summaryrefslogtreecommitdiff
path: root/src/server/api/endpoints/games/reversi/invitations.ts
blob: c20477057878ab0eefa4e2610bbf348160461728 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import Matching, { pack as packMatching } from '../../../../../models/games/reversi/matching';
import define from '../../../define';

export const meta = {
	tags: ['games'],

	requireCredential: true
};

export default define(meta, async (ps, user) => {
	// Find session
	const invitations = await Matching.find({
		childId: user._id
	}, {
		sort: {
			_id: -1
		}
	});

	return await Promise.all(invitations.map((i) => packMatching(i, user)));
});