Added trivial web ui.
This commit is contained in:
1 parent
f99513a8c8
commit
894f969d0f
11 files changed
+1382
-19
No files matched your search
+6
-6
@@ -190,16 +190,16 @@ pub fn is_owner(tx: &Connection, account_id: &AccountId, user_id: &UserId) -> Cu
|
||||
Ok(option.is_some())
|
||||
}
|
||||
|
||||
pub struct Receipt {
|
||||
pub struct AccountChangeReceipt {
|
||||
pub account_id: AccountId,
|
||||
pub version: i64,
|
||||
pub timestamp: i64,
|
||||
pub amount: i64,
|
||||
}
|
||||
|
||||
impl Receipt {
|
||||
pub fn from_row(row: &Row) -> Result<Receipt> {
|
||||
Ok(Receipt {
|
||||
impl AccountChangeReceipt {
|
||||
pub fn from_row(row: &Row) -> Result<AccountChangeReceipt> {
|
||||
Ok(AccountChangeReceipt {
|
||||
account_id: AccountId::from_id(row.get("id")?),
|
||||
version: row.get("version")?,
|
||||
amount: row.get("amount")?,
|
||||
@@ -224,7 +224,7 @@ fn update_account_history(tx: &Connection, account_id: &AccountId) -> CustomResu
|
||||
|
||||
pub fn add_to_account(tx: &Connection,
|
||||
account_id: &AccountId,
|
||||
amount: i64) -> CustomResult<Receipt> {
|
||||
amount: i64) -> CustomResult<AccountChangeReceipt> {
|
||||
let q = "
|
||||
UPDATE accounts SET amount = CASE account_type
|
||||
WHEN 'security_emitter'
|
||||
@@ -236,7 +236,7 @@ pub fn add_to_account(tx: &Connection,
|
||||
RETURNING id, version, amount, UNIXEPOCH(CURRENT_TIMESTAMP) as timestamp
|
||||
";
|
||||
let params = params![amount, account_id];
|
||||
let ret = tx.query_row(q, params, Receipt::from_row).map_err(Error::SqlError);
|
||||
let ret = tx.query_row(q, params, AccountChangeReceipt::from_row).map_err(Error::SqlError);
|
||||
update_account_history(tx, account_id)?;
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user