diff --git a/src/configs/typeorm.config.ts b/src/configs/typeorm.config.ts index 9391ab2..8d8378f 100755 --- a/src/configs/typeorm.config.ts +++ b/src/configs/typeorm.config.ts @@ -13,7 +13,7 @@ export function databaseConfigs(): TypeOrmModuleAsyncOptions { username: configService.getOrThrow("DB_USER"), password: configService.getOrThrow("DB_PASS"), autoLoadEntities: true, - synchronize: configService.getOrThrow("NODE_ENV") == "production" ? false : false, + synchronize: configService.getOrThrow("NODE_ENV") == "production" ? false : true, logging: configService.getOrThrow("NODE_ENV") == "production" ? false : true, migrationsTableName: "typeorm_migrations", migrationsRun: false, diff --git a/src/modules/criticisms/entities/criticism-file.entity.ts b/src/modules/criticisms/entities/criticism-file.entity.ts index b54d3d6..d4119c0 100755 --- a/src/modules/criticisms/entities/criticism-file.entity.ts +++ b/src/modules/criticisms/entities/criticism-file.entity.ts @@ -9,5 +9,5 @@ export class CriticismFile extends BaseEntity { fileUrl: string; @ManyToOne(() => Criticism, (criticism) => criticism.files, { nullable: false, onDelete: "CASCADE" }) - criticism: Criticism[]; + criticism: Criticism; } diff --git a/src/modules/criticisms/providers/criticisms.service.ts b/src/modules/criticisms/providers/criticisms.service.ts index 4f2caa7..95ad539 100755 --- a/src/modules/criticisms/providers/criticisms.service.ts +++ b/src/modules/criticisms/providers/criticisms.service.ts @@ -90,7 +90,8 @@ export class CriticismsService { async delete(id: string) { const criticism = await this.criticismRepository.findOneBy({ id }); - if (!criticism) throw new BadRequestException(); + if (!criticism) throw new BadRequestException(CriticismMessage.NOT_FOUND); + await this.criticismRepository.remove(criticism); return { message: CommonMessage.DELETED,