Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/common/swagger/user.json
Original file line number Diff line number Diff line change
Expand Up @@ -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":{
Expand Down
7 changes: 6 additions & 1 deletion src/user/repository/user.repository.js
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,11 @@ export const UserRepository = {
orderBy: {createdAt:"desc"},
});
},

// artistId로 팔로워 조회하기
async CountArtistFollower(artistId){
return await prisma.follow.count({
where:{artistId:artistId},
})
}
};

3 changes: 3 additions & 0 deletions src/user/service/user.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -441,6 +443,7 @@ export const UserService = {

return {
...profile,
followerCount: followercount,
reviews,
commissions:commissionList,
badges
Expand Down