UtilisateurPromoteursController.java
- package com.sintia.ffl.admin.dentaire.api.controllers;
- import com.sintia.ffl.admin.dentaire.api.utils.RestUtils;
- import com.sintia.ffl.admin.dentaire.services.dto.UtilisateurPromoteurDTO;
- import com.sintia.ffl.admin.dentaire.services.services.UtilisateurPromoteurService;
- import com.sintia.ffl.adminui.commons.dto.PromoteurDTO;
- import io.swagger.v3.oas.annotations.Operation;
- import io.swagger.v3.oas.annotations.responses.ApiResponse;
- import lombok.RequiredArgsConstructor;
- import lombok.extern.slf4j.Slf4j;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.http.ResponseEntity;
- import org.springframework.web.bind.annotation.GetMapping;
- import org.springframework.web.bind.annotation.PathVariable;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RestController;
- import java.util.Collection;
- @RestController
- @RequestMapping("/api/v1/userpromoteurs")
- @Slf4j
- @RequiredArgsConstructor(onConstructor = @__ ({@Autowired }))
- public class UtilisateurPromoteursController {
-
- private final UtilisateurPromoteurService utilisateurPromoteurService;
-
- @GetMapping(value = "/utilisateur/{utilisateur}")
- @Operation(
- operationId = "getUtilisateurPromoteurs",
- summary = "Retourne tous les promoteurs associés à un utilisateur donné",
- description = "Retourne tous les promoteurs associés à un utilisateur donné",
- responses = {
- @ApiResponse(responseCode = "200", description = "Traitement terminé normalement"),
- @ApiResponse(responseCode = "204", description = "Données non-trouvées"),
- @ApiResponse(responseCode = "400", description = "Données trop volumineuses") })
- public ResponseEntity<Collection<PromoteurDTO>> getUtilisateurPromoteur(@PathVariable(name = "utilisateur") String utilisateur) {
- log.debug("getPromoteursForUser");
- return RestUtils.constructApiResponse(utilisateurPromoteurService.getPromoteursForUser(utilisateur));
-
- }
-
- @GetMapping(value = "/all")
- @Operation(
- operationId = "getUtilisateurPromoteurs",
- summary = "Retourne tous les utilisateurs promoteurs",
- description = "Retourne tous les utilisateurs promoteurs",
- responses = {
- @ApiResponse(responseCode = "200", description = "Traitement terminé normalement"),
- @ApiResponse(responseCode = "204", description = "Données non-trouvées"),
- @ApiResponse(responseCode = "400", description = "Données trop volumineuses") })
- public ResponseEntity<Collection<UtilisateurPromoteurDTO>> getUtilisateurPromoteur() {
- log.debug("getPromoteursForUser");
- return RestUtils.constructApiResponse(utilisateurPromoteurService.getUtilisateurs());
-
- }
- }