Skip to content

Feature(#173, #35, #22): 강의 정보 조회, 발표자가 강의 종료 시 참여코드 무효화, 강의코드 검증 #171

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

Merged
merged 3 commits into from
Dec 1, 2023

Conversation

tmddus2
Copy link
Collaborator

@tmddus2 tmddus2 commented Nov 30, 2023

작업 개요

close #173 강의코드로 강의 정보를 조회한다.
close #35 발표자가 강의 종료 시 참여코드를 무효화한다.
close #22 사용자가 입력한 코드가 유효한 코드인지 확인한다.

작업 사항

강의 정보 조회 API를 구현했습니다.
HTTP method : GET
URL : /lecture?code=260512
query parameter의 code 값은 강의 참여코드입니다.

Response Body :

{
    "code": "260512",
    "title": "강의 제목",
    "description": "이런 내용"
}

강의코드에 대응하는 강의가 없을 때는 404 에러를 반환하도록 했습니다.

{
    "statusCode": 404,
    "message": "해당 강의가 없습니다."
}

강의 종료 시에는 DB에서 해당 강의 참여코드를 삭제하도록 구현했습니다.

Copy link

netlify bot commented Nov 30, 2023

Deploy Preview for boarlog ready!

Name Link
🔨 Latest commit 1304b8a
🔍 Latest deploy log https://app.netlify.com/sites/boarlog/deploys/6569939496c3000007d7b4f6
😎 Deploy Preview https://deploy-preview-171--boarlog.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@tmddus2 tmddus2 changed the title Feature(#35): 발표자가 강의 종료 시 참여코드를 무효화한다. Feature(#173, #35): 강의 정보 조회, 발표자가 강의 종료 시 참여코드 무효화 Nov 30, 2023
@tmddus2 tmddus2 requested a review from platinouss November 30, 2023 07:46
@tmddus2 tmddus2 self-assigned this Nov 30, 2023
@tmddus2 tmddus2 added ✨ Feat 기능 개발 BE 백엔드 작업 labels Nov 30, 2023
@tmddus2 tmddus2 added this to the 4주차 milestone Nov 30, 2023
@tmddus2 tmddus2 changed the title Feature(#173, #35): 강의 정보 조회, 발표자가 강의 종료 시 참여코드 무효화 Feature(#173, #35, #22): 강의 정보 조회, 발표자가 강의 종료 시 참여코드 무효화, 강의코드 검증 Nov 30, 2023
Copy link
Member

@platinouss platinouss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨습니다 !

async getLectureInfo(@Query('code') code: string, @Res() res: Response) {
const enterCodeDocument = await this.lectureService.findLectureByCode(code);
if (!enterCodeDocument) {
throw new HttpException('해당 강의가 없습니다.', HttpStatus.NOT_FOUND);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기서 HttpException을 던지면 PR에 써주셨듯이 response body를 JSON 형태로 statuscode와 message를 내려주는 것 같네요 !
response body 뿐만 아니라 HTTP 상태 코드도 404로 내려주나요 ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

상태코드도 404로 내려옵니다!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오 그렇군요 ! 좋네요

title: string;
description: string;

static of(code: any, lecture: Lecture): LectureInfoDto {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저는 정적 메서드보다는 constructor를 쓰고 있어서 이후에 이야기해보면 좋을 것 같습니다


async findLectureInfo(enterCode: EnterCode) {
const result = await this.lectureModel.findById(enterCode.lecture_id).exec();
return LectureInfoDto.of(enterCode.code, result);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이미 클라이언트는 해당 코드로 강의 정보 조회 요청을 해서 또 내려 줄 필요가 없다고 생각하는데 어떻게 생각하시나요 ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

안그래도 이 부분 그래서 프론트 분들이랑 이야기 해봤는데요! 그 프론트에서 흐름이

  1. 강의 코드 조회
  2. 강의 코드가 유효하면 강의 정보(어떤 강의인지 제목+설명) 알려주고 강의 참여하기 버튼 생성
  3. 강의 참여하기 버튼 누르면 그때 강의 참여
    이런 식으로 진행이 되어서 강의 정보 조회의 경우는 2번 단계에서 쓰이는거라 따로 만들어뒀습니다!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

여기 화면 보시면 코드 입력했을 때 제목과 설명 보여주는데 이때 필요할 것 같아서 추가해두었습니다

Copy link
Member

@platinouss platinouss Dec 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tmddus2 강의 코드 하나만 수정부탁드립니다 ! 제가 좀 늦게 봐드린 것 같아 죄송하네요 😢

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@platinouss 아닙니다! 수정사항 있다면 언제든지 편하게 말씀해주세요~

@tmddus2 tmddus2 requested a review from platinouss November 30, 2023 17:26
Copy link
Member

@platinouss platinouss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이번 한 주도 고생 많으셨습니다 !

@platinouss platinouss merged commit 37a474c into boostcampwm2023:dev Dec 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BE 백엔드 작업 ✨ Feat 기능 개발
Projects
None yet
2 participants