aboutsummaryrefslogtreecommitdiff
path: root/src/client/Model
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/Model')
-rw-r--r--src/client/Model/Category.elm35
-rw-r--r--src/client/Model/Conf.elm13
-rw-r--r--src/client/Model/Date.elm15
-rw-r--r--src/client/Model/Frequency.elm36
-rw-r--r--src/client/Model/Income.elm101
-rw-r--r--src/client/Model/Init.elm31
-rw-r--r--src/client/Model/InitResult.elm28
-rw-r--r--src/client/Model/Payer.elm137
-rw-r--r--src/client/Model/Payment.elm117
-rw-r--r--src/client/Model/PaymentCategory.elm61
-rw-r--r--src/client/Model/Size.elm17
-rw-r--r--src/client/Model/Translations.elm68
-rw-r--r--src/client/Model/User.elm44
-rw-r--r--src/client/Model/View.elm12
14 files changed, 0 insertions, 715 deletions
diff --git a/src/client/Model/Category.elm b/src/client/Model/Category.elm
deleted file mode 100644
index 8b653a7..0000000
--- a/src/client/Model/Category.elm
+++ /dev/null
@@ -1,35 +0,0 @@
-module Model.Category exposing
- ( Categories
- , Category
- , CategoryId
- , categoriesDecoder
- , categoryIdDecoder
- , empty
- )
-
-import Json.Decode as Decode exposing (Decoder)
-import Utils.Json as Json
-import Dict exposing (Dict)
-
-type alias Categories = Dict CategoryId Category
-
-type alias CategoryId = Int
-
-type alias Category =
- { name : String
- , color : String
- }
-
-categoriesDecoder : Decoder Categories
-categoriesDecoder =
- Json.dictDecoder (Decode.field "id" categoryIdDecoder) <|
- Decode.map2
- Category
- (Decode.field "name" Decode.string)
- (Decode.field "color" Decode.string)
-
-categoryIdDecoder : Decoder CategoryId
-categoryIdDecoder = Decode.int
-
-empty : Categories
-empty = Dict.empty
diff --git a/src/client/Model/Conf.elm b/src/client/Model/Conf.elm
deleted file mode 100644
index 308fa04..0000000
--- a/src/client/Model/Conf.elm
+++ /dev/null
@@ -1,13 +0,0 @@
-module Model.Conf exposing
- ( Conf
- , confDecoder
- )
-
-import Json.Decode as Decode exposing (Decoder)
-
-type alias Conf =
- { currency : String
- }
-
-confDecoder : Decoder Conf
-confDecoder = Decode.map Conf (Decode.field "currency" Decode.string)
diff --git a/src/client/Model/Date.elm b/src/client/Model/Date.elm
deleted file mode 100644
index bfba02f..0000000
--- a/src/client/Model/Date.elm
+++ /dev/null
@@ -1,15 +0,0 @@
-module Model.Date exposing
- ( timeDecoder
- , dateDecoder
- )
-
-import Date as Date exposing (Date)
-import Json.Decode as Decode exposing (Decoder)
-import Json.Decode.Extra as Decode
-import Time exposing (Time)
-
-timeDecoder : Decoder Time
-timeDecoder = Decode.map Date.toTime dateDecoder
-
-dateDecoder : Decoder Date
-dateDecoder = Decode.string |> Decode.andThen (Date.fromString >> Decode.fromResult)
diff --git a/src/client/Model/Frequency.elm b/src/client/Model/Frequency.elm
deleted file mode 100644
index 40f9893..0000000
--- a/src/client/Model/Frequency.elm
+++ /dev/null
@@ -1,36 +0,0 @@
-module Model.Frequency exposing
- ( Frequency(..)
- , decoder
- , validate
- , fromString
- )
-
-import Json.Decode as Decode exposing (Decoder)
-import Json.Decode.Extra as Decode
-
-import Form.Validate as Validate exposing (Validation)
-
-type Frequency = Punctual | Monthly
-
-decoder : Decoder Frequency
-decoder =
- let frequencyResult input =
- fromString input
- |> Result.fromMaybe ("Could not deduce Punctual nor Monthly from " ++ input)
- in Decode.string |> Decode.andThen (Decode.fromResult << frequencyResult)
-
-validate : Validation String Frequency
-validate =
- Validate.customValidation Validate.string (\str ->
- fromString str
- |> Result.fromMaybe (Validate.customError "InvalidFrequency")
- )
-
-fromString : String -> Maybe Frequency
-fromString str =
- if str == toString Punctual then
- Just Punctual
- else if str == toString Monthly then
- Just Monthly
- else
- Nothing
diff --git a/src/client/Model/Income.elm b/src/client/Model/Income.elm
deleted file mode 100644
index aa5f05f..0000000
--- a/src/client/Model/Income.elm
+++ /dev/null
@@ -1,101 +0,0 @@
-module Model.Income exposing
- ( Incomes
- , Income
- , IncomeId
- , incomesDecoder
- , incomeIdDecoder
- , incomeDefinedForAll
- , userCumulativeIncomeSince
- , cumulativeIncomesSince
- )
-
-import Dict exposing (Dict)
-import Json.Decode as Decode exposing (Decoder)
-import List exposing (..)
-import Maybe.Extra as Maybe
-import Time exposing (Time, hour)
-import Utils.Json as Json
-
-import Model.Date exposing (timeDecoder)
-import Model.User exposing (UserId, userIdDecoder)
-
-type alias Incomes = Dict IncomeId Income
-
-type alias IncomeId = Int
-
-type alias Income =
- { userId : UserId
- , time : Float
- , amount : Int
- }
-
-incomesDecoder : Decoder Incomes
-incomesDecoder =
- Json.dictDecoder (Decode.field "id" incomeIdDecoder) <|
- Decode.map3 Income
- (Decode.field "userId" userIdDecoder)
- (Decode.field "date" timeDecoder)
- (Decode.field "amount" Decode.int)
-
-incomeIdDecoder : Decoder IncomeId
-incomeIdDecoder = Decode.int
-
-incomeDefinedForAll : List UserId -> Incomes -> Maybe Time
-incomeDefinedForAll userIds incomes =
- let userIncomes = List.map (\userId -> List.filter ((==) userId << .userId) << Dict.values <| incomes) userIds
- firstIncomes = map (head << sortBy .time) userIncomes
- in if all Maybe.isJust firstIncomes
- then head << reverse << List.sort << map .time << Maybe.values <| firstIncomes
- else Nothing
-
-userCumulativeIncomeSince : Time -> Time -> Incomes -> UserId -> Int
-userCumulativeIncomeSince currentTime since incomes userId =
- incomes
- |> Dict.values
- |> List.filter (\income -> income.userId == userId)
- |> cumulativeIncomesSince currentTime since
-
-cumulativeIncomesSince : Time -> Time -> (List Income) -> Int
-cumulativeIncomesSince currentTime since incomes =
- cumulativeIncome currentTime (getOrderedIncomesSince since incomes)
-
-getOrderedIncomesSince : Time -> List Income -> List Income
-getOrderedIncomesSince time incomes =
- let mbStarterIncome = getIncomeAt time incomes
- orderedIncomesSince = filter (\income -> income.time >= time) incomes
- in (Maybe.toList mbStarterIncome) ++ orderedIncomesSince
-
-getIncomeAt : Time -> List Income -> Maybe Income
-getIncomeAt time incomes =
- case incomes of
- [x] ->
- if x.time < time
- then Just { userId = x.userId, time = time, amount = x.amount }
- else Nothing
- x1 :: x2 :: xs ->
- if x1.time < time && x2.time >= time
- then Just { userId = x1.userId, time = time, amount = x1.amount }
- else getIncomeAt time (x2 :: xs)
- [] ->
- Nothing
-
-cumulativeIncome : Time -> List Income -> Int
-cumulativeIncome currentTime incomes =
- getIncomesWithDuration currentTime (List.sortBy .time incomes)
- |> map durationIncome
- |> sum
-
-getIncomesWithDuration : Time -> List Income -> List (Float, Int)
-getIncomesWithDuration currentTime incomes =
- case incomes of
- [] ->
- []
- [income] ->
- [(currentTime - income.time, income.amount)]
- (income1 :: income2 :: xs) ->
- (income2.time - income1.time, income1.amount) :: (getIncomesWithDuration currentTime (income2 :: xs))
-
-durationIncome : (Float, Int) -> Int
-durationIncome (duration, income) =
- duration * toFloat income / (hour * 24 * 365 / 12)
- |> truncate
diff --git a/src/client/Model/Init.elm b/src/client/Model/Init.elm
deleted file mode 100644
index db7069f..0000000
--- a/src/client/Model/Init.elm
+++ /dev/null
@@ -1,31 +0,0 @@
-module Model.Init exposing
- ( Init
- , initDecoder
- )
-
-import Json.Decode as Decode exposing (Decoder)
-
-import Model.Payment exposing (Payments, paymentsDecoder)
-import Model.User exposing (Users, UserId, usersDecoder, userIdDecoder)
-import Model.Income exposing (Incomes, incomesDecoder)
-import Model.Category exposing (Categories, categoriesDecoder)
-import Model.PaymentCategory exposing (PaymentCategories, paymentCategoriesDecoder)
-
-type alias Init =
- { users : Users
- , me : UserId
- , payments : Payments
- , incomes : Incomes
- , categories : Categories
- , paymentCategories : PaymentCategories
- }
-
-initDecoder : Decoder Init
-initDecoder =
- Decode.map6 Init
- (Decode.field "users" usersDecoder)
- (Decode.field "me" userIdDecoder)
- (Decode.field "payments" paymentsDecoder)
- (Decode.field "incomes" incomesDecoder)
- (Decode.field "categories" categoriesDecoder)
- (Decode.field "paymentCategories" paymentCategoriesDecoder)
diff --git a/src/client/Model/InitResult.elm b/src/client/Model/InitResult.elm
deleted file mode 100644
index 7ce0be2..0000000
--- a/src/client/Model/InitResult.elm
+++ /dev/null
@@ -1,28 +0,0 @@
-module Model.InitResult exposing
- ( InitResult(..)
- , initResultDecoder
- )
-
-import Json.Decode as Decode exposing (Decoder)
-
-import Model.Init exposing (Init, initDecoder)
-
-type InitResult =
- InitEmpty
- | InitSuccess Init
- | InitError String
-
-initResultDecoder : Decoder InitResult
-initResultDecoder = (Decode.field "tag" Decode.string) |> Decode.andThen initResultDecoderWithTag
-
-initResultDecoderWithTag : String -> Decoder InitResult
-initResultDecoderWithTag tag =
- case tag of
- "InitEmpty" ->
- Decode.succeed InitEmpty
- "InitSuccess" ->
- Decode.map InitSuccess (Decode.field "contents" initDecoder)
- "InitError" ->
- Decode.map InitError (Decode.field "contents" Decode.string)
- _ ->
- Decode.fail <| "got " ++ tag ++ " for InitResult"
diff --git a/src/client/Model/Payer.elm b/src/client/Model/Payer.elm
deleted file mode 100644
index 4d9190e..0000000
--- a/src/client/Model/Payer.elm
+++ /dev/null
@@ -1,137 +0,0 @@
-module Model.Payer exposing
- ( Payers
- , Payer
- , ExceedingPayer
- , getOrderedExceedingPayers
- , useIncomesFrom
- )
-
-import Dict exposing (..)
-import List
-import Maybe
-import Time exposing (Time)
-import Date
-
-import Model.Payment exposing (Payments, totalPayments)
-import Model.User exposing (Users, UserId, userIdDecoder)
-import Model.Income exposing (..)
-
-import Utils.Dict exposing (mapValues)
-
-type alias Payers = Dict UserId Payer
-
-type alias Payer =
- { preIncomePaymentSum : Int
- , postIncomePaymentSum : Int
- , incomes : List Income
- }
-
-type alias PostPaymentPayer =
- { preIncomePaymentSum : Int
- , cumulativeIncome : Int
- , ratio : Float
- }
-
-type alias ExceedingPayer =
- { userId : UserId
- , amount : Int
- }
-
-getOrderedExceedingPayers : Time -> Users -> Incomes -> Payments -> List ExceedingPayer
-getOrderedExceedingPayers currentTime users incomes payments =
- let payers = getPayers currentTime users incomes payments
- exceedingPayersOnPreIncome =
- payers
- |> mapValues .preIncomePaymentSum
- |> Dict.toList
- |> exceedingPayersFromAmounts
- mbSince = useIncomesFrom users incomes payments
- in case mbSince of
- Just since ->
- let postPaymentPayers = mapValues (getPostPaymentPayer currentTime since) payers
- mbMaxRatio =
- postPaymentPayers
- |> Dict.toList
- |> List.map (.ratio << Tuple.second)
- |> List.maximum
- in case mbMaxRatio of
- Just maxRatio ->
- postPaymentPayers
- |> mapValues (getFinalDiff maxRatio)
- |> Dict.toList
- |> exceedingPayersFromAmounts
- Nothing ->
- exceedingPayersOnPreIncome
- _ ->
- exceedingPayersOnPreIncome
-
-useIncomesFrom : Users -> Incomes -> Payments -> Maybe Time
-useIncomesFrom users incomes payments =
- let firstPaymentTime =
- payments
- |> List.map (Date.toTime << .date)
- |> List.sort
- |> List.head
- mbIncomeTime = incomeDefinedForAll (Dict.keys users) incomes
- in case (firstPaymentTime, mbIncomeTime) of
- (Just paymentTime, Just incomeTime) ->
- Just (max paymentTime incomeTime)
- _ ->
- Nothing
-
-getPayers : Time -> Users -> Incomes -> Payments -> Payers
-getPayers currentTime users incomes payments =
- let userIds = Dict.keys users
- incomesDefined = incomeDefinedForAll userIds incomes
- in userIds
- |> List.map (\userId ->
- ( userId
- , { preIncomePaymentSum =
- totalPayments
- (\p -> (Date.toTime p.date) < (Maybe.withDefault currentTime incomesDefined))
- userId
- payments
- , postIncomePaymentSum =
- totalPayments
- (\p ->
- case incomesDefined of
- Nothing -> False
- Just t -> (Date.toTime p.date) >= t
- )
- userId
- payments
- , incomes = List.filter ((==) userId << .userId) (Dict.values incomes)
- }
- )
- )
- |> Dict.fromList
-
-exceedingPayersFromAmounts : List (UserId, Int) -> List ExceedingPayer
-exceedingPayersFromAmounts userAmounts =
- let mbMinAmount = List.minimum << List.map Tuple.second <| userAmounts
- in case mbMinAmount of
- Nothing ->
- []
- Just minAmount ->
- userAmounts
- |> List.map (\userAmount ->
- { userId = Tuple.first userAmount
- , amount = Tuple.second userAmount - minAmount
- }
- )
- |> List.filter (\payer -> payer.amount > 0)
-
-getPostPaymentPayer : Time -> Time -> Payer -> PostPaymentPayer
-getPostPaymentPayer currentTime since payer =
- let cumulativeIncome = cumulativeIncomesSince currentTime since payer.incomes
- in { preIncomePaymentSum = payer.preIncomePaymentSum
- , cumulativeIncome = cumulativeIncome
- , ratio = toFloat payer.postIncomePaymentSum / toFloat cumulativeIncome
- }
-
-getFinalDiff : Float -> PostPaymentPayer -> Int
-getFinalDiff maxRatio payer =
- let postIncomeDiff =
- -1 * (maxRatio - payer.ratio) * toFloat payer.cumulativeIncome
- |> truncate
- in postIncomeDiff + payer.preIncomePaymentSum
diff --git a/src/client/Model/Payment.elm b/src/client/Model/Payment.elm
deleted file mode 100644
index 204f9f5..0000000
--- a/src/client/Model/Payment.elm
+++ /dev/null
@@ -1,117 +0,0 @@
-module Model.Payment exposing
- ( perPage
- , Payments
- , Payment
- , PaymentId
- , paymentsDecoder
- , paymentIdDecoder
- , find
- , edit
- , delete
- , totalPayments
- , punctual
- , monthly
- , groupAndSortByMonth
- , search
- )
-
-import Date exposing (..)
-import Date.Extra.Core exposing (monthToInt, intToMonth)
-import Json.Decode as Decode exposing (Decoder)
-import Json.Decode.Extra as Decode
-import List
-import List.Extra as List
-
-import Form.Validate as Validate exposing (Validation)
-import Model.Date exposing (dateDecoder)
-import Model.Frequency as Frequency exposing (Frequency(..))
-import Model.User exposing (UserId, userIdDecoder)
-import Utils.List as List
-import Utils.Search as Search
-
-perPage : Int
-perPage = 7
-
-type alias Payments = List Payment
-
-type alias Payment =
- { id : PaymentId
- , name : String
- , cost : Int
- , date : Date
- , userId : UserId
- , frequency : Frequency
- }
-
-type alias PaymentId = Int
-
-paymentsDecoder : Decoder Payments
-paymentsDecoder = Decode.list paymentDecoder
-
-paymentDecoder : Decoder Payment
-paymentDecoder =
- Decode.map6 Payment
- (Decode.field "id" paymentIdDecoder)
- (Decode.field "name" Decode.string)
- (Decode.field "cost" Decode.int)
- (Decode.field "date" dateDecoder)
- (Decode.field "userId" userIdDecoder)
- (Decode.field "frequency" Frequency.decoder)
-
-paymentIdDecoder : Decoder PaymentId
-paymentIdDecoder = Decode.int
-
-find : PaymentId -> Payments -> Maybe Payment
-find paymentId payments =
- payments
- |> List.find (\p -> p.id == paymentId)
-
-edit : Payment -> Payments -> Payments
-edit payment payments = payment :: delete payment.id payments
-
-delete : PaymentId -> Payments -> Payments
-delete paymentId = List.filter (((/=) paymentId) << .id)
-
-totalPayments : (Payment -> Bool) -> UserId -> Payments -> Int
-totalPayments paymentFilter userId payments =
- payments
- |> List.filter (\payment ->
- paymentFilter payment
- && payment.userId == userId
- )
- |> List.map .cost
- |> List.sum
-
-punctual : Payments -> Payments
-punctual = List.filter ((==) Punctual << .frequency)
-
-monthly : Payments -> Payments
-monthly = List.filter ((==) Monthly << .frequency)
-
-groupAndSortByMonth : Payments -> List ((Month, Int), Payments)
-groupAndSortByMonth payments =
- payments
- |> List.groupBy (\payment -> (Date.year payment.date, monthToInt << Date.month <| payment.date))
- |> List.sortBy Tuple.first
- |> List.map (\((year, month), payments) -> ((intToMonth month, year), payments))
-
-search : String -> Frequency -> Payments -> Payments
-search name frequency payments =
- payments
- |> List.filter ((==) frequency << .frequency)
- |> paymentSort frequency
- |> List.filter (searchSuccess name)
-
-paymentSort : Frequency -> Payments -> Payments
-paymentSort frequency =
- case frequency of
- Punctual -> List.reverse << List.sortBy (Date.toTime << .date)
- Monthly -> List.sortBy (String.toLower << .name)
-
-searchSuccess : String -> Payment -> Bool
-searchSuccess search { name, cost } =
- let searchSuccessWord word =
- ( String.contains (Search.format word) (Search.format name)
- || String.contains word (toString cost)
- )
- in List.all searchSuccessWord (String.words search)
diff --git a/src/client/Model/PaymentCategory.elm b/src/client/Model/PaymentCategory.elm
deleted file mode 100644
index a4fceb1..0000000
--- a/src/client/Model/PaymentCategory.elm
+++ /dev/null
@@ -1,61 +0,0 @@
-module Model.PaymentCategory exposing
- ( PaymentCategories
- , paymentCategoriesDecoder
- , search
- , groupPaymentsByCategory
- , isCategoryUnused
- , save
- )
-
-import Dict exposing (Dict)
-import Json.Decode as Decode exposing (Decoder)
-import List.Extra as List
-import Maybe.Extra as Maybe
-
-import Model.Category exposing (CategoryId, categoryIdDecoder)
-import Model.Payment exposing (Payments)
-import Utils.Json as Json
-import Utils.List as List
-import Utils.Search as Search
-
-type alias PaymentCategories = List PaymentCategory
-
-type alias PaymentCategory =
- { name : String
- , category : CategoryId
- }
-
-paymentCategoriesDecoder : Decoder PaymentCategories
-paymentCategoriesDecoder =
- Decode.list <| Decode.map2 PaymentCategory
- (Decode.field "name" Decode.string)
- (Decode.field "category" categoryIdDecoder)
-
-groupPaymentsByCategory : PaymentCategories -> Payments -> List (CategoryId, Payments)
-groupPaymentsByCategory paymentCategories payments =
- payments
- |> List.groupBy (\payment ->
- search payment.name paymentCategories
- |> Maybe.withDefault -1
- )
- |> List.filterMap (\(category, payments) ->
- case category of
- -1 -> Nothing
- _ -> Just (category, payments)
- )
-
-search : String -> PaymentCategories -> Maybe CategoryId
-search paymentName paymentCategories =
- paymentCategories
- |> List.find (\pc -> Search.format pc.name == Search.format paymentName)
- |> Maybe.map .category
-
-isCategoryUnused : CategoryId -> PaymentCategories -> Bool
-isCategoryUnused category paymentCategories =
- paymentCategories
- |> List.find ((==) category << .category)
- |> Maybe.isNothing
-
-save : String -> CategoryId -> PaymentCategories -> PaymentCategories
-save name category paymentCategories =
- { name = name, category = category } :: List.filter (\pc -> not <| Search.format pc.name == Search.format name) paymentCategories
diff --git a/src/client/Model/Size.elm b/src/client/Model/Size.elm
deleted file mode 100644
index f40fb01..0000000
--- a/src/client/Model/Size.elm
+++ /dev/null
@@ -1,17 +0,0 @@
-module Model.Size exposing
- ( Size
- , sizeDecoder
- )
-
-import Json.Decode as Decode exposing (Decoder)
-
-type alias Size =
- { width: Int
- , height: Int
- }
-
-sizeDecoder : Decoder Size
-sizeDecoder =
- Decode.map2 Size
- (Decode.field "width" Decode.int)
- (Decode.field "height" Decode.int)
diff --git a/src/client/Model/Translations.elm b/src/client/Model/Translations.elm
deleted file mode 100644
index 9b314e1..0000000
--- a/src/client/Model/Translations.elm
+++ /dev/null
@@ -1,68 +0,0 @@
-module Model.Translations exposing
- ( translationsDecoder
- , Translations
- , Translation
- , getMessage
- , getParamMessage
- )
-
-import Maybe exposing (withDefault)
-import Json.Decode as Decode exposing (Decoder)
-import String
-
-type alias Translations = List Translation
-
-translationsDecoder : Decoder Translations
-translationsDecoder = Decode.list translationDecoder
-
-type alias Translation =
- { key : String
- , message : List MessagePart
- }
-
-getTranslation : String -> Translations -> Maybe (List MessagePart)
-getTranslation key translations =
- translations
- |> List.filter (\translation -> String.toLower translation.key == String.toLower key)
- |> List.head
- |> Maybe.map .message
-
-translationDecoder : Decoder Translation
-translationDecoder =
- Decode.map2 Translation
- (Decode.field "key" Decode.string)
- (Decode.field "message" (Decode.list partDecoder))
-
-type MessagePart =
- Order Int
- | Str String
-
-partDecoder : Decoder MessagePart
-partDecoder = (Decode.field "tag" Decode.string) |> Decode.andThen partDecoderWithTag
-
-partDecoderWithTag : String -> Decoder MessagePart
-partDecoderWithTag tag =
- case tag of
- "Order" -> Decode.map Order (Decode.field "contents" Decode.int)
- _ -> Decode.map Str (Decode.field "contents" Decode.string)
-
------
-
-getMessage : Translations -> String -> String
-getMessage = getParamMessage []
-
-getParamMessage : List String -> Translations -> String -> String
-getParamMessage values translations key =
- getTranslation key translations
- |> Maybe.map (\parts -> String.concat (List.map (replacePart values) parts))
- |> withDefault key
-
-replacePart : List String -> MessagePart -> String
-replacePart values part =
- case part of
- Str str -> str
- Order n ->
- values
- |> List.drop (n - 1)
- |> List.head
- |> withDefault ("{" ++ (toString n) ++ "}")
diff --git a/src/client/Model/User.elm b/src/client/Model/User.elm
deleted file mode 100644
index f6e8147..0000000
--- a/src/client/Model/User.elm
+++ /dev/null
@@ -1,44 +0,0 @@
-module Model.User exposing
- ( Users
- , usersDecoder
- , User
- , userDecoder
- , UserId
- , userIdDecoder
- , getUserName
- )
-
-import Json.Decode as Decode exposing (Decoder)
-import Dict exposing (Dict)
-
-type alias Users = Dict UserId User
-
-type alias UserId = Int
-
-type alias User =
- { name : String
- , email : String
- }
-
-usersDecoder : Decoder Users
-usersDecoder = Decode.map Dict.fromList (Decode.list userWithIdDecoder)
-
-userWithIdDecoder : Decode.Decoder (UserId, User)
-userWithIdDecoder =
- Decode.map2 (,)
- (Decode.field "id" userIdDecoder)
- userDecoder
-
-userIdDecoder : Decoder UserId
-userIdDecoder = Decode.int
-
-userDecoder : Decoder User
-userDecoder =
- Decode.map2 User
- (Decode.field "name" Decode.string)
- (Decode.field "email" Decode.string)
-
-getUserName : Users -> UserId -> Maybe String
-getUserName users userId =
- Dict.get userId users
- |> Maybe.map .name
diff --git a/src/client/Model/View.elm b/src/client/Model/View.elm
deleted file mode 100644
index 61d42a7..0000000
--- a/src/client/Model/View.elm
+++ /dev/null
@@ -1,12 +0,0 @@
-module Model.View exposing
- ( View(..)
- )
-
-import Model.Payment exposing (Payments)
-
-import SignIn.Model as SignInModel
-import LoggedIn.Model as LoggedInModel
-
-type View =
- SignInView SignInModel.Model
- | LoggedInView LoggedInModel.Model