Skip to content

Commit

Permalink
refactor(live-shop): abstrai type
Browse files Browse the repository at this point in the history
  • Loading branch information
simaomeyrerdooca committed Jul 5, 2024
1 parent 3cbd4e5 commit 6cf02b8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/modules/live-shop/LiveShopRepositoryGql.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import { getClient } from '../../services/GraphqlService'
import { LiveShopQueries } from './LiveShopQueries'
import { LiveShop, LiveShopFields, LiveShopResponse } from './LiveShopTypes'
import { LiveShop, LiveShopFields, LiveShopFilter, LiveShopResponse } from './LiveShopTypes'

export class LiveShopRepositoryGql {
static async getOne(
filter: { filter: { id?: number; hash?: string; slug?: string } },
fields?: LiveShopFields[]
): Promise<LiveShop> {
static async getOne(filter: { filter: LiveShopFilter }, fields?: LiveShopFields[]): Promise<LiveShop> {
const liveShopQuery = new LiveShopQueries(fields)
const fullQuery: string = liveShopQuery.getOneFullQuery()
const { liveShop }: LiveShopResponse = await getClient().query(fullQuery, { ...filter })
Expand Down
5 changes: 5 additions & 0 deletions src/modules/live-shop/LiveShopTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ export type LiveShopFields =
| 'createdAt'
| 'updatedAt'

export interface LiveShopFilter {
id?: number
hash?: string
slug?: string
}
export interface LiveShopImage {
src: string
alt: string
Expand Down

0 comments on commit 6cf02b8

Please sign in to comment.