memberNumber as partnerNumber+memberNumberSuffix #13

Merged
hsh-michaelhoennig merged 78 commits from memberNumberSuffix-and-partnerNumber into master 2024-01-24 15:57:16 +01:00
9 changed files with 15 additions and 19 deletions
Showing only changes of commit 4ca89df6fd - Show all commits

View File

@ -60,7 +60,7 @@ public class HsOfficeCoopSharesTransactionEntity implements Stringifyable, HasUu
private int shareCount; private int shareCount;
/** /**
* The ooking reference. * The Booking reference.
*/ */
@Column(name = "reference") @Column(name = "reference")
private String reference; private String reference;

View File

@ -179,7 +179,6 @@ call generateRbacIdentityView('hs_office_partner', $idName$
call generateRbacRestrictedView('hs_office_partner', call generateRbacRestrictedView('hs_office_partner',
'(select idName from hs_office_person_iv p where p.uuid = target.personUuid)', '(select idName from hs_office_person_iv p where p.uuid = target.personUuid)',
$updates$ $updates$
partnerNumber = new.partnerNumber,
personUuid = new.personUuid, personUuid = new.personUuid,
contactUuid = new.contactUuid contactUuid = new.contactUuid
$updates$); $updates$);

View File

@ -17,7 +17,9 @@ create table if not exists hs_office_membership
memberNumberSuffix::text ~ '^[0-9][0-9]$'), memberNumberSuffix::text ~ '^[0-9][0-9]$'),
validity daterange not null, validity daterange not null,
reasonForTermination HsOfficeReasonForTermination not null default 'NONE', reasonForTermination HsOfficeReasonForTermination not null default 'NONE',
membershipFeeBillable boolean not null default true membershipFeeBillable boolean not null default true,
UNIQUE(partnerUuid, memberNumberSuffix)
); );
--// --//

View File

@ -72,7 +72,7 @@ class HsOfficeCoopAssetsTransactionControllerAcceptanceTest {
} }
@Test @Test
void globalAdmin_canFindCoopAssetsTransactionsByMemberNumberSuffix() { void globalAdmin_canFindCoopAssetsTransactionsByMemberNumber() {
context.define("superuser-alex@hostsharing.net"); context.define("superuser-alex@hostsharing.net");
final var givenMembership = membershipRepo.findMembershipByMemberNumber(1000202); final var givenMembership = membershipRepo.findMembershipByMemberNumber(1000202);
@ -114,7 +114,7 @@ class HsOfficeCoopAssetsTransactionControllerAcceptanceTest {
} }
@Test @Test
void globalAdmin_canFindCoopAssetsTransactionsByMemberNumberSuffixAndDateRange() { void globalAdmin_canFindCoopAssetsTransactionsByMembershipUuidAndDateRange() {
context.define("superuser-alex@hostsharing.net"); context.define("superuser-alex@hostsharing.net");
final var givenMembership = membershipRepo.findMembershipByMemberNumber(1000202); final var givenMembership = membershipRepo.findMembershipByMemberNumber(1000202);

View File

@ -72,7 +72,7 @@ class HsOfficeCoopSharesTransactionControllerAcceptanceTest {
} }
@Test @Test
void globalAdmin_canFindCoopSharesTransactionsByMemberNumberSuffix() { void globalAdmin_canFindCoopSharesTransactionsByMemberNumber() {
context.define("superuser-alex@hostsharing.net"); context.define("superuser-alex@hostsharing.net");
final var givenMembership = membershipRepo.findMembershipByMemberNumber(1000202); final var givenMembership = membershipRepo.findMembershipByMemberNumber(1000202);
@ -106,13 +106,14 @@ class HsOfficeCoopSharesTransactionControllerAcceptanceTest {
} }
@Test @Test
void globalAdmin_canFindCoopSharesTransactionsByMemberNumberSuffixAndDateRange() { void globalAdmin_canFindCoopSharesTransactionsByMembershipUuidAndDateRange() {
context.define("superuser-alex@hostsharing.net"); context.define("superuser-alex@hostsharing.net");
final var givenMembership = membershipRepo.findMembershipByMemberNumber(1000202); final var givenMembership = membershipRepo.findMembershipByMemberNumber(1000202);
RestAssured // @formatter:off RestAssured // @formatter:off
.given().header("current-user", "superuser-alex@hostsharing.net").port(port).when().get("http://localhost/api/hs/office/coopsharestransactions?membershipUuid=" + givenMembership.getUuid() + "&fromValueDate=2020-01-01&toValueDate=2021-12-31").then().log().all().assertThat().statusCode(200).contentType("application/json").body("", lenientlyEquals(""" .given().header("current-user", "superuser-alex@hostsharing.net").port(port).when()
.get("http://localhost/api/hs/office/coopsharestransactions?membershipUuid=" + givenMembership.getUuid() + "&fromValueDate=2020-01-01&toValueDate=2021-12-31").then().log().all().assertThat().statusCode(200).contentType("application/json").body("", lenientlyEquals("""
[ [
{ {
"transactionType": "CANCELLATION", "transactionType": "CANCELLATION",

View File

@ -104,12 +104,6 @@ class HsOfficeDebitorEntityPatcherUnitTest extends PatchUnitTestBase<
HsOfficeDebitorEntity::setBillingContact, HsOfficeDebitorEntity::setBillingContact,
newBillingContact(PATCHED_CONTACT_UUID)) newBillingContact(PATCHED_CONTACT_UUID))
.notNullable(), .notNullable(),
new SimpleProperty<>(
"personType",
HsOfficeDebitorPatchResource::setBillable,
PATCHED_BILLABLE,
HsOfficeDebitorEntity::setBillable)
.notNullable(),
new SimpleProperty<>( new SimpleProperty<>(
"billable", "billable",
HsOfficeDebitorPatchResource::setBillable, HsOfficeDebitorPatchResource::setBillable,

View File

@ -77,7 +77,7 @@ class HsOfficeMembershipRepositoryIntegrationTest extends ContextBasedTest {
// when // when
final var result = attempt(em, () -> { final var result = attempt(em, () -> {
final var newMembership = toCleanup(HsOfficeMembershipEntity.builder() final var newMembership = toCleanup(HsOfficeMembershipEntity.builder()
.memberNumberSuffix("01") .memberNumberSuffix("11")
.partner(givenPartner) .partner(givenPartner)
.mainDebitor(givenDebitor) .mainDebitor(givenDebitor)
.validity(Range.closedInfinite(LocalDate.parse("2020-01-01"))) .validity(Range.closedInfinite(LocalDate.parse("2020-01-01")))

View File

@ -226,7 +226,7 @@ class HsOfficePartnerRepositoryIntegrationTest extends ContextBasedTest {
assertThat(result) assertThat(result)
.isNotNull() .isNotNull()
.extracting(Object::toString) .extracting(Object::toString)
.isEqualTo("partner(LEGAL First GmbH: first contact)"); .isEqualTo("partner(LP First GmbH: first contact)");
} }
} }

View File

@ -10,11 +10,11 @@ import static org.junit.jupiter.api.Assertions.*;
class HsOfficeRelationshipEntityUnitTest { class HsOfficeRelationshipEntityUnitTest {
private HsOfficePersonEntity anchor = HsOfficePersonEntity.builder() private HsOfficePersonEntity anchor = HsOfficePersonEntity.builder()
.personType(HsOfficePersonType.LEGAL) .personType(HsOfficePersonType.LEGAL_PERSON)
.tradeName("some trade name") .tradeName("some trade name")
.build(); .build();
private HsOfficePersonEntity holder = HsOfficePersonEntity.builder() private HsOfficePersonEntity holder = HsOfficePersonEntity.builder()
.personType(HsOfficePersonType.NATURAL) .personType(HsOfficePersonType.NATURAL_PERSON)
.familyName("Meier") .familyName("Meier")
.givenName("Mellie") .givenName("Mellie")
.build(); .build();
@ -27,6 +27,6 @@ class HsOfficeRelationshipEntityUnitTest {
.relHolder(holder) .relHolder(holder)
.build(); .build();
assertThat(given.toShortString()).isEqualTo("rel(relAnchor='LEGAL some trade name', relType='REPRESENTATIVE', relHolder='NATURAL Meier, Mellie')"); assertThat(given.toShortString()).isEqualTo("rel(relAnchor='LP some trade name', relType='REPRESENTATIVE', relHolder='NP Meier, Mellie')");
} }
} }