test(apihits): framework for apiHits to be implemented but no db insert yet
This commit is contained in:
26
database/schema/apiHits.ts
Normal file
26
database/schema/apiHits.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import {pgTable, text, timestamp} from "drizzle-orm/pg-core";
|
||||
import {createSelectSchema} from "drizzle-zod";
|
||||
|
||||
export const apiHits = pgTable(
|
||||
"apiHits",
|
||||
{
|
||||
ip: text("ip"),
|
||||
endpoint: text("endpoint"),
|
||||
action: text("action"),
|
||||
lastBody: text("lastBody"),
|
||||
stats: text("stats"),
|
||||
add_date: timestamp().defaultNow(),
|
||||
upd_date: timestamp().defaultNow(),
|
||||
}
|
||||
// (table) => [
|
||||
// // uniqueIndex('emailUniqueIndex').on(sql`lower(${table.email})`),
|
||||
// uniqueIndex("role_name").on(table.name),
|
||||
// ]
|
||||
);
|
||||
|
||||
// Schema for inserting a user - can be used to validate API requests
|
||||
// export const insertRolesSchema = createInsertSchema(roles, {
|
||||
// name: z.string().min(3, {message: "Role name must be more than 3 letters"}),
|
||||
// });
|
||||
// Schema for selecting a Expenses - can be used to validate API responses
|
||||
export const selectRolesSchema = createSelectSchema(apiHits);
|
||||
Reference in New Issue
Block a user