3.3 KiB
3.3 KiB
AGENTS.md
Project overview
- Symfony 8 + API Platform 4 backend, Nuxt 3 frontend in
frontend/. - Apache vhost serves API under
/apiand frontend fromfrontend/dist. - API base URL on frontend uses
NUXT_PUBLIC_API_BASE(seefrontend/.env).
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:
date_reception,license_plate,current_step(default 0),is_valid(default false). date_receptionis set by the UI, stored asDateTimeImmutable, serialized asY-m-d.- Weight entity (
src/Entity/Weight.php) is 1–N with Reception, each row storestype(grossortare),dsd,weight,weighed_at(all nullable excepttype). - Weigh endpoint
/receptions/weighreturnsPontBasculeReadingwithdsd,weight,weighedAt(formattedY-m-d). - Custom exception:
App\Exception\PontBasculeExceptionwith French messages, mapped to 500 in provider. - Parsing of pont-bascule payload is in
src/Service/PontBasculePayloadDecoder.php. config/reference.phpis auto-generated; keep it.
Frontend conventions
- Nuxt SSR disabled; Tailwind used.
- Layout in
frontend/layouts/default.vue: max width1050px, header full width. - Tailwind custom color palette is
primary(e.g.bg-primary-500). - API composable in
frontend/composables/useApi.tswithget/post/put/patch/deleteand default JSON/PATCH content types. - API errors/success toasts can be customized via
toastErrorMessage/toastSuccessMessageor i18n keystoastErrorKey/toastSuccessKey. Global method fallbacks useerrors.http.*keys. useApiusesuseNuxtApp().$i18n(notuseI18n) to avoid setup-only constraint in service calls.- Pinia store:
frontend/stores/reception.tsis 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 infrontend/utils/zod-errors.ts. - Weighing logic is shared via
frontend/composables/useWeighing.ts. - Reception step UI uses store state (
currentStep) infrontend/pages/reception/[[id]].vue. - Active nav styles in header use
NuxtLinkwithcustomslot. - Reusable UI components live under
frontend/components/ui/and are auto-imported withUiprefix (e.g.UiLoadingDots). - Service layer lives in
frontend/services/with typed DTOs infrontend/services/dto/. - Reception service uses
receptions,receptions/{id},receptions/weighand supports success/error toast keys. - Reception receipt endpoint is
receptions/{id}/receipt(PDF) viafrontend/composables/usePdfPrinter.ts.
Environment & routing
- Frontend dev server:
npm run devinfrontend/. - API base for local dev:
http://localhost:8080/api(set infrontend/.envviaNUXT_PUBLIC_API_BASE). - CORS handled by Nelmio;
.envincludesCORS_ALLOW_ORIGINregex for localhost. - Nuxt i18n locales live in
frontend/i18n/locales(configured vialangDir: 'locales'). - Default locale is
fr; translations infrontend/i18n/locales/fr.json.
Notes
- Do not add a GET that creates resources; use POST + PATCH.
- Keep endpoints in plural (API Platform convention).