Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions apps/server/src/v1/notifications.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import { createRoute, OpenAPIHono, z } from "@hono/zod-openapi";
import { and, db, eq, isNotNull } from "@openstatus/db";
import {
notification,
notificationsToMonitors,
notificationsToMonitorsRelation,
notificationRelations,
notificationProviderSchema,
notificationProvider,


} from "@openstatus/db/src/schema/notifications";
import type { Variables } from "./index";
import { ErrorSchema } from "./shared";
import { isoDate } from "./utils";

const notificationApi = new OpenAPIHono<{ Variables: Variables }>();

const ParamsSchema = z.object({
id: z
.string()
.min(1)
.openapi({
param: {
name: "id",
in: "path",
},
description: "The id of the Incident",
example: "1",
}),
});

const NotificationSchema = z.object({
id: z.number().openapi({
description: "The id of the notification",
example: 1,
}),
name: z
.string()
.openapi({
example: "Alert",
description: "The name of the notification",
})
.nullable(),
provider: notificationProviderSchema.openapi({
description: "The provider for notification",
}),
data: z.string().openapi({
example: "Hello World",
description: "The data",
}),

createdAt: isoDate.openapi({
description: "The date the incident started",
}),
updatedAt: isoDate.openapi({
description: "The date the incident started",
}),
});

Empty file.