summaryrefslogtreecommitdiff
path: root/Com/MusicMeetsComics/Database.hs
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2020-04-10 16:33:00 -0700
committerBen Sima <ben@bsima.me>2020-04-10 18:23:38 -0700
commit61e21346a6947327bf5394f6c73499621c494986 (patch)
treeeeb9d3525137e09ee482710b651ab2c004c2cee6 /Com/MusicMeetsComics/Database.hs
parent2263381b305092390984561855856ab725561cf6 (diff)
Deploy herocomics.app production server
This also includes some drive-by formatting changes and config changes needed to get it up and running.
Diffstat (limited to 'Com/MusicMeetsComics/Database.hs')
-rw-r--r--Com/MusicMeetsComics/Database.hs23
1 files changed, 17 insertions, 6 deletions
diff --git a/Com/MusicMeetsComics/Database.hs b/Com/MusicMeetsComics/Database.hs
index 8178e9a..c5a0068 100644
--- a/Com/MusicMeetsComics/Database.hs
+++ b/Com/MusicMeetsComics/Database.hs
@@ -3,18 +3,19 @@
{-# LANGUAGE OverloadedStrings #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Com.MusicMeetsComics.Database
- (
- ComicDB
+ ( ComicDB
, getComics
, load
- ) where
+ , dummy
+ )
+where
import Com.MusicMeetsComics.App
-import Data.Map ( Map )
-import qualified Data.Map as Map
+import Data.Map ( Map )
+import qualified Data.Map as Map
import Dhall
import Protolude
-import Servant ( Handler )
+import Servant ( Handler )
type ComicDB = (Map ComicId Comic)
@@ -23,6 +24,16 @@ instance Interpret Comic
load :: IO ComicDB
load = listToComicDB <$> input auto "./comic-database.dhall"
+dummy :: IO ComicDB
+dummy = return $ listToComicDB
+ [ Comic { comicId = "ComicId"
+ , comicPages = 10
+ , comicName = "Dummy comic"
+ , comicIssue = "dummy issue"
+ , comicDescription = "Lorem ipsum"
+ }
+ ]
+
listToComicDB :: [Comic] -> ComicDB
listToComicDB ls = Map.fromList $ (,) <$> comicId <*> identity <$> ls