summaryrefslogtreecommitdiff
path: root/packages/backend/src/server/api/endpoints/games
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2021-12-09 23:58:30 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2021-12-09 23:58:30 +0900
commitc69b72e1999578cba15e34677ebd366482cba734 (patch)
tree624ac6500e36e3a7024a5ea19ae891ef86781d04 /packages/backend/src/server/api/endpoints/games
parentUpdate instance-mute.vue (diff)
downloadmisskey-c69b72e1999578cba15e34677ebd366482cba734.tar.gz
misskey-c69b72e1999578cba15e34677ebd366482cba734.tar.bz2
misskey-c69b72e1999578cba15e34677ebd366482cba734.zip
fix lint
Diffstat (limited to 'packages/backend/src/server/api/endpoints/games')
-rw-r--r--packages/backend/src/server/api/endpoints/games/reversi/games.ts56
-rw-r--r--packages/backend/src/server/api/endpoints/games/reversi/games/show.ts60
-rw-r--r--packages/backend/src/server/api/endpoints/games/reversi/games/surrender.ts14
-rw-r--r--packages/backend/src/server/api/endpoints/games/reversi/invitations.ts22
-rw-r--r--packages/backend/src/server/api/endpoints/games/reversi/match.ts16
-rw-r--r--packages/backend/src/server/api/endpoints/games/reversi/match/cancel.ts4
6 files changed, 86 insertions, 86 deletions
diff --git a/packages/backend/src/server/api/endpoints/games/reversi/games.ts b/packages/backend/src/server/api/endpoints/games/reversi/games.ts
index 4db9ecb69f..f77f11942c 100644
--- a/packages/backend/src/server/api/endpoints/games/reversi/games.ts
+++ b/packages/backend/src/server/api/endpoints/games/reversi/games.ts
@@ -11,7 +11,7 @@ export const meta = {
params: {
limit: {
validator: $.optional.num.range(1, 100),
- default: 10
+ default: 10,
},
sinceId: {
@@ -24,8 +24,8 @@ export const meta = {
my: {
validator: $.optional.bool,
- default: false
- }
+ default: false,
+ },
},
res: {
@@ -38,86 +38,86 @@ export const meta = {
id: {
type: 'string' as const,
optional: false as const, nullable: false as const,
- format: 'id'
+ format: 'id',
},
createdAt: {
type: 'string' as const,
optional: false as const, nullable: false as const,
- format: 'date-time'
+ format: 'date-time',
},
startedAt: {
type: 'string' as const,
optional: false as const, nullable: false as const,
- format: 'date-time'
+ format: 'date-time',
},
isStarted: {
type: 'boolean' as const,
- optional: false as const, nullable: false as const
+ optional: false as const, nullable: false as const,
},
isEnded: {
type: 'boolean' as const,
- optional: false as const, nullable: false as const
+ optional: false as const, nullable: false as const,
},
form1: {
type: 'any' as const,
- optional: false as const, nullable: true as const
+ optional: false as const, nullable: true as const,
},
form2: {
type: 'any' as const,
- optional: false as const, nullable: true as const
+ optional: false as const, nullable: true as const,
},
user1Accepted: {
type: 'boolean' as const,
optional: false as const, nullable: false as const,
- default: false
+ default: false,
},
user2Accepted: {
type: 'boolean' as const,
optional: false as const, nullable: false as const,
- default: false
+ default: false,
},
user1Id: {
type: 'string' as const,
optional: false as const, nullable: false as const,
- format: 'id'
+ format: 'id',
},
user2Id: {
type: 'string' as const,
optional: false as const, nullable: false as const,
- format: 'id'
+ format: 'id',
},
user1: {
type: 'object' as const,
optional: false as const, nullable: false as const,
- ref: 'User'
+ ref: 'User',
},
user2: {
type: 'object' as const,
optional: false as const, nullable: false as const,
- ref: 'User'
+ ref: 'User',
},
winnerId: {
type: 'string' as const,
optional: false as const, nullable: true as const,
- format: 'id'
+ format: 'id',
},
winner: {
type: 'object' as const,
optional: false as const, nullable: true as const,
- ref: 'User'
+ ref: 'User',
},
surrendered: {
type: 'string' as const,
optional: false as const, nullable: true as const,
- format: 'id'
+ format: 'id',
},
black: {
type: 'number' as const,
- optional: false as const, nullable: true as const
+ optional: false as const, nullable: true as const,
},
bw: {
type: 'string' as const,
- optional: false as const, nullable: false as const
+ optional: false as const, nullable: false as const,
},
isLlotheo: {
type: 'boolean' as const,
@@ -125,15 +125,15 @@ export const meta = {
},
canPutEverywhere: {
type: 'boolean' as const,
- optional: false as const, nullable: false as const
+ optional: false as const, nullable: false as const,
},
loopedBoard: {
type: 'boolean' as const,
- optional: false as const, nullable: false as const
- }
- }
- }
- }
+ optional: false as const, nullable: false as const,
+ },
+ },
+ },
+ },
};
export default define(meta, async (ps, user) => {
@@ -151,6 +151,6 @@ export default define(meta, async (ps, user) => {
const games = await query.take(ps.limit!).getMany();
return await Promise.all(games.map((g) => ReversiGames.pack(g, user, {
- detail: false
+ detail: false,
})));
});
diff --git a/packages/backend/src/server/api/endpoints/games/reversi/games/show.ts b/packages/backend/src/server/api/endpoints/games/reversi/games/show.ts
index 93afffdb1f..0476a4be9b 100644
--- a/packages/backend/src/server/api/endpoints/games/reversi/games/show.ts
+++ b/packages/backend/src/server/api/endpoints/games/reversi/games/show.ts
@@ -18,7 +18,7 @@ export const meta = {
noSuchGame: {
message: 'No such game.',
code: 'NO_SUCH_GAME',
- id: 'f13a03db-fae1-46c9-87f3-43c8165419e1'
+ id: 'f13a03db-fae1-46c9-87f3-43c8165419e1',
},
},
@@ -32,86 +32,86 @@ export const meta = {
id: {
type: 'string' as const,
optional: false as const, nullable: false as const,
- format: 'id'
+ format: 'id',
},
createdAt: {
type: 'string' as const,
optional: false as const, nullable: false as const,
- format: 'date-time'
+ format: 'date-time',
},
startedAt: {
type: 'string' as const,
optional: false as const, nullable: false as const,
- format: 'date-time'
+ format: 'date-time',
},
isStarted: {
type: 'boolean' as const,
- optional: false as const, nullable: false as const
+ optional: false as const, nullable: false as const,
},
isEnded: {
type: 'boolean' as const,
- optional: false as const, nullable: false as const
+ optional: false as const, nullable: false as const,
},
form1: {
type: 'any' as const,
- optional: false as const, nullable: true as const
+ optional: false as const, nullable: true as const,
},
form2: {
type: 'any' as const,
- optional: false as const, nullable: true as const
+ optional: false as const, nullable: true as const,
},
user1Accepted: {
type: 'boolean' as const,
optional: false as const, nullable: false as const,
- default: false
+ default: false,
},
user2Accepted: {
type: 'boolean' as const,
optional: false as const, nullable: false as const,
- default: false
+ default: false,
},
user1Id: {
type: 'string' as const,
optional: false as const, nullable: false as const,
- format: 'id'
+ format: 'id',
},
user2Id: {
type: 'string' as const,
optional: false as const, nullable: false as const,
- format: 'id'
+ format: 'id',
},
user1: {
type: 'object' as const,
optional: false as const, nullable: false as const,
- ref: 'User'
+ ref: 'User',
},
user2: {
type: 'object' as const,
optional: false as const, nullable: false as const,
- ref: 'User'
+ ref: 'User',
},
winnerId: {
type: 'string' as const,
optional: false as const, nullable: true as const,
- format: 'id'
+ format: 'id',
},
winner: {
type: 'object' as const,
optional: false as const, nullable: true as const,
- ref: 'User'
+ ref: 'User',
},
surrendered: {
type: 'string' as const,
optional: false as const, nullable: true as const,
- format: 'id'
+ format: 'id',
},
black: {
type: 'number' as const,
- optional: false as const, nullable: true as const
+ optional: false as const, nullable: true as const,
},
bw: {
type: 'string' as const,
- optional: false as const, nullable: false as const
+ optional: false as const, nullable: false as const,
},
isLlotheo: {
type: 'boolean' as const,
@@ -119,27 +119,27 @@ export const meta = {
},
canPutEverywhere: {
type: 'boolean' as const,
- optional: false as const, nullable: false as const
+ optional: false as const, nullable: false as const,
},
loopedBoard: {
type: 'boolean' as const,
- optional: false as const, nullable: false as const
+ optional: false as const, nullable: false as const,
},
board: {
type: 'array' as const,
optional: false as const, nullable: false as const,
items: {
type: 'any' as const,
- optional: false as const, nullable: false as const
- }
+ optional: false as const, nullable: false as const,
+ },
},
turn: {
type: 'any' as const,
- optional: false as const, nullable: false as const
- }
- }
- }
- }
+ optional: false as const, nullable: false as const,
+ },
+ },
+ },
+ },
};
export default define(meta, async (ps, user) => {
@@ -152,7 +152,7 @@ export default define(meta, async (ps, user) => {
const o = new Reversi(game.map, {
isLlotheo: game.isLlotheo,
canPutEverywhere: game.canPutEverywhere,
- loopedBoard: game.loopedBoard
+ loopedBoard: game.loopedBoard,
});
for (const log of game.logs) {
@@ -163,6 +163,6 @@ export default define(meta, async (ps, user) => {
return Object.assign({
board: o.board,
- turn: o.turn
+ turn: o.turn,
}, packed);
});
diff --git a/packages/backend/src/server/api/endpoints/games/reversi/games/surrender.ts b/packages/backend/src/server/api/endpoints/games/reversi/games/surrender.ts
index 00d58b19e3..84b80c47a0 100644
--- a/packages/backend/src/server/api/endpoints/games/reversi/games/surrender.ts
+++ b/packages/backend/src/server/api/endpoints/games/reversi/games/surrender.ts
@@ -13,28 +13,28 @@ export const meta = {
params: {
gameId: {
validator: $.type(ID),
- }
+ },
},
errors: {
noSuchGame: {
message: 'No such game.',
code: 'NO_SUCH_GAME',
- id: 'ace0b11f-e0a6-4076-a30d-e8284c81b2df'
+ id: 'ace0b11f-e0a6-4076-a30d-e8284c81b2df',
},
alreadyEnded: {
message: 'That game has already ended.',
code: 'ALREADY_ENDED',
- id: '6c2ad4a6-cbf1-4a5b-b187-b772826cfc6d'
+ id: '6c2ad4a6-cbf1-4a5b-b187-b772826cfc6d',
},
accessDenied: {
message: 'Access denied.',
code: 'ACCESS_DENIED',
- id: '6e04164b-a992-4c93-8489-2123069973e1'
+ id: '6e04164b-a992-4c93-8489-2123069973e1',
},
- }
+ },
};
export default define(meta, async (ps, user) => {
@@ -57,11 +57,11 @@ export default define(meta, async (ps, user) => {
await ReversiGames.update(game.id, {
surrendered: user.id,
isEnded: true,
- winnerId: winnerId
+ winnerId: winnerId,
});
publishReversiGameStream(game.id, 'ended', {
winnerId: winnerId,
- game: await ReversiGames.pack(game.id, user)
+ game: await ReversiGames.pack(game.id, user),
});
});
diff --git a/packages/backend/src/server/api/endpoints/games/reversi/invitations.ts b/packages/backend/src/server/api/endpoints/games/reversi/invitations.ts
index c8629377b2..b859a2fc75 100644
--- a/packages/backend/src/server/api/endpoints/games/reversi/invitations.ts
+++ b/packages/backend/src/server/api/endpoints/games/reversi/invitations.ts
@@ -16,42 +16,42 @@ export const meta = {
id: {
type: 'string' as const,
optional: false as const, nullable: false as const,
- format: 'id'
+ format: 'id',
},
createdAt: {
type: 'string' as const,
optional: false as const, nullable: false as const,
- format: 'date-time'
+ format: 'date-time',
},
parentId: {
type: 'string' as const,
optional: false as const, nullable: false as const,
- format: 'id'
+ format: 'id',
},
parent: {
type: 'object' as const,
optional: false as const, nullable: false as const,
- ref: 'User'
+ ref: 'User',
},
childId: {
type: 'string' as const,
optional: false as const, nullable: false as const,
- format: 'id'
+ format: 'id',
},
child: {
type: 'object' as const,
optional: false as const, nullable: false as const,
- ref: 'User'
- }
- }
- }
- }
+ ref: 'User',
+ },
+ },
+ },
+ },
};
export default define(meta, async (ps, user) => {
// Find session
const invitations = await ReversiMatchings.find({
- childId: user.id
+ childId: user.id,
});
return await Promise.all(invitations.map((i) => ReversiMatchings.pack(i, user)));
diff --git a/packages/backend/src/server/api/endpoints/games/reversi/match.ts b/packages/backend/src/server/api/endpoints/games/reversi/match.ts
index 5ceb16c7d7..c66c5a4f75 100644
--- a/packages/backend/src/server/api/endpoints/games/reversi/match.ts
+++ b/packages/backend/src/server/api/endpoints/games/reversi/match.ts
@@ -25,15 +25,15 @@ export const meta = {
noSuchUser: {
message: 'No such user.',
code: 'NO_SUCH_USER',
- id: '0b4f0559-b484-4e31-9581-3f73cee89b28'
+ id: '0b4f0559-b484-4e31-9581-3f73cee89b28',
},
isYourself: {
message: 'Target user is yourself.',
code: 'TARGET_IS_YOURSELF',
- id: '96fd7bd6-d2bc-426c-a865-d055dcd2828e'
+ id: '96fd7bd6-d2bc-426c-a865-d055dcd2828e',
},
- }
+ },
};
export default define(meta, async (ps, user) => {
@@ -45,7 +45,7 @@ export default define(meta, async (ps, user) => {
// Find session
const exist = await ReversiMatchings.findOne({
parentId: ps.userId,
- childId: user.id
+ childId: user.id,
});
if (exist) {
@@ -65,13 +65,13 @@ export default define(meta, async (ps, user) => {
logs: [],
map: eighteight.data,
bw: 'random',
- isLlotheo: false
+ isLlotheo: false,
} as Partial<ReversiGame>);
publishReversiStream(exist.parentId, 'matched', await ReversiGames.pack(game, { id: exist.parentId }));
const other = await ReversiMatchings.count({
- childId: user.id
+ childId: user.id,
});
if (other == 0) {
@@ -88,7 +88,7 @@ export default define(meta, async (ps, user) => {
// 以前のセッションはすべて削除しておく
await ReversiMatchings.delete({
- parentId: user.id
+ parentId: user.id,
});
// セッションを作成
@@ -96,7 +96,7 @@ export default define(meta, async (ps, user) => {
id: genId(),
createdAt: new Date(),
parentId: user.id,
- childId: child.id
+ childId: child.id,
} as ReversiMatching);
const packed = await ReversiMatchings.pack(matching, child);
diff --git a/packages/backend/src/server/api/endpoints/games/reversi/match/cancel.ts b/packages/backend/src/server/api/endpoints/games/reversi/match/cancel.ts
index e4a138bb87..8076b7c5d8 100644
--- a/packages/backend/src/server/api/endpoints/games/reversi/match/cancel.ts
+++ b/packages/backend/src/server/api/endpoints/games/reversi/match/cancel.ts
@@ -4,11 +4,11 @@ import { ReversiMatchings } from '@/models/index';
export const meta = {
tags: ['games'],
- requireCredential: true as const
+ requireCredential: true as const,
};
export default define(meta, async (ps, user) => {
await ReversiMatchings.delete({
- parentId: user.id
+ parentId: user.id,
});
});