Merge branch 'main' of https://gitlab2.istic.univ-rennes1.fr/tuvu/hackathon
This commit is contained in:
@@ -44,7 +44,8 @@ public class SessionResource {
|
|||||||
public ResponseEntity<?> create(@RequestBody SessionDTO dto) {
|
public ResponseEntity<?> create(@RequestBody SessionDTO dto) {
|
||||||
try {
|
try {
|
||||||
Session session = maptoEntity(dto);
|
Session session = maptoEntity(dto);
|
||||||
session.setCoach(coachDAO.findById(dto.getCoachId()).orElse(null));
|
Coach c = coachDAO.findById(dto.getCoachId()).orElse(null);
|
||||||
|
session.setCoach(c);
|
||||||
sessionDAO.save(session);
|
sessionDAO.save(session);
|
||||||
return ResponseEntity.status(HttpStatus.CREATED).body(maptoDTO(session));
|
return ResponseEntity.status(HttpStatus.CREATED).body(maptoDTO(session));
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ services:
|
|||||||
- "8080:8080"
|
- "8080:8080"
|
||||||
volumes:
|
volumes:
|
||||||
- ./keycloak/:/opt/keycloak/data/import/
|
- ./keycloak/:/opt/keycloak/data/import/
|
||||||
|
- keycloak_data:/opt/keycloak/data
|
||||||
environment:
|
environment:
|
||||||
KEYCLOAK_ADMIN: admin
|
KEYCLOAK_ADMIN: admin
|
||||||
KEYCLOAK_ADMIN_PASSWORD: ${KEYCLOAK_ADMIN_PASSWORD}
|
KEYCLOAK_ADMIN_PASSWORD: ${KEYCLOAK_ADMIN_PASSWORD}
|
||||||
@@ -37,5 +38,6 @@ services:
|
|||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
postgres_data:
|
postgres_data:
|
||||||
|
keycloak_data:
|
||||||
|
|
||||||
version: "3.9"
|
version: "3.9"
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { Activite, Athlete, Coach , Session, Ligne, Admin } from "../classes";
|
|||||||
import {calculTempsDeJeuParLigne} from "../utils/ligneUtils";
|
import {calculTempsDeJeuParLigne} from "../utils/ligneUtils";
|
||||||
import { keyboard } from "@testing-library/user-event/dist/keyboard";
|
import { keyboard } from "@testing-library/user-event/dist/keyboard";
|
||||||
import ObjectSession from "./object/session";
|
import ObjectSession from "./object/session";
|
||||||
|
import ObjectActivite from "./object/activite";
|
||||||
import ObjectUser from "./object/user";
|
import ObjectUser from "./object/user";
|
||||||
import { getAllSessionsAPI } from "../requetes";
|
import { getAllSessionsAPI } from "../requetes";
|
||||||
import { useKeycloak } from "@react-keycloak/web";
|
import { useKeycloak } from "@react-keycloak/web";
|
||||||
@@ -84,8 +85,8 @@ import { useKeycloak } from "@react-keycloak/web";
|
|||||||
))
|
))
|
||||||
)}
|
)}
|
||||||
{value==="activites" && (
|
{value==="activites" && (
|
||||||
allSessions.map((session) => ( //TODO
|
allActivites.map((activite) => (
|
||||||
<ObjectSession session={session}/>
|
<ObjectActivite activite={activite}/>
|
||||||
))
|
))
|
||||||
)}
|
)}
|
||||||
{value==="coachs" && (
|
{value==="coachs" && (
|
||||||
|
|||||||
@@ -135,10 +135,9 @@ export async function postActivityAPI(session: Session, activity: Activite){
|
|||||||
|
|
||||||
export async function postAthlete(athlete: Athlete):Promise<Athlete>{
|
export async function postAthlete(athlete: Athlete):Promise<Athlete>{
|
||||||
try {
|
try {
|
||||||
//const response = await api.post<Athlete>("/athlete/create/",athlete.toDTO);
|
const response = await api.post<Athlete>("/athlete/create/",athlete.toDTO);
|
||||||
const response = await athleteService.create(athlete.toDTO());
|
|
||||||
console.log(response);
|
console.log(response);
|
||||||
return new Athlete(response.data);
|
return response.data;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error fetching coachs:", error);
|
console.error("Error fetching coachs:", error);
|
||||||
throw error;
|
throw error;
|
||||||
|
|||||||
Reference in New Issue
Block a user