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

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

    let peijian = await PeijianFun.getPeijian(call, call.req.p_id);
    if (!peijian || !peijian.wearId) return call.errorCode(-1);

    await PeijianFun.changeAttr(call, peijian, { wearId: '' });

    call.succ({});
}