refactor: path adjustments
This commit is contained in:
parent
de92fbe778
commit
798a832341
@ -11,13 +11,11 @@ import jakarta.ws.rs.core.MediaType;
|
|||||||
import jakarta.ws.rs.core.Response;
|
import jakarta.ws.rs.core.Response;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import org.eclipse.microprofile.openapi.annotations.Operation;
|
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.APIResponse;
|
||||||
import org.eclipse.microprofile.openapi.annotations.responses.APIResponses;
|
import org.eclipse.microprofile.openapi.annotations.responses.APIResponses;
|
||||||
|
|
||||||
@Path("/sites")
|
@Path("/api/sites")
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
public class SiteEndpoints {
|
public class SiteEndpoints {
|
||||||
@ -27,7 +25,6 @@ public class SiteEndpoints {
|
|||||||
@Inject SiteService siteService;
|
@Inject SiteService siteService;
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("/listall")
|
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
@RolesAllowed("root")
|
@RolesAllowed("root")
|
||||||
@Operation(summary = "Lists all existing sites",
|
@Operation(summary = "Lists all existing sites",
|
||||||
@ -50,7 +47,6 @@ public class SiteEndpoints {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@Path("/create")
|
|
||||||
@RolesAllowed("root")
|
@RolesAllowed("root")
|
||||||
@Operation(summary = "Creates a site",
|
@Operation(summary = "Creates a site",
|
||||||
description = "Creates a site if no name is not a duplicate.")
|
description = "Creates a site if no name is not a duplicate.")
|
||||||
@ -75,7 +71,7 @@ public class SiteEndpoints {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("/getbyname")
|
@Path("/{name}")
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
@Authenticated
|
@Authenticated
|
||||||
@Operation(summary = "Gets a site with its name", description = "")
|
@Operation(summary = "Gets a site with its name", description = "")
|
||||||
@ -87,7 +83,7 @@ public class SiteEndpoints {
|
|||||||
})
|
})
|
||||||
|
|
||||||
public Response
|
public Response
|
||||||
getSiteByName(@QueryParam("name") String name) {
|
getSiteByName(@PathParam("name") String name) {
|
||||||
try {
|
try {
|
||||||
Site site = siteService.getSiteByName(name);
|
Site site = siteService.getSiteByName(name);
|
||||||
return Response.ok(site.toString()).build();
|
return Response.ok(site.toString()).build();
|
||||||
@ -99,7 +95,6 @@ public class SiteEndpoints {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@DELETE
|
@DELETE
|
||||||
@Path("/del")
|
|
||||||
@RolesAllowed("root")
|
@RolesAllowed("root")
|
||||||
@Operation(summary = "Deletes a site",
|
@Operation(summary = "Deletes a site",
|
||||||
description =
|
description =
|
||||||
|
@ -28,7 +28,6 @@ public class SujetEndpoints {
|
|||||||
@Inject SujetService sujetService;
|
@Inject SujetService sujetService;
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("/all")
|
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
@Authenticated
|
@Authenticated
|
||||||
public Response getAllSujetsRespo() {
|
public Response getAllSujetsRespo() {
|
||||||
|
@ -14,6 +14,7 @@ import jakarta.ws.rs.POST;
|
|||||||
import jakarta.ws.rs.Path;
|
import jakarta.ws.rs.Path;
|
||||||
import jakarta.ws.rs.PathParam;
|
import jakarta.ws.rs.PathParam;
|
||||||
import jakarta.ws.rs.Produces;
|
import jakarta.ws.rs.Produces;
|
||||||
|
import jakarta.ws.rs.QueryParam;
|
||||||
import jakarta.ws.rs.core.MediaType;
|
import jakarta.ws.rs.core.MediaType;
|
||||||
import jakarta.ws.rs.core.Response;
|
import jakarta.ws.rs.core.Response;
|
||||||
|
|
||||||
@ -56,25 +57,25 @@ public class UserEndpoints {
|
|||||||
return Response.ok(userService.createUser(user)).build();
|
return Response.ok(userService.createUser(user)).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*@POST
|
@POST
|
||||||
@RolesAllowed("root")
|
@RolesAllowed("root") // TODO: respos JI doivent aussi pouvoir faire ca
|
||||||
@Path("/jdmi")
|
@Path("/bulk")
|
||||||
public Response createJdmiUsers(BulkUserRequest users) {
|
public Response createUsersBulk(BulkUserRequest users) {
|
||||||
userService.createJdmiUser(users);
|
userService.createUsers(users);
|
||||||
return Response.ok().build();
|
return Response.ok().build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@DELETE
|
@DELETE
|
||||||
@RolesAllowed("root")
|
@RolesAllowed("root")
|
||||||
public Response deleteJDMI() {
|
@Path("/bulk")
|
||||||
userService.deleteJDMI();
|
public Response deleteUserBulk() {
|
||||||
|
userService.deleteUsers();
|
||||||
return Response.ok().build();
|
return Response.ok().build();
|
||||||
}*/
|
}
|
||||||
|
|
||||||
@DELETE
|
@DELETE
|
||||||
@RolesAllowed("root")
|
@RolesAllowed("root")
|
||||||
@Path("/{id}")
|
public Response deleteUser(@QueryParam("id") Long id) {
|
||||||
public Response deleteUser(@PathParam("id") Long id) {
|
|
||||||
userService.deleteUser(id);
|
userService.deleteUser(id);
|
||||||
return Response.ok().build();
|
return Response.ok().build();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user