mirror of
https://github.com/zkldi/Tachi.git
synced 2026-10-14 01:59:05 +03:00
feat: last mmdx touches
This commit is contained in:
@@ -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.`,
|
||||
|
||||
Reference in New Issue
Block a user