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

[NDD-228]: 카테고리별 질문 조회 기능 구현 (1h / 1h) #73

Merged
merged 5 commits into from
Nov 21, 2023

Conversation

JangAJang
Copy link
Collaborator

@JangAJang JangAJang commented Nov 20, 2023

NDD-228 Powered by Pull Request Badge

Why

  • 기획서상으로 카테고리별 질문을 조회할 때 ResponseList로 조회하기로 기획했다.
    • 질문당 하나의 대표답변이 있어야 한다.
    • 질문은 질문의 id, content가 있어야 한다.
    • 대표답변은 id, content가 있어야 한다.
  • 여기에서 Answer 객체가 구현되어있지 않아, QuestionList로 구현하고 후에 Answer를 구현할 때 추가하기로 했다.

How

  • 비즈니스로직에서는 repository를 통해 가져온 Question[]을 QuestionResponse[]로 반환한다.
  • 컨트롤러 로직에서는 QuestionResponse[]를 QuestionResponseList객체로 반환한다(json으로 캡슐화하기 위해)

Result

// 비즈니스 로직
async findAllByCategory(categoryId: number) {
    if (isEmpty(categoryId)) {
      throw new NeedToFindByCategoryIdException();
    }

    const questions =
      await this.questionRepository.findByCategoryId(categoryId);
    return questions.map(QuestionResponse.from);
  }

//컨트롤러 로직
async findCategoryQuestions(@Query('category') categoryId: number) {
    const questionResponses =
      await this.questionService.findAllByCategory(categoryId);
    return QuestionResponseList.of(questionResponses);
  }

Prize

스크린샷 2023-11-21 13 50 15 - Todo: 후에 Answer API의 객체와 리포지토리 구현시에 해당 데이터에 대한 Answer 추가 예정

@JangAJang JangAJang self-assigned this Nov 20, 2023
@JangAJang JangAJang added BE 백엔드 코드 변경사항 feature 새로운 기능이 추가 된 경우 test 테스트코드가 변경된 경우 labels Nov 20, 2023
Copy link

cloudflare-workers-and-pages bot commented Nov 20, 2023

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 6224d32
Status: ✅  Deploy successful!
Preview URL: https://efeac232.gomterview.pages.dev
Branch Preview URL: https://feature-ndd-228.gomterview.pages.dev

View logs

@JangAJang JangAJang changed the title Feature/ndd 228 [NDD-228]: 카테고리별 질문 조회 기능 구현 (1h / 1h) Nov 21, 2023
export { ContentNotFoundException };
class NeedToFindByCategoryIdException extends HttpException {
constructor() {
super('카테고리 id를 입력해주세요 합니다.', 400);
Copy link
Collaborator

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.

@quiet-honey
Copy link
Collaborator

코드 잘 봤습니다! 장희님!
추가적으로 말씀드리고 싶은게 access.token.strategy.ts의 validate 메서드에 토큰 파싱 결과를 console에 로깅하는 로직이 있는데 지우시는걸 깜빡하신걸까요??!

Copy link
Collaborator

@quiet-honey quiet-honey left a comment

Choose a reason for hiding this comment

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

고생하셨습니다! LGTM:)

@adultlee
Copy link
Collaborator

adultlee commented Nov 21, 2023

image

아무 내용이 없어요😱

아직 작성중이신가용...?!

@JangAJang
Copy link
Collaborator Author

swagger문서화를 추가해 최종적으로 작성하려고 합니다!

@JangAJang JangAJang merged commit 7b2b4da into dev Nov 21, 2023
1 check passed
@JangAJang JangAJang deleted the feature/NDD-228 branch November 21, 2023 04:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BE 백엔드 코드 변경사항 feature 새로운 기능이 추가 된 경우 test 테스트코드가 변경된 경우
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants