enh
This commit is contained in:
parent
d95a663d97
commit
1f801f2146
1 changed files with 7 additions and 0 deletions
|
|
@ -6,6 +6,7 @@ import { ApiError } from "../lib/api-error";
|
|||
import { imageUploadS3, getOriginalUrlFromSignedUrl } from "../lib/s3-client";
|
||||
import { deleteS3Image } from "../lib/delete-image";
|
||||
import type { SpecialDeal } from "../db/types";
|
||||
import { initializeAllStores } from '../stores/store-initializer';
|
||||
|
||||
type CreateDeal = {
|
||||
quantity: number;
|
||||
|
|
@ -106,6 +107,9 @@ export const createProduct = async (req: Request, res: Response) => {
|
|||
await db.insert(productTags).values(tagAssociations);
|
||||
}
|
||||
|
||||
// Reinitialize stores to reflect changes
|
||||
await initializeAllStores();
|
||||
|
||||
return res.status(201).json({
|
||||
product: newProduct,
|
||||
deals: createdDeals,
|
||||
|
|
@ -290,6 +294,9 @@ export const updateProduct = async (req: Request, res: Response) => {
|
|||
await db.insert(productTags).values(tagAssociations);
|
||||
}
|
||||
|
||||
// Reinitialize stores to reflect changes
|
||||
await initializeAllStores();
|
||||
|
||||
return res.status(200).json({
|
||||
product: updatedProduct,
|
||||
message: "Product updated successfully",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue