feat(labelratio): new feature to monitor label ratio from auto and manual

this was designed more for dayton but could be used for all plants
This commit is contained in:
2025-07-14 10:18:23 -05:00
parent d6232cb358
commit 41308788fd
8 changed files with 156 additions and 2 deletions

32
database/schema/ratios.ts Normal file
View File

@@ -0,0 +1,32 @@
import {
integer,
jsonb,
pgTable,
text,
timestamp,
uniqueIndex,
uuid,
} from "drizzle-orm/pg-core";
import { createSelectSchema } from "drizzle-zod";
export const labelRatio = pgTable(
"labelRatio",
{
ratio_id: uuid(" ratio_id").defaultRandom().primaryKey(),
name: text("name").default("labels"),
autoLabel: integer("autoLabel").default(1),
manualLabel: integer("manualLabel").default(1),
lastReset: timestamp().defaultNow(),
},
(table) => [
// uniqueIndex('emailUniqueIndex').on(sql`lower(${table.email})`),
uniqueIndex("labelname").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(labelRatio);