Skip to content

Commit

Permalink
Merge pull request #125 from Onlineberatung/develop
Browse files Browse the repository at this point in the history
merge from OS
  • Loading branch information
tkuzynow authored Feb 16, 2024
2 parents 44be2da + 8a38787 commit 94690c1
Show file tree
Hide file tree
Showing 17 changed files with 30 additions and 30 deletions.
6 changes: 3 additions & 3 deletions api/agencyadminservice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ components:
dataProtection:
type: object
$ref: '#/components/schemas/DataProtectionDTO'
associationLogo:
agencyLogo:
type: string
example: "base64 encoded image"

Expand Down Expand Up @@ -636,7 +636,7 @@ components:
dataProtection:
type: object
$ref: '#/components/schemas/DataProtectionDTO'
associationLogo:
agencyLogo:
type: string
example: "base64 encoded image"

Expand Down Expand Up @@ -702,7 +702,7 @@ components:
dataProtection:
type: object
$ref: '#/components/schemas/DataProtectionDTO'
associationLogo:
agencyLogo:
type: string
example: "base64 encoded image"

Expand Down
2 changes: 1 addition & 1 deletion api/agencyservice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ components:
type: array
items:
type: long
associationLogo:
agencyLogo:
type: string
example: "base64 encoded image"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ private Agency fromAgencyDTO(AgencyDTO agencyDTO) {
.url(agencyDTO.getUrl())
.isExternal(agencyDTO.getExternal())
.counsellingRelations(Joiner.on(",").join(agencyDTO.getCounsellingRelations()))
.associationLogo(agencyDTO.getAssociationLogo())
.agencyLogo(agencyDTO.getAgencyLogo())
.createDate(LocalDateTime.now(ZoneOffset.UTC))
.updateDate(LocalDateTime.now(ZoneOffset.UTC));

Expand Down Expand Up @@ -210,7 +210,7 @@ private Agency mergeAgencies(Agency agency, UpdateAgencyDTO updateAgencyDTO) {
.updateDate(LocalDateTime.now(ZoneOffset.UTC))
.counsellingRelations(agency.getCounsellingRelations())
.deleteDate(agency.getDeleteDate())
.associationLogo(updateAgencyDTO.getAssociationLogo());
.agencyLogo(updateAgencyDTO.getAgencyLogo());

dataProtectionConverter.convertToEntity(updateAgencyDTO.getDataProtection(), agencyBuilder);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ private AgencyAdminResponseDTO createAgency() {
.updateDate(String.valueOf(this.agency.getUpdateDate()))
.deleteDate(String.valueOf(this.agency.getDeleteDate()))
.dataProtection(new DataProtectionDTOBuilder(this.agency).fromAgency())
.associationLogo(this.agency.getAssociationLogo());
.agencyLogo(this.agency.getAgencyLogo());

responseDTO.demographics(getDemographics(this.agency));
return responseDTO;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ private Integer getPostCodeInteger() {
@Column(name = "counselling_relations")
private String counsellingRelations;

@Column(name = "association_logo")
private String associationLogo;
@Column(name = "agency_logo")
private String agencyLogo;

@Transient
public boolean hasAnyDemographicsAttributes() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@


import static java.util.Objects.nonNull;
import static java.util.stream.Collectors.toList;
import static org.apache.commons.lang3.BooleanUtils.isTrue;

import com.google.common.collect.Lists;
Expand All @@ -27,7 +26,6 @@
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
Expand Down Expand Up @@ -311,8 +309,8 @@ private AgencyResponseDTO convertToAgencyResponseDTO(Agency agency) {
.tenantId(agency.getTenantId())
.consultingType(agency.getConsultingTypeId())
.agencySpecificPrivacy(renderedAgencySpecificPrivacy)
.topicIds(agency.getAgencyTopics().stream().map(AgencyTopic::getTopicId).collect(toList()))
.associationLogo(agency.getAssociationLogo());
.topicIds(agency.getAgencyTopics().stream().map(AgencyTopic::getTopicId).toList())
.agencyLogo(agency.getAgencyLogo());
}

protected String getRenderedAgencySpecificPrivacy(Agency agency) {
Expand Down Expand Up @@ -343,7 +341,7 @@ private FullAgencyResponseDTO convertToFullAgencyResponseDTO(Agency agency) {
.demographics(getDemographics(agency))
.tenantId(agency.getTenantId())
.topicIds(agency.getAgencyTopics().stream().map(AgencyTopic::getTopicId).toList())
.associationLogo(agency.getAssociationLogo());
.agencyLogo(agency.getAgencyLogo());

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@
-->
<include file="db/changelog/changeset/0015_change_consultingtype_column_type/0015_changeSet.xml"/>
<include file="db/changelog/changeset/0016_add_data_protection_attributes/0016_changeSet.xml"/>
<include file="db/changelog/changeset/0017_add_association_logo/0017_changeSet.xml"/>
<include file="db/changelog/changeset/0017_add_agency_logo/0017_changeSet.xml"/>
</databaseChangeLog>
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@
<include file="db/changelog/changeset/0014_drop_diocese/0014_changeSet.xml"/>-->
<include file="db/changelog/changeset/0015_change_consultingtype_column_type/0015_changeSet.xml"/>
<include file="db/changelog/changeset/0016_add_data_protection_attributes/0016_changeSet.xml"/>
<include file="db/changelog/changeset/0017_add_association_logo/0017_changeSet.xml"/>
<include file="db/changelog/changeset/0017_add_agency_logo/0017_changeSet.xml"/>
</databaseChangeLog>
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@
<include file="db/changelog/changeset/0014_drop_diocese/0014_changeSet.xml"/>-->
<include file="db/changelog/changeset/0015_change_consultingtype_column_type/0015_changeSet.xml"/>
<include file="db/changelog/changeset/0016_add_data_protection_attributes/0016_changeSet.xml"/>
<include file="db/changelog/changeset/0017_add_association_logo/0017_changeSet.xml"/>
<include file="db/changelog/changeset/0017_add_agency_logo/0017_changeSet.xml"/>
</databaseChangeLog>
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@
<include file="db/changelog/changeset/0014_drop_diocese/0014_changeSet.xml"/>-->
<include file="db/changelog/changeset/0015_change_consultingtype_column_type/0015_changeSet.xml"/>
<include file="db/changelog/changeset/0016_add_data_protection_attributes/0016_changeSet.xml"/>
<include file="db/changelog/changeset/0017_add_association_logo/0017_changeSet.xml"/>
<include file="db/changelog/changeset/0017_add_agency_logo/0017_changeSet.xml"/>
</databaseChangeLog>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd">
<changeSet author="tkuzynow" id="dropUniqueConstraintForSubdomain">
<sqlFile path="db/changelog/changeset/0017_add_association_logo/addAssociationLogo.sql" stripComments="true" />
<changeSet author="tkuzynow" id="addAgencyLogo">
<sqlFile path="db/changelog/changeset/0017_add_agency_logo/addAgencyLogo.sql" stripComments="true" />
<rollback><sql/></rollback>
</changeSet>
</databaseChangeLog>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE `agencyservice`.`agency`
DROP COLUMN `agency_logo`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE `agencyservice`.`agency`
ADD COLUMN `agency_logo` longtext NULL;

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ private void assertBaseDTOAttributesAreMapped(AgencyAdminFullResponseDTO result)
assertEquals(agency.getUrl(), result.getEmbedded().getUrl());
assertEquals(agency.isExternal(), result.getEmbedded().getExternal());
assertEquals(agency.getConsultingTypeId(), result.getEmbedded().getConsultingType());
assertEquals(agency.getAssociationLogo(), result.getEmbedded().getAssociationLogo());
assertEquals(agency.getAgencyLogo(), result.getEmbedded().getAgencyLogo());
assertThat(result.getEmbedded().getCounsellingRelations()).containsOnly(AgencyAdminResponseDTO.CounsellingRelationsEnum.PARENTAL_COUNSELLING, AgencyAdminResponseDTO.CounsellingRelationsEnum.RELATIVE_COUNSELLING);
assertEquals(String.valueOf(agency.getCreateDate()), result.getEmbedded().getCreateDate());
assertEquals(String.valueOf(agency.getUpdateDate()), result.getEmbedded().getUpdateDate());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ void getAgencyById_Should_ReturnAgencyData() throws Exception {
.andExpect(jsonPath("_embedded.createDate").exists())
.andExpect(jsonPath("_embedded.updateDate").exists())
.andExpect(jsonPath("_embedded.deleteDate").exists())
.andExpect(jsonPath("_embedded.associationLogo").exists());
.andExpect(jsonPath("_embedded.agencyLogo").exists());
}

@Test
Expand All @@ -126,7 +126,7 @@ void createAgency_Should_returnStatusCreated_When_calledWithValidCreateParamsAnd
.consultingType(0)
.url("https://www.test.de")
.external(true)
.associationLogo("base64 encoded logo");
.agencyLogo("base64 encoded logo");
String payload = JsonConverter.convertToJson(agencyDTO);

// when, then
Expand All @@ -148,7 +148,7 @@ void createAgency_Should_returnStatusCreated_When_calledWithValidCreateParamsAnd
.andExpect(jsonPath("_embedded.createDate").exists())
.andExpect(jsonPath("_embedded.updateDate").exists())
.andExpect(jsonPath("_embedded.deleteDate").exists())
.andExpect(jsonPath("_embedded.associationLogo").value("base64 encoded logo"));
.andExpect(jsonPath("_embedded.agencyLogo").value("base64 encoded logo"));
}

@Test
Expand Down Expand Up @@ -272,7 +272,7 @@ void updateAgency_Should_returnStatusOk_When_CentralDataProtectionIsEnabled_And_
.name("Test update name")
.description(null)
.offline(true)
.associationLogo("base64 encoded logo")
.agencyLogo("base64 encoded logo")
.external(false)
.dataProtection(new DataProtectionDTO().dataProtectionResponsibleEntity(DataProtectionDTO.DataProtectionResponsibleEntityEnum.DATA_PROTECTION_OFFICER)
.dataProtectionOfficerContact(new DataProtectionContactDTO().nameAndLegalForm("data protection contact").city("Munich")
Expand All @@ -293,7 +293,7 @@ void updateAgency_Should_returnStatusOk_When_CentralDataProtectionIsEnabled_And_
.andExpect(jsonPath("_embedded.createDate").exists())
.andExpect(jsonPath("_embedded.updateDate").exists())
.andExpect(jsonPath("_embedded.deleteDate").exists())
.andExpect(jsonPath("_embedded.associationLogo").value("base64 encoded logo"));
.andExpect(jsonPath("_embedded.agencyLogo").value("base64 encoded logo"));

var savedAgency = agencyRepository.findById(1L).orElseThrow();
assertNull(savedAgency.getDescription());
Expand Down
4 changes: 2 additions & 2 deletions src/test/resources/database/AgencyDatabase.sql
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ create table AGENCY
DATA_PROTECTION_AGENCY_CONTACT longtext null default null,
DATA_PROTECTION_OFFICER_CONTACT longtext null default null,
DATA_PROTECTION_ALTERNATIVE_CONTACT longtext null default null,
ASSOCIATION_LOGO longtext null default null,
AGENCY_LOGO longtext null default null,
primary key (ID)
);
CREATE SEQUENCE SEQUENCE_AGENCY
Expand Down Expand Up @@ -71,7 +71,7 @@ CREATE SEQUENCE SEQUENCE_AGENCY_TOPIC

INSERT INTO AGENCY (ID, TENANT_ID, NAME, DESCRIPTION, POSTCODE, CITY, IS_TEAM_AGENCY, CONSULTING_TYPE, IS_OFFLINE, URL, IS_EXTERNAL, ID_OLD, CREATE_DATE, UPDATE_DATE, DELETE_DATE, COUNSELLING_RELATIONS)
VALUES (0, null, 'Fachambulanz Sucht Caritas/Diakonie Bonn', 'Beratung , Behandlung und Betreuung von Alkohol-, Drogen- und Medikamentenabhängige , Spielsüchtige und Angehörige.', '53113', 'Bonn', 1, 0, 0, null, 0, 9, '2018-12-11 10:19:13', '2019-06-24 12:53:58', null, 'PARENTAL_COUNSELLING,SELF_COUNSELLING');
INSERT INTO AGENCY (ID, TENANT_ID, NAME, DESCRIPTION, POSTCODE, CITY, IS_TEAM_AGENCY, CONSULTING_TYPE, IS_OFFLINE, URL, IS_EXTERNAL, ID_OLD, CREATE_DATE, UPDATE_DATE, DELETE_DATE, COUNSELLING_RELATIONS, ASSOCIATION_LOGO) VALUES (1, null, 'JUGEND SUCHT BERATUNG Köln, SKM e.V. Köln', 'Offene Sprechstunden für Jugendliche und junge Erwachsene: Dienstag 16.00-18.00 Uhr Mittwoch 16.00-17.00 Uhr Freitag 13.00-14.00 Uhr', '50672', 'Köln', 0, 0, 0, null, 0, 10, '2018-12-11 10:19:13', '2019-06-24 12:53:58', null, 'RELATIVE_COUNSELLING,SELF_COUNSELLING', 'base64 encoded logo');
INSERT INTO AGENCY (ID, TENANT_ID, NAME, DESCRIPTION, POSTCODE, CITY, IS_TEAM_AGENCY, CONSULTING_TYPE, IS_OFFLINE, URL, IS_EXTERNAL, ID_OLD, CREATE_DATE, UPDATE_DATE, DELETE_DATE, COUNSELLING_RELATIONS, AGENCY_LOGO) VALUES (1, null, 'JUGEND SUCHT BERATUNG Köln, SKM e.V. Köln', 'Offene Sprechstunden für Jugendliche und junge Erwachsene: Dienstag 16.00-18.00 Uhr Mittwoch 16.00-17.00 Uhr Freitag 13.00-14.00 Uhr', '50672', 'Köln', 0, 0, 0, null, 0, 10, '2018-12-11 10:19:13', '2019-06-24 12:53:58', null, 'RELATIVE_COUNSELLING,SELF_COUNSELLING', 'base64 encoded logo');
INSERT INTO AGENCY (ID, TENANT_ID, NAME, DESCRIPTION, POSTCODE, CITY, IS_TEAM_AGENCY, CONSULTING_TYPE, IS_OFFLINE, URL, IS_EXTERNAL, ID_OLD, CREATE_DATE, UPDATE_DATE, DELETE_DATE, COUNSELLING_RELATIONS) VALUES (2, null, 'Caritas Suchthilfe des Rheinisch-Bergischer Kreises', null, '51465', 'Bergisch Gladbach', 0, 0, 0, null, 0, 11, '2018-12-11 10:19:13', '2019-06-24 12:53:58', null, 'RELATIVE_COUNSELLING');


Expand Down

0 comments on commit 94690c1

Please sign in to comment.