From e70dd24d0f323496898915bd99777317605d5e8b Mon Sep 17 00:00:00 2001 From: taeyoung0524 Date: Tue, 19 Aug 2025 00:39:02 +0900 Subject: [PATCH 1/2] =?UTF-8?q?REFACTOR=20:=20=EC=9E=91=EA=B0=80=20?= =?UTF-8?q?=ED=94=84=EB=A1=9C=ED=95=84=20=EC=A1=B0=ED=9A=8C=EC=97=90=20fol?= =?UTF-8?q?lowercount=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/user/repository/user.repository.js | 7 ++++++- src/user/service/user.service.js | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/user/repository/user.repository.js b/src/user/repository/user.repository.js index 1c57d68..6360bcc 100644 --- a/src/user/repository/user.repository.js +++ b/src/user/repository/user.repository.js @@ -326,6 +326,11 @@ export const UserRepository = { orderBy: {createdAt:"desc"}, }); }, - + // artistId로 팔로워 조회하기 + async CountArtistFollower(artistId){ + return await prisma.follow.count({ + where:{artistId:artistId}, + }) + } }; diff --git a/src/user/service/user.service.js b/src/user/service/user.service.js index 258b652..9dcebf6 100644 --- a/src/user/service/user.service.js +++ b/src/user/service/user.service.js @@ -371,6 +371,8 @@ export const UserService = { async AccessArtistProfile(artistId, accountId, userId) { const profile = await UserRepository.AccessArtistProfile(artistId); + const followercount = await UserRepository.CountArtistFollower(artistId); + if(!profile) throw new ArtistNotFound(); @@ -441,6 +443,7 @@ export const UserService = { return { ...profile, + followerCount: followercount, reviews, commissions:commissionList, badges From 33dc39ef481f1f4b2ef867885ce2f39d9aaeb76a Mon Sep 17 00:00:00 2001 From: taeyoung0524 Date: Tue, 19 Aug 2025 00:40:30 +0900 Subject: [PATCH 2/2] =?UTF-8?q?REFACTOR=20:=20=EC=9E=91=EA=B0=80=20?= =?UTF-8?q?=ED=94=84=EB=A1=9C=ED=95=84=20=EC=A1=B0=ED=9A=8C=20swagger=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/swagger/user.json | 1 + 1 file changed, 1 insertion(+) diff --git a/src/common/swagger/user.json b/src/common/swagger/user.json index 4e9b817..9501bd9 100644 --- a/src/common/swagger/user.json +++ b/src/common/swagger/user.json @@ -755,6 +755,7 @@ "description":{"type":"string", "example":"테스트용 작가입니다."}, "profileImage":{"type": "string", "example":"https://example.com/artist1.png"}, "slot":{"type": "integer", "example":3}, + "followerCount":{"type":"integer", "example":3}, "reviews":{ "type":"array", "items":{