summaryrefslogtreecommitdiff
path: root/lib/items-tech
diff options
context:
space:
mode:
authordujinkim <dujin.kim@dtsolution.co.kr>2025-05-28 12:26:28 +0000
committerdujinkim <dujin.kim@dtsolution.co.kr>2025-05-28 12:26:28 +0000
commit36dd60ca6fce7712b35e6d7c1b9602710f442ada (patch)
tree32c3f6e2eef53b565d545535b10b7980ad184883 /lib/items-tech
parent2caa8093ac616f14d48430ce2f485f805d6faa53 (diff)
(최겸) 기술영업 해양 rfq 개발v1
Diffstat (limited to 'lib/items-tech')
-rw-r--r--lib/items-tech/repository.ts7
-rw-r--r--lib/items-tech/service.ts10
2 files changed, 15 insertions, 2 deletions
diff --git a/lib/items-tech/repository.ts b/lib/items-tech/repository.ts
index 43e88866..1f4f7933 100644
--- a/lib/items-tech/repository.ts
+++ b/lib/items-tech/repository.ts
@@ -1,6 +1,6 @@
// src/lib/items/repository.ts
import db from "@/db/db";
-import { Item, items } from "@/db/schema/items";
+import { Item, ItemOffshoreTop, ItemOffshoreHull, itemOffshoreHull, itemOffshoreTop, items } from "@/db/schema/items";
import {
eq,
inArray,
@@ -117,3 +117,8 @@ export async function updateItems(
export async function findAllItems(): Promise<Item[]> {
return db.select().from(items).orderBy(asc(items.itemCode));
}
+export async function findAllOffshoreItems(): Promise<(ItemOffshoreHull | ItemOffshoreTop)[]> {
+ const hullItems = await db.select().from(itemOffshoreHull);
+ const topItems = await db.select().from(itemOffshoreTop);
+ return [...hullItems, ...topItems];
+}
diff --git a/lib/items-tech/service.ts b/lib/items-tech/service.ts
index 62a66aaa..70c664f3 100644
--- a/lib/items-tech/service.ts
+++ b/lib/items-tech/service.ts
@@ -10,8 +10,9 @@ import { getErrorMessage } from "@/lib/handle-error";
import { asc, desc, ilike, and, or, eq, count, inArray, sql } from "drizzle-orm";
import { GetItemsSchema, UpdateItemSchema, ShipbuildingItemCreateData, TypedItemCreateData, OffshoreTopItemCreateData, OffshoreHullItemCreateData } from "./validations";
-import { Item, items, itemShipbuilding, itemOffshoreTop, itemOffshoreHull } from "@/db/schema/items";
+import { Item, items, itemShipbuilding, itemOffshoreTop, itemOffshoreHull, ItemOffshoreTop, ItemOffshoreHull } from "@/db/schema/items";
import { findAllItems } from "./repository";
+import { findAllOffshoreItems } from "./repository";
/* -----------------------------------------------------
1) 조회 관련
@@ -1000,3 +1001,10 @@ export async function getAllShipbuildingItems(): Promise<Item[]> {
throw new Error("Failed to get items");
}
}
+export async function getAllOffshoreItems(): Promise<(ItemOffshoreHull | ItemOffshoreTop)[]> {
+ try {
+ return await findAllOffshoreItems();
+ } catch (err) {
+ throw new Error("Failed to get items");
+ }
+}