@movalib/movalib-commons 1.40.0 → 1.42.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 CHANGED
@@ -60,7 +60,7 @@ const App = () => {
60
60
  }
61
61
  })
62
62
  .catch(error => {
63
- Logger.error(response.error);
63
+ Logger.error(error);
64
64
  });
65
65
 
66
66
  }else{
package/dist/devIndex.js CHANGED
@@ -88,7 +88,7 @@ var App = function () {
88
88
  }
89
89
  })
90
90
  .catch(function (error) {
91
- Logger_1.default.error(response.error);
91
+ Logger_1.default.error(error);
92
92
  });
93
93
  }
94
94
  else {
package/dist/index.d.ts CHANGED
@@ -44,7 +44,7 @@ export type { APIRequest, APIResponse } from './src/helpers/ApiHelper';
44
44
  export type { DaySchedule, DayInterval } from './src/ScheduleFields';
45
45
  export type { MovaFormField, MovaLoginForm, MovaUserSignUpForm, MovaInterval, MovaVehicleForm, AddressFieldName } from './src/helpers/Types';
46
46
  export { readCookie, deleteCookie } from './src/helpers/CookieUtils';
47
- export { validateField, formatVehicleTire, formatFrenchVehiclePlate, isEmpty, getApplicationShortLabel, capitalizeFirstLetter, flexLeftRow, formatPhoneNumber, getFormattedSchedule, getFormattedIntervals, findScheduleByDayOfWeek, getDayOfWeekLabel, isSafariOniOS } from './src/helpers/Tools';
47
+ export { validateField, formatVehicleTire, formatFrenchVehiclePlate, isEmpty, getApplicationShortLabel, capitalizeFirstLetter, flexLeftRow, formatPhoneNumber, getFormattedSchedule, getFormattedIntervals, findScheduleByDayOfWeek, getDayOfWeekLabel, isSafariOniOS, getApplicationsShortLabels } from './src/helpers/Tools';
48
48
  export { validatePhoneNumber, validateText, validateEmail } from './src/helpers/Validator';
49
49
  export { formatDateByCountryCode, getLongFormattedDateTime } from './src/helpers/DateUtils';
50
50
  export { request, API_BASE_URL, } from './src/helpers/ApiHelper';
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  };
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.capitalizeFirstLetter = exports.getApplicationShortLabel = exports.isEmpty = exports.formatFrenchVehiclePlate = exports.formatVehicleTire = exports.validateField = exports.deleteCookie = exports.readCookie = exports.VehicleTire = exports.Event = exports.Schedule = exports.Garage = exports.Document = exports.Vehicle = exports.Address = exports.Role = exports.User = exports.Customer = exports.Logger = exports.Operation = exports.Prestation = exports.Product = exports.Supplier = exports.Employee = exports.Absence = exports.Subscription = exports.GenderSelector = exports.ConfirmationDialog = exports.MovaVehicleTireField = exports.MovaCopyright = exports.MovaSignUp = exports.MovaLogin = exports.MovaSnackbar = exports.TestButton = exports.VehiclePlateField = exports.QRCode = exports.MovaDialog = exports.Loader = exports.MovaDigitalPassport = exports.VehicleFullCard = exports.ScheduleFields = exports.AddressFields = exports.AccountValidation = exports.GaragePLV = exports.IbanInput = exports.DialogForgotPassword = exports.UserService = exports.GarageService = exports.AuthenticationService = exports.VehicleService = void 0;
8
- exports.APIMethod = exports.SubscriptionType = exports.SubscriptionState = exports.CountryCode = exports.PrestationState = exports.PrestationType = exports.RegistrationState = exports.SubscriptionPaymentInterval = exports.VehiclePlateType = exports.SlotAlgorithm = exports.OrderState = exports.OrderPreference = exports.ProductType = exports.PartsApplicationType = exports.DateFormatTypes = exports.Gender = exports.DocumentState = exports.DigitalPassportIndex = exports.DocumentType = exports.EventType = exports.EventState = exports.DayOfWeek = exports.MovaAppType = exports.RoleType = exports.API_BASE_URL = exports.request = exports.getLongFormattedDateTime = exports.formatDateByCountryCode = exports.validateEmail = exports.validateText = exports.validatePhoneNumber = exports.isSafariOniOS = exports.getDayOfWeekLabel = exports.findScheduleByDayOfWeek = exports.getFormattedIntervals = exports.getFormattedSchedule = exports.formatPhoneNumber = exports.flexLeftRow = void 0;
8
+ exports.APIMethod = exports.SubscriptionType = exports.SubscriptionState = exports.CountryCode = exports.PrestationState = exports.PrestationType = exports.RegistrationState = exports.SubscriptionPaymentInterval = exports.VehiclePlateType = exports.SlotAlgorithm = exports.OrderState = exports.OrderPreference = exports.ProductType = exports.PartsApplicationType = exports.DateFormatTypes = exports.Gender = exports.DocumentState = exports.DigitalPassportIndex = exports.DocumentType = exports.EventType = exports.EventState = exports.DayOfWeek = exports.MovaAppType = exports.RoleType = exports.API_BASE_URL = exports.request = exports.getLongFormattedDateTime = exports.formatDateByCountryCode = exports.validateEmail = exports.validateText = exports.validatePhoneNumber = exports.getApplicationsShortLabels = exports.isSafariOniOS = exports.getDayOfWeekLabel = exports.findScheduleByDayOfWeek = exports.getFormattedIntervals = exports.getFormattedSchedule = exports.formatPhoneNumber = exports.flexLeftRow = void 0;
9
9
  // Export des services
10
10
  var VehicleService_1 = require("./src/services/VehicleService");
11
11
  Object.defineProperty(exports, "VehicleService", { enumerable: true, get: function () { return __importDefault(VehicleService_1).default; } });
@@ -111,6 +111,7 @@ Object.defineProperty(exports, "getFormattedIntervals", { enumerable: true, get:
111
111
  Object.defineProperty(exports, "findScheduleByDayOfWeek", { enumerable: true, get: function () { return Tools_1.findScheduleByDayOfWeek; } });
112
112
  Object.defineProperty(exports, "getDayOfWeekLabel", { enumerable: true, get: function () { return Tools_1.getDayOfWeekLabel; } });
113
113
  Object.defineProperty(exports, "isSafariOniOS", { enumerable: true, get: function () { return Tools_1.isSafariOniOS; } });
114
+ Object.defineProperty(exports, "getApplicationsShortLabels", { enumerable: true, get: function () { return Tools_1.getApplicationsShortLabels; } });
114
115
  var Validator_1 = require("./src/helpers/Validator");
115
116
  Object.defineProperty(exports, "validatePhoneNumber", { enumerable: true, get: function () { return Validator_1.validatePhoneNumber; } });
116
117
  Object.defineProperty(exports, "validateText", { enumerable: true, get: function () { return Validator_1.validateText; } });
@@ -1,10 +1,14 @@
1
1
  import { APIMethod, MovaAppType } from "./Enums";
2
2
  export declare const API_BASE_URL: string;
3
- export type APIResponse<T> = {
4
- success: boolean;
5
- data?: T;
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) {
@@ -3,6 +3,7 @@ import { MovaFormField, MovaInterval } from "./Types";
3
3
  import { CSSProperties } from "react";
4
4
  import { DayOfWeek, PartsApplicationType } from "./Enums";
5
5
  import Schedule from "../models/Schedule";
6
+ export declare const getApplicationsShortLabels: (applications: PartsApplicationType[] | undefined) => string;
6
7
  export declare const flexStart: CSSProperties;
7
8
  export declare const isSafariOniOS: () => boolean;
8
9
  export declare const FR_WEEK_DAYS: string[];
@@ -1,7 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateField = exports.formatVehicleTireStr = exports.formatVehicleTire = exports.formatFrenchVehiclePlate = exports.isEmpty = exports.flexCenter = exports.flexEnd = exports.getApplicationShortLabel = exports.capitalizeFirstLetter = exports.flexLeftRow = exports.getFrenchDayLabel = exports.getDayOfWeek = exports.findScheduleByDayOfWeek = exports.formatTime = exports.getFormattedIntervals = exports.getFormattedSchedule = exports.formatPhoneNumber = exports.getDayOfWeekIndex = exports.getDayOfWeekLabel = exports.FR_WEEK_DAYS = exports.isSafariOniOS = exports.flexStart = void 0;
3
+ exports.validateField = exports.formatVehicleTireStr = exports.formatVehicleTire = exports.formatFrenchVehiclePlate = exports.isEmpty = exports.flexCenter = exports.flexEnd = exports.getApplicationShortLabel = exports.capitalizeFirstLetter = exports.flexLeftRow = exports.getFrenchDayLabel = exports.getDayOfWeek = exports.findScheduleByDayOfWeek = exports.formatTime = exports.getFormattedIntervals = exports.getFormattedSchedule = exports.formatPhoneNumber = exports.getDayOfWeekIndex = exports.getDayOfWeekLabel = exports.FR_WEEK_DAYS = exports.isSafariOniOS = exports.flexStart = exports.getApplicationsShortLabels = void 0;
4
4
  var Enums_1 = require("./Enums");
5
+ var getApplicationsShortLabels = function (applications) {
6
+ if (!applications) {
7
+ return '';
8
+ }
9
+ return applications.map(exports.getApplicationShortLabel).join(' + ');
10
+ };
11
+ exports.getApplicationsShortLabels = getApplicationsShortLabels;
5
12
  exports.flexStart = {
6
13
  display: 'flex',
7
14
  justifyContent: 'start',
@@ -24,5 +24,6 @@ export default class Prestation {
24
24
  position: number;
25
25
  active: boolean;
26
26
  state: PrestationState;
27
- constructor(id: number, code: string, name: string, description: string, category: string, downtime: number, appointmentDelay: number, position: number, active: boolean, state: PrestationState, operations?: Operation[]);
27
+ multipleApplication: boolean;
28
+ constructor(id: number, code: string, name: string, description: string, category: string, downtime: number, appointmentDelay: number, position: number, active: boolean, state: PrestationState, multipleApplication: boolean, operations?: Operation[]);
28
29
  }
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  var Prestation = /** @class */ (function () {
4
- function Prestation(id, code, name, description, category, downtime, appointmentDelay, position, active, state, operations) {
4
+ function Prestation(id, code, name, description, category, downtime, appointmentDelay, position, active, state, multipleApplication, operations) {
5
5
  this.id = id;
6
6
  this.code = code;
7
7
  this.name = name;
@@ -11,6 +11,7 @@ var Prestation = /** @class */ (function () {
11
11
  this.appointmentDelay = appointmentDelay;
12
12
  this.position = position;
13
13
  this.active = active;
14
+ this.multipleApplication = multipleApplication;
14
15
  this.operations = operations;
15
16
  this.state = state;
16
17
  }
@@ -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
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/index.ts CHANGED
@@ -58,7 +58,7 @@ export type { MovaFormField, MovaLoginForm, MovaUserSignUpForm, MovaInterval,
58
58
  export { readCookie, deleteCookie } from './src/helpers/CookieUtils';
59
59
  export { validateField, formatVehicleTire, formatFrenchVehiclePlate, isEmpty, getApplicationShortLabel,
60
60
  capitalizeFirstLetter, flexLeftRow, formatPhoneNumber, getFormattedSchedule, getFormattedIntervals,
61
- findScheduleByDayOfWeek, getDayOfWeekLabel, isSafariOniOS } from './src/helpers/Tools';
61
+ findScheduleByDayOfWeek, getDayOfWeekLabel, isSafariOniOS, getApplicationsShortLabels } from './src/helpers/Tools';
62
62
  export { validatePhoneNumber, validateText, validateEmail } from './src/helpers/Validator';
63
63
  export { formatDateByCountryCode, getLongFormattedDateTime } from './src/helpers/DateUtils';
64
64
  export { request, API_BASE_URL, } from './src/helpers/ApiHelper';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@movalib/movalib-commons",
3
- "version": "1.40.0",
3
+ "version": "1.42.0",
4
4
  "description": "Bibliothèque d'objets communs à l'ensemble des projets React de Movalib",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -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
- export type APIResponse<T> = {
9
- success: boolean;
10
- data?: T;
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
- * @param dispatch
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
+ }
@@ -5,6 +5,14 @@ import { CSSProperties } from "react";
5
5
  import { DayOfWeek, PartsApplicationType, VehiclePlateFormat } from "./Enums";
6
6
  import Schedule from "../models/Schedule";
7
7
 
8
+ export const getApplicationsShortLabels = (applications: PartsApplicationType[] | undefined): string => {
9
+ if(!applications) {
10
+ return '';
11
+ }
12
+
13
+ return applications.map(getApplicationShortLabel).join(' + ');
14
+ };
15
+
8
16
  export const flexStart:CSSProperties = {
9
17
  display: 'flex',
10
18
  justifyContent: 'start',
@@ -29,9 +29,11 @@ export default class Prestation {
29
29
  active:boolean;
30
30
 
31
31
  state: PrestationState;
32
+
33
+ multipleApplication: boolean;
32
34
 
33
35
  constructor(id:number, code: string, name:string, description: string, category:string,
34
- downtime:number, appointmentDelay: number, position: number, active: boolean, state: PrestationState, operations?: Operation[]) {
36
+ downtime:number, appointmentDelay: number, position: number, active: boolean, state: PrestationState, multipleApplication: boolean, operations?: Operation[]) {
35
37
  this.id = id;
36
38
  this.code = code;
37
39
  this.name = name;
@@ -41,6 +43,7 @@ export default class Prestation {
41
43
  this.appointmentDelay = appointmentDelay;
42
44
  this.position = position;
43
45
  this.active = active;
46
+ this.multipleApplication = multipleApplication;
44
47
  this.operations = operations;
45
48
  this.state = state;
46
49
  }
@@ -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
+ }