Files
Dwinzo-Backend-V0.0/src/shared/model/user-Model.ts

51 lines
1.0 KiB
TypeScript
Raw Normal View History

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;
recentlyViewed: string[];
2025-01-30 12:44:04 +05:30
role: String;
profilePicture: String;
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,
},
isShare: {
type: Boolean,
default: false,
},
activeStatus: {
type: String,
2025-01-30 12:44:04 +05:30
enum: ["online", "offline"],
default: "offline",
},
2025-01-30 12:44:04 +05:30
});
2025-05-27 12:19:15 +05:30
const userModel = (db: string) => {
return MainModel(db, "Users", signupschema, "Users");
2025-01-30 12:44:04 +05:30
};
export default userModel;