import { ApiCall } from "tsrpc";
import { ShiwuFun } from '../../public/shiwu';
import { ReqTakeOff, ResTakeOff } from "../../shared/protocols/shiwu/PtlTakeOff";

export default async function (call: ApiCall<ReqTakeOff, ResTakeOff>) {

    let shiwu = await ShiwuFun.getShiwu(call, call.req._id);
    if (!shiwu) return call.error(globalThis.lng.shiwu_3);
    if (!shiwu.wearId) return call.error(globalThis.lng.shiwu_5);

    await ShiwuFun.changeShiwuAttr(call, shiwu, { wearId: '' });

    call.succ({});
}