@movalib/movalib-commons 1.39.0 → 1.41.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/devIndex.tsx +1 -1
- package/dist/devIndex.js +1 -1
- package/dist/src/ConfirmationDialog.d.ts +4 -6
- package/dist/src/ConfirmationDialog.js +13 -2
- package/dist/src/helpers/ApiHelper.d.ts +9 -5
- package/dist/src/helpers/ApiHelper.js +0 -1
- package/dist/src/services/GarageService.d.ts +3 -0
- package/dist/src/services/GarageService.js +28 -0
- package/dist/src/services/GarageService.types.d.ts +25 -0
- package/dist/src/services/GarageService.types.js +2 -0
- package/dist/src/services/VehicleService.d.ts +2 -0
- package/dist/src/services/VehicleService.js +19 -0
- package/dist/src/services/VehicleService.types.d.ts +13 -0
- package/dist/src/services/VehicleService.types.js +2 -0
- package/package.json +1 -1
- package/src/ConfirmationDialog.tsx +7 -9
- package/src/helpers/ApiHelper.ts +15 -11
- package/src/services/GarageService.ts +18 -0
- package/src/services/GarageService.types.ts +28 -0
- package/src/services/VehicleService.ts +9 -0
- package/src/services/VehicleService.types.ts +16 -0
package/devIndex.tsx
CHANGED
package/dist/devIndex.js
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import React, { FunctionComponent } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
onClose: () => void;
|
|
2
|
+
import { type DialogProps } from '@mui/material/Dialog';
|
|
3
|
+
type ConfirmationDialogProps = DialogProps & {
|
|
4
|
+
onClose?: () => void;
|
|
6
5
|
onConfirm?: () => void;
|
|
7
6
|
showConfirm?: boolean;
|
|
8
7
|
confirmLabel?: string;
|
|
9
8
|
closeLabel?: string;
|
|
10
9
|
title?: React.ReactNode;
|
|
11
10
|
message?: React.ReactNode;
|
|
12
|
-
|
|
13
|
-
}
|
|
11
|
+
};
|
|
14
12
|
declare const ConfirmationDialog: FunctionComponent<ConfirmationDialogProps>;
|
|
15
13
|
export default ConfirmationDialog;
|
|
@@ -10,6 +10,17 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
+
t[p] = s[p];
|
|
17
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
+
t[p[i]] = s[p[i]];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
13
24
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
25
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
26
|
};
|
|
@@ -24,13 +35,13 @@ var Button_1 = __importDefault(require("@mui/material/Button"));
|
|
|
24
35
|
var material_1 = require("@mui/material");
|
|
25
36
|
var Tools_1 = require("./helpers/Tools");
|
|
26
37
|
var ConfirmationDialog = function (_a) {
|
|
27
|
-
var open = _a.open, onClose = _a.onClose, onConfirm = _a.onConfirm, title = _a.title, message = _a.message, _b = _a.showConfirm, showConfirm = _b === void 0 ? true : _b, confirmLabel = _a.confirmLabel, closeLabel = _a.closeLabel,
|
|
38
|
+
var open = _a.open, onClose = _a.onClose, onConfirm = _a.onConfirm, title = _a.title, message = _a.message, _b = _a.showConfirm, showConfirm = _b === void 0 ? true : _b, confirmLabel = _a.confirmLabel, closeLabel = _a.closeLabel, dialogProps = __rest(_a, ["open", "onClose", "onConfirm", "title", "message", "showConfirm", "confirmLabel", "closeLabel"]);
|
|
28
39
|
var theme = (0, material_1.useTheme)();
|
|
29
40
|
var defaultMessage = "Êtes-vous sûr de vouloir continuer ?";
|
|
30
41
|
var defaultTitle = "Confirmation";
|
|
31
42
|
var defaultConfirmLabel = "Oui";
|
|
32
43
|
var defaultCloseLabel = "Non";
|
|
33
|
-
return ((0, jsx_runtime_1.jsxs)(Dialog_1.default, __assign({ open: open, onClose: onClose, "aria-labelledby": "alert-dialog-title", "aria-describedby": "alert-dialog-description"
|
|
44
|
+
return ((0, jsx_runtime_1.jsxs)(Dialog_1.default, __assign({ open: open, onClose: onClose, "aria-labelledby": "alert-dialog-title", "aria-describedby": "alert-dialog-description" }, dialogProps, { children: [(0, jsx_runtime_1.jsx)(DialogTitle_1.default, __assign({ id: "alert-dialog-title", sx: {
|
|
34
45
|
backgroundColor: theme.palette.grey[200]
|
|
35
46
|
}, style: Tools_1.flexLeftRow }, { children: title || defaultTitle })), (0, jsx_runtime_1.jsx)(DialogContent_1.default, __assign({ sx: { textAlign: 'center' } }, { children: (0, jsx_runtime_1.jsx)(DialogContentText_1.default, __assign({ id: "alert-dialog-description", sx: { pt: 2 } }, { children: message || defaultMessage })) })), (0, jsx_runtime_1.jsxs)(DialogActions_1.default, __assign({ sx: {
|
|
36
47
|
py: 1,
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { APIMethod, MovaAppType } from "./Enums";
|
|
2
2
|
export declare const API_BASE_URL: string;
|
|
3
|
-
|
|
4
|
-
success:
|
|
5
|
-
data
|
|
6
|
-
error?: string;
|
|
3
|
+
type APISuccess<T> = {
|
|
4
|
+
success: true;
|
|
5
|
+
data: T;
|
|
7
6
|
};
|
|
7
|
+
type APIError = {
|
|
8
|
+
success: false;
|
|
9
|
+
error: string;
|
|
10
|
+
};
|
|
11
|
+
export type APIResponse<T> = APISuccess<T> | APIError;
|
|
8
12
|
export type APIRequest = {
|
|
9
13
|
url: string;
|
|
10
14
|
method: APIMethod;
|
|
@@ -15,7 +19,7 @@ export type APIRequest = {
|
|
|
15
19
|
* ATTENTION : cela signifie que toutes les requêtes du Front seront de type "preflight"
|
|
16
20
|
* Il faut penser à configurer l'API pour autoriser les headers
|
|
17
21
|
* @param options
|
|
18
|
-
* @param dispatch
|
|
19
22
|
* @returns
|
|
20
23
|
*/
|
|
21
24
|
export declare const request: (options: APIRequest) => Promise<APIResponse<any>>;
|
|
25
|
+
export {};
|
|
@@ -46,7 +46,6 @@ function handleResponse(response) {
|
|
|
46
46
|
* ATTENTION : cela signifie que toutes les requêtes du Front seront de type "preflight"
|
|
47
47
|
* Il faut penser à configurer l'API pour autoriser les headers
|
|
48
48
|
* @param options
|
|
49
|
-
* @param dispatch
|
|
50
49
|
* @returns
|
|
51
50
|
*/
|
|
52
51
|
var request = function (options) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { APIResponse } from "../helpers/ApiHelper";
|
|
2
2
|
import Employee from "../models/Employee";
|
|
3
3
|
import Garage from "../models/Garage";
|
|
4
|
+
import { AddCustomerVehicleParams, DeleteCustomerVehicleParams } from "./GarageService.types";
|
|
4
5
|
export default class GarageService {
|
|
5
6
|
static updateVehicleGarageEvent(garageId: string, eventId: string, req: any): Promise<APIResponse<string>>;
|
|
6
7
|
static sendGarageMandate(garageId: string): Promise<APIResponse<string>>;
|
|
@@ -34,4 +35,6 @@ export default class GarageService {
|
|
|
34
35
|
static sendGarageSupportRequest(garageId: string, req: {
|
|
35
36
|
message: string;
|
|
36
37
|
}): Promise<APIResponse<string>>;
|
|
38
|
+
static addCustomerVehicle({ garageId, customerId, ...payload }: AddCustomerVehicleParams): Promise<APIResponse<string>>;
|
|
39
|
+
static deleteCustomerVehicle({ garageId, customerId, vehicleId }: DeleteCustomerVehicleParams): Promise<APIResponse<string>>;
|
|
37
40
|
}
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
2
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
14
|
var ApiHelper_1 = require("../helpers/ApiHelper");
|
|
4
15
|
var Enums_1 = require("../helpers/Enums");
|
|
@@ -234,6 +245,23 @@ var GarageService = /** @class */ (function () {
|
|
|
234
245
|
body: JSON.stringify(req)
|
|
235
246
|
});
|
|
236
247
|
};
|
|
248
|
+
GarageService.addCustomerVehicle = function (_a) {
|
|
249
|
+
var garageId = _a.garageId, customerId = _a.customerId, payload = __rest(_a, ["garageId", "customerId"]);
|
|
250
|
+
return (0, ApiHelper_1.request)({
|
|
251
|
+
url: "".concat(ApiHelper_1.API_BASE_URL, "/garage/").concat(garageId, "/customers/").concat(customerId, "/vehicles"),
|
|
252
|
+
method: Enums_1.APIMethod.POST,
|
|
253
|
+
appType: Enums_1.MovaAppType.GARAGE,
|
|
254
|
+
body: JSON.stringify(payload)
|
|
255
|
+
});
|
|
256
|
+
};
|
|
257
|
+
GarageService.deleteCustomerVehicle = function (_a) {
|
|
258
|
+
var garageId = _a.garageId, customerId = _a.customerId, vehicleId = _a.vehicleId;
|
|
259
|
+
return (0, ApiHelper_1.request)({
|
|
260
|
+
url: "".concat(ApiHelper_1.API_BASE_URL, "/garage/").concat(garageId, "/customers/").concat(customerId, "/vehicles/").concat(vehicleId),
|
|
261
|
+
method: Enums_1.APIMethod.DELETE,
|
|
262
|
+
appType: Enums_1.MovaAppType.GARAGE,
|
|
263
|
+
});
|
|
264
|
+
};
|
|
237
265
|
return GarageService;
|
|
238
266
|
}());
|
|
239
267
|
exports.default = GarageService;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export type AddCustomerVehicleParams = {
|
|
2
|
+
/** L'identifiant unique du garage */
|
|
3
|
+
garageId: string;
|
|
4
|
+
/** L'identifiant unique du client */
|
|
5
|
+
customerId: string;
|
|
6
|
+
/** La plaque d'immat du véhicule */
|
|
7
|
+
plate: string;
|
|
8
|
+
/** Le nombre de km au compteur */
|
|
9
|
+
currentMileage?: number;
|
|
10
|
+
/** Le nombre moyen de km par an */
|
|
11
|
+
averageMileagePerYear?: number;
|
|
12
|
+
/** Identification du pneu (XXX XX RXX XXX) */
|
|
13
|
+
tireWidth?: string;
|
|
14
|
+
tireHeight?: string;
|
|
15
|
+
tireDiameter?: string;
|
|
16
|
+
tireSpeedIndex?: string;
|
|
17
|
+
};
|
|
18
|
+
export type DeleteCustomerVehicleParams = {
|
|
19
|
+
/** L'identifiant unique du garage */
|
|
20
|
+
garageId: string;
|
|
21
|
+
/** L'identifiant unique du client */
|
|
22
|
+
customerId: string;
|
|
23
|
+
/** L'identifiant unique du véhicule */
|
|
24
|
+
vehicleId: string;
|
|
25
|
+
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { APIResponse } from "../helpers/ApiHelper";
|
|
2
2
|
import { MovaAppType } from "../helpers/Enums";
|
|
3
|
+
import { EditVehicleParams } from "./VehicleService.types";
|
|
3
4
|
export default class VehicleService {
|
|
4
5
|
static getVehicleDescription(appType: MovaAppType, plate: string): Promise<APIResponse<string>>;
|
|
6
|
+
static editVehicle({ vehicleId, ...payload }: EditVehicleParams): Promise<APIResponse<string>>;
|
|
5
7
|
}
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
2
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
14
|
var ApiHelper_1 = require("../helpers/ApiHelper");
|
|
4
15
|
var Enums_1 = require("../helpers/Enums");
|
|
@@ -12,6 +23,14 @@ var VehicleService = /** @class */ (function () {
|
|
|
12
23
|
appType: appType,
|
|
13
24
|
});
|
|
14
25
|
};
|
|
26
|
+
VehicleService.editVehicle = function (_a) {
|
|
27
|
+
var vehicleId = _a.vehicleId, payload = __rest(_a, ["vehicleId"]);
|
|
28
|
+
return (0, ApiHelper_1.request)({
|
|
29
|
+
url: "".concat(ApiHelper_1.API_BASE_URL, "/vehicle/").concat(vehicleId),
|
|
30
|
+
method: Enums_1.APIMethod.PATCH,
|
|
31
|
+
body: JSON.stringify(payload)
|
|
32
|
+
});
|
|
33
|
+
};
|
|
15
34
|
return VehicleService;
|
|
16
35
|
}());
|
|
17
36
|
exports.default = VehicleService;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type EditVehicleParams = {
|
|
2
|
+
/** Identifiant unique du véhicule */
|
|
3
|
+
vehicleId: string;
|
|
4
|
+
/** Nombre de km au compteur */
|
|
5
|
+
currentMileage: number;
|
|
6
|
+
/** Nombre de km annuel moyen */
|
|
7
|
+
averageMileagePerYear: number;
|
|
8
|
+
/** Identification du pneu (XXX XX RXX XXX) */
|
|
9
|
+
tireWidth: string;
|
|
10
|
+
tireHeight: string;
|
|
11
|
+
tireDiameter: string;
|
|
12
|
+
tireSpeedIndex: string;
|
|
13
|
+
};
|
package/package.json
CHANGED
|
@@ -1,27 +1,25 @@
|
|
|
1
1
|
import React, { FunctionComponent } from 'react';
|
|
2
|
-
import Dialog from '@mui/material/Dialog';
|
|
2
|
+
import Dialog, { type DialogProps } from '@mui/material/Dialog';
|
|
3
3
|
import DialogActions from '@mui/material/DialogActions';
|
|
4
4
|
import DialogContent from '@mui/material/DialogContent';
|
|
5
5
|
import DialogContentText from '@mui/material/DialogContentText';
|
|
6
6
|
import DialogTitle from '@mui/material/DialogTitle';
|
|
7
7
|
import Button from '@mui/material/Button';
|
|
8
|
-
import {
|
|
8
|
+
import { useTheme } from '@mui/material';
|
|
9
9
|
import { flexLeftRow } from './helpers/Tools';
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
onClose: () => void;
|
|
11
|
+
type ConfirmationDialogProps = DialogProps & {
|
|
12
|
+
onClose?: () => void;
|
|
14
13
|
onConfirm?: () => void;
|
|
15
14
|
showConfirm?: boolean;
|
|
16
15
|
confirmLabel?: string;
|
|
17
16
|
closeLabel?: string;
|
|
18
17
|
title?: React.ReactNode;
|
|
19
18
|
message?: React.ReactNode;
|
|
20
|
-
sx?: SxProps<Theme>;
|
|
21
19
|
}
|
|
22
20
|
|
|
23
21
|
const ConfirmationDialog: FunctionComponent<ConfirmationDialogProps> = ({ open, onClose, onConfirm, title, message, showConfirm = true,
|
|
24
|
-
confirmLabel, closeLabel,
|
|
22
|
+
confirmLabel, closeLabel, ...dialogProps }) => {
|
|
25
23
|
|
|
26
24
|
const theme = useTheme();
|
|
27
25
|
const defaultMessage = "Êtes-vous sûr de vouloir continuer ?";
|
|
@@ -35,7 +33,7 @@ const ConfirmationDialog: FunctionComponent<ConfirmationDialogProps> = ({ open,
|
|
|
35
33
|
onClose={onClose}
|
|
36
34
|
aria-labelledby="alert-dialog-title"
|
|
37
35
|
aria-describedby="alert-dialog-description"
|
|
38
|
-
|
|
36
|
+
{...dialogProps}
|
|
39
37
|
>
|
|
40
38
|
<DialogTitle id="alert-dialog-title" sx={{
|
|
41
39
|
backgroundColor: theme.palette.grey[200]
|
|
@@ -64,4 +62,4 @@ const ConfirmationDialog: FunctionComponent<ConfirmationDialogProps> = ({ open,
|
|
|
64
62
|
);
|
|
65
63
|
}
|
|
66
64
|
|
|
67
|
-
export default ConfirmationDialog;
|
|
65
|
+
export default ConfirmationDialog;
|
package/src/helpers/ApiHelper.ts
CHANGED
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import { APIMethod, MovaAppType } from "./Enums";
|
|
2
2
|
import { COOKIE_PRO_TOKEN, COOKIE_INDIVIDUAL_TOKEN, readCookie } from "./CookieUtils";
|
|
3
3
|
import Logger from "./Logger";
|
|
4
|
-
import { useHistory } from "react-router-dom";
|
|
5
4
|
|
|
6
5
|
export const API_BASE_URL = process.env.REACT_APP_API_URL || 'https://localhost:8443/api';
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
success:
|
|
10
|
-
data
|
|
11
|
-
error?: string;
|
|
7
|
+
type APISuccess<T> = {
|
|
8
|
+
success: true;
|
|
9
|
+
data: T;
|
|
12
10
|
};
|
|
13
11
|
|
|
12
|
+
type APIError = {
|
|
13
|
+
success: false;
|
|
14
|
+
error: string;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export type APIResponse<T> = APISuccess<T> | APIError;
|
|
18
|
+
|
|
14
19
|
export type APIRequest = {
|
|
15
20
|
url: string,
|
|
16
21
|
method: APIMethod,
|
|
@@ -33,7 +38,7 @@ function handleResponse(response: Response): Promise<APIResponse<any>> {
|
|
|
33
38
|
const dataPromise = isJson ? response.json() : response.text();
|
|
34
39
|
|
|
35
40
|
return dataPromise.then(data => {
|
|
36
|
-
|
|
41
|
+
|
|
37
42
|
if (!response.ok) {
|
|
38
43
|
|
|
39
44
|
Logger.error(data);
|
|
@@ -53,7 +58,7 @@ function handleResponse(response: Response): Promise<APIResponse<any>> {
|
|
|
53
58
|
|
|
54
59
|
return { success: false, error: errorMsg };
|
|
55
60
|
}
|
|
56
|
-
|
|
61
|
+
|
|
57
62
|
return { success: true, data };
|
|
58
63
|
});
|
|
59
64
|
}
|
|
@@ -62,9 +67,8 @@ function handleResponse(response: Response): Promise<APIResponse<any>> {
|
|
|
62
67
|
/**
|
|
63
68
|
* ATTENTION : cela signifie que toutes les requêtes du Front seront de type "preflight"
|
|
64
69
|
* Il faut penser à configurer l'API pour autoriser les headers
|
|
65
|
-
* @param options
|
|
66
|
-
* @
|
|
67
|
-
* @returns
|
|
70
|
+
* @param options
|
|
71
|
+
* @returns
|
|
68
72
|
*/
|
|
69
73
|
export const request = (options:APIRequest): Promise<APIResponse<any>> => {
|
|
70
74
|
|
|
@@ -103,4 +107,4 @@ export const request = (options:APIRequest): Promise<APIResponse<any>> => {
|
|
|
103
107
|
Logger.error('There has been a problem with your fetch operation : ', error.message);
|
|
104
108
|
return handleError(error);
|
|
105
109
|
});
|
|
106
|
-
}
|
|
110
|
+
}
|
|
@@ -2,6 +2,7 @@ import { APIResponse, API_BASE_URL, request } from "../helpers/ApiHelper";
|
|
|
2
2
|
import { APIMethod, MovaAppType } from "../helpers/Enums";
|
|
3
3
|
import Employee from "../models/Employee";
|
|
4
4
|
import Garage from "../models/Garage";
|
|
5
|
+
import {AddCustomerVehicleParams, DeleteCustomerVehicleParams} from "./GarageService.types";
|
|
5
6
|
|
|
6
7
|
export default class GarageService {
|
|
7
8
|
|
|
@@ -270,4 +271,21 @@ export default class GarageService {
|
|
|
270
271
|
});
|
|
271
272
|
}
|
|
272
273
|
|
|
274
|
+
static addCustomerVehicle({garageId, customerId, ...payload}: AddCustomerVehicleParams):Promise<APIResponse<string>> {
|
|
275
|
+
return request({
|
|
276
|
+
url: `${API_BASE_URL}/garage/${garageId}/customers/${customerId}/vehicles`,
|
|
277
|
+
method: APIMethod.POST,
|
|
278
|
+
appType: MovaAppType.GARAGE,
|
|
279
|
+
body: JSON.stringify(payload)
|
|
280
|
+
})
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
static deleteCustomerVehicle({garageId, customerId, vehicleId}: DeleteCustomerVehicleParams):Promise<APIResponse<string>> {
|
|
284
|
+
return request({
|
|
285
|
+
url: `${API_BASE_URL}/garage/${garageId}/customers/${customerId}/vehicles/${vehicleId}`,
|
|
286
|
+
method: APIMethod.DELETE,
|
|
287
|
+
appType: MovaAppType.GARAGE,
|
|
288
|
+
})
|
|
289
|
+
}
|
|
290
|
+
|
|
273
291
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export type AddCustomerVehicleParams = {
|
|
2
|
+
/** L'identifiant unique du garage */
|
|
3
|
+
garageId: string;
|
|
4
|
+
/** L'identifiant unique du client */
|
|
5
|
+
customerId: string;
|
|
6
|
+
/** La plaque d'immat du véhicule */
|
|
7
|
+
plate: string;
|
|
8
|
+
/** Le nombre de km au compteur */
|
|
9
|
+
currentMileage?: number;
|
|
10
|
+
/** Le nombre moyen de km par an */
|
|
11
|
+
averageMileagePerYear?: number;
|
|
12
|
+
|
|
13
|
+
/** Identification du pneu (XXX XX RXX XXX) */
|
|
14
|
+
tireWidth?: string;
|
|
15
|
+
tireHeight?: string;
|
|
16
|
+
tireDiameter?: string;
|
|
17
|
+
tireSpeedIndex?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
export type DeleteCustomerVehicleParams = {
|
|
22
|
+
/** L'identifiant unique du garage */
|
|
23
|
+
garageId: string;
|
|
24
|
+
/** L'identifiant unique du client */
|
|
25
|
+
customerId: string;
|
|
26
|
+
/** L'identifiant unique du véhicule */
|
|
27
|
+
vehicleId: string;
|
|
28
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { APIResponse, API_BASE_URL, request } from "../helpers/ApiHelper";
|
|
2
2
|
import { APIMethod, MovaAppType } from "../helpers/Enums";
|
|
3
|
+
import {EditVehicleParams} from "./VehicleService.types";
|
|
3
4
|
|
|
4
5
|
|
|
5
6
|
export default class VehicleService {
|
|
@@ -12,4 +13,12 @@ export default class VehicleService {
|
|
|
12
13
|
});
|
|
13
14
|
}
|
|
14
15
|
|
|
16
|
+
static editVehicle({vehicleId, ...payload}: EditVehicleParams): Promise<APIResponse<string>> {
|
|
17
|
+
return request({
|
|
18
|
+
url: `${API_BASE_URL}/vehicle/${vehicleId}`,
|
|
19
|
+
method: APIMethod.PATCH,
|
|
20
|
+
body: JSON.stringify(payload)
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
15
24
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type EditVehicleParams = {
|
|
2
|
+
/** Identifiant unique du véhicule */
|
|
3
|
+
vehicleId: string;
|
|
4
|
+
|
|
5
|
+
/** Nombre de km au compteur */
|
|
6
|
+
currentMileage: number;
|
|
7
|
+
/** Nombre de km annuel moyen */
|
|
8
|
+
averageMileagePerYear: number;
|
|
9
|
+
|
|
10
|
+
/** Identification du pneu (XXX XX RXX XXX) */
|
|
11
|
+
tireWidth: string;
|
|
12
|
+
tireHeight: string;
|
|
13
|
+
tireDiameter: string;
|
|
14
|
+
tireSpeedIndex: string;
|
|
15
|
+
|
|
16
|
+
}
|