From 40b4994797a797b1fa86cafda789a5c488730c6d Mon Sep 17 00:00:00 2001 From: Joris Date: Sun, 28 Oct 2018 17:57:58 +0100 Subject: Delete payment --- common/common.cabal | 6 +++--- common/src/Common/Message/Key.hs | 4 ++-- common/src/Common/Message/Translation.hs | 12 ++++++------ common/src/Common/Model/CreatePayment.hs | 14 +++++++++++++- 4 files changed, 24 insertions(+), 12 deletions(-) (limited to 'common') diff --git a/common/common.cabal b/common/common.cabal index 6e5c8fb..151326a 100644 --- a/common/common.cabal +++ b/common/common.cabal @@ -21,12 +21,14 @@ Library Build-depends: aeson - , base >=4.9 && <4.11 + , base >=4.9 && <5 , text , time Exposed-modules: Common.Model + Common.Model.CreatePayment + Common.Model.Payment Common.Msg Common.Util.Text Common.Util.Time @@ -39,7 +41,6 @@ Library Common.Model.Category Common.Model.CreateCategory Common.Model.CreateIncome - Common.Model.CreatePayment Common.Model.Currency Common.Model.EditCategory Common.Model.EditIncome @@ -49,7 +50,6 @@ Library Common.Model.Init Common.Model.InitResult Common.Model.Payer - Common.Model.Payment Common.Model.PaymentCategory Common.Model.SignIn Common.Model.User diff --git a/common/src/Common/Message/Key.hs b/common/src/Common/Message/Key.hs index a6828d5..6e5f246 100644 --- a/common/src/Common/Message/Key.hs +++ b/common/src/Common/Message/Key.hs @@ -38,8 +38,8 @@ data Key = | Error_SignOut | Form_AlreadyExists - | Form_CostMustNotBeNull - | Form_Empty + | Form_NonEmpty + | Form_NonNullNumber | Form_GreaterIntThan Int | Form_InvalidCategory | Form_InvalidColor diff --git a/common/src/Common/Message/Translation.hs b/common/src/Common/Message/Translation.hs index 5ea12ad..70eb978 100644 --- a/common/src/Common/Message/Translation.hs +++ b/common/src/Common/Message/Translation.hs @@ -157,16 +157,16 @@ m l Form_AlreadyExists = English -> "Dupplicate field" French -> "Doublon" -m l Form_CostMustNotBeNull = - case l of - English -> "Cost must not be zero" - French -> "Le coût ne doît pas être nul" - -m l Form_Empty = +m l Form_NonEmpty = case l of English -> "Required field" French -> "Champ requis" +m l Form_NonNullNumber = + case l of + English -> "Number must not be null" + French -> "Le nombre ne doit pas être nul" + m l (Form_GreaterIntThan number) = case l of English -> T.concat [ "Integer smaller than ", T.pack . show $ number, " or equal required" ] diff --git a/common/src/Common/Model/CreatePayment.hs b/common/src/Common/Model/CreatePayment.hs index cd0b01d..c61423c 100644 --- a/common/src/Common/Model/CreatePayment.hs +++ b/common/src/Common/Model/CreatePayment.hs @@ -1,5 +1,6 @@ module Common.Model.CreatePayment - ( CreatePayment(..) + ( CreatePaymentError(..) + , CreatePayment(..) ) where import Data.Aeson (FromJSON, ToJSON) @@ -10,6 +11,17 @@ import GHC.Generics (Generic) import Common.Model.Category (CategoryId) import Common.Model.Frequency (Frequency) +data CreatePaymentError = CreatePaymentError + { _createPaymentError_name :: Maybe Text + , _createPaymentError_cost :: Maybe Text + , _createPaymentError_date :: Maybe Text + , _createPaymentError_category :: Maybe Text + , _createPaymentError_frequency :: Maybe Text + } deriving (Show, Generic) + +instance FromJSON CreatePaymentError +instance ToJSON CreatePaymentError + data CreatePayment = CreatePayment { _createPayment_name :: Text , _createPayment_cost :: Int -- cgit v1.2.3