summaryrefslogtreecommitdiff
path: root/lib/vendor-regular-registrations/approval-actions.ts
diff options
context:
space:
mode:
Diffstat (limited to 'lib/vendor-regular-registrations/approval-actions.ts')
-rw-r--r--lib/vendor-regular-registrations/approval-actions.ts14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/vendor-regular-registrations/approval-actions.ts b/lib/vendor-regular-registrations/approval-actions.ts
index 02c7e412..298591e9 100644
--- a/lib/vendor-regular-registrations/approval-actions.ts
+++ b/lib/vendor-regular-registrations/approval-actions.ts
@@ -11,6 +11,9 @@ import { withApproval } from '@/lib/approval/approval-workflow';
import { mapRegistrationToTemplateVariables } from './handlers';
import { debugLog, debugError, debugSuccess } from '@/lib/debug-utils';
import type { RegistrationRequestData } from '@/components/vendor-regular-registrations/registration-request-dialog';
+import db from '@/db/db';
+import { eq } from 'drizzle-orm';
+import { vendorRegularRegistrations } from '@/db/schema/vendorRegistrations';
/**
* 결재를 거쳐 정규업체 등록을 처리하는 서버 액션
@@ -90,6 +93,17 @@ export async function registerVendorWithApproval(data: {
}
);
+ // 3. 결재 상신 성공 시 상태를 pending_approval로 변경
+ if (result.status === 'pending_approval') {
+ debugLog('[VendorRegistrationApproval] 상태를 pending_approval로 변경');
+ await db.update(vendorRegularRegistrations)
+ .set({
+ status: 'pending_approval',
+ updatedAt: new Date()
+ })
+ .where(eq(vendorRegularRegistrations.id, data.registrationId));
+ }
+
debugSuccess('[VendorRegistrationApproval] 결재 워크플로우 완료', {
approvalId: result.approvalId,
status: result.status,