23
23
@ Tag (name = "Checklists" , description = "Creating, reading and deleting Checklists." )
24
24
public class ChecklistController {
25
25
26
- public static final String PATH_VAR_CHECKLIST_ID = "checklistID" ;
27
- public static final String PATH_VAR_SERVICE_ID = "serviceID" ;
26
+ public static final String CHECKLIST_ID = "checklistID" ;
27
+ public static final String SERVICE_ID = "serviceID" ;
28
+ public static final String PATH_VAR_CHECKLIST_ID = "/{" + CHECKLIST_ID + "}" ;
29
+ public static final String PATH_VAR_SERVICE_ID = "/{" + SERVICE_ID + "}" ;
28
30
29
31
private final ChecklistService checklistService ;
30
32
private final ChecklistMapper checklistMapper ;
@@ -37,10 +39,10 @@ public List<ChecklistReadDTO> getChecklists() {
37
39
return checklists .stream ().map (checklistMapper ::toReadDTO ).toList ();
38
40
}
39
41
40
- @ GetMapping (path = "/{" + PATH_VAR_CHECKLIST_ID + "}" )
42
+ @ GetMapping (path = PATH_VAR_CHECKLIST_ID )
41
43
@ Operation (summary = "Get specific checklist by checklist-id." , description = "Returns a checklist by checklistId" )
42
44
@ ResponseStatus (HttpStatus .OK )
43
- public ChecklistReadDTO getChecklist (@ PathVariable (PATH_VAR_CHECKLIST_ID ) final UUID checklistID ) {
45
+ public ChecklistReadDTO getChecklist (@ PathVariable (CHECKLIST_ID ) final UUID checklistID ) {
44
46
return checklistMapper .toReadDTO (checklistService .getChecklist (checklistID ));
45
47
}
46
48
@@ -52,34 +54,34 @@ public ChecklistReadDTO createChecklist(@Valid @RequestBody final ChecklistCreat
52
54
.toReadDTO (checklistService .createChecklist (checklistMapper .toCreateChecklist (checklistCreateDTO )));
53
55
}
54
56
55
- @ PutMapping ("/{checklistID}" )
57
+ @ PutMapping (PATH_VAR_CHECKLIST_ID )
56
58
@ Operation (summary = "Update a checklist" , description = "Updates a checklist using the provided checklist details." )
57
59
@ ResponseStatus (HttpStatus .OK )
58
60
public ChecklistReadDTO updateChecklist (@ Valid @ RequestBody final ChecklistUpdateDTO checklistUpdateDTO ,
59
- @ PathVariable ("checklistID" ) final UUID checklistID ) {
61
+ @ PathVariable (CHECKLIST_ID ) final UUID checklistID ) {
60
62
return checklistMapper .toReadDTO (checklistService .updateChecklist (checklistMapper .toUpdateChecklist (checklistUpdateDTO ), checklistID ));
61
63
}
62
64
63
- @ DeleteMapping ("/{" + PATH_VAR_CHECKLIST_ID + "}" )
65
+ @ DeleteMapping (PATH_VAR_CHECKLIST_ID )
64
66
@ Operation (summary = "Delete a checklist" , description = "Deletes a checklist by checklistId." )
65
67
@ ResponseStatus (HttpStatus .OK )
66
- public void deleteChecklist (@ PathVariable (PATH_VAR_CHECKLIST_ID ) final UUID checklistID ) {
68
+ public void deleteChecklist (@ PathVariable (CHECKLIST_ID ) final UUID checklistID ) {
67
69
checklistService .deleteChecklist (checklistID );
68
70
}
69
71
70
- @ PostMapping ("/{" + PATH_VAR_CHECKLIST_ID + "}/{" + PATH_VAR_SERVICE_ID + "}/check" )
72
+ @ PostMapping (PATH_VAR_CHECKLIST_ID + PATH_VAR_SERVICE_ID )
71
73
@ Operation (summary = "Check a Checklist-Entry" , description = "Checks a checklist-entry." )
72
74
@ ResponseStatus (HttpStatus .OK )
73
- public ChecklistReadDTO checkChecklistEntry (@ PathVariable (PATH_VAR_CHECKLIST_ID ) final UUID checklistID ,
74
- @ PathVariable (PATH_VAR_SERVICE_ID ) final String serviceID ) {
75
+ public ChecklistReadDTO checkChecklistEntry (@ PathVariable (CHECKLIST_ID ) final UUID checklistID ,
76
+ @ PathVariable (SERVICE_ID ) final String serviceID ) {
75
77
return checklistMapper .toReadDTO (checklistService .changeChecklistEntry (checklistID , serviceID , ZonedDateTime .now ()));
76
78
}
77
79
78
- @ PostMapping ("/{" + PATH_VAR_CHECKLIST_ID + "}/{" + PATH_VAR_SERVICE_ID + "}/uncheck" )
80
+ @ PostMapping (PATH_VAR_CHECKLIST_ID + PATH_VAR_SERVICE_ID )
79
81
@ Operation (summary = "Check a Checklist-Entry" , description = "Checks a checklist-entry." )
80
82
@ ResponseStatus (HttpStatus .OK )
81
- public ChecklistReadDTO uncheckChecklistEntry (@ PathVariable (PATH_VAR_CHECKLIST_ID ) final UUID checklistID ,
82
- @ PathVariable (PATH_VAR_SERVICE_ID ) final String serviceID ) {
83
+ public ChecklistReadDTO uncheckChecklistEntry (@ PathVariable (CHECKLIST_ID ) final UUID checklistID ,
84
+ @ PathVariable (SERVICE_ID ) final String serviceID ) {
83
85
return checklistMapper .toReadDTO (checklistService .changeChecklistEntry (checklistID , serviceID , null ));
84
86
}
85
87
}
0 commit comments