Use GBP price as the store-readiness signal
Setting a GBP price in Directus is the intentional signal that an artwork is for sale. USD-only items (264 with images) are imported historical catalog data not meant for the store. The store now shows the 19 artworks that have name + image + GBP price set. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
474470900f
commit
da7747610c
|
|
@ -241,17 +241,15 @@ export async function getArtworks(options?: {
|
|||
forSale?: boolean;
|
||||
}): Promise<Artwork[]> {
|
||||
// When forSale is true, build a compound filter requiring:
|
||||
// - name set, image set, and at least one price (GBP or USD) > 0
|
||||
// This means artworks automatically appear in the store once their
|
||||
// required fields are populated, and disappear when status changes to sold/archived.
|
||||
// - name set, image uploaded, and GBP price set (> 0)
|
||||
// Setting a GBP price is the signal that an artwork is for sale.
|
||||
// Artworks automatically appear in the store once these fields are populated
|
||||
// in Directus, and move to sold section when status changes to 'sold'.
|
||||
if (options?.forSale) {
|
||||
const conditions: Record<string, unknown>[] = [
|
||||
{ name: { _nnull: true, _nempty: true } },
|
||||
{ image: { _nnull: true } },
|
||||
{ _or: [
|
||||
{ price_gbp: { _gt: 0 } },
|
||||
{ price_usd: { _gt: 0 } },
|
||||
]},
|
||||
];
|
||||
if (options?.status) conditions.push({ status: { _eq: options.status } });
|
||||
if (options?.series) conditions.push({ series: { _eq: options.series } });
|
||||
|
|
|
|||
Loading…
Reference in New Issue