51 lines
1.0 KiB
TypeScript
51 lines
1.0 KiB
TypeScript
import { Document, Schema } from "mongoose";
|
|
import MainModel from "../connect/mongoose.ts";
|
|
export interface User extends Document {
|
|
userName: String;
|
|
email: String;
|
|
password: String;
|
|
recentlyViewed: string[];
|
|
role: String;
|
|
profilePicture: String;
|
|
isShare: Boolean;
|
|
activeStatus: string;
|
|
}
|
|
const signupschema: Schema = new Schema({
|
|
userName: {
|
|
type: String,
|
|
required: true,
|
|
},
|
|
email: {
|
|
type: String,
|
|
unique: true,
|
|
required: true,
|
|
},
|
|
password: {
|
|
type: String,
|
|
min: 8,
|
|
required: true,
|
|
},
|
|
role: {
|
|
type: String,
|
|
default: "User",
|
|
enum: ["User", "Admin", "Project Manager", "Manager", "Owner"],
|
|
},
|
|
profilePicture: {
|
|
type: String,
|
|
},
|
|
isShare: {
|
|
type: Boolean,
|
|
default: false,
|
|
},
|
|
activeStatus: {
|
|
type: String,
|
|
enum: ["online", "offline"],
|
|
default: "offline",
|
|
},
|
|
});
|
|
|
|
const userModel = (db: string) => {
|
|
return MainModel(db, "Users", signupschema, "Users");
|
|
};
|
|
export default userModel;
|