fix: bug
This commit is contained in:
@@ -13,7 +13,7 @@ export function databaseConfigs(): TypeOrmModuleAsyncOptions {
|
|||||||
username: configService.getOrThrow<string>("DB_USER"),
|
username: configService.getOrThrow<string>("DB_USER"),
|
||||||
password: configService.getOrThrow<string>("DB_PASS"),
|
password: configService.getOrThrow<string>("DB_PASS"),
|
||||||
autoLoadEntities: true,
|
autoLoadEntities: true,
|
||||||
synchronize: configService.getOrThrow<string>("NODE_ENV") == "production" ? false : false,
|
synchronize: configService.getOrThrow<string>("NODE_ENV") == "production" ? false : true,
|
||||||
logging: configService.getOrThrow<string>("NODE_ENV") == "production" ? false : true,
|
logging: configService.getOrThrow<string>("NODE_ENV") == "production" ? false : true,
|
||||||
migrationsTableName: "typeorm_migrations",
|
migrationsTableName: "typeorm_migrations",
|
||||||
migrationsRun: false,
|
migrationsRun: false,
|
||||||
|
|||||||
@@ -9,5 +9,5 @@ export class CriticismFile extends BaseEntity {
|
|||||||
fileUrl: string;
|
fileUrl: string;
|
||||||
|
|
||||||
@ManyToOne(() => Criticism, (criticism) => criticism.files, { nullable: false, onDelete: "CASCADE" })
|
@ManyToOne(() => Criticism, (criticism) => criticism.files, { nullable: false, onDelete: "CASCADE" })
|
||||||
criticism: Criticism[];
|
criticism: Criticism;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,7 +90,8 @@ export class CriticismsService {
|
|||||||
|
|
||||||
async delete(id: string) {
|
async delete(id: string) {
|
||||||
const criticism = await this.criticismRepository.findOneBy({ id });
|
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);
|
await this.criticismRepository.remove(criticism);
|
||||||
return {
|
return {
|
||||||
message: CommonMessage.DELETED,
|
message: CommonMessage.DELETED,
|
||||||
|
|||||||
Reference in New Issue
Block a user