35 lines
766 B
TypeScript
35 lines
766 B
TypeScript
|
|
import { Schema, Document } from "mongoose";
|
||
|
|
import MainModel from "../../connect/mongoose.ts";
|
||
|
|
export interface User extends Document {
|
||
|
|
Username: string;
|
||
|
|
Email: string;
|
||
|
|
Password: string;
|
||
|
|
isArchieve: boolean;
|
||
|
|
visitorBrowserID: string;
|
||
|
|
lastPasswordReset: number;
|
||
|
|
}
|
||
|
|
const signupschema: Schema = new Schema({
|
||
|
|
Username: {
|
||
|
|
type: String,
|
||
|
|
required: true,
|
||
|
|
},
|
||
|
|
Email: {
|
||
|
|
type: String,
|
||
|
|
unique: true,
|
||
|
|
required: true,
|
||
|
|
},
|
||
|
|
Password: {
|
||
|
|
type: String,
|
||
|
|
min: 8,
|
||
|
|
// required: true,
|
||
|
|
},
|
||
|
|
isArchieve: { type: Boolean, default: false },
|
||
|
|
lastPasswordReset: { type: Number },
|
||
|
|
visitorBrowserID: { type: String },
|
||
|
|
});
|
||
|
|
|
||
|
|
const userModel = (db: any) => {
|
||
|
|
return MainModel(db, "User", signupschema, "User");
|
||
|
|
};
|
||
|
|
export default userModel;
|