summaryrefslogtreecommitdiff
path: root/src/api/models
diff options
context:
space:
mode:
Diffstat (limited to 'src/api/models')
-rw-r--r--src/api/models/othello-matching.ts11
-rw-r--r--src/api/models/othello-session.ts29
2 files changed, 11 insertions, 29 deletions
diff --git a/src/api/models/othello-matching.ts b/src/api/models/othello-matching.ts
new file mode 100644
index 0000000000..bd7aeef3cf
--- /dev/null
+++ b/src/api/models/othello-matching.ts
@@ -0,0 +1,11 @@
+import * as mongo from 'mongodb';
+import db from '../../db/mongodb';
+
+const Matching = db.get<IMatching>('othello_matchings');
+export default Matching;
+
+export interface IMatching {
+ _id: mongo.ObjectID;
+ parent_id: mongo.ObjectID;
+ child_id: mongo.ObjectID;
+}
diff --git a/src/api/models/othello-session.ts b/src/api/models/othello-session.ts
deleted file mode 100644
index 0aa1d01e54..0000000000
--- a/src/api/models/othello-session.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-import * as mongo from 'mongodb';
-import deepcopy = require('deepcopy');
-import db from '../../db/mongodb';
-
-const Session = db.get<ISession>('othello_sessions');
-export default Session;
-
-export interface ISession {
- _id: mongo.ObjectID;
- code: string;
- user_id: mongo.ObjectID;
-}
-
-/**
- * Pack an othello session for API response
- *
- * @param {any} session
- * @return {Promise<any>}
- */
-export const pack = (
- session: any
-) => new Promise<any>(async (resolve, reject) => {
-
- const _session = deepcopy(session);
-
- delete _session._id;
-
- resolve(_session);
-});