mizzkey/src/server/api/endpoints/othello/invitations.ts
2018-03-29 20:32:18 +09:00

16 lines
367 B
TypeScript

import Matching, { pack as packMatching } from '../../../../models/othello-matching';
module.exports = (params, user) => 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))));
});