Add LndHub db/models, and quick stats for admin views
This commit is contained in:
15
app/models/lndhub_user.rb
Normal file
15
app/models/lndhub_user.rb
Normal file
@@ -0,0 +1,15 @@
|
||||
class LndhubUser < LndhubBase
|
||||
self.table_name = "users"
|
||||
self.inheritance_column = :_type_disabled
|
||||
|
||||
has_many :accounts, class_name: "LndhubAccount",
|
||||
foreign_key: "user_id"
|
||||
|
||||
belongs_to :user, class_name: "User",
|
||||
primary_key: "ln_account",
|
||||
foreign_key: "login"
|
||||
|
||||
def balance
|
||||
accounts.current.first.ledgers.sum("account_ledgers.amount")
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user