diff --git a/src/main/java/com/covas/Resources/PublisherRessources.java b/src/main/java/com/covas/Resources/PublisherRessources.java index 5d08820..07756c7 100644 --- a/src/main/java/com/covas/Resources/PublisherRessources.java +++ b/src/main/java/com/covas/Resources/PublisherRessources.java @@ -294,21 +294,21 @@ public class PublisherRessources { @Path("{id}") @RolesAllowed("Admin") @Transactional - public Response changeStatusSingleUserToDelete(@Context SecurityContext ctx, @CookieParam("user") String userCookie, + public Response changeStatusSinglePublisherToDelete(@Context SecurityContext ctx, @CookieParam("user") String userCookie, @PathParam("id") String id) { UUID kid = UUID.fromString(jwt.getClaim(Claims.kid)); UsersEntity user = UsersEntity.findById(kid); Response.Status status = getResponseCheck(ctx, userCookie, user); if (status.equals(Response.Status.OK)) { - UsersEntity singleUser = UsersEntity.find("id", UUID.fromString(id)).firstResult(); - if (singleUser == null) { + PublisherEntity singlePublisher = PublisherEntity.find("id", UUID.fromString(id)).firstResult(); + if (singlePublisher == null) { status = Response.Status.NOT_FOUND; } else { - singleUser.status = -1; - singleUser.updated_at = LocalDateTime.now(); - singleUser.deleted_at = LocalDateTime.now(); - singleUser.persist(); - if (!singleUser.isPersistent()) { + singlePublisher.status = -1; + singlePublisher.updated_at = LocalDateTime.now(); + singlePublisher.deleted_at = LocalDateTime.now(); + singlePublisher.persist(); + if (!singlePublisher.isPersistent()) { status = Response.Status.NOT_MODIFIED; } } @@ -344,21 +344,21 @@ public class PublisherRessources { @Path("/disable/{id}") @RolesAllowed("Admin") @Transactional - public Response changeStatusSingleUserToDisable(@Context SecurityContext ctx, @CookieParam("user") String userCookie, + public Response changeStatusSinglePublisherToDisable(@Context SecurityContext ctx, @CookieParam("user") String userCookie, @PathParam("id") String id) { UUID kid = UUID.fromString(jwt.getClaim(Claims.kid)); UsersEntity user = UsersEntity.findById(kid); Response.Status status = getResponseCheck(ctx, userCookie, user); if (status.equals(Response.Status.OK)) { - UsersEntity singleUser = UsersEntity.find("id", UUID.fromString(id)).firstResult(); - if (singleUser == null) { + PublisherEntity singlePublisher = PublisherEntity.find("id", UUID.fromString(id)).firstResult(); + if (singlePublisher == null) { status = Response.Status.NOT_FOUND; } else { - singleUser.status = 0; - singleUser.updated_at = LocalDateTime.now(); - singleUser.deleted_at = LocalDateTime.now(); - singleUser.persist(); - if (!singleUser.isPersistent()) { + singlePublisher.status = 0; + singlePublisher.updated_at = LocalDateTime.now(); + singlePublisher.deleted_at = LocalDateTime.now(); + singlePublisher.persist(); + if (!singlePublisher.isPersistent()) { status = Response.Status.NOT_MODIFIED; } }