-
Notifications
You must be signed in to change notification settings - Fork 0
[Feat] Organization 도메인 Port 설계 및 프로젝트 구조 확정 #24
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
Changes from 7 commits
005ca0a
11e5f7a
80a5aa2
f7ac3f9
31ab234
d6e4a41
c48dd16
831a1a7
1696b31
60bf9f7
4e836f1
668b8ca
aa6c4f8
c90b00d
65d6fc1
b4117d5
ff477e7
7fb7ec2
2eb2474
fc01317
55c0d50
34bf48b
5e09723
cf065e6
a7c5aaf
4101481
f36b248
544e2c0
e1d4bd1
5176735
018e6ff
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 |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| package com.umc.product.organization.application.port.in; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| public interface DeleteSchoolUseCase { | ||
| void deleteById(Long schoolId); | ||
| void deleteAll(List<Long> schoolIds); | ||
| } | ||
kyeoungwoon marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,12 @@ | ||||||||||||||||||||||||||||||||||||||||||||
| package com.umc.product.organization.application.port.in; | ||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||
| package com.umc.product.organization.application.port.in; | |
| package com.umc.product.organization.application.port.in.query; |
🤖 Prompt for AI Agents
In
@src/main/java/com/umc/product/organization/application/port/in/GetDeletableSchoolListUseCase.java
around line 1, The GetDeletableSchoolListUseCase interface is placed in the
wrong package; move it from package
com.umc.product.organization.application.port.in to the query subpackage to
follow hexagonal conventions. Update the package declaration to
com.umc.product.organization.application.port.in.query and relocate the file
into the corresponding directory, ensuring the interface name
GetDeletableSchoolListUseCase remains unchanged and any imports/usages elsewhere
are updated to the new package.
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
Outdated
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.
🛠️ Refactor suggestion | 🟠 Major
JavaDoc 문서화와 예외 처리 명세가 누락되었습니다.
코딩 가이드라인에 따르면, 예외 처리가 적절히 정의되어야 합니다. 다음 항목들을 추가하여 인터페이스의 계약을 명확히 해주세요:
- JavaDoc 문서: 메서드의 동작, 파라미터, 반환값, 예외 상황 설명
- 예외 처리 명세:
- condition이 null인 경우
- pageRequest가 null인 경우
- 잘못된 페이징 파라미터인 경우 (음수, 0 등)
- chapterId가 존재하지 않는 경우
As per coding guidelines, 예외가 적절히 처리되었는지 확인하고 의미 있는 커스텀 예외를 사용해야 합니다.
🔎 제안된 수정사항
+/**
+ * 삭제 가능한 학교 목록 조회 UseCase
+ * <p>
+ * 검색 조건과 페이징 정보에 따라 삭제 가능한 학교 목록을 조회하는 인바운드 포트입니다.
+ */
public interface GetDeletableSchoolListUseCase {
+ /**
+ * 삭제 가능한 학교 목록을 페이징 조회합니다.
+ *
+ * @param condition 학교 검색 조건 (키워드, 지부 ID 등)
+ * @param pageRequest 페이징 요청 정보 (페이지 번호, 페이지 크기)
+ * @return 삭제 가능한 학교 요약 정보 목록과 페이징 메타데이터
+ * @throws IllegalArgumentException condition 또는 pageRequest가 null인 경우, 또는 잘못된 페이징 파라미터인 경우
+ * @throws ChapterNotFoundException chapterId가 존재하지 않는 경우
+ */
PageResult<DeletableSchoolSummary> getList(SchoolDeleteSearchCondition condition, PageRequest pageRequest);
}📝 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.
| public interface GetDeletableSchoolListUseCase { | |
| PageResult<DeletableSchoolSummary> getList(SchoolDeleteSearchCondition condition, PageRequest pageRequest); | |
| /** | |
| * 삭제 가능한 학교 목록 조회 UseCase | |
| * <p> | |
| * 검색 조건과 페이징 정보에 따라 삭제 가능한 학교 목록을 조회하는 인바운드 포트입니다. | |
| */ | |
| public interface GetDeletableSchoolListUseCase { | |
| /** | |
| * 삭제 가능한 학교 목록을 페이징 조회합니다. | |
| * | |
| * @param condition 학교 검색 조건 (키워드, 지부 ID 등) | |
| * @param pageRequest 페이징 요청 정보 (페이지 번호, 페이지 크기) | |
| * @return 삭제 가능한 학교 요약 정보 목록과 페이징 메타데이터 | |
| * @throws IllegalArgumentException condition 또는 pageRequest가 null인 경우, 또는 잘못된 페이징 파라미터인 경우 | |
| * @throws ChapterNotFoundException chapterId가 존재하지 않는 경우 | |
| */ | |
| PageResult<DeletableSchoolSummary> getList(SchoolDeleteSearchCondition condition, PageRequest pageRequest); | |
| } |
🤖 Prompt for AI Agents
In
@src/main/java/com/umc/product/organization/application/port/in/GetDeletableSchoolListUseCase.java
around lines 8-10, Add JavaDoc to the GetDeletableSchoolListUseCase interface
and its getList(SchoolDeleteSearchCondition condition, PageRequest pageRequest)
method that documents behavior, parameters, return value, and failure modes;
explicitly declare the checked/unchecked exceptions the contract can throw
(e.g., IllegalArgumentException or a project-specific InvalidParameterException
when condition or pageRequest is null or when paging params are invalid
(negative/zero), and a ResourceNotFoundException or ChapterNotFoundException
when a referenced chapterId does not exist) so callers know expected error cases
and handling; ensure the JavaDoc lists each exceptional case and reference the
parameter types SchoolDeleteSearchCondition, PageRequest and the return type
PageResult<DeletableSchoolSummary> so implementors and callers can follow the
contract.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| package com.umc.product.organization.application.port.in; | ||
|
|
||
|
|
||
| import com.umc.product.organization.application.port.in.dto.SchoolInfo; | ||
| import com.umc.product.organization.application.port.in.dto.SchoolSummary; | ||
| import java.util.List; | ||
|
|
||
| public interface GetSchoolUserCase { | ||
|
||
| List<SchoolSummary> getAll(Long gisuId); | ||
| SchoolInfo getById(Long schoolId); | ||
|
|
||
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| package com.umc.product.organization.application.port.in; | ||
|
|
||
| import com.umc.product.organization.application.port.in.dto.RegisterSchoolCommand; | ||
|
|
||
| public interface RegisterSchoolUseCase { | ||
| Long register(RegisterSchoolCommand command); | ||
| } | ||
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| package com.umc.product.organization.application.port.in; | ||
|
||
|
|
||
| import com.umc.product.organization.application.port.in.dto.UpdateSchoolCommand; | ||
| import com.umc.product.organization.application.port.in.dto.UpdateSchoolInfo; | ||
|
|
||
| public interface UpdateSchoolUseCase { | ||
| UpdateSchoolInfo update(UpdateSchoolCommand command); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| package com.umc.product.organization.application.port.in.dto; | ||
|
|
||
| import java.time.LocalDate; | ||
|
|
||
| public record DeletableSchoolSummary( | ||
| Long schoolId, | ||
| String schoolName, | ||
| Long chapterId, | ||
| String chapterName, | ||
| LocalDate createdAt, | ||
| boolean isActive | ||
| ) { | ||
|
|
||
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,12 @@ | ||||||||||||||||||||||||||||||||||||||||||||||
| package com.umc.product.organization.application.port.in.dto; | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| import com.umc.product.organization.domain.Chapter; | ||||||||||||||||||||||||||||||||||||||||||||||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||||||||||||||
| import jakarta.validation.constraints.NotBlank; | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| public record RegisterSchoolCommand( | ||||||||||||||||||||||||||||||||||||||||||||||
| @NotBlank | ||||||||||||||||||||||||||||||||||||||||||||||
| String schoolName, | ||||||||||||||||||||||||||||||||||||||||||||||
| Long chapterId, | ||||||||||||||||||||||||||||||||||||||||||||||
| String remark | ||||||||||||||||||||||||||||||||||||||||||||||
| ) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||
| public record RegisterSchoolCommand( | |
| @NotBlank | |
| String schoolName, | |
| Long chapterId, | |
| String remark | |
| ) { | |
| } | |
| public record RegisterSchoolCommand( | |
| @NotBlank | |
| String schoolName, | |
| @NotNull | |
| Long chapterId, | |
| String remark | |
| ) { | |
| public School toEntity(Chapter chapter) { | |
| return School.builder() | |
| .schoolName(schoolName) | |
| .chapter(chapter) | |
| .remark(remark) | |
| .build(); | |
| } | |
| } |
🤖 Prompt for AI Agents
In
src/main/java/com/umc/product/organization/application/port/in/dto/RegisterSchoolCommand.java
around lines 6-12, the record lacks a conversion method to transform the DTO
into the domain entity; add a toEntity() (or toDomain()) method that returns a
School domain object constructed from this.schoolName, this.remark and maps
chapterId to the appropriate Chapter reference (e.g., Chapter.ofId(chapterId) or
null if absent) so that DTO-to-entity conversion logic lives in the command
record and downstream services can use the resulting School instance.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| package com.umc.product.organization.application.port.in.dto; | ||
|
|
||
| public record SchoolDeleteSearchCondition( | ||
| String keyword, | ||
| Long chapterId | ||
| ) { | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| package com.umc.product.organization.application.port.in.dto; | ||
|
|
||
| import java.time.LocalDate; | ||
|
|
||
| public record SchoolInfo( | ||
| Long chapterId, | ||
| String chapterName, | ||
| String schoolName, | ||
| Long schoolId, | ||
| String remark, | ||
| LocalDate createdAt, | ||
| LocalDate updatedAt | ||
| ) { | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| package com.umc.product.organization.application.port.in.dto; | ||
|
|
||
| public record SchoolSummary( | ||
| Long schoolId, | ||
| String schoolName | ||
| ) { | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,17 @@ | ||||||||||
| package com.umc.product.organization.application.port.in.dto; | ||||||||||
|
|
||||||||||
| import jakarta.validation.constraints.NotBlank; | ||||||||||
| import jakarta.validation.constraints.NotNull; | ||||||||||
| import java.time.LocalDate; | ||||||||||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||
|
|
||||||||||
| public record UpdateSchoolCommand( | ||||||||||
| @NotNull | ||||||||||
| Long schoolId, | ||||||||||
| @NotBlank | ||||||||||
| String schoolName, | ||||||||||
| @NotNull | ||||||||||
| String chapterId, | ||||||||||
|
||||||||||
| @NotNull | |
| String chapterId, | |
| @NotNull | |
| Long chapterId, |
🤖 Prompt for AI Agents
In
src/main/java/com/umc/product/organization/application/port/in/dto/UpdateSchoolCommand.java
around lines 12-13, the field chapterId is declared as String but
UpdateSchoolInfo expects a Long; change chapterId's type from String to Long
(keeping the @NotNull annotation) so DTO types match across layers, and update
any constructors/getters/setters and usages to accept/return Long to avoid
runtime conversion issues.
Outdated
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.
🧹 Nitpick | 🔵 Trivial
toEntity() 또는 변환 메소드 추가 권장
코딩 가이드라인에 따르면, Command record는 toCommand() 또는 toEntity() 변환 메소드를 포함해야 합니다. 이를 통해 도메인 엔티티로의 변환 로직을 명확하게 캡슐화할 수 있습니다.
Based on learnings, Command records should include conversion method.
🤖 Prompt for AI Agents
In
src/main/java/com/umc/product/organization/application/port/in/dto/UpdateSchoolCommand.java
around lines 7 to 17, the Command record lacks a conversion method; add a
toEntity() (or toCommand()) instance method that converts this DTO into the
domain School entity by creating and returning a School using the record fields
(schoolId, schoolName, chapterId, remark), mapping types appropriately (e.g.,
converting chapterId to the domain identifier type if needed) and using the
domain constructor or builder; ensure imports are added and keep the conversion
logic simple and null-safe.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| package com.umc.product.organization.application.port.in.dto; | ||
|
|
||
| import java.time.LocalDate; | ||
|
|
||
| public record UpdateSchoolInfo( | ||
| String newSchoolName, | ||
| Long chapterId, | ||
| String chapterName, | ||
| String remark, | ||
| LocalDate createdAt, | ||
| LocalDate updatedAt | ||
| ) { | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| package com.umc.product.organization.application.port.in.dto.paging; | ||
|
|
||
| import jakarta.validation.constraints.Max; | ||
| import jakarta.validation.constraints.Min; | ||
|
|
||
| public record PageRequest( | ||
| // common으로 빼도 괜찮을 거 같습니다 | ||
| @Min(1) int page, | ||
| @Min(1) @Max(100) int limit | ||
| ) { | ||
| public long offset() { | ||
| return (long) (page - 1) * limit; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| package com.umc.product.organization.application.port.in.dto.paging; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| public record PageResult<T>( | ||
| List<T> items, | ||
| long totalCount, | ||
| int page, | ||
| int limit | ||
| ) { | ||
| public long totalPages() { | ||
| return (totalCount + limit - 1) / limit; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| package com.umc.product.organization.application.port.out; | ||
|
|
||
| import com.umc.product.organization.domain.CentralOrganization; | ||
| import java.util.Optional; | ||
|
|
||
| public interface LoadCentralOrganizationPort { | ||
|
|
||
| Optional<CentralOrganization> findById(Long id); | ||
|
|
||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| package com.umc.product.organization.application.port.out; | ||
|
|
||
| import com.umc.product.organization.domain.Chapter; | ||
| import com.umc.product.organization.domain.Gisu; | ||
| import java.util.List; | ||
| import java.util.Optional; | ||
|
|
||
| public interface LoadChapterPort { | ||
|
|
||
| Optional<Chapter> findById(Long id); | ||
| List<Chapter> findAll(); | ||
| List<Chapter> findAllByGisu(Gisu gisu); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| package com.umc.product.organization.application.port.out; | ||
|
|
||
| import com.umc.product.organization.domain.Chapter; | ||
| import com.umc.product.organization.domain.ChapterSchool; | ||
| import com.umc.product.organization.domain.School; | ||
| import java.util.List; | ||
| import java.util.Optional; | ||
|
|
||
| public interface LoadChapterSchoolPort { | ||
|
|
||
| Optional<ChapterSchool> findById(Long id); | ||
| Optional<ChapterSchool> findByChapterAndSchool(Chapter chapter, School school); | ||
| List<ChapterSchool> findAllByChapter(Chapter chapter); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| package com.umc.product.organization.application.port.out; | ||
|
|
||
| import com.umc.product.organization.domain.Gisu; | ||
| import java.util.List; | ||
| import java.util.Optional; | ||
|
|
||
| public interface LoadGisuPort { | ||
|
|
||
| Optional<Gisu> findById(Long id); | ||
| List<Gisu> findAll(); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| package com.umc.product.organization.application.port.out; | ||
|
|
||
| import com.umc.product.organization.domain.Chapter; | ||
| import com.umc.product.organization.domain.School; | ||
| import java.util.List; | ||
| import java.util.Optional; | ||
|
|
||
| public interface LoadSchoolPort { | ||
|
|
||
| Optional<School> findById(Long id); | ||
| List<School> findAll(); | ||
| List<School> findByChapter(Chapter chapter); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| package com.umc.product.organization.application.port.out; | ||
|
|
||
| import com.umc.product.organization.domain.StudyGroup; | ||
| import com.umc.product.organization.domain.StudyGroupMember; | ||
| import java.util.List; | ||
| import java.util.Optional; | ||
|
|
||
| public interface LoadStudyGroupMemberPort { | ||
|
|
||
| Optional<StudyGroupMember> findById(Long id); | ||
| List<StudyGroupMember> findByStudyGroup(StudyGroup studyGroup); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| package com.umc.product.organization.application.port.out; | ||
|
|
||
| import com.umc.product.organization.domain.StudyGroup; | ||
| import java.util.Optional; | ||
|
|
||
| public interface LoadStudyGroupPort { | ||
|
|
||
| Optional<StudyGroup> findById(Long id); | ||
| Optional<StudyGroup> findByName(String name); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| package com.umc.product.organization.application.port.out; | ||
|
|
||
| import com.umc.product.organization.domain.CentralOrganization; | ||
|
|
||
| public interface SaveCentralOrganizationPort { | ||
|
|
||
| CentralOrganization save(CentralOrganization organization); | ||
| void delete(CentralOrganization organization); | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,10 @@ | ||||||||||||||
| package com.umc.product.organization.application.port.out; | ||||||||||||||
|
|
||||||||||||||
| import com.umc.product.organization.domain.Chapter; | ||||||||||||||
|
|
||||||||||||||
| public interface SaveChapterPort { | ||||||||||||||
|
|
||||||||||||||
|
|
||||||||||||||
|
||||||||||||||
| public interface SaveChapterPort { | |
| Chapter save(Chapter chapter); | |
| void delete(Chapter chapter); | |
| } |
🤖 Prompt for AI Agents
In
src/main/java/com/umc/product/organization/application/port/out/SaveChapterPort.java
around line 7, remove the unnecessary blank line to match the
formatting/consistency of other Save* port interfaces (e.g., SaveGisuPort,
SaveChapterSchoolPort); simply delete the empty line so the file has no
extraneous blank lines and adheres to the project's interface formatting
conventions.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| package com.umc.product.organization.application.port.out; | ||
|
|
||
| import com.umc.product.organization.domain.ChapterSchool; | ||
|
|
||
| public interface SaveChapterSchoolPort { | ||
|
|
||
| ChapterSchool save(ChapterSchool chapterSchool); | ||
| void delete(ChapterSchool chapterSchool); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| package com.umc.product.organization.application.port.out; | ||
|
|
||
| import com.umc.product.organization.domain.Gisu; | ||
|
|
||
| public interface SaveGisuPort { | ||
|
|
||
| Gisu save(Gisu gisu); | ||
| void delete(Gisu gisu); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| package com.umc.product.organization.application.port.out; | ||
|
|
||
| import com.umc.product.organization.domain.School; | ||
|
|
||
| public interface SaveSchoolPort { | ||
|
|
||
| School save(School school); | ||
| void delete(School school); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| package com.umc.product.organization.application.port.out; | ||
|
|
||
| import com.umc.product.organization.domain.StudyGroupMember; | ||
|
|
||
| public interface SaveStudyGroupMemberPort { | ||
|
|
||
| StudyGroupMember save(StudyGroupMember studyGroupMember); | ||
| void delete(StudyGroupMember studyGroupMember); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| package com.umc.product.organization.application.port.out; | ||
|
|
||
| import com.umc.product.organization.domain.StudyGroup; | ||
|
|
||
| public interface SaveStudyGroupPort { | ||
|
|
||
| StudyGroup save(StudyGroup studyGroup); | ||
| void delete(StudyGroup studyGroup); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| package com.umc.product.organization.domain; | ||
|
|
||
| import com.umc.product.global.exception.BusinessException; | ||
| import com.umc.product.global.exception.constant.Domain; | ||
| import com.umc.product.organization.exception.OrganizationErrorCode; | ||
| import jakarta.persistence.Entity; | ||
| import jakarta.persistence.FetchType; | ||
| import jakarta.persistence.GeneratedValue; | ||
| import jakarta.persistence.GenerationType; | ||
| import jakarta.persistence.Id; | ||
| import jakarta.persistence.JoinColumn; | ||
| import jakarta.persistence.ManyToOne; | ||
| import lombok.AccessLevel; | ||
| import lombok.Builder; | ||
| import lombok.Getter; | ||
| import lombok.NoArgsConstructor; | ||
|
|
||
| @Entity | ||
| @Getter | ||
| @NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
| public class CentralOrganization { | ||
|
|
||
| @Id | ||
| @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| private Long id; | ||
|
|
||
| @ManyToOne(fetch = FetchType.LAZY) | ||
| @JoinColumn(name = "gisu_id") | ||
| private Gisu gisu; | ||
|
|
||
| private String name; | ||
|
|
||
| @Builder | ||
| private CentralOrganization(Gisu gisu, String name) { | ||
| validate(gisu, name); | ||
| this.gisu = gisu; | ||
| this.name = name; | ||
| } | ||
|
|
||
| private static void validate(Gisu gisu, String name) { | ||
| if (gisu == null) throw new BusinessException(Domain.COMMON, OrganizationErrorCode.GISU_REQUIRED); | ||
| if (name == null || name.isBlank()) throw new BusinessException(Domain.COMMON, OrganizationErrorCode.ORGAN_NAME_REQUIRED); | ||
| } | ||
|
|
||
| } |
Uh oh!
There was an error while loading. Please reload this page.