@cofondateurauchomage/libs 1.1.45 → 1.1.47
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/build/api.d.ts +6 -2
- package/build/api.validate.js +6 -1
- package/build/db.model.d.ts +9 -3
- package/build/db.model.js +1 -0
- package/build/regex.d.ts +0 -5
- package/build/regex.js +0 -6
- package/package.json +1 -1
package/build/api.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IContact, INewsletter, IProject, IProspect, IUser, TPlan } from "./db.model";
|
|
2
|
-
export type CloudFunctionNames = "createProject" | "updateProject" | "deleteProject" | "activeProject" | "createUser" | "updateUser" | "deleteUser" | "activeUser" | "addStripeId" | "updatePlan" | "addStatsAssociation" | "updateNewsletter" | "createProspect";
|
|
1
|
+
import { IContact, INewsletter, IProject, IProspect, IReactionStatus, IUser, TPlan } from "./db.model";
|
|
2
|
+
export type CloudFunctionNames = "createProject" | "updateProject" | "deleteProject" | "activeProject" | "createUser" | "updateUser" | "deleteUser" | "activeUser" | "addStripeId" | "updatePlan" | "addStatsAssociation" | "updateNewsletter" | "createProspect" | "createUserReaction";
|
|
3
3
|
export type RouteNames = "checkout_session" | "delete_customer" | "portal_session" | "webhook";
|
|
4
4
|
export type BodyForO<O extends CloudFunctionNames | RouteNames> = {
|
|
5
5
|
createProject: Omit<IProject, "id" | "plan" | "active" | "clicks" | "creationDate" | "lastConnection" | "likes" | "stripeId"> & IContact & {
|
|
@@ -37,6 +37,10 @@ export type BodyForO<O extends CloudFunctionNames | RouteNames> = {
|
|
|
37
37
|
addStatsAssociation: {};
|
|
38
38
|
updateNewsletter: INewsletter;
|
|
39
39
|
createProspect: IProspect;
|
|
40
|
+
createUserReaction: {
|
|
41
|
+
toId: "string";
|
|
42
|
+
status: IReactionStatus;
|
|
43
|
+
};
|
|
40
44
|
checkout_session: {
|
|
41
45
|
stripeId?: string;
|
|
42
46
|
email: string;
|
package/build/api.validate.js
CHANGED
|
@@ -14,7 +14,7 @@ const firstName = (0, validate_1.isMatchRegex)(regex_1.RGX.Name.regex);
|
|
|
14
14
|
const invest = (0, validate_1.isNumber)().setMin(0).setMax(1000000).isOptional();
|
|
15
15
|
const lastName = (0, validate_1.isMatchRegex)(regex_1.RGX.Name.regex);
|
|
16
16
|
const linkedin = (0, validate_1.isMatchRegex)(regex_1.RGX.Linkedin.regex);
|
|
17
|
-
const website = (0, validate_1.
|
|
17
|
+
const website = (0, validate_1.isString)().isOptional();
|
|
18
18
|
const motivations = (0, validate_1.isString)().setMin(10).setMax(500);
|
|
19
19
|
const name = (0, validate_1.isString)().setMin(2).setMax(50);
|
|
20
20
|
const partner = (0, validate_1.isString)().setMin(10).setMax(300);
|
|
@@ -34,6 +34,7 @@ const logo = (0, validate_1.isString)().isOptional();
|
|
|
34
34
|
const plan = (0, validate_1.isMatchEnum)(["free", "pro", "premium"]);
|
|
35
35
|
const apiSecretKey = (0, validate_1.isString)();
|
|
36
36
|
const tel = (0, validate_1.isMatchRegex)(regex_1.RGX.Tel.regex);
|
|
37
|
+
const reactionStatus = (0, validate_1.isMatchEnum)(["like", "dislike"]);
|
|
37
38
|
const validatorsForAllRoutes = {
|
|
38
39
|
///////////////////
|
|
39
40
|
// Cloud functions
|
|
@@ -134,6 +135,10 @@ const validatorsForAllRoutes = {
|
|
|
134
135
|
createProspect: {
|
|
135
136
|
email,
|
|
136
137
|
},
|
|
138
|
+
createUserReaction: {
|
|
139
|
+
toId: (0, validate_1.isString)(),
|
|
140
|
+
status: reactionStatus,
|
|
141
|
+
},
|
|
137
142
|
//////////
|
|
138
143
|
// Routes
|
|
139
144
|
checkout_session: {
|
package/build/db.model.d.ts
CHANGED
|
@@ -5,7 +5,8 @@ export declare enum Collections {
|
|
|
5
5
|
newsletters = "newsletters",
|
|
6
6
|
stats = "stats",
|
|
7
7
|
notifications = "notifications",
|
|
8
|
-
prospects = "prospects"
|
|
8
|
+
prospects = "prospects",
|
|
9
|
+
reactions = "reactions"
|
|
9
10
|
}
|
|
10
11
|
export type TSkill = "Business" | "Design" | "Marketing" | "Produit" | "Tech";
|
|
11
12
|
export type TPlan = "free" | "pro" | "premium";
|
|
@@ -34,7 +35,6 @@ export interface IUser {
|
|
|
34
35
|
clicks: IClicks;
|
|
35
36
|
creationDate: number;
|
|
36
37
|
lastConnection: number;
|
|
37
|
-
likes: string[];
|
|
38
38
|
stripeId?: string;
|
|
39
39
|
}
|
|
40
40
|
export interface IProject {
|
|
@@ -56,7 +56,6 @@ export interface IProject {
|
|
|
56
56
|
clicks: IClicks;
|
|
57
57
|
creationDate: number;
|
|
58
58
|
lastConnection: number;
|
|
59
|
-
likes: string[];
|
|
60
59
|
stripeId?: string;
|
|
61
60
|
redstart?: boolean;
|
|
62
61
|
level?: boolean;
|
|
@@ -86,3 +85,10 @@ export interface INotification {
|
|
|
86
85
|
export interface IProspect {
|
|
87
86
|
email: string;
|
|
88
87
|
}
|
|
88
|
+
export type IReactionStatus = "like" | "dislike";
|
|
89
|
+
export interface IReaction {
|
|
90
|
+
fromUserId: string;
|
|
91
|
+
toUserId: string;
|
|
92
|
+
status: IReactionStatus;
|
|
93
|
+
createdAt: number;
|
|
94
|
+
}
|
package/build/db.model.js
CHANGED
package/build/regex.d.ts
CHANGED
package/build/regex.js
CHANGED
|
@@ -7,7 +7,6 @@ const regex = {
|
|
|
7
7
|
linkedin: /^(http(s)?:\/\/)?([\w]+\.)?linkedin\.com\/(pub|in|profile)\/.+$/,
|
|
8
8
|
name: /^[A-Za-zÜ-ü\s\-]{1,50}$/,
|
|
9
9
|
tel: /^([+][1-9]{2,3}[ .\-]?)?[0-9]{1,3}([ .\-]?[0-9]{2,3}){3,6}$/,
|
|
10
|
-
website: /^(?:http[s]?:\/\/.)?(?:www\.)?[-a-zA-Z0-9@%._\+~#=]{2,256}\.[a-z]{2,6}\b(?:[-a-zA-Z0-9@:%_\+.~#?&\/\/=]*)$/,
|
|
11
10
|
};
|
|
12
11
|
const pattern = (regex) => String(regex).replace("/^", "").replace("$/", "");
|
|
13
12
|
exports.RGX = {
|
|
@@ -32,9 +31,4 @@ exports.RGX = {
|
|
|
32
31
|
pattern: pattern(regex.tel),
|
|
33
32
|
message: `Veuillez entrer un numéro de téléphone valide.`,
|
|
34
33
|
},
|
|
35
|
-
Website: {
|
|
36
|
-
regex: regex.website,
|
|
37
|
-
pattern: pattern(regex.website),
|
|
38
|
-
message: `Le lien doit être un URL valide. (ex: https://www.monsite.com)`,
|
|
39
|
-
},
|
|
40
34
|
};
|