"implement product CRUD API endpoints and frontend integration"
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
// src/app/services/product.service.ts
|
||||
//
|
||||
// REQ0182 frontend product details
|
||||
//
|
||||
// PURPOSE:
|
||||
// - Service for handling ProductItem Record
|
||||
//
|
||||
@@ -65,11 +67,19 @@ type UpdateProduct = {
|
||||
};
|
||||
|
||||
async function listProducts(): Promise<ProductItem[]> {
|
||||
return prisma.productItem.findMany();
|
||||
return prisma.productItem.findMany({
|
||||
include: {
|
||||
reviews: true,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
async function getProduct(productId: string): Promise<ProductItem | null> {
|
||||
return prisma.productItem.findUnique({ where: { id: productId } });
|
||||
return prisma.productItem.findUnique({
|
||||
where: { id: productId },
|
||||
include: { reviews: true },
|
||||
//
|
||||
});
|
||||
}
|
||||
|
||||
async function createProduct(createForm: CreateProduct) {
|
||||
|
Reference in New Issue
Block a user