@movalib/movalib-commons 1.0.21 → 1.0.23

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
@@ -6,5 +6,7 @@ export { default as MovaCopyright } from './src/MovaCopyright';
6
6
  export { default as User } from './src/models/User';
7
7
  export { default as Role } from './src/models/Role';
8
8
  export { default as Address } from './src/models/Address';
9
+ export { default as Vehicle } from './src/models/Vehicle';
10
+ export { default as Document } from './src/models/Document';
9
11
  export type { MovaFormField, MovaLoginForm, MovaUserSignUpForm } from './src/helpers/Types';
10
12
  export { RoleType, MovaAppType } from './src/helpers/Enums';
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  return (mod && mod.__esModule) ? mod : { "default": mod };
5
5
  };
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.MovaAppType = exports.RoleType = exports.Address = exports.Role = exports.User = exports.MovaCopyright = exports.MovaSignUp = exports.MovaLogin = exports.MovaSnackbar = exports.TestButton = void 0;
7
+ exports.MovaAppType = exports.RoleType = exports.Document = exports.Vehicle = exports.Address = exports.Role = exports.User = exports.MovaCopyright = exports.MovaSignUp = exports.MovaLogin = exports.MovaSnackbar = exports.TestButton = void 0;
8
8
  // Export des composants
9
9
  var TestButton_1 = require("./src/TestButton");
10
10
  Object.defineProperty(exports, "TestButton", { enumerable: true, get: function () { return __importDefault(TestButton_1).default; } });
@@ -23,6 +23,10 @@ var Role_1 = require("./src/models/Role");
23
23
  Object.defineProperty(exports, "Role", { enumerable: true, get: function () { return __importDefault(Role_1).default; } });
24
24
  var Address_1 = require("./src/models/Address");
25
25
  Object.defineProperty(exports, "Address", { enumerable: true, get: function () { return __importDefault(Address_1).default; } });
26
+ var Vehicle_1 = require("./src/models/Vehicle");
27
+ Object.defineProperty(exports, "Vehicle", { enumerable: true, get: function () { return __importDefault(Vehicle_1).default; } });
28
+ var Document_1 = require("./src/models/Document");
29
+ Object.defineProperty(exports, "Document", { enumerable: true, get: function () { return __importDefault(Document_1).default; } });
26
30
  // Export des enums
27
31
  var Enums_1 = require("./src/helpers/Enums");
28
32
  Object.defineProperty(exports, "RoleType", { enumerable: true, get: function () { return Enums_1.RoleType; } });
@@ -112,7 +112,7 @@ var MovaLogin = function (_a) {
112
112
  // Validator pour l'email
113
113
  newForm.email = (0, Tools_1.validateField)(form.email, Validator_1.validateEmail, 'Adresse email invalide');
114
114
  // Validator pour le mot de passe
115
- newForm.password = (0, Tools_1.validateField)(form.password, function (value) { return value.length >= 8; }, 'Votre mot de passe doit faire au moins 8 caractères de long');
115
+ newForm.password = (0, Tools_1.validateField)(form.password, function (value) { return value.length >= 10 && /[a-z]/.test(value) && /[A-Z]/.test(value); }, 'Votre mot de passe doit faire au moins 8 caractères de long');
116
116
  setForm(newForm);
117
117
  return newForm.email.isValid && newForm.password.isValid;
118
118
  };
@@ -135,7 +135,7 @@ var MovaLogin = function (_a) {
135
135
  // Validator pour l'email
136
136
  newForm.email = (0, Tools_1.validateField)(userForm.email, Validator_1.validateEmail, 'Adresse email invalide');
137
137
  // Validator pour le mot de passe
138
- newForm.password = (0, Tools_1.validateField)(userForm.password, function (value) { return value.length >= 8; }, 'Votre mot de passe doit faire au moins 8 caractères de long');
138
+ newForm.password = (0, Tools_1.validateField)(userForm.password, function (value) { return value.length >= 10 && /[a-z]/.test(value) && /[A-Z]/.test(value); }, 'Votre mot de passe doit faire au moins 10 caractères de long, contenir au moins une majuscule et une minuscule');
139
139
  // Validator pour les CGU
140
140
  newForm.acceptsTerms = (0, Tools_1.validateField)(userForm.acceptsTerms, function (value) { return Boolean(value); }, 'Vous devez accepter les termes de nos CGU');
141
141
  setUserForm(newForm);
@@ -1,3 +1,8 @@
1
+ export declare enum DocumentType {
2
+ INVOICE = "INVOICE",
3
+ TYRE_PICTURE = "TYRE_PICTURE",
4
+ CAR_PICTURE = "CAR_PICTURE"
5
+ }
1
6
  export declare enum MovaAppType {
2
7
  /**
3
8
  * Application Garagiste
@@ -1,6 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RoleType = exports.MovaAppType = void 0;
3
+ exports.RoleType = exports.MovaAppType = exports.DocumentType = void 0;
4
+ var DocumentType;
5
+ (function (DocumentType) {
6
+ DocumentType["INVOICE"] = "INVOICE";
7
+ DocumentType["TYRE_PICTURE"] = "TYRE_PICTURE";
8
+ DocumentType["CAR_PICTURE"] = "CAR_PICTURE";
9
+ })(DocumentType = exports.DocumentType || (exports.DocumentType = {}));
4
10
  var MovaAppType;
5
11
  (function (MovaAppType) {
6
12
  /**
@@ -0,0 +1,10 @@
1
+ import { DocumentType } from "../helpers/Enums";
2
+ export default class Document {
3
+ id: string;
4
+ name: string;
5
+ type: DocumentType;
6
+ content: string;
7
+ creationDate: Date;
8
+ updateDate: Date;
9
+ constructor(id: string, name: string, type: DocumentType, content: string, creationDate: Date, updateDate: Date);
10
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var Document = /** @class */ (function () {
4
+ function Document(id, name, type, content, creationDate, updateDate) {
5
+ this.id = id;
6
+ this.name = name;
7
+ this.type = type;
8
+ this.content = content;
9
+ this.creationDate = creationDate;
10
+ this.updateDate = updateDate;
11
+ }
12
+ return Document;
13
+ }());
14
+ exports.default = Document;
@@ -1,4 +1,5 @@
1
1
  import Address from './Address';
2
+ import Vehicle from "./Vehicle";
2
3
  export default class User {
3
4
  id: string;
4
5
  roles: string[];
@@ -10,7 +11,8 @@ export default class User {
10
11
  created: Date;
11
12
  addresses?: Address[];
12
13
  phoneNumber?: string;
13
- constructor(id: string, roles: string[], firstname?: string, lastname?: string, avatar?: string, email?: string, password?: string, created?: Date, addresses?: Address[], phoneNumber?: string);
14
+ vehicles?: Vehicle[];
15
+ constructor(id: string, roles: string[], firstname?: string, lastname?: string, avatar?: string, email?: string, password?: string, created?: Date, addresses?: Address[], phoneNumber?: string, vehicles?: Vehicle[]);
14
16
  static getFirstLetter: (user: User) => string;
15
17
  static isCustomer: (user: User) => boolean;
16
18
  static isTechnician: (user: User) => boolean;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  var Enums_1 = require("../helpers/Enums");
4
4
  var User = /** @class */ (function () {
5
- function User(id, roles, firstname, lastname, avatar, email, password, created, addresses, phoneNumber) {
5
+ function User(id, roles, firstname, lastname, avatar, email, password, created, addresses, phoneNumber, vehicles) {
6
6
  if (firstname === void 0) { firstname = ''; }
7
7
  if (lastname === void 0) { lastname = ''; }
8
8
  if (avatar === void 0) { avatar = ''; }
@@ -19,6 +19,7 @@ var User = /** @class */ (function () {
19
19
  this.created = created;
20
20
  this.addresses = addresses;
21
21
  this.phoneNumber = phoneNumber;
22
+ this.vehicles = vehicles;
22
23
  }
23
24
  User.getFirstLetter = function (user) {
24
25
  var firstLetter = user.lastname[0].toUpperCase();
@@ -0,0 +1,21 @@
1
+ import Document from './Document';
2
+ export default class Vehicle {
3
+ id: number;
4
+ ownerId: number;
5
+ averageMileagePerYear: number;
6
+ plate: string;
7
+ brand: string;
8
+ model: string;
9
+ version: string;
10
+ vin: string;
11
+ currentMileage: number;
12
+ digitalPassportIndex: string;
13
+ firstRegistrationDate: Date;
14
+ ktype: string;
15
+ tireDiameter: string;
16
+ tireHeight: string;
17
+ tireSpeedIndex: string;
18
+ tireWidth: string;
19
+ documents: Document[];
20
+ constructor(id: number, ownerId: number, averageMileagePerYear: number, plate: string, brand: string, model: string, version: string, vin: string, currentMileage: number, digitalPassportIndex: string, firstRegistrationDate: Date, ktype: string, tireDiameter: string, tireHeight: string, tireSpeedIndex: string, tireWidth: string, documents: Document[]);
21
+ }
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /* AUDI A5 Sportback (F5A, F5F)
4
+ Marque : AUDI
5
+ Modele : A5 Sportback (F5A, F5F)
6
+ Corps : 3/5 portes
7
+ Version : 2.0 TFSI
8
+ Immatriculation : FE-291-MF
9
+ Années de production : 06 2016 -
10
+ Carburant : Essence
11
+ Cylindrée : 1984 cm3
12
+ Puissance : 140 KW (190 HP) */
13
+ var Vehicle = /** @class */ (function () {
14
+ function Vehicle(id, ownerId, averageMileagePerYear, plate, brand, model, version, vin, currentMileage, digitalPassportIndex, firstRegistrationDate, ktype, tireDiameter, tireHeight, tireSpeedIndex, tireWidth, documents) {
15
+ this.id = id;
16
+ this.ownerId = ownerId;
17
+ this.averageMileagePerYear = averageMileagePerYear;
18
+ this.plate = plate;
19
+ this.brand = brand;
20
+ this.model = model;
21
+ this.version = version;
22
+ this.vin = vin;
23
+ this.currentMileage = currentMileage;
24
+ this.digitalPassportIndex = digitalPassportIndex;
25
+ this.firstRegistrationDate = firstRegistrationDate;
26
+ this.ktype = ktype;
27
+ this.tireDiameter = tireDiameter;
28
+ this.tireHeight = tireHeight;
29
+ this.tireSpeedIndex = tireSpeedIndex;
30
+ this.tireWidth = tireWidth;
31
+ this.documents = documents;
32
+ }
33
+ return Vehicle;
34
+ }());
35
+ exports.default = Vehicle;
package/index.ts CHANGED
@@ -11,6 +11,8 @@ export { default as MovaCopyright } from './src/MovaCopyright';
11
11
  export { default as User } from './src/models/User';
12
12
  export { default as Role } from './src/models/Role';
13
13
  export { default as Address } from './src/models/Address';
14
+ export { default as Vehicle } from './src/models/Vehicle';
15
+ export { default as Document } from './src/models/Document';
14
16
 
15
17
  // Export des types
16
18
  export type { MovaFormField, MovaLoginForm, MovaUserSignUpForm } from './src/helpers/Types';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@movalib/movalib-commons",
3
- "version": "1.0.21",
3
+ "version": "1.0.23",
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",
package/src/MovaLogin.tsx CHANGED
@@ -82,7 +82,9 @@ const MovaLogin: FunctionComponent<MovaLoginProps> = ({ loading, movaAppType, on
82
82
  newForm.email = validateField(form.email, validateEmail, 'Adresse email invalide');
83
83
 
84
84
  // Validator pour le mot de passe
85
- newForm.password = validateField(form.password, value => value.length >= 8, 'Votre mot de passe doit faire au moins 8 caractères de long');
85
+ newForm.password = validateField(form.password,
86
+ value => value.length >= 10 && /[a-z]/.test(value) && /[A-Z]/.test(value),
87
+ 'Votre mot de passe doit faire au moins 8 caractères de long');
86
88
 
87
89
  setForm(newForm);
88
90
 
@@ -110,7 +110,9 @@ const MovaLogin: FunctionComponent<MovaSignUpProps> = ({ loading, movaAppType, o
110
110
  newForm.email = validateField(userForm.email, validateEmail, 'Adresse email invalide');
111
111
 
112
112
  // Validator pour le mot de passe
113
- newForm.password = validateField(userForm.password, value => value.length >= 8, 'Votre mot de passe doit faire au moins 8 caractères de long');
113
+ newForm.password = validateField(userForm.password,
114
+ value => value.length >= 10 && /[a-z]/.test(value) && /[A-Z]/.test(value),
115
+ 'Votre mot de passe doit faire au moins 10 caractères de long, contenir au moins une majuscule et une minuscule');
114
116
 
115
117
  // Validator pour les CGU
116
118
  newForm.acceptsTerms = validateField(userForm.acceptsTerms, value => Boolean(value), 'Vous devez accepter les termes de nos CGU');
@@ -1,3 +1,9 @@
1
+ export enum DocumentType {
2
+ INVOICE = 'INVOICE',
3
+ TYRE_PICTURE = 'TYRE_PICTURE',
4
+ CAR_PICTURE = 'CAR_PICTURE'
5
+ }
6
+
1
7
 
2
8
  export enum MovaAppType {
3
9
  /**
@@ -0,0 +1,28 @@
1
+ import { DocumentType } from "../helpers/Enums";
2
+
3
+ export default class Document {
4
+
5
+ //Properties
6
+ id: string; // UUID
7
+ name: string;
8
+ type: DocumentType;
9
+ content: string; // Photos stockée en base64
10
+ creationDate: Date;
11
+ updateDate: Date;
12
+
13
+ constructor(
14
+ id: string,
15
+ name: string,
16
+ type: DocumentType,
17
+ content: string,
18
+ creationDate: Date,
19
+ updateDate: Date
20
+ ) {
21
+ this.id = id;
22
+ this.name = name;
23
+ this.type = type;
24
+ this.content = content;
25
+ this.creationDate = creationDate;
26
+ this.updateDate = updateDate;
27
+ }
28
+ }
@@ -1,5 +1,6 @@
1
1
  import { RoleType } from "../helpers/Enums";
2
2
  import Address from './Address';
3
+ import Vehicle from "./Vehicle";
3
4
 
4
5
  export default class User {
5
6
 
@@ -14,6 +15,7 @@ export default class User {
14
15
  created: Date;
15
16
  addresses? : Address[]
16
17
  phoneNumber?: string;
18
+ vehicles?: Vehicle[];
17
19
 
18
20
  constructor(
19
21
  id: string,
@@ -25,7 +27,8 @@ export default class User {
25
27
  password: string = '',
26
28
  created: Date = new Date(),
27
29
  addresses?: Address[],
28
- phoneNumber?: string
30
+ phoneNumber?: string ,
31
+ vehicles?: Vehicle[]
29
32
  ) {
30
33
  this.id = id;
31
34
  this.roles = roles;
@@ -37,6 +40,7 @@ export default class User {
37
40
  this.created = created;
38
41
  this.addresses = addresses;
39
42
  this.phoneNumber = phoneNumber;
43
+ this.vehicles = vehicles;
40
44
  }
41
45
 
42
46
  static getFirstLetter = (user: User) : string => {
@@ -0,0 +1,72 @@
1
+ import Document from './Document';
2
+
3
+ /* AUDI A5 Sportback (F5A, F5F)
4
+ Marque : AUDI
5
+ Modele : A5 Sportback (F5A, F5F)
6
+ Corps : 3/5 portes
7
+ Version : 2.0 TFSI
8
+ Immatriculation : FE-291-MF
9
+ Années de production : 06 2016 -
10
+ Carburant : Essence
11
+ Cylindrée : 1984 cm3
12
+ Puissance : 140 KW (190 HP) */
13
+
14
+ export default class Vehicle {
15
+
16
+ // Properties
17
+ id: number;
18
+ ownerId: number;
19
+ averageMileagePerYear: number;
20
+ plate: string;
21
+ brand: string;
22
+ model: string;
23
+ version: string;
24
+ vin: string;
25
+ currentMileage: number;
26
+ digitalPassportIndex: string;
27
+ firstRegistrationDate: Date;
28
+ ktype: string;
29
+ tireDiameter: string;
30
+ tireHeight: string;
31
+ tireSpeedIndex: string;
32
+ tireWidth: string;
33
+ documents : Document[];
34
+
35
+ constructor(
36
+ id: number,
37
+ ownerId: number,
38
+ averageMileagePerYear: number,
39
+ plate: string,
40
+ brand: string,
41
+ model: string,
42
+ version: string,
43
+ vin: string,
44
+ currentMileage: number,
45
+ digitalPassportIndex: string,
46
+ firstRegistrationDate: Date,
47
+ ktype: string,
48
+ tireDiameter: string,
49
+ tireHeight: string,
50
+ tireSpeedIndex: string,
51
+ tireWidth: string,
52
+ documents: Document[]
53
+ ) {
54
+ this.id = id;
55
+ this.ownerId = ownerId;
56
+ this.averageMileagePerYear = averageMileagePerYear;
57
+ this.plate = plate;
58
+ this.brand = brand;
59
+ this.model = model;
60
+ this.version = version;
61
+ this.vin = vin;
62
+ this.currentMileage = currentMileage;
63
+ this.digitalPassportIndex = digitalPassportIndex;
64
+ this.firstRegistrationDate = firstRegistrationDate;
65
+ this.ktype = ktype;
66
+ this.tireDiameter = tireDiameter;
67
+ this.tireHeight = tireHeight;
68
+ this.tireSpeedIndex = tireSpeedIndex;
69
+ this.tireWidth = tireWidth;
70
+ this.documents = documents;
71
+ }
72
+ }