food
This commit is contained in:
@@ -29,17 +29,15 @@ export class FoodService {
|
||||
noon: rest.noon ?? false,
|
||||
dinner: rest.dinner ?? false,
|
||||
// pickup/stock
|
||||
isPickup: rest.isPickup ?? false,
|
||||
stock: rest.stock ?? 0,
|
||||
stockDefault: rest.stockDefault ?? 0,
|
||||
isActive: rest.isActive ?? true,
|
||||
inPlaceServe: rest.inPlaceServe ?? false,
|
||||
pickupServe: rest.pickupServe ?? false,
|
||||
rate: rest.rate ?? 0,
|
||||
discount: rest.discount ?? 0,
|
||||
// map single-title/content DTO to localized fields
|
||||
titleFa: rest.title,
|
||||
contentFa: rest.content,
|
||||
title: rest.title,
|
||||
content: rest.content,
|
||||
// numeric/array fields
|
||||
price: rest.price ?? 0,
|
||||
points: rest.points ?? 0,
|
||||
@@ -47,7 +45,10 @@ export class FoodService {
|
||||
images: rest.images ?? undefined,
|
||||
} as RequiredEntityData<Food>;
|
||||
|
||||
const food = this.foodRepository.create(data);
|
||||
const food = this.foodRepository.create(data) as Food;
|
||||
if (!food) {
|
||||
throw new Error('Failed to create food entity');
|
||||
}
|
||||
|
||||
// attach categories if provided
|
||||
if (categoryIds && categoryIds.length) {
|
||||
|
||||
Reference in New Issue
Block a user