1
1
mirror of https://github.com/kokonect-link/cherrypick synced 2025-01-09 11:23:14 +09:00
cherrypick/src/server/api/endpoints/games/reversi/invitations.ts
2018-07-07 19:01:33 +09:00

17 lines
448 B
TypeScript

import Matching, { pack as packMatching } from '../../../../../models/games/reversi/matching';
import { ILocalUser } from '../../../../../models/user';
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
// Find session
const invitations = await Matching.find({
childId: user._id
}, {
sort: {
_id: -1
}
});
// Reponse
res(Promise.all(invitations.map(async (i) => await packMatching(i, user))));
});