Add simple (and bad) frontend

This commit is contained in:
2022-12-07 19:37:39 +01:00
parent 4be962a6fb
commit 5bd3832d27
9 changed files with 286 additions and 10 deletions
+13 -3
View File
@@ -70,11 +70,11 @@ locations = all_ garfieldDb.locations
-- Inserts
runIns
runInserts
:: Connection
-> SqlInsert Postgres table
-> [SqlInsert Postgres table]
-> IO ()
runIns conn i = runBeamPostgresDebug putStrLn conn $ runInsert i
runInserts conn is = runBeamPostgresDebug putStrLn conn $ mapM_ runInsert is
transfer
:: InventoryItemId -- ^ to
@@ -97,6 +97,16 @@ transfer from to amount
(val_ $ Text.pack $ printf "Umbuchung von %d" $ from.unInventoryItemId)
]
-- Updates
runUpdates :: Connection -> [SqlUpdate Postgres table] -> IO ()
runUpdates conn us = runBeamPostgresDebug putStrLn conn $ mapM_ runUpdate us
disableItem :: InventoryItemId -> SqlUpdate Postgres InventoryItemT
disableItem itemId = update (inventoryItems garfieldDb)
(\it -> it.available <-. val_ False)
(\it -> it.id ==. val_ itemId.unInventoryItemId)
-- Function calls
type SqlFunction a = Connection -> IO a