39 lines
826 B
TypeScript
39 lines
826 B
TypeScript
import { Schema, Document } from "mongoose";
|
|
import MainModel from "../../connect/mongoose.ts";
|
|
export interface User extends Document {
|
|
userName: string;
|
|
Email: string;
|
|
Password: string;
|
|
isArchive: boolean;
|
|
visitorBrowserID: string;
|
|
role: string;
|
|
lastPasswordReset: number;
|
|
}
|
|
const AuthSchema: Schema = new Schema({
|
|
userName: {
|
|
type: String,
|
|
required: true,
|
|
},
|
|
role: {
|
|
type: String,
|
|
default: "User",
|
|
enum: ["User", "Admin"],
|
|
},
|
|
Email: {
|
|
type: String,
|
|
required: true,
|
|
},
|
|
Password: {
|
|
type: String,
|
|
min: 8,
|
|
},
|
|
isArchive: { type: Boolean, default: false },
|
|
lastPasswordReset: { type: Number },
|
|
visitorBrowserID: { type: String },
|
|
});
|
|
|
|
const AuthModel = (db: any) => {
|
|
return MainModel(db, "UserAuth", AuthSchema, "UserAuth");
|
|
};
|
|
export default AuthModel;
|