|
@@ -1,14 +1,26 @@
|
|
-const db = require("../db.js");
|
|
|
|
|
|
+const decksDal = require("../dal/decksDal.js");
|
|
|
|
|
|
class DecksRepository {
|
|
class DecksRepository {
|
|
//TODO continue
|
|
//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;
|
|
let decksRepository = null;
|
|
function getSingleton() {
|
|
function getSingleton() {
|
|
return decksRepository = (decksRepository === null ? new DecksRepository(): decksRepository);
|
|
return decksRepository = (decksRepository === null ? new DecksRepository(): decksRepository);
|
|
}
|
|
}
|
|
-module.exports = getSingleton();
|
|
|
|
|
|
+module.exports = getSingleton();
|
|
|
|
+
|