change name function for comment resources

This commit is contained in:
Valentin CZERYBA 2023-01-09 22:10:48 +01:00
parent fecd1799a2
commit f6018542cd

View File

@ -70,7 +70,7 @@ public class CommentRessources {
/// GET /// GET
@GET @GET
@RolesAllowed("Admin") @RolesAllowed("Admin")
public Response getPublishers(@CookieParam("user") String userCookie, @Context SecurityContext ctx, public Response getComments(@CookieParam("user") String userCookie, @Context SecurityContext ctx,
@QueryParam("page") Integer page, @QueryParam("nbPages") Integer nbPages, @QueryParam("page") Integer page, @QueryParam("nbPages") Integer nbPages,
@QueryParam("status") Short status, @QueryParam("status") Short status,
@QueryParam("search") String search, @QueryParam("search") String search,
@ -122,7 +122,7 @@ public class CommentRessources {
@GET @GET
@RolesAllowed("Admin") @RolesAllowed("Admin")
@Path("{id}") @Path("{id}")
public Response getSinglePublisher(@PathParam("id") String id, @CookieParam("user") String userCookie, public Response getSingleComment(@PathParam("id") String id, @CookieParam("user") String userCookie,
@Context SecurityContext ctx) { @Context SecurityContext ctx) {
UUID kid = UUID.fromString(jwt.getClaim(Claims.kid)); UUID kid = UUID.fromString(jwt.getClaim(Claims.kid));
UsersEntity user = UsersEntity.findById(kid); UsersEntity user = UsersEntity.findById(kid);
@ -147,7 +147,7 @@ public class CommentRessources {
@RolesAllowed({"Admin", "User"}) @RolesAllowed({"Admin", "User"})
@Path("{id}") @Path("{id}")
@Transactional @Transactional
public Response createPublisher(@Context SecurityContext ctx, @CookieParam("user") String userCookie, @PathParam("id") String id, CommentEntity comment) { public Response createComment(@Context SecurityContext ctx, @CookieParam("user") String userCookie, @PathParam("id") String id, CommentEntity comment) {
UUID kid = UUID.fromString(jwt.getClaim(Claims.kid)); UUID kid = UUID.fromString(jwt.getClaim(Claims.kid));
UsersEntity user = UsersEntity.findById(kid); UsersEntity user = UsersEntity.findById(kid);
@ -176,7 +176,7 @@ public class CommentRessources {
@Path("{id}") @Path("{id}")
@RolesAllowed({"Admin", "User"}) @RolesAllowed({"Admin", "User"})
@Transactional @Transactional
public Response changeStatusSinglePublisherToDelete(@Context SecurityContext ctx, @CookieParam("user") String userCookie, public Response changeStatusSingleCommentToDelete(@Context SecurityContext ctx, @CookieParam("user") String userCookie,
@PathParam("id") String id) { @PathParam("id") String id) {
UUID kid = UUID.fromString(jwt.getClaim(Claims.kid)); UUID kid = UUID.fromString(jwt.getClaim(Claims.kid));
UsersEntity user = UsersEntity.findById(kid); UsersEntity user = UsersEntity.findById(kid);
@ -202,7 +202,7 @@ public class CommentRessources {
@Path("/disable/{id}") @Path("/disable/{id}")
@RolesAllowed({"Admin", "User"}) @RolesAllowed({"Admin", "User"})
@Transactional @Transactional
public Response changeStatusSinglePublisherToDisable(@Context SecurityContext ctx, @CookieParam("user") String userCookie, public Response changeStatusSingleCommentToDisable(@Context SecurityContext ctx, @CookieParam("user") String userCookie,
@PathParam("id") String id) { @PathParam("id") String id) {
UUID kid = UUID.fromString(jwt.getClaim(Claims.kid)); UUID kid = UUID.fromString(jwt.getClaim(Claims.kid));
UsersEntity user = UsersEntity.findById(kid); UsersEntity user = UsersEntity.findById(kid);
@ -230,7 +230,7 @@ public class CommentRessources {
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@Transactional @Transactional
@Path("{id}") @Path("{id}")
public Response updatePublisherAdmin(@Context SecurityContext ctx, @CookieParam("user") String userCookie, public Response updateCommentAdmin(@Context SecurityContext ctx, @CookieParam("user") String userCookie,
CommentEntity comment, @PathParam("id") String id) { CommentEntity comment, @PathParam("id") String id) {
UUID kid = UUID.fromString(jwt.getClaim(Claims.kid)); UUID kid = UUID.fromString(jwt.getClaim(Claims.kid));
UsersEntity user = UsersEntity.findById(kid); UsersEntity user = UsersEntity.findById(kid);
@ -267,7 +267,7 @@ public class CommentRessources {
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@Transactional @Transactional
@Path("enable/{id}") @Path("enable/{id}")
public Response enableUserAdmin(@Context SecurityContext ctx, @CookieParam("user") String userCookie, @PathParam("id") String id) { public Response enableCommentAdmin(@Context SecurityContext ctx, @CookieParam("user") String userCookie, @PathParam("id") String id) {
UUID kid = UUID.fromString(jwt.getClaim(Claims.kid)); UUID kid = UUID.fromString(jwt.getClaim(Claims.kid));
UsersEntity user = UsersEntity.findById(kid); UsersEntity user = UsersEntity.findById(kid);
Response.Status status = getResponseCheck(ctx, userCookie, user); Response.Status status = getResponseCheck(ctx, userCookie, user);