[refactor] negodata: 목표가 산정내역을 백엔드 /target-breakdown 엔드포인트로 이관

- 생성(_calc_target_price)과 표시(get_target_breakdown)가 _candidates 헬퍼를 공유
  → 프론트 재계산 제거, 저장된 목표가와 항상 일치
- TargetPriceModal: useGetTargetBreakdown 으로 후보·채택·앵커링가 '표시만'
- QuotationType.is_new() 한 곳에서 신규유형 판단(생성·산정 공통)
- enum 라벨 단일출처(lib/enumLabels.ts): 협력사유형/카드 사용구분/유저상태
  members·CardFormSheet 는 거기서 re-export

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
minaChoiandClaude Opus 4.8 committed 2026-06-30 08:40:30 +09:00
1 parent 019f3dbeac
commit 33ce82997a
22 files changed
+471 -175

No files matched your search

@@ -290,6 +290,14 @@ export * from './resSupplierList';
export * from './resSupplierListMsg';
export * from './resSupplierMsg';
export * from './resSupplierSupplier';
export * from './resTargetBreakdown';
export * from './resTargetBreakdownChosenBasis';
export * from './resTargetBreakdownInternetLowest';
export * from './resTargetBreakdownMdPrice';
export * from './resTargetBreakdownMsg';
export * from './resTargetBreakdownPurchase';
export * from './resTargetBreakdownSelling';
export * from './resTargetBreakdownTargetAnchoringPrice';
export * from './sessionData';
export * from './sessionDataBidAt';
export * from './sessionDataBidPrice';
@@ -308,6 +316,7 @@ export * from './supplierDataManagerName';
export * from './supplierDataPriority';
export * from './supplierDataUpdatedAt';
export * from './supplierType';
export * from './targetCandidate';
export * from './userRole';
export * from './userStatus';
export * from './validationError';
@@ -0,0 +1,33 @@
/**
* 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 { ResTargetBreakdownMsg } from './resTargetBreakdownMsg';
import type { ResTargetBreakdownMdPrice } from './resTargetBreakdownMdPrice';
import type { ResTargetBreakdownInternetLowest } from './resTargetBreakdownInternetLowest';
import type { ResTargetBreakdownPurchase } from './resTargetBreakdownPurchase';
import type { ResTargetBreakdownSelling } from './resTargetBreakdownSelling';
import type { TargetCandidate } from './targetCandidate';
import type { ResTargetBreakdownChosenBasis } from './resTargetBreakdownChosenBasis';
import type { ResTargetBreakdownTargetAnchoringPrice } from './resTargetBreakdownTargetAnchoringPrice';
export interface ResTargetBreakdown {
result?: ErrorInfo;
msg?: ResTargetBreakdownMsg;
is_new?: boolean;
is_inherited?: boolean;
md_price?: ResTargetBreakdownMdPrice;
internet_lowest?: ResTargetBreakdownInternetLowest;
purchase?: ResTargetBreakdownPurchase;
selling?: ResTargetBreakdownSelling;
fee?: number;
margin?: number;
anchoring_value?: number;
candidates?: TargetCandidate[];
chosen_basis?: ResTargetBreakdownChosenBasis;
target_price?: number;
target_anchoring_price?: ResTargetBreakdownTargetAnchoringPrice;
}
@@ -0,0 +1,8 @@
/**
* Generated by orval v7.21.0 🍺
* Do not edit manually.
* Negodata Api Server
* OpenAPI spec version: 0.1.0
*/
export type ResTargetBreakdownChosenBasis = string | null;
@@ -0,0 +1,8 @@
/**
* Generated by orval v7.21.0 🍺
* Do not edit manually.
* Negodata Api Server
* OpenAPI spec version: 0.1.0
*/
export type ResTargetBreakdownInternetLowest = number | null;
@@ -0,0 +1,8 @@
/**
* Generated by orval v7.21.0 🍺
* Do not edit manually.
* Negodata Api Server
* OpenAPI spec version: 0.1.0
*/
export type ResTargetBreakdownMdPrice = number | null;
@@ -0,0 +1,8 @@
/**
* Generated by orval v7.21.0 🍺
* Do not edit manually.
* Negodata Api Server
* OpenAPI spec version: 0.1.0
*/
export type ResTargetBreakdownMsg = string | null;
@@ -0,0 +1,8 @@
/**
* Generated by orval v7.21.0 🍺
* Do not edit manually.
* Negodata Api Server
* OpenAPI spec version: 0.1.0
*/
export type ResTargetBreakdownPurchase = number | null;
@@ -0,0 +1,8 @@
/**
* Generated by orval v7.21.0 🍺
* Do not edit manually.
* Negodata Api Server
* OpenAPI spec version: 0.1.0
*/
export type ResTargetBreakdownSelling = number | null;
@@ -0,0 +1,8 @@
/**
* Generated by orval v7.21.0 🍺
* Do not edit manually.
* Negodata Api Server
* OpenAPI spec version: 0.1.0
*/
export type ResTargetBreakdownTargetAnchoringPrice = number | null;
@@ -0,0 +1,12 @@
/**
* Generated by orval v7.21.0 🍺
* Do not edit manually.
* Negodata Api Server
* OpenAPI spec version: 0.1.0
*/
export interface TargetCandidate {
basis: string;
label: string;
value: number;
}
@@ -38,7 +38,8 @@ import type {
ResQuotationResult,
ResQuotationSessions,
ResQuotationStatus,
ResSessionChat
ResSessionChat,
ResTargetBreakdown
} from '.././model';
import { customFetch } from '../../mutator/custom-fetch';
@@ -670,6 +671,98 @@ export function useGetSessionChat<TData = Awaited<ReturnType<typeof getSessionCh
/**
* @summary 세션 목표가 산정내역
*/
export const getTargetBreakdown = (
sessionId: string,
options?: SecondParameter<typeof customFetch>,signal?: AbortSignal
) => {
return customFetch<ResTargetBreakdown>(
{url: `/v1/quotation/session/${sessionId}/target-breakdown`, method: 'GET', signal
},
options);
}
export const getGetTargetBreakdownQueryKey = (sessionId?: string,) => {
return [
`/v1/quotation/session/${sessionId}/target-breakdown`
] as const;
}
export const getGetTargetBreakdownQueryOptions = <TData = Awaited<ReturnType<typeof getTargetBreakdown>>, TError = void | HTTPValidationError>(sessionId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getTargetBreakdown>>, TError, TData>>, request?: SecondParameter<typeof customFetch>}
) => {
const {query: queryOptions, request: requestOptions} = options ?? {};
const queryKey = queryOptions?.queryKey ?? getGetTargetBreakdownQueryKey(sessionId);
const queryFn: QueryFunction<Awaited<ReturnType<typeof getTargetBreakdown>>> = ({ signal }) => getTargetBreakdown(sessionId, requestOptions, signal);
return { queryKey, queryFn, enabled: !!(sessionId), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getTargetBreakdown>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
}
export type GetTargetBreakdownQueryResult = NonNullable<Awaited<ReturnType<typeof getTargetBreakdown>>>
export type GetTargetBreakdownQueryError = void | HTTPValidationError
export function useGetTargetBreakdown<TData = Awaited<ReturnType<typeof getTargetBreakdown>>, TError = void | HTTPValidationError>(
sessionId: string, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getTargetBreakdown>>, TError, TData>> & Pick<
DefinedInitialDataOptions<
Awaited<ReturnType<typeof getTargetBreakdown>>,
TError,
Awaited<ReturnType<typeof getTargetBreakdown>>
> , 'initialData'
>, request?: SecondParameter<typeof customFetch>}
, queryClient?: QueryClient
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetTargetBreakdown<TData = Awaited<ReturnType<typeof getTargetBreakdown>>, TError = void | HTTPValidationError>(
sessionId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getTargetBreakdown>>, TError, TData>> & Pick<
UndefinedInitialDataOptions<
Awaited<ReturnType<typeof getTargetBreakdown>>,
TError,
Awaited<ReturnType<typeof getTargetBreakdown>>
> , 'initialData'
>, request?: SecondParameter<typeof customFetch>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetTargetBreakdown<TData = Awaited<ReturnType<typeof getTargetBreakdown>>, TError = void | HTTPValidationError>(
sessionId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getTargetBreakdown>>, TError, TData>>, request?: SecondParameter<typeof customFetch>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/**
* @summary 세션 목표가 산정내역
*/
export function useGetTargetBreakdown<TData = Awaited<ReturnType<typeof getTargetBreakdown>>, TError = void | HTTPValidationError>(
sessionId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getTargetBreakdown>>, TError, TData>>, request?: SecondParameter<typeof customFetch>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
const queryOptions = getGetTargetBreakdownQueryOptions(sessionId,options)
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
query.queryKey = queryOptions.queryKey ;
return query;
}
/**
* @summary 세션 초청 메일 재발송
*/