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

refactor: 발급 티켓 도메인 메서드 정리 및 API 추가 #180

Merged
merged 4 commits into from
Jan 23, 2023

Conversation

sanbonai06
Copy link
Member

개요

작업사항

  • 발급 티켓 도메인 내부 메서드들을 조금 정리했습니다.
  • 정리하면서 필요해보이는 상태변환 메서드들을 추가했습니다.
  • 또 상태변환 메서드를 추가하니 입장 처리해주는 API가 필요해서 추가해주었습니다.
  • 정상 응답
PATCH /v1/admin/issuedTickets/{issuedTicketId}

{
  "success": true,
  "status": 200,
  "data": {
    "issuedTicketId": 16,
    "issuedTicketNo": "T1000016",
    "uuid": "f8197615-ec94-472b-87b5-ba5b03b69db7",
    "ticketName": "test",
    "ticketPrice": "4000원",
    "createdAt": "2023-01-23 03:24:58",
    "issuedTicketStatus": "입장 완료",
    "optionPrice": "0원"
  },
  "timeStamp": "2023-01-23T17:40:11.571074"
}

  • 티켓이 이미 입장 처리 되었을 때
{
  "success": false,
  "status": 400,
  "code": "IssuedTicket_400_5",
  "reason": "이미 입장 처리된 티켓입니다.",
  "timeStamp": "2023-01-23T17:40:50.49026",
  "path": "http://localhost:8080/api/v1/admin/issuedTickets/16"
}
  • 추가로 해당 부분에도 락을 걸고 들어가야 할지 고민을 해봤습니다. 하지만 QR 찍는 행위가 동시에 일어 날 일은 없다고 생각해서 따로 처리하지 않았습니다.

변경로직

  • 찬진님이 말한 티켓재고관련 Redisson Lock에서 새로운 트랜잭션이 필요하기 때문에 needSameTransaction 옵션을 디폴트값인 false로 변경하였습니다.
    @RedissonLock(LockName = "티켓재고관리", paramClassType = TicketItem.class, identifier = "id")

@sanbonai06 sanbonai06 added For: API [이슈 대상] 외부 API Type: Feature [이슈 목적] 새로운 기능 추가 Type: Refactor [이슈 목적] 프로덕션 코드 리팩토링 labels Jan 23, 2023
@sanbonai06 sanbonai06 self-assigned this Jan 23, 2023
Copy link
Member

@ImNM ImNM 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 58 to 60
public void delete(IssuedTicket issuedTicket) {
issuedTicket.cancelIssuedTicket();
issuedTicket.cancel();
}
Copy link
Member

Choose a reason for hiding this comment

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

cancel 로 통일시키는게 좋아보입니당!

티켓이 입장 미완료 상태가 아니면 입장 할 수 없음
*/
public void entrance() {
if (this.issuedTicketStatus == IssuedTicketStatus.CANCELED) {
Copy link
Member

Choose a reason for hiding this comment

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

백기선 님 강좌듣는데 이넘값을 == 으로 비교하면 더 좋다 그러더라구요
this.issuedTicketStatus.equals(IssuedTicketStatus.CANCELED)
위방식보다
민준님 방식이 euqals 칠때 null 포인터 exception 까지 막을수 있으니

Copy link
Member

@cofls6581 cofls6581 left a comment

Choose a reason for hiding this comment

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

리팩토링 굿굿!

Copy link
Member

@gengminy gengminy left a comment

Choose a reason for hiding this comment

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

굿입니다👍

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 198 Code Smells

13.1% 13.1% Coverage
1.2% 1.2% Duplication

@sanbonai06 sanbonai06 merged commit aee3094 into dev Jan 23, 2023
@sanbonai06 sanbonai06 deleted the refactor/167-refactoring-issuedTicket branch January 23, 2023 12:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For: API [이슈 대상] 외부 API Type: Feature [이슈 목적] 새로운 기능 추가 Type: Refactor [이슈 목적] 프로덕션 코드 리팩토링
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

🔨[refactor] 발급 티켓 도메인 정리, 주석 처리 및 입장 처리 관련 메서드 추가
4 participants