summaryrefslogtreecommitdiff
path: root/lib/projects/service.ts
diff options
context:
space:
mode:
authordujinkim <dujin.kim@dtsolution.co.kr>2025-09-30 10:08:53 +0000
committerdujinkim <dujin.kim@dtsolution.co.kr>2025-09-30 10:08:53 +0000
commit2c02afd48a4d9276a4f5c132e088540a578d0972 (patch)
treee5efdd3f48fad33681c139a4c58481f4514fb38e /lib/projects/service.ts
parent19794b32a6e3285fdeda7519ededdce451966f3d (diff)
(대표님) 폼리스트, spreadjs 관련 변경사항, 벤더문서 뷰 쿼리 수정, 이메일 템플릿 추가 등
Diffstat (limited to 'lib/projects/service.ts')
-rw-r--r--lib/projects/service.ts23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/projects/service.ts b/lib/projects/service.ts
index 3f562e20..4685fce4 100644
--- a/lib/projects/service.ts
+++ b/lib/projects/service.ts
@@ -112,4 +112,27 @@ export async function getAllProjectInfoByProjectCode(projectCode: string) {
.from(projects)
.where(eq(projects.code, projectCode))
.limit(1);
+}
+
+/**
+ * projectId로 프로젝트 코드를 가져오는 함수
+ * @param projectId - 프로젝트 ID
+ * @returns 프로젝트 코드 또는 null
+ */
+export async function getProjectCode(projectId: number): Promise<string | null> {
+ try {
+ const project = await db.project.findUnique({
+ where: {
+ id: projectId,
+ },
+ select: {
+ code: true,
+ },
+ })
+
+ return project?.code || null
+ } catch (error) {
+ console.error("Error fetching project code:", error)
+ return null
+ }
} \ No newline at end of file