first commit
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
import { model, Schema } from "mongoose";
|
||||
|
||||
const buildSchema = new Schema(
|
||||
{
|
||||
companyId: {
|
||||
type: Schema.Types.ObjectId,
|
||||
required: true,
|
||||
},
|
||||
name: {
|
||||
type: String,
|
||||
required: true,
|
||||
unique: true,
|
||||
},
|
||||
sessionLimit: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
timestamps: true,
|
||||
toJSON: { virtuals: true },
|
||||
toObject: { virtuals: true },
|
||||
}
|
||||
);
|
||||
|
||||
buildSchema.virtual("scheduledSessions", {
|
||||
ref: "Scheduled_Session",
|
||||
localField: "_id",
|
||||
foreignField: "buildId",
|
||||
});
|
||||
|
||||
const Build = model("Build", buildSchema);
|
||||
|
||||
export default Build;
|
||||
Reference in New Issue
Block a user