From a23986d4359fa059545c0e7eeef963c6a1cb29be Mon Sep 17 00:00:00 2001 From: shafi54 <108669266+shafi-aviz@users.noreply.github.com> Date: Thu, 29 Jan 2026 14:56:10 +0530 Subject: [PATCH] enh --- apps/admin-ui/components/SlotForm.tsx | 6 ++++-- apps/backend/src/stores/product-store.ts | 1 + apps/backend/src/trpc/common-apis/common.ts | 4 +++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/apps/admin-ui/components/SlotForm.tsx b/apps/admin-ui/components/SlotForm.tsx index 9894084..0a980da 100644 --- a/apps/admin-ui/components/SlotForm.tsx +++ b/apps/admin-ui/components/SlotForm.tsx @@ -128,11 +128,13 @@ export default function SlotForm({ // Remove duplicates const groupProductIds = [...new Set(allGroupProductIds)]; - const productOptions: DropdownOption[] = products.map(product => ({ + const productOptions: DropdownOption[] = products.map(product => { + + return { label: `${product.name}${groupProductIds.includes(product.id) ? ' (from group)' : ''}`, value: product.id.toString(), disabled: groupProductIds.includes(product.id), - })); + }}); const groupOptions: DropdownOption[] = (groupsData?.groups || []).map(group => ({ label: group.groupName, diff --git a/apps/backend/src/stores/product-store.ts b/apps/backend/src/stores/product-store.ts index 6d38c70..d7a516d 100644 --- a/apps/backend/src/stores/product-store.ts +++ b/apps/backend/src/stores/product-store.ts @@ -136,6 +136,7 @@ export async function initializeProducts(): Promise { specialDeals: specialDeals.map(d => ({ quantity: d.quantity.toString(), price: d.price.toString(), validTill: d.validTill })), productTags: productTags, }; + await redisClient.set(`product:${product.id}`, JSON.stringify(productObj)); } diff --git a/apps/backend/src/trpc/common-apis/common.ts b/apps/backend/src/trpc/common-apis/common.ts index d27c6c6..423c1b1 100644 --- a/apps/backend/src/trpc/common-apis/common.ts +++ b/apps/backend/src/trpc/common-apis/common.ts @@ -52,7 +52,8 @@ export const commonRouter = router({ // Get all products from cache let products = await getAllProductsFromCache(); - + products = products.filter(item => Boolean(item.id)) + // Apply tag filtering if tagId is provided if (tagId) { // Get products that have this tag from the database @@ -119,6 +120,7 @@ export const commonRouter = router({ }) ); + return { products: formattedProducts, count: formattedProducts.length,