projectData and version model added

This commit is contained in:
2025-05-14 14:29:14 +05:30
parent af8510ad90
commit e2be6deb0a
11 changed files with 699 additions and 136 deletions

View File

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