import { ApiCall } from "tsrpc";
import { ReqAim, ResAim } from "../../shared/protocols/slzd/PtlAim";

export default async function (call: ApiCall<ReqAim, ResAim>) {

    if (call.conn.gud.ghLevel > 2 || call.conn.gud.ghLevel == 0) return call.error(globalThis.lng.slzd_1);
    if (!G.gc.slzd.forts[call.req.fort]) return call.error(globalThis.lng.shiwu_6);

    G.mongodb.collection('slzdUser').updateMany(
        { ghid: call.conn.gud.ghId },
        { $set: { "data.aim": call.req.fort } }
    );

    call.succ({});
}