Skip to content

Open-source status page, incident response and uptime monitoring

📝 fix formating

Thibault Le Ouayfd9716bb9af5
diff --git a/apps/server/src/v1/incidents.test.ts b/apps/server/src/v1/incidents.test.ts
index efbbb69e7..ec14d5b3c 100644
--- a/apps/server/src/v1/incidents.test.ts
+++ b/apps/server/src/v1/incidents.test.ts
@@ -1,4 +1,5 @@
import { expect, test } from "bun:test";
+
import { api } from ".";
import { iso8601Regex } from "./test-utils";
@@ -83,7 +84,8 @@ test("Update an incident with invalid data should return 403", async () => {
"x-openstatus-key": "1",
"content-type": "application/json",
},
- body: JSON.stringify({//passing incorrect body
+ body: JSON.stringify({
+ //passing incorrect body
acknowledgedAt: "2023-11-0",
}),
});
diff --git a/apps/server/src/v1/incidents.ts b/apps/server/src/v1/incidents.ts
index 4fa85f24e..815f74360 100644
--- a/apps/server/src/v1/incidents.ts
+++ b/apps/server/src/v1/incidents.ts
@@ -28,10 +28,9 @@ const IncidentSchema = z.object({
description: "The id of the incident",
example: 1,
}),
- startedAt: isoDate
- .openapi({
- description: "The date the incident started",
- }),
+ startedAt: isoDate.openapi({
+ description: "The date the incident started",
+ }),
monitorId: z
.number()
@@ -41,7 +40,7 @@ const IncidentSchema = z.object({
})
.nullable(),
- acknowledgedAt:isoDate
+ acknowledgedAt: isoDate
.openapi({
description: "The date the incident was acknowledged",
})
diff --git a/apps/server/src/v1/monitor.test.ts b/apps/server/src/v1/monitor.test.ts
index ee5de8b69..0a58b5dc9 100644
--- a/apps/server/src/v1/monitor.test.ts
+++ b/apps/server/src/v1/monitor.test.ts
@@ -1,4 +1,5 @@
import { expect, test } from "bun:test";
+
import { api } from ".";
import { iso8601Regex } from "./test-utils";
diff --git a/apps/server/src/v1/statusReport.test.ts b/apps/server/src/v1/statusReport.test.ts
index d53f37dc0..dc44888d3 100644
--- a/apps/server/src/v1/statusReport.test.ts
+++ b/apps/server/src/v1/statusReport.test.ts
@@ -1,4 +1,5 @@
import { expect, test } from "bun:test";
+
import { api } from ".";
import { iso8601Regex } from "./test-utils";
@@ -162,7 +163,8 @@ test("Create a status report update with invalid data should return 403", async
"x-openstatus-key": "1",
"content-type": "application/json",
},
- body: JSON.stringify({//passing in incompelete body
+ body: JSON.stringify({
+ //passing in incompelete body
date: "2023-11-08T21:03:13.000Z",
message: "Test Status Report",
}),
diff --git a/apps/server/src/v1/statusReport.ts b/apps/server/src/v1/statusReport.ts
index ebc46c815..4c59d76e6 100644
--- a/apps/server/src/v1/statusReport.ts
+++ b/apps/server/src/v1/statusReport.ts
@@ -15,8 +15,8 @@ import { allPlans } from "@openstatus/plans";
import type { Variables } from "./index";
import { ErrorSchema } from "./shared";
-import { isoDate } from "./utils";
import { statusUpdateSchema } from "./statusReportUpdate";
+import { isoDate } from "./utils";
const statusReportApi = new OpenAPIHono<{ Variables: Variables }>();
@@ -38,10 +38,9 @@ const createStatusReportUpdateSchema = z.object({
status: z.enum(statusReportStatus).openapi({
description: "The status of the update",
}),
- date: isoDate
- .openapi({
- description: "The date of the update in ISO8601 format",
- }),
+ date: isoDate.openapi({
+ description: "The date of the update in ISO8601 format",
+ }),
message: z.string().openapi({
description: "The message of the update",
}),
diff --git a/apps/server/src/v1/statusReportUpdate.test.ts b/apps/server/src/v1/statusReportUpdate.test.ts
index 168c2c76e..b6eeeb990 100644
--- a/apps/server/src/v1/statusReportUpdate.test.ts
+++ b/apps/server/src/v1/statusReportUpdate.test.ts
@@ -1,4 +1,5 @@
import { expect, test } from "bun:test";
+
import { api } from ".";
import { iso8601Regex } from "./test-utils";
diff --git a/apps/server/src/v1/statusReportUpdate.ts b/apps/server/src/v1/statusReportUpdate.ts
index 2d6f12e0e..ccfbdc7c3 100644
--- a/apps/server/src/v1/statusReportUpdate.ts
+++ b/apps/server/src/v1/statusReportUpdate.ts
@@ -37,8 +37,7 @@ export const statusUpdateSchema = z.object({
description: "The status of the update",
}),
id: z.coerce.string().openapi({ description: "The id of the update" }),
- date: isoDate
- .openapi({
+ date: isoDate.openapi({
description: "The date of the update in ISO8601 format",
}),
message: z.string().openapi({
@@ -53,8 +52,7 @@ const createStatusReportUpdateSchema = z.object({
status: z.enum(statusReportStatus).openapi({
description: "The status of the update",
}),
- date: isoDate
- .openapi({
+ date: isoDate.openapi({
description: "The date of the update in ISO8601 format",
}),
message: z.string().openapi({
diff --git a/apps/server/src/v1/test-utils.ts b/apps/server/src/v1/test-utils.ts
index 4ec5b39f4..bd7a2f6f8 100644
--- a/apps/server/src/v1/test-utils.ts
+++ b/apps/server/src/v1/test-utils.ts
@@ -1 +1,2 @@
-export const iso8601Regex: RegExp = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?Z$/;
\ No newline at end of file
+export const iso8601Regex: RegExp =
+ /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?Z$/;
diff --git a/apps/server/src/v1/utils.ts b/apps/server/src/v1/utils.ts
index c1308f237..4a1a8c8eb 100644
--- a/apps/server/src/v1/utils.ts
+++ b/apps/server/src/v1/utils.ts
@@ -1,7 +1,8 @@
+import { z } from "@hono/zod-openapi";
+
import { db, eq } from "@openstatus/db";
import { selectWorkspaceSchema, workspace } from "@openstatus/db/src/schema";
import { allPlans } from "@openstatus/plans";
-import { z } from "@hono/zod-openapi";
/**
* TODO: move the plan limit into the Unkey `{ meta }` to avoid an additional db call.
@@ -12,13 +13,12 @@ import { z } from "@hono/zod-openapi";
* That remindes me we need to downgrade the frequency/periodicity of monitors to 10m if the user downgrades their plan.
*/
-export const isoDate = z
-.preprocess((val) => {
+export const isoDate = z.preprocess((val) => {
if (val) {
return new Date(String(val)).toISOString();
}
return new Date().toISOString();
-}, z.string())
+}, z.string());
export async function getWorkspace(id: number) {
const _workspace = await db