summaryrefslogtreecommitdiff
path: root/lambda-calcul/haskell/src/Minilang/API.hs
blob: 2b8743f229b704e706811dec8722633799f8bc69 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE TypeOperators #-}

module Minilang.API where

import Data.Aeson (FromJSON, ToJSON)
import Data.Time (UTCTime)
import GHC.Generics (Generic)
import Servant (Get, JSON, (:<|>), (:>), Raw)

data Score = Score
  { name :: String,
    grade :: Int,
    lastTest :: UTCTime
  }
  deriving (Eq, Show, Generic, ToJSON, FromJSON)

type LambdaAPI =
  "api" :> "leaderboard" :> Get '[JSON] [Score]
    :<|> Raw