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
, base16-bytestring
, base64-bytestring
, openapi3 >=3
, random
, servant
, servant-server
, servant-openapi3
, servant-rawm >= 0.3.0.0
, servant-rawm-server
, opaleye

View File

@ -49,7 +49,7 @@ import Util.Crypto
initToken :: PGS.Query
initToken = mconcat
[ "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_expiry TIMESTAMPTZ NOT NULL,"
, "token_method INT NOT NULL"

View File

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