Commit Graph

7 Commits

Author SHA1 Message Date
DahoudG
a5adb84a62 Fix: Correction des types TypeScript et validation du build production
Corrections apportées:

1. **Utilisation correcte des services exportés**
   - Remplacement de apiService.X par les services nommés (chantierService, clientService, etc.)
   - Alignement avec l'architecture d'export du fichier services/api.ts

2. **Correction des types d'interface**
   - Utilisation des types officiels depuis @/types/btp
   - Chantier: suppression des propriétés custom, utilisation du type standard
   - Client: ajout des imports Chantier et Facture
   - Materiel: adaptation aux propriétés réelles (numeroSerie au lieu de reference)
   - PlanningEvent: remplacement de TacheChantier par PlanningEvent

3. **Correction des propriétés obsolètes**
   - Chantier: dateFin → dateFinPrevue, budget → montantPrevu, responsable → typeChantier
   - Client: typeClient → entreprise, suppression de chantiers/factures inexistants
   - Materiel: reference → numeroSerie, prixAchat → valeurAchat
   - PlanningEvent: nom → titre, suppression de progression

4. **Correction des enums**
   - StatutFacture: EN_ATTENTE → ENVOYEE/BROUILLON/PARTIELLEMENT_PAYEE
   - PrioritePlanningEvent: MOYENNE → CRITIQUE/HAUTE/NORMALE/BASSE

5. **Fix async/await pour cookies()**
   - Ajout de await pour cookies() dans les routes API (Next.js 15 requirement)
   - app/api/auth/logout/route.ts
   - app/api/auth/token/route.ts
   - app/api/auth/userinfo/route.ts

6. **Fix useSearchParams() Suspense**
   - Enveloppement de useSearchParams() dans un Suspense boundary
   - Création d'un composant LoginContent séparé
   - Ajout d'un fallback avec spinner

Résultat:
 Build production réussi: 126 pages générées
 Compilation TypeScript sans erreurs
 Linting validé
 Middleware 34.4 kB
 First Load JS shared: 651 kB

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-31 13:24:12 +00:00
dahoud
9b55f5219a Fix: Use ARG for NEXT_PUBLIC variables to ensure correct API URL during build
Problem: Frontend was trying to contact http://localhost:8080 instead of
https://api.lions.dev/btpxpress because NEXT_PUBLIC_API_URL wasn't correctly
baked into the Next.js bundle during build.

Solution:
- Added ARG declarations with correct default values for all NEXT_PUBLIC_* variables
- Convert ARG to ENV before running npm run build
- This ensures Next.js bakes the correct values into the bundle
- ARG allows override at docker build time if needed
- Fixed ENV format to use = instead of space (removes Docker warnings)

Variables defined:
- NEXT_PUBLIC_API_URL=https://api.lions.dev/btpxpress
- NEXT_PUBLIC_KEYCLOAK_URL=https://security.lions.dev
- NEXT_PUBLIC_KEYCLOAK_REALM=btpxpress
- NEXT_PUBLIC_KEYCLOAK_CLIENT_ID=btpxpress-frontend
- NEXT_PUBLIC_APP_ENV=production

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-25 17:46:44 +00:00
dahoud
728b2d31d6 Revert "Fix: Define NEXT_PUBLIC variables explicitly in Dockerfile for build time"
This reverts commit e56e485fcd.
2025-10-25 17:08:34 +00:00
dahoud
e56e485fcd Fix: Define NEXT_PUBLIC variables explicitly in Dockerfile for build time
Added explicit ENV declarations for all NEXT_PUBLIC_* variables in the
builder stage before npm run build. This ensures Next.js correctly bakes
these values into the JavaScript bundle, regardless of lionsctl's
automatic manifest generation.

Variables defined:
- NEXT_PUBLIC_API_URL=https://api.lions.dev/btpxpress
- NEXT_PUBLIC_KEYCLOAK_URL=https://security.lions.dev
- NEXT_PUBLIC_KEYCLOAK_REALM=btpxpress
- NEXT_PUBLIC_KEYCLOAK_CLIENT_ID=btpxpress-frontend
- NEXT_PUBLIC_APP_ENV=production

This fixes the issue where the frontend was using https://api.lions.dev
instead of https://api.lions.dev/btpxpress for API calls.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-25 16:46:02 +00:00
dahoud
2cf0378270 Fix: Add NODE_ENV=production during Next.js build to load .env.production
Next.js only loads .env.production when NODE_ENV=production is set during build time.
Previously, NODE_ENV was only set in the runner stage, causing the builder stage to
ignore .env.production and use default values.

This fixes NEXT_PUBLIC_API_URL to correctly point to https://api.lions.dev/btpxpress
instead of just https://api.lions.dev.
2025-10-24 08:04:55 +00:00
dahoud
5bdd4b6e4f fix: Remove demo pages and add testDataService for production build 2025-10-02 00:10:01 +00:00
dahoud
b430bf3b96 Initial commit 2025-10-01 01:39:07 +00:00