fix setting mark via API
This commit is contained in:
parent
3faf2ea99e
commit
6bac02380b
@ -70,6 +70,7 @@ public class HsOfficeRelationController implements HsOfficeRelationsApi {
|
||||
|
||||
final var entityToSave = new HsOfficeRelationEntity();
|
||||
entityToSave.setType(HsOfficeRelationType.valueOf(body.getType()));
|
||||
entityToSave.setMark(body.getMark());
|
||||
entityToSave.setAnchor(holderRepo.findByUuid(body.getAnchorUuid()).orElseThrow(
|
||||
() -> new NoSuchElementException("cannot find anchorUuid " + body.getAnchorUuid())
|
||||
));
|
||||
|
@ -55,6 +55,7 @@ components:
|
||||
nullable: true
|
||||
mark:
|
||||
type: string
|
||||
nullable: true
|
||||
contactUuid:
|
||||
type: string
|
||||
format: uuid
|
||||
@ -62,4 +63,4 @@ components:
|
||||
- anchorUuid
|
||||
- holderUuid
|
||||
- type
|
||||
- relContactUuid
|
||||
- contactUuid
|
||||
|
@ -137,12 +137,14 @@ class HsOfficeRelationControllerAcceptanceTest extends ContextBasedTestWithClean
|
||||
.body("""
|
||||
{
|
||||
"type": "%s",
|
||||
"mark": "%s",
|
||||
"anchorUuid": "%s",
|
||||
"holderUuid": "%s",
|
||||
"contactUuid": "%s"
|
||||
}
|
||||
""".formatted(
|
||||
HsOfficeRelationTypeResource.DEBITOR,
|
||||
HsOfficeRelationTypeResource.SUBSCRIBER,
|
||||
"operations-discuss",
|
||||
givenAnchorPerson.getUuid(),
|
||||
givenHolderPerson.getUuid(),
|
||||
givenContact.getUuid()))
|
||||
@ -153,7 +155,8 @@ class HsOfficeRelationControllerAcceptanceTest extends ContextBasedTestWithClean
|
||||
.statusCode(201)
|
||||
.contentType(ContentType.JSON)
|
||||
.body("uuid", isUuidValid())
|
||||
.body("type", is("DEBITOR"))
|
||||
.body("type", is("SUBSCRIBER"))
|
||||
.body("mark", is("operations-discuss"))
|
||||
.body("anchor.tradeName", is("Third OHG"))
|
||||
.body("holder.givenName", is("Paul"))
|
||||
.body("contact.label", is("second contact"))
|
||||
|
@ -72,7 +72,8 @@ class HsOfficeRelationRepositoryIntegrationTest extends ContextBasedTestWithClea
|
||||
final var newRelation = HsOfficeRelationEntity.builder()
|
||||
.anchor(givenAnchorPerson)
|
||||
.holder(givenHolderPerson)
|
||||
.type(HsOfficeRelationType.REPRESENTATIVE)
|
||||
.type(HsOfficeRelationType.SUBSCRIBER)
|
||||
.mark("operations-announce")
|
||||
.contact(givenContact)
|
||||
.build();
|
||||
return toCleanup(relationRepo.save(newRelation));
|
||||
@ -83,6 +84,9 @@ class HsOfficeRelationRepositoryIntegrationTest extends ContextBasedTestWithClea
|
||||
assertThat(result.returnedValue()).isNotNull().extracting(HsOfficeRelationEntity::getUuid).isNotNull();
|
||||
assertThatRelationIsPersisted(result.returnedValue());
|
||||
assertThat(relationRepo.count()).isEqualTo(count + 1);
|
||||
final var stored = relationRepo.findByUuid(result.returnedValue().getUuid());
|
||||
assertThat(stored).isNotEmpty().map(HsOfficeRelationEntity::toString).get()
|
||||
.isEqualTo("rel(anchor='NP Bessler, Anita', type='SUBSCRIBER', mark='operations-announce', holder='NP Bessler, Anita', contact='fourth contact')");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Loading…
Reference in New Issue
Block a user