@cofondateurauchomage/libs 1.0.1 → 1.0.2
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/package.json +1 -1
- package/src/const.ts +9 -1
- package/src/db.model.ts +13 -5
- package/src/index.ts +4 -4
- package/src/utils/checkSkills.ts +3 -2
- package/src/utils/regex.ts +10 -9
package/package.json
CHANGED
package/src/const.ts
CHANGED
package/src/db.model.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export enum Collections {
|
|
2
|
-
users =
|
|
2
|
+
users = "users",
|
|
3
3
|
}
|
|
4
4
|
|
|
5
5
|
export interface IUser {
|
|
@@ -7,13 +7,21 @@ export interface IUser {
|
|
|
7
7
|
firstName: string;
|
|
8
8
|
email: string;
|
|
9
9
|
joblessDate: string;
|
|
10
|
-
zipCode
|
|
11
|
-
city
|
|
12
|
-
linkedin
|
|
10
|
+
zipCode?: number;
|
|
11
|
+
city?: string;
|
|
12
|
+
linkedin?: string;
|
|
13
13
|
tel?: string;
|
|
14
|
-
skills:
|
|
14
|
+
skills: TSkills[];
|
|
15
15
|
motivations: string;
|
|
16
16
|
partner: string;
|
|
17
17
|
business: string;
|
|
18
18
|
invest?: number;
|
|
19
19
|
}
|
|
20
|
+
|
|
21
|
+
export type TSkills = (
|
|
22
|
+
| "Business"
|
|
23
|
+
| "Design"
|
|
24
|
+
| "Marketing"
|
|
25
|
+
| "Produit"
|
|
26
|
+
| "Tech"
|
|
27
|
+
)[];
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {SKILLS} from "./const";
|
|
2
|
-
export {Collections, IUser} from "./db.model";
|
|
3
|
-
export {checkSkills} from "./utils/checkSkills";
|
|
4
|
-
export {RGX} from "./utils/regex";
|
|
1
|
+
export { SKILLS } from "./const";
|
|
2
|
+
export { Collections, IUser } from "./db.model";
|
|
3
|
+
export { checkSkills } from "./utils/checkSkills";
|
|
4
|
+
export { RGX } from "./utils/regex";
|
package/src/utils/checkSkills.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { SKILLS } from
|
|
1
|
+
import { SKILLS } from "../const";
|
|
2
|
+
import { TSkills } from "../db.model";
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Checks if at least one skill is checked
|
|
5
6
|
* @param skills
|
|
6
7
|
* @returns
|
|
7
8
|
*/
|
|
8
|
-
export function checkSkills(skills:
|
|
9
|
+
export function checkSkills(skills: TSkills) {
|
|
9
10
|
let check = true;
|
|
10
11
|
skills.forEach((skill) => {
|
|
11
12
|
if (!SKILLS.includes(skill)) check = false;
|
package/src/utils/regex.ts
CHANGED
|
@@ -4,22 +4,22 @@ export const RGX = {
|
|
|
4
4
|
},
|
|
5
5
|
Name: {
|
|
6
6
|
regex: /^[A-Za-zÜ-ü]{1,24}([ -]{1}[A-Za-zÜ-ü]{1,24})?$/,
|
|
7
|
-
pattern:
|
|
7
|
+
pattern: "[A-Za-zÜ-ü]{1,24}([ -]{1}[A-Za-zÜ-ü]{1,24})?",
|
|
8
8
|
message:
|
|
9
|
-
|
|
9
|
+
"Accepte les noms composés (espace ou -) et les accents. Les caractères spéciaux ne sont pas autorisés.",
|
|
10
10
|
},
|
|
11
11
|
Date: {
|
|
12
12
|
regex: /^([12]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01]))$/,
|
|
13
13
|
},
|
|
14
14
|
City: {
|
|
15
15
|
regex: /^(?=(.*[A-Za-z]){1,45})[A-Za-z]{1,20}([ -]{1}[A-Za-z]{1,24}){0,8}$/,
|
|
16
|
-
pattern:
|
|
17
|
-
message:
|
|
16
|
+
pattern: "(?=(.*[A-Za-z]){1,45})[A-Za-z]{1,20}([ -]{1}[A-Za-z]{1,24}){0,8}",
|
|
17
|
+
message: "Veuillez entrer un nom de ville valide.",
|
|
18
18
|
},
|
|
19
19
|
Tel: {
|
|
20
20
|
regex: /^([+]{1}[1-9]{2,3}[ .-]?)?[0-9]{1,3}([ .-]?[0-9]{2,3}){3,6}$/,
|
|
21
|
-
pattern:
|
|
22
|
-
message:
|
|
21
|
+
pattern: "([+]{1}[1-9]{2,3}[ .-]?)?[0-9]{1,3}([ .-]?[0-9]{2,3}){3,6}",
|
|
22
|
+
message: "Veuillez entrer un numéro de téléphone valide.",
|
|
23
23
|
},
|
|
24
24
|
Linkedin: {
|
|
25
25
|
regex: /^(http(s)?:\/\/)?([\w]+\.)?linkedin\.com\/(pub|in|profile)\/.+$/,
|
|
@@ -30,10 +30,11 @@ export const RGX = {
|
|
|
30
30
|
regex: /^(?=.*[0-9])(?=.*[A-z])([^\s]){8,24}$/,
|
|
31
31
|
pattern: `(?=.*[0-9])(?=.*[A-z])([^\\s]){8,24}`,
|
|
32
32
|
message:
|
|
33
|
-
|
|
33
|
+
"Votre mot de passe doit contenir entre 8 et 24 caractères dont 1 chiffre et 1 lettre.",
|
|
34
34
|
},
|
|
35
35
|
Text: {
|
|
36
36
|
regex: /^(?=(.*[A-Za-z]){10}).{10,300}$/,
|
|
37
|
-
message:
|
|
38
|
-
|
|
37
|
+
message:
|
|
38
|
+
"Le texte doit contenir au moins 10 lettres et ne pas excéder 300 caractères.",
|
|
39
|
+
},
|
|
39
40
|
};
|