💥 add basic fetch user via email
This commit is contained in:
@ -1,24 +0,0 @@
|
||||
import Joi from "joi";
|
||||
|
||||
export const editUserSchema = Joi.object({
|
||||
name: Joi.string()
|
||||
.min(4)
|
||||
.max(255),
|
||||
username: Joi.string()
|
||||
.min(4)
|
||||
.max(255),
|
||||
birthdate: Joi.date(),
|
||||
gender: Joi.string().valid("male", "female"),
|
||||
phoneCC: Joi.string()
|
||||
.min(2)
|
||||
.max(2),
|
||||
phoneNumber: Joi.string()
|
||||
.min(7)
|
||||
.max(15),
|
||||
bioProfile: Joi.string().max(300),
|
||||
deletedAt: Joi.date(),
|
||||
|
||||
// validate in helper
|
||||
avatar: Joi.any(),
|
||||
commentBackground: Joi.any(),
|
||||
});
|
||||
5
src/modules/user/schemas/getUserById.schema.ts
Normal file
5
src/modules/user/schemas/getUserById.schema.ts
Normal file
@ -0,0 +1,5 @@
|
||||
import z from "zod";
|
||||
|
||||
export const getUserByIdSchema = z.object({
|
||||
email: z.email(),
|
||||
});
|
||||
20
src/modules/user/schemas/getUserOptions.schema.ts
Normal file
20
src/modules/user/schemas/getUserOptions.schema.ts
Normal file
@ -0,0 +1,20 @@
|
||||
import z from "zod";
|
||||
|
||||
const includeEnum = z.enum(
|
||||
["preference", "roles"],
|
||||
"option: include value didn't match with enum types"
|
||||
);
|
||||
|
||||
export const getUserOptionsSchema = z.object({
|
||||
verbosity: z
|
||||
.enum(
|
||||
["exists", "basic", "full"],
|
||||
"option: verbosity value didn't match with enum types"
|
||||
)
|
||||
.optional(),
|
||||
include: z.preprocess((val) => {
|
||||
if (Array.isArray(val)) return val;
|
||||
if (typeof val === "string") return [val];
|
||||
return [];
|
||||
}, z.array(includeEnum).optional()),
|
||||
});
|
||||
Reference in New Issue
Block a user