38 lines
1.1 KiB
TypeScript
38 lines
1.1 KiB
TypeScript
import { Schema, Document } 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;
|
|
isDeleted: boolean;
|
|
thumbnail: string;
|
|
sharedUsers: [];
|
|
DeletedAt: Date;
|
|
total_versions: string;
|
|
Present_version: string;
|
|
}
|
|
const projectSchema: Schema = new Schema(
|
|
{
|
|
projectUuid: { type: String },
|
|
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" }],
|
|
DeletedAt: { type: Date, default: null },
|
|
isDeleted: { type: Boolean, default: false },
|
|
total_versions: { type: String },
|
|
Present_version: { type: String },
|
|
},
|
|
{ timestamps: true }
|
|
);
|
|
|
|
const projectModel = (db: string) => {
|
|
return MainModel(db, "Projects", projectSchema, "Projects");
|
|
};
|
|
|
|
export default projectModel;
|