summaryrefslogtreecommitdiff
path: root/src/server/api/endpoints/othello/invitations.ts
blob: 47615376145597f1fd8b7c396841731ea8c18e64 (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))));
});