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

@@ -1,21 +1,30 @@
import {pgTable, text, timestamp} from "drizzle-orm/pg-core";
import {createSelectSchema} from "drizzle-zod";
import {
integer,
jsonb,
pgTable,
text,
timestamp,
uniqueIndex,
uuid,
} from "drizzle-orm/pg-core";
import { createSelectSchema } from "drizzle-zod";
export const apiHits = pgTable(
"apiHits",
{
apiHit_id: uuid("apiHit_id").defaultRandom().primaryKey(),
ip: text("ip"),
endpoint: text("endpoint"),
action: text("action"),
lastBody: text("lastBody"),
stats: text("stats"),
lastBody: jsonb("lastBody"),
stats: integer("stats").default(1),
add_date: timestamp().defaultNow(),
upd_date: timestamp().defaultNow(),
}
// (table) => [
// // uniqueIndex('emailUniqueIndex').on(sql`lower(${table.email})`),
// uniqueIndex("role_name").on(table.name),
// ]
},
(table) => [
// uniqueIndex('emailUniqueIndex').on(sql`lower(${table.email})`),
uniqueIndex("endpoint").on(table.endpoint, table.ip),
]
);
// Schema for inserting a user - can be used to validate API requests