refactor(rfid tags): update tag table to include what is needed and changed columns to be correct
This commit is contained in:
@@ -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 {createInsertSchema, createSelectSchema} from "drizzle-zod";
|
||||||
import {z} from "zod";
|
import {z} from "zod";
|
||||||
|
|
||||||
@@ -9,9 +9,11 @@ export const rfidTags = pgTable(
|
|||||||
tagHex: text("tagHex"),
|
tagHex: text("tagHex"),
|
||||||
tag: text("tag"),
|
tag: text("tag"),
|
||||||
lastRead: timestamp("timeStamp").defaultNow(),
|
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(),
|
lastareaIn: text("lastareaIn").notNull(),
|
||||||
runningNumber: numeric("runningNumber").notNull(),
|
runningNumber: integer("runningNumber"),
|
||||||
|
antenna: integer("antenna"),
|
||||||
|
tagStrength: integer("tagStrength"),
|
||||||
created_at: timestamp("created_at").defaultNow(),
|
created_at: timestamp("created_at").defaultNow(),
|
||||||
},
|
},
|
||||||
(table) => [
|
(table) => [
|
||||||
@@ -21,8 +23,8 @@ export const rfidTags = pgTable(
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Schema for inserting a user - can be used to validate API requests
|
// Schema for inserting a user - can be used to validate API requests
|
||||||
// export const insertRolesSchema = createInsertSchema(roles, {
|
export const insertRolesSchema = createInsertSchema(rfidTags, {
|
||||||
// name: z.string().min(3, {message: "Role name must be more than 3 letters"}),
|
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
|
// Schema for selecting a Expenses - can be used to validate API responses
|
||||||
export const selectRolesSchema = createSelectSchema(rfidTags);
|
export const selectRolesSchema = createSelectSchema(rfidTags);
|
||||||
|
|||||||
Reference in New Issue
Block a user