diff --git a/AGENTS.md b/AGENTS.md index 8806129..61ec05d 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -9,9 +9,10 @@ Backend conventions - Use English for code identifiers/messages; keep “pont-bascule” as domain term. - API Platform operations are defined on Doctrine entities. - Reception entity is in `src/Entity/Reception.php`, with custom weigh endpoint `/receptions/weigh`. -- Reception fields: `dsd`, `weight`, `date_reception`, `license_plate`, `current_step` (default 0), `is_valid` (default false). -- `date_reception` is set by the UI, stored as `DateTimeImmutable`. -- Weight entity (`src/Entity/Weight.php`) is 1–1 with Reception, weights stored as `int` (kg), dates nullable. +- Reception fields: `date_reception`, `license_plate`, `current_step` (default 0), `is_valid` (default false). +- `date_reception` is set by the UI, stored as `DateTimeImmutable`, serialized as `Y-m-d`. +- Weight entity (`src/Entity/Weight.php`) is 1–N with Reception, each row stores `type` (`gross` or `tare`), `dsd`, `weight`, `weighed_at` (all nullable except `type`). +- Weigh endpoint `/receptions/weigh` returns `PontBasculeReading` with `dsd`, `weight`, `weighedAt` (formatted `Y-m-d`). - Custom exception: `App\Exception\PontBasculeException` with French messages, mapped to 500 in provider. - Parsing of pont-bascule payload is in `src/Service/PontBasculePayloadDecoder.php`. - `config/reference.php` is auto-generated; keep it. @@ -22,8 +23,11 @@ Frontend conventions - Tailwind custom color palette is `primary` (e.g. `bg-primary-500`). - API composable in `frontend/composables/useApi.ts` with `get/post/put/patch/delete` and default JSON/PATCH content types. - Pinia store: `frontend/stores/reception.ts` is the source of truth for the current reception. +- Zod is used for form validation (e.g. `frontend/components/reception/reception-form.vue`); shared helpers live in `frontend/utils/zod-errors.ts`. +- Weighing logic is shared via `frontend/composables/useWeighing.ts`. - Reception step UI uses store state (`currentStep`) in `frontend/pages/reception/[[id]].vue`. - Active nav styles in header use `NuxtLink` with `custom` slot. +- Reusable UI components live under `frontend/components/ui/` and are auto-imported with `Ui` prefix (e.g. `UiLoadingDots`). Environment & routing - Frontend dev server: `npm run dev` in `frontend/`.