Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/retrieve chat list #59

Merged
merged 55 commits into from
Sep 24, 2023
Merged
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
eab5e43
채팅 목록 불러오기 기반 작업
seongyunlee Sep 19, 2023
7c5c3e6
채팅 목록 불러오기 기반 작업
seongyunlee Sep 19, 2023
aea0fdd
채팅 목록 불러오기 스웨거 작업
seongyunlee Sep 20, 2023
ffa540c
채팅 보내기 repository 함수 생성
seongyunlee Sep 20, 2023
0b2f8b0
일반 질문 지정 질문 route 분리
seongyunlee Sep 20, 2023
b62f04c
일반 질문 지정 질문 로직 작성
seongyunlee Sep 20, 2023
85a1f81
지정 질문 선택시에 선생님 한테 메시지 보내짐
seongyunlee Sep 20, 2023
51e498e
일반 질문 숏과외 제안시 채팅 개시
seongyunlee Sep 20, 2023
dff65cb
일반 질문 숏과외 제안시 채팅 개시
seongyunlee Sep 20, 2023
0041fd9
Merge remote-tracking branch 'origin/dev' into feat/start_question
seongyunlee Sep 20, 2023
d15eb87
chatting list 반환할때 roomType 지정
seongyunlee Sep 20, 2023
9325ad1
chatting list 반환할때 roomType 지정
seongyunlee Sep 20, 2023
01c9ac2
학생 입장에서 일반질문 올리고 아무도 offer 없을때도 채팅 목록에서 보이게 수정
seongyunlee Sep 21, 2023
510fda0
Merge remote-tracking branch 'origin/dev' into feat/start_selected_qu…
seongyunlee Sep 21, 2023
7db6583
수업 시간 정하기 api 추가
seongyunlee Sep 22, 2023
e789049
수업 끝나면 question.status 도 finish로 바뀜
seongyunlee Sep 22, 2023
886278d
지정 질문 올릴때 question에 selectedteacherId 저장하도록 수정
seongyunlee Sep 22, 2023
83f7caf
튜터링 객체 만들때 startedAt, EndAt emptystring으로 해둔거 수정
seongyunlee Sep 22, 2023
34948f0
/tutoring/info 를 학생이 부를 때 선생님이 과외를 시작하지 않았으면 정보를 돌려주지 않고 success: fal…
seongyunlee Sep 22, 2023
f2adca9
일반 질문 학생이 선생님 선택하면 다른 선생님한테 메시지 가도록 수정.
seongyunlee Sep 22, 2023
a79ea44
선생님이 채팅 조회시 일반 질문 거절 당했을때 "normalreserve"로 분류되던걸 , "normalproposed"로 …
seongyunlee Sep 22, 2023
55ea389
Merge remote-tracking branch 'origin/dev' into feat/fix_tutoring_time
seongyunlee Sep 22, 2023
8821f2d
선생님이 채팅 조회시 일반 질문 거절 당했을때 텍스트 메시지를 받도록 변경
seongyunlee Sep 22, 2023
3a63fa8
refactor /chatting/list
seongyunlee Sep 22, 2023
65aeff2
refactor /chatting/list
seongyunlee Sep 22, 2023
63c390d
refactor /chatting/list
seongyunlee Sep 22, 2023
73a4d00
지정 질문 선생님 아이디 유효성 체크
seongyunlee Sep 22, 2023
563253a
채팅 목록 불러오기 기반 작업
seongyunlee Sep 19, 2023
ce8f92d
채팅 목록 불러오기 기반 작업
seongyunlee Sep 19, 2023
be77225
채팅 목록 불러오기 스웨거 작업
seongyunlee Sep 20, 2023
c6ff7c9
채팅 보내기 repository 함수 생성
seongyunlee Sep 20, 2023
16a1282
일반 질문 지정 질문 route 분리
seongyunlee Sep 20, 2023
ad26376
일반 질문 지정 질문 로직 작성
seongyunlee Sep 20, 2023
a74a095
지정 질문 선택시에 선생님 한테 메시지 보내짐
seongyunlee Sep 20, 2023
d3f5be8
일반 질문 숏과외 제안시 채팅 개시
seongyunlee Sep 20, 2023
f47b7a4
일반 질문 숏과외 제안시 채팅 개시
seongyunlee Sep 20, 2023
cd64531
chatting list 반환할때 roomType 지정
seongyunlee Sep 20, 2023
2ca61c1
chatting list 반환할때 roomType 지정
seongyunlee Sep 20, 2023
a8d64e6
학생 입장에서 일반질문 올리고 아무도 offer 없을때도 채팅 목록에서 보이게 수정
seongyunlee Sep 21, 2023
2371ab8
수업 시간 정하기 api 추가
seongyunlee Sep 22, 2023
7fc015e
수업 끝나면 question.status 도 finish로 바뀜
seongyunlee Sep 22, 2023
00d5594
지정 질문 올릴때 question에 selectedteacherId 저장하도록 수정
seongyunlee Sep 22, 2023
92ca472
튜터링 객체 만들때 startedAt, EndAt emptystring으로 해둔거 수정
seongyunlee Sep 22, 2023
eee9e93
/tutoring/info 를 학생이 부를 때 선생님이 과외를 시작하지 않았으면 정보를 돌려주지 않고 success: fal…
seongyunlee Sep 22, 2023
113b1c1
일반 질문 학생이 선생님 선택하면 다른 선생님한테 메시지 가도록 수정.
seongyunlee Sep 22, 2023
a25dfa6
선생님이 채팅 조회시 일반 질문 거절 당했을때 "normalreserve"로 분류되던걸 , "normalproposed"로 …
seongyunlee Sep 22, 2023
35d5c58
선생님이 채팅 조회시 일반 질문 거절 당했을때 텍스트 메시지를 받도록 변경
seongyunlee Sep 22, 2023
2fd5ae5
refactor /chatting/list
seongyunlee Sep 22, 2023
5ae1c45
refactor /chatting/list
seongyunlee Sep 22, 2023
c4881f6
refactor /chatting/list
seongyunlee Sep 22, 2023
9df26d2
지정 질문 선생님 아이디 유효성 체크
seongyunlee Sep 22, 2023
8c3f38a
Merge remote-tracking branch 'origin/feat/retrieve_chat_list' into fe…
seongyunlee Sep 22, 2023
d5f2692
chatting.schema.ts 수정 status 삭제
seongyunlee Sep 22, 2023
cf64e32
선생님 신청 없는 일반 질문도 목록 보이게 수정
seongyunlee Sep 24, 2023
338e26e
Merge remote-tracking branch 'origin/dev' into feat/retrieve_chat_list
seongyunlee Sep 24, 2023
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
27 changes: 25 additions & 2 deletions src/chatting/chatting.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,11 @@ export class ChattingService {

const chatLists = this.groupChatRoomByState(chatRooms);
if (userInfo.role == 'student') {
chatLists.normalProposed = this.groupNormalProposedForStudent(
const questions =
await this.questionRepository.getStudentPendingQuestions(userId);
chatLists.normalProposed = await this.groupNormalProposedForStudent(
chatLists.normalReserved,
questions.map((q) => q.id),
);
}

Expand All @@ -50,7 +53,10 @@ export class ChattingService {
}
}

groupNormalProposedForStudent(chatRooms: ChatRoom[]): ChatRoom[] {
async groupNormalProposedForStudent(
chatRooms: ChatRoom[],
pendingQuestionIds: string[],
): Promise<ChatRoom[]> {
const result = {};
chatRooms.forEach((chatRoom) => {
if (chatRoom.questionId in result) {
Expand All @@ -71,6 +77,23 @@ export class ChattingService {
result[chatRoom.questionId] = questionRoom;
}
});

for (const questionId of pendingQuestionIds) {
if (!(questionId in result)) {
const questionInfo = await this.questionRepository.getInfo(questionId);
result[questionId] = {
teachers: [],
isTeacherRoom: false,
roomImage: questionInfo.problem.mainImage,
title: questionInfo.problem.description,
isSelect: false,
status: ChattingStatus.pending,
questionId: questionId,
problemImage: questionInfo.problem.mainImage,
};
}
}

return Object.values(result);
}

Expand Down