From a3ffdf7a1d8f662e5e68bdd3d6f23d56841c388f Mon Sep 17 00:00:00 2001 From: Huynh Nguyen Date: Thu, 24 Oct 2024 22:33:40 +0700 Subject: [PATCH 1/2] [NguyenHCP] feat: config response when send mail --- .../PodBookingSystem/controller/AccountController.java | 9 ++++++--- .../dto/request/Account/SendMailRequest.java | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/swp/PodBookingSystem/controller/AccountController.java b/src/main/java/com/swp/PodBookingSystem/controller/AccountController.java index 053dd071..39739543 100644 --- a/src/main/java/com/swp/PodBookingSystem/controller/AccountController.java +++ b/src/main/java/com/swp/PodBookingSystem/controller/AccountController.java @@ -106,15 +106,18 @@ ApiResponse getMe(@RequestHeader("Authorization") String } @PostMapping("/send-email") - public String sendEmail(@RequestBody SendMailRequest request) throws MessagingException, IOException { + ApiResponse sendEmail(@RequestBody SendMailRequest request) throws MessagingException, IOException { sendEmailService.sendCalenderInvite( CalendarRequest.builder() .subject("Đăt lịch ở POD Booking") .description("Hãy đặt lịch ở calendar để không bị bỏ lỡ") .summary("Đăt lịch ở POD Booking") .to(request.getEmail()) - .eventDateTime(LocalDateTime.parse("2024-10-27T17:00:00")).build()); - return "Send email successfully"; + .eventDateTime(LocalDateTime.parse(request.getStartTime())).build()); + return ApiResponse.builder() + .message("Gửi lời mời đặt lịch thành công") + .code(200) + .build(); } @GetMapping("/staff") diff --git a/src/main/java/com/swp/PodBookingSystem/dto/request/Account/SendMailRequest.java b/src/main/java/com/swp/PodBookingSystem/dto/request/Account/SendMailRequest.java index da80989a..d1af77a0 100644 --- a/src/main/java/com/swp/PodBookingSystem/dto/request/Account/SendMailRequest.java +++ b/src/main/java/com/swp/PodBookingSystem/dto/request/Account/SendMailRequest.java @@ -10,4 +10,5 @@ @FieldDefaults(level = AccessLevel.PRIVATE) public class SendMailRequest { String email; + String startTime; } From ce1310e3e62a1458f37a3c098f09e91627889ab4 Mon Sep 17 00:00:00 2001 From: Huynh Nguyen Date: Thu, 24 Oct 2024 22:51:31 +0700 Subject: [PATCH 2/2] [NguyenHCP] chore: config api getMe response --- .../dto/request/Account/AccountResponseClient.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/swp/PodBookingSystem/dto/request/Account/AccountResponseClient.java b/src/main/java/com/swp/PodBookingSystem/dto/request/Account/AccountResponseClient.java index 1de58a3e..1999724f 100644 --- a/src/main/java/com/swp/PodBookingSystem/dto/request/Account/AccountResponseClient.java +++ b/src/main/java/com/swp/PodBookingSystem/dto/request/Account/AccountResponseClient.java @@ -1,8 +1,7 @@ package com.swp.PodBookingSystem.dto.request.Account; import com.swp.PodBookingSystem.enums.AccountRole; -import jakarta.persistence.EnumType; -import jakarta.persistence.Enumerated; +import jakarta.persistence.*; import lombok.*; import lombok.experimental.FieldDefaults; @@ -12,6 +11,8 @@ @Builder @FieldDefaults(level = AccessLevel.PRIVATE) public class AccountResponseClient { + @Id + String id; String name; String email; String avatar;