Summary
When editing a ticket via the edit-ticket page, the form collects title, description, priority, and status — but the current submit handler in src/main/resources/static/js/edit-ticket.js only sends status to PATCH /api/tickets/{id}/status. The remaining fields (title, description, priority) are silently discarded.
Note: The client-side edit-ticket logic was originally in src/main/resources/static/js/app.js (removed in PR #81) and has since moved to src/main/resources/static/js/edit-ticket.js.
Required work
-
Create UpdateTicketDTO — a new DTO class (e.g., src/main/java/org/example/cyberwatch/features/ticket/model/UpdateTicketDTO.java) with fields:
String title
String description
Priority priority
Status status
(with appropriate validation annotations)
-
Add PUT /api/tickets/{id} endpoint in TicketController that accepts the new UpdateTicketDTO and updates all four fields.
-
Implement service method in TicketService to persist the updated title, description, priority, and status.
-
Update the client handler in src/main/resources/static/js/edit-ticket.js (setupEditTicketForm) to send a JSON PUT with all four fields to /api/tickets/{id} instead of the single-field PATCH.
References
Summary
When editing a ticket via the edit-ticket page, the form collects title, description, priority, and status — but the current submit handler in
src/main/resources/static/js/edit-ticket.jsonly sendsstatustoPATCH /api/tickets/{id}/status. The remaining fields (title,description,priority) are silently discarded.Required work
Create
UpdateTicketDTO— a new DTO class (e.g.,src/main/java/org/example/cyberwatch/features/ticket/model/UpdateTicketDTO.java) with fields:String titleString descriptionPriority priorityStatus status(with appropriate validation annotations)
Add
PUT /api/tickets/{id}endpoint inTicketControllerthat accepts the newUpdateTicketDTOand updates all four fields.Implement service method in
TicketServiceto persist the updated title, description, priority, and status.Update the client handler in
src/main/resources/static/js/edit-ticket.js(setupEditTicketForm) to send a JSONPUTwith all four fields to/api/tickets/{id}instead of the single-fieldPATCH.References