OfficeScenarioTests CoopShares+Assets #121
@ -22,7 +22,7 @@ create table if not exists hs_office.coopassettx
|
|||||||
membershipUuid uuid not null references hs_office.membership(uuid),
|
membershipUuid uuid not null references hs_office.membership(uuid),
|
||||||
transactionType hs_office.CoopAssetsTransactionType not null,
|
transactionType hs_office.CoopAssetsTransactionType not null,
|
||||||
valueDate date not null,
|
valueDate date not null,
|
||||||
assetValue money not null,
|
assetValue numeric(12,2) not null, -- TODO.impl: use money type, but we had problems with Hibernate conversion
|
||||||
reference varchar(48) not null,
|
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,
|
||||||
comment varchar(512)
|
comment varchar(512)
|
||||||
@ -44,12 +44,12 @@ alter table hs_office.coopassettx
|
|||||||
--changeset michael.hoennig:hs-office-coopassets-ASSET-VALUE-CONSTRAINT endDelimiter:--//
|
--changeset michael.hoennig:hs-office-coopassets-ASSET-VALUE-CONSTRAINT endDelimiter:--//
|
||||||
-- ----------------------------------------------------------------------------
|
-- ----------------------------------------------------------------------------
|
||||||
|
|
||||||
create or replace function hs_office.coopassetstx_check_positive_total(forMembershipUuid UUID, newAssetValue money)
|
create or replace function hs_office.coopassetstx_check_positive_total(forMembershipUuid UUID, newAssetValue numeric(12, 5))
|
||||||
returns boolean
|
returns boolean
|
||||||
language plpgsql as $$
|
language plpgsql as $$
|
||||||
declare
|
declare
|
||||||
currentAssetValue money;
|
currentAssetValue numeric(12,2);
|
||||||
totalAssetValue money;
|
totalAssetValue numeric(12,2);
|
||||||
begin
|
begin
|
||||||
select sum(cat.assetValue)
|
select sum(cat.assetValue)
|
||||||
from hs_office.coopassettx cat
|
from hs_office.coopassettx cat
|
||||||
|
@ -69,7 +69,7 @@ class HsOfficeCoopAssetsTransactionRepositoryIntegrationTest extends ContextBase
|
|||||||
final var newCoopAssetsTransaction = HsOfficeCoopAssetsTransactionEntity.builder()
|
final var newCoopAssetsTransaction = HsOfficeCoopAssetsTransactionEntity.builder()
|
||||||
.membership(givenMembership)
|
.membership(givenMembership)
|
||||||
.transactionType(HsOfficeCoopAssetsTransactionType.DEPOSIT)
|
.transactionType(HsOfficeCoopAssetsTransactionType.DEPOSIT)
|
||||||
.assetValue(new BigDecimal("128.00"))
|
.assetValue(new BigDecimal("6,400.00"))
|
||||||
.valueDate(LocalDate.parse("2022-10-18"))
|
.valueDate(LocalDate.parse("2022-10-18"))
|
||||||
.reference("temp ref A")
|
.reference("temp ref A")
|
||||||
.build();
|
.build();
|
||||||
@ -98,7 +98,7 @@ class HsOfficeCoopAssetsTransactionRepositoryIntegrationTest extends ContextBase
|
|||||||
final var newCoopAssetsTransaction = HsOfficeCoopAssetsTransactionEntity.builder()
|
final var newCoopAssetsTransaction = HsOfficeCoopAssetsTransactionEntity.builder()
|
||||||
.membership(givenMembership)
|
.membership(givenMembership)
|
||||||
.transactionType(HsOfficeCoopAssetsTransactionType.DEPOSIT)
|
.transactionType(HsOfficeCoopAssetsTransactionType.DEPOSIT)
|
||||||
.assetValue(new BigDecimal("128.00"))
|
.assetValue(new BigDecimal("6400.00"))
|
||||||
.valueDate(LocalDate.parse("2022-10-18"))
|
.valueDate(LocalDate.parse("2022-10-18"))
|
||||||
.reference("temp ref B")
|
.reference("temp ref B")
|
||||||
.build();
|
.build();
|
||||||
|
Loading…
Reference in New Issue
Block a user