refactor: path adjustments

This commit is contained in:
Arthur Wambst 2025-08-22 09:39:33 +02:00
parent de92fbe778
commit 798a832341
No known key found for this signature in database
3 changed files with 14 additions and 19 deletions

View File

@ -11,13 +11,11 @@ import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.eclipse.microprofile.openapi.annotations.Operation;
import org.eclipse.microprofile.openapi.annotations.parameters.Parameter;
import org.eclipse.microprofile.openapi.annotations.responses.APIResponse;
import org.eclipse.microprofile.openapi.annotations.responses.APIResponses;
@Path("/sites")
@Path("/api/sites")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public class SiteEndpoints {
@ -27,7 +25,6 @@ public class SiteEndpoints {
@Inject SiteService siteService;
@GET
@Path("/listall")
@Produces(MediaType.APPLICATION_JSON)
@RolesAllowed("root")
@Operation(summary = "Lists all existing sites",
@ -50,7 +47,6 @@ public class SiteEndpoints {
}
@POST
@Path("/create")
@RolesAllowed("root")
@Operation(summary = "Creates a site",
description = "Creates a site if no name is not a duplicate.")
@ -75,7 +71,7 @@ public class SiteEndpoints {
}
@GET
@Path("/getbyname")
@Path("/{name}")
@Produces(MediaType.APPLICATION_JSON)
@Authenticated
@Operation(summary = "Gets a site with its name", description = "")
@ -87,7 +83,7 @@ public class SiteEndpoints {
})
public Response
getSiteByName(@QueryParam("name") String name) {
getSiteByName(@PathParam("name") String name) {
try {
Site site = siteService.getSiteByName(name);
return Response.ok(site.toString()).build();
@ -99,7 +95,6 @@ public class SiteEndpoints {
}
@DELETE
@Path("/del")
@RolesAllowed("root")
@Operation(summary = "Deletes a site",
description =

View File

@ -28,7 +28,6 @@ public class SujetEndpoints {
@Inject SujetService sujetService;
@GET
@Path("/all")
@Produces(MediaType.APPLICATION_JSON)
@Authenticated
public Response getAllSujetsRespo() {

View File

@ -14,6 +14,7 @@ import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.QueryParam;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
@ -56,25 +57,25 @@ public class UserEndpoints {
return Response.ok(userService.createUser(user)).build();
}
/*@POST
@RolesAllowed("root")
@Path("/jdmi")
public Response createJdmiUsers(BulkUserRequest users) {
userService.createJdmiUser(users);
@POST
@RolesAllowed("root") // TODO: respos JI doivent aussi pouvoir faire ca
@Path("/bulk")
public Response createUsersBulk(BulkUserRequest users) {
userService.createUsers(users);
return Response.ok().build();
}
@DELETE
@RolesAllowed("root")
public Response deleteJDMI() {
userService.deleteJDMI();
@Path("/bulk")
public Response deleteUserBulk() {
userService.deleteUsers();
return Response.ok().build();
}*/
}
@DELETE
@RolesAllowed("root")
@Path("/{id}")
public Response deleteUser(@PathParam("id") Long id) {
public Response deleteUser(@QueryParam("id") Long id) {
userService.deleteUser(id);
return Response.ok().build();
}