import {ApiCall} from "tsrpc";
import {ReqRefresh, ResRefresh} from "../../shared/protocols/ganhai/PtlRefresh";
import {randomShips} from './ApiOpen';

export default async function (call: ApiCall<ReqRefresh, ResRefresh>) {
    let ships = await randomShips(call.uid, call.conn.gud.ghId);

    G.mongodb.collection('ganhai').updateOne({uid: call.uid}, {$set: {ships: ships}});

    call.succ({
        change: {
            ships: ships
        }
    });
}