Mini refactor

This commit is contained in:
2025-04-19 01:41:46 +02:00
parent a8411b6e63
commit 07141f3a1c
5 changed files with 26 additions and 8 deletions

View File

@@ -16,7 +16,7 @@ import java.util.Map;
@Slf4j
@RestController
@RequestMapping("/api/v1/auth")
@RequestMapping("/auth")
public class AuthenticationController {
private final AuthenticationService authenticationService;

View File

@@ -17,7 +17,8 @@ import org.springframework.web.bind.annotation.*;
import java.util.Optional;
@RestController
public class BibleReadingPlanMapping extends SecureApiRestController {
@RequestMapping("/secure/bible-reading-plan")
public class BibleReadingPlanMapping {
private final EntityManager entityManager;
private final BibleReadingPlanRepository bibleReadingPlanRepository;
@@ -27,8 +28,8 @@ public class BibleReadingPlanMapping extends SecureApiRestController {
this.bibleReadingPlanRepository = bibleReadingPlanRepository;
}
@GetMapping("/bible-reading-plan")
public ResponseEntity<Object> getBibleReadingPlans(@RequestParam(required = true) Long id) {
@GetMapping
public ResponseEntity<Object> getBibleReadingPlans(@RequestParam(name = "id", required = true) Long id) {
Optional<BibleReadingPlan> brp = bibleReadingPlanRepository.findById(id);
if(brp.isEmpty()) {
return new ResponseEntity<>(HttpStatus.NOT_FOUND);
@@ -44,7 +45,7 @@ public class BibleReadingPlanMapping extends SecureApiRestController {
return new ResponseEntity<>(bibleReadingPlanDTO, HttpStatus.OK);
}
@PostMapping("/bible-reading-plan")
@PostMapping
public ResponseEntity<Object> createBibleReadingPlan(@RequestBody BibleReadingPlanDTO bibleReadingPlanDTO) {
Authentication auth = SecurityContextHolder.getContext().getAuthentication();