enh
This commit is contained in:
parent
77e2d92d71
commit
a23986d435
3 changed files with 8 additions and 3 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -136,6 +136,7 @@ export async function initializeProducts(): Promise<void> {
|
|||
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));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue