feat(M01): fetchComboInputs · searchMaterials 알약 자료 함수
- fetchComboInputs(조합 코드) → {키, 이름, 물량: [{키, 이름, 단위, 로직, 배?}], 조건}
- searchMaterials(글) = /pick?kind=price 감쌈 → [{코드, 이름, 규격, 단위}]
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TULoa94ZFL26KU6ZqVpjkF
This commit is contained in:
@@ -175,3 +175,28 @@ export const fetchPick = (
|
||||
kind: PickKind,
|
||||
q: string,
|
||||
): Promise<{ total: number; items: PickItem[] }> => get("/pick", { kind, q, limit: 50 });
|
||||
|
||||
/** 조합 알약 물량 하나 — 담은 로직 결과단위 분모(같은 이름 · 단위는 합침) · `배` = 원/10㎡ 의 10 */
|
||||
export interface ComboQuantity {
|
||||
키: string;
|
||||
이름: string;
|
||||
단위: string;
|
||||
로직: string[];
|
||||
배?: number;
|
||||
}
|
||||
|
||||
export const fetchComboInputs = (
|
||||
combo: string,
|
||||
): Promise<{ 키: string; 이름: string; 물량: ComboQuantity[]; 조건: unknown[] }> =>
|
||||
get(`/combo/${encodeURIComponent(combo)}/inputs`, {});
|
||||
|
||||
/** 자재 찾기 — `/pick?kind=price` 감쌈 · 이름·규격 낱말이 모두 든 줄 */
|
||||
export const searchMaterials = async (
|
||||
q: string,
|
||||
): Promise<{ 코드: string; 이름: string; 규격: string; 단위: string }[]> =>
|
||||
(await fetchPick("price", q)).items.map((m) => ({
|
||||
코드: m.ref,
|
||||
이름: m.이름,
|
||||
규격: m.규격,
|
||||
단위: m.단위,
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user