Skip to content

Commit

Permalink
Feat/edit chat info (#70)
Browse files Browse the repository at this point in the history
* 실시간 온라인 접속 선생님 확인 api swagger

* 채팅 chatting/list 수정 . 수업 예약시간도 같이 줌

* swagger 수정

* 채팅 chatting/list 수정 . 수업 예약시간도 같이 줌

* 채팅 chatting/list 수정 . 수업 예약시간도 같이 줌

* 채팅 chatting/list 수정 . 수업 예약시간도 같이 줌
  • Loading branch information
seongyunlee authored Oct 3, 2023
1 parent 54dc7d5 commit 884101b
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/chatting/chatting.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export class ChattingController {
}

@ApiOperation(ChattingOperation.list)
@ApiResponse(ChattingResponse.list.success)
@Get('/:chattingId')
getChatRoomInfo(
@Param('chattingId') chattingId: string,
Expand Down
5 changes: 4 additions & 1 deletion src/chatting/chatting.module.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { AgoraModule } from '../agora/agora.module';
import { dynamooseModule } from '../config.dynamoose';
import { QuestionRepository } from '../question/question.repository';
import { TutoringRepository } from '../tutoring/tutoring.repository';
import { UploadRepository } from '../upload/upload.repository';
import { UserRepository } from '../user/user.repository';
import { ChattingController } from './chatting.controller';
Expand All @@ -8,14 +10,15 @@ import { ChattingService } from './chatting.service';
import { Module } from '@nestjs/common';

@Module({
imports: [dynamooseModule],
imports: [dynamooseModule, ChattingModule, AgoraModule],
controllers: [ChattingController],
providers: [
ChattingService,
ChattingRepository,
UserRepository,
QuestionRepository,
UploadRepository,
TutoringRepository,
],
exports: [ChattingRepository],
})
Expand Down
12 changes: 12 additions & 0 deletions src/chatting/chatting.service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { QuestionRepository } from '../question/question.repository';
import { Fail, Success } from '../response';
import { TutoringRepository } from '../tutoring/tutoring.repository';
import { User } from '../user/entities/user.interface';
import { UserRepository } from '../user/user.repository';
import { ChattingRepository } from './chatting.repository';
Expand All @@ -18,6 +19,7 @@ export class ChattingService {
private readonly chattingRepository: ChattingRepository,
private readonly userRepository: UserRepository,
private readonly questionRepository: QuestionRepository,
private readonly tutoringRepository: TutoringRepository,
) {}

async getChatList(userId: string) {
Expand Down Expand Up @@ -150,6 +152,16 @@ export class ChattingService {
questionInfo: questionInfo,
title: opponentInfo?.name,
};

try {
if (questionInfo.tutoringId != null) {
const tutoringInfo = await this.tutoringRepository.get(
questionInfo.tutoringId,
);
chatRoom.reservedStart = tutoringInfo.reservedStart;
}
} catch (error) {}

return chatRoom;
}

Expand Down
1 change: 1 addition & 0 deletions src/chatting/description/chatting.response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export const ChattingListEntity = {
roomImage:
'https://short-tutoring.s3.ap-northeast-2.amazonaws.com/default/profile.png',
id: '067e02cd-57dd-4bb4-9654-d467bef97d1e',
reservedStart: '2021-09-11T03:59:08.121Z',
messages: [
{
message: {
Expand Down
1 change: 1 addition & 0 deletions src/chatting/items/chat.list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export interface ChatRoom {
isSelect: boolean;
questionInfo?: Question;
questionId: string;
reservedStart?: Date;
}

export interface Message {
Expand Down
4 changes: 4 additions & 0 deletions src/question/descriptions/question.operation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,8 @@ export const QuestionOperation = {
summary: '질문 목록 조회',
description: '질문 목록을 조회합니다.',
},
info: {
summary: '질문 정보 조회',
description: '질문 정보를 조회합니다.',
},
};
2 changes: 1 addition & 1 deletion src/question/question.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export class QuestionController {

@ApiTags('Question')
@ApiBearerAuth('Authorization')
@ApiOperation(QuestionOperation.list)
@ApiOperation(QuestionOperation.info)
@Get('question/info/:questionId')
getQuestionInfo(@Param('questionId') questionId: string) {
return this.questionService.getQuestionInfo(questionId);
Expand Down

0 comments on commit 884101b

Please sign in to comment.