Skip to content

Commit

Permalink
AKR(Frontend & Backend) OPHKIOS-16: ONR osoitelähteen valinta virkail…
Browse files Browse the repository at this point in the history
…ijalle (#643)

* AKR(Backend) tests for onr contact details

* AKR(Backend & Frontend) ONR multiple address feature continues

* AKR(Backend & Frontend) ONR multiple address feature continues

* AKR(Backend & Frontend) ONR multiple address feature continues

* AKR(Backend & Frontend) ONR multiple address feature continues

* AKR(Backend & Frontend) ONR multiple address feature continues

* AKR(Backend & Frontend) ONR multiple address feature continues

* AKR(Backend & Frontend) ONR multiple address feature continues

* AKR(Frontend) ONR multiple address feature continues

* AKR(Frontend) ONR multiple address tests

* AKR(Backend) test fixes

* AKR(Backend) wrong annotation?

* AKR(Frontend) edit AKR address

* AKR(Frontend) small UI tweaks

* AKR(Frontend) some cypress tests

* AKR(Backend) address logic

* Revert "Merge pull request #625 from Opetushallitus/feature/OPHAKRKEH-523"

This reverts commit eb5fa08, reversing
changes made to 06d5026.

* AKR(Backend & Frontend) deploy commit [deploy]

* Update frontend/packages/akr/public/i18n/fi-FI/translation.json

Co-authored-by: Pyry Koivisto <[email protected]>

* AKR(Backend & Frontend) random fixes

* AKR(Backend & Frontend) review fixes and debug end point

* AKR(Backend) review fix

* AKR(Frontend) linter fix

* AKR(Frontend) new translator add fix

* AKR(Backend & Frontend) review fixes [deploy]

* AKR(Backend) fix migration id

---------

Co-authored-by: Pyry Koivisto <[email protected]>
  • Loading branch information
jrkkp and pkoivisto authored Mar 11, 2024
1 parent 7e12f0b commit b5e6fb2
Show file tree
Hide file tree
Showing 43 changed files with 1,851 additions and 310 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
import fi.oph.akr.api.dto.clerk.modify.AuthorisationUpdateDTO;
import fi.oph.akr.api.dto.clerk.modify.TranslatorCreateDTO;
import fi.oph.akr.api.dto.clerk.modify.TranslatorUpdateDTO;
import fi.oph.akr.onr.dto.ContactDetailsGroupSource;
import fi.oph.akr.service.ClerkTranslatorService;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import java.util.List;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
Expand All @@ -20,6 +22,7 @@
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;

Expand All @@ -45,6 +48,16 @@ public ClerkTranslatorResponseDTO listTranslators() {
return clerkTranslatorService.listTranslators();
}

@GetMapping(path = "/filter")
@Operation(
tags = TAG_TRANSLATOR,
operationId = "list_translator_by_source",
summary = "List all translators by source, with all their data"
)
public List<ClerkTranslatorDTO> listTranslatorsBySource(@RequestParam final ContactDetailsGroupSource source) {
return clerkTranslatorService.listTranslatorsBySource(source);
}

@Operation(
tags = TAG_TRANSLATOR,
summary = "Create new translator with authorisations",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package fi.oph.akr.api.dto.clerk;

import fi.oph.akr.api.dto.translator.CommonTranslatorAddressDTO;
import fi.oph.akr.onr.dto.ContactDetailsGroupSource;
import fi.oph.akr.onr.dto.ContactDetailsGroupType;
import fi.oph.akr.util.StringUtil;
import jakarta.validation.constraints.Size;
import lombok.Builder;
import lombok.NonNull;

@Builder
public record ClerkTranslatorAddressDTO(
@Size(max = 255) String street,
@Size(max = 255) String postalCode,
@Size(max = 255) String town,
@Size(max = 255) String country,
@NonNull ContactDetailsGroupSource source,
@NonNull ContactDetailsGroupType type,
@NonNull Boolean selected
)
implements CommonTranslatorAddressDTO {
public ClerkTranslatorAddressDTO {
street = StringUtil.sanitize(street);
postalCode = StringUtil.sanitize(postalCode);
town = StringUtil.sanitize(town);
country = StringUtil.sanitize(country);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package fi.oph.akr.api.dto.clerk;

import java.util.List;
import lombok.Builder;
import lombok.NonNull;

Expand All @@ -15,10 +16,7 @@ public record ClerkTranslatorDTO(
String identityNumber,
String email,
String phoneNumber,
String street,
String postalCode,
String town,
String country,
@NonNull List<ClerkTranslatorAddressDTO> address,
String extraInformation,
@NonNull Boolean isAssuranceGiven,
@NonNull ClerkTranslatorAuthorisationsDTO authorisations
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package fi.oph.akr.api.dto.clerk;

import java.util.List;
import lombok.Builder;
import lombok.NonNull;

Expand All @@ -12,8 +13,5 @@ public record PersonDTO(
@NonNull String lastName,
@NonNull String firstName,
@NonNull String nickName,
String street,
String postalCode,
String town,
String country
@NonNull List<ClerkTranslatorAddressDTO> address
) {}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package fi.oph.akr.api.dto.clerk.modify;

import fi.oph.akr.api.dto.clerk.ClerkTranslatorAddressDTO;
import fi.oph.akr.util.StringUtil;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotEmpty;
Expand All @@ -20,10 +21,7 @@ public record TranslatorCreateDTO(
@Size(max = 255) @NonNull @NotBlank String identityNumber,
@Size(max = 255) String email,
@Size(max = 255) String phoneNumber,
@Size(max = 255) String street,
@Size(max = 255) String postalCode,
@Size(max = 255) String town,
@Size(max = 255) String country,
@NonNull List<ClerkTranslatorAddressDTO> address,
@Size(max = 4096) String extraInformation,
@NonNull @NotNull Boolean isAssuranceGiven,
@NonNull @NotEmpty List<AuthorisationCreateDTO> authorisations
Expand All @@ -36,10 +34,7 @@ public record TranslatorCreateDTO(
nickName = StringUtil.sanitize(nickName);
email = StringUtil.sanitize(email);
phoneNumber = StringUtil.sanitize(phoneNumber);
street = StringUtil.sanitize(street);
postalCode = StringUtil.sanitize(postalCode);
town = StringUtil.sanitize(town);
country = StringUtil.sanitize(country);
extraInformation = StringUtil.sanitize(extraInformation);
// TODO validate address?
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
package fi.oph.akr.api.dto.clerk.modify;

import fi.oph.akr.api.dto.clerk.ClerkTranslatorAddressDTO;
import fi.oph.akr.api.dto.translator.CommonTranslatorAddressDTO;
import fi.oph.akr.api.dto.translator.TranslatorAddressDTO;
import java.util.List;

public interface TranslatorDTOCommonFields {
Boolean isIndividualised();

Expand All @@ -17,13 +22,7 @@ public interface TranslatorDTOCommonFields {

String phoneNumber();

String street();

String postalCode();

String town();

String country();
List<ClerkTranslatorAddressDTO> address();

String extraInformation();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package fi.oph.akr.api.dto.clerk.modify;

import fi.oph.akr.api.dto.clerk.ClerkTranslatorAddressDTO;
import fi.oph.akr.util.StringUtil;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import java.util.List;
import lombok.Builder;
import lombok.NonNull;

Expand All @@ -19,10 +21,7 @@ public record TranslatorUpdateDTO(
@Size(max = 255) @NonNull @NotBlank String identityNumber,
@Size(max = 255) String email,
@Size(max = 255) String phoneNumber,
@Size(max = 255) String street,
@Size(max = 255) String postalCode,
@Size(max = 255) String town,
@Size(max = 255) String country,
@NonNull List<ClerkTranslatorAddressDTO> address,
@Size(max = 4096) String extraInformation,
@NonNull @NotNull Boolean isAssuranceGiven
)
Expand All @@ -34,10 +33,6 @@ public record TranslatorUpdateDTO(
nickName = StringUtil.sanitize(nickName);
email = StringUtil.sanitize(email);
phoneNumber = StringUtil.sanitize(phoneNumber);
street = StringUtil.sanitize(street);
postalCode = StringUtil.sanitize(postalCode);
town = StringUtil.sanitize(town);
country = StringUtil.sanitize(country);
extraInformation = StringUtil.sanitize(extraInformation);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package fi.oph.akr.api.dto.translator;

import fi.oph.akr.onr.dto.ContactDetailsGroupSource;
import fi.oph.akr.onr.dto.ContactDetailsGroupType;

public interface CommonTranslatorAddressDTO {
String street();
String postalCode();
String town();
String country();
ContactDetailsGroupSource source();
ContactDetailsGroupType type();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package fi.oph.akr.api.dto.translator;

import fi.oph.akr.onr.dto.ContactDetailsGroupSource;
import fi.oph.akr.onr.dto.ContactDetailsGroupType;
import lombok.Builder;
import lombok.NonNull;

@Builder
public record TranslatorAddressDTO(
String street,
String postalCode,
String town,
String country,
@NonNull ContactDetailsGroupSource source,
@NonNull ContactDetailsGroupType type
)
implements CommonTranslatorAddressDTO {}
40 changes: 40 additions & 0 deletions backend/akr/src/main/java/fi/oph/akr/model/Translator.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,49 @@ public class Translator extends BaseEntity {
@OneToMany(mappedBy = "translator")
private Collection<ContactRequestTranslator> contactRequestTranslators = new ArrayList<>();

// TODO: after old AKR data deletion is done remove the below code
@Size(max = 255)
@Column(name = "identity_number")
private String identityNumber;

@Size(max = 255)
@Column(name = "first_name")
private String firstName;

@Size(max = 255)
@Column(name = "last_name")
private String lastName;

@Size(max = 255)
@Column(name = "email")
private String email;

@Column(name = "phone_number")
private String phone;

@Column(name = "street")
private String street;

@Column(name = "town")
private String town;

@Column(name = "postal_code")
private String postalCode;

@Column(name = "country")
private String country;

//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

@Column(name = "extra_information")
private String extraInformation;

@Column(name = "selected_source")
private String selectedSource;

@Column(name = "selected_type")
private String selectedType;

@Column(name = "is_assurance_given", nullable = false)
private boolean isAssuranceGiven;
}
Loading

0 comments on commit b5e6fb2

Please sign in to comment.