This commit is contained in:
2026-02-09 12:51:21 +03:30
parent a01dba1508
commit c9c42db698
@@ -180,7 +180,7 @@ export class ProductService {
const product = await this.findOrFail(id) const product = await this.findOrFail(id)
if (product.shop.id !== shopId) { if (product.shop.id !== shopId) {
throw new BadRequestException("Product doesnt belongs to you") throw new BadRequestException("Product doesnt belongs to your shop")
} }
product.deletedAt = new Date(); product.deletedAt = new Date();
@@ -194,13 +194,13 @@ export class ProductService {
const favorite = await this.em.findOne(Favorite, { user: userId, product: productId }); const favorite = await this.em.findOne(Favorite, { user: userId, product: productId });
if (favorite) { if (favorite) {
return this.em.removeAndFlush(favorite); return await this.em.removeAndFlush(favorite);
} }
const newFavorite = this.em.create(Favorite, { const newFavorite = this.em.create(Favorite, {
user: userId, user: userId,
product: productId, product: productId,
}); });
return this.em.persistAndFlush(newFavorite); return await this.em.persistAndFlush(newFavorite);
} }