use "YYYY-MM-DD" format when writing LocalDate to JSON
This commit is contained in:
parent
c6d92e271f
commit
4f22dffe5d
@ -59,6 +59,7 @@ dependencies {
|
|||||||
implementation 'org.springdoc:springdoc-openapi-ui:1.6.11'
|
implementation 'org.springdoc:springdoc-openapi-ui:1.6.11'
|
||||||
implementation 'org.liquibase:liquibase-core'
|
implementation 'org.liquibase:liquibase-core'
|
||||||
implementation 'com.vladmihalcea:hibernate-types-55:2.19.2'
|
implementation 'com.vladmihalcea:hibernate-types-55:2.19.2'
|
||||||
|
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.13.4'
|
||||||
implementation 'org.openapitools:jackson-databind-nullable:0.2.3'
|
implementation 'org.openapitools:jackson-databind-nullable:0.2.3'
|
||||||
implementation 'org.modelmapper:modelmapper:3.1.0'
|
implementation 'org.modelmapper:modelmapper:3.1.0'
|
||||||
implementation 'org.iban4j:iban4j:3.2.3-RELEASE'
|
implementation 'org.iban4j:iban4j:3.2.3-RELEASE'
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package net.hostsharing.hsadminng.config;
|
package net.hostsharing.hsadminng.config;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||||
import org.openapitools.jackson.nullable.JsonNullableModule;
|
import org.openapitools.jackson.nullable.JsonNullableModule;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
@ -14,6 +15,7 @@ public class JsonObjectMapperConfiguration {
|
|||||||
@Primary
|
@Primary
|
||||||
public Jackson2ObjectMapperBuilder customObjectMapper() {
|
public Jackson2ObjectMapperBuilder customObjectMapper() {
|
||||||
return new Jackson2ObjectMapperBuilder()
|
return new Jackson2ObjectMapperBuilder()
|
||||||
.modules(new JsonNullableModule(), new JavaTimeModule());
|
.modules(new JsonNullableModule(), new JavaTimeModule())
|
||||||
|
.featuresToDisable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,28 +8,37 @@
|
|||||||
/*
|
/*
|
||||||
Creates a single partner test record.
|
Creates a single partner test record.
|
||||||
*/
|
*/
|
||||||
create or replace procedure createHsOfficePartnerTestData( personTradeName varchar, contactLabel varchar )
|
create or replace procedure createHsOfficePartnerTestData( personTradeOrFamilyName varchar, contactLabel varchar )
|
||||||
language plpgsql as $$
|
language plpgsql as $$
|
||||||
declare
|
declare
|
||||||
currentTask varchar;
|
currentTask varchar;
|
||||||
idName varchar;
|
idName varchar;
|
||||||
relatedPerson hs_office_person;
|
relatedPerson hs_office_person;
|
||||||
relatedContact hs_office_contact;
|
relatedContact hs_office_contact;
|
||||||
|
birthday date;
|
||||||
begin
|
begin
|
||||||
idName := cleanIdentifier( personTradeName|| '-' || contactLabel);
|
idName := cleanIdentifier( personTradeOrFamilyName|| '-' || contactLabel);
|
||||||
currentTask := 'creating partner test-data ' || idName;
|
currentTask := 'creating partner test-data ' || idName;
|
||||||
call defineContext(currentTask, null, 'superuser-alex@hostsharing.net', 'global#global.admin');
|
call defineContext(currentTask, null, 'superuser-alex@hostsharing.net', 'global#global.admin');
|
||||||
execute format('set local hsadminng.currentTask to %L', currentTask);
|
execute format('set local hsadminng.currentTask to %L', currentTask);
|
||||||
|
|
||||||
select p.* from hs_office_person p where p.tradeName = personTradeName into relatedPerson;
|
select p.* from hs_office_person p
|
||||||
select c.* from hs_office_contact c where c.label = contactLabel into relatedContact;
|
where p.tradeName = personTradeOrFamilyName or p.familyName = personTradeOrFamilyName
|
||||||
|
into relatedPerson;
|
||||||
|
select c.* from hs_office_contact c
|
||||||
|
where c.label = contactLabel
|
||||||
|
into relatedContact;
|
||||||
|
|
||||||
|
if relatedPerson.persontype = 'NATURAL' then
|
||||||
|
birthday := '1987-10-31'::date;
|
||||||
|
end if;
|
||||||
|
|
||||||
raise notice 'creating test partner: %', idName;
|
raise notice 'creating test partner: %', idName;
|
||||||
raise notice '- using person (%): %', relatedPerson.uuid, relatedPerson;
|
raise notice '- using person (%): %', relatedPerson.uuid, relatedPerson;
|
||||||
raise notice '- using contact (%): %', relatedContact.uuid, relatedContact;
|
raise notice '- using contact (%): %', relatedContact.uuid, relatedContact;
|
||||||
insert
|
insert
|
||||||
into hs_office_partner (uuid, personuuid, contactuuid)
|
into hs_office_partner (uuid, personuuid, contactuuid, birthday)
|
||||||
values (uuid_generate_v4(), relatedPerson.uuid, relatedContact.uuid);
|
values (uuid_generate_v4(), relatedPerson.uuid, relatedContact.uuid, birthDay);
|
||||||
end; $$;
|
end; $$;
|
||||||
--//
|
--//
|
||||||
|
|
||||||
@ -67,6 +76,7 @@ do language plpgsql $$
|
|||||||
call createHsOfficePartnerTestData('Second e.K.', 'second contact');
|
call createHsOfficePartnerTestData('Second e.K.', 'second contact');
|
||||||
call createHsOfficePartnerTestData('Third OHG', 'third contact');
|
call createHsOfficePartnerTestData('Third OHG', 'third contact');
|
||||||
call createHsOfficePartnerTestData('Fourth e.G.', 'forth contact');
|
call createHsOfficePartnerTestData('Fourth e.G.', 'forth contact');
|
||||||
|
call createHsOfficePartnerTestData('Smith', 'fifth contact');
|
||||||
end;
|
end;
|
||||||
$$;
|
$$;
|
||||||
--//
|
--//
|
||||||
|
@ -76,6 +76,11 @@ class HsOfficePartnerControllerAcceptanceTest {
|
|||||||
.contentType("application/json")
|
.contentType("application/json")
|
||||||
.body("", lenientlyEquals("""
|
.body("", lenientlyEquals("""
|
||||||
[
|
[
|
||||||
|
{
|
||||||
|
"person": { "familyName": "Smith" },
|
||||||
|
"contact": { "label": "fifth contact" },
|
||||||
|
"birthday": "1987-10-31"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"person": { "tradeName": "First GmbH" },
|
"person": { "tradeName": "First GmbH" },
|
||||||
"contact": { "label": "first contact" }
|
"contact": { "label": "first contact" }
|
||||||
|
Loading…
Reference in New Issue
Block a user