Skip to content

Commit e98d759

Browse files
authored
Merge pull request #135 from umc-commit/fix/front-user-artist-google
FEAT : 작가 프로필 목록 조회 commissionlist 부분 bookmark 추가
2 parents 341922a + c990594 commit e98d759

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

src/user/controller/user.controller.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ export const AccessArtistProfile = async(req, res, next) => {
181181
try{
182182
const artistId = req.params.artistId;
183183
const accountId = req.user.accountId;
184+
const userId = req.user.userId;
184185

185186
const result = await UserService.AccessArtistProfile(artistId, accountId);
186187

src/user/repository/user.repository.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ export const UserRepository = {
287287
})
288288
},
289289
// 작가가 등록한 커미션 목록 불러오기
290-
async FetchArtistCommissions(artistId) {
290+
async FetchArtistCommissions(artistId, userId) {
291291
return await prisma.commission.findMany({
292292
where: { artistId: artistId },
293293
select: {
@@ -302,6 +302,10 @@ export const UserRepository = {
302302
select: {
303303
tag: { select: { name: true } }
304304
}
305+
},
306+
bookmarks:{
307+
where:{userId},
308+
select:{id:true}
305309
}
306310
}
307311
});

src/user/service/user.service.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ export const UserService = {
343343
return await BadgeRepository.ViewUserBadges(accountId);
344344
},
345345
// 작가 프로필 조회하기
346-
async AccessArtistProfile(artistId, accountId) {
346+
async AccessArtistProfile(artistId, accountId, userId) {
347347
const profile = await UserRepository.AccessArtistProfile(artistId);
348348
const rawReviews = await UserRepository.ArtistReviews(artistId);
349349

@@ -371,15 +371,16 @@ export const UserService = {
371371
}});
372372

373373
// 작가가 등록한 커미션 목록
374-
const commissions = await UserRepository.FetchArtistCommissions(artistId);
374+
const commissions = await UserRepository.FetchArtistCommissions(artistId, userId);
375375
const commissionList = commissions.map(c=> ({
376376
id: c.id,
377377
title: c.title,
378378
summary: c.summary,
379379
minPrice: c.minPrice,
380380
category: c.category.name,
381381
tags: c.commissionTags.map(t => t.tag.name),
382-
thumbnail: c.thumbnailImage // 컬럼 존재 시
382+
thumbnail: c.thumbnailImage, // 컬럼 존재 시
383+
bookmark: c.bookmarks.length > 0
383384
}));
384385

385386

0 commit comments

Comments
 (0)