Add used-product flag for store listings.
Merchants can mark items as used on create/edit, see a used badge on cards, and filter the store list for used products. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
32f0dbab63
commit
61d145d92e
@@ -26,6 +26,7 @@ export interface StoreItem {
|
||||
stockQuantity: number | null
|
||||
rewardPoints: number | null
|
||||
isFestival: boolean
|
||||
isUsed: boolean
|
||||
sortOrder: number
|
||||
createdAt: string
|
||||
updatedAt: string
|
||||
@@ -48,6 +49,7 @@ export interface CreateStoreItemPayload {
|
||||
|
||||
export interface BatchCreateStoreItemsPayload {
|
||||
productId: string
|
||||
isUsed?: boolean
|
||||
items: CreateStoreItemPayload[]
|
||||
}
|
||||
|
||||
@@ -74,6 +76,7 @@ export interface SyncStoreItemRowPayload {
|
||||
|
||||
export interface SyncProductStoreItemsPayload {
|
||||
productId: string
|
||||
isUsed?: boolean
|
||||
items: SyncStoreItemRowPayload[]
|
||||
removedIds: string[]
|
||||
}
|
||||
@@ -95,7 +98,7 @@ export async function listStoreItems(
|
||||
page = 1,
|
||||
pageSize = 20,
|
||||
signal?: AbortSignal,
|
||||
filters?: { name?: string },
|
||||
filters?: { name?: string; isUsed?: boolean },
|
||||
) {
|
||||
const params = new URLSearchParams({
|
||||
page: String(page),
|
||||
@@ -104,6 +107,9 @@ export async function listStoreItems(
|
||||
if (filters?.name?.trim()) {
|
||||
params.set('name', filters.name.trim())
|
||||
}
|
||||
if (filters?.isUsed) {
|
||||
params.set('isUsed', 'true')
|
||||
}
|
||||
|
||||
return apiRequest<StoreItemsListResponse>(
|
||||
`${businessPath()}?${params.toString()}`,
|
||||
|
||||
Reference in New Issue
Block a user