introduce-partner-business-role #16

Merged
hsh-michaelhoennig merged 33 commits from introduce-partner-business-role into master 2024-02-01 14:48:16 +01:00
2 changed files with 11 additions and 31 deletions
Showing only changes of commit 4d6c330398 - Show all commits

View File

@ -33,10 +33,10 @@ create table hs_office_partner
( (
uuid uuid unique references RbacObject (uuid) initially deferred, uuid uuid unique references RbacObject (uuid) initially deferred,
partnerNumber numeric(5) unique not null, partnerNumber numeric(5) unique not null,
partnerRoleUuid uuid not null references hs_office_relationship(uuid) on delete cascade, partnerRoleUuid uuid not null references hs_office_relationship(uuid), -- TODO: delete in after delete trigger
hsh-michaelhoennig marked this conversation as resolved Outdated

on delete cascade: ist das gut?

on delete cascade: ist das gut?
personUuid uuid not null references hs_office_person(uuid), -- TODO: remove, replaced by partnerRoleUuid personUuid uuid not null references hs_office_person(uuid), -- TODO: remove, replaced by partnerRoleUuid
contactUuid uuid not null references hs_office_contact(uuid), -- TODO: remove, replaced by partnerRoleUuid contactUuid uuid not null references hs_office_contact(uuid), -- TODO: remove, replaced by partnerRoleUuid
detailsUuid uuid not null references hs_office_partner_details(uuid) on delete cascade detailsUuid uuid not null references hs_office_partner_details(uuid) -- deleted in after delete trigger
hsh-michaelhoennig marked this conversation as resolved Outdated

wollen wir on delete cascade?

wollen wir on delete cascade?
); );
--// --//

View File

@ -647,7 +647,6 @@ public class ImportOfficeData extends ContextBasedTest {
.personType(HsOfficePersonType.LEGAL_PERSON) .personType(HsOfficePersonType.LEGAL_PERSON)
.tradeName("Hostsharing eG") .tradeName("Hostsharing eG")
.build(); .build();
assertThat(persons.containsKey(1)).describedAs("overwriting " + persons.get(1) + " index " + 1 + " with " + mandant).isFalse();
persons.put(1, mandant); persons.put(1, mandant);
records.stream() records.stream()
@ -662,10 +661,7 @@ public class ImportOfficeData extends ContextBasedTest {
.relAnchor(mandant) .relAnchor(mandant)
.contact(null) // is set during contacts import depending on assigned roles .contact(null) // is set during contacts import depending on assigned roles
.build(); .build();
final Integer i3 = relationshipId++; relationships.put(relationshipId++, partnerRelationship);
assertThat(relationships.containsKey(i3)).describedAs("overwriting " + relationships.get(i3) + " index " + i3
+ " with " + partnerRelationship).isFalse();
relationships.put(i3, partnerRelationship);
final var partner = HsOfficePartnerEntity.builder() final var partner = HsOfficePartnerEntity.builder()
.partnerNumber(rec.getInteger("member_id")) .partnerNumber(rec.getInteger("member_id"))
@ -674,9 +670,7 @@ public class ImportOfficeData extends ContextBasedTest {
.contact(null) // is set during contacts import depending on assigned roles .contact(null) // is set during contacts import depending on assigned roles
.person(person) .person(person)
.build(); .build();
final Integer i2 = rec.getInteger("bp_id"); partners.put(rec.getInteger("bp_id"), partner);
assertThat(partners.containsKey(i2)).describedAs("overwriting " + partners.get(i2) + " index " + i2 + " with " + partner).isFalse();
partners.put(i2, partner);
final var debitor = HsOfficeDebitorEntity.builder() final var debitor = HsOfficeDebitorEntity.builder()
.partner(partner) .partner(partner)
@ -688,9 +682,7 @@ public class ImportOfficeData extends ContextBasedTest {
.vatBusiness("GROSS".equals(rec.getString("indicator_vat"))) // TODO: remove .vatBusiness("GROSS".equals(rec.getString("indicator_vat"))) // TODO: remove
.vatId(rec.getString("uid_vat")) .vatId(rec.getString("uid_vat"))
.build(); .build();
final Integer i1 = rec.getInteger("bp_id"); debitors.put(rec.getInteger("bp_id"), debitor);
assertThat(debitors.containsKey(i1)).describedAs("overwriting " + debitors.get(i1) + " index " + i1 + " with " + debitor).isFalse();
debitors.put(i1, debitor);
if (isNotBlank(rec.getString("member_since"))) { if (isNotBlank(rec.getString("member_since"))) {
assertThat(rec.getInteger("member_id")).isEqualTo(partner.getPartnerNumber()); assertThat(rec.getInteger("member_id")).isEqualTo(partner.getPartnerNumber());
@ -707,9 +699,7 @@ public class ImportOfficeData extends ContextBasedTest {
: HsOfficeReasonForTermination.UNKNOWN) : HsOfficeReasonForTermination.UNKNOWN)
.mainDebitor(debitor) .mainDebitor(debitor)
.build(); .build();
final Integer i = rec.getInteger("bp_id"); memberships.put(rec.getInteger("bp_id"), membership);
assertThat(memberships.containsKey(i)).describedAs("overwriting " + memberships.get(i) + " index " + i + " with " + membership).isFalse();
memberships.put(i, membership);
} }
}); });
} }
@ -738,9 +728,7 @@ public class ImportOfficeData extends ContextBasedTest {
.comment( rec.getString("comment")) .comment( rec.getString("comment"))
.build(); .build();
final Integer i = rec.getInteger("member_share_id"); coopShares.put(rec.getInteger("member_share_id"), shareTransaction);
assertThat(coopShares.containsKey(i)).describedAs("overwriting " + coopShares.get(i) + " index " + i + " with " + shareTransaction).isFalse();
coopShares.put(i, shareTransaction);
}); });
} }
@ -783,9 +771,7 @@ public class ImportOfficeData extends ContextBasedTest {
.comment(rec.getString("comment")) .comment(rec.getString("comment"))
.build(); .build();
final Integer i = rec.getInteger("member_asset_id"); coopAssets.put(rec.getInteger("member_asset_id"), assetTransaction);
assertThat(coopAssets.containsKey(i)).describedAs("overwriting " + coopAssets.get(i) + " index " + i + " with " + assetTransaction).isFalse();
coopAssets.put(i, assetTransaction);
}); });
} }
@ -919,9 +905,7 @@ public class ImportOfficeData extends ContextBasedTest {
.contact(contact) .contact(contact)
.relType(representative) .relType(representative)
.build(); .build();
final Integer i = relationshipId++; relationships.put(relationshipId++, rel);
assertThat(relationships.containsKey(i)).describedAs("overwriting " + relationships.get(i) + " index " + i + " with " + rel).isFalse();
relationships.put(i, rel);
return rel; return rel;
} }
@ -932,9 +916,7 @@ public class ImportOfficeData extends ContextBasedTest {
person.setTradeName(contactRecord.getString("firma")); person.setTradeName(contactRecord.getString("firma"));
determinePersonType(person, contactRecord.getString("roles")); determinePersonType(person, contactRecord.getString("roles"));
final Integer i = contactRecord.getInteger("contact_id"); persons.put(contactRecord.getInteger("contact_id"), person);
assertThat(persons.containsKey(i)).describedAs("overwriting " + persons.get(i) + " index " + i + " with " + person).isFalse();
persons.put(i, person);
return person; return person;
} }
@ -989,9 +971,7 @@ public class ImportOfficeData extends ContextBasedTest {
contact.setPostalAddress(toAddress(contactRecord)); contact.setPostalAddress(toAddress(contactRecord));
contact.setPhoneNumbers(toPhoneNumbers(contactRecord)); contact.setPhoneNumbers(toPhoneNumbers(contactRecord));
final Integer i = contactRecord.getInteger("contact_id"); contacts.put(contactRecord.getInteger("contact_id"), contact);
assertThat(contacts.containsKey(i)).describedAs("overwriting " + contacts.get(i) + " index " + i + " with " + contact).isFalse();
contacts.put(i, contact);
return contact; return contact;
} }