add cache to auth
This commit is contained in:
@@ -1,37 +1,41 @@
|
||||
import { buildJsonSchemas } from "fastify-zod";
|
||||
import mongoose from "mongoose";
|
||||
import mongoose, { InferSchemaType } from "mongoose";
|
||||
import { z } from "zod";
|
||||
import { roles } from "../utils/roles";
|
||||
|
||||
export const userModel = mongoose.model(
|
||||
"user",
|
||||
new mongoose.Schema({
|
||||
tenantId: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
pid: {
|
||||
type: String,
|
||||
unique: true,
|
||||
required: true,
|
||||
},
|
||||
orgId: mongoose.Types.ObjectId,
|
||||
firstName: String,
|
||||
lastName: String,
|
||||
name: String,
|
||||
email: {
|
||||
type: String,
|
||||
unique: true,
|
||||
required: true,
|
||||
},
|
||||
avatar: String,
|
||||
status: String,
|
||||
role: String,
|
||||
createdAt: Date,
|
||||
createdBy: mongoose.Types.ObjectId,
|
||||
lastLogin: Date,
|
||||
})
|
||||
);
|
||||
const userSchema = new mongoose.Schema({
|
||||
tenantId: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
pid: {
|
||||
type: String,
|
||||
unique: true,
|
||||
required: true,
|
||||
},
|
||||
orgId: mongoose.Types.ObjectId,
|
||||
firstName: String,
|
||||
lastName: String,
|
||||
name: String,
|
||||
email: {
|
||||
type: String,
|
||||
unique: true,
|
||||
required: true,
|
||||
},
|
||||
avatar: String,
|
||||
status: String,
|
||||
role: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
createdAt: Date,
|
||||
createdBy: mongoose.Types.ObjectId,
|
||||
lastLogin: Date,
|
||||
});
|
||||
|
||||
export const userModel = mongoose.model("user", userSchema);
|
||||
|
||||
export type User = InferSchemaType<typeof userSchema>;
|
||||
|
||||
const userCore = {
|
||||
firstName: z.string().max(30),
|
||||
|
||||
Reference in New Issue
Block a user