From 064f5402e8b85657c65163ef65b632198e9565d4 Mon Sep 17 00:00:00 2001 From: minsu Date: Thu, 5 Jun 2025 23:54:17 +0900 Subject: [PATCH] [Fix] --- config/cookie.js | 4 ++-- config/redis.js | 20 ++++++++++---------- repositorys/followRepository.js | 24 ++++++++++++------------ 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/config/cookie.js b/config/cookie.js index f58494c..cfae2f7 100644 --- a/config/cookie.js +++ b/config/cookie.js @@ -4,7 +4,7 @@ const accessTokenOption = { sameSite: 'None', maxAge: 1000 * 60 * 60 * 3, path: '/', - domain: '.sjcpop.com', + // domain: '.sjcpop.com', }; const refreshTokenOption = { @@ -13,7 +13,7 @@ const refreshTokenOption = { sameSite: 'None', maxAge: 1000 * 60 * 60 * 24 * 7, path: '/', - domain: '.sjcpop.com', + // domain: '.sjcpop.com', }; const clearAccessTokenOption = { diff --git a/config/redis.js b/config/redis.js index 223b22b..17ff67b 100644 --- a/config/redis.js +++ b/config/redis.js @@ -3,24 +3,24 @@ import dotenv from 'dotenv'; dotenv.config(); -const client = createClient({ - // username: process.env.REDIS_NAME, - // password: process.env.REDIS_SECRET, - socket: { - host: '10.178.0.2', - port: 6379, - }, - // legacyMode: true, -}); // const client = createClient({ // // username: process.env.REDIS_NAME, // // password: process.env.REDIS_SECRET, // socket: { -// host: '127.0.0.1', +// host: '10.178.0.2', // port: 6379, // }, // // legacyMode: true, // }); +const client = createClient({ + // username: process.env.REDIS_NAME, + // password: process.env.REDIS_SECRET, + socket: { + host: '127.0.0.1', + port: 6379, + }, + // legacyMode: true, +}); client.on('error', (err) => console.log('Redis Client Error', err)); diff --git a/repositorys/followRepository.js b/repositorys/followRepository.js index 3a1171e..60958e5 100644 --- a/repositorys/followRepository.js +++ b/repositorys/followRepository.js @@ -5,7 +5,7 @@ const getFollowers = async (userId, targetUserId, size, cursor, name) => { const whereCondition = { following_id: targetUserId, ...(name && { - following: { + follower: { nickname: { contains: name, mode: 'insensitive' }, }, }), @@ -20,7 +20,7 @@ const getFollowers = async (userId, targetUserId, size, cursor, name) => { take: size, skip: cursor, include: { - following: { + follower: { select: { id: true, email: true, @@ -32,7 +32,7 @@ const getFollowers = async (userId, targetUserId, size, cursor, name) => { }); // 모든 관계를 한 번에 가져오기 - const followerIds = followers.map((f) => f.following.id); + const followerIds = followers.map((f) => f.follower.id); const [followingRelations, followerRelations] = await Promise.all([ prisma.follow.findMany({ where: { @@ -49,12 +49,12 @@ const getFollowers = async (userId, targetUserId, size, cursor, name) => { ]); const followersWithStatus = followers.map((follower) => { - const { profile_image, ...rest } = follower.following; + const { profile_image, ...rest } = follower.follower; const isFollowing = followingRelations.some( - (rel) => rel.following_id === follower.following.id + (rel) => rel.following_id === follower.follower.id ); const isFollower = followerRelations.some( - (rel) => rel.follower_id === follower.following.id + (rel) => rel.follower_id === follower.follower.id ); return { @@ -80,7 +80,7 @@ const getFollowing = async (userId, targetUserId, size, cursor, name) => { const whereCondition = { follower_id: targetUserId, ...(name && { - follower: { + following: { nickname: { contains: name, mode: 'insensitive' }, }, }), @@ -93,7 +93,7 @@ const getFollowing = async (userId, targetUserId, size, cursor, name) => { take: size, skip: cursor, include: { - follower: { + following: { select: { id: true, email: true, @@ -105,7 +105,7 @@ const getFollowing = async (userId, targetUserId, size, cursor, name) => { }); // 모든 관계를 한 번에 가져오기 - const followingIds = following.map((f) => f.follower.id); + const followingIds = following.map((f) => f.following.id); const [followingRelations, followerRelations] = await Promise.all([ prisma.follow.findMany({ where: { @@ -122,12 +122,12 @@ const getFollowing = async (userId, targetUserId, size, cursor, name) => { ]); const followingWithStatus = following.map((item) => { - const { profile_image, ...rest } = item.follower; + const { profile_image, ...rest } = item.following; const isFollowing = followingRelations.some( - (rel) => rel.following_id === item.follower.id + (rel) => rel.following_id === item.following.id ); const isFollower = followerRelations.some( - (rel) => rel.follower_id === item.follower.id + (rel) => rel.follower_id === item.following.id ); return {