chore(storage-key): add stub

This commit is contained in:
Sarah Vaupel 2020-01-28 09:24:11 +01:00 committed by Gregor Kleen
parent 2d9a8771ef
commit fed81fdbce

46
src/Handler/StorageKey.hs Normal file
View File

@ -0,0 +1,46 @@
module Handler.StorageKey
( postStorageKeyR
) where
import Import
-- import qualified Data.Binary as Binary
data StorageKeyType
= SKTExamCorrect ExamId
-- { sktExamCorrectExamId :: ExamId
-- }
deriveJSON defaultOptions
{ fieldLabelModifier = camelToPathPiece' 3
, constructorTagModifier = camelToPathPiece' 3
} ''StorageKeyType
data StorageKeyRequest
= StorageKeyRequest
{ skReqType :: StorageKeyType
, skReqTimestamp :: Maybe UTCTime
, skReqSalt :: Maybe Text
, skReqLength :: Int
}
deriveJSON defaultOptions
{ fieldLabelModifier = camelToPathPiece' 2
} ''StorageKeyRequest
data StorageKeyResponse
= StorageKeyResponse
{ skResKey :: Text
}
deriveJSON defaultOptions
{ fieldLabelModifier = camelToPathPiece' 2
, constructorTagModifier = camelToPathPiece' 2
} ''StorageKeyResponse
postStorageKeyR :: Handler Value
postStorageKeyR = do
StorageKeyRequest{..} <- requireCheckJsonBody
let key = "TODO"
sendResponseStatus ok200 $ toJSON StorageKeyResponse{ skResKey = key }