mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-02 23:46:30 +02:00
Resolve conflicts
This commit is contained in:
@@ -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
|
||||
@@ -10,28 +10,28 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$;
|
||||
if (limitErr) return rej('invalid limit param');
|
||||
|
||||
// Get 'since_id' parameter
|
||||
const [sinceId, sinceIdErr] = $(params.since_id).optional.id().$;
|
||||
if (sinceIdErr) return rej('invalid since_id param');
|
||||
// Get 'sinceId' parameter
|
||||
const [sinceId, sinceIdErr] = $(params.sinceId).optional.id().$;
|
||||
if (sinceIdErr) return rej('invalid sinceId param');
|
||||
|
||||
// Get 'until_id' parameter
|
||||
const [untilId, untilIdErr] = $(params.until_id).optional.id().$;
|
||||
if (untilIdErr) return rej('invalid until_id param');
|
||||
// Get 'untilId' parameter
|
||||
const [untilId, untilIdErr] = $(params.untilId).optional.id().$;
|
||||
if (untilIdErr) return rej('invalid untilId param');
|
||||
|
||||
// Check if both of since_id and until_id is specified
|
||||
// Check if both of sinceId and untilId is specified
|
||||
if (sinceId && untilId) {
|
||||
return rej('cannot set since_id and until_id');
|
||||
return rej('cannot set sinceId and untilId');
|
||||
}
|
||||
|
||||
const q: any = my ? {
|
||||
is_started: true,
|
||||
isStarted: true,
|
||||
$or: [{
|
||||
user1_id: user._id
|
||||
user1Id: user._id
|
||||
}, {
|
||||
user2_id: user._id
|
||||
user2Id: user._id
|
||||
}]
|
||||
} : {
|
||||
is_started: true
|
||||
isStarted: true
|
||||
};
|
||||
|
||||
const sort = {
|
||||
@@ -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
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user