29 lines
833 B
TypeScript
29 lines
833 B
TypeScript
|
|
import { Schema, Document, Types } from "mongoose";
|
||
|
|
import MainModel from "../../connect/mongoose.ts";
|
||
|
|
import {User} from "../user-Model.ts";
|
||
|
|
|
||
|
|
export interface Project extends Document {
|
||
|
|
projectUuid: string;
|
||
|
|
projectName: string;
|
||
|
|
createdBy: User["_id"];
|
||
|
|
isArchive: boolean
|
||
|
|
thumbnail: string
|
||
|
|
sharedUsers: []
|
||
|
|
|
||
|
|
}
|
||
|
|
const projectSchema:Schema = new Schema({
|
||
|
|
projectUuid: { type: String, required: true },
|
||
|
|
projectName: { type: String },
|
||
|
|
thumbnail: { type: String },
|
||
|
|
isArchive: { type: Boolean,default:false },
|
||
|
|
createdBy: { type: Schema.Types.ObjectId, ref: "user" },
|
||
|
|
sharedUsers: [{ type: Schema.Types.ObjectId, ref: "user" }],
|
||
|
|
|
||
|
|
|
||
|
|
}, { timestamps: true })
|
||
|
|
|
||
|
|
const projectModel = (db: string) => {
|
||
|
|
return MainModel(db, "Projects", projectSchema, "Projects");
|
||
|
|
};
|
||
|
|
|
||
|
|
export default projectModel;
|