Skip to content

client(feat): implement ticket completion feature with documentation …#12

Open
xowin wants to merge 1 commit intodevfrom
complete-button
Open

client(feat): implement ticket completion feature with documentation …#12
xowin wants to merge 1 commit intodevfrom
complete-button

Conversation

@xowin
Copy link
Collaborator

@xowin xowin commented Oct 10, 2025

This pull request introduces a comprehensive "resolution documentation" workflow for tickets, improving both the user interface and backend support for documenting how tickets are resolved. Users are now prompted to provide documentation before completing a ticket, and this information is displayed in the ticket details. The changes also include UI/UX enhancements and backend API updates to support the new workflow.

Ticket Completion & Documentation Workflow

  • Added a new TicketCompleteModal component that prompts users to provide resolution documentation before marking a ticket as complete. The modal enforces documentation as a required field and provides helpful guidance for writing it. (client/components/tickets/ticket-complete-modal.tsx)
  • Updated the ticket detail view to include a "Complete Ticket" button (when not already closed), which opens the completion modal. Upon completion, the ticket status is set to "Closed" and the documentation is saved. (client/components/tickets/ticket-detail.tsx) [1] [2] [3] [4] [5]
  • Added a dedicated "Resolution Documentation" section to the ticket detail view, displaying the documentation if present or a fallback message if not. (client/components/tickets/ticket-detail.tsx)
  • Extended the ticket editing form to allow editing the documentation field, and ensured all form fields have safe default values to avoid uncontrolled input issues. (client/components/tickets/ticket-edit.tsx) [1] [2] [3] [4] [5] [6] [7] [8] [9]
  • Added the optional documentation field to the Ticket type. (client/lib/types/ticket.ts)

Backend & API Enhancements

  • Added a new API endpoint and handler to mark a ticket as completed (POST /api/v1/tickets/{id}/complete), which sets the ticket status to "Closed". (server/internal/api/handlers.go) [1] [2]
  • Added a corresponding completeTicket function to the client API and a React Query hook for ticket completion. (client/lib/api/tickets.ts, client/lib/hooks/queries/use-tickets.ts) [1] [2] [3]

Other Improvements

  • Improved cache updating and invalidation on ticket update and completion to ensure UI reflects the latest data immediately. (client/lib/hooks/queries/use-tickets.ts)

These changes together ensure that every completed ticket includes a documented resolution, making it easier for team members to learn from previous work and improving the maintainability of the ticketing system.

@xowin xowin requested review from Copilot and villaleo October 10, 2025 18:48
@vercel
Copy link

vercel bot commented Oct 10, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
nestqueue Error Error Oct 10, 2025 6:48pm
nestqueue-mmc4 Error Error Oct 10, 2025 6:48pm

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request introduces a comprehensive ticket completion workflow with mandatory resolution documentation. The changes enhance both the user interface and backend to support documenting how tickets are resolved before marking them as complete.

  • Added a new documentation field to the ticket model and database operations
  • Created a modal-based completion workflow that requires resolution documentation
  • Enhanced the ticket detail and edit views to display and manage documentation

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
server/internal/models/ticket.go Added documentation field to Ticket struct and BSON tags
server/internal/storage/storage.go Added documentation field support in create and update operations
server/internal/api/handlers.go Added new completion endpoint for marking tickets as closed
client/lib/types/ticket.ts Added optional documentation field to Ticket interface
client/lib/api/tickets.ts Added completeTicket API function
client/lib/hooks/queries/use-tickets.ts Added completion hook and improved cache management
client/components/tickets/ticket-edit.tsx Enhanced form with documentation field and safer default values
client/components/tickets/ticket-detail.tsx Added completion button, documentation display, and completion modal
client/components/tickets/ticket-complete-modal.tsx New modal component for ticket completion with required documentation

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +54 to 57
return useMutation<Ticket, Error, string>({
mutationFn: (id) => completeTicket(id),
onSuccess: () => client.invalidateQueries({ queryKey: ["tickets"] }),
});
Copy link

Copilot AI Oct 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The useCompleteTicket hook is defined but not used in the actual completion flow. The ticket-detail.tsx component uses updateTicket instead of completeTicket for completion. Consider removing this unused hook or updating the completion flow to use it.

Copilot uses AI. Check for mistakes.
Comment on lines +108 to +125
updateTicket({
id: ticketId,
updates: {
status: "Closed",
documentation: documentation
}
}, {
onSuccess: (updatedTicket) => {
setStatus("Closed");
setIsCompletionModalOpen(false);
setIsCompleting(false);
onUpdate(); // Call immediately since cache is updated
},
onError: (error) => {
console.error('Error updating ticket:', error);
setIsCompleting(false);
},
});
Copy link

Copilot AI Oct 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The completion flow bypasses the dedicated completion endpoint (/api/v1/tickets/{id}/complete) and uses the general update endpoint instead. This creates inconsistency - there's a specific completion API that's not being used. Consider using the completeTicket function or removing the unused completion endpoint.

Copilot uses AI. Check for mistakes.
}
sugar = h.logger.Sugar()
)

Copy link

Copilot AI Oct 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The completion endpoint only sets the status to 'Closed' but doesn't handle the documentation field that the frontend is trying to set. This creates a mismatch between the frontend completion workflow (which includes documentation) and the backend completion endpoint.

Suggested change
// Attempt to decode documentation from the request body, if present
var body map[string]any
if r.Body != nil {
if err := decodeInto(r.Body, &body); err != nil && err.Error() != "EOF" {
sugar.Error(err)
http.Error(w, errInternal.Error(), http.StatusInternalServerError)
return
}
if doc, ok := body["documentation"]; ok {
updates["documentation"] = doc
}
}

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant