Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,15 @@ public ResponseEntity<BaseResponse<MatchResponse>> createMatch(
.body(BaseResponse.success("매칭 생성 성공", response));
}

@Operation(summary = "매칭 취소 (관리자 전용)", description = "매칭을 취소 상태로 변경합니다. 이미 시작/종료된 매칭은 취소할 수 없습니다.")
@PatchMapping("/matches/{matchId}/cancel")
public ResponseEntity<BaseResponse<Void>> cancelMatch(
@PathVariable Long matchId
) {
adminService.cancelMatch(matchId);
return ResponseEntity.ok(BaseResponse.success("매칭 취소 성공", null));
}

@Operation(summary = "매칭 삭제 (관리자 전용)", description = "매칭을 강제 삭제합니다.")
@DeleteMapping("/matches/{matchId}")
public ResponseEntity<BaseResponse<Void>> deleteMatch(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,7 @@ public interface AdminService {

MatchResponse createMatch(Long adminId, MatchCreateRequest request); // 매칭 생성

void cancelMatch(Long matchId); // 매칭 취소

void deleteMatch(Long matchId); // 매칭 삭제
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ public MatchResponse createMatch(Long adminId, MatchCreateRequest request) {
return matchService.createMatch(adminId, request);
}

@Override
@Transactional
public void cancelMatch(Long matchId) {
matchService.cancelMatch(matchId);
}

@Override
@Transactional
public void deleteMatch(Long matchId) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.be.sportizebe.domain.facility.dto.request;

import com.be.sportizebe.domain.facility.entity.FacilityType;
import com.be.sportizebe.domain.facility.entity.ParkingType;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
Expand All @@ -24,7 +25,28 @@ public record FacilityCreateRequest(

@Schema(description = "시설 종목 타입", example = "SOCCER")
@NotNull
FacilityType facilityType
FacilityType facilityType,

@Schema(description = "화장실 유무", example = "true")
boolean hasToilet,

@Schema(description = "자판기 유무", example = "false")
boolean hasVendingMachine,

@Schema(description = "샤워실 유무", example = "true")
boolean hasShower,

@Schema(description = "주차 유형 (NONE/FREE/PAID)", example = "FREE")
ParkingType parkingType,

@Schema(description = "구장 가로 크기 (m)", example = "40")
Integer widthMeter,

@Schema(description = "구장 세로 크기 (m)", example = "20")
Integer heightMeter,

Comment on lines +42 to +47
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

구장 크기 필드에 값 범위 검증이 필요합니다.

현재는 음수/0 크기도 통과할 수 있어 잘못된 시설 데이터가 저장될 수 있습니다. 생성 요청에서는 최소 양수 제약을 거는 편이 안전합니다.

제안 수정안
 import io.swagger.v3.oas.annotations.media.Schema;
 import jakarta.validation.constraints.NotBlank;
 import jakarta.validation.constraints.NotNull;
+import jakarta.validation.constraints.Positive;
@@
         `@Schema`(description = "구장 가로 크기 (m)", example = "40")
+        `@Positive`
         Integer widthMeter,
@@
         `@Schema`(description = "구장 세로 크기 (m)", example = "20")
+        `@Positive`
         Integer heightMeter,
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
@Schema(description = "구장 가로 크기 (m)", example = "40")
Integer widthMeter,
@Schema(description = "구장 세로 크기 (m)", example = "20")
Integer heightMeter,
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Positive;
`@Schema`(description = "구장 가로 크기 (m)", example = "40")
`@Positive`
Integer widthMeter,
`@Schema`(description = "구장 세로 크기 (m)", example = "20")
`@Positive`
Integer heightMeter,
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/main/java/com/be/sportizebe/domain/facility/dto/request/FacilityCreateRequest.java`
around lines 42 - 47, Add strict positive-range validation to the facility
dimension fields in FacilityCreateRequest so negative or zero sizes cannot be
submitted: annotate the Integer fields widthMeter and heightMeter with a
bean-validation constraint such as `@Min`(1) or `@Positive` and update imports
(javax/ jakarta.validation.constraints.*) accordingly, and ensure any existing
validation groups/DTO usage will trigger validation on create requests so
invalid payloads return 400.

@Schema(description = "휠체어 접근 가능 여부", example = "true")
boolean wheelchairAccessible

) {
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.be.sportizebe.domain.facility.dto.request;

import com.be.sportizebe.domain.facility.entity.FacilityType;
import com.be.sportizebe.domain.facility.entity.ParkingType;
import io.swagger.v3.oas.annotations.media.Schema;

@Schema(description = "체육시설 수정 요청 (null 필드는 수정하지 않음)")
Expand All @@ -19,6 +20,27 @@ public record FacilityUpdateRequest(
String thumbnailUrl,

@Schema(description = "시설 종목 타입", example = "SOCCER")
FacilityType facilityType
FacilityType facilityType,

@Schema(description = "화장실 유무", example = "true")
Boolean hasToilet,

@Schema(description = "자판기 유무", example = "false")
Boolean hasVendingMachine,

@Schema(description = "샤워실 유무", example = "true")
Boolean hasShower,

@Schema(description = "주차 유형 (NONE/FREE/PAID)", example = "FREE")
ParkingType parkingType,

@Schema(description = "구장 가로 크기 (m)", example = "40")
Integer widthMeter,

@Schema(description = "구장 세로 크기 (m)", example = "20")
Integer heightMeter,
Comment on lines +37 to +41
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

구장 크기에 음수/0 값이 들어갈 수 있습니다.

Line 37-41은 값 경계 검증이 없어 비정상 규격 데이터가 저장될 수 있습니다.

🧩 제안 수정안
+import jakarta.validation.constraints.Min;
@@
         `@Schema`(description = "구장 가로 크기 (m)", example = "40")
+        `@Min`(value = 1, message = "구장 가로 크기는 1m 이상이어야 합니다.")
         Integer widthMeter,
@@
         `@Schema`(description = "구장 세로 크기 (m)", example = "20")
+        `@Min`(value = 1, message = "구장 세로 크기는 1m 이상이어야 합니다.")
         Integer heightMeter,
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/main/java/com/be/sportizebe/domain/facility/dto/request/FacilityUpdateRequest.java`
around lines 37 - 41, The DTO FacilityUpdateRequest allows widthMeter and
heightMeter to be zero or negative; add bean validation to enforce positive
dimensions by annotating the Integer fields widthMeter and heightMeter with an
appropriate constraint such as `@Min`(1) or `@Positive` (and import
javax.validation.constraints.*), and ensure the controller uses `@Valid` on the
request parameter so invalid values are rejected before persistence.


@Schema(description = "휠체어 접근 가능 여부", example = "true")
Boolean wheelchairAccessible

) {}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.be.sportizebe.domain.facility.dto.response;

import com.be.sportizebe.domain.facility.entity.FacilityType;
import com.be.sportizebe.domain.facility.entity.ParkingType;
import io.swagger.v3.oas.annotations.media.Schema;

@Schema(description = "체육시설 단건 조회 응답")
Expand Down Expand Up @@ -28,7 +29,28 @@ public record FacilityResponse(
double lat,

@Schema(description = "경도", example = "126.982")
double lng
double lng,

@Schema(description = "화장실 유무", example = "true")
boolean hasToilet,

@Schema(description = "자판기 유무", example = "false")
boolean hasVendingMachine,

@Schema(description = "샤워실 유무", example = "true")
boolean hasShower,

@Schema(description = "주차 유형 (NONE/FREE/PAID)", example = "FREE")
ParkingType parkingType,

@Schema(description = "구장 가로 크기 (m)", example = "40")
Integer widthMeter,

@Schema(description = "구장 세로 크기 (m)", example = "20")
Integer heightMeter,

@Schema(description = "휠체어 접근 가능 여부", example = "true")
boolean wheelchairAccessible

) {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.be.sportizebe.domain.facility.entity;

public enum ParkingType {
NONE, // 주차장 없음
FREE, // 무료 주차
PAID // 유료 주차
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class SportsFacility extends BaseTimeEntity {
@Column(columnDefinition = "text")
private String introduce;

// 리소스 부담 생각해서 일단 썸네일 이미지 1장으로만 구현하는 방식
// 리소스 부담 생각해서 일단 썸네일 이미지 1/치장으로만 구현하는 방식
private String thumbnailUrl;

@Enumerated(EnumType.STRING)
Expand All @@ -35,6 +35,27 @@ public class SportsFacility extends BaseTimeEntity {
@Column(columnDefinition = "geography(Point, 4326)", nullable = false)
private Point location;

// 편의시설
@Column(nullable = false)
private boolean hasToilet;

@Column(nullable = false)
private boolean hasVendingMachine;

@Column(nullable = false)
private boolean hasShower;

@Enumerated(EnumType.STRING)
@Column(nullable = false, length = 10)
private ParkingType parkingType;

// 구장 크기 (미터)
private Integer widthMeter;
private Integer heightMeter;

@Column(nullable = false)
private boolean wheelchairAccessible;
Comment on lines +39 to +57
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

# First, let's explore the repository structure to find migration-related directories
find . -type d \( -name "*migration*" -o -name "*liquibase*" -o -name "*flyway*" -o -name "*sql*" -o -name "db" \) 2>/dev/null | head -20

Repository: Sportize/be

Length of output: 37


🏁 Script executed:

# Search for database migration files with common patterns
git ls-files | grep -E "\.(sql|xml|yaml|yml)$" | grep -iE "(migration|liquibase|flyway|sql)" | head -30

Repository: Sportize/be

Length of output: 37


🏁 Script executed:

# Search for sports_facilities table references in the codebase
rg -i "sports_facilities" --type sql --type xml --type yaml -n

Repository: Sportize/be

Length of output: 37


🏁 Script executed:

# Check for Liquibase or Flyway configuration in Gradle files
rg -i "liquibase|flyway" --type gradle --type text -A 3 -B 1

Repository: Sportize/be

Length of output: 83


🏁 Script executed:

# Search for any DEFAULT or migration-related content related to the new columns
rg -i "(has_toilet|has_vending_machine|has_shower|parking_type|wheelchair_accessible|width_meter|height_meter)" -n

Repository: Sportize/be

Length of output: 37


🏁 Script executed:

# List the overall directory structure
ls -la && echo "---" && find . -type d -maxdepth 3 | head -40

Repository: Sportize/be

Length of output: 1528


🏁 Script executed:

# Look for any SQL files anywhere in the repository
find . -name "*.sql" -o -name "*.ddl" 2>/dev/null

Repository: Sportize/be

Length of output: 37


🏁 Script executed:

# Check the build.gradle or gradle files for database/migration configuration
find . -name "*.gradle" -o -name "*.gradle.kts" | head -5

Repository: Sportize/be

Length of output: 87


🏁 Script executed:

# Look at the root build.gradle or build.gradle.kts
find . -maxdepth 2 -name "build.gradle*" -exec cat {} \;

Repository: Sportize/be

Length of output: 1969


🏁 Script executed:

# Check if there's any database configuration or JPA/Hibernate setup
rg -i "jpa|hibernate|database|datasource|migration" -A 2 --type gradle --type yaml --type xml | head -50

Repository: Sportize/be

Length of output: 324


🏁 Script executed:

# Look for application configuration files
find ./src -name "application*.properties" -o -name "application*.yml" -o -name "application*.yaml"

Repository: Sportize/be

Length of output: 37


🏁 Script executed:

# Check application.properties content
find ./src -name "application*.properties" -exec cat {} \;

Repository: Sportize/be

Length of output: 37


🏁 Script executed:

# Check application.yml content
find ./src -name "application*.yml" -o -name "application*.yaml" | head -5 | xargs cat 2>/dev/null

Repository: Sportize/be

Length of output: 37


🏁 Script executed:

# Look for schema.sql or data.sql initialization files
find ./src -name "schema*.sql" -o -name "data.sql" -o -name "init*.sql"

Repository: Sportize/be

Length of output: 37


🏁 Script executed:

# Read the SportsFacility.java entity to check for defaults
cat -n ./src/main/java/com/be/sportizebe/domain/facility/entity/SportsFacility.java

Repository: Sportize/be

Length of output: 3494


기존 데이터를 위한 NOT NULL 컬럼 마이그레이션 및 DEFAULT 값 설정이 필요합니다.

sports_facilities 테이블에 7개의 NOT NULL 컬럼이 데이터베이스 기본값 없이 추가되고 있습니다:

  • hasToilet, hasVendingMachine, hasShower, wheelchairAccessible (primitive boolean - DEFAULT 없음)
  • parkingType (Enum 타입 - DEFAULT 없음)

현재 저장소에는 Liquibase/Flyway 마이그레이션 프레임워크가 없으며, 데이터베이스 스키마 초기화 파일(schema.sql, data.sql) 또는 DEFAULT 값 정의도 없습니다. 기존 sports_facilities 데이터가 있는 경우, 이 컬럼들을 추가할 때 스키마 적용 실패 또는 제약 조건 위반이 발생할 수 있습니다.

다음 중 하나를 적용하세요:

  • Liquibase/Flyway 마이그레이션 파일에 DEFAULT 값 및 UPDATE 백필 처리 추가
  • 또는 entity에 columnDefinition = "DEFAULT 값" 또는 @ColumnDefault 적용
  • 또는 Hibernate ddl-auto=create-drop 대신 적절한 마이그레이션 전략 도입
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/main/java/com/be/sportizebe/domain/facility/entity/SportsFacility.java`
around lines 39 - 57, The new NOT NULL fields in SportsFacility (hasToilet,
hasVendingMachine, hasShower, wheelchairAccessible, parkingType) need default
values or a backfill migration to avoid schema apply failures for existing rows;
either add explicit column defaults on the entity (e.g., `@Column`(nullable =
false, columnDefinition="boolean default false") or `@ColumnDefault`("false") for
the four booleans and a sensible default string for parkingType) and ensure the
Java fields have matching initial values, or create a proper migration
(Liquibase/Flyway) that adds the columns with DEFAULT clauses and performs an
UPDATE backfill before dropping defaults — update the SportsFacility class
fields and/or add the migration so schema changes are safe for preexisting data.


// 변경 메서드(Dirty Checking용)
public void changeInfo(String facilityName, String introduce, String thumbnailUrl, FacilityType facilityType) {
if (facilityName != null) this.facilityName = facilityName;
Expand All @@ -43,6 +64,18 @@ public void changeInfo(String facilityName, String introduce, String thumbnailUr
if (facilityType != null) this.facilityType = facilityType;
}

public void changeAmenity(Boolean hasToilet, Boolean hasVendingMachine, Boolean hasShower,
ParkingType parkingType, Integer widthMeter, Integer heightMeter,
Boolean wheelchairAccessible) {
if (hasToilet != null) this.hasToilet = hasToilet;
if (hasVendingMachine != null) this.hasVendingMachine = hasVendingMachine;
if (hasShower != null) this.hasShower = hasShower;
if (parkingType != null) this.parkingType = parkingType;
if (widthMeter != null) this.widthMeter = widthMeter;
if (heightMeter != null) this.heightMeter = heightMeter;
if (wheelchairAccessible != null) this.wheelchairAccessible = wheelchairAccessible;
}

public void changeAddress(String address) {
this.address = address;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,14 @@ static FacilityResponse toFacilityResponse(SportsFacility sf) {
sf.getThumbnailUrl(),
sf.getFacilityType(),
lat,
lng
lng,
sf.isHasToilet(),
sf.isHasVendingMachine(),
sf.isHasShower(),
sf.getParkingType(),
sf.getWidthMeter(),
sf.getHeightMeter(),
sf.isWheelchairAccessible()
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.be.sportizebe.domain.facility.dto.response.FacilityMarkerResponse;
import com.be.sportizebe.domain.facility.dto.response.FacilityNearResponse;
import com.be.sportizebe.domain.facility.dto.response.FacilityResponse;
import com.be.sportizebe.domain.facility.entity.ParkingType;
import com.be.sportizebe.domain.facility.entity.SportsFacility;
import com.be.sportizebe.domain.facility.mapper.FacilityMapper;
import com.be.sportizebe.domain.facility.repository.SportsFacilityRepository;
Expand Down Expand Up @@ -81,6 +82,13 @@ public FacilityResponse create(FacilityCreateRequest request) {
.thumbnailUrl(request.thumbnailUrl())
.facilityType(request.facilityType())
.location(point)
.hasToilet(request.hasToilet())
.hasVendingMachine(request.hasVendingMachine())
.hasShower(request.hasShower())
.parkingType(request.parkingType() != null ? request.parkingType() : ParkingType.NONE)
.widthMeter(request.widthMeter())
.heightMeter(request.heightMeter())
.wheelchairAccessible(request.wheelchairAccessible())
.build();

SportsFacility saved = sportsFacilityRepository.save(facility);
Expand All @@ -106,6 +114,16 @@ public FacilityResponse update(Long facilityId, FacilityUpdateRequest request) {
request.facilityType()
);

facility.changeAmenity(
request.hasToilet(),
request.hasVendingMachine(),
request.hasShower(),
request.parkingType(),
request.widthMeter(),
request.heightMeter(),
request.wheelchairAccessible()
);

return FacilityMapper.toFacilityResponse(facility);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.be.sportizebe.domain.match.dto.request;

import com.be.sportizebe.common.enums.SportType;
import com.be.sportizebe.domain.match.entity.UniformPolicy;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Future;
import jakarta.validation.constraints.Max;
Expand Down Expand Up @@ -32,6 +33,16 @@ public record MatchCreateRequest(
@Schema(description = "매칭 시작 일시", example = "2026-03-07T14:00:00")
@NotNull(message = "매칭 시작 일시는 필수입니다.")
@Future(message = "매칭 시작 일시는 현재 시간 이후여야 합니다.")
LocalDateTime scheduledAt
LocalDateTime scheduledAt,

@Schema(description = "유니폼 정책 (BRING_OWN: 흰/검 지참, VEST_PROVIDED: 조끼 제공)", example = "BRING_OWN")
UniformPolicy uniformPolicy,

@Schema(description = "몇 파전 (미입력 시 2파전)", example = "2")
@Min(value = 2, message = "파전 수는 2 이상이어야 합니다.")
Integer numberOfTeams,

@Schema(description = "남/녀 혼성 허용 여부", example = "false")
boolean mixedGender
Comment on lines +45 to +46
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

mixedGender를 primitive로 두면 필드 누락이 조용히 false 처리됩니다.

Line 46은 요청에서 필드가 빠져도 검증 없이 false로 들어가서, 클라이언트 누락과 의도적 false를 구분할 수 없습니다. 필수 입력이라면 Boolean + @NotNull``로 명시해 주세요.

💡 제안 수정안
-        `@Schema`(description = "남/녀 혼성 허용 여부", example = "false")
-        boolean mixedGender
+        `@Schema`(description = "남/녀 혼성 허용 여부", example = "false")
+        `@NotNull`(message = "혼성 허용 여부는 필수입니다.")
+        Boolean mixedGender
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
@Schema(description = "남/녀 혼성 허용 여부", example = "false")
boolean mixedGender
`@Schema`(description = "남/녀 혼성 허용 여부", example = "false")
`@NotNull`(message = "혼성 허용 여부는 필수입니다.")
Boolean mixedGender
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/main/java/com/be/sportizebe/domain/match/dto/request/MatchCreateRequest.java`
around lines 45 - 46, The mixedGender field in MatchCreateRequest is a primitive
boolean so missing request values silently default to false; change its type
from primitive boolean to the wrapper Boolean (field name mixedGender in class
MatchCreateRequest) and, if the field is required, annotate it with `@NotNull`
(and update imports) so you can distinguish absent values from an explicit
false; also update any related `@Schema` or validation annotations/examples
accordingly.


) {}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.be.sportizebe.domain.match.entity.MatchParticipantStatus;
import com.be.sportizebe.domain.match.entity.MatchRoom;
import com.be.sportizebe.domain.match.entity.UniformPolicy;
import com.be.sportizebe.common.enums.SportType;
import com.be.sportizebe.domain.user.entity.User;
import io.swagger.v3.oas.annotations.media.Schema;
Expand Down Expand Up @@ -34,7 +35,16 @@ public record MatchDetailResponse(
boolean joined,

@Schema(description = "매칭 시작 일시", example = "2026-03-07T14:00:00")
LocalDateTime scheduledAt
LocalDateTime scheduledAt,

@Schema(description = "유니폼 정책 (BRING_OWN: 흰/검 지참, VEST_PROVIDED: 조끼 제공)", example = "BRING_OWN")
UniformPolicy uniformPolicy,

@Schema(description = "몇 파전", example = "2")
int numberOfTeams,

@Schema(description = "남/녀 혼성 허용 여부", example = "false")
boolean mixedGender

) {
public static MatchDetailResponse of(
Expand All @@ -58,7 +68,10 @@ public static MatchDetailResponse of(
participantIds.size(),
participantIds,
joined,
matchRoom.getScheduledAt()
matchRoom.getScheduledAt(),
matchRoom.getUniformPolicy(),
matchRoom.getNumberOfTeams(),
matchRoom.isMixedGender()
);
}
}
25 changes: 23 additions & 2 deletions src/main/java/com/be/sportizebe/domain/match/entity/MatchRoom.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,16 @@ public class MatchRoom extends BaseTimeEntity {
@Column(nullable = false)
private LocalDateTime scheduledAt; // 매칭 시작 일시

@Enumerated(EnumType.STRING)
@Column(length = 20)
private UniformPolicy uniformPolicy; // 흰/검 지참 or 조끼 제공

@Column(nullable = false)
@Builder.Default
private int numberOfTeams = 2; // 몇 파전 (default: 2파전)

@Column(nullable = false)
private boolean mixedGender; // 남/녀 혼성 허용 여부

@OneToMany(mappedBy = "matchRoom", cascade = CascadeType.ALL, orphanRemoval = true)
@Builder.Default
Expand All @@ -59,7 +69,7 @@ public boolean isFull() {
}

public static MatchRoom create(MatchCreateRequest request) {
return MatchRoom.builder()
MatchRoom.MatchRoomBuilder builder = MatchRoom.builder()
.sportsName(request.sportsName())
.facilityId(request.facilityId())
.curMembers(0)
Expand All @@ -68,7 +78,14 @@ public static MatchRoom create(MatchCreateRequest request) {
.durationMinutes(request.durationMinutes())
.entryFee(request.entryFee())
.scheduledAt(request.scheduledAt())
.build();
.uniformPolicy(request.uniformPolicy())
.mixedGender(request.mixedGender());

if (request.numberOfTeams() != null) {
builder.numberOfTeams(request.numberOfTeams());
}

return builder.build();
}
public void join() {
this.curMembers++;
Expand All @@ -79,5 +96,9 @@ public void leave() {
if (this.status == MatchStatus.FULL) this.status = MatchStatus.OPEN;
}

public void cancel() {
this.status = MatchStatus.CANCELLED;
}


}
Loading