chore(storage-key): add stub
This commit is contained in:
parent
2d9a8771ef
commit
fed81fdbce
46
src/Handler/StorageKey.hs
Normal file
46
src/Handler/StorageKey.hs
Normal 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 }
|
||||||
Loading…
Reference in New Issue
Block a user