refactor(maintenance): centralize DurationUnit + sync OpenAPI spec
Convention pass per docs/coding-conventions.md (rules 5/8/10/11): - Promote DurationUnit from a raw union type to a const tuple + derived type. - Mongoose schema enum imports DurationUnits instead of inlining the values. - Both validators import DurationUnits instead of inlining z.enum twice. - Drop stale 'expiry' entries from openapi.json (spec is now strict-mode-correct).
This commit is contained in:
1 parent
bd059da94a
commit
b462ba7562
4 files changed
+7
-15
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import { Schema, model, type Types } from "mongoose";
|
||||
import 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"> & {
|
||||
monitorId: Types.ObjectId;
|
||||
@@ -38,7 +38,7 @@ const MaintenanceWindowSchema = new Schema<MaintenanceWindowDocument>(
|
||||
},
|
||||
durationUnit: {
|
||||
type: String,
|
||||
enum: ["seconds", "minutes", "hours", "days"],
|
||||
enum: DurationUnits,
|
||||
},
|
||||
repeat: {
|
||||
type: Number,
|
||||
|
||||
Reference in new issue
Block a user