diff --git a/backend/vkt/src/main/java/fi/oph/vkt/api/dto/examiner/ExaminerContactRequestDTO.java b/backend/vkt/src/main/java/fi/oph/vkt/api/dto/examiner/ExaminerContactRequestDTO.java index b0c456bc2..a76e982eb 100644 --- a/backend/vkt/src/main/java/fi/oph/vkt/api/dto/examiner/ExaminerContactRequestDTO.java +++ b/backend/vkt/src/main/java/fi/oph/vkt/api/dto/examiner/ExaminerContactRequestDTO.java @@ -1,9 +1,14 @@ package fi.oph.vkt.api.dto.examiner; -import jakarta.validation.constraints.NotEmpty; -import java.util.List; +import java.time.LocalDate; import lombok.Builder; import lombok.NonNull; @Builder -public record ExaminerContactRequestDTO(@NonNull Long id, @NonNull String lastName, @NonNull String firstName) {} +public record ExaminerContactRequestDTO( + @NonNull Long id, + @NonNull String lastName, + @NonNull String firstName, + @NonNull String email, + @NonNull LocalDate contactDate +) {} diff --git a/backend/vkt/src/main/java/fi/oph/vkt/util/ExaminerUtil.java b/backend/vkt/src/main/java/fi/oph/vkt/util/ExaminerUtil.java index 91342bf6f..67274fb9f 100644 --- a/backend/vkt/src/main/java/fi/oph/vkt/util/ExaminerUtil.java +++ b/backend/vkt/src/main/java/fi/oph/vkt/util/ExaminerUtil.java @@ -26,6 +26,8 @@ public static ExaminerContactRequestDTO toContactRequestDTO(final EnrollmentAppo .id(enrollmentAppointment.getId()) .firstName(enrollmentAppointment.getFirstName()) .lastName(enrollmentAppointment.getLastName()) + .email(enrollmentAppointment.getEmail()) + .contactDate(enrollmentAppointment.getCreatedAt().toLocalDate()) .build(); } diff --git a/frontend/packages/vkt/public/i18n/fi-FI/examiner.json b/frontend/packages/vkt/public/i18n/fi-FI/examiner.json index 12f30c3d1..6b8f09ffb 100644 --- a/frontend/packages/vkt/public/i18n/fi-FI/examiner.json +++ b/frontend/packages/vkt/public/i18n/fi-FI/examiner.json @@ -16,8 +16,10 @@ "actions": "Toiminnot", "contactRequest": "Yhteydenottopyyntö", "contactFields": "Yhteystiedot", + "contactDate": "Yhteydenottopäivä", "lastName": "Sukunimi", "firstName": "Etunimi", + "requesterName": "Lähettäjän nimi", "email": "Sähköpostiosoite", "examination": "Tutkinto", "phoneNumber": "Puhelinnumero", diff --git a/frontend/packages/vkt/src/components/examinerExamEvent/listing/ExaminerContactRequestListing.tsx b/frontend/packages/vkt/src/components/examinerExamEvent/listing/ExaminerContactRequestListing.tsx index ccdceba55..34050f484 100644 --- a/frontend/packages/vkt/src/components/examinerExamEvent/listing/ExaminerContactRequestListing.tsx +++ b/frontend/packages/vkt/src/components/examinerExamEvent/listing/ExaminerContactRequestListing.tsx @@ -3,6 +3,7 @@ import { TableCell, TableHead, TableRow } from '@mui/material'; import { useParams } from 'react-router'; import { CustomButtonLink, CustomTable, Text } from 'shared/components'; import { Color, Variant } from 'shared/enums'; +import { DateUtils } from 'shared/utils'; import { useExaminerTranslation } from 'configs/i18n'; import { useAppSelector } from 'configs/redux'; @@ -18,8 +19,9 @@ const ExaminerExamEventListingHeader = () => { return ( - {t('firstName')} - {t('lastName')} + {t('requesterName')} + {t('email')} + {t('contactDate')} {t('actions')} @@ -40,10 +42,13 @@ const ExaminerContactRequestListingRow = ({ return ( - {contactRequest.firstName} + {`${contactRequest.firstName} ${contactRequest.lastName}`} - {contactRequest.lastName} + {contactRequest.email} + + + {DateUtils.formatOptionalDate(contactRequest.contactDate)} { + contactDate: string; } export interface ExaminerDetails extends WithId { @@ -40,8 +48,9 @@ export interface ExaminerDetails extends WithId { } export interface ExaminerDetailsResponse - extends Omit { + extends Omit { examEvents: Array; + contactRequests: Array; } export type ExaminerDetailsInit = Pick< diff --git a/frontend/packages/vkt/src/utils/serialization.ts b/frontend/packages/vkt/src/utils/serialization.ts index 536b5e5a4..71c2a2169 100644 --- a/frontend/packages/vkt/src/utils/serialization.ts +++ b/frontend/packages/vkt/src/utils/serialization.ts @@ -24,6 +24,8 @@ import { ClerkListExamEventResponse, } from 'interfaces/clerkListExamEvent'; import { + ContactRequest, + ContactRequestResponse, ExaminerDetails, ExaminerDetailsResponse, } from 'interfaces/examinerDetails'; @@ -347,6 +349,15 @@ export class SerializationUtils { }; } + static deserializeContactRequest( + contactRequest: ContactRequestResponse, + ): ContactRequest { + return { + ...contactRequest, + contactDate: dayjs(contactRequest.contactDate), + }; + } + static deserializeExaminerDetails( examinerDetails: ExaminerDetailsResponse, ): ExaminerDetails { @@ -355,6 +366,9 @@ export class SerializationUtils { examEvents: examinerDetails.examEvents.map( SerializationUtils.deserializeExaminerExamEvent, ), + contactRequests: examinerDetails.contactRequests.map( + SerializationUtils.deserializeContactRequest, + ), }; } }