feat(app): order schdeuler
This commit is contained in:
51
app/src/pkg/db/schema/orderScheduler.ts
Normal file
51
app/src/pkg/db/schema/orderScheduler.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
import {
|
||||
boolean,
|
||||
date,
|
||||
integer,
|
||||
pgTable,
|
||||
real,
|
||||
text,
|
||||
timestamp,
|
||||
uniqueIndex,
|
||||
uuid,
|
||||
} from "drizzle-orm/pg-core";
|
||||
import type z from "zod";
|
||||
|
||||
export const orderScheduler = pgTable(
|
||||
"orderScheduler",
|
||||
{
|
||||
schedule_id: uuid("schedule_id").defaultRandom().primaryKey(),
|
||||
av: integer("av"),
|
||||
description: text("description"),
|
||||
orderType: text("order_type").notNull(), //orders || incoming
|
||||
orderNumber: integer("order_number").notNull(),
|
||||
header: text("header").notNull(),
|
||||
lineItemNumber: text("line_item_number"),
|
||||
customerReleaseNumber: text("customer_release_number"),
|
||||
deliveryDate: timestamp("delivery_date").notNull(),
|
||||
loadingDate: timestamp("loading_date"),
|
||||
orderQTY: real("order_qty").notNull(),
|
||||
orderLu: real("order_lu").notNull(),
|
||||
deliveredQTY: real("delivered_qty").default(0.0),
|
||||
deliveredLu: real("delivered_lu").default(0.0),
|
||||
remark: text("remark"),
|
||||
createdAsEDI: boolean("created_as_EDI"),
|
||||
currentState: integer("current_state"),
|
||||
lstDateCheck: timestamp("lst_date_check"), //this will match the delivery date to start and when moved in the front end run a function to alert or update via api
|
||||
customerAddressId: integer("customer_address_id"),
|
||||
customerDescription: text("customer_description"),
|
||||
dock: text("dock"),
|
||||
orderFrom: text("order_from"), // manual or prod.
|
||||
// being edited change to true so it will essential lock all others from editing
|
||||
// carrier
|
||||
// carrier email. -- when dropped we can email the carrier this could be considered there confirmation.
|
||||
addDate: timestamp("add_date").defaultNow(),
|
||||
updDate: timestamp("upd_date").defaultNow(),
|
||||
},
|
||||
(table) => [
|
||||
// uniqueIndex('emailUniqueIndex').on(sql`lower(${table.email})`),
|
||||
uniqueIndex("orderNumber").on(table.orderNumber),
|
||||
],
|
||||
);
|
||||
|
||||
export type OrderScheduler = z.infer<typeof orderScheduler>;
|
||||
Reference in New Issue
Block a user