aboutsummaryrefslogtreecommitdiff
path: root/common/src/Common/Model
diff options
context:
space:
mode:
authorJoris2019-12-08 11:39:37 +0100
committerJoris2019-12-08 11:39:37 +0100
commit316bda10c6bec8b5ccc9e23f1f677c076205f046 (patch)
tree98da1d18834108af50f80ca6fa5c0f4facc42472 /common/src/Common/Model
parente622e8fdd2e40b4306b5cc724d8dfb76bf976242 (diff)
Add category page
Diffstat (limited to 'common/src/Common/Model')
-rw-r--r--common/src/Common/Model/Category.hs2
-rw-r--r--common/src/Common/Model/CategoryPage.hs17
-rw-r--r--common/src/Common/Model/CreateCategory.hs14
-rw-r--r--common/src/Common/Model/CreateCategoryForm.hs15
-rw-r--r--common/src/Common/Model/EditCategory.hs17
-rw-r--r--common/src/Common/Model/EditCategoryForm.hs18
6 files changed, 51 insertions, 32 deletions
diff --git a/common/src/Common/Model/Category.hs b/common/src/Common/Model/Category.hs
index db1da53..cc3f795 100644
--- a/common/src/Common/Model/Category.hs
+++ b/common/src/Common/Model/Category.hs
@@ -18,7 +18,7 @@ data Category = Category
, _category_createdAt :: UTCTime
, _category_editedAt :: Maybe UTCTime
, _category_deletedAt :: Maybe UTCTime
- } deriving (Show, Generic)
+ } 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
new file mode 100644
index 0000000..476b4ce
--- /dev/null
+++ b/common/src/Common/Model/CategoryPage.hs
@@ -0,0 +1,17 @@
+module Common.Model.CategoryPage
+ ( CategoryPage(..)
+ ) where
+
+import Data.Aeson (FromJSON, ToJSON)
+import GHC.Generics (Generic)
+
+import Common.Model.Category (Category)
+
+data CategoryPage = CategoryPage
+ { _categoryPage_page :: Int
+ , _categoryPage_categories :: [Category]
+ , _categoryPage_totalCount :: Int
+ } deriving (Eq, Show, Generic)
+
+instance FromJSON CategoryPage
+instance ToJSON CategoryPage
diff --git a/common/src/Common/Model/CreateCategory.hs b/common/src/Common/Model/CreateCategory.hs
deleted file mode 100644
index 51bd2a0..0000000
--- a/common/src/Common/Model/CreateCategory.hs
+++ /dev/null
@@ -1,14 +0,0 @@
-module Common.Model.CreateCategory
- ( CreateCategory(..)
- ) where
-
-import Data.Aeson (FromJSON)
-import Data.Text (Text)
-import GHC.Generics (Generic)
-
-data CreateCategory = CreateCategory
- { _createCategory_name :: Text
- , _createCategory_color :: Text
- } deriving (Show, Generic)
-
-instance FromJSON CreateCategory
diff --git a/common/src/Common/Model/CreateCategoryForm.hs b/common/src/Common/Model/CreateCategoryForm.hs
new file mode 100644
index 0000000..4668ef4
--- /dev/null
+++ b/common/src/Common/Model/CreateCategoryForm.hs
@@ -0,0 +1,15 @@
+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/EditCategory.hs b/common/src/Common/Model/EditCategory.hs
deleted file mode 100644
index 8b9d9eb..0000000
--- a/common/src/Common/Model/EditCategory.hs
+++ /dev/null
@@ -1,17 +0,0 @@
-module Common.Model.EditCategory
- ( EditCategory(..)
- ) where
-
-import Data.Aeson (FromJSON)
-import Data.Text (Text)
-import GHC.Generics (Generic)
-
-import Common.Model.Category (CategoryId)
-
-data EditCategory = EditCategory
- { _editCategory_id :: CategoryId
- , _editCategory_name :: Text
- , _editCategory_color :: Text
- } deriving (Show, Generic)
-
-instance FromJSON EditCategory
diff --git a/common/src/Common/Model/EditCategoryForm.hs b/common/src/Common/Model/EditCategoryForm.hs
new file mode 100644
index 0000000..a2ceca0
--- /dev/null
+++ b/common/src/Common/Model/EditCategoryForm.hs
@@ -0,0 +1,18 @@
+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