Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • main
1 result

Target

Select target project
  • fatima-ezzahra.majidi.etu/gestion-des-stages
1 result
Select Git revision
  • main
1 result
Show changes
Commits on Source (2)
...@@ -43,8 +43,8 @@ public class SecurityConfig { ...@@ -43,8 +43,8 @@ public class SecurityConfig {
.requestMatchers("/**").permitAll() .requestMatchers("/**").permitAll()
// Role-based access // Role-based access
// STUDENTS (ETUDIANTS) - Can ONLY View Students & Stages // STUDENTS (ETUDIANTS) - Can ONLY View Stages
.requestMatchers(HttpMethod.GET, "/api/students").hasAuthority("ROLE_ETUDIANT") .requestMatchers(HttpMethod.GET, "/api/stages/**").hasAuthority("ROLE_ETUDIANT")
.requestMatchers(HttpMethod.GET, "/api/stages").hasAuthority("ROLE_ETUDIANT") .requestMatchers(HttpMethod.GET, "/api/stages").hasAuthority("ROLE_ETUDIANT")
// ENTERPRISES - Can CRUD Stages but NOT Students // ENTERPRISES - Can CRUD Stages but NOT Students
......
...@@ -66,6 +66,9 @@ public class CandidacyController { ...@@ -66,6 +66,9 @@ public class CandidacyController {
candidacy.setStudent(student.get()); candidacy.setStudent(student.get());
candidacy.setStage(stage.get()); candidacy.setStage(stage.get());
univSupervisor.ifPresent(candidacy::setUnivSupervisor); univSupervisor.ifPresent(candidacy::setUnivSupervisor);
if (candidacy.getComment() == null) {
candidacy.setComment(""); // Valeur par défaut si vide
}
Candidacy savedCandidacy = candidacyService.saveCandidacy(candidacy); Candidacy savedCandidacy = candidacyService.saveCandidacy(candidacy);
return ResponseEntity.ok(savedCandidacy); return ResponseEntity.ok(savedCandidacy);
...@@ -136,6 +139,9 @@ public class CandidacyController { ...@@ -136,6 +139,9 @@ public class CandidacyController {
if (updatedCandidacy.getAcceptedState() != null) { if (updatedCandidacy.getAcceptedState() != null) {
candidacy.setAcceptedState(updatedCandidacy.getAcceptedState()); candidacy.setAcceptedState(updatedCandidacy.getAcceptedState());
} }
if (updatedCandidacy.getComment() != null) {
candidacy.setComment(updatedCandidacy.getComment());
}
// Save the updated candidacy // Save the updated candidacy
Candidacy savedCandidacy = candidacyService.saveCandidacy(candidacy); Candidacy savedCandidacy = candidacyService.saveCandidacy(candidacy);
......
...@@ -36,6 +36,9 @@ public class Candidacy { ...@@ -36,6 +36,9 @@ public class Candidacy {
// Enum to store the accepted candidacy state (wait, inProgress, terminated) // Enum to store the accepted candidacy state (wait, inProgress, terminated)
@Enumerated(EnumType.STRING) @Enumerated(EnumType.STRING)
private AcceptedCandidacyStateKind acceptedState = AcceptedCandidacyStateKind.wait; private AcceptedCandidacyStateKind acceptedState = AcceptedCandidacyStateKind.wait;
// Ajout du champ commentaire
@Column(length = 500) // Définit une longueur max
private String comment;
public Candidacy() {} public Candidacy() {}
...@@ -45,6 +48,7 @@ public class Candidacy { ...@@ -45,6 +48,7 @@ public class Candidacy {
this.univSupervisor = univSupervisor; this.univSupervisor = univSupervisor;
this.requestState = CandidacyRequestState.FirstRequest; // Default state this.requestState = CandidacyRequestState.FirstRequest; // Default state
this.acceptedState = AcceptedCandidacyStateKind.wait; // Default state this.acceptedState = AcceptedCandidacyStateKind.wait; // Default state
this.comment = comment;
} }
public Long getId() { return id; } public Long getId() { return id; }
...@@ -65,4 +69,12 @@ public class Candidacy { ...@@ -65,4 +69,12 @@ public class Candidacy {
public AcceptedCandidacyStateKind getAcceptedState() { return acceptedState; } public AcceptedCandidacyStateKind getAcceptedState() { return acceptedState; }
public void setAcceptedState(AcceptedCandidacyStateKind acceptedState) { this.acceptedState = acceptedState; } public void setAcceptedState(AcceptedCandidacyStateKind acceptedState) { this.acceptedState = acceptedState; }
public String getComment() {
return comment;
}
public void setComment(String comment) {
this.comment = comment;
}
} }