4.9 KiB
4.9 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). - Reception also has
identification_number(autoN-BR-####),merchandise_type,merchandise_detail,buildings(M2M), andpellet_buildings(viareception_pellet_building). 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). - Global font stack uses Helvetica via Tailwind (
font-sans) andfrontend/assets/css/main.css. - 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. - Step 2 uses
frontend/components/reception/reception-product-received.vuefor merchandise selection; type codes infrontend/utils/constants.ts. - 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).
- New reference data added:
- Reception types (
reception_type, fields:label,code), selectable on reception form. - Merchandise types (
merchandise_type, fields:label,code) and pellet types (pellet_type, fields:label,code). - Buildings (
building, fields:label,code) and reception allocations (reception_buildingM2M,reception_pellet_buildingunique on reception/pellet/building). - Suppliers (
supplier) with addresses (address, fields:label,street,postal_code,city,country_codeISO2), viasupplier_addressjoin table. - Trucks (
truck, field:name), linked to receptions. - Carriers (
carrier, fields:name, nullablecode), Drivers (driver, fields:name,carrier_id), Vehicles (vehicle, fields:plate,carrier_id,truck_id) used for LIOT logic. - Reception links:
reception_type_id,supplier_id,address_id,truck_id,carrier_id,driver_id,user_id. - Address exposes
fullAddressvia getter for display. - LIOT behavior in reception form: if carrier code =
LIOT, show driver + vehicle selects and hide manual license plate input; vehicle list filters by truck type and carrier; selected vehicle setslicense_plate.
- Reception types (