-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
45 changed files
with
1,282 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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 MakeUs.Moira.config.security; | ||
|
||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@Getter | ||
@RequiredArgsConstructor | ||
public enum UserRole { | ||
USER("ROLE_USER", "로그인_사용자"); | ||
|
||
private final String key; | ||
private final String title; | ||
} |
42 changes: 42 additions & 0 deletions
42
src/main/java/MakeUs/Moira/config/swagger/SwaggerConfiguration.java
This file contains 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,42 @@ | ||
package MakeUs.Moira.config.swagger; | ||
|
||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import springfox.documentation.builders.ApiInfoBuilder; | ||
import springfox.documentation.builders.ParameterBuilder; | ||
import springfox.documentation.builders.PathSelectors; | ||
import springfox.documentation.builders.RequestHandlerSelectors; | ||
import springfox.documentation.schema.ModelRef; | ||
import springfox.documentation.service.ApiInfo; | ||
import springfox.documentation.service.ApiKey; | ||
import springfox.documentation.service.Parameter; | ||
import springfox.documentation.spi.DocumentationType; | ||
import springfox.documentation.spring.web.plugins.Docket; | ||
import springfox.documentation.swagger2.annotations.EnableSwagger2; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
@Configuration | ||
@EnableSwagger2 | ||
public class SwaggerConfiguration { | ||
@Bean | ||
public Docket swaggerApi() { | ||
|
||
return new Docket(DocumentationType.SWAGGER_2) | ||
.apiInfo(swaggerInfo()) | ||
.select() | ||
.apis(RequestHandlerSelectors.basePackage("MakeUs.Moira.controller")) | ||
.paths(PathSelectors.any()) | ||
.build() | ||
.useDefaultResponseMessages(false); // 기본으로 세팅되는 200,401,403,404 메시지를 표시 하지 않음 | ||
} | ||
|
||
|
||
private ApiInfo swaggerInfo() { | ||
return new ApiInfoBuilder().title("Moira API Documentation") | ||
.description("Moira 앱 개발시 사용되는 서버 API 문서입니다") | ||
.build(); | ||
} | ||
} |
72 changes: 72 additions & 0 deletions
72
src/main/java/MakeUs/Moira/domain/alarmHistory/AlarmHistory.java
This file contains 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,72 @@ | ||
package MakeUs.Moira.domain.alarmHistory; | ||
|
||
import MakeUs.Moira.controller.home.dto.AlarmReadStatusUpdateResponseDto; | ||
import MakeUs.Moira.controller.home.dto.AlarmResponseDto; | ||
import MakeUs.Moira.domain.AuditorEntity; | ||
import MakeUs.Moira.domain.chat.ReadStatus; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import javax.persistence.*; | ||
|
||
@NoArgsConstructor | ||
@Getter | ||
@Entity | ||
public class AlarmHistory extends AuditorEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
private Long userId; | ||
|
||
@Enumerated(EnumType.STRING) | ||
private AlarmType type; | ||
|
||
private Long alarmTargetId; | ||
|
||
private String alarmTargetImage; | ||
|
||
private String alarmContent; | ||
|
||
@Enumerated(EnumType.STRING) | ||
private ReadStatus readStatus; | ||
|
||
@Builder | ||
public AlarmHistory(Long userId, AlarmType type, Long alarmTargetId, String alarmTargetImage, String alarmContent) { | ||
this.userId = userId; | ||
this.type = type; | ||
this.alarmTargetId = alarmTargetId; | ||
this.alarmTargetImage = alarmTargetImage; | ||
this.alarmContent = alarmContent; | ||
readStatus = ReadStatus.UNREAD; | ||
} | ||
|
||
public AlarmResponseDto toAlarmResponseDto() { | ||
return AlarmResponseDto.builder() | ||
.alarmId(id) | ||
.alarmType(type) | ||
.alarmTargetId(alarmTargetId) | ||
.alarmTargetImage(alarmTargetImage) | ||
.alarmContent(alarmContent) | ||
.readStatus(readStatus) | ||
.writtenTime(getCreatedDate()) | ||
.build(); | ||
} | ||
|
||
public AlarmReadStatusUpdateResponseDto toAlarmReadStatusUpdateResponseDto() { | ||
return AlarmReadStatusUpdateResponseDto.builder() | ||
.alarmId(id) | ||
.read(readStatusToBoolean()) | ||
.build(); | ||
} | ||
|
||
private boolean readStatusToBoolean() { | ||
return this.readStatus.equals(ReadStatus.READ); | ||
} | ||
|
||
public void updateReadStatus() { | ||
this.readStatus = ReadStatus.READ; | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/MakeUs/Moira/domain/alarmHistory/AlarmHistoryRepo.java
This file contains 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,11 @@ | ||
package MakeUs.Moira.domain.alarmHistory; | ||
|
||
import org.springframework.data.domain.Pageable; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
import java.util.List; | ||
|
||
public interface AlarmHistoryRepo extends JpaRepository<AlarmHistory, Long> { | ||
List<AlarmHistory> findByUserId(Long userId); | ||
List<AlarmHistory> findByUserIdOrderByCreatedDateDesc(Long userId, Pageable pageable); | ||
} |
24 changes: 24 additions & 0 deletions
24
src/main/java/MakeUs/Moira/domain/alarmHistory/AlarmType.java
This file contains 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,24 @@ | ||
package MakeUs.Moira.domain.alarmHistory; | ||
|
||
import lombok.Getter; | ||
|
||
@Getter | ||
public enum AlarmType { | ||
/* | ||
1. 나한테 쪽지옴 | ||
2. 내가 쓴 모집글에 지원함 | ||
3. 내가 쓴 모집글에 댓글담 | ||
4. 내 댓글에 대댓글담 | ||
5. 내가 지원자이고 팀장한테 초대 받음 | ||
6. 내가 지원자이고 팀장이 지원 거절함 | ||
7. 내가 팀장이고 내가 보낸 초대에 지원자가 수락함 | ||
8. 내가 팀장이고 내가 보낸 초대에 지원자가 거절함 | ||
9. 나에게 리뷰가 달림 | ||
*/ | ||
PROJECT, | ||
APPLY, | ||
APPLY_ANSWER, | ||
INVITE_ANSWER, | ||
REVIEW, | ||
CHATROOM | ||
} |
57 changes: 57 additions & 0 deletions
57
src/main/java/MakeUs/Moira/domain/projectApply/ProjectApply.java
This file contains 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,57 @@ | ||
package MakeUs.Moira.domain.projectApply; | ||
|
||
import MakeUs.Moira.domain.AuditorEntity; | ||
import MakeUs.Moira.domain.position.UserPosition; | ||
import MakeUs.Moira.domain.projectDetail.ProjectDetail; | ||
import MakeUs.Moira.domain.user.User; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import javax.persistence.*; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
@Getter | ||
@Entity | ||
@NoArgsConstructor | ||
public class ProjectApply extends AuditorEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@ManyToOne | ||
private ProjectDetail projectDetail; | ||
|
||
@ManyToOne | ||
private User applicant; | ||
|
||
@ManyToOne | ||
private UserPosition userPosition; | ||
|
||
@OneToMany(mappedBy = "projectApply", cascade = CascadeType.ALL) | ||
private List<OptionalApplyInfo> optionalApplyInfoList = new ArrayList<>(); | ||
|
||
@Enumerated(EnumType.STRING) | ||
private ProjectApplyStatus projectApplyStatus; | ||
|
||
@Builder | ||
public ProjectApply(ProjectDetail projectDetail, User applicant, UserPosition userPosition, List<OptionalApplyInfo> optionalApplyInfoList, ProjectApplyStatus projectApplyStatus) { | ||
this.projectDetail = projectDetail; | ||
this.applicant = applicant; | ||
this.userPosition = userPosition; | ||
this.projectApplyStatus = projectApplyStatus; | ||
} | ||
|
||
public void addOptionalApplyInfo(OptionalApplyInfo optionalApplyInfo){ | ||
this.optionalApplyInfoList.add(optionalApplyInfo); | ||
} | ||
|
||
public void updateProjectApplyStatus(ProjectApplyStatus projectApplyStatus){ | ||
this.projectApplyStatus = projectApplyStatus; | ||
} | ||
} | ||
|
||
|
||
|
10 changes: 10 additions & 0 deletions
10
src/main/java/MakeUs/Moira/domain/projectApply/ProjectApplyRepo.java
This file contains 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,10 @@ | ||
package MakeUs.Moira.domain.projectApply; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
import java.util.List; | ||
|
||
public interface ProjectApplyRepo extends JpaRepository<ProjectApply, Long> { | ||
List<ProjectApply> findAllByApplicant_Id(Long applicantId); | ||
int countByApplicant_Id(Long applicantId); | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/MakeUs/Moira/domain/projectApply/ProjectApplyStatus.java
This file contains 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,11 @@ | ||
package MakeUs.Moira.domain.projectApply; | ||
|
||
public enum ProjectApplyStatus { | ||
USER_APPLIED, | ||
|
||
APPLY_REJECTED, | ||
TEAM_INVITED, | ||
|
||
USER_ACCEPTED, | ||
USER_REJECTED | ||
} |
40 changes: 40 additions & 0 deletions
40
src/main/java/MakeUs/Moira/domain/projectComment/ProjectComment.java
This file contains 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,40 @@ | ||
package MakeUs.Moira.domain.projectComment; | ||
|
||
import MakeUs.Moira.domain.AuditorEntity; | ||
import MakeUs.Moira.domain.projectDetail.ProjectDetail; | ||
import MakeUs.Moira.domain.user.User; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import javax.persistence.*; | ||
|
||
@Entity | ||
@Getter | ||
@NoArgsConstructor | ||
public class ProjectComment extends AuditorEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@ManyToOne | ||
private ProjectDetail projectDetail; | ||
|
||
@ManyToOne | ||
private User writer; | ||
|
||
private String comment; | ||
|
||
// 셀프 양방향 관계 | ||
@ManyToOne | ||
private ProjectComment parentComment; | ||
|
||
@Builder | ||
public ProjectComment(ProjectDetail projectDetail, User writer, String comment, ProjectComment parentComment){ | ||
this.projectDetail = projectDetail; | ||
this.writer = writer; | ||
this.comment = comment; | ||
this.parentComment = parentComment; | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
src/main/java/MakeUs/Moira/domain/projectComment/ProjectCommentRepo.java
This file contains 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,10 @@ | ||
package MakeUs.Moira.domain.projectComment; | ||
|
||
import MakeUs.Moira.domain.projectDetail.ProjectDetail; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
import java.util.List; | ||
|
||
public interface ProjectCommentRepo extends JpaRepository<ProjectComment, Long> { | ||
public List<ProjectComment> findAllByProjectDetailOrderByCreatedDate(ProjectDetail projectDetail); | ||
} |
74 changes: 74 additions & 0 deletions
74
src/main/java/MakeUs/Moira/domain/projectDetail/ProjectDetail.java
This file contains 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,74 @@ | ||
package MakeUs.Moira.domain.projectDetail; | ||
|
||
import MakeUs.Moira.domain.project.*; | ||
import MakeUs.Moira.domain.projectApply.ProjectApply; | ||
import MakeUs.Moira.domain.projectComment.ProjectComment; | ||
import MakeUs.Moira.domain.projectPosition.ProjectPosition; | ||
import lombok.*; | ||
|
||
import javax.persistence.*; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
@Entity | ||
@Getter | ||
@NoArgsConstructor | ||
public class ProjectDetail { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@OneToOne(mappedBy = "projectDetail") | ||
private Project project; | ||
|
||
@OneToMany(mappedBy = "projectDetail", cascade = CascadeType.ALL) | ||
private List<ProjectComment> projectCommentList = new ArrayList<>(); | ||
|
||
@OneToMany(mappedBy = "projectDetail", cascade = CascadeType.ALL) | ||
private List<ProjectApply> projectApplyList = new ArrayList<>(); | ||
|
||
@OneToMany(mappedBy = "projectDetail", cascade = CascadeType.ALL) | ||
private List<ProjectPosition> projectPositionList = new ArrayList<>(); | ||
|
||
private String projectContent; | ||
|
||
@Enumerated(EnumType.STRING) | ||
private ProjectDuration projectDuration; | ||
|
||
@Enumerated(EnumType.STRING) | ||
private ProjectLocalType projectLocalType; | ||
|
||
@Builder | ||
public ProjectDetail(Project project, String projectContent, ProjectDuration projectDuration, ProjectLocalType projectLocalType) { | ||
this.project = project; | ||
this.projectContent = projectContent; | ||
this.projectDuration = projectDuration; | ||
this.projectLocalType = projectLocalType; | ||
} | ||
|
||
public void addProjectComment(ProjectComment projectComment){ | ||
projectCommentList.add(projectComment); | ||
} | ||
|
||
public void addProjectApply(ProjectApply projectApply){ | ||
projectApplyList.add(projectApply); | ||
} | ||
|
||
public void removeProjectComment(ProjectComment projectComment){ | ||
projectCommentList.remove(projectComment); | ||
} | ||
|
||
public void removeProjectApply(ProjectApply projectApply){ | ||
projectApplyList.remove(projectApply); | ||
} | ||
|
||
public void addProjectPosition(ProjectPosition projectPosition){ | ||
projectPositionList.add(projectPosition); | ||
} | ||
|
||
public void updateProjectContent(String projectContent){ | ||
this.projectContent = projectContent; | ||
} | ||
|
||
} |
8 changes: 8 additions & 0 deletions
8
src/main/java/MakeUs/Moira/domain/projectDetail/ProjectDetailRepo.java
This file contains 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 MakeUs.Moira.domain.projectDetail; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface ProjectDetailRepo extends JpaRepository<ProjectDetail, Long> { | ||
} |
5 changes: 5 additions & 0 deletions
5
src/main/java/MakeUs/Moira/domain/projectDetail/ProjectDuration.java
This file contains 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,5 @@ | ||
package MakeUs.Moira.domain.projectDetail; | ||
|
||
public enum ProjectDuration { | ||
ONE_MONTH, THREE_MONTH, SIX_MONTH, ETC | ||
} |
Oops, something went wrong.