From 2b5d46d165e84a572099517b84c687675a90e659 Mon Sep 17 00:00:00 2001 From: nfesta2023 <142601504+nfesta2023@users.noreply.github.com> Date: Fri, 5 Jan 2024 10:20:00 +0700 Subject: [PATCH] FES-22-database-modify-table-basic-customization (#28) * adjust data for the basic customization Co-authored-by: NHT --- src/dto/food-detail.dto.ts | 2 +- src/entity/basic-customization.entity.ts | 20 ++++++++------------ src/feature/food/food.service.ts | 2 +- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/dto/food-detail.dto.ts b/src/dto/food-detail.dto.ts index 741d7d2..9e81346 100644 --- a/src/dto/food-detail.dto.ts +++ b/src/dto/food-detail.dto.ts @@ -28,6 +28,6 @@ class Ingredient { } class BasicCustomization { - basic_customization_id: string; + no_adding_id: string; description: TextByLang[]; } diff --git a/src/entity/basic-customization.entity.ts b/src/entity/basic-customization.entity.ts index a9bf7f6..0636cc9 100644 --- a/src/entity/basic-customization.entity.ts +++ b/src/entity/basic-customization.entity.ts @@ -1,21 +1,17 @@ -import { - Entity, - CreateDateColumn, - PrimaryGeneratedColumn, - Column, - OneToMany, -} from 'typeorm'; +import { Entity, CreateDateColumn, OneToMany, PrimaryColumn } from 'typeorm'; import { NoAddingExt } from './no-adding-ext.entity'; @Entity('Basic_Customization') export class BasicCustomization { - @PrimaryGeneratedColumn() - public basic_customization_id: number; - - @Column({ type: 'int', nullable: false, unique: false }) + @PrimaryColumn({ type: 'int', nullable: false, unique: false }) public menu_item_id: number; - @Column({ type: 'varchar', length: 45, nullable: true, unique: false }) + @PrimaryColumn({ + type: 'varchar', + length: 45, + nullable: false, + unique: false, + }) public no_adding_id: string; @CreateDateColumn({ diff --git a/src/feature/food/food.service.ts b/src/feature/food/food.service.ts index 69abacf..a51f055 100644 --- a/src/feature/food/food.service.ts +++ b/src/feature/food/food.service.ts @@ -187,7 +187,7 @@ export class FoodService { const convertedBasicCustomization = []; for (const basic of basicCustomization) { const customizedItem = { - basic_customization_id: basic.basic_customization_id, + no_adding_id: basic.no_adding_id, description: basic.extension.map((ext) => { return { ISO_language_code: ext.ISO_language_code,