revert(maintenance): keep one-time TTL cleanup, narrow PR to validator-only

Per review feedback: auto-deleting completed one-time maintenance windows is
intentional cleanup, not a bug. The actual bug is past-dated end values being
accepted at creation time, which the validator refines now reject up front.

Reverts:
- Restore expiry field + TTL index on MaintenanceWindow schema
- Restore repository's auto-set of expiry = end for repeat=0
- Drop migration 0007 (no longer needed)
- Restore expiry properties in openapi.json
- Restore expiry in create/edit validators (still optional)

Kept from this PR:
- .strict() on create/edit body schemas
- end > start refine on create/edit
- end > now refine on create when repeat=0 (the real fix)
- DurationUnits const tuple + reuse (rules 5/8/10)
- Client no longer sends redundant expiry (server still derives it)
This commit is contained in:
gorkem-bwl committed 2026-05-07 13:38:10 -04:00
1 parent b462ba7562
commit c45bcfaa2f
6 files changed
+22 -60

No files matched your search

@@ -6,6 +6,7 @@ type MaintenanceWindowDocumentBase = Omit<MaintenanceWindow, "id" | "monitorId"
teamId: Types.ObjectId;
start: Date;
end: Date;
expiry?: Date;
createdAt: Date;
updatedAt: Date;
};
@@ -49,6 +50,10 @@ const MaintenanceWindowSchema = new Schema<MaintenanceWindowDocument>(
end: {
type: Date,
},
expiry: {
type: Date,
index: { expires: "0s" },
},
},
{
timestamps: true,