Add simple (and bad) frontend
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user