From 3ed6495025c14008c7851c600be60809bf72445e Mon Sep 17 00:00:00 2001 From: SeungWon Date: Sat, 11 May 2024 10:30:35 -0700 Subject: [PATCH] :bug: add logic in liked service --- src/likes/likes.service.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/likes/likes.service.ts b/src/likes/likes.service.ts index 1fe251a8f4..a1692a4a42 100644 --- a/src/likes/likes.service.ts +++ b/src/likes/likes.service.ts @@ -28,6 +28,17 @@ export class LikesService { } async likeProfile(profileId: number, userId: number): Promise { + const liked = await this.likesRepository.findOne({ + where: { + profileId: profileId, + user: { + id: userId, + }, + }, + }); + if (liked) { + return liked; + } const user: User = await this.userService.findOneById(userId); const newLike: Likes = this.likesRepository.create({ profileId,