diff --git a/.github/workflows/backend-build.yml b/.github/workflows/backend-build.yml index 34d2395b..c0682d10 100644 --- a/.github/workflows/backend-build.yml +++ b/.github/workflows/backend-build.yml @@ -2,13 +2,13 @@ name: Backend - Build & Lint on: push: - branches: [main, pre-prod] + branches: [main] paths: - - "backend/**" + - "backend/**/**" pull_request: - branches: [main, pre-prod] + branches: [main] paths: - - "backend/**" + - "backend/**/**" jobs: lint: @@ -54,26 +54,31 @@ jobs: working-directory: backend/gestion run: go build -v ./... + - name: Upload binary + uses: actions/upload-artifact@v4 + with: + name: backend-binary + path: backend/gestion/gestion + retention-days: 7 + docker: name: Docker Build & Push needs: build runs-on: ubuntu-latest - if: > - (github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/pre-prod')) || - (github.event_name == 'pull_request' && (github.base_ref == 'main' || github.base_ref == 'pre-prod')) + if: github.event_name == 'push' && github.ref == 'refs/heads/main' steps: - uses: actions/checkout@v4 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Login to Docker Hub uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Build & push backend (runtime) uses: docker/build-push-action@v6 with: @@ -81,9 +86,7 @@ jobs: file: docker/backend/Dockerfile target: runtime push: true - tags: xor1234/backend-mln:${{ (github.ref == 'refs/heads/main' || github.base_ref == 'main') && 'latest' || 'pre-prod' }} - cache-from: type=gha,scope=backend-runtime - cache-to: type=gha,mode=max,scope=backend-runtime + tags: xor1234/backend-mln:latest - name: Build & push WAF uses: docker/build-push-action@v6 @@ -92,17 +95,12 @@ jobs: file: docker/backend/Dockerfile target: waf push: true - tags: xor1234/backend-mln:${{ (github.ref == 'refs/heads/main' || github.base_ref == 'main') && 'waf' || 'waf-pre-prod' }} - cache-from: type=gha,scope=backend-waf - cache-to: type=gha,mode=max,scope=backend-waf + tags: xor1234/backend-mln:waf deploy: - name: Deploy to server + name: SSH Deploy needs: docker runs-on: ubuntu-latest - if: > - (github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/pre-prod')) || - (github.event_name == 'pull_request' && (github.base_ref == 'main' || github.base_ref == 'pre-prod')) steps: - name: SSH deploy diff --git a/.github/workflows/frontend-admin-build.yml b/.github/workflows/frontend-admin-build.yml index c1ac7c1d..026c9ed0 100644 --- a/.github/workflows/frontend-admin-build.yml +++ b/.github/workflows/frontend-admin-build.yml @@ -32,10 +32,9 @@ jobs: working-directory: frontend-admin run: npx tsc --noEmit - build-apk-pre-prod: + build-apk: needs: typecheck runs-on: ubuntu-latest - if: github.event_name == 'push' && github.ref == 'refs/heads/pre-prod' steps: - uses: actions/checkout@v4 @@ -63,13 +62,13 @@ jobs: jq '.expo.extra.eas.projectId = "${{ secrets.EXPO_PROJECT_ID }}"' app.json > app.tmp.json mv app.tmp.json app.json - - name: Build production APK - working-directory: frontend-admin + - name: Build APK + working-directory: mobile env: EAS_BUILD_NO_EXPO_GO_WARNING: true - run: eas build --platform android --profile pre-production --non-interactive + run: eas build --platform android ${{ (github.ref == 'refs/heads/main' || github.base_ref == 'main') && '--profile production' || '--profile preview' }} --non-interactive - - name: Download production APK + - name: Download APK working-directory: frontend-admin run: | APK_URL=$(eas build:list --platform android --status finished --limit 1 --json --non-interactive | jq -r '.[0].artifacts.buildUrl') diff --git a/.github/workflows/frontend-client-build.yml b/.github/workflows/frontend-client-build.yml index f35e983a..0d54f4c4 100644 --- a/.github/workflows/frontend-client-build.yml +++ b/.github/workflows/frontend-client-build.yml @@ -32,10 +32,9 @@ jobs: working-directory: mobile run: npx tsc --noEmit - build-apk-prod: + build-apk: needs: typecheck runs-on: ubuntu-latest - if: github.event_name == 'push' && github.ref == 'refs/heads/pre-prod' steps: - uses: actions/checkout@v4 @@ -67,11 +66,11 @@ jobs: working-directory: mobile run: cat app.json - - name: Build production APK + - name: Build APK working-directory: mobile env: EAS_BUILD_NO_EXPO_GO_WARNING: true - run: eas build --platform android --profile production --non-interactive + run: ${{ (github.ref == 'refs/heads/main' || github.base_ref == 'main') && --profile production || --profile preview }} eas build --platform android --profile production --non-interactive - name: Download production APK working-directory: mobile diff --git a/.github/workflows/frontend-web-build.yml b/.github/workflows/frontend-web-build.yml index 36e7aaad..5538fef5 100644 --- a/.github/workflows/frontend-web-build.yml +++ b/.github/workflows/frontend-web-build.yml @@ -98,9 +98,6 @@ jobs: name: Deploy to server needs: docker runs-on: ubuntu-latest - if: > - (github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/pre-prod')) || - (github.event_name == 'pull_request' && (github.base_ref == 'main' || github.base_ref == 'pre-prod')) steps: - name: SSH deploy diff --git a/backend/gestion/services/geo_services.go b/backend/gestion/services/geo_services.go index 6817f3f2..29d85f86 100644 --- a/backend/gestion/services/geo_services.go +++ b/backend/gestion/services/geo_services.go @@ -16,10 +16,6 @@ import ( "github.com/redis/go-redis/v9" ) -// ============================================ -// CONSTANTES -// ============================================ - const ( NominatimBaseURL = "https://nominatim.openstreetmap.org/search" EarthRadiusKm = 6371.0 diff --git a/frontend-admin/src/api/api_admin.ts b/frontend-admin/src/api/api_admin.ts index 60dc6bc0..5fd33220 100644 --- a/frontend-admin/src/api/api_admin.ts +++ b/frontend-admin/src/api/api_admin.ts @@ -52,10 +52,6 @@ export const logoutAdmin = async (): Promise => { } }; -// ============================================ -// CLIENTS -// ============================================ - export const getAllClients = async (): Promise => { const { data } = await apiClient.get(`${V2}/admin/protected/all/clients`); return data.clients || []; diff --git a/frontend-prep/src/api/api.ts b/frontend-prep/src/api/api.ts index 91b2692b..9bdae554 100644 --- a/frontend-prep/src/api/api.ts +++ b/frontend-prep/src/api/api.ts @@ -1219,11 +1219,14 @@ export const calculateOrderTotal = (order: Record): number => { // Fallback: calculer depuis les items si présents if (Array.isArray(order.items) && order.items.length > 0) { - return (order.items as Record[]).reduce((sum: number, item) => { - const price = Number(item.prix || item.price || 0); - const quantity = Number(item.quantite || item.quantity || 1); - return sum + price * quantity; - }, 0); + return (order.items as Record[]).reduce( + (sum: number, item) => { + const price = Number(item.prix || item.price || 0); + const quantity = Number(item.quantite || item.quantity || 1); + return sum + price * quantity; + }, + 0, + ); } return 0; diff --git a/mobile/src/api/api.ts b/mobile/src/api/api.ts index 8f279981..d7ad039f 100644 --- a/mobile/src/api/api.ts +++ b/mobile/src/api/api.ts @@ -12,7 +12,7 @@ import type { import { getToken } from "../auth/tokenStorage"; import { extractUsernameFromToken } from "../auth/jwtUtils"; -const V1 = "https://5.181.0.112.nip.io/api/v1"; +const V1 = "https://mln-uber.club/api/v1"; export const getJwtUsername = async (): Promise => { const token = await getToken(); diff --git a/mobile/src/api/client.ts b/mobile/src/api/client.ts index e257b745..919ff467 100644 --- a/mobile/src/api/client.ts +++ b/mobile/src/api/client.ts @@ -2,7 +2,7 @@ import axios from "axios"; import { getToken, getAdminToken } from "../auth/tokenStorage"; // Change this to your server IP/domain -export const API_BASE_URL = "https://5.181.0.112.nip.io"; +export const API_BASE_URL = "https://mln-uber.club"; const apiClient = axios.create({ baseURL: API_BASE_URL,