Files
andris-carservice/aidoit-notes.md
T
Hermes f7a9906add
Build and publish images / docker (push) Canceled after 0s
carservice: initial commit
2026-07-20 20:51:23 +01:00

17 lines
3.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Project notes
- dashboard: [[src/app/page.tsx]] lists open orders from GET /api/orders and finished orders from GET /api/orders?status=finished; order cards navigate to order detail; close order via PATCH /api/orders/:id; uses [[src/components/Navbar.tsx]] for sticky header/settings menu.
- car edit/delete: cars list rows in [[src/app/cars/page.tsx]] are clickable cards; [[src/app/cars/[id]/page.tsx]] offers Edit/Save and Delete, posting PATCH/DELETE to [[src/app/api/cars/[id]/route.ts]].
- car create/lookup: [[src/app/orders/new/page.tsx]] → POST /api/cars with `lookup: true` → [[src/lib/vehicle-lookup.ts]] (DVLA for UK plates; ROI parser / MotorCheck for Irish plates); reg input uses a ref so programmatic fills work.
- order detail + tasks: [[src/app/orders/[id]/page.tsx]] uses SWR to GET /api/orders/:id; task toggle/edit/delete via /api/tasks/:id; pricing recalculated server-side in PATCH; parts modal posts to /api/parts; close order via PATCH.
- pricing: task total = selected saved parts (qty × price) + laborHours × hourlyRate, manual `price` overrides; order total stored in [[prisma/schema.prisma]] Order.total and recalculated in [[src/app/api/tasks/[id]/route.ts]].
- parts library: [[src/app/parts/page.tsx]] → /api/parts and /api/scrape-part using [[src/lib/scrape.ts]] (Cheerio on fetched page); add-part modal supports scraping a URL first. Parts page now has two tabs: Global (default) and Car Specific. Car-specific tab includes a car reg search field and shows only parts linked to that car.
- parts API: [[src/app/api/parts/route.ts]] GET supports `includeGlobal` query param; when `carId` is passed with `includeGlobal=true`, it returns both car-specific and global parts; with `includeGlobal=false`, it returns only car-specific parts. Default without `carId` shows only global parts.
- parts in task edit: [[src/app/orders/[id]/page.tsx]] when editing a task, the available parts list defaults to car-specific parts only (via `includeGlobal=false`). A "Show global parts" checkbox toggles `showGlobalParts` state to also include global parts in the list.
- quick tasks: seeded in [[prisma/seed.js]], managed in [[src/app/quick-tasks/page.tsx]], used when adding tasks in order detail; useCount incremented on add/finish.
- print: [[src/app/orders/[id]/print/page.tsx]] fetches GET /api/print/:id with type=service|invoice, day/range/prices params. Service report shows labour per task column, no prices by default. Invoice shows tasks list with Parts/Labour totals separated at bottom (no per-task labour column). Print stylesheet hides `.no-print`.
- car history: [[src/app/api/cars/[id]/history/route.ts]] returns finished tasks flat (no prices); [[src/app/cars/[id]/history/page.tsx]] bundles same-title tasks; [[src/app/cars/[id]/history/print/page.tsx]] is the printable bundled view.
- navbar: [[src/components/Navbar.tsx]] sticky header on all pages, includes settings menu panel with site name field and quick-tabs toggles; links Dashboard/Cars/Parts/Quick tasks and New order button.
- database: Prisma `DATABASE_URL` in [[.env]] is `file:./dev.db`, resolved relative to [[prisma/schema.prisma]] → `prisma/dev.db`.
- test ids: data-testid attributes added to dashboard search/clear, order cards, reg input/lookup, car details fields, car edit/save/delete, car cards/search, task add/edit/toggle/delete, parts modal/scrape/fields, print and close-order buttons.