import { ApiCall } from "tsrpc";
import { ReqState, ResState } from "../../cross/protocols/kbzz/PtlState";

export default async function (call: ApiCall<ReqState, ResState>) {

    let num = await G.mongodb.collection(call.req.type == 'apply' ? 'kbzzApplyUser' : 'kbzzGroupUser').countDocuments();

    call.succ({
        num: num,
        succ: call.req.type == 'apply' ? num >= G.gc.kbzz.groupNum : num >= 1
    });
}