Fixed 267U.pre2
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
import define from "../../define.js";
|
||||
import { ApiError } from "../../error.js";
|
||||
import { ShogiGames } from "../../../../models/index.js";
|
||||
export const meta = {
|
||||
tags: [
|
||||
"shogi"
|
||||
],
|
||||
requireCredential: false,
|
||||
errors: {
|
||||
noSuchGame: {
|
||||
message: "No such game.",
|
||||
code: "NO_SUCH_GAME",
|
||||
id: "f732066e-d92e-4d80-940f-b596d512f2ef"
|
||||
}
|
||||
},
|
||||
res: {
|
||||
type: "object",
|
||||
optional: false,
|
||||
nullable: false
|
||||
}
|
||||
};
|
||||
export const paramDef = {
|
||||
type: "object",
|
||||
properties: {
|
||||
gameId: {
|
||||
type: "string",
|
||||
format: "misskey:id"
|
||||
}
|
||||
},
|
||||
required: [
|
||||
"gameId"
|
||||
]
|
||||
};
|
||||
export default define(meta, paramDef, async (ps)=>{
|
||||
const game = await ShogiGames.findOne({
|
||||
where: {
|
||||
id: ps.gameId
|
||||
},
|
||||
relations: {
|
||||
user1: true,
|
||||
user2: true
|
||||
}
|
||||
});
|
||||
if (!game) throw new ApiError(meta.errors.noSuchGame);
|
||||
return await ShogiGames.packDetail(game);
|
||||
});
|
||||
Reference in New Issue
Block a user