more beauty
This commit is contained in:
parent
57aacb1e21
commit
a15c075d77
3 changed files with 40 additions and 6 deletions
|
@ -49,7 +49,13 @@ import Model.User
|
|||
|
||||
|
||||
initToken :: PGS.Query
|
||||
initToken = "create table if not exists \"token\" (token_string bytea not null primary key, token_user integer references \"user\"(user_id) not null, token_expiry timestamptz not null)"
|
||||
initToken = foldl (<>) "" $
|
||||
[ "create table if not exists \"token\" ("
|
||||
, "token_string bytea not null primary key,"
|
||||
, "token_user integer references \"user\"(user_id) not null,"
|
||||
, "token_expiry timestamptz not null"
|
||||
, ")"
|
||||
]
|
||||
|
||||
tokenTable :: Table
|
||||
( Field SqlBytea
|
||||
|
|
|
@ -4,7 +4,7 @@ module Model.Product where
|
|||
|
||||
import Servant.Server
|
||||
|
||||
import Data.Text as T hiding (head)
|
||||
import Data.Text as T hiding (head, foldl)
|
||||
import Data.Time.Calendar (Day)
|
||||
import Data.Profunctor.Product (p13)
|
||||
|
||||
|
@ -31,7 +31,23 @@ import Opaleye.Constant as C
|
|||
import Types
|
||||
|
||||
initProduct :: PGS.Query
|
||||
initProduct = "create Table if not exists \"product\" (product_id serial primary key, product_ident varchar(128) not null, product_price integer not null, product_amount integer not null, product_vanish integer not null, product_ml integer not null, product_avatar integer, product_supplier integer, product_max_amount integer not null, product_total_bought integer not null, product_amount_per_crate integer not null, product_price_per_crate integer, product_art_nr varchar(128))"
|
||||
initProduct = foldl (<>) "" $
|
||||
[ "create table if not exists \"product\" ("
|
||||
, "product_id serial primary key,"
|
||||
, "product_ident varchar(128) not null,"
|
||||
, "product_price integer not null,"
|
||||
, "product_amount integer not null,"
|
||||
, "product_vanish integer not null,"
|
||||
, "product_ml integer not null,"
|
||||
, "product_avatar integer,"
|
||||
, "product_supplier integer,"
|
||||
, "product_max_amount integer not null,"
|
||||
, "product_total_bought integer not null,"
|
||||
, "product_amount_per_crate integer not null,"
|
||||
, "product_price_per_crate integer,"
|
||||
, "product_art_nr varchar(128)"
|
||||
, ")"
|
||||
]
|
||||
|
||||
productTable :: Table
|
||||
( Maybe (Field SqlInt4)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
{-# LANGUAGE DuplicateRecordFields #-}
|
||||
module Model.User where
|
||||
|
||||
import Data.Text as T hiding (head)
|
||||
import Data.Text as T hiding (head, foldl)
|
||||
import Data.Time.Calendar
|
||||
import Data.Time.Clock
|
||||
|
||||
|
@ -11,7 +11,7 @@ import Data.Profunctor.Product (p9)
|
|||
|
||||
import Data.Maybe (fromJust, isJust, fromMaybe)
|
||||
|
||||
import Data.ByteString hiding (head)
|
||||
import Data.ByteString hiding (head, foldl)
|
||||
|
||||
import Data.Int (Int64)
|
||||
|
||||
|
@ -34,7 +34,19 @@ import Types.Auth
|
|||
import Types.Reader
|
||||
|
||||
initUser :: PGS.Query
|
||||
initUser = "create table if not exists \"user\" (user_id serial primary key, user_ident varchar(128) not null, user_balance integer not null, user_timestamp date not null, user_email varchar(128), user_avatar integer, user_salt bytea not null, user_hash bytea, user_algo integer)"
|
||||
initUser = foldl (<>) "" $
|
||||
[ "create table if not exists \"user\" ("
|
||||
, "user_id serial primary key,"
|
||||
, "user_ident varchar(128) not null,"
|
||||
, "user_balance integer not null,"
|
||||
, "user_timestamp date not null,"
|
||||
, "user_email varchar(128),"
|
||||
, "user_avatar integer,"
|
||||
, "user_salt bytea not null,"
|
||||
, "user_hash bytea,"
|
||||
, "user_algo integer"
|
||||
, ")"
|
||||
]
|
||||
|
||||
userTable :: Table
|
||||
( Maybe (Field SqlInt4)
|
||||
|
|
Loading…
Reference in a new issue