This commit is contained in:
2025-09-17 16:45:14 +02:00
parent 05c9a05d39
commit 6b4f015ac0
4 changed files with 341 additions and 161 deletions

View File

@@ -18,16 +18,63 @@ pub enum AccountStatus {
pub struct Account {
db.Base
pub mut:
owner_id u32
address string @[index]
balance f64
currency string
owner_id u32 //link to user
location_id u32 //link to location, 0 is none
accountpolicies []AccountPolicy
assets []AccountAsset
assetid u32
last_activity u64
administrators []u32
accountpolicy u32
}
// AccountPolicy represents a set of rules for an account
pub struct AccountPolicy {
pub mut:
policy_id u32 @[index]
admins []u32 //people who can transfer money out
min_signatures u8 //nr of people who need to sign
limits
whitelist_out []u32 //where money can go to
whitelist_in []u32 //where money can come from
lock_till u64 //date in epoch till no money can be transfered, only after
admin_lock_type LockType
admin_lock_till u64 //date in epoch when admin can unlock (0 means its free), this is unlock for changing this policy
admin_unlock []u32 //users who can unlock the admin policy
admin_unlock_min_signature u8 //nr of signatures from the adminunlock
}
pub enum LockType{
locked_till
locked
free
}
pub struct AccountLimit {
pub mut:
amount f64
asset_id u32
period AccountLimitPeriodLimit
}
pub enum AccountLimitPeriodLimit{
daily
weekly
monthly
}
pub struct AccountAsset {
db.Base
pub mut:
assetid u32
balance f64
metadata map[string]string
}
pub struct DBAccount {
pub mut:
db &db.DB @[skip; str: skip]