diff options
| author | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-05-14 06:12:13 +0000 |
|---|---|---|
| committer | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-05-14 06:12:13 +0000 |
| commit | d0d2eaa2de58a0c33e9a21604b126961403cd69e (patch) | |
| tree | f66cd3c8d3a123ff04f800b4b868c573fab2da95 /db/schema/items.ts | |
| parent | 21d8148fc5b1234cd4523e66ccaa8971ad104560 (diff) | |
(최겸) 기술영업 조선, 해양Top, 해양 Hull 아이템 리스트 개발(CRUD, excel import/export/template)
Diffstat (limited to 'db/schema/items.ts')
| -rw-r--r-- | db/schema/items.ts | 57 |
1 files changed, 56 insertions, 1 deletions
diff --git a/db/schema/items.ts b/db/schema/items.ts index 9279b580..4218f0f4 100644 --- a/db/schema/items.ts +++ b/db/schema/items.ts @@ -19,6 +19,12 @@ export const itemsRelations = relations(items, ({ many }) => ({ // 조선 기능(공종) 유형 enum 정의 export const workTypeEnum = pgEnum('work_type', ['기장', '전장', '선실', '배관', '철의']); +// 해양 TOP 기능(공종) 유형 enum 정의 +export const offshoreTopWorkTypeEnum = pgEnum('offshore_top_work_type', ['TM', 'TS', 'TE', 'TP']); + +// 해양 HULL 기능(공종) 유형 enum 정의 +export const offshoreHullWorkTypeEnum = pgEnum('offshore_hull_work_type', ['HA', 'HE', 'HH', 'HM', 'NC']); + //조선 아이템 테이블 //아이템코드(:자재그룹코드), 아이템이름(:아이템리스트), 공종(:workType), 선종, createdAt(:생성일), updatedAt(:수정일) export const itemShipbuilding = pgTable("item_shipbuilding", { @@ -26,6 +32,8 @@ export const itemShipbuilding = pgTable("item_shipbuilding", { itemId: integer("item_id").notNull().references(() => items.id, { onDelete: 'cascade' }), workType: workTypeEnum("work_type").notNull(), shipTypes: text("ship_types").notNull().default('A-MAX'), + createdAt: timestamp("created_at").defaultNow().notNull(), + updatedAt: timestamp("updated_at").defaultNow().notNull(), }); @@ -40,4 +48,51 @@ export const itemShipbuildingRelations = relations(itemShipbuilding, ({ one }) = export type ItemShipbuilding = typeof itemShipbuilding.$inferSelect; -export type ItemWithShipbuilding = Item & ItemShipbuilding;
\ No newline at end of file +export type ItemWithShipbuilding = Item & ItemShipbuilding; + +//해양 TOP 아이템 테이블 +export const itemOffshoreTop = pgTable("item_offshore_top", { + id: serial("id").primaryKey(), + itemId: integer("item_id").notNull().references(() => items.id, { onDelete: 'cascade' }), + workType: offshoreTopWorkTypeEnum("work_type").notNull(), + itemList1: text("item_list1"), + itemList2: text("item_list2"), + itemList3: text("item_list3"), + itemList4: text("item_list4"), + createdAt: timestamp("created_at").defaultNow().notNull(), + updatedAt: timestamp("updated_at").defaultNow().notNull(), +}); + +//해양 HULL 아이템 테이블 +export const itemOffshoreHull = pgTable("item_offshore_hull", { + id: serial("id").primaryKey(), + itemId: integer("item_id").notNull().references(() => items.id, { onDelete: 'cascade' }), + workType: offshoreHullWorkTypeEnum("work_type").notNull(), + itemList1: text("item_list1"), + itemList2: text("item_list2"), + itemList3: text("item_list3"), + itemList4: text("item_list4"), + createdAt: timestamp("created_at").defaultNow().notNull(), + updatedAt: timestamp("updated_at").defaultNow().notNull(), +}); + +//해양 TOP 아이템 관계 정의 +export const itemOffshoreTopRelations = relations(itemOffshoreTop, ({ one }) => ({ + item: one(items, { + fields: [itemOffshoreTop.itemId], + references: [items.id], + }), +})); + +//해양 HULL 아이템 관계 정의 +export const itemOffshoreHullRelations = relations(itemOffshoreHull, ({ one }) => ({ + item: one(items, { + fields: [itemOffshoreHull.itemId], + references: [items.id], + }), +})); + +export type ItemOffshoreTop = typeof itemOffshoreTop.$inferSelect; +export type ItemOffshoreHull = typeof itemOffshoreHull.$inferSelect; +export type ItemWithOffshoreTop = Item & ItemOffshoreTop; +export type ItemWithOffshoreHull = Item & ItemOffshoreHull;
\ No newline at end of file |
