summaryrefslogtreecommitdiff
path: root/src/api/endpoints/othello/invitations.ts
blob: f462ef0bf98761eebedbfc557adf1616147fdb35 (plain)
1
2
3
4
5
6
7
8
9
10
11
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({
		child_id: user._id
	});

	// Reponse
	res(Promise.all(invitations.map(async (i) => await packMatching(i, user))));
});