update delete for publisher admin
This commit is contained in:
parent
d0b6cee3ea
commit
7f9a149196
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user