Skip to content

Implement PUT /api/tickets/{id} endpoint and UpdateTicketDTO for full ticket editing #68

Description

@coderabbitai

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

  1. 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)
  2. Add PUT /api/tickets/{id} endpoint in TicketController that accepts the new UpdateTicketDTO and updates all four fields.

  3. Implement service method in TicketService to persist the updated title, description, priority, and status.

  4. 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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions