-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from StudyFlexUMC5th/changmin
Changmin
- Loading branch information
Showing
11 changed files
with
285 additions
and
7 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
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
16 changes: 16 additions & 0 deletions
16
src/main/java/com/umc/StudyFlexBE/dto/response/ProgressRes.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,16 @@ | ||
package com.umc.StudyFlexBE.dto.response; | ||
|
||
import lombok.*; | ||
|
||
import java.time.LocalDate; | ||
|
||
@Builder | ||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@AllArgsConstructor | ||
public class ProgressRes { | ||
private int week; | ||
private LocalDate start_date; | ||
private double participant_rate; | ||
private boolean completed; | ||
} |
15 changes: 15 additions & 0 deletions
15
src/main/java/com/umc/StudyFlexBE/dto/response/StudyDetailRes.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,15 @@ | ||
package com.umc.StudyFlexBE.dto.response; | ||
|
||
import com.umc.StudyFlexBE.entity.StudyStatus; | ||
import lombok.*; | ||
|
||
@Builder | ||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@AllArgsConstructor | ||
public class StudyDetailRes { | ||
private int max_members; | ||
private int current_members; | ||
private StudyStatus study_status; | ||
private double total_progress_rate; | ||
} |
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,23 @@ | ||
package com.umc.StudyFlexBE.entity; | ||
|
||
import jakarta.persistence.*; | ||
import lombok.*; | ||
|
||
@Entity | ||
@Getter | ||
@AllArgsConstructor | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@Builder | ||
public class Completed { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "progress_id") | ||
private Progress progress; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "study_participation_id") | ||
private StudyParticipation studyParticipation; | ||
} |
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,36 @@ | ||
package com.umc.StudyFlexBE.entity; | ||
|
||
import jakarta.persistence.*; | ||
import lombok.*; | ||
import org.hibernate.annotations.ColumnDefault; | ||
|
||
import java.time.LocalDate; | ||
|
||
@Entity | ||
@Getter | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class Progress { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@Column(name = "start_date") | ||
private LocalDate startDate; | ||
|
||
@Column(name = "completed_number") | ||
@ColumnDefault("0") | ||
private Integer completedNumber; | ||
|
||
private Integer week; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "study_id") | ||
private Study study; | ||
|
||
public int addCompletedNumber(){ | ||
return ++completedNumber; | ||
} | ||
|
||
} |
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
12 changes: 12 additions & 0 deletions
12
src/main/java/com/umc/StudyFlexBE/repository/CompletedRepository.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,12 @@ | ||
package com.umc.StudyFlexBE.repository; | ||
|
||
import com.umc.StudyFlexBE.entity.Completed; | ||
import com.umc.StudyFlexBE.entity.Progress; | ||
import com.umc.StudyFlexBE.entity.StudyParticipation; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface CompletedRepository extends JpaRepository<Completed, Long> { | ||
boolean existsByProgressAndStudyParticipation(Progress progress, StudyParticipation studyParticipation); | ||
} |
15 changes: 15 additions & 0 deletions
15
src/main/java/com/umc/StudyFlexBE/repository/ProgressRepository.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,15 @@ | ||
package com.umc.StudyFlexBE.repository; | ||
|
||
import com.umc.StudyFlexBE.entity.Progress; | ||
import com.umc.StudyFlexBE.entity.Study; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
@Repository | ||
public interface ProgressRepository extends JpaRepository<Progress,Long> { | ||
Optional<Progress> findByWeekAndStudy(int week, Study study); | ||
List<Progress> findAllByStudy(Study study); | ||
} |
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
Oops, something went wrong.