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
|
// Remove duplicates
|
||||||
const groupProductIds = [...new Set(allGroupProductIds)];
|
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)' : ''}`,
|
label: `${product.name}${groupProductIds.includes(product.id) ? ' (from group)' : ''}`,
|
||||||
value: product.id.toString(),
|
value: product.id.toString(),
|
||||||
disabled: groupProductIds.includes(product.id),
|
disabled: groupProductIds.includes(product.id),
|
||||||
}));
|
}});
|
||||||
|
|
||||||
const groupOptions: DropdownOption[] = (groupsData?.groups || []).map(group => ({
|
const groupOptions: DropdownOption[] = (groupsData?.groups || []).map(group => ({
|
||||||
label: group.groupName,
|
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 })),
|
specialDeals: specialDeals.map(d => ({ quantity: d.quantity.toString(), price: d.price.toString(), validTill: d.validTill })),
|
||||||
productTags: productTags,
|
productTags: productTags,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
await redisClient.set(`product:${product.id}`, JSON.stringify(productObj));
|
await redisClient.set(`product:${product.id}`, JSON.stringify(productObj));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,8 @@ export const commonRouter = router({
|
||||||
|
|
||||||
// Get all products from cache
|
// Get all products from cache
|
||||||
let products = await getAllProductsFromCache();
|
let products = await getAllProductsFromCache();
|
||||||
|
products = products.filter(item => Boolean(item.id))
|
||||||
|
|
||||||
// Apply tag filtering if tagId is provided
|
// Apply tag filtering if tagId is provided
|
||||||
if (tagId) {
|
if (tagId) {
|
||||||
// Get products that have this tag from the database
|
// Get products that have this tag from the database
|
||||||
|
|
@ -119,6 +120,7 @@ export const commonRouter = router({
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
products: formattedProducts,
|
products: formattedProducts,
|
||||||
count: formattedProducts.length,
|
count: formattedProducts.length,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue