add advanced scenario-tests for coop-assets #123

Merged
hsh-michaelhoennig merged 24 commits from feature/add-advanced-scenario-tests-for-coop-assets into master 2024-11-25 16:06:26 +01:00
2 changed files with 4 additions and 4 deletions
Showing only changes of commit b337fc998f - Show all commits

View File

@ -24,7 +24,7 @@ create table if not exists hs_office.coopassettx
valueDate date not null,
assetValue numeric(12,2) not null, -- https://wiki.postgresql.org/wiki/Don't_Do_This#Don.27t_use_money
reference varchar(48) not null,
revertedAssetTxuUid uuid unique REFERENCES hs_office.coopassettx(uuid) DEFERRABLE INITIALLY DEFERRED,
revertedAssetTxUuid uuid unique REFERENCES hs_office.coopassettx(uuid) DEFERRABLE INITIALLY DEFERRED,
assetAdoptionTxUuid uuid unique REFERENCES hs_office.coopassettx(uuid) DEFERRABLE INITIALLY DEFERRED,
comment varchar(512)
);
@ -37,11 +37,11 @@ create table if not exists hs_office.coopassettx
alter table hs_office.coopassettx
add constraint reversal_asset_tx_must_have_reverted_asset_tx
check (transactionType <> 'REVERSAL' or revertedAssetTxuUid is not null);
check (transactionType <> 'REVERSAL' or revertedAssetTxUuid is not null);
alter table hs_office.coopassettx
add constraint non_reversal_asset_tx_must_not_have_reverted_asset_tx
check (transactionType = 'REVERSAL' or revertedAssetTxuUid is null or transactionType = 'REVERSAL');
check (transactionType = 'REVERSAL' or revertedAssetTxUuid is null or transactionType = 'REVERSAL');
alter table hs_office.coopassettx
add constraint transfer_asset_tx_must_have_adopted_asset_tx

View File

@ -31,7 +31,7 @@ begin
transferTx := uuid_generate_v4();
adoptionTx := uuid_generate_v4();
insert
into hs_office.coopassettx(uuid, membershipuuid, transactiontype, valuedate, assetvalue, reference, comment, revertedAssetTxuUid, assetAdoptionTxUuid)
into hs_office.coopassettx(uuid, membershipuuid, transactiontype, valuedate, assetvalue, reference, comment, revertedAssetTxUuid, assetAdoptionTxUuid)
values
(uuid_generate_v4(), membership.uuid, 'DEPOSIT', '2010-03-15', 320.00, 'ref '||givenPartnerNumber || givenMemberNumberSuffix||'-1', 'initial deposit', null, null),
(uuid_generate_v4(), membership.uuid, 'DISBURSAL', '2021-09-01', -128.00, 'ref '||givenPartnerNumber || givenMemberNumberSuffix||'-2', 'partial disbursal', null, null),