-
Notifications
You must be signed in to change notification settings - Fork 0
Feat/match #58
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
Feat/match #58
Changes from all commits
964af1f
fd8795f
a071d9c
b6a9a45
8471a96
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,6 +16,13 @@ public record MatchCreateRequest( | |
|
|
||
| @Schema(description = "최대 참여 인원 수", example = "10") | ||
| @Min(2) @Max(20) | ||
| Integer maxMembers | ||
| Integer maxMembers, | ||
|
|
||
| @Schema(description = "몇 분동안 진행되는 매칭인지", example = "120") | ||
| int durationMinutes, | ||
|
Comment on lines
+21
to
+22
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
🛡️ 제안 수정+ `@Schema`(description = "몇 분동안 진행되는 매칭인지", example = "120")
+ `@Min`(value = 1, message = "매칭 시간은 1분 이상이어야 합니다.")
+ `@Max`(value = 1440, message = "매칭 시간은 1440분(24시간) 이하이어야 합니다.")
int durationMinutes,🤖 Prompt for AI Agents |
||
|
|
||
| @Schema(description = "매칭 참여 요금", example = "4000") | ||
| @Min(value = 1000, message = "참가비는 1000원 이상이어야 합니다.") | ||
| int entryFee | ||
|
|
||
| ) {} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| package com.be.sportizebe.domain.match.entity; | ||
|
|
||
| public enum MatchParticipantStatus { | ||
| JOINED, LEFT | ||
| JOINED, | ||
| LEFT | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -39,6 +39,13 @@ public class MatchRoom extends BaseTimeEntity { | |||||||||||||||||||||||
| @Column(nullable = false) | ||||||||||||||||||||||||
| private MatchStatus status; | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| @Column(nullable = false) | ||||||||||||||||||||||||
| private int durationMinutes; | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| @Column(nullable = false) | ||||||||||||||||||||||||
| private int entryFee; | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| @OneToMany(mappedBy = "matchRoom", cascade = CascadeType.ALL, orphanRemoval = true) | ||||||||||||||||||||||||
| @Builder.Default | ||||||||||||||||||||||||
| private List<MatchParticipant> participants = new ArrayList<>(); | ||||||||||||||||||||||||
|
|
@@ -54,6 +61,18 @@ public static MatchRoom create(MatchCreateRequest request) { | |||||||||||||||||||||||
| .curMembers(0) | ||||||||||||||||||||||||
| .maxMembers(request.maxMembers()) | ||||||||||||||||||||||||
| .status(MatchStatus.OPEN) | ||||||||||||||||||||||||
| .durationMinutes(request.durationMinutes()) | ||||||||||||||||||||||||
| .entryFee(request.entryFee()) | ||||||||||||||||||||||||
| .build(); | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| public void join() { | ||||||||||||||||||||||||
| this.curMembers++; | ||||||||||||||||||||||||
| if (isFull()) this.status = MatchStatus.FULL; | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| public void leave() { | ||||||||||||||||||||||||
| this.curMembers--; | ||||||||||||||||||||||||
| if (this.status == MatchStatus.FULL) this.status = MatchStatus.OPEN; | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
Comment on lines
+72
to
+75
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
서비스 레이어에서 JOINED 참가자를 먼저 조회하므로 정상 흐름에서는 이 문제가 발생하지 않지만, 엔티티 메서드 자체에 방어 로직이 없어 잘못된 호출 시 🛡️ 수정 제안 public void leave() {
- this.curMembers--;
+ if (this.curMembers <= 0) {
+ throw new IllegalStateException("curMembers가 이미 0입니다.");
+ }
+ this.curMembers--;
if (this.status == MatchStatus.FULL) this.status = MatchStatus.OPEN;
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
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.
@Operationsummary가 의미상 불명확합니다."매칭 취소"는 매칭 자체를 취소(삭제)하는 것으로 오해될 수 있습니다. 참여를 철회한다는 의도를 명확히 하려면 "매칭 참여 취소" 또는 "매칭 나가기"로 수정을 권장합니다.
✏️ 수정 제안
📝 Committable suggestion
🤖 Prompt for AI Agents