summaryrefslogtreecommitdiff
path: root/db/schema/procurementRFQ.ts
blob: 2756f93474a9c8a7249243afc412fde3e999ec3d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { pgTable, varchar, timestamp, boolean } from "drizzle-orm/pg-core";

/**
 * 지불조건, 인코텀즈, 선적/하역(출발지, 도착지) 테이블은 Non-SAP에서 동기화 (Oracle DB to PostgreSQL)
 * 동기화 로직은 instrumentation.ts 에서 node-cron 을 통해 job으로 등록됨
 */

// 지불조건 테이블 (Non-SAP 에서 동기화)
export const paymentTerms = pgTable("payment_terms", {
  code: varchar("code", { length: 50 }).primaryKey(),
  description: varchar("description", { length: 255 }).notNull(),
  // days: integer("days").notNull(),
  isActive: boolean("is_active").default(true).notNull(),
  createdAt: timestamp("created_at").defaultNow().notNull(),
});

// 인코텀즈 테이블 (Non-SAP 에서 동기화)
export const incoterms = pgTable("incoterms", {
  code: varchar("code", { length: 20 }).primaryKey(),
  description: varchar("description", { length: 255 }).notNull(),
  isActive: boolean("is_active").default(true).notNull(),
  createdAt: timestamp("created_at").defaultNow().notNull(),
});

// 선적/하역 테이블 (Non-SAP 에서 동기화)
export const placeOfShipping = pgTable("place_of_shipping", {
  code: varchar("code", { length: 20 }).primaryKey(),
  description: varchar("description", { length: 255 }).notNull(),
  isActive: boolean("is_active").default(true).notNull(),
  createdAt: timestamp("created_at").defaultNow().notNull(),
});

export type Incoterm = typeof incoterms.$inferSelect;