chore: fix
This commit is contained in:
@@ -2,13 +2,13 @@ name: Backend - Build & Lint
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [main, pre-prod]
|
branches: [main]
|
||||||
paths:
|
paths:
|
||||||
- "backend/**"
|
- "backend/**/**"
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [main, pre-prod]
|
branches: [main]
|
||||||
paths:
|
paths:
|
||||||
- "backend/**"
|
- "backend/**/**"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
lint:
|
lint:
|
||||||
@@ -54,26 +54,31 @@ jobs:
|
|||||||
working-directory: backend/gestion
|
working-directory: backend/gestion
|
||||||
run: go build -v ./...
|
run: go build -v ./...
|
||||||
|
|
||||||
|
- name: Upload binary
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: backend-binary
|
||||||
|
path: backend/gestion/gestion
|
||||||
|
retention-days: 7
|
||||||
|
|
||||||
docker:
|
docker:
|
||||||
name: Docker Build & Push
|
name: Docker Build & Push
|
||||||
needs: build
|
needs: build
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: >
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||||
(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:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
|
|
||||||
- name: Login to Docker Hub
|
- name: Login to Docker Hub
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
- name: Build & push backend (runtime)
|
- name: Build & push backend (runtime)
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
@@ -81,9 +86,7 @@ jobs:
|
|||||||
file: docker/backend/Dockerfile
|
file: docker/backend/Dockerfile
|
||||||
target: runtime
|
target: runtime
|
||||||
push: true
|
push: true
|
||||||
tags: xor1234/backend-mln:${{ (github.ref == 'refs/heads/main' || github.base_ref == 'main') && 'latest' || 'pre-prod' }}
|
tags: xor1234/backend-mln:latest
|
||||||
cache-from: type=gha,scope=backend-runtime
|
|
||||||
cache-to: type=gha,mode=max,scope=backend-runtime
|
|
||||||
|
|
||||||
- name: Build & push WAF
|
- name: Build & push WAF
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
@@ -92,17 +95,12 @@ jobs:
|
|||||||
file: docker/backend/Dockerfile
|
file: docker/backend/Dockerfile
|
||||||
target: waf
|
target: waf
|
||||||
push: true
|
push: true
|
||||||
tags: xor1234/backend-mln:${{ (github.ref == 'refs/heads/main' || github.base_ref == 'main') && 'waf' || 'waf-pre-prod' }}
|
tags: xor1234/backend-mln:waf
|
||||||
cache-from: type=gha,scope=backend-waf
|
|
||||||
cache-to: type=gha,mode=max,scope=backend-waf
|
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
name: Deploy to server
|
name: SSH Deploy
|
||||||
needs: docker
|
needs: docker
|
||||||
runs-on: ubuntu-latest
|
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:
|
steps:
|
||||||
- name: SSH deploy
|
- name: SSH deploy
|
||||||
|
|||||||
@@ -32,10 +32,9 @@ jobs:
|
|||||||
working-directory: frontend-admin
|
working-directory: frontend-admin
|
||||||
run: npx tsc --noEmit
|
run: npx tsc --noEmit
|
||||||
|
|
||||||
build-apk-pre-prod:
|
build-apk:
|
||||||
needs: typecheck
|
needs: typecheck
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: github.event_name == 'push' && github.ref == 'refs/heads/pre-prod'
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
@@ -63,13 +62,13 @@ jobs:
|
|||||||
jq '.expo.extra.eas.projectId = "${{ secrets.EXPO_PROJECT_ID }}"' app.json > app.tmp.json
|
jq '.expo.extra.eas.projectId = "${{ secrets.EXPO_PROJECT_ID }}"' app.json > app.tmp.json
|
||||||
mv app.tmp.json app.json
|
mv app.tmp.json app.json
|
||||||
|
|
||||||
- name: Build production APK
|
- name: Build APK
|
||||||
working-directory: frontend-admin
|
working-directory: mobile
|
||||||
env:
|
env:
|
||||||
EAS_BUILD_NO_EXPO_GO_WARNING: true
|
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
|
working-directory: frontend-admin
|
||||||
run: |
|
run: |
|
||||||
APK_URL=$(eas build:list --platform android --status finished --limit 1 --json --non-interactive | jq -r '.[0].artifacts.buildUrl')
|
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
|
working-directory: mobile
|
||||||
run: npx tsc --noEmit
|
run: npx tsc --noEmit
|
||||||
|
|
||||||
build-apk-prod:
|
build-apk:
|
||||||
needs: typecheck
|
needs: typecheck
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: github.event_name == 'push' && github.ref == 'refs/heads/pre-prod'
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
@@ -67,11 +66,11 @@ jobs:
|
|||||||
working-directory: mobile
|
working-directory: mobile
|
||||||
run: cat app.json
|
run: cat app.json
|
||||||
|
|
||||||
- name: Build production APK
|
- name: Build APK
|
||||||
working-directory: mobile
|
working-directory: mobile
|
||||||
env:
|
env:
|
||||||
EAS_BUILD_NO_EXPO_GO_WARNING: true
|
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
|
- name: Download production APK
|
||||||
working-directory: mobile
|
working-directory: mobile
|
||||||
|
|||||||
@@ -98,9 +98,6 @@ jobs:
|
|||||||
name: Deploy to server
|
name: Deploy to server
|
||||||
needs: docker
|
needs: docker
|
||||||
runs-on: ubuntu-latest
|
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:
|
steps:
|
||||||
- name: SSH deploy
|
- name: SSH deploy
|
||||||
|
|||||||
@@ -16,10 +16,6 @@ import (
|
|||||||
"github.com/redis/go-redis/v9"
|
"github.com/redis/go-redis/v9"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ============================================
|
|
||||||
// CONSTANTES
|
|
||||||
// ============================================
|
|
||||||
|
|
||||||
const (
|
const (
|
||||||
NominatimBaseURL = "https://nominatim.openstreetmap.org/search"
|
NominatimBaseURL = "https://nominatim.openstreetmap.org/search"
|
||||||
EarthRadiusKm = 6371.0
|
EarthRadiusKm = 6371.0
|
||||||
|
|||||||
@@ -52,10 +52,6 @@ export const logoutAdmin = async (): Promise<void> => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// ============================================
|
|
||||||
// CLIENTS
|
|
||||||
// ============================================
|
|
||||||
|
|
||||||
export const getAllClients = async (): Promise<ClientResponse[]> => {
|
export const getAllClients = async (): Promise<ClientResponse[]> => {
|
||||||
const { data } = await apiClient.get(`${V2}/admin/protected/all/clients`);
|
const { data } = await apiClient.get(`${V2}/admin/protected/all/clients`);
|
||||||
return data.clients || [];
|
return data.clients || [];
|
||||||
|
|||||||
@@ -1219,11 +1219,14 @@ export const calculateOrderTotal = (order: Record<string, unknown>): number => {
|
|||||||
|
|
||||||
// Fallback: calculer depuis les items si présents
|
// Fallback: calculer depuis les items si présents
|
||||||
if (Array.isArray(order.items) && order.items.length > 0) {
|
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 price = Number(item.prix || item.price || 0);
|
||||||
const quantity = Number(item.quantite || item.quantity || 1);
|
const quantity = Number(item.quantite || item.quantity || 1);
|
||||||
return sum + price * quantity;
|
return sum + price * quantity;
|
||||||
}, 0);
|
},
|
||||||
|
0,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import type {
|
|||||||
import { getToken } from "../auth/tokenStorage";
|
import { getToken } from "../auth/tokenStorage";
|
||||||
import { extractUsernameFromToken } from "../auth/jwtUtils";
|
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> => {
|
export const getJwtUsername = async (): Promise<string | null> => {
|
||||||
const token = await getToken();
|
const token = await getToken();
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import axios from "axios";
|
|||||||
import { getToken, getAdminToken } from "../auth/tokenStorage";
|
import { getToken, getAdminToken } from "../auth/tokenStorage";
|
||||||
|
|
||||||
// Change this to your server IP/domain
|
// 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({
|
const apiClient = axios.create({
|
||||||
baseURL: API_BASE_URL,
|
baseURL: API_BASE_URL,
|
||||||
|
|||||||
Reference in New Issue
Block a user