Spring Boot 기반 하우스 파티션(공유 주거) 관리 앱 백엔드.
패키지: com.partition
src/main/java/com/partition/
├── domain/ # 도메인별 비즈니스 로직
│ ├── {domain}/
│ │ ├── controller/
│ │ ├── service/
│ │ ├── repository/
│ │ ├── dto/
│ │ │ ├── request/
│ │ │ └── response/
│ │ └── exception/ # 도메인별 ErrorCode enum
│ └── common/
│ └── dto/response/ # ApiResponse<T> 공통 응답
├── entity/ # JPA 엔티티 (도메인 분리 없이 flat 구조)
│ └── enums/ # 엔티티에서 사용하는 enum
└── global/
├── config/ # Security, JWT, Swagger, Firebase 설정
└── exception/ # GlobalExceptionHandler, CustomException, BaseErrorCode
현재 도메인: alarm, auth, calender, chore, common, household,
preference, report, reservation, schedule, supply, user, utilitybill
모든 API는 ApiResponse<T>를 사용한다. (domain/common/dto/response/ApiResponse.java)
// 데이터 있을 때
return ResponseEntity.ok(ApiResponse.onSuccess("200", "메시지", result));
// 데이터 없을 때 (생성/삭제)
return ResponseEntity.ok(ApiResponse.onSuccess("200", "메시지"));{
"isSuccess": true,
"code": "200",
"message": "집안일 완료 처리 성공",
"result": { ... }
}throw new CustomException(SomeDomainErrorCode.ERROR_NAME);
// GlobalExceptionHandler가 자동으로 처리{
"isSuccess": false,
"code": "CHORE_4001",
"message": "에러 메시지",
"error": null
}// domain/{domain}/exception/{Domain}ErrorCode.java
@Getter
@RequiredArgsConstructor
public enum ChoreErrorCode implements BaseErrorCode {
CHORE_NOT_FOUND(404, "집안일을 찾을 수 없습니다."),
NOT_ASSIGNED_USER(403, "해당 집안일에 배정된 사용자가 아닙니다.");
private final int status;
private final String message;
}throw new CustomException(ChoreErrorCode.CHORE_NOT_FOUND);public interface BaseErrorCode {
int getStatus();
String getMessage();
String name();
}@RestController
@RequestMapping("/api/{domain}s")
@RequiredArgsConstructor
public class {Domain}Controller {
@Operation(summary = "요약", description = "상세 설명")
@{HttpMethod}Mapping("/{path}")
public ResponseEntity<ApiResponse<{ResponseDto}>> methodName(
@AuthenticationPrincipal CustomUserDetails userDetails,
@RequestBody @Valid {RequestDto} request) {
Long userId = Long.parseLong(userDetails.getUsername());
// ...
return ResponseEntity.ok(ApiResponse.onSuccess("200", "메시지", result));
}
}@AuthenticationPrincipal CustomUserDetails로 인증 사용자 추출userId = Long.parseLong(userDetails.getUsername())으로 userId 획득- Swagger
@Operation필수
- 메인 브랜치:
develop(통합 브랜치) - 기능 브랜치:
feat/기능명(예:feat/reservation-state-toggle) - 모든 작업은
develop기반으로 브랜치 생성 후 PR
git checkout develop
git pull origin develop
git checkout -b feat/기능명git fetch origin
git rebase origin/develop