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
24 changes: 17 additions & 7 deletions src/chat/repositories/chat.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ export class ChatRepository {
user_id1: userId1,
user_id2: userId2,
last_message_id: null,
// μ°Έμ—¬μž 생성
participants: {
create: [
{ user_id: userId1},
{ user_id: userId2},
],
}
},
});
}
Expand Down Expand Up @@ -111,6 +118,8 @@ export class ChatRepository {
const where: Prisma.ChatParticipantWhereInput = {
user_id: userId,
left_at: null, // λ‚˜κ°€μ§€ μ•Šμ€ λ°©
chatRoom: {
is: { last_message_id: { not: null } } }, // λ©”μ‹œμ§€κ°€ μžˆλŠ” λ°©
};

if (filter === "pinned") {
Expand All @@ -123,16 +132,17 @@ export class ChatRepository {

if (search && search.trim().length > 0) {
where.chatRoom = {
participants: {
some: {
user_id: { not: userId },
user: {
nickname: {
contains: search.trim(),
is: {
...(where.chatRoom as any)?.is,
participants: {
some: {
user_id: { not: userId },
user: {
nickname: {contains: search.trim()},
},
},
},
},
}
};
}

Expand Down
5 changes: 3 additions & 2 deletions src/chat/routes/chat.route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ router.post("/rooms", authenticateJwt, createOrGetChatRoom);
* get:
* summary: μ±„νŒ…λ°© 상세 쑰회
* description: >
* μ±„νŒ…λ°© 상세 정보(μƒλŒ€ 정보/차단 μƒνƒœ/λ©”μ‹œμ§€ λͺ©λ‘/νŽ˜μ΄μ§€ 정보)λ₯Ό μ‘°νšŒν•©λ‹ˆλ‹€.
* μ±„νŒ…λ°© 상세 정보(μƒλŒ€ 정보/차단 μƒνƒœ/λ©”μ‹œμ§€ λͺ©λ‘/νŽ˜μ΄μ§€ 정보)λ₯Ό μ‘°νšŒν•©λ‹ˆλ‹€.<br/>
* λ©”μ‹œμ§€λŠ” 였래된 순(ASC)으둜 λ°˜ν™˜λ˜λ©°, cursor 기반으둜 κ³Όκ±° λ©”μ‹œμ§€λ₯Ό μΆ”κ°€λ‘œ 뢈러올 수 μžˆμŠ΅λ‹ˆλ‹€.
* tags: [Chat]
* security:
Expand Down Expand Up @@ -227,7 +227,8 @@ router.get("/rooms/:roomId", authenticateJwt, getChatRoomDetail);
* get:
* summary: μ±„νŒ…λ°© λͺ©λ‘ 쑰회
* description: >
* λ‚΄ μ±„νŒ…λ°© λͺ©λ‘μ„ μ‘°νšŒν•©λ‹ˆλ‹€.
* λ‚΄ μ±„νŒ…λ°© λͺ©λ‘μ„ μ‘°νšŒν•©λ‹ˆλ‹€.<br/>
* λ©”μ„Έμ§€κ°€ μ‘΄μž¬ν•˜μ§€ μ•ŠμœΌλ©΄ ν•΄λ‹Ή μ±„νŒ…λ°©μ€ λͺ©λ‘μ—μ„œ μ œμ™Έλ©λ‹ˆλ‹€.<br/>
* filter(전체/μ•ˆμ½μŒ/κ³ μ •), search(μƒλŒ€ λ‹‰λ„€μž„ 검색), cursor 기반 νŽ˜μ΄μ§•μ„ μ§€μ›ν•©λ‹ˆλ‹€.
* tags: [Chat]
* security:
Expand Down