Sync: code local unifié
Synchronisation du code source local (fait foi). Signed-off-by: lions dev Team
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
package dev.lions.unionflow.server.resource.ong;
|
||||
|
||||
import dev.lions.unionflow.server.api.dto.ong.ProjetOngDTO;
|
||||
import dev.lions.unionflow.server.api.enums.ong.StatutProjetOng;
|
||||
import dev.lions.unionflow.server.service.ong.ProjetOngService;
|
||||
|
||||
import jakarta.annotation.security.RolesAllowed;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.ws.rs.*;
|
||||
import jakarta.ws.rs.core.MediaType;
|
||||
import jakarta.ws.rs.core.Response;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@Path("/api/v1/ong/projets")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
public class ProjetOngResource {
|
||||
|
||||
@Inject
|
||||
ProjetOngService projetOngService;
|
||||
|
||||
@POST
|
||||
@RolesAllowed({ "admin", "admin_organisation", "ong_resp" })
|
||||
public Response creerProjet(@Valid ProjetOngDTO dto) {
|
||||
ProjetOngDTO response = projetOngService.creerProjet(dto);
|
||||
return Response.status(Response.Status.CREATED).entity(response).build();
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/{id}")
|
||||
@RolesAllowed({ "admin", "admin_organisation", "membre_actif" })
|
||||
public Response getProjetById(@PathParam("id") UUID id) {
|
||||
ProjetOngDTO response = projetOngService.getProjetById(id);
|
||||
return Response.ok(response).build();
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/ong/{organisationId}")
|
||||
@RolesAllowed({ "admin", "admin_organisation", "ong_resp" })
|
||||
public Response getProjetsByOng(@PathParam("organisationId") UUID organisationId) {
|
||||
List<ProjetOngDTO> response = projetOngService.getProjetsByOng(organisationId);
|
||||
return Response.ok(response).build();
|
||||
}
|
||||
|
||||
@PATCH
|
||||
@Path("/{id}/statut")
|
||||
@RolesAllowed({ "admin", "admin_organisation", "ong_resp" })
|
||||
public Response changerStatut(@PathParam("id") UUID id, @QueryParam("statut") StatutProjetOng statut) {
|
||||
if (statut == null) {
|
||||
return Response.status(Response.Status.BAD_REQUEST).entity("Le statut est requis").build();
|
||||
}
|
||||
ProjetOngDTO response = projetOngService.changerStatut(id, statut);
|
||||
return Response.ok(response).build();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user