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
7 changed files with 37 additions and 38 deletions
Showing only changes of commit 19f962cf2e - Show all commits

View File

@ -1,8 +1,8 @@
package net.hostsharing.hsadminng.hs.office.relationship;
public enum HsOfficeRelationshipType {
SOLE_AGENT,
JOINT_AGENT,
UNKNOWN,
REPRESENTATIVE,
ACCOUNTING_CONTACT,
TECHNICAL_CONTACT
}

View File

@ -6,8 +6,7 @@ components:
HsOfficeRelationshipType:
type: string
enum:
- SOLE_AGENT # e.g. CEO
- JOINT_AGENT # e.g. heir
- REPRESENTATIVE
- ACCOUNTING_CONTACT
- TECHNICAL_CONTACT

View File

@ -4,7 +4,7 @@
--changeset hs-office-relationship-MAIN-TABLE:1 endDelimiter:--//
-- ----------------------------------------------------------------------------
CREATE TYPE HsOfficeRelationshipType AS ENUM ('SOLE_AGENT', 'JOINT_AGENT', 'CO_OWNER', 'ACCOUNTING_CONTACT', 'TECHNICAL_CONTACT');
CREATE TYPE HsOfficeRelationshipType AS ENUM ('UNKNOWN', 'REPRESENTATIVE', 'ACCOUNTING_CONTACT', 'TECHNICAL_CONTACT');
CREATE CAST (character varying as HsOfficeRelationshipType) WITH INOUT AS IMPLICIT;

View File

@ -58,7 +58,7 @@ begin
select p.* from hs_office_person p where tradeName = intToVarChar(t, 4) into person;
select c.* from hs_office_contact c where c.label = intToVarChar(t, 4) || '#' || t into contact;
call createHsOfficeRelationshipTestData(person.uuid, contact.uuid, 'SOLE_AGENT');
call createHsOfficeRelationshipTestData(person.uuid, contact.uuid, 'REPRESENTATIVE');
commit;
end loop;
end; $$;
@ -71,11 +71,11 @@ end; $$;
do language plpgsql $$
begin
call createHsOfficeRelationshipTestData('First GmbH', 'Smith', 'SOLE_AGENT', 'first contact');
call createHsOfficeRelationshipTestData('First GmbH', 'Smith', 'REPRESENTATIVE', 'first contact');
call createHsOfficeRelationshipTestData('Second e.K.', 'Smith', 'SOLE_AGENT', 'second contact');
call createHsOfficeRelationshipTestData('Second e.K.', 'Smith', 'REPRESENTATIVE', 'second contact');
call createHsOfficeRelationshipTestData('Third OHG', 'Smith', 'SOLE_AGENT', 'third contact');
call createHsOfficeRelationshipTestData('Third OHG', 'Smith', 'REPRESENTATIVE', 'third contact');
end;
$$;
--//

View File

@ -75,7 +75,7 @@ class HsOfficeRelationshipControllerAcceptanceTest {
.port(port)
.when()
.get("http://localhost/api/hs/office/relationships?personUuid=%s&relationshipType=%s"
.formatted(givenPerson.getUuid(), HsOfficeRelationshipTypeResource.SOLE_AGENT))
.formatted(givenPerson.getUuid(), HsOfficeRelationshipTypeResource.REPRESENTATIVE))
.then().log().all().assertThat()
.statusCode(200)
.contentType("application/json")
@ -91,7 +91,7 @@ class HsOfficeRelationshipControllerAcceptanceTest {
"givenName": "Peter",
"familyName": "Smith"
},
"relType": "SOLE_AGENT",
"relType": "REPRESENTATIVE",
"contact": { "label": "third contact" }
},
{
@ -106,7 +106,7 @@ class HsOfficeRelationshipControllerAcceptanceTest {
"givenName": "Peter",
"familyName": "Smith"
},
"relType": "SOLE_AGENT",
"relType": "REPRESENTATIVE",
"contact": { "label": "second contact" }
},
{
@ -120,7 +120,7 @@ class HsOfficeRelationshipControllerAcceptanceTest {
"givenName": "Peter",
"familyName": "Smith"
},
"relType": "SOLE_AGENT",
"relType": "REPRESENTATIVE",
"contact": { "label": "first contact" }
}
]
@ -387,7 +387,7 @@ class HsOfficeRelationshipControllerAcceptanceTest {
.statusCode(200)
.contentType(ContentType.JSON)
.body("uuid", isUuidValid())
.body("relType", is("JOINT_AGENT"))
.body("relType", is("REPRESENTATIVE"))
.body("relAnchor.tradeName", is("Erben Bessler"))
.body("relHolder.familyName", is("Winkler"))
.body("contact.label", is("forth contact"));
@ -400,7 +400,7 @@ class HsOfficeRelationshipControllerAcceptanceTest {
assertThat(rel.getRelAnchor().getTradeName()).contains("Bessler");
assertThat(rel.getRelHolder().getFamilyName()).contains("Winkler");
assertThat(rel.getContact().getLabel()).isEqualTo("forth contact");
assertThat(rel.getRelType()).isEqualTo(HsOfficeRelationshipType.JOINT_AGENT);
assertThat(rel.getRelType()).isEqualTo(HsOfficeRelationshipType.REPRESENTATIVE);
return true;
});
}
@ -477,7 +477,7 @@ class HsOfficeRelationshipControllerAcceptanceTest {
final var givenContact = contactRepo.findContactByOptionalLabelLike("seventh contact").get(0);
final var newRelationship = HsOfficeRelationshipEntity.builder()
.uuid(UUID.randomUUID())
.relType(HsOfficeRelationshipType.JOINT_AGENT)
.relType(HsOfficeRelationshipType.REPRESENTATIVE)
.relAnchor(givenAnchorPerson)
.relHolder(givenHolderPerson)
.contact(givenContact)

View File

@ -52,7 +52,7 @@ class HsOfficeRelationshipEntityPatcherUnitTest extends PatchUnitTestBase<
protected HsOfficeRelationshipEntity newInitialEntity() {
final var entity = new HsOfficeRelationshipEntity();
entity.setUuid(INITIAL_RELATIONSHIP_UUID);
entity.setRelType(HsOfficeRelationshipType.SOLE_AGENT);
entity.setRelType(HsOfficeRelationshipType.REPRESENTATIVE);
entity.setRelAnchor(givenInitialAnchorPerson);
entity.setRelHolder(givenInitialHolderPerson);
entity.setContact(givenInitialContact);

View File

@ -77,7 +77,7 @@ class HsOfficeRelationshipRepositoryIntegrationTest extends ContextBasedTest {
final var newRelationship = toCleanup(HsOfficeRelationshipEntity.builder()
.relAnchor(givenAnchorPerson)
.relHolder(givenHolderPerson)
.relType(HsOfficeRelationshipType.JOINT_AGENT)
.relType(HsOfficeRelationshipType.REPRESENTATIVE)
.contact(givenContact)
.build());
return relationshipRepo.save(newRelationship);
@ -105,7 +105,7 @@ class HsOfficeRelationshipRepositoryIntegrationTest extends ContextBasedTest {
final var newRelationship = toCleanup(HsOfficeRelationshipEntity.builder()
.relAnchor(givenAnchorPerson)
.relHolder(givenHolderPerson)
.relType(HsOfficeRelationshipType.JOINT_AGENT)
.relType(HsOfficeRelationshipType.REPRESENTATIVE)
.contact(givenContact)
.build());
return relationshipRepo.save(newRelationship);
@ -114,26 +114,26 @@ class HsOfficeRelationshipRepositoryIntegrationTest extends ContextBasedTest {
// then
assertThat(roleNamesOf(rawRoleRepo.findAll())).containsExactlyInAnyOrder(Array.from(
initialRoleNames,
"hs_office_relationship#BesslerAnita-with-JOINT_AGENT-BesslerAnita.admin",
"hs_office_relationship#BesslerAnita-with-JOINT_AGENT-BesslerAnita.owner",
"hs_office_relationship#BesslerAnita-with-JOINT_AGENT-BesslerAnita.tenant"));
"hs_office_relationship#BesslerAnita-with-REPRESENTATIVE-BesslerAnita.admin",
"hs_office_relationship#BesslerAnita-with-REPRESENTATIVE-BesslerAnita.owner",
"hs_office_relationship#BesslerAnita-with-REPRESENTATIVE-BesslerAnita.tenant"));
assertThat(grantDisplaysOf(rawGrantRepo.findAll())).containsExactlyInAnyOrder(Array.fromFormatted(
initialGrantNames,
"{ grant perm * on hs_office_relationship#BesslerAnita-with-JOINT_AGENT-BesslerAnita to role hs_office_relationship#BesslerAnita-with-JOINT_AGENT-BesslerAnita.owner by system and assume }",
"{ grant role hs_office_relationship#BesslerAnita-with-JOINT_AGENT-BesslerAnita.owner to role global#global.admin by system and assume }",
"{ grant role hs_office_relationship#BesslerAnita-with-JOINT_AGENT-BesslerAnita.owner to role hs_office_person#BesslerAnita.admin by system and assume }",
"{ grant perm * on hs_office_relationship#BesslerAnita-with-REPRESENTATIVE-BesslerAnita to role hs_office_relationship#BesslerAnita-with-REPRESENTATIVE-BesslerAnita.owner by system and assume }",
"{ grant role hs_office_relationship#BesslerAnita-with-REPRESENTATIVE-BesslerAnita.owner to role global#global.admin by system and assume }",
"{ grant role hs_office_relationship#BesslerAnita-with-REPRESENTATIVE-BesslerAnita.owner to role hs_office_person#BesslerAnita.admin by system and assume }",
"{ grant perm edit on hs_office_relationship#BesslerAnita-with-JOINT_AGENT-BesslerAnita to role hs_office_relationship#BesslerAnita-with-JOINT_AGENT-BesslerAnita.admin by system and assume }",
"{ grant role hs_office_relationship#BesslerAnita-with-JOINT_AGENT-BesslerAnita.admin to role hs_office_relationship#BesslerAnita-with-JOINT_AGENT-BesslerAnita.owner by system and assume }",
"{ grant perm edit on hs_office_relationship#BesslerAnita-with-REPRESENTATIVE-BesslerAnita to role hs_office_relationship#BesslerAnita-with-REPRESENTATIVE-BesslerAnita.admin by system and assume }",
"{ grant role hs_office_relationship#BesslerAnita-with-REPRESENTATIVE-BesslerAnita.admin to role hs_office_relationship#BesslerAnita-with-REPRESENTATIVE-BesslerAnita.owner by system and assume }",
"{ grant perm view on hs_office_relationship#BesslerAnita-with-JOINT_AGENT-BesslerAnita to role hs_office_relationship#BesslerAnita-with-JOINT_AGENT-BesslerAnita.tenant by system and assume }",
"{ grant role hs_office_relationship#BesslerAnita-with-JOINT_AGENT-BesslerAnita.tenant to role hs_office_contact#forthcontact.admin by system and assume }",
"{ grant role hs_office_relationship#BesslerAnita-with-JOINT_AGENT-BesslerAnita.tenant to role hs_office_person#BesslerAnita.admin by system and assume }",
"{ grant perm view on hs_office_relationship#BesslerAnita-with-REPRESENTATIVE-BesslerAnita to role hs_office_relationship#BesslerAnita-with-REPRESENTATIVE-BesslerAnita.tenant by system and assume }",
"{ grant role hs_office_relationship#BesslerAnita-with-REPRESENTATIVE-BesslerAnita.tenant to role hs_office_contact#forthcontact.admin by system and assume }",
"{ grant role hs_office_relationship#BesslerAnita-with-REPRESENTATIVE-BesslerAnita.tenant to role hs_office_person#BesslerAnita.admin by system and assume }",
"{ grant role hs_office_relationship#BesslerAnita-with-JOINT_AGENT-BesslerAnita.tenant to role hs_office_relationship#BesslerAnita-with-JOINT_AGENT-BesslerAnita.admin by system and assume }",
"{ grant role hs_office_contact#forthcontact.tenant to role hs_office_relationship#BesslerAnita-with-JOINT_AGENT-BesslerAnita.tenant by system and assume }",
"{ grant role hs_office_person#BesslerAnita.tenant to role hs_office_relationship#BesslerAnita-with-JOINT_AGENT-BesslerAnita.tenant by system and assume }",
"{ grant role hs_office_relationship#BesslerAnita-with-REPRESENTATIVE-BesslerAnita.tenant to role hs_office_relationship#BesslerAnita-with-REPRESENTATIVE-BesslerAnita.admin by system and assume }",
"{ grant role hs_office_contact#forthcontact.tenant to role hs_office_relationship#BesslerAnita-with-REPRESENTATIVE-BesslerAnita.tenant by system and assume }",
"{ grant role hs_office_person#BesslerAnita.tenant to role hs_office_relationship#BesslerAnita-with-REPRESENTATIVE-BesslerAnita.tenant by system and assume }",
null)
);
}
@ -159,9 +159,9 @@ class HsOfficeRelationshipRepositoryIntegrationTest extends ContextBasedTest {
// then
allTheseRelationshipsAreReturned(
result,
"rel(relAnchor='First GmbH', relType='SOLE_AGENT', relHolder='Smith, Peter', contact='first contact')",
"rel(relAnchor='Third OHG', relType='SOLE_AGENT', relHolder='Smith, Peter', contact='third contact')",
"rel(relAnchor='Second e.K.', relType='SOLE_AGENT', relHolder='Smith, Peter', contact='second contact')");
"rel(relAnchor='First GmbH', relType='REPRESENTATIVE', relHolder='Smith, Peter', contact='first contact')",
"rel(relAnchor='Third OHG', relType='REPRESENTATIVE', relHolder='Smith, Peter', contact='third contact')",
"rel(relAnchor='Second e.K.', relType='REPRESENTATIVE', relHolder='Smith, Peter', contact='second contact')");
}
@Test
@ -176,7 +176,7 @@ class HsOfficeRelationshipRepositoryIntegrationTest extends ContextBasedTest {
// then:
exactlyTheseRelationshipsAreReturned(
result,
"rel(relAnchor='First GmbH', relType='SOLE_AGENT', relHolder='Smith, Peter', contact='first contact')");
"rel(relAnchor='First GmbH', relType='REPRESENTATIVE', relHolder='Smith, Peter', contact='first contact')");
}
}
@ -392,7 +392,7 @@ class HsOfficeRelationshipRepositoryIntegrationTest extends ContextBasedTest {
final var givenHolderPerson = personRepo.findPersonByOptionalNameLike(holderPerson).get(0);
final var givenContact = contactRepo.findContactByOptionalLabelLike(contact).get(0);
final var newRelationship = HsOfficeRelationshipEntity.builder()
.relType(HsOfficeRelationshipType.JOINT_AGENT)
.relType(HsOfficeRelationshipType.REPRESENTATIVE)
.relAnchor(givenAnchorPerson)
.relHolder(givenHolderPerson)
.contact(givenContact)