Changes Api Delete EndPoints

This commit is contained in:
2023-08-02 00:09:59 -03:00
parent 3da5b7380a
commit 8173d5829a
2 changed files with 3 additions and 6 deletions

View File

@@ -6,10 +6,7 @@ import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSession;
@@ -26,7 +23,7 @@ public class SessionController {
return ResponseEntity.ok(this.sessionManagerService.validateSession(session)); return ResponseEntity.ok(this.sessionManagerService.validateSession(session));
} }
@PostMapping(path="/destroy") @DeleteMapping(path="/destroy")
public ResponseEntity<Void> destroyCurrentSession(HttpSession session) { public ResponseEntity<Void> destroyCurrentSession(HttpSession session) {
this.sessionManagerService.destroySession(session); this.sessionManagerService.destroySession(session);
return new ResponseEntity<>(HttpStatus.NO_CONTENT); return new ResponseEntity<>(HttpStatus.NO_CONTENT);

View File

@@ -69,7 +69,7 @@ public class UserController {
response.sendRedirect("http://localhost:4200"); response.sendRedirect("http://localhost:4200");
} }
@PostMapping("/delete/{id}") @DeleteMapping("/delete/{id}")
@UserResourceGuard(accessType = UserResourceGuardEnum.SAME_USER) @UserResourceGuard(accessType = UserResourceGuardEnum.SAME_USER)
public ResponseEntity<Void> deleteUser(@PathVariable("id") Long id) { public ResponseEntity<Void> deleteUser(@PathVariable("id") Long id) {
this.userService.deleteUser(id); this.userService.deleteUser(id);