feat: last mmdx touches

This commit is contained in:
zkldi
2022-12-26 16:07:01 +00:00
parent fecb3440a9
commit f287c8d281
12 changed files with 56120 additions and 55738 deletions
@@ -1,6 +1,8 @@
import { GetTableFromParam } from "./middleware";
import { Router } from "express";
import db from "external/mongo/db";
import CreateLogCtx from "lib/logger/logger";
import { FormatGame } from "tachi-common";
import { GetFoldersFromTable } from "utils/folder";
import { GetGPT, GetTachiData } from "utils/req-tachi-data";
import type { FilterQuery } from "mongodb";
@@ -8,6 +10,8 @@ import type { TableDocument } from "tachi-common";
const router: Router = Router({ mergeParams: true });
const logger = CreateLogCtx(__filename);
/**
* Return all the tables for this game.
*
@@ -26,6 +30,19 @@ router.get("/", async (req, res) => {
const tables = await db.tables.find(query);
if (tables.length === 0) {
logger.error(
`The game ${FormatGame(
game,
playtype
)} has no tables. This renders table support for the game broken!`
);
return res.status(500).json({
success: false,
description: "This game has no tables.",
});
}
return res.status(200).json({
success: true,
description: `Returned ${tables.length} tables.`,