From 06064536f55e596b65c1b019ae1b84e7b13b6cb4 Mon Sep 17 00:00:00 2001 From: joonhoekim <26rote@gmail.com> Date: Wed, 17 Sep 2025 19:52:04 +0900 Subject: (김준회) 리팩터링: countryDialCodes 별도 파일 추출 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/vendors/validations.ts | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) (limited to 'lib/vendors') diff --git a/lib/vendors/validations.ts b/lib/vendors/validations.ts index 54b5a29b..d1902866 100644 --- a/lib/vendors/validations.ts +++ b/lib/vendors/validations.ts @@ -8,8 +8,9 @@ import { import * as z from "zod" import { getFiltersStateParser, getSortingStateParser } from "@/lib/parsers" -import { Vendor, VendorContact, VendorItemsView, VendorMaterialsView, vendors, VendorWithType } from "@/db/schema/vendors"; +import { VendorContact, VendorItemsView, VendorMaterialsView, vendors, VendorWithType } from "@/db/schema/vendors"; import { rfqs } from "@/db/schema/rfq" +import { countryDialCodes } from '@/components/common/country-dial-codes'; export const searchParamsCache = createSearchParamsCache({ @@ -117,7 +118,6 @@ export const searchParamsItemCache = createSearchParamsCache({ const creditAgencyEnum = z.enum(["NICE", "KIS", "KED", "SCI"]); export type CreditAgencyType = z.infer; - export const updateVendorSchema = z.object({ vendorName: z.string().min(1, "업체명은 필수 입력사항입니다"), vendorCode: z.string().optional(), @@ -314,13 +314,7 @@ export const createVendorSchema = z message: "올바른 한국 전화번호 형식이 아닙니다. +82로 시작하거나 010으로 시작하는 번호를 입력해주세요.", }); } - if (!data.corporateRegistrationNumber) { - ctx.addIssue({ - code: "custom", - path: ["corporateRegistrationNumber"], - message: "법인등록번호는 한국(KR) 업체일 경우 필수입니다.", - }); - } + // 법인등록번호는 선택사항으로 변경됨 } // Validate contact phone numbers @@ -486,14 +480,8 @@ export const updateVendorSchemaWithConditions = updateVendorInfoSchema.superRefi path: ["representativePhone"], }) } - - if (!data.corporateRegistrationNumber) { - ctx.addIssue({ - code: z.ZodIssueCode.custom, - message: "법인등록번호는 필수 입력사항입니다.", - path: ["corporateRegistrationNumber"], - }) - } + + // 법인등록번호는 선택사항으로 변경됨 // 신용평가사가 선택된 경우, 등급 정보 필수 if (data.creditAgency) { -- cgit v1.2.3