feat(apihits): so i can see if what end points are being used and when and how often
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
import { createRoute, OpenAPIHono, z } from "@hono/zod-openapi";
|
||||
import { responses } from "../../../globalUtils/routeDefs/responses.js";
|
||||
import { getAllJobs } from "../utils/processNotifications.js";
|
||||
import { apiHit } from "../../../globalUtils/apiHits.js";
|
||||
|
||||
const app = new OpenAPIHono({ strict: false });
|
||||
|
||||
@@ -15,6 +16,7 @@ app.openapi(
|
||||
responses: responses(),
|
||||
}),
|
||||
async (c) => {
|
||||
apiHit(c, { endpoint: "/activenotifications" });
|
||||
const jobs = getAllJobs();
|
||||
return c.json({
|
||||
success: true,
|
||||
|
||||
@@ -4,6 +4,7 @@ import { createRoute, OpenAPIHono, z } from "@hono/zod-openapi";
|
||||
import { responses } from "../../../globalUtils/routeDefs/responses.js";
|
||||
import { getNotifications } from "../controller/getNotifications.js";
|
||||
import { tryCatch } from "../../../globalUtils/tryCatch.js";
|
||||
import { apiHit } from "../../../globalUtils/apiHits.js";
|
||||
|
||||
const app = new OpenAPIHono({ strict: false });
|
||||
|
||||
@@ -18,7 +19,7 @@ app.openapi(
|
||||
responses: responses(),
|
||||
}),
|
||||
async (c: any) => {
|
||||
//apiHit(c, { endpoint: `api/logger/logs` });
|
||||
apiHit(c, { endpoint: "/notifications" });
|
||||
const { data, error } = await tryCatch(getNotifications());
|
||||
|
||||
if (error) {
|
||||
|
||||
@@ -3,6 +3,7 @@ import { createRoute, OpenAPIHono, z } from "@hono/zod-openapi";
|
||||
import { responses } from "../../../globalUtils/routeDefs/responses.js";
|
||||
|
||||
import runTiImport from "../controller/notifications/tiIntergration.js";
|
||||
import { apiHit } from "../../../globalUtils/apiHits.js";
|
||||
|
||||
const app = new OpenAPIHono({ strict: false });
|
||||
|
||||
@@ -16,6 +17,7 @@ app.openapi(
|
||||
responses: responses(),
|
||||
}),
|
||||
async (c) => {
|
||||
apiHit(c, { endpoint: "/tiTrigger" });
|
||||
const tiImport = await runTiImport();
|
||||
return c.json({
|
||||
success: tiImport?.success,
|
||||
|
||||
@@ -8,6 +8,7 @@ import { tryCatch } from "../../../globalUtils/tryCatch.js";
|
||||
import { notifications } from "../../../../database/schema/notifications.js";
|
||||
import { db } from "../../../../database/dbclient.js";
|
||||
import { eq } from "drizzle-orm";
|
||||
import { apiHit } from "../../../globalUtils/apiHits.js";
|
||||
|
||||
const app = new OpenAPIHono({ strict: false });
|
||||
|
||||
@@ -24,7 +25,7 @@ app.openapi(
|
||||
/**
|
||||
* get the blocking notification stuff
|
||||
*/
|
||||
|
||||
apiHit(c, { endpoint: "/blockingTrigger" });
|
||||
const { data, error } = await tryCatch(
|
||||
db
|
||||
.select()
|
||||
|
||||
@@ -4,6 +4,7 @@ import { responses } from "../../../globalUtils/routeDefs/responses.js";
|
||||
import { authMiddleware } from "../../auth/middleware/authMiddleware.js";
|
||||
import { sendEmail } from "../controller/sendMail.js";
|
||||
import { tryCatch } from "../../../globalUtils/tryCatch.js";
|
||||
import { apiHit } from "../../../globalUtils/apiHits.js";
|
||||
|
||||
const app = new OpenAPIHono({ strict: false });
|
||||
|
||||
@@ -41,6 +42,7 @@ app.openapi(
|
||||
const { data: bodyData, error: bodyError } = await tryCatch(
|
||||
c.req.json()
|
||||
);
|
||||
apiHit(c, { endpoint: "/sendmail", lastBody: bodyData });
|
||||
if (bodyError) {
|
||||
return c.json(
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user