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" ;
28
+
26
29
private final ChecklistService checklistService ;
27
30
private final ChecklistMapper checklistMapper ;
28
31
@@ -34,10 +37,10 @@ public List<ChecklistReadDTO> getChecklists() {
34
37
return checklists .stream ().map (checklistMapper ::toReadDTO ).toList ();
35
38
}
36
39
37
- @ GetMapping (path = "/{checklistID }" )
40
+ @ GetMapping (path = "/{" + PATH_VAR_CHECKLIST_ID + " }" )
38
41
@ Operation (summary = "Get specific checklist by checklist-id." , description = "Returns a checklist by checklistId" )
39
42
@ ResponseStatus (HttpStatus .OK )
40
- public ChecklistReadDTO getChecklist (@ PathVariable ("checklistID" ) final UUID checklistID ) {
43
+ public ChecklistReadDTO getChecklist (@ PathVariable (PATH_VAR_CHECKLIST_ID ) final UUID checklistID ) {
41
44
return checklistMapper .toReadDTO (checklistService .getChecklist (checklistID ));
42
45
}
43
46
@@ -57,26 +60,26 @@ public ChecklistReadDTO updateChecklist(@Valid @RequestBody final ChecklistUpdat
57
60
return checklistMapper .toReadDTO (checklistService .updateChecklist (checklistMapper .toUpdateChecklist (checklistUpdateDTO ), checklistID ));
58
61
}
59
62
60
- @ DeleteMapping ("/{checklistID }" )
63
+ @ DeleteMapping ("/{" + PATH_VAR_CHECKLIST_ID + " }" )
61
64
@ Operation (summary = "Delete a checklist" , description = "Deletes a checklist by checklistId." )
62
65
@ ResponseStatus (HttpStatus .OK )
63
- public void deleteChecklist (@ PathVariable ("checklistID" ) final UUID checklistID ) {
66
+ public void deleteChecklist (@ PathVariable (PATH_VAR_CHECKLIST_ID ) final UUID checklistID ) {
64
67
checklistService .deleteChecklist (checklistID );
65
68
}
66
69
67
- @ PostMapping ("/{checklistID }/{serviceID }/check" )
70
+ @ PostMapping ("/{" + PATH_VAR_CHECKLIST_ID + " }/{" + PATH_VAR_SERVICE_ID + " }/check" )
68
71
@ Operation (summary = "Check a Checklist-Entry" , description = "Checks a checklist-entry." )
69
72
@ ResponseStatus (HttpStatus .OK )
70
- public ChecklistReadDTO checkChecklistEntry (@ PathVariable ("checklistID" ) final UUID checklistID ,
71
- @ PathVariable ("serviceID" ) final String serviceID ) {
73
+ public ChecklistReadDTO checkChecklistEntry (@ PathVariable (PATH_VAR_CHECKLIST_ID ) final UUID checklistID ,
74
+ @ PathVariable (PATH_VAR_SERVICE_ID ) final String serviceID ) {
72
75
return checklistMapper .toReadDTO (checklistService .changeChecklistEntry (checklistID , serviceID , ZonedDateTime .now ()));
73
76
}
74
77
75
- @ PostMapping ("/{checklistID }/{serviceID }/uncheck" )
78
+ @ PostMapping ("/{" + PATH_VAR_CHECKLIST_ID + " }/{" + PATH_VAR_SERVICE_ID + " }/uncheck" )
76
79
@ Operation (summary = "Check a Checklist-Entry" , description = "Checks a checklist-entry." )
77
80
@ ResponseStatus (HttpStatus .OK )
78
- public ChecklistReadDTO uncheckChecklistEntry (@ PathVariable ("checklistID" ) final UUID checklistID ,
79
- @ PathVariable ("serviceID" ) final String serviceID ) {
81
+ public ChecklistReadDTO uncheckChecklistEntry (@ PathVariable (PATH_VAR_CHECKLIST_ID ) final UUID checklistID ,
82
+ @ PathVariable (PATH_VAR_SERVICE_ID ) final String serviceID ) {
80
83
return checklistMapper .toReadDTO (checklistService .changeChecklistEntry (checklistID , serviceID , null ));
81
84
}
82
85
}
0 commit comments