Skip to content

Commit

Permalink
update: DTO가 일관성 있는 패키지 구조가 되도록 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
SHEOMM committed Mar 30, 2024
1 parent 6801bbd commit ca71c80
Show file tree
Hide file tree
Showing 31 changed files with 86 additions and 90 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.waruru.areyouhere.attendance.controller;

import com.waruru.areyouhere.attendance.dto.AttendRequestDto;
import com.waruru.areyouhere.attendance.dto.AttendResponseDto;
import com.waruru.areyouhere.attendance.dto.CurrentAttendanceCount;
import com.waruru.areyouhere.attendance.dto.request.AttendRequestDto;
import com.waruru.areyouhere.attendance.dto.response.AttendResponseDto;
import com.waruru.areyouhere.attendance.dto.response.CurrentAttendanceCountResponseDto;
import com.waruru.areyouhere.attendance.dto.UpdateAttendance;
import com.waruru.areyouhere.attendance.dto.UpdateAttendanceRequestDto;
import com.waruru.areyouhere.attendance.dto.request.UpdateAttendanceRequestDto;
import com.waruru.areyouhere.attendance.exception.DuplicateAuthCodeAttendException;
import com.waruru.areyouhere.attendance.service.AttendanceService;
import com.waruru.areyouhere.attendance.service.dto.CurrentSessionAttendeeAttendance;
Expand Down Expand Up @@ -97,10 +97,10 @@ ResponseEntity<HttpStatus> updateAttendances(@RequestBody UpdateAttendanceReques

@LoginRequired
@GetMapping
ResponseEntity<CurrentAttendanceCount> getCurrentAttendances(@RequestParam("courseId") Long courseId, @RequestParam("sessionId") Long sessionId){
ResponseEntity<CurrentAttendanceCountResponseDto> getCurrentAttendances(@RequestParam("courseId") Long courseId, @RequestParam("sessionId") Long sessionId){
int currentAttendance = attendanceService.currentAttendance(sessionId);
int total = attendeeService.getAttendeeByCourseId(courseId);
return ResponseEntity.ok(new CurrentAttendanceCount(currentAttendance, total));
return ResponseEntity.ok(new CurrentAttendanceCountResponseDto(currentAttendance, total));
}

@LoginRequired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import com.waruru.areyouhere.course.domain.entity.Course;
import com.waruru.areyouhere.course.service.CourseService;
import com.waruru.areyouhere.session.domain.entity.Session;
import com.waruru.areyouhere.attendance.dto.AuthCodeDeactivationRequestDto;
import com.waruru.areyouhere.attendance.dto.AuthCodeRequestDto;
import com.waruru.areyouhere.attendance.dto.request.AuthCodeDeactivationRequestDto;
import com.waruru.areyouhere.attendance.dto.request.AuthCodeRequestDto;
import com.waruru.areyouhere.attendance.service.AuthCodeService;
import com.waruru.areyouhere.session.service.SessionService;
import java.time.LocalDateTime;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.waruru.areyouhere.attendance.dto;
package com.waruru.areyouhere.attendance.dto.request;

import lombok.Data;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.waruru.areyouhere.attendance.dto;
package com.waruru.areyouhere.attendance.dto.request;


import lombok.AccessLevel;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.waruru.areyouhere.attendance.dto;
package com.waruru.areyouhere.attendance.dto.request;

import jakarta.validation.constraints.NotNull;
import lombok.Data;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.waruru.areyouhere.attendance.dto;
package com.waruru.areyouhere.attendance.dto.request;

import com.waruru.areyouhere.attendance.dto.UpdateAttendance;
import java.util.List;
import lombok.Data;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.waruru.areyouhere.attendance.dto;
package com.waruru.areyouhere.attendance.dto.response;

import com.waruru.areyouhere.attendee.service.dto.AttendeeInfo;
import java.time.LocalDateTime;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.waruru.areyouhere.attendance.dto;
package com.waruru.areyouhere.attendance.dto.response;

import lombok.AllArgsConstructor;
import lombok.Data;

@Data
@AllArgsConstructor
public class CurrentAttendanceCount {
public class CurrentAttendanceCountResponseDto {
private int attendances;
private int total;
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package com.waruru.areyouhere.attendee.controller;

import com.waruru.areyouhere.attendee.dto.AttendeeDetailDto;
import com.waruru.areyouhere.attendee.dto.ClassAttendeesDto;
import com.waruru.areyouhere.attendee.dto.DeleteAttendeesDto;
import com.waruru.areyouhere.attendee.dto.DuplicateCheckAttendeesDto;
import com.waruru.areyouhere.attendee.dto.NewAttendeesDto;
import com.waruru.areyouhere.attendee.service.dto.AttendeeDetailDto;
import com.waruru.areyouhere.attendee.dto.response.ClassAttendeesResponseDto;
import com.waruru.areyouhere.attendee.dto.request.DeleteAttendeesRequestDto;
import com.waruru.areyouhere.attendee.dto.request.DuplicateCheckAttendeesRequestDto;
import com.waruru.areyouhere.attendee.dto.request.NewAttendeesRequestDto;
import com.waruru.areyouhere.attendee.service.AttendeeService;
import com.waruru.areyouhere.attendee.service.dto.AttendeeAttendanceInfo;
import com.waruru.areyouhere.attendee.service.dto.ClassAttendees;
import com.waruru.areyouhere.attendee.service.dto.DuplicateAttendees;
import com.waruru.areyouhere.common.annotation.LoginRequired;
Expand All @@ -33,32 +32,32 @@ public class AttendeeController {

@LoginRequired
@GetMapping
public ResponseEntity<ClassAttendeesDto> getClassAttendees(@RequestParam("courseId") Long courseId){
public ResponseEntity<ClassAttendeesResponseDto> getClassAttendees(@RequestParam("courseId") Long courseId){
List<ClassAttendees> classAttendees = attendeeService.getClassAttendeesIfExistsOrEmpty(courseId);

return ResponseEntity.ok(ClassAttendeesDto.builder()
return ResponseEntity.ok(ClassAttendeesResponseDto.builder()
.classAttendees(classAttendees)
.build());
}

@LoginRequired
@PostMapping
public ResponseEntity<HttpStatus> create(@RequestBody NewAttendeesDto newAttendeesDto){
attendeeService.createAttendees(newAttendeesDto.getCourseId(), newAttendeesDto.getNewAttendees());
public ResponseEntity<HttpStatus> create(@RequestBody NewAttendeesRequestDto newAttendeesRequestDto){
attendeeService.createAttendees(newAttendeesRequestDto.getCourseId(), newAttendeesRequestDto.getNewAttendees());
return ResponseEntity.ok().build();
}

@LoginRequired
@PostMapping("/delete")
public ResponseEntity<HttpStatus> delete(@RequestBody DeleteAttendeesDto deleteAttendeesDto){
attendeeService.deleteAttendees(deleteAttendeesDto.getAttendeeIds());
public ResponseEntity<HttpStatus> delete(@RequestBody DeleteAttendeesRequestDto deleteAttendeesRequestDto){
attendeeService.deleteAttendees(deleteAttendeesRequestDto.getAttendeeIds());
return ResponseEntity.ok().build();
}

@LoginRequired
@PostMapping("/duplicate")
public ResponseEntity<DuplicateAttendees> checkDuplicate(@RequestBody DuplicateCheckAttendeesDto duplicateCheckAttendeesDto){
return ResponseEntity.ok(attendeeService.getDuplicateAttendees(duplicateCheckAttendeesDto.getCourseId(), duplicateCheckAttendeesDto.getNewAttendees()));
public ResponseEntity<DuplicateAttendees> checkDuplicate(@RequestBody DuplicateCheckAttendeesRequestDto duplicateCheckAttendeesRequestDto){
return ResponseEntity.ok(attendeeService.getDuplicateAttendees(duplicateCheckAttendeesRequestDto.getCourseId(), duplicateCheckAttendeesRequestDto.getNewAttendees()));
}

@LoginRequired
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.waruru.areyouhere.attendee.dto.request;

import java.util.List;
import lombok.Data;

@Data
public class DeleteAttendeesRequestDto {
List<Long> attendeeIds;
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.waruru.areyouhere.attendee.dto;
package com.waruru.areyouhere.attendee.dto.request;

import java.util.List;
import lombok.Getter;


@Getter
public class DuplicateCheckAttendeesDto {
public class DuplicateCheckAttendeesRequestDto {
private Long courseId;
private List<String> newAttendees;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.waruru.areyouhere.attendee.dto.request;

import com.waruru.areyouhere.attendee.service.dto.AttendeeData;
import java.util.List;
import lombok.Data;


@Data
public class NewAttendeesRequestDto {
private Long courseId;

List<AttendeeData> newAttendees;
}

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.waruru.areyouhere.attendee.dto;
package com.waruru.areyouhere.attendee.dto.response;

import com.waruru.areyouhere.attendee.service.dto.ClassAttendees;
import java.util.List;
Expand All @@ -10,12 +10,12 @@

@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class ClassAttendeesDto {
public class ClassAttendeesResponseDto {

private List<ClassAttendees> classAttendees;

@Builder
public ClassAttendeesDto(List<ClassAttendees> classAttendees) {
public ClassAttendeesResponseDto(List<ClassAttendees> classAttendees) {
this.classAttendees = classAttendees;
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package com.waruru.areyouhere.attendee.service;

import com.waruru.areyouhere.attendee.dto.AttendeeData;
import com.waruru.areyouhere.attendee.dto.AttendeeDetailDto;
import com.waruru.areyouhere.attendee.service.dto.AttendeeAttendanceInfo;
import com.waruru.areyouhere.attendee.service.dto.AttendeeData;
import com.waruru.areyouhere.attendee.service.dto.AttendeeDetailDto;
import com.waruru.areyouhere.attendee.service.dto.ClassAttendees;
import com.waruru.areyouhere.attendee.service.dto.DuplicateAttendees;
import com.waruru.areyouhere.attendee.service.dto.SessionAttendees;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import com.waruru.areyouhere.attendee.domain.repository.dto.AttendeeAttendDetailInfo;
import com.waruru.areyouhere.attendee.domain.repository.dto.ClassAttendeeInfo;
import com.waruru.areyouhere.attendee.domain.repository.dto.SessionAttendeeInfo;
import com.waruru.areyouhere.attendee.dto.AttendeeData;
import com.waruru.areyouhere.attendee.dto.AttendeeDetailDto;
import com.waruru.areyouhere.attendee.service.dto.AttendeeData;
import com.waruru.areyouhere.attendee.service.dto.AttendeeDetailDto;
import com.waruru.areyouhere.attendee.exception.ClassAttendeesEmptyException;
import com.waruru.areyouhere.attendee.exception.SessionAttendeesEmptyException;
import com.waruru.areyouhere.attendee.service.dto.AttendeeAttendanceInfo;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.waruru.areyouhere.attendee.dto;
package com.waruru.areyouhere.attendee.service.dto;


import lombok.Data;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package com.waruru.areyouhere.attendee.dto;
package com.waruru.areyouhere.attendee.service.dto;


import com.waruru.areyouhere.attendee.domain.repository.dto.AttendeeAttendDetailInfo;
import com.waruru.areyouhere.attendee.service.dto.AttendeeAttendanceInfo;
import java.util.List;
import lombok.AccessLevel;
import lombok.Builder;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.waruru.areyouhere.course.dto.request;

import com.waruru.areyouhere.attendee.dto.AttendeeData;
import com.waruru.areyouhere.attendee.service.dto.AttendeeData;
import jakarta.validation.constraints.NotEmpty;
import lombok.*;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.waruru.areyouhere.course.service;

import com.waruru.areyouhere.attendee.dto.AttendeeData;
import com.waruru.areyouhere.attendee.service.dto.AttendeeData;
import com.waruru.areyouhere.course.domain.entity.Course;
import com.waruru.areyouhere.course.dto.CourseData;
import org.springframework.web.bind.annotation.RestController;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
import com.waruru.areyouhere.attendee.domain.repository.AttendeeBatchRepository;
import com.waruru.areyouhere.attendee.domain.repository.AttendeeRepository;
import com.waruru.areyouhere.attendee.domain.repository.dto.EachClassAttendeeCountInfo;
import com.waruru.areyouhere.attendee.dto.AttendeeData;
import com.waruru.areyouhere.auth.session.SessionManager;
import com.waruru.areyouhere.common.utils.RandomIdentifierGenerator;
import com.waruru.areyouhere.attendee.service.dto.AttendeeData;
import com.waruru.areyouhere.course.domain.entity.Course;
import com.waruru.areyouhere.course.domain.repository.CourseRepository;
import com.waruru.areyouhere.attendee.exception.AttendeesNotUniqueException;
Expand All @@ -20,8 +18,6 @@
import java.util.Set;
import java.util.stream.Collectors;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.SetOperations;
import org.springframework.transaction.annotation.Transactional;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
Expand All @@ -36,7 +32,6 @@
public class CourseServiceImpl implements CourseService {
private final CourseRepository courseRepository;
private final ManagerRepository managerRepository;
private final SessionManager sessionManager;
private final AttendeeBatchRepository attendeeBatchRepository;
private final AttendeeRepository attendeeRepository;
private final AttendanceRepository attendanceRepository;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,8 @@ public void update(Long userId, String name, String password){
Manager manager = managerRepository.findById(userId).orElseThrow(UnAuthenticatedException::new);
managerRepository.save(manager.update(name, passwordEncoder.encode(password)));
}

public void delete(Long userId){
managerRepository.deleteById(userId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@


import com.waruru.areyouhere.common.annotation.LoginRequired;
import com.waruru.areyouhere.session.dto.CurrentSessionResponseDto;
import com.waruru.areyouhere.session.dto.PreviousFiveSessionResponseDto;
import com.waruru.areyouhere.session.dto.response.CurrentSessionResponseDto;
import com.waruru.areyouhere.session.dto.response.PreviousFiveSessionResponseDto;
import com.waruru.areyouhere.session.exception.CurrentSessionNotFoundException;
import com.waruru.areyouhere.session.service.SessionService;
import com.waruru.areyouhere.session.service.dto.CurrentSessionDto;
import com.waruru.areyouhere.session.service.dto.SessionAttendanceInfo;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@

import com.waruru.areyouhere.attendee.service.AttendeeService;
import com.waruru.areyouhere.attendee.service.dto.SessionAttendees;
import com.waruru.areyouhere.session.dto.CreateSessionRequestDto;
import com.waruru.areyouhere.session.dto.DeleteSessionRequestDto;
import com.waruru.areyouhere.session.dto.SessionAttendeesDto;
import com.waruru.areyouhere.session.dto.request.CreateSessionRequestDto;
import com.waruru.areyouhere.session.dto.response.SessionAttendeesResponseDto;
import com.waruru.areyouhere.session.service.SessionService;
import com.waruru.areyouhere.session.service.dto.AllSessionAttendanceInfo;
import com.waruru.areyouhere.session.service.dto.SessionAttendanceInfo;
Expand Down Expand Up @@ -64,21 +63,21 @@ public ResponseEntity<SessionAttendanceInfo> getSessionBasicInfo(@PathVariable("
}

@GetMapping("/{sessionId}/attendee")
public ResponseEntity<SessionAttendeesDto> getSessionAllAttendees(@PathVariable("sessionId") Long sessionId){
public ResponseEntity<SessionAttendeesResponseDto> getSessionAllAttendees(@PathVariable("sessionId") Long sessionId){
List<SessionAttendees> sessionAttendees = attendeeService.getSessionAttendeesIfExistsOrEmpty(
sessionId);

return ResponseEntity.ok(SessionAttendeesDto.builder()
return ResponseEntity.ok(SessionAttendeesResponseDto.builder()
.sessionAttendees(sessionAttendees)
.build());
}

@GetMapping("/{sessionId}/absentee")
public ResponseEntity<SessionAttendeesDto> getSessionAbsenteeOnly(@PathVariable("sessionId") Long sessionId){
public ResponseEntity<SessionAttendeesResponseDto> getSessionAbsenteeOnly(@PathVariable("sessionId") Long sessionId){
List<SessionAttendees> sessionAttendees = attendeeService.getSessionAbsenteesIfExistsOrEmpty(
sessionId);

return ResponseEntity.ok(SessionAttendeesDto.builder()
return ResponseEntity.ok(SessionAttendeesResponseDto.builder()
.sessionAttendees(sessionAttendees)
.build());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.waruru.areyouhere.session.dto;
package com.waruru.areyouhere.session.dto.request;

import lombok.Data;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.waruru.areyouhere.session.dto;
package com.waruru.areyouhere.session.dto.request;

import lombok.Data;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.waruru.areyouhere.session.dto;
package com.waruru.areyouhere.session.dto.response;


import java.time.LocalDateTime;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.waruru.areyouhere.session.dto;
package com.waruru.areyouhere.session.dto.response;

import com.waruru.areyouhere.session.service.dto.SessionAttendanceInfo;
import java.util.List;
Expand Down
Loading

0 comments on commit ca71c80

Please sign in to comment.