Implemented project handling and updated property components according to front-end needs
This commit is contained in:
@@ -35,7 +35,7 @@ public class PropertyController {
|
||||
|
||||
@GetMapping
|
||||
@PreAuthorize("hasAnyRole('ROLE_ADMIN', 'ROLE_USER')")
|
||||
public ResponseEntity<?> getAllProperties() {
|
||||
public ResponseEntity<?> getAll() {
|
||||
List<PropertyDTO> propertiesDTO = propertyService.toDTOs(propertyService.findAll());
|
||||
|
||||
return ResponseEntity
|
||||
@@ -44,7 +44,7 @@ public class PropertyController {
|
||||
|
||||
@GetMapping("/{id}")
|
||||
@PreAuthorize("hasAnyRole('ADMIN', 'USER')")
|
||||
public ResponseEntity<?> getPropertyById(@PathVariable UUID id) {
|
||||
public ResponseEntity<?> getById(@PathVariable UUID id) {
|
||||
try {
|
||||
return ResponseEntity
|
||||
.ok(propertyService.findById(id).orElseThrow(EntityNotFoundException::new));
|
||||
@@ -107,7 +107,7 @@ public class PropertyController {
|
||||
|
||||
@PostMapping
|
||||
@PreAuthorize("hasRole('ADMIN')")
|
||||
public ResponseEntity<?> createProperty(@RequestBody PropertyDTO propertyDTO) {
|
||||
public ResponseEntity<?> create(@RequestBody PropertyDTO propertyDTO) {
|
||||
try {
|
||||
Property newItem = propertyService.saveDTO(propertyDTO);
|
||||
|
||||
@@ -128,7 +128,7 @@ public class PropertyController {
|
||||
|
||||
@PatchMapping("/{id}")
|
||||
@PreAuthorize("hasRole('ADMIN')")
|
||||
public ResponseEntity<?> updateProperty(@PathVariable UUID id, @RequestBody PropertyDTO propertyDTO) {
|
||||
public ResponseEntity<?> update(@PathVariable UUID id, @RequestBody PropertyDTO propertyDTO) {
|
||||
try {
|
||||
return ResponseEntity
|
||||
.ok(propertyService.update(id, propertyDTO));
|
||||
@@ -145,7 +145,7 @@ public class PropertyController {
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
@PreAuthorize("hasRole('ADMIN')")
|
||||
public ResponseEntity<?> deleteProperty(@PathVariable UUID id) {
|
||||
public ResponseEntity<?> delete(@PathVariable UUID id) {
|
||||
try {
|
||||
propertyService.deleteById(id);
|
||||
|
||||
@@ -165,7 +165,7 @@ public class PropertyController {
|
||||
|
||||
@PostMapping("/bulk-delete")
|
||||
@PreAuthorize("hasRole('ADMIN')")
|
||||
public ResponseEntity<?> deleteProperties(@RequestBody BulkDeletePropertyIdsDTO propertiesDTO) {
|
||||
public ResponseEntity<?> deleteMany(@RequestBody BulkDeletePropertyIdsDTO propertiesDTO) {
|
||||
try {
|
||||
propertyService.deleteByIds(propertiesDTO);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user