-
Notifications
You must be signed in to change notification settings - Fork 0
[Feat] 프로세스, 워크스페이스 엔티티 설계 및 DTO 정의 #4
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
Merged
Merged
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
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
nect-api/src/main/java/com/nect/api/domain/team/process/controller/ProcessController.java
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 |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| package com.nect.api.domain.team.process.controller; | ||
|
|
||
| import com.nect.api.domain.team.process.dto.req.ProcessCreateReqDto; | ||
| import com.nect.api.domain.team.process.dto.res.ProcessCreateResDto; | ||
| import com.nect.api.global.response.ApiResponse; | ||
| import lombok.RequiredArgsConstructor; | ||
| import org.springframework.web.bind.annotation.*; | ||
|
|
||
| @RestController | ||
| @RequestMapping("/projects/{projectId}/processes") | ||
| @RequiredArgsConstructor | ||
| public class ProcessController { | ||
|
|
||
| // TODO : private final ProcessService processService | ||
|
|
||
| // 새 프로세스 생성 | ||
| @PostMapping | ||
| public ApiResponse<ProcessCreateResDto> createProcess( | ||
| @PathVariable Long projectId, | ||
| @RequestBody ProcessCreateReqDto request | ||
| ) { | ||
| // TODO : Long processId = processService.createProcess(projectId, request); | ||
|
|
||
| Long processId = 1L; // 임시 | ||
| return ApiResponse.ok(new ProcessCreateResDto(processId)); | ||
| } | ||
|
|
||
| } |
48 changes: 48 additions & 0 deletions
48
nect-api/src/main/java/com/nect/api/domain/team/process/dto/req/ProcessCreateReqDto.java
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 |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| package com.nect.api.domain.team.process.dto.req; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonProperty; | ||
| import com.nect.core.entity.team.process.enums.ProcessStatus; | ||
|
|
||
| import java.time.LocalDate; | ||
| import java.util.List; | ||
|
|
||
| public record ProcessCreateReqDto( | ||
| // TODO : @Valid 나중에 필수값 확정되면 사용하기 | ||
|
|
||
| @JsonProperty("process_title") | ||
| String processTitle, | ||
|
|
||
| @JsonProperty("process_content") | ||
| String processContent, | ||
|
|
||
| @JsonProperty("process_status") | ||
| ProcessStatus processStatus, | ||
|
|
||
| @JsonProperty("assignee_ids") | ||
| List<Long> assigneeIds, | ||
|
|
||
| @JsonProperty("field_ids") | ||
| List<Long> fieldIds, | ||
|
|
||
| @JsonProperty("start_date") | ||
| LocalDate startDate, | ||
|
|
||
| @JsonProperty("dead_line") | ||
| LocalDate deadLine, | ||
|
|
||
| @JsonProperty("mentions") | ||
| List<Long> mentions, | ||
|
|
||
| @JsonProperty("file_ids") | ||
| List<Long> fileIds, | ||
|
|
||
| @JsonProperty("links") | ||
| List<String> links, | ||
|
|
||
| @JsonProperty("task_items") | ||
| List<ProcessTaskItemReqDto> taskItems | ||
|
|
||
|
|
||
| // TODO : 일단은 null -> 프로세스 생성할 때 초기 피드백도 같이 등록할 수 있으면 사용 | ||
| // List<ProcessFeedbackCreateReqDTO> feedbacks | ||
| ) {} |
13 changes: 13 additions & 0 deletions
13
nect-api/src/main/java/com/nect/api/domain/team/process/dto/req/ProcessTaskItemReqDto.java
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 |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| package com.nect.api.domain.team.process.dto.req; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
|
||
| public record ProcessTaskItemReqDto( | ||
| String content, | ||
|
|
||
| @JsonProperty("is_done") | ||
| Boolean isDone, | ||
|
|
||
| @JsonProperty("sort_order") | ||
| Integer sortOrder | ||
| ) {} |
14 changes: 14 additions & 0 deletions
14
nect-api/src/main/java/com/nect/api/domain/team/process/dto/res/AssigneeResDto.java
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 |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| package com.nect.api.domain.team.process.dto.res; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
|
||
| public record AssigneeResDto( | ||
| @JsonProperty("user_id") | ||
| Long userId, | ||
|
|
||
| @JsonProperty("user_name") | ||
| String userName, | ||
|
|
||
| @JsonProperty("user_image") | ||
| String userImage | ||
| ) {} |
15 changes: 15 additions & 0 deletions
15
nect-api/src/main/java/com/nect/api/domain/team/process/dto/res/FieldGroupResDto.java
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 |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| package com.nect.api.domain.team.process.dto.res; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| public record FieldGroupResDto( | ||
| @JsonProperty("field_id") | ||
| Long fieldId, | ||
|
|
||
| @JsonProperty("field_name") | ||
| String fieldName, | ||
|
|
||
| List<ProcessCardResDto> processes | ||
| ) {} |
37 changes: 37 additions & 0 deletions
37
nect-api/src/main/java/com/nect/api/domain/team/process/dto/res/ProcessCardResDto.java
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 |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| package com.nect.api.domain.team.process.dto.res; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
|
||
| import java.time.LocalDate; | ||
| import java.util.List; | ||
|
|
||
| public record ProcessCardResDto( | ||
| @JsonProperty("process_id") | ||
| Long processId, | ||
|
|
||
| @JsonProperty("process_status") | ||
| String processStatus, | ||
|
|
||
| // 파트(담당 분야) | ||
| String field, | ||
|
|
||
| String title, | ||
|
|
||
| @JsonProperty("complete_check_list") | ||
| Integer completeCheckList, | ||
|
|
||
| @JsonProperty("whole_check_list") | ||
| Integer wholeCheckList, | ||
|
|
||
| @JsonProperty("start_date") | ||
| LocalDate startDate, | ||
|
|
||
| @JsonProperty("dead_line") | ||
| LocalDate deadLine, | ||
|
|
||
| @JsonProperty("left_day") | ||
| Integer leftDay, | ||
|
|
||
| @JsonProperty("assignee") | ||
| List<AssigneeResDto> assignee | ||
| ) {} |
8 changes: 8 additions & 0 deletions
8
nect-api/src/main/java/com/nect/api/domain/team/process/dto/res/ProcessCreateResDto.java
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 |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| package com.nect.api.domain.team.process.dto.res; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
|
||
| public record ProcessCreateResDto( | ||
| @JsonProperty("process_id") | ||
| Long processId | ||
| ) {} |
16 changes: 16 additions & 0 deletions
16
nect-api/src/main/java/com/nect/api/domain/team/process/dto/res/ProcessWeekResDto.java
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 |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| package com.nect.api.domain.team.process.dto.res; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| public record ProcessWeekResDto( | ||
| @JsonProperty("start_date") | ||
| String startDate, | ||
|
|
||
| @JsonProperty("project_purpose") | ||
| List<ProcessCardResDto> projectPurpose, | ||
|
|
||
| @JsonProperty("by_field") | ||
| List<FieldGroupResDto> byField | ||
| ) {} |
69 changes: 69 additions & 0 deletions
69
nect-core/src/main/java/com/nect/core/entity/team/Project.java
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 |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| package com.nect.core.entity.team; | ||
|
|
||
| import com.nect.core.entity.BaseEntity; | ||
| import com.nect.core.entity.team.enums.ProjectStatus; | ||
| import com.nect.core.entity.team.enums.RecruitmentStatus; | ||
| import jakarta.persistence.*; | ||
| import lombok.*; | ||
|
|
||
| import java.time.LocalDateTime; | ||
|
|
||
| @Entity | ||
| @Getter | ||
| @NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
| @Table(name = "project") | ||
| public class Project extends BaseEntity { | ||
| @Id | ||
| @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| private Long id; | ||
|
|
||
| @Column(name = "title", length = 50, nullable = false) | ||
| private String title; | ||
|
|
||
| @Column(name = "description", length = 100) | ||
| private String description; | ||
|
|
||
| @Column(name = "information", columnDefinition = "TEXT") | ||
| private String information; | ||
|
|
||
| @Enumerated(EnumType.STRING) | ||
| @Column(nullable = false) | ||
| private ProjectStatus status; | ||
|
|
||
| @Column(name = "notice_text", columnDefinition = "TEXT") | ||
| private String noticeText; | ||
|
|
||
| // 정규 회의 | ||
| @Column(name = "regular_meeting_text", columnDefinition = "TEXT") | ||
| private String regularMeetingText; | ||
|
|
||
| // 모집 상태 | ||
| @Enumerated(EnumType.STRING) | ||
| @Column(name = "recruitment_status", nullable = false) | ||
| private RecruitmentStatus recruitmentStatus; | ||
|
|
||
| @Column(name = "ended_at") | ||
| private LocalDateTime endedAt; | ||
|
|
||
|
|
||
| @Builder | ||
| protected Project(String title, | ||
| String description, | ||
| String information, | ||
| ProjectStatus status, | ||
| String noticeText, | ||
| String regularMeetingText) { | ||
| this.title = title; | ||
| this.description = description; | ||
| this.information = information; | ||
| this.status = (status == null) ? ProjectStatus.ACTIVE : status; | ||
| this.noticeText = noticeText; | ||
| this.regularMeetingText = regularMeetingText; | ||
| } | ||
|
|
||
| public void end() { | ||
| this.status = ProjectStatus.ENDED; | ||
| this.recruitmentStatus = RecruitmentStatus.CLOSED; | ||
| this.endedAt = LocalDateTime.now(); | ||
| } | ||
| } |
67 changes: 67 additions & 0 deletions
67
nect-core/src/main/java/com/nect/core/entity/team/ProjectUser.java
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 |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| package com.nect.core.entity.team; | ||
|
|
||
| import com.nect.core.entity.team.enums.ProjectMemberStatus; | ||
| import com.nect.core.entity.team.enums.ProjectMemberType; | ||
| import jakarta.persistence.*; | ||
| import lombok.AccessLevel; | ||
| import lombok.Builder; | ||
| import lombok.Getter; | ||
| import lombok.NoArgsConstructor; | ||
|
|
||
| @Entity | ||
| @NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
| @Getter | ||
| @Table( | ||
| name = "project_user", | ||
| uniqueConstraints = { | ||
| @UniqueConstraint( | ||
| name = "uk_project_user_project_user", | ||
| columnNames = {"project_id", "user_id"} | ||
| ) | ||
| } | ||
| ) | ||
| public class ProjectUser { | ||
| @Id | ||
| @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| private Long id; | ||
|
|
||
| // TODO: User 엔티티 연결되면 연관관계로 변경 | ||
| // @ManyToOne(fetch = FetchType.LAZY) | ||
| // @JoinColumn(name = "user_id", nullable = false) | ||
| // private User user; | ||
|
|
||
| @Column(name = "user_id", nullable = false) | ||
| private Long userId; | ||
|
|
||
| @ManyToOne(fetch = FetchType.LAZY) | ||
| @JoinColumn(name = "project_id", nullable = false) | ||
| private Project project; | ||
|
|
||
| @Enumerated(EnumType.STRING) | ||
| @Column(name = "member_type", nullable = false) | ||
| private ProjectMemberType memberType; | ||
|
|
||
| @Enumerated(EnumType.STRING) | ||
| @Column(name = "member_status", nullable = false) | ||
| private ProjectMemberStatus memberStatus; | ||
|
|
||
| @Builder | ||
| private ProjectUser(Project project, Long userId, ProjectMemberType memberType, ProjectMemberStatus memberStatus) { | ||
| this.project = project; | ||
| this.userId = userId; | ||
| this.memberType = (memberType != null) ? memberType : ProjectMemberType.MEMBER; | ||
| this.memberStatus = (memberStatus != null) ? memberStatus : ProjectMemberStatus.PENDING; | ||
| } | ||
|
|
||
| void setProject(Project project) { | ||
| this.project = project; | ||
| } | ||
|
|
||
| public void activate() { | ||
| this.memberStatus = ProjectMemberStatus.ACTIVE; | ||
| } | ||
|
|
||
| public void kick() { | ||
| this.memberStatus = ProjectMemberStatus.KICKED; | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
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.
엔티티인듯 한데, 최소한의 어노테이션이나 필드는 달아주세요
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.
넵 지금 수정하겠습니다!