-
Notifications
You must be signed in to change notification settings - Fork 0
Schedule and coaching #7
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
Open
AustinSnyd3r
wants to merge
12
commits into
main
Choose a base branch
from
scheduleAndCoaching
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
05c2e3b
mappers and dto for workout schedules
AustinSnyd3r f7e4400
mappers for client agreement and related. also some models
AustinSnyd3r 5f961ca
coaching and client endpoints and services small amount of work for g…
AustinSnyd3r 09e789b
remove workout from training schedule
AustinSnyd3r 3ac69a2
a client can add a workout to their TrainingSchedule
AustinSnyd3r 0224e33
Coach should be able to add to clients training schedule
AustinSnyd3r c644691
movement service controller repo and not found exception.
AustinSnyd3r 9758d6a
api requests working for add workout, delete workout, get-clients-coa…
AustinSnyd3r 71f41c1
dto for agreement and contract ironed out a little. Also small bug fi…
AustinSnyd3r 43f25ef
fixes with adding and removing workout from shcedule modularity
AustinSnyd3r 96efb81
withdraw coach agreement acceptance and helper method to reduce dupli…
AustinSnyd3r cf43831
changed docker to not run tests. And starting on actual integration t…
AustinSnyd3r 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
File renamed without changes.
File renamed without changes.
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
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
Empty file.
Empty file.
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,2 @@ | ||
| GET http://localhost:4004/api/clients/client/coaches | ||
| Authorization: Bearer {{token}} |
23 changes: 23 additions & 0 deletions
23
api-request/client-service/clients/schedule/add-workout-to-schedule.http
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,23 @@ | ||
| POST http://localhost:4004/api/clients/client/schedule/workout | ||
| Authorization: Bearer {{token}} | ||
| Content-Type: application/json | ||
|
|
||
|
|
||
| { | ||
| "exercises" : [ | ||
| { | ||
| "movement" : { | ||
| "id" : "{{created_movement_id}}" | ||
| }, | ||
| "numSets" : "3", | ||
| "numReps" : "10", | ||
| "coachNotes" : "Take these easy if you need to." | ||
| } | ||
| ], | ||
| "date" : "2025-10-20", | ||
| "workoutNotes" : "Hey this is the note. Do good.", | ||
| "isCompleted" : "False", | ||
| "trainingScheduleId" : "" | ||
| } | ||
|
|
||
|
|
2 changes: 2 additions & 0 deletions
2
api-request/client-service/clients/schedule/delete-workout-from-schedule.http
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,2 @@ | ||
| DELETE http://localhost:4004/api/clients/client/schedule/workout/fde2ca82-1a26-4767-adc9-8fbbdfc119e0 | ||
| Authorization: Bearer {{token}} |
5 changes: 5 additions & 0 deletions
5
api-request/client-service/clients/schedule/get-training-schedule.http
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,5 @@ | ||
| ### Get request to get a users training schedule. | ||
| GET http://localhost:4004/api/clients/client/schedule | ||
| Authorization: Bearer {{token}} | ||
|
|
||
| > {% client.global.set("training_schedule_id", response.body.id) %} |
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
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
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 |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| DELETE http://localhost:4004/api/clients/a526c437-cd19-48a2-9804-fdbe091c0b38 | ||
| DELETE http://localhost:4004/api/clients/users/a526c437-cd19-48a2-9804-fdbe091c0b38 | ||
| Authorization: Bearer {{token}} |
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 |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| ### GET request to get the users. | ||
| GET http://localhost:4004/api/clients | ||
| GET http://localhost:4004/api/clients/users | ||
| Authorization: Bearer {{token}} |
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,10 @@ | ||
| POST http://localhost:4004/api/clients/movements | ||
| Authorization: Bearer {{token}} | ||
| Content-Type: application/json | ||
|
|
||
| { | ||
| "name" : "Deadlift", | ||
| "description" : "Sumo or bust." | ||
| } | ||
|
|
||
| > {% client.global.set("created_movement_id", response.body.id) %} |
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,2 @@ | ||
| GET http://localhost:4004/api/clients/movements/{{created_movement_id}} | ||
| Authorization: Bearer {{token}} |
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
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
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
110 changes: 110 additions & 0 deletions
110
client-service/src/main/java/com/cm/clientservice/controller/CoachingController.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,110 @@ | ||
| package com.cm.clientservice.controller; | ||
| import com.cm.clientservice.dto.UserResponseDTO; | ||
| import com.cm.clientservice.dto.contract.template.AgreementTemplateRequestDto; | ||
| import com.cm.clientservice.dto.contract.template.AgreementTemplateResponseDto; | ||
| import com.cm.clientservice.dto.contract.CoachClientAgreementRequestDto; | ||
| import com.cm.clientservice.dto.contract.CoachClientAgreementResponseDto; | ||
| import com.cm.clientservice.dto.scheduling.TrainingScheduleDto; | ||
| import com.cm.clientservice.dto.scheduling.workout.WorkoutRequestDto; | ||
| import com.cm.clientservice.service.UserService; | ||
| import io.swagger.v3.oas.annotations.Operation; | ||
| import io.swagger.v3.oas.annotations.tags.Tag; | ||
| import org.springframework.http.ResponseEntity; | ||
| import org.springframework.web.bind.annotation.*; | ||
|
|
||
| import java.util.List; | ||
| import java.util.UUID; | ||
|
|
||
| @RestController | ||
| @RequestMapping("clients/coaching") | ||
| @Tag(name = "coaching", description = "API for coaching management.") | ||
| public class CoachingController { | ||
|
|
||
| private final UserService userService; | ||
|
|
||
| public CoachingController(UserService userService){ | ||
| this.userService = userService; | ||
| } | ||
|
|
||
| @GetMapping("/clients") | ||
| @Operation(summary= "") | ||
| public ResponseEntity<List<UserResponseDTO>> getClients(@RequestHeader("X-AUTH-ID") String authId){ | ||
|
|
||
| List<UserResponseDTO> clients = userService.getClientsOfCoach(UUID.fromString(authId)); | ||
| return ResponseEntity.ok().body(clients); | ||
| } | ||
|
|
||
| @GetMapping("/clients/{clientId}/schedule") | ||
| @Operation(summary = "Get the clients training schedule for the coach to view. ") | ||
| public ResponseEntity<TrainingScheduleDto> getClientSchedule(@RequestHeader("X-AUTH-ID") String authId, | ||
| @PathVariable String clientId){ | ||
|
|
||
| TrainingScheduleDto trainingScheduleDto = | ||
| userService.getClientTrainingSchedule(UUID.fromString(clientId), UUID.fromString(authId)); | ||
|
|
||
| return ResponseEntity.ok().body(trainingScheduleDto); | ||
| } | ||
|
|
||
| @DeleteMapping("/clients/{clientId}/schedule/workout/{id}") | ||
| public ResponseEntity<TrainingScheduleDto> deleteWorkoutFromClientSchedule(@RequestHeader("X-AUTH-ID") String authId, | ||
| @PathVariable String clientId, | ||
| @PathVariable String id){ | ||
|
|
||
| TrainingScheduleDto trainingScheduleDto = | ||
| userService.removeWorkoutFromClientSchedule(UUID.fromString(authId), UUID.fromString(clientId), UUID.fromString(id)); | ||
|
|
||
| return ResponseEntity.ok().body(trainingScheduleDto); | ||
| } | ||
|
|
||
| @PostMapping("/clients/{clientId}/schedule/workout") | ||
| public ResponseEntity<TrainingScheduleDto> addWorkoutToClientSchedule(@RequestHeader("X-AUTH-ID") String authId, | ||
| @PathVariable String clientId, | ||
| @RequestBody WorkoutRequestDto workoutDto){ | ||
| TrainingScheduleDto trainingScheduleDto = | ||
| userService.addWorkoutToClientsSchedule(UUID.fromString(authId), UUID.fromString(clientId), workoutDto); | ||
|
|
||
| return ResponseEntity.ok().body(trainingScheduleDto); | ||
| } | ||
|
|
||
|
|
||
| @PostMapping("/agreement/{clientId}") | ||
| public ResponseEntity<CoachClientAgreementResponseDto> proposeClientAgreement(@RequestHeader("X-AUTH-ID") String coachAuthId, | ||
| @PathVariable String clientId, | ||
| @RequestBody CoachClientAgreementRequestDto coachClientAgreement){ | ||
| CoachClientAgreementResponseDto dto = | ||
| userService.proposeCoachClientAgreement(UUID.fromString(coachAuthId), | ||
| UUID.fromString(clientId), | ||
| coachClientAgreement); | ||
|
|
||
| return ResponseEntity.ok().body(dto); | ||
| } | ||
|
|
||
| @PutMapping("/agreement/withdraw/{agreementId}") | ||
| public ResponseEntity<CoachClientAgreementResponseDto> withdrawCoachesAgreementAcceptance(@RequestHeader("X-AUTH-ID") String coachAuthId, | ||
| @PathVariable String agreementId){ | ||
| //TODO: Alert user of withdrawal. | ||
| //TODO: Alert billing service of end of contract. | ||
Check noticeCode scanning / devskim A "TODO" or similar was left in source code, possibly indicating incomplete functionality Note
Suspicious comment
|
||
|
|
||
| CoachClientAgreementResponseDto dto = | ||
| userService.withdrawCoachesAgreementAcceptance(UUID.fromString(coachAuthId), UUID.fromString(agreementId)); | ||
|
|
||
| return ResponseEntity.ok().body(dto); | ||
| } | ||
|
|
||
| @PostMapping("/templates") | ||
| public ResponseEntity<AgreementTemplateResponseDto> createAgreementTemplate(@RequestHeader("X-AUTH-ID") String coachAuthId, | ||
| @RequestBody AgreementTemplateRequestDto templateRequestDto){ | ||
| AgreementTemplateResponseDto dto = | ||
| userService.createAgreementTemplate(UUID.fromString(coachAuthId), templateRequestDto); | ||
|
|
||
| return ResponseEntity.ok().body(dto); | ||
| } | ||
|
|
||
| @GetMapping("/templates") | ||
| public ResponseEntity<List<AgreementTemplateResponseDto>> getCoachesAgreementTemplates(@RequestHeader("X-AUTH-ID") String coachAuthId){ | ||
| List<AgreementTemplateResponseDto> dtoList = | ||
| userService.getCoachAgreementTemplates(UUID.fromString(coachAuthId)); | ||
|
|
||
| return ResponseEntity.ok().body(dtoList); | ||
| } | ||
| } | ||
35 changes: 35 additions & 0 deletions
35
client-service/src/main/java/com/cm/clientservice/controller/MovementController.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,35 @@ | ||
| package com.cm.clientservice.controller; | ||
| import com.cm.clientservice.dto.scheduling.movement.MovementCreateRequestDto; | ||
| import com.cm.clientservice.dto.scheduling.movement.MovementResponseDto; | ||
| import com.cm.clientservice.service.MovementService; | ||
| import io.swagger.v3.oas.annotations.tags.Tag; | ||
| import org.springframework.http.ResponseEntity; | ||
| import org.springframework.web.bind.annotation.*; | ||
| import java.util.UUID; | ||
|
|
||
| @RestController | ||
| @RequestMapping("/clients/movements") | ||
| @Tag(name="movements", description = "API for management of movements. ") | ||
| public class MovementController { | ||
|
|
||
| private final MovementService movementService; | ||
| public MovementController(MovementService movementService){ | ||
| this.movementService = movementService; | ||
| } | ||
|
|
||
| @PostMapping | ||
| public ResponseEntity<MovementResponseDto> createMovement(@RequestBody MovementCreateRequestDto movementCreateRequestDto){ | ||
| MovementResponseDto movementResponseDto = | ||
| movementService.createMovement(movementCreateRequestDto); | ||
|
|
||
| return ResponseEntity.ok().body(movementResponseDto); | ||
| } | ||
|
|
||
| @GetMapping("/{movementId}") | ||
| public ResponseEntity<MovementResponseDto> getMovementById(@PathVariable String movementId){ | ||
| MovementResponseDto movementResponseDto = | ||
| movementService.getMovementById(UUID.fromString(movementId)); | ||
|
|
||
| return ResponseEntity.ok().body(movementResponseDto); | ||
| } | ||
| } |
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.
Check notice
Code scanning / devskim
A "TODO" or similar was left in source code, possibly indicating incomplete functionality Note