update maintenance window model to use array of IDs instead of ID
This commit is contained in:
1 parent
c1fc537479
commit
bdecc1a5e2
1 file changed
+5
-5
@@ -1,8 +1,8 @@
|
|||||||
import { Schema, model, type Types } from "mongoose";
|
import { Schema, model, type Types } from "mongoose";
|
||||||
import { DurationUnits, type MaintenanceWindow } from "@/types/maintenanceWindow.js";
|
import { DurationUnits, type MaintenanceWindow } from "@/types/maintenanceWindow.js";
|
||||||
|
|
||||||
type MaintenanceWindowDocumentBase = Omit<MaintenanceWindow, "id" | "monitorId" | "teamId" | "start" | "end" | "createdAt" | "updatedAt"> & {
|
type MaintenanceWindowDocumentBase = Omit<MaintenanceWindow, "id" | "monitorIds" | "teamId" | "start" | "end" | "createdAt" | "updatedAt"> & {
|
||||||
monitorId: Types.ObjectId;
|
monitorIds: Types.ObjectId[];
|
||||||
teamId: Types.ObjectId;
|
teamId: Types.ObjectId;
|
||||||
start: Date;
|
start: Date;
|
||||||
end: Date;
|
end: Date;
|
||||||
@@ -17,10 +17,10 @@ interface MaintenanceWindowDocument extends MaintenanceWindowDocumentBase {
|
|||||||
|
|
||||||
const MaintenanceWindowSchema = new Schema<MaintenanceWindowDocument>(
|
const MaintenanceWindowSchema = new Schema<MaintenanceWindowDocument>(
|
||||||
{
|
{
|
||||||
monitorId: {
|
monitorIds: {
|
||||||
type: Schema.Types.ObjectId,
|
type: [Schema.Types.ObjectId],
|
||||||
ref: "Monitor",
|
ref: "Monitor",
|
||||||
immutable: true,
|
index: true,
|
||||||
},
|
},
|
||||||
teamId: {
|
teamId: {
|
||||||
type: Schema.Types.ObjectId,
|
type: Schema.Types.ObjectId,
|
||||||
|
|||||||
Reference in new issue
Block a user