Skip to content

Commit ae23570

Browse files
committed
FIX : 팔로우하는 작가 목록 조회 버그 수정
1 parent 3649910 commit ae23570

3 files changed

Lines changed: 18 additions & 18 deletions

File tree

src/user/controller/user.controller.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,14 @@ export const FollowArtist = async(req, res, next) => {
129129
// 작가 팔로우 취소하기
130130
export const CancelArtistFollow = async(req, res, next) => {
131131
try{
132-
console.log("Decoded JWT from req.user:", req.user);
132+
console.log("💟Decoded JWT from req.user:", req.user);
133133

134-
const userId = req.user.userId.toString();
135-
console.log("userId : ", userId);
134+
const accountId = req.user.accountId.toString();
135+
console.log("작가 팔로우 취소하기 accountId : ", accountId);
136136

137137
const artistId = req.params.artistId;
138138

139-
const result = await UserService.CancelArtistFollow(userId, artistId);
139+
const result = await UserService.CancelArtistFollow(accountId, artistId);
140140

141141
res.status(StatusCodes.OK).success(result);
142142
} catch(err) {
@@ -147,12 +147,12 @@ export const CancelArtistFollow = async(req, res, next) => {
147147
// 사용자가 팔로우 한 작가 조회하기
148148
export const LookUserFollow = async(req, res, next) => {
149149
try{
150-
console.log("Decoded JWT from req.user:", req.user);
150+
console.log("🦁Decoded JWT from req.user:", req.user);
151151

152-
const userId = req.user.userId.toString();
153-
console.log("userId : ", userId);
152+
const accountId = req.user.accountId.toString();
153+
console.log("팔로우하는 작가 목록 조회 accountId : ", accountId);
154154

155-
const result = await UserService.LookUserFollow(userId);
155+
const result = await UserService.LookUserFollow(accountId);
156156

157157
res.status(StatusCodes.OK).success(result);
158158
}catch(err) {

src/user/repository/user.repository.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,22 +180,22 @@ export const UserRepository = {
180180
},
181181

182182
// 작가 팔로우 취소하기
183-
async CancelArtistFollow(userId, artistId) {
183+
async CancelArtistFollow(accountId, artistId) {
184184
return await prisma.follow.delete({
185185
where:{
186-
userId_artistId:{
187-
userId,
186+
accountId_artistId:{
187+
accountId,
188188
artistId
189189
}
190190
}
191191
});
192192
},
193193

194194
// 사용자가 팔로우한 작가 조회하기
195-
async LookUserFollow(userId){
195+
async LookUserFollow(accountId){
196196
return await prisma.follow.findMany({
197197
where:{
198-
userId:userId
198+
accountId:accountId
199199
},
200200
select:{
201201
artist:{

src/user/service/user.service.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -256,18 +256,18 @@ export const UserService = {
256256
},
257257

258258
// 작가 팔로우 취소하기
259-
async CancelArtistFollow(userId, artistId) {
259+
async CancelArtistFollow(accountId, artistId) {
260260
const artist = await UserRepository.findArtistById(artistId);
261261

262262
if(!artist)
263263
throw new ArtistNotFound();
264264

265-
const FollowState = await UserRepository.AlreadyFollow(userId, artistId);
265+
const FollowState = await UserRepository.AlreadyFollow(accountId, artistId);
266266

267267
if(!FollowState)
268268
throw new NotFollowingArtist();
269269

270-
const result = await UserRepository.CancelArtistFollow(userId, artistId);
270+
const result = await UserRepository.CancelArtistFollow(accountId, artistId);
271271

272272
return {
273273
message: "해당 작가 팔로우를 취소했습니다.",
@@ -276,8 +276,8 @@ export const UserService = {
276276
},
277277

278278
// 사용자가 팔로우한 작가 조회하기
279-
async LookUserFollow(userId) {
280-
const artistList = await UserRepository.LookUserFollow(userId);
279+
async LookUserFollow(accountId) {
280+
const artistList = await UserRepository.LookUserFollow(accountId);
281281

282282
if(artistList.length === 0) return {
283283
message:"팔로우하는 작가가 없습니다.",

0 commit comments

Comments
 (0)