test(notification): added framework for managment tab

This commit is contained in:
2025-04-14 12:27:45 -05:00
parent 17773e9a23
commit ae7ea2bb90
6 changed files with 143 additions and 16 deletions

View File

@@ -0,0 +1,44 @@
// an external way to creating logs
import { createRoute, OpenAPIHono, z } from "@hono/zod-openapi";
//import { apiHit } from "../../../globalUtils/apiHits.js";
import { responses } from "../../../globalUtils/routeDefs/responses.js";
import { getNotifications } from "../controller/getNotifications.js";
import { tryCatch } from "../../../globalUtils/tryCatch.js";
const app = new OpenAPIHono({ strict: false });
app.openapi(
createRoute({
tags: ["notify"],
summary: "Gets notifications.",
method: "get",
path: "/notifications",
// description:
// "This might be a temp soltuin during the transtion between versions",
responses: responses(),
}),
async (c: any) => {
//apiHit(c, { endpoint: `api/logger/logs` });
const { data, error } = await tryCatch(getNotifications());
if (error) {
return c.json(
{
success: false,
message: "There was an error clearing the log.",
data: error,
},
400
);
}
return c.json(
{
success: data?.success,
message: data?.message,
data: data?.data,
},
200
);
}
);
export default app;