feat(apihits): so i can see if what end points are being used and when and how often

This commit is contained in:
2025-05-15 20:55:17 -05:00
parent 12ea23c9fb
commit 9d9a2683fa
86 changed files with 15710 additions and 496 deletions

View File

@@ -4,6 +4,7 @@ import { authMiddleware } from "../../../auth/middleware/authMiddleware.js";
import { responses } from "../../../../globalUtils/routeDefs/responses.js";
import { tryCatch } from "../../../../globalUtils/tryCatch.js";
import { printerCycle } from "../../controller/printers/printerCycle.js";
import { apiHit } from "../../../../globalUtils/apiHits.js";
const app = new OpenAPIHono({ strict: false });
@@ -22,6 +23,7 @@ app.openapi(
}),
async (c) => {
const { data, error } = await tryCatch(printerCycle());
apiHit(c, { endpoint: "/startsprintercycle" });
const dataError: any = error;
if (error) {
return c.json({

View File

@@ -4,6 +4,7 @@ import { authMiddleware } from "../../../auth/middleware/authMiddleware.js";
import { responses } from "../../../../globalUtils/routeDefs/responses.js";
import { tryCatch } from "../../../../globalUtils/tryCatch.js";
import { stopPrinterCycle } from "../../controller/printers/printerCycle.js";
import { apiHit } from "../../../../globalUtils/apiHits.js";
const app = new OpenAPIHono({ strict: false });
@@ -22,6 +23,7 @@ app.openapi(
}),
async (c) => {
const { data, error } = await tryCatch(stopPrinterCycle());
apiHit(c, { endpoint: "/stopprintercycle" });
const dataError: any = error;
if (error) {
return c.json({

View File

@@ -3,6 +3,7 @@ import { createRoute, OpenAPIHono, z } from "@hono/zod-openapi";
import { responses } from "../../../../globalUtils/routeDefs/responses.js";
import { tryCatch } from "../../../../globalUtils/tryCatch.js";
import { getPrinters } from "../../controller/printers/getPrinters.js";
import { apiHit } from "../../../../globalUtils/apiHits.js";
const app = new OpenAPIHono({ strict: false });
const CreateLog = z.object({
@@ -32,6 +33,7 @@ app.openapi(
const { data: printData, error: printError } = await tryCatch(
getPrinters()
);
apiHit(c, { endpoint: "/getprinters" });
if (printError) {
return c.json({

View File

@@ -4,6 +4,7 @@ import { authMiddleware } from "../../../auth/middleware/authMiddleware.js";
import { responses } from "../../../../globalUtils/routeDefs/responses.js";
import { tryCatch } from "../../../../globalUtils/tryCatch.js";
import { printerCycle } from "../../controller/printers/printerCycle.js";
import { apiHit } from "../../../../globalUtils/apiHits.js";
const app = new OpenAPIHono({ strict: false });
@@ -22,6 +23,7 @@ app.openapi(
}),
async (c) => {
const { data, error } = await tryCatch(printerCycle());
apiHit(c, { endpoint: "/startsprintercycle" });
const dataError: any = error;
if (error) {
return c.json({

View File

@@ -4,6 +4,7 @@ import { authMiddleware } from "../../../auth/middleware/authMiddleware.js";
import { responses } from "../../../../globalUtils/routeDefs/responses.js";
import { tryCatch } from "../../../../globalUtils/tryCatch.js";
import { stopPrinterCycle } from "../../controller/printers/printerCycle.js";
import { apiHit } from "../../../../globalUtils/apiHits.js";
const app = new OpenAPIHono({ strict: false });
@@ -22,6 +23,7 @@ app.openapi(
}),
async (c) => {
const { data, error } = await tryCatch(stopPrinterCycle());
apiHit(c, { endpoint: "/stopprintercycle" });
const dataError: any = error;
if (error) {
return c.json({

View File

@@ -3,6 +3,7 @@ import { createRoute, OpenAPIHono, z } from "@hono/zod-openapi";
import { responses } from "../../../../globalUtils/routeDefs/responses.js";
import { tryCatch } from "../../../../globalUtils/tryCatch.js";
import { updatePrinters } from "../../controller/printers/updatePrinters.js";
import { apiHit } from "../../../../globalUtils/apiHits.js";
const app = new OpenAPIHono({ strict: false });
const CreateLog = z.object({
@@ -32,6 +33,7 @@ app.openapi(
const { data: printData, error: printError } = await tryCatch(
updatePrinters()
);
apiHit(c, { endpoint: "/updateprinters" });
if (printError) {
return c.json({