refactor(rfid tags): update tag table to include what is needed and changed columns to be correct

This commit is contained in:
2025-03-16 15:33:20 -05:00
parent 020fdc83af
commit d178e04362

View File

@@ -1,4 +1,4 @@
import {text, pgTable, numeric, index, timestamp, boolean, uuid, uniqueIndex, jsonb} from "drizzle-orm/pg-core";
import {text, pgTable, timestamp, uuid, uniqueIndex, jsonb, integer} from "drizzle-orm/pg-core";
import {createInsertSchema, createSelectSchema} from "drizzle-zod";
import {z} from "zod";
@@ -9,9 +9,11 @@ export const rfidTags = pgTable(
tagHex: text("tagHex"),
tag: text("tag"),
lastRead: timestamp("timeStamp").defaultNow(),
counts: jsonb("counts").notNull(), //.default([{area: 1, timesHere: 5}]).notNull(),
counts: jsonb("counts").default([]), // example [{area: Line3.2, count: 1}, {area: line3.1, count: 6}]
lastareaIn: text("lastareaIn").notNull(),
runningNumber: numeric("runningNumber").notNull(),
runningNumber: integer("runningNumber"),
antenna: integer("antenna"),
tagStrength: integer("tagStrength"),
created_at: timestamp("created_at").defaultNow(),
},
(table) => [
@@ -21,8 +23,8 @@ export const rfidTags = pgTable(
);
// 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"}),
// });
export const insertRolesSchema = createInsertSchema(rfidTags, {
tagHex: z.string().min(3, {message: "Tag Should have more than 3 characters"}),
});
// Schema for selecting a Expenses - can be used to validate API responses
export const selectRolesSchema = createSelectSchema(rfidTags);