rvv001 - DB.hs - Relational database model created for Zgo

This commit is contained in:
Rene V. Vergara A. 2024-09-14 19:48:11 -04:00
parent b9cf0bcb9f
commit d743233c4b
2 changed files with 81 additions and 21 deletions

View file

@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [1.9.0]
### Added
- Relational database model (DB.hs) version 0.1
## [1.8.1] ## [1.8.1]
### Changed ### Changed

View file

@ -52,43 +52,61 @@ derivePersistField "HexStringDB"
share share
[mkPersist sqlSettings, mkMigrate "migrateAll"] [mkPersist sqlSettings, mkMigrate "migrateAll"]
[persistLowerCase| [persistLowerCase|
-- |
-- | Block table (ref. #49)
-- |
ZgoBlock json ZgoBlock json
confs Int default=0 confs Int default=0
network String default="" network String default=""
height Int default=0 height Int default=0
time Int default=0 time Int default=0
deriving Show Eq deriving Show Eq
-- | Block transactions table (child table)
ZgoBlockTx ZgoBlockTx
blocktx_block_id Int blockId ZgoBlockId
blocktx_id Int txid String
blocktx_txid String
deriving Show Eq deriving Show Eq
-- |
-- | Coutry codes table (ref. 0.50)
-- |
ZgoCountry json ZgoCountry json
code T.Text code T.Text
name T.Text name T.Text
UniqueCountryCode code UniqueCountryCode code
deriving Show Eq deriving Show Eq
-- |
-- | Coutry Items table )ref. #51)
-- } (Owner's Child table)
-- |
ZgoItem json ZgoItem json
owner_id Int owner ZgoOwnerId
name T.Text name T.Text
description T.Text default="" description T.Text default=""
cost Double default=0.0 cost Double default=0.0
deriving Show Eq deriving Show Eq
-- |
-- | Langauages table (ref #52)
-- |
ZgoLanguages ZgoLanguages
encode_id T.Text encode_id T.Text
name T.Text default-"" name T.Text default-""
element T.Text default="" element T.Text default=""
element_text T.Text default="" element_text T.Text default=""
deriving Show Eq deriving Show Eq
-- |
-- | Orders table (ref #53)
-- | (Owner child table)
-- |
ZgoOrder json ZgoOrder json
owner ZgoOwnerId owner ZgoOwnerId
zaddress T.Text
session ZgoUserId session ZgoUserId
timestamp Int timestamp Int
closed Word8 closed Word8
currency T.Text currency T.Text
price Double price Double
total Double total Double
totalzec Double totalZec Double
paid Bool paid Bool
token T.Text default="" token T.Text default=""
externalInvoice T.Text default="" externalInvoice T.Text default=""
@ -97,12 +115,19 @@ share
tipamount Double tipamount Double
vatamount Double vatamount Double
deriving Show Eq deriving Show Eq
-- |
-- | Order Lines table
-- | (Order child table)
-- |
ZgoOrderLines ZgoOrderLines
orderId ZgoOrderId orderId ZgoOrderId
qty Int default=0 qty Int default=0
name T.Text default="" name T.Text default=""
cost Double default=0.0 cost Double default=0.0
deriving Show Eq deriving Show Eq
-- |
-- | Owner table (ref. #54)
-- |
ZgoOwner ZgoOwner
co_name T.Text co_name T.Text
firstname T.Text firstname T.Text
@ -116,7 +141,7 @@ share
country T.Text country T.Text
website T.Text website T.Text
currency T.Text currency T.Text
zcaddress T.Text zaddress T.Text
usezats Bool usezats Bool
crmtoken T.Text crmtoken T.Text
usetax Bool usetax Bool
@ -130,6 +155,9 @@ share
paid Bool paid Bool
expiration UTCTime expiration UTCTime
deriving Show Eq deriving Show Eq
-- |
-- | Payment Table (ref. #55)
-- |
ZgoPayment ZgoPayment
delta Int delta Int
done Bool done Bool
@ -140,26 +168,37 @@ share
txid HexStringDB txid HexStringDB
memo T.Text memo T.Text
deriving Show Eq deriving Show Eq
-- |
-- | Price Table (ref. #56)
-- |
ZgoPrice ZgoPrice
price_delta Int default=0 currency T.Text
price_done Bool default=0 price Double default=0.0
price_zaddress T.Text default="" timestamp UTCTime
price_session String default=""
price_blocktime Int default=0
price_amount Double default=0.0
price_txid String default=""
price_memo T.Text default=""
deriving Show Eq deriving Show Eq
ZgoProsession -- |
-- | ProSesion Table (ref. #57)
-- |
ZgoProSesion
zaddress T.Text default="" zaddress T.Text default=""
expiration UTCTime expiration UTCTime
closed Bool closed Bool
deriving Show Eq deriving Show Eq
-- |
-- | Transaction table (ref. # 58)
-- |
ZgoTransaction ZgoTransaction
zaddress T.Text default="" zaddress T.Text
expiration Int default=0 session T.Text
closed Word8 default=0 confirmations Int default=0
blocktime Int default=0
amount Double default=0.00
txid T.Text
memo T.Text
deriving Show Eq deriving Show Eq
-- |
-- | User table (ref. 59)
-- |
ZgoUser json ZgoUser json
owner ZgoOwnerId owner ZgoOwnerId
session UuidDB session UuidDB
@ -167,17 +206,31 @@ share
pin T.Text pin T.Text
validated Bool validated Bool
deriving Show Eq deriving Show Eq
-- |
-- | User table (ref. 60)
-- |
ZgoWooToken
owner ZgoOwnerId
token T.Text
url T.Text
deriving Show Eq
-- |
-- | User table (ref. 61)
-- |
ZgoXero ZgoXero
client_id T.Text default="" client_id T.Text default=""
client_secret T.Text default="" client_secret T.Text default=""
deriving Show Eq deriving Show Eq
ZgoXeroToken -- |
-- | User table (ref. 62)
-- |
ZgoXeroToken
zaddress T.Text zaddress T.Text
access_token T.Text access_token T.Text
expires Int expires UTCTime
refreshtoken T.Text refreshtoken T.Text
accexpires Int accexpires Int
accCode T.Text accCode T.Text
refexpires Int refexpires UTCTime
deriving Show Eq deriving Show Eq
|] |]