chore: build
This commit is contained in:
@@ -319,6 +319,7 @@ func SetupRoutes(router *gin.Engine, database *db.Database, geoService *services
|
|||||||
cabineGroupV1.POST("/telegram/link-token", handlers.GenerateAdminLinkToken)
|
cabineGroupV1.POST("/telegram/link-token", handlers.GenerateAdminLinkToken)
|
||||||
cabineGroupV1.DELETE("/telegram/unlink", handlers.UnlinkAdminTelegram)
|
cabineGroupV1.DELETE("/telegram/unlink", handlers.UnlinkAdminTelegram)
|
||||||
|
|
||||||
|
cabineGroupV1.GET("/commands", handlers.GetAllCommands)
|
||||||
cabineGroupV1.GET("/commands/:id/items", handlers.ShowItems)
|
cabineGroupV1.GET("/commands/:id/items", handlers.ShowItems)
|
||||||
cabineGroupV1.POST("/commands/:id/confirm-reception", handlers.StaffApproveDelivery)
|
cabineGroupV1.POST("/commands/:id/confirm-reception", handlers.StaffApproveDelivery)
|
||||||
cabineGroupV1.POST("/commands/:id/assign", handlers.AssignDeliveryPerson)
|
cabineGroupV1.POST("/commands/:id/assign", handlers.AssignDeliveryPerson)
|
||||||
@@ -327,9 +328,10 @@ func SetupRoutes(router *gin.Engine, database *db.Database, geoService *services
|
|||||||
cabineGroupV1.PUT("/items/:item_id/status", handlers.UpdateItemStatus)
|
cabineGroupV1.PUT("/items/:item_id/status", handlers.UpdateItemStatus)
|
||||||
cabineGroupV1.GET("/commands/:id/deliveryman/location", handlers.GetDeliverymanLocationForCommand)
|
cabineGroupV1.GET("/commands/:id/deliveryman/location", handlers.GetDeliverymanLocationForCommand)
|
||||||
cabineGroupV1.GET("/all/deliveryman", handlers.GetAllDeliveryMen)
|
cabineGroupV1.GET("/all/deliveryman", handlers.GetAllDeliveryMen)
|
||||||
|
cabineGroupV1.GET("/delivery-persons/:username", handlers.GetDeliveryPersonDetails)
|
||||||
|
cabineGroupV1.GET("/all/clients", handlers.GetAllClients)
|
||||||
cabineGroupV1.DELETE("/commands/:id", handlers.DeleteCommandByCabine)
|
cabineGroupV1.DELETE("/commands/:id", handlers.DeleteCommandByCabine)
|
||||||
cabineGroupV1.POST("/commands/:id/propose-address", handlers.ProposeAddressChange)
|
cabineGroupV1.POST("/commands/:id/propose-address", handlers.ProposeAddressChange)
|
||||||
// ⭐ NOUVEAU - ANNULATION PAR CABINE
|
|
||||||
cabineGroupV1.GET("/commands/cancelled", handlers.GetAllCancelledOrders)
|
cabineGroupV1.GET("/commands/cancelled", handlers.GetAllCancelledOrders)
|
||||||
cabineGroupV1.GET("/client/:username/penalties", handlers.GetClientPenaltiesAdmin) // Voir pénalités client
|
cabineGroupV1.GET("/client/:username/penalties", handlers.GetClientPenaltiesAdmin) // Voir pénalités client
|
||||||
cabineGroupV1.POST("/client/:username/penalties/reset", handlers.ResetClientPenaltiesAdmin) // Reset pénalités
|
cabineGroupV1.POST("/client/:username/penalties/reset", handlers.ResetClientPenaltiesAdmin) // Reset pénalités
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ export const getAllDeliveryPersonsWithDetails = async (): Promise<{
|
|||||||
users.map(async (u: any): Promise<DeliveryPerson> => {
|
users.map(async (u: any): Promise<DeliveryPerson> => {
|
||||||
try {
|
try {
|
||||||
const { data: details } = await apiClient.get(
|
const { data: details } = await apiClient.get(
|
||||||
`${V2}/admin/protected/delivery-persons/${u.username}`,
|
`${API}/delivery-persons/${u.username}`,
|
||||||
);
|
);
|
||||||
const d = details.deliveryman || details;
|
const d = details.deliveryman || details;
|
||||||
const parsedStatus = parseStatus(d.status);
|
const parsedStatus = parseStatus(d.status);
|
||||||
@@ -367,7 +367,7 @@ export const markCabineNotificationsRead = async (): Promise<void> => {
|
|||||||
export const getPublicSettings = async (): Promise<PublicSettings> => {
|
export const getPublicSettings = async (): Promise<PublicSettings> => {
|
||||||
try {
|
try {
|
||||||
const { data } = await apiClient.get(
|
const { data } = await apiClient.get(
|
||||||
`https://5.181.0.112.nip.io/api/v1/app-settings`,
|
`${API_BASE_URL}/api/v1/app-settings`,
|
||||||
);
|
);
|
||||||
return {
|
return {
|
||||||
penalties_enabled: data.penalties_enabled ?? true,
|
penalties_enabled: data.penalties_enabled ?? true,
|
||||||
@@ -427,11 +427,41 @@ export const getAllAddresses = async (): Promise<
|
|||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// ============================================
|
||||||
|
// COMMANDES — CABINE
|
||||||
|
// ============================================
|
||||||
|
|
||||||
|
export const getCabineCommands = async (): Promise<{
|
||||||
|
success: boolean;
|
||||||
|
commands: any[];
|
||||||
|
count: number;
|
||||||
|
}> => {
|
||||||
|
try {
|
||||||
|
const { data } = await apiClient.get(`${API}/commands`);
|
||||||
|
return { success: true, commands: data.commands || [], count: data.count || 0 };
|
||||||
|
} catch {
|
||||||
|
return { success: false, commands: [], count: 0 };
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// ============================================
|
||||||
|
// CLIENTS — CABINE
|
||||||
|
// ============================================
|
||||||
|
|
||||||
|
export const getCabineAllClients = async (): Promise<any[]> => {
|
||||||
|
try {
|
||||||
|
const { data } = await apiClient.get(`${API}/all/clients`);
|
||||||
|
return data.clients || [];
|
||||||
|
} catch {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// ============================================
|
// ============================================
|
||||||
// TELEGRAM — CABINE
|
// TELEGRAM — CABINE
|
||||||
// ============================================
|
// ============================================
|
||||||
|
|
||||||
const CABINE_API = "https://5.181.0.112.nip.io/api/v1/cabine";
|
const CABINE_API = `${API_BASE_URL}/api/v1/cabine`;
|
||||||
|
|
||||||
export const getCabineTelegramStatus = async (): Promise<{
|
export const getCabineTelegramStatus = async (): Promise<{
|
||||||
linked: boolean;
|
linked: boolean;
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ import { spacing, fontSize, borderRadius } from "../../theme";
|
|||||||
import { useTheme } from "../../context/ThemeContext";
|
import { useTheme } from "../../context/ThemeContext";
|
||||||
import { shadows } from "../../theme/shadows";
|
import { shadows } from "../../theme/shadows";
|
||||||
import { useAuth } from "../../auth/AuthContext";
|
import { useAuth } from "../../auth/AuthContext";
|
||||||
import { getAllCommands } from "../../api/api_admin";
|
|
||||||
import {
|
import {
|
||||||
|
getCabineCommands,
|
||||||
getAllDeliveryPersonsWithDetails,
|
getAllDeliveryPersonsWithDetails,
|
||||||
getCabineTelegramStatus,
|
getCabineTelegramStatus,
|
||||||
generateCabineLinkToken,
|
generateCabineLinkToken,
|
||||||
@@ -46,7 +46,7 @@ export default function DashboardScreen() {
|
|||||||
const loadStats = useCallback(async () => {
|
const loadStats = useCallback(async () => {
|
||||||
try {
|
try {
|
||||||
const [allCmd, livreursRes] = await Promise.all([
|
const [allCmd, livreursRes] = await Promise.all([
|
||||||
getAllCommands(),
|
getCabineCommands(),
|
||||||
getAllDeliveryPersonsWithDetails(),
|
getAllDeliveryPersonsWithDetails(),
|
||||||
]);
|
]);
|
||||||
const cmds = allCmd.commands;
|
const cmds = allCmd.commands;
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import {
|
|||||||
import { Ionicons } from "@expo/vector-icons";
|
import { Ionicons } from "@expo/vector-icons";
|
||||||
import { spacing, fontSize, borderRadius } from "../../theme";
|
import { spacing, fontSize, borderRadius } from "../../theme";
|
||||||
import { useTheme } from "../../context/ThemeContext";
|
import { useTheme } from "../../context/ThemeContext";
|
||||||
import { getAllCommands } from "../../api/api_admin";
|
|
||||||
import {
|
import {
|
||||||
getCommandItems,
|
getCommandItems,
|
||||||
deleteCommand,
|
deleteCommand,
|
||||||
@@ -21,6 +20,7 @@ import {
|
|||||||
getCabineLivreursList,
|
getCabineLivreursList,
|
||||||
assignDeliveryPersonByCabine,
|
assignDeliveryPersonByCabine,
|
||||||
proposeAddressChangeCabine,
|
proposeAddressChangeCabine,
|
||||||
|
getCabineCommands,
|
||||||
} from "../../api/api_cabine";
|
} from "../../api/api_cabine";
|
||||||
import type { CommandResponse } from "../../api/types";
|
import type { CommandResponse } from "../../api/types";
|
||||||
import StatusBadge from "../../components/StatusBadge";
|
import StatusBadge from "../../components/StatusBadge";
|
||||||
@@ -78,7 +78,7 @@ export default function OrdersScreen() {
|
|||||||
|
|
||||||
const loadData = useCallback(async () => {
|
const loadData = useCallback(async () => {
|
||||||
try {
|
try {
|
||||||
const result = await getAllCommands();
|
const result = await getCabineCommands();
|
||||||
setCommands(
|
setCommands(
|
||||||
result.commands.filter(
|
result.commands.filter(
|
||||||
(c: CommandResponse) =>
|
(c: CommandResponse) =>
|
||||||
|
|||||||
@@ -2,8 +2,7 @@ import React, { useState, useEffect, useCallback, useMemo } from "react";
|
|||||||
import { View, Text, StyleSheet, FlatList, RefreshControl } from "react-native";
|
import { View, Text, StyleSheet, FlatList, RefreshControl } from "react-native";
|
||||||
import { spacing, fontSize } from "../../theme";
|
import { spacing, fontSize } from "../../theme";
|
||||||
import { useTheme } from "../../context/ThemeContext";
|
import { useTheme } from "../../context/ThemeContext";
|
||||||
import { getAllClients } from "../../api/api_admin";
|
import { applyClientPenalty, resetClientPenalties, resetClientPoints, getPublicSettings, getCabineAllClients } from "../../api/api_cabine";
|
||||||
import { applyClientPenalty, resetClientPenalties, resetClientPoints, getPublicSettings } from "../../api/api_cabine";
|
|
||||||
import type { PublicSettings } from "../../api/api_cabine";
|
import type { PublicSettings } from "../../api/api_cabine";
|
||||||
import type { ClientResponse } from "../../api/types";
|
import type { ClientResponse } from "../../api/types";
|
||||||
import LoadingSpinner from "../../components/ui/LoadingSpinner";
|
import LoadingSpinner from "../../components/ui/LoadingSpinner";
|
||||||
@@ -35,7 +34,7 @@ export default function UsersScreen() {
|
|||||||
const loadData = useCallback(async () => {
|
const loadData = useCallback(async () => {
|
||||||
try {
|
try {
|
||||||
const [clientsData, settings] = await Promise.all([
|
const [clientsData, settings] = await Promise.all([
|
||||||
getAllClients(),
|
getCabineAllClients(),
|
||||||
getPublicSettings(),
|
getPublicSettings(),
|
||||||
]);
|
]);
|
||||||
setClients(clientsData);
|
setClients(clientsData);
|
||||||
|
|||||||
Reference in New Issue
Block a user