-
Notifications
You must be signed in to change notification settings - Fork 3
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 #271 from bounswe/issue#261-change-training-progra…
…m-model Issue#261 Change Training Program Model
- Loading branch information
Showing
16 changed files
with
345 additions
and
62 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
backend/demo-group7/src/main/java/com/group7/demo/dtos/WeekRequest.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.group7.demo.dtos; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
import org.springframework.lang.NonNull; | ||
|
||
import java.util.List; | ||
|
||
@Data | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class WeekRequest { | ||
@NonNull | ||
private List<WorkoutRequest> workouts; | ||
} |
16 changes: 16 additions & 0 deletions
16
backend/demo-group7/src/main/java/com/group7/demo/dtos/WeekResponse.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.group7.demo.dtos; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
|
||
import java.util.List; | ||
|
||
@Data | ||
@AllArgsConstructor | ||
@Builder | ||
public class WeekResponse { | ||
private Long id; | ||
private int weekNumber; | ||
private List<WorkoutResponse> workouts; | ||
} |
18 changes: 18 additions & 0 deletions
18
backend/demo-group7/src/main/java/com/group7/demo/dtos/WorkoutExerciseRequest.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,18 @@ | ||
package com.group7.demo.dtos; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
import org.springframework.lang.NonNull; | ||
|
||
@Data | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class WorkoutExerciseRequest { | ||
@NonNull | ||
private Long exerciseId; | ||
@NonNull | ||
private int repetitions; | ||
@NonNull | ||
private int sets; | ||
} |
17 changes: 17 additions & 0 deletions
17
backend/demo-group7/src/main/java/com/group7/demo/dtos/WorkoutExerciseResponse.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,17 @@ | ||
package com.group7.demo.dtos; | ||
|
||
import com.group7.demo.models.Exercise; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
|
||
@Data | ||
@Builder | ||
@AllArgsConstructor | ||
public class WorkoutExerciseResponse { | ||
private Long id; | ||
private int exerciseNumber; | ||
private Exercise exercise; | ||
private int repetitions; | ||
private int sets; | ||
} |
20 changes: 20 additions & 0 deletions
20
backend/demo-group7/src/main/java/com/group7/demo/dtos/WorkoutRequest.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,20 @@ | ||
package com.group7.demo.dtos; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
import org.springframework.lang.NonNull; | ||
|
||
import java.util.List; | ||
|
||
|
||
@Data | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class WorkoutRequest { | ||
@NonNull | ||
private String name; | ||
@NonNull | ||
private List<WorkoutExerciseRequest> exercises; | ||
} | ||
|
17 changes: 17 additions & 0 deletions
17
backend/demo-group7/src/main/java/com/group7/demo/dtos/WorkoutResponse.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,17 @@ | ||
package com.group7.demo.dtos; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
|
||
import java.util.List; | ||
|
||
@Data | ||
@AllArgsConstructor | ||
@Builder | ||
public class WorkoutResponse { | ||
private Long id; | ||
private String name; | ||
private int workoutNumber; | ||
private List<WorkoutExerciseResponse> workoutExercises; | ||
} |
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
31 changes: 31 additions & 0 deletions
31
backend/demo-group7/src/main/java/com/group7/demo/models/Week.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,31 @@ | ||
package com.group7.demo.models; | ||
|
||
import com.fasterxml.jackson.annotation.JsonBackReference; | ||
import com.fasterxml.jackson.annotation.JsonManagedReference; | ||
import jakarta.persistence.*; | ||
import lombok.*; | ||
|
||
import java.util.List; | ||
|
||
@Entity | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@Getter | ||
@Setter | ||
@Builder | ||
public class Week { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
private int weekNumber; | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "training_program_id", nullable = false) | ||
@JsonBackReference | ||
private TrainingProgram trainingProgram; | ||
|
||
@OneToMany(mappedBy = "week", cascade = CascadeType.ALL) | ||
@JsonManagedReference | ||
private List<Workout> workouts; | ||
} |
33 changes: 33 additions & 0 deletions
33
backend/demo-group7/src/main/java/com/group7/demo/models/Workout.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,33 @@ | ||
package com.group7.demo.models; | ||
|
||
import com.fasterxml.jackson.annotation.JsonBackReference; | ||
import com.fasterxml.jackson.annotation.JsonManagedReference; | ||
import jakarta.persistence.*; | ||
import lombok.*; | ||
|
||
import java.util.List; | ||
|
||
@Entity | ||
@NoArgsConstructor | ||
@Builder | ||
@AllArgsConstructor | ||
@Getter | ||
@Setter | ||
public class Workout { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
private String name; | ||
|
||
private int workoutNumber; | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "week_id") | ||
@JsonBackReference | ||
private Week week; | ||
|
||
@OneToMany(mappedBy = "workout", cascade = CascadeType.ALL) | ||
@JsonManagedReference | ||
private List<WorkoutExercise> exercises; | ||
} |
Oops, something went wrong.