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

XFESpaceNinjaServer

A simple server for a small space ninja game

公开
关注 0 Fork 0 Star 0
UTF-8
import type { RequestHandler } from "express";
import { getPersonalRooms, getShip } from "../../services/personalRoomsService.ts";
import type { IGetShipResponse } from "../../types/personalRoomsTypes.ts";

export const getShipController: RequestHandler = async (req, res) => {
    const personalRoomsDb = await getPersonalRooms(req.query.shipOwnerId as string);

    if (personalRoomsDb.Ship.ContentUrlSignature != (req.query.sig as string)) {
        res.status(409).send("Paramater error"); // [sic]
        return;
    }

    const getShipResponse: IGetShipResponse = await getShip(personalRoomsDb);
    res.json(getShipResponse);
};