start openapi implememntation

This commit is contained in:
nek0 2022-05-28 12:54:13 +02:00
parent 5e70cd6b0f
commit f3891f2bfe
3 changed files with 8 additions and 1 deletions

View File

@ -84,9 +84,11 @@ library
, bytestring >=0.10.12.0 , bytestring >=0.10.12.0
, base16-bytestring , base16-bytestring
, base64-bytestring , base64-bytestring
, openapi3 >=3
, random , random
, servant , servant
, servant-server , servant-server
, servant-openapi3
, servant-rawm >= 0.3.0.0 , servant-rawm >= 0.3.0.0
, servant-rawm-server , servant-rawm-server
, opaleye , opaleye

View File

@ -49,7 +49,7 @@ import Util.Crypto
initToken :: PGS.Query initToken :: PGS.Query
initToken = mconcat initToken = mconcat
[ "CREATE TABLE IF NOT EXISTS \"token\" (" [ "CREATE TABLE IF NOT EXISTS \"token\" ("
, "token_string TEXT NOT NULL PRIMARY KEY," , "token_string BYTEA NOT NULL PRIMARY KEY,"
, "token_user INTEGER REFERENCES \"user\"(user_id) NOT NULL," , "token_user INTEGER REFERENCES \"user\"(user_id) NOT NULL,"
, "token_expiry TIMESTAMPTZ NOT NULL," , "token_expiry TIMESTAMPTZ NOT NULL,"
, "token_method INT NOT NULL" , "token_method INT NOT NULL"

View File

@ -5,6 +5,8 @@ module Types.Refine where
import GHC.Generics import GHC.Generics
import Data.OpenApi (ToParamSchema(..))
import Web.HttpApiData import Web.HttpApiData
data UserRefine = AllUsers | ActiveUsers | OldUsers data UserRefine = AllUsers | ActiveUsers | OldUsers
@ -24,6 +26,7 @@ instance ToHttpApiData UserRefine where
ActiveUsers -> "active" ActiveUsers -> "active"
OldUsers -> "old" OldUsers -> "old"
instance ToParamSchema UserRefine
data ProductRefine = AllProducts | AvailableProducts | DepletedProducts data ProductRefine = AllProducts | AvailableProducts | DepletedProducts
deriving (Generic, Show, Enum) deriving (Generic, Show, Enum)
@ -41,3 +44,5 @@ instance ToHttpApiData ProductRefine where
AllProducts -> "all" AllProducts -> "all"
AvailableProducts -> "available" AvailableProducts -> "available"
DepletedProducts -> "depleted" DepletedProducts -> "depleted"
instance ToParamSchema ProductRefine