This commit is contained in:
syuilo 2018-03-28 13:32:05 +09:00
parent ac12e63a85
commit 69cef75b53
6 changed files with 59 additions and 39 deletions

View file

@ -1,5 +1,5 @@
import $ from 'cafy';
import Game, { pack } from '../../models/othello-game';
import OthelloGame, { pack } from '../../models/othello-game';
module.exports = (params, user) => new Promise(async (res, rej) => {
// Get 'my' parameter
@ -50,7 +50,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
}
// Fetch games
const games = await Game.find(q, {
const games = await OthelloGame.find(q, {
sort,
limit
});

View file

@ -1,5 +1,5 @@
import $ from 'cafy';
import Game, { pack } from '../../../models/othello-game';
import OthelloGame, { pack } from '../../../models/othello-game';
import Othello from '../../../../common/othello/core';
module.exports = (params, user) => new Promise(async (res, rej) => {
@ -7,7 +7,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
const [gameId, gameIdErr] = $(params.game_id).id().$;
if (gameIdErr) return rej('invalid game_id param');
const game = await Game.findOne({ _id: gameId });
const game = await OthelloGame.findOne({ _id: gameId });
if (game == null) {
return rej('game not found');

View file

@ -1,6 +1,6 @@
import $ from 'cafy';
import Matching, { pack as packMatching } from '../../models/othello-matching';
import Game, { pack as packGame } from '../../models/othello-game';
import OthelloGame, { pack as packGame } from '../../models/othello-game';
import User from '../../models/user';
import publishUserStream, { publishOthelloStream } from '../../event';
import { eighteight } from '../../../common/othello/maps';
@ -28,7 +28,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
});
// Create game
const game = await Game.insert({
const game = await OthelloGame.insert({
created_at: new Date(),
user1_id: exist.parent_id,
user2_id: user._id,