Skip to content

feat: Work Order PDF Generation Service (Story 12.1)#187

Merged
daveharmswebdev merged 2 commits intomainfrom
feature/12-1-work-order-pdf-generation-service
Feb 6, 2026
Merged

feat: Work Order PDF Generation Service (Story 12.1)#187
daveharmswebdev merged 2 commits intomainfrom
feature/12-1-work-order-pdf-generation-service

Conversation

@daveharmswebdev
Copy link
Owner

Summary

  • Add POST /api/v1/work-orders/{id}/pdf endpoint that generates a professional PDF document for any work order
  • QuestPDF implementation with all required sections: header with status badge, property info, work order details, vendor/DIY assignment, chronological notes, linked expenses table with totals, photo count note, and branded footer with page numbers
  • Follows existing ScheduleE PDF architecture pattern exactly (interface in Application, implementation in Infrastructure, DI in Program.cs)
  • 9 new unit tests covering: valid generation, 404 for missing work orders, DIY work orders, empty notes/expenses, photo count, vendor contact mapping, address formatting, filename sanitization

Test plan

  • 9 new unit tests passing
  • 913 total Application.Tests passing (0 regressions)
  • Solution builds with 0 errors
  • Manual smoke test: call endpoint with valid work order ID, verify PDF opens and contains all sections
  • Verify 404 returned for non-existent work order ID

🤖 Generated with Claude Code

daveharmswebdev and others added 2 commits February 6, 2026 08:40
Implement backend service to generate professional work order PDFs via
POST /api/v1/work-orders/{id}/pdf. Follows existing ScheduleE PDF pattern
using QuestPDF. Includes header with status badge, property info, work order
details, vendor/DIY assignment, notes, linked expenses table, photo count
note, and branded footer with page numbers. 9 unit tests, 913 total passing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Code review fixes for work order PDF generation (PR #187):
- CRITICAL: Add explicit AccountId filter to query (defense-in-depth)
- Add AsNoTracking() to all three read-only queries (performance)
- Add validator injection and call in controller endpoint (consistency)
- Capture DateTime.UtcNow once to prevent midnight-boundary drift
- Remove redundant DeletedAt filters (global query filter handles it)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@daveharmswebdev daveharmswebdev merged commit 5cc798d into main Feb 6, 2026
7 checks passed
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