start openapi implememntation

master
nek0 2 months ago
parent 5e70cd6b0f
commit f3891f2bfe
  1. 2
      mateamt.cabal
  2. 2
      src/Model/Auth.hs
  3. 5
      src/Types/Refine.hs

@ -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

@ -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"

@ -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

Loading…
Cancel
Save