[refactor] negodata: 도메인 코드값 enum 정비 — 백엔드 정본 + 프론트 생성타입 사용
- 백엔드: 도메인 enum CodeEnum 상속(x-enum-varnames) → orval이 이름 있는 enum 생성. 응답 필드 enum 타입 지정(요청은 int 유지). ENUM_LABELS/DOMAIN_ENUMS·/v1/enums 제거 - 프론트: 생성 enum + 라벨맵으로 교체(매직넘버·발명 어휘 제거), 견적·세션 상태 코드화, role/delivery 라벨 프론트 소유 - 동반 정리: unwrap 캐스트·목업(buildSessions·데모)·死코드 제거, mapItem toMinPrice dedupe Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
6fa024137f
commit
eb6612af1c
47 files changed
+501
-581
No files matched your search
@@ -1,124 +0,0 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Negodata Api Server
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import {
|
||||
useQuery
|
||||
} from '@tanstack/react-query';
|
||||
import type {
|
||||
DataTag,
|
||||
DefinedInitialDataOptions,
|
||||
DefinedUseQueryResult,
|
||||
QueryClient,
|
||||
QueryFunction,
|
||||
QueryKey,
|
||||
UndefinedInitialDataOptions,
|
||||
UseQueryOptions,
|
||||
UseQueryResult
|
||||
} from '@tanstack/react-query';
|
||||
|
||||
import type {
|
||||
ResEnums
|
||||
} from '.././model';
|
||||
|
||||
import { customFetch } from '../../mutator/custom-fetch';
|
||||
|
||||
|
||||
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @summary 도메인 코드 enum 전체
|
||||
*/
|
||||
export const listEnums = (
|
||||
|
||||
options?: SecondParameter<typeof customFetch>,signal?: AbortSignal
|
||||
) => {
|
||||
|
||||
|
||||
return customFetch<ResEnums>(
|
||||
{url: `/v1/enums`, method: 'GET', signal
|
||||
},
|
||||
options);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
export const getListEnumsQueryKey = () => {
|
||||
return [
|
||||
`/v1/enums`
|
||||
] as const;
|
||||
}
|
||||
|
||||
|
||||
export const getListEnumsQueryOptions = <TData = Awaited<ReturnType<typeof listEnums>>, TError = void>( options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listEnums>>, TError, TData>>, request?: SecondParameter<typeof customFetch>}
|
||||
) => {
|
||||
|
||||
const {query: queryOptions, request: requestOptions} = options ?? {};
|
||||
|
||||
const queryKey = queryOptions?.queryKey ?? getListEnumsQueryKey();
|
||||
|
||||
|
||||
|
||||
const queryFn: QueryFunction<Awaited<ReturnType<typeof listEnums>>> = ({ signal }) => listEnums(requestOptions, signal);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof listEnums>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
|
||||
}
|
||||
|
||||
export type ListEnumsQueryResult = NonNullable<Awaited<ReturnType<typeof listEnums>>>
|
||||
export type ListEnumsQueryError = void
|
||||
|
||||
|
||||
export function useListEnums<TData = Awaited<ReturnType<typeof listEnums>>, TError = void>(
|
||||
options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof listEnums>>, TError, TData>> & Pick<
|
||||
DefinedInitialDataOptions<
|
||||
Awaited<ReturnType<typeof listEnums>>,
|
||||
TError,
|
||||
Awaited<ReturnType<typeof listEnums>>
|
||||
> , 'initialData'
|
||||
>, request?: SecondParameter<typeof customFetch>}
|
||||
, queryClient?: QueryClient
|
||||
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
|
||||
export function useListEnums<TData = Awaited<ReturnType<typeof listEnums>>, TError = void>(
|
||||
options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listEnums>>, TError, TData>> & Pick<
|
||||
UndefinedInitialDataOptions<
|
||||
Awaited<ReturnType<typeof listEnums>>,
|
||||
TError,
|
||||
Awaited<ReturnType<typeof listEnums>>
|
||||
> , 'initialData'
|
||||
>, request?: SecondParameter<typeof customFetch>}
|
||||
, queryClient?: QueryClient
|
||||
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
|
||||
export function useListEnums<TData = Awaited<ReturnType<typeof listEnums>>, TError = void>(
|
||||
options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listEnums>>, TError, TData>>, request?: SecondParameter<typeof customFetch>}
|
||||
, queryClient?: QueryClient
|
||||
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
|
||||
/**
|
||||
* @summary 도메인 코드 enum 전체
|
||||
*/
|
||||
|
||||
export function useListEnums<TData = Awaited<ReturnType<typeof listEnums>>, TError = void>(
|
||||
options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listEnums>>, TError, TData>>, request?: SecondParameter<typeof customFetch>}
|
||||
, queryClient?: QueryClient
|
||||
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
|
||||
|
||||
const queryOptions = getListEnumsQueryOptions(options)
|
||||
|
||||
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
||||
|
||||
query.queryKey = queryOptions.queryKey ;
|
||||
|
||||
return query;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import type { CardDataName } from './cardDataName';
|
||||
import type { CardDataNumber } from './cardDataNumber';
|
||||
import type { CardDataScript } from './cardDataScript';
|
||||
import type { CardDataEditScript } from './cardDataEditScript';
|
||||
import type { CardStatus } from './cardStatus';
|
||||
import type { CardDataCondition } from './cardDataCondition';
|
||||
import type { CardDataMemo } from './cardDataMemo';
|
||||
import type { CardDataCreatedAt } from './cardDataCreatedAt';
|
||||
@@ -22,7 +23,7 @@ export interface CardData {
|
||||
number?: CardDataNumber;
|
||||
script?: CardDataScript;
|
||||
edit_script?: CardDataEditScript;
|
||||
status?: number;
|
||||
status?: CardStatus;
|
||||
condition?: CardDataCondition;
|
||||
memo?: CardDataMemo;
|
||||
created_at?: CardDataCreatedAt;
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Negodata Api Server
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* nego_cards.status 코드값. 와일드카드의 협상 적용 여부(수동 승인). 일반 협상카드는 상시 ACTIVE.
|
||||
*/
|
||||
export type CardStatus = typeof CardStatus[keyof typeof CardStatus];
|
||||
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
||||
export const CardStatus = {
|
||||
ACTIVE: 1,
|
||||
INACTIVE: 2,
|
||||
} as const;
|
||||
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Negodata Api Server
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* negotiation.chats.card_type / quotation_cards.type 코드값. 1=nego_card, 2=wild_card.
|
||||
*/
|
||||
export type CardType = typeof CardType[keyof typeof CardType];
|
||||
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
||||
export const CardType = {
|
||||
NEGO: 1,
|
||||
WILD: 2,
|
||||
} as const;
|
||||
@@ -5,18 +5,23 @@
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import type { ChatMessageDataCardId } from './chatMessageDataCardId';
|
||||
import type { ChatSender } from './chatSender';
|
||||
import type { ChatMessageDataCardUsedYn } from './chatMessageDataCardUsedYn';
|
||||
import type { ChatMessageDataIndicatorValue } from './chatMessageDataIndicatorValue';
|
||||
import type { ChatMessageDataCardType } from './chatMessageDataCardType';
|
||||
import type { ChatMessageDataScript } from './chatMessageDataScript';
|
||||
import type { ChatMessageDataStep } from './chatMessageDataStep';
|
||||
|
||||
export interface ChatMessageData {
|
||||
chat_id: string;
|
||||
session_id: string;
|
||||
card_id?: ChatMessageDataCardId;
|
||||
index: number;
|
||||
sender: number;
|
||||
sender: ChatSender;
|
||||
target_price: number;
|
||||
card_used_yn?: ChatMessageDataCardUsedYn;
|
||||
indicator_value?: ChatMessageDataIndicatorValue;
|
||||
card_type?: ChatMessageDataCardType;
|
||||
script?: ChatMessageDataScript;
|
||||
step?: ChatMessageDataStep;
|
||||
}
|
||||
@@ -4,5 +4,6 @@
|
||||
* Negodata Api Server
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import type { CardType } from './cardType';
|
||||
|
||||
export type ChatMessageDataCardType = number | null;
|
||||
export type ChatMessageDataCardType = CardType | null;
|
||||
+1
-5
@@ -5,8 +5,4 @@
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export interface EnumOption {
|
||||
value: number;
|
||||
name: string;
|
||||
label: string;
|
||||
}
|
||||
export type ChatMessageDataScript = string | null;
|
||||
+1
-1
@@ -5,4 +5,4 @@
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
export type ResEnumsMsg = string | null;
|
||||
export type ChatMessageDataStep = string | null;
|
||||
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Negodata Api Server
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* negotiation.chats.sender 코드값. 채팅 발신 주체.
|
||||
*/
|
||||
export type ChatSender = typeof ChatSender[keyof typeof ChatSender];
|
||||
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
||||
export const ChatSender = {
|
||||
BOT: 1,
|
||||
USER: 2,
|
||||
} as const;
|
||||
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Negodata Api Server
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* items.delivery_type 코드값. 협상 채팅의 배송형태 선택지와 동일 집합.
|
||||
*/
|
||||
export type DeliveryType = typeof DeliveryType[keyof typeof DeliveryType];
|
||||
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
||||
export const DeliveryType = {
|
||||
PARTNER: 1,
|
||||
COURIER: 2,
|
||||
PICKUP: 3,
|
||||
} as const;
|
||||
@@ -17,13 +17,18 @@ export * from './cardDataNumber';
|
||||
export * from './cardDataScript';
|
||||
export * from './cardDataUpdatedAt';
|
||||
export * from './cardDataUserId';
|
||||
export * from './cardStatus';
|
||||
export * from './cardType';
|
||||
export * from './chatMessageData';
|
||||
export * from './chatMessageDataCardId';
|
||||
export * from './chatMessageDataCardType';
|
||||
export * from './chatMessageDataCardUsedYn';
|
||||
export * from './chatMessageDataIndicatorValue';
|
||||
export * from './chatMessageDataScript';
|
||||
export * from './chatMessageDataStep';
|
||||
export * from './chatSender';
|
||||
export * from './companyData';
|
||||
export * from './enumOption';
|
||||
export * from './deliveryType';
|
||||
export * from './errorInfo';
|
||||
export * from './errorInfoCode';
|
||||
export * from './errorInfoDesc';
|
||||
@@ -80,6 +85,8 @@ export * from './quotationSettingData';
|
||||
export * from './quotationSettingDataCreatedAt';
|
||||
export * from './quotationSettingDataUpdatedAt';
|
||||
export * from './quotationSettingDataUserId';
|
||||
export * from './quotationStatus';
|
||||
export * from './quotationType';
|
||||
export * from './reqCheckCodes';
|
||||
export * from './reqCreateAccount';
|
||||
export * from './reqCreateCard';
|
||||
@@ -179,9 +186,6 @@ export * from './resDeleteQuotationSetting';
|
||||
export * from './resDeleteQuotationSettingMsg';
|
||||
export * from './resDeleteSupplier';
|
||||
export * from './resDeleteSupplierMsg';
|
||||
export * from './resEnums';
|
||||
export * from './resEnumsEnums';
|
||||
export * from './resEnumsMsg';
|
||||
export * from './resItem';
|
||||
export * from './resItemCategories';
|
||||
export * from './resItemCategoriesMsg';
|
||||
@@ -248,6 +252,7 @@ export * from './sessionDataBidPrice';
|
||||
export * from './sessionDataRejectDeliveryType';
|
||||
export * from './sessionDataRejectPrice';
|
||||
export * from './sessionDataRejectReason';
|
||||
export * from './sessionStatus';
|
||||
export * from './supplierData';
|
||||
export * from './supplierDataCode';
|
||||
export * from './supplierDataCreatedAt';
|
||||
@@ -256,6 +261,7 @@ export * from './supplierDataManagerEmail';
|
||||
export * from './supplierDataManagerName';
|
||||
export * from './supplierDataPriority';
|
||||
export * from './supplierDataUpdatedAt';
|
||||
export * from './userRole';
|
||||
export * from './validationError';
|
||||
export * from './validationErrorCtx';
|
||||
export * from './validationErrorLocItem';
|
||||
@@ -4,5 +4,6 @@
|
||||
* Negodata Api Server
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import type { DeliveryType } from './deliveryType';
|
||||
|
||||
export type ItemDataDeliveryType = number | null;
|
||||
export type ItemDataDeliveryType = DeliveryType | null;
|
||||
@@ -4,5 +4,6 @@
|
||||
* Negodata Api Server
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import type { CardType } from './cardType';
|
||||
|
||||
export type QuotationCardDataType = number | null;
|
||||
export type QuotationCardDataType = CardType | null;
|
||||
@@ -4,6 +4,8 @@
|
||||
* Negodata Api Server
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import type { QuotationType } from './quotationType';
|
||||
import type { QuotationStatus } from './quotationStatus';
|
||||
import type { QuotationDataManagerName } from './quotationDataManagerName';
|
||||
import type { QuotationDataManagerEmail } from './quotationDataManagerEmail';
|
||||
import type { QuotationDataManagerContactNumber } from './quotationDataManagerContactNumber';
|
||||
@@ -25,9 +27,9 @@ export interface QuotationData {
|
||||
version_id: string;
|
||||
name: string;
|
||||
number: string;
|
||||
type: number;
|
||||
type: QuotationType;
|
||||
round?: number;
|
||||
status: number;
|
||||
status: QuotationStatus;
|
||||
start_time: string;
|
||||
end_time: string;
|
||||
manager_name?: QuotationDataManagerName;
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Negodata Api Server
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* quotations.status 코드값(SMALLINT). 프론트 견적상태 뱃지와 매핑된다.
|
||||
*/
|
||||
export type QuotationStatus = typeof QuotationStatus[keyof typeof QuotationStatus];
|
||||
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
||||
export const QuotationStatus = {
|
||||
CREATED: 1,
|
||||
ACTIVE: 2,
|
||||
CLOSED: 3,
|
||||
ON_HOLD: 4,
|
||||
} as const;
|
||||
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Negodata Api Server
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* quotations.type 코드값. 1=renego(재협상 1:1), 2=requote(재견적 1:N).
|
||||
*/
|
||||
export type QuotationType = typeof QuotationType[keyof typeof QuotationType];
|
||||
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
||||
export const QuotationType = {
|
||||
RENEGO: 1,
|
||||
REQUOTE: 2,
|
||||
} as const;
|
||||
@@ -15,8 +15,6 @@ export interface ResCardList {
|
||||
page?: number;
|
||||
size?: number;
|
||||
cards?: CardData[];
|
||||
/** 협상카드 탭 카운트(검색 필터 반영) */
|
||||
total_nego?: number;
|
||||
/** 와일드카드 탭 카운트(검색 필터 반영) */
|
||||
total_wild?: number;
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Negodata Api Server
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import type { ErrorInfo } from './errorInfo';
|
||||
import type { ResEnumsMsg } from './resEnumsMsg';
|
||||
import type { ResEnumsEnums } from './resEnumsEnums';
|
||||
|
||||
export interface ResEnums {
|
||||
result?: ErrorInfo;
|
||||
msg?: ResEnumsMsg;
|
||||
enums?: ResEnumsEnums;
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Negodata Api Server
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import type { EnumOption } from './enumOption';
|
||||
|
||||
export type ResEnumsEnums = {[key: string]: EnumOption[]};
|
||||
@@ -9,6 +9,7 @@ import type { ResMeMsg } from './resMeMsg';
|
||||
import type { ResMeName } from './resMeName';
|
||||
import type { ResMeEmail } from './resMeEmail';
|
||||
import type { ResMeContactNumber } from './resMeContactNumber';
|
||||
import type { UserRole } from './userRole';
|
||||
import type { ResMeCompany } from './resMeCompany';
|
||||
|
||||
export interface ResMe {
|
||||
@@ -19,7 +20,6 @@ export interface ResMe {
|
||||
name?: ResMeName;
|
||||
email?: ResMeEmail;
|
||||
contact_number?: ResMeContactNumber;
|
||||
role?: number;
|
||||
role_label?: string;
|
||||
role?: UserRole;
|
||||
company?: ResMeCompany;
|
||||
}
|
||||
@@ -4,6 +4,8 @@
|
||||
* Negodata Api Server
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import type { QuotationType } from './quotationType';
|
||||
import type { SessionStatus } from './sessionStatus';
|
||||
import type { SessionDataBidPrice } from './sessionDataBidPrice';
|
||||
import type { SessionDataBidAt } from './sessionDataBidAt';
|
||||
import type { SessionDataRejectReason } from './sessionDataRejectReason';
|
||||
@@ -17,9 +19,9 @@ export interface SessionData {
|
||||
item_id: string;
|
||||
qt_number: string;
|
||||
qt_round: number;
|
||||
qt_type: number;
|
||||
qt_type: QuotationType;
|
||||
target_price: number;
|
||||
status: number;
|
||||
status: SessionStatus;
|
||||
bid_price?: SessionDataBidPrice;
|
||||
bid_at?: SessionDataBidAt;
|
||||
end_time: string;
|
||||
|
||||
@@ -4,5 +4,6 @@
|
||||
* Negodata Api Server
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import type { DeliveryType } from './deliveryType';
|
||||
|
||||
export type SessionDataRejectDeliveryType = number | null;
|
||||
export type SessionDataRejectDeliveryType = DeliveryType | null;
|
||||
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Negodata Api Server
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* negotiation.sessions.status 코드값. 협력사별 협상 세션 진행 상태.
|
||||
*/
|
||||
export type SessionStatus = typeof SessionStatus[keyof typeof SessionStatus];
|
||||
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
||||
export const SessionStatus = {
|
||||
CREATED: 1,
|
||||
IN_PROGRESS: 2,
|
||||
DONE: 3,
|
||||
NOT_PARTICIPATED: 4,
|
||||
REJECTED: 5,
|
||||
} as const;
|
||||
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* Generated by orval v7.21.0 🍺
|
||||
* Do not edit manually.
|
||||
* Negodata Api Server
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* users.role 코드값.
|
||||
*/
|
||||
export type UserRole = typeof UserRole[keyof typeof UserRole];
|
||||
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
||||
export const UserRole = {
|
||||
USER: 1,
|
||||
MANAGER: 2,
|
||||
} as const;
|
||||
Reference in new issue
Block a user