8459e9ae48
TrsrDB: fixed Id -> credId autobalance -> make_transfers TrsrDB::Account: added history accessor TrsrDB::Balance: added fieds earned spent and even_until, renamed credit to available TrsrDB::CurrentArrears: fixed account -> debtor in relation declaration schema.sql: fixed triggers deactivated trigger enforceFixedCredit extended Balance with some more fields t/schema.{sql,out} trivial fixes t/schema.t added tests: Get balances after transfers partial use of credit, indirect transfers
39 lines
905 B
Perl
39 lines
905 B
Perl
use strict;
|
|
|
|
package TrsrDB::Account;
|
|
use base qw/DBIx::Class::Core/;
|
|
|
|
__PACKAGE__->table('Account');
|
|
__PACKAGE__->add_columns(qw/ID type altId IBAN/);
|
|
__PACKAGE__->set_primary_key('ID');
|
|
|
|
__PACKAGE__->has_many(
|
|
statement_rows => 'TrsrDB::ReconstructedBankStatement',
|
|
{ 'foreign.account' => 'self.ID' }
|
|
);
|
|
__PACKAGE__->has_many(
|
|
debits => 'TrsrDB::Debit',
|
|
{ 'foreign.debtor' => 'self.ID' }
|
|
);
|
|
__PACKAGE__->has_many(
|
|
current_arrears => 'TrsrDB::CurrentArrears',
|
|
{ 'foreign.debtor' => 'self.ID' }
|
|
);
|
|
__PACKAGE__->has_many(
|
|
credits => 'TrsrDB::Credit',
|
|
{ 'foreign.account' => 'self.ID' }
|
|
);
|
|
__PACKAGE__->has_many(
|
|
available_credits => 'TrsrDB::AvailableCredits',
|
|
{ 'foreign.account' => 'self.ID' }
|
|
);
|
|
__PACKAGE__->has_one(
|
|
balance => 'TrsrDB::Balance', 'ID'
|
|
);
|
|
__PACKAGE__->has_many(
|
|
history => 'TrsrDB::History',
|
|
{ 'foreign.account' => 'self.ID' }
|
|
);
|
|
|
|
1;
|