From d2f0ffc899049ede97f5bc986788f21de38b7bb2 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Wed, 8 May 2019 10:27:30 +0200 Subject: [PATCH] Document `deleteR` --- src/Handler/Utils/Delete.hs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Handler/Utils/Delete.hs b/src/Handler/Utils/Delete.hs index e4e1cbff1..149ab8285 100644 --- a/src/Handler/Utils/Delete.hs +++ b/src/Handler/Utils/Delete.hs @@ -32,11 +32,11 @@ import qualified Database.Esqueleto.Internal.Language as E (From) data DeleteRoute record = forall tables infoExpr info. (E.SqlSelect infoExpr info, E.From E.SqlQuery E.SqlExpr SqlBackend tables) => DeleteRoute - { drRecords :: Set (Key record) - , drGetInfo :: tables -> E.SqlQuery infoExpr - , drUnjoin :: tables -> E.SqlExpr (Entity record) - , drRenderRecord :: info -> ReaderT SqlBackend (HandlerT UniWorX IO) Widget - , drRecordConfirmString :: info -> ReaderT SqlBackend (HandlerT UniWorX IO) Text + { drRecords :: Set (Key record) -- ^ Records to be deleted + , drGetInfo :: tables -> E.SqlQuery infoExpr -- ^ SQL-Query to get necessary information to render identifing information about records to the user (`drRenderRecord`, `drRecordConfirmString`); @tables@ is an arbitrary join, see `E.from`; @infoExpr@ gets converted to @info@ by esqueleto + , drUnjoin :: tables -> E.SqlExpr (Entity record) -- ^ `E.SqlExpr` of @Key record@ extracted from @tables@, `deleteR` restricts `drGetInfo` to `drRecords` automatically + , drRenderRecord :: info -> ReaderT SqlBackend (HandlerT UniWorX IO) Widget -- ^ Present a single record, to be deleted, to the user for inspection prior to deletion + , drRecordConfirmString :: info -> ReaderT SqlBackend (HandlerT UniWorX IO) Text -- ^ Text for the user to copy to confirm deletion; should probably contain all information from `drRenderRecord` so user gets prompted to think about what they're deleting , drCaption , drSuccessMessage :: SomeMessage UniWorX , drAbort