From c414bb65469ac3062dae5b4ca76cf11d31d016c6 Mon Sep 17 00:00:00 2001 From: SHEOMM Date: Sat, 30 Mar 2024 22:00:09 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20Attendee=20=EC=83=81=EC=84=B8=20?= =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=80=20API=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../attendee/domain/entity/Attendee.java | 5 +++++ .../dto/request/UpdateAttendeesRequestDto.java | 9 +++++++++ .../attendee/service/dto/AttendeeDetailDto.java | 15 ++++++++++++--- .../manager/controller/ManagerController.java | 1 - 4 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 src/main/java/com/waruru/areyouhere/attendee/dto/request/UpdateAttendeesRequestDto.java diff --git a/src/main/java/com/waruru/areyouhere/attendee/domain/entity/Attendee.java b/src/main/java/com/waruru/areyouhere/attendee/domain/entity/Attendee.java index d2bf5d0..0c88725 100644 --- a/src/main/java/com/waruru/areyouhere/attendee/domain/entity/Attendee.java +++ b/src/main/java/com/waruru/areyouhere/attendee/domain/entity/Attendee.java @@ -30,5 +30,10 @@ public Attendee(Course course, String name, String note){ this.note = note; } + public void update(String name, String note){ + this.name = name; + this.note = note; + } + } diff --git a/src/main/java/com/waruru/areyouhere/attendee/dto/request/UpdateAttendeesRequestDto.java b/src/main/java/com/waruru/areyouhere/attendee/dto/request/UpdateAttendeesRequestDto.java new file mode 100644 index 0000000..4458b96 --- /dev/null +++ b/src/main/java/com/waruru/areyouhere/attendee/dto/request/UpdateAttendeesRequestDto.java @@ -0,0 +1,9 @@ +package com.waruru.areyouhere.attendee.dto.request; + +import com.waruru.areyouhere.attendee.service.dto.AttendeeInfo; +import java.util.List; + +public class UpdateAttendeesRequestDto { + private Long courseId; + private List updatedAttendees; +} diff --git a/src/main/java/com/waruru/areyouhere/attendee/service/dto/AttendeeDetailDto.java b/src/main/java/com/waruru/areyouhere/attendee/service/dto/AttendeeDetailDto.java index 12c5656..0596fa2 100644 --- a/src/main/java/com/waruru/areyouhere/attendee/service/dto/AttendeeDetailDto.java +++ b/src/main/java/com/waruru/areyouhere/attendee/service/dto/AttendeeDetailDto.java @@ -1,6 +1,7 @@ package com.waruru.areyouhere.attendee.service.dto; +import com.waruru.areyouhere.attendee.domain.entity.Attendee; import com.waruru.areyouhere.attendee.domain.repository.dto.AttendeeAttendDetailInfo; import java.util.List; import lombok.AccessLevel; @@ -11,13 +12,21 @@ @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) public class AttendeeDetailDto { - private AttendeeAttendanceInfo attendee; + private AttendeeInfo attendee; + private int attendance; + private int absence; private List attendanceInfo; @Builder - public AttendeeDetailDto(AttendeeAttendanceInfo attendee, List attendanceInfo) { - this.attendee = attendee; + public AttendeeDetailDto(Attendee attendee, int attendance, int absence, List attendanceInfo) { + this.attendee = AttendeeInfo.builder() + .id(attendee.getId()) + .name(attendee.getName()) + .note(attendee.getNote()) + .build(); + this.attendance = attendance; + this.absence = absence; this.attendanceInfo = attendanceInfo.stream() .map(attendeeAttendDetailInfo -> new AttendeeAttendeeDetail( attendeeAttendDetailInfo.getAttendanceId(), diff --git a/src/main/java/com/waruru/areyouhere/manager/controller/ManagerController.java b/src/main/java/com/waruru/areyouhere/manager/controller/ManagerController.java index 8579a0c..261c19e 100644 --- a/src/main/java/com/waruru/areyouhere/manager/controller/ManagerController.java +++ b/src/main/java/com/waruru/areyouhere/manager/controller/ManagerController.java @@ -84,7 +84,6 @@ public ResponseEntity unauthorized(){ @LoginRequired @PutMapping public ResponseEntity update(@RequestBody UpdateRequestDto updateRequestDto, @Login Manager manager){ - managerService.update(manager.getId(), updateRequestDto.getName(), updateRequestDto.getPassword()); return RESPONSE_OK; }