From 4f88c31210815c8df42e6af35816cbd737ea56ec Mon Sep 17 00:00:00 2001 From: Mirna Gama Date: Sat, 13 Jan 2024 17:26:53 -0300 Subject: [PATCH] [R9] Consultation DTO --- .../dtos/consultation/ConsultationDTO.java | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/main/java/com/mirna/hospitalmanagementapi/domain/dtos/consultation/ConsultationDTO.java diff --git a/src/main/java/com/mirna/hospitalmanagementapi/domain/dtos/consultation/ConsultationDTO.java b/src/main/java/com/mirna/hospitalmanagementapi/domain/dtos/consultation/ConsultationDTO.java new file mode 100644 index 0000000..6bf9b15 --- /dev/null +++ b/src/main/java/com/mirna/hospitalmanagementapi/domain/dtos/consultation/ConsultationDTO.java @@ -0,0 +1,36 @@ +package com.mirna.hospitalmanagementapi.domain.dtos.consultation; + +import java.time.LocalDateTime; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.mirna.hospitalmanagementapi.domain.enums.Specialty; +import com.mirna.hospitalmanagementapi.domain.validators.consultation.constraints.ConsultationDateBusinessHours; +import com.mirna.hospitalmanagementapi.domain.validators.consultation.constraints.ConsultationDateScheduledInAdvance; + +import jakarta.validation.constraints.Future; +import jakarta.validation.constraints.NotNull; + +/** +* Data transfer object used to transfer data that will be saved in a Consultation entity +* +* @author Mirna Gama +* @version 1.0 +*/ +public record ConsultationDTO ( + + Long doctorId, + + @NotNull(message="patient id cannot be null") + Long patientId, + + @NotNull(message="consultation date cannot be null") + @Future + @JsonFormat(pattern = "dd/MM/yyyy HH:mm") + @ConsultationDateScheduledInAdvance + @ConsultationDateBusinessHours + LocalDateTime consultationDate, + + Specialty specialty +) { + +}