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/),
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]
### Changed

View file

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