File tree Expand file tree Collapse file tree 2 files changed +17
-7
lines changed
Expand file tree Collapse file tree 2 files changed +17
-7
lines changed Original file line number Diff line number Diff line change @@ -215,7 +215,8 @@ export const UserRepository = {
215215 select :{
216216 id :true ,
217217 nickname :true ,
218- profileImage :true
218+ profileImage :true ,
219+ _count : { select : { follows : true } }
219220 }
220221 }
221222 }
Original file line number Diff line number Diff line change @@ -164,9 +164,9 @@ export const UserService = {
164164 console . log ( "userBadges 확인:" , result . userBadges ) ;
165165
166166 const badges = result . userBadges . map ( ( userBadge ) => ( {
167- id : userBadge . id ,
168- earnedAt : userBadge . earnedAt ,
169- badge : userBadge . badge ? [ userBadge . badge ] : [ ]
167+ id : userBadge . id ,
168+ earnedAt : userBadge . earnedAt ,
169+ badge : userBadge . badge ? [ userBadge . badge ] : [ ]
170170 } ) ) ;
171171
172172 return {
@@ -317,12 +317,21 @@ export const UserService = {
317317
318318 // 사용자가 팔로우한 작가 조회하기
319319 async LookUserFollow ( accountId ) {
320- const artistList = await UserRepository . LookUserFollow ( accountId ) ;
320+ const rows = await UserRepository . LookUserFollow ( accountId ) ;
321321
322- if ( artistList . length === 0 ) return {
322+ if ( ! rows ? .length ) return {
323323 message :"팔로우하는 작가가 없습니다." ,
324324 artistList :[ ]
325- } ;
325+ }
326+
327+ const artistList = rows . map ( r => ( {
328+ artist :{
329+ id : r . artist . id ,
330+ nickname :r . artist . nickname ,
331+ profileImage :r . artist . profileImage ,
332+ followerCount : r . artist . _count . follows
333+ }
334+ } ) ) ;
326335
327336 return {
328337 message :"사용자가 팔로우하는 작가 목록입니다." ,
You can’t perform that action at this time.
0 commit comments