@cofondateurauchomage/libs 1.1.131 → 1.1.133

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.
@@ -76,10 +76,38 @@ const userBody = {
76
76
  industries: zod_1.z.array(zIndustryWithNeverMind).optional(),
77
77
  photo: zod_1.z.string().optional(),
78
78
  };
79
+ const FIELDS_LABEL = {
80
+ ambitions: "Ambitions",
81
+ availability: "Disponibilité",
82
+ bestStrength: "Meilleur atout",
83
+ business: "Business",
84
+ city: "Ville",
85
+ description: "Description",
86
+ email: "Email",
87
+ firstName: "Prénom",
88
+ industries: "Industries",
89
+ invest: "Investissement",
90
+ lastName: "Nom",
91
+ linkedin: "Linkedin",
92
+ motivations: "Motivations",
93
+ name: "Nom",
94
+ partner: "Partenaire",
95
+ partner_iii: "Partenaire III",
96
+ partner_swanbase: "Partenaire Swanbase",
97
+ productTypes: "Types de produits",
98
+ projectStatus: "Statut du projet",
99
+ skills: "Compétences",
100
+ status: "Statut",
101
+ status_detail: "Détail du statut",
102
+ tel: "Téléphone",
103
+ turnover: "Chiffre d'affaires",
104
+ website: "Site web",
105
+ yearsOfExperience: "Années d'expérience",
106
+ };
79
107
  function throwFromZodError(error) {
80
108
  const issue = error.issues[0];
81
109
  const key = issue.path.find((p) => typeof p === "string") ?? "champ";
82
- const humanKey = (0, utils_1.capitalize)(key.replaceAll("_", " "));
110
+ const humanKey = FIELDS_LABEL[key] ?? (0, utils_1.capitalize)(key.replaceAll("_", " "));
83
111
  if (issue.code === "invalid_type" &&
84
112
  /\breceived undefined\b/i.test(issue.message)) {
85
113
  throw new ValidationError(400, `${humanKey} requis`);
@@ -212,13 +240,12 @@ function validateBodyForO(route, body) {
212
240
  if (typeof body !== "object" || body === null) {
213
241
  throw new ValidationError(400, "Le payload est requis");
214
242
  }
215
- const cleanedBody = (0, utils_1.cleanObject)(body, { keepNull: true, keepEmptyArrays: true });
216
243
  const schema = schemasForAllRoutes[route];
217
- const parsed = schema.safeParse(cleanedBody);
244
+ const parsed = schema.safeParse(body);
218
245
  if (!parsed.success) {
219
246
  throwFromZodError(parsed.error);
220
247
  }
221
- const input = cleanedBody;
248
+ const input = body;
222
249
  const result = {};
223
250
  for (const key of Object.keys(schema.shape)) {
224
251
  if (input[key] !== undefined) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cofondateurauchomage/libs",
3
- "version": "1.1.131",
3
+ "version": "1.1.133",
4
4
  "description": "",
5
5
  "main": "build/index",
6
6
  "scripts": {