Skip to content
Snippets Groups Projects
Commit be74b380 authored by Fatima Ezzahra Majidi's avatar Fatima Ezzahra Majidi
Browse files

Ajout de commentaire

parent c82c4d5b
No related branches found
No related tags found
1 merge request!12Ajout de commentaire
......@@ -43,8 +43,8 @@ public class SecurityConfig {
.requestMatchers("/**").permitAll()
// Role-based access
// STUDENTS (ETUDIANTS) - Can ONLY View Students & Stages
.requestMatchers(HttpMethod.GET, "/api/students").hasAuthority("ROLE_ETUDIANT")
// STUDENTS (ETUDIANTS) - Can ONLY View Stages
.requestMatchers(HttpMethod.GET, "/api/stages/**").hasAuthority("ROLE_ETUDIANT")
.requestMatchers(HttpMethod.GET, "/api/stages").hasAuthority("ROLE_ETUDIANT")
// ENTERPRISES - Can CRUD Stages but NOT Students
......
......@@ -66,6 +66,9 @@ public class CandidacyController {
candidacy.setStudent(student.get());
candidacy.setStage(stage.get());
univSupervisor.ifPresent(candidacy::setUnivSupervisor);
if (candidacy.getComment() == null) {
candidacy.setComment(""); // Valeur par défaut si vide
}
Candidacy savedCandidacy = candidacyService.saveCandidacy(candidacy);
return ResponseEntity.ok(savedCandidacy);
......@@ -136,6 +139,9 @@ public class CandidacyController {
if (updatedCandidacy.getAcceptedState() != null) {
candidacy.setAcceptedState(updatedCandidacy.getAcceptedState());
}
if (updatedCandidacy.getComment() != null) {
candidacy.setComment(updatedCandidacy.getComment());
}
// Save the updated candidacy
Candidacy savedCandidacy = candidacyService.saveCandidacy(candidacy);
......
......@@ -36,6 +36,9 @@ public class Candidacy {
// Enum to store the accepted candidacy state (wait, inProgress, terminated)
@Enumerated(EnumType.STRING)
private AcceptedCandidacyStateKind acceptedState = AcceptedCandidacyStateKind.wait;
// Ajout du champ commentaire
@Column(length = 500) // Définit une longueur max
private String comment;
public Candidacy() {}
......@@ -45,6 +48,7 @@ public class Candidacy {
this.univSupervisor = univSupervisor;
this.requestState = CandidacyRequestState.FirstRequest; // Default state
this.acceptedState = AcceptedCandidacyStateKind.wait; // Default state
this.comment = comment;
}
public Long getId() { return id; }
......@@ -65,4 +69,12 @@ public class Candidacy {
public AcceptedCandidacyStateKind getAcceptedState() { return acceptedState; }
public void setAcceptedState(AcceptedCandidacyStateKind acceptedState) { this.acceptedState = acceptedState; }
public String getComment() {
return comment;
}
public void setComment(String comment) {
this.comment = comment;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment