Skip to content

Commit

Permalink
change ProductCollectionResponseData to ProductCollectionSaved
Browse files Browse the repository at this point in the history
  • Loading branch information
weronika-kurczyna committed Oct 4, 2023
1 parent 265d706 commit 7b94bfb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 18 deletions.
29 changes: 15 additions & 14 deletions packages/sdk/src/types/ProductCollections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@ type WithRequiredProperty<Type, Key extends keyof Type> = Type &

export interface ProductIdentity {
id?: string
object?: 'product'
}

export interface SkuIdentity {
id?: string
product_id?: string
object?: 'sku'
}

export interface ProductBase {
Expand All @@ -34,37 +32,42 @@ export interface SkuBase {
image_url?: string | null
}

export interface ProductResponseData {
export interface ProductSaved {
created_at?: string
updated_at?: string | null
image_url?: string | null
object?: 'product'
}

export interface SkuResponseData {
export interface SkuSaved {
created_at?: string
updated_at?: string | null
image_url?: string | null
object?: 'sku'
}

export type Product = Required<SkuIdentity> | Required<ProductIdentity>

export type ProductInCollection = Required<ProductIdentity> &
Required<ProductResponseData> &
Required<ProductSaved> &
Required<ProductBase> & { source_id: string | null }

export type SkuInCollection = Required<SkuIdentity> & Required<SkuBase> & SkuResponseData & { source_id: string | null }
export type SkuInCollection = Required<SkuIdentity> &
Required<SkuSaved> &
Required<SkuBase> & { source_id: string | null }

export type ProductInCollectionItem = Required<ProductIdentity> & Required<ProductBase> & { source_id: string | null }
export type ProductInCollectionItem = Required<ProductIdentity> &
Required<ProductBase> & { source_id: string | null; object: 'product' }

// Product Collection

export interface ProductCollectionIdentity {
id?: string
object?: 'products_collection'
}

export interface ProductCollectionResponseData {
export interface ProductCollectionSaved {
created_at?: string
object?: 'products_collection'
}

export type ProductCollectionBase = Required<StaticProductCollectionBase> | Required<DynamicProductCollectionBase>
Expand Down Expand Up @@ -136,7 +139,7 @@ export type ProductCollectionsCreateRequestBody =

export type ProductCollectionsCreateResponseBody = ProductCollectionBase &
Required<ProductCollectionIdentity> &
Required<ProductCollectionResponseData>
Required<ProductCollectionSaved>

// list
export interface ProductCollectionsListRequestQuery {
Expand All @@ -148,17 +151,15 @@ export interface ProductCollectionsListRequestQuery {
export interface ProductCollectionsListResponseBody {
object: 'list'
data_ref: 'data'
data: (Required<ProductCollectionBase> &
Required<ProductCollectionIdentity> &
Required<ProductCollectionResponseData>)[]
data: (Required<ProductCollectionBase> & Required<ProductCollectionIdentity> & Required<ProductCollectionSaved>)[]
total: number
}

// get

export type ProductCollectionsGetResponseBody = ProductCollectionBase &
Required<ProductCollectionIdentity> &
Required<ProductCollectionResponseData>
Required<ProductCollectionSaved>

// list products
export interface ProductCollectionsListProductsRequestQuery {
Expand Down
4 changes: 0 additions & 4 deletions packages/sdk/test/productCollections.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import { voucherifyClient as client } from './client'
// import { asyncMap } from './utils/asyncMap'
// import { CreateProductCollectionStaticProduct } from '../src/types/ProductCollections'
import { generateRandomString } from './utils/generateRandomString'
import { isoRegex } from './utils/isoRegex'
// import { isoRegex } from './utils/isoRegex'
// import { generateRandomString } from './utils/generateRandomString'

describe('Product Collections API', () => {
it('should create 3 products and create STATIC collection of those products, then delete it', async () => {
Expand Down

0 comments on commit 7b94bfb

Please sign in to comment.