Skip to content

Commit

Permalink
[JPA] Correction génération controller suite refacto
Browse files Browse the repository at this point in the history
  • Loading branch information
gideruette committed Jan 16, 2025
1 parent dcd4c6d commit 29ede3f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ private void WriteEndpoint(JavaWriter fw, Endpoint endpoint, string tag)
}

{
var mappingAnnotation = new JavaAnnotation($@"@{endpoint.Method.ToPascalCase(true)}Mapping(", imports: $"org.springframework.web.bind.annotation.{endpoint.Method.ToPascalCase(true)}Mapping")
var mappingAnnotation = new JavaAnnotation($@"@{endpoint.Method.ToPascalCase(true)}Mapping", imports: $"org.springframework.web.bind.annotation.{endpoint.Method.ToPascalCase(true)}Mapping")
.AddAttribute("path", $@"""{endpoint.Route}""");
if (endpoint.Returns != null && endpoint.Returns.Domain?.MediaType != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public interface ProfilController {
* @return Profil sauvegardé
*/
@PreAuthorize("hasRole('CREATE')")
@PostMapping((path = "/")
@PostMapping(path = "/")
ProfilRead addProfil(@RequestBody @Valid ProfilWrite profil);

/**
Expand All @@ -40,15 +40,15 @@ public interface ProfilController {
* @return Le détail de l'Profil
*/
@PreAuthorize("hasRole('READ')")
@GetMapping((path = "/{proId}")
@GetMapping(path = "/{proId}")
ProfilRead getProfil(@PathVariable("proId") Integer proId);

/**
* Liste tous les Profils.
* @return Profils matchant les critères
*/
@PreAuthorize("hasRole('READ')")
@GetMapping((path = "/")
@GetMapping(path = "/")
List<ProfilItem> getProfils();

/**
Expand All @@ -58,6 +58,6 @@ public interface ProfilController {
* @return Profil sauvegardé
*/
@PreAuthorize("hasRole('UPDATE')")
@PutMapping((path = "/{proId}")
@PutMapping(path = "/{proId}")
ProfilRead updateProfil(@PathVariable("proId") Integer proId, @RequestBody @Valid ProfilWrite profil);
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ public interface UtilisateurController {
* @return Utilisateur sauvegardé
*/
@PreAuthorize("hasRole('CREATE')")
@PostMapping((path = "/")
@PostMapping(path = "/")
UtilisateurRead addUtilisateur(@RequestBody @Valid UtilisateurWrite utilisateur);

/**
* Supprime un utilisateur.
* @param utiId Id de l'utilisateur
*/
@PreAuthorize("hasRole('DELETE')")
@DeleteMapping((path = "/{utiId}")
@DeleteMapping(path = "/{utiId}")
void deleteUtilisateur(@PathVariable("utiId") Integer utiId);

/**
Expand All @@ -52,7 +52,7 @@ public interface UtilisateurController {
* @return Le détail de l'utilisateur
*/
@PreAuthorize("hasRole('READ')")
@GetMapping((path = "/{utiId}")
@GetMapping(path = "/{utiId}")
UtilisateurRead getUtilisateur(@PathVariable("utiId") Integer utiId);

/**
Expand All @@ -68,7 +68,7 @@ public interface UtilisateurController {
* @return Utilisateurs matchant les critères
*/
@PreAuthorize("hasRole('READ')")
@GetMapping((path = "/")
@GetMapping(path = "/")
List<UtilisateurItem> searchUtilisateur(@RequestParam(value = "nom", required = true) String nom, @RequestParam(value = "prenom", required = true) String prenom, @RequestParam(value = "email", required = true) String email, @RequestParam(value = "dateNaissance", required = false) LocalDate dateNaissance, @RequestParam(value = "adresse", required = false) String adresse, @RequestParam(value = "actif", required = true) Boolean actif, @RequestParam(value = "profilId", required = true) Integer profilId, @RequestParam(value = "typeUtilisateurCode", required = true) TypeUtilisateurCode typeUtilisateurCode);

/**
Expand All @@ -78,6 +78,6 @@ public interface UtilisateurController {
* @return Utilisateur sauvegardé
*/
@PreAuthorize("hasRole('UPDATE')")
@PutMapping((path = "/{utiId}")
@PutMapping(path = "/{utiId}")
UtilisateurRead updateUtilisateur(@PathVariable("utiId") Integer utiId, @RequestBody @Valid UtilisateurWrite utilisateur);
}
2 changes: 1 addition & 1 deletion samples/model/jpa.topmodel.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

version: 2.3.5
custom:
../../../TopModel.Generator.Jpa: c60dc7414a12c709cc5c73ae3c66ecbe
../../../TopModel.Generator.Jpa: 11abe1baef01154b7cd55cc234b18171
generatedFiles:
- ../generators/jpa/src/main/javagen/topmodel/jpa/sample/demo/api/client/securite/profil/ProfilClient.java
- ../generators/jpa/src/main/javagen/topmodel/jpa/sample/demo/api/client/securite/utilisateur/UtilisateurClient.java
Expand Down

0 comments on commit 29ede3f

Please sign in to comment.