XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

SpaceNinjaServer

A simple server for a small space ninja game

公开
关注 0 Fork 1 Star 0
UTF-8
import type { RequestHandler } from "express";
import { Account } from "../../models/loginModel.ts";
import { getGoogleAccountData } from "../../services/loginService.ts";

export const signupAndroidController: RequestHandler = async (request, res) => {
    const googleTokenId = request.query.googleTokenId as string | undefined;
    const { userId } = await getGoogleAccountData(googleTokenId);
    const account = await Account.findOne({ GoogleTokenId: userId });
    if (!account) {
        res.status(400).json({ error: "account not found" });
        return;
    }
    account.DisplayName = request.query.accountName as string;
    await account.save();
    res.status(200).end();
};