aboutsummaryrefslogtreecommitdiff
path: root/common/src/Common/Model
diff options
context:
space:
mode:
Diffstat (limited to 'common/src/Common/Model')
-rw-r--r--common/src/Common/Model/Category.hs24
-rw-r--r--common/src/Common/Model/CategoryPage.hs18
-rw-r--r--common/src/Common/Model/CreateCategoryForm.hs15
-rw-r--r--common/src/Common/Model/CreateIncomeForm.hs15
-rw-r--r--common/src/Common/Model/CreatePaymentForm.hs21
-rw-r--r--common/src/Common/Model/Currency.hs12
-rw-r--r--common/src/Common/Model/EditCategoryForm.hs18
-rw-r--r--common/src/Common/Model/EditIncome.hs17
-rw-r--r--common/src/Common/Model/EditIncomeForm.hs18
-rw-r--r--common/src/Common/Model/EditPaymentForm.hs23
-rw-r--r--common/src/Common/Model/Email.hs12
-rw-r--r--common/src/Common/Model/ExceedingPayer.hs16
-rw-r--r--common/src/Common/Model/Frequency.hs14
-rw-r--r--common/src/Common/Model/Income.hs27
-rw-r--r--common/src/Common/Model/IncomeHeader.hs18
-rw-r--r--common/src/Common/Model/IncomePage.hs19
-rw-r--r--common/src/Common/Model/Init.hs18
-rw-r--r--common/src/Common/Model/Password.hs12
-rw-r--r--common/src/Common/Model/Payment.hs33
-rw-r--r--common/src/Common/Model/PaymentHeader.hs18
-rw-r--r--common/src/Common/Model/PaymentPage.hs21
-rw-r--r--common/src/Common/Model/SignInForm.hs15
-rw-r--r--common/src/Common/Model/Stats.hs23
-rw-r--r--common/src/Common/Model/User.hs27
24 files changed, 0 insertions, 454 deletions
diff --git a/common/src/Common/Model/Category.hs b/common/src/Common/Model/Category.hs
deleted file mode 100644
index cc3f795..0000000
--- a/common/src/Common/Model/Category.hs
+++ /dev/null
@@ -1,24 +0,0 @@
-module Common.Model.Category
- ( CategoryId
- , Category(..)
- ) where
-
-import Data.Aeson (FromJSON, ToJSON)
-import Data.Int (Int64)
-import Data.Text (Text)
-import Data.Time (UTCTime)
-import GHC.Generics (Generic)
-
-type CategoryId = Int64
-
-data Category = Category
- { _category_id :: CategoryId
- , _category_name :: Text
- , _category_color :: Text
- , _category_createdAt :: UTCTime
- , _category_editedAt :: Maybe UTCTime
- , _category_deletedAt :: Maybe UTCTime
- } deriving (Eq, Show, Generic)
-
-instance FromJSON Category
-instance ToJSON Category
diff --git a/common/src/Common/Model/CategoryPage.hs b/common/src/Common/Model/CategoryPage.hs
deleted file mode 100644
index e20f49f..0000000
--- a/common/src/Common/Model/CategoryPage.hs
+++ /dev/null
@@ -1,18 +0,0 @@
-module Common.Model.CategoryPage
- ( CategoryPage(..)
- ) where
-
-import Data.Aeson (FromJSON, ToJSON)
-import GHC.Generics (Generic)
-
-import Common.Model.Category (Category, CategoryId)
-
-data CategoryPage = CategoryPage
- { _categoryPage_page :: Int
- , _categoryPage_categories :: [Category]
- , _categoryPage_usedCategories :: [CategoryId]
- , _categoryPage_totalCount :: Int
- } deriving (Eq, Show, Generic)
-
-instance FromJSON CategoryPage
-instance ToJSON CategoryPage
diff --git a/common/src/Common/Model/CreateCategoryForm.hs b/common/src/Common/Model/CreateCategoryForm.hs
deleted file mode 100644
index 4668ef4..0000000
--- a/common/src/Common/Model/CreateCategoryForm.hs
+++ /dev/null
@@ -1,15 +0,0 @@
-module Common.Model.CreateCategoryForm
- ( CreateCategoryForm(..)
- ) where
-
-import Data.Aeson (FromJSON, ToJSON)
-import Data.Text (Text)
-import GHC.Generics (Generic)
-
-data CreateCategoryForm = CreateCategoryForm
- { _createCategoryForm_name :: Text
- , _createCategoryForm_color :: Text
- } deriving (Show, Generic)
-
-instance FromJSON CreateCategoryForm
-instance ToJSON CreateCategoryForm
diff --git a/common/src/Common/Model/CreateIncomeForm.hs b/common/src/Common/Model/CreateIncomeForm.hs
deleted file mode 100644
index e83bf0a..0000000
--- a/common/src/Common/Model/CreateIncomeForm.hs
+++ /dev/null
@@ -1,15 +0,0 @@
-module Common.Model.CreateIncomeForm
- ( CreateIncomeForm(..)
- ) where
-
-import Data.Aeson (FromJSON, ToJSON)
-import Data.Text (Text)
-import GHC.Generics (Generic)
-
-data CreateIncomeForm = CreateIncomeForm
- { _createIncomeForm_amount :: Text
- , _createIncomeForm_date :: Text
- } deriving (Show, Generic)
-
-instance FromJSON CreateIncomeForm
-instance ToJSON CreateIncomeForm
diff --git a/common/src/Common/Model/CreatePaymentForm.hs b/common/src/Common/Model/CreatePaymentForm.hs
deleted file mode 100644
index 60c5423..0000000
--- a/common/src/Common/Model/CreatePaymentForm.hs
+++ /dev/null
@@ -1,21 +0,0 @@
-module Common.Model.CreatePaymentForm
- ( CreatePaymentForm(..)
- ) where
-
-import Data.Aeson (FromJSON, ToJSON)
-import Data.Text (Text)
-import GHC.Generics (Generic)
-
-import Common.Model.Category (CategoryId)
-import Common.Model.Frequency (Frequency)
-
-data CreatePaymentForm = CreatePaymentForm
- { _createPaymentForm_name :: Text
- , _createPaymentForm_cost :: Text
- , _createPaymentForm_date :: Text
- , _createPaymentForm_category :: CategoryId
- , _createPaymentForm_frequency :: Frequency
- } deriving (Show, Generic)
-
-instance FromJSON CreatePaymentForm
-instance ToJSON CreatePaymentForm
diff --git a/common/src/Common/Model/Currency.hs b/common/src/Common/Model/Currency.hs
deleted file mode 100644
index 175aeba..0000000
--- a/common/src/Common/Model/Currency.hs
+++ /dev/null
@@ -1,12 +0,0 @@
-module Common.Model.Currency
- ( Currency(..)
- ) where
-
-import Data.Aeson (FromJSON, ToJSON)
-import Data.Text (Text)
-import GHC.Generics (Generic)
-
-newtype Currency = Currency Text deriving (Show, Generic)
-
-instance FromJSON Currency
-instance ToJSON Currency
diff --git a/common/src/Common/Model/EditCategoryForm.hs b/common/src/Common/Model/EditCategoryForm.hs
deleted file mode 100644
index a2ceca0..0000000
--- a/common/src/Common/Model/EditCategoryForm.hs
+++ /dev/null
@@ -1,18 +0,0 @@
-module Common.Model.EditCategoryForm
- ( EditCategoryForm(..)
- ) where
-
-import Data.Aeson (FromJSON, ToJSON)
-import Data.Text (Text)
-import GHC.Generics (Generic)
-
-import Common.Model.Category (CategoryId)
-
-data EditCategoryForm = EditCategoryForm
- { _editCategoryForm_id :: CategoryId
- , _editCategoryForm_name :: Text
- , _editCategoryForm_color :: Text
- } deriving (Show, Generic)
-
-instance FromJSON EditCategoryForm
-instance ToJSON EditCategoryForm
diff --git a/common/src/Common/Model/EditIncome.hs b/common/src/Common/Model/EditIncome.hs
deleted file mode 100644
index 0e65f12..0000000
--- a/common/src/Common/Model/EditIncome.hs
+++ /dev/null
@@ -1,17 +0,0 @@
-module Common.Model.EditIncome
- ( EditIncome(..)
- ) where
-
-import Data.Aeson (FromJSON)
-import Data.Time.Calendar (Day)
-import GHC.Generics (Generic)
-
-import Common.Model.Income (IncomeId)
-
-data EditIncome = EditIncome
- { _editIncome_id :: IncomeId
- , _editIncome_date :: Day
- , _editIncome_amount :: Int
- } deriving (Show, Generic)
-
-instance FromJSON EditIncome
diff --git a/common/src/Common/Model/EditIncomeForm.hs b/common/src/Common/Model/EditIncomeForm.hs
deleted file mode 100644
index ff975fc..0000000
--- a/common/src/Common/Model/EditIncomeForm.hs
+++ /dev/null
@@ -1,18 +0,0 @@
-module Common.Model.EditIncomeForm
- ( EditIncomeForm(..)
- ) where
-
-import Data.Aeson (FromJSON, ToJSON)
-import Data.Text (Text)
-import GHC.Generics (Generic)
-
-import Common.Model.Income (IncomeId)
-
-data EditIncomeForm = EditIncomeForm
- { _editIncomeForm_id :: IncomeId
- , _editIncomeForm_amount :: Text
- , _editIncomeForm_date :: Text
- } deriving (Show, Generic)
-
-instance FromJSON EditIncomeForm
-instance ToJSON EditIncomeForm
diff --git a/common/src/Common/Model/EditPaymentForm.hs b/common/src/Common/Model/EditPaymentForm.hs
deleted file mode 100644
index 168c9ff..0000000
--- a/common/src/Common/Model/EditPaymentForm.hs
+++ /dev/null
@@ -1,23 +0,0 @@
-module Common.Model.EditPaymentForm
- ( EditPaymentForm(..)
- ) where
-
-import Data.Aeson (FromJSON, ToJSON)
-import Data.Text (Text)
-import GHC.Generics (Generic)
-
-import Common.Model.Category (CategoryId)
-import Common.Model.Frequency (Frequency)
-import Common.Model.Payment (PaymentId)
-
-data EditPaymentForm = EditPaymentForm
- { _editPaymentForm_id :: PaymentId
- , _editPaymentForm_name :: Text
- , _editPaymentForm_cost :: Text
- , _editPaymentForm_date :: Text
- , _editPaymentForm_category :: CategoryId
- , _editPaymentForm_frequency :: Frequency
- } deriving (Show, Generic)
-
-instance FromJSON EditPaymentForm
-instance ToJSON EditPaymentForm
diff --git a/common/src/Common/Model/Email.hs b/common/src/Common/Model/Email.hs
deleted file mode 100644
index e938f83..0000000
--- a/common/src/Common/Model/Email.hs
+++ /dev/null
@@ -1,12 +0,0 @@
-module Common.Model.Email
- ( Email(..)
- ) where
-
-import Data.Aeson (FromJSON, ToJSON)
-import Data.Text (Text)
-import GHC.Generics (Generic)
-
-newtype Email = Email Text deriving (Show, Generic)
-
-instance FromJSON Email
-instance ToJSON Email
diff --git a/common/src/Common/Model/ExceedingPayer.hs b/common/src/Common/Model/ExceedingPayer.hs
deleted file mode 100644
index b7d3efb..0000000
--- a/common/src/Common/Model/ExceedingPayer.hs
+++ /dev/null
@@ -1,16 +0,0 @@
-module Common.Model.ExceedingPayer
- ( ExceedingPayer(..)
- ) where
-
-import Data.Aeson (FromJSON, ToJSON)
-import GHC.Generics (Generic)
-
-import Common.Model.User (UserId)
-
-data ExceedingPayer = ExceedingPayer
- { _exceedingPayer_userId :: UserId
- , _exceedingPayer_amount :: Int
- } deriving (Eq, Show, Generic)
-
-instance FromJSON ExceedingPayer
-instance ToJSON ExceedingPayer
diff --git a/common/src/Common/Model/Frequency.hs b/common/src/Common/Model/Frequency.hs
deleted file mode 100644
index 48e75ea..0000000
--- a/common/src/Common/Model/Frequency.hs
+++ /dev/null
@@ -1,14 +0,0 @@
-module Common.Model.Frequency
- ( Frequency(..)
- ) where
-
-import Data.Aeson (FromJSON, ToJSON)
-import GHC.Generics (Generic)
-
-data Frequency =
- Punctual
- | Monthly
- deriving (Eq, Read, Show, Generic, Ord)
-
-instance FromJSON Frequency
-instance ToJSON Frequency
diff --git a/common/src/Common/Model/Income.hs b/common/src/Common/Model/Income.hs
deleted file mode 100644
index 57d07f1..0000000
--- a/common/src/Common/Model/Income.hs
+++ /dev/null
@@ -1,27 +0,0 @@
-module Common.Model.Income
- ( IncomeId
- , Income(..)
- ) where
-
-import Data.Aeson (FromJSON, ToJSON)
-import Data.Int (Int64)
-import Data.Time (UTCTime)
-import Data.Time.Calendar (Day)
-import GHC.Generics (Generic)
-
-import Common.Model.User (UserId)
-
-type IncomeId = Int64
-
-data Income = Income
- { _income_id :: IncomeId
- , _income_userId :: UserId
- , _income_date :: Day
- , _income_amount :: Int
- , _income_createdAt :: UTCTime
- , _income_editedAt :: Maybe UTCTime
- , _income_deletedAt :: Maybe UTCTime
- } deriving (Eq, Show, Generic)
-
-instance FromJSON Income
-instance ToJSON Income
diff --git a/common/src/Common/Model/IncomeHeader.hs b/common/src/Common/Model/IncomeHeader.hs
deleted file mode 100644
index 7e712e8..0000000
--- a/common/src/Common/Model/IncomeHeader.hs
+++ /dev/null
@@ -1,18 +0,0 @@
-module Common.Model.IncomeHeader
- ( IncomeHeader(..)
- ) where
-
-import Data.Aeson (FromJSON, ToJSON)
-import Data.Map (Map)
-import Data.Time.Calendar (Day)
-import GHC.Generics (Generic)
-
-import Common.Model.User (UserId)
-
-data IncomeHeader = IncomeHeader
- { _incomeHeader_since :: Maybe Day
- , _incomeHeader_byUser :: Map UserId Int
- } deriving (Eq, Show, Generic)
-
-instance FromJSON IncomeHeader
-instance ToJSON IncomeHeader
diff --git a/common/src/Common/Model/IncomePage.hs b/common/src/Common/Model/IncomePage.hs
deleted file mode 100644
index 977b0ea..0000000
--- a/common/src/Common/Model/IncomePage.hs
+++ /dev/null
@@ -1,19 +0,0 @@
-module Common.Model.IncomePage
- ( IncomePage(..)
- ) where
-
-import Data.Aeson (FromJSON, ToJSON)
-import GHC.Generics (Generic)
-
-import Common.Model.Income (Income)
-import Common.Model.IncomeHeader (IncomeHeader)
-
-data IncomePage = IncomePage
- { _incomePage_page :: Int
- , _incomePage_header :: IncomeHeader
- , _incomePage_incomes :: [Income]
- , _incomePage_totalCount :: Int
- } deriving (Eq, Show, Generic)
-
-instance FromJSON IncomePage
-instance ToJSON IncomePage
diff --git a/common/src/Common/Model/Init.hs b/common/src/Common/Model/Init.hs
deleted file mode 100644
index 5ef1535..0000000
--- a/common/src/Common/Model/Init.hs
+++ /dev/null
@@ -1,18 +0,0 @@
-module Common.Model.Init
- ( Init(..)
- ) where
-
-import Data.Aeson (FromJSON, ToJSON)
-import GHC.Generics (Generic)
-
-import Common.Model.Currency (Currency)
-import Common.Model.User (User, UserId)
-
-data Init = Init
- { _init_users :: [User]
- , _init_currentUser :: UserId
- , _init_currency :: Currency
- } deriving (Show, Generic)
-
-instance FromJSON Init
-instance ToJSON Init
diff --git a/common/src/Common/Model/Password.hs b/common/src/Common/Model/Password.hs
deleted file mode 100644
index 1b51a47..0000000
--- a/common/src/Common/Model/Password.hs
+++ /dev/null
@@ -1,12 +0,0 @@
-module Common.Model.Password
- ( Password(..)
- ) where
-
-import Data.Aeson (FromJSON, ToJSON)
-import Data.Text (Text)
-import GHC.Generics (Generic)
-
-newtype Password = Password Text deriving (Show, Generic)
-
-instance FromJSON Password
-instance ToJSON Password
diff --git a/common/src/Common/Model/Payment.hs b/common/src/Common/Model/Payment.hs
deleted file mode 100644
index 733a145..0000000
--- a/common/src/Common/Model/Payment.hs
+++ /dev/null
@@ -1,33 +0,0 @@
-module Common.Model.Payment
- ( PaymentId
- , Payment(..)
- ) where
-
-import Data.Aeson (FromJSON, ToJSON)
-import Data.Int (Int64)
-import Data.Text (Text)
-import Data.Time (UTCTime)
-import Data.Time.Calendar (Day)
-import GHC.Generics (Generic)
-
-import Common.Model.Category (CategoryId)
-import Common.Model.Frequency
-import Common.Model.User (UserId)
-
-type PaymentId = Int64
-
-data Payment = Payment
- { _payment_id :: PaymentId
- , _payment_user :: UserId
- , _payment_name :: Text
- , _payment_cost :: Int
- , _payment_date :: Day
- , _payment_category :: CategoryId
- , _payment_frequency :: Frequency
- , _payment_createdAt :: UTCTime
- , _payment_editedAt :: Maybe UTCTime
- , _payment_deletedAt :: Maybe UTCTime
- } deriving (Eq, Show, Generic)
-
-instance FromJSON Payment
-instance ToJSON Payment
diff --git a/common/src/Common/Model/PaymentHeader.hs b/common/src/Common/Model/PaymentHeader.hs
deleted file mode 100644
index 35f5e1a..0000000
--- a/common/src/Common/Model/PaymentHeader.hs
+++ /dev/null
@@ -1,18 +0,0 @@
-module Common.Model.PaymentHeader
- ( PaymentHeader(..)
- ) where
-
-import Data.Aeson (FromJSON, ToJSON)
-import Data.Map (Map)
-import GHC.Generics (Generic)
-
-import Common.Model.ExceedingPayer (ExceedingPayer)
-import Common.Model.User (UserId)
-
-data PaymentHeader = PaymentHeader
- { _paymentHeader_exceedingPayers :: [ExceedingPayer]
- , _paymentHeader_repartition :: Map UserId Int
- } deriving (Eq, Show, Generic)
-
-instance FromJSON PaymentHeader
-instance ToJSON PaymentHeader
diff --git a/common/src/Common/Model/PaymentPage.hs b/common/src/Common/Model/PaymentPage.hs
deleted file mode 100644
index 88d9715..0000000
--- a/common/src/Common/Model/PaymentPage.hs
+++ /dev/null
@@ -1,21 +0,0 @@
-module Common.Model.PaymentPage
- ( PaymentPage(..)
- ) where
-
-import Data.Aeson (FromJSON, ToJSON)
-import GHC.Generics (Generic)
-
-import Common.Model.Frequency (Frequency)
-import Common.Model.Payment (Payment)
-import Common.Model.PaymentHeader (PaymentHeader)
-
-data PaymentPage = PaymentPage
- { _paymentPage_page :: Int
- , _paymentPage_frequency :: Frequency
- , _paymentPage_header :: PaymentHeader
- , _paymentPage_payments :: [Payment]
- , _paymentPage_totalCount :: Int
- } deriving (Eq, Show, Generic)
-
-instance FromJSON PaymentPage
-instance ToJSON PaymentPage
diff --git a/common/src/Common/Model/SignInForm.hs b/common/src/Common/Model/SignInForm.hs
deleted file mode 100644
index 7a25935..0000000
--- a/common/src/Common/Model/SignInForm.hs
+++ /dev/null
@@ -1,15 +0,0 @@
-module Common.Model.SignInForm
- ( SignInForm(..)
- ) where
-
-import Data.Aeson (FromJSON, ToJSON)
-import Data.Text (Text)
-import GHC.Generics (Generic)
-
-data SignInForm = SignInForm
- { _signInForm_email :: Text
- , _signInForm_password :: Text
- } deriving (Show, Generic)
-
-instance FromJSON SignInForm
-instance ToJSON SignInForm
diff --git a/common/src/Common/Model/Stats.hs b/common/src/Common/Model/Stats.hs
deleted file mode 100644
index 86e6ab9..0000000
--- a/common/src/Common/Model/Stats.hs
+++ /dev/null
@@ -1,23 +0,0 @@
-module Common.Model.Stats
- ( Stats
- , MonthStats(..)
- ) where
-
-import Data.Aeson (FromJSON, ToJSON)
-import Data.Map (Map)
-import Data.Time.Calendar (Day)
-import GHC.Generics (Generic)
-
-import Common.Model.Category (CategoryId)
-import Common.Model.User (UserId)
-
-type Stats = [MonthStats]
-
-data MonthStats = MonthStats
- { _monthStats_start :: Day
- , _monthStats_paymentsByCategory :: Map CategoryId Int
- , _monthStats_incomeByUser :: Map UserId Int
- } deriving (Eq, Show, Generic)
-
-instance FromJSON MonthStats
-instance ToJSON MonthStats
diff --git a/common/src/Common/Model/User.hs b/common/src/Common/Model/User.hs
deleted file mode 100644
index a30d104..0000000
--- a/common/src/Common/Model/User.hs
+++ /dev/null
@@ -1,27 +0,0 @@
-module Common.Model.User
- ( UserId
- , User(..)
- , findUser
- ) where
-
-import Data.Aeson (FromJSON, ToJSON)
-import Data.Int (Int64)
-import qualified Data.List as L
-import Data.Text (Text)
-import Data.Time (UTCTime)
-import GHC.Generics (Generic)
-
-type UserId = Int64
-
-data User = User
- { _user_id :: UserId
- , _user_creation :: UTCTime
- , _user_email :: Text
- , _user_name :: Text
- } deriving (Show, Generic)
-
-instance FromJSON User
-instance ToJSON User
-
-findUser :: UserId -> [User] -> Maybe User
-findUser userId users = L.find ((== userId) . _user_id) users