diff --git a/BE/src/diaries/diaries.module.ts b/BE/src/diaries/diaries.module.ts index 1a450d3..8a9dd4e 100644 --- a/BE/src/diaries/diaries.module.ts +++ b/BE/src/diaries/diaries.module.ts @@ -10,10 +10,11 @@ import { ShapesModule } from "src/shapes/shapes.module"; import { ShapesRepository } from "src/shapes/shapes.repository"; import { TagsRepository } from "src/tags/tags.repository"; import { HttpModule } from "@nestjs/axios"; +import { Line } from "src/lines/lines.entity"; @Module({ imports: [ - TypeOrmModule.forFeature([Diary]), + TypeOrmModule.forFeature([Diary, Line]), AuthModule, TagsModule, ShapesModule, diff --git a/BE/src/diaries/diaries.repository.ts b/BE/src/diaries/diaries.repository.ts index c127e28..468bc62 100644 --- a/BE/src/diaries/diaries.repository.ts +++ b/BE/src/diaries/diaries.repository.ts @@ -1,4 +1,5 @@ import { User } from "src/auth/users.entity"; +import { Line } from "src/lines/lines.entity"; import { CreateDiaryDto, DeleteDiaryDto, @@ -98,7 +99,15 @@ export class DiariesRepository { async deleteDiary(deleteDiaryDto: DeleteDiaryDto): Promise { const { uuid } = deleteDiaryDto; - const diary = await this.getDiaryByUuid(uuid); + const diary: Diary = await this.getDiaryByUuid(uuid); + + const lines = await Line.find({ + where: [ + { firstDiary: { id: diary.id } }, + { secondDiary: { id: diary.id } }, + ], + }); + await Line.softRemove(lines); await Diary.softRemove(diary); }