rename partnerRole -> partnerRel, relationship -> relation and remove rel-Prefix (relAnchor etc.) #23

Merged
hsh-michaelhoennig merged 5 commits from rename-partnerRole-to-partnerRel into master 2024-03-13 15:01:25 +01:00
15 changed files with 113 additions and 112 deletions
Showing only changes of commit 0ecf2a1e2e - Show all commits

View File

@ -10,7 +10,7 @@ classDiagram
namespace Partner {
class partner-MeierGmbH
class role-MeierGmbH
class rel-MeierGmbH
class personDetails-MeierGmbH
class contactData-MeierGmbH
class person-MeierGmbH
@ -19,28 +19,29 @@ classDiagram
namespace Representatives {
class person-FrankMeier
class contactData-FrankMeier
class role-MeierGmbH-FrankMeier
class rel-MeierGmbH-FrankMeier
}
namespace Debitors {
class debitor-MeierGmbH
class contactData-MeierGmbH-Buha
class role-MeierGmbH-Buha
class rel-MeierGmbH-Buha
}
namespace Operations {
class person-SabineMeier
class contactData-SabineMeier
class role-MeierGmbH-SabineMeier
class rel-MeierGmbH-SabineMeier
}
namespace Enums {
class RoleType {
class RelationType {
<<enumeration>>
UNKNOWN
PARTNER
DEBITOR
REPRESENTATIVE
ACCOUNTING
OPERATIONS
}
@ -64,9 +65,9 @@ classDiagram
class partner-MeierGmbH {
+Numeric partnerNumber: 12345
+Role partnerRole
+Relation partnerRel
}
partner-MeierGmbH *-- role-MeierGmbH
partner-MeierGmbH *-- rel-MeierGmbH
class person-MeierGmbH {
+personType: LEGAL
@ -90,22 +91,22 @@ classDiagram
+emailAddresses: office@meier-gmbh.de
}
class role-MeierGmbH {
+RoleType RoleType PARTNER
class rel-MeierGmbH {
+RelationType type PARTNER
+Person anchor
+Person holder
+Contact roleContact
+Contact contact
}
role-MeierGmbH o-- person-HostsharingEG : anchor
role-MeierGmbH o-- person-MeierGmbH : holder
role-MeierGmbH o-- contactData-MeierGmbH
rel-MeierGmbH o-- person-HostsharingEG : anchor
rel-MeierGmbH o-- person-MeierGmbH : holder
rel-MeierGmbH o-- contactData-MeierGmbH
%% --- Debitors ---
class debitor-MeierGmbH {
+Partner partner
+Numeric[2] debitorNumberSuffix: 00
+Role billingRole
+Relation debitorRel
+boolean billable: true
+String vatId: ID123456789
+String vatCountryCode: DE
@ -115,7 +116,7 @@ classDiagram
+String defaultPrefix: mei
}
debitor-MeierGmbH o-- partner-MeierGmbH
debitor-MeierGmbH *-- role-MeierGmbH-Buha
debitor-MeierGmbH *-- rel-MeierGmbH-Buha
class contactData-MeierGmbH-Buha {
+postalAddress: Hauptstraße 5, 22345 Hamburg
@ -123,15 +124,15 @@ classDiagram
+emailAddresses: buha@meier-gmbh.de
}
class role-MeierGmbH-Buha {
+RoleType RoleType ACCOUNTING
class rel-MeierGmbH-Buha {
+RelationType type ACCOUNTING
+Person anchor
+Person holder
+Contact roleContact
+Contact contact
}
role-MeierGmbH-Buha o-- person-MeierGmbH : anchor
role-MeierGmbH-Buha o-- person-MeierGmbH : holder
role-MeierGmbH-Buha o-- contactData-MeierGmbH-Buha
rel-MeierGmbH-Buha o-- person-MeierGmbH : anchor
rel-MeierGmbH-Buha o-- person-MeierGmbH : holder
rel-MeierGmbH-Buha o-- contactData-MeierGmbH-Buha
%% --- Representatives ---
@ -148,15 +149,15 @@ classDiagram
+emailAddresses: frank.meier@meier-gmbh.de
}
class role-MeierGmbH-FrankMeier {
+RoleType RoleType REPRESENTATIVE
class rel-MeierGmbH-FrankMeier {
+RelationType type REPRESENTATIVE
+Person anchor
+Person holder
+Contact roleContact
+Contact contact
}
role-MeierGmbH-FrankMeier o-- person-MeierGmbH : anchor
role-MeierGmbH-FrankMeier o-- person-FrankMeier : holder
role-MeierGmbH-FrankMeier o-- contactData-FrankMeier
rel-MeierGmbH-FrankMeier o-- person-MeierGmbH : anchor
rel-MeierGmbH-FrankMeier o-- person-FrankMeier : holder
rel-MeierGmbH-FrankMeier o-- contactData-FrankMeier
%% --- Operations ---
@ -173,14 +174,14 @@ classDiagram
+emailAddresses: sabine.meier@meier-gmbh.de
}
class role-MeierGmbH-SabineMeier {
+RoleType RoleType OPERATIONAL
class rel-MeierGmbH-SabineMeier {
+RelationType type OPERATIONAL
+Person anchor
+Person holder
+Contact roleContact
+Contact contact
}
role-MeierGmbH-SabineMeier o-- person-MeierGmbH : anchor
role-MeierGmbH-SabineMeier o-- person-SabineMeier : holder
role-MeierGmbH-SabineMeier o-- contactData-SabineMeier
rel-MeierGmbH-SabineMeier o-- person-MeierGmbH : anchor
rel-MeierGmbH-SabineMeier o-- person-SabineMeier : holder
rel-MeierGmbH-SabineMeier o-- contactData-SabineMeier
```

View File

@ -114,7 +114,7 @@ public class HsOfficeDebitorEntity implements HasUuid, Stringifyable {
'D-' || (SELECT partner.partnerNumber
FROM hs_office_partner partner
JOIN hs_office_relationship partnerRel
ON partnerRel.uuid = partner.partnerRoleUUid AND partnerRel.relType = 'PARTNER'
ON partnerRel.uuid = partner.partnerRelUUid AND partnerRel.relType = 'PARTNER'
JOIN hs_office_relationship debitorRel
ON debitorRel.relAnchorUuid = partnerRel.relHolderUuid AND partnerRel.relType = 'DEBITOR'
WHERE debitorRel.uuid = debitor.debitorRelUuid)

View File

@ -7,7 +7,7 @@ import net.hostsharing.hsadminng.hs.office.generated.api.v1.api.HsOfficePartners
import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficePartnerInsertResource;
import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficePartnerPatchResource;
import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficePartnerResource;
import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficePartnerRoleInsertResource;
import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficePartnerRelInsertResource;
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity;
import net.hostsharing.hsadminng.hs.office.relationship.HsOfficeRelationshipEntity;
import net.hostsharing.hsadminng.hs.office.relationship.HsOfficeRelationshipRepository;
@ -112,7 +112,7 @@ public class HsOfficePartnerController implements HsOfficePartnersApi {
if (partnerRepo.deleteByUuid(partnerUuid) != 1 ||
// TODO: move to after delete trigger in partner
relationshipRepo.deleteByUuid(partnerToDelete.get().getPartnerRole().getUuid()) != 1 ) {
relationshipRepo.deleteByUuid(partnerToDelete.get().getPartnerRel().getUuid()) != 1 ) {
return ResponseEntity.status(HttpStatus.FORBIDDEN).build();
}
@ -141,14 +141,14 @@ public class HsOfficePartnerController implements HsOfficePartnersApi {
private HsOfficePartnerEntity createPartnerEntity(final HsOfficePartnerInsertResource body) {
final var entityToSave = new HsOfficePartnerEntity();
entityToSave.setPartnerNumber(body.getPartnerNumber());
entityToSave.setPartnerRole(persistPartnerRole(body.getPartnerRole()));
entityToSave.setPartnerRel(persistPartnerRel(body.getPartnerRel()));
entityToSave.setContact(ref(HsOfficeContactEntity.class, body.getContactUuid()));
entityToSave.setPerson(ref(HsOfficePersonEntity.class, body.getPersonUuid()));
entityToSave.setDetails(mapper.map(body.getDetails(), HsOfficePartnerDetailsEntity.class));
return entityToSave;
}
private HsOfficeRelationshipEntity persistPartnerRole(final HsOfficePartnerRoleInsertResource resource) {
private HsOfficeRelationshipEntity persistPartnerRel(final HsOfficePartnerRelInsertResource resource) {
final var entity = new HsOfficeRelationshipEntity();
entity.setRelType(HsOfficeRelationshipType.PARTNER);
entity.setRelAnchor(ref(HsOfficePersonEntity.class, resource.getRelAnchorUuid()));

View File

@ -92,9 +92,9 @@ public class HsOfficePartnerDetailsEntity implements HasUuid, Stringifyable {
FROM hs_office_relationship AS partnerRel
JOIN hs_office_partner AS partner
ON partner.detailsUuid = ${ref}.uuid
WHERE partnerRel.uuid = partner.partnerRoleUuid
WHERE partnerRel.uuid = partner.partnerRelUuid
"""),
dependsOnColumn("partnerRoleUuid"))
dependsOnColumn("partnerRelUuid"))
// The grants are defined in HsOfficePartnerEntity.rbac()
// because they have to be changed when its partnerRel changes,

View File

@ -50,15 +50,15 @@ public class HsOfficePartnerEntity implements Stringifyable, HasUuid {
private Integer partnerNumber;
@ManyToOne
@JoinColumn(name = "partnerroleuuid", nullable = false)
private HsOfficeRelationshipEntity partnerRole;
@JoinColumn(name = "partnerreluuid", nullable = false)
private HsOfficeRelationshipEntity partnerRel;
// TODO: remove, is replaced by partnerRole
// TODO: remove, is replaced by partnerRel
@ManyToOne
@JoinColumn(name = "personuuid", nullable = false)
private HsOfficePersonEntity person;
// TODO: remove, is replaced by partnerRole
// TODO: remove, is replaced by partnerRel
@ManyToOne
@JoinColumn(name = "contactuuid", nullable = false)
private HsOfficeContactEntity contact;
@ -87,13 +87,13 @@ public class HsOfficePartnerEntity implements Stringifyable, HasUuid {
FROM hs_office_partner AS partner
"""))
.withUpdatableColumns(
"partnerRoleUuid",
"partnerRelUuid",
"personUuid",
"contactUuid")
.createPermission(custom("new-partner")).grantedTo("global", ADMIN)
.importRootEntityAliasProxy("partnerRel", HsOfficeRelationshipEntity.class,
fetchedBySql("SELECT * FROM hs_office_relationship AS r WHERE r.uuid = ${ref}.partnerRoleUuid"),
fetchedBySql("SELECT * FROM hs_office_relationship AS r WHERE r.uuid = ${ref}.partnerRelUuid"),
dependsOnColumn("partnerRelUuid"))
.createPermission(DELETE).grantedTo("partnerRel", ADMIN)
.createPermission(UPDATE).grantedTo("partnerRel", AGENT)

View File

@ -96,8 +96,8 @@ components:
format: int8
minimum: 10000
maximum: 99999
partnerRole:
$ref: '#/components/schemas/HsOfficePartnerRoleInsert'
partnerRel:
$ref: '#/components/schemas/HsOfficePartnerRelInsert'
personUuid:
type: string
format: uuid
@ -112,7 +112,7 @@ components:
- contactUuid
- details
HsOfficePartnerRoleInsert:
HsOfficePartnerRelInsert:
type: object
nullable: false
properties:

View File

@ -9,9 +9,9 @@ components:
- UNKNOWN
- PARTNER
- EX_PARTNER
- REPRESENTATIVE,
- DEBITOR
- REPRESENTATIVE
- VIP_CONTACT
- ACCOUNTING,
- OPERATIONS
- SUBSCRIBER

View File

@ -33,9 +33,9 @@ create table hs_office_partner
(
uuid uuid unique references RbacObject (uuid) initially deferred,
partnerNumber numeric(5) unique not null,
partnerRoleUuid uuid not null references hs_office_relationship(uuid), -- TODO: delete in after delete trigger
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
partnerRelUuid uuid not null references hs_office_relationship(uuid), -- TODO: delete in after delete trigger
personUuid uuid not null references hs_office_person(uuid), -- TODO: remove, replaced by partnerRelUuid
contactUuid uuid not null references hs_office_contact(uuid), -- TODO: remove, replaced by partnerRelUuid
detailsUuid uuid not null references hs_office_partner_details(uuid) -- deleted in after delete trigger
);
--//

View File

@ -27,8 +27,8 @@ create or replace function hsOfficePartnerRbacRolesTrigger()
language plpgsql
strict as $$
declare
oldPartnerRole hs_office_relationship;
newPartnerRole hs_office_relationship;
oldPartnerRel hs_office_relationship;
newPartnerRel hs_office_relationship;
oldPerson hs_office_person;
newPerson hs_office_person;
@ -38,7 +38,7 @@ declare
begin
call enterTriggerForObjectUuid(NEW.uuid);
select * from hs_office_relationship as r where r.uuid = NEW.partnerroleuuid into newPartnerRole;
select * from hs_office_relationship as r where r.uuid = NEW.partnerReluuid into newPartnerRel;
select * from hs_office_person as p where p.uuid = NEW.personUuid into newPerson;
select * from hs_office_contact as c where c.uuid = NEW.contactUuid into newContact;
@ -58,7 +58,7 @@ begin
incomingSuperRoles => array[
hsOfficePartnerOwner(NEW)],
outgoingSubRoles => array[
hsOfficeRelationshipTenant(newPartnerRole),
hsOfficeRelationshipTenant(newPartnerRel),
hsOfficePersonTenant(newPerson),
hsOfficeContactTenant(newContact)]
);
@ -67,7 +67,7 @@ begin
hsOfficePartnerAgent(NEW),
incomingSuperRoles => array[
hsOfficePartnerAdmin(NEW),
hsOfficeRelationshipAdmin(newPartnerRole),
hsOfficeRelationshipAdmin(newPartnerRel),
hsOfficePersonAdmin(newPerson),
hsOfficeContactAdmin(newContact)]
);
@ -77,7 +77,7 @@ begin
incomingSuperRoles => array[
hsOfficePartnerAgent(NEW)],
outgoingSubRoles => array[
hsOfficeRelationshipTenant(newPartnerRole),
hsOfficeRelationshipTenant(newPartnerRel),
hsOfficePersonGuest(newPerson),
hsOfficeContactGuest(newContact)]
);
@ -118,17 +118,17 @@ begin
elsif TG_OP = 'UPDATE' then
if OLD.partnerRoleUuid <> NEW.partnerRoleUuid then
select * from hs_office_relationship as r where r.uuid = OLD.partnerRoleUuid into oldPartnerRole;
if OLD.partnerRelUuid <> NEW.partnerRelUuid then
select * from hs_office_relationship as r where r.uuid = OLD.partnerRelUuid into oldPartnerRel;
call revokeRoleFromRole(hsOfficeRelationshipTenant(oldPartnerRole), hsOfficePartnerAdmin(OLD));
call grantRoleToRole(hsOfficeRelationshipTenant(newPartnerRole), hsOfficePartnerAdmin(NEW));
call revokeRoleFromRole(hsOfficeRelationshipTenant(oldPartnerRel), hsOfficePartnerAdmin(OLD));
call grantRoleToRole(hsOfficeRelationshipTenant(newPartnerRel), hsOfficePartnerAdmin(NEW));
call revokeRoleFromRole(hsOfficePartnerAgent(OLD), hsOfficeRelationshipAdmin(oldPartnerRole));
call grantRoleToRole(hsOfficePartnerAgent(NEW), hsOfficeRelationshipAdmin(newPartnerRole));
call revokeRoleFromRole(hsOfficePartnerAgent(OLD), hsOfficeRelationshipAdmin(oldPartnerRel));
call grantRoleToRole(hsOfficePartnerAgent(NEW), hsOfficeRelationshipAdmin(newPartnerRel));
call revokeRoleFromRole(hsOfficeRelationshipGuest(oldPartnerRole), hsOfficePartnerTenant(OLD));
call grantRoleToRole(hsOfficeRelationshipGuest(newPartnerRole), hsOfficePartnerTenant(NEW));
call revokeRoleFromRole(hsOfficeRelationshipGuest(oldPartnerRel), hsOfficePartnerTenant(OLD));
call grantRoleToRole(hsOfficeRelationshipGuest(newPartnerRel), hsOfficePartnerTenant(NEW));
end if;
if OLD.personUuid <> NEW.personUuid then
@ -202,7 +202,7 @@ call generateRbacIdentityViewFromProjection('hs_office_partner', $idName$
call generateRbacRestrictedView('hs_office_partner',
'(select idName from hs_office_person_iv p where p.uuid = target.personUuid)',
$updates$
partnerRoleUuid = new.partnerRoleUuid,
partnerRelUuid = new.partnerRelUuid,
personUuid = new.personUuid,
contactUuid = new.contactUuid
$updates$);

View File

@ -18,7 +18,7 @@ declare
currentTask varchar;
idName varchar;
mandantPerson hs_office_person;
partnerRole hs_office_relationship;
partnerRel hs_office_relationship;
relatedPerson hs_office_person;
relatedContact hs_office_contact;
relatedDetailsUuid uuid;
@ -45,13 +45,13 @@ begin
select r.* from hs_office_relationship r
where r.reltype = 'PARTNER'
and r.relanchoruuid = mandantPerson.uuid and r.relholderuuid = relatedPerson.uuid
into partnerRole;
if partnerRole is null then
raise exception 'partnerRole "%"-"%" not found', mandantPerson.tradename, partnerPersonName;
into partnerRel;
if partnerRel is null then
raise exception 'partnerRel "%"-"%" not found', mandantPerson.tradename, partnerPersonName;
end if;
raise notice 'creating test partner: %', idName;
raise notice '- using partnerRole (%): %', partnerRole.uuid, partnerRole;
raise notice '- using partnerRel (%): %', partnerRel.uuid, partnerRel;
raise notice '- using person (%): %', relatedPerson.uuid, relatedPerson;
raise notice '- using contact (%): %', relatedContact.uuid, relatedContact;
@ -68,8 +68,8 @@ begin
end if;
insert
into hs_office_partner (uuid, partnerNumber, partnerRoleUuid, personuuid, contactuuid, detailsUuid)
values (uuid_generate_v4(), partnerNumber, partnerRole.uuid, relatedPerson.uuid, relatedContact.uuid, relatedDetailsUuid);
into hs_office_partner (uuid, partnerNumber, partnerRelUuid, personuuid, contactuuid, detailsUuid)
values (uuid_generate_v4(), partnerNumber, partnerRel.uuid, relatedPerson.uuid, relatedContact.uuid, relatedDetailsUuid);
end; $$;
--//

View File

@ -224,8 +224,8 @@ public class ImportOfficeData extends ContextBasedTest {
debitors.forEach( (id, debitor) -> {
final var debitorRel = HsOfficeRelationshipEntity.builder()
.relType(HsOfficeRelationshipType.DEBITOR)
.relAnchor(debitor.getPartner().getPartnerRole().getRelHolder())
.relHolder(debitor.getPartner().getPartnerRole().getRelHolder()) // just 1 debitor/partner in legacy hsadmin
.relAnchor(debitor.getPartner().getPartnerRel().getRelHolder())
.relHolder(debitor.getPartner().getPartnerRel().getRelHolder()) // just 1 debitor/partner in legacy hsadmin
.contact(debitor.getBillingContact())
.build();
if (debitorRel.getRelAnchor() != null && debitorRel.getRelHolder() != null &&
@ -687,7 +687,7 @@ public class ImportOfficeData extends ContextBasedTest {
final var partner = HsOfficePartnerEntity.builder()
.partnerNumber(rec.getInteger("member_id"))
.details(HsOfficePartnerDetailsEntity.builder().build())
.partnerRole(partnerRelationship)
.partnerRel(partnerRelationship)
.contact(null) // is set during contacts import depending on assigned roles
.person(person)
.build();
@ -845,7 +845,7 @@ public class ImportOfficeData extends ContextBasedTest {
final var debitor = debitors.get(bpId);
final var partnerPerson = partner.getPerson();
if (containsPartnerRole(rec)) {
if (containsPartnerRel(rec)) {
initPerson(partner.getPerson(), rec);
}
@ -859,10 +859,10 @@ public class ImportOfficeData extends ContextBasedTest {
final var contact = HsOfficeContactEntity.builder().build();
initContact(contact, rec);
if (containsPartnerRole(rec)) {
if (containsPartnerRel(rec)) {
assertThat(partner.getContact()).isNull();
partner.setContact(contact);
partner.getPartnerRole().setContact(contact);
partner.getPartnerRel().setContact(contact);
}
if (containsRole(rec, "billing")) {
assertThat(debitor.getBillingContact()).isNull();
@ -909,7 +909,7 @@ public class ImportOfficeData extends ContextBasedTest {
return ("," + roles + ",").contains("," + role + ",");
}
private static boolean containsPartnerRole(final Record rec) {
private static boolean containsPartnerRel(final Record rec) {
return containsRole(rec, "partner");
}

View File

@ -102,7 +102,7 @@ class HsOfficePartnerControllerAcceptanceTest extends ContextBasedTestWithCleanu
.body("""
{
"partnerNumber": "20002",
"partnerRole": {
"partnerRel": {
"relAnchorUuid": "%s",
"relHolderUuid": "%s",
"contactUuid": "%s"
@ -155,7 +155,7 @@ class HsOfficePartnerControllerAcceptanceTest extends ContextBasedTestWithCleanu
.body("""
{
"partnerNumber": "20003",
"partnerRole": {
"partnerRel": {
"relAnchorUuid": "%s",
"relHolderUuid": "%s",
"contactUuid": "%s"
@ -193,7 +193,7 @@ class HsOfficePartnerControllerAcceptanceTest extends ContextBasedTestWithCleanu
.body("""
{
"partnerNumber": "20004",
"partnerRole": {
"partnerRel": {
"relAnchorUuid": "%s",
"relHolderUuid": "%s",
"contactUuid": "%s"
@ -413,7 +413,7 @@ class HsOfficePartnerControllerAcceptanceTest extends ContextBasedTestWithCleanu
// then the given partner is gone
assertThat(partnerRepo.findByUuid(givenPartner.getUuid())).isEmpty();
assertThat(relationshipRepository.findByUuid(givenPartner.getPartnerRole().getUuid())).isEmpty();
assertThat(relationshipRepository.findByUuid(givenPartner.getPartnerRel().getUuid())).isEmpty();
}
@Test
@ -465,15 +465,15 @@ class HsOfficePartnerControllerAcceptanceTest extends ContextBasedTestWithCleanu
final var givenPerson = personRepo.findPersonByOptionalNameLike("Erben Bessler").get(0);
final var givenContact = contactRepo.findContactByOptionalLabelLike("fourth contact").get(0);
final var partnerRole = new HsOfficeRelationshipEntity();
partnerRole.setRelType(HsOfficeRelationshipType.PARTNER);
partnerRole.setRelAnchor(givenMandantPerson);
partnerRole.setRelHolder(givenPerson);
partnerRole.setContact(givenContact);
em.persist(partnerRole);
final var partnerRel = new HsOfficeRelationshipEntity();
partnerRel.setRelType(HsOfficeRelationshipType.PARTNER);
partnerRel.setRelAnchor(givenMandantPerson);
partnerRel.setRelHolder(givenPerson);
partnerRel.setContact(givenContact);
em.persist(partnerRel);
final var newPartner = HsOfficePartnerEntity.builder()
.partnerRole(partnerRole)
.partnerRel(partnerRel)
.partnerNumber(partnerNumber)
.person(givenPerson)
.contact(givenContact)

View File

@ -100,7 +100,7 @@ class HsOfficePartnerControllerRestTest {
.content("""
{
"partnerNumber": "20002",
"partnerRole": {
"partnerRel": {
"relAnchorUuid": "%s",
"relHolderUuid": "%s",
"contactUuid": "%s"
@ -137,7 +137,7 @@ class HsOfficePartnerControllerRestTest {
.content("""
{
"partnerNumber": "20002",
"partnerRole": {
"partnerRel": {
"relAnchorUuid": "%s",
"relHolderUuid": "%s",
"contactUuid": "%s"
@ -176,7 +176,7 @@ class HsOfficePartnerControllerRestTest {
when(partnerRepo.deleteByUuid(givenPartnerUuid)).thenReturn(0);
final UUID givenRelationshipUuid = UUID.randomUUID();
when(partnerMock.getPartnerRole()).thenReturn(HsOfficeRelationshipEntity.builder()
when(partnerMock.getPartnerRel()).thenReturn(HsOfficeRelationshipEntity.builder()
.uuid(givenRelationshipUuid)
.build());
when(relationshipRepo.deleteByUuid(givenRelationshipUuid)).thenReturn(0);
@ -201,7 +201,7 @@ class HsOfficePartnerControllerRestTest {
when(relationshipRepo.deleteByUuid(any())).thenReturn(0);
final UUID givenRelationshipUuid = UUID.randomUUID();
when(partnerMock.getPartnerRole()).thenReturn(HsOfficeRelationshipEntity.builder()
when(partnerMock.getPartnerRel()).thenReturn(HsOfficeRelationshipEntity.builder()
.uuid(givenRelationshipUuid)
.build());
when(relationshipRepo.deleteByUuid(givenRelationshipUuid)).thenReturn(0);

View File

@ -80,19 +80,19 @@ class HsOfficePartnerRepositoryIntegrationTest extends ContextBasedTestWithClean
final var givenPartnerPerson = personRepo.findPersonByOptionalNameLike("First GmbH").get(0);
final var givenContact = contactRepo.findContactByOptionalLabelLike("first contact").get(0);
final var partnerRole = HsOfficeRelationshipEntity.builder()
final var partnerRel = HsOfficeRelationshipEntity.builder()
.relHolder(givenPartnerPerson)
.relType(HsOfficeRelationshipType.PARTNER)
.relAnchor(givenMandantorPerson)
.contact(givenContact)
.build();
relationshipRepo.save(partnerRole);
relationshipRepo.save(partnerRel);
// when
final var result = attempt(em, () -> {
final var newPartner = HsOfficePartnerEntity.builder()
.partnerNumber(20031)
.partnerRole(partnerRole)
.partnerRel(partnerRel)
.person(givenPartnerPerson)
.contact(givenContact)
.details(HsOfficePartnerDetailsEntity.builder()
@ -135,7 +135,7 @@ class HsOfficePartnerRepositoryIntegrationTest extends ContextBasedTestWithClean
final var newPartner = HsOfficePartnerEntity.builder()
.partnerNumber(20032)
.partnerRole(newRelationship)
.partnerRel(newRelationship)
.person(givenPartnerPerson)
.contact(givenContact)
.details(HsOfficePartnerDetailsEntity.builder().build())
@ -429,7 +429,7 @@ class HsOfficePartnerRepositoryIntegrationTest extends ContextBasedTestWithClean
// TODO: should deleting a partner automatically delete the PARTNER relationship? (same for debitor)
// TODO: why did the test cleanup check does not notice this, if missing?
return partnerRepo.deleteByUuid(givenPartner.getUuid()) +
relationshipRepo.deleteByUuid(givenPartner.getPartnerRole().getUuid());
relationshipRepo.deleteByUuid(givenPartner.getPartnerRel().getUuid());
});
// then
@ -466,17 +466,17 @@ class HsOfficePartnerRepositoryIntegrationTest extends ContextBasedTestWithClean
final var givenPartnerPerson = personRepo.findPersonByOptionalNameLike(person).get(0);
final var givenContact = contactRepo.findContactByOptionalLabelLike(contact).get(0);
final var partnerRole = HsOfficeRelationshipEntity.builder()
final var partnerRel = HsOfficeRelationshipEntity.builder()
.relHolder(givenPartnerPerson)
.relType(HsOfficeRelationshipType.PARTNER)
.relAnchor(givenMandantorPerson)
.contact(givenContact)
.build();
relationshipRepo.save(partnerRole);
relationshipRepo.save(partnerRel);
final var newPartner = HsOfficePartnerEntity.builder()
.partnerNumber(partnerNumber)
.partnerRole(partnerRole)
.partnerRel(partnerRel)
.person(givenPartnerPerson)
.contact(givenContact)
.details(HsOfficePartnerDetailsEntity.builder().build())

View File

@ -142,7 +142,7 @@ class HsOfficeRelationshipControllerAcceptanceTest extends ContextBasedTestWithC
"contactUuid": "%s"
}
""".formatted(
HsOfficeRelationshipTypeResource.ACCOUNTING,
HsOfficeRelationshipTypeResource.DEBITOR,
givenAnchorPerson.getUuid(),
givenHolderPerson.getUuid(),
givenContact.getUuid()))
@ -153,7 +153,7 @@ class HsOfficeRelationshipControllerAcceptanceTest extends ContextBasedTestWithC
.statusCode(201)
.contentType(ContentType.JSON)
.body("uuid", isUuidValid())
.body("relType", is("ACCOUNTING"))
.body("relType", is("DEBITOR"))
.body("relAnchor.tradeName", is("Third OHG"))
.body("relHolder.givenName", is("Paul"))
.body("contact.label", is("second contact"))
@ -186,7 +186,7 @@ class HsOfficeRelationshipControllerAcceptanceTest extends ContextBasedTestWithC
"contactUuid": "%s"
}
""".formatted(
HsOfficeRelationshipTypeResource.ACCOUNTING,
HsOfficeRelationshipTypeResource.DEBITOR,
givenAnchorPersonUuid,
givenHolderPerson.getUuid(),
givenContact.getUuid()))
@ -218,7 +218,7 @@ class HsOfficeRelationshipControllerAcceptanceTest extends ContextBasedTestWithC
"contactUuid": "%s"
}
""".formatted(
HsOfficeRelationshipTypeResource.ACCOUNTING,
HsOfficeRelationshipTypeResource.DEBITOR,
givenAnchorPerson.getUuid(),
GIVEN_NON_EXISTING_HOLDER_PERSON_UUID,
givenContact.getUuid()))
@ -251,7 +251,7 @@ class HsOfficeRelationshipControllerAcceptanceTest extends ContextBasedTestWithC
"contactUuid": "%s"
}
""".formatted(
HsOfficeRelationshipTypeResource.ACCOUNTING,
HsOfficeRelationshipTypeResource.DEBITOR,
givenAnchorPerson.getUuid(),
givenHolderPerson.getUuid(),
givenContactUuid))