diff --git a/backend/otr/src/main/java/fi/oph/otr/api/dto/clerk/ClerkInterpreterDTO.java b/backend/otr/src/main/java/fi/oph/otr/api/dto/clerk/ClerkInterpreterDTO.java index ceed375b9..1ebeeba80 100644 --- a/backend/otr/src/main/java/fi/oph/otr/api/dto/clerk/ClerkInterpreterDTO.java +++ b/backend/otr/src/main/java/fi/oph/otr/api/dto/clerk/ClerkInterpreterDTO.java @@ -26,6 +26,7 @@ public record ClerkInterpreterDTO( String country, String extraInformation, @NonNull List regions, - @NonNull ClerkInterpreterQualificationsDTO qualifications + @NonNull ClerkInterpreterQualificationsDTO qualifications, + @NonNull Boolean isAssuranceGiven ) implements ClerkInterpreterDTOCommonFields {} diff --git a/backend/otr/src/main/java/fi/oph/otr/api/dto/clerk/ClerkInterpreterDTOCommonFields.java b/backend/otr/src/main/java/fi/oph/otr/api/dto/clerk/ClerkInterpreterDTOCommonFields.java index 97acf14d6..30d94e4d4 100644 --- a/backend/otr/src/main/java/fi/oph/otr/api/dto/clerk/ClerkInterpreterDTOCommonFields.java +++ b/backend/otr/src/main/java/fi/oph/otr/api/dto/clerk/ClerkInterpreterDTOCommonFields.java @@ -38,4 +38,6 @@ public interface ClerkInterpreterDTOCommonFields { String extraInformation(); List regions(); + + Boolean isAssuranceGiven(); } diff --git a/backend/otr/src/main/java/fi/oph/otr/api/dto/clerk/modify/ClerkInterpreterCreateDTO.java b/backend/otr/src/main/java/fi/oph/otr/api/dto/clerk/modify/ClerkInterpreterCreateDTO.java index 9983bf67a..08c1244c2 100644 --- a/backend/otr/src/main/java/fi/oph/otr/api/dto/clerk/modify/ClerkInterpreterCreateDTO.java +++ b/backend/otr/src/main/java/fi/oph/otr/api/dto/clerk/modify/ClerkInterpreterCreateDTO.java @@ -32,7 +32,8 @@ public record ClerkInterpreterCreateDTO( @Size(max = 255) String country, @Size(max = 4096) String extraInformation, @NonNull @NotNull List regions, - @NonNull @NotEmpty @Valid List qualifications + @NonNull @NotEmpty @Valid List qualifications, + @NonNull @NotNull Boolean isAssuranceGiven ) implements ClerkInterpreterDTOCommonFields { public ClerkInterpreterCreateDTO { diff --git a/backend/otr/src/main/java/fi/oph/otr/api/dto/clerk/modify/ClerkInterpreterUpdateDTO.java b/backend/otr/src/main/java/fi/oph/otr/api/dto/clerk/modify/ClerkInterpreterUpdateDTO.java index cb9dd3718..10a5b1e76 100644 --- a/backend/otr/src/main/java/fi/oph/otr/api/dto/clerk/modify/ClerkInterpreterUpdateDTO.java +++ b/backend/otr/src/main/java/fi/oph/otr/api/dto/clerk/modify/ClerkInterpreterUpdateDTO.java @@ -30,7 +30,8 @@ public record ClerkInterpreterUpdateDTO( @Size(max = 255) String town, @Size(max = 255) String country, @Size(max = 4096) String extraInformation, - @NonNull @NotNull List regions + @NonNull @NotNull List regions, + @NonNull @NotNull Boolean isAssuranceGiven ) implements ClerkInterpreterDTOCommonFields { public ClerkInterpreterUpdateDTO { diff --git a/backend/otr/src/main/java/fi/oph/otr/model/Interpreter.java b/backend/otr/src/main/java/fi/oph/otr/model/Interpreter.java index 5c2dd02b7..2b71f2122 100644 --- a/backend/otr/src/main/java/fi/oph/otr/model/Interpreter.java +++ b/backend/otr/src/main/java/fi/oph/otr/model/Interpreter.java @@ -48,4 +48,7 @@ public class Interpreter extends BaseEntity { @OneToMany(mappedBy = "interpreter") private List regions = new ArrayList<>(); + + @Column(name = "is_assurance_given", nullable = false) + private boolean isAssuranceGiven; } diff --git a/backend/otr/src/main/java/fi/oph/otr/repository/QualificationRepository.java b/backend/otr/src/main/java/fi/oph/otr/repository/QualificationRepository.java index e98f724dc..6ecb81171 100644 --- a/backend/otr/src/main/java/fi/oph/otr/repository/QualificationRepository.java +++ b/backend/otr/src/main/java/fi/oph/otr/repository/QualificationRepository.java @@ -20,6 +20,7 @@ public interface QualificationRepository extends BaseRepository { " WHERE q.beginDate <= CURRENT_DATE" + " AND CURRENT_DATE <= q.endDate" + " AND q.permissionToPublish = true" + + " AND i.isAssuranceGiven = true" + " AND q.deletedAt IS NULL" + " AND i.deletedAt IS NULL" + " GROUP BY i.id, q.fromLang, q.toLang" diff --git a/backend/otr/src/main/java/fi/oph/otr/service/ClerkInterpreterService.java b/backend/otr/src/main/java/fi/oph/otr/service/ClerkInterpreterService.java index 4eed78aea..2c552fbeb 100644 --- a/backend/otr/src/main/java/fi/oph/otr/service/ClerkInterpreterService.java +++ b/backend/otr/src/main/java/fi/oph/otr/service/ClerkInterpreterService.java @@ -171,6 +171,7 @@ private Optional createClerkInterpreterDTO( .extraInformation(interpreter.getExtraInformation()) .regions(regions) .qualifications(interpreterQualificationsDTO) + .isAssuranceGiven(interpreter.isAssuranceGiven()) .build() ); } @@ -308,6 +309,7 @@ private void copyFromInterpreterDTO(final Interpreter interpreter, final ClerkIn interpreter.setOtherContactInformation(dto.otherContactInfo()); interpreter.setPermissionToPublishOtherContactInfo(dto.permissionToPublishOtherContactInfo()); interpreter.setExtraInformation(dto.extraInformation()); + interpreter.setAssuranceGiven(dto.isAssuranceGiven()); final List regions = dto .regions() diff --git a/backend/otr/src/main/resources/db/changelog/db.changelog-2.0.xml b/backend/otr/src/main/resources/db/changelog/db.changelog-2.0.xml index 1328d5a48..6f9d5d255 100644 --- a/backend/otr/src/main/resources/db/changelog/db.changelog-2.0.xml +++ b/backend/otr/src/main/resources/db/changelog/db.changelog-2.0.xml @@ -526,5 +526,12 @@ name = 'OTHER' + + + + + + + diff --git a/frontend/packages/otr/public/i18n/en-GB/translation.json b/frontend/packages/otr/public/i18n/en-GB/translation.json index 18dc6600f..fada6aa25 100644 --- a/frontend/packages/otr/public/i18n/en-GB/translation.json +++ b/frontend/packages/otr/public/i18n/en-GB/translation.json @@ -57,6 +57,9 @@ "description": "You will lose the changes you have made.", "title": "Do you want to exit the modification view?" }, + "caveats": { + "isNotAssuranceGiven": "The authorisations are not visible in the public list!" + }, "fields": { "country": "Country", "email": "Email", @@ -75,6 +78,7 @@ "address": "Address", "contactInformation": "Contact details", "extraInformation": "Additional information", + "isAssuranceGiven": "Declaration given", "personalInformation": "Personal data", "regions": "Operating area" }, diff --git a/frontend/packages/otr/public/i18n/fi-FI/translation.json b/frontend/packages/otr/public/i18n/fi-FI/translation.json index 226e89048..69ba0e280 100644 --- a/frontend/packages/otr/public/i18n/fi-FI/translation.json +++ b/frontend/packages/otr/public/i18n/fi-FI/translation.json @@ -57,6 +57,9 @@ "description": "Menetät tekemäsi muutokset.", "title": "Haluatko poistua muokkausnäkymästä?" }, + "caveats": { + "isNotAssuranceGiven": "Auktorisoinnit eivät ole näkyvissä julkisessa listauksessa!" + }, "fields": { "country": "Maa", "email": "Sähköpostiosoite", @@ -75,6 +78,7 @@ "address": "Osoite", "contactInformation": "Yhteystiedot", "extraInformation": "Lisätiedot", + "isAssuranceGiven": "Vakuutus annettu", "personalInformation": "Henkilötiedot", "regions": "Toiminta-alue" }, diff --git a/frontend/packages/otr/public/i18n/sv-SE/translation.json b/frontend/packages/otr/public/i18n/sv-SE/translation.json index 0c7e70d7a..2157f3c03 100644 --- a/frontend/packages/otr/public/i18n/sv-SE/translation.json +++ b/frontend/packages/otr/public/i18n/sv-SE/translation.json @@ -57,6 +57,9 @@ "description": "Du kommer att förlora dina ändringar.", "title": "Vill du lämna redigeringsvyn?" }, + "caveats": { + "isNotAssuranceGiven": "Auktoriseringarna syns inte i den offentliga listan!" + }, "fields": { "country": "Land", "email": "E-postadress", @@ -75,6 +78,7 @@ "address": "Adress", "contactInformation": "Kontaktuppgifter", "extraInformation": "Ytterligare information", + "isAssuranceGiven": "Försäkran har getts", "personalInformation": "Personuppgifter", "regions": "Verksamhetsområde" }, diff --git a/frontend/packages/otr/src/components/clerkInterpreter/overview/ClerkInterpreterDetailsFields.tsx b/frontend/packages/otr/src/components/clerkInterpreter/overview/ClerkInterpreterDetailsFields.tsx index d6e852dd2..d0665de57 100644 --- a/frontend/packages/otr/src/components/clerkInterpreter/overview/ClerkInterpreterDetailsFields.tsx +++ b/frontend/packages/otr/src/components/clerkInterpreter/overview/ClerkInterpreterDetailsFields.tsx @@ -7,6 +7,7 @@ import RadioGroup from '@mui/material/RadioGroup'; import TextField from '@mui/material/TextField'; import { ChangeEvent, useMemo, useState } from 'react'; import { + CustomSwitch, CustomTextField, CustomTextFieldProps, H2, @@ -429,6 +430,22 @@ export const ClerkInterpreterDetailsFields = ({ onChange={onFieldChange('regions')} disabled={isViewMode} /> +
+

{t('header.isAssuranceGiven')}

+ {t('caveats.isNotAssuranceGiven')} + ) + } + /> +
); }; diff --git a/frontend/packages/otr/src/interfaces/clerkInterpreter.ts b/frontend/packages/otr/src/interfaces/clerkInterpreter.ts index 78e9b1a35..531ea8c1c 100644 --- a/frontend/packages/otr/src/interfaces/clerkInterpreter.ts +++ b/frontend/packages/otr/src/interfaces/clerkInterpreter.ts @@ -22,6 +22,7 @@ export interface ClerkInterpreterTextFields { export interface ClerkInterpreterBasicInformation extends ClerkInterpreterTextFields { + isAssuranceGiven: boolean; permissionToPublishEmail: boolean; permissionToPublishPhone: boolean; permissionToPublishOtherContactInfo: boolean; diff --git a/frontend/packages/otr/src/redux/reducers/clerkNewInterpreter.ts b/frontend/packages/otr/src/redux/reducers/clerkNewInterpreter.ts index 72bd0b251..a2c79eedd 100644 --- a/frontend/packages/otr/src/redux/reducers/clerkNewInterpreter.ts +++ b/frontend/packages/otr/src/redux/reducers/clerkNewInterpreter.ts @@ -27,6 +27,7 @@ const initialState: ClerkNewInterpreterState = { town: '', country: '', extraInformation: '', + isAssuranceGiven: false, permissionToPublishEmail: false, permissionToPublishPhone: false, permissionToPublishOtherContactInfo: false, diff --git a/frontend/packages/otr/src/tests/msw/fixtures/clerkInterpreter.ts b/frontend/packages/otr/src/tests/msw/fixtures/clerkInterpreter.ts index 947ca82d6..0180c339b 100644 --- a/frontend/packages/otr/src/tests/msw/fixtures/clerkInterpreter.ts +++ b/frontend/packages/otr/src/tests/msw/fixtures/clerkInterpreter.ts @@ -11,6 +11,7 @@ export const clerkInterpreter = { firstName: 'Anneli Anna', nickName: 'Anneli', email: 'anneli.aaltonen@example.invalid', + isAssuranceGiven: true, permissionToPublishEmail: true, phoneNumber: '+358401000011', permissionToPublishPhone: true, diff --git a/frontend/packages/otr/src/utils/serialization.ts b/frontend/packages/otr/src/utils/serialization.ts index 313f7055a..a183a8ba7 100644 --- a/frontend/packages/otr/src/utils/serialization.ts +++ b/frontend/packages/otr/src/utils/serialization.ts @@ -43,6 +43,7 @@ export class SerializationUtils { static serializeClerkNewInterpreter(interpreter: ClerkNewInterpreter) { const { onrId, + isAssuranceGiven, isIndividualised, hasIndividualisedAddress, permissionToPublishEmail, @@ -58,6 +59,7 @@ export class SerializationUtils { return { ...textFields, onrId, + isAssuranceGiven, isIndividualised, hasIndividualisedAddress, permissionToPublishEmail, @@ -74,6 +76,7 @@ export class SerializationUtils { const { id, version, + isAssuranceGiven, isIndividualised, hasIndividualisedAddress, permissionToPublishEmail, @@ -90,6 +93,7 @@ export class SerializationUtils { ...textFields, id, version, + isAssuranceGiven, isIndividualised, hasIndividualisedAddress, permissionToPublishEmail,