aboutsummaryrefslogtreecommitdiff
path: root/src/server/Model/Json/PaymentCategory.hs
blob: fd97674ba140feb2b0e68d846235cf775d962516 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
{-# LANGUAGE DeriveGeneric #-}

module Model.Json.PaymentCategory
  ( PaymentCategory(..)
  , fromPaymentCategory
  ) where

import Data.Aeson
import Data.Text (Text)
import GHC.Generics

import Model.Category (CategoryId)
import qualified Model.PaymentCategory as M

data PaymentCategory = PaymentCategory
  { name :: Text
  , category :: CategoryId
  } deriving (Show, Generic)

instance ToJSON PaymentCategory

fromPaymentCategory :: M.PaymentCategory -> PaymentCategory
fromPaymentCategory pc = PaymentCategory (M.name pc) (M.category pc)