diff --git a/BE/src/timelines/timelines.controller.ts b/BE/src/timelines/timelines.controller.ts index 4289922..c918d92 100644 --- a/BE/src/timelines/timelines.controller.ts +++ b/BE/src/timelines/timelines.controller.ts @@ -162,8 +162,15 @@ export class TimelinesController { description: 'id에 해당하는 타임라인을 반환합니다.', }) @ApiOkResponse({ schema: { example: findOne_OK } }) - async findOne(@Param('id', ParseUUIDPipe) id: string): Promise { - return this.timelinesService.findOneWithURL(id); + async findOne(@Req() request, @Param('id', ParseUUIDPipe) id: string) { + const timeline = await this.timelinesService.findOneWithURL(id); + delete timeline.posting.writer.resourceId; + delete timeline.posting.writer.socialType; + delete timeline.posting.writer.allowedIp; + delete timeline.posting.writer.bannedIp; + + const userId = request['user'].id; + return { ...timeline, isOwner: timeline.posting.writer.id === userId }; } @Put(':id') diff --git a/BE/src/timelines/timelines.repository.ts b/BE/src/timelines/timelines.repository.ts index 4448c33..fd4005f 100644 --- a/BE/src/timelines/timelines.repository.ts +++ b/BE/src/timelines/timelines.repository.ts @@ -15,10 +15,12 @@ export class TimelinesRepository { } async findOne(id: string) { - return this.timelineRepository.findOne({ - where: { id }, - relations: { posting: true }, - }); + return this.timelineRepository + .createQueryBuilder('t') + .leftJoinAndSelect('t.posting', 'p') + .leftJoinAndSelect('p.writer', 'u') + .where('t.id = :id', { id }) + .getOne(); } async findAll(posting: string, day: number) {