@zyacreatives/shared 2.1.26 → 2.1.28
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/schemas/auth.d.ts +13 -0
- package/dist/schemas/auth.js +43 -0
- package/dist/schemas/brand.d.ts +4 -4
- package/dist/schemas/common.d.ts +1 -1
- package/dist/schemas/creative.d.ts +4 -4
- package/dist/schemas/index.d.ts +1 -0
- package/dist/schemas/index.js +1 -0
- package/dist/schemas/job-application.d.ts +5 -4
- package/dist/schemas/job-application.js +1 -0
- package/dist/schemas/project.d.ts +4 -4
- package/dist/schemas/user.d.ts +26 -26
- package/dist/schemas/user.js +4 -2
- package/dist/types/auth.d.ts +4 -0
- package/dist/types/auth.js +2 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/package.json +1 -1
- package/src/schemas/auth.ts +43 -0
- package/src/schemas/index.ts +1 -0
- package/src/schemas/job-application.ts +1 -0
- package/src/schemas/user.ts +7 -5
- package/src/types/auth.ts +5 -0
- package/src/types/index.ts +1 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
export declare const RegisterSchema: z.ZodObject<{
|
|
3
|
+
firstName: z.ZodString;
|
|
4
|
+
lastName: z.ZodString;
|
|
5
|
+
email: z.ZodEmail;
|
|
6
|
+
username: z.ZodString;
|
|
7
|
+
password: z.ZodString;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
export declare const LoginSchema: z.ZodObject<{
|
|
10
|
+
identifier: z.ZodString;
|
|
11
|
+
password: z.ZodString;
|
|
12
|
+
rememberMe: z.ZodBoolean;
|
|
13
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.LoginSchema = exports.RegisterSchema = void 0;
|
|
7
|
+
const zod_1 = __importDefault(require("zod"));
|
|
8
|
+
exports.RegisterSchema = zod_1.default.object({
|
|
9
|
+
firstName: zod_1.default.string().max(255, { message: "First name is too long" }),
|
|
10
|
+
lastName: zod_1.default.string().max(255, { message: "Last name is too long" }),
|
|
11
|
+
email: zod_1.default
|
|
12
|
+
.email({ message: "Enter a valid email address" })
|
|
13
|
+
.max(255, { message: "Email is too long" }),
|
|
14
|
+
username: zod_1.default
|
|
15
|
+
.string()
|
|
16
|
+
.min(3, { message: "Username is too short" })
|
|
17
|
+
.max(32, { message: "Username must be at most 32 characters" })
|
|
18
|
+
.regex(/^[a-zA-Z0-9_]+$/, {
|
|
19
|
+
error: "Username can only contain letters, numbers, and underscores",
|
|
20
|
+
}),
|
|
21
|
+
password: zod_1.default
|
|
22
|
+
.string()
|
|
23
|
+
.min(8, { message: "Password must be at least 8 characters" })
|
|
24
|
+
.max(100, { message: "Password must be at most 100 characters" }),
|
|
25
|
+
});
|
|
26
|
+
exports.LoginSchema = zod_1.default.object({
|
|
27
|
+
identifier: zod_1.default
|
|
28
|
+
.string()
|
|
29
|
+
.trim()
|
|
30
|
+
.min(1, { message: "Email or username is required" })
|
|
31
|
+
.refine((val) => {
|
|
32
|
+
const isEmail = zod_1.default.email().safeParse(val).success;
|
|
33
|
+
const isUsername = /^[a-zA-Z0-9_]{3,20}$/.test(val);
|
|
34
|
+
return isEmail || isUsername;
|
|
35
|
+
}, {
|
|
36
|
+
message: "Enter a valid email or a username (3–20 characters, letters/numbers/underscore)",
|
|
37
|
+
}),
|
|
38
|
+
password: zod_1.default
|
|
39
|
+
.string()
|
|
40
|
+
.min(8, { message: "Password must be at least 8 characters" })
|
|
41
|
+
.max(100, { message: "Password must be at most 100 characters" }),
|
|
42
|
+
rememberMe: zod_1.default.boolean(),
|
|
43
|
+
});
|
package/dist/schemas/brand.d.ts
CHANGED
|
@@ -181,9 +181,9 @@ export declare const BrandWithUserEntitySchema: z.ZodObject<{
|
|
|
181
181
|
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
182
182
|
updatedAt: z.ZodCoercedDate<unknown>;
|
|
183
183
|
user: z.ZodObject<{
|
|
184
|
-
id: z.ZodCUID2;
|
|
185
|
-
username: z.ZodOptional<z.ZodString>;
|
|
186
184
|
email: z.ZodString;
|
|
185
|
+
username: z.ZodOptional<z.ZodString>;
|
|
186
|
+
id: z.ZodCUID2;
|
|
187
187
|
name: z.ZodOptional<z.ZodString>;
|
|
188
188
|
image: z.ZodOptional<z.ZodString>;
|
|
189
189
|
role: z.ZodEnum<{
|
|
@@ -210,9 +210,9 @@ export declare const SearchBrandOutputSchema: z.ZodObject<{
|
|
|
210
210
|
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
211
211
|
updatedAt: z.ZodCoercedDate<unknown>;
|
|
212
212
|
user: z.ZodObject<{
|
|
213
|
-
id: z.ZodCUID2;
|
|
214
|
-
username: z.ZodOptional<z.ZodString>;
|
|
215
213
|
email: z.ZodString;
|
|
214
|
+
username: z.ZodOptional<z.ZodString>;
|
|
215
|
+
id: z.ZodCUID2;
|
|
216
216
|
name: z.ZodOptional<z.ZodString>;
|
|
217
217
|
image: z.ZodOptional<z.ZodString>;
|
|
218
218
|
role: z.ZodEnum<{
|
package/dist/schemas/common.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { z } from "@hono/zod-openapi";
|
|
|
2
2
|
export declare const CuidSchema: z.ZodCUID2;
|
|
3
3
|
export declare const UserIdentifierSchema: z.ZodObject<{
|
|
4
4
|
by: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
5
|
-
id: "id";
|
|
6
5
|
username: "username";
|
|
6
|
+
id: "id";
|
|
7
7
|
}>>>;
|
|
8
8
|
}, z.core.$strip>;
|
|
9
9
|
export type UserIdentifier = z.infer<typeof UserIdentifierSchema>;
|
|
@@ -272,9 +272,9 @@ export declare const CreativeWithUserEntitySchema: z.ZodObject<{
|
|
|
272
272
|
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
273
273
|
updatedAt: z.ZodCoercedDate<unknown>;
|
|
274
274
|
user: z.ZodObject<{
|
|
275
|
-
id: z.ZodCUID2;
|
|
276
|
-
username: z.ZodOptional<z.ZodString>;
|
|
277
275
|
email: z.ZodString;
|
|
276
|
+
username: z.ZodOptional<z.ZodString>;
|
|
277
|
+
id: z.ZodCUID2;
|
|
278
278
|
name: z.ZodOptional<z.ZodString>;
|
|
279
279
|
image: z.ZodOptional<z.ZodString>;
|
|
280
280
|
role: z.ZodEnum<{
|
|
@@ -308,9 +308,9 @@ export declare const SearchCreativeOutputSchema: z.ZodObject<{
|
|
|
308
308
|
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
309
309
|
updatedAt: z.ZodCoercedDate<unknown>;
|
|
310
310
|
user: z.ZodObject<{
|
|
311
|
-
id: z.ZodCUID2;
|
|
312
|
-
username: z.ZodOptional<z.ZodString>;
|
|
313
311
|
email: z.ZodString;
|
|
312
|
+
username: z.ZodOptional<z.ZodString>;
|
|
313
|
+
id: z.ZodCUID2;
|
|
314
314
|
name: z.ZodOptional<z.ZodString>;
|
|
315
315
|
image: z.ZodOptional<z.ZodString>;
|
|
316
316
|
role: z.ZodEnum<{
|
package/dist/schemas/index.d.ts
CHANGED
package/dist/schemas/index.js
CHANGED
|
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./auth"), exports);
|
|
17
18
|
__exportStar(require("./brand"), exports);
|
|
18
19
|
__exportStar(require("./common"), exports);
|
|
19
20
|
__exportStar(require("./creative"), exports);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { z } from "@hono/zod-openapi";
|
|
2
2
|
export declare const MinimalJobApplicationEntitySchema: z.ZodObject<{
|
|
3
3
|
user: z.ZodObject<{
|
|
4
|
-
id: z.ZodCUID2;
|
|
5
|
-
username: z.ZodOptional<z.ZodString>;
|
|
6
4
|
email: z.ZodString;
|
|
5
|
+
username: z.ZodOptional<z.ZodString>;
|
|
6
|
+
id: z.ZodCUID2;
|
|
7
7
|
name: z.ZodOptional<z.ZodString>;
|
|
8
8
|
image: z.ZodOptional<z.ZodString>;
|
|
9
9
|
role: z.ZodEnum<{
|
|
@@ -78,13 +78,14 @@ export declare const BaseJobApplicationEntitySchema: z.ZodObject<{
|
|
|
78
78
|
wagesAmount: z.ZodNullable<z.ZodNumber>;
|
|
79
79
|
}, z.core.$strip>;
|
|
80
80
|
export declare const JobApplicationEntitySchema: z.ZodObject<{
|
|
81
|
+
id: z.ZodString;
|
|
81
82
|
firstName: z.ZodOptional<z.ZodString>;
|
|
82
83
|
lastName: z.ZodOptional<z.ZodString>;
|
|
83
84
|
jobId: z.ZodCUID2;
|
|
84
85
|
user: z.ZodObject<{
|
|
85
|
-
id: z.ZodCUID2;
|
|
86
|
-
username: z.ZodOptional<z.ZodString>;
|
|
87
86
|
email: z.ZodString;
|
|
87
|
+
username: z.ZodOptional<z.ZodString>;
|
|
88
|
+
id: z.ZodCUID2;
|
|
88
89
|
name: z.ZodOptional<z.ZodString>;
|
|
89
90
|
image: z.ZodOptional<z.ZodString>;
|
|
90
91
|
role: z.ZodEnum<{
|
|
@@ -54,6 +54,7 @@ exports.BaseJobApplicationEntitySchema = zod_openapi_1.z.object({
|
|
|
54
54
|
wagesAmount: zod_openapi_1.z.number().nullable(),
|
|
55
55
|
});
|
|
56
56
|
exports.JobApplicationEntitySchema = zod_openapi_1.z.object({
|
|
57
|
+
id: zod_openapi_1.z.string(),
|
|
57
58
|
firstName: zod_openapi_1.z.string().optional(),
|
|
58
59
|
lastName: zod_openapi_1.z.string().optional(),
|
|
59
60
|
jobId: zod_openapi_1.z.cuid2(),
|
|
@@ -68,9 +68,9 @@ export declare const ProjectDetailsEntitySchema: z.ZodObject<{
|
|
|
68
68
|
createdAt: z.ZodCoercedDate<unknown>;
|
|
69
69
|
updatedAt: z.ZodCoercedDate<unknown>;
|
|
70
70
|
user: z.ZodObject<{
|
|
71
|
-
id: z.ZodCUID2;
|
|
72
|
-
username: z.ZodOptional<z.ZodString>;
|
|
73
71
|
email: z.ZodString;
|
|
72
|
+
username: z.ZodOptional<z.ZodString>;
|
|
73
|
+
id: z.ZodCUID2;
|
|
74
74
|
name: z.ZodOptional<z.ZodString>;
|
|
75
75
|
image: z.ZodOptional<z.ZodString>;
|
|
76
76
|
role: z.ZodEnum<{
|
|
@@ -278,9 +278,9 @@ export declare const GetProjectOutputSchema: z.ZodObject<{
|
|
|
278
278
|
createdAt: z.ZodCoercedDate<unknown>;
|
|
279
279
|
updatedAt: z.ZodCoercedDate<unknown>;
|
|
280
280
|
user: z.ZodObject<{
|
|
281
|
-
id: z.ZodCUID2;
|
|
282
|
-
username: z.ZodOptional<z.ZodString>;
|
|
283
281
|
email: z.ZodString;
|
|
282
|
+
username: z.ZodOptional<z.ZodString>;
|
|
283
|
+
id: z.ZodCUID2;
|
|
284
284
|
name: z.ZodOptional<z.ZodString>;
|
|
285
285
|
image: z.ZodOptional<z.ZodString>;
|
|
286
286
|
role: z.ZodEnum<{
|
package/dist/schemas/user.d.ts
CHANGED
|
@@ -37,9 +37,9 @@ export declare const UserEntitySchema: z.ZodObject<{
|
|
|
37
37
|
updatedAt: z.ZodCoercedDate<unknown>;
|
|
38
38
|
}, z.core.$strip>;
|
|
39
39
|
export declare const MinimalUserSchema: z.ZodObject<{
|
|
40
|
-
id: z.ZodCUID2;
|
|
41
|
-
username: z.ZodOptional<z.ZodString>;
|
|
42
40
|
email: z.ZodString;
|
|
41
|
+
username: z.ZodOptional<z.ZodString>;
|
|
42
|
+
id: z.ZodCUID2;
|
|
43
43
|
name: z.ZodOptional<z.ZodString>;
|
|
44
44
|
image: z.ZodOptional<z.ZodString>;
|
|
45
45
|
role: z.ZodEnum<{
|
|
@@ -298,9 +298,9 @@ export declare const GetUserFollowersInputSchema: z.ZodObject<{
|
|
|
298
298
|
offset: z.ZodOptional<z.ZodNumber>;
|
|
299
299
|
}, z.core.$strip>;
|
|
300
300
|
export declare const UserWithFollowingEntitySchema: z.ZodObject<{
|
|
301
|
-
id: z.ZodCUID2;
|
|
302
|
-
username: z.ZodOptional<z.ZodString>;
|
|
303
301
|
email: z.ZodString;
|
|
302
|
+
username: z.ZodOptional<z.ZodString>;
|
|
303
|
+
id: z.ZodCUID2;
|
|
304
304
|
name: z.ZodOptional<z.ZodString>;
|
|
305
305
|
image: z.ZodOptional<z.ZodString>;
|
|
306
306
|
role: z.ZodEnum<{
|
|
@@ -310,9 +310,9 @@ export declare const UserWithFollowingEntitySchema: z.ZodObject<{
|
|
|
310
310
|
ADMIN: "ADMIN";
|
|
311
311
|
}>;
|
|
312
312
|
following: z.ZodArray<z.ZodObject<{
|
|
313
|
-
id: z.ZodCUID2;
|
|
314
|
-
username: z.ZodOptional<z.ZodString>;
|
|
315
313
|
email: z.ZodString;
|
|
314
|
+
username: z.ZodOptional<z.ZodString>;
|
|
315
|
+
id: z.ZodCUID2;
|
|
316
316
|
name: z.ZodOptional<z.ZodString>;
|
|
317
317
|
image: z.ZodOptional<z.ZodString>;
|
|
318
318
|
role: z.ZodEnum<{
|
|
@@ -324,9 +324,9 @@ export declare const UserWithFollowingEntitySchema: z.ZodObject<{
|
|
|
324
324
|
}, z.core.$strip>>;
|
|
325
325
|
}, z.core.$strip>;
|
|
326
326
|
export declare const UserWithFollowersEntitySchema: z.ZodObject<{
|
|
327
|
-
id: z.ZodCUID2;
|
|
328
|
-
username: z.ZodOptional<z.ZodString>;
|
|
329
327
|
email: z.ZodString;
|
|
328
|
+
username: z.ZodOptional<z.ZodString>;
|
|
329
|
+
id: z.ZodCUID2;
|
|
330
330
|
name: z.ZodOptional<z.ZodString>;
|
|
331
331
|
image: z.ZodOptional<z.ZodString>;
|
|
332
332
|
role: z.ZodEnum<{
|
|
@@ -336,9 +336,9 @@ export declare const UserWithFollowersEntitySchema: z.ZodObject<{
|
|
|
336
336
|
ADMIN: "ADMIN";
|
|
337
337
|
}>;
|
|
338
338
|
followers: z.ZodArray<z.ZodObject<{
|
|
339
|
-
id: z.ZodCUID2;
|
|
340
|
-
username: z.ZodOptional<z.ZodString>;
|
|
341
339
|
email: z.ZodString;
|
|
340
|
+
username: z.ZodOptional<z.ZodString>;
|
|
341
|
+
id: z.ZodCUID2;
|
|
342
342
|
name: z.ZodOptional<z.ZodString>;
|
|
343
343
|
image: z.ZodOptional<z.ZodString>;
|
|
344
344
|
role: z.ZodEnum<{
|
|
@@ -405,9 +405,9 @@ export declare const UserWithPostsEntitySchema: z.ZodObject<{
|
|
|
405
405
|
}, z.core.$strip>;
|
|
406
406
|
export declare const GetUserFollowingOutputSchema: z.ZodObject<{
|
|
407
407
|
results: z.ZodObject<{
|
|
408
|
-
id: z.ZodCUID2;
|
|
409
|
-
username: z.ZodOptional<z.ZodString>;
|
|
410
408
|
email: z.ZodString;
|
|
409
|
+
username: z.ZodOptional<z.ZodString>;
|
|
410
|
+
id: z.ZodCUID2;
|
|
411
411
|
name: z.ZodOptional<z.ZodString>;
|
|
412
412
|
image: z.ZodOptional<z.ZodString>;
|
|
413
413
|
role: z.ZodEnum<{
|
|
@@ -417,9 +417,9 @@ export declare const GetUserFollowingOutputSchema: z.ZodObject<{
|
|
|
417
417
|
ADMIN: "ADMIN";
|
|
418
418
|
}>;
|
|
419
419
|
following: z.ZodArray<z.ZodObject<{
|
|
420
|
-
id: z.ZodCUID2;
|
|
421
|
-
username: z.ZodOptional<z.ZodString>;
|
|
422
420
|
email: z.ZodString;
|
|
421
|
+
username: z.ZodOptional<z.ZodString>;
|
|
422
|
+
id: z.ZodCUID2;
|
|
423
423
|
name: z.ZodOptional<z.ZodString>;
|
|
424
424
|
image: z.ZodOptional<z.ZodString>;
|
|
425
425
|
role: z.ZodEnum<{
|
|
@@ -433,9 +433,9 @@ export declare const GetUserFollowingOutputSchema: z.ZodObject<{
|
|
|
433
433
|
}, z.core.$strip>;
|
|
434
434
|
export declare const GetUserFollowersOutputSchema: z.ZodObject<{
|
|
435
435
|
results: z.ZodObject<{
|
|
436
|
-
id: z.ZodCUID2;
|
|
437
|
-
username: z.ZodOptional<z.ZodString>;
|
|
438
436
|
email: z.ZodString;
|
|
437
|
+
username: z.ZodOptional<z.ZodString>;
|
|
438
|
+
id: z.ZodCUID2;
|
|
439
439
|
name: z.ZodOptional<z.ZodString>;
|
|
440
440
|
image: z.ZodOptional<z.ZodString>;
|
|
441
441
|
role: z.ZodEnum<{
|
|
@@ -445,9 +445,9 @@ export declare const GetUserFollowersOutputSchema: z.ZodObject<{
|
|
|
445
445
|
ADMIN: "ADMIN";
|
|
446
446
|
}>;
|
|
447
447
|
followers: z.ZodArray<z.ZodObject<{
|
|
448
|
-
id: z.ZodCUID2;
|
|
449
|
-
username: z.ZodOptional<z.ZodString>;
|
|
450
448
|
email: z.ZodString;
|
|
449
|
+
username: z.ZodOptional<z.ZodString>;
|
|
450
|
+
id: z.ZodCUID2;
|
|
451
451
|
name: z.ZodOptional<z.ZodString>;
|
|
452
452
|
image: z.ZodOptional<z.ZodString>;
|
|
453
453
|
role: z.ZodEnum<{
|
|
@@ -709,9 +709,9 @@ export declare const GetAuthenticatedUserWithProjectBookmarksOutputSchema: z.Zod
|
|
|
709
709
|
}, z.core.$strip>>;
|
|
710
710
|
}, z.core.$strip>;
|
|
711
711
|
export declare const GetAuthenticatedUserWithUserFollowingOutputSchema: z.ZodObject<{
|
|
712
|
-
id: z.ZodCUID2;
|
|
713
|
-
username: z.ZodOptional<z.ZodString>;
|
|
714
712
|
email: z.ZodString;
|
|
713
|
+
username: z.ZodOptional<z.ZodString>;
|
|
714
|
+
id: z.ZodCUID2;
|
|
715
715
|
name: z.ZodOptional<z.ZodString>;
|
|
716
716
|
image: z.ZodOptional<z.ZodString>;
|
|
717
717
|
role: z.ZodEnum<{
|
|
@@ -721,9 +721,9 @@ export declare const GetAuthenticatedUserWithUserFollowingOutputSchema: z.ZodObj
|
|
|
721
721
|
ADMIN: "ADMIN";
|
|
722
722
|
}>;
|
|
723
723
|
following: z.ZodArray<z.ZodObject<{
|
|
724
|
-
id: z.ZodCUID2;
|
|
725
|
-
username: z.ZodOptional<z.ZodString>;
|
|
726
724
|
email: z.ZodString;
|
|
725
|
+
username: z.ZodOptional<z.ZodString>;
|
|
726
|
+
id: z.ZodCUID2;
|
|
727
727
|
name: z.ZodOptional<z.ZodString>;
|
|
728
728
|
image: z.ZodOptional<z.ZodString>;
|
|
729
729
|
role: z.ZodEnum<{
|
|
@@ -735,9 +735,9 @@ export declare const GetAuthenticatedUserWithUserFollowingOutputSchema: z.ZodObj
|
|
|
735
735
|
}, z.core.$strip>>;
|
|
736
736
|
}, z.core.$strip>;
|
|
737
737
|
export declare const GetAuthenticatedUserWithUserFollowersOutputSchema: z.ZodObject<{
|
|
738
|
-
id: z.ZodCUID2;
|
|
739
|
-
username: z.ZodOptional<z.ZodString>;
|
|
740
738
|
email: z.ZodString;
|
|
739
|
+
username: z.ZodOptional<z.ZodString>;
|
|
740
|
+
id: z.ZodCUID2;
|
|
741
741
|
name: z.ZodOptional<z.ZodString>;
|
|
742
742
|
image: z.ZodOptional<z.ZodString>;
|
|
743
743
|
role: z.ZodEnum<{
|
|
@@ -747,9 +747,9 @@ export declare const GetAuthenticatedUserWithUserFollowersOutputSchema: z.ZodObj
|
|
|
747
747
|
ADMIN: "ADMIN";
|
|
748
748
|
}>;
|
|
749
749
|
followers: z.ZodArray<z.ZodObject<{
|
|
750
|
-
id: z.ZodCUID2;
|
|
751
|
-
username: z.ZodOptional<z.ZodString>;
|
|
752
750
|
email: z.ZodString;
|
|
751
|
+
username: z.ZodOptional<z.ZodString>;
|
|
752
|
+
id: z.ZodCUID2;
|
|
753
753
|
name: z.ZodOptional<z.ZodString>;
|
|
754
754
|
image: z.ZodOptional<z.ZodString>;
|
|
755
755
|
role: z.ZodEnum<{
|
package/dist/schemas/user.js
CHANGED
|
@@ -112,10 +112,12 @@ exports.UserWithFollowersEntitySchema = exports.MinimalUserSchema.extend({
|
|
|
112
112
|
.array(exports.MinimalUserSchema)
|
|
113
113
|
.openapi({ description: "List of users who follow this user." }),
|
|
114
114
|
}).openapi("UserWithFollowersEntity");
|
|
115
|
-
exports.UserWithPostsEntitySchema = zod_openapi_1.z
|
|
115
|
+
exports.UserWithPostsEntitySchema = zod_openapi_1.z
|
|
116
|
+
.object({
|
|
116
117
|
userId: zod_openapi_1.z.cuid2(),
|
|
117
118
|
posts: zod_openapi_1.z.array(post_1.PostWithFilesEntitySchema),
|
|
118
|
-
})
|
|
119
|
+
})
|
|
120
|
+
.openapi("UserWithPostsEntity");
|
|
119
121
|
exports.GetUserFollowingOutputSchema = zod_openapi_1.z.object({
|
|
120
122
|
results: exports.UserWithFollowingEntitySchema,
|
|
121
123
|
});
|
package/dist/types/index.d.ts
CHANGED
package/dist/types/index.js
CHANGED
|
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./auth"), exports);
|
|
17
18
|
__exportStar(require("./brand"), exports);
|
|
18
19
|
__exportStar(require("./common"), exports);
|
|
19
20
|
__exportStar(require("./creative"), exports);
|
package/package.json
CHANGED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
|
|
3
|
+
export const RegisterSchema = z.object({
|
|
4
|
+
firstName: z.string().max(255, { message: "First name is too long" }),
|
|
5
|
+
lastName: z.string().max(255, { message: "Last name is too long" }),
|
|
6
|
+
email: z
|
|
7
|
+
.email({ message: "Enter a valid email address" })
|
|
8
|
+
.max(255, { message: "Email is too long" }),
|
|
9
|
+
username: z
|
|
10
|
+
.string()
|
|
11
|
+
.min(3, { message: "Username is too short" })
|
|
12
|
+
.max(32, { message: "Username must be at most 32 characters" })
|
|
13
|
+
.regex(/^[a-zA-Z0-9_]+$/, {
|
|
14
|
+
error: "Username can only contain letters, numbers, and underscores",
|
|
15
|
+
}),
|
|
16
|
+
password: z
|
|
17
|
+
.string()
|
|
18
|
+
.min(8, { message: "Password must be at least 8 characters" })
|
|
19
|
+
.max(100, { message: "Password must be at most 100 characters" }),
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export const LoginSchema = z.object({
|
|
23
|
+
identifier: z
|
|
24
|
+
.string()
|
|
25
|
+
.trim()
|
|
26
|
+
.min(1, { message: "Email or username is required" })
|
|
27
|
+
.refine(
|
|
28
|
+
(val) => {
|
|
29
|
+
const isEmail = z.email().safeParse(val).success;
|
|
30
|
+
const isUsername = /^[a-zA-Z0-9_]{3,20}$/.test(val);
|
|
31
|
+
return isEmail || isUsername;
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
message:
|
|
35
|
+
"Enter a valid email or a username (3–20 characters, letters/numbers/underscore)",
|
|
36
|
+
}
|
|
37
|
+
),
|
|
38
|
+
password: z
|
|
39
|
+
.string()
|
|
40
|
+
.min(8, { message: "Password must be at least 8 characters" })
|
|
41
|
+
.max(100, { message: "Password must be at most 100 characters" }),
|
|
42
|
+
rememberMe: z.boolean(),
|
|
43
|
+
});
|
package/src/schemas/index.ts
CHANGED
package/src/schemas/user.ts
CHANGED
|
@@ -20,7 +20,7 @@ import { LikeEntitySchema } from "./like";
|
|
|
20
20
|
import { BrandEntitySchema } from "./brand";
|
|
21
21
|
import { CreativeEntitySchema } from "./creative";
|
|
22
22
|
import { InvestorEntitySchema } from "./investor";
|
|
23
|
-
import {
|
|
23
|
+
import { PostWithFilesEntitySchema } from "./post";
|
|
24
24
|
|
|
25
25
|
export const UserEntitySchema = z
|
|
26
26
|
.object({
|
|
@@ -140,10 +140,12 @@ export const UserWithFollowersEntitySchema = MinimalUserSchema.extend({
|
|
|
140
140
|
.openapi({ description: "List of users who follow this user." }),
|
|
141
141
|
}).openapi("UserWithFollowersEntity");
|
|
142
142
|
|
|
143
|
-
export const UserWithPostsEntitySchema = z
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
143
|
+
export const UserWithPostsEntitySchema = z
|
|
144
|
+
.object({
|
|
145
|
+
userId: z.cuid2(),
|
|
146
|
+
posts: z.array(PostWithFilesEntitySchema),
|
|
147
|
+
})
|
|
148
|
+
.openapi("UserWithPostsEntity");
|
|
147
149
|
|
|
148
150
|
export const GetUserFollowingOutputSchema = z.object({
|
|
149
151
|
results: UserWithFollowingEntitySchema,
|
package/src/types/index.ts
CHANGED