2025-05-27 12:19:15 +05:30
|
|
|
import { Document, Schema } from "mongoose";
|
2025-03-28 12:45:59 +05:30
|
|
|
import MainModel from "../connect/mongoose.ts";
|
2025-01-30 12:44:04 +05:30
|
|
|
export interface User extends Document {
|
|
|
|
|
userName: String;
|
|
|
|
|
email: String;
|
|
|
|
|
password: String;
|
2025-05-15 18:53:18 +05:30
|
|
|
recentlyViewed: string[];
|
2025-01-30 12:44:04 +05:30
|
|
|
role: String;
|
|
|
|
|
profilePicture: String;
|
2025-05-15 18:53:18 +05:30
|
|
|
isShare: Boolean;
|
|
|
|
|
activeStatus: string;
|
2025-01-30 12:44:04 +05:30
|
|
|
}
|
|
|
|
|
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,
|
|
|
|
|
},
|
2025-05-15 18:53:18 +05:30
|
|
|
isShare: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
default: false,
|
|
|
|
|
},
|
|
|
|
|
activeStatus: {
|
|
|
|
|
type: String,
|
2025-01-30 12:44:04 +05:30
|
|
|
enum: ["online", "offline"],
|
2025-05-15 18:53:18 +05:30
|
|
|
default: "offline",
|
|
|
|
|
},
|
2025-01-30 12:44:04 +05:30
|
|
|
});
|
|
|
|
|
|
2025-05-27 12:19:15 +05:30
|
|
|
const userModel = (db: string) => {
|
2025-05-28 09:42:00 +05:30
|
|
|
return MainModel(db, "Users", signupschema, "Users");
|
2025-01-30 12:44:04 +05:30
|
|
|
};
|
2025-05-15 18:53:18 +05:30
|
|
|
export default userModel;
|