This commit is contained in:
syuilo
2019-02-22 14:02:56 +09:00
parent e8d2959717
commit be3298639d
27 changed files with 98 additions and 173 deletions

View File

@@ -7,6 +7,7 @@ import { publishMainStream, publishReversiStream } from '../../../../../services
import { eighteight } from '../../../../../games/reversi/maps';
import define from '../../../define';
import { ApiError } from '../../../error';
import { getUser } from '../../../common/getters';
export const meta = {
requireCredential: true,
@@ -85,18 +86,11 @@ export default define(meta, async (ps, user) => {
return await packGame(game, user);
} else {
// Fetch child
const child = await User.findOne({
_id: ps.userId
}, {
fields: {
_id: true
}
const child = await getUser(ps.userId).catch(e => {
if (e.id === '15348ddd-432d-49c2-8a5a-8069753becff') throw new ApiError(meta.errors.noSuchUser);
throw e;
});
if (child === null) {
throw new ApiError(meta.errors.noSuchUser);
}
// 以前のセッションはすべて削除しておく
await Matching.remove({
parentId: user._id