fix : update product : approved
This commit is contained in:
@@ -485,7 +485,34 @@ class ProductService {
|
||||
{
|
||||
imagesUrl,
|
||||
// step: CreateProductStep.Image,
|
||||
// status: ProductStatus.Pending,
|
||||
status: ProductStatus.Approved,
|
||||
},
|
||||
{ new: true },
|
||||
);
|
||||
|
||||
return {
|
||||
message: ProductMessage.ProductUpdated,
|
||||
updatedProduct,
|
||||
};
|
||||
}
|
||||
|
||||
async updateProductFinalStepForSeller(updateFinalStepDto: UpdateProductFinalStepDTO, ownerId: string) {
|
||||
const product = await this.validateProduct(updateFinalStepDto.productId, ownerId);
|
||||
|
||||
// ensure the product is in draft status
|
||||
this.ensureDraftStatus(product.status);
|
||||
|
||||
// ensure the step is correct
|
||||
// this.ensureCorrectStep(product.step, CreateProductStep.Image);
|
||||
|
||||
const imagesUrl = { cover: updateFinalStepDto.coverImage, list: updateFinalStepDto.imagesList };
|
||||
|
||||
const updatedProduct = await this.productRepo.model.findByIdAndUpdate(
|
||||
updateFinalStepDto.productId,
|
||||
{
|
||||
imagesUrl,
|
||||
// step: CreateProductStep.Image,
|
||||
status: ProductStatus.Pending,
|
||||
},
|
||||
{ new: true },
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user