From 3e692708610a99d567f5886a63f468aae589e054 Mon Sep 17 00:00:00 2001 From: j2noo Date: Mon, 20 May 2024 15:31:53 +0900 Subject: [PATCH] =?UTF-8?q?feat(#59)=20:=20swagger=EC=97=90=EC=84=9C=20nul?= =?UTF-8?q?l=20=ED=8F=AC=ED=95=A8=ED=95=98=EC=A7=80=20=EC=95=8A=EB=8A=94?= =?UTF-8?q?=20=EC=96=B4=EB=85=B8=ED=85=8C=EC=9D=B4=EC=85=98=20=EA=B3=B5?= =?UTF-8?q?=ED=86=B5=EC=A0=81=EC=9C=BC=EB=A1=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/response/AcceptConnectionResponseDto.java | 2 ++ .../dto/response/RequestConnectionResponseDto.java | 2 ++ .../java/com/remind/api/member/dto/CautionPatientDto.java | 2 ++ src/main/java/com/remind/api/member/dto/PatientDto.java | 3 ++- .../api/member/dto/response/CautionPatientsResponseDto.java | 2 ++ .../api/member/dto/response/KakaoGetMemberInfoResponse.java | 2 ++ .../remind/api/member/dto/response/KakaoLoginResponse.java | 2 ++ .../api/member/dto/response/OnboardingResponseDto.java | 2 ++ .../remind/api/member/dto/response/PatientsResponseDto.java | 2 ++ .../remind/api/member/dto/response/TokenResponseDto.java | 2 ++ .../dto/response/CreatePrescriptionResponseDto.java | 2 ++ .../takingMedicine/controller/TakingMedicineController.java | 6 ++++-- .../api/takingMedicine/dto/DailyTakingMedicineDto.java | 2 ++ .../api/takingMedicine/dto/MonthlyTakingMedicineDto.java | 2 ++ .../dto/response/CreateTakingMedicineResponse.java | 2 ++ .../dto/response/DailyTakingMedicineInfoResponse.java | 2 ++ .../dto/response/UpdateTakingMedicineResponseDto.java | 4 ---- src/main/java/com/remind/core/domain/member/Patient.java | 2 -- 18 files changed, 34 insertions(+), 9 deletions(-) delete mode 100644 src/main/java/com/remind/api/takingMedicine/dto/response/UpdateTakingMedicineResponseDto.java diff --git a/src/main/java/com/remind/api/connection/dto/response/AcceptConnectionResponseDto.java b/src/main/java/com/remind/api/connection/dto/response/AcceptConnectionResponseDto.java index fc26d95..5c3f3f7 100644 --- a/src/main/java/com/remind/api/connection/dto/response/AcceptConnectionResponseDto.java +++ b/src/main/java/com/remind/api/connection/dto/response/AcceptConnectionResponseDto.java @@ -1,9 +1,11 @@ package com.remind.api.connection.dto.response; +import com.fasterxml.jackson.annotation.JsonInclude; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Builder; @Builder +@JsonInclude(JsonInclude.Include.NON_NULL) @Schema(description = "의사/센터가 환자의 관계 요청 응답을 수락하는 응답 객체") public record AcceptConnectionResponseDto( @Schema(description = "요청을 수락하며 생긴 커넥션의 아이디") diff --git a/src/main/java/com/remind/api/connection/dto/response/RequestConnectionResponseDto.java b/src/main/java/com/remind/api/connection/dto/response/RequestConnectionResponseDto.java index 7224912..932fb26 100644 --- a/src/main/java/com/remind/api/connection/dto/response/RequestConnectionResponseDto.java +++ b/src/main/java/com/remind/api/connection/dto/response/RequestConnectionResponseDto.java @@ -1,9 +1,11 @@ package com.remind.api.connection.dto.response; +import com.fasterxml.jackson.annotation.JsonInclude; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Builder; @Builder +@JsonInclude(JsonInclude.Include.NON_NULL) @Schema(description = "환자 -> 의사/센터 관계 요청하는 응답 객체") public record RequestConnectionResponseDto( @Schema(description = "요청을 보내며 생긴 요청 row의 아이디") diff --git a/src/main/java/com/remind/api/member/dto/CautionPatientDto.java b/src/main/java/com/remind/api/member/dto/CautionPatientDto.java index 9eb7bca..b5e3cf8 100644 --- a/src/main/java/com/remind/api/member/dto/CautionPatientDto.java +++ b/src/main/java/com/remind/api/member/dto/CautionPatientDto.java @@ -1,9 +1,11 @@ package com.remind.api.member.dto; +import com.fasterxml.jackson.annotation.JsonInclude; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Builder; @Builder +@JsonInclude(JsonInclude.Include.NON_NULL) public record CautionPatientDto( @Schema(description = "환자 아이디") Long memberId, diff --git a/src/main/java/com/remind/api/member/dto/PatientDto.java b/src/main/java/com/remind/api/member/dto/PatientDto.java index db2b0cb..baaa612 100644 --- a/src/main/java/com/remind/api/member/dto/PatientDto.java +++ b/src/main/java/com/remind/api/member/dto/PatientDto.java @@ -1,11 +1,12 @@ package com.remind.api.member.dto; +import com.fasterxml.jackson.annotation.JsonInclude; import io.swagger.v3.oas.annotations.media.Schema; import lombok.AllArgsConstructor; import lombok.Builder; @Builder -//@AllArgsConstructor +@JsonInclude(JsonInclude.Include.NON_NULL) public record PatientDto( @Schema(description = "멤버 아이디") Long memberId, diff --git a/src/main/java/com/remind/api/member/dto/response/CautionPatientsResponseDto.java b/src/main/java/com/remind/api/member/dto/response/CautionPatientsResponseDto.java index cb503ee..2e266d8 100644 --- a/src/main/java/com/remind/api/member/dto/response/CautionPatientsResponseDto.java +++ b/src/main/java/com/remind/api/member/dto/response/CautionPatientsResponseDto.java @@ -1,5 +1,6 @@ package com.remind.api.member.dto.response; +import com.fasterxml.jackson.annotation.JsonInclude; import com.remind.api.member.dto.CautionPatientDto; import com.remind.api.member.dto.PatientDto; import io.swagger.v3.oas.annotations.media.Schema; @@ -8,6 +9,7 @@ import java.util.List; @Builder +@JsonInclude(JsonInclude.Include.NON_NULL) @Schema(description = "주의가 필요한 환자 목록 리스트") public record CautionPatientsResponseDto( @Schema(description = "관리중인 환자 목록 리스트") diff --git a/src/main/java/com/remind/api/member/dto/response/KakaoGetMemberInfoResponse.java b/src/main/java/com/remind/api/member/dto/response/KakaoGetMemberInfoResponse.java index 604e119..a315d8c 100644 --- a/src/main/java/com/remind/api/member/dto/response/KakaoGetMemberInfoResponse.java +++ b/src/main/java/com/remind/api/member/dto/response/KakaoGetMemberInfoResponse.java @@ -1,9 +1,11 @@ package com.remind.api.member.dto.response; +import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Getter; @Getter +@JsonInclude(JsonInclude.Include.NON_NULL) public class KakaoGetMemberInfoResponse { @JsonProperty("id") private Long authId; diff --git a/src/main/java/com/remind/api/member/dto/response/KakaoLoginResponse.java b/src/main/java/com/remind/api/member/dto/response/KakaoLoginResponse.java index b9d4164..bf71b09 100644 --- a/src/main/java/com/remind/api/member/dto/response/KakaoLoginResponse.java +++ b/src/main/java/com/remind/api/member/dto/response/KakaoLoginResponse.java @@ -1,10 +1,12 @@ package com.remind.api.member.dto.response; +import com.fasterxml.jackson.annotation.JsonInclude; import com.remind.core.domain.member.enums.RolesType; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Builder; @Builder +@JsonInclude(JsonInclude.Include.NON_NULL) public record KakaoLoginResponse(@Schema(description = "Remind의 리프레시 토큰") String refreshToken, diff --git a/src/main/java/com/remind/api/member/dto/response/OnboardingResponseDto.java b/src/main/java/com/remind/api/member/dto/response/OnboardingResponseDto.java index a21383a..ce046e2 100644 --- a/src/main/java/com/remind/api/member/dto/response/OnboardingResponseDto.java +++ b/src/main/java/com/remind/api/member/dto/response/OnboardingResponseDto.java @@ -1,8 +1,10 @@ package com.remind.api.member.dto.response; +import com.fasterxml.jackson.annotation.JsonInclude; import com.remind.core.domain.member.enums.RolesType; import lombok.Builder; @Builder +@JsonInclude(JsonInclude.Include.NON_NULL) public record OnboardingResponseDto(Long userId, RolesType rolesType) { } diff --git a/src/main/java/com/remind/api/member/dto/response/PatientsResponseDto.java b/src/main/java/com/remind/api/member/dto/response/PatientsResponseDto.java index 24c6edd..7dd7783 100644 --- a/src/main/java/com/remind/api/member/dto/response/PatientsResponseDto.java +++ b/src/main/java/com/remind/api/member/dto/response/PatientsResponseDto.java @@ -1,5 +1,6 @@ package com.remind.api.member.dto.response; +import com.fasterxml.jackson.annotation.JsonInclude; import com.remind.api.member.dto.PatientDto; import com.remind.api.mood.dto.MoodChartDto; import io.swagger.v3.oas.annotations.media.Schema; @@ -8,6 +9,7 @@ import java.util.List; @Builder +@JsonInclude(JsonInclude.Include.NON_NULL) public record PatientsResponseDto( @Schema(description = "관리중인 환자 목록 리스트") List patientDtos, diff --git a/src/main/java/com/remind/api/member/dto/response/TokenResponseDto.java b/src/main/java/com/remind/api/member/dto/response/TokenResponseDto.java index 6cfa1c2..ad78698 100644 --- a/src/main/java/com/remind/api/member/dto/response/TokenResponseDto.java +++ b/src/main/java/com/remind/api/member/dto/response/TokenResponseDto.java @@ -1,9 +1,11 @@ package com.remind.api.member.dto.response; +import com.fasterxml.jackson.annotation.JsonInclude; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Builder; @Builder +@JsonInclude(JsonInclude.Include.NON_NULL) @Schema(description = "토큰 응답 model") public record TokenResponseDto( @Schema(description = "access token 유효 기간: 30분") diff --git a/src/main/java/com/remind/api/prescription/dto/response/CreatePrescriptionResponseDto.java b/src/main/java/com/remind/api/prescription/dto/response/CreatePrescriptionResponseDto.java index 2539226..19b6c0a 100644 --- a/src/main/java/com/remind/api/prescription/dto/response/CreatePrescriptionResponseDto.java +++ b/src/main/java/com/remind/api/prescription/dto/response/CreatePrescriptionResponseDto.java @@ -1,5 +1,6 @@ package com.remind.api.prescription.dto.response; +import com.fasterxml.jackson.annotation.JsonInclude; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.persistence.Column; import lombok.Builder; @@ -7,6 +8,7 @@ import java.time.LocalDate; @Builder +@JsonInclude(JsonInclude.Include.NON_NULL) @Schema(description = "약 복용 정보 업데이트 응답 객체") public record CreatePrescriptionResponseDto( Long PrescriptionId diff --git a/src/main/java/com/remind/api/takingMedicine/controller/TakingMedicineController.java b/src/main/java/com/remind/api/takingMedicine/controller/TakingMedicineController.java index 98a6548..4f6e399 100644 --- a/src/main/java/com/remind/api/takingMedicine/controller/TakingMedicineController.java +++ b/src/main/java/com/remind/api/takingMedicine/controller/TakingMedicineController.java @@ -29,7 +29,8 @@ public class TakingMedicineController { private final TakingMedicineService takingMedicineService; @Operation( summary = "memberId(), 날짜로 해당 날짜의 약 복용 정보를 조회하는 api", - description = "memberId(), 날짜로 해당 날짜의 약 복용 정보를 조회하는 api\n 나의 정보를 조회하는 경우에는 memberId = 0 을 넣어주세요" + description = "나의 정보를 조회하는 경우에는 memberId = 0 을 넣어주세요." + + "date는 string으로, YYYY-MM-DD 형식으로 주세요." ) @GetMapping("/daily") public ResponseEntity> getDailyTakingMedicineInfo( @@ -57,7 +58,8 @@ public ResponseEntity> get @Operation( summary = "특정 날짜의 약 복용 정보를 등록하는 api", - description = "특정 날짜의 약 복용 정보를 등록하는 api" + description = "medicineType : BREAKFAST, LUNCH, DINNER, ETC" + + "약을 복용하지 않은 경우 notTakingReason을 비워두거나 빈 문자열" ) @PostMapping("") public ResponseEntity> createTakingMedicine( diff --git a/src/main/java/com/remind/api/takingMedicine/dto/DailyTakingMedicineDto.java b/src/main/java/com/remind/api/takingMedicine/dto/DailyTakingMedicineDto.java index c5d86ff..5e2ed11 100644 --- a/src/main/java/com/remind/api/takingMedicine/dto/DailyTakingMedicineDto.java +++ b/src/main/java/com/remind/api/takingMedicine/dto/DailyTakingMedicineDto.java @@ -1,5 +1,6 @@ package com.remind.api.takingMedicine.dto; +import com.fasterxml.jackson.annotation.JsonInclude; import com.remind.core.domain.takingMedicine.enums.MedicinesType; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Builder; @@ -8,6 +9,7 @@ import java.time.format.DateTimeFormatter; @Schema(description = "특정 날짜의 약 복용 정보를 반환할 dto") +@JsonInclude(JsonInclude.Include.NON_NULL) @Builder public record DailyTakingMedicineDto( @Schema(description = "해당 약 처방 정보의 식별 id") diff --git a/src/main/java/com/remind/api/takingMedicine/dto/MonthlyTakingMedicineDto.java b/src/main/java/com/remind/api/takingMedicine/dto/MonthlyTakingMedicineDto.java index 37ef41a..87d3f82 100644 --- a/src/main/java/com/remind/api/takingMedicine/dto/MonthlyTakingMedicineDto.java +++ b/src/main/java/com/remind/api/takingMedicine/dto/MonthlyTakingMedicineDto.java @@ -1,5 +1,6 @@ package com.remind.api.takingMedicine.dto; +import com.fasterxml.jackson.annotation.JsonInclude; import com.remind.core.domain.takingMedicine.enums.MedicinesType; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Builder; @@ -8,6 +9,7 @@ import java.time.LocalTime; @Schema(description = "특정 월에서 일 단위의 약 복용 정보를 반환할 dto") +@JsonInclude(JsonInclude.Include.NON_NULL) @Builder public record MonthlyTakingMedicineDto( diff --git a/src/main/java/com/remind/api/takingMedicine/dto/response/CreateTakingMedicineResponse.java b/src/main/java/com/remind/api/takingMedicine/dto/response/CreateTakingMedicineResponse.java index 536144f..8df715e 100644 --- a/src/main/java/com/remind/api/takingMedicine/dto/response/CreateTakingMedicineResponse.java +++ b/src/main/java/com/remind/api/takingMedicine/dto/response/CreateTakingMedicineResponse.java @@ -1,8 +1,10 @@ package com.remind.api.takingMedicine.dto.response; +import com.fasterxml.jackson.annotation.JsonInclude; import lombok.Builder; @Builder +@JsonInclude(JsonInclude.Include.NON_NULL) public record CreateTakingMedicineResponse( String notTakingReason, Boolean isTaking diff --git a/src/main/java/com/remind/api/takingMedicine/dto/response/DailyTakingMedicineInfoResponse.java b/src/main/java/com/remind/api/takingMedicine/dto/response/DailyTakingMedicineInfoResponse.java index bad2985..b954f1c 100644 --- a/src/main/java/com/remind/api/takingMedicine/dto/response/DailyTakingMedicineInfoResponse.java +++ b/src/main/java/com/remind/api/takingMedicine/dto/response/DailyTakingMedicineInfoResponse.java @@ -1,5 +1,6 @@ package com.remind.api.takingMedicine.dto.response; +import com.fasterxml.jackson.annotation.JsonInclude; import com.remind.api.takingMedicine.dto.DailyTakingMedicineDto; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Builder; @@ -7,6 +8,7 @@ import java.util.List; @Builder +@JsonInclude(JsonInclude.Include.NON_NULL) @Schema(description = "특정 날짜의 약 복용 정보를 반환할 dto list") public record DailyTakingMedicineInfoResponse( @Schema(description = "특정 날짜의 약 복용 정보를 반환할 리스트") diff --git a/src/main/java/com/remind/api/takingMedicine/dto/response/UpdateTakingMedicineResponseDto.java b/src/main/java/com/remind/api/takingMedicine/dto/response/UpdateTakingMedicineResponseDto.java deleted file mode 100644 index 0904c99..0000000 --- a/src/main/java/com/remind/api/takingMedicine/dto/response/UpdateTakingMedicineResponseDto.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.remind.api.takingMedicine.dto.response; - -public record UpdateTakingMedicineResponseDto() { -} diff --git a/src/main/java/com/remind/core/domain/member/Patient.java b/src/main/java/com/remind/core/domain/member/Patient.java index 740edb7..cb89974 100644 --- a/src/main/java/com/remind/core/domain/member/Patient.java +++ b/src/main/java/com/remind/core/domain/member/Patient.java @@ -1,12 +1,10 @@ package com.remind.core.domain.member; -import com.remind.api.takingMedicine.dto.response.UpdateTakingMedicineResponseDto; import jakarta.persistence.*; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; -import lombok.experimental.SuperBuilder; @Entity @Getter