|
@@ -1,14 +1,26 @@
|
|
|
-const db = require("../db.js");
|
|
|
+const decksDal = require("../dal/decksDal.js");
|
|
|
|
|
|
class DecksRepository {
|
|
|
//TODO continue
|
|
|
- getDecksByUser(userid) {
|
|
|
+// where UserID equals to logged in user's ID
|
|
|
|
|
|
+ getDecksByUser(userID) {
|
|
|
+ return decksDal.getDecksByUser(userID);
|
|
|
}
|
|
|
+
|
|
|
+ insertDeckByUser(userID, cards){
|
|
|
+ return decksDal.insertDeckByUser(userID, cards);
|
|
|
+ }
|
|
|
+
|
|
|
+ deleteDeckByUser(userID, deckID) {
|
|
|
+ return decksDal.deleteDeckByUser(userID, deckID)
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
let decksRepository = null;
|
|
|
function getSingleton() {
|
|
|
return decksRepository = (decksRepository === null ? new DecksRepository(): decksRepository);
|
|
|
}
|
|
|
-module.exports = getSingleton();
|
|
|
+module.exports = getSingleton();
|
|
|
+
|