import { ApiCall } from "tsrpc";
import { ReqRefresh, ResRefresh } from "../../../shared/protocols/hbzb/zbs/PtlRefresh";

export default async function (call: ApiCall<ReqRefresh, ResRefresh>) {

    let callRes = await G.clientCross.callApi('hbzb/zbs/GetEnemy', { uid: call.uid });

    G.mongodb.cPlayerInfo('hbzbZbs').updateOne(
        { uid: call.uid, type: 'hbzbZbs' },
        { $set: { 'data.enemy': callRes.res.enemy } },
        { upsert: true }
    );

    call.succ({
        ...callRes.res
    });
}