import { ApiCall } from "tsrpc";
import { ReqSearch, ResSearch } from "../../shared/protocols/friend/PtlSearch";

export default async function (call: ApiCall<ReqSearch, ResSearch>) {

    let player = await G.mongodb.collection('user').findOne({ name: call.req.name });

    if (!player) return call.error('', { code: -1, message: globalThis.lng.friend_22 });

    call.succ(player);
}