aboutsummaryrefslogtreecommitdiff
path: root/server/src/Validation
diff options
context:
space:
mode:
authorJoris2021-01-03 13:40:40 +0100
committerJoris2021-01-03 13:54:20 +0100
commit11052951b74b9ad4b6a9412ae490086235f9154b (patch)
tree64526ac926c1bf470ea113f6cac8a33158684e8d /server/src/Validation
parent371449b0e312a03162b78797b83dee9d81706669 (diff)
Rewrite in Rust
Diffstat (limited to 'server/src/Validation')
-rw-r--r--server/src/Validation/Category.hs27
-rw-r--r--server/src/Validation/Income.hs27
-rw-r--r--server/src/Validation/Payment.hs33
-rw-r--r--server/src/Validation/SignIn.hs16
4 files changed, 0 insertions, 103 deletions
diff --git a/server/src/Validation/Category.hs b/server/src/Validation/Category.hs
deleted file mode 100644
index 12f2117..0000000
--- a/server/src/Validation/Category.hs
+++ /dev/null
@@ -1,27 +0,0 @@
-module Validation.Category
- ( createCategory
- , editCategory
- ) where
-
-import Data.Text (Text)
-import Data.Validation (Validation)
-import qualified Data.Validation as V
-
-import Common.Model (CreateCategoryForm (..),
- EditCategoryForm (..))
-import qualified Common.Validation.Category as CategoryValidation
-import Model.CreateCategory (CreateCategory (..))
-import Model.EditCategory (EditCategory (..))
-
-createCategory :: CreateCategoryForm -> Validation Text CreateCategory
-createCategory form =
- CreateCategory
- <$> CategoryValidation.name (_createCategoryForm_name form)
- <*> CategoryValidation.color (_createCategoryForm_color form)
-
-editCategory :: EditCategoryForm -> Validation Text EditCategory
-editCategory form =
- EditCategory
- <$> V.Success (_editCategoryForm_id form)
- <*> CategoryValidation.name (_editCategoryForm_name form)
- <*> CategoryValidation.color (_editCategoryForm_color form)
diff --git a/server/src/Validation/Income.hs b/server/src/Validation/Income.hs
deleted file mode 100644
index 5e034d1..0000000
--- a/server/src/Validation/Income.hs
+++ /dev/null
@@ -1,27 +0,0 @@
-module Validation.Income
- ( createIncome
- , editIncome
- ) where
-
-import Data.Text (Text)
-import Data.Validation (Validation)
-import qualified Data.Validation as V
-
-import Common.Model (CreateIncomeForm (..),
- EditIncomeForm (..))
-import qualified Common.Validation.Income as IncomeValidation
-import Model.CreateIncome (CreateIncome (..))
-import Model.EditIncome (EditIncome (..))
-
-createIncome :: CreateIncomeForm -> Validation Text CreateIncome
-createIncome form =
- CreateIncome
- <$> IncomeValidation.amount (_createIncomeForm_amount form)
- <*> IncomeValidation.date (_createIncomeForm_date form)
-
-editIncome :: EditIncomeForm -> Validation Text EditIncome
-editIncome form =
- EditIncome
- <$> V.Success (_editIncomeForm_id form)
- <*> IncomeValidation.amount (_editIncomeForm_amount form)
- <*> IncomeValidation.date (_editIncomeForm_date form)
diff --git a/server/src/Validation/Payment.hs b/server/src/Validation/Payment.hs
deleted file mode 100644
index 20e370e..0000000
--- a/server/src/Validation/Payment.hs
+++ /dev/null
@@ -1,33 +0,0 @@
-module Validation.Payment
- ( createPayment
- , editPayment
- ) where
-
-import Data.Text (Text)
-import Data.Validation (Validation)
-import qualified Data.Validation as V
-
-import Common.Model (CategoryId, CreatePaymentForm (..),
- EditPaymentForm (..))
-import qualified Common.Validation.Payment as PaymentValidation
-import Model.CreatePayment (CreatePayment (..))
-import Model.EditPayment (EditPayment (..))
-
-createPayment :: [CategoryId] -> CreatePaymentForm -> Validation Text CreatePayment
-createPayment categories form =
- CreatePayment
- <$> PaymentValidation.name (_createPaymentForm_name form)
- <*> PaymentValidation.cost (_createPaymentForm_cost form)
- <*> PaymentValidation.date (_createPaymentForm_date form)
- <*> PaymentValidation.category categories (_createPaymentForm_category form)
- <*> V.Success (_createPaymentForm_frequency form)
-
-editPayment :: [CategoryId] -> EditPaymentForm -> Validation Text EditPayment
-editPayment categories form =
- EditPayment
- <$> V.Success (_editPaymentForm_id form)
- <*> PaymentValidation.name (_editPaymentForm_name form)
- <*> PaymentValidation.cost (_editPaymentForm_cost form)
- <*> PaymentValidation.date (_editPaymentForm_date form)
- <*> PaymentValidation.category categories (_editPaymentForm_category form)
- <*> V.Success (_editPaymentForm_frequency form)
diff --git a/server/src/Validation/SignIn.hs b/server/src/Validation/SignIn.hs
deleted file mode 100644
index dc86122..0000000
--- a/server/src/Validation/SignIn.hs
+++ /dev/null
@@ -1,16 +0,0 @@
-module Validation.SignIn
- ( signIn
- ) where
-
-import Data.Text (Text)
-import Data.Validation (Validation)
-
-import Common.Model (SignInForm (..))
-import qualified Common.Validation.SignIn as SignInValidation
-import Model.SignIn (SignIn (..))
-
-signIn :: SignInForm -> Validation Text SignIn
-signIn form =
- SignIn
- <$> SignInValidation.email (_signInForm_email form)
- <*> SignInValidation.password (_signInForm_password form)