chore: fix
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -16,10 +16,6 @@ import (
|
||||
"github.com/redis/go-redis/v9"
|
||||
)
|
||||
|
||||
// ============================================
|
||||
// CONSTANTES
|
||||
// ============================================
|
||||
|
||||
const (
|
||||
NominatimBaseURL = "https://nominatim.openstreetmap.org/search"
|
||||
EarthRadiusKm = 6371.0
|
||||
|
||||
@@ -52,10 +52,6 @@ export const logoutAdmin = async (): Promise<void> => {
|
||||
}
|
||||
};
|
||||
|
||||
// ============================================
|
||||
// CLIENTS
|
||||
// ============================================
|
||||
|
||||
export const getAllClients = async (): Promise<ClientResponse[]> => {
|
||||
const { data } = await apiClient.get(`${V2}/admin/protected/all/clients`);
|
||||
return data.clients || [];
|
||||
|
||||
@@ -1219,11 +1219,14 @@ export const calculateOrderTotal = (order: Record<string, unknown>): number => {
|
||||
|
||||
// Fallback: calculer depuis les items si présents
|
||||
if (Array.isArray(order.items) && order.items.length > 0) {
|
||||
return (order.items as Record<string, unknown>[]).reduce((sum: number, item) => {
|
||||
return (order.items as Record<string, unknown>[]).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);
|
||||
},
|
||||
0,
|
||||
);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -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<string | null> => {
|
||||
const token = await getToken();
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user