summaryrefslogtreecommitdiff
path: root/src/server/api/endpoints/othello/invitations.ts
blob: f6e0071a6c4c38f10fe7504f42fbb146e62d3dc0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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))));
});