-
Notifications
You must be signed in to change notification settings - Fork 2
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
물품 구매 로직 구현 #11
base: roki/purchase
Are you sure you want to change the base?
물품 구매 로직 구현 #11
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
수고하셨습니다!!
/** | ||
* 가장 낮은 번호의 빈 사물함을 할당하는 메소드 | ||
*/ | ||
public Locker assignLocker() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이 부분은 동시성에 대한 고려를 해주지 않아도 될까요??
* 구매자가 물건 구매를 시작함 (Pessimistic Lock 적용) | ||
*/ | ||
@Transactional | ||
public boolean startPurchase(Long productId, HttpServletRequest request) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
혹시 이 곳에 비관적 락을 사용하신 이유가 있을까요??
@Column(nullable = false) | ||
private LocalDateTime updatedAt; | ||
|
||
@PrePersist |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BaseEntity를 고려해보셔도 좋을 것 같습니다!
Locker assignedLocker = lockerService.assignLocker(); | ||
return ResponseEntity.ok(assignedLocker); | ||
} catch (RuntimeException e) { | ||
return ResponseEntity.status(HttpStatus.NOT_FOUND).body(null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
공통응답처리를 고려해보셔도 좋을 것 같습니다!
구매 플로우
/api/v1/products
/api/v1/product/purchase-page/{product_id}
/api/v1/product/purchase/{product_id}
/api/v1/product/locker-in/{product_id}
/api/v1/product/take-out/{product_id}