Merge remote-tracking branch 'refs/remotes/origin/main'
This commit is contained in:
@@ -114,7 +114,24 @@ public class SessionResource {
|
|||||||
return ResponseEntity.noContent().build();
|
return ResponseEntity.noContent().build();
|
||||||
}
|
}
|
||||||
|
|
||||||
//Commented because not finished
|
@GetMapping("/{id}/activities")
|
||||||
|
@PreAuthorize("hasRole('coach') or hasRole('athlete')")
|
||||||
|
public ResponseEntity<?> getActivitiesBySessionId(@PathVariable Integer id) {
|
||||||
|
try {
|
||||||
|
Session session = sessionDAO.findById(id).orElseThrow();
|
||||||
|
List<Activite> activites = session.getActivites();
|
||||||
|
List<ActiviteDTO> activiteDTOs = new ArrayList<>();
|
||||||
|
for (Activite activite : activites) {
|
||||||
|
ActiviteDTO dto = new ActiviteDTO();
|
||||||
|
dto.setId(activite.getId());
|
||||||
|
dto.setName(activite.getName());
|
||||||
|
activiteDTOs.add(dto);
|
||||||
|
}
|
||||||
|
return ResponseEntity.ok(activiteDTOs);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
return ResponseEntity.status(HttpStatus.NOT_FOUND).body(ex.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/{id_session}/activities/add/{id_act}")
|
@GetMapping("/{id_session}/activities/add/{id_act}")
|
||||||
@PreAuthorize("hasRole('coach') or hasRole('admin')")
|
@PreAuthorize("hasRole('coach') or hasRole('admin')")
|
||||||
|
|||||||
@@ -4,17 +4,12 @@ import ObjectSession from "./object/session";
|
|||||||
import {calculStatsAthlete, niveauAlerte} from "../utils/athleteUtils";
|
import {calculStatsAthlete, niveauAlerte} from "../utils/athleteUtils";
|
||||||
import {calculTempsDeJeuParLigne} from "../utils/ligneUtils";
|
import {calculTempsDeJeuParLigne} from "../utils/ligneUtils";
|
||||||
import ObjectActivite from "./object/activite";
|
import ObjectActivite from "./object/activite";
|
||||||
|
|
||||||
|
|
||||||
type AthleteListProps = { athletes: Athlete[], sessions: Session[]};
|
type AthleteListProps = { athletes: Athlete[], sessions: Session[]};
|
||||||
type ActiviteListProps = { activites: Activite[] };
|
type ActiviteListProps = { activites: Activite[] };
|
||||||
type CoachListProps = { coachs: Coach[] };
|
type CoachListProps = { coachs: Coach[] };
|
||||||
type SessionListProps = { sessions: Session[]};
|
type SessionListProps = { sessions: Session[]};
|
||||||
type LigneListProps = { lignes: Ligne[], tempsDeJeuParLigne: Map<number, number> };
|
type LigneListProps = { lignes: Ligne[], tempsDeJeuParLigne: Map<number, number> };
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function AthleteList({ athletes, sessions }: AthleteListProps) {
|
function AthleteList({ athletes, sessions }: AthleteListProps) {
|
||||||
const [dateDebut, setDateDebut] = React.useState(new Date());
|
const [dateDebut, setDateDebut] = React.useState(new Date());
|
||||||
const [dateFin, setDateFin] = React.useState(new Date());
|
const [dateFin, setDateFin] = React.useState(new Date());
|
||||||
|
|||||||
Reference in New Issue
Block a user