1234567891011121314151617181920212223242526 |
- const decksDal = require("../dal/decksDal.js");
- class DecksRepository {
- //TODO continue
- // 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();
|