@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 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;
@@ -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.isMatchRegex)(regex_1.RGX.Website.regex).isOptional();
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: {
@@ -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
@@ -10,4 +10,5 @@ var Collections;
10
10
  Collections["stats"] = "stats";
11
11
  Collections["notifications"] = "notifications";
12
12
  Collections["prospects"] = "prospects";
13
+ Collections["reactions"] = "reactions";
13
14
  })(Collections = exports.Collections || (exports.Collections = {}));
package/build/regex.d.ts CHANGED
@@ -20,9 +20,4 @@ export declare const RGX: {
20
20
  pattern: string;
21
21
  message: string;
22
22
  };
23
- Website: {
24
- regex: RegExp;
25
- pattern: string;
26
- message: string;
27
- };
28
23
  };
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
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cofondateurauchomage/libs",
3
- "version": "1.1.45",
3
+ "version": "1.1.47",
4
4
  "description": "",
5
5
  "main": "build/index",
6
6
  "scripts": {