Skip to content

Commit

Permalink
WIP. Create and delete decks, with database persistence.
Browse files Browse the repository at this point in the history
  • Loading branch information
srhoulam committed Jul 23, 2021
1 parent 2f01270 commit 59c8620
Show file tree
Hide file tree
Showing 8 changed files with 189 additions and 132 deletions.
4 changes: 3 additions & 1 deletion babel-cards.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cabal-version: 1.12
--
-- see: https://github.com/sol/hpack
--
-- hash: 4fde194f696b0b94c80772e3e95c24155b2e91b943887cc178cbf7ef67ade9d4
-- hash: 74ff7ad6298c7bc5c792db969bc8935ed56c223f2144585438870cbdc7231c17

name: babel-cards
version: 0.1.0
Expand Down Expand Up @@ -61,6 +61,8 @@ library
, esqueleto
, file-embed
, filepath
, interpolate
, microlens
, microlens-th
, monad-logger
, persistent
Expand Down
2 changes: 2 additions & 0 deletions package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ library:
- esqueleto
- file-embed
- filepath
- interpolate
- microlens
- microlens-th
- monad-logger
- persistent
Expand Down
3 changes: 2 additions & 1 deletion src/Application/Database.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import qualified Database.Esqueleto as E
import Database.Persist as Application.Database
-- import Database.Persist.Class as Application.Database
import Database.Persist.Sql (SqlBackend, runSqlPool)
-- import Lens.Micro
import Model as Application.Database
import RIO
import RIO.List (headMaybe)
Expand Down Expand Up @@ -80,7 +81,7 @@ retrieveDeckSummaries = do
)

return $ mkDeckMetadata <$> summaries
where mkDeckMetadata (dmDeckEntity, E.Value dmLastStudied, E.Value dmCardCount) =
where mkDeckMetadata (_deckEntity, E.Value _lastStudied, E.Value _cardCount) =
DeckMetadata {..}

retrieveNextCard :: DeckId -> BabelQuery (Maybe (Entity Card))
Expand Down
Loading

0 comments on commit 59c8620

Please sign in to comment.