summaryrefslogtreecommitdiff
path: root/lib/tech-vendors
diff options
context:
space:
mode:
authordujinkim <dujin.kim@dtsolution.co.kr>2025-06-16 01:11:01 +0000
committerdujinkim <dujin.kim@dtsolution.co.kr>2025-06-16 01:11:01 +0000
commitfa6a6093014c5d60188edfc9c4552e81c4b97bd1 (patch)
tree6f55a45a0991de354fca565d1385665779c5ae90 /lib/tech-vendors
parentb63d886613707c99cb4b244c8442860c2a15af69 (diff)
(최겸) 기술영업 벤더 add 서버액션 수정
Diffstat (limited to 'lib/tech-vendors')
-rw-r--r--lib/tech-vendors/service.ts12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/tech-vendors/service.ts b/lib/tech-vendors/service.ts
index 7513a283..05ec1178 100644
--- a/lib/tech-vendors/service.ts
+++ b/lib/tech-vendors/service.ts
@@ -1420,7 +1420,7 @@ export async function addTechVendor(input: {
// 이미 존재하는 유저인지 확인
const existingUser = await tx.query.users.findFirst({
where: eq(users.email, input.email),
- columns: { id: true }
+ columns: { id: true, techCompanyId: true }
});
let userId = null;
@@ -1435,7 +1435,15 @@ export async function addTechVendor(input: {
userId = newUser.id;
console.log("유저 생성 성공:", userId);
} else {
- console.log("이미 존재하는 유저:", existingUser.id);
+ // 이미 존재하는 유저의 techCompanyId가 null인 경우 업데이트
+ if (!existingUser.techCompanyId) {
+ await tx.update(users)
+ .set({ techCompanyId: newVendor.id })
+ .where(eq(users.id, existingUser.id));
+ console.log("기존 유저의 techCompanyId 업데이트:", existingUser.id);
+ }
+ userId = existingUser.id;
+ console.log("이미 존재하는 유저:", userId);
}
return { vendor: newVendor, userId };