-
Notifications
You must be signed in to change notification settings - Fork 0
fix(feed): Spot 전환 조건 — 서포터 1명 + 파트너 1명 이상 수락 시 MATCHED #121
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
Open
ThonApple
wants to merge
2
commits into
develop
Choose a base branch
from
fix/spot-matching-condition
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+125
−31
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -82,6 +82,10 @@ public class FeedItem { | |
| @Column(nullable = false) | ||
| private Integer confirmedPartnerCount = 0; | ||
|
|
||
| @Builder.Default | ||
| @Column(nullable = false, columnDefinition = "integer NOT NULL DEFAULT 0") | ||
| private Integer confirmedSupporterCount = 0; | ||
|
|
||
| @Builder.Default | ||
| @Column(nullable = false) | ||
| private Integer views = 0; | ||
|
|
@@ -160,6 +164,10 @@ public class FeedItem { | |
| @Column(columnDefinition = "TEXT") | ||
| private String photoUrlsJson; | ||
|
|
||
| @Builder.Default | ||
| @Column(nullable = false, columnDefinition = "boolean NOT NULL DEFAULT false") | ||
| private boolean earlyStartRequested = false; | ||
|
|
||
| @Builder.Default | ||
| @Column(name = "is_deleted", nullable = false) | ||
| private boolean deleted = false; | ||
|
|
@@ -176,32 +184,43 @@ public void softDelete() { | |
| this.deleted = true; | ||
| } | ||
|
|
||
| /** | ||
| * 피드 당 수락 가능한 서포터 최대 인원. | ||
| * OFFER/REQUEST 모두 서포터는 1명으로 고정하는 것이 현재 서비스 정책이다. | ||
| * {@code maxParticipants} 필드는 프론트 UI 표시용(모집 정원 안내)이며, | ||
| * 수락 상한 판단에는 사용하지 않는다. | ||
| */ | ||
| private static final int MAX_SUPPORTERS_PER_FEED = 1; | ||
|
|
||
| /** | ||
| * 추가 서포터를 수락할 수 있는지 확인한다. | ||
| * 수락 상한은 {@link #MAX_SUPPORTERS_PER_FEED}(현재 1명)으로 고정된다. | ||
| */ | ||
| public boolean canAcceptMore() { | ||
| int confirmed = this.confirmedPartnerCount != null ? this.confirmedPartnerCount : 0; | ||
| /** 서포터 추가 수락 가능 여부. 서포터는 1명으로 고정. */ | ||
| public boolean canAcceptMoreSupporters() { | ||
| int confirmed = this.confirmedSupporterCount != null ? this.confirmedSupporterCount : 0; | ||
| return confirmed < MAX_SUPPORTERS_PER_FEED; | ||
| } | ||
|
|
||
| public void accumulateFunding(int amount) { | ||
| this.fundedAmount = (this.fundedAmount != null ? this.fundedAmount : 0) + amount; | ||
| public void recordSupporterAccepted() { | ||
| this.confirmedSupporterCount = (this.confirmedSupporterCount != null ? this.confirmedSupporterCount : 0) + 1; | ||
| } | ||
|
|
||
| public void recordPartnerAccepted() { | ||
| this.confirmedPartnerCount = (this.confirmedPartnerCount != null ? this.confirmedPartnerCount : 0) + 1; | ||
| } | ||
|
|
||
| public boolean isFundingGoalMet() { | ||
| if (this.fundingGoal == null || this.fundingGoal <= 0) { | ||
| /** | ||
| * 자동 Spot 전환 조건: 서포터 1명 + 파트너 수락 수 >= maxParticipants. | ||
| * maxParticipants 미설정 시 자동 전환 없음 — 작성자가 수동 진행 요청해야 함. | ||
| */ | ||
| public boolean isReadyToMatch() { | ||
|
Collaborator
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.
public boolean isReadyToMatch() {
if (this.maxParticipants == null) return false;
int supporters = (confirmedSupporterCount != null ? confirmedSupporterCount : 0)
+ (this.authorRole == FeedAuthorRole.SUPPORTER ? 1 : 0);
int partners = (confirmedPartnerCount != null ? confirmedPartnerCount : 0)
+ (this.authorRole == FeedAuthorRole.PARTNER ? 1 : 0);
return supporters >= 1 && partners >= this.maxParticipants;
} |
||
| if (this.maxParticipants == null) { | ||
| return false; | ||
| } | ||
| return this.fundedAmount >= this.fundingGoal; | ||
| int supporters = this.confirmedSupporterCount != null ? this.confirmedSupporterCount : 0; | ||
| int partners = this.confirmedPartnerCount != null ? this.confirmedPartnerCount : 0; | ||
| return supporters >= 1 && partners >= this.maxParticipants; | ||
| } | ||
|
|
||
| /** 조기 시작 요청 가능 조건: 서포터 1명 + 파트너 1명 이상 (필수 조건). */ | ||
| public boolean canRequestEarlyStart() { | ||
| int supporters = this.confirmedSupporterCount != null ? this.confirmedSupporterCount : 0; | ||
| int partners = this.confirmedPartnerCount != null ? this.confirmedPartnerCount : 0; | ||
| return supporters >= 1 && partners >= 1 && !this.earlyStartRequested; | ||
| } | ||
|
|
||
| public void requestEarlyStart() { | ||
| this.earlyStartRequested = true; | ||
| } | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
authorRole = SUPPORTER인 피드에서confirmedSupporterCount = 0 < 1→true반환. 작성자가 이미 서포터 슬롯을 차지했으므로 외부 SUPPORTER 수락이 허용돼서는 안 됩니다.