Add session management
This commit is contained in:
@@ -24,6 +24,7 @@ export const userModel = mongoose.model(
|
||||
},
|
||||
avatar: String,
|
||||
status: String,
|
||||
claims: [String],
|
||||
createdAt: Date,
|
||||
createdBy: mongoose.Types.ObjectId,
|
||||
lastLogin: Date,
|
||||
@@ -40,6 +41,7 @@ const userCore = {
|
||||
})
|
||||
.email(),
|
||||
avatar: z.string().url().optional(),
|
||||
claims: z.array(z.string()).optional(),
|
||||
};
|
||||
|
||||
const createUserInput = z.object({
|
||||
@@ -51,7 +53,21 @@ const createUserResponse = z.object({
|
||||
...userCore,
|
||||
});
|
||||
|
||||
const updateUserInput = z.object({
|
||||
firstName: z.string().max(30).optional(),
|
||||
lastName: z.string().max(30).optional(),
|
||||
email: z
|
||||
.string({
|
||||
required_error: "Email is required",
|
||||
invalid_type_error: "Email must be a valid string",
|
||||
})
|
||||
.email()
|
||||
.optional(),
|
||||
avatar: z.string().url().optional(),
|
||||
});
|
||||
|
||||
export type CreateUserInput = z.infer<typeof createUserInput>;
|
||||
export type UpdateUserInput = z.infer<typeof updateUserInput>;
|
||||
|
||||
export const { schemas: userSchemas, $ref: $user } = buildJsonSchemas(
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user