summaryrefslogtreecommitdiff
path: root/src/server/api/endpoints/reversi/invitations.ts
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-06-17 08:10:54 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-06-17 08:10:54 +0900
commit1ef66c962a1cea81dee4f5db32cd011feac7de44 (patch)
tree006945b7ae9d437cebb0fabc5eb5a849cff518c5 /src/server/api/endpoints/reversi/invitations.ts
parentAdd missing semicolon (diff)
downloadsharkey-1ef66c962a1cea81dee4f5db32cd011feac7de44.tar.gz
sharkey-1ef66c962a1cea81dee4f5db32cd011feac7de44.tar.bz2
sharkey-1ef66c962a1cea81dee4f5db32cd011feac7de44.zip
reversi :white_flower: :100:
Diffstat (limited to 'src/server/api/endpoints/reversi/invitations.ts')
-rw-r--r--src/server/api/endpoints/reversi/invitations.ts15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/server/api/endpoints/reversi/invitations.ts b/src/server/api/endpoints/reversi/invitations.ts
new file mode 100644
index 0000000000..fc487205a9
--- /dev/null
+++ b/src/server/api/endpoints/reversi/invitations.ts
@@ -0,0 +1,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))));
+});