summaryrefslogtreecommitdiff
path: root/src/server/api/endpoints/reversi/invitations.ts
blob: fc487205a91545157dd1f094cc3831e1fe2e623c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import Matching, { pack as packMatching } from '../../../../models/reversi-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))));
});