Skip to content

Commit 6cf02b8

Browse files
refactor(live-shop): abstrai type
1 parent 3cbd4e5 commit 6cf02b8

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/modules/live-shop/LiveShopRepositoryGql.ts

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
import { getClient } from '../../services/GraphqlService'
22
import { LiveShopQueries } from './LiveShopQueries'
3-
import { LiveShop, LiveShopFields, LiveShopResponse } from './LiveShopTypes'
3+
import { LiveShop, LiveShopFields, LiveShopFilter, LiveShopResponse } from './LiveShopTypes'
44

55
export class LiveShopRepositoryGql {
6-
static async getOne(
7-
filter: { filter: { id?: number; hash?: string; slug?: string } },
8-
fields?: LiveShopFields[]
9-
): Promise<LiveShop> {
6+
static async getOne(filter: { filter: LiveShopFilter }, fields?: LiveShopFields[]): Promise<LiveShop> {
107
const liveShopQuery = new LiveShopQueries(fields)
118
const fullQuery: string = liveShopQuery.getOneFullQuery()
129
const { liveShop }: LiveShopResponse = await getClient().query(fullQuery, { ...filter })

src/modules/live-shop/LiveShopTypes.ts

+5
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ export type LiveShopFields =
1414
| 'createdAt'
1515
| 'updatedAt'
1616

17+
export interface LiveShopFilter {
18+
id?: number
19+
hash?: string
20+
slug?: string
21+
}
1722
export interface LiveShopImage {
1823
src: string
1924
alt: string

0 commit comments

Comments
 (0)