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

GTB-74 [refactor] 주점 관리 API 변경 #85

Merged
merged 8 commits into from
Sep 11, 2024
Merged

GTB-74 [refactor] 주점 관리 API 변경 #85

merged 8 commits into from
Sep 11, 2024

Conversation

jwnnoh
Copy link
Member

@jwnnoh jwnnoh commented Sep 11, 2024

1. 무슨 이유로 코드를 변경했나요?

  • 주점 관리 API를 변경하기 위함입니다.

메뉴 등록 및 관리

대표 메뉴 2개만 사진을 표기할 수 있도록 정책이 변경되었습니다.

  • 따라서 메뉴 도메인에 썸네일 필드를 추가하였습니다.
  • 프런트에서 메뉴 관리 API에 대표 메뉴부터 보내줍니다.
    • 우선순위를 따로 설정해주지 않아도 기본값으로 대표 메뉴부터 조회됩니다.

🤔 기존에 존재하는 메뉴는 어떻게 판단하나요?

주점 상세 조회 DTO에 menuId를 같이 반환하도록 수정하였습니다.

  • 이를 이용해 관리 API의 requestDTO에 menuId가 포함되어 있는 메뉴는 update,
  • 그렇지 않은 메뉴는 create 메서드로 진행하도록 분기하였습니다.

2. 어떤 위험이나 장애를 발견했나요?

  • 특이사항 없습니다.

3. 관련 스크린샷을 첨부해주세요.

  • DB
스크린샷 2024-09-11 오후 4 25 56
  • Curl
curl --location --request PATCH 'http://localhost:8080/admin/manage' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer eyJhbGciOiJIUzM4NCJ9.eyJzdWIiOiJzdHJpbmciLCJ1aWQiOiJhNWZlMDJjMi05YWRkLTQ2NGYtYTBjOC0wMzkzZGZkZjFmMzEiLCJyb2xlIjoiUk9MRV9BRE1JTiIsImV4cCI6MTcyNjA2MDkyN30.AyI_4sUAlvCvv5TkgT6ygJU_NFyMZdId0ZyL1Yh0WS_H6c5WV9Sa3beX4qnwbb-D' \
--data '{
  "thumbnails": [
    "https://gachontable.s3.ap-northeast-2.amazonaws.com/menus/1.jpeg"
  ],
  "menuRequests": [
    {
      "menuId": 4,
      "thumbnail": "https://gachontable.s3.ap-northeast-2.amazonaws.com/menus/1_1.jpeg",
      "menuName": "test3",
      "price": "10000냥",
      "oneLiner": "test3"
    },
    {
      "menuId": 5,
      "thumbnail": "https://gachontable.s3.ap-northeast-2.amazonaws.com/menus/1_2.jpeg",
      "menuName": "test4",
      "price": "10000냥",
      "oneLiner": "test4"
    }
  ]
}'

4. 완료 사항

  • 주점 관리 API 변경

이슈 번호

close #84


5. 추가 사항

  • 주점 관리 책임을 Pub -> Admin으로 변경
  • 주점 검증 로직을 따로 분리
  • 정책에 따른 필드 수정
    • Pub 객체의 StudentCard -> Nullable
    • Waiting 객체의 allocated 필드 삭제

@jwnnoh jwnnoh added ✨ feature 새로운 기능 ♻️ refactor 코드 리팩토링 labels Sep 11, 2024
@jwnnoh jwnnoh self-assigned this Sep 11, 2024
@jwnnoh jwnnoh requested review from rootTiket, yechan-kim and hoonyworld and removed request for rootTiket and yechan-kim September 11, 2024 07:34
Copy link
Contributor

@rootTiket rootTiket left a comment

Choose a reason for hiding this comment

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

정책 변경에 맞게 잘 변경된 것 같습니다 !! 고생하셨어요 :)

Comment on lines +49 to +62
if (menu != null) {
menu.update(
menuRequest.menuName(),
menuRequest.price(),
menuRequest.oneLiner(),
menuRequest.thumbnail());
return menu;
}
return Menu.create(
pub,
menuRequest.menuName(),
menuRequest.price(),
menuRequest.oneLiner(),
menuRequest.thumbnail());
Copy link
Contributor

Choose a reason for hiding this comment

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

말씀하신 로직이 해당 로직 같은데, 매우 흥미롭게 봤습니다! 고생하셨습니다!!!

@jwnnoh jwnnoh merged commit 026ff26 into develop Sep 11, 2024
@jwnnoh jwnnoh deleted the GTB-74 branch September 11, 2024 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ feature 새로운 기능 ♻️ refactor 코드 리팩토링
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GTB-74 [refactor] 주점 관리 API 변경
3 participants