feat(m01-easycalc): 쉬운 단가산출 Api 타입 · 함수 머리 올림
- EasyListItem · EasyOpened · EasySaved · EasyUse · EasyMachine · EasyMachineElement - listEasy · openEasy · calcLater · newEasy · copyEasy · editEasy · deleteEasy · usesOf · listMachines · machineElement · plainError 머리(몸은 다음 커밋) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KmELpdXFDRZHhfbGuRhSmL
This commit is contained in:
@@ -0,0 +1,116 @@
|
||||
/* =============================================================================
|
||||
* M01_EasyCalc_Api.ts
|
||||
* 쉬운 단가산출 Api — 서버 길 감싸기(목록 · 열기 + 자동값 · 시험 계산 뒤에서 · 새로 · 본뜨기 ·
|
||||
* 고치기 · 지우기 · 쓰는 곳) · 403 · 409 · 422 를 쉬운 말로 · 기계 기종 → 부를 기계경비 로직 · 넘길 값
|
||||
* 모양은 `docs/raw/M01_쉬운단가/설계.md` 3절 그대로 · 쓰기는 `/logic/*` 만(`/save` 안 씀)
|
||||
* ========================================================================== */
|
||||
|
||||
import type { CalcAnswer, LogicInput, LogicRow } from "../M01_MasterData_UI_Logic_Api";
|
||||
|
||||
/** 목록 한 줄 */
|
||||
export interface EasyListItem {
|
||||
key: string;
|
||||
name: string;
|
||||
/** 품셈 기본(읽기만) · false = 내가 만든 것 */
|
||||
isBase: boolean;
|
||||
/** 화면 글 「품셈 기본」 · 「내가 만든 것」 */
|
||||
owner: string;
|
||||
/** 결과단위 「원/㎡」 */
|
||||
resultUnit: string;
|
||||
/** 쉬운 길로 열 수 있나 — 돈 아닌 로직(작업량 등)은 false */
|
||||
canOpen: boolean;
|
||||
/** 못 여는 까닭 쉬운 말 · 열 수 있으면 null */
|
||||
whyNot: string | null;
|
||||
/** 어디 것인지 — 「산림품셈 13장 구조물」 · 내가 만든 것은 장만 */
|
||||
where: string;
|
||||
}
|
||||
|
||||
/** 열기 답 — `trial` = 설계 때 정하는 값의 견본(자동값) */
|
||||
export interface EasyOpened {
|
||||
row: LogicRow;
|
||||
version: string;
|
||||
isBase: boolean;
|
||||
trial: Record<string, unknown>;
|
||||
}
|
||||
|
||||
/** 새로 · 본뜨기 · 고치기 답 */
|
||||
export interface EasySaved {
|
||||
key: string;
|
||||
version: string;
|
||||
row: LogicRow;
|
||||
}
|
||||
|
||||
/** 쓰는 곳 한 줄 — 일위대가 조합 · 이 로직을 부르는 다른 로직 */
|
||||
export interface EasyUse {
|
||||
kind: "combo" | "logic";
|
||||
key: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
/** 기계 고르기 목록 한 줄 */
|
||||
export interface EasyMachine {
|
||||
분류번호: string;
|
||||
이름: string;
|
||||
규격: string;
|
||||
/** 줄 단위(「시간」) */
|
||||
단위: string;
|
||||
}
|
||||
|
||||
/** 기종 → 호표 「요소」(기계경비 로직 부름 글) · 그 로직이 받는 설계 때 정하는 값 */
|
||||
export interface EasyMachineElement {
|
||||
element: string;
|
||||
needInputs: LogicInput[];
|
||||
}
|
||||
|
||||
const notReady = (): never => {
|
||||
throw new Error("준비 중");
|
||||
};
|
||||
|
||||
export async function listEasy(_q: string): Promise<EasyListItem[]> {
|
||||
return notReady();
|
||||
}
|
||||
|
||||
export async function openEasy(_key: string): Promise<EasyOpened> {
|
||||
return notReady();
|
||||
}
|
||||
|
||||
/** 0.3초 뒤 서버 시험 계산 · 최신 응답만 `onDone` · 멈춤 · 실패는 `plain` 쉬운 말 */
|
||||
export function calcLater(
|
||||
_row: LogicRow,
|
||||
_trial: Record<string, unknown>,
|
||||
_onDone: (ans: CalcAnswer | null, plain: string | null) => void,
|
||||
): void {
|
||||
notReady();
|
||||
}
|
||||
|
||||
export async function newEasy(_row: LogicRow): Promise<EasySaved> {
|
||||
return notReady();
|
||||
}
|
||||
|
||||
export async function copyEasy(_key: string): Promise<EasySaved> {
|
||||
return notReady();
|
||||
}
|
||||
|
||||
export async function editEasy(_key: string, _version: string, _row: LogicRow): Promise<EasySaved> {
|
||||
return notReady();
|
||||
}
|
||||
|
||||
export async function deleteEasy(_key: string, _version: string): Promise<{ version: string }> {
|
||||
return notReady();
|
||||
}
|
||||
|
||||
export async function usesOf(_key: string): Promise<EasyUse[]> {
|
||||
return notReady();
|
||||
}
|
||||
|
||||
export async function listMachines(_q: string): Promise<EasyMachine[]> {
|
||||
return notReady();
|
||||
}
|
||||
|
||||
export async function machineElement(_기종: string): Promise<EasyMachineElement> {
|
||||
return notReady();
|
||||
}
|
||||
|
||||
export function plainError(_e: unknown): string {
|
||||
return notReady();
|
||||
}
|
||||
Reference in New Issue
Block a user