@movalib/movalib-commons 1.0.57 → 1.0.58

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/dist/index.d.ts CHANGED
@@ -19,7 +19,7 @@ export { default as Garage } from './src/models/Garage';
19
19
  export { default as Schedule } from './src/models/Schedule';
20
20
  export { default as Event } from './src/models/Event';
21
21
  export { default as VehicleTire } from './src/models/VehicleTire';
22
- export type { MovaFormField, MovaLoginForm, MovaUserSignUpForm, MovaInterval } from './src/helpers/Types';
22
+ export type { MovaFormField, MovaLoginForm, MovaUserSignUpForm, MovaInterval, OriginReference } from './src/helpers/Types';
23
23
  export { validateField } from './src/helpers/Tools';
24
24
  export { validatePhoneNumber, validateText, validateEmail } from './src/helpers/Validator';
25
25
  export { RoleType, MovaAppType, DayOfWeek, EventState, EventType, DocumentType, DigitalPassportIndex, DocumentState, Gender } from './src/helpers/Enums';
@@ -1,3 +1,7 @@
1
+ export type OriginReference = {
2
+ key: string;
3
+ value: string;
4
+ };
1
5
  /**
2
6
  * Type utilisé pour définir un interval sur une objet Schedule
3
7
  */
@@ -3,6 +3,7 @@ import { EventState, EventType } from "../helpers/Enums";
3
3
  import Prestation from "./Prestation";
4
4
  import Customer from "./Customer";
5
5
  import Vehicle from "./Vehicle";
6
+ import { OriginReference } from "../helpers/Types";
6
7
  export default class Event {
7
8
  id: string;
8
9
  ownerId: number;
@@ -34,7 +35,7 @@ export default class Event {
34
35
  /**
35
36
  * MVP : pour l'instant les références sont transmises sous cette forme classique
36
37
  */
37
- originReferences?: [string, string][];
38
+ originReferences?: OriginReference[];
38
39
  constructor({ id, notes, ownerId, type, title, garageName, garageId, state, startDate, endDate, prestations, guestsId, vehicleId, quoteId, originReferences }: {
39
40
  id: string;
40
41
  notes?: string;
@@ -50,7 +51,7 @@ export default class Event {
50
51
  guestsId?: string[];
51
52
  vehicleId?: number;
52
53
  quoteId?: number;
53
- originReferences?: [string, string][];
54
+ originReferences?: OriginReference[];
54
55
  });
55
56
  static getOriginReferences(event: Event): string | undefined;
56
57
  static getServicesList(event: Event): string[];
@@ -24,7 +24,7 @@ var Event = /** @class */ (function () {
24
24
  var list = '';
25
25
  if (event.originReferences && event.originReferences.length !== 0) {
26
26
  (_a = event.originReferences) === null || _a === void 0 ? void 0 : _a.forEach(function (reference) {
27
- list = "".concat(reference[0], " : ").concat(reference[1]);
27
+ list = "".concat(reference.key, " : ").concat(reference.value);
28
28
  });
29
29
  }
30
30
  return list;
package/index.ts CHANGED
@@ -26,7 +26,7 @@ export { default as Event } from './src/models/Event';
26
26
  export { default as VehicleTire } from './src/models/VehicleTire';
27
27
 
28
28
  // Export des types
29
- export type { MovaFormField, MovaLoginForm, MovaUserSignUpForm, MovaInterval } from './src/helpers/Types';
29
+ export type { MovaFormField, MovaLoginForm, MovaUserSignUpForm, MovaInterval, OriginReference } from './src/helpers/Types';
30
30
 
31
31
  // Export des méthodes utilitaires
32
32
  export { validateField } from './src/helpers/Tools';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@movalib/movalib-commons",
3
- "version": "1.0.57",
3
+ "version": "1.0.58",
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,3 +1,7 @@
1
+ export type OriginReference = {
2
+ key: string;
3
+ value: string
4
+ };
1
5
 
2
6
  /**
3
7
  * Type utilisé pour définir un interval sur une objet Schedule
@@ -3,6 +3,7 @@ import { EventState, EventType } from "../helpers/Enums";
3
3
  import Prestation from "./Prestation";
4
4
  import Customer from "./Customer";
5
5
  import Vehicle from "./Vehicle";
6
+ import { OriginReference } from "../helpers/Types";
6
7
 
7
8
  export default class Event {
8
9
 
@@ -38,12 +39,12 @@ export default class Event {
38
39
  /**
39
40
  * MVP : pour l'instant les références sont transmises sous cette forme classique
40
41
  */
41
- originReferences?: [string, string][];
42
+ originReferences?: OriginReference[];
42
43
 
43
44
  constructor({ id, notes, ownerId, type, title, garageName, garageId, state, startDate, endDate, prestations, guestsId, vehicleId, quoteId, originReferences }
44
45
  : { id: string; notes?: string; ownerId: number; type : EventType; title: string; garageName: string; garageId: number;
45
46
  state: EventState; startDate?: Date; endDate?: Date, prestations?: Prestation[],
46
- guestsId?: string[], vehicleId?: number, quoteId?: number, originReferences?: [string, string][]})
47
+ guestsId?: string[], vehicleId?: number, quoteId?: number, originReferences?: OriginReference[]})
47
48
  {
48
49
  this.id = id;
49
50
  this.notes = notes;
@@ -67,7 +68,7 @@ export default class Event {
67
68
 
68
69
  if(event.originReferences && event.originReferences.length !== 0){
69
70
  event.originReferences?.forEach(reference => {
70
- list = `${reference[0]} : ${reference[1]}`;
71
+ list = `${reference.key} : ${reference.value}`;
71
72
  })
72
73
  }
73
74
  return list;