From 9484e65dda4c8f8af68588e7155277506ecec0c9 Mon Sep 17 00:00:00 2001 From: thguss Date: Fri, 19 Jan 2024 01:07:30 +0900 Subject: [PATCH 001/141] =?UTF-8?q?[REFACTOR]=20DTO=20=EB=A6=AC=ED=8C=A9?= =?UTF-8?q?=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/lecture/AttendanceResponseDTO.java | 5 +- .../dto/lecture/LectureRequestDTO.java | 1 + .../dto/lecture/LectureResponseDTO.java | 31 +++++++--- .../dto/lecture/LecturesResponseDTO.java | 62 +++++++++---------- 4 files changed, 57 insertions(+), 42 deletions(-) diff --git a/src/main/java/org/sopt/makers/operation/dto/lecture/AttendanceResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/lecture/AttendanceResponseDTO.java index 9376a41a..da99b041 100644 --- a/src/main/java/org/sopt/makers/operation/dto/lecture/AttendanceResponseDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/lecture/AttendanceResponseDTO.java @@ -1,4 +1,7 @@ package org.sopt.makers.operation.dto.lecture; -public record AttendanceResponseDTO(Long lectureId, Long subLectureId) { +public record AttendanceResponseDTO( + Long lectureId, + Long subLectureId +) { } diff --git a/src/main/java/org/sopt/makers/operation/dto/lecture/LectureRequestDTO.java b/src/main/java/org/sopt/makers/operation/dto/lecture/LectureRequestDTO.java index 970f1f76..96c99649 100644 --- a/src/main/java/org/sopt/makers/operation/dto/lecture/LectureRequestDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/lecture/LectureRequestDTO.java @@ -9,6 +9,7 @@ import lombok.*; +@Builder public record LectureRequestDTO( @NonNull Part part, @NonNull String name, diff --git a/src/main/java/org/sopt/makers/operation/dto/lecture/LectureResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/lecture/LectureResponseDTO.java index 69e90313..81a07c6b 100644 --- a/src/main/java/org/sopt/makers/operation/dto/lecture/LectureResponseDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/lecture/LectureResponseDTO.java @@ -1,6 +1,8 @@ package org.sopt.makers.operation.dto.lecture; import static java.util.Objects.*; + +import java.time.LocalDateTime; import java.util.List; import org.sopt.makers.operation.entity.Part; @@ -35,16 +37,25 @@ public static LectureResponseDTO of(Lecture lecture) { .status(lecture.getLectureStatus()) .build(); } -} -record SubLectureVO( - Long subLectureId, - int round, - String startAt, - String code -) { - static SubLectureVO of(SubLecture subLecture) { - val startAt = nonNull(subLecture.getStartAt()) ? subLecture.getStartAt().toString() : null; - return new SubLectureVO(subLecture.getId(), subLecture.getRound(), startAt, subLecture.getCode()); + @Builder + public record SubLectureVO( + Long subLectureId, + int round, + String startAt, + String code + ) { + private static SubLectureVO of(SubLecture subLecture) { + return SubLectureVO.builder() + .subLectureId(subLecture.getId()) + .round(subLecture.getRound()) + .startAt(getStartAt(subLecture.getStartAt())) + .code(subLecture.getCode()) + .build(); + } + + private static String getStartAt(LocalDateTime startAt) { + return nonNull(startAt) ? startAt.toString() : null; + } } } \ No newline at end of file diff --git a/src/main/java/org/sopt/makers/operation/dto/lecture/LecturesResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/lecture/LecturesResponseDTO.java index 253a9f25..2a831d19 100644 --- a/src/main/java/org/sopt/makers/operation/dto/lecture/LecturesResponseDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/lecture/LecturesResponseDTO.java @@ -9,44 +9,44 @@ import lombok.*; public record LecturesResponseDTO( - int generation, - List lectures + int generation, + List lectures ) { public static LecturesResponseDTO of(int generation, List lectures) { return new LecturesResponseDTO( - generation, - lectures.stream().map(LectureVO::of).toList() + generation, + lectures.stream().map(LectureVO::of).toList() ); } -} -@Builder -record LectureVO( - Long lectureId, - String name, - Part partValue, - String partName, - String startDate, - String endDate, - Attribute attributeValue, - String attributeName, - String place, - AttendancesStatusVO attendances -) { - public static LectureVO of(Lecture lecture) { - return LectureVO.builder() - .lectureId(lecture.getId()) - .name(lecture.getName()) - .partValue(lecture.getPart()) - .partName(lecture.getPart().getName()) - .startDate(lecture.getStartDate().toString()) - .endDate(lecture.getEndDate().toString()) - .attributeValue(lecture.getAttribute()) - .attributeName(lecture.getAttribute().getName()) - .place(lecture.getPlace()) - .attendances(AttendancesStatusVO.of(lecture)) - .build(); + @Builder + public record LectureVO( + Long lectureId, + String name, + Part partValue, + String partName, + String startDate, + String endDate, + Attribute attributeValue, + String attributeName, + String place, + AttendancesStatusVO attendances + ) { + private static LectureVO of(Lecture lecture) { + return LectureVO.builder() + .lectureId(lecture.getId()) + .name(lecture.getName()) + .partValue(lecture.getPart()) + .partName(lecture.getPart().getName()) + .startDate(lecture.getStartDate().toString()) + .endDate(lecture.getEndDate().toString()) + .attributeValue(lecture.getAttribute()) + .attributeName(lecture.getAttribute().getName()) + .place(lecture.getPlace()) + .attendances(AttendancesStatusVO.of(lecture)) + .build(); + } } } From 2275e9e997e166804a52cf9585dfbb9b57809a68 Mon Sep 17 00:00:00 2001 From: thguss Date: Fri, 19 Jan 2024 01:08:13 +0900 Subject: [PATCH 002/141] =?UTF-8?q?[REFACTOR]=20=EB=A6=AC=ED=8C=A9?= =?UTF-8?q?=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/web/LectureController.java | 42 +++++++++---------- .../operation/service/LectureServiceImpl.java | 1 - 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/src/main/java/org/sopt/makers/operation/controller/web/LectureController.java b/src/main/java/org/sopt/makers/operation/controller/web/LectureController.java index 1fdd49db..43d57790 100644 --- a/src/main/java/org/sopt/makers/operation/controller/web/LectureController.java +++ b/src/main/java/org/sopt/makers/operation/controller/web/LectureController.java @@ -1,5 +1,6 @@ package org.sopt.makers.operation.controller.web; +import static org.sopt.makers.operation.common.ApiResponse.*; import static org.sopt.makers.operation.common.ResponseMessage.*; import java.net.URI; @@ -39,22 +40,21 @@ public ResponseEntity createLecture(@RequestBody LectureRequestDTO val lectureId = lectureService.createLecture(requestDTO); return ResponseEntity .created(getURI(lectureId)) - .body(ApiResponse.success(SUCCESS_CREATE_LECTURE.getMessage(), lectureId)); + .body(success(SUCCESS_CREATE_LECTURE.getMessage(), lectureId)); } @ApiOperation(value = "세션 리스트 조회") @GetMapping - public ResponseEntity getLecturesByGeneration( - @RequestParam("generation") int generation, @RequestParam(required = false) Part part) { + public ResponseEntity getLecturesByGeneration(@RequestParam int generation, @RequestParam(required = false) Part part) { val response = lectureService.getLecturesByGeneration(generation, part); - return ResponseEntity.ok(ApiResponse.success(SUCCESS_GET_LECTURES.getMessage(), response)); + return ResponseEntity.ok(success(SUCCESS_GET_LECTURES.getMessage(), response)); } - @ApiOperation(value = "세션 상세 조회") + @ApiOperation(value = "세션 단일 조회") @GetMapping("/{lectureId}") public ResponseEntity getLecture(@PathVariable Long lectureId) { val response = lectureService.getLecture(lectureId); - return ResponseEntity.ok(ApiResponse.success(SUCCESS_GET_LECTURE.getMessage(), response)); + return ResponseEntity.ok(success(SUCCESS_GET_LECTURE.getMessage(), response)); } @ApiOperation(value = "출석 시작") @@ -63,35 +63,35 @@ public ResponseEntity startAttendance(@RequestBody AttendanceReques val response = lectureService.startAttendance(requestDTO); return ResponseEntity .created(getURI(requestDTO.lectureId())) - .body(ApiResponse.success(SUCCESS_START_ATTENDANCE.getMessage(), response)); + .body(success(SUCCESS_START_ATTENDANCE.getMessage(), response)); } - @ApiOperation(value = "출석 점수 갱신 트리거 (출석 종료)") + private URI getURI(Long lectureId) { + return ServletUriComponentsBuilder + .fromCurrentRequest() + .path("/{lectureId}") + .buildAndExpand(lectureId) + .toUri(); + } + + @ApiOperation(value = "세션 종료 후 출석 점수 갱신") @PatchMapping("/{lectureId}") - public ResponseEntity finishLecture(@PathVariable("lectureId") Long lectureId) { + public ResponseEntity finishLecture(@PathVariable Long lectureId) { lectureService.finishLecture(lectureId); - return ResponseEntity.ok(ApiResponse.success(SUCCESS_UPDATE_MEMBER_SCORE.getMessage())); + return ResponseEntity.ok(success(SUCCESS_UPDATE_MEMBER_SCORE.getMessage())); } @ApiOperation(value = "세션 삭제") @DeleteMapping("/{lectureId}") public ResponseEntity deleteLecture(@PathVariable Long lectureId) { lectureService.deleteLecture(lectureId); - return ResponseEntity.ok(ApiResponse.success(SUCCESS_DELETE_LECTURE.getMessage())); + return ResponseEntity.ok(success(SUCCESS_DELETE_LECTURE.getMessage())); } - @ApiOperation(value = "세션 상세 조회 (팝업)") + @ApiOperation(value = "세션 팝업용 상세 조회") @GetMapping("/detail/{lectureId}") public ResponseEntity getLectureDetail(@PathVariable Long lectureId) { val response = lectureService.getLectureDetail(lectureId); - return ResponseEntity.ok(ApiResponse.success(SUCCESS_GET_LECTURE.getMessage(), response)); - } - - private URI getURI(Long lectureId) { - return ServletUriComponentsBuilder - .fromCurrentRequest() - .path("/{lectureId}") - .buildAndExpand(lectureId) - .toUri(); + return ResponseEntity.ok(success(SUCCESS_GET_LECTURE.getMessage(), response)); } } diff --git a/src/main/java/org/sopt/makers/operation/service/LectureServiceImpl.java b/src/main/java/org/sopt/makers/operation/service/LectureServiceImpl.java index edbc3cd3..6f405fde 100644 --- a/src/main/java/org/sopt/makers/operation/service/LectureServiceImpl.java +++ b/src/main/java/org/sopt/makers/operation/service/LectureServiceImpl.java @@ -141,7 +141,6 @@ public LectureGetResponseDTO getCurrentLecture(Long playGroundId) { return LectureGetResponseDTO.of(lectureType, currentLecture, message, subAttendances); } - @Override public LecturesResponseDTO getLecturesByGeneration(int generation, Part part) { val lectures = lectureRepository.findLectures(generation, part); From d556cb0a56753596706219637cb91017b21b7a9f Mon Sep 17 00:00:00 2001 From: thguss Date: Fri, 19 Jan 2024 01:08:36 +0900 Subject: [PATCH 003/141] =?UTF-8?q?[TEST]=20=EC=84=B8=EC=85=98(web)=20?= =?UTF-8?q?=EC=BB=A8=ED=8A=B8=EB=A1=A4=EB=9F=AC=20=ED=85=8C=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 5 + .../controller/web/LectureControllerTest.java | 273 ++++++++++++++++++ 2 files changed, 278 insertions(+) create mode 100644 src/test/java/org/sopt/makers/operation/controller/web/LectureControllerTest.java diff --git a/build.gradle b/build.gradle index 74b34945..a6ed1626 100644 --- a/build.gradle +++ b/build.gradle @@ -32,6 +32,8 @@ dependencies { implementation 'org.springframework.boot:spring-boot-starter-security' implementation "com.querydsl:querydsl-jpa:${queryDslVersion}" implementation "com.querydsl:querydsl-apt:${queryDslVersion}" + testImplementation 'junit:junit:4.13.1' + testImplementation 'junit:junit:4.13.1' compileOnly 'org.projectlombok:lombok' runtimeOnly 'com.h2database:h2' @@ -48,6 +50,9 @@ dependencies { // swagger implementation 'io.springfox:springfox-boot-starter:3.0.0' implementation 'io.springfox:springfox-swagger-ui:3.0.0' + + // gson + implementation 'com.google.code.gson:gson:2.8.9' } tasks.named('test') { diff --git a/src/test/java/org/sopt/makers/operation/controller/web/LectureControllerTest.java b/src/test/java/org/sopt/makers/operation/controller/web/LectureControllerTest.java new file mode 100644 index 00000000..bf22b432 --- /dev/null +++ b/src/test/java/org/sopt/makers/operation/controller/web/LectureControllerTest.java @@ -0,0 +1,273 @@ +package org.sopt.makers.operation.controller.web; + +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Stream; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import org.sopt.makers.operation.dto.lecture.AttendanceRequestDTO; +import org.sopt.makers.operation.dto.lecture.AttendanceResponseDTO; +import org.sopt.makers.operation.dto.lecture.AttendancesStatusVO; +import org.sopt.makers.operation.dto.lecture.LectureDetailResponseDTO; +import org.sopt.makers.operation.dto.lecture.LectureRequestDTO; +import org.sopt.makers.operation.dto.lecture.LectureResponseDTO; +import org.sopt.makers.operation.dto.lecture.LectureResponseDTO.SubLectureVO; +import org.sopt.makers.operation.dto.lecture.LecturesResponseDTO; +import org.sopt.makers.operation.dto.lecture.LecturesResponseDTO.LectureVO; +import org.sopt.makers.operation.entity.Part; +import org.sopt.makers.operation.entity.lecture.Attribute; +import org.sopt.makers.operation.entity.lecture.LectureStatus; +import org.sopt.makers.operation.service.LectureService; +import org.springframework.http.MediaType; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.ResultActions; +import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; +import org.springframework.test.web.servlet.setup.MockMvcBuilders; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; + +import static org.mockito.Mockito.*; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; + +import com.google.gson.Gson; + +@ExtendWith(MockitoExtension.class) +class LectureControllerTest { + @InjectMocks + private LectureController lectureController; + + @Mock + private LectureService lectureService; + + private MockMvc mockMvc; + + private final String DEFAULT_URI = "/api/v1/lectures"; + private final String LECTURE_NAME = "테스트 이름"; + private final Part LECTURE_PART = Part.ALL; + private final int LECTURE_GENERATION = 30; + private final String LECTURE_PLACE = "테스트 장소"; + private final LocalDateTime NOW = LocalDateTime.now(); + private final Attribute LECTURE_ATTRIBUTE = Attribute.ETC; + private final LectureStatus LECTURE_STATUS = LectureStatus.BEFORE; + private final int LIST_SIZE = 5; + private final String SUB_LECTURE_CODE = "code"; + + @BeforeEach + public void init() { + mockMvc = MockMvcBuilders.standaloneSetup(lectureController).build(); + } + + @DisplayName("세션 생성 성공") + @Test + void success_createLecture() throws Exception { + // given + LectureRequestDTO request = lectureRequest(); + long response = lectureId(); + + doReturn(response).when(lectureService).createLecture(any()); + + // when + ResultActions resultActions = mockMvc.perform( + MockMvcRequestBuilders.post(DEFAULT_URI) + .contentType(MediaType.APPLICATION_JSON) + .content(new Gson().toJson(request))); + + // then + resultActions.andExpect(status().isCreated()); + } + + @DisplayName("세션 목록 조회 성공") + @Test + void success_getLectureList() throws Exception { + // given + LecturesResponseDTO response = lecturesResponse(); + MultiValueMap queries = new LinkedMultiValueMap<>(); + queries.add("generation", String.valueOf(LECTURE_GENERATION)); + + doReturn(response).when(lectureService).getLecturesByGeneration(anyInt(), any()); + + // when + ResultActions resultActions = mockMvc.perform( + MockMvcRequestBuilders.get(DEFAULT_URI) + .queryParams(queries)); + + // then + resultActions.andExpect(status().isOk()); + } + + @DisplayName("세션 단일 조회 성공") + @Test + void success_getLecture() throws Exception { + // given + LectureResponseDTO response = lectureResponse(); + + doReturn(response).when(lectureService).getLecture(anyLong()); + + // when + ResultActions resultActions = mockMvc.perform( + MockMvcRequestBuilders.get(DEFAULT_URI + "/{lectureId}", anyLong())); + + // then + resultActions.andExpect(status().isOk()); + } + + @DisplayName("출석 시작 성공") + @Test + void success_startAttendance() throws Exception { + // given + AttendanceRequestDTO request = attendanceRequest(); + AttendanceResponseDTO response = attendanceResponse(); + + doReturn(response).when(lectureService).startAttendance(any()); + + // when + ResultActions resultActions = mockMvc.perform( + MockMvcRequestBuilders.patch(DEFAULT_URI + "/attendance") + .contentType(MediaType.APPLICATION_JSON) + .content(new Gson().toJson(request))); + + // then + resultActions.andExpect(status().isCreated()); + } + + @DisplayName("출석 종료 성공") + @Test + void success_finishLecture() throws Exception { + // when + ResultActions resultActions = mockMvc.perform( + MockMvcRequestBuilders.patch(DEFAULT_URI + "/{lectureId}", anyLong())); + + // then + resultActions.andExpect(status().isOk()); + } + + @DisplayName("세션 삭제 성공") + @Test + void success_deleteLecture() throws Exception { + // when + ResultActions resultActions = mockMvc.perform( + MockMvcRequestBuilders.delete(DEFAULT_URI + "/{lectureId}", anyLong())); + + // then + resultActions.andExpect(status().isOk()); + } + + @DisplayName("세션 상세 조회 성공") + @Test + void success_getLectureDetail() throws Exception { + // given + LectureDetailResponseDTO response = lectureDetail(); + + doReturn(response).when(lectureService).getLectureDetail(anyLong()); + + // when + ResultActions resultActions = mockMvc.perform( + MockMvcRequestBuilders.get(DEFAULT_URI + "/detail/{lectureId}", anyLong())); + + // then + resultActions.andExpect(status().isOk()); + } + + private LectureRequestDTO lectureRequest() { + return LectureRequestDTO.builder() + .part(LECTURE_PART) + .name(LECTURE_NAME) + .generation(LECTURE_GENERATION) + .place(LECTURE_PLACE) + .startDate(NOW.toString()) + .endDate(NOW.plusHours(4).toString()) + .attribute(LECTURE_ATTRIBUTE) + .build(); + } + + private long lectureId() { + return 0L; + } + + private LecturesResponseDTO lecturesResponse() { + return new LecturesResponseDTO(LECTURE_GENERATION, lectures()); + } + + private List lectures() { + return Stream.iterate(1, i -> i + 1).limit(LIST_SIZE) + .map(this::lecture).toList(); + } + + private LectureVO lecture(int i) { + return LectureVO.builder() + .lectureId(0L) + .name(LECTURE_NAME + i) + .partValue(Part.ALL) + .partName(Part.ALL.getName()) + .startDate(NOW.plusHours(i).toString()) + .endDate(NOW.plusHours(i + 4).toString()) + .attributeValue(LECTURE_ATTRIBUTE) + .attributeName(LECTURE_ATTRIBUTE.getName()) + .place(LECTURE_PLACE + i) + .attendances(attendancesStatus()) + .build(); + } + + private LectureResponseDTO lectureResponse() { + return LectureResponseDTO.builder() + .lectureId(0L) + .name(LECTURE_NAME) + .generation(LECTURE_GENERATION) + .part(LECTURE_PART) + .attribute(LECTURE_ATTRIBUTE) + .subLectures(subLectures()) + .attendances(attendancesStatus()) + .status(LECTURE_STATUS) + .build(); + } + + private AttendancesStatusVO attendancesStatus() { + return AttendancesStatusVO.builder() + .attendance(80) + .absent(0) + .tardy(10) + .unknown(10) + .build(); + } + + private List subLectures() { + return Stream.iterate(1, i -> i + 1).limit(LIST_SIZE) + .map(this::subLecture).toList(); + } + + private SubLectureVO subLecture(int i) { + return SubLectureVO.builder() + .subLectureId((long)i) + .round(i % 2) + .startAt(NOW.toString()) + .code(SUB_LECTURE_CODE) + .build(); + } + + private AttendanceResponseDTO attendanceResponse() { + return new AttendanceResponseDTO(0L, 0L); + } + + private AttendanceRequestDTO attendanceRequest() { + return new AttendanceRequestDTO(0L, 0, SUB_LECTURE_CODE); + } + + private LectureDetailResponseDTO lectureDetail() { + return LectureDetailResponseDTO.builder() + .lectureId(0L) + .part(LECTURE_PART.getName()) + .name(LECTURE_NAME) + .place(LECTURE_PLACE) + .attribute(LECTURE_ATTRIBUTE.getName()) + .startDate(NOW.toString()) + .endDate(NOW.plusHours(4).toString()) + .generation(LECTURE_GENERATION) + .build(); + } +} \ No newline at end of file From 91700e1b08fce7e048cdd2b6d4a5fa2a8425d902 Mon Sep 17 00:00:00 2001 From: thguss Date: Fri, 19 Jan 2024 01:33:55 +0900 Subject: [PATCH 004/141] =?UTF-8?q?[REFACTOR]=20=EC=84=B8=EC=85=98=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1=20=EB=A6=AC=ED=8C=A9=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../member/MemberCustomRepository.java | 1 + .../member/MemberRepositoryImpl.java | 15 +- .../operation/service/LectureServiceImpl.java | 179 ++++++++++-------- 3 files changed, 113 insertions(+), 82 deletions(-) diff --git a/src/main/java/org/sopt/makers/operation/repository/member/MemberCustomRepository.java b/src/main/java/org/sopt/makers/operation/repository/member/MemberCustomRepository.java index 9c8c2a84..e54fd4b3 100644 --- a/src/main/java/org/sopt/makers/operation/repository/member/MemberCustomRepository.java +++ b/src/main/java/org/sopt/makers/operation/repository/member/MemberCustomRepository.java @@ -13,4 +13,5 @@ public interface MemberCustomRepository { List search(MemberSearchCondition condition); Optional find(Long memberId); int countByGenerationAndPart(int generation, Part part); + List find(int generation, Part part); } diff --git a/src/main/java/org/sopt/makers/operation/repository/member/MemberRepositoryImpl.java b/src/main/java/org/sopt/makers/operation/repository/member/MemberRepositoryImpl.java index b5259490..4bfc6858 100644 --- a/src/main/java/org/sopt/makers/operation/repository/member/MemberRepositoryImpl.java +++ b/src/main/java/org/sopt/makers/operation/repository/member/MemberRepositoryImpl.java @@ -80,7 +80,20 @@ public int countByGenerationAndPart(int generation, Part part) { .fetchFirst()); } + @Override + public List find(int generation, Part part) { + StringExpression firstName = Expressions.stringTemplate("SUBSTR({0}, 1, 1)", member.name); + + return queryFactory + .selectFrom(member) + .where( + member.generation.eq(generation), + partEq(part)) + .orderBy(firstName.asc()) + .fetch(); + } + private BooleanExpression partEq(Part part) { - return nonNull(part) ? member.part.eq(part) : null; + return (isNull(part) || part.equals(ALL)) ? null : member.part.eq(part); } } diff --git a/src/main/java/org/sopt/makers/operation/service/LectureServiceImpl.java b/src/main/java/org/sopt/makers/operation/service/LectureServiceImpl.java index 6f405fde..f23bac6b 100644 --- a/src/main/java/org/sopt/makers/operation/service/LectureServiceImpl.java +++ b/src/main/java/org/sopt/makers/operation/service/LectureServiceImpl.java @@ -3,7 +3,6 @@ import static java.util.Objects.nonNull; import static org.sopt.makers.operation.common.ExceptionMessage.*; import static org.sopt.makers.operation.entity.AttendanceStatus.*; -import static org.sopt.makers.operation.entity.Part.*; import static org.sopt.makers.operation.entity.alarm.Attribute.*; import static org.sopt.makers.operation.entity.lecture.LectureStatus.*; @@ -22,7 +21,6 @@ import org.sopt.makers.operation.dto.lecture.LectureRequestDTO; import org.sopt.makers.operation.dto.lecture.LectureResponseDTO; import org.sopt.makers.operation.dto.lecture.LecturesResponseDTO; -import org.sopt.makers.operation.dto.member.MemberSearchCondition; import org.sopt.makers.operation.entity.*; import org.sopt.makers.operation.entity.lecture.Attribute; import org.sopt.makers.operation.entity.lecture.Lecture; @@ -55,90 +53,52 @@ public class LectureServiceImpl implements LectureService { @Value("${sopt.alarm.message.content_end}") private String ALARM_MESSAGE_CONTENT; - @Override - @Transactional - public Long createLecture(LectureRequestDTO requestDTO) { - // 세션 생성 - Lecture savedLecture = lectureRepository.save(requestDTO.toEntity()); - - // 출석 세션 2개 생성 - Stream.iterate(1, i -> i + 1).limit(2) - .forEach(i -> subLectureRepository.save(new SubLecture(savedLecture, i))); - - // 출석 생성 - memberRepository - .search(getMemberSearchCondition(requestDTO)) - .forEach(member -> attendanceRepository.save(new Attendance(member, savedLecture))); - - // 서브 출석 생성 - savedLecture.getAttendances() - .forEach(attendance -> savedLecture.getSubLectures() - .forEach(subLecture -> subAttendanceRepository.save(new SubAttendance(attendance, subLecture)))); + private final int SUB_LECTURE_MAX_ROUND = 2; + /** WEB **/ + @Override + @Transactional + public Long createLecture(LectureRequestDTO request) { + val savedLecture = saveLecture(request); + createSubLectures(savedLecture); + createAttendance(request.generation(), request.part(), savedLecture); + createSubAttendances(savedLecture); return savedLecture.getId(); } - @Override - public LectureGetResponseDTO getCurrentLecture(Long playGroundId) { - val now = LocalDateTime.now(); - - val attendances = attendanceRepository.findCurrentAttendanceByMember(playGroundId); - - if (attendances.isEmpty()) { - return new LectureGetResponseDTO(LectureResponseType.NO_SESSION, 0L, "", "", "", "", "", Collections.emptyList()); - } - - if (attendances.size() > 2) { - throw new LectureException(INVALID_COUNT_SESSION.getName()); - } - - // 현재 출석과 Lecture 가져오기 - val currentAttendance = getCurrentAttendance(attendances, now); - val currentLecture = currentAttendance.getLecture(); - val lectureType = getLectureResponseType(currentLecture); - - if (lectureType.equals(LectureResponseType.NO_ATTENDANCE)) { - val message = "출석 점수가 반영되지 않아요."; - return LectureGetResponseDTO.of(lectureType, currentLecture, message, Collections.emptyList()); - } - - val subAttendances = attendanceRepository.findSubAttendanceByAttendanceId(currentAttendance.getId()); - - val firstSubLectureAttendance = subAttendances.get(0); - val secondSubLectureAttendance = subAttendances.get(1); + private Lecture saveLecture(LectureRequestDTO request) { + val lecture = request.toEntity(); + return lectureRepository.save(lecture); + } - val firstSubLectureAttendanceStatus = firstSubLectureAttendance.getStatus(); - val secondSubLectureAttendanceStatus = secondSubLectureAttendance.getStatus(); + private void createSubLectures(Lecture lecture) { + Stream.iterate(1, i -> i + 1).limit(SUB_LECTURE_MAX_ROUND) + .forEach(round -> saveSubLecture(lecture, round)); + } - val firstSessionStart = firstSubLectureAttendance.getSubLecture().getStartAt(); - val secondSessionStart = secondSubLectureAttendance.getSubLecture().getStartAt(); + private void saveSubLecture(Lecture lecture, int round) { + subLectureRepository.save(new SubLecture(lecture, round)); + } - val message = (currentLecture.getAttribute() == Attribute.SEMINAR) ? "" : "행사도 참여하고, 출석점수도 받고, 일석이조!"; + private void createAttendance(int generation, Part part, Lecture lecture) { + memberRepository.find(generation, part).forEach(member -> saveAttendance(member, lecture)); + } - // Lecture 시작 전 혹은 1차 출석 시작 전 - if (now.isBefore(currentLecture.getStartDate()) || !nonNull(firstSessionStart)) { - return LectureGetResponseDTO.of(lectureType, currentLecture, message, Collections.emptyList()); - } + private void saveAttendance(Member member, Lecture lecture) { + attendanceRepository.save(new Attendance(member, lecture)); + } - // 1차 출석 시작, 2차 출석 시작 전 - if (now.isAfter(firstSessionStart) && !nonNull(secondSessionStart)) { - // 1차 출석 중 결석인 상태 - if (now.isBefore(firstSessionStart.plusMinutes(10)) && firstSubLectureAttendanceStatus.equals(ABSENT)) { - return LectureGetResponseDTO.of(lectureType, currentLecture, message, Collections.emptyList()); - } + private void createSubAttendances(Lecture lecture) { + lecture.getAttendances().forEach(this::saveSubAttendances); + } - return LectureGetResponseDTO.of(lectureType, currentLecture, message, Collections.singletonList(firstSubLectureAttendance)); - } + private void saveSubAttendances(Attendance attendance) { + attendance.getLecture().getSubLectures().forEach(subLecture -> saveSubAttendance(attendance, subLecture)); + } - // 2차 출석 시작 이후 - if (now.isAfter(secondSessionStart)) { - // 2차 출석 중 결석인 상태 - if (now.isBefore(secondSessionStart.plusMinutes(10)) && secondSubLectureAttendanceStatus.equals(ABSENT)) { - return LectureGetResponseDTO.of(lectureType, currentLecture, message, Collections.singletonList(firstSubLectureAttendance)); - } - } - return LectureGetResponseDTO.of(lectureType, currentLecture, message, subAttendances); + private void saveSubAttendance(Attendance attendance, SubLecture subLecture) { + subAttendanceRepository.save(new SubAttendance(attendance, subLecture)); } @Override @@ -194,6 +154,8 @@ public void finishLecture(Long lectureId) { alarmSender.send(new AlarmSenderDTO(alarmTitle, ALARM_MESSAGE_CONTENT, memberPgIds, NEWS, null)); } + /** APP **/ + @Override @Transactional public void finishLecture() { @@ -215,6 +177,68 @@ public void finishLecture() { } } + @Override + public LectureGetResponseDTO getCurrentLecture(Long playGroundId) { + val now = LocalDateTime.now(); + + val attendances = attendanceRepository.findCurrentAttendanceByMember(playGroundId); + + if (attendances.isEmpty()) { + return new LectureGetResponseDTO(LectureResponseType.NO_SESSION, 0L, "", "", "", "", "", Collections.emptyList()); + } + + if (attendances.size() > 2) { + throw new LectureException(INVALID_COUNT_SESSION.getName()); + } + + // 현재 출석과 Lecture 가져오기 + val currentAttendance = getCurrentAttendance(attendances, now); + val currentLecture = currentAttendance.getLecture(); + val lectureType = getLectureResponseType(currentLecture); + + if (lectureType.equals(LectureResponseType.NO_ATTENDANCE)) { + val message = "출석 점수가 반영되지 않아요."; + return LectureGetResponseDTO.of(lectureType, currentLecture, message, Collections.emptyList()); + } + + val subAttendances = attendanceRepository.findSubAttendanceByAttendanceId(currentAttendance.getId()); + + val firstSubLectureAttendance = subAttendances.get(0); + val secondSubLectureAttendance = subAttendances.get(1); + + val firstSubLectureAttendanceStatus = firstSubLectureAttendance.getStatus(); + val secondSubLectureAttendanceStatus = secondSubLectureAttendance.getStatus(); + + val firstSessionStart = firstSubLectureAttendance.getSubLecture().getStartAt(); + val secondSessionStart = secondSubLectureAttendance.getSubLecture().getStartAt(); + + val message = (currentLecture.getAttribute() == Attribute.SEMINAR) ? "" : "행사도 참여하고, 출석점수도 받고, 일석이조!"; + + // Lecture 시작 전 혹은 1차 출석 시작 전 + if (now.isBefore(currentLecture.getStartDate()) || !nonNull(firstSessionStart)) { + return LectureGetResponseDTO.of(lectureType, currentLecture, message, Collections.emptyList()); + } + + // 1차 출석 시작, 2차 출석 시작 전 + if (now.isAfter(firstSessionStart) && !nonNull(secondSessionStart)) { + // 1차 출석 중 결석인 상태 + if (now.isBefore(firstSessionStart.plusMinutes(10)) && firstSubLectureAttendanceStatus.equals(ABSENT)) { + return LectureGetResponseDTO.of(lectureType, currentLecture, message, Collections.emptyList()); + } + + return LectureGetResponseDTO.of(lectureType, currentLecture, message, Collections.singletonList(firstSubLectureAttendance)); + } + + // 2차 출석 시작 이후 + if (now.isAfter(secondSessionStart)) { + // 2차 출석 중 결석인 상태 + if (now.isBefore(secondSessionStart.plusMinutes(10)) && secondSubLectureAttendanceStatus.equals(ABSENT)) { + return LectureGetResponseDTO.of(lectureType, currentLecture, message, Collections.singletonList(firstSubLectureAttendance)); + } + } + return LectureGetResponseDTO.of(lectureType, currentLecture, message, subAttendances); + } + @Override public LectureCurrentRoundResponseDTO getCurrentLectureRound(Long lectureId) { val now = LocalDateTime.now(); @@ -288,13 +312,6 @@ public LectureDetailResponseDTO getLectureDetail(Long lectureId) { return LectureDetailResponseDTO.of(lecture); } - private MemberSearchCondition getMemberSearchCondition(LectureRequestDTO requestDTO) { - return new MemberSearchCondition( - !requestDTO.part().equals(ALL) ? requestDTO.part() : null, - requestDTO.generation() - ); - } - private Lecture findLecture(Long id) { return lectureRepository.findById(id) .orElseThrow(() -> new LectureException(INVALID_LECTURE.getName())); From de15bd5890a1144e93ef791ac718616e02a33d6d Mon Sep 17 00:00:00 2001 From: thguss Date: Fri, 19 Jan 2024 01:34:33 +0900 Subject: [PATCH 005/141] =?UTF-8?q?[REFACTOR]=20=EC=84=B8=EC=85=98=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1=20=EB=A6=AC=ED=8C=A9=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/sopt/makers/operation/service/LectureService.java | 2 +- .../org/sopt/makers/operation/service/LectureServiceImpl.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/sopt/makers/operation/service/LectureService.java b/src/main/java/org/sopt/makers/operation/service/LectureService.java index 910aadc1..04e033a3 100644 --- a/src/main/java/org/sopt/makers/operation/service/LectureService.java +++ b/src/main/java/org/sopt/makers/operation/service/LectureService.java @@ -10,7 +10,7 @@ import org.sopt.makers.operation.dto.lecture.*; public interface LectureService { - Long createLecture(LectureRequestDTO requestDTO); + long createLecture(LectureRequestDTO requestDTO); LectureGetResponseDTO getCurrentLecture(Long playGroundId); LecturesResponseDTO getLecturesByGeneration(int generation, Part part); LectureResponseDTO getLecture(Long lectureId); diff --git a/src/main/java/org/sopt/makers/operation/service/LectureServiceImpl.java b/src/main/java/org/sopt/makers/operation/service/LectureServiceImpl.java index f23bac6b..3beadafe 100644 --- a/src/main/java/org/sopt/makers/operation/service/LectureServiceImpl.java +++ b/src/main/java/org/sopt/makers/operation/service/LectureServiceImpl.java @@ -59,7 +59,7 @@ public class LectureServiceImpl implements LectureService { @Override @Transactional - public Long createLecture(LectureRequestDTO request) { + public long createLecture(LectureRequestDTO request) { val savedLecture = saveLecture(request); createSubLectures(savedLecture); createAttendance(request.generation(), request.part(), savedLecture); From f4df0630df46c780478e26ea8f2f5deb6dae7442 Mon Sep 17 00:00:00 2001 From: thguss Date: Fri, 19 Jan 2024 10:55:37 +0900 Subject: [PATCH 006/141] =?UTF-8?q?[REFACTOR]=20Value=20=EA=B0=92=20?= =?UTF-8?q?=ED=95=9C=20=ED=81=B4=EB=9E=98=EC=8A=A4=20=EB=82=B4=EC=97=90?= =?UTF-8?q?=EC=84=9C=20=EA=B4=80=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../makers/operation/config/ValueConfig.java | 17 ++++++++++++++++ .../operation/service/LectureServiceImpl.java | 20 +++++++------------ 2 files changed, 24 insertions(+), 13 deletions(-) create mode 100644 src/main/java/org/sopt/makers/operation/config/ValueConfig.java diff --git a/src/main/java/org/sopt/makers/operation/config/ValueConfig.java b/src/main/java/org/sopt/makers/operation/config/ValueConfig.java new file mode 100644 index 00000000..a94b0438 --- /dev/null +++ b/src/main/java/org/sopt/makers/operation/config/ValueConfig.java @@ -0,0 +1,17 @@ +package org.sopt.makers.operation.config; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Configuration; + +import lombok.Getter; + +@Configuration +@Getter +public class ValueConfig { + @Value("${sopt.alarm.message.title_end}") + private String ALARM_MESSAGE_TITLE; + @Value("${sopt.alarm.message.content_end}") + private String ALARM_MESSAGE_CONTENT; + + private final int SUB_LECTURE_MAX_ROUND = 2; +} diff --git a/src/main/java/org/sopt/makers/operation/service/LectureServiceImpl.java b/src/main/java/org/sopt/makers/operation/service/LectureServiceImpl.java index 3beadafe..6b09b1ec 100644 --- a/src/main/java/org/sopt/makers/operation/service/LectureServiceImpl.java +++ b/src/main/java/org/sopt/makers/operation/service/LectureServiceImpl.java @@ -13,6 +13,7 @@ import lombok.val; +import org.sopt.makers.operation.config.ValueConfig; import org.sopt.makers.operation.dto.alarm.AlarmSenderDTO; import org.sopt.makers.operation.dto.lecture.*; @@ -31,7 +32,6 @@ import org.sopt.makers.operation.repository.lecture.LectureRepository; import org.sopt.makers.operation.repository.lecture.SubLectureRepository; import org.sopt.makers.operation.repository.member.MemberRepository; -import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -47,13 +47,7 @@ public class LectureServiceImpl implements LectureService { private final SubAttendanceRepository subAttendanceRepository; private final MemberRepository memberRepository; private final AlarmSender alarmSender; - - @Value("${sopt.alarm.message.title_end}") - private String ALARM_MESSAGE_TITLE; - @Value("${sopt.alarm.message.content_end}") - private String ALARM_MESSAGE_CONTENT; - - private final int SUB_LECTURE_MAX_ROUND = 2; + private final ValueConfig valueConfig; /** WEB **/ @@ -73,7 +67,7 @@ private Lecture saveLecture(LectureRequestDTO request) { } private void createSubLectures(Lecture lecture) { - Stream.iterate(1, i -> i + 1).limit(SUB_LECTURE_MAX_ROUND) + Stream.iterate(1, i -> i + 1).limit(valueConfig.getSUB_LECTURE_MAX_ROUND()) .forEach(round -> saveSubLecture(lecture, round)); } @@ -150,8 +144,8 @@ public void finishLecture(Long lectureId) { .filter(id -> !id.equals("null")) .toList(); - val alarmTitle = lecture.getName() + " " + ALARM_MESSAGE_TITLE; - alarmSender.send(new AlarmSenderDTO(alarmTitle, ALARM_MESSAGE_CONTENT, memberPgIds, NEWS, null)); + val alarmTitle = lecture.getName() + " " + valueConfig.getALARM_MESSAGE_TITLE(); + alarmSender.send(new AlarmSenderDTO(alarmTitle, valueConfig.getALARM_MESSAGE_CONTENT(), memberPgIds, NEWS, null)); } /** APP **/ @@ -172,8 +166,8 @@ public void finishLecture() { } } - val alarmTitle = lecture.getName() + " " + ALARM_MESSAGE_TITLE; - alarmSender.send(new AlarmSenderDTO(alarmTitle, ALARM_MESSAGE_CONTENT, memberPgIds, NEWS, null)); + val alarmTitle = lecture.getName() + " " + valueConfig.getALARM_MESSAGE_TITLE(); + alarmSender.send(new AlarmSenderDTO(alarmTitle, valueConfig.getALARM_MESSAGE_CONTENT(), memberPgIds, NEWS, null)); } } From 1f21149e59efbc87859f7b41b40d7769847fcfb2 Mon Sep 17 00:00:00 2001 From: thguss Date: Fri, 19 Jan 2024 10:57:00 +0900 Subject: [PATCH 007/141] =?UTF-8?q?[REFACTOR]=20=ED=95=9C=20=EC=A4=84=20?= =?UTF-8?q?=EB=9D=84=EC=9A=B0=EA=B3=A0=20=EC=8B=9C=EC=9E=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sopt/makers/operation/config/ValueConfig.java | 1 + .../makers/operation/service/LectureService.java | 1 + .../operation/service/LectureServiceImpl.java | 1 + .../operation/service/LectureServiceImplTest.java | 13 +++++++++++++ 4 files changed, 16 insertions(+) create mode 100644 src/test/java/org/sopt/makers/operation/service/LectureServiceImplTest.java diff --git a/src/main/java/org/sopt/makers/operation/config/ValueConfig.java b/src/main/java/org/sopt/makers/operation/config/ValueConfig.java index a94b0438..9c36a59e 100644 --- a/src/main/java/org/sopt/makers/operation/config/ValueConfig.java +++ b/src/main/java/org/sopt/makers/operation/config/ValueConfig.java @@ -8,6 +8,7 @@ @Configuration @Getter public class ValueConfig { + @Value("${sopt.alarm.message.title_end}") private String ALARM_MESSAGE_TITLE; @Value("${sopt.alarm.message.content_end}") diff --git a/src/main/java/org/sopt/makers/operation/service/LectureService.java b/src/main/java/org/sopt/makers/operation/service/LectureService.java index 04e033a3..f74532e7 100644 --- a/src/main/java/org/sopt/makers/operation/service/LectureService.java +++ b/src/main/java/org/sopt/makers/operation/service/LectureService.java @@ -10,6 +10,7 @@ import org.sopt.makers.operation.dto.lecture.*; public interface LectureService { + long createLecture(LectureRequestDTO requestDTO); LectureGetResponseDTO getCurrentLecture(Long playGroundId); LecturesResponseDTO getLecturesByGeneration(int generation, Part part); diff --git a/src/main/java/org/sopt/makers/operation/service/LectureServiceImpl.java b/src/main/java/org/sopt/makers/operation/service/LectureServiceImpl.java index 6b09b1ec..831b0770 100644 --- a/src/main/java/org/sopt/makers/operation/service/LectureServiceImpl.java +++ b/src/main/java/org/sopt/makers/operation/service/LectureServiceImpl.java @@ -41,6 +41,7 @@ @RequiredArgsConstructor @Transactional(readOnly = true) public class LectureServiceImpl implements LectureService { + private final LectureRepository lectureRepository; private final SubLectureRepository subLectureRepository; private final AttendanceRepository attendanceRepository; diff --git a/src/test/java/org/sopt/makers/operation/service/LectureServiceImplTest.java b/src/test/java/org/sopt/makers/operation/service/LectureServiceImplTest.java new file mode 100644 index 00000000..1085bfe4 --- /dev/null +++ b/src/test/java/org/sopt/makers/operation/service/LectureServiceImplTest.java @@ -0,0 +1,13 @@ +package org.sopt.makers.operation.service; + +import static org.junit.jupiter.api.Assertions.*; + +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.InjectMocks; +import org.mockito.junit.jupiter.MockitoExtension; + +@ExtendWith(MockitoExtension.class) +class LectureServiceImplTest { + + @InjectMocks +} \ No newline at end of file From bbe6a4200fddaa4acfb62617bd47604a71cae856 Mon Sep 17 00:00:00 2001 From: thguss Date: Fri, 19 Jan 2024 11:05:43 +0900 Subject: [PATCH 008/141] =?UTF-8?q?[TEST]=20=EC=84=B8=EC=85=98=20=EC=BB=A8?= =?UTF-8?q?=ED=8A=B8=EB=A1=A4=EB=9F=AC=20=ED=85=8C=EC=8A=A4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/web/LectureControllerTest.java | 105 +----------------- 1 file changed, 1 insertion(+), 104 deletions(-) diff --git a/src/test/java/org/sopt/makers/operation/controller/web/LectureControllerTest.java b/src/test/java/org/sopt/makers/operation/controller/web/LectureControllerTest.java index bf22b432..0197a2d4 100644 --- a/src/test/java/org/sopt/makers/operation/controller/web/LectureControllerTest.java +++ b/src/test/java/org/sopt/makers/operation/controller/web/LectureControllerTest.java @@ -1,9 +1,5 @@ package org.sopt.makers.operation.controller.web; -import java.time.LocalDateTime; -import java.util.List; -import java.util.stream.Stream; - import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; @@ -13,16 +9,10 @@ import org.mockito.junit.jupiter.MockitoExtension; import org.sopt.makers.operation.dto.lecture.AttendanceRequestDTO; import org.sopt.makers.operation.dto.lecture.AttendanceResponseDTO; -import org.sopt.makers.operation.dto.lecture.AttendancesStatusVO; import org.sopt.makers.operation.dto.lecture.LectureDetailResponseDTO; import org.sopt.makers.operation.dto.lecture.LectureRequestDTO; import org.sopt.makers.operation.dto.lecture.LectureResponseDTO; -import org.sopt.makers.operation.dto.lecture.LectureResponseDTO.SubLectureVO; import org.sopt.makers.operation.dto.lecture.LecturesResponseDTO; -import org.sopt.makers.operation.dto.lecture.LecturesResponseDTO.LectureVO; -import org.sopt.makers.operation.entity.Part; -import org.sopt.makers.operation.entity.lecture.Attribute; -import org.sopt.makers.operation.entity.lecture.LectureStatus; import org.sopt.makers.operation.service.LectureService; import org.springframework.http.MediaType; import org.springframework.test.web.servlet.MockMvc; @@ -33,6 +23,7 @@ import org.springframework.util.MultiValueMap; import static org.mockito.Mockito.*; +import static org.sopt.makers.operation.fixture.LectureFixture.*; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; import com.google.gson.Gson; @@ -48,15 +39,6 @@ class LectureControllerTest { private MockMvc mockMvc; private final String DEFAULT_URI = "/api/v1/lectures"; - private final String LECTURE_NAME = "테스트 이름"; - private final Part LECTURE_PART = Part.ALL; - private final int LECTURE_GENERATION = 30; - private final String LECTURE_PLACE = "테스트 장소"; - private final LocalDateTime NOW = LocalDateTime.now(); - private final Attribute LECTURE_ATTRIBUTE = Attribute.ETC; - private final LectureStatus LECTURE_STATUS = LectureStatus.BEFORE; - private final int LIST_SIZE = 5; - private final String SUB_LECTURE_CODE = "code"; @BeforeEach public void init() { @@ -185,89 +167,4 @@ private LectureRequestDTO lectureRequest() { .attribute(LECTURE_ATTRIBUTE) .build(); } - - private long lectureId() { - return 0L; - } - - private LecturesResponseDTO lecturesResponse() { - return new LecturesResponseDTO(LECTURE_GENERATION, lectures()); - } - - private List lectures() { - return Stream.iterate(1, i -> i + 1).limit(LIST_SIZE) - .map(this::lecture).toList(); - } - - private LectureVO lecture(int i) { - return LectureVO.builder() - .lectureId(0L) - .name(LECTURE_NAME + i) - .partValue(Part.ALL) - .partName(Part.ALL.getName()) - .startDate(NOW.plusHours(i).toString()) - .endDate(NOW.plusHours(i + 4).toString()) - .attributeValue(LECTURE_ATTRIBUTE) - .attributeName(LECTURE_ATTRIBUTE.getName()) - .place(LECTURE_PLACE + i) - .attendances(attendancesStatus()) - .build(); - } - - private LectureResponseDTO lectureResponse() { - return LectureResponseDTO.builder() - .lectureId(0L) - .name(LECTURE_NAME) - .generation(LECTURE_GENERATION) - .part(LECTURE_PART) - .attribute(LECTURE_ATTRIBUTE) - .subLectures(subLectures()) - .attendances(attendancesStatus()) - .status(LECTURE_STATUS) - .build(); - } - - private AttendancesStatusVO attendancesStatus() { - return AttendancesStatusVO.builder() - .attendance(80) - .absent(0) - .tardy(10) - .unknown(10) - .build(); - } - - private List subLectures() { - return Stream.iterate(1, i -> i + 1).limit(LIST_SIZE) - .map(this::subLecture).toList(); - } - - private SubLectureVO subLecture(int i) { - return SubLectureVO.builder() - .subLectureId((long)i) - .round(i % 2) - .startAt(NOW.toString()) - .code(SUB_LECTURE_CODE) - .build(); - } - - private AttendanceResponseDTO attendanceResponse() { - return new AttendanceResponseDTO(0L, 0L); - } - - private AttendanceRequestDTO attendanceRequest() { - return new AttendanceRequestDTO(0L, 0, SUB_LECTURE_CODE); - } - - private LectureDetailResponseDTO lectureDetail() { - return LectureDetailResponseDTO.builder() - .lectureId(0L) - .part(LECTURE_PART.getName()) - .name(LECTURE_NAME) - .place(LECTURE_PLACE) - .attribute(LECTURE_ATTRIBUTE.getName()) - .startDate(NOW.toString()) - .endDate(NOW.plusHours(4).toString()) - .generation(LECTURE_GENERATION) - .build(); - } } \ No newline at end of file From 45692df9b5fef9962ffa25e2bdbf2334ab33f2df Mon Sep 17 00:00:00 2001 From: thguss Date: Fri, 19 Jan 2024 11:05:49 +0900 Subject: [PATCH 009/141] =?UTF-8?q?[TEST]=20=EC=84=B8=EC=85=98=20=EC=BB=A8?= =?UTF-8?q?=ED=8A=B8=EB=A1=A4=EB=9F=AC=20=ED=85=8C=EC=8A=A4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operation/fixture/LectureFixture.java | 113 ++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 src/test/java/org/sopt/makers/operation/fixture/LectureFixture.java diff --git a/src/test/java/org/sopt/makers/operation/fixture/LectureFixture.java b/src/test/java/org/sopt/makers/operation/fixture/LectureFixture.java new file mode 100644 index 00000000..91ca8cd8 --- /dev/null +++ b/src/test/java/org/sopt/makers/operation/fixture/LectureFixture.java @@ -0,0 +1,113 @@ +package org.sopt.makers.operation.fixture; + +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Stream; + +import org.sopt.makers.operation.dto.lecture.AttendanceRequestDTO; +import org.sopt.makers.operation.dto.lecture.AttendanceResponseDTO; +import org.sopt.makers.operation.dto.lecture.AttendancesStatusVO; +import org.sopt.makers.operation.dto.lecture.LectureDetailResponseDTO; +import org.sopt.makers.operation.dto.lecture.LectureResponseDTO; +import org.sopt.makers.operation.dto.lecture.LecturesResponseDTO; +import org.sopt.makers.operation.entity.Part; +import org.sopt.makers.operation.entity.lecture.Attribute; +import org.sopt.makers.operation.entity.lecture.LectureStatus; + +public class LectureFixture { + + public static final String LECTURE_NAME = "테스트 이름"; + public static final Part LECTURE_PART = Part.ALL; + public static final int LECTURE_GENERATION = 30; + public static final String LECTURE_PLACE = "테스트 장소"; + public static final LocalDateTime NOW = LocalDateTime.now(); + public static final Attribute LECTURE_ATTRIBUTE = Attribute.ETC; + public static final LectureStatus LECTURE_STATUS = LectureStatus.BEFORE; + public static final int LIST_SIZE = 5; + public static final String SUB_LECTURE_CODE = "code"; + + public static long lectureId() { + return 0L; + } + + public static LecturesResponseDTO lecturesResponse() { + return new LecturesResponseDTO(LECTURE_GENERATION, lectures()); + } + + private static List lectures() { + return Stream.iterate(1, i -> i + 1).limit(LIST_SIZE) + .map(LectureFixture::lecture).toList(); + } + + private static LecturesResponseDTO.LectureVO lecture(int i) { + return LecturesResponseDTO.LectureVO.builder() + .lectureId(0L) + .name(LECTURE_NAME + i) + .partValue(Part.ALL) + .partName(Part.ALL.getName()) + .startDate(NOW.plusHours(i).toString()) + .endDate(NOW.plusHours(i + 4).toString()) + .attributeValue(LECTURE_ATTRIBUTE) + .attributeName(LECTURE_ATTRIBUTE.getName()) + .place(LECTURE_PLACE + i) + .attendances(attendancesStatus()) + .build(); + } + + public static LectureResponseDTO lectureResponse() { + return LectureResponseDTO.builder() + .lectureId(0L) + .name(LECTURE_NAME) + .generation(LECTURE_GENERATION) + .part(LECTURE_PART) + .attribute(LECTURE_ATTRIBUTE) + .subLectures(subLectures()) + .attendances(attendancesStatus()) + .status(LECTURE_STATUS) + .build(); + } + + private static AttendancesStatusVO attendancesStatus() { + return AttendancesStatusVO.builder() + .attendance(80) + .absent(0) + .tardy(10) + .unknown(10) + .build(); + } + + private static List subLectures() { + return Stream.iterate(1, i -> i + 1).limit(LIST_SIZE) + .map(LectureFixture::subLecture).toList(); + } + + private static LectureResponseDTO.SubLectureVO subLecture(int i) { + return LectureResponseDTO.SubLectureVO.builder() + .subLectureId((long)i) + .round(i % 2) + .startAt(NOW.toString()) + .code(SUB_LECTURE_CODE) + .build(); + } + + public static AttendanceResponseDTO attendanceResponse() { + return new AttendanceResponseDTO(0L, 0L); + } + + public static AttendanceRequestDTO attendanceRequest() { + return new AttendanceRequestDTO(0L, 0, SUB_LECTURE_CODE); + } + + public static LectureDetailResponseDTO lectureDetail() { + return LectureDetailResponseDTO.builder() + .lectureId(0L) + .part(LECTURE_PART.getName()) + .name(LECTURE_NAME) + .place(LECTURE_PLACE) + .attribute(LECTURE_ATTRIBUTE.getName()) + .startDate(NOW.toString()) + .endDate(NOW.plusHours(4).toString()) + .generation(LECTURE_GENERATION) + .build(); + } +} From 12ad5e5de398cacc96fd5597dc6d9b9b84aa9e6f Mon Sep 17 00:00:00 2001 From: thguss Date: Fri, 19 Jan 2024 12:16:13 +0900 Subject: [PATCH 010/141] =?UTF-8?q?[REFACTOR]=20=EC=84=B8=EC=85=98=20?= =?UTF-8?q?=EB=AA=A9=EB=A1=9D=20=EC=A1=B0=ED=9A=8C=20=EB=A6=AC=ED=8C=A9?= =?UTF-8?q?=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/web/LectureController.java | 4 +-- .../lecture/LectureCustomRepository.java | 2 +- .../lecture/LectureRepositoryImpl.java | 2 +- .../operation/service/LectureService.java | 2 +- .../operation/service/LectureServiceImpl.java | 4 +-- .../controller/web/LectureControllerTest.java | 15 ++------- .../operation/fixture/LectureFixture.java | 33 +++++++++++++++---- 7 files changed, 36 insertions(+), 26 deletions(-) diff --git a/src/main/java/org/sopt/makers/operation/controller/web/LectureController.java b/src/main/java/org/sopt/makers/operation/controller/web/LectureController.java index 43d57790..9cc4e264 100644 --- a/src/main/java/org/sopt/makers/operation/controller/web/LectureController.java +++ b/src/main/java/org/sopt/makers/operation/controller/web/LectureController.java @@ -45,8 +45,8 @@ public ResponseEntity createLecture(@RequestBody LectureRequestDTO @ApiOperation(value = "세션 리스트 조회") @GetMapping - public ResponseEntity getLecturesByGeneration(@RequestParam int generation, @RequestParam(required = false) Part part) { - val response = lectureService.getLecturesByGeneration(generation, part); + public ResponseEntity getLectures(@RequestParam int generation, @RequestParam(required = false) Part part) { + val response = lectureService.getLectures(generation, part); return ResponseEntity.ok(success(SUCCESS_GET_LECTURES.getMessage(), response)); } diff --git a/src/main/java/org/sopt/makers/operation/repository/lecture/LectureCustomRepository.java b/src/main/java/org/sopt/makers/operation/repository/lecture/LectureCustomRepository.java index b17ca536..64bf58ae 100644 --- a/src/main/java/org/sopt/makers/operation/repository/lecture/LectureCustomRepository.java +++ b/src/main/java/org/sopt/makers/operation/repository/lecture/LectureCustomRepository.java @@ -6,7 +6,7 @@ import java.util.Optional; public interface LectureCustomRepository { - List findLectures(int generation, Part part); + List find(int generation, Part part); List findLecturesToBeEnd(); Optional find(Long lectureId); } diff --git a/src/main/java/org/sopt/makers/operation/repository/lecture/LectureRepositoryImpl.java b/src/main/java/org/sopt/makers/operation/repository/lecture/LectureRepositoryImpl.java index 85772ee1..51960170 100644 --- a/src/main/java/org/sopt/makers/operation/repository/lecture/LectureRepositoryImpl.java +++ b/src/main/java/org/sopt/makers/operation/repository/lecture/LectureRepositoryImpl.java @@ -22,7 +22,7 @@ public class LectureRepositoryImpl implements LectureCustomRepository { private final JPAQueryFactory queryFactory; @Override - public List findLectures(int generation, Part part) { + public List find(int generation, Part part) { return queryFactory .selectFrom(lecture) .leftJoin(lecture.attendances, attendance).fetchJoin().distinct() diff --git a/src/main/java/org/sopt/makers/operation/service/LectureService.java b/src/main/java/org/sopt/makers/operation/service/LectureService.java index f74532e7..6a16ee0c 100644 --- a/src/main/java/org/sopt/makers/operation/service/LectureService.java +++ b/src/main/java/org/sopt/makers/operation/service/LectureService.java @@ -12,8 +12,8 @@ public interface LectureService { long createLecture(LectureRequestDTO requestDTO); + LecturesResponseDTO getLectures(int generation, Part part); LectureGetResponseDTO getCurrentLecture(Long playGroundId); - LecturesResponseDTO getLecturesByGeneration(int generation, Part part); LectureResponseDTO getLecture(Long lectureId); AttendanceResponseDTO startAttendance(AttendanceRequestDTO requestDTO); void finishLecture(Long lectureId); diff --git a/src/main/java/org/sopt/makers/operation/service/LectureServiceImpl.java b/src/main/java/org/sopt/makers/operation/service/LectureServiceImpl.java index 831b0770..330f2f16 100644 --- a/src/main/java/org/sopt/makers/operation/service/LectureServiceImpl.java +++ b/src/main/java/org/sopt/makers/operation/service/LectureServiceImpl.java @@ -97,8 +97,8 @@ private void saveSubAttendance(Attendance attendance, SubLecture subLecture) { } @Override - public LecturesResponseDTO getLecturesByGeneration(int generation, Part part) { - val lectures = lectureRepository.findLectures(generation, part); + public LecturesResponseDTO getLectures(int generation, Part part) { + val lectures = lectureRepository.find(generation, part); return LecturesResponseDTO.of(generation, lectures); } diff --git a/src/test/java/org/sopt/makers/operation/controller/web/LectureControllerTest.java b/src/test/java/org/sopt/makers/operation/controller/web/LectureControllerTest.java index 0197a2d4..f00c2aa4 100644 --- a/src/test/java/org/sopt/makers/operation/controller/web/LectureControllerTest.java +++ b/src/test/java/org/sopt/makers/operation/controller/web/LectureControllerTest.java @@ -30,6 +30,7 @@ @ExtendWith(MockitoExtension.class) class LectureControllerTest { + @InjectMocks private LectureController lectureController; @@ -72,7 +73,7 @@ void success_getLectureList() throws Exception { MultiValueMap queries = new LinkedMultiValueMap<>(); queries.add("generation", String.valueOf(LECTURE_GENERATION)); - doReturn(response).when(lectureService).getLecturesByGeneration(anyInt(), any()); + doReturn(response).when(lectureService).getLectures(anyInt(), any()); // when ResultActions resultActions = mockMvc.perform( @@ -155,16 +156,4 @@ void success_getLectureDetail() throws Exception { // then resultActions.andExpect(status().isOk()); } - - private LectureRequestDTO lectureRequest() { - return LectureRequestDTO.builder() - .part(LECTURE_PART) - .name(LECTURE_NAME) - .generation(LECTURE_GENERATION) - .place(LECTURE_PLACE) - .startDate(NOW.toString()) - .endDate(NOW.plusHours(4).toString()) - .attribute(LECTURE_ATTRIBUTE) - .build(); - } } \ No newline at end of file diff --git a/src/test/java/org/sopt/makers/operation/fixture/LectureFixture.java b/src/test/java/org/sopt/makers/operation/fixture/LectureFixture.java index 91ca8cd8..a11a6932 100644 --- a/src/test/java/org/sopt/makers/operation/fixture/LectureFixture.java +++ b/src/test/java/org/sopt/makers/operation/fixture/LectureFixture.java @@ -8,10 +8,14 @@ import org.sopt.makers.operation.dto.lecture.AttendanceResponseDTO; import org.sopt.makers.operation.dto.lecture.AttendancesStatusVO; import org.sopt.makers.operation.dto.lecture.LectureDetailResponseDTO; +import org.sopt.makers.operation.dto.lecture.LectureRequestDTO; import org.sopt.makers.operation.dto.lecture.LectureResponseDTO; +import org.sopt.makers.operation.dto.lecture.LectureResponseDTO.SubLectureVO; import org.sopt.makers.operation.dto.lecture.LecturesResponseDTO; +import org.sopt.makers.operation.dto.lecture.LecturesResponseDTO.LectureVO; import org.sopt.makers.operation.entity.Part; import org.sopt.makers.operation.entity.lecture.Attribute; +import org.sopt.makers.operation.entity.lecture.Lecture; import org.sopt.makers.operation.entity.lecture.LectureStatus; public class LectureFixture { @@ -26,6 +30,18 @@ public class LectureFixture { public static final int LIST_SIZE = 5; public static final String SUB_LECTURE_CODE = "code"; + public static LectureRequestDTO lectureRequest() { + return LectureRequestDTO.builder() + .part(LECTURE_PART) + .name(LECTURE_NAME) + .generation(LECTURE_GENERATION) + .place(LECTURE_PLACE) + .startDate(NOW.toString()) + .endDate(NOW.plusHours(4).toString()) + .attribute(LECTURE_ATTRIBUTE) + .build(); + } + public static long lectureId() { return 0L; } @@ -34,13 +50,13 @@ public static LecturesResponseDTO lecturesResponse() { return new LecturesResponseDTO(LECTURE_GENERATION, lectures()); } - private static List lectures() { + private static List lectures() { return Stream.iterate(1, i -> i + 1).limit(LIST_SIZE) .map(LectureFixture::lecture).toList(); } - private static LecturesResponseDTO.LectureVO lecture(int i) { - return LecturesResponseDTO.LectureVO.builder() + private static LectureVO lecture(int i) { + return LectureVO.builder() .lectureId(0L) .name(LECTURE_NAME + i) .partValue(Part.ALL) @@ -76,13 +92,13 @@ private static AttendancesStatusVO attendancesStatus() { .build(); } - private static List subLectures() { + private static List subLectures() { return Stream.iterate(1, i -> i + 1).limit(LIST_SIZE) .map(LectureFixture::subLecture).toList(); } - private static LectureResponseDTO.SubLectureVO subLecture(int i) { - return LectureResponseDTO.SubLectureVO.builder() + private static SubLectureVO subLecture(int i) { + return SubLectureVO.builder() .subLectureId((long)i) .round(i % 2) .startAt(NOW.toString()) @@ -110,4 +126,9 @@ public static LectureDetailResponseDTO lectureDetail() { .generation(LECTURE_GENERATION) .build(); } + + public static List lectureList() { + return Stream.iterate(1, i -> i + 1).limit(LIST_SIZE) + .map(i -> lectureRequest().toEntity()).toList(); + } } From 49e7558dcea926c5d0f7d3a60fbb37ac016cd3f9 Mon Sep 17 00:00:00 2001 From: thguss Date: Fri, 19 Jan 2024 12:16:33 +0900 Subject: [PATCH 011/141] =?UTF-8?q?[TEST]=20=EC=84=B8=EC=85=98=20=EB=AA=A9?= =?UTF-8?q?=EB=A1=9D=20=EC=A1=B0=ED=9A=8C=20=ED=85=8C=EC=8A=A4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/LectureServiceImplTest.java | 37 ++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/src/test/java/org/sopt/makers/operation/service/LectureServiceImplTest.java b/src/test/java/org/sopt/makers/operation/service/LectureServiceImplTest.java index 1085bfe4..a1491be7 100644 --- a/src/test/java/org/sopt/makers/operation/service/LectureServiceImplTest.java +++ b/src/test/java/org/sopt/makers/operation/service/LectureServiceImplTest.java @@ -1,13 +1,48 @@ package org.sopt.makers.operation.service; -import static org.junit.jupiter.api.Assertions.*; +import static org.hamcrest.MatcherAssert.*; +import static org.hamcrest.Matchers.*; +import static org.sopt.makers.operation.fixture.LectureFixture.*; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; +import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; +import org.sopt.makers.operation.config.ValueConfig; +import org.sopt.makers.operation.dto.lecture.LecturesResponseDTO; +import org.sopt.makers.operation.repository.lecture.LectureRepository; +import org.sopt.makers.operation.repository.member.MemberRepository; + +import static org.mockito.Mockito.*; @ExtendWith(MockitoExtension.class) class LectureServiceImplTest { @InjectMocks + LectureServiceImpl lectureService; + + @Mock + private LectureRepository lectureRepository; + @Mock + private MemberRepository memberRepository; + @Mock + ValueConfig valueConfig; + + @DisplayName("세션 목록 조회") + @Test + void getLectures() { + // given + doReturn(lectureList()).when(lectureRepository).find(anyInt(), any()); + + // when + LecturesResponseDTO response = lectureService.getLectures(LECTURE_GENERATION, LECTURE_PART); + + // then + assertThat(response.lectures().size(), is(equalTo(LIST_SIZE))); + + // verify + verify(lectureRepository, times(1)).find(anyInt(), any()); + } } \ No newline at end of file From f58055cb34bb88bf23b2df5dbb714962c2e4745f Mon Sep 17 00:00:00 2001 From: thguss Date: Fri, 19 Jan 2024 12:23:32 +0900 Subject: [PATCH 012/141] =?UTF-8?q?[TEST]=20=EC=84=B8=EC=85=98=20=EB=8B=A8?= =?UTF-8?q?=EA=B1=B4=20=EC=A1=B0=ED=9A=8C=20=ED=85=8C=EC=8A=A4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/LectureServiceImplTest.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/test/java/org/sopt/makers/operation/service/LectureServiceImplTest.java b/src/test/java/org/sopt/makers/operation/service/LectureServiceImplTest.java index a1491be7..ef093a9d 100644 --- a/src/test/java/org/sopt/makers/operation/service/LectureServiceImplTest.java +++ b/src/test/java/org/sopt/makers/operation/service/LectureServiceImplTest.java @@ -11,12 +11,16 @@ import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; import org.sopt.makers.operation.config.ValueConfig; +import org.sopt.makers.operation.dto.lecture.LectureResponseDTO; import org.sopt.makers.operation.dto.lecture.LecturesResponseDTO; +import org.sopt.makers.operation.entity.lecture.Lecture; import org.sopt.makers.operation.repository.lecture.LectureRepository; import org.sopt.makers.operation.repository.member.MemberRepository; import static org.mockito.Mockito.*; +import java.util.Optional; + @ExtendWith(MockitoExtension.class) class LectureServiceImplTest { @@ -45,4 +49,26 @@ void getLectures() { // verify verify(lectureRepository, times(1)).find(anyInt(), any()); } + + @DisplayName("세션 단건 조회") + @Test + void getLecture() { + // given + Lecture lecture = lectureRequest().toEntity(); + long lectureId = lectureId(); + + doReturn(Optional.of(lecture)).when(lectureRepository).findById(anyLong()); + + // when + LectureResponseDTO response = lectureService.getLecture(lectureId); + + // then + assertThat(response.name(), is(equalTo(lecture.getName()))); + assertThat(response.generation(), is(equalTo(lecture.getGeneration()))); + assertThat(response.part(), is(equalTo(lecture.getPart()))); + assertThat(response.attribute(), is(equalTo(lecture.getAttribute()))); + + // verify + verify(lectureRepository, times(1)).findById(anyLong()); + } } \ No newline at end of file From 75abd9591c5ab0e8b20ed9694e632e0e9703b337 Mon Sep 17 00:00:00 2001 From: thguss Date: Fri, 19 Jan 2024 12:41:45 +0900 Subject: [PATCH 013/141] =?UTF-8?q?[REFACTOR]=20=EC=B6=9C=EC=84=9D=20?= =?UTF-8?q?=EC=8B=9C=EC=9E=91=20=EB=A9=94=EC=86=8C=EB=93=9C=20=EB=A6=AC?= =?UTF-8?q?=ED=8C=A9=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/lecture/AttendanceResponseDTO.java | 7 ++++ .../operation/entity/lecture/Lecture.java | 8 +++++ .../operation/service/LectureServiceImpl.java | 32 +++++++++++-------- 3 files changed, 33 insertions(+), 14 deletions(-) diff --git a/src/main/java/org/sopt/makers/operation/dto/lecture/AttendanceResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/lecture/AttendanceResponseDTO.java index da99b041..ed025359 100644 --- a/src/main/java/org/sopt/makers/operation/dto/lecture/AttendanceResponseDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/lecture/AttendanceResponseDTO.java @@ -1,7 +1,14 @@ package org.sopt.makers.operation.dto.lecture; +import org.sopt.makers.operation.entity.SubLecture; +import org.sopt.makers.operation.entity.lecture.Lecture; + public record AttendanceResponseDTO( Long lectureId, Long subLectureId ) { + + public static AttendanceResponseDTO of(Lecture lecture, SubLecture subLecture) { + return new AttendanceResponseDTO(lecture.getId(), subLecture.getId()); + } } diff --git a/src/main/java/org/sopt/makers/operation/entity/lecture/Lecture.java b/src/main/java/org/sopt/makers/operation/entity/lecture/Lecture.java index 29201733..5027ce8f 100644 --- a/src/main/java/org/sopt/makers/operation/entity/lecture/Lecture.java +++ b/src/main/java/org/sopt/makers/operation/entity/lecture/Lecture.java @@ -78,4 +78,12 @@ public void finish() { this.lectureStatus = LectureStatus.END; attendances.forEach(Attendance::updateMemberScore); } + + public boolean isEnd() { + return this.lectureStatus.equals(LectureStatus.END); + } + + public boolean isBefore() { + return this.lectureStatus.equals(LectureStatus.BEFORE); + } } diff --git a/src/main/java/org/sopt/makers/operation/service/LectureServiceImpl.java b/src/main/java/org/sopt/makers/operation/service/LectureServiceImpl.java index 330f2f16..2571d36f 100644 --- a/src/main/java/org/sopt/makers/operation/service/LectureServiceImpl.java +++ b/src/main/java/org/sopt/makers/operation/service/LectureServiceImpl.java @@ -26,6 +26,7 @@ import org.sopt.makers.operation.entity.lecture.Attribute; import org.sopt.makers.operation.entity.lecture.Lecture; import org.sopt.makers.operation.exception.LectureException; +import org.sopt.makers.operation.exception.SubLectureException; import org.sopt.makers.operation.external.api.AlarmSender; import org.sopt.makers.operation.repository.attendance.AttendanceRepository; import org.sopt.makers.operation.repository.SubAttendanceRepository; @@ -111,23 +112,26 @@ public LectureResponseDTO getLecture(Long lectureId) { @Override @Transactional public AttendanceResponseDTO startAttendance(AttendanceRequestDTO requestDTO) { - Lecture lecture = findLecture(requestDTO.lectureId()); + val lecture = findLecture(requestDTO.lectureId()); + checkValidAttendance(lecture, requestDTO.round()); + val subLecture = getSubLecture(lecture, requestDTO.round()); + subLecture.startAttendance(requestDTO.code()); + return AttendanceResponseDTO.of(lecture, subLecture); + } - // 출석 가능 여부 유효성 체크 - if (requestDTO.round() == 2 && lecture.getLectureStatus().equals(BEFORE)) { - throw new IllegalStateException(NOT_STARTED_PRE_ATTENDANCE.getName()); - } else if (lecture.getLectureStatus().equals(END)) { - throw new IllegalStateException(END_LECTURE.getName()); + private void checkValidAttendance(Lecture lecture, int round) { + if (lecture.isEnd()) { + throw new LectureException(END_LECTURE.getName()); + } else if (round == 2 && lecture.isBefore()) { + throw new LectureException(NOT_STARTED_PRE_ATTENDANCE.getName()); } + } - // 출석 세션 상태 업데이트 (시작) - SubLecture subLecture = lecture.getSubLectures().stream() - .filter(session -> session.getRound() == requestDTO.round()) - .findFirst() - .orElseThrow(() -> new IllegalStateException(NO_SUB_LECTURE_EQUAL_ROUND.getName())); - subLecture.startAttendance(requestDTO.code()); - - return new AttendanceResponseDTO(lecture.getId(), subLecture.getId()); + private SubLecture getSubLecture(Lecture lecture, int round) { + return lecture.getSubLectures().stream() + .filter(l -> l.getRound() == round) + .findFirst() + .orElseThrow(() -> new SubLectureException(NO_SUB_LECTURE_EQUAL_ROUND.getName())); } @Override From eb6b1ea9f1958aaace53d56edb7cea9fc144cf05 Mon Sep 17 00:00:00 2001 From: thguss Date: Fri, 19 Jan 2024 12:54:40 +0900 Subject: [PATCH 014/141] =?UTF-8?q?[TEST]=20=EC=B6=9C=EC=84=9D=20=EC=8B=9C?= =?UTF-8?q?=EC=9E=91=20=ED=85=8C=EC=8A=A4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operation/fixture/LectureFixture.java | 7 ++++++- .../service/LectureServiceImplTest.java | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/test/java/org/sopt/makers/operation/fixture/LectureFixture.java b/src/test/java/org/sopt/makers/operation/fixture/LectureFixture.java index a11a6932..898bf7d1 100644 --- a/src/test/java/org/sopt/makers/operation/fixture/LectureFixture.java +++ b/src/test/java/org/sopt/makers/operation/fixture/LectureFixture.java @@ -14,6 +14,7 @@ import org.sopt.makers.operation.dto.lecture.LecturesResponseDTO; import org.sopt.makers.operation.dto.lecture.LecturesResponseDTO.LectureVO; import org.sopt.makers.operation.entity.Part; +import org.sopt.makers.operation.entity.SubLecture; import org.sopt.makers.operation.entity.lecture.Attribute; import org.sopt.makers.operation.entity.lecture.Lecture; import org.sopt.makers.operation.entity.lecture.LectureStatus; @@ -111,7 +112,7 @@ public static AttendanceResponseDTO attendanceResponse() { } public static AttendanceRequestDTO attendanceRequest() { - return new AttendanceRequestDTO(0L, 0, SUB_LECTURE_CODE); + return new AttendanceRequestDTO(0L, 1, SUB_LECTURE_CODE); } public static LectureDetailResponseDTO lectureDetail() { @@ -131,4 +132,8 @@ public static List lectureList() { return Stream.iterate(1, i -> i + 1).limit(LIST_SIZE) .map(i -> lectureRequest().toEntity()).toList(); } + + public static SubLecture subLecture(Lecture lecture) { + return new SubLecture(lecture, 1); + } } diff --git a/src/test/java/org/sopt/makers/operation/service/LectureServiceImplTest.java b/src/test/java/org/sopt/makers/operation/service/LectureServiceImplTest.java index ef093a9d..5db70016 100644 --- a/src/test/java/org/sopt/makers/operation/service/LectureServiceImplTest.java +++ b/src/test/java/org/sopt/makers/operation/service/LectureServiceImplTest.java @@ -11,6 +11,7 @@ import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; import org.sopt.makers.operation.config.ValueConfig; +import org.sopt.makers.operation.dto.lecture.AttendanceRequestDTO; import org.sopt.makers.operation.dto.lecture.LectureResponseDTO; import org.sopt.makers.operation.dto.lecture.LecturesResponseDTO; import org.sopt.makers.operation.entity.lecture.Lecture; @@ -71,4 +72,21 @@ void getLecture() { // verify verify(lectureRepository, times(1)).findById(anyLong()); } + + @DisplayName("출석 시작") + @Test + void startAttendance() { + // given + Lecture lecture = lectureRequest().toEntity(); + subLecture(lecture); + AttendanceRequestDTO request = attendanceRequest(); + + doReturn(Optional.of(lecture)).when(lectureRepository).findById(anyLong()); + + // when + lectureService.startAttendance(request); + + // verify + verify(lectureRepository, times(1)).findById(anyLong()); + } } \ No newline at end of file From 7bca58ba5c7ca564e85736b6845c5809cd8d48bc Mon Sep 17 00:00:00 2001 From: thguss Date: Fri, 19 Jan 2024 13:27:30 +0900 Subject: [PATCH 015/141] =?UTF-8?q?[REFACTOR]=20=EC=84=B8=EC=85=98=20?= =?UTF-8?q?=EC=A2=85=EB=A3=8C=20=EB=A6=AC=ED=8C=A9=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ScheduleController.java | 2 +- .../controller/web/LectureController.java | 4 +- .../operation/entity/lecture/Lecture.java | 2 +- .../operation/service/LectureService.java | 11 +++- .../operation/service/LectureServiceImpl.java | 65 ++++++++++--------- 5 files changed, 46 insertions(+), 38 deletions(-) diff --git a/src/main/java/org/sopt/makers/operation/controller/ScheduleController.java b/src/main/java/org/sopt/makers/operation/controller/ScheduleController.java index 8ede0853..5b7a673e 100644 --- a/src/main/java/org/sopt/makers/operation/controller/ScheduleController.java +++ b/src/main/java/org/sopt/makers/operation/controller/ScheduleController.java @@ -16,7 +16,7 @@ public class ScheduleController { @Scheduled(cron = "0 0 0 ? * SUN") public void endLecture() { - lectureService.finishLecture(); + lectureService.endLectures(); } } diff --git a/src/main/java/org/sopt/makers/operation/controller/web/LectureController.java b/src/main/java/org/sopt/makers/operation/controller/web/LectureController.java index 9cc4e264..156cc045 100644 --- a/src/main/java/org/sopt/makers/operation/controller/web/LectureController.java +++ b/src/main/java/org/sopt/makers/operation/controller/web/LectureController.java @@ -76,8 +76,8 @@ private URI getURI(Long lectureId) { @ApiOperation(value = "세션 종료 후 출석 점수 갱신") @PatchMapping("/{lectureId}") - public ResponseEntity finishLecture(@PathVariable Long lectureId) { - lectureService.finishLecture(lectureId); + public ResponseEntity endLecture(@PathVariable Long lectureId) { + lectureService.endLecture(lectureId); return ResponseEntity.ok(success(SUCCESS_UPDATE_MEMBER_SCORE.getMessage())); } diff --git a/src/main/java/org/sopt/makers/operation/entity/lecture/Lecture.java b/src/main/java/org/sopt/makers/operation/entity/lecture/Lecture.java index 5027ce8f..0125fbe3 100644 --- a/src/main/java/org/sopt/makers/operation/entity/lecture/Lecture.java +++ b/src/main/java/org/sopt/makers/operation/entity/lecture/Lecture.java @@ -74,7 +74,7 @@ public void updateStatus(LectureStatus status) { this.lectureStatus = status; } - public void finish() { + public void updateToEnd() { this.lectureStatus = LectureStatus.END; attendances.forEach(Attendance::updateMemberScore); } diff --git a/src/main/java/org/sopt/makers/operation/service/LectureService.java b/src/main/java/org/sopt/makers/operation/service/LectureService.java index 6a16ee0c..e739b0ff 100644 --- a/src/main/java/org/sopt/makers/operation/service/LectureService.java +++ b/src/main/java/org/sopt/makers/operation/service/LectureService.java @@ -11,13 +11,18 @@ public interface LectureService { + /** WEB **/ long createLecture(LectureRequestDTO requestDTO); LecturesResponseDTO getLectures(int generation, Part part); + AttendanceResponseDTO startAttendance(AttendanceRequestDTO requestDTO); + void endLecture(Long lectureId); + + /** SCHEDULER **/ + void endLectures(); + + /** APP **/ LectureGetResponseDTO getCurrentLecture(Long playGroundId); LectureResponseDTO getLecture(Long lectureId); - AttendanceResponseDTO startAttendance(AttendanceRequestDTO requestDTO); - void finishLecture(Long lectureId); - void finishLecture(); LectureCurrentRoundResponseDTO getCurrentLectureRound(Long lectureId); void deleteLecture(Long lectureId); LectureDetailResponseDTO getLectureDetail(Long lectureId); diff --git a/src/main/java/org/sopt/makers/operation/service/LectureServiceImpl.java b/src/main/java/org/sopt/makers/operation/service/LectureServiceImpl.java index 2571d36f..56fe9f76 100644 --- a/src/main/java/org/sopt/makers/operation/service/LectureServiceImpl.java +++ b/src/main/java/org/sopt/makers/operation/service/LectureServiceImpl.java @@ -113,13 +113,13 @@ public LectureResponseDTO getLecture(Long lectureId) { @Transactional public AttendanceResponseDTO startAttendance(AttendanceRequestDTO requestDTO) { val lecture = findLecture(requestDTO.lectureId()); - checkValidAttendance(lecture, requestDTO.round()); + checkStartAttendanceValidity(lecture, requestDTO.round()); val subLecture = getSubLecture(lecture, requestDTO.round()); subLecture.startAttendance(requestDTO.code()); return AttendanceResponseDTO.of(lecture, subLecture); } - private void checkValidAttendance(Lecture lecture, int round) { + private void checkStartAttendanceValidity(Lecture lecture, int round) { if (lecture.isEnd()) { throw new LectureException(END_LECTURE.getName()); } else if (round == 2 && lecture.isBefore()) { @@ -136,46 +136,49 @@ private SubLecture getSubLecture(Lecture lecture, int round) { @Override @Transactional - public void finishLecture(Long lectureId) { + public void endLecture(Long lectureId) { val lecture = findLecture(lectureId); - val now = LocalDateTime.now(); - if (now.isBefore(lecture.getEndDate())) { - throw new IllegalStateException(NOT_END_TIME_YET.getName()); - } - lecture.finish(); - - List memberPgIds = lecture.getAttendances().stream() - .map(attendance -> String.valueOf(attendance.getMember().getPlaygroundId())) - .filter(id -> !id.equals("null")) - .toList(); - - val alarmTitle = lecture.getName() + " " + valueConfig.getALARM_MESSAGE_TITLE(); - alarmSender.send(new AlarmSenderDTO(alarmTitle, valueConfig.getALARM_MESSAGE_CONTENT(), memberPgIds, NEWS, null)); + checkEndLectureValidity(lecture); + lecture.updateToEnd(); + sendAlarm(lecture); } - /** APP **/ + /** SCHEDULER **/ @Override @Transactional - public void finishLecture() { + public void endLectures() { val lectures = lectureRepository.findLecturesToBeEnd(); - lectures.forEach(Lecture::finish); - - List memberPgIds; - for (val lecture : lectures) { - memberPgIds = new ArrayList<>(); - for (val attendance : lecture.getAttendances()) { - val playgroundId = attendance.getMember().getPlaygroundId(); - if (Objects.nonNull(playgroundId)) { - memberPgIds.add(String.valueOf(attendance.getMember().getPlaygroundId())); - } - } + lectures.forEach(lecture -> endLecture(lecture.getId())); + } - val alarmTitle = lecture.getName() + " " + valueConfig.getALARM_MESSAGE_TITLE(); - alarmSender.send(new AlarmSenderDTO(alarmTitle, valueConfig.getALARM_MESSAGE_CONTENT(), memberPgIds, NEWS, null)); + private void checkEndLectureValidity(Lecture lecture) { + val now = LocalDateTime.now(); + if (now.isBefore(lecture.getEndDate())) { + throw new LectureException(NOT_END_TIME_YET.getName()); } } + private void sendAlarm(Lecture lecture) { + val alarmTitle = getAlarmTitle(lecture); + val alarmContent = valueConfig.getALARM_MESSAGE_CONTENT(); + val memberPlaygroundIds = getMemberPlaygroundIds(lecture); + alarmSender.send(new AlarmSenderDTO(alarmTitle, alarmContent, memberPlaygroundIds, NEWS, null)); + } + + private List getMemberPlaygroundIds(Lecture lecture) { + return lecture.getAttendances().stream() + .map(attendance -> String.valueOf(attendance.getMember().getPlaygroundId())) + .filter(id -> !id.equals("null")) + .toList(); + } + + private String getAlarmTitle(Lecture lecture) { + return lecture.getName() + " " + valueConfig.getALARM_MESSAGE_TITLE(); + } + + /** APP **/ + @Override public LectureGetResponseDTO getCurrentLecture(Long playGroundId) { val now = LocalDateTime.now(); From 39e5a52895232369b10374113f4afba8f5e21e65 Mon Sep 17 00:00:00 2001 From: thguss Date: Fri, 19 Jan 2024 13:32:18 +0900 Subject: [PATCH 016/141] =?UTF-8?q?[TEST]=20=EC=84=B8=EC=85=98=20=EC=A2=85?= =?UTF-8?q?=EB=A3=8C=20=ED=85=8C=EC=8A=A4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operation/service/LectureServiceImpl.java | 3 +-- .../operation/fixture/LectureFixture.java | 6 ++++++ .../service/LectureServiceImplTest.java | 19 +++++++++++++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/sopt/makers/operation/service/LectureServiceImpl.java b/src/main/java/org/sopt/makers/operation/service/LectureServiceImpl.java index 56fe9f76..08d85ad7 100644 --- a/src/main/java/org/sopt/makers/operation/service/LectureServiceImpl.java +++ b/src/main/java/org/sopt/makers/operation/service/LectureServiceImpl.java @@ -153,8 +153,7 @@ public void endLectures() { } private void checkEndLectureValidity(Lecture lecture) { - val now = LocalDateTime.now(); - if (now.isBefore(lecture.getEndDate())) { + if (!lecture.isEnd()) { throw new LectureException(NOT_END_TIME_YET.getName()); } } diff --git a/src/test/java/org/sopt/makers/operation/fixture/LectureFixture.java b/src/test/java/org/sopt/makers/operation/fixture/LectureFixture.java index 898bf7d1..cad87a67 100644 --- a/src/test/java/org/sopt/makers/operation/fixture/LectureFixture.java +++ b/src/test/java/org/sopt/makers/operation/fixture/LectureFixture.java @@ -43,6 +43,12 @@ public static LectureRequestDTO lectureRequest() { .build(); } + public static Lecture lectureEnd() { + Lecture lecture = lectureRequest().toEntity(); + lecture.updateToEnd(); + return lecture; + } + public static long lectureId() { return 0L; } diff --git a/src/test/java/org/sopt/makers/operation/service/LectureServiceImplTest.java b/src/test/java/org/sopt/makers/operation/service/LectureServiceImplTest.java index 5db70016..e37a615f 100644 --- a/src/test/java/org/sopt/makers/operation/service/LectureServiceImplTest.java +++ b/src/test/java/org/sopt/makers/operation/service/LectureServiceImplTest.java @@ -15,6 +15,7 @@ import org.sopt.makers.operation.dto.lecture.LectureResponseDTO; import org.sopt.makers.operation.dto.lecture.LecturesResponseDTO; import org.sopt.makers.operation.entity.lecture.Lecture; +import org.sopt.makers.operation.external.api.AlarmSender; import org.sopt.makers.operation.repository.lecture.LectureRepository; import org.sopt.makers.operation.repository.member.MemberRepository; @@ -33,6 +34,8 @@ class LectureServiceImplTest { @Mock private MemberRepository memberRepository; @Mock + private AlarmSender alarmSender; + @Mock ValueConfig valueConfig; @DisplayName("세션 목록 조회") @@ -89,4 +92,20 @@ void startAttendance() { // verify verify(lectureRepository, times(1)).findById(anyLong()); } + + @DisplayName("세션 종료") + @Test + void endLecture() { + // given + long lectureId = lectureId(); + Lecture lecture = lectureEnd(); + + doReturn(Optional.of(lecture)).when(lectureRepository).findById(anyLong()); + + // when + lectureService.endLecture(lectureId); + + // verify + verify(lectureRepository, times(1)).findById(anyLong()); + } } \ No newline at end of file From 4a99d3f3138f80dd52897a3bdf0cb056261d4e88 Mon Sep 17 00:00:00 2001 From: thguss Date: Fri, 19 Jan 2024 14:48:58 +0900 Subject: [PATCH 017/141] =?UTF-8?q?[REFACTOR]=20=EC=84=B8=EC=85=98=20?= =?UTF-8?q?=EA=B4=80=EB=A0=A8=20=EB=A6=AC=ED=8C=A9=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../makers/operation/config/ValueConfig.java | 3 + .../controller/app/AppLectureController.java | 13 +- ...eDTO.java => TodayLectureResponseDTO.java} | 38 ++-- .../operation/entity/lecture/Lecture.java | 13 +- .../AttendanceCustomRepository.java | 3 +- .../attendance/AttendanceRepositoryImpl.java | 33 +--- .../operation/service/LectureService.java | 11 +- .../operation/service/LectureServiceImpl.java | 173 +++++++++--------- 8 files changed, 138 insertions(+), 149 deletions(-) rename src/main/java/org/sopt/makers/operation/dto/lecture/{LectureGetResponseDTO.java => TodayLectureResponseDTO.java} (63%) diff --git a/src/main/java/org/sopt/makers/operation/config/ValueConfig.java b/src/main/java/org/sopt/makers/operation/config/ValueConfig.java index 9c36a59e..e979ce11 100644 --- a/src/main/java/org/sopt/makers/operation/config/ValueConfig.java +++ b/src/main/java/org/sopt/makers/operation/config/ValueConfig.java @@ -15,4 +15,7 @@ public class ValueConfig { private String ALARM_MESSAGE_CONTENT; private final int SUB_LECTURE_MAX_ROUND = 2; + private final String ETC_MESSAGE = "출석 점수가 반영되지 않아요."; + private final String SEMINAR_MESSAGE = ""; + private final String EVENT_MESSAGE = "행사도 참여하고, 출석점수도 받고, 일석이조!"; } diff --git a/src/main/java/org/sopt/makers/operation/controller/app/AppLectureController.java b/src/main/java/org/sopt/makers/operation/controller/app/AppLectureController.java index 663aa109..309af9e0 100644 --- a/src/main/java/org/sopt/makers/operation/controller/app/AppLectureController.java +++ b/src/main/java/org/sopt/makers/operation/controller/app/AppLectureController.java @@ -1,7 +1,5 @@ package org.sopt.makers.operation.controller.app; - -import static java.util.Objects.*; import static org.sopt.makers.operation.common.ResponseMessage.*; import io.swagger.annotations.ApiOperation; @@ -19,11 +17,14 @@ @RequiredArgsConstructor @RequestMapping("/api/v1/app/lectures") public class AppLectureController { + private final LectureService lectureService; - @ApiOperation(value = "단일 세미나 상태 조회") + + @ApiOperation(value = "진행 중인 세미나 상태 조회") @GetMapping public ResponseEntity getLecture(@ApiIgnore Principal principal) { - val response = lectureService.getCurrentLecture(getMemberId(principal)); + val memberPlaygroundId = Long.parseLong(principal.getName()); + val response = lectureService.getTodayLecture(memberPlaygroundId); return ResponseEntity.ok(ApiResponse.success(SUCCESS_SINGLE_GET_LECTURE.getMessage(), response)); } @@ -33,8 +34,4 @@ public ResponseEntity getRound(@PathVariable("lectureId") Long lect val response = lectureService.getCurrentLectureRound(lectureId); return ResponseEntity.ok(ApiResponse.success(SUCCESS_GET_LECTURE_ROUND.getMessage(), response)); } - - private Long getMemberId(Principal principal) { - return nonNull(principal) ? Long.valueOf(principal.getName()) : null; - } } diff --git a/src/main/java/org/sopt/makers/operation/dto/lecture/LectureGetResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/lecture/TodayLectureResponseDTO.java similarity index 63% rename from src/main/java/org/sopt/makers/operation/dto/lecture/LectureGetResponseDTO.java rename to src/main/java/org/sopt/makers/operation/dto/lecture/TodayLectureResponseDTO.java index 7b1f9696..40685563 100644 --- a/src/main/java/org/sopt/makers/operation/dto/lecture/LectureGetResponseDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/lecture/TodayLectureResponseDTO.java @@ -11,7 +11,7 @@ import java.util.stream.Collectors; @Builder -public record LectureGetResponseDTO( +public record TodayLectureResponseDTO( LectureResponseType type, Long id, String location, @@ -21,9 +21,9 @@ public record LectureGetResponseDTO( String message, List attendances ) { - public static LectureGetResponseDTO of(LectureResponseType type, Lecture lecture, String message, List attendances) { + public static TodayLectureResponseDTO of(LectureResponseType type, Lecture lecture, String message, List attendances) { - return LectureGetResponseDTO.builder() + return TodayLectureResponseDTO.builder() .type(type) .id(lecture.getId()) .location(lecture.getPlace()) @@ -40,22 +40,22 @@ public static LectureGetResponseDTO of(LectureResponseType type, Lecture lecture private static DateTimeFormatter convertFormat() { return DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss"); } -} - -@Builder -record LectureGetResponseVO( - AttendanceStatus status, - String attendedAt -) { - public static LectureGetResponseVO of(AttendanceStatus status, LocalDateTime attendedAt) { - return LectureGetResponseVO.builder() - .status(status) - .attendedAt(attendedAt.format((convertFormat()))) - .build(); - } - - private static DateTimeFormatter convertFormat() { - return DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss"); + @Builder + record LectureGetResponseVO( + AttendanceStatus status, + String attendedAt + + ) { + public static LectureGetResponseVO of(AttendanceStatus status, LocalDateTime attendedAt) { + return LectureGetResponseVO.builder() + .status(status) + .attendedAt(attendedAt.format((convertFormat()))) + .build(); + } + + private static DateTimeFormatter convertFormat() { + return DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss"); + } } } diff --git a/src/main/java/org/sopt/makers/operation/entity/lecture/Lecture.java b/src/main/java/org/sopt/makers/operation/entity/lecture/Lecture.java index 0125fbe3..8fd2b9af 100644 --- a/src/main/java/org/sopt/makers/operation/entity/lecture/Lecture.java +++ b/src/main/java/org/sopt/makers/operation/entity/lecture/Lecture.java @@ -1,6 +1,7 @@ package org.sopt.makers.operation.entity.lecture; import static javax.persistence.GenerationType.*; +import static org.sopt.makers.operation.entity.lecture.LectureStatus.*; import java.time.LocalDateTime; import java.util.ArrayList; @@ -67,7 +68,7 @@ public Lecture(String name, Part part, int generation, String place, LocalDateTi this.startDate = startDate; this.endDate = endDate; this.attribute = attribute; - this.lectureStatus = LectureStatus.BEFORE; + this.lectureStatus = BEFORE; } public void updateStatus(LectureStatus status) { @@ -75,15 +76,19 @@ public void updateStatus(LectureStatus status) { } public void updateToEnd() { - this.lectureStatus = LectureStatus.END; + this.lectureStatus = END; attendances.forEach(Attendance::updateMemberScore); } public boolean isEnd() { - return this.lectureStatus.equals(LectureStatus.END); + return this.lectureStatus.equals(END); } public boolean isBefore() { - return this.lectureStatus.equals(LectureStatus.BEFORE); + return this.lectureStatus.equals(BEFORE); + } + + public boolean isFirst() { + return this.lectureStatus.equals(FIRST); } } diff --git a/src/main/java/org/sopt/makers/operation/repository/attendance/AttendanceCustomRepository.java b/src/main/java/org/sopt/makers/operation/repository/attendance/AttendanceCustomRepository.java index dcbd655e..40e8f7cf 100644 --- a/src/main/java/org/sopt/makers/operation/repository/attendance/AttendanceCustomRepository.java +++ b/src/main/java/org/sopt/makers/operation/repository/attendance/AttendanceCustomRepository.java @@ -13,7 +13,6 @@ public interface AttendanceCustomRepository { List findAttendanceByMemberId(Long memberId); List findByLecture(Long lectureId, Part part, Pageable pageable); List findByMember(Member member); - List findCurrentAttendanceByMember(Long playGroundId); - List findSubAttendanceByAttendanceId(Long attendanceId); + List findToday(long memberPlaygroundId); int countByLectureIdAndPart(long lectureId, Part part); } diff --git a/src/main/java/org/sopt/makers/operation/repository/attendance/AttendanceRepositoryImpl.java b/src/main/java/org/sopt/makers/operation/repository/attendance/AttendanceRepositoryImpl.java index 497ae2f9..b84101a9 100644 --- a/src/main/java/org/sopt/makers/operation/repository/attendance/AttendanceRepositoryImpl.java +++ b/src/main/java/org/sopt/makers/operation/repository/attendance/AttendanceRepositoryImpl.java @@ -8,6 +8,7 @@ import static org.sopt.makers.operation.entity.QSubLecture.*; import static org.sopt.makers.operation.entity.lecture.QLecture.*; +import java.time.LocalDate; import java.time.LocalDateTime; import java.time.LocalTime; import java.util.List; @@ -18,6 +19,7 @@ import org.sopt.makers.operation.entity.Attendance; import org.sopt.makers.operation.entity.Member; import org.sopt.makers.operation.entity.Part; +import org.sopt.makers.operation.entity.QMember; import org.sopt.makers.operation.entity.SubAttendance; import org.sopt.makers.operation.entity.lecture.LectureStatus; import org.springframework.data.domain.Pageable; @@ -81,40 +83,25 @@ public List findByMember(Member member) { } @Override - public List findCurrentAttendanceByMember(Long playGroundId) { - val now = LocalDateTime.now(); - val today = now.toLocalDate(); + public List findToday(long memberPlaygroundId) { + val today = LocalDate.now(); val startOfDay = today.atStartOfDay(); val endOfDay = LocalDateTime.of(today, LocalTime.MAX); - return queryFactory - .select(attendance) - .from(attendance) + .selectFrom(attendance) .leftJoin(attendance.lecture, lecture).fetchJoin() .leftJoin(attendance.member, member).fetchJoin() + .leftJoin(attendance.subAttendances, subAttendance).fetchJoin().distinct() + .leftJoin(subAttendance.subLecture, subLecture).fetchJoin() .where( + member.playgroundId.eq(memberPlaygroundId), + member.generation.eq(generationConfig.getCurrentGeneration()), lecture.part.eq(member.part).or(lecture.part.eq(Part.ALL)), - lecture.startDate.between(startOfDay, endOfDay), - member.playgroundId.eq(playGroundId), - member.generation.eq(generationConfig.getCurrentGeneration()) - ) + lecture.startDate.between(startOfDay, endOfDay)) .orderBy(lecture.startDate.asc()) .fetch(); } - @Override - public List findSubAttendanceByAttendanceId(Long attendanceId) { - return queryFactory - .select(subAttendance) - .from(subAttendance) - .leftJoin(subAttendance.subLecture, subLecture).fetchJoin() - .where( - subAttendance.attendance.id.eq(attendanceId) - ) - .orderBy(subAttendance.createdDate.asc()) - .fetch(); - } - @Override public int countByLectureIdAndPart(long lectureId, Part part) { return Math.toIntExact(queryFactory diff --git a/src/main/java/org/sopt/makers/operation/service/LectureService.java b/src/main/java/org/sopt/makers/operation/service/LectureService.java index e739b0ff..8659e21e 100644 --- a/src/main/java/org/sopt/makers/operation/service/LectureService.java +++ b/src/main/java/org/sopt/makers/operation/service/LectureService.java @@ -1,6 +1,6 @@ package org.sopt.makers.operation.service; -import org.sopt.makers.operation.dto.lecture.LectureGetResponseDTO; +import org.sopt.makers.operation.dto.lecture.TodayLectureResponseDTO; import org.sopt.makers.operation.dto.lecture.AttendanceRequestDTO; import org.sopt.makers.operation.dto.lecture.AttendanceResponseDTO; import org.sopt.makers.operation.dto.lecture.LectureRequestDTO; @@ -14,17 +14,16 @@ public interface LectureService { /** WEB **/ long createLecture(LectureRequestDTO requestDTO); LecturesResponseDTO getLectures(int generation, Part part); + LectureResponseDTO getLecture(Long lectureId); AttendanceResponseDTO startAttendance(AttendanceRequestDTO requestDTO); void endLecture(Long lectureId); + void deleteLecture(Long lectureId); + LectureDetailResponseDTO getLectureDetail(Long lectureId); /** SCHEDULER **/ void endLectures(); /** APP **/ - LectureGetResponseDTO getCurrentLecture(Long playGroundId); - LectureResponseDTO getLecture(Long lectureId); + TodayLectureResponseDTO getTodayLecture(long memberPlaygroundId); LectureCurrentRoundResponseDTO getCurrentLectureRound(Long lectureId); - void deleteLecture(Long lectureId); - LectureDetailResponseDTO getLectureDetail(Long lectureId); - } diff --git a/src/main/java/org/sopt/makers/operation/service/LectureServiceImpl.java b/src/main/java/org/sopt/makers/operation/service/LectureServiceImpl.java index 08d85ad7..b445ba95 100644 --- a/src/main/java/org/sopt/makers/operation/service/LectureServiceImpl.java +++ b/src/main/java/org/sopt/makers/operation/service/LectureServiceImpl.java @@ -1,7 +1,8 @@ package org.sopt.makers.operation.service; -import static java.util.Objects.nonNull; import static org.sopt.makers.operation.common.ExceptionMessage.*; +import static org.sopt.makers.operation.common.ExceptionMessage.NO_SESSION; +import static org.sopt.makers.operation.dto.lecture.LectureResponseType.*; import static org.sopt.makers.operation.entity.AttendanceStatus.*; import static org.sopt.makers.operation.entity.alarm.Attribute.*; import static org.sopt.makers.operation.entity.lecture.LectureStatus.*; @@ -143,6 +144,34 @@ public void endLecture(Long lectureId) { sendAlarm(lecture); } + @Override + @Transactional + public void deleteLecture(Long lectureId) { + val lecture = findLecture(lectureId); + if (lecture.isEnd()) { + restoreAttendances(lecture.getAttendances()); + } + subAttendanceRepository.deleteAllBySubLectureIn(lecture.getSubLectures()); + subLectureRepository.deleteAllByLecture(lecture); + attendanceRepository.deleteAllByLecture(lecture); + lectureRepository.deleteById(lectureId); + } + + private void restoreAttendances(List attendances) { + attendances.forEach(Attendance::revertMemberScore); + } + + @Override + public LectureDetailResponseDTO getLectureDetail(Long lectureId) { + val lecture = findLecture(lectureId); + return LectureDetailResponseDTO.of(lecture); + } + + private Lecture findLecture(Long id) { + return lectureRepository.findById(id) + .orElseThrow(() -> new LectureException(INVALID_LECTURE.getName())); + } + /** SCHEDULER **/ @Override @@ -179,65 +208,77 @@ private String getAlarmTitle(Lecture lecture) { /** APP **/ @Override - public LectureGetResponseDTO getCurrentLecture(Long playGroundId) { - val now = LocalDateTime.now(); - - val attendances = attendanceRepository.findCurrentAttendanceByMember(playGroundId); + public TodayLectureResponseDTO getTodayLecture(long memberPlaygroundId) { + val attendances = attendanceRepository.findToday(memberPlaygroundId); + checkAttendancesSize(attendances); if (attendances.isEmpty()) { - return new LectureGetResponseDTO(LectureResponseType.NO_SESSION, 0L, "", "", "", "", "", Collections.emptyList()); + return getEmptyResponse(); } - if (attendances.size() > 2) { - throw new LectureException(INVALID_COUNT_SESSION.getName()); - } - - // 현재 출석과 Lecture 가져오기 - val currentAttendance = getCurrentAttendance(attendances, now); - val currentLecture = currentAttendance.getLecture(); - val lectureType = getLectureResponseType(currentLecture); + val attendance = getNowAttendance(attendances); + val lecture = attendance.getLecture(); + val responseType = getResponseType(lecture); + val message = getMessage(lecture.getAttribute()); - if (lectureType.equals(LectureResponseType.NO_ATTENDANCE)) { - val message = "출석 점수가 반영되지 않아요."; - return LectureGetResponseDTO.of(lectureType, currentLecture, message, Collections.emptyList()); + if (responseType.equals(NO_ATTENDANCE) || lecture.isBefore()) { + return TodayLectureResponseDTO.of(responseType, lecture, message, Collections.emptyList()); } - val subAttendances = attendanceRepository.findSubAttendanceByAttendanceId(currentAttendance.getId()); - - val firstSubLectureAttendance = subAttendances.get(0); - val secondSubLectureAttendance = subAttendances.get(1); + val subAttendances = attendance.getSubAttendances(); + val subAttendance = lecture.isFirst() ? subAttendances.get(0) : subAttendances.get(1); + return getTodayLectureResponse(subAttendance, responseType, lecture); + } - val firstSubLectureAttendanceStatus = firstSubLectureAttendance.getStatus(); - val secondSubLectureAttendanceStatus = secondSubLectureAttendance.getStatus(); + private TodayLectureResponseDTO getEmptyResponse() { + return TodayLectureResponseDTO.builder() + .type(LectureResponseType.NO_SESSION) + .id(0L) + .location("") + .name("") + .startDate("") + .endDate("") + .message("") + .attendances(Collections.emptyList()) + .build(); + } - val firstSessionStart = firstSubLectureAttendance.getSubLecture().getStartAt(); - val secondSessionStart = secondSubLectureAttendance.getSubLecture().getStartAt(); + private void checkAttendancesSize(List attendances) { + if (attendances.size() > valueConfig.getSUB_LECTURE_MAX_ROUND()) { + throw new LectureException(INVALID_COUNT_SESSION.getName()); + } + } - val message = (currentLecture.getAttribute() == Attribute.SEMINAR) ? "" : "행사도 참여하고, 출석점수도 받고, 일석이조!"; + private Attendance getNowAttendance(List attendances) { + val index = getAttendanceIndex(); + return attendances.get(index); + } - // Lecture 시작 전 혹은 1차 출석 시작 전 - if (now.isBefore(currentLecture.getStartDate()) || !nonNull(firstSessionStart)) { - return LectureGetResponseDTO.of(lectureType, currentLecture, message, Collections.emptyList()); - } + private int getAttendanceIndex() { + return (LocalDateTime.now().getHour() >= 16) ? 1 : 0; + } - // 1차 출석 시작, 2차 출석 시작 전 - if (now.isAfter(firstSessionStart) && !nonNull(secondSessionStart)) { - // 1차 출석 중 결석인 상태 - if (now.isBefore(firstSessionStart.plusMinutes(10)) && firstSubLectureAttendanceStatus.equals(ABSENT)) { - return LectureGetResponseDTO.of(lectureType, currentLecture, message, Collections.emptyList()); - } + private LectureResponseType getResponseType(Lecture lecture) { + val attribute = lecture.getAttribute(); + return attribute.equals(Attribute.ETC) ? NO_ATTENDANCE : HAS_ATTENDANCE; + } - return LectureGetResponseDTO.of(lectureType, currentLecture, message, Collections.singletonList(firstSubLectureAttendance)); - } + private String getMessage(Attribute attribute) { + return switch (attribute) { + case SEMINAR -> valueConfig.getSEMINAR_MESSAGE(); + case EVENT -> valueConfig.getEVENT_MESSAGE(); + case ETC -> valueConfig.getETC_MESSAGE(); + }; + } - // 2차 출석 시작 이후 - if (now.isAfter(secondSessionStart)) { - // 2차 출석 중 결석인 상태 - if (now.isBefore(secondSessionStart.plusMinutes(10)) && secondSubLectureAttendanceStatus.equals(ABSENT)) { - return LectureGetResponseDTO.of(lectureType, currentLecture, message, Collections.singletonList(firstSubLectureAttendance)); - } + private TodayLectureResponseDTO getTodayLectureResponse(SubAttendance subAttendance, LectureResponseType responseType, Lecture lecture) { + val subLecture = subAttendance.getSubLecture(); + val isOnAttendanceCheck = LocalDateTime.now().isBefore(subLecture.getStartAt().plusMinutes(10)); + val message = getMessage(lecture.getAttribute()); + if (isOnAttendanceCheck && subAttendance.getStatus().equals(ABSENT)) { + return TodayLectureResponseDTO.of(responseType, lecture, message, Collections.emptyList()); } - return LectureGetResponseDTO.of(lectureType, currentLecture, message, subAttendances); + return TodayLectureResponseDTO.of(responseType, lecture, message, Collections.singletonList(subAttendance)); } @Override @@ -287,46 +328,4 @@ public LectureCurrentRoundResponseDTO getCurrentLectureRound(Long lectureId) { return LectureCurrentRoundResponseDTO.of(subLecture); } - - @Override - @Transactional - public void deleteLecture(Long lectureId) { - val lecture = lectureRepository.find(lectureId) - .orElseThrow(() -> new LectureException(INVALID_LECTURE.getName())); - - // 출석 종료된 세션: 출석 점수 갱신 전으로 복구 - if (lecture.getLectureStatus().equals(END)) { - lecture.getAttendances().forEach(Attendance::revertMemberScore); - } - - // 연관 관계의 객체 삭제 후 세션 삭제 - subAttendanceRepository.deleteAllBySubLectureIn(lecture.getSubLectures()); - subLectureRepository.deleteAllByLecture(lecture); - attendanceRepository.deleteAllByLecture(lecture); - lectureRepository.deleteById(lectureId); - // lectureRepository.delete(lecture); //TODO: 에러 원인 파악 필요 - } - - @Override - public LectureDetailResponseDTO getLectureDetail(Long lectureId) { - val lecture = findLecture(lectureId); - return LectureDetailResponseDTO.of(lecture); - } - - private Lecture findLecture(Long id) { - return lectureRepository.findById(id) - .orElseThrow(() -> new LectureException(INVALID_LECTURE.getName())); - } - - private Attendance getCurrentAttendance(List attendances, LocalDateTime now) { - val lectureSize = attendances.size(); - val currentHour = now.getHour(); - - val attendanceIndex = (lectureSize == 2 && currentHour >= 16) ? 1 : 0; - return attendances.get(attendanceIndex); - } - - private LectureResponseType getLectureResponseType(Lecture currentLecture) { - return (currentLecture.getAttribute() != Attribute.ETC) ? LectureResponseType.HAS_ATTENDANCE : LectureResponseType.NO_ATTENDANCE; - } } From 52013cea0323e0d5eccadee4fe517f64811c77d1 Mon Sep 17 00:00:00 2001 From: thguss Date: Fri, 19 Jan 2024 15:12:37 +0900 Subject: [PATCH 018/141] =?UTF-8?q?[REFACTOR]=20=EC=B6=9C=EC=84=9D=20?= =?UTF-8?q?=EC=B0=A8=EC=88=98=20=EC=A1=B0=ED=9A=8C=20=EB=A6=AC=ED=8C=A9?= =?UTF-8?q?=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operation/service/LectureService.java | 6 +- .../operation/service/LectureServiceImpl.java | 84 ++++++++++--------- 2 files changed, 48 insertions(+), 42 deletions(-) diff --git a/src/main/java/org/sopt/makers/operation/service/LectureService.java b/src/main/java/org/sopt/makers/operation/service/LectureService.java index 8659e21e..b133cc73 100644 --- a/src/main/java/org/sopt/makers/operation/service/LectureService.java +++ b/src/main/java/org/sopt/makers/operation/service/LectureService.java @@ -14,16 +14,16 @@ public interface LectureService { /** WEB **/ long createLecture(LectureRequestDTO requestDTO); LecturesResponseDTO getLectures(int generation, Part part); - LectureResponseDTO getLecture(Long lectureId); + LectureResponseDTO getLecture(long lectureId); AttendanceResponseDTO startAttendance(AttendanceRequestDTO requestDTO); void endLecture(Long lectureId); void deleteLecture(Long lectureId); - LectureDetailResponseDTO getLectureDetail(Long lectureId); + LectureDetailResponseDTO getLectureDetail(long lectureId); /** SCHEDULER **/ void endLectures(); /** APP **/ TodayLectureResponseDTO getTodayLecture(long memberPlaygroundId); - LectureCurrentRoundResponseDTO getCurrentLectureRound(Long lectureId); + LectureCurrentRoundResponseDTO getCurrentLectureRound(long lectureId); } diff --git a/src/main/java/org/sopt/makers/operation/service/LectureServiceImpl.java b/src/main/java/org/sopt/makers/operation/service/LectureServiceImpl.java index b445ba95..dc4c6fcd 100644 --- a/src/main/java/org/sopt/makers/operation/service/LectureServiceImpl.java +++ b/src/main/java/org/sopt/makers/operation/service/LectureServiceImpl.java @@ -7,6 +7,7 @@ import static org.sopt.makers.operation.entity.alarm.Attribute.*; import static org.sopt.makers.operation.entity.lecture.LectureStatus.*; +import java.time.LocalDate; import java.time.LocalDateTime; import java.time.LocalTime; import java.util.*; @@ -105,7 +106,7 @@ public LecturesResponseDTO getLectures(int generation, Part part) { } @Override - public LectureResponseDTO getLecture(Long lectureId) { + public LectureResponseDTO getLecture(long lectureId) { Lecture lecture = findLecture(lectureId); return LectureResponseDTO.of(lecture); } @@ -128,13 +129,6 @@ private void checkStartAttendanceValidity(Lecture lecture, int round) { } } - private SubLecture getSubLecture(Lecture lecture, int round) { - return lecture.getSubLectures().stream() - .filter(l -> l.getRound() == round) - .findFirst() - .orElseThrow(() -> new SubLectureException(NO_SUB_LECTURE_EQUAL_ROUND.getName())); - } - @Override @Transactional public void endLecture(Long lectureId) { @@ -162,7 +156,7 @@ private void restoreAttendances(List attendances) { } @Override - public LectureDetailResponseDTO getLectureDetail(Long lectureId) { + public LectureDetailResponseDTO getLectureDetail(long lectureId) { val lecture = findLecture(lectureId); return LectureDetailResponseDTO.of(lecture); } @@ -282,50 +276,62 @@ private TodayLectureResponseDTO getTodayLectureResponse(SubAttendance subAttenda } @Override - public LectureCurrentRoundResponseDTO getCurrentLectureRound(Long lectureId) { - val now = LocalDateTime.now(); - val today = now.toLocalDate(); - val startOfDay = today.atStartOfDay(); - val endOfDay = LocalDateTime.of(today, LocalTime.MAX); - - val lecture = lectureRepository.findById(lectureId) - .orElseThrow(() -> new LectureException(INVALID_LECTURE.getName())); - - val lectureStartDate = lecture.getStartDate(); - val lectureStatus = lecture.getLectureStatus(); + public LectureCurrentRoundResponseDTO getCurrentLectureRound(long lectureId) { + val lecture = findLecture(lectureId); + val subLecture = getSubLecture(lecture); + checkLectureExist(lecture); + checkLectureBefore(lecture); + checkEndAttendance(subLecture); + checkLectureEnd(lecture); + return LectureCurrentRoundResponseDTO.of(subLecture); + } - val subLectures = lecture.getSubLectures(); - subLectures.sort(Comparator.comparing(SubLecture::getRound)); + private SubLecture getSubLecture(Lecture lecture) { + val status = lecture.getLectureStatus(); + val round = status.equals(FIRST) ? 1 : 2; + return getSubLecture(lecture, round); + } - val subLecture = lectureStatus.equals(FIRST) ? - subLectures.get(0) : subLectures.get(1); + private SubLecture getSubLecture(Lecture lecture, int round) { + return lecture.getSubLectures().stream() + .filter(l -> l.getRound() == round) + .findFirst() + .orElseThrow(() -> new SubLectureException(NO_SUB_LECTURE_EQUAL_ROUND.getName())); + } - if (lectureStartDate.isBefore(startOfDay) || lectureStartDate.isAfter(endOfDay)) { + private void checkLectureExist(Lecture lecture) { + val today = LocalDate.now(); + val startOfDay = today.atStartOfDay(); + val endOfDay = LocalDateTime.of(today, LocalTime.MAX); + val startAt = lecture.getStartDate(); + if (startAt.isBefore(startOfDay) || startAt.isAfter(endOfDay)) { throw new LectureException(NO_SESSION.getName()); } + } - if (lectureStatus.equals(BEFORE)) { + private void checkLectureBefore(Lecture lecture) { + if (lecture.isBefore()) { throw new LectureException(NOT_STARTED_ATTENDANCE.getName()); } + } - if (lectureStatus.equals(FIRST)) { - // 1차 출석이 마감되었을 때 - if (now.isAfter(subLecture.getStartAt().plusMinutes(10))) { - throw new LectureException(subLecture.getRound() + ENDED_ATTENDANCE.getName()); - } + private void checkEndAttendance(SubLecture subLecture) { + if (isEndAttendance(subLecture)) { + throw new LectureException(subLecture.getRound() + ENDED_ATTENDANCE.getName()); } + } - if (lectureStatus.equals(SECOND)) { - // 2차 출석이 마감되었을 때 - if (now.isAfter(subLecture.getStartAt().plusMinutes(10))) { - throw new LectureException(subLecture.getRound() + ENDED_ATTENDANCE.getName()); - } + private boolean isEndAttendance(SubLecture subLecture) { + val status = subLecture.getLecture().getLectureStatus(); + if (LocalDateTime.now().isAfter(subLecture.getStartAt().plusMinutes(10))) { + return status.equals(FIRST) || status.equals(SECOND); } + return false; + } - if (lectureStatus.equals(END)) { + private void checkLectureEnd(Lecture lecture) { + if (lecture.isEnd()) { throw new LectureException(END_LECTURE.getName()); } - - return LectureCurrentRoundResponseDTO.of(subLecture); } } From cb9f46536889f89b383f3c98f9d6131dcc6bbb95 Mon Sep 17 00:00:00 2001 From: thguss Date: Wed, 24 Jan 2024 00:58:44 +0900 Subject: [PATCH 019/141] =?UTF-8?q?[CHORE]=20=EB=A6=AC=EB=B7=B0=20?= =?UTF-8?q?=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../makers/operation/config/GenerationConfig.java | 13 ------------- .../sopt/makers/operation/config/ValueConfig.java | 2 ++ .../dto/lecture/AttendanceResponseDTO.java | 8 +++++++- .../attendance/AttendanceRepositoryImpl.java | 10 ++++------ .../makers/operation/service/AlarmServiceImpl.java | 9 ++++----- .../operation/service/AttendanceServiceImpl.java | 11 +++-------- .../makers/operation/service/MemberServiceImpl.java | 10 ++++------ 7 files changed, 24 insertions(+), 39 deletions(-) delete mode 100644 src/main/java/org/sopt/makers/operation/config/GenerationConfig.java diff --git a/src/main/java/org/sopt/makers/operation/config/GenerationConfig.java b/src/main/java/org/sopt/makers/operation/config/GenerationConfig.java deleted file mode 100644 index 890de985..00000000 --- a/src/main/java/org/sopt/makers/operation/config/GenerationConfig.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.sopt.makers.operation.config; - -import lombok.Getter; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Configuration; - - -@Getter -@Configuration -public class GenerationConfig { - @Value("${sopt.current.generation}") - private int currentGeneration; -} diff --git a/src/main/java/org/sopt/makers/operation/config/ValueConfig.java b/src/main/java/org/sopt/makers/operation/config/ValueConfig.java index e979ce11..e38673ff 100644 --- a/src/main/java/org/sopt/makers/operation/config/ValueConfig.java +++ b/src/main/java/org/sopt/makers/operation/config/ValueConfig.java @@ -13,6 +13,8 @@ public class ValueConfig { private String ALARM_MESSAGE_TITLE; @Value("${sopt.alarm.message.content_end}") private String ALARM_MESSAGE_CONTENT; + @Value("${sopt.current.generation}") + private int GENERATION; private final int SUB_LECTURE_MAX_ROUND = 2; private final String ETC_MESSAGE = "출석 점수가 반영되지 않아요."; diff --git a/src/main/java/org/sopt/makers/operation/dto/lecture/AttendanceResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/lecture/AttendanceResponseDTO.java index ed025359..8e61faf9 100644 --- a/src/main/java/org/sopt/makers/operation/dto/lecture/AttendanceResponseDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/lecture/AttendanceResponseDTO.java @@ -3,12 +3,18 @@ import org.sopt.makers.operation.entity.SubLecture; import org.sopt.makers.operation.entity.lecture.Lecture; +import lombok.Builder; + +@Builder public record AttendanceResponseDTO( Long lectureId, Long subLectureId ) { public static AttendanceResponseDTO of(Lecture lecture, SubLecture subLecture) { - return new AttendanceResponseDTO(lecture.getId(), subLecture.getId()); + return AttendanceResponseDTO.builder() + .lectureId(lecture.getId()) + .subLectureId(subLecture.getId()) + .build(); } } diff --git a/src/main/java/org/sopt/makers/operation/repository/attendance/AttendanceRepositoryImpl.java b/src/main/java/org/sopt/makers/operation/repository/attendance/AttendanceRepositoryImpl.java index b84101a9..708592c1 100644 --- a/src/main/java/org/sopt/makers/operation/repository/attendance/AttendanceRepositoryImpl.java +++ b/src/main/java/org/sopt/makers/operation/repository/attendance/AttendanceRepositoryImpl.java @@ -15,12 +15,10 @@ import lombok.val; -import org.sopt.makers.operation.config.GenerationConfig; +import org.sopt.makers.operation.config.ValueConfig; import org.sopt.makers.operation.entity.Attendance; import org.sopt.makers.operation.entity.Member; import org.sopt.makers.operation.entity.Part; -import org.sopt.makers.operation.entity.QMember; -import org.sopt.makers.operation.entity.SubAttendance; import org.sopt.makers.operation.entity.lecture.LectureStatus; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Repository; @@ -35,7 +33,7 @@ public class AttendanceRepositoryImpl implements AttendanceCustomRepository { private final JPAQueryFactory queryFactory; - private final GenerationConfig generationConfig; + private final ValueConfig valueConfig; @Override public List findAttendanceByMemberId(Long memberId) { @@ -46,7 +44,7 @@ public List findAttendanceByMemberId(Long memberId) { .leftJoin(attendance.lecture, lecture) .where(attendance.member.id.eq(memberId), lecture.lectureStatus.eq(LectureStatus.END), - lecture.generation.eq(generationConfig.getCurrentGeneration()) + lecture.generation.eq(valueConfig.getGENERATION()) ) .orderBy(attendance.lecture.startDate.desc()) .fetch(); @@ -95,7 +93,7 @@ public List findToday(long memberPlaygroundId) { .leftJoin(subAttendance.subLecture, subLecture).fetchJoin() .where( member.playgroundId.eq(memberPlaygroundId), - member.generation.eq(generationConfig.getCurrentGeneration()), + member.generation.eq(valueConfig.getGENERATION()), lecture.part.eq(member.part).or(lecture.part.eq(Part.ALL)), lecture.startDate.between(startOfDay, endOfDay)) .orderBy(lecture.startDate.asc()) diff --git a/src/main/java/org/sopt/makers/operation/service/AlarmServiceImpl.java b/src/main/java/org/sopt/makers/operation/service/AlarmServiceImpl.java index 08c79780..a08a42dc 100644 --- a/src/main/java/org/sopt/makers/operation/service/AlarmServiceImpl.java +++ b/src/main/java/org/sopt/makers/operation/service/AlarmServiceImpl.java @@ -5,6 +5,7 @@ import static org.sopt.makers.operation.entity.Part.*; import static org.sopt.makers.operation.entity.alarm.Status.*; +import org.sopt.makers.operation.config.ValueConfig; import org.sopt.makers.operation.dto.alarm.AlarmSendRequestDTO; import org.sopt.makers.operation.dto.alarm.AlarmSenderDTO; import org.sopt.makers.operation.dto.member.MemberSearchCondition; @@ -15,7 +16,6 @@ import org.sopt.makers.operation.external.api.PlayGroundServer; import org.sopt.makers.operation.repository.alarm.AlarmRepository; import org.sopt.makers.operation.repository.member.MemberRepository; -import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -34,13 +34,12 @@ @Service @RequiredArgsConstructor public class AlarmServiceImpl implements AlarmService { - @Value("${sopt.current.generation}") - private int currentGeneration; private final AlarmRepository alarmRepository; private final MemberRepository memberRepository; private final AlarmSender alarmSender; private final PlayGroundServer playGroundServer; + private final ValueConfig valueConfig; @Override @Transactional @@ -68,7 +67,7 @@ private List getTargetIdList(Alarm alarm) { return activeTargetList; } - val inactiveTargetList = getInactiveTargetList(currentGeneration, alarm.getPart()); + val inactiveTargetList = getInactiveTargetList(valueConfig.getGENERATION(), alarm.getPart()); return inactiveTargetList.stream() .filter(target -> !activeTargetList.contains(target)) .toList(); @@ -76,7 +75,7 @@ private List getTargetIdList(Alarm alarm) { private List getActiveTargetList(Part part) { part = part.equals(ALL) ? null : part; - val members = memberRepository.search(new MemberSearchCondition(part, currentGeneration)); + val members = memberRepository.search(new MemberSearchCondition(part, valueConfig.getGENERATION())); return members.stream() .filter(member -> nonNull(member.getPlaygroundId())) .map(member -> String.valueOf(member.getPlaygroundId())) diff --git a/src/main/java/org/sopt/makers/operation/service/AttendanceServiceImpl.java b/src/main/java/org/sopt/makers/operation/service/AttendanceServiceImpl.java index 1d4e6645..7ac524b1 100644 --- a/src/main/java/org/sopt/makers/operation/service/AttendanceServiceImpl.java +++ b/src/main/java/org/sopt/makers/operation/service/AttendanceServiceImpl.java @@ -3,12 +3,10 @@ import static java.util.Objects.nonNull; import static org.sopt.makers.operation.common.ExceptionMessage.*; -import java.util.List; - +import org.sopt.makers.operation.config.ValueConfig; import org.sopt.makers.operation.dto.attendance.AttendanceMemberResponseDTO; import org.sopt.makers.operation.dto.attendance.SubAttendanceUpdateRequestDTO; import org.sopt.makers.operation.dto.attendance.SubAttendanceUpdateResponseDTO; -import org.sopt.makers.operation.dto.attendance.MemberResponseDTO; import lombok.val; import org.sopt.makers.operation.dto.attendance.*; import org.sopt.makers.operation.entity.AttendanceStatus; @@ -22,7 +20,6 @@ import org.sopt.makers.operation.exception.SubLectureException; import org.sopt.makers.operation.repository.lecture.SubLectureRepository; import org.sopt.makers.operation.repository.member.MemberRepository; -import org.springframework.beans.factory.annotation.Value; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -42,9 +39,7 @@ public class AttendanceServiceImpl implements AttendanceService { private final MemberRepository memberRepository; private final SubLectureRepository subLectureRepository; private final AttendanceRepository attendanceRepository; - - @Value("${sopt.current.generation}") - private int currentGeneration; + private final ValueConfig valueConfig; @Override @Transactional @@ -81,7 +76,7 @@ public AttendancesResponseDTO findAttendancesByLecture(Long lectureId, Part part @Transactional public AttendResponseDTO attend(Long playGroundId, AttendRequestDTO requestDTO) { log.info("[Attendance: attend start] id: " + playGroundId); - val member = memberRepository.getMemberByPlaygroundIdAndGeneration(playGroundId, currentGeneration) + val member = memberRepository.getMemberByPlaygroundIdAndGeneration(playGroundId, valueConfig.getGENERATION()) .orElseThrow(() -> new MemberException(INVALID_MEMBER.getName())); val memberId = member.getId(); diff --git a/src/main/java/org/sopt/makers/operation/service/MemberServiceImpl.java b/src/main/java/org/sopt/makers/operation/service/MemberServiceImpl.java index d4885baf..e1f57251 100644 --- a/src/main/java/org/sopt/makers/operation/service/MemberServiceImpl.java +++ b/src/main/java/org/sopt/makers/operation/service/MemberServiceImpl.java @@ -5,6 +5,7 @@ import lombok.RequiredArgsConstructor; import lombok.val; +import org.sopt.makers.operation.config.ValueConfig; import org.sopt.makers.operation.dto.attendance.AttendanceTotalCountVO; import org.sopt.makers.operation.dto.attendance.AttendanceTotalResponseDTO; import org.sopt.makers.operation.dto.attendance.AttendanceTotalVO; @@ -20,7 +21,6 @@ import org.sopt.makers.operation.exception.MemberException; import org.sopt.makers.operation.repository.attendance.AttendanceRepository; import org.sopt.makers.operation.repository.member.MemberRepository; -import org.springframework.beans.factory.annotation.Value; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; @@ -34,9 +34,7 @@ public class MemberServiceImpl implements MemberService { private final MemberRepository memberRepository; private final AttendanceRepository attendanceRepository; - - @Value("${sopt.current.generation}") - private int currentGeneration; + private final ValueConfig valueConfig; @Override public MembersResponseDTO getMemberList(Part part, int generation, Pageable pageable) { @@ -58,7 +56,7 @@ public MembersResponseDTO getMemberList(Part part, int generation, Pageable page @Override public AttendanceTotalResponseDTO getMemberTotalAttendance(Long playGroundId) { - val member = memberRepository.getMemberByPlaygroundIdAndGeneration(playGroundId, currentGeneration) + val member = memberRepository.getMemberByPlaygroundIdAndGeneration(playGroundId, valueConfig.getGENERATION()) .orElseThrow(() -> new MemberException(INVALID_MEMBER.getName())); val attendances = findAttendances(member); @@ -72,7 +70,7 @@ public AttendanceTotalResponseDTO getMemberTotalAttendance(Long playGroundId) { @Override public MemberScoreGetResponse getMemberScore(Long playGroundId) { - val member = memberRepository.getMemberByPlaygroundIdAndGeneration(playGroundId, currentGeneration) + val member = memberRepository.getMemberByPlaygroundIdAndGeneration(playGroundId, valueConfig.getGENERATION()) .orElseThrow(() -> new MemberException(INVALID_MEMBER.getName())); return MemberScoreGetResponse.of(member.getScore()); From 6484f3f05ef70ea400d1536a3054f74f2cdb7564 Mon Sep 17 00:00:00 2001 From: thguss Date: Wed, 24 Jan 2024 01:11:16 +0900 Subject: [PATCH 020/141] =?UTF-8?q?[CHORE]=20=ED=8C=A8=ED=82=A4=EC=A7=80?= =?UTF-8?q?=20=EB=A6=AC=ED=8C=A9=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../makers/operation/dto/admin/LoginResponseDTO.java | 4 ++-- .../makers/operation/dto/admin/SignUpRequestDTO.java | 2 +- .../makers/operation/dto/admin/SignUpResponseDTO.java | 2 +- .../dto/attendance/AttendanceMemberResponseDTO.java | 6 +++--- .../dto/attendance/AttendanceTotalResponseDTO.java | 2 +- .../operation/dto/attendance/AttendanceTotalVO.java | 4 ++-- .../dto/attendance/AttendancesResponseDTO.java | 2 +- .../operation/dto/attendance/MemberResponseDTO.java | 8 ++++---- .../dto/attendance/SubAttendanceUpdateRequestDTO.java | 2 +- .../dto/attendance/SubAttendanceUpdateResponseDTO.java | 4 ++-- .../operation/dto/lecture/AttendanceResponseDTO.java | 2 +- .../operation/dto/lecture/AttendancesStatusVO.java | 4 ++-- .../dto/lecture/LectureCurrentRoundResponseDTO.java | 2 +- .../operation/dto/lecture/LectureResponseDTO.java | 2 +- .../operation/dto/lecture/LectureSearchCondition.java | 2 +- .../operation/dto/lecture/TodayLectureResponseDTO.java | 4 ++-- .../operation/dto/member/MemberListGetResponse.java | 2 +- .../makers/operation/dto/member/MemberRequestDTO.java | 2 +- .../java/org/sopt/makers/operation/entity/ObYb.java | 5 ----- .../makers/operation/entity/{ => admin}/Admin.java | 2 +- .../operation/entity/{ => admin}/AdminStatus.java | 2 +- .../sopt/makers/operation/entity/{ => admin}/Role.java | 2 +- .../operation/entity/{ => attendance}/Attendance.java | 5 +++-- .../entity/{ => attendance}/AttendanceStatus.java | 2 +- .../entity/{ => attendance}/SubAttendance.java | 5 ++++- .../sopt/makers/operation/entity/lecture/Lecture.java | 3 +-- .../operation/entity/{ => lecture}/SubLecture.java | 3 ++- .../makers/operation/entity/{ => member}/Member.java | 4 +++- .../org/sopt/makers/operation/entity/member/ObYb.java | 5 +++++ .../operation/external/{api => alarm}/AlarmSender.java | 2 +- .../external/{api => alarm}/AlarmSenderImpl.java | 2 +- .../external/{api => playground}/PlayGroundServer.java | 2 +- .../{api => playground}/PlayGroundServerImpl.java | 2 +- .../ErrorHandler.java} | 4 ++-- .../makers/operation/repository/AdminRepository.java | 2 +- .../attendance/AttendanceCustomRepository.java | 6 ++---- .../repository/attendance/AttendanceRepository.java | 2 +- .../attendance/AttendanceRepositoryImpl.java | 4 ++-- .../{ => attendance}/SubAttendanceRepository.java | 6 +++--- .../repository/lecture/SubLectureRepository.java | 2 +- .../repository/member/MemberCustomRepository.java | 2 +- .../operation/repository/member/MemberRepository.java | 2 +- .../repository/member/MemberRepositoryImpl.java | 2 +- .../repository/schedule/ScheduleRepository.java | 2 +- .../LectureScheduler.java} | 8 ++++---- .../makers/operation/service/AdminServiceImpl.java | 4 ++-- .../makers/operation/service/AlarmServiceImpl.java | 4 ++-- .../operation/service/AttendanceServiceImpl.java | 8 ++++---- .../makers/operation/service/LectureServiceImpl.java | 10 +++++++--- .../makers/operation/service/MemberServiceImpl.java | 4 ++-- .../sopt/makers/operation/fixture/LectureFixture.java | 2 +- .../operation/service/LectureServiceImplTest.java | 2 +- 52 files changed, 93 insertions(+), 85 deletions(-) delete mode 100644 src/main/java/org/sopt/makers/operation/entity/ObYb.java rename src/main/java/org/sopt/makers/operation/entity/{ => admin}/Admin.java (95%) rename src/main/java/org/sopt/makers/operation/entity/{ => admin}/AdminStatus.java (60%) rename src/main/java/org/sopt/makers/operation/entity/{ => admin}/Role.java (74%) rename src/main/java/org/sopt/makers/operation/entity/{ => attendance}/Attendance.java (94%) rename src/main/java/org/sopt/makers/operation/entity/{ => attendance}/AttendanceStatus.java (83%) rename src/main/java/org/sopt/makers/operation/entity/{ => attendance}/SubAttendance.java (90%) rename src/main/java/org/sopt/makers/operation/entity/{ => lecture}/SubLecture.java (93%) rename src/main/java/org/sopt/makers/operation/entity/{ => member}/Member.java (91%) create mode 100644 src/main/java/org/sopt/makers/operation/entity/member/ObYb.java rename src/main/java/org/sopt/makers/operation/external/{api => alarm}/AlarmSender.java (73%) rename src/main/java/org/sopt/makers/operation/external/{api => alarm}/AlarmSenderImpl.java (98%) rename src/main/java/org/sopt/makers/operation/external/{api => playground}/PlayGroundServer.java (81%) rename src/main/java/org/sopt/makers/operation/external/{api => playground}/PlayGroundServerImpl.java (97%) rename src/main/java/org/sopt/makers/operation/{controller/ExceptionController.java => handler/ErrorHandler.java} (96%) rename src/main/java/org/sopt/makers/operation/repository/{ => attendance}/SubAttendanceRepository.java (72%) rename src/main/java/org/sopt/makers/operation/{controller/ScheduleController.java => scheduler/LectureScheduler.java} (72%) diff --git a/src/main/java/org/sopt/makers/operation/dto/admin/LoginResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/admin/LoginResponseDTO.java index 64fb28c3..fdabcf8c 100644 --- a/src/main/java/org/sopt/makers/operation/dto/admin/LoginResponseDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/admin/LoginResponseDTO.java @@ -1,8 +1,8 @@ package org.sopt.makers.operation.dto.admin; import lombok.Builder; -import org.sopt.makers.operation.entity.Admin; -import org.sopt.makers.operation.entity.AdminStatus; +import org.sopt.makers.operation.entity.admin.Admin; +import org.sopt.makers.operation.entity.admin.AdminStatus; @Builder public record LoginResponseDTO(LoginResponseVO loginResponseVO, String refreshToken) { diff --git a/src/main/java/org/sopt/makers/operation/dto/admin/SignUpRequestDTO.java b/src/main/java/org/sopt/makers/operation/dto/admin/SignUpRequestDTO.java index 9ef629b9..2dda7189 100644 --- a/src/main/java/org/sopt/makers/operation/dto/admin/SignUpRequestDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/admin/SignUpRequestDTO.java @@ -1,6 +1,6 @@ package org.sopt.makers.operation.dto.admin; -import org.sopt.makers.operation.entity.Role; +import org.sopt.makers.operation.entity.admin.Role; public record SignUpRequestDTO( String email, diff --git a/src/main/java/org/sopt/makers/operation/dto/admin/SignUpResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/admin/SignUpResponseDTO.java index a2dd5574..15616af4 100644 --- a/src/main/java/org/sopt/makers/operation/dto/admin/SignUpResponseDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/admin/SignUpResponseDTO.java @@ -1,6 +1,6 @@ package org.sopt.makers.operation.dto.admin; -import org.sopt.makers.operation.entity.Role; +import org.sopt.makers.operation.entity.admin.Role; public record SignUpResponseDTO( Long id, diff --git a/src/main/java/org/sopt/makers/operation/dto/attendance/AttendanceMemberResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/attendance/AttendanceMemberResponseDTO.java index ed0909b9..59705d21 100644 --- a/src/main/java/org/sopt/makers/operation/dto/attendance/AttendanceMemberResponseDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/attendance/AttendanceMemberResponseDTO.java @@ -2,9 +2,9 @@ import java.util.List; -import org.sopt.makers.operation.entity.Attendance; -import org.sopt.makers.operation.entity.Member; -import org.sopt.makers.operation.entity.SubAttendance; +import org.sopt.makers.operation.entity.attendance.Attendance; +import org.sopt.makers.operation.entity.member.Member; +import org.sopt.makers.operation.entity.attendance.SubAttendance; public record AttendanceMemberResponseDTO( String name, diff --git a/src/main/java/org/sopt/makers/operation/dto/attendance/AttendanceTotalResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/attendance/AttendanceTotalResponseDTO.java index 13cecdd6..42f509c5 100644 --- a/src/main/java/org/sopt/makers/operation/dto/attendance/AttendanceTotalResponseDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/attendance/AttendanceTotalResponseDTO.java @@ -1,6 +1,6 @@ package org.sopt.makers.operation.dto.attendance; -import org.sopt.makers.operation.entity.Member; +import org.sopt.makers.operation.entity.member.Member; import org.sopt.makers.operation.entity.Part; import java.util.List; diff --git a/src/main/java/org/sopt/makers/operation/dto/attendance/AttendanceTotalVO.java b/src/main/java/org/sopt/makers/operation/dto/attendance/AttendanceTotalVO.java index 0d576ca2..b18df121 100644 --- a/src/main/java/org/sopt/makers/operation/dto/attendance/AttendanceTotalVO.java +++ b/src/main/java/org/sopt/makers/operation/dto/attendance/AttendanceTotalVO.java @@ -1,7 +1,7 @@ package org.sopt.makers.operation.dto.attendance; -import org.sopt.makers.operation.entity.Attendance; -import org.sopt.makers.operation.entity.AttendanceStatus; +import org.sopt.makers.operation.entity.attendance.Attendance; +import org.sopt.makers.operation.entity.attendance.AttendanceStatus; import org.sopt.makers.operation.entity.lecture.Attribute; import java.time.format.DateTimeFormatter; diff --git a/src/main/java/org/sopt/makers/operation/dto/attendance/AttendancesResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/attendance/AttendancesResponseDTO.java index 10852bf6..5a204213 100644 --- a/src/main/java/org/sopt/makers/operation/dto/attendance/AttendancesResponseDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/attendance/AttendancesResponseDTO.java @@ -2,7 +2,7 @@ import java.util.List; -import org.sopt.makers.operation.entity.Attendance; +import org.sopt.makers.operation.entity.attendance.Attendance; public record AttendancesResponseDTO( List attendances, diff --git a/src/main/java/org/sopt/makers/operation/dto/attendance/MemberResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/attendance/MemberResponseDTO.java index 39e24970..60568a90 100644 --- a/src/main/java/org/sopt/makers/operation/dto/attendance/MemberResponseDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/attendance/MemberResponseDTO.java @@ -2,10 +2,10 @@ import java.util.List; -import org.sopt.makers.operation.entity.Attendance; -import org.sopt.makers.operation.entity.AttendanceStatus; -import org.sopt.makers.operation.entity.Member; -import org.sopt.makers.operation.entity.SubAttendance; +import org.sopt.makers.operation.entity.attendance.Attendance; +import org.sopt.makers.operation.entity.attendance.AttendanceStatus; +import org.sopt.makers.operation.entity.member.Member; +import org.sopt.makers.operation.entity.attendance.SubAttendance; public record MemberResponseDTO ( Long attendanceId, diff --git a/src/main/java/org/sopt/makers/operation/dto/attendance/SubAttendanceUpdateRequestDTO.java b/src/main/java/org/sopt/makers/operation/dto/attendance/SubAttendanceUpdateRequestDTO.java index ba430b0d..3f7634da 100644 --- a/src/main/java/org/sopt/makers/operation/dto/attendance/SubAttendanceUpdateRequestDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/attendance/SubAttendanceUpdateRequestDTO.java @@ -1,6 +1,6 @@ package org.sopt.makers.operation.dto.attendance; -import org.sopt.makers.operation.entity.AttendanceStatus; +import org.sopt.makers.operation.entity.attendance.AttendanceStatus; public record SubAttendanceUpdateRequestDTO( Long subAttendanceId, diff --git a/src/main/java/org/sopt/makers/operation/dto/attendance/SubAttendanceUpdateResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/attendance/SubAttendanceUpdateResponseDTO.java index 482b529a..8661181a 100644 --- a/src/main/java/org/sopt/makers/operation/dto/attendance/SubAttendanceUpdateResponseDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/attendance/SubAttendanceUpdateResponseDTO.java @@ -1,7 +1,7 @@ package org.sopt.makers.operation.dto.attendance; -import org.sopt.makers.operation.entity.AttendanceStatus; -import org.sopt.makers.operation.entity.SubAttendance; +import org.sopt.makers.operation.entity.attendance.AttendanceStatus; +import org.sopt.makers.operation.entity.attendance.SubAttendance; public record SubAttendanceUpdateResponseDTO( Long subAttendanceId, diff --git a/src/main/java/org/sopt/makers/operation/dto/lecture/AttendanceResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/lecture/AttendanceResponseDTO.java index 8e61faf9..10690fda 100644 --- a/src/main/java/org/sopt/makers/operation/dto/lecture/AttendanceResponseDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/lecture/AttendanceResponseDTO.java @@ -1,6 +1,6 @@ package org.sopt.makers.operation.dto.lecture; -import org.sopt.makers.operation.entity.SubLecture; +import org.sopt.makers.operation.entity.lecture.SubLecture; import org.sopt.makers.operation.entity.lecture.Lecture; import lombok.Builder; diff --git a/src/main/java/org/sopt/makers/operation/dto/lecture/AttendancesStatusVO.java b/src/main/java/org/sopt/makers/operation/dto/lecture/AttendancesStatusVO.java index b2a33c87..663d4b58 100644 --- a/src/main/java/org/sopt/makers/operation/dto/lecture/AttendancesStatusVO.java +++ b/src/main/java/org/sopt/makers/operation/dto/lecture/AttendancesStatusVO.java @@ -1,10 +1,10 @@ package org.sopt.makers.operation.dto.lecture; -import static org.sopt.makers.operation.entity.AttendanceStatus.*; +import static org.sopt.makers.operation.entity.attendance.AttendanceStatus.*; import java.time.LocalDateTime; -import org.sopt.makers.operation.entity.AttendanceStatus; +import org.sopt.makers.operation.entity.attendance.AttendanceStatus; import org.sopt.makers.operation.entity.lecture.Lecture; import lombok.Builder; diff --git a/src/main/java/org/sopt/makers/operation/dto/lecture/LectureCurrentRoundResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/lecture/LectureCurrentRoundResponseDTO.java index d07f21c2..ecc2af8c 100644 --- a/src/main/java/org/sopt/makers/operation/dto/lecture/LectureCurrentRoundResponseDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/lecture/LectureCurrentRoundResponseDTO.java @@ -1,6 +1,6 @@ package org.sopt.makers.operation.dto.lecture; -import org.sopt.makers.operation.entity.SubLecture; +import org.sopt.makers.operation.entity.lecture.SubLecture; public record LectureCurrentRoundResponseDTO( Long id, diff --git a/src/main/java/org/sopt/makers/operation/dto/lecture/LectureResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/lecture/LectureResponseDTO.java index 81a07c6b..edf4c2c6 100644 --- a/src/main/java/org/sopt/makers/operation/dto/lecture/LectureResponseDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/lecture/LectureResponseDTO.java @@ -6,7 +6,7 @@ import java.util.List; import org.sopt.makers.operation.entity.Part; -import org.sopt.makers.operation.entity.SubLecture; +import org.sopt.makers.operation.entity.lecture.SubLecture; import org.sopt.makers.operation.entity.lecture.Attribute; import org.sopt.makers.operation.entity.lecture.Lecture; import org.sopt.makers.operation.entity.lecture.LectureStatus; diff --git a/src/main/java/org/sopt/makers/operation/dto/lecture/LectureSearchCondition.java b/src/main/java/org/sopt/makers/operation/dto/lecture/LectureSearchCondition.java index 3ac25110..49672978 100644 --- a/src/main/java/org/sopt/makers/operation/dto/lecture/LectureSearchCondition.java +++ b/src/main/java/org/sopt/makers/operation/dto/lecture/LectureSearchCondition.java @@ -1,6 +1,6 @@ package org.sopt.makers.operation.dto.lecture; -import org.sopt.makers.operation.entity.Member; +import org.sopt.makers.operation.entity.member.Member; import org.sopt.makers.operation.entity.Part; public record LectureSearchCondition(Part part, int generation, Long memberId) { diff --git a/src/main/java/org/sopt/makers/operation/dto/lecture/TodayLectureResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/lecture/TodayLectureResponseDTO.java index 40685563..01127353 100644 --- a/src/main/java/org/sopt/makers/operation/dto/lecture/TodayLectureResponseDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/lecture/TodayLectureResponseDTO.java @@ -1,8 +1,8 @@ package org.sopt.makers.operation.dto.lecture; import lombok.Builder; -import org.sopt.makers.operation.entity.AttendanceStatus; -import org.sopt.makers.operation.entity.SubAttendance; +import org.sopt.makers.operation.entity.attendance.AttendanceStatus; +import org.sopt.makers.operation.entity.attendance.SubAttendance; import org.sopt.makers.operation.entity.lecture.Lecture; import java.time.LocalDateTime; diff --git a/src/main/java/org/sopt/makers/operation/dto/member/MemberListGetResponse.java b/src/main/java/org/sopt/makers/operation/dto/member/MemberListGetResponse.java index db40b34e..d30f24bd 100644 --- a/src/main/java/org/sopt/makers/operation/dto/member/MemberListGetResponse.java +++ b/src/main/java/org/sopt/makers/operation/dto/member/MemberListGetResponse.java @@ -1,7 +1,7 @@ package org.sopt.makers.operation.dto.member; import org.sopt.makers.operation.dto.attendance.AttendanceTotalCountVO; -import org.sopt.makers.operation.entity.Member; +import org.sopt.makers.operation.entity.member.Member; import org.sopt.makers.operation.entity.Part; public record MemberListGetResponse( diff --git a/src/main/java/org/sopt/makers/operation/dto/member/MemberRequestDTO.java b/src/main/java/org/sopt/makers/operation/dto/member/MemberRequestDTO.java index 423bb1f1..136bb649 100644 --- a/src/main/java/org/sopt/makers/operation/dto/member/MemberRequestDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/member/MemberRequestDTO.java @@ -1,6 +1,6 @@ package org.sopt.makers.operation.dto.member; -import org.sopt.makers.operation.entity.ObYb; +import org.sopt.makers.operation.entity.member.ObYb; import org.sopt.makers.operation.entity.Part; public record MemberRequestDTO( diff --git a/src/main/java/org/sopt/makers/operation/entity/ObYb.java b/src/main/java/org/sopt/makers/operation/entity/ObYb.java deleted file mode 100644 index 2103662d..00000000 --- a/src/main/java/org/sopt/makers/operation/entity/ObYb.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.sopt.makers.operation.entity; - -public enum ObYb { - OB, YB -} diff --git a/src/main/java/org/sopt/makers/operation/entity/Admin.java b/src/main/java/org/sopt/makers/operation/entity/admin/Admin.java similarity index 95% rename from src/main/java/org/sopt/makers/operation/entity/Admin.java rename to src/main/java/org/sopt/makers/operation/entity/admin/Admin.java index f6fd1bef..e7b3692d 100644 --- a/src/main/java/org/sopt/makers/operation/entity/Admin.java +++ b/src/main/java/org/sopt/makers/operation/entity/admin/Admin.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.entity; +package org.sopt.makers.operation.entity.admin; import lombok.Builder; import lombok.Getter; diff --git a/src/main/java/org/sopt/makers/operation/entity/AdminStatus.java b/src/main/java/org/sopt/makers/operation/entity/admin/AdminStatus.java similarity index 60% rename from src/main/java/org/sopt/makers/operation/entity/AdminStatus.java rename to src/main/java/org/sopt/makers/operation/entity/admin/AdminStatus.java index 980530d3..ae7410b3 100644 --- a/src/main/java/org/sopt/makers/operation/entity/AdminStatus.java +++ b/src/main/java/org/sopt/makers/operation/entity/admin/AdminStatus.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.entity; +package org.sopt.makers.operation.entity.admin; public enum AdminStatus { DEVELOPER, SOPT, MAKERS, NOT_CERTIFIED diff --git a/src/main/java/org/sopt/makers/operation/entity/Role.java b/src/main/java/org/sopt/makers/operation/entity/admin/Role.java similarity index 74% rename from src/main/java/org/sopt/makers/operation/entity/Role.java rename to src/main/java/org/sopt/makers/operation/entity/admin/Role.java index a9709150..f4429ea5 100644 --- a/src/main/java/org/sopt/makers/operation/entity/Role.java +++ b/src/main/java/org/sopt/makers/operation/entity/admin/Role.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.entity; +package org.sopt.makers.operation.entity.admin; public enum Role { OPERATION_TEAM, PRESIDENT, VICE_PRESIDENT, AFFAIRS, MANAGE, MEDIA, PLAN, DESIGN, WEB, ANDROID, IOS, SERVER, MAKERS diff --git a/src/main/java/org/sopt/makers/operation/entity/Attendance.java b/src/main/java/org/sopt/makers/operation/entity/attendance/Attendance.java similarity index 94% rename from src/main/java/org/sopt/makers/operation/entity/Attendance.java rename to src/main/java/org/sopt/makers/operation/entity/attendance/Attendance.java index 7539f0f4..e11fa9db 100644 --- a/src/main/java/org/sopt/makers/operation/entity/Attendance.java +++ b/src/main/java/org/sopt/makers/operation/entity/attendance/Attendance.java @@ -1,8 +1,8 @@ -package org.sopt.makers.operation.entity; +package org.sopt.makers.operation.entity.attendance; import static javax.persistence.GenerationType.*; import static org.sopt.makers.operation.common.ExceptionMessage.*; -import static org.sopt.makers.operation.entity.AttendanceStatus.*; +import static org.sopt.makers.operation.entity.attendance.AttendanceStatus.*; import java.util.ArrayList; import java.util.List; @@ -20,6 +20,7 @@ import javax.persistence.ManyToOne; import javax.persistence.OneToMany; +import org.sopt.makers.operation.entity.member.Member; import org.sopt.makers.operation.entity.lecture.Lecture; import lombok.*; diff --git a/src/main/java/org/sopt/makers/operation/entity/AttendanceStatus.java b/src/main/java/org/sopt/makers/operation/entity/attendance/AttendanceStatus.java similarity index 83% rename from src/main/java/org/sopt/makers/operation/entity/AttendanceStatus.java rename to src/main/java/org/sopt/makers/operation/entity/attendance/AttendanceStatus.java index acd573cb..6a6e0666 100644 --- a/src/main/java/org/sopt/makers/operation/entity/AttendanceStatus.java +++ b/src/main/java/org/sopt/makers/operation/entity/attendance/AttendanceStatus.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.entity; +package org.sopt.makers.operation.entity.attendance; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/src/main/java/org/sopt/makers/operation/entity/SubAttendance.java b/src/main/java/org/sopt/makers/operation/entity/attendance/SubAttendance.java similarity index 90% rename from src/main/java/org/sopt/makers/operation/entity/SubAttendance.java rename to src/main/java/org/sopt/makers/operation/entity/attendance/SubAttendance.java index 0099b00d..81ca1d23 100644 --- a/src/main/java/org/sopt/makers/operation/entity/SubAttendance.java +++ b/src/main/java/org/sopt/makers/operation/entity/attendance/SubAttendance.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.entity; +package org.sopt.makers.operation.entity.attendance; import static javax.persistence.GenerationType.*; @@ -14,6 +14,9 @@ import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; +import org.sopt.makers.operation.entity.BaseEntity; +import org.sopt.makers.operation.entity.lecture.SubLecture; + import lombok.Getter; import lombok.NoArgsConstructor; diff --git a/src/main/java/org/sopt/makers/operation/entity/lecture/Lecture.java b/src/main/java/org/sopt/makers/operation/entity/lecture/Lecture.java index 8fd2b9af..55bf09ba 100644 --- a/src/main/java/org/sopt/makers/operation/entity/lecture/Lecture.java +++ b/src/main/java/org/sopt/makers/operation/entity/lecture/Lecture.java @@ -15,10 +15,9 @@ import javax.persistence.Id; import javax.persistence.OneToMany; -import org.sopt.makers.operation.entity.Attendance; +import org.sopt.makers.operation.entity.attendance.Attendance; import org.sopt.makers.operation.entity.BaseEntity; import org.sopt.makers.operation.entity.Part; -import org.sopt.makers.operation.entity.SubLecture; import lombok.Builder; import lombok.Getter; diff --git a/src/main/java/org/sopt/makers/operation/entity/SubLecture.java b/src/main/java/org/sopt/makers/operation/entity/lecture/SubLecture.java similarity index 93% rename from src/main/java/org/sopt/makers/operation/entity/SubLecture.java rename to src/main/java/org/sopt/makers/operation/entity/lecture/SubLecture.java index b38dfca7..77eeb510 100644 --- a/src/main/java/org/sopt/makers/operation/entity/SubLecture.java +++ b/src/main/java/org/sopt/makers/operation/entity/lecture/SubLecture.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.entity; +package org.sopt.makers.operation.entity.lecture; import static javax.persistence.GenerationType.*; import static org.sopt.makers.operation.entity.lecture.LectureStatus.*; @@ -17,6 +17,7 @@ import javax.persistence.ManyToOne; import javax.persistence.OneToMany; +import org.sopt.makers.operation.entity.attendance.SubAttendance; import org.sopt.makers.operation.entity.lecture.Lecture; import org.sopt.makers.operation.entity.lecture.LectureStatus; diff --git a/src/main/java/org/sopt/makers/operation/entity/Member.java b/src/main/java/org/sopt/makers/operation/entity/member/Member.java similarity index 91% rename from src/main/java/org/sopt/makers/operation/entity/Member.java rename to src/main/java/org/sopt/makers/operation/entity/member/Member.java index 6cf13b7e..acd5675a 100644 --- a/src/main/java/org/sopt/makers/operation/entity/Member.java +++ b/src/main/java/org/sopt/makers/operation/entity/member/Member.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.entity; +package org.sopt.makers.operation.entity.member; import static org.sopt.makers.operation.entity.lecture.LectureStatus.*; @@ -15,6 +15,8 @@ import javax.persistence.OneToMany; import org.sopt.makers.operation.dto.member.MemberRequestDTO; +import org.sopt.makers.operation.entity.Part; +import org.sopt.makers.operation.entity.attendance.Attendance; import lombok.Getter; import lombok.NoArgsConstructor; diff --git a/src/main/java/org/sopt/makers/operation/entity/member/ObYb.java b/src/main/java/org/sopt/makers/operation/entity/member/ObYb.java new file mode 100644 index 00000000..0041bffb --- /dev/null +++ b/src/main/java/org/sopt/makers/operation/entity/member/ObYb.java @@ -0,0 +1,5 @@ +package org.sopt.makers.operation.entity.member; + +public enum ObYb { + OB, YB +} diff --git a/src/main/java/org/sopt/makers/operation/external/api/AlarmSender.java b/src/main/java/org/sopt/makers/operation/external/alarm/AlarmSender.java similarity index 73% rename from src/main/java/org/sopt/makers/operation/external/api/AlarmSender.java rename to src/main/java/org/sopt/makers/operation/external/alarm/AlarmSender.java index e45a2fe5..e9437619 100644 --- a/src/main/java/org/sopt/makers/operation/external/api/AlarmSender.java +++ b/src/main/java/org/sopt/makers/operation/external/alarm/AlarmSender.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.external.api; +package org.sopt.makers.operation.external.alarm; import org.sopt.makers.operation.dto.alarm.AlarmSenderDTO; diff --git a/src/main/java/org/sopt/makers/operation/external/api/AlarmSenderImpl.java b/src/main/java/org/sopt/makers/operation/external/alarm/AlarmSenderImpl.java similarity index 98% rename from src/main/java/org/sopt/makers/operation/external/api/AlarmSenderImpl.java rename to src/main/java/org/sopt/makers/operation/external/alarm/AlarmSenderImpl.java index d6bf50ff..5a3f636d 100644 --- a/src/main/java/org/sopt/makers/operation/external/api/AlarmSenderImpl.java +++ b/src/main/java/org/sopt/makers/operation/external/alarm/AlarmSenderImpl.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.external.api; +package org.sopt.makers.operation.external.alarm; import static java.util.Objects.*; import static java.util.UUID.*; diff --git a/src/main/java/org/sopt/makers/operation/external/api/PlayGroundServer.java b/src/main/java/org/sopt/makers/operation/external/playground/PlayGroundServer.java similarity index 81% rename from src/main/java/org/sopt/makers/operation/external/api/PlayGroundServer.java rename to src/main/java/org/sopt/makers/operation/external/playground/PlayGroundServer.java index 0c11ef79..5e886335 100644 --- a/src/main/java/org/sopt/makers/operation/external/api/PlayGroundServer.java +++ b/src/main/java/org/sopt/makers/operation/external/playground/PlayGroundServer.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.external.api; +package org.sopt.makers.operation.external.playground; import org.sopt.makers.operation.dto.alarm.AlarmInactiveListResponseDTO; import org.sopt.makers.operation.entity.Part; diff --git a/src/main/java/org/sopt/makers/operation/external/api/PlayGroundServerImpl.java b/src/main/java/org/sopt/makers/operation/external/playground/PlayGroundServerImpl.java similarity index 97% rename from src/main/java/org/sopt/makers/operation/external/api/PlayGroundServerImpl.java rename to src/main/java/org/sopt/makers/operation/external/playground/PlayGroundServerImpl.java index 3710228f..6e54253c 100644 --- a/src/main/java/org/sopt/makers/operation/external/api/PlayGroundServerImpl.java +++ b/src/main/java/org/sopt/makers/operation/external/playground/PlayGroundServerImpl.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.external.api; +package org.sopt.makers.operation.external.playground; import static org.sopt.makers.operation.common.ExceptionMessage.*; import static org.sopt.makers.operation.entity.Part.*; diff --git a/src/main/java/org/sopt/makers/operation/controller/ExceptionController.java b/src/main/java/org/sopt/makers/operation/handler/ErrorHandler.java similarity index 96% rename from src/main/java/org/sopt/makers/operation/controller/ExceptionController.java rename to src/main/java/org/sopt/makers/operation/handler/ErrorHandler.java index 6e9e4f83..b5426500 100644 --- a/src/main/java/org/sopt/makers/operation/controller/ExceptionController.java +++ b/src/main/java/org/sopt/makers/operation/handler/ErrorHandler.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.controller; +package org.sopt.makers.operation.handler; import static org.sopt.makers.operation.common.ApiResponse.*; import static org.sopt.makers.operation.common.ExceptionMessage.*; @@ -15,7 +15,7 @@ @Slf4j @RestControllerAdvice -public class ExceptionController { +public class ErrorHandler { @ExceptionHandler(AdminFailureException.class) public ResponseEntity authFailureException (AdminFailureException ex) { log.error(ex.getMessage()); diff --git a/src/main/java/org/sopt/makers/operation/repository/AdminRepository.java b/src/main/java/org/sopt/makers/operation/repository/AdminRepository.java index 7bb0beac..4a0894f8 100644 --- a/src/main/java/org/sopt/makers/operation/repository/AdminRepository.java +++ b/src/main/java/org/sopt/makers/operation/repository/AdminRepository.java @@ -1,6 +1,6 @@ package org.sopt.makers.operation.repository; -import org.sopt.makers.operation.entity.Admin; +import org.sopt.makers.operation.entity.admin.Admin; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; diff --git a/src/main/java/org/sopt/makers/operation/repository/attendance/AttendanceCustomRepository.java b/src/main/java/org/sopt/makers/operation/repository/attendance/AttendanceCustomRepository.java index 40e8f7cf..40c43981 100644 --- a/src/main/java/org/sopt/makers/operation/repository/attendance/AttendanceCustomRepository.java +++ b/src/main/java/org/sopt/makers/operation/repository/attendance/AttendanceCustomRepository.java @@ -2,11 +2,9 @@ import java.util.List; -import org.sopt.makers.operation.entity.Attendance; -import org.sopt.makers.operation.entity.Member; +import org.sopt.makers.operation.entity.attendance.Attendance; +import org.sopt.makers.operation.entity.member.Member; import org.sopt.makers.operation.entity.Part; -import org.sopt.makers.operation.entity.SubAttendance; -import org.sopt.makers.operation.entity.lecture.Lecture; import org.springframework.data.domain.Pageable; public interface AttendanceCustomRepository { diff --git a/src/main/java/org/sopt/makers/operation/repository/attendance/AttendanceRepository.java b/src/main/java/org/sopt/makers/operation/repository/attendance/AttendanceRepository.java index 3e5cc2f6..6edcebfe 100644 --- a/src/main/java/org/sopt/makers/operation/repository/attendance/AttendanceRepository.java +++ b/src/main/java/org/sopt/makers/operation/repository/attendance/AttendanceRepository.java @@ -1,6 +1,6 @@ package org.sopt.makers.operation.repository.attendance; -import org.sopt.makers.operation.entity.Attendance; +import org.sopt.makers.operation.entity.attendance.Attendance; import org.sopt.makers.operation.entity.lecture.Lecture; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Modifying; diff --git a/src/main/java/org/sopt/makers/operation/repository/attendance/AttendanceRepositoryImpl.java b/src/main/java/org/sopt/makers/operation/repository/attendance/AttendanceRepositoryImpl.java index 708592c1..535cbb48 100644 --- a/src/main/java/org/sopt/makers/operation/repository/attendance/AttendanceRepositoryImpl.java +++ b/src/main/java/org/sopt/makers/operation/repository/attendance/AttendanceRepositoryImpl.java @@ -16,8 +16,8 @@ import lombok.val; import org.sopt.makers.operation.config.ValueConfig; -import org.sopt.makers.operation.entity.Attendance; -import org.sopt.makers.operation.entity.Member; +import org.sopt.makers.operation.entity.attendance.Attendance; +import org.sopt.makers.operation.entity.member.Member; import org.sopt.makers.operation.entity.Part; import org.sopt.makers.operation.entity.lecture.LectureStatus; import org.springframework.data.domain.Pageable; diff --git a/src/main/java/org/sopt/makers/operation/repository/SubAttendanceRepository.java b/src/main/java/org/sopt/makers/operation/repository/attendance/SubAttendanceRepository.java similarity index 72% rename from src/main/java/org/sopt/makers/operation/repository/SubAttendanceRepository.java rename to src/main/java/org/sopt/makers/operation/repository/attendance/SubAttendanceRepository.java index 8362cbfe..5d8caaa6 100644 --- a/src/main/java/org/sopt/makers/operation/repository/SubAttendanceRepository.java +++ b/src/main/java/org/sopt/makers/operation/repository/attendance/SubAttendanceRepository.java @@ -1,9 +1,9 @@ -package org.sopt.makers.operation.repository; +package org.sopt.makers.operation.repository.attendance; import java.util.List; -import org.sopt.makers.operation.entity.SubAttendance; -import org.sopt.makers.operation.entity.SubLecture; +import org.sopt.makers.operation.entity.attendance.SubAttendance; +import org.sopt.makers.operation.entity.lecture.SubLecture; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; diff --git a/src/main/java/org/sopt/makers/operation/repository/lecture/SubLectureRepository.java b/src/main/java/org/sopt/makers/operation/repository/lecture/SubLectureRepository.java index 4eeb7d85..1e33f3b7 100644 --- a/src/main/java/org/sopt/makers/operation/repository/lecture/SubLectureRepository.java +++ b/src/main/java/org/sopt/makers/operation/repository/lecture/SubLectureRepository.java @@ -1,6 +1,6 @@ package org.sopt.makers.operation.repository.lecture; -import org.sopt.makers.operation.entity.SubLecture; +import org.sopt.makers.operation.entity.lecture.SubLecture; import org.sopt.makers.operation.entity.lecture.Lecture; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Modifying; diff --git a/src/main/java/org/sopt/makers/operation/repository/member/MemberCustomRepository.java b/src/main/java/org/sopt/makers/operation/repository/member/MemberCustomRepository.java index e54fd4b3..03aa323a 100644 --- a/src/main/java/org/sopt/makers/operation/repository/member/MemberCustomRepository.java +++ b/src/main/java/org/sopt/makers/operation/repository/member/MemberCustomRepository.java @@ -4,7 +4,7 @@ import java.util.Optional; import org.sopt.makers.operation.dto.member.MemberSearchCondition; -import org.sopt.makers.operation.entity.Member; +import org.sopt.makers.operation.entity.member.Member; import org.sopt.makers.operation.entity.Part; import org.springframework.data.domain.Pageable; diff --git a/src/main/java/org/sopt/makers/operation/repository/member/MemberRepository.java b/src/main/java/org/sopt/makers/operation/repository/member/MemberRepository.java index ec0c0cbe..04a0b400 100644 --- a/src/main/java/org/sopt/makers/operation/repository/member/MemberRepository.java +++ b/src/main/java/org/sopt/makers/operation/repository/member/MemberRepository.java @@ -1,6 +1,6 @@ package org.sopt.makers.operation.repository.member; -import org.sopt.makers.operation.entity.Member; +import org.sopt.makers.operation.entity.member.Member; import org.springframework.data.jpa.repository.JpaRepository; import java.util.Optional; diff --git a/src/main/java/org/sopt/makers/operation/repository/member/MemberRepositoryImpl.java b/src/main/java/org/sopt/makers/operation/repository/member/MemberRepositoryImpl.java index 4bfc6858..b54a64d3 100644 --- a/src/main/java/org/sopt/makers/operation/repository/member/MemberRepositoryImpl.java +++ b/src/main/java/org/sopt/makers/operation/repository/member/MemberRepositoryImpl.java @@ -12,7 +12,7 @@ import com.querydsl.core.types.dsl.Expressions; import com.querydsl.core.types.dsl.StringExpression; import org.sopt.makers.operation.dto.member.MemberSearchCondition; -import org.sopt.makers.operation.entity.Member; +import org.sopt.makers.operation.entity.member.Member; import org.sopt.makers.operation.entity.Part; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Repository; diff --git a/src/main/java/org/sopt/makers/operation/repository/schedule/ScheduleRepository.java b/src/main/java/org/sopt/makers/operation/repository/schedule/ScheduleRepository.java index c651e850..0cf9858a 100644 --- a/src/main/java/org/sopt/makers/operation/repository/schedule/ScheduleRepository.java +++ b/src/main/java/org/sopt/makers/operation/repository/schedule/ScheduleRepository.java @@ -1,6 +1,6 @@ package org.sopt.makers.operation.repository.schedule; -import org.sopt.makers.operation.entity.Member; +import org.sopt.makers.operation.entity.member.Member; import org.springframework.data.jpa.repository.JpaRepository; public interface ScheduleRepository extends JpaRepository, ScheduleCustomRepository { diff --git a/src/main/java/org/sopt/makers/operation/controller/ScheduleController.java b/src/main/java/org/sopt/makers/operation/scheduler/LectureScheduler.java similarity index 72% rename from src/main/java/org/sopt/makers/operation/controller/ScheduleController.java rename to src/main/java/org/sopt/makers/operation/scheduler/LectureScheduler.java index 5b7a673e..2340f063 100644 --- a/src/main/java/org/sopt/makers/operation/controller/ScheduleController.java +++ b/src/main/java/org/sopt/makers/operation/scheduler/LectureScheduler.java @@ -1,16 +1,16 @@ -package org.sopt.makers.operation.controller; +package org.sopt.makers.operation.scheduler; import org.sopt.makers.operation.service.LectureService; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.Scheduled; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.stereotype.Component; import lombok.RequiredArgsConstructor; -@RestController +@Component @EnableScheduling @RequiredArgsConstructor -public class ScheduleController { +public class LectureScheduler { private final LectureService lectureService; diff --git a/src/main/java/org/sopt/makers/operation/service/AdminServiceImpl.java b/src/main/java/org/sopt/makers/operation/service/AdminServiceImpl.java index e9f4da54..08315793 100644 --- a/src/main/java/org/sopt/makers/operation/service/AdminServiceImpl.java +++ b/src/main/java/org/sopt/makers/operation/service/AdminServiceImpl.java @@ -6,8 +6,8 @@ import lombok.val; import org.sopt.makers.operation.dto.admin.*; -import org.sopt.makers.operation.entity.Admin; -import org.sopt.makers.operation.entity.AdminStatus; +import org.sopt.makers.operation.entity.admin.Admin; +import org.sopt.makers.operation.entity.admin.AdminStatus; import org.sopt.makers.operation.exception.AdminFailureException; import org.sopt.makers.operation.repository.AdminRepository; import org.sopt.makers.operation.security.jwt.AdminAuthentication; diff --git a/src/main/java/org/sopt/makers/operation/service/AlarmServiceImpl.java b/src/main/java/org/sopt/makers/operation/service/AlarmServiceImpl.java index a08a42dc..561146f2 100644 --- a/src/main/java/org/sopt/makers/operation/service/AlarmServiceImpl.java +++ b/src/main/java/org/sopt/makers/operation/service/AlarmServiceImpl.java @@ -12,8 +12,8 @@ import org.sopt.makers.operation.entity.Part; import org.sopt.makers.operation.entity.alarm.Status; import org.sopt.makers.operation.exception.AlarmException; -import org.sopt.makers.operation.external.api.AlarmSender; -import org.sopt.makers.operation.external.api.PlayGroundServer; +import org.sopt.makers.operation.external.alarm.AlarmSender; +import org.sopt.makers.operation.external.playground.PlayGroundServer; import org.sopt.makers.operation.repository.alarm.AlarmRepository; import org.sopt.makers.operation.repository.member.MemberRepository; import org.springframework.stereotype.Service; diff --git a/src/main/java/org/sopt/makers/operation/service/AttendanceServiceImpl.java b/src/main/java/org/sopt/makers/operation/service/AttendanceServiceImpl.java index 7ac524b1..839fdd53 100644 --- a/src/main/java/org/sopt/makers/operation/service/AttendanceServiceImpl.java +++ b/src/main/java/org/sopt/makers/operation/service/AttendanceServiceImpl.java @@ -9,13 +9,13 @@ import org.sopt.makers.operation.dto.attendance.SubAttendanceUpdateResponseDTO; import lombok.val; import org.sopt.makers.operation.dto.attendance.*; -import org.sopt.makers.operation.entity.AttendanceStatus; -import org.sopt.makers.operation.entity.Member; +import org.sopt.makers.operation.entity.attendance.AttendanceStatus; +import org.sopt.makers.operation.entity.member.Member; import org.sopt.makers.operation.entity.Part; -import org.sopt.makers.operation.entity.SubAttendance; +import org.sopt.makers.operation.entity.attendance.SubAttendance; import org.sopt.makers.operation.exception.LectureException; import org.sopt.makers.operation.exception.MemberException; -import org.sopt.makers.operation.repository.SubAttendanceRepository; +import org.sopt.makers.operation.repository.attendance.SubAttendanceRepository; import org.sopt.makers.operation.repository.attendance.AttendanceRepository; import org.sopt.makers.operation.exception.SubLectureException; import org.sopt.makers.operation.repository.lecture.SubLectureRepository; diff --git a/src/main/java/org/sopt/makers/operation/service/LectureServiceImpl.java b/src/main/java/org/sopt/makers/operation/service/LectureServiceImpl.java index dc4c6fcd..24755f09 100644 --- a/src/main/java/org/sopt/makers/operation/service/LectureServiceImpl.java +++ b/src/main/java/org/sopt/makers/operation/service/LectureServiceImpl.java @@ -3,7 +3,7 @@ import static org.sopt.makers.operation.common.ExceptionMessage.*; import static org.sopt.makers.operation.common.ExceptionMessage.NO_SESSION; import static org.sopt.makers.operation.dto.lecture.LectureResponseType.*; -import static org.sopt.makers.operation.entity.AttendanceStatus.*; +import static org.sopt.makers.operation.entity.attendance.AttendanceStatus.*; import static org.sopt.makers.operation.entity.alarm.Attribute.*; import static org.sopt.makers.operation.entity.lecture.LectureStatus.*; @@ -25,13 +25,17 @@ import org.sopt.makers.operation.dto.lecture.LectureResponseDTO; import org.sopt.makers.operation.dto.lecture.LecturesResponseDTO; import org.sopt.makers.operation.entity.*; +import org.sopt.makers.operation.entity.attendance.Attendance; +import org.sopt.makers.operation.entity.attendance.SubAttendance; import org.sopt.makers.operation.entity.lecture.Attribute; import org.sopt.makers.operation.entity.lecture.Lecture; +import org.sopt.makers.operation.entity.lecture.SubLecture; +import org.sopt.makers.operation.entity.member.Member; import org.sopt.makers.operation.exception.LectureException; import org.sopt.makers.operation.exception.SubLectureException; -import org.sopt.makers.operation.external.api.AlarmSender; +import org.sopt.makers.operation.external.alarm.AlarmSender; import org.sopt.makers.operation.repository.attendance.AttendanceRepository; -import org.sopt.makers.operation.repository.SubAttendanceRepository; +import org.sopt.makers.operation.repository.attendance.SubAttendanceRepository; import org.sopt.makers.operation.repository.lecture.LectureRepository; import org.sopt.makers.operation.repository.lecture.SubLectureRepository; import org.sopt.makers.operation.repository.member.MemberRepository; diff --git a/src/main/java/org/sopt/makers/operation/service/MemberServiceImpl.java b/src/main/java/org/sopt/makers/operation/service/MemberServiceImpl.java index e1f57251..f12fd21a 100644 --- a/src/main/java/org/sopt/makers/operation/service/MemberServiceImpl.java +++ b/src/main/java/org/sopt/makers/operation/service/MemberServiceImpl.java @@ -14,8 +14,8 @@ import org.sopt.makers.operation.dto.member.MemberScoreGetResponse; import org.sopt.makers.operation.dto.member.MemberSearchCondition; import org.sopt.makers.operation.dto.member.MembersResponseDTO; -import org.sopt.makers.operation.entity.AttendanceStatus; -import org.sopt.makers.operation.entity.Member; +import org.sopt.makers.operation.entity.attendance.AttendanceStatus; +import org.sopt.makers.operation.entity.member.Member; import org.sopt.makers.operation.entity.Part; import org.sopt.makers.operation.entity.lecture.Attribute; import org.sopt.makers.operation.exception.MemberException; diff --git a/src/test/java/org/sopt/makers/operation/fixture/LectureFixture.java b/src/test/java/org/sopt/makers/operation/fixture/LectureFixture.java index cad87a67..00fee1f5 100644 --- a/src/test/java/org/sopt/makers/operation/fixture/LectureFixture.java +++ b/src/test/java/org/sopt/makers/operation/fixture/LectureFixture.java @@ -14,7 +14,7 @@ import org.sopt.makers.operation.dto.lecture.LecturesResponseDTO; import org.sopt.makers.operation.dto.lecture.LecturesResponseDTO.LectureVO; import org.sopt.makers.operation.entity.Part; -import org.sopt.makers.operation.entity.SubLecture; +import org.sopt.makers.operation.entity.lecture.SubLecture; import org.sopt.makers.operation.entity.lecture.Attribute; import org.sopt.makers.operation.entity.lecture.Lecture; import org.sopt.makers.operation.entity.lecture.LectureStatus; diff --git a/src/test/java/org/sopt/makers/operation/service/LectureServiceImplTest.java b/src/test/java/org/sopt/makers/operation/service/LectureServiceImplTest.java index e37a615f..ea75742e 100644 --- a/src/test/java/org/sopt/makers/operation/service/LectureServiceImplTest.java +++ b/src/test/java/org/sopt/makers/operation/service/LectureServiceImplTest.java @@ -15,7 +15,7 @@ import org.sopt.makers.operation.dto.lecture.LectureResponseDTO; import org.sopt.makers.operation.dto.lecture.LecturesResponseDTO; import org.sopt.makers.operation.entity.lecture.Lecture; -import org.sopt.makers.operation.external.api.AlarmSender; +import org.sopt.makers.operation.external.alarm.AlarmSender; import org.sopt.makers.operation.repository.lecture.LectureRepository; import org.sopt.makers.operation.repository.member.MemberRepository; From 413672893df164cf90da6a7daf7dd814d8239949 Mon Sep 17 00:00:00 2001 From: thguss Date: Wed, 24 Jan 2024 01:15:48 +0900 Subject: [PATCH 021/141] =?UTF-8?q?[CHORE]=20=ED=8C=A8=ED=82=A4=EC=A7=80?= =?UTF-8?q?=20=EC=9D=B4=EB=8F=99=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repository/attendance/AttendanceRepositoryImpl.java | 8 ++++---- .../repository/lecture/LectureRepositoryImpl.java | 4 ++-- .../operation/repository/member/MemberRepositoryImpl.java | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/sopt/makers/operation/repository/attendance/AttendanceRepositoryImpl.java b/src/main/java/org/sopt/makers/operation/repository/attendance/AttendanceRepositoryImpl.java index 535cbb48..8362a3f4 100644 --- a/src/main/java/org/sopt/makers/operation/repository/attendance/AttendanceRepositoryImpl.java +++ b/src/main/java/org/sopt/makers/operation/repository/attendance/AttendanceRepositoryImpl.java @@ -2,11 +2,11 @@ import static com.querydsl.core.types.dsl.Expressions.*; import static java.util.Objects.*; -import static org.sopt.makers.operation.entity.QAttendance.*; -import static org.sopt.makers.operation.entity.QMember.*; -import static org.sopt.makers.operation.entity.QSubAttendance.*; -import static org.sopt.makers.operation.entity.QSubLecture.*; +import static org.sopt.makers.operation.entity.attendance.QAttendance.*; +import static org.sopt.makers.operation.entity.attendance.QSubAttendance.*; import static org.sopt.makers.operation.entity.lecture.QLecture.*; +import static org.sopt.makers.operation.entity.lecture.QSubLecture.*; +import static org.sopt.makers.operation.entity.member.QMember.*; import java.time.LocalDate; import java.time.LocalDateTime; diff --git a/src/main/java/org/sopt/makers/operation/repository/lecture/LectureRepositoryImpl.java b/src/main/java/org/sopt/makers/operation/repository/lecture/LectureRepositoryImpl.java index 51960170..f5e550f3 100644 --- a/src/main/java/org/sopt/makers/operation/repository/lecture/LectureRepositoryImpl.java +++ b/src/main/java/org/sopt/makers/operation/repository/lecture/LectureRepositoryImpl.java @@ -12,10 +12,10 @@ import java.util.Optional; import static java.util.Objects.*; -import static org.sopt.makers.operation.entity.QAttendance.*; -import static org.sopt.makers.operation.entity.QMember.*; +import static org.sopt.makers.operation.entity.attendance.QAttendance.*; import static org.sopt.makers.operation.entity.lecture.LectureStatus.*; import static org.sopt.makers.operation.entity.lecture.QLecture.*; +import static org.sopt.makers.operation.entity.member.QMember.*; @Repository @RequiredArgsConstructor diff --git a/src/main/java/org/sopt/makers/operation/repository/member/MemberRepositoryImpl.java b/src/main/java/org/sopt/makers/operation/repository/member/MemberRepositoryImpl.java index b54a64d3..cb0eb443 100644 --- a/src/main/java/org/sopt/makers/operation/repository/member/MemberRepositoryImpl.java +++ b/src/main/java/org/sopt/makers/operation/repository/member/MemberRepositoryImpl.java @@ -2,9 +2,9 @@ import static java.util.Objects.*; import static org.sopt.makers.operation.entity.Part.*; -import static org.sopt.makers.operation.entity.QAttendance.*; -import static org.sopt.makers.operation.entity.QMember.*; +import static org.sopt.makers.operation.entity.attendance.QAttendance.*; import static org.sopt.makers.operation.entity.lecture.QLecture.*; +import static org.sopt.makers.operation.entity.member.QMember.*; import java.util.List; import java.util.Optional; From 92cc3759c4717925909c5ad798c1639378610bba Mon Sep 17 00:00:00 2001 From: thguss Date: Wed, 24 Jan 2024 01:54:35 +0900 Subject: [PATCH 022/141] =?UTF-8?q?[FIX]=20Swagger=20Profile=EC=97=90=20?= =?UTF-8?q?=EB=94=B0=EB=9D=BC=20=EA=B6=8C=ED=95=9C=20=EB=B6=84=EA=B8=B0=20?= =?UTF-8?q?=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../security/config/SecurityConfig.java | 54 ++++++++++++++----- 1 file changed, 40 insertions(+), 14 deletions(-) diff --git a/src/main/java/org/sopt/makers/operation/security/config/SecurityConfig.java b/src/main/java/org/sopt/makers/operation/security/config/SecurityConfig.java index e9209e47..70026526 100644 --- a/src/main/java/org/sopt/makers/operation/security/config/SecurityConfig.java +++ b/src/main/java/org/sopt/makers/operation/security/config/SecurityConfig.java @@ -7,6 +7,7 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Profile; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.http.SessionCreationPolicy; @@ -38,25 +39,50 @@ public class SecurityConfig { public static PasswordEncoder passwordEncoder() { return PasswordEncoderFactories.createDelegatingPasswordEncoder(); } + + @Bean + @Profile("dev") + public SecurityFilterChain filterChainDev(HttpSecurity http) throws Exception { + setHttp(http); + authorizeRequestsDev(http); + return http.build(); + } + + @Profile("dev") + private void authorizeRequestsDev(HttpSecurity http) throws Exception { + http.authorizeRequests() + .antMatchers("/api/v1/auth/**", "/exception/**", "/swagger-ui/**").permitAll() + .and() + .authorizeRequests() + .antMatchers("/api/v1/**").authenticated(); + } + @Bean - public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { - return http.antMatcher("/**") + @Profile("prod") + public SecurityFilterChain filterChainProd(HttpSecurity http) throws Exception { + setHttp(http); + authorizeRequestsProd(http); + return http.build(); + } + + @Profile("prod") + private void authorizeRequestsProd(HttpSecurity http) throws Exception { + http.authorizeRequests() + .antMatchers("/api/v1/auth/**","/exception/**").permitAll() + .and() + .authorizeRequests() + .antMatchers("/api/v1/**", "/swagger-ui/**").authenticated(); + } + + private void setHttp(HttpSecurity http) throws Exception { + http.antMatcher("/**") .httpBasic().disable() .csrf().disable() .formLogin().disable() - .cors().configurationSource(corsConfigurationSource()) - .and() - .authorizeRequests() - .antMatchers("/api/v1/auth/**","/exception/**").permitAll() - .and() - .authorizeRequests() - .antMatchers("/api/v1/**", "/swagger-ui/**").authenticated() - .and() - .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS) + .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS) .and() - .addFilterBefore(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class) - .addFilterBefore(jwtExceptionFilter, JwtAuthenticationFilter.class) - .build(); + .addFilterBefore(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class) + .addFilterBefore(jwtExceptionFilter, JwtAuthenticationFilter.class); } @Bean From 3fe8ee0c978f8d2ec268859603c704de397e7963 Mon Sep 17 00:00:00 2001 From: thguss Date: Wed, 24 Jan 2024 15:39:55 +0900 Subject: [PATCH 023/141] =?UTF-8?q?[REFACTOR]=20=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EB=A6=AC=ED=8C=A9=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../makers/operation/config/ValueConfig.java | 7 +++ .../security/config/SecurityConfig.java | 47 ++++++------------- 2 files changed, 21 insertions(+), 33 deletions(-) diff --git a/src/main/java/org/sopt/makers/operation/config/ValueConfig.java b/src/main/java/org/sopt/makers/operation/config/ValueConfig.java index e38673ff..1031b635 100644 --- a/src/main/java/org/sopt/makers/operation/config/ValueConfig.java +++ b/src/main/java/org/sopt/makers/operation/config/ValueConfig.java @@ -15,9 +15,16 @@ public class ValueConfig { private String ALARM_MESSAGE_CONTENT; @Value("${sopt.current.generation}") private int GENERATION; + @Value("${admin.url.prod}") + private String ADMIN_PROD_URL; + @Value("${admin.url.dev}") + private String ADMIN_DEV_URL; + @Value("${admin.url.local}") + private String ADMIN_LOCAL_URL; private final int SUB_LECTURE_MAX_ROUND = 2; private final String ETC_MESSAGE = "출석 점수가 반영되지 않아요."; private final String SEMINAR_MESSAGE = ""; private final String EVENT_MESSAGE = "행사도 참여하고, 출석점수도 받고, 일석이조!"; + private final String SWAGGER_URI = "/swagger-ui/**"; } diff --git a/src/main/java/org/sopt/makers/operation/security/config/SecurityConfig.java b/src/main/java/org/sopt/makers/operation/security/config/SecurityConfig.java index 70026526..2d1588ed 100644 --- a/src/main/java/org/sopt/makers/operation/security/config/SecurityConfig.java +++ b/src/main/java/org/sopt/makers/operation/security/config/SecurityConfig.java @@ -2,9 +2,10 @@ import lombok.RequiredArgsConstructor; import lombok.val; + +import org.sopt.makers.operation.config.ValueConfig; import org.sopt.makers.operation.security.jwt.JwtAuthenticationFilter; import org.sopt.makers.operation.security.jwt.JwtExceptionFilter; -import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Profile; @@ -25,15 +26,7 @@ public class SecurityConfig { private final JwtAuthenticationFilter jwtAuthenticationFilter; private final JwtExceptionFilter jwtExceptionFilter; - - @Value("${admin.url.prod}") - private String ADMIN_PROD_URL; - - @Value("${admin.url.dev}") - private String ADMIN_DEV_URL; - - @Value("${admin.url.local}") - private String ADMIN_LOCAL_URL; + private final ValueConfig valueConfig; @Bean public static PasswordEncoder passwordEncoder() { @@ -44,41 +37,29 @@ public static PasswordEncoder passwordEncoder() { @Profile("dev") public SecurityFilterChain filterChainDev(HttpSecurity http) throws Exception { setHttp(http); - authorizeRequestsDev(http); + http.authorizeRequests().antMatchers(valueConfig.getSWAGGER_URI()).permitAll(); return http.build(); } - @Profile("dev") - private void authorizeRequestsDev(HttpSecurity http) throws Exception { - http.authorizeRequests() - .antMatchers("/api/v1/auth/**", "/exception/**", "/swagger-ui/**").permitAll() - .and() - .authorizeRequests() - .antMatchers("/api/v1/**").authenticated(); - } - @Bean @Profile("prod") public SecurityFilterChain filterChainProd(HttpSecurity http) throws Exception { setHttp(http); - authorizeRequestsProd(http); + http.authorizeRequests().antMatchers(valueConfig.getSWAGGER_URI()).authenticated(); return http.build(); } - @Profile("prod") - private void authorizeRequestsProd(HttpSecurity http) throws Exception { - http.authorizeRequests() - .antMatchers("/api/v1/auth/**","/exception/**").permitAll() - .and() - .authorizeRequests() - .antMatchers("/api/v1/**", "/swagger-ui/**").authenticated(); - } - private void setHttp(HttpSecurity http) throws Exception { http.antMatcher("/**") .httpBasic().disable() .csrf().disable() .formLogin().disable() + .authorizeRequests() + .antMatchers("/api/v1/auth/**", "/exception/**").permitAll() + .and() + .authorizeRequests() + .antMatchers("/api/v1/**").authenticated() + .and() .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS) .and() .addFilterBefore(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class) @@ -89,9 +70,9 @@ private void setHttp(HttpSecurity http) throws Exception { public CorsConfigurationSource corsConfigurationSource() { val configuration = new CorsConfiguration(); - configuration.addAllowedOrigin(ADMIN_PROD_URL); - configuration.addAllowedOrigin(ADMIN_DEV_URL); - configuration.addAllowedOrigin(ADMIN_LOCAL_URL); + configuration.addAllowedOrigin(valueConfig.getADMIN_PROD_URL()); + configuration.addAllowedOrigin(valueConfig.getADMIN_DEV_URL()); + configuration.addAllowedOrigin(valueConfig.getADMIN_LOCAL_URL()); configuration.addAllowedHeader("*"); configuration.addAllowedMethod("*"); configuration.setAllowCredentials(true); From 3311d92164ad88c59669177d82efb116155b00b2 Mon Sep 17 00:00:00 2001 From: thguss Date: Wed, 24 Jan 2024 15:42:23 +0900 Subject: [PATCH 024/141] =?UTF-8?q?[CHORE]=20=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EC=BB=A8=EB=B2=A4=EC=85=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../security/config/SecurityConfig.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/sopt/makers/operation/security/config/SecurityConfig.java b/src/main/java/org/sopt/makers/operation/security/config/SecurityConfig.java index 2d1588ed..d2affa62 100644 --- a/src/main/java/org/sopt/makers/operation/security/config/SecurityConfig.java +++ b/src/main/java/org/sopt/makers/operation/security/config/SecurityConfig.java @@ -54,16 +54,18 @@ private void setHttp(HttpSecurity http) throws Exception { .httpBasic().disable() .csrf().disable() .formLogin().disable() - .authorizeRequests() - .antMatchers("/api/v1/auth/**", "/exception/**").permitAll() + .cors().configurationSource(corsConfigurationSource()) .and() - .authorizeRequests() - .antMatchers("/api/v1/**").authenticated() + .authorizeRequests() + .antMatchers("/api/v1/auth/**", "/exception/**").permitAll() .and() - .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS) + .authorizeRequests() + .antMatchers("/api/v1/**").authenticated() .and() - .addFilterBefore(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class) - .addFilterBefore(jwtExceptionFilter, JwtAuthenticationFilter.class); + .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS) + .and() + .addFilterBefore(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class) + .addFilterBefore(jwtExceptionFilter, JwtAuthenticationFilter.class); } @Bean From 8fa4d4508eea17f2dc88b47af62a957856c65a8d Mon Sep 17 00:00:00 2001 From: dragontaek-lee Date: Wed, 24 Jan 2024 21:18:48 +0900 Subject: [PATCH 025/141] =?UTF-8?q?[FIX]=20error,=20info=20=EB=A1=9C?= =?UTF-8?q?=EA=B7=B8=20=EC=A0=80=EC=9E=A5=20=EB=94=94=EB=A0=89=ED=86=A0?= =?UTF-8?q?=EB=A6=AC=20=EB=B3=B5=EA=B5=AC=20#255?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/file-error-appender.xml | 2 +- src/main/resources/file-info-appender.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/file-error-appender.xml b/src/main/resources/file-error-appender.xml index 2746bed3..f5698d26 100644 --- a/src/main/resources/file-error-appender.xml +++ b/src/main/resources/file-error-appender.xml @@ -1,6 +1,6 @@ - /home/ubuntu/operation/log/error/error-${BY_DATE}.log + ./log/error/error-${BY_DATE}.log ERROR ACCEPT diff --git a/src/main/resources/file-info-appender.xml b/src/main/resources/file-info-appender.xml index 600fa4bb..c6422ede 100644 --- a/src/main/resources/file-info-appender.xml +++ b/src/main/resources/file-info-appender.xml @@ -1,6 +1,6 @@ - /home/ubuntu/operation/log/info/info-${BY_DATE}.log + ./log/info/info-${BY_DATE}.log INFO ACCEPT From b2982fef4079866b6992e779a28be8d87fa76db6 Mon Sep 17 00:00:00 2001 From: thguss Date: Wed, 24 Jan 2024 23:43:53 +0900 Subject: [PATCH 026/141] =?UTF-8?q?[CHORE]=20=EB=A6=AC=EB=B7=B0=20?= =?UTF-8?q?=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../makers/operation/{security => }/config/SecurityConfig.java | 2 +- .../operation/security/{jwt => }/AdminAuthentication.java | 2 +- .../sopt/makers/operation/security/jwt/JwtTokenProvider.java | 1 + .../org/sopt/makers/operation/service/AdminServiceImpl.java | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) rename src/main/java/org/sopt/makers/operation/{security => }/config/SecurityConfig.java (98%) rename src/main/java/org/sopt/makers/operation/security/{jwt => }/AdminAuthentication.java (90%) diff --git a/src/main/java/org/sopt/makers/operation/security/config/SecurityConfig.java b/src/main/java/org/sopt/makers/operation/config/SecurityConfig.java similarity index 98% rename from src/main/java/org/sopt/makers/operation/security/config/SecurityConfig.java rename to src/main/java/org/sopt/makers/operation/config/SecurityConfig.java index e9209e47..68be6136 100644 --- a/src/main/java/org/sopt/makers/operation/security/config/SecurityConfig.java +++ b/src/main/java/org/sopt/makers/operation/config/SecurityConfig.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.security.config; +package org.sopt.makers.operation.config; import lombok.RequiredArgsConstructor; import lombok.val; diff --git a/src/main/java/org/sopt/makers/operation/security/jwt/AdminAuthentication.java b/src/main/java/org/sopt/makers/operation/security/AdminAuthentication.java similarity index 90% rename from src/main/java/org/sopt/makers/operation/security/jwt/AdminAuthentication.java rename to src/main/java/org/sopt/makers/operation/security/AdminAuthentication.java index f80aa5d7..2385c90e 100644 --- a/src/main/java/org/sopt/makers/operation/security/jwt/AdminAuthentication.java +++ b/src/main/java/org/sopt/makers/operation/security/AdminAuthentication.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.security.jwt; +package org.sopt.makers.operation.security; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.GrantedAuthority; diff --git a/src/main/java/org/sopt/makers/operation/security/jwt/JwtTokenProvider.java b/src/main/java/org/sopt/makers/operation/security/jwt/JwtTokenProvider.java index ae7d974a..e43cf11e 100644 --- a/src/main/java/org/sopt/makers/operation/security/jwt/JwtTokenProvider.java +++ b/src/main/java/org/sopt/makers/operation/security/jwt/JwtTokenProvider.java @@ -9,6 +9,7 @@ import lombok.val; import org.sopt.makers.operation.common.ExceptionMessage; import org.sopt.makers.operation.exception.TokenException; +import org.sopt.makers.operation.security.AdminAuthentication; import org.springframework.beans.factory.annotation.Value; import org.springframework.security.core.Authentication; import org.springframework.stereotype.Service; diff --git a/src/main/java/org/sopt/makers/operation/service/AdminServiceImpl.java b/src/main/java/org/sopt/makers/operation/service/AdminServiceImpl.java index 08315793..d57bdd68 100644 --- a/src/main/java/org/sopt/makers/operation/service/AdminServiceImpl.java +++ b/src/main/java/org/sopt/makers/operation/service/AdminServiceImpl.java @@ -10,7 +10,7 @@ import org.sopt.makers.operation.entity.admin.AdminStatus; import org.sopt.makers.operation.exception.AdminFailureException; import org.sopt.makers.operation.repository.AdminRepository; -import org.sopt.makers.operation.security.jwt.AdminAuthentication; +import org.sopt.makers.operation.security.AdminAuthentication; import org.sopt.makers.operation.security.jwt.JwtTokenProvider; import org.sopt.makers.operation.security.jwt.JwtTokenType; import org.springframework.security.crypto.password.PasswordEncoder; From 511d96c7bf824405b69699450a594f341da9b968 Mon Sep 17 00:00:00 2001 From: thguss Date: Wed, 31 Jan 2024 06:06:49 +0900 Subject: [PATCH 027/141] =?UTF-8?q?[DELETE]=20=EB=AF=B8=EC=82=AC=EC=9A=A9?= =?UTF-8?q?=20API=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/InternalOpenApiController.java | 49 ------------------- 1 file changed, 49 deletions(-) delete mode 100644 src/main/java/org/sopt/makers/operation/controller/InternalOpenApiController.java diff --git a/src/main/java/org/sopt/makers/operation/controller/InternalOpenApiController.java b/src/main/java/org/sopt/makers/operation/controller/InternalOpenApiController.java deleted file mode 100644 index f2c332bd..00000000 --- a/src/main/java/org/sopt/makers/operation/controller/InternalOpenApiController.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.sopt.makers.operation.controller; - -import static org.sopt.makers.operation.common.ResponseMessage.*; - -import org.sopt.makers.operation.common.ApiResponse; -import org.sopt.makers.operation.dto.member.MemberRequestDTO; -import org.sopt.makers.operation.service.MemberService; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestHeader; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import io.swagger.annotations.ApiOperation; -import lombok.RequiredArgsConstructor; - -@RestController -@RequiredArgsConstructor -@RequestMapping("/internal/api/v1") -public class InternalOpenApiController { - - private final MemberService memberService; - - @Value("${spring.secretKey.playground}") - private String playgroundKey; - - @ApiOperation(value = "회원 등록") - @PostMapping("/idp/members") - public ResponseEntity createMember( - @RequestHeader("x-api-key") String apiKey, - @RequestHeader("x-request-from") String serviceName, - @RequestBody MemberRequestDTO requestDTO - ) throws IllegalAccessException { - checkApiKey(apiKey, serviceName); - memberService.createMember(requestDTO); - return ResponseEntity.ok(ApiResponse.success(SUCCESS_CREATE_MEMBER.getMessage())); - } - - private void checkApiKey(String apiKey, String serviceName) throws IllegalAccessException { - if (serviceName.equals("playground") && apiKey.equals(playgroundKey)) { - return; - } else { - throw new IllegalAccessException("잘못된 API Key 입니다."); - } - } - -} From 2df6de0f4eba2f9e52abaaaf4d51cc78d7ce3282 Mon Sep 17 00:00:00 2001 From: thguss Date: Wed, 31 Jan 2024 06:09:27 +0900 Subject: [PATCH 028/141] =?UTF-8?q?[FIX]=20=EB=82=B4=EB=B6=80=20=ED=81=B4?= =?UTF-8?q?=EB=9E=98=EC=8A=A4=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AttendanceMemberResponseDTO.java | 50 +++++++++---------- .../dto/attendance/MemberResponseDTO.java | 32 ++++++------ 2 files changed, 41 insertions(+), 41 deletions(-) diff --git a/src/main/java/org/sopt/makers/operation/dto/attendance/AttendanceMemberResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/attendance/AttendanceMemberResponseDTO.java index 59705d21..6eb36023 100644 --- a/src/main/java/org/sopt/makers/operation/dto/attendance/AttendanceMemberResponseDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/attendance/AttendanceMemberResponseDTO.java @@ -23,33 +23,33 @@ public static AttendanceMemberResponseDTO of(Member member, List att member.getPhone(), attendances.stream().map(LectureVO::of).toList()); } -} -record LectureVO( - String lecture, - float additiveScore, - String status, - List attendances -) { - public static LectureVO of(Attendance attendance) { - return new LectureVO( - attendance.getLecture().getName(), - attendance.getScore(), - attendance.getStatus().getName(), - attendance.getSubAttendances().stream().map(AttendanceVO::of).toList()); + record LectureVO( + String lecture, + float additiveScore, + String status, + List attendances + ) { + public static LectureVO of(Attendance attendance) { + return new LectureVO( + attendance.getLecture().getName(), + attendance.getScore(), + attendance.getStatus().getName(), + attendance.getSubAttendances().stream().map(AttendanceVO::of).toList()); + } } -} -record AttendanceVO( - int round, - String status, - String date -) { - public static AttendanceVO of(SubAttendance subAttendance) { - return new AttendanceVO( - subAttendance.getSubLecture().getRound(), - subAttendance.getStatus().getName(), - subAttendance.getLastModifiedDate().toString() - ); + record AttendanceVO( + int round, + String status, + String date + ) { + public static AttendanceVO of(SubAttendance subAttendance) { + return new AttendanceVO( + subAttendance.getSubLecture().getRound(), + subAttendance.getStatus().getName(), + subAttendance.getLastModifiedDate().toString() + ); + } } } diff --git a/src/main/java/org/sopt/makers/operation/dto/attendance/MemberResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/attendance/MemberResponseDTO.java index 60568a90..a2df1d28 100644 --- a/src/main/java/org/sopt/makers/operation/dto/attendance/MemberResponseDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/attendance/MemberResponseDTO.java @@ -21,24 +21,24 @@ public static MemberResponseDTO of(Attendance attendance) { attendance.getSubAttendances().stream().map(SubAttendanceVO::of).toList(), attendance.getScore()); } -} -record MemberVO(Long memberId, String name, String university, String part) { - static MemberVO of(Member member) { - return new MemberVO( - member.getId(), - member.getName(), - member.getUniversity(), - member.getPart().getName()); + record MemberVO(Long memberId, String name, String university, String part) { + static MemberVO of(Member member) { + return new MemberVO( + member.getId(), + member.getName(), + member.getUniversity(), + member.getPart().getName()); + } } -} -record SubAttendanceVO(Long subAttendanceId, int round, AttendanceStatus status, String updateAt) { - static SubAttendanceVO of(SubAttendance subAttendance) { - return new SubAttendanceVO( - subAttendance.getId(), - subAttendance.getSubLecture().getRound(), - subAttendance.getStatus(), - subAttendance.getLastModifiedDate().toString()); + record SubAttendanceVO(Long subAttendanceId, int round, AttendanceStatus status, String updateAt) { + static SubAttendanceVO of(SubAttendance subAttendance) { + return new SubAttendanceVO( + subAttendance.getId(), + subAttendance.getSubLecture().getRound(), + subAttendance.getStatus(), + subAttendance.getLastModifiedDate().toString()); + } } } From 705197330ab7815277715c15aad5ae4f6f2a79b2 Mon Sep 17 00:00:00 2001 From: thguss Date: Wed, 31 Jan 2024 06:13:26 +0900 Subject: [PATCH 029/141] =?UTF-8?q?[REFACTOR]=20request,=20response=20?= =?UTF-8?q?=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/AppAttendanceController.java | 2 +- .../controller/web/AdminController.java | 3 ++- .../controller/web/AlarmController.java | 4 ++-- .../controller/web/AttendanceController.java | 2 +- .../controller/web/LectureController.java | 4 ++-- .../admin/{ => request}/LoginRequestDTO.java | 2 +- .../admin/{ => request}/SignUpRequestDTO.java | 2 +- .../{ => response}/LoginResponseDTO.java | 22 +++++++++---------- .../{ => response}/RefreshResponseDTO.java | 2 +- .../{ => response}/SignUpResponseDTO.java | 2 +- .../alarm/{ => request}/AlarmRequestDTO.java | 2 +- .../{ => request}/AlarmSendRequestDTO.java | 2 +- .../alarm/{ => request}/AlarmSenderDTO.java | 2 +- .../AlarmInactiveListResponseDTO.java | 2 +- .../{ => response}/AlarmResponseDTO.java | 2 +- .../{ => response}/AlarmSendResponseDTO.java | 2 +- .../{ => response}/AlarmsResponseDTO.java | 2 +- .../{ => request}/AttendRequestDTO.java | 2 +- .../SubAttendanceUpdateRequestDTO.java | 2 +- .../{ => response}/AttendResponseDTO.java | 2 +- .../AttendanceMemberResponseDTO.java | 2 +- .../AttendanceTotalCountVO.java | 2 +- .../AttendanceTotalResponseDTO.java | 2 +- .../{ => response}/AttendanceTotalVO.java | 2 +- .../AttendancesResponseDTO.java | 2 +- .../{ => response}/MemberResponseDTO.java | 2 +- .../SubAttendanceUpdateResponseDTO.java | 2 +- .../dto/lecture/LectureSearchCondition.java | 14 ------------ .../{ => request}/AttendanceRequestDTO.java | 2 +- .../{ => request}/LectureRequestDTO.java | 2 +- .../{ => response}/AttendanceResponseDTO.java | 2 +- .../{ => response}/AttendancesStatusVO.java | 2 +- .../LectureCurrentRoundResponseDTO.java | 2 +- .../LectureDetailResponseDTO.java | 2 +- .../{ => response}/LectureResponseDTO.java | 2 +- .../{ => response}/LectureResponseType.java | 2 +- .../{ => response}/LecturesResponseDTO.java | 2 +- .../TodayLectureResponseDTO.java | 3 ++- .../{ => request}/MemberRequestDTO.java | 2 +- .../{ => response}/MemberListGetResponse.java | 4 ++-- .../MemberScoreGetResponse.java | 2 +- .../{ => response}/MemberSearchCondition.java | 2 +- .../{ => response}/MembersResponseDTO.java | 2 +- .../{ => response}/SchedulesResponseDTO.java | 2 +- .../makers/operation/entity/alarm/Alarm.java | 2 +- .../operation/entity/member/Member.java | 2 +- .../operation/external/alarm/AlarmSender.java | 2 +- .../external/alarm/AlarmSenderImpl.java | 4 ++-- .../external/playground/PlayGroundServer.java | 2 +- .../playground/PlayGroundServerImpl.java | 2 +- .../member/MemberCustomRepository.java | 2 +- .../member/MemberRepositoryImpl.java | 2 +- .../operation/service/AdminService.java | 6 ++++- .../operation/service/AdminServiceImpl.java | 6 ++++- .../operation/service/AlarmService.java | 11 ++++------ .../operation/service/AlarmServiceImpl.java | 12 +++++----- .../operation/service/AttendanceService.java | 13 +++++------ .../service/AttendanceServiceImpl.java | 11 ++++++---- .../operation/service/LectureService.java | 15 +++++++------ .../operation/service/LectureServiceImpl.java | 21 ++++++++++-------- .../operation/service/MemberService.java | 11 ++++------ .../operation/service/MemberServiceImpl.java | 16 +++++++------- .../operation/service/ScheduleService.java | 2 +- .../service/ScheduleServiceImpl.java | 2 +- .../controller/web/LectureControllerTest.java | 12 +++++----- .../operation/fixture/LectureFixture.java | 18 +++++++-------- .../service/LectureServiceImplTest.java | 6 ++--- 67 files changed, 152 insertions(+), 156 deletions(-) rename src/main/java/org/sopt/makers/operation/dto/admin/{ => request}/LoginRequestDTO.java (55%) rename src/main/java/org/sopt/makers/operation/dto/admin/{ => request}/SignUpRequestDTO.java (77%) rename src/main/java/org/sopt/makers/operation/dto/admin/{ => response}/LoginResponseDTO.java (52%) rename src/main/java/org/sopt/makers/operation/dto/admin/{ => response}/RefreshResponseDTO.java (83%) rename src/main/java/org/sopt/makers/operation/dto/admin/{ => response}/SignUpResponseDTO.java (76%) rename src/main/java/org/sopt/makers/operation/dto/alarm/{ => request}/AlarmRequestDTO.java (89%) rename src/main/java/org/sopt/makers/operation/dto/alarm/{ => request}/AlarmSendRequestDTO.java (50%) rename src/main/java/org/sopt/makers/operation/dto/alarm/{ => request}/AlarmSenderDTO.java (91%) rename src/main/java/org/sopt/makers/operation/dto/alarm/{ => response}/AlarmInactiveListResponseDTO.java (63%) rename src/main/java/org/sopt/makers/operation/dto/alarm/{ => response}/AlarmResponseDTO.java (93%) rename src/main/java/org/sopt/makers/operation/dto/alarm/{ => response}/AlarmSendResponseDTO.java (67%) rename src/main/java/org/sopt/makers/operation/dto/alarm/{ => response}/AlarmsResponseDTO.java (94%) rename src/main/java/org/sopt/makers/operation/dto/attendance/{ => request}/AttendRequestDTO.java (59%) rename src/main/java/org/sopt/makers/operation/dto/attendance/{ => request}/SubAttendanceUpdateRequestDTO.java (74%) rename src/main/java/org/sopt/makers/operation/dto/attendance/{ => response}/AttendResponseDTO.java (77%) rename src/main/java/org/sopt/makers/operation/dto/attendance/{ => response}/AttendanceMemberResponseDTO.java (95%) rename src/main/java/org/sopt/makers/operation/dto/attendance/{ => response}/AttendanceTotalCountVO.java (87%) rename src/main/java/org/sopt/makers/operation/dto/attendance/{ => response}/AttendanceTotalResponseDTO.java (92%) rename src/main/java/org/sopt/makers/operation/dto/attendance/{ => response}/AttendanceTotalVO.java (94%) rename src/main/java/org/sopt/makers/operation/dto/attendance/{ => response}/AttendancesResponseDTO.java (86%) rename src/main/java/org/sopt/makers/operation/dto/attendance/{ => response}/MemberResponseDTO.java (95%) rename src/main/java/org/sopt/makers/operation/dto/attendance/{ => response}/SubAttendanceUpdateResponseDTO.java (87%) delete mode 100644 src/main/java/org/sopt/makers/operation/dto/lecture/LectureSearchCondition.java rename src/main/java/org/sopt/makers/operation/dto/lecture/{ => request}/AttendanceRequestDTO.java (60%) rename src/main/java/org/sopt/makers/operation/dto/lecture/{ => request}/LectureRequestDTO.java (94%) rename src/main/java/org/sopt/makers/operation/dto/lecture/{ => response}/AttendanceResponseDTO.java (88%) rename src/main/java/org/sopt/makers/operation/dto/lecture/{ => response}/AttendancesStatusVO.java (94%) rename src/main/java/org/sopt/makers/operation/dto/lecture/{ => response}/LectureCurrentRoundResponseDTO.java (86%) rename src/main/java/org/sopt/makers/operation/dto/lecture/{ => response}/LectureDetailResponseDTO.java (92%) rename src/main/java/org/sopt/makers/operation/dto/lecture/{ => response}/LectureResponseDTO.java (96%) rename src/main/java/org/sopt/makers/operation/dto/lecture/{ => response}/LectureResponseType.java (59%) rename src/main/java/org/sopt/makers/operation/dto/lecture/{ => response}/LecturesResponseDTO.java (95%) rename src/main/java/org/sopt/makers/operation/dto/lecture/{ => response}/TodayLectureResponseDTO.java (97%) rename src/main/java/org/sopt/makers/operation/dto/member/{ => request}/MemberRequestDTO.java (82%) rename src/main/java/org/sopt/makers/operation/dto/member/{ => response}/MemberListGetResponse.java (82%) rename src/main/java/org/sopt/makers/operation/dto/member/{ => response}/MemberScoreGetResponse.java (78%) rename src/main/java/org/sopt/makers/operation/dto/member/{ => response}/MemberSearchCondition.java (67%) rename src/main/java/org/sopt/makers/operation/dto/member/{ => response}/MembersResponseDTO.java (82%) rename src/main/java/org/sopt/makers/operation/dto/schedule/{ => response}/SchedulesResponseDTO.java (96%) diff --git a/src/main/java/org/sopt/makers/operation/controller/app/AppAttendanceController.java b/src/main/java/org/sopt/makers/operation/controller/app/AppAttendanceController.java index 70fe59f5..0754c7e5 100644 --- a/src/main/java/org/sopt/makers/operation/controller/app/AppAttendanceController.java +++ b/src/main/java/org/sopt/makers/operation/controller/app/AppAttendanceController.java @@ -7,7 +7,7 @@ import lombok.RequiredArgsConstructor; import lombok.val; import org.sopt.makers.operation.common.ApiResponse; -import org.sopt.makers.operation.dto.attendance.AttendRequestDTO; +import org.sopt.makers.operation.dto.attendance.request.AttendRequestDTO; import org.sopt.makers.operation.service.AttendanceService; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; diff --git a/src/main/java/org/sopt/makers/operation/controller/web/AdminController.java b/src/main/java/org/sopt/makers/operation/controller/web/AdminController.java index 918a7d5a..38d9fff8 100644 --- a/src/main/java/org/sopt/makers/operation/controller/web/AdminController.java +++ b/src/main/java/org/sopt/makers/operation/controller/web/AdminController.java @@ -8,7 +8,8 @@ import lombok.val; import org.sopt.makers.operation.common.ApiResponse; -import org.sopt.makers.operation.dto.admin.*; +import org.sopt.makers.operation.dto.admin.request.LoginRequestDTO; +import org.sopt.makers.operation.dto.admin.request.SignUpRequestDTO; import org.sopt.makers.operation.service.AdminServiceImpl; import org.sopt.makers.operation.util.Cookie; import org.springframework.http.ResponseEntity; diff --git a/src/main/java/org/sopt/makers/operation/controller/web/AlarmController.java b/src/main/java/org/sopt/makers/operation/controller/web/AlarmController.java index 21929a09..67e71e16 100644 --- a/src/main/java/org/sopt/makers/operation/controller/web/AlarmController.java +++ b/src/main/java/org/sopt/makers/operation/controller/web/AlarmController.java @@ -4,7 +4,7 @@ import lombok.RequiredArgsConstructor; import org.sopt.makers.operation.common.ApiResponse; -import org.sopt.makers.operation.dto.alarm.AlarmSendRequestDTO; +import org.sopt.makers.operation.dto.alarm.request.AlarmSendRequestDTO; import org.sopt.makers.operation.service.AlarmService; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PostMapping; @@ -18,7 +18,7 @@ import java.net.URI; -import org.sopt.makers.operation.dto.alarm.AlarmRequestDTO; +import org.sopt.makers.operation.dto.alarm.request.AlarmRequestDTO; import org.sopt.makers.operation.entity.Part; import org.sopt.makers.operation.entity.alarm.Status; import org.springframework.data.domain.Pageable; diff --git a/src/main/java/org/sopt/makers/operation/controller/web/AttendanceController.java b/src/main/java/org/sopt/makers/operation/controller/web/AttendanceController.java index e5432011..38439716 100644 --- a/src/main/java/org/sopt/makers/operation/controller/web/AttendanceController.java +++ b/src/main/java/org/sopt/makers/operation/controller/web/AttendanceController.java @@ -3,7 +3,7 @@ import static org.sopt.makers.operation.common.ResponseMessage.*; import org.sopt.makers.operation.common.ApiResponse; -import org.sopt.makers.operation.dto.attendance.SubAttendanceUpdateRequestDTO; +import org.sopt.makers.operation.dto.attendance.request.SubAttendanceUpdateRequestDTO; import org.sopt.makers.operation.entity.Part; import org.sopt.makers.operation.service.AttendanceService; import org.springframework.data.domain.Pageable; diff --git a/src/main/java/org/sopt/makers/operation/controller/web/LectureController.java b/src/main/java/org/sopt/makers/operation/controller/web/LectureController.java index 156cc045..d9af3005 100644 --- a/src/main/java/org/sopt/makers/operation/controller/web/LectureController.java +++ b/src/main/java/org/sopt/makers/operation/controller/web/LectureController.java @@ -6,8 +6,8 @@ import java.net.URI; import org.sopt.makers.operation.common.ApiResponse; -import org.sopt.makers.operation.dto.lecture.AttendanceRequestDTO; -import org.sopt.makers.operation.dto.lecture.LectureRequestDTO; +import org.sopt.makers.operation.dto.lecture.request.AttendanceRequestDTO; +import org.sopt.makers.operation.dto.lecture.request.LectureRequestDTO; import org.sopt.makers.operation.entity.Part; import org.sopt.makers.operation.service.LectureService; import org.springframework.http.ResponseEntity; diff --git a/src/main/java/org/sopt/makers/operation/dto/admin/LoginRequestDTO.java b/src/main/java/org/sopt/makers/operation/dto/admin/request/LoginRequestDTO.java similarity index 55% rename from src/main/java/org/sopt/makers/operation/dto/admin/LoginRequestDTO.java rename to src/main/java/org/sopt/makers/operation/dto/admin/request/LoginRequestDTO.java index 6cfdf3a1..945b165d 100644 --- a/src/main/java/org/sopt/makers/operation/dto/admin/LoginRequestDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/admin/request/LoginRequestDTO.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.dto.admin; +package org.sopt.makers.operation.dto.admin.request; public record LoginRequestDTO(String email, String password) { } diff --git a/src/main/java/org/sopt/makers/operation/dto/admin/SignUpRequestDTO.java b/src/main/java/org/sopt/makers/operation/dto/admin/request/SignUpRequestDTO.java similarity index 77% rename from src/main/java/org/sopt/makers/operation/dto/admin/SignUpRequestDTO.java rename to src/main/java/org/sopt/makers/operation/dto/admin/request/SignUpRequestDTO.java index 2dda7189..fd526f0b 100644 --- a/src/main/java/org/sopt/makers/operation/dto/admin/SignUpRequestDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/admin/request/SignUpRequestDTO.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.dto.admin; +package org.sopt.makers.operation.dto.admin.request; import org.sopt.makers.operation.entity.admin.Role; diff --git a/src/main/java/org/sopt/makers/operation/dto/admin/LoginResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/admin/response/LoginResponseDTO.java similarity index 52% rename from src/main/java/org/sopt/makers/operation/dto/admin/LoginResponseDTO.java rename to src/main/java/org/sopt/makers/operation/dto/admin/response/LoginResponseDTO.java index fdabcf8c..a263c3e5 100644 --- a/src/main/java/org/sopt/makers/operation/dto/admin/LoginResponseDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/admin/response/LoginResponseDTO.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.dto.admin; +package org.sopt.makers.operation.dto.admin.response; import lombok.Builder; import org.sopt.makers.operation.entity.admin.Admin; @@ -12,16 +12,16 @@ public static LoginResponseDTO of(Admin admin, String accessToken, String refres .refreshToken(refreshToken) .build(); } -} -@Builder -record LoginResponseVO(Long id, String name, AdminStatus adminStatus, String accessToken) { - public static LoginResponseVO of(Long id, String name, AdminStatus adminStatus, String accessToken) { - return LoginResponseVO.builder() - .id(id) - .name(name) - .adminStatus(adminStatus) - .accessToken(accessToken) - .build(); + @Builder + record LoginResponseVO(Long id, String name, AdminStatus adminStatus, String accessToken) { + public static LoginResponseVO of(Long id, String name, AdminStatus adminStatus, String accessToken) { + return LoginResponseVO.builder() + .id(id) + .name(name) + .adminStatus(adminStatus) + .accessToken(accessToken) + .build(); + } } } diff --git a/src/main/java/org/sopt/makers/operation/dto/admin/RefreshResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/admin/response/RefreshResponseDTO.java similarity index 83% rename from src/main/java/org/sopt/makers/operation/dto/admin/RefreshResponseDTO.java rename to src/main/java/org/sopt/makers/operation/dto/admin/response/RefreshResponseDTO.java index bced1f4d..d3cfc552 100644 --- a/src/main/java/org/sopt/makers/operation/dto/admin/RefreshResponseDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/admin/response/RefreshResponseDTO.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.dto.admin; +package org.sopt.makers.operation.dto.admin.response; public record RefreshResponseDTO(String accessToken, String refreshToken) { public static RefreshResponseDTO of(String accessToken, String refreshToken) { diff --git a/src/main/java/org/sopt/makers/operation/dto/admin/SignUpResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/admin/response/SignUpResponseDTO.java similarity index 76% rename from src/main/java/org/sopt/makers/operation/dto/admin/SignUpResponseDTO.java rename to src/main/java/org/sopt/makers/operation/dto/admin/response/SignUpResponseDTO.java index 15616af4..fdb6b954 100644 --- a/src/main/java/org/sopt/makers/operation/dto/admin/SignUpResponseDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/admin/response/SignUpResponseDTO.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.dto.admin; +package org.sopt.makers.operation.dto.admin.response; import org.sopt.makers.operation.entity.admin.Role; diff --git a/src/main/java/org/sopt/makers/operation/dto/alarm/AlarmRequestDTO.java b/src/main/java/org/sopt/makers/operation/dto/alarm/request/AlarmRequestDTO.java similarity index 89% rename from src/main/java/org/sopt/makers/operation/dto/alarm/AlarmRequestDTO.java rename to src/main/java/org/sopt/makers/operation/dto/alarm/request/AlarmRequestDTO.java index cf1972ce..5d4fbc1b 100644 --- a/src/main/java/org/sopt/makers/operation/dto/alarm/AlarmRequestDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/alarm/request/AlarmRequestDTO.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.dto.alarm; +package org.sopt.makers.operation.dto.alarm.request; import java.util.List; diff --git a/src/main/java/org/sopt/makers/operation/dto/alarm/AlarmSendRequestDTO.java b/src/main/java/org/sopt/makers/operation/dto/alarm/request/AlarmSendRequestDTO.java similarity index 50% rename from src/main/java/org/sopt/makers/operation/dto/alarm/AlarmSendRequestDTO.java rename to src/main/java/org/sopt/makers/operation/dto/alarm/request/AlarmSendRequestDTO.java index c02f3278..7dee9460 100644 --- a/src/main/java/org/sopt/makers/operation/dto/alarm/AlarmSendRequestDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/alarm/request/AlarmSendRequestDTO.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.dto.alarm; +package org.sopt.makers.operation.dto.alarm.request; public record AlarmSendRequestDTO(Long alarmId) { } diff --git a/src/main/java/org/sopt/makers/operation/dto/alarm/AlarmSenderDTO.java b/src/main/java/org/sopt/makers/operation/dto/alarm/request/AlarmSenderDTO.java similarity index 91% rename from src/main/java/org/sopt/makers/operation/dto/alarm/AlarmSenderDTO.java rename to src/main/java/org/sopt/makers/operation/dto/alarm/request/AlarmSenderDTO.java index d9889844..aad31a51 100644 --- a/src/main/java/org/sopt/makers/operation/dto/alarm/AlarmSenderDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/alarm/request/AlarmSenderDTO.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.dto.alarm; +package org.sopt.makers.operation.dto.alarm.request; import java.util.List; diff --git a/src/main/java/org/sopt/makers/operation/dto/alarm/AlarmInactiveListResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/alarm/response/AlarmInactiveListResponseDTO.java similarity index 63% rename from src/main/java/org/sopt/makers/operation/dto/alarm/AlarmInactiveListResponseDTO.java rename to src/main/java/org/sopt/makers/operation/dto/alarm/response/AlarmInactiveListResponseDTO.java index 9d1cdcfd..86f5f23d 100644 --- a/src/main/java/org/sopt/makers/operation/dto/alarm/AlarmInactiveListResponseDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/alarm/response/AlarmInactiveListResponseDTO.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.dto.alarm; +package org.sopt.makers.operation.dto.alarm.response; import java.util.List; diff --git a/src/main/java/org/sopt/makers/operation/dto/alarm/AlarmResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/alarm/response/AlarmResponseDTO.java similarity index 93% rename from src/main/java/org/sopt/makers/operation/dto/alarm/AlarmResponseDTO.java rename to src/main/java/org/sopt/makers/operation/dto/alarm/response/AlarmResponseDTO.java index ee5e86d1..8899d3d3 100644 --- a/src/main/java/org/sopt/makers/operation/dto/alarm/AlarmResponseDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/alarm/response/AlarmResponseDTO.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.dto.alarm; +package org.sopt.makers.operation.dto.alarm.response; import static java.util.Objects.*; diff --git a/src/main/java/org/sopt/makers/operation/dto/alarm/AlarmSendResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/alarm/response/AlarmSendResponseDTO.java similarity index 67% rename from src/main/java/org/sopt/makers/operation/dto/alarm/AlarmSendResponseDTO.java rename to src/main/java/org/sopt/makers/operation/dto/alarm/response/AlarmSendResponseDTO.java index 7b4d9f87..b6e9f3d0 100644 --- a/src/main/java/org/sopt/makers/operation/dto/alarm/AlarmSendResponseDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/alarm/response/AlarmSendResponseDTO.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.dto.alarm; +package org.sopt.makers.operation.dto.alarm.response; public record AlarmSendResponseDTO( int status, diff --git a/src/main/java/org/sopt/makers/operation/dto/alarm/AlarmsResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/alarm/response/AlarmsResponseDTO.java similarity index 94% rename from src/main/java/org/sopt/makers/operation/dto/alarm/AlarmsResponseDTO.java rename to src/main/java/org/sopt/makers/operation/dto/alarm/response/AlarmsResponseDTO.java index 0f90fa92..faa87d56 100644 --- a/src/main/java/org/sopt/makers/operation/dto/alarm/AlarmsResponseDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/alarm/response/AlarmsResponseDTO.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.dto.alarm; +package org.sopt.makers.operation.dto.alarm.response; import static java.util.Objects.*; diff --git a/src/main/java/org/sopt/makers/operation/dto/attendance/AttendRequestDTO.java b/src/main/java/org/sopt/makers/operation/dto/attendance/request/AttendRequestDTO.java similarity index 59% rename from src/main/java/org/sopt/makers/operation/dto/attendance/AttendRequestDTO.java rename to src/main/java/org/sopt/makers/operation/dto/attendance/request/AttendRequestDTO.java index baa571f1..4a8acb10 100644 --- a/src/main/java/org/sopt/makers/operation/dto/attendance/AttendRequestDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/attendance/request/AttendRequestDTO.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.dto.attendance; +package org.sopt.makers.operation.dto.attendance.request; public record AttendRequestDTO( Long subLectureId, diff --git a/src/main/java/org/sopt/makers/operation/dto/attendance/SubAttendanceUpdateRequestDTO.java b/src/main/java/org/sopt/makers/operation/dto/attendance/request/SubAttendanceUpdateRequestDTO.java similarity index 74% rename from src/main/java/org/sopt/makers/operation/dto/attendance/SubAttendanceUpdateRequestDTO.java rename to src/main/java/org/sopt/makers/operation/dto/attendance/request/SubAttendanceUpdateRequestDTO.java index 3f7634da..68a0e338 100644 --- a/src/main/java/org/sopt/makers/operation/dto/attendance/SubAttendanceUpdateRequestDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/attendance/request/SubAttendanceUpdateRequestDTO.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.dto.attendance; +package org.sopt.makers.operation.dto.attendance.request; import org.sopt.makers.operation.entity.attendance.AttendanceStatus; diff --git a/src/main/java/org/sopt/makers/operation/dto/attendance/AttendResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/attendance/response/AttendResponseDTO.java similarity index 77% rename from src/main/java/org/sopt/makers/operation/dto/attendance/AttendResponseDTO.java rename to src/main/java/org/sopt/makers/operation/dto/attendance/response/AttendResponseDTO.java index 2f392886..080b7753 100644 --- a/src/main/java/org/sopt/makers/operation/dto/attendance/AttendResponseDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/attendance/response/AttendResponseDTO.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.dto.attendance; +package org.sopt.makers.operation.dto.attendance.response; public record AttendResponseDTO( Long subLectureId diff --git a/src/main/java/org/sopt/makers/operation/dto/attendance/AttendanceMemberResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/attendance/response/AttendanceMemberResponseDTO.java similarity index 95% rename from src/main/java/org/sopt/makers/operation/dto/attendance/AttendanceMemberResponseDTO.java rename to src/main/java/org/sopt/makers/operation/dto/attendance/response/AttendanceMemberResponseDTO.java index 6eb36023..5c42ae0c 100644 --- a/src/main/java/org/sopt/makers/operation/dto/attendance/AttendanceMemberResponseDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/attendance/response/AttendanceMemberResponseDTO.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.dto.attendance; +package org.sopt.makers.operation.dto.attendance.response; import java.util.List; diff --git a/src/main/java/org/sopt/makers/operation/dto/attendance/AttendanceTotalCountVO.java b/src/main/java/org/sopt/makers/operation/dto/attendance/response/AttendanceTotalCountVO.java similarity index 87% rename from src/main/java/org/sopt/makers/operation/dto/attendance/AttendanceTotalCountVO.java rename to src/main/java/org/sopt/makers/operation/dto/attendance/response/AttendanceTotalCountVO.java index c88a2df0..0bf0b01b 100644 --- a/src/main/java/org/sopt/makers/operation/dto/attendance/AttendanceTotalCountVO.java +++ b/src/main/java/org/sopt/makers/operation/dto/attendance/response/AttendanceTotalCountVO.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.dto.attendance; +package org.sopt.makers.operation.dto.attendance.response; public record AttendanceTotalCountVO( int attendance, diff --git a/src/main/java/org/sopt/makers/operation/dto/attendance/AttendanceTotalResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/attendance/response/AttendanceTotalResponseDTO.java similarity index 92% rename from src/main/java/org/sopt/makers/operation/dto/attendance/AttendanceTotalResponseDTO.java rename to src/main/java/org/sopt/makers/operation/dto/attendance/response/AttendanceTotalResponseDTO.java index 42f509c5..9a7ac18a 100644 --- a/src/main/java/org/sopt/makers/operation/dto/attendance/AttendanceTotalResponseDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/attendance/response/AttendanceTotalResponseDTO.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.dto.attendance; +package org.sopt.makers.operation.dto.attendance.response; import org.sopt.makers.operation.entity.member.Member; import org.sopt.makers.operation.entity.Part; diff --git a/src/main/java/org/sopt/makers/operation/dto/attendance/AttendanceTotalVO.java b/src/main/java/org/sopt/makers/operation/dto/attendance/response/AttendanceTotalVO.java similarity index 94% rename from src/main/java/org/sopt/makers/operation/dto/attendance/AttendanceTotalVO.java rename to src/main/java/org/sopt/makers/operation/dto/attendance/response/AttendanceTotalVO.java index b18df121..2107b781 100644 --- a/src/main/java/org/sopt/makers/operation/dto/attendance/AttendanceTotalVO.java +++ b/src/main/java/org/sopt/makers/operation/dto/attendance/response/AttendanceTotalVO.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.dto.attendance; +package org.sopt.makers.operation.dto.attendance.response; import org.sopt.makers.operation.entity.attendance.Attendance; import org.sopt.makers.operation.entity.attendance.AttendanceStatus; diff --git a/src/main/java/org/sopt/makers/operation/dto/attendance/AttendancesResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/attendance/response/AttendancesResponseDTO.java similarity index 86% rename from src/main/java/org/sopt/makers/operation/dto/attendance/AttendancesResponseDTO.java rename to src/main/java/org/sopt/makers/operation/dto/attendance/response/AttendancesResponseDTO.java index 5a204213..45813484 100644 --- a/src/main/java/org/sopt/makers/operation/dto/attendance/AttendancesResponseDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/attendance/response/AttendancesResponseDTO.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.dto.attendance; +package org.sopt.makers.operation.dto.attendance.response; import java.util.List; diff --git a/src/main/java/org/sopt/makers/operation/dto/attendance/MemberResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/attendance/response/MemberResponseDTO.java similarity index 95% rename from src/main/java/org/sopt/makers/operation/dto/attendance/MemberResponseDTO.java rename to src/main/java/org/sopt/makers/operation/dto/attendance/response/MemberResponseDTO.java index a2df1d28..a11dff7d 100644 --- a/src/main/java/org/sopt/makers/operation/dto/attendance/MemberResponseDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/attendance/response/MemberResponseDTO.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.dto.attendance; +package org.sopt.makers.operation.dto.attendance.response; import java.util.List; diff --git a/src/main/java/org/sopt/makers/operation/dto/attendance/SubAttendanceUpdateResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/attendance/response/SubAttendanceUpdateResponseDTO.java similarity index 87% rename from src/main/java/org/sopt/makers/operation/dto/attendance/SubAttendanceUpdateResponseDTO.java rename to src/main/java/org/sopt/makers/operation/dto/attendance/response/SubAttendanceUpdateResponseDTO.java index 8661181a..8aa98a49 100644 --- a/src/main/java/org/sopt/makers/operation/dto/attendance/SubAttendanceUpdateResponseDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/attendance/response/SubAttendanceUpdateResponseDTO.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.dto.attendance; +package org.sopt.makers.operation.dto.attendance.response; import org.sopt.makers.operation.entity.attendance.AttendanceStatus; import org.sopt.makers.operation.entity.attendance.SubAttendance; diff --git a/src/main/java/org/sopt/makers/operation/dto/lecture/LectureSearchCondition.java b/src/main/java/org/sopt/makers/operation/dto/lecture/LectureSearchCondition.java deleted file mode 100644 index 49672978..00000000 --- a/src/main/java/org/sopt/makers/operation/dto/lecture/LectureSearchCondition.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.sopt.makers.operation.dto.lecture; - -import org.sopt.makers.operation.entity.member.Member; -import org.sopt.makers.operation.entity.Part; - -public record LectureSearchCondition(Part part, int generation, Long memberId) { - public static LectureSearchCondition of(Member member) { - return new LectureSearchCondition( - member.getPart(), - member.getGeneration(), - member.getId() - ); - } -} diff --git a/src/main/java/org/sopt/makers/operation/dto/lecture/AttendanceRequestDTO.java b/src/main/java/org/sopt/makers/operation/dto/lecture/request/AttendanceRequestDTO.java similarity index 60% rename from src/main/java/org/sopt/makers/operation/dto/lecture/AttendanceRequestDTO.java rename to src/main/java/org/sopt/makers/operation/dto/lecture/request/AttendanceRequestDTO.java index 8afd941a..9319dec9 100644 --- a/src/main/java/org/sopt/makers/operation/dto/lecture/AttendanceRequestDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/lecture/request/AttendanceRequestDTO.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.dto.lecture; +package org.sopt.makers.operation.dto.lecture.request; public record AttendanceRequestDTO( Long lectureId, diff --git a/src/main/java/org/sopt/makers/operation/dto/lecture/LectureRequestDTO.java b/src/main/java/org/sopt/makers/operation/dto/lecture/request/LectureRequestDTO.java similarity index 94% rename from src/main/java/org/sopt/makers/operation/dto/lecture/LectureRequestDTO.java rename to src/main/java/org/sopt/makers/operation/dto/lecture/request/LectureRequestDTO.java index 96c99649..ea5125d8 100644 --- a/src/main/java/org/sopt/makers/operation/dto/lecture/LectureRequestDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/lecture/request/LectureRequestDTO.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.dto.lecture; +package org.sopt.makers.operation.dto.lecture.request; import java.time.LocalDateTime; import java.time.format.DateTimeParseException; diff --git a/src/main/java/org/sopt/makers/operation/dto/lecture/AttendanceResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/lecture/response/AttendanceResponseDTO.java similarity index 88% rename from src/main/java/org/sopt/makers/operation/dto/lecture/AttendanceResponseDTO.java rename to src/main/java/org/sopt/makers/operation/dto/lecture/response/AttendanceResponseDTO.java index 10690fda..e377623d 100644 --- a/src/main/java/org/sopt/makers/operation/dto/lecture/AttendanceResponseDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/lecture/response/AttendanceResponseDTO.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.dto.lecture; +package org.sopt.makers.operation.dto.lecture.response; import org.sopt.makers.operation.entity.lecture.SubLecture; import org.sopt.makers.operation.entity.lecture.Lecture; diff --git a/src/main/java/org/sopt/makers/operation/dto/lecture/AttendancesStatusVO.java b/src/main/java/org/sopt/makers/operation/dto/lecture/response/AttendancesStatusVO.java similarity index 94% rename from src/main/java/org/sopt/makers/operation/dto/lecture/AttendancesStatusVO.java rename to src/main/java/org/sopt/makers/operation/dto/lecture/response/AttendancesStatusVO.java index 663d4b58..c566bc87 100644 --- a/src/main/java/org/sopt/makers/operation/dto/lecture/AttendancesStatusVO.java +++ b/src/main/java/org/sopt/makers/operation/dto/lecture/response/AttendancesStatusVO.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.dto.lecture; +package org.sopt.makers.operation.dto.lecture.response; import static org.sopt.makers.operation.entity.attendance.AttendanceStatus.*; diff --git a/src/main/java/org/sopt/makers/operation/dto/lecture/LectureCurrentRoundResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/lecture/response/LectureCurrentRoundResponseDTO.java similarity index 86% rename from src/main/java/org/sopt/makers/operation/dto/lecture/LectureCurrentRoundResponseDTO.java rename to src/main/java/org/sopt/makers/operation/dto/lecture/response/LectureCurrentRoundResponseDTO.java index ecc2af8c..aac13efb 100644 --- a/src/main/java/org/sopt/makers/operation/dto/lecture/LectureCurrentRoundResponseDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/lecture/response/LectureCurrentRoundResponseDTO.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.dto.lecture; +package org.sopt.makers.operation.dto.lecture.response; import org.sopt.makers.operation.entity.lecture.SubLecture; diff --git a/src/main/java/org/sopt/makers/operation/dto/lecture/LectureDetailResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/lecture/response/LectureDetailResponseDTO.java similarity index 92% rename from src/main/java/org/sopt/makers/operation/dto/lecture/LectureDetailResponseDTO.java rename to src/main/java/org/sopt/makers/operation/dto/lecture/response/LectureDetailResponseDTO.java index 95042350..08d5d8d8 100644 --- a/src/main/java/org/sopt/makers/operation/dto/lecture/LectureDetailResponseDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/lecture/response/LectureDetailResponseDTO.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.dto.lecture; +package org.sopt.makers.operation.dto.lecture.response; import org.sopt.makers.operation.entity.lecture.Lecture; diff --git a/src/main/java/org/sopt/makers/operation/dto/lecture/LectureResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/lecture/response/LectureResponseDTO.java similarity index 96% rename from src/main/java/org/sopt/makers/operation/dto/lecture/LectureResponseDTO.java rename to src/main/java/org/sopt/makers/operation/dto/lecture/response/LectureResponseDTO.java index edf4c2c6..a48e7e78 100644 --- a/src/main/java/org/sopt/makers/operation/dto/lecture/LectureResponseDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/lecture/response/LectureResponseDTO.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.dto.lecture; +package org.sopt.makers.operation.dto.lecture.response; import static java.util.Objects.*; diff --git a/src/main/java/org/sopt/makers/operation/dto/lecture/LectureResponseType.java b/src/main/java/org/sopt/makers/operation/dto/lecture/response/LectureResponseType.java similarity index 59% rename from src/main/java/org/sopt/makers/operation/dto/lecture/LectureResponseType.java rename to src/main/java/org/sopt/makers/operation/dto/lecture/response/LectureResponseType.java index 9c5e7c33..cc3de48b 100644 --- a/src/main/java/org/sopt/makers/operation/dto/lecture/LectureResponseType.java +++ b/src/main/java/org/sopt/makers/operation/dto/lecture/response/LectureResponseType.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.dto.lecture; +package org.sopt.makers.operation.dto.lecture.response; public enum LectureResponseType { NO_SESSION, HAS_ATTENDANCE, NO_ATTENDANCE diff --git a/src/main/java/org/sopt/makers/operation/dto/lecture/LecturesResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/lecture/response/LecturesResponseDTO.java similarity index 95% rename from src/main/java/org/sopt/makers/operation/dto/lecture/LecturesResponseDTO.java rename to src/main/java/org/sopt/makers/operation/dto/lecture/response/LecturesResponseDTO.java index 2a831d19..a40239dc 100644 --- a/src/main/java/org/sopt/makers/operation/dto/lecture/LecturesResponseDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/lecture/response/LecturesResponseDTO.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.dto.lecture; +package org.sopt.makers.operation.dto.lecture.response; import java.util.List; diff --git a/src/main/java/org/sopt/makers/operation/dto/lecture/TodayLectureResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/lecture/response/TodayLectureResponseDTO.java similarity index 97% rename from src/main/java/org/sopt/makers/operation/dto/lecture/TodayLectureResponseDTO.java rename to src/main/java/org/sopt/makers/operation/dto/lecture/response/TodayLectureResponseDTO.java index 01127353..56c69cdd 100644 --- a/src/main/java/org/sopt/makers/operation/dto/lecture/TodayLectureResponseDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/lecture/response/TodayLectureResponseDTO.java @@ -1,6 +1,7 @@ -package org.sopt.makers.operation.dto.lecture; +package org.sopt.makers.operation.dto.lecture.response; import lombok.Builder; + import org.sopt.makers.operation.entity.attendance.AttendanceStatus; import org.sopt.makers.operation.entity.attendance.SubAttendance; import org.sopt.makers.operation.entity.lecture.Lecture; diff --git a/src/main/java/org/sopt/makers/operation/dto/member/MemberRequestDTO.java b/src/main/java/org/sopt/makers/operation/dto/member/request/MemberRequestDTO.java similarity index 82% rename from src/main/java/org/sopt/makers/operation/dto/member/MemberRequestDTO.java rename to src/main/java/org/sopt/makers/operation/dto/member/request/MemberRequestDTO.java index 136bb649..5e44d375 100644 --- a/src/main/java/org/sopt/makers/operation/dto/member/MemberRequestDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/member/request/MemberRequestDTO.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.dto.member; +package org.sopt.makers.operation.dto.member.request; import org.sopt.makers.operation.entity.member.ObYb; import org.sopt.makers.operation.entity.Part; diff --git a/src/main/java/org/sopt/makers/operation/dto/member/MemberListGetResponse.java b/src/main/java/org/sopt/makers/operation/dto/member/response/MemberListGetResponse.java similarity index 82% rename from src/main/java/org/sopt/makers/operation/dto/member/MemberListGetResponse.java rename to src/main/java/org/sopt/makers/operation/dto/member/response/MemberListGetResponse.java index d30f24bd..12571567 100644 --- a/src/main/java/org/sopt/makers/operation/dto/member/MemberListGetResponse.java +++ b/src/main/java/org/sopt/makers/operation/dto/member/response/MemberListGetResponse.java @@ -1,6 +1,6 @@ -package org.sopt.makers.operation.dto.member; +package org.sopt.makers.operation.dto.member.response; -import org.sopt.makers.operation.dto.attendance.AttendanceTotalCountVO; +import org.sopt.makers.operation.dto.attendance.response.AttendanceTotalCountVO; import org.sopt.makers.operation.entity.member.Member; import org.sopt.makers.operation.entity.Part; diff --git a/src/main/java/org/sopt/makers/operation/dto/member/MemberScoreGetResponse.java b/src/main/java/org/sopt/makers/operation/dto/member/response/MemberScoreGetResponse.java similarity index 78% rename from src/main/java/org/sopt/makers/operation/dto/member/MemberScoreGetResponse.java rename to src/main/java/org/sopt/makers/operation/dto/member/response/MemberScoreGetResponse.java index 7e1d56a8..b308d309 100644 --- a/src/main/java/org/sopt/makers/operation/dto/member/MemberScoreGetResponse.java +++ b/src/main/java/org/sopt/makers/operation/dto/member/response/MemberScoreGetResponse.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.dto.member; +package org.sopt.makers.operation.dto.member.response; public record MemberScoreGetResponse( float score diff --git a/src/main/java/org/sopt/makers/operation/dto/member/MemberSearchCondition.java b/src/main/java/org/sopt/makers/operation/dto/member/response/MemberSearchCondition.java similarity index 67% rename from src/main/java/org/sopt/makers/operation/dto/member/MemberSearchCondition.java rename to src/main/java/org/sopt/makers/operation/dto/member/response/MemberSearchCondition.java index f4636d28..f3cbe9d6 100644 --- a/src/main/java/org/sopt/makers/operation/dto/member/MemberSearchCondition.java +++ b/src/main/java/org/sopt/makers/operation/dto/member/response/MemberSearchCondition.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.dto.member; +package org.sopt.makers.operation.dto.member.response; import org.sopt.makers.operation.entity.Part; diff --git a/src/main/java/org/sopt/makers/operation/dto/member/MembersResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/member/response/MembersResponseDTO.java similarity index 82% rename from src/main/java/org/sopt/makers/operation/dto/member/MembersResponseDTO.java rename to src/main/java/org/sopt/makers/operation/dto/member/response/MembersResponseDTO.java index 07b81d1e..ff90b0b4 100644 --- a/src/main/java/org/sopt/makers/operation/dto/member/MembersResponseDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/member/response/MembersResponseDTO.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.dto.member; +package org.sopt.makers.operation.dto.member.response; import java.util.List; diff --git a/src/main/java/org/sopt/makers/operation/dto/schedule/SchedulesResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/schedule/response/SchedulesResponseDTO.java similarity index 96% rename from src/main/java/org/sopt/makers/operation/dto/schedule/SchedulesResponseDTO.java rename to src/main/java/org/sopt/makers/operation/dto/schedule/response/SchedulesResponseDTO.java index 9c83d9b3..31daed32 100644 --- a/src/main/java/org/sopt/makers/operation/dto/schedule/SchedulesResponseDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/schedule/response/SchedulesResponseDTO.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.dto.schedule; +package org.sopt.makers.operation.dto.schedule.response; import lombok.*; import org.sopt.makers.operation.entity.lecture.Attribute; diff --git a/src/main/java/org/sopt/makers/operation/entity/alarm/Alarm.java b/src/main/java/org/sopt/makers/operation/entity/alarm/Alarm.java index 7ae69ccd..7f536a8f 100644 --- a/src/main/java/org/sopt/makers/operation/entity/alarm/Alarm.java +++ b/src/main/java/org/sopt/makers/operation/entity/alarm/Alarm.java @@ -16,7 +16,7 @@ import javax.persistence.Id; import org.sopt.makers.operation.converter.StringListConverter; -import org.sopt.makers.operation.dto.alarm.AlarmRequestDTO; +import org.sopt.makers.operation.dto.alarm.request.AlarmRequestDTO; import org.sopt.makers.operation.entity.BaseEntity; import org.sopt.makers.operation.entity.Part; diff --git a/src/main/java/org/sopt/makers/operation/entity/member/Member.java b/src/main/java/org/sopt/makers/operation/entity/member/Member.java index acd5675a..8d8cbfc5 100644 --- a/src/main/java/org/sopt/makers/operation/entity/member/Member.java +++ b/src/main/java/org/sopt/makers/operation/entity/member/Member.java @@ -14,7 +14,7 @@ import javax.persistence.Id; import javax.persistence.OneToMany; -import org.sopt.makers.operation.dto.member.MemberRequestDTO; +import org.sopt.makers.operation.dto.member.request.MemberRequestDTO; import org.sopt.makers.operation.entity.Part; import org.sopt.makers.operation.entity.attendance.Attendance; diff --git a/src/main/java/org/sopt/makers/operation/external/alarm/AlarmSender.java b/src/main/java/org/sopt/makers/operation/external/alarm/AlarmSender.java index e9437619..fec5ad40 100644 --- a/src/main/java/org/sopt/makers/operation/external/alarm/AlarmSender.java +++ b/src/main/java/org/sopt/makers/operation/external/alarm/AlarmSender.java @@ -1,6 +1,6 @@ package org.sopt.makers.operation.external.alarm; -import org.sopt.makers.operation.dto.alarm.AlarmSenderDTO; +import org.sopt.makers.operation.dto.alarm.request.AlarmSenderDTO; public interface AlarmSender { void send(AlarmSenderDTO alarmSenderDTO); diff --git a/src/main/java/org/sopt/makers/operation/external/alarm/AlarmSenderImpl.java b/src/main/java/org/sopt/makers/operation/external/alarm/AlarmSenderImpl.java index 5a3f636d..e24783b2 100644 --- a/src/main/java/org/sopt/makers/operation/external/alarm/AlarmSenderImpl.java +++ b/src/main/java/org/sopt/makers/operation/external/alarm/AlarmSenderImpl.java @@ -11,8 +11,8 @@ import java.util.List; import java.util.Map; -import org.sopt.makers.operation.dto.alarm.AlarmSendResponseDTO; -import org.sopt.makers.operation.dto.alarm.AlarmSenderDTO; +import org.sopt.makers.operation.dto.alarm.response.AlarmSendResponseDTO; +import org.sopt.makers.operation.dto.alarm.request.AlarmSenderDTO; import org.sopt.makers.operation.exception.AlarmException; import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpEntity; diff --git a/src/main/java/org/sopt/makers/operation/external/playground/PlayGroundServer.java b/src/main/java/org/sopt/makers/operation/external/playground/PlayGroundServer.java index 5e886335..e911fefc 100644 --- a/src/main/java/org/sopt/makers/operation/external/playground/PlayGroundServer.java +++ b/src/main/java/org/sopt/makers/operation/external/playground/PlayGroundServer.java @@ -1,6 +1,6 @@ package org.sopt.makers.operation.external.playground; -import org.sopt.makers.operation.dto.alarm.AlarmInactiveListResponseDTO; +import org.sopt.makers.operation.dto.alarm.response.AlarmInactiveListResponseDTO; import org.sopt.makers.operation.entity.Part; public interface PlayGroundServer { diff --git a/src/main/java/org/sopt/makers/operation/external/playground/PlayGroundServerImpl.java b/src/main/java/org/sopt/makers/operation/external/playground/PlayGroundServerImpl.java index 6e54253c..8ec7c1e5 100644 --- a/src/main/java/org/sopt/makers/operation/external/playground/PlayGroundServerImpl.java +++ b/src/main/java/org/sopt/makers/operation/external/playground/PlayGroundServerImpl.java @@ -4,7 +4,7 @@ import static org.sopt.makers.operation.entity.Part.*; import static org.springframework.http.HttpMethod.*; -import org.sopt.makers.operation.dto.alarm.AlarmInactiveListResponseDTO; +import org.sopt.makers.operation.dto.alarm.response.AlarmInactiveListResponseDTO; import org.sopt.makers.operation.entity.Part; import org.sopt.makers.operation.exception.AlarmException; import org.springframework.beans.factory.annotation.Value; diff --git a/src/main/java/org/sopt/makers/operation/repository/member/MemberCustomRepository.java b/src/main/java/org/sopt/makers/operation/repository/member/MemberCustomRepository.java index 03aa323a..9344e655 100644 --- a/src/main/java/org/sopt/makers/operation/repository/member/MemberCustomRepository.java +++ b/src/main/java/org/sopt/makers/operation/repository/member/MemberCustomRepository.java @@ -3,7 +3,7 @@ import java.util.List; import java.util.Optional; -import org.sopt.makers.operation.dto.member.MemberSearchCondition; +import org.sopt.makers.operation.dto.member.response.MemberSearchCondition; import org.sopt.makers.operation.entity.member.Member; import org.sopt.makers.operation.entity.Part; import org.springframework.data.domain.Pageable; diff --git a/src/main/java/org/sopt/makers/operation/repository/member/MemberRepositoryImpl.java b/src/main/java/org/sopt/makers/operation/repository/member/MemberRepositoryImpl.java index cb0eb443..5e0cb1ac 100644 --- a/src/main/java/org/sopt/makers/operation/repository/member/MemberRepositoryImpl.java +++ b/src/main/java/org/sopt/makers/operation/repository/member/MemberRepositoryImpl.java @@ -11,7 +11,7 @@ import com.querydsl.core.types.dsl.Expressions; import com.querydsl.core.types.dsl.StringExpression; -import org.sopt.makers.operation.dto.member.MemberSearchCondition; +import org.sopt.makers.operation.dto.member.response.MemberSearchCondition; import org.sopt.makers.operation.entity.member.Member; import org.sopt.makers.operation.entity.Part; import org.springframework.data.domain.Pageable; diff --git a/src/main/java/org/sopt/makers/operation/service/AdminService.java b/src/main/java/org/sopt/makers/operation/service/AdminService.java index 0e29ab57..736b8b23 100644 --- a/src/main/java/org/sopt/makers/operation/service/AdminService.java +++ b/src/main/java/org/sopt/makers/operation/service/AdminService.java @@ -1,6 +1,10 @@ package org.sopt.makers.operation.service; -import org.sopt.makers.operation.dto.admin.*; +import org.sopt.makers.operation.dto.admin.request.LoginRequestDTO; +import org.sopt.makers.operation.dto.admin.request.SignUpRequestDTO; +import org.sopt.makers.operation.dto.admin.response.LoginResponseDTO; +import org.sopt.makers.operation.dto.admin.response.RefreshResponseDTO; +import org.sopt.makers.operation.dto.admin.response.SignUpResponseDTO; public interface AdminService { SignUpResponseDTO signUp(SignUpRequestDTO signUpRequestDTO); diff --git a/src/main/java/org/sopt/makers/operation/service/AdminServiceImpl.java b/src/main/java/org/sopt/makers/operation/service/AdminServiceImpl.java index d57bdd68..2e10e43b 100644 --- a/src/main/java/org/sopt/makers/operation/service/AdminServiceImpl.java +++ b/src/main/java/org/sopt/makers/operation/service/AdminServiceImpl.java @@ -5,7 +5,11 @@ import lombok.RequiredArgsConstructor; import lombok.val; -import org.sopt.makers.operation.dto.admin.*; +import org.sopt.makers.operation.dto.admin.request.LoginRequestDTO; +import org.sopt.makers.operation.dto.admin.request.SignUpRequestDTO; +import org.sopt.makers.operation.dto.admin.response.LoginResponseDTO; +import org.sopt.makers.operation.dto.admin.response.RefreshResponseDTO; +import org.sopt.makers.operation.dto.admin.response.SignUpResponseDTO; import org.sopt.makers.operation.entity.admin.Admin; import org.sopt.makers.operation.entity.admin.AdminStatus; import org.sopt.makers.operation.exception.AdminFailureException; diff --git a/src/main/java/org/sopt/makers/operation/service/AlarmService.java b/src/main/java/org/sopt/makers/operation/service/AlarmService.java index 43c8c9d1..459cb89f 100644 --- a/src/main/java/org/sopt/makers/operation/service/AlarmService.java +++ b/src/main/java/org/sopt/makers/operation/service/AlarmService.java @@ -1,13 +1,10 @@ package org.sopt.makers.operation.service; -import java.util.List; +import org.sopt.makers.operation.dto.alarm.request.AlarmSendRequestDTO; -import org.sopt.makers.operation.dto.alarm.AlarmSendRequestDTO; -import org.sopt.makers.operation.entity.alarm.Attribute; - -import org.sopt.makers.operation.dto.alarm.AlarmRequestDTO; -import org.sopt.makers.operation.dto.alarm.AlarmResponseDTO; -import org.sopt.makers.operation.dto.alarm.AlarmsResponseDTO; +import org.sopt.makers.operation.dto.alarm.request.AlarmRequestDTO; +import org.sopt.makers.operation.dto.alarm.response.AlarmResponseDTO; +import org.sopt.makers.operation.dto.alarm.response.AlarmsResponseDTO; import org.sopt.makers.operation.entity.Part; import org.sopt.makers.operation.entity.alarm.Status; import org.springframework.data.domain.Pageable; diff --git a/src/main/java/org/sopt/makers/operation/service/AlarmServiceImpl.java b/src/main/java/org/sopt/makers/operation/service/AlarmServiceImpl.java index 561146f2..70e16525 100644 --- a/src/main/java/org/sopt/makers/operation/service/AlarmServiceImpl.java +++ b/src/main/java/org/sopt/makers/operation/service/AlarmServiceImpl.java @@ -6,9 +6,9 @@ import static org.sopt.makers.operation.entity.alarm.Status.*; import org.sopt.makers.operation.config.ValueConfig; -import org.sopt.makers.operation.dto.alarm.AlarmSendRequestDTO; -import org.sopt.makers.operation.dto.alarm.AlarmSenderDTO; -import org.sopt.makers.operation.dto.member.MemberSearchCondition; +import org.sopt.makers.operation.dto.alarm.request.AlarmSendRequestDTO; +import org.sopt.makers.operation.dto.alarm.request.AlarmSenderDTO; +import org.sopt.makers.operation.dto.member.response.MemberSearchCondition; import org.sopt.makers.operation.entity.Part; import org.sopt.makers.operation.entity.alarm.Status; import org.sopt.makers.operation.exception.AlarmException; @@ -25,9 +25,9 @@ import lombok.*; -import org.sopt.makers.operation.dto.alarm.AlarmRequestDTO; -import org.sopt.makers.operation.dto.alarm.AlarmResponseDTO; -import org.sopt.makers.operation.dto.alarm.AlarmsResponseDTO; +import org.sopt.makers.operation.dto.alarm.request.AlarmRequestDTO; +import org.sopt.makers.operation.dto.alarm.response.AlarmResponseDTO; +import org.sopt.makers.operation.dto.alarm.response.AlarmsResponseDTO; import org.sopt.makers.operation.entity.alarm.Alarm; import org.springframework.data.domain.Pageable; diff --git a/src/main/java/org/sopt/makers/operation/service/AttendanceService.java b/src/main/java/org/sopt/makers/operation/service/AttendanceService.java index cee613e8..4f29f899 100644 --- a/src/main/java/org/sopt/makers/operation/service/AttendanceService.java +++ b/src/main/java/org/sopt/makers/operation/service/AttendanceService.java @@ -1,14 +1,13 @@ package org.sopt.makers.operation.service; -import java.util.List; - -import org.sopt.makers.operation.dto.attendance.AttendanceMemberResponseDTO; -import org.sopt.makers.operation.dto.attendance.SubAttendanceUpdateRequestDTO; -import org.sopt.makers.operation.dto.attendance.SubAttendanceUpdateResponseDTO; -import org.sopt.makers.operation.dto.attendance.MemberResponseDTO; +import org.sopt.makers.operation.dto.attendance.request.AttendRequestDTO; +import org.sopt.makers.operation.dto.attendance.response.AttendResponseDTO; +import org.sopt.makers.operation.dto.attendance.response.AttendanceMemberResponseDTO; +import org.sopt.makers.operation.dto.attendance.request.SubAttendanceUpdateRequestDTO; +import org.sopt.makers.operation.dto.attendance.response.AttendancesResponseDTO; +import org.sopt.makers.operation.dto.attendance.response.SubAttendanceUpdateResponseDTO; import org.sopt.makers.operation.entity.Part; import org.springframework.data.domain.Pageable; -import org.sopt.makers.operation.dto.attendance.*; public interface AttendanceService { SubAttendanceUpdateResponseDTO updateSubAttendance(SubAttendanceUpdateRequestDTO requestDTO); diff --git a/src/main/java/org/sopt/makers/operation/service/AttendanceServiceImpl.java b/src/main/java/org/sopt/makers/operation/service/AttendanceServiceImpl.java index 839fdd53..45ba1a10 100644 --- a/src/main/java/org/sopt/makers/operation/service/AttendanceServiceImpl.java +++ b/src/main/java/org/sopt/makers/operation/service/AttendanceServiceImpl.java @@ -4,11 +4,14 @@ import static org.sopt.makers.operation.common.ExceptionMessage.*; import org.sopt.makers.operation.config.ValueConfig; -import org.sopt.makers.operation.dto.attendance.AttendanceMemberResponseDTO; -import org.sopt.makers.operation.dto.attendance.SubAttendanceUpdateRequestDTO; -import org.sopt.makers.operation.dto.attendance.SubAttendanceUpdateResponseDTO; +import org.sopt.makers.operation.dto.attendance.request.AttendRequestDTO; +import org.sopt.makers.operation.dto.attendance.response.AttendResponseDTO; +import org.sopt.makers.operation.dto.attendance.response.AttendanceMemberResponseDTO; +import org.sopt.makers.operation.dto.attendance.request.SubAttendanceUpdateRequestDTO; +import org.sopt.makers.operation.dto.attendance.response.AttendancesResponseDTO; +import org.sopt.makers.operation.dto.attendance.response.SubAttendanceUpdateResponseDTO; import lombok.val; -import org.sopt.makers.operation.dto.attendance.*; + import org.sopt.makers.operation.entity.attendance.AttendanceStatus; import org.sopt.makers.operation.entity.member.Member; import org.sopt.makers.operation.entity.Part; diff --git a/src/main/java/org/sopt/makers/operation/service/LectureService.java b/src/main/java/org/sopt/makers/operation/service/LectureService.java index b133cc73..f254e092 100644 --- a/src/main/java/org/sopt/makers/operation/service/LectureService.java +++ b/src/main/java/org/sopt/makers/operation/service/LectureService.java @@ -1,13 +1,14 @@ package org.sopt.makers.operation.service; -import org.sopt.makers.operation.dto.lecture.TodayLectureResponseDTO; -import org.sopt.makers.operation.dto.lecture.AttendanceRequestDTO; -import org.sopt.makers.operation.dto.lecture.AttendanceResponseDTO; -import org.sopt.makers.operation.dto.lecture.LectureRequestDTO; -import org.sopt.makers.operation.dto.lecture.LectureResponseDTO; -import org.sopt.makers.operation.dto.lecture.LecturesResponseDTO; +import org.sopt.makers.operation.dto.lecture.response.LectureCurrentRoundResponseDTO; +import org.sopt.makers.operation.dto.lecture.response.LectureDetailResponseDTO; +import org.sopt.makers.operation.dto.lecture.response.TodayLectureResponseDTO; +import org.sopt.makers.operation.dto.lecture.request.AttendanceRequestDTO; +import org.sopt.makers.operation.dto.lecture.response.AttendanceResponseDTO; +import org.sopt.makers.operation.dto.lecture.request.LectureRequestDTO; +import org.sopt.makers.operation.dto.lecture.response.LectureResponseDTO; +import org.sopt.makers.operation.dto.lecture.response.LecturesResponseDTO; import org.sopt.makers.operation.entity.Part; -import org.sopt.makers.operation.dto.lecture.*; public interface LectureService { diff --git a/src/main/java/org/sopt/makers/operation/service/LectureServiceImpl.java b/src/main/java/org/sopt/makers/operation/service/LectureServiceImpl.java index 24755f09..ee5f97ed 100644 --- a/src/main/java/org/sopt/makers/operation/service/LectureServiceImpl.java +++ b/src/main/java/org/sopt/makers/operation/service/LectureServiceImpl.java @@ -2,7 +2,7 @@ import static org.sopt.makers.operation.common.ExceptionMessage.*; import static org.sopt.makers.operation.common.ExceptionMessage.NO_SESSION; -import static org.sopt.makers.operation.dto.lecture.LectureResponseType.*; +import static org.sopt.makers.operation.dto.lecture.response.LectureResponseType.*; import static org.sopt.makers.operation.entity.attendance.AttendanceStatus.*; import static org.sopt.makers.operation.entity.alarm.Attribute.*; import static org.sopt.makers.operation.entity.lecture.LectureStatus.*; @@ -16,14 +16,17 @@ import lombok.val; import org.sopt.makers.operation.config.ValueConfig; -import org.sopt.makers.operation.dto.alarm.AlarmSenderDTO; -import org.sopt.makers.operation.dto.lecture.*; - -import org.sopt.makers.operation.dto.lecture.AttendanceRequestDTO; -import org.sopt.makers.operation.dto.lecture.AttendanceResponseDTO; -import org.sopt.makers.operation.dto.lecture.LectureRequestDTO; -import org.sopt.makers.operation.dto.lecture.LectureResponseDTO; -import org.sopt.makers.operation.dto.lecture.LecturesResponseDTO; +import org.sopt.makers.operation.dto.alarm.request.AlarmSenderDTO; + +import org.sopt.makers.operation.dto.lecture.request.AttendanceRequestDTO; +import org.sopt.makers.operation.dto.lecture.response.AttendanceResponseDTO; +import org.sopt.makers.operation.dto.lecture.request.LectureRequestDTO; +import org.sopt.makers.operation.dto.lecture.response.LectureCurrentRoundResponseDTO; +import org.sopt.makers.operation.dto.lecture.response.LectureDetailResponseDTO; +import org.sopt.makers.operation.dto.lecture.response.LectureResponseDTO; +import org.sopt.makers.operation.dto.lecture.response.LectureResponseType; +import org.sopt.makers.operation.dto.lecture.response.LecturesResponseDTO; +import org.sopt.makers.operation.dto.lecture.response.TodayLectureResponseDTO; import org.sopt.makers.operation.entity.*; import org.sopt.makers.operation.entity.attendance.Attendance; import org.sopt.makers.operation.entity.attendance.SubAttendance; diff --git a/src/main/java/org/sopt/makers/operation/service/MemberService.java b/src/main/java/org/sopt/makers/operation/service/MemberService.java index 4abdef58..2b6bcbfa 100644 --- a/src/main/java/org/sopt/makers/operation/service/MemberService.java +++ b/src/main/java/org/sopt/makers/operation/service/MemberService.java @@ -1,15 +1,12 @@ package org.sopt.makers.operation.service; -import org.sopt.makers.operation.dto.attendance.AttendanceTotalResponseDTO; -import org.sopt.makers.operation.dto.member.MemberListGetResponse; -import org.sopt.makers.operation.dto.member.MemberRequestDTO; -import org.sopt.makers.operation.dto.member.MemberScoreGetResponse; -import org.sopt.makers.operation.dto.member.MembersResponseDTO; +import org.sopt.makers.operation.dto.attendance.response.AttendanceTotalResponseDTO; +import org.sopt.makers.operation.dto.member.request.MemberRequestDTO; +import org.sopt.makers.operation.dto.member.response.MemberScoreGetResponse; +import org.sopt.makers.operation.dto.member.response.MembersResponseDTO; import org.sopt.makers.operation.entity.Part; import org.springframework.data.domain.Pageable; -import java.util.List; - public interface MemberService { MembersResponseDTO getMemberList(Part part, int generation, Pageable pageable); AttendanceTotalResponseDTO getMemberTotalAttendance(Long playGroundId); diff --git a/src/main/java/org/sopt/makers/operation/service/MemberServiceImpl.java b/src/main/java/org/sopt/makers/operation/service/MemberServiceImpl.java index f12fd21a..48282fc1 100644 --- a/src/main/java/org/sopt/makers/operation/service/MemberServiceImpl.java +++ b/src/main/java/org/sopt/makers/operation/service/MemberServiceImpl.java @@ -6,14 +6,14 @@ import lombok.val; import org.sopt.makers.operation.config.ValueConfig; -import org.sopt.makers.operation.dto.attendance.AttendanceTotalCountVO; -import org.sopt.makers.operation.dto.attendance.AttendanceTotalResponseDTO; -import org.sopt.makers.operation.dto.attendance.AttendanceTotalVO; -import org.sopt.makers.operation.dto.member.MemberListGetResponse; -import org.sopt.makers.operation.dto.member.MemberRequestDTO; -import org.sopt.makers.operation.dto.member.MemberScoreGetResponse; -import org.sopt.makers.operation.dto.member.MemberSearchCondition; -import org.sopt.makers.operation.dto.member.MembersResponseDTO; +import org.sopt.makers.operation.dto.attendance.response.AttendanceTotalCountVO; +import org.sopt.makers.operation.dto.attendance.response.AttendanceTotalResponseDTO; +import org.sopt.makers.operation.dto.attendance.response.AttendanceTotalVO; +import org.sopt.makers.operation.dto.member.response.MemberListGetResponse; +import org.sopt.makers.operation.dto.member.request.MemberRequestDTO; +import org.sopt.makers.operation.dto.member.response.MemberScoreGetResponse; +import org.sopt.makers.operation.dto.member.response.MemberSearchCondition; +import org.sopt.makers.operation.dto.member.response.MembersResponseDTO; import org.sopt.makers.operation.entity.attendance.AttendanceStatus; import org.sopt.makers.operation.entity.member.Member; import org.sopt.makers.operation.entity.Part; diff --git a/src/main/java/org/sopt/makers/operation/service/ScheduleService.java b/src/main/java/org/sopt/makers/operation/service/ScheduleService.java index a864957c..6ac8f9e8 100644 --- a/src/main/java/org/sopt/makers/operation/service/ScheduleService.java +++ b/src/main/java/org/sopt/makers/operation/service/ScheduleService.java @@ -1,6 +1,6 @@ package org.sopt.makers.operation.service; -import org.sopt.makers.operation.dto.schedule.SchedulesResponseDTO; +import org.sopt.makers.operation.dto.schedule.response.SchedulesResponseDTO; import java.time.LocalDateTime; diff --git a/src/main/java/org/sopt/makers/operation/service/ScheduleServiceImpl.java b/src/main/java/org/sopt/makers/operation/service/ScheduleServiceImpl.java index ad7965fe..ad4a9b9a 100644 --- a/src/main/java/org/sopt/makers/operation/service/ScheduleServiceImpl.java +++ b/src/main/java/org/sopt/makers/operation/service/ScheduleServiceImpl.java @@ -2,7 +2,7 @@ import lombok.RequiredArgsConstructor; import lombok.val; -import org.sopt.makers.operation.dto.schedule.SchedulesResponseDTO; +import org.sopt.makers.operation.dto.schedule.response.SchedulesResponseDTO; import org.sopt.makers.operation.entity.schedule.Schedule; import org.sopt.makers.operation.repository.schedule.ScheduleRepository; import org.springframework.stereotype.Service; diff --git a/src/test/java/org/sopt/makers/operation/controller/web/LectureControllerTest.java b/src/test/java/org/sopt/makers/operation/controller/web/LectureControllerTest.java index f00c2aa4..bb980bc3 100644 --- a/src/test/java/org/sopt/makers/operation/controller/web/LectureControllerTest.java +++ b/src/test/java/org/sopt/makers/operation/controller/web/LectureControllerTest.java @@ -7,12 +7,12 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; -import org.sopt.makers.operation.dto.lecture.AttendanceRequestDTO; -import org.sopt.makers.operation.dto.lecture.AttendanceResponseDTO; -import org.sopt.makers.operation.dto.lecture.LectureDetailResponseDTO; -import org.sopt.makers.operation.dto.lecture.LectureRequestDTO; -import org.sopt.makers.operation.dto.lecture.LectureResponseDTO; -import org.sopt.makers.operation.dto.lecture.LecturesResponseDTO; +import org.sopt.makers.operation.dto.lecture.request.AttendanceRequestDTO; +import org.sopt.makers.operation.dto.lecture.response.AttendanceResponseDTO; +import org.sopt.makers.operation.dto.lecture.response.LectureDetailResponseDTO; +import org.sopt.makers.operation.dto.lecture.request.LectureRequestDTO; +import org.sopt.makers.operation.dto.lecture.response.LectureResponseDTO; +import org.sopt.makers.operation.dto.lecture.response.LecturesResponseDTO; import org.sopt.makers.operation.service.LectureService; import org.springframework.http.MediaType; import org.springframework.test.web.servlet.MockMvc; diff --git a/src/test/java/org/sopt/makers/operation/fixture/LectureFixture.java b/src/test/java/org/sopt/makers/operation/fixture/LectureFixture.java index 00fee1f5..e01c867b 100644 --- a/src/test/java/org/sopt/makers/operation/fixture/LectureFixture.java +++ b/src/test/java/org/sopt/makers/operation/fixture/LectureFixture.java @@ -4,15 +4,15 @@ import java.util.List; import java.util.stream.Stream; -import org.sopt.makers.operation.dto.lecture.AttendanceRequestDTO; -import org.sopt.makers.operation.dto.lecture.AttendanceResponseDTO; -import org.sopt.makers.operation.dto.lecture.AttendancesStatusVO; -import org.sopt.makers.operation.dto.lecture.LectureDetailResponseDTO; -import org.sopt.makers.operation.dto.lecture.LectureRequestDTO; -import org.sopt.makers.operation.dto.lecture.LectureResponseDTO; -import org.sopt.makers.operation.dto.lecture.LectureResponseDTO.SubLectureVO; -import org.sopt.makers.operation.dto.lecture.LecturesResponseDTO; -import org.sopt.makers.operation.dto.lecture.LecturesResponseDTO.LectureVO; +import org.sopt.makers.operation.dto.lecture.request.AttendanceRequestDTO; +import org.sopt.makers.operation.dto.lecture.response.AttendanceResponseDTO; +import org.sopt.makers.operation.dto.lecture.response.AttendancesStatusVO; +import org.sopt.makers.operation.dto.lecture.response.LectureDetailResponseDTO; +import org.sopt.makers.operation.dto.lecture.request.LectureRequestDTO; +import org.sopt.makers.operation.dto.lecture.response.LectureResponseDTO; +import org.sopt.makers.operation.dto.lecture.response.LectureResponseDTO.SubLectureVO; +import org.sopt.makers.operation.dto.lecture.response.LecturesResponseDTO; +import org.sopt.makers.operation.dto.lecture.response.LecturesResponseDTO.LectureVO; import org.sopt.makers.operation.entity.Part; import org.sopt.makers.operation.entity.lecture.SubLecture; import org.sopt.makers.operation.entity.lecture.Attribute; diff --git a/src/test/java/org/sopt/makers/operation/service/LectureServiceImplTest.java b/src/test/java/org/sopt/makers/operation/service/LectureServiceImplTest.java index ea75742e..7550bf66 100644 --- a/src/test/java/org/sopt/makers/operation/service/LectureServiceImplTest.java +++ b/src/test/java/org/sopt/makers/operation/service/LectureServiceImplTest.java @@ -11,9 +11,9 @@ import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; import org.sopt.makers.operation.config.ValueConfig; -import org.sopt.makers.operation.dto.lecture.AttendanceRequestDTO; -import org.sopt.makers.operation.dto.lecture.LectureResponseDTO; -import org.sopt.makers.operation.dto.lecture.LecturesResponseDTO; +import org.sopt.makers.operation.dto.lecture.request.AttendanceRequestDTO; +import org.sopt.makers.operation.dto.lecture.response.LectureResponseDTO; +import org.sopt.makers.operation.dto.lecture.response.LecturesResponseDTO; import org.sopt.makers.operation.entity.lecture.Lecture; import org.sopt.makers.operation.external.alarm.AlarmSender; import org.sopt.makers.operation.repository.lecture.LectureRepository; From da232a8b44a6afd3ad9c8222a335aedd15c80f3e Mon Sep 17 00:00:00 2001 From: thguss Date: Wed, 31 Jan 2024 06:25:29 +0900 Subject: [PATCH 030/141] =?UTF-8?q?[REFACTOR]=20Attendance=20=EC=84=9C?= =?UTF-8?q?=EB=B9=84=EC=8A=A4=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...troller.java => AttendanceController.java} | 5 +- .../controller/web/AttendanceController.java | 2 +- .../app/attendance/AttendanceService.java | 14 ++++ .../attendance}/AttendanceServiceImpl.java | 64 ++-------------- .../attendance}/AttendanceService.java | 7 +- .../web/attendance/AttendanceServiceImpl.java | 75 +++++++++++++++++++ 6 files changed, 101 insertions(+), 66 deletions(-) rename src/main/java/org/sopt/makers/operation/controller/app/{AppAttendanceController.java => AttendanceController.java} (91%) create mode 100644 src/main/java/org/sopt/makers/operation/service/app/attendance/AttendanceService.java rename src/main/java/org/sopt/makers/operation/service/{ => app/attendance}/AttendanceServiceImpl.java (59%) rename src/main/java/org/sopt/makers/operation/service/{ => web/attendance}/AttendanceService.java (74%) create mode 100644 src/main/java/org/sopt/makers/operation/service/web/attendance/AttendanceServiceImpl.java diff --git a/src/main/java/org/sopt/makers/operation/controller/app/AppAttendanceController.java b/src/main/java/org/sopt/makers/operation/controller/app/AttendanceController.java similarity index 91% rename from src/main/java/org/sopt/makers/operation/controller/app/AppAttendanceController.java rename to src/main/java/org/sopt/makers/operation/controller/app/AttendanceController.java index 0754c7e5..4a74911c 100644 --- a/src/main/java/org/sopt/makers/operation/controller/app/AppAttendanceController.java +++ b/src/main/java/org/sopt/makers/operation/controller/app/AttendanceController.java @@ -8,7 +8,7 @@ import lombok.val; import org.sopt.makers.operation.common.ApiResponse; import org.sopt.makers.operation.dto.attendance.request.AttendRequestDTO; -import org.sopt.makers.operation.service.AttendanceService; +import org.sopt.makers.operation.service.app.attendance.AttendanceService; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import springfox.documentation.annotations.ApiIgnore; @@ -18,8 +18,9 @@ @RestController @RequiredArgsConstructor @RequestMapping("/api/v1/app/attendances") -public class AppAttendanceController { +public class AttendanceController { private final AttendanceService attendanceService; + @ApiOperation(value = "출석 하기") @PostMapping("/attend") public ResponseEntity attend(@RequestBody AttendRequestDTO requestDTO, @ApiIgnore Principal principal) { diff --git a/src/main/java/org/sopt/makers/operation/controller/web/AttendanceController.java b/src/main/java/org/sopt/makers/operation/controller/web/AttendanceController.java index 38439716..fa6c2a2f 100644 --- a/src/main/java/org/sopt/makers/operation/controller/web/AttendanceController.java +++ b/src/main/java/org/sopt/makers/operation/controller/web/AttendanceController.java @@ -5,7 +5,7 @@ import org.sopt.makers.operation.common.ApiResponse; import org.sopt.makers.operation.dto.attendance.request.SubAttendanceUpdateRequestDTO; import org.sopt.makers.operation.entity.Part; -import org.sopt.makers.operation.service.AttendanceService; +import org.sopt.makers.operation.service.web.attendance.AttendanceService; import org.springframework.data.domain.Pageable; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; diff --git a/src/main/java/org/sopt/makers/operation/service/app/attendance/AttendanceService.java b/src/main/java/org/sopt/makers/operation/service/app/attendance/AttendanceService.java new file mode 100644 index 00000000..080b790c --- /dev/null +++ b/src/main/java/org/sopt/makers/operation/service/app/attendance/AttendanceService.java @@ -0,0 +1,14 @@ +package org.sopt.makers.operation.service.app.attendance; + +import org.sopt.makers.operation.dto.attendance.request.AttendRequestDTO; +import org.sopt.makers.operation.dto.attendance.request.SubAttendanceUpdateRequestDTO; +import org.sopt.makers.operation.dto.attendance.response.AttendResponseDTO; +import org.sopt.makers.operation.dto.attendance.response.AttendanceMemberResponseDTO; +import org.sopt.makers.operation.dto.attendance.response.AttendancesResponseDTO; +import org.sopt.makers.operation.dto.attendance.response.SubAttendanceUpdateResponseDTO; +import org.sopt.makers.operation.entity.Part; +import org.springframework.data.domain.Pageable; + +public interface AttendanceService { + AttendResponseDTO attend(Long playGroundId, AttendRequestDTO requestDTO); +} diff --git a/src/main/java/org/sopt/makers/operation/service/AttendanceServiceImpl.java b/src/main/java/org/sopt/makers/operation/service/app/attendance/AttendanceServiceImpl.java similarity index 59% rename from src/main/java/org/sopt/makers/operation/service/AttendanceServiceImpl.java rename to src/main/java/org/sopt/makers/operation/service/app/attendance/AttendanceServiceImpl.java index 45ba1a10..a394283b 100644 --- a/src/main/java/org/sopt/makers/operation/service/AttendanceServiceImpl.java +++ b/src/main/java/org/sopt/makers/operation/service/app/attendance/AttendanceServiceImpl.java @@ -1,36 +1,26 @@ -package org.sopt.makers.operation.service; +package org.sopt.makers.operation.service.app.attendance; -import static java.util.Objects.nonNull; +import static java.util.Objects.*; import static org.sopt.makers.operation.common.ExceptionMessage.*; +import java.time.LocalDateTime; + import org.sopt.makers.operation.config.ValueConfig; import org.sopt.makers.operation.dto.attendance.request.AttendRequestDTO; import org.sopt.makers.operation.dto.attendance.response.AttendResponseDTO; -import org.sopt.makers.operation.dto.attendance.response.AttendanceMemberResponseDTO; -import org.sopt.makers.operation.dto.attendance.request.SubAttendanceUpdateRequestDTO; -import org.sopt.makers.operation.dto.attendance.response.AttendancesResponseDTO; -import org.sopt.makers.operation.dto.attendance.response.SubAttendanceUpdateResponseDTO; -import lombok.val; - import org.sopt.makers.operation.entity.attendance.AttendanceStatus; -import org.sopt.makers.operation.entity.member.Member; -import org.sopt.makers.operation.entity.Part; -import org.sopt.makers.operation.entity.attendance.SubAttendance; import org.sopt.makers.operation.exception.LectureException; import org.sopt.makers.operation.exception.MemberException; -import org.sopt.makers.operation.repository.attendance.SubAttendanceRepository; -import org.sopt.makers.operation.repository.attendance.AttendanceRepository; import org.sopt.makers.operation.exception.SubLectureException; +import org.sopt.makers.operation.repository.attendance.AttendanceRepository; import org.sopt.makers.operation.repository.lecture.SubLectureRepository; import org.sopt.makers.operation.repository.member.MemberRepository; -import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; - -import java.time.LocalDateTime; +import lombok.val; @Slf4j @Service @@ -38,43 +28,11 @@ @Transactional(readOnly = true) public class AttendanceServiceImpl implements AttendanceService { - private final SubAttendanceRepository subAttendanceRepository; private final MemberRepository memberRepository; private final SubLectureRepository subLectureRepository; private final AttendanceRepository attendanceRepository; private final ValueConfig valueConfig; - @Override - @Transactional - public SubAttendanceUpdateResponseDTO updateSubAttendance(SubAttendanceUpdateRequestDTO requestDTO) { - val subAttendance = findSubAttendance(requestDTO.subAttendanceId()); - subAttendance.updateStatus(requestDTO.status()); - return SubAttendanceUpdateResponseDTO.of(subAttendance); - } - - @Override - public AttendanceMemberResponseDTO findAttendancesByMember(Long memberId) { - val member = findMember(memberId); - val attendances = attendanceRepository.findByMember(member); - return AttendanceMemberResponseDTO.of(member, attendances); - } - - @Override - @Transactional - public float updateMemberScore(Long memberId) { - Member member = memberRepository.find(memberId) - .orElseThrow(() -> new MemberException(INVALID_MEMBER.getName())); - member.updateTotalScore(); - return member.getScore(); - } - - @Override - public AttendancesResponseDTO findAttendancesByLecture(Long lectureId, Part part, Pageable pageable) { - val attendances = attendanceRepository.findByLecture(lectureId, part, pageable); - val attendancesCount = attendanceRepository.countByLectureIdAndPart(lectureId, part); - return AttendancesResponseDTO.of(attendances, attendancesCount); - } - @Override @Transactional public AttendResponseDTO attend(Long playGroundId, AttendRequestDTO requestDTO) { @@ -126,14 +84,4 @@ public AttendResponseDTO attend(Long playGroundId, AttendRequestDTO requestDTO) return AttendResponseDTO.of(subLecture.getId()); } - - private Member findMember(Long id) { - return memberRepository.findById(id) - .orElseThrow(() -> new MemberException(INVALID_MEMBER.getName())); - } - - private SubAttendance findSubAttendance(Long id) { - return subAttendanceRepository.findById(id) - .orElseThrow(() -> new LectureException(INVALID_ATTENDANCE.getName())); - } } diff --git a/src/main/java/org/sopt/makers/operation/service/AttendanceService.java b/src/main/java/org/sopt/makers/operation/service/web/attendance/AttendanceService.java similarity index 74% rename from src/main/java/org/sopt/makers/operation/service/AttendanceService.java rename to src/main/java/org/sopt/makers/operation/service/web/attendance/AttendanceService.java index 4f29f899..3010bb44 100644 --- a/src/main/java/org/sopt/makers/operation/service/AttendanceService.java +++ b/src/main/java/org/sopt/makers/operation/service/web/attendance/AttendanceService.java @@ -1,9 +1,7 @@ -package org.sopt.makers.operation.service; +package org.sopt.makers.operation.service.web.attendance; -import org.sopt.makers.operation.dto.attendance.request.AttendRequestDTO; -import org.sopt.makers.operation.dto.attendance.response.AttendResponseDTO; -import org.sopt.makers.operation.dto.attendance.response.AttendanceMemberResponseDTO; import org.sopt.makers.operation.dto.attendance.request.SubAttendanceUpdateRequestDTO; +import org.sopt.makers.operation.dto.attendance.response.AttendanceMemberResponseDTO; import org.sopt.makers.operation.dto.attendance.response.AttendancesResponseDTO; import org.sopt.makers.operation.dto.attendance.response.SubAttendanceUpdateResponseDTO; import org.sopt.makers.operation.entity.Part; @@ -14,5 +12,4 @@ public interface AttendanceService { AttendanceMemberResponseDTO findAttendancesByMember(Long memberId); float updateMemberScore(Long memberId); AttendancesResponseDTO findAttendancesByLecture(Long lectureId, Part part, Pageable pageable); - AttendResponseDTO attend(Long playGroundId, AttendRequestDTO requestDTO); } diff --git a/src/main/java/org/sopt/makers/operation/service/web/attendance/AttendanceServiceImpl.java b/src/main/java/org/sopt/makers/operation/service/web/attendance/AttendanceServiceImpl.java new file mode 100644 index 00000000..cf10a06b --- /dev/null +++ b/src/main/java/org/sopt/makers/operation/service/web/attendance/AttendanceServiceImpl.java @@ -0,0 +1,75 @@ +package org.sopt.makers.operation.service.web.attendance; + +import static org.sopt.makers.operation.common.ExceptionMessage.*; + +import org.sopt.makers.operation.dto.attendance.request.SubAttendanceUpdateRequestDTO; +import org.sopt.makers.operation.dto.attendance.response.AttendanceMemberResponseDTO; +import org.sopt.makers.operation.dto.attendance.response.AttendancesResponseDTO; +import org.sopt.makers.operation.dto.attendance.response.SubAttendanceUpdateResponseDTO; +import org.sopt.makers.operation.entity.Part; +import org.sopt.makers.operation.entity.attendance.SubAttendance; +import org.sopt.makers.operation.entity.member.Member; +import org.sopt.makers.operation.exception.LectureException; +import org.sopt.makers.operation.exception.MemberException; +import org.sopt.makers.operation.repository.attendance.AttendanceRepository; +import org.sopt.makers.operation.repository.attendance.SubAttendanceRepository; +import org.sopt.makers.operation.repository.member.MemberRepository; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import lombok.val; + +@Slf4j +@Service +@RequiredArgsConstructor +@Transactional(readOnly = true) +public class AttendanceServiceImpl implements AttendanceService { + + private final SubAttendanceRepository subAttendanceRepository; + private final MemberRepository memberRepository; + private final AttendanceRepository attendanceRepository; + + @Override + @Transactional + public SubAttendanceUpdateResponseDTO updateSubAttendance(SubAttendanceUpdateRequestDTO requestDTO) { + val subAttendance = findSubAttendance(requestDTO.subAttendanceId()); + subAttendance.updateStatus(requestDTO.status()); + return SubAttendanceUpdateResponseDTO.of(subAttendance); + } + + @Override + public AttendanceMemberResponseDTO findAttendancesByMember(Long memberId) { + val member = findMember(memberId); + val attendances = attendanceRepository.findByMember(member); + return AttendanceMemberResponseDTO.of(member, attendances); + } + + @Override + @Transactional + public float updateMemberScore(Long memberId) { + Member member = memberRepository.find(memberId) + .orElseThrow(() -> new MemberException(INVALID_MEMBER.getName())); + member.updateTotalScore(); + return member.getScore(); + } + + @Override + public AttendancesResponseDTO findAttendancesByLecture(Long lectureId, Part part, Pageable pageable) { + val attendances = attendanceRepository.findByLecture(lectureId, part, pageable); + val attendancesCount = attendanceRepository.countByLectureIdAndPart(lectureId, part); + return AttendancesResponseDTO.of(attendances, attendancesCount); + } + + private Member findMember(Long id) { + return memberRepository.findById(id) + .orElseThrow(() -> new MemberException(INVALID_MEMBER.getName())); + } + + private SubAttendance findSubAttendance(Long id) { + return subAttendanceRepository.findById(id) + .orElseThrow(() -> new LectureException(INVALID_ATTENDANCE.getName())); + } +} From af18ebbd43dfef1f530964c10463ef3f665455ca Mon Sep 17 00:00:00 2001 From: thguss Date: Wed, 31 Jan 2024 06:38:59 +0900 Subject: [PATCH 031/141] =?UTF-8?q?[REFACTOR]=20Lecture=20=EC=84=9C?= =?UTF-8?q?=EB=B9=84=EC=8A=A4=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...Controller.java => LectureController.java} | 4 +- .../controller/web/LectureController.java | 2 +- .../operation/scheduler/LectureScheduler.java | 2 +- .../service/app/lecture/LectureService.java | 10 + .../app/lecture/LectureServiceImpl.java | 181 ++++++++++++++++++ .../service/batch/LectureService.java | 6 + .../service/batch/LectureServiceImpl.java | 74 +++++++ .../{ => web/lecture}/LectureService.java | 15 +- .../{ => web/lecture}/LectureServiceImpl.java | 162 +--------------- .../controller/web/LectureControllerTest.java | 2 +- .../{ => web}/LectureServiceImplTest.java | 3 +- 11 files changed, 286 insertions(+), 175 deletions(-) rename src/main/java/org/sopt/makers/operation/controller/app/{AppLectureController.java => LectureController.java} (93%) create mode 100644 src/main/java/org/sopt/makers/operation/service/app/lecture/LectureService.java create mode 100644 src/main/java/org/sopt/makers/operation/service/app/lecture/LectureServiceImpl.java create mode 100644 src/main/java/org/sopt/makers/operation/service/batch/LectureService.java create mode 100644 src/main/java/org/sopt/makers/operation/service/batch/LectureServiceImpl.java rename src/main/java/org/sopt/makers/operation/service/{ => web/lecture}/LectureService.java (69%) rename src/main/java/org/sopt/makers/operation/service/{ => web/lecture}/LectureServiceImpl.java (56%) rename src/test/java/org/sopt/makers/operation/service/{ => web}/LectureServiceImplTest.java (96%) diff --git a/src/main/java/org/sopt/makers/operation/controller/app/AppLectureController.java b/src/main/java/org/sopt/makers/operation/controller/app/LectureController.java similarity index 93% rename from src/main/java/org/sopt/makers/operation/controller/app/AppLectureController.java rename to src/main/java/org/sopt/makers/operation/controller/app/LectureController.java index 309af9e0..edccbcab 100644 --- a/src/main/java/org/sopt/makers/operation/controller/app/AppLectureController.java +++ b/src/main/java/org/sopt/makers/operation/controller/app/LectureController.java @@ -6,7 +6,7 @@ import lombok.RequiredArgsConstructor; import lombok.val; import org.sopt.makers.operation.common.ApiResponse; -import org.sopt.makers.operation.service.LectureService; +import org.sopt.makers.operation.service.app.lecture.LectureService; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import springfox.documentation.annotations.ApiIgnore; @@ -16,7 +16,7 @@ @RestController @RequiredArgsConstructor @RequestMapping("/api/v1/app/lectures") -public class AppLectureController { +public class LectureController { private final LectureService lectureService; diff --git a/src/main/java/org/sopt/makers/operation/controller/web/LectureController.java b/src/main/java/org/sopt/makers/operation/controller/web/LectureController.java index d9af3005..209fd4be 100644 --- a/src/main/java/org/sopt/makers/operation/controller/web/LectureController.java +++ b/src/main/java/org/sopt/makers/operation/controller/web/LectureController.java @@ -9,7 +9,7 @@ import org.sopt.makers.operation.dto.lecture.request.AttendanceRequestDTO; import org.sopt.makers.operation.dto.lecture.request.LectureRequestDTO; import org.sopt.makers.operation.entity.Part; -import org.sopt.makers.operation.service.LectureService; +import org.sopt.makers.operation.service.web.lecture.LectureService; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; diff --git a/src/main/java/org/sopt/makers/operation/scheduler/LectureScheduler.java b/src/main/java/org/sopt/makers/operation/scheduler/LectureScheduler.java index 2340f063..16db8642 100644 --- a/src/main/java/org/sopt/makers/operation/scheduler/LectureScheduler.java +++ b/src/main/java/org/sopt/makers/operation/scheduler/LectureScheduler.java @@ -1,6 +1,6 @@ package org.sopt.makers.operation.scheduler; -import org.sopt.makers.operation.service.LectureService; +import org.sopt.makers.operation.service.batch.LectureService; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; diff --git a/src/main/java/org/sopt/makers/operation/service/app/lecture/LectureService.java b/src/main/java/org/sopt/makers/operation/service/app/lecture/LectureService.java new file mode 100644 index 00000000..ade68b23 --- /dev/null +++ b/src/main/java/org/sopt/makers/operation/service/app/lecture/LectureService.java @@ -0,0 +1,10 @@ +package org.sopt.makers.operation.service.app.lecture; + +import org.sopt.makers.operation.dto.lecture.response.LectureCurrentRoundResponseDTO; +import org.sopt.makers.operation.dto.lecture.response.TodayLectureResponseDTO; + +public interface LectureService { + + TodayLectureResponseDTO getTodayLecture(long memberPlaygroundId); + LectureCurrentRoundResponseDTO getCurrentLectureRound(long lectureId); +} diff --git a/src/main/java/org/sopt/makers/operation/service/app/lecture/LectureServiceImpl.java b/src/main/java/org/sopt/makers/operation/service/app/lecture/LectureServiceImpl.java new file mode 100644 index 00000000..9af7b8aa --- /dev/null +++ b/src/main/java/org/sopt/makers/operation/service/app/lecture/LectureServiceImpl.java @@ -0,0 +1,181 @@ +package org.sopt.makers.operation.service.app.lecture; + +import static org.sopt.makers.operation.common.ExceptionMessage.NO_SESSION; +import static org.sopt.makers.operation.common.ExceptionMessage.*; +import static org.sopt.makers.operation.dto.lecture.response.LectureResponseType.*; +import static org.sopt.makers.operation.entity.attendance.AttendanceStatus.*; +import static org.sopt.makers.operation.entity.lecture.LectureStatus.*; + +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.util.Collections; +import java.util.List; + +import org.sopt.makers.operation.config.ValueConfig; +import org.sopt.makers.operation.dto.lecture.response.LectureCurrentRoundResponseDTO; +import org.sopt.makers.operation.dto.lecture.response.LectureResponseType; +import org.sopt.makers.operation.dto.lecture.response.TodayLectureResponseDTO; +import org.sopt.makers.operation.entity.attendance.Attendance; +import org.sopt.makers.operation.entity.attendance.SubAttendance; +import org.sopt.makers.operation.entity.lecture.Attribute; +import org.sopt.makers.operation.entity.lecture.Lecture; +import org.sopt.makers.operation.entity.lecture.SubLecture; +import org.sopt.makers.operation.exception.LectureException; +import org.sopt.makers.operation.exception.SubLectureException; +import org.sopt.makers.operation.repository.attendance.AttendanceRepository; +import org.sopt.makers.operation.repository.lecture.LectureRepository; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import lombok.RequiredArgsConstructor; +import lombok.val; + +@Service +@RequiredArgsConstructor +@Transactional(readOnly = true) +public class LectureServiceImpl implements LectureService { + + private final LectureRepository lectureRepository; + private final AttendanceRepository attendanceRepository; + private final ValueConfig valueConfig; + + @Override + public TodayLectureResponseDTO getTodayLecture(long memberPlaygroundId) { + val attendances = attendanceRepository.findToday(memberPlaygroundId); + checkAttendancesSize(attendances); + + if (attendances.isEmpty()) { + return getEmptyResponse(); + } + + val attendance = getNowAttendance(attendances); + val lecture = attendance.getLecture(); + val responseType = getResponseType(lecture); + val message = getMessage(lecture.getAttribute()); + + if (responseType.equals(NO_ATTENDANCE) || lecture.isBefore()) { + return TodayLectureResponseDTO.of(responseType, lecture, message, Collections.emptyList()); + } + + val subAttendances = attendance.getSubAttendances(); + val subAttendance = lecture.isFirst() ? subAttendances.get(0) : subAttendances.get(1); + return getTodayLectureResponse(subAttendance, responseType, lecture); + } + + private TodayLectureResponseDTO getEmptyResponse() { + return TodayLectureResponseDTO.builder() + .type(LectureResponseType.NO_SESSION) + .id(0L) + .location("") + .name("") + .startDate("") + .endDate("") + .message("") + .attendances(Collections.emptyList()) + .build(); + } + + private void checkAttendancesSize(List attendances) { + if (attendances.size() > valueConfig.getSUB_LECTURE_MAX_ROUND()) { + throw new LectureException(INVALID_COUNT_SESSION.getName()); + } + } + + private Attendance getNowAttendance(List attendances) { + val index = getAttendanceIndex(); + return attendances.get(index); + } + + private int getAttendanceIndex() { + return (LocalDateTime.now().getHour() >= 16) ? 1 : 0; + } + + private LectureResponseType getResponseType(Lecture lecture) { + val attribute = lecture.getAttribute(); + return attribute.equals(Attribute.ETC) ? NO_ATTENDANCE : HAS_ATTENDANCE; + } + + private String getMessage(Attribute attribute) { + return switch (attribute) { + case SEMINAR -> valueConfig.getSEMINAR_MESSAGE(); + case EVENT -> valueConfig.getEVENT_MESSAGE(); + case ETC -> valueConfig.getETC_MESSAGE(); + }; + } + + private TodayLectureResponseDTO getTodayLectureResponse(SubAttendance subAttendance, LectureResponseType responseType, Lecture lecture) { + val subLecture = subAttendance.getSubLecture(); + val isOnAttendanceCheck = LocalDateTime.now().isBefore(subLecture.getStartAt().plusMinutes(10)); + val message = getMessage(lecture.getAttribute()); + if (isOnAttendanceCheck && subAttendance.getStatus().equals(ABSENT)) { + return TodayLectureResponseDTO.of(responseType, lecture, message, Collections.emptyList()); + } + return TodayLectureResponseDTO.of(responseType, lecture, message, Collections.singletonList(subAttendance)); + } + + @Override + public LectureCurrentRoundResponseDTO getCurrentLectureRound(long lectureId) { + val lecture = findLecture(lectureId); + val subLecture = getSubLecture(lecture); + checkLectureExist(lecture); + checkLectureBefore(lecture); + checkEndAttendance(subLecture); + checkLectureEnd(lecture); + return LectureCurrentRoundResponseDTO.of(subLecture); + } + + private Lecture findLecture(Long id) { + return lectureRepository.findById(id) + .orElseThrow(() -> new LectureException(INVALID_LECTURE.getName())); + } + + private SubLecture getSubLecture(Lecture lecture) { + val status = lecture.getLectureStatus(); + val round = status.equals(FIRST) ? 1 : 2; + return getSubLecture(lecture, round); + } + + private SubLecture getSubLecture(Lecture lecture, int round) { + return lecture.getSubLectures().stream() + .filter(l -> l.getRound() == round) + .findFirst() + .orElseThrow(() -> new SubLectureException(NO_SUB_LECTURE_EQUAL_ROUND.getName())); + } + + private void checkLectureExist(Lecture lecture) { + val today = LocalDate.now(); + val startOfDay = today.atStartOfDay(); + val endOfDay = LocalDateTime.of(today, LocalTime.MAX); + val startAt = lecture.getStartDate(); + if (startAt.isBefore(startOfDay) || startAt.isAfter(endOfDay)) { + throw new LectureException(NO_SESSION.getName()); + } + } + + private void checkLectureBefore(Lecture lecture) { + if (lecture.isBefore()) { + throw new LectureException(NOT_STARTED_ATTENDANCE.getName()); + } + } + + private void checkEndAttendance(SubLecture subLecture) { + if (isEndAttendance(subLecture)) { + throw new LectureException(subLecture.getRound() + ENDED_ATTENDANCE.getName()); + } + } + + private boolean isEndAttendance(SubLecture subLecture) { + val status = subLecture.getLecture().getLectureStatus(); + if (LocalDateTime.now().isAfter(subLecture.getStartAt().plusMinutes(10))) { + return status.equals(FIRST) || status.equals(SECOND); + } + return false; + } + + private void checkLectureEnd(Lecture lecture) { + if (lecture.isEnd()) { + throw new LectureException(END_LECTURE.getName()); + } + } +} diff --git a/src/main/java/org/sopt/makers/operation/service/batch/LectureService.java b/src/main/java/org/sopt/makers/operation/service/batch/LectureService.java new file mode 100644 index 00000000..b575ebf5 --- /dev/null +++ b/src/main/java/org/sopt/makers/operation/service/batch/LectureService.java @@ -0,0 +1,6 @@ +package org.sopt.makers.operation.service.batch; + +public interface LectureService { + + void endLectures(); +} diff --git a/src/main/java/org/sopt/makers/operation/service/batch/LectureServiceImpl.java b/src/main/java/org/sopt/makers/operation/service/batch/LectureServiceImpl.java new file mode 100644 index 00000000..2c78f4a8 --- /dev/null +++ b/src/main/java/org/sopt/makers/operation/service/batch/LectureServiceImpl.java @@ -0,0 +1,74 @@ +package org.sopt.makers.operation.service.batch; + +import static org.sopt.makers.operation.common.ExceptionMessage.*; +import static org.sopt.makers.operation.entity.alarm.Attribute.*; + +import java.util.*; + +import lombok.val; + +import org.sopt.makers.operation.config.ValueConfig; +import org.sopt.makers.operation.dto.alarm.request.AlarmSenderDTO; + +import org.sopt.makers.operation.entity.lecture.Lecture; +import org.sopt.makers.operation.exception.LectureException; +import org.sopt.makers.operation.external.alarm.AlarmSender; +import org.sopt.makers.operation.repository.lecture.LectureRepository; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import lombok.RequiredArgsConstructor; + +@Service +@RequiredArgsConstructor +@Transactional(readOnly = true) +public class LectureServiceImpl implements LectureService { + + private final LectureRepository lectureRepository; + private final AlarmSender alarmSender; + private final ValueConfig valueConfig; + + @Override + @Transactional + public void endLectures() { + val lectures = lectureRepository.findLecturesToBeEnd(); + lectures.forEach(lecture -> endLecture(lecture.getId())); + } + + private void endLecture(Long lectureId) { + val lecture = findLecture(lectureId); + checkEndLectureValidity(lecture); + lecture.updateToEnd(); + sendAlarm(lecture); + } + + private Lecture findLecture(Long id) { + return lectureRepository.findById(id) + .orElseThrow(() -> new LectureException(INVALID_LECTURE.getName())); + } + + private void checkEndLectureValidity(Lecture lecture) { + if (!lecture.isEnd()) { + throw new LectureException(NOT_END_TIME_YET.getName()); + } + } + + private void sendAlarm(Lecture lecture) { + val alarmTitle = getAlarmTitle(lecture); + val alarmContent = valueConfig.getALARM_MESSAGE_CONTENT(); + val memberPlaygroundIds = getMemberPlaygroundIds(lecture); + alarmSender.send(new AlarmSenderDTO(alarmTitle, alarmContent, memberPlaygroundIds, NEWS, null)); + } + + private List getMemberPlaygroundIds(Lecture lecture) { + return lecture.getAttendances().stream() + .map(attendance -> String.valueOf(attendance.getMember().getPlaygroundId())) + .filter(id -> !id.equals("null")) + .toList(); + } + + private String getAlarmTitle(Lecture lecture) { + return lecture.getName() + " " + valueConfig.getALARM_MESSAGE_TITLE(); + } + +} diff --git a/src/main/java/org/sopt/makers/operation/service/LectureService.java b/src/main/java/org/sopt/makers/operation/service/web/lecture/LectureService.java similarity index 69% rename from src/main/java/org/sopt/makers/operation/service/LectureService.java rename to src/main/java/org/sopt/makers/operation/service/web/lecture/LectureService.java index f254e092..59e819c6 100644 --- a/src/main/java/org/sopt/makers/operation/service/LectureService.java +++ b/src/main/java/org/sopt/makers/operation/service/web/lecture/LectureService.java @@ -1,11 +1,9 @@ -package org.sopt.makers.operation.service; +package org.sopt.makers.operation.service.web.lecture; -import org.sopt.makers.operation.dto.lecture.response.LectureCurrentRoundResponseDTO; -import org.sopt.makers.operation.dto.lecture.response.LectureDetailResponseDTO; -import org.sopt.makers.operation.dto.lecture.response.TodayLectureResponseDTO; import org.sopt.makers.operation.dto.lecture.request.AttendanceRequestDTO; -import org.sopt.makers.operation.dto.lecture.response.AttendanceResponseDTO; import org.sopt.makers.operation.dto.lecture.request.LectureRequestDTO; +import org.sopt.makers.operation.dto.lecture.response.AttendanceResponseDTO; +import org.sopt.makers.operation.dto.lecture.response.LectureDetailResponseDTO; import org.sopt.makers.operation.dto.lecture.response.LectureResponseDTO; import org.sopt.makers.operation.dto.lecture.response.LecturesResponseDTO; import org.sopt.makers.operation.entity.Part; @@ -20,11 +18,4 @@ public interface LectureService { void endLecture(Long lectureId); void deleteLecture(Long lectureId); LectureDetailResponseDTO getLectureDetail(long lectureId); - - /** SCHEDULER **/ - void endLectures(); - - /** APP **/ - TodayLectureResponseDTO getTodayLecture(long memberPlaygroundId); - LectureCurrentRoundResponseDTO getCurrentLectureRound(long lectureId); } diff --git a/src/main/java/org/sopt/makers/operation/service/LectureServiceImpl.java b/src/main/java/org/sopt/makers/operation/service/web/lecture/LectureServiceImpl.java similarity index 56% rename from src/main/java/org/sopt/makers/operation/service/LectureServiceImpl.java rename to src/main/java/org/sopt/makers/operation/service/web/lecture/LectureServiceImpl.java index ee5f97ed..86f65131 100644 --- a/src/main/java/org/sopt/makers/operation/service/LectureServiceImpl.java +++ b/src/main/java/org/sopt/makers/operation/service/web/lecture/LectureServiceImpl.java @@ -1,36 +1,22 @@ -package org.sopt.makers.operation.service; +package org.sopt.makers.operation.service.web.lecture; import static org.sopt.makers.operation.common.ExceptionMessage.*; -import static org.sopt.makers.operation.common.ExceptionMessage.NO_SESSION; -import static org.sopt.makers.operation.dto.lecture.response.LectureResponseType.*; -import static org.sopt.makers.operation.entity.attendance.AttendanceStatus.*; import static org.sopt.makers.operation.entity.alarm.Attribute.*; -import static org.sopt.makers.operation.entity.lecture.LectureStatus.*; -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.time.LocalTime; -import java.util.*; +import java.util.List; import java.util.stream.Stream; -import lombok.val; - import org.sopt.makers.operation.config.ValueConfig; import org.sopt.makers.operation.dto.alarm.request.AlarmSenderDTO; - import org.sopt.makers.operation.dto.lecture.request.AttendanceRequestDTO; -import org.sopt.makers.operation.dto.lecture.response.AttendanceResponseDTO; import org.sopt.makers.operation.dto.lecture.request.LectureRequestDTO; -import org.sopt.makers.operation.dto.lecture.response.LectureCurrentRoundResponseDTO; +import org.sopt.makers.operation.dto.lecture.response.AttendanceResponseDTO; import org.sopt.makers.operation.dto.lecture.response.LectureDetailResponseDTO; import org.sopt.makers.operation.dto.lecture.response.LectureResponseDTO; -import org.sopt.makers.operation.dto.lecture.response.LectureResponseType; import org.sopt.makers.operation.dto.lecture.response.LecturesResponseDTO; -import org.sopt.makers.operation.dto.lecture.response.TodayLectureResponseDTO; -import org.sopt.makers.operation.entity.*; +import org.sopt.makers.operation.entity.Part; import org.sopt.makers.operation.entity.attendance.Attendance; import org.sopt.makers.operation.entity.attendance.SubAttendance; -import org.sopt.makers.operation.entity.lecture.Attribute; import org.sopt.makers.operation.entity.lecture.Lecture; import org.sopt.makers.operation.entity.lecture.SubLecture; import org.sopt.makers.operation.entity.member.Member; @@ -46,6 +32,7 @@ import org.springframework.transaction.annotation.Transactional; import lombok.RequiredArgsConstructor; +import lombok.val; @Service @RequiredArgsConstructor @@ -60,8 +47,6 @@ public class LectureServiceImpl implements LectureService { private final AlarmSender alarmSender; private final ValueConfig valueConfig; - /** WEB **/ - @Override @Transactional public long createLecture(LectureRequestDTO request) { @@ -173,15 +158,6 @@ private Lecture findLecture(Long id) { .orElseThrow(() -> new LectureException(INVALID_LECTURE.getName())); } - /** SCHEDULER **/ - - @Override - @Transactional - public void endLectures() { - val lectures = lectureRepository.findLecturesToBeEnd(); - lectures.forEach(lecture -> endLecture(lecture.getId())); - } - private void checkEndLectureValidity(Lecture lecture) { if (!lecture.isEnd()) { throw new LectureException(NOT_END_TIME_YET.getName()); @@ -206,99 +182,6 @@ private String getAlarmTitle(Lecture lecture) { return lecture.getName() + " " + valueConfig.getALARM_MESSAGE_TITLE(); } - /** APP **/ - - @Override - public TodayLectureResponseDTO getTodayLecture(long memberPlaygroundId) { - val attendances = attendanceRepository.findToday(memberPlaygroundId); - checkAttendancesSize(attendances); - - if (attendances.isEmpty()) { - return getEmptyResponse(); - } - - val attendance = getNowAttendance(attendances); - val lecture = attendance.getLecture(); - val responseType = getResponseType(lecture); - val message = getMessage(lecture.getAttribute()); - - if (responseType.equals(NO_ATTENDANCE) || lecture.isBefore()) { - return TodayLectureResponseDTO.of(responseType, lecture, message, Collections.emptyList()); - } - - val subAttendances = attendance.getSubAttendances(); - val subAttendance = lecture.isFirst() ? subAttendances.get(0) : subAttendances.get(1); - return getTodayLectureResponse(subAttendance, responseType, lecture); - } - - private TodayLectureResponseDTO getEmptyResponse() { - return TodayLectureResponseDTO.builder() - .type(LectureResponseType.NO_SESSION) - .id(0L) - .location("") - .name("") - .startDate("") - .endDate("") - .message("") - .attendances(Collections.emptyList()) - .build(); - } - - private void checkAttendancesSize(List attendances) { - if (attendances.size() > valueConfig.getSUB_LECTURE_MAX_ROUND()) { - throw new LectureException(INVALID_COUNT_SESSION.getName()); - } - } - - private Attendance getNowAttendance(List attendances) { - val index = getAttendanceIndex(); - return attendances.get(index); - } - - private int getAttendanceIndex() { - return (LocalDateTime.now().getHour() >= 16) ? 1 : 0; - } - - private LectureResponseType getResponseType(Lecture lecture) { - val attribute = lecture.getAttribute(); - return attribute.equals(Attribute.ETC) ? NO_ATTENDANCE : HAS_ATTENDANCE; - } - - private String getMessage(Attribute attribute) { - return switch (attribute) { - case SEMINAR -> valueConfig.getSEMINAR_MESSAGE(); - case EVENT -> valueConfig.getEVENT_MESSAGE(); - case ETC -> valueConfig.getETC_MESSAGE(); - }; - } - - private TodayLectureResponseDTO getTodayLectureResponse(SubAttendance subAttendance, LectureResponseType responseType, Lecture lecture) { - val subLecture = subAttendance.getSubLecture(); - val isOnAttendanceCheck = LocalDateTime.now().isBefore(subLecture.getStartAt().plusMinutes(10)); - val message = getMessage(lecture.getAttribute()); - if (isOnAttendanceCheck && subAttendance.getStatus().equals(ABSENT)) { - return TodayLectureResponseDTO.of(responseType, lecture, message, Collections.emptyList()); - } - return TodayLectureResponseDTO.of(responseType, lecture, message, Collections.singletonList(subAttendance)); - } - - @Override - public LectureCurrentRoundResponseDTO getCurrentLectureRound(long lectureId) { - val lecture = findLecture(lectureId); - val subLecture = getSubLecture(lecture); - checkLectureExist(lecture); - checkLectureBefore(lecture); - checkEndAttendance(subLecture); - checkLectureEnd(lecture); - return LectureCurrentRoundResponseDTO.of(subLecture); - } - - private SubLecture getSubLecture(Lecture lecture) { - val status = lecture.getLectureStatus(); - val round = status.equals(FIRST) ? 1 : 2; - return getSubLecture(lecture, round); - } - private SubLecture getSubLecture(Lecture lecture, int round) { return lecture.getSubLectures().stream() .filter(l -> l.getRound() == round) @@ -306,39 +189,4 @@ private SubLecture getSubLecture(Lecture lecture, int round) { .orElseThrow(() -> new SubLectureException(NO_SUB_LECTURE_EQUAL_ROUND.getName())); } - private void checkLectureExist(Lecture lecture) { - val today = LocalDate.now(); - val startOfDay = today.atStartOfDay(); - val endOfDay = LocalDateTime.of(today, LocalTime.MAX); - val startAt = lecture.getStartDate(); - if (startAt.isBefore(startOfDay) || startAt.isAfter(endOfDay)) { - throw new LectureException(NO_SESSION.getName()); - } - } - - private void checkLectureBefore(Lecture lecture) { - if (lecture.isBefore()) { - throw new LectureException(NOT_STARTED_ATTENDANCE.getName()); - } - } - - private void checkEndAttendance(SubLecture subLecture) { - if (isEndAttendance(subLecture)) { - throw new LectureException(subLecture.getRound() + ENDED_ATTENDANCE.getName()); - } - } - - private boolean isEndAttendance(SubLecture subLecture) { - val status = subLecture.getLecture().getLectureStatus(); - if (LocalDateTime.now().isAfter(subLecture.getStartAt().plusMinutes(10))) { - return status.equals(FIRST) || status.equals(SECOND); - } - return false; - } - - private void checkLectureEnd(Lecture lecture) { - if (lecture.isEnd()) { - throw new LectureException(END_LECTURE.getName()); - } - } } diff --git a/src/test/java/org/sopt/makers/operation/controller/web/LectureControllerTest.java b/src/test/java/org/sopt/makers/operation/controller/web/LectureControllerTest.java index bb980bc3..08848629 100644 --- a/src/test/java/org/sopt/makers/operation/controller/web/LectureControllerTest.java +++ b/src/test/java/org/sopt/makers/operation/controller/web/LectureControllerTest.java @@ -13,7 +13,7 @@ import org.sopt.makers.operation.dto.lecture.request.LectureRequestDTO; import org.sopt.makers.operation.dto.lecture.response.LectureResponseDTO; import org.sopt.makers.operation.dto.lecture.response.LecturesResponseDTO; -import org.sopt.makers.operation.service.LectureService; +import org.sopt.makers.operation.service.web.lecture.LectureService; import org.springframework.http.MediaType; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.ResultActions; diff --git a/src/test/java/org/sopt/makers/operation/service/LectureServiceImplTest.java b/src/test/java/org/sopt/makers/operation/service/web/LectureServiceImplTest.java similarity index 96% rename from src/test/java/org/sopt/makers/operation/service/LectureServiceImplTest.java rename to src/test/java/org/sopt/makers/operation/service/web/LectureServiceImplTest.java index 7550bf66..28a33888 100644 --- a/src/test/java/org/sopt/makers/operation/service/LectureServiceImplTest.java +++ b/src/test/java/org/sopt/makers/operation/service/web/LectureServiceImplTest.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.service; +package org.sopt.makers.operation.service.web; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; @@ -18,6 +18,7 @@ import org.sopt.makers.operation.external.alarm.AlarmSender; import org.sopt.makers.operation.repository.lecture.LectureRepository; import org.sopt.makers.operation.repository.member.MemberRepository; +import org.sopt.makers.operation.service.web.lecture.LectureServiceImpl; import static org.mockito.Mockito.*; From 5987348a9ca0ba3f36f16857607ff5a5a5a9acc2 Mon Sep 17 00:00:00 2001 From: thguss Date: Wed, 31 Jan 2024 06:39:39 +0900 Subject: [PATCH 032/141] =?UTF-8?q?[REFACTOR]=20Admin=20=EC=84=9C=EB=B9=84?= =?UTF-8?q?=EC=8A=A4=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sopt/makers/operation/controller/web/AdminController.java | 2 +- .../makers/operation/service/{ => web/admin}/AdminService.java | 2 +- .../operation/service/{ => web/admin}/AdminServiceImpl.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) rename src/main/java/org/sopt/makers/operation/service/{ => web/admin}/AdminService.java (92%) rename src/main/java/org/sopt/makers/operation/service/{ => web/admin}/AdminServiceImpl.java (98%) diff --git a/src/main/java/org/sopt/makers/operation/controller/web/AdminController.java b/src/main/java/org/sopt/makers/operation/controller/web/AdminController.java index 38d9fff8..8c82f821 100644 --- a/src/main/java/org/sopt/makers/operation/controller/web/AdminController.java +++ b/src/main/java/org/sopt/makers/operation/controller/web/AdminController.java @@ -10,7 +10,7 @@ import org.sopt.makers.operation.common.ApiResponse; import org.sopt.makers.operation.dto.admin.request.LoginRequestDTO; import org.sopt.makers.operation.dto.admin.request.SignUpRequestDTO; -import org.sopt.makers.operation.service.AdminServiceImpl; +import org.sopt.makers.operation.service.web.admin.AdminServiceImpl; import org.sopt.makers.operation.util.Cookie; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; diff --git a/src/main/java/org/sopt/makers/operation/service/AdminService.java b/src/main/java/org/sopt/makers/operation/service/web/admin/AdminService.java similarity index 92% rename from src/main/java/org/sopt/makers/operation/service/AdminService.java rename to src/main/java/org/sopt/makers/operation/service/web/admin/AdminService.java index 736b8b23..088e3a64 100644 --- a/src/main/java/org/sopt/makers/operation/service/AdminService.java +++ b/src/main/java/org/sopt/makers/operation/service/web/admin/AdminService.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.service; +package org.sopt.makers.operation.service.web.admin; import org.sopt.makers.operation.dto.admin.request.LoginRequestDTO; import org.sopt.makers.operation.dto.admin.request.SignUpRequestDTO; diff --git a/src/main/java/org/sopt/makers/operation/service/AdminServiceImpl.java b/src/main/java/org/sopt/makers/operation/service/web/admin/AdminServiceImpl.java similarity index 98% rename from src/main/java/org/sopt/makers/operation/service/AdminServiceImpl.java rename to src/main/java/org/sopt/makers/operation/service/web/admin/AdminServiceImpl.java index 2e10e43b..cca6da02 100644 --- a/src/main/java/org/sopt/makers/operation/service/AdminServiceImpl.java +++ b/src/main/java/org/sopt/makers/operation/service/web/admin/AdminServiceImpl.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.service; +package org.sopt.makers.operation.service.web.admin; import static org.sopt.makers.operation.common.ExceptionMessage.*; From 6c41f37c4526e514c2da2090fbc3537e18ed7a5c Mon Sep 17 00:00:00 2001 From: thguss Date: Wed, 31 Jan 2024 06:40:42 +0900 Subject: [PATCH 033/141] =?UTF-8?q?[REFACTOR]=20Alarm=20=EC=84=9C=EB=B9=84?= =?UTF-8?q?=EC=8A=A4=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sopt/makers/operation/controller/web/AlarmController.java | 2 +- .../makers/operation/service/{ => web/alarm}/AlarmService.java | 2 +- .../operation/service/{ => web/alarm}/AlarmServiceImpl.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) rename src/main/java/org/sopt/makers/operation/service/{ => web/alarm}/AlarmService.java (93%) rename src/main/java/org/sopt/makers/operation/service/{ => web/alarm}/AlarmServiceImpl.java (98%) diff --git a/src/main/java/org/sopt/makers/operation/controller/web/AlarmController.java b/src/main/java/org/sopt/makers/operation/controller/web/AlarmController.java index 67e71e16..0bc52a8d 100644 --- a/src/main/java/org/sopt/makers/operation/controller/web/AlarmController.java +++ b/src/main/java/org/sopt/makers/operation/controller/web/AlarmController.java @@ -5,7 +5,7 @@ import org.sopt.makers.operation.common.ApiResponse; import org.sopt.makers.operation.dto.alarm.request.AlarmSendRequestDTO; -import org.sopt.makers.operation.service.AlarmService; +import org.sopt.makers.operation.service.web.alarm.AlarmService; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; diff --git a/src/main/java/org/sopt/makers/operation/service/AlarmService.java b/src/main/java/org/sopt/makers/operation/service/web/alarm/AlarmService.java similarity index 93% rename from src/main/java/org/sopt/makers/operation/service/AlarmService.java rename to src/main/java/org/sopt/makers/operation/service/web/alarm/AlarmService.java index 459cb89f..2dae99ed 100644 --- a/src/main/java/org/sopt/makers/operation/service/AlarmService.java +++ b/src/main/java/org/sopt/makers/operation/service/web/alarm/AlarmService.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.service; +package org.sopt.makers.operation.service.web.alarm; import org.sopt.makers.operation.dto.alarm.request.AlarmSendRequestDTO; diff --git a/src/main/java/org/sopt/makers/operation/service/AlarmServiceImpl.java b/src/main/java/org/sopt/makers/operation/service/web/alarm/AlarmServiceImpl.java similarity index 98% rename from src/main/java/org/sopt/makers/operation/service/AlarmServiceImpl.java rename to src/main/java/org/sopt/makers/operation/service/web/alarm/AlarmServiceImpl.java index 70e16525..9ce19b87 100644 --- a/src/main/java/org/sopt/makers/operation/service/AlarmServiceImpl.java +++ b/src/main/java/org/sopt/makers/operation/service/web/alarm/AlarmServiceImpl.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.service; +package org.sopt.makers.operation.service.web.alarm; import static java.util.Objects.*; import static org.sopt.makers.operation.common.ExceptionMessage.*; From 3f09ae65d90a51bf47293fef8ee6833453e67b66 Mon Sep 17 00:00:00 2001 From: thguss Date: Wed, 31 Jan 2024 06:44:43 +0900 Subject: [PATCH 034/141] =?UTF-8?q?[REFACTOR]=20Member=20=EC=84=9C?= =?UTF-8?q?=EB=B9=84=EC=8A=A4=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...rController.java => MemberController.java} | 5 +- .../controller/web/MemberController.java | 2 +- .../operation/service/MemberService.java | 15 ---- .../service/app/member/MemberService.java | 9 +++ .../{ => app/member}/MemberServiceImpl.java | 49 +++---------- .../service/web/member/MemberService.java | 9 +++ .../service/web/member/MemberServiceImpl.java | 72 +++++++++++++++++++ 7 files changed, 102 insertions(+), 59 deletions(-) rename src/main/java/org/sopt/makers/operation/controller/app/{AppMemberController.java => MemberController.java} (94%) delete mode 100644 src/main/java/org/sopt/makers/operation/service/MemberService.java create mode 100644 src/main/java/org/sopt/makers/operation/service/app/member/MemberService.java rename src/main/java/org/sopt/makers/operation/service/{ => app/member}/MemberServiceImpl.java (70%) create mode 100644 src/main/java/org/sopt/makers/operation/service/web/member/MemberService.java create mode 100644 src/main/java/org/sopt/makers/operation/service/web/member/MemberServiceImpl.java diff --git a/src/main/java/org/sopt/makers/operation/controller/app/AppMemberController.java b/src/main/java/org/sopt/makers/operation/controller/app/MemberController.java similarity index 94% rename from src/main/java/org/sopt/makers/operation/controller/app/AppMemberController.java rename to src/main/java/org/sopt/makers/operation/controller/app/MemberController.java index 52e94977..2fcdb18f 100644 --- a/src/main/java/org/sopt/makers/operation/controller/app/AppMemberController.java +++ b/src/main/java/org/sopt/makers/operation/controller/app/MemberController.java @@ -4,7 +4,7 @@ import lombok.RequiredArgsConstructor; import lombok.val; import org.sopt.makers.operation.common.ApiResponse; -import org.sopt.makers.operation.service.MemberService; +import org.sopt.makers.operation.service.app.member.MemberService; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; @@ -19,8 +19,9 @@ @RestController @RequiredArgsConstructor @RequestMapping("/api/v1/app/members") -public class AppMemberController { +public class MemberController { private final MemberService memberService; + @ApiOperation(value = "전체 출석 정보 조회") @GetMapping("/attendances") public ResponseEntity getMemberTotalAttendance(@ApiIgnore Principal principal) { diff --git a/src/main/java/org/sopt/makers/operation/controller/web/MemberController.java b/src/main/java/org/sopt/makers/operation/controller/web/MemberController.java index 961dd544..48c98cd6 100644 --- a/src/main/java/org/sopt/makers/operation/controller/web/MemberController.java +++ b/src/main/java/org/sopt/makers/operation/controller/web/MemberController.java @@ -6,7 +6,7 @@ import org.sopt.makers.operation.common.ApiResponse; import org.sopt.makers.operation.entity.Part; -import org.sopt.makers.operation.service.MemberService; +import org.sopt.makers.operation.service.web.member.MemberService; import org.springframework.data.domain.Pageable; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; diff --git a/src/main/java/org/sopt/makers/operation/service/MemberService.java b/src/main/java/org/sopt/makers/operation/service/MemberService.java deleted file mode 100644 index 2b6bcbfa..00000000 --- a/src/main/java/org/sopt/makers/operation/service/MemberService.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.sopt.makers.operation.service; - -import org.sopt.makers.operation.dto.attendance.response.AttendanceTotalResponseDTO; -import org.sopt.makers.operation.dto.member.request.MemberRequestDTO; -import org.sopt.makers.operation.dto.member.response.MemberScoreGetResponse; -import org.sopt.makers.operation.dto.member.response.MembersResponseDTO; -import org.sopt.makers.operation.entity.Part; -import org.springframework.data.domain.Pageable; - -public interface MemberService { - MembersResponseDTO getMemberList(Part part, int generation, Pageable pageable); - AttendanceTotalResponseDTO getMemberTotalAttendance(Long playGroundId); - MemberScoreGetResponse getMemberScore(Long playGroundId); - void createMember(MemberRequestDTO requestDTO); -} diff --git a/src/main/java/org/sopt/makers/operation/service/app/member/MemberService.java b/src/main/java/org/sopt/makers/operation/service/app/member/MemberService.java new file mode 100644 index 00000000..ff5e10c5 --- /dev/null +++ b/src/main/java/org/sopt/makers/operation/service/app/member/MemberService.java @@ -0,0 +1,9 @@ +package org.sopt.makers.operation.service.app.member; + +import org.sopt.makers.operation.dto.attendance.response.AttendanceTotalResponseDTO; +import org.sopt.makers.operation.dto.member.response.MemberScoreGetResponse; + +public interface MemberService { + AttendanceTotalResponseDTO getMemberTotalAttendance(Long playGroundId); + MemberScoreGetResponse getMemberScore(Long playGroundId); +} diff --git a/src/main/java/org/sopt/makers/operation/service/MemberServiceImpl.java b/src/main/java/org/sopt/makers/operation/service/app/member/MemberServiceImpl.java similarity index 70% rename from src/main/java/org/sopt/makers/operation/service/MemberServiceImpl.java rename to src/main/java/org/sopt/makers/operation/service/app/member/MemberServiceImpl.java index 48282fc1..5b54b95c 100644 --- a/src/main/java/org/sopt/makers/operation/service/MemberServiceImpl.java +++ b/src/main/java/org/sopt/makers/operation/service/app/member/MemberServiceImpl.java @@ -1,59 +1,35 @@ -package org.sopt.makers.operation.service; +package org.sopt.makers.operation.service.app.member; import static org.sopt.makers.operation.common.ExceptionMessage.*; -import lombok.RequiredArgsConstructor; -import lombok.val; +import java.util.EnumMap; +import java.util.List; import org.sopt.makers.operation.config.ValueConfig; import org.sopt.makers.operation.dto.attendance.response.AttendanceTotalCountVO; import org.sopt.makers.operation.dto.attendance.response.AttendanceTotalResponseDTO; import org.sopt.makers.operation.dto.attendance.response.AttendanceTotalVO; -import org.sopt.makers.operation.dto.member.response.MemberListGetResponse; -import org.sopt.makers.operation.dto.member.request.MemberRequestDTO; import org.sopt.makers.operation.dto.member.response.MemberScoreGetResponse; -import org.sopt.makers.operation.dto.member.response.MemberSearchCondition; -import org.sopt.makers.operation.dto.member.response.MembersResponseDTO; import org.sopt.makers.operation.entity.attendance.AttendanceStatus; -import org.sopt.makers.operation.entity.member.Member; -import org.sopt.makers.operation.entity.Part; import org.sopt.makers.operation.entity.lecture.Attribute; +import org.sopt.makers.operation.entity.member.Member; import org.sopt.makers.operation.exception.MemberException; import org.sopt.makers.operation.repository.attendance.AttendanceRepository; import org.sopt.makers.operation.repository.member.MemberRepository; -import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; -import java.util.EnumMap; -import java.util.List; - -import javax.transaction.Transactional; +import lombok.RequiredArgsConstructor; +import lombok.val; @Service @RequiredArgsConstructor +@Transactional(readOnly = true) public class MemberServiceImpl implements MemberService { private final MemberRepository memberRepository; private final AttendanceRepository attendanceRepository; private final ValueConfig valueConfig; - @Override - public MembersResponseDTO getMemberList(Part part, int generation, Pageable pageable) { - if (part.equals(Part.ALL)) { - part = null; - } - - val members = memberRepository.search(new MemberSearchCondition(part, generation), pageable) - .stream().map(member -> { - val attendances = findAttendances(member); - val countAttendance = countAttendance(attendances); - val total = translateAttendanceStatus(countAttendance); - return MemberListGetResponse.of(member, total); - }).toList(); - val membersCount = memberRepository.countByGenerationAndPart(generation, part); - - return MembersResponseDTO.of(members, membersCount); - } - @Override public AttendanceTotalResponseDTO getMemberTotalAttendance(Long playGroundId) { val member = memberRepository.getMemberByPlaygroundIdAndGeneration(playGroundId, valueConfig.getGENERATION()) @@ -76,15 +52,6 @@ public MemberScoreGetResponse getMemberScore(Long playGroundId) { return MemberScoreGetResponse.of(member.getScore()); } - @Override - @Transactional - public void createMember(MemberRequestDTO requestDTO) { - if (memberRepository.existsByPlaygroundId(requestDTO.playgroundId())) { - throw new IllegalStateException(DUPLICATED_MEMBER.getName()); - } - memberRepository.save(new Member(requestDTO)); - } - private List filterEtcNoAppearance(List attendances) { return attendances.stream() .filter(attendanceTotalVO -> diff --git a/src/main/java/org/sopt/makers/operation/service/web/member/MemberService.java b/src/main/java/org/sopt/makers/operation/service/web/member/MemberService.java new file mode 100644 index 00000000..d7985148 --- /dev/null +++ b/src/main/java/org/sopt/makers/operation/service/web/member/MemberService.java @@ -0,0 +1,9 @@ +package org.sopt.makers.operation.service.web.member; + +import org.sopt.makers.operation.dto.member.response.MembersResponseDTO; +import org.sopt.makers.operation.entity.Part; +import org.springframework.data.domain.Pageable; + +public interface MemberService { + MembersResponseDTO getMemberList(Part part, int generation, Pageable pageable); +} diff --git a/src/main/java/org/sopt/makers/operation/service/web/member/MemberServiceImpl.java b/src/main/java/org/sopt/makers/operation/service/web/member/MemberServiceImpl.java new file mode 100644 index 00000000..311ff155 --- /dev/null +++ b/src/main/java/org/sopt/makers/operation/service/web/member/MemberServiceImpl.java @@ -0,0 +1,72 @@ +package org.sopt.makers.operation.service.web.member; + +import lombok.RequiredArgsConstructor; +import lombok.val; + +import org.sopt.makers.operation.dto.attendance.response.AttendanceTotalCountVO; +import org.sopt.makers.operation.dto.attendance.response.AttendanceTotalVO; +import org.sopt.makers.operation.dto.member.response.MemberListGetResponse; +import org.sopt.makers.operation.dto.member.response.MemberSearchCondition; +import org.sopt.makers.operation.dto.member.response.MembersResponseDTO; +import org.sopt.makers.operation.entity.attendance.AttendanceStatus; +import org.sopt.makers.operation.entity.member.Member; +import org.sopt.makers.operation.entity.Part; +import org.sopt.makers.operation.repository.attendance.AttendanceRepository; +import org.sopt.makers.operation.repository.member.MemberRepository; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.EnumMap; +import java.util.List; + +@Service +@RequiredArgsConstructor +@Transactional(readOnly = true) +public class MemberServiceImpl implements MemberService { + private final MemberRepository memberRepository; + private final AttendanceRepository attendanceRepository; + + @Override + public MembersResponseDTO getMemberList(Part part, int generation, Pageable pageable) { + if (part.equals(Part.ALL)) { + part = null; + } + + val members = memberRepository.search(new MemberSearchCondition(part, generation), pageable) + .stream().map(member -> { + val attendances = findAttendances(member); + val countAttendance = countAttendance(attendances); + val total = translateAttendanceStatus(countAttendance); + return MemberListGetResponse.of(member, total); + }).toList(); + val membersCount = memberRepository.countByGenerationAndPart(generation, part); + + return MembersResponseDTO.of(members, membersCount); + } + + private List findAttendances(Member member) { + return attendanceRepository.findAttendanceByMemberId(member.getId()) + .stream().map(AttendanceTotalVO::getTotalAttendanceVO) + .toList(); + } + + private EnumMap countAttendance(List attendances) { + return attendances.stream() + .map(AttendanceTotalVO::getAttendanceStatus) + .collect( + () -> new EnumMap<>(AttendanceStatus.class), + (map, status) -> map.merge(status, 1, Integer::sum), + (map1, map2) -> map2.forEach((status, count) -> map1.merge(status, count, Integer::sum)) + ); + } + + private AttendanceTotalCountVO translateAttendanceStatus(EnumMap countAttendance) { + return AttendanceTotalCountVO.of( + countAttendance.getOrDefault(AttendanceStatus.ATTENDANCE, 0), + countAttendance.getOrDefault(AttendanceStatus.ABSENT, 0), + countAttendance.getOrDefault(AttendanceStatus.TARDY, 0), + countAttendance.getOrDefault(AttendanceStatus.PARTICIPATE, 0) + ); + } +} From 261219854b6fbc520176b980f285a8752a003b3c Mon Sep 17 00:00:00 2001 From: thguss Date: Wed, 31 Jan 2024 06:45:53 +0900 Subject: [PATCH 035/141] =?UTF-8?q?[REFACTOR]=20Schedule=20=EC=84=9C?= =?UTF-8?q?=EB=B9=84=EC=8A=A4=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...eController.java => ScheduleController.java} | 4 ++-- .../{ => app/schedule}/ScheduleService.java | 6 +++--- .../{ => app/schedule}/ScheduleServiceImpl.java | 17 +++++++++-------- 3 files changed, 14 insertions(+), 13 deletions(-) rename src/main/java/org/sopt/makers/operation/controller/app/{AppScheduleController.java => ScheduleController.java} (91%) rename src/main/java/org/sopt/makers/operation/service/{ => app/schedule}/ScheduleService.java (80%) rename src/main/java/org/sopt/makers/operation/service/{ => app/schedule}/ScheduleServiceImpl.java (98%) diff --git a/src/main/java/org/sopt/makers/operation/controller/app/AppScheduleController.java b/src/main/java/org/sopt/makers/operation/controller/app/ScheduleController.java similarity index 91% rename from src/main/java/org/sopt/makers/operation/controller/app/AppScheduleController.java rename to src/main/java/org/sopt/makers/operation/controller/app/ScheduleController.java index 1d187ac5..dbe029a5 100644 --- a/src/main/java/org/sopt/makers/operation/controller/app/AppScheduleController.java +++ b/src/main/java/org/sopt/makers/operation/controller/app/ScheduleController.java @@ -4,7 +4,7 @@ import lombok.RequiredArgsConstructor; import lombok.val; import org.sopt.makers.operation.common.ApiResponse; -import org.sopt.makers.operation.service.ScheduleService; +import org.sopt.makers.operation.service.app.schedule.ScheduleService; import org.springframework.format.annotation.DateTimeFormat; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; @@ -17,7 +17,7 @@ @RestController @RequiredArgsConstructor @RequestMapping("/api/v1/app/schedules") -public class AppScheduleController { +public class ScheduleController { private final ScheduleService scheduleService; @ApiOperation("일정 리스트 조회") diff --git a/src/main/java/org/sopt/makers/operation/service/ScheduleService.java b/src/main/java/org/sopt/makers/operation/service/app/schedule/ScheduleService.java similarity index 80% rename from src/main/java/org/sopt/makers/operation/service/ScheduleService.java rename to src/main/java/org/sopt/makers/operation/service/app/schedule/ScheduleService.java index 6ac8f9e8..e7c74aca 100644 --- a/src/main/java/org/sopt/makers/operation/service/ScheduleService.java +++ b/src/main/java/org/sopt/makers/operation/service/app/schedule/ScheduleService.java @@ -1,9 +1,9 @@ -package org.sopt.makers.operation.service; - -import org.sopt.makers.operation.dto.schedule.response.SchedulesResponseDTO; +package org.sopt.makers.operation.service.app.schedule; import java.time.LocalDateTime; +import org.sopt.makers.operation.dto.schedule.response.SchedulesResponseDTO; + public interface ScheduleService { SchedulesResponseDTO getSchedules(LocalDateTime start, LocalDateTime end); } diff --git a/src/main/java/org/sopt/makers/operation/service/ScheduleServiceImpl.java b/src/main/java/org/sopt/makers/operation/service/app/schedule/ScheduleServiceImpl.java similarity index 98% rename from src/main/java/org/sopt/makers/operation/service/ScheduleServiceImpl.java rename to src/main/java/org/sopt/makers/operation/service/app/schedule/ScheduleServiceImpl.java index ad4a9b9a..d9b2fafe 100644 --- a/src/main/java/org/sopt/makers/operation/service/ScheduleServiceImpl.java +++ b/src/main/java/org/sopt/makers/operation/service/app/schedule/ScheduleServiceImpl.java @@ -1,11 +1,4 @@ -package org.sopt.makers.operation.service; - -import lombok.RequiredArgsConstructor; -import lombok.val; -import org.sopt.makers.operation.dto.schedule.response.SchedulesResponseDTO; -import org.sopt.makers.operation.entity.schedule.Schedule; -import org.sopt.makers.operation.repository.schedule.ScheduleRepository; -import org.springframework.stereotype.Service; +package org.sopt.makers.operation.service.app.schedule; import java.time.Duration; import java.time.LocalDate; @@ -17,6 +10,14 @@ import java.util.stream.Collectors; import java.util.stream.LongStream; +import org.sopt.makers.operation.dto.schedule.response.SchedulesResponseDTO; +import org.sopt.makers.operation.entity.schedule.Schedule; +import org.sopt.makers.operation.repository.schedule.ScheduleRepository; +import org.springframework.stereotype.Service; + +import lombok.RequiredArgsConstructor; +import lombok.val; + @Service @RequiredArgsConstructor public class ScheduleServiceImpl implements ScheduleService { From 9335f5f61f67f56e138b96f814ec432985f2d70b Mon Sep 17 00:00:00 2001 From: thguss Date: Wed, 31 Jan 2024 06:49:30 +0900 Subject: [PATCH 036/141] =?UTF-8?q?[FIX]=20=ED=81=B4=EB=9E=98=EC=8A=A4?= =?UTF-8?q?=EB=AA=85=20=EC=88=98=EC=A0=95:=20ApiResponse=20=EC=9D=B4?= =?UTF-8?q?=EB=A6=84=20=EC=A4=91=EB=B3=B5=20(=EC=8A=A4=EC=9B=A8=EA=B1=B0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../makers/operation/common/ApiResponse.java | 20 ------------------- .../controller/app/AttendanceController.java | 6 +++--- .../controller/app/LectureController.java | 10 +++++----- .../controller/app/MemberController.java | 10 +++++----- .../controller/app/ScheduleController.java | 6 +++--- .../controller/web/AdminController.java | 14 ++++++------- .../controller/web/AlarmController.java | 16 +++++++-------- .../controller/web/AttendanceController.java | 18 ++++++++--------- .../controller/web/LectureController.java | 18 ++++++++--------- .../controller/web/MemberController.java | 6 +++--- .../makers/operation/dto/ResponseDTO.java | 20 +++++++++++++++++++ .../operation/handler/ErrorHandler.java | 20 +++++++++---------- .../security/jwt/JwtExceptionFilter.java | 4 ++-- 13 files changed, 84 insertions(+), 84 deletions(-) delete mode 100644 src/main/java/org/sopt/makers/operation/common/ApiResponse.java create mode 100644 src/main/java/org/sopt/makers/operation/dto/ResponseDTO.java diff --git a/src/main/java/org/sopt/makers/operation/common/ApiResponse.java b/src/main/java/org/sopt/makers/operation/common/ApiResponse.java deleted file mode 100644 index 0b6e12cb..00000000 --- a/src/main/java/org/sopt/makers/operation/common/ApiResponse.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.sopt.makers.operation.common; - -public record ApiResponse( - boolean success, - String message, - Object data -) { - - public static ApiResponse success(String message, Object data) { - return new ApiResponse(true, message, data); - } - - public static ApiResponse success(String message) { - return new ApiResponse(true, message, null); - } - - public static ApiResponse fail(String message) { - return new ApiResponse(false, message, null); - } -} diff --git a/src/main/java/org/sopt/makers/operation/controller/app/AttendanceController.java b/src/main/java/org/sopt/makers/operation/controller/app/AttendanceController.java index 4a74911c..68efe68c 100644 --- a/src/main/java/org/sopt/makers/operation/controller/app/AttendanceController.java +++ b/src/main/java/org/sopt/makers/operation/controller/app/AttendanceController.java @@ -6,7 +6,7 @@ import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import lombok.val; -import org.sopt.makers.operation.common.ApiResponse; +import org.sopt.makers.operation.dto.ResponseDTO; import org.sopt.makers.operation.dto.attendance.request.AttendRequestDTO; import org.sopt.makers.operation.service.app.attendance.AttendanceService; import org.springframework.http.ResponseEntity; @@ -23,9 +23,9 @@ public class AttendanceController { @ApiOperation(value = "출석 하기") @PostMapping("/attend") - public ResponseEntity attend(@RequestBody AttendRequestDTO requestDTO, @ApiIgnore Principal principal) { + public ResponseEntity attend(@RequestBody AttendRequestDTO requestDTO, @ApiIgnore Principal principal) { val response = attendanceService.attend(getMemberId(principal), requestDTO); - return ResponseEntity.ok(ApiResponse.success(SUCCESS_ATTEND.getMessage(), response)); + return ResponseEntity.ok(ResponseDTO.success(SUCCESS_ATTEND.getMessage(), response)); } private Long getMemberId(Principal principal) { diff --git a/src/main/java/org/sopt/makers/operation/controller/app/LectureController.java b/src/main/java/org/sopt/makers/operation/controller/app/LectureController.java index edccbcab..ea46300a 100644 --- a/src/main/java/org/sopt/makers/operation/controller/app/LectureController.java +++ b/src/main/java/org/sopt/makers/operation/controller/app/LectureController.java @@ -5,7 +5,7 @@ import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import lombok.val; -import org.sopt.makers.operation.common.ApiResponse; +import org.sopt.makers.operation.dto.ResponseDTO; import org.sopt.makers.operation.service.app.lecture.LectureService; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; @@ -22,16 +22,16 @@ public class LectureController { @ApiOperation(value = "진행 중인 세미나 상태 조회") @GetMapping - public ResponseEntity getLecture(@ApiIgnore Principal principal) { + public ResponseEntity getLecture(@ApiIgnore Principal principal) { val memberPlaygroundId = Long.parseLong(principal.getName()); val response = lectureService.getTodayLecture(memberPlaygroundId); - return ResponseEntity.ok(ApiResponse.success(SUCCESS_SINGLE_GET_LECTURE.getMessage(), response)); + return ResponseEntity.ok(ResponseDTO.success(SUCCESS_SINGLE_GET_LECTURE.getMessage(), response)); } @ApiOperation(value = "출석 차수 조회") @GetMapping("/round/{lectureId}") - public ResponseEntity getRound(@PathVariable("lectureId") Long lectureId) { + public ResponseEntity getRound(@PathVariable("lectureId") Long lectureId) { val response = lectureService.getCurrentLectureRound(lectureId); - return ResponseEntity.ok(ApiResponse.success(SUCCESS_GET_LECTURE_ROUND.getMessage(), response)); + return ResponseEntity.ok(ResponseDTO.success(SUCCESS_GET_LECTURE_ROUND.getMessage(), response)); } } diff --git a/src/main/java/org/sopt/makers/operation/controller/app/MemberController.java b/src/main/java/org/sopt/makers/operation/controller/app/MemberController.java index 2fcdb18f..9d7faaa7 100644 --- a/src/main/java/org/sopt/makers/operation/controller/app/MemberController.java +++ b/src/main/java/org/sopt/makers/operation/controller/app/MemberController.java @@ -3,7 +3,7 @@ import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import lombok.val; -import org.sopt.makers.operation.common.ApiResponse; +import org.sopt.makers.operation.dto.ResponseDTO; import org.sopt.makers.operation.service.app.member.MemberService; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; @@ -24,16 +24,16 @@ public class MemberController { @ApiOperation(value = "전체 출석 정보 조회") @GetMapping("/attendances") - public ResponseEntity getMemberTotalAttendance(@ApiIgnore Principal principal) { + public ResponseEntity getMemberTotalAttendance(@ApiIgnore Principal principal) { val response = memberService.getMemberTotalAttendance(getMemberId(principal)); - return ResponseEntity.ok(ApiResponse.success(SUCCESS_TOTAL_ATTENDANCE.getMessage(), response)); + return ResponseEntity.ok(ResponseDTO.success(SUCCESS_TOTAL_ATTENDANCE.getMessage(), response)); } @ApiOperation(value = "출석 점수 조회") @GetMapping("/score") - public ResponseEntity getScore(@ApiIgnore Principal principal) { + public ResponseEntity getScore(@ApiIgnore Principal principal) { val response = memberService.getMemberScore(getMemberId(principal)); - return ResponseEntity.ok(ApiResponse.success(SUCCESS_GET_ATTENDANCE_SCORE.getMessage(), response)); + return ResponseEntity.ok(ResponseDTO.success(SUCCESS_GET_ATTENDANCE_SCORE.getMessage(), response)); } private Long getMemberId(Principal principal) { diff --git a/src/main/java/org/sopt/makers/operation/controller/app/ScheduleController.java b/src/main/java/org/sopt/makers/operation/controller/app/ScheduleController.java index dbe029a5..b04b7611 100644 --- a/src/main/java/org/sopt/makers/operation/controller/app/ScheduleController.java +++ b/src/main/java/org/sopt/makers/operation/controller/app/ScheduleController.java @@ -3,7 +3,7 @@ import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import lombok.val; -import org.sopt.makers.operation.common.ApiResponse; +import org.sopt.makers.operation.dto.ResponseDTO; import org.sopt.makers.operation.service.app.schedule.ScheduleService; import org.springframework.format.annotation.DateTimeFormat; import org.springframework.http.ResponseEntity; @@ -11,7 +11,7 @@ import java.time.LocalDateTime; -import static org.sopt.makers.operation.common.ApiResponse.success; +import static org.sopt.makers.operation.dto.ResponseDTO.success; import static org.sopt.makers.operation.common.ResponseMessage.*; @RestController @@ -22,7 +22,7 @@ public class ScheduleController { @ApiOperation("일정 리스트 조회") @GetMapping - public ResponseEntity getAlarms( + public ResponseEntity getAlarms( @RequestParam @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDateTime start, @RequestParam @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDateTime end ) { diff --git a/src/main/java/org/sopt/makers/operation/controller/web/AdminController.java b/src/main/java/org/sopt/makers/operation/controller/web/AdminController.java index 8c82f821..75a2ff11 100644 --- a/src/main/java/org/sopt/makers/operation/controller/web/AdminController.java +++ b/src/main/java/org/sopt/makers/operation/controller/web/AdminController.java @@ -7,7 +7,7 @@ import lombok.RequiredArgsConstructor; import lombok.val; -import org.sopt.makers.operation.common.ApiResponse; +import org.sopt.makers.operation.dto.ResponseDTO; import org.sopt.makers.operation.dto.admin.request.LoginRequestDTO; import org.sopt.makers.operation.dto.admin.request.SignUpRequestDTO; import org.sopt.makers.operation.service.web.admin.AdminServiceImpl; @@ -24,29 +24,29 @@ public class AdminController { @ApiOperation(value = "회원가입") @PostMapping("/signup") - public ResponseEntity signup(@RequestBody SignUpRequestDTO signUpRequestDTO) { + public ResponseEntity signup(@RequestBody SignUpRequestDTO signUpRequestDTO) { val response = authService.signUp(signUpRequestDTO); - return ResponseEntity.ok(ApiResponse.success(SUCCESS_SIGN_UP.getMessage(), response)); + return ResponseEntity.ok(ResponseDTO.success(SUCCESS_SIGN_UP.getMessage(), response)); } @ApiOperation(value = "로그인") @PostMapping("/login") - public ResponseEntity login(@RequestBody LoginRequestDTO userLoginRequestDTO) { + public ResponseEntity login(@RequestBody LoginRequestDTO userLoginRequestDTO) { val response = authService.login(userLoginRequestDTO); val headers = cookie.setRefreshToken(response.refreshToken()); return ResponseEntity.status(OK) .headers(headers) - .body(ApiResponse.success(SUCCESS_LOGIN_UP.getMessage(), response.loginResponseVO())); + .body(ResponseDTO.success(SUCCESS_LOGIN_UP.getMessage(), response.loginResponseVO())); } @ApiOperation(value = "토큰 재발급") @PatchMapping("/refresh") - public ResponseEntity refresh(@CookieValue String refreshToken) { + public ResponseEntity refresh(@CookieValue String refreshToken) { val response = authService.refresh(refreshToken); val headers = cookie.setRefreshToken(response.refreshToken()); return ResponseEntity.status(OK).headers(headers) - .body(ApiResponse.success(SUCCESS_GET_REFRESH_TOKEN.getMessage(), response.accessToken())); + .body(ResponseDTO.success(SUCCESS_GET_REFRESH_TOKEN.getMessage(), response.accessToken())); } } diff --git a/src/main/java/org/sopt/makers/operation/controller/web/AlarmController.java b/src/main/java/org/sopt/makers/operation/controller/web/AlarmController.java index 0bc52a8d..b53ad509 100644 --- a/src/main/java/org/sopt/makers/operation/controller/web/AlarmController.java +++ b/src/main/java/org/sopt/makers/operation/controller/web/AlarmController.java @@ -3,7 +3,7 @@ import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; -import org.sopt.makers.operation.common.ApiResponse; +import org.sopt.makers.operation.dto.ResponseDTO; import org.sopt.makers.operation.dto.alarm.request.AlarmSendRequestDTO; import org.sopt.makers.operation.service.web.alarm.AlarmService; import org.springframework.http.ResponseEntity; @@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RestController; import static org.sopt.makers.operation.common.ResponseMessage.SUCCESS_SEND_ALARM; -import static org.sopt.makers.operation.common.ApiResponse.*; +import static org.sopt.makers.operation.dto.ResponseDTO.*; import static org.sopt.makers.operation.common.ResponseMessage.*; import java.net.URI; @@ -38,14 +38,14 @@ public class AlarmController { @ApiOperation(value = "알림 전송") @PostMapping("/send") - public ResponseEntity sendAlarm(@RequestBody AlarmSendRequestDTO requestDTO) { + public ResponseEntity sendAlarm(@RequestBody AlarmSendRequestDTO requestDTO) { alarmService.sendByAdmin(requestDTO); - return ResponseEntity.ok(ApiResponse.success(SUCCESS_SEND_ALARM.getMessage())); + return ResponseEntity.ok(ResponseDTO.success(SUCCESS_SEND_ALARM.getMessage())); } @ApiOperation("알림 생성") @PostMapping - public ResponseEntity createAlarm(@RequestBody AlarmRequestDTO requestDTO) { + public ResponseEntity createAlarm(@RequestBody AlarmRequestDTO requestDTO) { val alarmId = alarmService.createAlarm(requestDTO); return ResponseEntity .created(getURI(alarmId)) @@ -54,7 +54,7 @@ public ResponseEntity createAlarm(@RequestBody AlarmRequestDTO requ @ApiOperation("알림 리스트 조회") @GetMapping - public ResponseEntity getAlarms( + public ResponseEntity getAlarms( @RequestParam(required = false) Integer generation, @RequestParam(required = false) Part part, @RequestParam(required = false) Status status, @@ -66,14 +66,14 @@ public ResponseEntity getAlarms( @ApiOperation("알림 상세 조회") @GetMapping("/{alarmId}") - public ResponseEntity getAlarm(@PathVariable Long alarmId) { + public ResponseEntity getAlarm(@PathVariable Long alarmId) { val response = alarmService.getAlarm(alarmId); return ResponseEntity.ok(success(SUCCESS_GET_ALARM.getMessage(), response)); } @ApiOperation("알림 삭제") @DeleteMapping("/{alarmId}") - public ResponseEntity deleteAlarm(@PathVariable Long alarmId) { + public ResponseEntity deleteAlarm(@PathVariable Long alarmId) { alarmService.deleteAlarm(alarmId); return ResponseEntity.ok(success(SUCCESS_DELETE_ALARM.getMessage())); } diff --git a/src/main/java/org/sopt/makers/operation/controller/web/AttendanceController.java b/src/main/java/org/sopt/makers/operation/controller/web/AttendanceController.java index fa6c2a2f..3a7cd7a3 100644 --- a/src/main/java/org/sopt/makers/operation/controller/web/AttendanceController.java +++ b/src/main/java/org/sopt/makers/operation/controller/web/AttendanceController.java @@ -2,7 +2,7 @@ import static org.sopt.makers.operation.common.ResponseMessage.*; -import org.sopt.makers.operation.common.ApiResponse; +import org.sopt.makers.operation.dto.ResponseDTO; import org.sopt.makers.operation.dto.attendance.request.SubAttendanceUpdateRequestDTO; import org.sopt.makers.operation.entity.Part; import org.sopt.makers.operation.service.web.attendance.AttendanceService; @@ -28,30 +28,30 @@ public class AttendanceController { @ApiOperation(value = "출석 상태 변경") @PatchMapping - public ResponseEntity updateSubAttendance(@RequestBody SubAttendanceUpdateRequestDTO requestDTO) { + public ResponseEntity updateSubAttendance(@RequestBody SubAttendanceUpdateRequestDTO requestDTO) { val response = attendanceService.updateSubAttendance(requestDTO); - return ResponseEntity.ok(ApiResponse.success(SUCCESS_UPDATE_ATTENDANCE_STATUS.getMessage(), response)); + return ResponseEntity.ok(ResponseDTO.success(SUCCESS_UPDATE_ATTENDANCE_STATUS.getMessage(), response)); } @ApiOperation(value = "회원별 출석 정보 조회") @GetMapping("/{memberId}") - public ResponseEntity findAttendancesByMember(@PathVariable Long memberId) { + public ResponseEntity findAttendancesByMember(@PathVariable Long memberId) { val response = attendanceService.findAttendancesByMember(memberId); - return ResponseEntity.ok(ApiResponse.success(SUCCESS_GET_MEMBER_ATTENDANCE.getMessage(), response)); + return ResponseEntity.ok(ResponseDTO.success(SUCCESS_GET_MEMBER_ATTENDANCE.getMessage(), response)); } @ApiOperation(value = "출석 점수 갱신") @PatchMapping("/member/{memberId}") - public ResponseEntity updateMemberScore(@PathVariable Long memberId) { + public ResponseEntity updateMemberScore(@PathVariable Long memberId) { val response = attendanceService.updateMemberScore(memberId); - return ResponseEntity.ok(ApiResponse.success(SUCCESS_UPDATE_MEMBER_SCORE.getMessage(), response)); + return ResponseEntity.ok(ResponseDTO.success(SUCCESS_UPDATE_MEMBER_SCORE.getMessage(), response)); } @ApiOperation(value = "세션별 출석 정보 조회") @GetMapping("/lecture/{lectureId}") - public ResponseEntity findAttendancesByLecture( + public ResponseEntity findAttendancesByLecture( @PathVariable Long lectureId, @RequestParam(required = false) Part part, Pageable pageable) { val response = attendanceService.findAttendancesByLecture(lectureId, part, pageable); - return ResponseEntity.ok(ApiResponse.success(SUCCESS_GET_ATTENDANCES.getMessage(), response)); + return ResponseEntity.ok(ResponseDTO.success(SUCCESS_GET_ATTENDANCES.getMessage(), response)); } } diff --git a/src/main/java/org/sopt/makers/operation/controller/web/LectureController.java b/src/main/java/org/sopt/makers/operation/controller/web/LectureController.java index 209fd4be..0ab501f6 100644 --- a/src/main/java/org/sopt/makers/operation/controller/web/LectureController.java +++ b/src/main/java/org/sopt/makers/operation/controller/web/LectureController.java @@ -1,11 +1,11 @@ package org.sopt.makers.operation.controller.web; -import static org.sopt.makers.operation.common.ApiResponse.*; +import static org.sopt.makers.operation.dto.ResponseDTO.*; import static org.sopt.makers.operation.common.ResponseMessage.*; import java.net.URI; -import org.sopt.makers.operation.common.ApiResponse; +import org.sopt.makers.operation.dto.ResponseDTO; import org.sopt.makers.operation.dto.lecture.request.AttendanceRequestDTO; import org.sopt.makers.operation.dto.lecture.request.LectureRequestDTO; import org.sopt.makers.operation.entity.Part; @@ -36,7 +36,7 @@ public class LectureController { @ApiOperation(value = "세션 생성") @PostMapping - public ResponseEntity createLecture(@RequestBody LectureRequestDTO requestDTO) { + public ResponseEntity createLecture(@RequestBody LectureRequestDTO requestDTO) { val lectureId = lectureService.createLecture(requestDTO); return ResponseEntity .created(getURI(lectureId)) @@ -45,21 +45,21 @@ public ResponseEntity createLecture(@RequestBody LectureRequestDTO @ApiOperation(value = "세션 리스트 조회") @GetMapping - public ResponseEntity getLectures(@RequestParam int generation, @RequestParam(required = false) Part part) { + public ResponseEntity getLectures(@RequestParam int generation, @RequestParam(required = false) Part part) { val response = lectureService.getLectures(generation, part); return ResponseEntity.ok(success(SUCCESS_GET_LECTURES.getMessage(), response)); } @ApiOperation(value = "세션 단일 조회") @GetMapping("/{lectureId}") - public ResponseEntity getLecture(@PathVariable Long lectureId) { + public ResponseEntity getLecture(@PathVariable Long lectureId) { val response = lectureService.getLecture(lectureId); return ResponseEntity.ok(success(SUCCESS_GET_LECTURE.getMessage(), response)); } @ApiOperation(value = "출석 시작") @PatchMapping("/attendance") - public ResponseEntity startAttendance(@RequestBody AttendanceRequestDTO requestDTO) { + public ResponseEntity startAttendance(@RequestBody AttendanceRequestDTO requestDTO) { val response = lectureService.startAttendance(requestDTO); return ResponseEntity .created(getURI(requestDTO.lectureId())) @@ -76,21 +76,21 @@ private URI getURI(Long lectureId) { @ApiOperation(value = "세션 종료 후 출석 점수 갱신") @PatchMapping("/{lectureId}") - public ResponseEntity endLecture(@PathVariable Long lectureId) { + public ResponseEntity endLecture(@PathVariable Long lectureId) { lectureService.endLecture(lectureId); return ResponseEntity.ok(success(SUCCESS_UPDATE_MEMBER_SCORE.getMessage())); } @ApiOperation(value = "세션 삭제") @DeleteMapping("/{lectureId}") - public ResponseEntity deleteLecture(@PathVariable Long lectureId) { + public ResponseEntity deleteLecture(@PathVariable Long lectureId) { lectureService.deleteLecture(lectureId); return ResponseEntity.ok(success(SUCCESS_DELETE_LECTURE.getMessage())); } @ApiOperation(value = "세션 팝업용 상세 조회") @GetMapping("/detail/{lectureId}") - public ResponseEntity getLectureDetail(@PathVariable Long lectureId) { + public ResponseEntity getLectureDetail(@PathVariable Long lectureId) { val response = lectureService.getLectureDetail(lectureId); return ResponseEntity.ok(success(SUCCESS_GET_LECTURE.getMessage(), response)); } diff --git a/src/main/java/org/sopt/makers/operation/controller/web/MemberController.java b/src/main/java/org/sopt/makers/operation/controller/web/MemberController.java index 48c98cd6..2ae9b07a 100644 --- a/src/main/java/org/sopt/makers/operation/controller/web/MemberController.java +++ b/src/main/java/org/sopt/makers/operation/controller/web/MemberController.java @@ -4,7 +4,7 @@ import lombok.RequiredArgsConstructor; import lombok.val; -import org.sopt.makers.operation.common.ApiResponse; +import org.sopt.makers.operation.dto.ResponseDTO; import org.sopt.makers.operation.entity.Part; import org.sopt.makers.operation.service.web.member.MemberService; import org.springframework.data.domain.Pageable; @@ -21,9 +21,9 @@ public class MemberController { @ApiOperation(value = "멤버 리스트 조회") @GetMapping("/list") - public ResponseEntity getMemberList( + public ResponseEntity getMemberList( @RequestParam(required = false) Part part, @RequestParam(required = false) Integer generation, Pageable pageable) { val memberList = memberService.getMemberList(part, generation, pageable); - return ResponseEntity.ok(ApiResponse.success(SUCCESS_GET_MEMBERS.getMessage(), memberList)); + return ResponseEntity.ok(ResponseDTO.success(SUCCESS_GET_MEMBERS.getMessage(), memberList)); } } diff --git a/src/main/java/org/sopt/makers/operation/dto/ResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/ResponseDTO.java new file mode 100644 index 00000000..116064db --- /dev/null +++ b/src/main/java/org/sopt/makers/operation/dto/ResponseDTO.java @@ -0,0 +1,20 @@ +package org.sopt.makers.operation.dto; + +public record ResponseDTO( + boolean success, + String message, + Object data +) { + + public static ResponseDTO success(String message, Object data) { + return new ResponseDTO(true, message, data); + } + + public static ResponseDTO success(String message) { + return new ResponseDTO(true, message, null); + } + + public static ResponseDTO fail(String message) { + return new ResponseDTO(false, message, null); + } +} diff --git a/src/main/java/org/sopt/makers/operation/handler/ErrorHandler.java b/src/main/java/org/sopt/makers/operation/handler/ErrorHandler.java index b5426500..b734ec8e 100644 --- a/src/main/java/org/sopt/makers/operation/handler/ErrorHandler.java +++ b/src/main/java/org/sopt/makers/operation/handler/ErrorHandler.java @@ -1,12 +1,12 @@ package org.sopt.makers.operation.handler; -import static org.sopt.makers.operation.common.ApiResponse.*; +import static org.sopt.makers.operation.dto.ResponseDTO.*; import static org.sopt.makers.operation.common.ExceptionMessage.*; import static org.springframework.http.HttpStatus.*; import java.time.format.DateTimeParseException; -import org.sopt.makers.operation.common.ApiResponse; +import org.sopt.makers.operation.dto.ResponseDTO; import org.sopt.makers.operation.exception.*; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.ExceptionHandler; @@ -17,48 +17,48 @@ @RestControllerAdvice public class ErrorHandler { @ExceptionHandler(AdminFailureException.class) - public ResponseEntity authFailureException (AdminFailureException ex) { + public ResponseEntity authFailureException (AdminFailureException ex) { log.error(ex.getMessage()); return ResponseEntity.status(BAD_REQUEST).body(fail(ex.getMessage())); } @ExceptionHandler(TokenException.class) - public ResponseEntity tokenException (TokenException ex) { + public ResponseEntity tokenException (TokenException ex) { log.error(ex.getMessage()); return ResponseEntity.status(BAD_REQUEST).body(fail(ex.getMessage())); } @ExceptionHandler(IllegalStateException.class) - public ResponseEntity illegalStateExceptionException (IllegalStateException ex) { + public ResponseEntity illegalStateExceptionException (IllegalStateException ex) { log.error(ex.getMessage()); return ResponseEntity.status(BAD_REQUEST).body(fail(ex.getMessage())); } @ExceptionHandler(MemberException.class) - public ResponseEntity memberException (MemberException ex) { + public ResponseEntity memberException (MemberException ex) { log.error(ex.getMessage()); return ResponseEntity.status(NOT_FOUND).body(fail(ex.getMessage())); } @ExceptionHandler(LectureException.class) - public ResponseEntity lectureException (LectureException ex) { + public ResponseEntity lectureException (LectureException ex) { log.error(ex.getMessage()); return ResponseEntity.status(NOT_FOUND).body(fail(ex.getMessage())); } @ExceptionHandler(SubLectureException.class) - public ResponseEntity subLectureException (SubLectureException ex) { + public ResponseEntity subLectureException (SubLectureException ex) { log.error(ex.getMessage()); return ResponseEntity.status(NOT_FOUND).body(fail(ex.getMessage())); } @ExceptionHandler(DateTimeParseException.class) - public ResponseEntity dateTimeParseException () { + public ResponseEntity dateTimeParseException () { return ResponseEntity.status(BAD_REQUEST).body(fail(FAULT_DATE_FORMATTER.getName())); } @ExceptionHandler(AlarmException.class) - public ResponseEntity AlarmException (AlarmException ex) { + public ResponseEntity AlarmException (AlarmException ex) { log.error(ex.getMessage()); return ResponseEntity.status(BAD_REQUEST).body(fail(ex.getMessage())); } diff --git a/src/main/java/org/sopt/makers/operation/security/jwt/JwtExceptionFilter.java b/src/main/java/org/sopt/makers/operation/security/jwt/JwtExceptionFilter.java index b3c424f0..b398b3ab 100644 --- a/src/main/java/org/sopt/makers/operation/security/jwt/JwtExceptionFilter.java +++ b/src/main/java/org/sopt/makers/operation/security/jwt/JwtExceptionFilter.java @@ -1,6 +1,6 @@ package org.sopt.makers.operation.security.jwt; -import org.sopt.makers.operation.common.ApiResponse; +import org.sopt.makers.operation.dto.ResponseDTO; import org.sopt.makers.operation.exception.TokenException; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; @@ -28,7 +28,7 @@ protected void doFilterInternal(HttpServletRequest httpServletRequest, filterChain.doFilter(httpServletRequest, httpServletResponse); } catch(TokenException e) { val objectMapper = new ObjectMapper(); - val jsonResponse = objectMapper.writeValueAsString(ApiResponse.fail(e.getMessage())); + val jsonResponse = objectMapper.writeValueAsString(ResponseDTO.fail(e.getMessage())); httpServletResponse.setStatus(HttpStatus.UNAUTHORIZED.value()); httpServletResponse.setContentType(MediaType.APPLICATION_JSON_VALUE); From fc0e2cc70c2fe84762c26ef5881611be71eeeef1 Mon Sep 17 00:00:00 2001 From: thguss Date: Thu, 1 Feb 2024 23:30:26 +0900 Subject: [PATCH 037/141] =?UTF-8?q?[REFACTOR]=20=EB=B6=84=EB=A6=AC=201?= =?UTF-8?q?=EC=B0=A8..?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 88 ++++++------------- operation-api/build.gradle | 14 +++ .../org/operation/OperationApplication.java | 12 +++ .../org/operation}/app/LectureController.java | 6 +- .../org/operation}/app/MemberController.java | 6 +- .../operation}/app/ScheduleController.java | 4 +- .../app/attendance/AttendanceApi.java | 39 ++++++++ .../attendance/AttendanceApiController.java | 34 +++++++ .../dto/request/AttendanceRequest.java | 7 ++ .../attendance/message/SuccessMessage.java | 13 +++ .../org/operation/app/lecture/LectureApi.java | 9 ++ .../app/lecture/LectureApiController.java | 29 ++++++ .../operation/common/dto/BaseResponse.java | 39 ++++++++ .../org/operation}/web/AdminController.java | 8 +- .../org/operation}/web/AlarmController.java | 12 +-- .../operation}/web/AttendanceController.java | 10 +-- .../org/operation}/web/LectureController.java | 16 ++-- .../org/operation}/web/MemberController.java | 4 +- operation-auth/build.gradle | 16 ++++ operation-domain/build.gradle | 19 ++++ operation-external/build.gradle | 19 ++++ operation-storage/build.gradle | 19 ++++ settings.gradle | 6 ++ .../controller/HealthCheckController.java | 16 ---- .../controller/app/AttendanceController.java | 34 ------- 25 files changed, 337 insertions(+), 142 deletions(-) create mode 100644 operation-api/build.gradle create mode 100644 operation-api/src/main/java/org/operation/OperationApplication.java rename {src/main/java/org/sopt/makers/operation/controller => operation-api/src/main/java/org/operation}/app/LectureController.java (81%) rename {src/main/java/org/sopt/makers/operation/controller => operation-api/src/main/java/org/operation}/app/MemberController.java (84%) rename {src/main/java/org/sopt/makers/operation/controller => operation-api/src/main/java/org/operation}/app/ScheduleController.java (88%) create mode 100644 operation-api/src/main/java/org/operation/app/attendance/AttendanceApi.java create mode 100644 operation-api/src/main/java/org/operation/app/attendance/AttendanceApiController.java create mode 100644 operation-api/src/main/java/org/operation/app/attendance/dto/request/AttendanceRequest.java create mode 100644 operation-api/src/main/java/org/operation/app/attendance/message/SuccessMessage.java create mode 100644 operation-api/src/main/java/org/operation/app/lecture/LectureApi.java create mode 100644 operation-api/src/main/java/org/operation/app/lecture/LectureApiController.java create mode 100644 operation-api/src/main/java/org/operation/common/dto/BaseResponse.java rename {src/main/java/org/sopt/makers/operation/controller => operation-api/src/main/java/org/operation}/web/AdminController.java (82%) rename {src/main/java/org/sopt/makers/operation/controller => operation-api/src/main/java/org/operation}/web/AlarmController.java (84%) rename {src/main/java/org/sopt/makers/operation/controller => operation-api/src/main/java/org/operation}/web/AttendanceController.java (81%) rename {src/main/java/org/sopt/makers/operation/controller => operation-api/src/main/java/org/operation}/web/LectureController.java (81%) rename {src/main/java/org/sopt/makers/operation/controller => operation-api/src/main/java/org/operation}/web/MemberController.java (86%) create mode 100644 operation-auth/build.gradle create mode 100644 operation-domain/build.gradle create mode 100644 operation-external/build.gradle create mode 100644 operation-storage/build.gradle delete mode 100644 src/main/java/org/sopt/makers/operation/controller/HealthCheckController.java delete mode 100644 src/main/java/org/sopt/makers/operation/controller/app/AttendanceController.java diff --git a/build.gradle b/build.gradle index a6ed1626..e7a3630d 100644 --- a/build.gradle +++ b/build.gradle @@ -1,19 +1,18 @@ -buildscript { - ext { - queryDslVersion = "5.0.0" - } -} - plugins { id 'java' id 'org.springframework.boot' version '2.7.4' id 'io.spring.dependency-management' version '1.1.0' - id 'com.ewerk.gradle.plugins.querydsl' version '1.0.10' } -group = 'org.sopt.makers' -version = '0.0.1-SNAPSHOT' -sourceCompatibility = '17' +allprojects { + group = 'org.sopt.makers' + version = '0.0.1-SNAPSHOT' + sourceCompatibility = '17' + + repositories { + mavenCentral() + } +} configurations { compileOnly { @@ -21,59 +20,30 @@ configurations { } } -repositories { - mavenCentral() -} - -dependencies { - implementation 'org.springframework.boot:spring-boot-starter-data-jpa' - implementation 'org.springframework.boot:spring-boot-starter-validation' - implementation 'org.springframework.boot:spring-boot-starter-web' - implementation 'org.springframework.boot:spring-boot-starter-security' - implementation "com.querydsl:querydsl-jpa:${queryDslVersion}" - implementation "com.querydsl:querydsl-apt:${queryDslVersion}" - testImplementation 'junit:junit:4.13.1' - testImplementation 'junit:junit:4.13.1' - - compileOnly 'org.projectlombok:lombok' - runtimeOnly 'com.h2database:h2' - runtimeOnly 'org.postgresql:postgresql' - annotationProcessor 'org.projectlombok:lombok' +subprojects { + apply plugin: 'java' + apply plugin: 'org.springframework.boot' + apply plugin: 'io.spring.dependency-management' - // jwt - implementation group: 'io.jsonwebtoken', name: 'jjwt-api', version: '0.11.2' - runtimeOnly group: 'io.jsonwebtoken', name: 'jjwt-impl', version: '0.11.2' - runtimeOnly group: 'io.jsonwebtoken', name: 'jjwt-jackson', version: '0.11.2' + dependencies { + // lombok + compileOnly 'org.projectlombok:lombok' + annotationProcessor 'org.projectlombok:lombok' - testImplementation 'org.springframework.boot:spring-boot-starter-test' - - // swagger - implementation 'io.springfox:springfox-boot-starter:3.0.0' - implementation 'io.springfox:springfox-swagger-ui:3.0.0' - - // gson - implementation 'com.google.code.gson:gson:2.8.9' -} + // test + testImplementation 'org.springframework.boot:spring-boot-starter-test' + } -tasks.named('test') { - useJUnitPlatform() -} + tasks.named('bootJar') { + enabled = false + } -def querydslDir = "$buildDir/generated/querydsl" + tasks.named('jar') { + enabled = true + } -querydsl { - jpa = true - querydslSourcesDir = querydslDir -} -sourceSets { - main.java.srcDir querydslDir -} -compileQuerydsl{ - options.annotationProcessorPath = configurations.querydsl -} -configurations { - compileOnly { - extendsFrom annotationProcessor + tasks.named('test') { + useJUnitPlatform() } - querydsl.extendsFrom compileClasspath } + diff --git a/operation-api/build.gradle b/operation-api/build.gradle new file mode 100644 index 00000000..6b6e0471 --- /dev/null +++ b/operation-api/build.gradle @@ -0,0 +1,14 @@ +tasks.named('bootJar') { + enabled = true +} + +tasks.named('jar') { + enabled = false +} + +dependencies { + implementation project(path: ':operation-domain') + + implementation 'org.springframework.boot:spring-boot-starter-web' + implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.0.2' +} diff --git a/operation-api/src/main/java/org/operation/OperationApplication.java b/operation-api/src/main/java/org/operation/OperationApplication.java new file mode 100644 index 00000000..cc496cb9 --- /dev/null +++ b/operation-api/src/main/java/org/operation/OperationApplication.java @@ -0,0 +1,12 @@ +package org.operation; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class OperationApplication { + + public static void main(String[] args) { + SpringApplication.run(OperationApplication.class, args); + } +} diff --git a/src/main/java/org/sopt/makers/operation/controller/app/LectureController.java b/operation-api/src/main/java/org/operation/app/LectureController.java similarity index 81% rename from src/main/java/org/sopt/makers/operation/controller/app/LectureController.java rename to operation-api/src/main/java/org/operation/app/LectureController.java index ea46300a..36bd94b8 100644 --- a/src/main/java/org/sopt/makers/operation/controller/app/LectureController.java +++ b/operation-api/src/main/java/org/operation/app/LectureController.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.controller.app; +package org.operation.app; import static org.sopt.makers.operation.common.ResponseMessage.*; @@ -25,13 +25,13 @@ public class LectureController { public ResponseEntity getLecture(@ApiIgnore Principal principal) { val memberPlaygroundId = Long.parseLong(principal.getName()); val response = lectureService.getTodayLecture(memberPlaygroundId); - return ResponseEntity.ok(ResponseDTO.success(SUCCESS_SINGLE_GET_LECTURE.getMessage(), response)); + return ResponseEntity.ok(ResponseDTO.success(ResponseMessage.SUCCESS_SINGLE_GET_LECTURE.getMessage(), response)); } @ApiOperation(value = "출석 차수 조회") @GetMapping("/round/{lectureId}") public ResponseEntity getRound(@PathVariable("lectureId") Long lectureId) { val response = lectureService.getCurrentLectureRound(lectureId); - return ResponseEntity.ok(ResponseDTO.success(SUCCESS_GET_LECTURE_ROUND.getMessage(), response)); + return ResponseEntity.ok(ResponseDTO.success(ResponseMessage.SUCCESS_GET_LECTURE_ROUND.getMessage(), response)); } } diff --git a/src/main/java/org/sopt/makers/operation/controller/app/MemberController.java b/operation-api/src/main/java/org/operation/app/MemberController.java similarity index 84% rename from src/main/java/org/sopt/makers/operation/controller/app/MemberController.java rename to operation-api/src/main/java/org/operation/app/MemberController.java index 9d7faaa7..72044096 100644 --- a/src/main/java/org/sopt/makers/operation/controller/app/MemberController.java +++ b/operation-api/src/main/java/org/operation/app/MemberController.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.controller.app; +package org.operation.app; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; @@ -26,14 +26,14 @@ public class MemberController { @GetMapping("/attendances") public ResponseEntity getMemberTotalAttendance(@ApiIgnore Principal principal) { val response = memberService.getMemberTotalAttendance(getMemberId(principal)); - return ResponseEntity.ok(ResponseDTO.success(SUCCESS_TOTAL_ATTENDANCE.getMessage(), response)); + return ResponseEntity.ok(ResponseDTO.success(ResponseMessage.SUCCESS_TOTAL_ATTENDANCE.getMessage(), response)); } @ApiOperation(value = "출석 점수 조회") @GetMapping("/score") public ResponseEntity getScore(@ApiIgnore Principal principal) { val response = memberService.getMemberScore(getMemberId(principal)); - return ResponseEntity.ok(ResponseDTO.success(SUCCESS_GET_ATTENDANCE_SCORE.getMessage(), response)); + return ResponseEntity.ok(ResponseDTO.success(ResponseMessage.SUCCESS_GET_ATTENDANCE_SCORE.getMessage(), response)); } private Long getMemberId(Principal principal) { diff --git a/src/main/java/org/sopt/makers/operation/controller/app/ScheduleController.java b/operation-api/src/main/java/org/operation/app/ScheduleController.java similarity index 88% rename from src/main/java/org/sopt/makers/operation/controller/app/ScheduleController.java rename to operation-api/src/main/java/org/operation/app/ScheduleController.java index b04b7611..50d5d0f8 100644 --- a/src/main/java/org/sopt/makers/operation/controller/app/ScheduleController.java +++ b/operation-api/src/main/java/org/operation/app/ScheduleController.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.controller.app; +package org.operation.app; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; @@ -27,6 +27,6 @@ public ResponseEntity getAlarms( @RequestParam @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDateTime end ) { val response = scheduleService.getSchedules(start, end); - return ResponseEntity.ok(success(SUCCESS_GET_SCHEDULES.getMessage(), response)); + return ResponseEntity.ok(ResponseDTO.success(ResponseMessage.SUCCESS_GET_SCHEDULES.getMessage(), response)); } } diff --git a/operation-api/src/main/java/org/operation/app/attendance/AttendanceApi.java b/operation-api/src/main/java/org/operation/app/attendance/AttendanceApi.java new file mode 100644 index 00000000..0c778234 --- /dev/null +++ b/operation-api/src/main/java/org/operation/app/attendance/AttendanceApi.java @@ -0,0 +1,39 @@ +package org.operation.app.attendance; + +import java.security.Principal; + +import org.operation.app.attendance.dto.request.AttendanceRequest; +import org.operation.common.dto.BaseResponse; +import org.springframework.http.ResponseEntity; + +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.tags.Tag; + + +@Tag(name = "앱 출석 관련 API") +public interface AttendanceApi { + @Operation( + summary = "앱 출석 API", + responses = { + @ApiResponse( + responseCode = "200", + description = "출석에 성공했습니다." + ), + @ApiResponse( + responseCode = "400", + description = "출석에 실패했습니다." + ), + @ApiResponse( + responseCode = "500", + description = "서버 내부 오류" + ) + } + ) + ResponseEntity> attend( + @RequestBody AttendanceRequest request, + @Parameter(hidden = true) Principal principal + ); +} diff --git a/operation-api/src/main/java/org/operation/app/attendance/AttendanceApiController.java b/operation-api/src/main/java/org/operation/app/attendance/AttendanceApiController.java new file mode 100644 index 00000000..e18e398e --- /dev/null +++ b/operation-api/src/main/java/org/operation/app/attendance/AttendanceApiController.java @@ -0,0 +1,34 @@ +package org.operation.app.attendance; + +import static java.util.Objects.*; +import static org.operation.app.attendance.message.SuccessMessage.*; + +import java.security.Principal; + +import org.operation.app.attendance.dto.request.AttendanceRequest; +import org.operation.common.dto.BaseResponse; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import lombok.RequiredArgsConstructor; +import lombok.val; + +@RestController +@RequiredArgsConstructor +@RequestMapping("/api/v1/app/attendances") +public class AttendanceApiController implements AttendanceApi { + // private final AttendanceService attendanceService; + + @Override + public ResponseEntity> attend(@RequestBody AttendanceRequest request, Principal principal) { + val memberId = getMemberId(principal); + val response = memberId + ""; // attendanceService.attend(getMemberId(principal), requestDTO); + return ResponseEntity.ok(BaseResponse.success(SUCCESS_GET_ATTENDANCE.getMessage(), response)); + } + + private Long getMemberId(Principal principal) { + return nonNull(principal) ? Long.valueOf(principal.getName()) : null; + } +} diff --git a/operation-api/src/main/java/org/operation/app/attendance/dto/request/AttendanceRequest.java b/operation-api/src/main/java/org/operation/app/attendance/dto/request/AttendanceRequest.java new file mode 100644 index 00000000..2f7dbe86 --- /dev/null +++ b/operation-api/src/main/java/org/operation/app/attendance/dto/request/AttendanceRequest.java @@ -0,0 +1,7 @@ +package org.operation.app.attendance.dto.request; + +public record AttendanceRequest( + Long subLectureId, + String code +) { +} diff --git a/operation-api/src/main/java/org/operation/app/attendance/message/SuccessMessage.java b/operation-api/src/main/java/org/operation/app/attendance/message/SuccessMessage.java new file mode 100644 index 00000000..6930682c --- /dev/null +++ b/operation-api/src/main/java/org/operation/app/attendance/message/SuccessMessage.java @@ -0,0 +1,13 @@ +package org.operation.app.attendance.message; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public enum SuccessMessage { + SUCCESS_GET_ATTENDANCE("출석 성공"), + ; + + private final String message; +} diff --git a/operation-api/src/main/java/org/operation/app/lecture/LectureApi.java b/operation-api/src/main/java/org/operation/app/lecture/LectureApi.java new file mode 100644 index 00000000..e61a5228 --- /dev/null +++ b/operation-api/src/main/java/org/operation/app/lecture/LectureApi.java @@ -0,0 +1,9 @@ +package org.operation.app.lecture; + +import org.springframework.http.ResponseEntity; + +import io.swagger.v3.oas.annotations.tags.Tag; + +@Tag(name = "앱 출석 관련 API") +public interface AttendanceApi { +} diff --git a/operation-api/src/main/java/org/operation/app/lecture/LectureApiController.java b/operation-api/src/main/java/org/operation/app/lecture/LectureApiController.java new file mode 100644 index 00000000..b7a9b1fe --- /dev/null +++ b/operation-api/src/main/java/org/operation/app/lecture/LectureApiController.java @@ -0,0 +1,29 @@ +package org.operation.app.lecture; + +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import lombok.RequiredArgsConstructor; + +@RestController +@RequiredArgsConstructor +@RequestMapping("/api/v1/app/lectures") +public class LectureApiController implements AttendanceApi { + // + // private final LectureService lectureService; + // + // @ApiOperation(value = "진행 중인 세미나 상태 조회") + // @GetMapping + // public ResponseEntity getLecture(@ApiIgnore Principal principal) { + // val memberPlaygroundId = Long.parseLong(principal.getName()); + // val response = lectureService.getTodayLecture(memberPlaygroundId); + // return ResponseEntity.ok(ResponseDTO.success(ResponseMessage.SUCCESS_SINGLE_GET_LECTURE.getMessage(), response)); + // } + // + // @ApiOperation(value = "출석 차수 조회") + // @GetMapping("/round/{lectureId}") + // public ResponseEntity getRound(@PathVariable("lectureId") Long lectureId) { + // val response = lectureService.getCurrentLectureRound(lectureId); + // return ResponseEntity.ok(ResponseDTO.success(ResponseMessage.SUCCESS_GET_LECTURE_ROUND.getMessage(), response)); + // } +} diff --git a/operation-api/src/main/java/org/operation/common/dto/BaseResponse.java b/operation-api/src/main/java/org/operation/common/dto/BaseResponse.java new file mode 100644 index 00000000..f99b455c --- /dev/null +++ b/operation-api/src/main/java/org/operation/common/dto/BaseResponse.java @@ -0,0 +1,39 @@ +package org.operation.common.dto; + +import com.fasterxml.jackson.annotation.JsonInclude; + +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import lombok.Builder; + +@Builder(access = AccessLevel.PRIVATE) +@AllArgsConstructor(access = AccessLevel.PRIVATE) +public record BaseResponse ( + boolean success, + String message, + @JsonInclude(value = JsonInclude.Include.NON_NULL) + T data +) { + + public static BaseResponse success(String message, T data) { + return BaseResponse.builder() + .success(true) + .message(message) + .data(data) + .build(); + } + + public static BaseResponse success(String message) { + return BaseResponse.builder() + .success(true) + .message(message) + .build(); + } + + public static BaseResponse fail(String message) { + return BaseResponse.builder() + .success(false) + .message(message) + .build(); + } +} diff --git a/src/main/java/org/sopt/makers/operation/controller/web/AdminController.java b/operation-api/src/main/java/org/operation/web/AdminController.java similarity index 82% rename from src/main/java/org/sopt/makers/operation/controller/web/AdminController.java rename to operation-api/src/main/java/org/operation/web/AdminController.java index 75a2ff11..fa0dea07 100644 --- a/src/main/java/org/sopt/makers/operation/controller/web/AdminController.java +++ b/operation-api/src/main/java/org/operation/web/AdminController.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.controller.web; +package org.operation.web; import static org.sopt.makers.operation.common.ResponseMessage.*; import static org.springframework.http.HttpStatus.*; @@ -26,7 +26,7 @@ public class AdminController { @PostMapping("/signup") public ResponseEntity signup(@RequestBody SignUpRequestDTO signUpRequestDTO) { val response = authService.signUp(signUpRequestDTO); - return ResponseEntity.ok(ResponseDTO.success(SUCCESS_SIGN_UP.getMessage(), response)); + return ResponseEntity.ok(ResponseDTO.success(ResponseMessage.SUCCESS_SIGN_UP.getMessage(), response)); } @ApiOperation(value = "로그인") @@ -37,7 +37,7 @@ public ResponseEntity login(@RequestBody LoginRequestDTO userLoginR return ResponseEntity.status(OK) .headers(headers) - .body(ResponseDTO.success(SUCCESS_LOGIN_UP.getMessage(), response.loginResponseVO())); + .body(ResponseDTO.success(ResponseMessage.SUCCESS_LOGIN_UP.getMessage(), response.loginResponseVO())); } @ApiOperation(value = "토큰 재발급") @@ -47,6 +47,6 @@ public ResponseEntity refresh(@CookieValue String refreshToken) { val headers = cookie.setRefreshToken(response.refreshToken()); return ResponseEntity.status(OK).headers(headers) - .body(ResponseDTO.success(SUCCESS_GET_REFRESH_TOKEN.getMessage(), response.accessToken())); + .body(ResponseDTO.success(ResponseMessage.SUCCESS_GET_REFRESH_TOKEN.getMessage(), response.accessToken())); } } diff --git a/src/main/java/org/sopt/makers/operation/controller/web/AlarmController.java b/operation-api/src/main/java/org/operation/web/AlarmController.java similarity index 84% rename from src/main/java/org/sopt/makers/operation/controller/web/AlarmController.java rename to operation-api/src/main/java/org/operation/web/AlarmController.java index b53ad509..575edd42 100644 --- a/src/main/java/org/sopt/makers/operation/controller/web/AlarmController.java +++ b/operation-api/src/main/java/org/operation/web/AlarmController.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.controller.web; +package org.operation.web; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; @@ -40,7 +40,7 @@ public class AlarmController { @PostMapping("/send") public ResponseEntity sendAlarm(@RequestBody AlarmSendRequestDTO requestDTO) { alarmService.sendByAdmin(requestDTO); - return ResponseEntity.ok(ResponseDTO.success(SUCCESS_SEND_ALARM.getMessage())); + return ResponseEntity.ok(ResponseDTO.success(ResponseMessage.SUCCESS_SEND_ALARM.getMessage())); } @ApiOperation("알림 생성") @@ -49,7 +49,7 @@ public ResponseEntity createAlarm(@RequestBody AlarmRequestDTO requ val alarmId = alarmService.createAlarm(requestDTO); return ResponseEntity .created(getURI(alarmId)) - .body(success(SUCCESS_CREATE_ALARM.getMessage(), alarmId)); + .body(ResponseDTO.success(ResponseMessage.SUCCESS_CREATE_ALARM.getMessage(), alarmId)); } @ApiOperation("알림 리스트 조회") @@ -61,21 +61,21 @@ public ResponseEntity getAlarms( Pageable pageable ) { val response = alarmService.getAlarms(generation, part, status, pageable); - return ResponseEntity.ok(success(SUCCESS_GET_ALARMS.getMessage(), response)); + return ResponseEntity.ok(ResponseDTO.success(ResponseMessage.SUCCESS_GET_ALARMS.getMessage(), response)); } @ApiOperation("알림 상세 조회") @GetMapping("/{alarmId}") public ResponseEntity getAlarm(@PathVariable Long alarmId) { val response = alarmService.getAlarm(alarmId); - return ResponseEntity.ok(success(SUCCESS_GET_ALARM.getMessage(), response)); + return ResponseEntity.ok(ResponseDTO.success(ResponseMessage.SUCCESS_GET_ALARM.getMessage(), response)); } @ApiOperation("알림 삭제") @DeleteMapping("/{alarmId}") public ResponseEntity deleteAlarm(@PathVariable Long alarmId) { alarmService.deleteAlarm(alarmId); - return ResponseEntity.ok(success(SUCCESS_DELETE_ALARM.getMessage())); + return ResponseEntity.ok(ResponseDTO.success(ResponseMessage.SUCCESS_DELETE_ALARM.getMessage())); } private URI getURI(Long alarmId) { diff --git a/src/main/java/org/sopt/makers/operation/controller/web/AttendanceController.java b/operation-api/src/main/java/org/operation/web/AttendanceController.java similarity index 81% rename from src/main/java/org/sopt/makers/operation/controller/web/AttendanceController.java rename to operation-api/src/main/java/org/operation/web/AttendanceController.java index 3a7cd7a3..e5b381c0 100644 --- a/src/main/java/org/sopt/makers/operation/controller/web/AttendanceController.java +++ b/operation-api/src/main/java/org/operation/web/AttendanceController.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.controller.web; +package org.operation.web; import static org.sopt.makers.operation.common.ResponseMessage.*; @@ -30,21 +30,21 @@ public class AttendanceController { @PatchMapping public ResponseEntity updateSubAttendance(@RequestBody SubAttendanceUpdateRequestDTO requestDTO) { val response = attendanceService.updateSubAttendance(requestDTO); - return ResponseEntity.ok(ResponseDTO.success(SUCCESS_UPDATE_ATTENDANCE_STATUS.getMessage(), response)); + return ResponseEntity.ok(ResponseDTO.success(ResponseMessage.SUCCESS_UPDATE_ATTENDANCE_STATUS.getMessage(), response)); } @ApiOperation(value = "회원별 출석 정보 조회") @GetMapping("/{memberId}") public ResponseEntity findAttendancesByMember(@PathVariable Long memberId) { val response = attendanceService.findAttendancesByMember(memberId); - return ResponseEntity.ok(ResponseDTO.success(SUCCESS_GET_MEMBER_ATTENDANCE.getMessage(), response)); + return ResponseEntity.ok(ResponseDTO.success(ResponseMessage.SUCCESS_GET_MEMBER_ATTENDANCE.getMessage(), response)); } @ApiOperation(value = "출석 점수 갱신") @PatchMapping("/member/{memberId}") public ResponseEntity updateMemberScore(@PathVariable Long memberId) { val response = attendanceService.updateMemberScore(memberId); - return ResponseEntity.ok(ResponseDTO.success(SUCCESS_UPDATE_MEMBER_SCORE.getMessage(), response)); + return ResponseEntity.ok(ResponseDTO.success(ResponseMessage.SUCCESS_UPDATE_MEMBER_SCORE.getMessage(), response)); } @ApiOperation(value = "세션별 출석 정보 조회") @@ -52,6 +52,6 @@ public ResponseEntity updateMemberScore(@PathVariable Long memberId public ResponseEntity findAttendancesByLecture( @PathVariable Long lectureId, @RequestParam(required = false) Part part, Pageable pageable) { val response = attendanceService.findAttendancesByLecture(lectureId, part, pageable); - return ResponseEntity.ok(ResponseDTO.success(SUCCESS_GET_ATTENDANCES.getMessage(), response)); + return ResponseEntity.ok(ResponseDTO.success(ResponseMessage.SUCCESS_GET_ATTENDANCES.getMessage(), response)); } } diff --git a/src/main/java/org/sopt/makers/operation/controller/web/LectureController.java b/operation-api/src/main/java/org/operation/web/LectureController.java similarity index 81% rename from src/main/java/org/sopt/makers/operation/controller/web/LectureController.java rename to operation-api/src/main/java/org/operation/web/LectureController.java index 0ab501f6..ce96cb98 100644 --- a/src/main/java/org/sopt/makers/operation/controller/web/LectureController.java +++ b/operation-api/src/main/java/org/operation/web/LectureController.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.controller.web; +package org.operation.web; import static org.sopt.makers.operation.dto.ResponseDTO.*; import static org.sopt.makers.operation.common.ResponseMessage.*; @@ -40,21 +40,21 @@ public ResponseEntity createLecture(@RequestBody LectureRequestDTO val lectureId = lectureService.createLecture(requestDTO); return ResponseEntity .created(getURI(lectureId)) - .body(success(SUCCESS_CREATE_LECTURE.getMessage(), lectureId)); + .body(ResponseDTO.success(ResponseMessage.SUCCESS_CREATE_LECTURE.getMessage(), lectureId)); } @ApiOperation(value = "세션 리스트 조회") @GetMapping public ResponseEntity getLectures(@RequestParam int generation, @RequestParam(required = false) Part part) { val response = lectureService.getLectures(generation, part); - return ResponseEntity.ok(success(SUCCESS_GET_LECTURES.getMessage(), response)); + return ResponseEntity.ok(ResponseDTO.success(ResponseMessage.SUCCESS_GET_LECTURES.getMessage(), response)); } @ApiOperation(value = "세션 단일 조회") @GetMapping("/{lectureId}") public ResponseEntity getLecture(@PathVariable Long lectureId) { val response = lectureService.getLecture(lectureId); - return ResponseEntity.ok(success(SUCCESS_GET_LECTURE.getMessage(), response)); + return ResponseEntity.ok(ResponseDTO.success(ResponseMessage.SUCCESS_GET_LECTURE.getMessage(), response)); } @ApiOperation(value = "출석 시작") @@ -63,7 +63,7 @@ public ResponseEntity startAttendance(@RequestBody AttendanceReques val response = lectureService.startAttendance(requestDTO); return ResponseEntity .created(getURI(requestDTO.lectureId())) - .body(success(SUCCESS_START_ATTENDANCE.getMessage(), response)); + .body(ResponseDTO.success(ResponseMessage.SUCCESS_START_ATTENDANCE.getMessage(), response)); } private URI getURI(Long lectureId) { @@ -78,20 +78,20 @@ private URI getURI(Long lectureId) { @PatchMapping("/{lectureId}") public ResponseEntity endLecture(@PathVariable Long lectureId) { lectureService.endLecture(lectureId); - return ResponseEntity.ok(success(SUCCESS_UPDATE_MEMBER_SCORE.getMessage())); + return ResponseEntity.ok(ResponseDTO.success(ResponseMessage.SUCCESS_UPDATE_MEMBER_SCORE.getMessage())); } @ApiOperation(value = "세션 삭제") @DeleteMapping("/{lectureId}") public ResponseEntity deleteLecture(@PathVariable Long lectureId) { lectureService.deleteLecture(lectureId); - return ResponseEntity.ok(success(SUCCESS_DELETE_LECTURE.getMessage())); + return ResponseEntity.ok(ResponseDTO.success(ResponseMessage.SUCCESS_DELETE_LECTURE.getMessage())); } @ApiOperation(value = "세션 팝업용 상세 조회") @GetMapping("/detail/{lectureId}") public ResponseEntity getLectureDetail(@PathVariable Long lectureId) { val response = lectureService.getLectureDetail(lectureId); - return ResponseEntity.ok(success(SUCCESS_GET_LECTURE.getMessage(), response)); + return ResponseEntity.ok(ResponseDTO.success(ResponseMessage.SUCCESS_GET_LECTURE.getMessage(), response)); } } diff --git a/src/main/java/org/sopt/makers/operation/controller/web/MemberController.java b/operation-api/src/main/java/org/operation/web/MemberController.java similarity index 86% rename from src/main/java/org/sopt/makers/operation/controller/web/MemberController.java rename to operation-api/src/main/java/org/operation/web/MemberController.java index 2ae9b07a..75599f54 100644 --- a/src/main/java/org/sopt/makers/operation/controller/web/MemberController.java +++ b/operation-api/src/main/java/org/operation/web/MemberController.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.controller.web; +package org.operation.web; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; @@ -24,6 +24,6 @@ public class MemberController { public ResponseEntity getMemberList( @RequestParam(required = false) Part part, @RequestParam(required = false) Integer generation, Pageable pageable) { val memberList = memberService.getMemberList(part, generation, pageable); - return ResponseEntity.ok(ResponseDTO.success(SUCCESS_GET_MEMBERS.getMessage(), memberList)); + return ResponseEntity.ok(ResponseDTO.success(ResponseMessage.SUCCESS_GET_MEMBERS.getMessage(), memberList)); } } diff --git a/operation-auth/build.gradle b/operation-auth/build.gradle new file mode 100644 index 00000000..8fcc6037 --- /dev/null +++ b/operation-auth/build.gradle @@ -0,0 +1,16 @@ +tasks.named('bootJar') { + enabled = true +} + +tasks.named('jar') { + enabled = false +} + +dependencies { + implementation 'org.springframework.boot:spring-boot-starter-security' + + // jwt + implementation group: 'io.jsonwebtoken', name: 'jjwt-api', version: '0.11.2' + runtimeOnly group: 'io.jsonwebtoken', name: 'jjwt-impl', version: '0.11.2' + runtimeOnly group: 'io.jsonwebtoken', name: 'jjwt-jackson', version: '0.11.2' +} \ No newline at end of file diff --git a/operation-domain/build.gradle b/operation-domain/build.gradle new file mode 100644 index 00000000..1ebaba4d --- /dev/null +++ b/operation-domain/build.gradle @@ -0,0 +1,19 @@ +plugins { + id 'java' +} + +group = 'org.sopt.makers' +version = '0.0.1-SNAPSHOT' + +repositories { + mavenCentral() +} + +dependencies { + testImplementation platform('org.junit:junit-bom:5.9.1') + testImplementation 'org.junit.jupiter:junit-jupiter' +} + +test { + useJUnitPlatform() +} \ No newline at end of file diff --git a/operation-external/build.gradle b/operation-external/build.gradle new file mode 100644 index 00000000..1ebaba4d --- /dev/null +++ b/operation-external/build.gradle @@ -0,0 +1,19 @@ +plugins { + id 'java' +} + +group = 'org.sopt.makers' +version = '0.0.1-SNAPSHOT' + +repositories { + mavenCentral() +} + +dependencies { + testImplementation platform('org.junit:junit-bom:5.9.1') + testImplementation 'org.junit.jupiter:junit-jupiter' +} + +test { + useJUnitPlatform() +} \ No newline at end of file diff --git a/operation-storage/build.gradle b/operation-storage/build.gradle new file mode 100644 index 00000000..1ebaba4d --- /dev/null +++ b/operation-storage/build.gradle @@ -0,0 +1,19 @@ +plugins { + id 'java' +} + +group = 'org.sopt.makers' +version = '0.0.1-SNAPSHOT' + +repositories { + mavenCentral() +} + +dependencies { + testImplementation platform('org.junit:junit-bom:5.9.1') + testImplementation 'org.junit.jupiter:junit-jupiter' +} + +test { + useJUnitPlatform() +} \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index fbee0ab1..e0518269 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1,7 @@ rootProject.name = 'operation' +include 'operation-api' +include 'operation-auth' +include 'operation-domain' +include 'operation-external' +include 'operation-storage' + diff --git a/src/main/java/org/sopt/makers/operation/controller/HealthCheckController.java b/src/main/java/org/sopt/makers/operation/controller/HealthCheckController.java deleted file mode 100644 index 12bfd6af..00000000 --- a/src/main/java/org/sopt/makers/operation/controller/HealthCheckController.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.sopt.makers.operation.controller; - -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RestController; - -import springfox.documentation.annotations.ApiIgnore; - -@RestController -@ApiIgnore -public class HealthCheckController { - - @GetMapping("/") - public String healthCheck() { - return "Hello Operation!"; - } -} diff --git a/src/main/java/org/sopt/makers/operation/controller/app/AttendanceController.java b/src/main/java/org/sopt/makers/operation/controller/app/AttendanceController.java deleted file mode 100644 index 68efe68c..00000000 --- a/src/main/java/org/sopt/makers/operation/controller/app/AttendanceController.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.sopt.makers.operation.controller.app; - -import static java.util.Objects.*; -import static org.sopt.makers.operation.common.ResponseMessage.*; - -import io.swagger.annotations.ApiOperation; -import lombok.RequiredArgsConstructor; -import lombok.val; -import org.sopt.makers.operation.dto.ResponseDTO; -import org.sopt.makers.operation.dto.attendance.request.AttendRequestDTO; -import org.sopt.makers.operation.service.app.attendance.AttendanceService; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.*; -import springfox.documentation.annotations.ApiIgnore; - -import java.security.Principal; - -@RestController -@RequiredArgsConstructor -@RequestMapping("/api/v1/app/attendances") -public class AttendanceController { - private final AttendanceService attendanceService; - - @ApiOperation(value = "출석 하기") - @PostMapping("/attend") - public ResponseEntity attend(@RequestBody AttendRequestDTO requestDTO, @ApiIgnore Principal principal) { - val response = attendanceService.attend(getMemberId(principal), requestDTO); - return ResponseEntity.ok(ResponseDTO.success(SUCCESS_ATTEND.getMessage(), response)); - } - - private Long getMemberId(Principal principal) { - return nonNull(principal) ? Long.valueOf(principal.getName()) : null; - } -} From 0276f9d660f95425e7bc1db9bff597b9c1279786 Mon Sep 17 00:00:00 2001 From: thguss Date: Fri, 2 Feb 2024 01:07:35 +0900 Subject: [PATCH 038/141] =?UTF-8?q?[REFACTOR]=20=ED=8C=A8=ED=82=A4?= =?UTF-8?q?=EC=A7=80=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/operation/app/attendance/{ => api}/AttendanceApi.java | 2 +- .../app/attendance/{ => api}/AttendanceApiController.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename operation-api/src/main/java/org/operation/app/attendance/{ => api}/AttendanceApi.java (96%) rename operation-api/src/main/java/org/operation/app/attendance/{ => api}/AttendanceApiController.java (96%) diff --git a/operation-api/src/main/java/org/operation/app/attendance/AttendanceApi.java b/operation-api/src/main/java/org/operation/app/attendance/api/AttendanceApi.java similarity index 96% rename from operation-api/src/main/java/org/operation/app/attendance/AttendanceApi.java rename to operation-api/src/main/java/org/operation/app/attendance/api/AttendanceApi.java index 0c778234..fb967a0a 100644 --- a/operation-api/src/main/java/org/operation/app/attendance/AttendanceApi.java +++ b/operation-api/src/main/java/org/operation/app/attendance/api/AttendanceApi.java @@ -1,4 +1,4 @@ -package org.operation.app.attendance; +package org.operation.app.attendance.api; import java.security.Principal; diff --git a/operation-api/src/main/java/org/operation/app/attendance/AttendanceApiController.java b/operation-api/src/main/java/org/operation/app/attendance/api/AttendanceApiController.java similarity index 96% rename from operation-api/src/main/java/org/operation/app/attendance/AttendanceApiController.java rename to operation-api/src/main/java/org/operation/app/attendance/api/AttendanceApiController.java index e18e398e..0dca9d85 100644 --- a/operation-api/src/main/java/org/operation/app/attendance/AttendanceApiController.java +++ b/operation-api/src/main/java/org/operation/app/attendance/api/AttendanceApiController.java @@ -1,4 +1,4 @@ -package org.operation.app.attendance; +package org.operation.app.attendance.api; import static java.util.Objects.*; import static org.operation.app.attendance.message.SuccessMessage.*; From e33844ea20f3a3e8e4816960c22cf6e1ab990bab Mon Sep 17 00:00:00 2001 From: thguss Date: Fri, 2 Feb 2024 01:15:40 +0900 Subject: [PATCH 039/141] =?UTF-8?q?[ADD]=20=EB=A7=A4=ED=95=91=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/attendance/api/AttendanceApiController.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/operation-api/src/main/java/org/operation/app/attendance/api/AttendanceApiController.java b/operation-api/src/main/java/org/operation/app/attendance/api/AttendanceApiController.java index 0dca9d85..1c9e76a5 100644 --- a/operation-api/src/main/java/org/operation/app/attendance/api/AttendanceApiController.java +++ b/operation-api/src/main/java/org/operation/app/attendance/api/AttendanceApiController.java @@ -2,12 +2,14 @@ import static java.util.Objects.*; import static org.operation.app.attendance.message.SuccessMessage.*; +import static org.operation.common.dto.BaseResponse.*; import java.security.Principal; import org.operation.app.attendance.dto.request.AttendanceRequest; import org.operation.common.dto.BaseResponse; import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -22,10 +24,11 @@ public class AttendanceApiController implements AttendanceApi { // private final AttendanceService attendanceService; @Override + @PostMapping("/attend") public ResponseEntity> attend(@RequestBody AttendanceRequest request, Principal principal) { val memberId = getMemberId(principal); val response = memberId + ""; // attendanceService.attend(getMemberId(principal), requestDTO); - return ResponseEntity.ok(BaseResponse.success(SUCCESS_GET_ATTENDANCE.getMessage(), response)); + return ResponseEntity.ok(success(SUCCESS_GET_ATTENDANCE.getMessage(), response)); } private Long getMemberId(Principal principal) { From 01b4efa323a0b5b5bd51be9a91fdbb74e8b2f99f Mon Sep 17 00:00:00 2001 From: thguss Date: Fri, 2 Feb 2024 01:47:35 +0900 Subject: [PATCH 040/141] =?UTF-8?q?[FIX]=20=EA=B3=B5=ED=86=B5=EB=90=9C=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EC=B6=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../attendance/api/AttendanceApiController.java | 15 ++++++--------- .../app/attendance/message/SuccessMessage.java | 2 +- .../org/operation/common/dto/BaseResponse.java | 13 +++---------- .../operation/common/util/ApiResponseUtil.java | 15 +++++++++++++++ .../org/operation/common/util/CommonUtils.java | 14 ++++++++++++++ 5 files changed, 39 insertions(+), 20 deletions(-) create mode 100644 operation-api/src/main/java/org/operation/common/util/ApiResponseUtil.java create mode 100644 operation-api/src/main/java/org/operation/common/util/CommonUtils.java diff --git a/operation-api/src/main/java/org/operation/app/attendance/api/AttendanceApiController.java b/operation-api/src/main/java/org/operation/app/attendance/api/AttendanceApiController.java index 1c9e76a5..aaadc27a 100644 --- a/operation-api/src/main/java/org/operation/app/attendance/api/AttendanceApiController.java +++ b/operation-api/src/main/java/org/operation/app/attendance/api/AttendanceApiController.java @@ -1,12 +1,12 @@ package org.operation.app.attendance.api; -import static java.util.Objects.*; import static org.operation.app.attendance.message.SuccessMessage.*; -import static org.operation.common.dto.BaseResponse.*; import java.security.Principal; import org.operation.app.attendance.dto.request.AttendanceRequest; +import org.operation.common.util.CommonUtils; +import org.operation.common.util.ApiResponseUtil; import org.operation.common.dto.BaseResponse; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PostMapping; @@ -22,16 +22,13 @@ @RequestMapping("/api/v1/app/attendances") public class AttendanceApiController implements AttendanceApi { // private final AttendanceService attendanceService; + private final CommonUtils utils; @Override @PostMapping("/attend") public ResponseEntity> attend(@RequestBody AttendanceRequest request, Principal principal) { - val memberId = getMemberId(principal); - val response = memberId + ""; // attendanceService.attend(getMemberId(principal), requestDTO); - return ResponseEntity.ok(success(SUCCESS_GET_ATTENDANCE.getMessage(), response)); - } - - private Long getMemberId(Principal principal) { - return nonNull(principal) ? Long.valueOf(principal.getName()) : null; + val memberId = utils.getMemberId(principal); + val response = memberId + ""; // attendanceService.attend(memberId, requestDTO); + return ApiResponseUtil.ok(SUCCESS_GET_ATTENDANCE.getContent(), response); } } diff --git a/operation-api/src/main/java/org/operation/app/attendance/message/SuccessMessage.java b/operation-api/src/main/java/org/operation/app/attendance/message/SuccessMessage.java index 6930682c..b1e20d5c 100644 --- a/operation-api/src/main/java/org/operation/app/attendance/message/SuccessMessage.java +++ b/operation-api/src/main/java/org/operation/app/attendance/message/SuccessMessage.java @@ -9,5 +9,5 @@ public enum SuccessMessage { SUCCESS_GET_ATTENDANCE("출석 성공"), ; - private final String message; + private final String content; } diff --git a/operation-api/src/main/java/org/operation/common/dto/BaseResponse.java b/operation-api/src/main/java/org/operation/common/dto/BaseResponse.java index f99b455c..e0e97810 100644 --- a/operation-api/src/main/java/org/operation/common/dto/BaseResponse.java +++ b/operation-api/src/main/java/org/operation/common/dto/BaseResponse.java @@ -15,7 +15,7 @@ public record BaseResponse ( T data ) { - public static BaseResponse success(String message, T data) { + public static BaseResponse of(String message, T data) { return BaseResponse.builder() .success(true) .message(message) @@ -23,16 +23,9 @@ public static BaseResponse success(String message, T data) { .build(); } - public static BaseResponse success(String message) { + public static BaseResponse of(String message, boolean isSuccess) { return BaseResponse.builder() - .success(true) - .message(message) - .build(); - } - - public static BaseResponse fail(String message) { - return BaseResponse.builder() - .success(false) + .success(isSuccess) .message(message) .build(); } diff --git a/operation-api/src/main/java/org/operation/common/util/ApiResponseUtil.java b/operation-api/src/main/java/org/operation/common/util/ApiResponseUtil.java new file mode 100644 index 00000000..f0fd2a0e --- /dev/null +++ b/operation-api/src/main/java/org/operation/common/util/ApiResponseUtil.java @@ -0,0 +1,15 @@ +package org.operation.common.util; + +import org.operation.common.dto.BaseResponse; +import org.springframework.http.ResponseEntity; + +public interface ApiResponseUtil { + + static ResponseEntity> ok(String message, T data) { + return ResponseEntity.ok(BaseResponse.of(message, data)); + } + + static ResponseEntity> ok(String message) { + return ResponseEntity.ok(BaseResponse.of(message, true)); + } +} diff --git a/operation-api/src/main/java/org/operation/common/util/CommonUtils.java b/operation-api/src/main/java/org/operation/common/util/CommonUtils.java new file mode 100644 index 00000000..bb39aca5 --- /dev/null +++ b/operation-api/src/main/java/org/operation/common/util/CommonUtils.java @@ -0,0 +1,14 @@ +package org.operation.common.util; + +import static java.util.Objects.*; + +import java.security.Principal; + +import org.springframework.context.annotation.Configuration; + +@Configuration +public class CommonUtils { + public Long getMemberId(Principal principal) { + return nonNull(principal) ? Long.valueOf(principal.getName()) : null; + } +} From 687b86fe440532b769e8cc37172783b1c19200cd Mon Sep 17 00:00:00 2001 From: thguss Date: Fri, 2 Feb 2024 01:50:30 +0900 Subject: [PATCH 041/141] =?UTF-8?q?[ADD]=20NonNull=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/operation/app/attendance/api/AttendanceApi.java | 4 ++-- .../operation/app/attendance/api/AttendanceApiController.java | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/operation-api/src/main/java/org/operation/app/attendance/api/AttendanceApi.java b/operation-api/src/main/java/org/operation/app/attendance/api/AttendanceApi.java index fb967a0a..33e6d131 100644 --- a/operation-api/src/main/java/org/operation/app/attendance/api/AttendanceApi.java +++ b/operation-api/src/main/java/org/operation/app/attendance/api/AttendanceApi.java @@ -11,7 +11,7 @@ import io.swagger.v3.oas.annotations.parameters.RequestBody; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.tags.Tag; - +import lombok.NonNull; @Tag(name = "앱 출석 관련 API") public interface AttendanceApi { @@ -34,6 +34,6 @@ public interface AttendanceApi { ) ResponseEntity> attend( @RequestBody AttendanceRequest request, - @Parameter(hidden = true) Principal principal + @Parameter(hidden = true) @NonNull Principal principal ); } diff --git a/operation-api/src/main/java/org/operation/app/attendance/api/AttendanceApiController.java b/operation-api/src/main/java/org/operation/app/attendance/api/AttendanceApiController.java index aaadc27a..fbee053e 100644 --- a/operation-api/src/main/java/org/operation/app/attendance/api/AttendanceApiController.java +++ b/operation-api/src/main/java/org/operation/app/attendance/api/AttendanceApiController.java @@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import lombok.NonNull; import lombok.RequiredArgsConstructor; import lombok.val; @@ -26,7 +27,7 @@ public class AttendanceApiController implements AttendanceApi { @Override @PostMapping("/attend") - public ResponseEntity> attend(@RequestBody AttendanceRequest request, Principal principal) { + public ResponseEntity> attend(@RequestBody AttendanceRequest request, @NonNull Principal principal) { val memberId = utils.getMemberId(principal); val response = memberId + ""; // attendanceService.attend(memberId, requestDTO); return ApiResponseUtil.ok(SUCCESS_GET_ATTENDANCE.getContent(), response); From 8445911f0e6104bd47e89ed711085a46501dd4f3 Mon Sep 17 00:00:00 2001 From: thguss Date: Fri, 2 Feb 2024 01:52:29 +0900 Subject: [PATCH 042/141] =?UTF-8?q?[ADD]=20NonNull=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/operation/app/attendance/api/AttendanceApi.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/operation-api/src/main/java/org/operation/app/attendance/api/AttendanceApi.java b/operation-api/src/main/java/org/operation/app/attendance/api/AttendanceApi.java index 33e6d131..2bae383d 100644 --- a/operation-api/src/main/java/org/operation/app/attendance/api/AttendanceApi.java +++ b/operation-api/src/main/java/org/operation/app/attendance/api/AttendanceApi.java @@ -15,6 +15,7 @@ @Tag(name = "앱 출석 관련 API") public interface AttendanceApi { + @Operation( summary = "앱 출석 API", responses = { @@ -34,6 +35,5 @@ public interface AttendanceApi { ) ResponseEntity> attend( @RequestBody AttendanceRequest request, - @Parameter(hidden = true) @NonNull Principal principal - ); + @Parameter(hidden = true) @NonNull Principal principal); } From 1b1dfd879bc5ee11511fdebc4ada10f7131d498c Mon Sep 17 00:00:00 2001 From: thguss Date: Fri, 2 Feb 2024 02:25:49 +0900 Subject: [PATCH 043/141] =?UTF-8?q?[REFACTOR]=20operation-api=20=EB=AA=A8?= =?UTF-8?q?=EB=93=88=20=EB=B6=84=EB=A6=AC=20:=20=EC=95=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/operation/app/LectureController.java | 37 --------- .../org/operation/app/MemberController.java | 42 ----------- .../org/operation/app/ScheduleController.java | 32 -------- .../app/attendance/api/AttendanceApi.java | 8 +- .../api/AttendanceApiController.java | 2 +- .../dto/{request => }/AttendanceRequest.java | 2 +- .../org/operation/app/lecture/LectureApi.java | 9 --- .../app/lecture/LectureApiController.java | 29 ------- .../operation/app/lecture/api/LectureApi.java | 59 +++++++++++++++ .../app/lecture/api/LectureApiController.java | 42 +++++++++++ .../app/lecture/message/SuccessMessage.java | 14 ++++ .../operation/app/member/api/MemberApi.java | 58 ++++++++++++++ .../app/member/api/MemberApiController.java | 42 +++++++++++ .../app/member/message/SuccessMessage.java | 14 ++++ .../app/schedule/api/ScheduleApi.java | 37 +++++++++ .../schedule/api/ScheduleApiController.java | 35 +++++++++ .../app/schedule/message/SuccessMessage.java | 13 ++++ .../common/config/SwaggerConfig.java | 31 ++++++++ .../operation/common/util/CommonUtils.java | 8 +- .../operation/OperationServerApplication.java | 13 ---- .../operation/common/ResponseMessage.java | 71 +++++++----------- .../operation/config/SwaggerConfig.java | 75 ------------------- .../makers/operation/dto/ResponseDTO.java | 20 ----- .../attendance/request/AttendRequestDTO.java | 7 -- .../operation/handler/ErrorHandler.java | 1 - .../security/jwt/JwtExceptionFilter.java | 1 - .../app/attendance/AttendanceService.java | 6 -- .../app/attendance/AttendanceServiceImpl.java | 1 - 28 files changed, 384 insertions(+), 325 deletions(-) delete mode 100644 operation-api/src/main/java/org/operation/app/LectureController.java delete mode 100644 operation-api/src/main/java/org/operation/app/MemberController.java delete mode 100644 operation-api/src/main/java/org/operation/app/ScheduleController.java rename operation-api/src/main/java/org/operation/app/attendance/dto/{request => }/AttendanceRequest.java (63%) delete mode 100644 operation-api/src/main/java/org/operation/app/lecture/LectureApi.java delete mode 100644 operation-api/src/main/java/org/operation/app/lecture/LectureApiController.java create mode 100644 operation-api/src/main/java/org/operation/app/lecture/api/LectureApi.java create mode 100644 operation-api/src/main/java/org/operation/app/lecture/api/LectureApiController.java create mode 100644 operation-api/src/main/java/org/operation/app/lecture/message/SuccessMessage.java create mode 100644 operation-api/src/main/java/org/operation/app/member/api/MemberApi.java create mode 100644 operation-api/src/main/java/org/operation/app/member/api/MemberApiController.java create mode 100644 operation-api/src/main/java/org/operation/app/member/message/SuccessMessage.java create mode 100644 operation-api/src/main/java/org/operation/app/schedule/api/ScheduleApi.java create mode 100644 operation-api/src/main/java/org/operation/app/schedule/api/ScheduleApiController.java create mode 100644 operation-api/src/main/java/org/operation/app/schedule/message/SuccessMessage.java create mode 100644 operation-api/src/main/java/org/operation/common/config/SwaggerConfig.java delete mode 100644 src/main/java/org/sopt/makers/operation/OperationServerApplication.java delete mode 100644 src/main/java/org/sopt/makers/operation/config/SwaggerConfig.java delete mode 100644 src/main/java/org/sopt/makers/operation/dto/ResponseDTO.java delete mode 100644 src/main/java/org/sopt/makers/operation/dto/attendance/request/AttendRequestDTO.java diff --git a/operation-api/src/main/java/org/operation/app/LectureController.java b/operation-api/src/main/java/org/operation/app/LectureController.java deleted file mode 100644 index 36bd94b8..00000000 --- a/operation-api/src/main/java/org/operation/app/LectureController.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.operation.app; - -import static org.sopt.makers.operation.common.ResponseMessage.*; - -import io.swagger.annotations.ApiOperation; -import lombok.RequiredArgsConstructor; -import lombok.val; -import org.sopt.makers.operation.dto.ResponseDTO; -import org.sopt.makers.operation.service.app.lecture.LectureService; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.*; -import springfox.documentation.annotations.ApiIgnore; - -import java.security.Principal; - -@RestController -@RequiredArgsConstructor -@RequestMapping("/api/v1/app/lectures") -public class LectureController { - - private final LectureService lectureService; - - @ApiOperation(value = "진행 중인 세미나 상태 조회") - @GetMapping - public ResponseEntity getLecture(@ApiIgnore Principal principal) { - val memberPlaygroundId = Long.parseLong(principal.getName()); - val response = lectureService.getTodayLecture(memberPlaygroundId); - return ResponseEntity.ok(ResponseDTO.success(ResponseMessage.SUCCESS_SINGLE_GET_LECTURE.getMessage(), response)); - } - - @ApiOperation(value = "출석 차수 조회") - @GetMapping("/round/{lectureId}") - public ResponseEntity getRound(@PathVariable("lectureId") Long lectureId) { - val response = lectureService.getCurrentLectureRound(lectureId); - return ResponseEntity.ok(ResponseDTO.success(ResponseMessage.SUCCESS_GET_LECTURE_ROUND.getMessage(), response)); - } -} diff --git a/operation-api/src/main/java/org/operation/app/MemberController.java b/operation-api/src/main/java/org/operation/app/MemberController.java deleted file mode 100644 index 72044096..00000000 --- a/operation-api/src/main/java/org/operation/app/MemberController.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.operation.app; - -import io.swagger.annotations.ApiOperation; -import lombok.RequiredArgsConstructor; -import lombok.val; -import org.sopt.makers.operation.dto.ResponseDTO; -import org.sopt.makers.operation.service.app.member.MemberService; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import springfox.documentation.annotations.ApiIgnore; - -import java.security.Principal; - -import static java.util.Objects.nonNull; -import static org.sopt.makers.operation.common.ResponseMessage.*; - -@RestController -@RequiredArgsConstructor -@RequestMapping("/api/v1/app/members") -public class MemberController { - private final MemberService memberService; - - @ApiOperation(value = "전체 출석 정보 조회") - @GetMapping("/attendances") - public ResponseEntity getMemberTotalAttendance(@ApiIgnore Principal principal) { - val response = memberService.getMemberTotalAttendance(getMemberId(principal)); - return ResponseEntity.ok(ResponseDTO.success(ResponseMessage.SUCCESS_TOTAL_ATTENDANCE.getMessage(), response)); - } - - @ApiOperation(value = "출석 점수 조회") - @GetMapping("/score") - public ResponseEntity getScore(@ApiIgnore Principal principal) { - val response = memberService.getMemberScore(getMemberId(principal)); - return ResponseEntity.ok(ResponseDTO.success(ResponseMessage.SUCCESS_GET_ATTENDANCE_SCORE.getMessage(), response)); - } - - private Long getMemberId(Principal principal) { - return nonNull(principal) ? Long.valueOf(principal.getName()) : null; - } -} diff --git a/operation-api/src/main/java/org/operation/app/ScheduleController.java b/operation-api/src/main/java/org/operation/app/ScheduleController.java deleted file mode 100644 index 50d5d0f8..00000000 --- a/operation-api/src/main/java/org/operation/app/ScheduleController.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.operation.app; - -import io.swagger.annotations.ApiOperation; -import lombok.RequiredArgsConstructor; -import lombok.val; -import org.sopt.makers.operation.dto.ResponseDTO; -import org.sopt.makers.operation.service.app.schedule.ScheduleService; -import org.springframework.format.annotation.DateTimeFormat; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.*; - -import java.time.LocalDateTime; - -import static org.sopt.makers.operation.dto.ResponseDTO.success; -import static org.sopt.makers.operation.common.ResponseMessage.*; - -@RestController -@RequiredArgsConstructor -@RequestMapping("/api/v1/app/schedules") -public class ScheduleController { - private final ScheduleService scheduleService; - - @ApiOperation("일정 리스트 조회") - @GetMapping - public ResponseEntity getAlarms( - @RequestParam @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDateTime start, - @RequestParam @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDateTime end - ) { - val response = scheduleService.getSchedules(start, end); - return ResponseEntity.ok(ResponseDTO.success(ResponseMessage.SUCCESS_GET_SCHEDULES.getMessage(), response)); - } -} diff --git a/operation-api/src/main/java/org/operation/app/attendance/api/AttendanceApi.java b/operation-api/src/main/java/org/operation/app/attendance/api/AttendanceApi.java index 2bae383d..f7930256 100644 --- a/operation-api/src/main/java/org/operation/app/attendance/api/AttendanceApi.java +++ b/operation-api/src/main/java/org/operation/app/attendance/api/AttendanceApi.java @@ -2,7 +2,7 @@ import java.security.Principal; -import org.operation.app.attendance.dto.request.AttendanceRequest; +import org.operation.app.attendance.dto.AttendanceRequest; import org.operation.common.dto.BaseResponse; import org.springframework.http.ResponseEntity; @@ -10,6 +10,7 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.parameters.RequestBody; import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.NonNull; @@ -17,15 +18,16 @@ public interface AttendanceApi { @Operation( + security = @SecurityRequirement(name = "Authorization"), summary = "앱 출석 API", responses = { @ApiResponse( responseCode = "200", - description = "출석에 성공했습니다." + description = "출석 성공" ), @ApiResponse( responseCode = "400", - description = "출석에 실패했습니다." + description = "잘못된 요청" ), @ApiResponse( responseCode = "500", diff --git a/operation-api/src/main/java/org/operation/app/attendance/api/AttendanceApiController.java b/operation-api/src/main/java/org/operation/app/attendance/api/AttendanceApiController.java index fbee053e..e9fcb107 100644 --- a/operation-api/src/main/java/org/operation/app/attendance/api/AttendanceApiController.java +++ b/operation-api/src/main/java/org/operation/app/attendance/api/AttendanceApiController.java @@ -4,7 +4,7 @@ import java.security.Principal; -import org.operation.app.attendance.dto.request.AttendanceRequest; +import org.operation.app.attendance.dto.AttendanceRequest; import org.operation.common.util.CommonUtils; import org.operation.common.util.ApiResponseUtil; import org.operation.common.dto.BaseResponse; diff --git a/operation-api/src/main/java/org/operation/app/attendance/dto/request/AttendanceRequest.java b/operation-api/src/main/java/org/operation/app/attendance/dto/AttendanceRequest.java similarity index 63% rename from operation-api/src/main/java/org/operation/app/attendance/dto/request/AttendanceRequest.java rename to operation-api/src/main/java/org/operation/app/attendance/dto/AttendanceRequest.java index 2f7dbe86..c0e49bd3 100644 --- a/operation-api/src/main/java/org/operation/app/attendance/dto/request/AttendanceRequest.java +++ b/operation-api/src/main/java/org/operation/app/attendance/dto/AttendanceRequest.java @@ -1,4 +1,4 @@ -package org.operation.app.attendance.dto.request; +package org.operation.app.attendance.dto; public record AttendanceRequest( Long subLectureId, diff --git a/operation-api/src/main/java/org/operation/app/lecture/LectureApi.java b/operation-api/src/main/java/org/operation/app/lecture/LectureApi.java deleted file mode 100644 index e61a5228..00000000 --- a/operation-api/src/main/java/org/operation/app/lecture/LectureApi.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.operation.app.lecture; - -import org.springframework.http.ResponseEntity; - -import io.swagger.v3.oas.annotations.tags.Tag; - -@Tag(name = "앱 출석 관련 API") -public interface AttendanceApi { -} diff --git a/operation-api/src/main/java/org/operation/app/lecture/LectureApiController.java b/operation-api/src/main/java/org/operation/app/lecture/LectureApiController.java deleted file mode 100644 index b7a9b1fe..00000000 --- a/operation-api/src/main/java/org/operation/app/lecture/LectureApiController.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.operation.app.lecture; - -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import lombok.RequiredArgsConstructor; - -@RestController -@RequiredArgsConstructor -@RequestMapping("/api/v1/app/lectures") -public class LectureApiController implements AttendanceApi { - // - // private final LectureService lectureService; - // - // @ApiOperation(value = "진행 중인 세미나 상태 조회") - // @GetMapping - // public ResponseEntity getLecture(@ApiIgnore Principal principal) { - // val memberPlaygroundId = Long.parseLong(principal.getName()); - // val response = lectureService.getTodayLecture(memberPlaygroundId); - // return ResponseEntity.ok(ResponseDTO.success(ResponseMessage.SUCCESS_SINGLE_GET_LECTURE.getMessage(), response)); - // } - // - // @ApiOperation(value = "출석 차수 조회") - // @GetMapping("/round/{lectureId}") - // public ResponseEntity getRound(@PathVariable("lectureId") Long lectureId) { - // val response = lectureService.getCurrentLectureRound(lectureId); - // return ResponseEntity.ok(ResponseDTO.success(ResponseMessage.SUCCESS_GET_LECTURE_ROUND.getMessage(), response)); - // } -} diff --git a/operation-api/src/main/java/org/operation/app/lecture/api/LectureApi.java b/operation-api/src/main/java/org/operation/app/lecture/api/LectureApi.java new file mode 100644 index 00000000..42e8b826 --- /dev/null +++ b/operation-api/src/main/java/org/operation/app/lecture/api/LectureApi.java @@ -0,0 +1,59 @@ +package org.operation.app.lecture.api; + +import java.security.Principal; + +import org.operation.common.dto.BaseResponse; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.PathVariable; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.NonNull; + +@Tag(name = "앱 세션 관련 API") +public interface LectureApi { + + @Operation( + security = @SecurityRequirement(name = "Authorization"), + summary = "앱 내 진행 중인 세션 조회 API", + responses = { + @ApiResponse( + responseCode = "200", + description = "진행 중인 세션 조회 성공" + ), + @ApiResponse( + responseCode = "400", + description = "잘못된 요청" + ), + @ApiResponse( + responseCode = "500", + description = "서버 내부 오류" + ) + } + ) + ResponseEntity> getTodayLecture( + @Parameter(hidden = true) @NonNull Principal principal); + + @Operation( + security = @SecurityRequirement(name = "Authorization"), + summary = "앱 내 출석 차수 조회 API", + responses = { + @ApiResponse( + responseCode = "200", + description = "출석 차수 조회 성공" + ), + @ApiResponse( + responseCode = "400", + description = "잘못된 요청" + ), + @ApiResponse( + responseCode = "500", + description = "서버 내부 오류" + ) + } + ) + ResponseEntity> getRound(@PathVariable long lectureId); +} diff --git a/operation-api/src/main/java/org/operation/app/lecture/api/LectureApiController.java b/operation-api/src/main/java/org/operation/app/lecture/api/LectureApiController.java new file mode 100644 index 00000000..2b939857 --- /dev/null +++ b/operation-api/src/main/java/org/operation/app/lecture/api/LectureApiController.java @@ -0,0 +1,42 @@ +package org.operation.app.lecture.api; + +import static org.operation.app.lecture.message.SuccessMessage.*; + +import java.security.Principal; + +import org.operation.common.dto.BaseResponse; +import org.operation.common.util.ApiResponseUtil; +import org.operation.common.util.CommonUtils; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import lombok.NonNull; +import lombok.RequiredArgsConstructor; +import lombok.val; + +@RestController +@RequiredArgsConstructor +@RequestMapping("/api/v1/app/lectures") +public class LectureApiController implements LectureApi { + + // private final LectureService lectureService; + private final CommonUtils utils; + + @Override + @GetMapping + public ResponseEntity> getTodayLecture(@NonNull Principal principal) { + val memberId = Long.parseLong(principal.getName()); + val response = ""; // lectureService.getTodayLecture(memberId); + return ApiResponseUtil.ok(SUCCESS_SINGLE_GET_LECTURE.getContent(), response); + } + + @Override + @GetMapping("/round/{lectureId}") + public ResponseEntity> getRound(@PathVariable long lectureId) { + val response = ""; // lectureService.getCurrentLectureRound(lectureId); + return ApiResponseUtil.ok(SUCCESS_GET_LECTURE_ROUND.getContent(), response); + } +} diff --git a/operation-api/src/main/java/org/operation/app/lecture/message/SuccessMessage.java b/operation-api/src/main/java/org/operation/app/lecture/message/SuccessMessage.java new file mode 100644 index 00000000..2790fa80 --- /dev/null +++ b/operation-api/src/main/java/org/operation/app/lecture/message/SuccessMessage.java @@ -0,0 +1,14 @@ +package org.operation.app.lecture.message; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public enum SuccessMessage { + SUCCESS_SINGLE_GET_LECTURE("세션 조회 성공"), + SUCCESS_GET_LECTURE_ROUND("출석 차수 조회 성공"), + ; + + private final String content; +} diff --git a/operation-api/src/main/java/org/operation/app/member/api/MemberApi.java b/operation-api/src/main/java/org/operation/app/member/api/MemberApi.java new file mode 100644 index 00000000..2fef1e53 --- /dev/null +++ b/operation-api/src/main/java/org/operation/app/member/api/MemberApi.java @@ -0,0 +1,58 @@ +package org.operation.app.member.api; + +import java.security.Principal; + +import org.operation.common.dto.BaseResponse; +import org.springframework.http.ResponseEntity; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import lombok.NonNull; +import lombok.val; + +public interface MemberApi { + + @Operation( + security = @SecurityRequirement(name = "Authorization"), + summary = "앱 내 전체 출석 정보 조회 API", + responses = { + @ApiResponse( + responseCode = "200", + description = "전체 출석 정보 조회 성공" + ), + @ApiResponse( + responseCode = "400", + description = "잘못된 요청" + ), + @ApiResponse( + responseCode = "500", + description = "서버 내부 오류" + ) + } + ) + ResponseEntity> getMemberTotalAttendance( + @Parameter(hidden = true) @NonNull Principal principal); + + @Operation( + security = @SecurityRequirement(name = "Authorization"), + summary = "앱 내 출석 점수 조회 API", + responses = { + @ApiResponse( + responseCode = "200", + description = "출석 점수 조회 성공" + ), + @ApiResponse( + responseCode = "400", + description = "잘못된 요청" + ), + @ApiResponse( + responseCode = "500", + description = "서버 내부 오류" + ) + } + ) + ResponseEntity> getScore( + @Parameter(hidden = true) @NonNull Principal principal); +} diff --git a/operation-api/src/main/java/org/operation/app/member/api/MemberApiController.java b/operation-api/src/main/java/org/operation/app/member/api/MemberApiController.java new file mode 100644 index 00000000..5b3b41b5 --- /dev/null +++ b/operation-api/src/main/java/org/operation/app/member/api/MemberApiController.java @@ -0,0 +1,42 @@ +package org.operation.app.member.api; + +import static org.operation.app.member.message.SuccessMessage.*; + +import java.security.Principal; + +import org.operation.common.dto.BaseResponse; +import org.operation.common.util.ApiResponseUtil; +import org.operation.common.util.CommonUtils; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import lombok.NonNull; +import lombok.RequiredArgsConstructor; +import lombok.val; + +@RestController +@RequiredArgsConstructor +@RequestMapping("/api/v1/app/members") +public class MemberApiController implements MemberApi { + + // private final MemberService memberService; + private CommonUtils utils; + + @Override + @GetMapping("/attendances") + public ResponseEntity> getMemberTotalAttendance(@NonNull Principal principal) { + val memberId = utils.getMemberId(principal); + val response = ""; // memberService.getMemberTotalAttendance(memberId); + return ApiResponseUtil.ok(SUCCESS_TOTAL_ATTENDANCE.getContent(), response); + } + + @Override + @GetMapping("/score") + public ResponseEntity> getScore(@NonNull Principal principal) { + val memberId = utils.getMemberId(principal); + val response = ""; // memberService.getMemberScore(memberId); + return ApiResponseUtil.ok(SUCCESS_GET_ATTENDANCE_SCORE.getContent(), response); + } +} diff --git a/operation-api/src/main/java/org/operation/app/member/message/SuccessMessage.java b/operation-api/src/main/java/org/operation/app/member/message/SuccessMessage.java new file mode 100644 index 00000000..fb495b9c --- /dev/null +++ b/operation-api/src/main/java/org/operation/app/member/message/SuccessMessage.java @@ -0,0 +1,14 @@ +package org.operation.app.member.message; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public enum SuccessMessage { + SUCCESS_TOTAL_ATTENDANCE("전체 출석 정보 조회 성공"), + SUCCESS_GET_ATTENDANCE_SCORE("출석 점수 조회 성공"), + ; + + private final String content; +} diff --git a/operation-api/src/main/java/org/operation/app/schedule/api/ScheduleApi.java b/operation-api/src/main/java/org/operation/app/schedule/api/ScheduleApi.java new file mode 100644 index 00000000..82153825 --- /dev/null +++ b/operation-api/src/main/java/org/operation/app/schedule/api/ScheduleApi.java @@ -0,0 +1,37 @@ +package org.operation.app.schedule.api; + +import java.time.LocalDateTime; + +import org.operation.common.dto.BaseResponse; +import org.springframework.format.annotation.DateTimeFormat; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.RequestParam; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; + +public interface ScheduleApi { + + @Operation( + security = @SecurityRequirement(name = "Authorization"), + summary = "앱 내 일정 리스트 조회 API", + responses = { + @ApiResponse( + responseCode = "200", + description = "일정 리스트 조회 성공" + ), + @ApiResponse( + responseCode = "400", + description = "잘못된 요청" + ), + @ApiResponse( + responseCode = "500", + description = "서버 내부 오류" + ) + } + ) + ResponseEntity> getSchedules( + @RequestParam @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDateTime start, + @RequestParam @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDateTime end); +} diff --git a/operation-api/src/main/java/org/operation/app/schedule/api/ScheduleApiController.java b/operation-api/src/main/java/org/operation/app/schedule/api/ScheduleApiController.java new file mode 100644 index 00000000..412e34d4 --- /dev/null +++ b/operation-api/src/main/java/org/operation/app/schedule/api/ScheduleApiController.java @@ -0,0 +1,35 @@ +package org.operation.app.schedule.api; + +import static org.operation.app.schedule.message.SuccessMessage.*; + +import java.time.LocalDateTime; + +import org.operation.common.dto.BaseResponse; +import org.operation.common.util.ApiResponseUtil; +import org.springframework.format.annotation.DateTimeFormat; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import lombok.RequiredArgsConstructor; +import lombok.val; + +@RestController +@RequiredArgsConstructor +@RequestMapping("/api/v1/app/schedules") +public class ScheduleApiController implements ScheduleApi { + + // private final ScheduleService scheduleService; + + @Override + @GetMapping + public ResponseEntity> getSchedules( + @RequestParam @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDateTime start, + @RequestParam @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDateTime end + ) { + val response = ""; // scheduleService.getSchedules(start, end); + return ApiResponseUtil.ok(SUCCESS_GET_SCHEDULES.getContent(), response); + } +} diff --git a/operation-api/src/main/java/org/operation/app/schedule/message/SuccessMessage.java b/operation-api/src/main/java/org/operation/app/schedule/message/SuccessMessage.java new file mode 100644 index 00000000..659e1e08 --- /dev/null +++ b/operation-api/src/main/java/org/operation/app/schedule/message/SuccessMessage.java @@ -0,0 +1,13 @@ +package org.operation.app.schedule.message; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public enum SuccessMessage { + SUCCESS_GET_SCHEDULES("일정 리스트 조회 성공") + ; + + private final String content; +} diff --git a/operation-api/src/main/java/org/operation/common/config/SwaggerConfig.java b/operation-api/src/main/java/org/operation/common/config/SwaggerConfig.java new file mode 100644 index 00000000..ae1be08c --- /dev/null +++ b/operation-api/src/main/java/org/operation/common/config/SwaggerConfig.java @@ -0,0 +1,31 @@ +package org.operation.common.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import io.swagger.v3.oas.annotations.enums.SecuritySchemeIn; +import io.swagger.v3.oas.annotations.enums.SecuritySchemeType; +import io.swagger.v3.oas.annotations.security.SecurityScheme; +import io.swagger.v3.oas.models.OpenAPI; +import io.swagger.v3.oas.models.info.Info; + +@SecurityScheme( + name = "Authorization", + type = SecuritySchemeType.HTTP, + in = SecuritySchemeIn.HEADER, + bearerFormat = "JWT", + scheme = "Bearer" +) +@Configuration +public class SwaggerConfig { + + @Bean + public OpenAPI api() { + Info info = new Info() + .title("SOPT Makers API Docs") + .version("v1.0.0") + .description("SOPT Makers API 명세서"); + return new OpenAPI() + .info(info); + } +} diff --git a/operation-api/src/main/java/org/operation/common/util/CommonUtils.java b/operation-api/src/main/java/org/operation/common/util/CommonUtils.java index bb39aca5..00a87c4c 100644 --- a/operation-api/src/main/java/org/operation/common/util/CommonUtils.java +++ b/operation-api/src/main/java/org/operation/common/util/CommonUtils.java @@ -1,14 +1,14 @@ package org.operation.common.util; -import static java.util.Objects.*; - import java.security.Principal; import org.springframework.context.annotation.Configuration; +import lombok.NonNull; + @Configuration public class CommonUtils { - public Long getMemberId(Principal principal) { - return nonNull(principal) ? Long.valueOf(principal.getName()) : null; + public long getMemberId(@NonNull Principal principal) { + return Long.parseLong(principal.getName()); } } diff --git a/src/main/java/org/sopt/makers/operation/OperationServerApplication.java b/src/main/java/org/sopt/makers/operation/OperationServerApplication.java deleted file mode 100644 index 432aa9b8..00000000 --- a/src/main/java/org/sopt/makers/operation/OperationServerApplication.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.sopt.makers.operation; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication -public class OperationServerApplication { - - public static void main(String[] args) { - SpringApplication.run(OperationServerApplication.class, args); - } - -} diff --git a/src/main/java/org/sopt/makers/operation/common/ResponseMessage.java b/src/main/java/org/sopt/makers/operation/common/ResponseMessage.java index b40126da..601e7474 100644 --- a/src/main/java/org/sopt/makers/operation/common/ResponseMessage.java +++ b/src/main/java/org/sopt/makers/operation/common/ResponseMessage.java @@ -1,49 +1,34 @@ package org.sopt.makers.operation.common; -import lombok.Getter; -import lombok.RequiredArgsConstructor; -@Getter -@RequiredArgsConstructor public enum ResponseMessage { + // + // /** auth **/ + // SUCCESS_SIGN_UP("회원 가입 성공"), + // SUCCESS_LOGIN_UP("로그인 성공"), + // SUCCESS_GET_REFRESH_TOKEN("토큰 재발급 성공"), + // + // SUCCESS_CREATE_MEMBER("회원 등록 성공"), + // + // /** attendance **/ + // SUCCESS_UPDATE_ATTENDANCE_STATUS("출석 상태 변경 성공"), + // SUCCESS_GET_MEMBER_ATTENDANCE("회원 출석 정보 조회 성공"), + // SUCCESS_UPDATE_MEMBER_SCORE("회원 출석 점수 갱신 성공"), + // SUCCESS_GET_ATTENDANCES("출석 리스트 조회 성공"), + // + // /** lecture **/ + // SUCCESS_CREATE_LECTURE("세션 생성 성공"), + // SUCCESS_GET_LECTURES("세션 리스트 조회 성공"), + // SUCCESS_GET_LECTURE("세션 상세 조회 성공"), + // SUCCESS_START_ATTENDANCE("출석 시작 성공"), + // SUCCESS_GET_MEMBERS("유저 리스트 조회 성공"), + // SUCCESS_DELETE_LECTURE("세션 삭제 성공"), + // + // /** alarm **/ + // SUCCESS_SEND_ALARM("알림 전송 성공"), + // SUCCESS_CREATE_ALARM("알림 생성 성공"), + // SUCCESS_GET_ALARMS("알림 리스트 조회 성공"), + // SUCCESS_GET_ALARM("알림 상세 조회 성공"), + // SUCCESS_DELETE_ALARM("알림 삭제 성공"), - /** auth **/ - SUCCESS_SIGN_UP("회원 가입 성공"), - SUCCESS_LOGIN_UP("로그인 성공"), - SUCCESS_GET_REFRESH_TOKEN("토큰 재발급 성공"), - - /** app **/ - SUCCESS_SINGLE_GET_LECTURE("세션 조회 성공"), - SUCCESS_TOTAL_ATTENDANCE("전체 출석정보 조회 성공"), - SUCCESS_GET_ATTENDANCE_SCORE("출석 점수 조회 성공"), - SUCCESS_GET_LECTURE_ROUND("출석 차수 조회 성공"), - SUCCESS_ATTEND("출석 성공"), - SUCCESS_CREATE_MEMBER("회원 등록 성공"), - - /** attendance **/ - SUCCESS_UPDATE_ATTENDANCE_STATUS("출석 상태 변경 성공"), - SUCCESS_GET_MEMBER_ATTENDANCE("회원 출석 정보 조회 성공"), - SUCCESS_UPDATE_MEMBER_SCORE("회원 출석 점수 갱신 성공"), - SUCCESS_GET_ATTENDANCES("출석 리스트 조회 성공"), - - /** lecture **/ - SUCCESS_CREATE_LECTURE("세션 생성 성공"), - SUCCESS_GET_LECTURES("세션 리스트 조회 성공"), - SUCCESS_GET_LECTURE("세션 상세 조회 성공"), - SUCCESS_START_ATTENDANCE("출석 시작 성공"), - SUCCESS_GET_MEMBERS("유저 리스트 조회 성공"), - SUCCESS_DELETE_LECTURE("세션 삭제 성공"), - - /** alarm **/ - SUCCESS_SEND_ALARM("알림 전송 성공"), - SUCCESS_CREATE_ALARM("알림 생성 성공"), - SUCCESS_GET_ALARMS("알림 리스트 조회 성공"), - SUCCESS_GET_ALARM("알림 상세 조회 성공"), - SUCCESS_DELETE_ALARM("알림 삭제 성공"), - - /** schedule **/ - SUCCESS_GET_SCHEDULES("일정 리스트 조회 성공") - ; - - private final String message; } diff --git a/src/main/java/org/sopt/makers/operation/config/SwaggerConfig.java b/src/main/java/org/sopt/makers/operation/config/SwaggerConfig.java deleted file mode 100644 index 626fc3ec..00000000 --- a/src/main/java/org/sopt/makers/operation/config/SwaggerConfig.java +++ /dev/null @@ -1,75 +0,0 @@ -package org.sopt.makers.operation.config; - -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.web.servlet.config.annotation.EnableWebMvc; - -import springfox.documentation.builders.ApiInfoBuilder; -import springfox.documentation.builders.PathSelectors; -import springfox.documentation.builders.RequestHandlerSelectors; -import springfox.documentation.service.ApiInfo; -import springfox.documentation.service.ApiKey; -import springfox.documentation.service.AuthorizationScope; -import springfox.documentation.service.SecurityReference; -import springfox.documentation.spi.DocumentationType; -import springfox.documentation.spi.service.contexts.SecurityContext; -import springfox.documentation.spring.web.plugins.Docket; -import springfox.documentation.swagger2.annotations.EnableSwagger2; - -@Configuration -@EnableSwagger2 -@EnableWebMvc -public class SwaggerConfig { - - private ApiInfo swaggerInfo() { - return new ApiInfoBuilder().title("Makers Operation API") - .description("Makers Operation API Docs").build(); - } - - @Bean - public Docket swaggerApi() { - return new Docket(DocumentationType.SWAGGER_2) - .securityContexts(List.of(securityContext())) - .securitySchemes(List.of(apiKey())) - .consumes(getConsumeContentTypes()) - .produces(getProduceContentTypes()) - .apiInfo(swaggerInfo()).select() - .apis(RequestHandlerSelectors.basePackage("org.sopt.makers.operation.controller")) - .paths(PathSelectors.any()) - .build() - .useDefaultResponseMessages(false); - } - - private Set getConsumeContentTypes() { - Set consumes = new HashSet<>(); - consumes.add("application/json"); - return consumes; - } - - private Set getProduceContentTypes() { - Set produces = new HashSet<>(); - produces.add("application/json"); - return produces; - } - - private SecurityContext securityContext() { - return SecurityContext.builder() - .securityReferences(defaultAuth()) - .build(); - } - - private List defaultAuth() { - AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything"); - AuthorizationScope[] authorizationScopes = new AuthorizationScope[1]; - authorizationScopes[0] = authorizationScope; - return List.of(new SecurityReference("Authorization", authorizationScopes)); - } - - private ApiKey apiKey() { - return new ApiKey("Authorization", "Authorization", "header"); - } -} diff --git a/src/main/java/org/sopt/makers/operation/dto/ResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/ResponseDTO.java deleted file mode 100644 index 116064db..00000000 --- a/src/main/java/org/sopt/makers/operation/dto/ResponseDTO.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.sopt.makers.operation.dto; - -public record ResponseDTO( - boolean success, - String message, - Object data -) { - - public static ResponseDTO success(String message, Object data) { - return new ResponseDTO(true, message, data); - } - - public static ResponseDTO success(String message) { - return new ResponseDTO(true, message, null); - } - - public static ResponseDTO fail(String message) { - return new ResponseDTO(false, message, null); - } -} diff --git a/src/main/java/org/sopt/makers/operation/dto/attendance/request/AttendRequestDTO.java b/src/main/java/org/sopt/makers/operation/dto/attendance/request/AttendRequestDTO.java deleted file mode 100644 index 4a8acb10..00000000 --- a/src/main/java/org/sopt/makers/operation/dto/attendance/request/AttendRequestDTO.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.sopt.makers.operation.dto.attendance.request; - -public record AttendRequestDTO( - Long subLectureId, - String code -) { -} diff --git a/src/main/java/org/sopt/makers/operation/handler/ErrorHandler.java b/src/main/java/org/sopt/makers/operation/handler/ErrorHandler.java index b734ec8e..0532a1fa 100644 --- a/src/main/java/org/sopt/makers/operation/handler/ErrorHandler.java +++ b/src/main/java/org/sopt/makers/operation/handler/ErrorHandler.java @@ -6,7 +6,6 @@ import java.time.format.DateTimeParseException; -import org.sopt.makers.operation.dto.ResponseDTO; import org.sopt.makers.operation.exception.*; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.ExceptionHandler; diff --git a/src/main/java/org/sopt/makers/operation/security/jwt/JwtExceptionFilter.java b/src/main/java/org/sopt/makers/operation/security/jwt/JwtExceptionFilter.java index b398b3ab..cf2e8eb9 100644 --- a/src/main/java/org/sopt/makers/operation/security/jwt/JwtExceptionFilter.java +++ b/src/main/java/org/sopt/makers/operation/security/jwt/JwtExceptionFilter.java @@ -1,6 +1,5 @@ package org.sopt.makers.operation.security.jwt; -import org.sopt.makers.operation.dto.ResponseDTO; import org.sopt.makers.operation.exception.TokenException; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; diff --git a/src/main/java/org/sopt/makers/operation/service/app/attendance/AttendanceService.java b/src/main/java/org/sopt/makers/operation/service/app/attendance/AttendanceService.java index 080b790c..2dae3298 100644 --- a/src/main/java/org/sopt/makers/operation/service/app/attendance/AttendanceService.java +++ b/src/main/java/org/sopt/makers/operation/service/app/attendance/AttendanceService.java @@ -1,12 +1,6 @@ package org.sopt.makers.operation.service.app.attendance; -import org.sopt.makers.operation.dto.attendance.request.AttendRequestDTO; -import org.sopt.makers.operation.dto.attendance.request.SubAttendanceUpdateRequestDTO; import org.sopt.makers.operation.dto.attendance.response.AttendResponseDTO; -import org.sopt.makers.operation.dto.attendance.response.AttendanceMemberResponseDTO; -import org.sopt.makers.operation.dto.attendance.response.AttendancesResponseDTO; -import org.sopt.makers.operation.dto.attendance.response.SubAttendanceUpdateResponseDTO; -import org.sopt.makers.operation.entity.Part; import org.springframework.data.domain.Pageable; public interface AttendanceService { diff --git a/src/main/java/org/sopt/makers/operation/service/app/attendance/AttendanceServiceImpl.java b/src/main/java/org/sopt/makers/operation/service/app/attendance/AttendanceServiceImpl.java index a394283b..7ff97b63 100644 --- a/src/main/java/org/sopt/makers/operation/service/app/attendance/AttendanceServiceImpl.java +++ b/src/main/java/org/sopt/makers/operation/service/app/attendance/AttendanceServiceImpl.java @@ -6,7 +6,6 @@ import java.time.LocalDateTime; import org.sopt.makers.operation.config.ValueConfig; -import org.sopt.makers.operation.dto.attendance.request.AttendRequestDTO; import org.sopt.makers.operation.dto.attendance.response.AttendResponseDTO; import org.sopt.makers.operation.entity.attendance.AttendanceStatus; import org.sopt.makers.operation.exception.LectureException; From 16b3ec13d64d09b6e5bde4e42a4d5afc8ae8d39c Mon Sep 17 00:00:00 2001 From: thguss Date: Fri, 2 Feb 2024 04:04:32 +0900 Subject: [PATCH 044/141] =?UTF-8?q?[FIX]=202=EC=B0=A8=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- operation-api/build.gradle | 3 +- .../app/attendance/api/AttendanceApi.java | 2 +- .../api/AttendanceApiController.java | 2 +- .../common/util/ApiResponseUtil.java | 8 ++ .../org/operation/common}/util/Cookie.java | 2 +- .../org/operation/web/AdminController.java | 52 --------- .../org/operation/web/admin/api/AdminApi.java | 75 +++++++++++++ .../web/admin/api/AdminApiController.java | 52 +++++++++ .../web/admin/message/SuccessMessage.java | 15 +++ .../web/admin/service/AdminService.java | 13 +++ .../web/{ => alarm}/AlarmController.java | 4 +- .../org/operation/web/alarm/api/AlarmApi.java | 4 + .../web/alarm/api/AlarmApiController.java | 4 + .../web/alarm/message/SuccessMessage.java | 13 +++ .../AttendanceController.java | 2 +- .../web/attendnace/api/AttendanceApi.java | 4 + .../api/AttendanceApiController.java | 4 + .../attendnace/message/SuccessMessage.java | 13 +++ .../web/{ => lecture}/LectureController.java | 2 +- .../operation/web/lecture/api/LectureApi.java | 4 + .../web/lecture/api/LectureApiController.java | 4 + .../web/lecture/message/SuccessMessage.java | 13 +++ .../web/{ => member}/MemberController.java | 2 +- .../operation/web/member/api/MemberApi.java | 4 + .../web/member/api/MemberApiController.java | 4 + .../web/member/message/SuccessMessage.java | 13 +++ .../dto/request}/AttendanceRequest.java | 2 +- .../web/admin/dto/request/LoginRequest.java | 7 ++ .../web/admin/dto/request/SignUpRequest.java | 21 ++++ .../web/admin/dto/response/LoginResponse.java | 38 +++++++ .../admin/dto/response/RefreshResponse.java | 10 ++ .../admin/dto/response/SignUpResponse.java | 25 +++++ .../admin}/repository/AdminRepository.java | 8 +- .../web/admin/service/AdminServiceImpl.java | 106 ++++++++++++++++++ operation-domain/build.gradle | 2 + .../main/java/org/operation}/BaseEntity.java | 2 +- .../src/main/java/org/operation}/Part.java | 2 +- .../org/operation/admin/domain}/Admin.java | 6 +- .../operation/admin/domain}/AdminStatus.java | 2 +- .../org/operation/admin/domain}/Role.java | 2 +- .../main/java/org/operation}/alarm/Alarm.java | 6 +- .../java/org/operation}/alarm/Attribute.java | 2 +- .../java/org/operation}/alarm/Status.java | 2 +- .../org/operation}/attendance/Attendance.java | 8 +- .../attendance/AttendanceStatus.java | 2 +- .../operation}/attendance/SubAttendance.java | 6 +- .../org/operation}/lecture/Attribute.java | 2 +- .../java/org/operation}/lecture/Lecture.java | 10 +- .../org/operation}/lecture/LectureStatus.java | 2 +- .../org/operation}/lecture/SubLecture.java | 8 +- .../java/org/operation}/member/Member.java | 8 +- .../main/java/org/operation/member/ObYb.java | 5 + .../org/operation}/schedule/Schedule.java | 6 +- settings.gradle | 1 + .../operation/common/ResponseMessage.java | 4 +- .../dto/admin/request/LoginRequestDTO.java | 4 - .../dto/admin/request/SignUpRequestDTO.java | 11 -- .../dto/admin/response/LoginResponseDTO.java | 27 ----- .../admin/response/RefreshResponseDTO.java | 10 -- .../dto/admin/response/SignUpResponseDTO.java | 11 -- .../dto/alarm/request/AlarmRequestDTO.java | 4 +- .../dto/alarm/request/AlarmSenderDTO.java | 4 +- .../dto/alarm/response/AlarmResponseDTO.java | 2 +- .../dto/alarm/response/AlarmsResponseDTO.java | 2 +- .../SubAttendanceUpdateRequestDTO.java | 2 +- .../response/AttendanceMemberResponseDTO.java | 6 +- .../response/AttendanceTotalResponseDTO.java | 2 +- .../response/AttendanceTotalVO.java | 6 +- .../response/AttendancesResponseDTO.java | 2 +- .../response/MemberResponseDTO.java | 8 +- .../SubAttendanceUpdateResponseDTO.java | 4 +- .../lecture/request/LectureRequestDTO.java | 4 +- .../response/AttendanceResponseDTO.java | 4 +- .../lecture/response/AttendancesStatusVO.java | 6 +- .../LectureCurrentRoundResponseDTO.java | 2 +- .../response/LectureDetailResponseDTO.java | 2 +- .../lecture/response/LectureResponseDTO.java | 8 +- .../lecture/response/LecturesResponseDTO.java | 4 +- .../response/TodayLectureResponseDTO.java | 6 +- .../dto/member/request/MemberRequestDTO.java | 2 +- .../response/MemberListGetResponse.java | 2 +- .../response/SchedulesResponseDTO.java | 4 +- .../makers/operation/entity/member/ObYb.java | 5 - .../alarm/AlarmCustomRepository.java | 4 +- .../repository/alarm/AlarmRepository.java | 2 +- .../repository/alarm/AlarmRepositoryImpl.java | 6 +- .../AttendanceCustomRepository.java | 4 +- .../attendance/AttendanceRepository.java | 4 +- .../attendance/AttendanceRepositoryImpl.java | 16 +-- .../attendance/SubAttendanceRepository.java | 4 +- .../lecture/LectureCustomRepository.java | 2 +- .../repository/lecture/LectureRepository.java | 2 +- .../lecture/LectureRepositoryImpl.java | 10 +- .../lecture/SubLectureRepository.java | 4 +- .../member/MemberCustomRepository.java | 2 +- .../repository/member/MemberRepository.java | 2 +- .../member/MemberRepositoryImpl.java | 8 +- .../schedule/ScheduleCustomRepository.java | 2 +- .../schedule/ScheduleRepository.java | 2 +- .../schedule/ScheduleRepositoryImpl.java | 4 +- .../app/attendance/AttendanceServiceImpl.java | 2 +- .../app/lecture/LectureServiceImpl.java | 14 +-- .../service/app/member/MemberServiceImpl.java | 6 +- .../app/schedule/ScheduleServiceImpl.java | 2 +- .../service/batch/LectureServiceImpl.java | 4 +- .../service/web/admin/AdminService.java | 14 --- .../service/web/admin/AdminServiceImpl.java | 101 ----------------- .../service/web/alarm/AlarmService.java | 2 +- .../service/web/alarm/AlarmServiceImpl.java | 6 +- .../web/attendance/AttendanceServiceImpl.java | 4 +- .../web/lecture/LectureServiceImpl.java | 12 +- .../service/web/member/MemberServiceImpl.java | 4 +- .../operation/fixture/LectureFixture.java | 8 +- .../service/web/LectureServiceImplTest.java | 2 +- 114 files changed, 631 insertions(+), 405 deletions(-) rename {src/main/java/org/sopt/makers/operation => operation-api/src/main/java/org/operation/common}/util/Cookie.java (95%) delete mode 100644 operation-api/src/main/java/org/operation/web/AdminController.java create mode 100644 operation-api/src/main/java/org/operation/web/admin/api/AdminApi.java create mode 100644 operation-api/src/main/java/org/operation/web/admin/api/AdminApiController.java create mode 100644 operation-api/src/main/java/org/operation/web/admin/message/SuccessMessage.java create mode 100644 operation-api/src/main/java/org/operation/web/admin/service/AdminService.java rename operation-api/src/main/java/org/operation/web/{ => alarm}/AlarmController.java (97%) create mode 100644 operation-api/src/main/java/org/operation/web/alarm/api/AlarmApi.java create mode 100644 operation-api/src/main/java/org/operation/web/alarm/api/AlarmApiController.java create mode 100644 operation-api/src/main/java/org/operation/web/alarm/message/SuccessMessage.java rename operation-api/src/main/java/org/operation/web/{ => attendnace}/AttendanceController.java (98%) create mode 100644 operation-api/src/main/java/org/operation/web/attendnace/api/AttendanceApi.java create mode 100644 operation-api/src/main/java/org/operation/web/attendnace/api/AttendanceApiController.java create mode 100644 operation-api/src/main/java/org/operation/web/attendnace/message/SuccessMessage.java rename operation-api/src/main/java/org/operation/web/{ => lecture}/LectureController.java (99%) create mode 100644 operation-api/src/main/java/org/operation/web/lecture/api/LectureApi.java create mode 100644 operation-api/src/main/java/org/operation/web/lecture/api/LectureApiController.java create mode 100644 operation-api/src/main/java/org/operation/web/lecture/message/SuccessMessage.java rename operation-api/src/main/java/org/operation/web/{ => member}/MemberController.java (97%) create mode 100644 operation-api/src/main/java/org/operation/web/member/api/MemberApi.java create mode 100644 operation-api/src/main/java/org/operation/web/member/api/MemberApiController.java create mode 100644 operation-api/src/main/java/org/operation/web/member/message/SuccessMessage.java rename {operation-api/src/main/java/org/operation/app/attendance/dto => operation-business/src/main/java/org/operation/app/attendance/dto/request}/AttendanceRequest.java (63%) create mode 100644 operation-business/src/main/java/org/operation/web/admin/dto/request/LoginRequest.java create mode 100644 operation-business/src/main/java/org/operation/web/admin/dto/request/SignUpRequest.java create mode 100644 operation-business/src/main/java/org/operation/web/admin/dto/response/LoginResponse.java create mode 100644 operation-business/src/main/java/org/operation/web/admin/dto/response/RefreshResponse.java create mode 100644 operation-business/src/main/java/org/operation/web/admin/dto/response/SignUpResponse.java rename {src/main/java/org/sopt/makers/operation => operation-business/src/main/java/org/operation/web/admin}/repository/AdminRepository.java (76%) create mode 100644 operation-business/src/main/java/org/operation/web/admin/service/AdminServiceImpl.java rename {src/main/java/org/sopt/makers/operation/entity => operation-domain/src/main/java/org/operation}/BaseEntity.java (92%) rename {src/main/java/org/sopt/makers/operation/entity => operation-domain/src/main/java/org/operation}/Part.java (86%) rename {src/main/java/org/sopt/makers/operation/entity/admin => operation-domain/src/main/java/org/operation/admin/domain}/Admin.java (88%) rename {src/main/java/org/sopt/makers/operation/entity/admin => operation-domain/src/main/java/org/operation/admin/domain}/AdminStatus.java (60%) rename {src/main/java/org/sopt/makers/operation/entity/admin => operation-domain/src/main/java/org/operation/admin/domain}/Role.java (74%) rename {src/main/java/org/sopt/makers/operation/entity => operation-domain/src/main/java/org/operation}/alarm/Alarm.java (93%) rename {src/main/java/org/sopt/makers/operation/entity => operation-domain/src/main/java/org/operation}/alarm/Attribute.java (78%) rename {src/main/java/org/sopt/makers/operation/entity => operation-domain/src/main/java/org/operation}/alarm/Status.java (79%) rename {src/main/java/org/sopt/makers/operation/entity => operation-domain/src/main/java/org/operation}/attendance/Attendance.java (92%) rename {src/main/java/org/sopt/makers/operation/entity => operation-domain/src/main/java/org/operation}/attendance/AttendanceStatus.java (83%) rename {src/main/java/org/sopt/makers/operation/entity => operation-domain/src/main/java/org/operation}/attendance/SubAttendance.java (90%) rename {src/main/java/org/sopt/makers/operation/entity => operation-domain/src/main/java/org/operation}/lecture/Attribute.java (79%) rename {src/main/java/org/sopt/makers/operation/entity => operation-domain/src/main/java/org/operation}/lecture/Lecture.java (87%) rename {src/main/java/org/sopt/makers/operation/entity => operation-domain/src/main/java/org/operation}/lecture/LectureStatus.java (54%) rename {src/main/java/org/sopt/makers/operation/entity => operation-domain/src/main/java/org/operation}/lecture/SubLecture.java (83%) rename {src/main/java/org/sopt/makers/operation/entity => operation-domain/src/main/java/org/operation}/member/Member.java (87%) create mode 100644 operation-domain/src/main/java/org/operation/member/ObYb.java rename {src/main/java/org/sopt/makers/operation/entity => operation-domain/src/main/java/org/operation}/schedule/Schedule.java (79%) delete mode 100644 src/main/java/org/sopt/makers/operation/dto/admin/request/LoginRequestDTO.java delete mode 100644 src/main/java/org/sopt/makers/operation/dto/admin/request/SignUpRequestDTO.java delete mode 100644 src/main/java/org/sopt/makers/operation/dto/admin/response/LoginResponseDTO.java delete mode 100644 src/main/java/org/sopt/makers/operation/dto/admin/response/RefreshResponseDTO.java delete mode 100644 src/main/java/org/sopt/makers/operation/dto/admin/response/SignUpResponseDTO.java delete mode 100644 src/main/java/org/sopt/makers/operation/entity/member/ObYb.java delete mode 100644 src/main/java/org/sopt/makers/operation/service/web/admin/AdminService.java delete mode 100644 src/main/java/org/sopt/makers/operation/service/web/admin/AdminServiceImpl.java diff --git a/operation-api/build.gradle b/operation-api/build.gradle index 6b6e0471..9d3c0444 100644 --- a/operation-api/build.gradle +++ b/operation-api/build.gradle @@ -7,8 +7,7 @@ tasks.named('jar') { } dependencies { - implementation project(path: ':operation-domain') + implementation project(path: ':operation-business') implementation 'org.springframework.boot:spring-boot-starter-web' - implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.0.2' } diff --git a/operation-api/src/main/java/org/operation/app/attendance/api/AttendanceApi.java b/operation-api/src/main/java/org/operation/app/attendance/api/AttendanceApi.java index f7930256..1c461aee 100644 --- a/operation-api/src/main/java/org/operation/app/attendance/api/AttendanceApi.java +++ b/operation-api/src/main/java/org/operation/app/attendance/api/AttendanceApi.java @@ -2,7 +2,7 @@ import java.security.Principal; -import org.operation.app.attendance.dto.AttendanceRequest; +import org.operation.app.attendance.dto.request.AttendanceRequest; import org.operation.common.dto.BaseResponse; import org.springframework.http.ResponseEntity; diff --git a/operation-api/src/main/java/org/operation/app/attendance/api/AttendanceApiController.java b/operation-api/src/main/java/org/operation/app/attendance/api/AttendanceApiController.java index e9fcb107..fbee053e 100644 --- a/operation-api/src/main/java/org/operation/app/attendance/api/AttendanceApiController.java +++ b/operation-api/src/main/java/org/operation/app/attendance/api/AttendanceApiController.java @@ -4,7 +4,7 @@ import java.security.Principal; -import org.operation.app.attendance.dto.AttendanceRequest; +import org.operation.app.attendance.dto.request.AttendanceRequest; import org.operation.common.util.CommonUtils; import org.operation.common.util.ApiResponseUtil; import org.operation.common.dto.BaseResponse; diff --git a/operation-api/src/main/java/org/operation/common/util/ApiResponseUtil.java b/operation-api/src/main/java/org/operation/common/util/ApiResponseUtil.java index f0fd2a0e..be1df6cc 100644 --- a/operation-api/src/main/java/org/operation/common/util/ApiResponseUtil.java +++ b/operation-api/src/main/java/org/operation/common/util/ApiResponseUtil.java @@ -1,6 +1,8 @@ package org.operation.common.util; import org.operation.common.dto.BaseResponse; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; public interface ApiResponseUtil { @@ -12,4 +14,10 @@ static ResponseEntity> ok(String message, T data) { static ResponseEntity> ok(String message) { return ResponseEntity.ok(BaseResponse.of(message, true)); } + + static ResponseEntity> ok(HttpHeaders headers, String message, T data) { + return ResponseEntity.status(HttpStatus.OK) + .headers(headers) + .body(BaseResponse.of(message, data)); + } } diff --git a/src/main/java/org/sopt/makers/operation/util/Cookie.java b/operation-api/src/main/java/org/operation/common/util/Cookie.java similarity index 95% rename from src/main/java/org/sopt/makers/operation/util/Cookie.java rename to operation-api/src/main/java/org/operation/common/util/Cookie.java index 14b0f300..bc3f574a 100644 --- a/src/main/java/org/sopt/makers/operation/util/Cookie.java +++ b/operation-api/src/main/java/org/operation/common/util/Cookie.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.util; +package org.operation.common.util; import lombok.val; import org.springframework.context.annotation.Configuration; diff --git a/operation-api/src/main/java/org/operation/web/AdminController.java b/operation-api/src/main/java/org/operation/web/AdminController.java deleted file mode 100644 index fa0dea07..00000000 --- a/operation-api/src/main/java/org/operation/web/AdminController.java +++ /dev/null @@ -1,52 +0,0 @@ -package org.operation.web; - -import static org.sopt.makers.operation.common.ResponseMessage.*; -import static org.springframework.http.HttpStatus.*; - -import io.swagger.annotations.ApiOperation; -import lombok.RequiredArgsConstructor; -import lombok.val; - -import org.sopt.makers.operation.dto.ResponseDTO; -import org.sopt.makers.operation.dto.admin.request.LoginRequestDTO; -import org.sopt.makers.operation.dto.admin.request.SignUpRequestDTO; -import org.sopt.makers.operation.service.web.admin.AdminServiceImpl; -import org.sopt.makers.operation.util.Cookie; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.*; - -@RestController -@RequiredArgsConstructor -@RequestMapping("/api/v1/auth") -public class AdminController { - private final AdminServiceImpl authService; - private final Cookie cookie; - - @ApiOperation(value = "회원가입") - @PostMapping("/signup") - public ResponseEntity signup(@RequestBody SignUpRequestDTO signUpRequestDTO) { - val response = authService.signUp(signUpRequestDTO); - return ResponseEntity.ok(ResponseDTO.success(ResponseMessage.SUCCESS_SIGN_UP.getMessage(), response)); - } - - @ApiOperation(value = "로그인") - @PostMapping("/login") - public ResponseEntity login(@RequestBody LoginRequestDTO userLoginRequestDTO) { - val response = authService.login(userLoginRequestDTO); - val headers = cookie.setRefreshToken(response.refreshToken()); - - return ResponseEntity.status(OK) - .headers(headers) - .body(ResponseDTO.success(ResponseMessage.SUCCESS_LOGIN_UP.getMessage(), response.loginResponseVO())); - } - - @ApiOperation(value = "토큰 재발급") - @PatchMapping("/refresh") - public ResponseEntity refresh(@CookieValue String refreshToken) { - val response = authService.refresh(refreshToken); - val headers = cookie.setRefreshToken(response.refreshToken()); - - return ResponseEntity.status(OK).headers(headers) - .body(ResponseDTO.success(ResponseMessage.SUCCESS_GET_REFRESH_TOKEN.getMessage(), response.accessToken())); - } -} diff --git a/operation-api/src/main/java/org/operation/web/admin/api/AdminApi.java b/operation-api/src/main/java/org/operation/web/admin/api/AdminApi.java new file mode 100644 index 00000000..08b435d5 --- /dev/null +++ b/operation-api/src/main/java/org/operation/web/admin/api/AdminApi.java @@ -0,0 +1,75 @@ +package org.operation.web.admin.api; + +import org.operation.common.dto.BaseResponse; +import org.operation.web.admin.dto.request.LoginRequest; +import org.operation.web.admin.dto.request.SignUpRequest; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.CookieValue; +import org.springframework.web.bind.annotation.RequestBody; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; + +public interface AdminApi { + + @Operation( + summary = "회원가입 API", + responses = { + @ApiResponse( + responseCode = "200", + description = "회원가입 성공" + ), + @ApiResponse( + responseCode = "400", + description = "잘못된 요청" + ), + @ApiResponse( + responseCode = "500", + description = "서버 내부 오류" + ) + } + ) + ResponseEntity> signup(@RequestBody SignUpRequest signUpRequestDTO); + + + @Operation( + summary = "로그인 API", + responses = { + @ApiResponse( + responseCode = "200", + description = "로그인 성공" + ), + @ApiResponse( + responseCode = "400", + description = "잘못된 요청" + ), + @ApiResponse( + responseCode = "500", + description = "서버 내부 오류" + ) + } + ) + ResponseEntity> login(@RequestBody LoginRequest userLoginRequestDTO); + + + @Operation( + security = @SecurityRequirement(name = "Authorization"), + summary = "앱 내 일정 리스트 조회 API", + responses = { + @ApiResponse( + responseCode = "200", + description = "일정 리스트 조회 성공" + ), + @ApiResponse( + responseCode = "400", + description = "잘못된 요청" + ), + @ApiResponse( + responseCode = "500", + description = "서버 내부 오류" + ) + } + ) + ResponseEntity> refresh(@CookieValue String refreshToken); +} diff --git a/operation-api/src/main/java/org/operation/web/admin/api/AdminApiController.java b/operation-api/src/main/java/org/operation/web/admin/api/AdminApiController.java new file mode 100644 index 00000000..37ef4da4 --- /dev/null +++ b/operation-api/src/main/java/org/operation/web/admin/api/AdminApiController.java @@ -0,0 +1,52 @@ +package org.operation.web.admin.api; + +import static org.operation.web.admin.message.SuccessMessage.*; + +import org.operation.common.dto.BaseResponse; +import org.operation.common.util.ApiResponseUtil; +import org.operation.common.util.Cookie; +import org.operation.web.admin.dto.request.LoginRequest; +import org.operation.web.admin.dto.request.SignUpRequest; +import org.operation.web.admin.service.AdminService; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.PatchMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import lombok.RequiredArgsConstructor; +import lombok.val; + +@RestController +@RequiredArgsConstructor +@RequestMapping("/api/v1/auth") +@ComponentScan("operation-business") +public class AdminApiController implements AdminApi { + + private final AdminService authService; + private final Cookie cookie; + + @Override + @PostMapping("/signup") + public ResponseEntity> signup(SignUpRequest signUpRequestDTO) { + val response = authService.signUp(signUpRequestDTO); + return ApiResponseUtil.ok(SUCCESS_SIGN_UP.getContent(), response); + } + + @Override + @PostMapping("/login") + public ResponseEntity> login(LoginRequest userLoginRequestDTO) { + val response = authService.login(userLoginRequestDTO); + val headers = cookie.setRefreshToken(response.refreshToken()); + return ApiResponseUtil.ok(headers, SUCCESS_LOGIN_UP.getContent(), response.loginResponseVO()); + } + + @Override + @PatchMapping("/refresh") + public ResponseEntity> refresh(String refreshToken) { + val response = authService.refresh(refreshToken); + val headers = cookie.setRefreshToken(response.refreshToken()); + return ApiResponseUtil.ok(headers, SUCCESS_GET_REFRESH_TOKEN.getContent(), response.accessToken()); + } +} diff --git a/operation-api/src/main/java/org/operation/web/admin/message/SuccessMessage.java b/operation-api/src/main/java/org/operation/web/admin/message/SuccessMessage.java new file mode 100644 index 00000000..2bf6a6f9 --- /dev/null +++ b/operation-api/src/main/java/org/operation/web/admin/message/SuccessMessage.java @@ -0,0 +1,15 @@ +package org.operation.web.admin.message; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public enum SuccessMessage { + SUCCESS_SIGN_UP("회원 가입 성공"), + SUCCESS_LOGIN_UP("로그인 성공"), + SUCCESS_GET_REFRESH_TOKEN("토큰 재발급 성공"), + ; + + private final String content; +} diff --git a/operation-api/src/main/java/org/operation/web/admin/service/AdminService.java b/operation-api/src/main/java/org/operation/web/admin/service/AdminService.java new file mode 100644 index 00000000..91a196bc --- /dev/null +++ b/operation-api/src/main/java/org/operation/web/admin/service/AdminService.java @@ -0,0 +1,13 @@ +package org.operation.web.admin.service; + +import org.operation.web.admin.dto.request.LoginRequest; +import org.operation.web.admin.dto.request.SignUpRequest; +import org.operation.web.admin.dto.response.LoginResponse; +import org.operation.web.admin.dto.response.RefreshResponse; +import org.operation.web.admin.dto.response.SignUpResponse; + +public interface AdminService { + SignUpResponse signUp(SignUpRequest request); + LoginResponse login(LoginRequest request); + RefreshResponse refresh(String refreshToken); +} diff --git a/operation-api/src/main/java/org/operation/web/AlarmController.java b/operation-api/src/main/java/org/operation/web/alarm/AlarmController.java similarity index 97% rename from operation-api/src/main/java/org/operation/web/AlarmController.java rename to operation-api/src/main/java/org/operation/web/alarm/AlarmController.java index 575edd42..c234149e 100644 --- a/operation-api/src/main/java/org/operation/web/AlarmController.java +++ b/operation-api/src/main/java/org/operation/web/alarm/AlarmController.java @@ -1,4 +1,4 @@ -package org.operation.web; +package org.operation.web.alarm; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; @@ -20,7 +20,7 @@ import org.sopt.makers.operation.dto.alarm.request.AlarmRequestDTO; import org.sopt.makers.operation.entity.Part; -import org.sopt.makers.operation.entity.alarm.Status; +import org.operation.alarm.Status; import org.springframework.data.domain.Pageable; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; diff --git a/operation-api/src/main/java/org/operation/web/alarm/api/AlarmApi.java b/operation-api/src/main/java/org/operation/web/alarm/api/AlarmApi.java new file mode 100644 index 00000000..6fdbd7cc --- /dev/null +++ b/operation-api/src/main/java/org/operation/web/alarm/api/AlarmApi.java @@ -0,0 +1,4 @@ +package org.operation.web.alarm.api; + +public interface AlarmApi { +} diff --git a/operation-api/src/main/java/org/operation/web/alarm/api/AlarmApiController.java b/operation-api/src/main/java/org/operation/web/alarm/api/AlarmApiController.java new file mode 100644 index 00000000..7ba68a1f --- /dev/null +++ b/operation-api/src/main/java/org/operation/web/alarm/api/AlarmApiController.java @@ -0,0 +1,4 @@ +package org.operation.web.alarm.api; + +public class AlarmApiController implements AlarmApi { +} diff --git a/operation-api/src/main/java/org/operation/web/alarm/message/SuccessMessage.java b/operation-api/src/main/java/org/operation/web/alarm/message/SuccessMessage.java new file mode 100644 index 00000000..4fcf4928 --- /dev/null +++ b/operation-api/src/main/java/org/operation/web/alarm/message/SuccessMessage.java @@ -0,0 +1,13 @@ +package org.operation.web.alarm.message; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public enum SuccessMessage { + + ; + + private final String content; +} diff --git a/operation-api/src/main/java/org/operation/web/AttendanceController.java b/operation-api/src/main/java/org/operation/web/attendnace/AttendanceController.java similarity index 98% rename from operation-api/src/main/java/org/operation/web/AttendanceController.java rename to operation-api/src/main/java/org/operation/web/attendnace/AttendanceController.java index e5b381c0..4c972293 100644 --- a/operation-api/src/main/java/org/operation/web/AttendanceController.java +++ b/operation-api/src/main/java/org/operation/web/attendnace/AttendanceController.java @@ -1,4 +1,4 @@ -package org.operation.web; +package org.operation.web.attendnace; import static org.sopt.makers.operation.common.ResponseMessage.*; diff --git a/operation-api/src/main/java/org/operation/web/attendnace/api/AttendanceApi.java b/operation-api/src/main/java/org/operation/web/attendnace/api/AttendanceApi.java new file mode 100644 index 00000000..cf92384c --- /dev/null +++ b/operation-api/src/main/java/org/operation/web/attendnace/api/AttendanceApi.java @@ -0,0 +1,4 @@ +package org.operation.web.attendnace.api; + +public interface AttendanceApi { +} diff --git a/operation-api/src/main/java/org/operation/web/attendnace/api/AttendanceApiController.java b/operation-api/src/main/java/org/operation/web/attendnace/api/AttendanceApiController.java new file mode 100644 index 00000000..58c4ad39 --- /dev/null +++ b/operation-api/src/main/java/org/operation/web/attendnace/api/AttendanceApiController.java @@ -0,0 +1,4 @@ +package org.operation.web.attendnace.api; + +public class AttendanceApiController implements AttendanceApi { +} diff --git a/operation-api/src/main/java/org/operation/web/attendnace/message/SuccessMessage.java b/operation-api/src/main/java/org/operation/web/attendnace/message/SuccessMessage.java new file mode 100644 index 00000000..ebfd4f69 --- /dev/null +++ b/operation-api/src/main/java/org/operation/web/attendnace/message/SuccessMessage.java @@ -0,0 +1,13 @@ +package org.operation.web.attendnace.message; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public enum SuccessMessage { + + ; + + private final String content; +} diff --git a/operation-api/src/main/java/org/operation/web/LectureController.java b/operation-api/src/main/java/org/operation/web/lecture/LectureController.java similarity index 99% rename from operation-api/src/main/java/org/operation/web/LectureController.java rename to operation-api/src/main/java/org/operation/web/lecture/LectureController.java index ce96cb98..c5fdbf49 100644 --- a/operation-api/src/main/java/org/operation/web/LectureController.java +++ b/operation-api/src/main/java/org/operation/web/lecture/LectureController.java @@ -1,4 +1,4 @@ -package org.operation.web; +package org.operation.web.lecture; import static org.sopt.makers.operation.dto.ResponseDTO.*; import static org.sopt.makers.operation.common.ResponseMessage.*; diff --git a/operation-api/src/main/java/org/operation/web/lecture/api/LectureApi.java b/operation-api/src/main/java/org/operation/web/lecture/api/LectureApi.java new file mode 100644 index 00000000..7b3bf65e --- /dev/null +++ b/operation-api/src/main/java/org/operation/web/lecture/api/LectureApi.java @@ -0,0 +1,4 @@ +package org.operation.web.lecture.api; + +public interface LectureApi { +} diff --git a/operation-api/src/main/java/org/operation/web/lecture/api/LectureApiController.java b/operation-api/src/main/java/org/operation/web/lecture/api/LectureApiController.java new file mode 100644 index 00000000..3ec617d9 --- /dev/null +++ b/operation-api/src/main/java/org/operation/web/lecture/api/LectureApiController.java @@ -0,0 +1,4 @@ +package org.operation.web.lecture.api; + +public class LectureApiController implements LectureApi { +} diff --git a/operation-api/src/main/java/org/operation/web/lecture/message/SuccessMessage.java b/operation-api/src/main/java/org/operation/web/lecture/message/SuccessMessage.java new file mode 100644 index 00000000..63c6bec3 --- /dev/null +++ b/operation-api/src/main/java/org/operation/web/lecture/message/SuccessMessage.java @@ -0,0 +1,13 @@ +package org.operation.web.lecture.message; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public enum SuccessMessage { + + ; + + private final String content; +} diff --git a/operation-api/src/main/java/org/operation/web/MemberController.java b/operation-api/src/main/java/org/operation/web/member/MemberController.java similarity index 97% rename from operation-api/src/main/java/org/operation/web/MemberController.java rename to operation-api/src/main/java/org/operation/web/member/MemberController.java index 75599f54..fcaac858 100644 --- a/operation-api/src/main/java/org/operation/web/MemberController.java +++ b/operation-api/src/main/java/org/operation/web/member/MemberController.java @@ -1,4 +1,4 @@ -package org.operation.web; +package org.operation.web.member; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; diff --git a/operation-api/src/main/java/org/operation/web/member/api/MemberApi.java b/operation-api/src/main/java/org/operation/web/member/api/MemberApi.java new file mode 100644 index 00000000..480968b1 --- /dev/null +++ b/operation-api/src/main/java/org/operation/web/member/api/MemberApi.java @@ -0,0 +1,4 @@ +package org.operation.web.member.api; + +public interface MemberApi { +} diff --git a/operation-api/src/main/java/org/operation/web/member/api/MemberApiController.java b/operation-api/src/main/java/org/operation/web/member/api/MemberApiController.java new file mode 100644 index 00000000..29686903 --- /dev/null +++ b/operation-api/src/main/java/org/operation/web/member/api/MemberApiController.java @@ -0,0 +1,4 @@ +package org.operation.web.member.api; + +public class MemberApiController implements MemberApi { +} diff --git a/operation-api/src/main/java/org/operation/web/member/message/SuccessMessage.java b/operation-api/src/main/java/org/operation/web/member/message/SuccessMessage.java new file mode 100644 index 00000000..84608ca8 --- /dev/null +++ b/operation-api/src/main/java/org/operation/web/member/message/SuccessMessage.java @@ -0,0 +1,13 @@ +package org.operation.web.member.message; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public enum SuccessMessage { + + ; + + private final String content; +} diff --git a/operation-api/src/main/java/org/operation/app/attendance/dto/AttendanceRequest.java b/operation-business/src/main/java/org/operation/app/attendance/dto/request/AttendanceRequest.java similarity index 63% rename from operation-api/src/main/java/org/operation/app/attendance/dto/AttendanceRequest.java rename to operation-business/src/main/java/org/operation/app/attendance/dto/request/AttendanceRequest.java index c0e49bd3..2f7dbe86 100644 --- a/operation-api/src/main/java/org/operation/app/attendance/dto/AttendanceRequest.java +++ b/operation-business/src/main/java/org/operation/app/attendance/dto/request/AttendanceRequest.java @@ -1,4 +1,4 @@ -package org.operation.app.attendance.dto; +package org.operation.app.attendance.dto.request; public record AttendanceRequest( Long subLectureId, diff --git a/operation-business/src/main/java/org/operation/web/admin/dto/request/LoginRequest.java b/operation-business/src/main/java/org/operation/web/admin/dto/request/LoginRequest.java new file mode 100644 index 00000000..4f390246 --- /dev/null +++ b/operation-business/src/main/java/org/operation/web/admin/dto/request/LoginRequest.java @@ -0,0 +1,7 @@ +package org.operation.web.admin.dto.request; + +public record LoginRequest( + String email, + String password +) { +} diff --git a/operation-business/src/main/java/org/operation/web/admin/dto/request/SignUpRequest.java b/operation-business/src/main/java/org/operation/web/admin/dto/request/SignUpRequest.java new file mode 100644 index 00000000..828e5620 --- /dev/null +++ b/operation-business/src/main/java/org/operation/web/admin/dto/request/SignUpRequest.java @@ -0,0 +1,21 @@ +package org.operation.web.admin.dto.request; + +import org.operation.admin.domain.Admin; +import org.operation.admin.domain.Role; + +public record SignUpRequest( + String email, + String password, + String name, + Role role +) { + + public Admin toEntity() { + return Admin.builder() + .email(this.email) + .password(this.password) + .name(this.name) + .role(this.role) + .build(); + } +} diff --git a/operation-business/src/main/java/org/operation/web/admin/dto/response/LoginResponse.java b/operation-business/src/main/java/org/operation/web/admin/dto/response/LoginResponse.java new file mode 100644 index 00000000..7f3db527 --- /dev/null +++ b/operation-business/src/main/java/org/operation/web/admin/dto/response/LoginResponse.java @@ -0,0 +1,38 @@ +package org.operation.web.admin.dto.response; + +import lombok.AccessLevel; +import lombok.Builder; +import org.operation.admin.domain.Admin; +import org.operation.admin.domain.AdminStatus; + +@Builder(access = AccessLevel.PRIVATE) +public record LoginResponse( + LoginResponseVO loginResponseVO, + String refreshToken +) { + + public static LoginResponse of(Admin admin, String accessToken) { + return builder() + .loginResponseVO(LoginResponseVO.of(admin, accessToken)) + .refreshToken(admin.getRefreshToken()) + .build(); + } + + @Builder + record LoginResponseVO( + Long id, + String name, + AdminStatus adminStatus, + String accessToken + ) { + + public static LoginResponseVO of(Admin admin, String accessToken) { + return builder() + .id(admin.getId()) + .name(admin.getName()) + .adminStatus(admin.getStatus()) + .accessToken(accessToken) + .build(); + } + } +} diff --git a/operation-business/src/main/java/org/operation/web/admin/dto/response/RefreshResponse.java b/operation-business/src/main/java/org/operation/web/admin/dto/response/RefreshResponse.java new file mode 100644 index 00000000..2c1ad7e3 --- /dev/null +++ b/operation-business/src/main/java/org/operation/web/admin/dto/response/RefreshResponse.java @@ -0,0 +1,10 @@ +package org.operation.web.admin.dto.response; + +public record RefreshResponse( + String accessToken +) { + + public static RefreshResponse of(String accessToken) { + return new RefreshResponse(accessToken); + } +} \ No newline at end of file diff --git a/operation-business/src/main/java/org/operation/web/admin/dto/response/SignUpResponse.java b/operation-business/src/main/java/org/operation/web/admin/dto/response/SignUpResponse.java new file mode 100644 index 00000000..45db8905 --- /dev/null +++ b/operation-business/src/main/java/org/operation/web/admin/dto/response/SignUpResponse.java @@ -0,0 +1,25 @@ +package org.operation.web.admin.dto.response; + +import org.operation.admin.domain.Admin; +import org.operation.admin.domain.Role; + +import lombok.AccessLevel; +import lombok.Builder; + +@Builder(access = AccessLevel.PRIVATE) +public record SignUpResponse( + Long id, + String email, + String name, + Role role +) { + + public static SignUpResponse of(Admin admin) { + return SignUpResponse.builder() + .id(admin.getId()) + .email(admin.getEmail()) + .name(admin.getName()) + .role(admin.getRole()) + .build(); + } +} diff --git a/src/main/java/org/sopt/makers/operation/repository/AdminRepository.java b/operation-business/src/main/java/org/operation/web/admin/repository/AdminRepository.java similarity index 76% rename from src/main/java/org/sopt/makers/operation/repository/AdminRepository.java rename to operation-business/src/main/java/org/operation/web/admin/repository/AdminRepository.java index 4a0894f8..0cf07686 100644 --- a/src/main/java/org/sopt/makers/operation/repository/AdminRepository.java +++ b/operation-business/src/main/java/org/operation/web/admin/repository/AdminRepository.java @@ -1,11 +1,11 @@ -package org.sopt.makers.operation.repository; +package org.operation.web.admin.repository; -import org.sopt.makers.operation.entity.admin.Admin; +import java.util.Optional; + +import org.operation.admin.domain.Admin; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; -import java.util.Optional; - @Repository public interface AdminRepository extends JpaRepository { Optional findByEmail(String email); diff --git a/operation-business/src/main/java/org/operation/web/admin/service/AdminServiceImpl.java b/operation-business/src/main/java/org/operation/web/admin/service/AdminServiceImpl.java new file mode 100644 index 00000000..09cd15e5 --- /dev/null +++ b/operation-business/src/main/java/org/operation/web/admin/service/AdminServiceImpl.java @@ -0,0 +1,106 @@ +package org.operation.web.admin.service; + +import org.operation.admin.domain.Admin; +import org.operation.admin.domain.AdminStatus; +import org.operation.web.admin.dto.request.LoginRequest; +import org.operation.web.admin.dto.request.SignUpRequest; +import org.operation.web.admin.dto.response.LoginResponse; +import org.operation.web.admin.dto.response.RefreshResponse; +import org.operation.web.admin.dto.response.SignUpResponse; +import org.operation.web.admin.repository.AdminRepository; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import lombok.RequiredArgsConstructor; +import lombok.val; + +@RequiredArgsConstructor +@Service +@Transactional(readOnly = true) +public class AdminServiceImpl implements AdminService { + + private final JwtTokenProvider jwtTokenProvider; //TODO auth + private final PasswordEncoder passwordEncoder; //TODO auth + private final AdminRepository adminRepository; + + @Override + @Transactional + public SignUpResponse signUp(SignUpRequest request){ + checkEmailDuplicated(request.email()); + val admin = adminRepository.save(request.toEntity()); + return SignUpResponse.of(admin); + } + + private void checkEmailDuplicated(String email) { + val isExist = adminRepository.existsByEmail(email); + if (isExist) { + throw new AdminFailureException("중복되는 이메일입니다"); //TODO: ExceptionMessage + } + } + + @Override + @Transactional + public LoginResponse login(LoginRequest request) { + val admin = findByEmail(request.email()); + checkPasswordMatched(request.password(), admin); + checkAdminAllowed(admin); + val refreshToken = generateRefreshToken(); + admin.updateRefreshToken(refreshToken); + val accessToken = generateAccessToken(admin); + return LoginResponse.of(admin, accessToken); + } + + private String generateAccessToken(Admin admin) { + val adminAuthentication = new AdminAuthentication(admin.getId(), null, null); + return jwtTokenProvider.generateAccessToken(adminAuthentication); + } + + private String generateRefreshToken() { + val authentication = new AdminAuthentication(admin.getId(), null, null); + return jwtTokenProvider.generateRefreshToken(authentication); + } + + private Admin findByEmail(String email) { + return adminRepository.findByEmail(email) + .orElseThrow(() -> new AdminFailureException("이메일이 존재하지 않습니다")); //TODO: message + } + + private void checkPasswordMatched(String password, Admin admin) { // TODO: admin 내부로 옮기는 게 좋지 않을까..? + if (!passwordEncoder.matches(password, admin.getPassword())) { + throw new AdminFailureException("비밀번호가 일치하지 않습니다"); + } + } + + private void checkAdminAllowed(Admin admin) { + if (admin.isNotAllowed()) { + throw new AdminFailureException("승인되지 않은 계정입니다"); + } + } + + @Override + @Transactional + public RefreshResponse refresh(String refreshToken) { + val adminId = jwtTokenProvider.getId(refreshToken, JwtTokenType.REFRESH_TOKEN); + val admin = findById((Long)adminId); + validateRefreshToken(admin, refreshToken); + val newAccessToken = generateAccessToken(); + + //TODO: 재발급 때 access만 해주지 않나?? + /* + val newRefreshToken = jwtTokenProvider.generateRefreshToken(adminAuthentication); + admin.updateRefreshToken(newRefreshToken);*/ + + return RefreshResponse.of((String)newAccessToken); + } + + public void validateRefreshToken(Admin admin, String refreshToken) { + if(!admin.getRefreshToken().equals(refreshToken)) { + throw new AdminFailureException("토큰이 일치하지 않습니다"); //TODO: message + } + } + + private Admin findById(Long adminId) { + return adminRepository.findById(adminId) + .orElseThrow(() -> new AdminFailureException(INVALID_MEMBER.getName())); + } +} diff --git a/operation-domain/build.gradle b/operation-domain/build.gradle index 1ebaba4d..3ef353e4 100644 --- a/operation-domain/build.gradle +++ b/operation-domain/build.gradle @@ -10,6 +10,8 @@ repositories { } dependencies { + implementation 'org.springframework.boot:spring-boot-starter-data-jpa' + testImplementation platform('org.junit:junit-bom:5.9.1') testImplementation 'org.junit.jupiter:junit-jupiter' } diff --git a/src/main/java/org/sopt/makers/operation/entity/BaseEntity.java b/operation-domain/src/main/java/org/operation/BaseEntity.java similarity index 92% rename from src/main/java/org/sopt/makers/operation/entity/BaseEntity.java rename to operation-domain/src/main/java/org/operation/BaseEntity.java index b68b25db..243b6788 100644 --- a/src/main/java/org/sopt/makers/operation/entity/BaseEntity.java +++ b/operation-domain/src/main/java/org/operation/BaseEntity.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.entity; +package org.operation; import java.time.LocalDateTime; diff --git a/src/main/java/org/sopt/makers/operation/entity/Part.java b/operation-domain/src/main/java/org/operation/Part.java similarity index 86% rename from src/main/java/org/sopt/makers/operation/entity/Part.java rename to operation-domain/src/main/java/org/operation/Part.java index 6ccfe2e2..3d88e331 100644 --- a/src/main/java/org/sopt/makers/operation/entity/Part.java +++ b/operation-domain/src/main/java/org/operation/Part.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.entity; +package org.operation; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/src/main/java/org/sopt/makers/operation/entity/admin/Admin.java b/operation-domain/src/main/java/org/operation/admin/domain/Admin.java similarity index 88% rename from src/main/java/org/sopt/makers/operation/entity/admin/Admin.java rename to operation-domain/src/main/java/org/operation/admin/domain/Admin.java index e7b3692d..dd0f4a0c 100644 --- a/src/main/java/org/sopt/makers/operation/entity/admin/Admin.java +++ b/operation-domain/src/main/java/org/operation/admin/domain/Admin.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.entity.admin; +package org.operation.admin.domain; import lombok.Builder; import lombok.Getter; @@ -49,4 +49,8 @@ public Admin(String email, String password, String name, Role role) { public void updateRefreshToken(String refreshToken) { this.refreshToken = refreshToken; } + + public boolean isNotAllowed() { + return this.status.equals(AdminStatus.NOT_CERTIFIED); + } } diff --git a/src/main/java/org/sopt/makers/operation/entity/admin/AdminStatus.java b/operation-domain/src/main/java/org/operation/admin/domain/AdminStatus.java similarity index 60% rename from src/main/java/org/sopt/makers/operation/entity/admin/AdminStatus.java rename to operation-domain/src/main/java/org/operation/admin/domain/AdminStatus.java index ae7410b3..c61f09b2 100644 --- a/src/main/java/org/sopt/makers/operation/entity/admin/AdminStatus.java +++ b/operation-domain/src/main/java/org/operation/admin/domain/AdminStatus.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.entity.admin; +package org.operation.admin.domain; public enum AdminStatus { DEVELOPER, SOPT, MAKERS, NOT_CERTIFIED diff --git a/src/main/java/org/sopt/makers/operation/entity/admin/Role.java b/operation-domain/src/main/java/org/operation/admin/domain/Role.java similarity index 74% rename from src/main/java/org/sopt/makers/operation/entity/admin/Role.java rename to operation-domain/src/main/java/org/operation/admin/domain/Role.java index f4429ea5..c2985f69 100644 --- a/src/main/java/org/sopt/makers/operation/entity/admin/Role.java +++ b/operation-domain/src/main/java/org/operation/admin/domain/Role.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.entity.admin; +package org.operation.admin.domain; public enum Role { OPERATION_TEAM, PRESIDENT, VICE_PRESIDENT, AFFAIRS, MANAGE, MEDIA, PLAN, DESIGN, WEB, ANDROID, IOS, SERVER, MAKERS diff --git a/src/main/java/org/sopt/makers/operation/entity/alarm/Alarm.java b/operation-domain/src/main/java/org/operation/alarm/Alarm.java similarity index 93% rename from src/main/java/org/sopt/makers/operation/entity/alarm/Alarm.java rename to operation-domain/src/main/java/org/operation/alarm/Alarm.java index 7f536a8f..eb5d7781 100644 --- a/src/main/java/org/sopt/makers/operation/entity/alarm/Alarm.java +++ b/operation-domain/src/main/java/org/operation/alarm/Alarm.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.entity.alarm; +package org.operation.alarm; import static java.util.Objects.*; import static javax.persistence.EnumType.*; @@ -17,8 +17,8 @@ import org.sopt.makers.operation.converter.StringListConverter; import org.sopt.makers.operation.dto.alarm.request.AlarmRequestDTO; -import org.sopt.makers.operation.entity.BaseEntity; -import org.sopt.makers.operation.entity.Part; +import org.operation.BaseEntity; +import org.operation.Part; import lombok.Getter; import lombok.NoArgsConstructor; diff --git a/src/main/java/org/sopt/makers/operation/entity/alarm/Attribute.java b/operation-domain/src/main/java/org/operation/alarm/Attribute.java similarity index 78% rename from src/main/java/org/sopt/makers/operation/entity/alarm/Attribute.java rename to operation-domain/src/main/java/org/operation/alarm/Attribute.java index 0a64f842..84508927 100644 --- a/src/main/java/org/sopt/makers/operation/entity/alarm/Attribute.java +++ b/operation-domain/src/main/java/org/operation/alarm/Attribute.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.entity.alarm; +package org.operation.alarm; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/src/main/java/org/sopt/makers/operation/entity/alarm/Status.java b/operation-domain/src/main/java/org/operation/alarm/Status.java similarity index 79% rename from src/main/java/org/sopt/makers/operation/entity/alarm/Status.java rename to operation-domain/src/main/java/org/operation/alarm/Status.java index 682a4247..d08ebc4a 100644 --- a/src/main/java/org/sopt/makers/operation/entity/alarm/Status.java +++ b/operation-domain/src/main/java/org/operation/alarm/Status.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.entity.alarm; +package org.operation.alarm; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/src/main/java/org/sopt/makers/operation/entity/attendance/Attendance.java b/operation-domain/src/main/java/org/operation/attendance/Attendance.java similarity index 92% rename from src/main/java/org/sopt/makers/operation/entity/attendance/Attendance.java rename to operation-domain/src/main/java/org/operation/attendance/Attendance.java index e11fa9db..7377d7f3 100644 --- a/src/main/java/org/sopt/makers/operation/entity/attendance/Attendance.java +++ b/operation-domain/src/main/java/org/operation/attendance/Attendance.java @@ -1,8 +1,8 @@ -package org.sopt.makers.operation.entity.attendance; +package org.operation.attendance; import static javax.persistence.GenerationType.*; import static org.sopt.makers.operation.common.ExceptionMessage.*; -import static org.sopt.makers.operation.entity.attendance.AttendanceStatus.*; +import static org.operation.attendance.AttendanceStatus.*; import java.util.ArrayList; import java.util.List; @@ -20,8 +20,8 @@ import javax.persistence.ManyToOne; import javax.persistence.OneToMany; -import org.sopt.makers.operation.entity.member.Member; -import org.sopt.makers.operation.entity.lecture.Lecture; +import org.operation.member.Member; +import org.operation.lecture.Lecture; import lombok.*; diff --git a/src/main/java/org/sopt/makers/operation/entity/attendance/AttendanceStatus.java b/operation-domain/src/main/java/org/operation/attendance/AttendanceStatus.java similarity index 83% rename from src/main/java/org/sopt/makers/operation/entity/attendance/AttendanceStatus.java rename to operation-domain/src/main/java/org/operation/attendance/AttendanceStatus.java index 6a6e0666..05dc0176 100644 --- a/src/main/java/org/sopt/makers/operation/entity/attendance/AttendanceStatus.java +++ b/operation-domain/src/main/java/org/operation/attendance/AttendanceStatus.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.entity.attendance; +package org.operation.attendance; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/src/main/java/org/sopt/makers/operation/entity/attendance/SubAttendance.java b/operation-domain/src/main/java/org/operation/attendance/SubAttendance.java similarity index 90% rename from src/main/java/org/sopt/makers/operation/entity/attendance/SubAttendance.java rename to operation-domain/src/main/java/org/operation/attendance/SubAttendance.java index 81ca1d23..a190aaf4 100644 --- a/src/main/java/org/sopt/makers/operation/entity/attendance/SubAttendance.java +++ b/operation-domain/src/main/java/org/operation/attendance/SubAttendance.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.entity.attendance; +package org.operation.attendance; import static javax.persistence.GenerationType.*; @@ -14,8 +14,8 @@ import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; -import org.sopt.makers.operation.entity.BaseEntity; -import org.sopt.makers.operation.entity.lecture.SubLecture; +import org.operation.BaseEntity; +import org.operation.lecture.SubLecture; import lombok.Getter; import lombok.NoArgsConstructor; diff --git a/src/main/java/org/sopt/makers/operation/entity/lecture/Attribute.java b/operation-domain/src/main/java/org/operation/lecture/Attribute.java similarity index 79% rename from src/main/java/org/sopt/makers/operation/entity/lecture/Attribute.java rename to operation-domain/src/main/java/org/operation/lecture/Attribute.java index b5869d72..cf57c07f 100644 --- a/src/main/java/org/sopt/makers/operation/entity/lecture/Attribute.java +++ b/operation-domain/src/main/java/org/operation/lecture/Attribute.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.entity.lecture; +package org.operation.lecture; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/src/main/java/org/sopt/makers/operation/entity/lecture/Lecture.java b/operation-domain/src/main/java/org/operation/lecture/Lecture.java similarity index 87% rename from src/main/java/org/sopt/makers/operation/entity/lecture/Lecture.java rename to operation-domain/src/main/java/org/operation/lecture/Lecture.java index 55bf09ba..d915d519 100644 --- a/src/main/java/org/sopt/makers/operation/entity/lecture/Lecture.java +++ b/operation-domain/src/main/java/org/operation/lecture/Lecture.java @@ -1,7 +1,7 @@ -package org.sopt.makers.operation.entity.lecture; +package org.operation.lecture; import static javax.persistence.GenerationType.*; -import static org.sopt.makers.operation.entity.lecture.LectureStatus.*; +import static org.operation.lecture.LectureStatus.*; import java.time.LocalDateTime; import java.util.ArrayList; @@ -15,9 +15,9 @@ import javax.persistence.Id; import javax.persistence.OneToMany; -import org.sopt.makers.operation.entity.attendance.Attendance; -import org.sopt.makers.operation.entity.BaseEntity; -import org.sopt.makers.operation.entity.Part; +import org.operation.attendance.Attendance; +import org.operation.BaseEntity; +import org.operation.Part; import lombok.Builder; import lombok.Getter; diff --git a/src/main/java/org/sopt/makers/operation/entity/lecture/LectureStatus.java b/operation-domain/src/main/java/org/operation/lecture/LectureStatus.java similarity index 54% rename from src/main/java/org/sopt/makers/operation/entity/lecture/LectureStatus.java rename to operation-domain/src/main/java/org/operation/lecture/LectureStatus.java index a121b08f..5852af16 100644 --- a/src/main/java/org/sopt/makers/operation/entity/lecture/LectureStatus.java +++ b/operation-domain/src/main/java/org/operation/lecture/LectureStatus.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.entity.lecture; +package org.operation.lecture; public enum LectureStatus { BEFORE, FIRST, SECOND, END diff --git a/src/main/java/org/sopt/makers/operation/entity/lecture/SubLecture.java b/operation-domain/src/main/java/org/operation/lecture/SubLecture.java similarity index 83% rename from src/main/java/org/sopt/makers/operation/entity/lecture/SubLecture.java rename to operation-domain/src/main/java/org/operation/lecture/SubLecture.java index 77eeb510..794de75c 100644 --- a/src/main/java/org/sopt/makers/operation/entity/lecture/SubLecture.java +++ b/operation-domain/src/main/java/org/operation/lecture/SubLecture.java @@ -1,7 +1,7 @@ -package org.sopt.makers.operation.entity.lecture; +package org.operation.lecture; import static javax.persistence.GenerationType.*; -import static org.sopt.makers.operation.entity.lecture.LectureStatus.*; +import static org.operation.lecture.LectureStatus.*; import java.time.LocalDateTime; import java.util.ArrayList; @@ -17,9 +17,7 @@ import javax.persistence.ManyToOne; import javax.persistence.OneToMany; -import org.sopt.makers.operation.entity.attendance.SubAttendance; -import org.sopt.makers.operation.entity.lecture.Lecture; -import org.sopt.makers.operation.entity.lecture.LectureStatus; +import org.operation.attendance.SubAttendance; import lombok.Getter; import lombok.NoArgsConstructor; diff --git a/src/main/java/org/sopt/makers/operation/entity/member/Member.java b/operation-domain/src/main/java/org/operation/member/Member.java similarity index 87% rename from src/main/java/org/sopt/makers/operation/entity/member/Member.java rename to operation-domain/src/main/java/org/operation/member/Member.java index 8d8cbfc5..5b22d418 100644 --- a/src/main/java/org/sopt/makers/operation/entity/member/Member.java +++ b/operation-domain/src/main/java/org/operation/member/Member.java @@ -1,6 +1,6 @@ -package org.sopt.makers.operation.entity.member; +package org.operation.member; -import static org.sopt.makers.operation.entity.lecture.LectureStatus.*; +import static org.operation.lecture.LectureStatus.*; import java.util.ArrayList; import java.util.List; @@ -15,8 +15,8 @@ import javax.persistence.OneToMany; import org.sopt.makers.operation.dto.member.request.MemberRequestDTO; -import org.sopt.makers.operation.entity.Part; -import org.sopt.makers.operation.entity.attendance.Attendance; +import org.operation.Part; +import org.operation.attendance.Attendance; import lombok.Getter; import lombok.NoArgsConstructor; diff --git a/operation-domain/src/main/java/org/operation/member/ObYb.java b/operation-domain/src/main/java/org/operation/member/ObYb.java new file mode 100644 index 00000000..5d0178fa --- /dev/null +++ b/operation-domain/src/main/java/org/operation/member/ObYb.java @@ -0,0 +1,5 @@ +package org.operation.member; + +public enum ObYb { + OB, YB +} diff --git a/src/main/java/org/sopt/makers/operation/entity/schedule/Schedule.java b/operation-domain/src/main/java/org/operation/schedule/Schedule.java similarity index 79% rename from src/main/java/org/sopt/makers/operation/entity/schedule/Schedule.java rename to operation-domain/src/main/java/org/operation/schedule/Schedule.java index b376878b..24c5a650 100644 --- a/src/main/java/org/sopt/makers/operation/entity/schedule/Schedule.java +++ b/operation-domain/src/main/java/org/operation/schedule/Schedule.java @@ -1,9 +1,9 @@ -package org.sopt.makers.operation.entity.schedule; +package org.operation.schedule; import lombok.Getter; import lombok.NoArgsConstructor; -import org.sopt.makers.operation.entity.BaseEntity; -import org.sopt.makers.operation.entity.lecture.Attribute; +import org.operation.BaseEntity; +import org.operation.lecture.Attribute; import javax.persistence.*; import java.time.LocalDateTime; diff --git a/settings.gradle b/settings.gradle index e0518269..2988048c 100644 --- a/settings.gradle +++ b/settings.gradle @@ -4,4 +4,5 @@ include 'operation-auth' include 'operation-domain' include 'operation-external' include 'operation-storage' +include 'operation-business' diff --git a/src/main/java/org/sopt/makers/operation/common/ResponseMessage.java b/src/main/java/org/sopt/makers/operation/common/ResponseMessage.java index 601e7474..59d0d592 100644 --- a/src/main/java/org/sopt/makers/operation/common/ResponseMessage.java +++ b/src/main/java/org/sopt/makers/operation/common/ResponseMessage.java @@ -4,9 +4,7 @@ public enum ResponseMessage { // // /** auth **/ - // SUCCESS_SIGN_UP("회원 가입 성공"), - // SUCCESS_LOGIN_UP("로그인 성공"), - // SUCCESS_GET_REFRESH_TOKEN("토큰 재발급 성공"), + // // SUCCESS_CREATE_MEMBER("회원 등록 성공"), // diff --git a/src/main/java/org/sopt/makers/operation/dto/admin/request/LoginRequestDTO.java b/src/main/java/org/sopt/makers/operation/dto/admin/request/LoginRequestDTO.java deleted file mode 100644 index 945b165d..00000000 --- a/src/main/java/org/sopt/makers/operation/dto/admin/request/LoginRequestDTO.java +++ /dev/null @@ -1,4 +0,0 @@ -package org.sopt.makers.operation.dto.admin.request; - -public record LoginRequestDTO(String email, String password) { -} diff --git a/src/main/java/org/sopt/makers/operation/dto/admin/request/SignUpRequestDTO.java b/src/main/java/org/sopt/makers/operation/dto/admin/request/SignUpRequestDTO.java deleted file mode 100644 index fd526f0b..00000000 --- a/src/main/java/org/sopt/makers/operation/dto/admin/request/SignUpRequestDTO.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.sopt.makers.operation.dto.admin.request; - -import org.sopt.makers.operation.entity.admin.Role; - -public record SignUpRequestDTO( - String email, - String password, - String name, - Role role -) { -} diff --git a/src/main/java/org/sopt/makers/operation/dto/admin/response/LoginResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/admin/response/LoginResponseDTO.java deleted file mode 100644 index a263c3e5..00000000 --- a/src/main/java/org/sopt/makers/operation/dto/admin/response/LoginResponseDTO.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.sopt.makers.operation.dto.admin.response; - -import lombok.Builder; -import org.sopt.makers.operation.entity.admin.Admin; -import org.sopt.makers.operation.entity.admin.AdminStatus; - -@Builder -public record LoginResponseDTO(LoginResponseVO loginResponseVO, String refreshToken) { - public static LoginResponseDTO of(Admin admin, String accessToken, String refreshToken) { - return LoginResponseDTO.builder() - .loginResponseVO(LoginResponseVO.of(admin.getId(), admin.getName(), admin.getStatus(), accessToken)) - .refreshToken(refreshToken) - .build(); - } - - @Builder - record LoginResponseVO(Long id, String name, AdminStatus adminStatus, String accessToken) { - public static LoginResponseVO of(Long id, String name, AdminStatus adminStatus, String accessToken) { - return LoginResponseVO.builder() - .id(id) - .name(name) - .adminStatus(adminStatus) - .accessToken(accessToken) - .build(); - } - } -} diff --git a/src/main/java/org/sopt/makers/operation/dto/admin/response/RefreshResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/admin/response/RefreshResponseDTO.java deleted file mode 100644 index d3cfc552..00000000 --- a/src/main/java/org/sopt/makers/operation/dto/admin/response/RefreshResponseDTO.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.sopt.makers.operation.dto.admin.response; - -public record RefreshResponseDTO(String accessToken, String refreshToken) { - public static RefreshResponseDTO of(String accessToken, String refreshToken) { - return new RefreshResponseDTO( - accessToken, - refreshToken - ); - } -} \ No newline at end of file diff --git a/src/main/java/org/sopt/makers/operation/dto/admin/response/SignUpResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/admin/response/SignUpResponseDTO.java deleted file mode 100644 index fdb6b954..00000000 --- a/src/main/java/org/sopt/makers/operation/dto/admin/response/SignUpResponseDTO.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.sopt.makers.operation.dto.admin.response; - -import org.sopt.makers.operation.entity.admin.Role; - -public record SignUpResponseDTO( - Long id, - String email, - String name, - Role role -) { -} diff --git a/src/main/java/org/sopt/makers/operation/dto/alarm/request/AlarmRequestDTO.java b/src/main/java/org/sopt/makers/operation/dto/alarm/request/AlarmRequestDTO.java index 5d4fbc1b..1b1144e5 100644 --- a/src/main/java/org/sopt/makers/operation/dto/alarm/request/AlarmRequestDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/alarm/request/AlarmRequestDTO.java @@ -3,8 +3,8 @@ import java.util.List; import org.sopt.makers.operation.entity.Part; -import org.sopt.makers.operation.entity.alarm.Alarm; -import org.sopt.makers.operation.entity.alarm.Attribute; +import org.operation.alarm.Alarm; +import org.operation.alarm.Attribute; public record AlarmRequestDTO( int generation, diff --git a/src/main/java/org/sopt/makers/operation/dto/alarm/request/AlarmSenderDTO.java b/src/main/java/org/sopt/makers/operation/dto/alarm/request/AlarmSenderDTO.java index aad31a51..9cc2dbc4 100644 --- a/src/main/java/org/sopt/makers/operation/dto/alarm/request/AlarmSenderDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/alarm/request/AlarmSenderDTO.java @@ -2,8 +2,8 @@ import java.util.List; -import org.sopt.makers.operation.entity.alarm.Alarm; -import org.sopt.makers.operation.entity.alarm.Attribute; +import org.operation.alarm.Alarm; +import org.operation.alarm.Attribute; import lombok.Builder; diff --git a/src/main/java/org/sopt/makers/operation/dto/alarm/response/AlarmResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/alarm/response/AlarmResponseDTO.java index 8899d3d3..f31530fe 100644 --- a/src/main/java/org/sopt/makers/operation/dto/alarm/response/AlarmResponseDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/alarm/response/AlarmResponseDTO.java @@ -2,7 +2,7 @@ import static java.util.Objects.*; -import org.sopt.makers.operation.entity.alarm.Alarm; +import org.operation.alarm.Alarm; import lombok.Builder; diff --git a/src/main/java/org/sopt/makers/operation/dto/alarm/response/AlarmsResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/alarm/response/AlarmsResponseDTO.java index faa87d56..689c8ae3 100644 --- a/src/main/java/org/sopt/makers/operation/dto/alarm/response/AlarmsResponseDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/alarm/response/AlarmsResponseDTO.java @@ -4,7 +4,7 @@ import java.util.List; -import org.sopt.makers.operation.entity.alarm.Alarm; +import org.operation.alarm.Alarm; import lombok.Builder; diff --git a/src/main/java/org/sopt/makers/operation/dto/attendance/request/SubAttendanceUpdateRequestDTO.java b/src/main/java/org/sopt/makers/operation/dto/attendance/request/SubAttendanceUpdateRequestDTO.java index 68a0e338..d6fee73b 100644 --- a/src/main/java/org/sopt/makers/operation/dto/attendance/request/SubAttendanceUpdateRequestDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/attendance/request/SubAttendanceUpdateRequestDTO.java @@ -1,6 +1,6 @@ package org.sopt.makers.operation.dto.attendance.request; -import org.sopt.makers.operation.entity.attendance.AttendanceStatus; +import org.operation.attendance.AttendanceStatus; public record SubAttendanceUpdateRequestDTO( Long subAttendanceId, diff --git a/src/main/java/org/sopt/makers/operation/dto/attendance/response/AttendanceMemberResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/attendance/response/AttendanceMemberResponseDTO.java index 5c42ae0c..c91fddbe 100644 --- a/src/main/java/org/sopt/makers/operation/dto/attendance/response/AttendanceMemberResponseDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/attendance/response/AttendanceMemberResponseDTO.java @@ -2,9 +2,9 @@ import java.util.List; -import org.sopt.makers.operation.entity.attendance.Attendance; -import org.sopt.makers.operation.entity.member.Member; -import org.sopt.makers.operation.entity.attendance.SubAttendance; +import org.operation.attendance.Attendance; +import org.operation.member.Member; +import org.operation.attendance.SubAttendance; public record AttendanceMemberResponseDTO( String name, diff --git a/src/main/java/org/sopt/makers/operation/dto/attendance/response/AttendanceTotalResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/attendance/response/AttendanceTotalResponseDTO.java index 9a7ac18a..af3ec806 100644 --- a/src/main/java/org/sopt/makers/operation/dto/attendance/response/AttendanceTotalResponseDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/attendance/response/AttendanceTotalResponseDTO.java @@ -1,6 +1,6 @@ package org.sopt.makers.operation.dto.attendance.response; -import org.sopt.makers.operation.entity.member.Member; +import org.operation.member.Member; import org.sopt.makers.operation.entity.Part; import java.util.List; diff --git a/src/main/java/org/sopt/makers/operation/dto/attendance/response/AttendanceTotalVO.java b/src/main/java/org/sopt/makers/operation/dto/attendance/response/AttendanceTotalVO.java index 2107b781..45a2b9c0 100644 --- a/src/main/java/org/sopt/makers/operation/dto/attendance/response/AttendanceTotalVO.java +++ b/src/main/java/org/sopt/makers/operation/dto/attendance/response/AttendanceTotalVO.java @@ -1,8 +1,8 @@ package org.sopt.makers.operation.dto.attendance.response; -import org.sopt.makers.operation.entity.attendance.Attendance; -import org.sopt.makers.operation.entity.attendance.AttendanceStatus; -import org.sopt.makers.operation.entity.lecture.Attribute; +import org.operation.attendance.Attendance; +import org.operation.attendance.AttendanceStatus; +import org.operation.lecture.Attribute; import java.time.format.DateTimeFormatter; diff --git a/src/main/java/org/sopt/makers/operation/dto/attendance/response/AttendancesResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/attendance/response/AttendancesResponseDTO.java index 45813484..eceaa7b6 100644 --- a/src/main/java/org/sopt/makers/operation/dto/attendance/response/AttendancesResponseDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/attendance/response/AttendancesResponseDTO.java @@ -2,7 +2,7 @@ import java.util.List; -import org.sopt.makers.operation.entity.attendance.Attendance; +import org.operation.attendance.Attendance; public record AttendancesResponseDTO( List attendances, diff --git a/src/main/java/org/sopt/makers/operation/dto/attendance/response/MemberResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/attendance/response/MemberResponseDTO.java index a11dff7d..69029e58 100644 --- a/src/main/java/org/sopt/makers/operation/dto/attendance/response/MemberResponseDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/attendance/response/MemberResponseDTO.java @@ -2,10 +2,10 @@ import java.util.List; -import org.sopt.makers.operation.entity.attendance.Attendance; -import org.sopt.makers.operation.entity.attendance.AttendanceStatus; -import org.sopt.makers.operation.entity.member.Member; -import org.sopt.makers.operation.entity.attendance.SubAttendance; +import org.operation.attendance.Attendance; +import org.operation.attendance.AttendanceStatus; +import org.operation.member.Member; +import org.operation.attendance.SubAttendance; public record MemberResponseDTO ( Long attendanceId, diff --git a/src/main/java/org/sopt/makers/operation/dto/attendance/response/SubAttendanceUpdateResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/attendance/response/SubAttendanceUpdateResponseDTO.java index 8aa98a49..34b333d5 100644 --- a/src/main/java/org/sopt/makers/operation/dto/attendance/response/SubAttendanceUpdateResponseDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/attendance/response/SubAttendanceUpdateResponseDTO.java @@ -1,7 +1,7 @@ package org.sopt.makers.operation.dto.attendance.response; -import org.sopt.makers.operation.entity.attendance.AttendanceStatus; -import org.sopt.makers.operation.entity.attendance.SubAttendance; +import org.operation.attendance.AttendanceStatus; +import org.operation.attendance.SubAttendance; public record SubAttendanceUpdateResponseDTO( Long subAttendanceId, diff --git a/src/main/java/org/sopt/makers/operation/dto/lecture/request/LectureRequestDTO.java b/src/main/java/org/sopt/makers/operation/dto/lecture/request/LectureRequestDTO.java index ea5125d8..4232f149 100644 --- a/src/main/java/org/sopt/makers/operation/dto/lecture/request/LectureRequestDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/lecture/request/LectureRequestDTO.java @@ -3,8 +3,8 @@ import java.time.LocalDateTime; import java.time.format.DateTimeParseException; -import org.sopt.makers.operation.entity.lecture.Attribute; -import org.sopt.makers.operation.entity.lecture.Lecture; +import org.operation.lecture.Attribute; +import org.operation.lecture.Lecture; import org.sopt.makers.operation.entity.Part; import lombok.*; diff --git a/src/main/java/org/sopt/makers/operation/dto/lecture/response/AttendanceResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/lecture/response/AttendanceResponseDTO.java index e377623d..d3265f65 100644 --- a/src/main/java/org/sopt/makers/operation/dto/lecture/response/AttendanceResponseDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/lecture/response/AttendanceResponseDTO.java @@ -1,7 +1,7 @@ package org.sopt.makers.operation.dto.lecture.response; -import org.sopt.makers.operation.entity.lecture.SubLecture; -import org.sopt.makers.operation.entity.lecture.Lecture; +import org.operation.lecture.SubLecture; +import org.operation.lecture.Lecture; import lombok.Builder; diff --git a/src/main/java/org/sopt/makers/operation/dto/lecture/response/AttendancesStatusVO.java b/src/main/java/org/sopt/makers/operation/dto/lecture/response/AttendancesStatusVO.java index c566bc87..1d9cf535 100644 --- a/src/main/java/org/sopt/makers/operation/dto/lecture/response/AttendancesStatusVO.java +++ b/src/main/java/org/sopt/makers/operation/dto/lecture/response/AttendancesStatusVO.java @@ -1,11 +1,11 @@ package org.sopt.makers.operation.dto.lecture.response; -import static org.sopt.makers.operation.entity.attendance.AttendanceStatus.*; +import static org.operation.attendance.AttendanceStatus.*; import java.time.LocalDateTime; -import org.sopt.makers.operation.entity.attendance.AttendanceStatus; -import org.sopt.makers.operation.entity.lecture.Lecture; +import org.operation.attendance.AttendanceStatus; +import org.operation.lecture.Lecture; import lombok.Builder; diff --git a/src/main/java/org/sopt/makers/operation/dto/lecture/response/LectureCurrentRoundResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/lecture/response/LectureCurrentRoundResponseDTO.java index aac13efb..900247dd 100644 --- a/src/main/java/org/sopt/makers/operation/dto/lecture/response/LectureCurrentRoundResponseDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/lecture/response/LectureCurrentRoundResponseDTO.java @@ -1,6 +1,6 @@ package org.sopt.makers.operation.dto.lecture.response; -import org.sopt.makers.operation.entity.lecture.SubLecture; +import org.operation.lecture.SubLecture; public record LectureCurrentRoundResponseDTO( Long id, diff --git a/src/main/java/org/sopt/makers/operation/dto/lecture/response/LectureDetailResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/lecture/response/LectureDetailResponseDTO.java index 08d5d8d8..4b5e3804 100644 --- a/src/main/java/org/sopt/makers/operation/dto/lecture/response/LectureDetailResponseDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/lecture/response/LectureDetailResponseDTO.java @@ -1,6 +1,6 @@ package org.sopt.makers.operation.dto.lecture.response; -import org.sopt.makers.operation.entity.lecture.Lecture; +import org.operation.lecture.Lecture; import lombok.Builder; diff --git a/src/main/java/org/sopt/makers/operation/dto/lecture/response/LectureResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/lecture/response/LectureResponseDTO.java index a48e7e78..4178dc5d 100644 --- a/src/main/java/org/sopt/makers/operation/dto/lecture/response/LectureResponseDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/lecture/response/LectureResponseDTO.java @@ -6,10 +6,10 @@ import java.util.List; import org.sopt.makers.operation.entity.Part; -import org.sopt.makers.operation.entity.lecture.SubLecture; -import org.sopt.makers.operation.entity.lecture.Attribute; -import org.sopt.makers.operation.entity.lecture.Lecture; -import org.sopt.makers.operation.entity.lecture.LectureStatus; +import org.operation.lecture.SubLecture; +import org.operation.lecture.Attribute; +import org.operation.lecture.Lecture; +import org.operation.lecture.LectureStatus; import lombok.*; diff --git a/src/main/java/org/sopt/makers/operation/dto/lecture/response/LecturesResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/lecture/response/LecturesResponseDTO.java index a40239dc..e4ba8c5c 100644 --- a/src/main/java/org/sopt/makers/operation/dto/lecture/response/LecturesResponseDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/lecture/response/LecturesResponseDTO.java @@ -3,8 +3,8 @@ import java.util.List; import org.sopt.makers.operation.entity.Part; -import org.sopt.makers.operation.entity.lecture.Attribute; -import org.sopt.makers.operation.entity.lecture.Lecture; +import org.operation.lecture.Attribute; +import org.operation.lecture.Lecture; import lombok.*; diff --git a/src/main/java/org/sopt/makers/operation/dto/lecture/response/TodayLectureResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/lecture/response/TodayLectureResponseDTO.java index 56c69cdd..8e395522 100644 --- a/src/main/java/org/sopt/makers/operation/dto/lecture/response/TodayLectureResponseDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/lecture/response/TodayLectureResponseDTO.java @@ -2,9 +2,9 @@ import lombok.Builder; -import org.sopt.makers.operation.entity.attendance.AttendanceStatus; -import org.sopt.makers.operation.entity.attendance.SubAttendance; -import org.sopt.makers.operation.entity.lecture.Lecture; +import org.operation.attendance.AttendanceStatus; +import org.operation.attendance.SubAttendance; +import org.operation.lecture.Lecture; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; diff --git a/src/main/java/org/sopt/makers/operation/dto/member/request/MemberRequestDTO.java b/src/main/java/org/sopt/makers/operation/dto/member/request/MemberRequestDTO.java index 5e44d375..b0ec6fcf 100644 --- a/src/main/java/org/sopt/makers/operation/dto/member/request/MemberRequestDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/member/request/MemberRequestDTO.java @@ -1,6 +1,6 @@ package org.sopt.makers.operation.dto.member.request; -import org.sopt.makers.operation.entity.member.ObYb; +import org.operation.member.ObYb; import org.sopt.makers.operation.entity.Part; public record MemberRequestDTO( diff --git a/src/main/java/org/sopt/makers/operation/dto/member/response/MemberListGetResponse.java b/src/main/java/org/sopt/makers/operation/dto/member/response/MemberListGetResponse.java index 12571567..f22161f3 100644 --- a/src/main/java/org/sopt/makers/operation/dto/member/response/MemberListGetResponse.java +++ b/src/main/java/org/sopt/makers/operation/dto/member/response/MemberListGetResponse.java @@ -1,7 +1,7 @@ package org.sopt.makers.operation.dto.member.response; import org.sopt.makers.operation.dto.attendance.response.AttendanceTotalCountVO; -import org.sopt.makers.operation.entity.member.Member; +import org.operation.member.Member; import org.sopt.makers.operation.entity.Part; public record MemberListGetResponse( diff --git a/src/main/java/org/sopt/makers/operation/dto/schedule/response/SchedulesResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/schedule/response/SchedulesResponseDTO.java index 31daed32..1d19d54d 100644 --- a/src/main/java/org/sopt/makers/operation/dto/schedule/response/SchedulesResponseDTO.java +++ b/src/main/java/org/sopt/makers/operation/dto/schedule/response/SchedulesResponseDTO.java @@ -1,8 +1,8 @@ package org.sopt.makers.operation.dto.schedule.response; import lombok.*; -import org.sopt.makers.operation.entity.lecture.Attribute; -import org.sopt.makers.operation.entity.schedule.Schedule; +import org.operation.lecture.Attribute; +import org.operation.schedule.Schedule; import java.time.LocalDate; import java.time.format.TextStyle; diff --git a/src/main/java/org/sopt/makers/operation/entity/member/ObYb.java b/src/main/java/org/sopt/makers/operation/entity/member/ObYb.java deleted file mode 100644 index 0041bffb..00000000 --- a/src/main/java/org/sopt/makers/operation/entity/member/ObYb.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.sopt.makers.operation.entity.member; - -public enum ObYb { - OB, YB -} diff --git a/src/main/java/org/sopt/makers/operation/repository/alarm/AlarmCustomRepository.java b/src/main/java/org/sopt/makers/operation/repository/alarm/AlarmCustomRepository.java index 70dc812c..5cae219b 100644 --- a/src/main/java/org/sopt/makers/operation/repository/alarm/AlarmCustomRepository.java +++ b/src/main/java/org/sopt/makers/operation/repository/alarm/AlarmCustomRepository.java @@ -3,8 +3,8 @@ import java.util.List; import org.sopt.makers.operation.entity.Part; -import org.sopt.makers.operation.entity.alarm.Alarm; -import org.sopt.makers.operation.entity.alarm.Status; +import org.operation.alarm.Alarm; +import org.operation.alarm.Status; import org.springframework.data.domain.Pageable; public interface AlarmCustomRepository { diff --git a/src/main/java/org/sopt/makers/operation/repository/alarm/AlarmRepository.java b/src/main/java/org/sopt/makers/operation/repository/alarm/AlarmRepository.java index 9ca5e9d4..94ded05c 100644 --- a/src/main/java/org/sopt/makers/operation/repository/alarm/AlarmRepository.java +++ b/src/main/java/org/sopt/makers/operation/repository/alarm/AlarmRepository.java @@ -1,6 +1,6 @@ package org.sopt.makers.operation.repository.alarm; -import org.sopt.makers.operation.entity.alarm.Alarm; +import org.operation.alarm.Alarm; import org.springframework.data.jpa.repository.JpaRepository; public interface AlarmRepository extends JpaRepository, AlarmCustomRepository { diff --git a/src/main/java/org/sopt/makers/operation/repository/alarm/AlarmRepositoryImpl.java b/src/main/java/org/sopt/makers/operation/repository/alarm/AlarmRepositoryImpl.java index bacbba7c..5b90acea 100644 --- a/src/main/java/org/sopt/makers/operation/repository/alarm/AlarmRepositoryImpl.java +++ b/src/main/java/org/sopt/makers/operation/repository/alarm/AlarmRepositoryImpl.java @@ -1,13 +1,13 @@ package org.sopt.makers.operation.repository.alarm; import static java.util.Objects.*; -import static org.sopt.makers.operation.entity.alarm.QAlarm.*; +import static org.operation.alarm.QAlarm.*; import java.util.List; import org.sopt.makers.operation.entity.Part; -import org.sopt.makers.operation.entity.alarm.Alarm; -import org.sopt.makers.operation.entity.alarm.Status; +import org.operation.alarm.Alarm; +import org.operation.alarm.Status; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Repository; diff --git a/src/main/java/org/sopt/makers/operation/repository/attendance/AttendanceCustomRepository.java b/src/main/java/org/sopt/makers/operation/repository/attendance/AttendanceCustomRepository.java index 40c43981..030f6e68 100644 --- a/src/main/java/org/sopt/makers/operation/repository/attendance/AttendanceCustomRepository.java +++ b/src/main/java/org/sopt/makers/operation/repository/attendance/AttendanceCustomRepository.java @@ -2,8 +2,8 @@ import java.util.List; -import org.sopt.makers.operation.entity.attendance.Attendance; -import org.sopt.makers.operation.entity.member.Member; +import org.operation.attendance.Attendance; +import org.operation.member.Member; import org.sopt.makers.operation.entity.Part; import org.springframework.data.domain.Pageable; diff --git a/src/main/java/org/sopt/makers/operation/repository/attendance/AttendanceRepository.java b/src/main/java/org/sopt/makers/operation/repository/attendance/AttendanceRepository.java index 6edcebfe..42bd6741 100644 --- a/src/main/java/org/sopt/makers/operation/repository/attendance/AttendanceRepository.java +++ b/src/main/java/org/sopt/makers/operation/repository/attendance/AttendanceRepository.java @@ -1,7 +1,7 @@ package org.sopt.makers.operation.repository.attendance; -import org.sopt.makers.operation.entity.attendance.Attendance; -import org.sopt.makers.operation.entity.lecture.Lecture; +import org.operation.attendance.Attendance; +import org.operation.lecture.Lecture; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; diff --git a/src/main/java/org/sopt/makers/operation/repository/attendance/AttendanceRepositoryImpl.java b/src/main/java/org/sopt/makers/operation/repository/attendance/AttendanceRepositoryImpl.java index 8362a3f4..f4157ff2 100644 --- a/src/main/java/org/sopt/makers/operation/repository/attendance/AttendanceRepositoryImpl.java +++ b/src/main/java/org/sopt/makers/operation/repository/attendance/AttendanceRepositoryImpl.java @@ -2,11 +2,11 @@ import static com.querydsl.core.types.dsl.Expressions.*; import static java.util.Objects.*; -import static org.sopt.makers.operation.entity.attendance.QAttendance.*; -import static org.sopt.makers.operation.entity.attendance.QSubAttendance.*; -import static org.sopt.makers.operation.entity.lecture.QLecture.*; -import static org.sopt.makers.operation.entity.lecture.QSubLecture.*; -import static org.sopt.makers.operation.entity.member.QMember.*; +import static org.operation.attendance.QAttendance.*; +import static org.operation.attendance.QSubAttendance.*; +import static org.operation.lecture.QLecture.*; +import static org.operation.lecture.QSubLecture.*; +import static org.operation.member.QMember.*; import java.time.LocalDate; import java.time.LocalDateTime; @@ -16,10 +16,10 @@ import lombok.val; import org.sopt.makers.operation.config.ValueConfig; -import org.sopt.makers.operation.entity.attendance.Attendance; -import org.sopt.makers.operation.entity.member.Member; +import org.operation.attendance.Attendance; +import org.operation.member.Member; import org.sopt.makers.operation.entity.Part; -import org.sopt.makers.operation.entity.lecture.LectureStatus; +import org.operation.lecture.LectureStatus; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Repository; diff --git a/src/main/java/org/sopt/makers/operation/repository/attendance/SubAttendanceRepository.java b/src/main/java/org/sopt/makers/operation/repository/attendance/SubAttendanceRepository.java index 5d8caaa6..c306aa99 100644 --- a/src/main/java/org/sopt/makers/operation/repository/attendance/SubAttendanceRepository.java +++ b/src/main/java/org/sopt/makers/operation/repository/attendance/SubAttendanceRepository.java @@ -2,8 +2,8 @@ import java.util.List; -import org.sopt.makers.operation.entity.attendance.SubAttendance; -import org.sopt.makers.operation.entity.lecture.SubLecture; +import org.operation.attendance.SubAttendance; +import org.operation.lecture.SubLecture; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; diff --git a/src/main/java/org/sopt/makers/operation/repository/lecture/LectureCustomRepository.java b/src/main/java/org/sopt/makers/operation/repository/lecture/LectureCustomRepository.java index 64bf58ae..e1fe62bf 100644 --- a/src/main/java/org/sopt/makers/operation/repository/lecture/LectureCustomRepository.java +++ b/src/main/java/org/sopt/makers/operation/repository/lecture/LectureCustomRepository.java @@ -1,7 +1,7 @@ package org.sopt.makers.operation.repository.lecture; import org.sopt.makers.operation.entity.Part; -import org.sopt.makers.operation.entity.lecture.Lecture; +import org.operation.lecture.Lecture; import java.util.List; import java.util.Optional; diff --git a/src/main/java/org/sopt/makers/operation/repository/lecture/LectureRepository.java b/src/main/java/org/sopt/makers/operation/repository/lecture/LectureRepository.java index 2e73cf22..e1ab6e91 100644 --- a/src/main/java/org/sopt/makers/operation/repository/lecture/LectureRepository.java +++ b/src/main/java/org/sopt/makers/operation/repository/lecture/LectureRepository.java @@ -1,6 +1,6 @@ package org.sopt.makers.operation.repository.lecture; -import org.sopt.makers.operation.entity.lecture.Lecture; +import org.operation.lecture.Lecture; import org.springframework.data.jpa.repository.JpaRepository; public interface LectureRepository extends JpaRepository, LectureCustomRepository { diff --git a/src/main/java/org/sopt/makers/operation/repository/lecture/LectureRepositoryImpl.java b/src/main/java/org/sopt/makers/operation/repository/lecture/LectureRepositoryImpl.java index f5e550f3..371f77c5 100644 --- a/src/main/java/org/sopt/makers/operation/repository/lecture/LectureRepositoryImpl.java +++ b/src/main/java/org/sopt/makers/operation/repository/lecture/LectureRepositoryImpl.java @@ -4,7 +4,7 @@ import com.querydsl.jpa.impl.JPAQueryFactory; import lombok.RequiredArgsConstructor; import org.sopt.makers.operation.entity.Part; -import org.sopt.makers.operation.entity.lecture.Lecture; +import org.operation.lecture.Lecture; import org.springframework.stereotype.Repository; import java.time.LocalDateTime; @@ -12,10 +12,10 @@ import java.util.Optional; import static java.util.Objects.*; -import static org.sopt.makers.operation.entity.attendance.QAttendance.*; -import static org.sopt.makers.operation.entity.lecture.LectureStatus.*; -import static org.sopt.makers.operation.entity.lecture.QLecture.*; -import static org.sopt.makers.operation.entity.member.QMember.*; +import static org.operation.attendance.QAttendance.*; +import static org.operation.lecture.LectureStatus.*; +import static org.operation.lecture.QLecture.*; +import static org.operation.member.QMember.*; @Repository @RequiredArgsConstructor diff --git a/src/main/java/org/sopt/makers/operation/repository/lecture/SubLectureRepository.java b/src/main/java/org/sopt/makers/operation/repository/lecture/SubLectureRepository.java index 1e33f3b7..0907b027 100644 --- a/src/main/java/org/sopt/makers/operation/repository/lecture/SubLectureRepository.java +++ b/src/main/java/org/sopt/makers/operation/repository/lecture/SubLectureRepository.java @@ -1,7 +1,7 @@ package org.sopt.makers.operation.repository.lecture; -import org.sopt.makers.operation.entity.lecture.SubLecture; -import org.sopt.makers.operation.entity.lecture.Lecture; +import org.operation.lecture.SubLecture; +import org.operation.lecture.Lecture; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; diff --git a/src/main/java/org/sopt/makers/operation/repository/member/MemberCustomRepository.java b/src/main/java/org/sopt/makers/operation/repository/member/MemberCustomRepository.java index 9344e655..2dbc950a 100644 --- a/src/main/java/org/sopt/makers/operation/repository/member/MemberCustomRepository.java +++ b/src/main/java/org/sopt/makers/operation/repository/member/MemberCustomRepository.java @@ -4,7 +4,7 @@ import java.util.Optional; import org.sopt.makers.operation.dto.member.response.MemberSearchCondition; -import org.sopt.makers.operation.entity.member.Member; +import org.operation.member.Member; import org.sopt.makers.operation.entity.Part; import org.springframework.data.domain.Pageable; diff --git a/src/main/java/org/sopt/makers/operation/repository/member/MemberRepository.java b/src/main/java/org/sopt/makers/operation/repository/member/MemberRepository.java index 04a0b400..1cf0fa1d 100644 --- a/src/main/java/org/sopt/makers/operation/repository/member/MemberRepository.java +++ b/src/main/java/org/sopt/makers/operation/repository/member/MemberRepository.java @@ -1,6 +1,6 @@ package org.sopt.makers.operation.repository.member; -import org.sopt.makers.operation.entity.member.Member; +import org.operation.member.Member; import org.springframework.data.jpa.repository.JpaRepository; import java.util.Optional; diff --git a/src/main/java/org/sopt/makers/operation/repository/member/MemberRepositoryImpl.java b/src/main/java/org/sopt/makers/operation/repository/member/MemberRepositoryImpl.java index 5e0cb1ac..10b2a5e1 100644 --- a/src/main/java/org/sopt/makers/operation/repository/member/MemberRepositoryImpl.java +++ b/src/main/java/org/sopt/makers/operation/repository/member/MemberRepositoryImpl.java @@ -2,9 +2,9 @@ import static java.util.Objects.*; import static org.sopt.makers.operation.entity.Part.*; -import static org.sopt.makers.operation.entity.attendance.QAttendance.*; -import static org.sopt.makers.operation.entity.lecture.QLecture.*; -import static org.sopt.makers.operation.entity.member.QMember.*; +import static org.operation.attendance.QAttendance.*; +import static org.operation.lecture.QLecture.*; +import static org.operation.member.QMember.*; import java.util.List; import java.util.Optional; @@ -12,7 +12,7 @@ import com.querydsl.core.types.dsl.Expressions; import com.querydsl.core.types.dsl.StringExpression; import org.sopt.makers.operation.dto.member.response.MemberSearchCondition; -import org.sopt.makers.operation.entity.member.Member; +import org.operation.member.Member; import org.sopt.makers.operation.entity.Part; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Repository; diff --git a/src/main/java/org/sopt/makers/operation/repository/schedule/ScheduleCustomRepository.java b/src/main/java/org/sopt/makers/operation/repository/schedule/ScheduleCustomRepository.java index e4ccfe95..0a6fde17 100644 --- a/src/main/java/org/sopt/makers/operation/repository/schedule/ScheduleCustomRepository.java +++ b/src/main/java/org/sopt/makers/operation/repository/schedule/ScheduleCustomRepository.java @@ -1,6 +1,6 @@ package org.sopt.makers.operation.repository.schedule; -import org.sopt.makers.operation.entity.schedule.Schedule; +import org.operation.schedule.Schedule; import java.time.LocalDateTime; import java.util.List; diff --git a/src/main/java/org/sopt/makers/operation/repository/schedule/ScheduleRepository.java b/src/main/java/org/sopt/makers/operation/repository/schedule/ScheduleRepository.java index 0cf9858a..d943a11e 100644 --- a/src/main/java/org/sopt/makers/operation/repository/schedule/ScheduleRepository.java +++ b/src/main/java/org/sopt/makers/operation/repository/schedule/ScheduleRepository.java @@ -1,6 +1,6 @@ package org.sopt.makers.operation.repository.schedule; -import org.sopt.makers.operation.entity.member.Member; +import org.operation.member.Member; import org.springframework.data.jpa.repository.JpaRepository; public interface ScheduleRepository extends JpaRepository, ScheduleCustomRepository { diff --git a/src/main/java/org/sopt/makers/operation/repository/schedule/ScheduleRepositoryImpl.java b/src/main/java/org/sopt/makers/operation/repository/schedule/ScheduleRepositoryImpl.java index 46a05395..e230dc36 100644 --- a/src/main/java/org/sopt/makers/operation/repository/schedule/ScheduleRepositoryImpl.java +++ b/src/main/java/org/sopt/makers/operation/repository/schedule/ScheduleRepositoryImpl.java @@ -5,13 +5,13 @@ import lombok.RequiredArgsConstructor; -import org.sopt.makers.operation.entity.schedule.Schedule; +import org.operation.schedule.Schedule; import org.springframework.stereotype.Repository; import java.time.LocalDateTime; import java.util.List; -import static org.sopt.makers.operation.entity.schedule.QSchedule.schedule; +import static org.operation.schedule.QSchedule.schedule; @Repository @RequiredArgsConstructor diff --git a/src/main/java/org/sopt/makers/operation/service/app/attendance/AttendanceServiceImpl.java b/src/main/java/org/sopt/makers/operation/service/app/attendance/AttendanceServiceImpl.java index 7ff97b63..d05a39ea 100644 --- a/src/main/java/org/sopt/makers/operation/service/app/attendance/AttendanceServiceImpl.java +++ b/src/main/java/org/sopt/makers/operation/service/app/attendance/AttendanceServiceImpl.java @@ -7,7 +7,7 @@ import org.sopt.makers.operation.config.ValueConfig; import org.sopt.makers.operation.dto.attendance.response.AttendResponseDTO; -import org.sopt.makers.operation.entity.attendance.AttendanceStatus; +import org.operation.attendance.AttendanceStatus; import org.sopt.makers.operation.exception.LectureException; import org.sopt.makers.operation.exception.MemberException; import org.sopt.makers.operation.exception.SubLectureException; diff --git a/src/main/java/org/sopt/makers/operation/service/app/lecture/LectureServiceImpl.java b/src/main/java/org/sopt/makers/operation/service/app/lecture/LectureServiceImpl.java index 9af7b8aa..3a733332 100644 --- a/src/main/java/org/sopt/makers/operation/service/app/lecture/LectureServiceImpl.java +++ b/src/main/java/org/sopt/makers/operation/service/app/lecture/LectureServiceImpl.java @@ -3,8 +3,8 @@ import static org.sopt.makers.operation.common.ExceptionMessage.NO_SESSION; import static org.sopt.makers.operation.common.ExceptionMessage.*; import static org.sopt.makers.operation.dto.lecture.response.LectureResponseType.*; -import static org.sopt.makers.operation.entity.attendance.AttendanceStatus.*; -import static org.sopt.makers.operation.entity.lecture.LectureStatus.*; +import static org.operation.attendance.AttendanceStatus.*; +import static org.operation.lecture.LectureStatus.*; import java.time.LocalDate; import java.time.LocalDateTime; @@ -16,11 +16,11 @@ import org.sopt.makers.operation.dto.lecture.response.LectureCurrentRoundResponseDTO; import org.sopt.makers.operation.dto.lecture.response.LectureResponseType; import org.sopt.makers.operation.dto.lecture.response.TodayLectureResponseDTO; -import org.sopt.makers.operation.entity.attendance.Attendance; -import org.sopt.makers.operation.entity.attendance.SubAttendance; -import org.sopt.makers.operation.entity.lecture.Attribute; -import org.sopt.makers.operation.entity.lecture.Lecture; -import org.sopt.makers.operation.entity.lecture.SubLecture; +import org.operation.attendance.Attendance; +import org.operation.attendance.SubAttendance; +import org.operation.lecture.Attribute; +import org.operation.lecture.Lecture; +import org.operation.lecture.SubLecture; import org.sopt.makers.operation.exception.LectureException; import org.sopt.makers.operation.exception.SubLectureException; import org.sopt.makers.operation.repository.attendance.AttendanceRepository; diff --git a/src/main/java/org/sopt/makers/operation/service/app/member/MemberServiceImpl.java b/src/main/java/org/sopt/makers/operation/service/app/member/MemberServiceImpl.java index 5b54b95c..67cce15a 100644 --- a/src/main/java/org/sopt/makers/operation/service/app/member/MemberServiceImpl.java +++ b/src/main/java/org/sopt/makers/operation/service/app/member/MemberServiceImpl.java @@ -10,9 +10,9 @@ import org.sopt.makers.operation.dto.attendance.response.AttendanceTotalResponseDTO; import org.sopt.makers.operation.dto.attendance.response.AttendanceTotalVO; import org.sopt.makers.operation.dto.member.response.MemberScoreGetResponse; -import org.sopt.makers.operation.entity.attendance.AttendanceStatus; -import org.sopt.makers.operation.entity.lecture.Attribute; -import org.sopt.makers.operation.entity.member.Member; +import org.operation.attendance.AttendanceStatus; +import org.operation.lecture.Attribute; +import org.operation.member.Member; import org.sopt.makers.operation.exception.MemberException; import org.sopt.makers.operation.repository.attendance.AttendanceRepository; import org.sopt.makers.operation.repository.member.MemberRepository; diff --git a/src/main/java/org/sopt/makers/operation/service/app/schedule/ScheduleServiceImpl.java b/src/main/java/org/sopt/makers/operation/service/app/schedule/ScheduleServiceImpl.java index d9b2fafe..ddc2840c 100644 --- a/src/main/java/org/sopt/makers/operation/service/app/schedule/ScheduleServiceImpl.java +++ b/src/main/java/org/sopt/makers/operation/service/app/schedule/ScheduleServiceImpl.java @@ -11,7 +11,7 @@ import java.util.stream.LongStream; import org.sopt.makers.operation.dto.schedule.response.SchedulesResponseDTO; -import org.sopt.makers.operation.entity.schedule.Schedule; +import org.operation.schedule.Schedule; import org.sopt.makers.operation.repository.schedule.ScheduleRepository; import org.springframework.stereotype.Service; diff --git a/src/main/java/org/sopt/makers/operation/service/batch/LectureServiceImpl.java b/src/main/java/org/sopt/makers/operation/service/batch/LectureServiceImpl.java index 2c78f4a8..cdbb9e7a 100644 --- a/src/main/java/org/sopt/makers/operation/service/batch/LectureServiceImpl.java +++ b/src/main/java/org/sopt/makers/operation/service/batch/LectureServiceImpl.java @@ -1,7 +1,7 @@ package org.sopt.makers.operation.service.batch; import static org.sopt.makers.operation.common.ExceptionMessage.*; -import static org.sopt.makers.operation.entity.alarm.Attribute.*; +import static org.operation.alarm.Attribute.*; import java.util.*; @@ -10,7 +10,7 @@ import org.sopt.makers.operation.config.ValueConfig; import org.sopt.makers.operation.dto.alarm.request.AlarmSenderDTO; -import org.sopt.makers.operation.entity.lecture.Lecture; +import org.operation.lecture.Lecture; import org.sopt.makers.operation.exception.LectureException; import org.sopt.makers.operation.external.alarm.AlarmSender; import org.sopt.makers.operation.repository.lecture.LectureRepository; diff --git a/src/main/java/org/sopt/makers/operation/service/web/admin/AdminService.java b/src/main/java/org/sopt/makers/operation/service/web/admin/AdminService.java deleted file mode 100644 index 088e3a64..00000000 --- a/src/main/java/org/sopt/makers/operation/service/web/admin/AdminService.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.sopt.makers.operation.service.web.admin; - -import org.sopt.makers.operation.dto.admin.request.LoginRequestDTO; -import org.sopt.makers.operation.dto.admin.request.SignUpRequestDTO; -import org.sopt.makers.operation.dto.admin.response.LoginResponseDTO; -import org.sopt.makers.operation.dto.admin.response.RefreshResponseDTO; -import org.sopt.makers.operation.dto.admin.response.SignUpResponseDTO; - -public interface AdminService { - SignUpResponseDTO signUp(SignUpRequestDTO signUpRequestDTO); - LoginResponseDTO login(LoginRequestDTO userLoginRequestDTO); - void validateRefreshToken(Long adminId, String requestRefreshToken); - RefreshResponseDTO refresh(String refreshToken); -} diff --git a/src/main/java/org/sopt/makers/operation/service/web/admin/AdminServiceImpl.java b/src/main/java/org/sopt/makers/operation/service/web/admin/AdminServiceImpl.java deleted file mode 100644 index cca6da02..00000000 --- a/src/main/java/org/sopt/makers/operation/service/web/admin/AdminServiceImpl.java +++ /dev/null @@ -1,101 +0,0 @@ -package org.sopt.makers.operation.service.web.admin; - -import static org.sopt.makers.operation.common.ExceptionMessage.*; - -import lombok.RequiredArgsConstructor; -import lombok.val; - -import org.sopt.makers.operation.dto.admin.request.LoginRequestDTO; -import org.sopt.makers.operation.dto.admin.request.SignUpRequestDTO; -import org.sopt.makers.operation.dto.admin.response.LoginResponseDTO; -import org.sopt.makers.operation.dto.admin.response.RefreshResponseDTO; -import org.sopt.makers.operation.dto.admin.response.SignUpResponseDTO; -import org.sopt.makers.operation.entity.admin.Admin; -import org.sopt.makers.operation.entity.admin.AdminStatus; -import org.sopt.makers.operation.exception.AdminFailureException; -import org.sopt.makers.operation.repository.AdminRepository; -import org.sopt.makers.operation.security.AdminAuthentication; -import org.sopt.makers.operation.security.jwt.JwtTokenProvider; -import org.sopt.makers.operation.security.jwt.JwtTokenType; -import org.springframework.security.crypto.password.PasswordEncoder; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -@RequiredArgsConstructor -@Transactional(readOnly = true) -@Service -public class AdminServiceImpl implements AdminService { - - private final JwtTokenProvider jwtTokenProvider; - private final PasswordEncoder passwordEncoder; - private final AdminRepository adminRepository; - - @Override - @Transactional - public SignUpResponseDTO signUp(SignUpRequestDTO SignUpRequestDTO){ - isEmailDuplicated(SignUpRequestDTO.email()); - - val admin = adminRepository.save(Admin.builder() - .email(SignUpRequestDTO.email()) - .password(passwordEncoder.encode(SignUpRequestDTO.password())) - .name(SignUpRequestDTO.name()) - .role(SignUpRequestDTO.role()) - .build()); - - return new SignUpResponseDTO(admin.getId(), admin.getEmail(), admin.getName(), admin.getRole()); - } - - @Override - @Transactional - public LoginResponseDTO login(LoginRequestDTO userLoginRequestDTO) { - val admin = adminRepository - .findByEmail(userLoginRequestDTO.email()) - .orElseThrow(() -> new AdminFailureException("이메일이 존재하지 않습니다")); - - if(!passwordEncoder.matches(userLoginRequestDTO.password(), admin.getPassword())){ - throw new AdminFailureException("비밀번호가 일치하지 않습니다"); - } - - if(admin.getStatus().equals(AdminStatus.NOT_CERTIFIED)) throw new AdminFailureException("승인되지 않은 계정입니다"); - - val authentication = new AdminAuthentication(admin.getId(), null, null); - - admin.updateRefreshToken(jwtTokenProvider.generateRefreshToken(authentication)); - - return LoginResponseDTO.of(admin, jwtTokenProvider.generateAccessToken(authentication), admin.getRefreshToken()); - } - - @Override - public void validateRefreshToken(Long adminId, String requestRefreshToken) { - val admin = this.findById(adminId); - val refreshToken = admin.getRefreshToken(); - - if(!refreshToken.equals(requestRefreshToken)) throw new AdminFailureException("토큰이 일치하지 않습니다"); - } - - @Override - @Transactional - public RefreshResponseDTO refresh(String refreshToken) { - val adminId = jwtTokenProvider.getId(refreshToken, JwtTokenType.REFRESH_TOKEN); - - validateRefreshToken(adminId, refreshToken); - - val adminAuthentication = new AdminAuthentication(adminId, null, null); - val newAccessToken = jwtTokenProvider.generateAccessToken(adminAuthentication); - val newRefreshToken = jwtTokenProvider.generateRefreshToken(adminAuthentication); - val admin = findById(adminId); - - admin.updateRefreshToken(newRefreshToken); - - return RefreshResponseDTO.of(newAccessToken, newRefreshToken); - } - - private Admin findById(Long adminId) { - return adminRepository.findById(adminId) - .orElseThrow(() -> new AdminFailureException(INVALID_MEMBER.getName())); - } - - private void isEmailDuplicated(String email) { - if(adminRepository.existsByEmail(email)) throw new AdminFailureException("중복되는 이메일입니다"); - } -} diff --git a/src/main/java/org/sopt/makers/operation/service/web/alarm/AlarmService.java b/src/main/java/org/sopt/makers/operation/service/web/alarm/AlarmService.java index 2dae99ed..3c6b3a98 100644 --- a/src/main/java/org/sopt/makers/operation/service/web/alarm/AlarmService.java +++ b/src/main/java/org/sopt/makers/operation/service/web/alarm/AlarmService.java @@ -6,7 +6,7 @@ import org.sopt.makers.operation.dto.alarm.response.AlarmResponseDTO; import org.sopt.makers.operation.dto.alarm.response.AlarmsResponseDTO; import org.sopt.makers.operation.entity.Part; -import org.sopt.makers.operation.entity.alarm.Status; +import org.operation.alarm.Status; import org.springframework.data.domain.Pageable; public interface AlarmService { diff --git a/src/main/java/org/sopt/makers/operation/service/web/alarm/AlarmServiceImpl.java b/src/main/java/org/sopt/makers/operation/service/web/alarm/AlarmServiceImpl.java index 9ce19b87..738528e9 100644 --- a/src/main/java/org/sopt/makers/operation/service/web/alarm/AlarmServiceImpl.java +++ b/src/main/java/org/sopt/makers/operation/service/web/alarm/AlarmServiceImpl.java @@ -3,14 +3,14 @@ import static java.util.Objects.*; import static org.sopt.makers.operation.common.ExceptionMessage.*; import static org.sopt.makers.operation.entity.Part.*; -import static org.sopt.makers.operation.entity.alarm.Status.*; +import static org.operation.alarm.Status.*; import org.sopt.makers.operation.config.ValueConfig; import org.sopt.makers.operation.dto.alarm.request.AlarmSendRequestDTO; import org.sopt.makers.operation.dto.alarm.request.AlarmSenderDTO; import org.sopt.makers.operation.dto.member.response.MemberSearchCondition; import org.sopt.makers.operation.entity.Part; -import org.sopt.makers.operation.entity.alarm.Status; +import org.operation.alarm.Status; import org.sopt.makers.operation.exception.AlarmException; import org.sopt.makers.operation.external.alarm.AlarmSender; import org.sopt.makers.operation.external.playground.PlayGroundServer; @@ -28,7 +28,7 @@ import org.sopt.makers.operation.dto.alarm.request.AlarmRequestDTO; import org.sopt.makers.operation.dto.alarm.response.AlarmResponseDTO; import org.sopt.makers.operation.dto.alarm.response.AlarmsResponseDTO; -import org.sopt.makers.operation.entity.alarm.Alarm; +import org.operation.alarm.Alarm; import org.springframework.data.domain.Pageable; @Service diff --git a/src/main/java/org/sopt/makers/operation/service/web/attendance/AttendanceServiceImpl.java b/src/main/java/org/sopt/makers/operation/service/web/attendance/AttendanceServiceImpl.java index cf10a06b..bcd5c2bb 100644 --- a/src/main/java/org/sopt/makers/operation/service/web/attendance/AttendanceServiceImpl.java +++ b/src/main/java/org/sopt/makers/operation/service/web/attendance/AttendanceServiceImpl.java @@ -7,8 +7,8 @@ import org.sopt.makers.operation.dto.attendance.response.AttendancesResponseDTO; import org.sopt.makers.operation.dto.attendance.response.SubAttendanceUpdateResponseDTO; import org.sopt.makers.operation.entity.Part; -import org.sopt.makers.operation.entity.attendance.SubAttendance; -import org.sopt.makers.operation.entity.member.Member; +import org.operation.attendance.SubAttendance; +import org.operation.member.Member; import org.sopt.makers.operation.exception.LectureException; import org.sopt.makers.operation.exception.MemberException; import org.sopt.makers.operation.repository.attendance.AttendanceRepository; diff --git a/src/main/java/org/sopt/makers/operation/service/web/lecture/LectureServiceImpl.java b/src/main/java/org/sopt/makers/operation/service/web/lecture/LectureServiceImpl.java index 86f65131..8ee6d8d5 100644 --- a/src/main/java/org/sopt/makers/operation/service/web/lecture/LectureServiceImpl.java +++ b/src/main/java/org/sopt/makers/operation/service/web/lecture/LectureServiceImpl.java @@ -1,7 +1,7 @@ package org.sopt.makers.operation.service.web.lecture; import static org.sopt.makers.operation.common.ExceptionMessage.*; -import static org.sopt.makers.operation.entity.alarm.Attribute.*; +import static org.operation.alarm.Attribute.*; import java.util.List; import java.util.stream.Stream; @@ -15,11 +15,11 @@ import org.sopt.makers.operation.dto.lecture.response.LectureResponseDTO; import org.sopt.makers.operation.dto.lecture.response.LecturesResponseDTO; import org.sopt.makers.operation.entity.Part; -import org.sopt.makers.operation.entity.attendance.Attendance; -import org.sopt.makers.operation.entity.attendance.SubAttendance; -import org.sopt.makers.operation.entity.lecture.Lecture; -import org.sopt.makers.operation.entity.lecture.SubLecture; -import org.sopt.makers.operation.entity.member.Member; +import org.operation.attendance.Attendance; +import org.operation.attendance.SubAttendance; +import org.operation.lecture.Lecture; +import org.operation.lecture.SubLecture; +import org.operation.member.Member; import org.sopt.makers.operation.exception.LectureException; import org.sopt.makers.operation.exception.SubLectureException; import org.sopt.makers.operation.external.alarm.AlarmSender; diff --git a/src/main/java/org/sopt/makers/operation/service/web/member/MemberServiceImpl.java b/src/main/java/org/sopt/makers/operation/service/web/member/MemberServiceImpl.java index 311ff155..722e8951 100644 --- a/src/main/java/org/sopt/makers/operation/service/web/member/MemberServiceImpl.java +++ b/src/main/java/org/sopt/makers/operation/service/web/member/MemberServiceImpl.java @@ -8,8 +8,8 @@ import org.sopt.makers.operation.dto.member.response.MemberListGetResponse; import org.sopt.makers.operation.dto.member.response.MemberSearchCondition; import org.sopt.makers.operation.dto.member.response.MembersResponseDTO; -import org.sopt.makers.operation.entity.attendance.AttendanceStatus; -import org.sopt.makers.operation.entity.member.Member; +import org.operation.attendance.AttendanceStatus; +import org.operation.member.Member; import org.sopt.makers.operation.entity.Part; import org.sopt.makers.operation.repository.attendance.AttendanceRepository; import org.sopt.makers.operation.repository.member.MemberRepository; diff --git a/src/test/java/org/sopt/makers/operation/fixture/LectureFixture.java b/src/test/java/org/sopt/makers/operation/fixture/LectureFixture.java index e01c867b..b0ee79fd 100644 --- a/src/test/java/org/sopt/makers/operation/fixture/LectureFixture.java +++ b/src/test/java/org/sopt/makers/operation/fixture/LectureFixture.java @@ -14,10 +14,10 @@ import org.sopt.makers.operation.dto.lecture.response.LecturesResponseDTO; import org.sopt.makers.operation.dto.lecture.response.LecturesResponseDTO.LectureVO; import org.sopt.makers.operation.entity.Part; -import org.sopt.makers.operation.entity.lecture.SubLecture; -import org.sopt.makers.operation.entity.lecture.Attribute; -import org.sopt.makers.operation.entity.lecture.Lecture; -import org.sopt.makers.operation.entity.lecture.LectureStatus; +import org.operation.lecture.SubLecture; +import org.operation.lecture.Attribute; +import org.operation.lecture.Lecture; +import org.operation.lecture.LectureStatus; public class LectureFixture { diff --git a/src/test/java/org/sopt/makers/operation/service/web/LectureServiceImplTest.java b/src/test/java/org/sopt/makers/operation/service/web/LectureServiceImplTest.java index 28a33888..f960d735 100644 --- a/src/test/java/org/sopt/makers/operation/service/web/LectureServiceImplTest.java +++ b/src/test/java/org/sopt/makers/operation/service/web/LectureServiceImplTest.java @@ -14,7 +14,7 @@ import org.sopt.makers.operation.dto.lecture.request.AttendanceRequestDTO; import org.sopt.makers.operation.dto.lecture.response.LectureResponseDTO; import org.sopt.makers.operation.dto.lecture.response.LecturesResponseDTO; -import org.sopt.makers.operation.entity.lecture.Lecture; +import org.operation.lecture.Lecture; import org.sopt.makers.operation.external.alarm.AlarmSender; import org.sopt.makers.operation.repository.lecture.LectureRepository; import org.sopt.makers.operation.repository.member.MemberRepository; From 04abd3be716ed94f952413b576cbd9369b965a00 Mon Sep 17 00:00:00 2001 From: thguss Date: Fri, 2 Feb 2024 04:22:00 +0900 Subject: [PATCH 045/141] =?UTF-8?q?[FIX]=202.5=EC=B0=A8=20=EB=B6=84?= =?UTF-8?q?=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common}/config/TimezoneConfig.java | 4 +- .../common/handler/ErrorHandler.java | 72 +++++++++++++++++++ .../common/util/ApiResponseUtil.java | 5 ++ operation-business/build.gradle | 22 ++++++ .../exception/AdminFailureException.java | 2 +- .../common}/exception/AlarmException.java | 2 +- .../common}/exception/LectureException.java | 2 +- .../common}/exception/MemberException.java | 2 +- .../exception/SubLectureException.java | 2 +- .../common}/exception/TokenException.java | 2 +- .../web/admin/service/AdminServiceImpl.java | 4 +- .../main/java/org/operation/alarm/Alarm.java | 4 +- .../operation/attendance/SubAttendance.java | 2 +- .../common}/config/JpaAuditingConfig.java | 2 +- .../common}/config/JpaQueryFactoryConfig.java | 2 +- .../{ => common/domain}/BaseEntity.java | 2 +- .../operation/{ => common/domain}/Part.java | 2 +- .../java/org/operation/lecture/Lecture.java | 4 +- .../java/org/operation/member/Member.java | 2 +- .../java/org/operation/schedule/Schedule.java | 2 +- operation-storage/db-jpa/build.gradle | 19 +++++ .../operation/handler/ErrorHandler.java | 65 ----------------- 22 files changed, 139 insertions(+), 86 deletions(-) rename {src/main/java/org/sopt/makers/operation => operation-api/src/main/java/org/operation/common}/config/TimezoneConfig.java (66%) create mode 100644 operation-api/src/main/java/org/operation/common/handler/ErrorHandler.java create mode 100644 operation-business/build.gradle rename {src/main/java/org/sopt/makers/operation => operation-business/src/main/java/org/operation/common}/exception/AdminFailureException.java (79%) rename {src/main/java/org/sopt/makers/operation => operation-business/src/main/java/org/operation/common}/exception/AlarmException.java (77%) rename {src/main/java/org/sopt/makers/operation => operation-business/src/main/java/org/operation/common}/exception/LectureException.java (78%) rename {src/main/java/org/sopt/makers/operation => operation-business/src/main/java/org/operation/common}/exception/MemberException.java (77%) rename {src/main/java/org/sopt/makers/operation => operation-business/src/main/java/org/operation/common}/exception/SubLectureException.java (79%) rename {src/main/java/org/sopt/makers/operation => operation-business/src/main/java/org/operation/common}/exception/TokenException.java (77%) rename {src/main/java/org/sopt/makers/operation => operation-domain/src/main/java/org/operation/common}/config/JpaAuditingConfig.java (82%) rename {src/main/java/org/sopt/makers/operation => operation-domain/src/main/java/org/operation/common}/config/JpaQueryFactoryConfig.java (89%) rename operation-domain/src/main/java/org/operation/{ => common/domain}/BaseEntity.java (93%) rename operation-domain/src/main/java/org/operation/{ => common/domain}/Part.java (87%) create mode 100644 operation-storage/db-jpa/build.gradle delete mode 100644 src/main/java/org/sopt/makers/operation/handler/ErrorHandler.java diff --git a/src/main/java/org/sopt/makers/operation/config/TimezoneConfig.java b/operation-api/src/main/java/org/operation/common/config/TimezoneConfig.java similarity index 66% rename from src/main/java/org/sopt/makers/operation/config/TimezoneConfig.java rename to operation-api/src/main/java/org/operation/common/config/TimezoneConfig.java index f14faffe..0274dce2 100644 --- a/src/main/java/org/sopt/makers/operation/config/TimezoneConfig.java +++ b/operation-api/src/main/java/org/operation/common/config/TimezoneConfig.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.config; +package org.operation.common.config; import java.util.TimeZone; @@ -7,7 +7,7 @@ import org.springframework.context.annotation.Configuration; @Configuration -public class TimezoneConfig { +public class TimezoneConfig { //TODO: 타임 체크 로컬에서 UTF로 바꿔서 체크 @PostConstruct public void init() { diff --git a/operation-api/src/main/java/org/operation/common/handler/ErrorHandler.java b/operation-api/src/main/java/org/operation/common/handler/ErrorHandler.java new file mode 100644 index 00000000..1f769822 --- /dev/null +++ b/operation-api/src/main/java/org/operation/common/handler/ErrorHandler.java @@ -0,0 +1,72 @@ +package org.operation.common.handler; + +import static org.springframework.http.HttpStatus.*; + +import java.time.format.DateTimeParseException; + +import org.operation.common.dto.BaseResponse; +import org.operation.common.exception.MemberException; +import org.operation.common.util.ApiResponseUtil; +import org.operation.common.exception.AdminFailureException; +import org.operation.common.exception.TokenException; +import org.operation.common.exception.AlarmException; +import org.operation.common.exception.LectureException; +import org.operation.common.exception.SubLectureException; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.RestControllerAdvice; + +import lombok.extern.slf4j.Slf4j; + +@Slf4j +@RestControllerAdvice +public class ErrorHandler { + + @ExceptionHandler(AdminFailureException.class) + public ResponseEntity> authFailureException(AdminFailureException ex) { + log.error(ex.getMessage()); + return ApiResponseUtil.failure(BAD_REQUEST, ex.getMessage()); + } + + @ExceptionHandler(TokenException.class) + public ResponseEntity> tokenException(TokenException ex) { + log.error(ex.getMessage()); + return ApiResponseUtil.failure(BAD_REQUEST, ex.getMessage()); + } + + @ExceptionHandler(IllegalStateException.class) + public ResponseEntity> illegalStateExceptionException(IllegalStateException ex) { + log.error(ex.getMessage()); + return ApiResponseUtil.failure(BAD_REQUEST, ex.getMessage()); + } + + @ExceptionHandler(MemberException.class) + public ResponseEntity> memberException(MemberException ex) { + log.error(ex.getMessage()); + return ApiResponseUtil.failure(NOT_FOUND, ex.getMessage()); + } + + @ExceptionHandler(LectureException.class) + public ResponseEntity> lectureException(LectureException ex) { + log.error(ex.getMessage()); + return ApiResponseUtil.failure(NOT_FOUND, ex.getMessage()); + } + + @ExceptionHandler(SubLectureException.class) + public ResponseEntity> subLectureException(SubLectureException ex) { + log.error(ex.getMessage()); + return ApiResponseUtil.failure(NOT_FOUND, ex.getMessage()); + } + + @ExceptionHandler(DateTimeParseException.class) + public ResponseEntity> dateTimeParseException(DateTimeParseException ex) { + return ApiResponseUtil.failure(BAD_REQUEST, ex.getMessage()); + } + + @ExceptionHandler(AlarmException.class) + public ResponseEntity> alarmException(AlarmException ex) { + log.error(ex.getMessage()); + return ApiResponseUtil.failure(BAD_REQUEST, ex.getMessage()); + } + +} diff --git a/operation-api/src/main/java/org/operation/common/util/ApiResponseUtil.java b/operation-api/src/main/java/org/operation/common/util/ApiResponseUtil.java index be1df6cc..025d50c1 100644 --- a/operation-api/src/main/java/org/operation/common/util/ApiResponseUtil.java +++ b/operation-api/src/main/java/org/operation/common/util/ApiResponseUtil.java @@ -20,4 +20,9 @@ static ResponseEntity> ok(HttpHeaders headers, String messag .headers(headers) .body(BaseResponse.of(message, data)); } + + static ResponseEntity> failure(HttpStatus status, String message) { + return ResponseEntity.status(status) + .body(BaseResponse.of(message, false)); + } } diff --git a/operation-business/build.gradle b/operation-business/build.gradle new file mode 100644 index 00000000..6b3ca8cb --- /dev/null +++ b/operation-business/build.gradle @@ -0,0 +1,22 @@ +plugins { + id 'java' +} + +group = 'org.sopt.makers' +version = '0.0.1-SNAPSHOT' + +repositories { + mavenCentral() +} + +dependencies { + implementation project(path: ':operation-api') + implementation project(path: ':operation-domain') + + implementation 'org.springframework.boot:spring-boot-starter-web' + implementation 'org.springframework.boot:spring-boot-starter-data-jpa' +} + +test { + useJUnitPlatform() +} \ No newline at end of file diff --git a/src/main/java/org/sopt/makers/operation/exception/AdminFailureException.java b/operation-business/src/main/java/org/operation/common/exception/AdminFailureException.java similarity index 79% rename from src/main/java/org/sopt/makers/operation/exception/AdminFailureException.java rename to operation-business/src/main/java/org/operation/common/exception/AdminFailureException.java index 6e254a7d..dca2f1cc 100644 --- a/src/main/java/org/sopt/makers/operation/exception/AdminFailureException.java +++ b/operation-business/src/main/java/org/operation/common/exception/AdminFailureException.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.exception; +package org.operation.common.exception; public class AdminFailureException extends RuntimeException { public AdminFailureException(String message) { diff --git a/src/main/java/org/sopt/makers/operation/exception/AlarmException.java b/operation-business/src/main/java/org/operation/common/exception/AlarmException.java similarity index 77% rename from src/main/java/org/sopt/makers/operation/exception/AlarmException.java rename to operation-business/src/main/java/org/operation/common/exception/AlarmException.java index d27e1e2c..ce3ec426 100644 --- a/src/main/java/org/sopt/makers/operation/exception/AlarmException.java +++ b/operation-business/src/main/java/org/operation/common/exception/AlarmException.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.exception; +package org.operation.common.exception; public class AlarmException extends RuntimeException { public AlarmException(String message) { diff --git a/src/main/java/org/sopt/makers/operation/exception/LectureException.java b/operation-business/src/main/java/org/operation/common/exception/LectureException.java similarity index 78% rename from src/main/java/org/sopt/makers/operation/exception/LectureException.java rename to operation-business/src/main/java/org/operation/common/exception/LectureException.java index d5040bf5..c0dfaa5d 100644 --- a/src/main/java/org/sopt/makers/operation/exception/LectureException.java +++ b/operation-business/src/main/java/org/operation/common/exception/LectureException.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.exception; +package org.operation.common.exception; public class LectureException extends RuntimeException { public LectureException(String message) { diff --git a/src/main/java/org/sopt/makers/operation/exception/MemberException.java b/operation-business/src/main/java/org/operation/common/exception/MemberException.java similarity index 77% rename from src/main/java/org/sopt/makers/operation/exception/MemberException.java rename to operation-business/src/main/java/org/operation/common/exception/MemberException.java index 9aceb62e..9981e98f 100644 --- a/src/main/java/org/sopt/makers/operation/exception/MemberException.java +++ b/operation-business/src/main/java/org/operation/common/exception/MemberException.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.exception; +package org.operation.common.exception; public class MemberException extends RuntimeException { public MemberException(String message) { diff --git a/src/main/java/org/sopt/makers/operation/exception/SubLectureException.java b/operation-business/src/main/java/org/operation/common/exception/SubLectureException.java similarity index 79% rename from src/main/java/org/sopt/makers/operation/exception/SubLectureException.java rename to operation-business/src/main/java/org/operation/common/exception/SubLectureException.java index 3d9d4612..e19c7a77 100644 --- a/src/main/java/org/sopt/makers/operation/exception/SubLectureException.java +++ b/operation-business/src/main/java/org/operation/common/exception/SubLectureException.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.exception; +package org.operation.common.exception; public class SubLectureException extends RuntimeException { public SubLectureException(String message) { diff --git a/src/main/java/org/sopt/makers/operation/exception/TokenException.java b/operation-business/src/main/java/org/operation/common/exception/TokenException.java similarity index 77% rename from src/main/java/org/sopt/makers/operation/exception/TokenException.java rename to operation-business/src/main/java/org/operation/common/exception/TokenException.java index a1bcc83f..b56db1b6 100644 --- a/src/main/java/org/sopt/makers/operation/exception/TokenException.java +++ b/operation-business/src/main/java/org/operation/common/exception/TokenException.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.exception; +package org.operation.common.exception; public class TokenException extends RuntimeException { public TokenException(String message) { super("[TokenException] : " + message); diff --git a/operation-business/src/main/java/org/operation/web/admin/service/AdminServiceImpl.java b/operation-business/src/main/java/org/operation/web/admin/service/AdminServiceImpl.java index 09cd15e5..54ef08f7 100644 --- a/operation-business/src/main/java/org/operation/web/admin/service/AdminServiceImpl.java +++ b/operation-business/src/main/java/org/operation/web/admin/service/AdminServiceImpl.java @@ -1,12 +1,12 @@ package org.operation.web.admin.service; import org.operation.admin.domain.Admin; -import org.operation.admin.domain.AdminStatus; import org.operation.web.admin.dto.request.LoginRequest; import org.operation.web.admin.dto.request.SignUpRequest; import org.operation.web.admin.dto.response.LoginResponse; import org.operation.web.admin.dto.response.RefreshResponse; import org.operation.web.admin.dto.response.SignUpResponse; +import org.operation.common.exception.AdminFailureException; import org.operation.web.admin.repository.AdminRepository; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -90,7 +90,7 @@ public RefreshResponse refresh(String refreshToken) { val newRefreshToken = jwtTokenProvider.generateRefreshToken(adminAuthentication); admin.updateRefreshToken(newRefreshToken);*/ - return RefreshResponse.of((String)newAccessToken); + return RefreshResponse.of(newAccessToken); } public void validateRefreshToken(Admin admin, String refreshToken) { diff --git a/operation-domain/src/main/java/org/operation/alarm/Alarm.java b/operation-domain/src/main/java/org/operation/alarm/Alarm.java index eb5d7781..e2217061 100644 --- a/operation-domain/src/main/java/org/operation/alarm/Alarm.java +++ b/operation-domain/src/main/java/org/operation/alarm/Alarm.java @@ -17,8 +17,8 @@ import org.sopt.makers.operation.converter.StringListConverter; import org.sopt.makers.operation.dto.alarm.request.AlarmRequestDTO; -import org.operation.BaseEntity; -import org.operation.Part; +import org.operation.common.domain.BaseEntity; +import org.operation.common.domain.Part; import lombok.Getter; import lombok.NoArgsConstructor; diff --git a/operation-domain/src/main/java/org/operation/attendance/SubAttendance.java b/operation-domain/src/main/java/org/operation/attendance/SubAttendance.java index a190aaf4..216b6180 100644 --- a/operation-domain/src/main/java/org/operation/attendance/SubAttendance.java +++ b/operation-domain/src/main/java/org/operation/attendance/SubAttendance.java @@ -14,7 +14,7 @@ import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; -import org.operation.BaseEntity; +import org.operation.common.domain.BaseEntity; import org.operation.lecture.SubLecture; import lombok.Getter; diff --git a/src/main/java/org/sopt/makers/operation/config/JpaAuditingConfig.java b/operation-domain/src/main/java/org/operation/common/config/JpaAuditingConfig.java similarity index 82% rename from src/main/java/org/sopt/makers/operation/config/JpaAuditingConfig.java rename to operation-domain/src/main/java/org/operation/common/config/JpaAuditingConfig.java index b6561dd0..289d6216 100644 --- a/src/main/java/org/sopt/makers/operation/config/JpaAuditingConfig.java +++ b/operation-domain/src/main/java/org/operation/common/config/JpaAuditingConfig.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.config; +package org.operation.common.config; import org.springframework.context.annotation.Configuration; import org.springframework.data.jpa.repository.config.EnableJpaAuditing; diff --git a/src/main/java/org/sopt/makers/operation/config/JpaQueryFactoryConfig.java b/operation-domain/src/main/java/org/operation/common/config/JpaQueryFactoryConfig.java similarity index 89% rename from src/main/java/org/sopt/makers/operation/config/JpaQueryFactoryConfig.java rename to operation-domain/src/main/java/org/operation/common/config/JpaQueryFactoryConfig.java index 06d4078c..bad707c2 100644 --- a/src/main/java/org/sopt/makers/operation/config/JpaQueryFactoryConfig.java +++ b/operation-domain/src/main/java/org/operation/common/config/JpaQueryFactoryConfig.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.config; +package org.operation.common.config; import javax.persistence.EntityManager; diff --git a/operation-domain/src/main/java/org/operation/BaseEntity.java b/operation-domain/src/main/java/org/operation/common/domain/BaseEntity.java similarity index 93% rename from operation-domain/src/main/java/org/operation/BaseEntity.java rename to operation-domain/src/main/java/org/operation/common/domain/BaseEntity.java index 243b6788..3456d884 100644 --- a/operation-domain/src/main/java/org/operation/BaseEntity.java +++ b/operation-domain/src/main/java/org/operation/common/domain/BaseEntity.java @@ -1,4 +1,4 @@ -package org.operation; +package org.operation.common.domain; import java.time.LocalDateTime; diff --git a/operation-domain/src/main/java/org/operation/Part.java b/operation-domain/src/main/java/org/operation/common/domain/Part.java similarity index 87% rename from operation-domain/src/main/java/org/operation/Part.java rename to operation-domain/src/main/java/org/operation/common/domain/Part.java index 3d88e331..22cdc785 100644 --- a/operation-domain/src/main/java/org/operation/Part.java +++ b/operation-domain/src/main/java/org/operation/common/domain/Part.java @@ -1,4 +1,4 @@ -package org.operation; +package org.operation.common.domain; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/operation-domain/src/main/java/org/operation/lecture/Lecture.java b/operation-domain/src/main/java/org/operation/lecture/Lecture.java index d915d519..48850e3a 100644 --- a/operation-domain/src/main/java/org/operation/lecture/Lecture.java +++ b/operation-domain/src/main/java/org/operation/lecture/Lecture.java @@ -16,8 +16,8 @@ import javax.persistence.OneToMany; import org.operation.attendance.Attendance; -import org.operation.BaseEntity; -import org.operation.Part; +import org.operation.common.domain.BaseEntity; +import org.operation.common.domain.Part; import lombok.Builder; import lombok.Getter; diff --git a/operation-domain/src/main/java/org/operation/member/Member.java b/operation-domain/src/main/java/org/operation/member/Member.java index 5b22d418..4d8c5e58 100644 --- a/operation-domain/src/main/java/org/operation/member/Member.java +++ b/operation-domain/src/main/java/org/operation/member/Member.java @@ -15,7 +15,7 @@ import javax.persistence.OneToMany; import org.sopt.makers.operation.dto.member.request.MemberRequestDTO; -import org.operation.Part; +import org.operation.common.domain.Part; import org.operation.attendance.Attendance; import lombok.Getter; diff --git a/operation-domain/src/main/java/org/operation/schedule/Schedule.java b/operation-domain/src/main/java/org/operation/schedule/Schedule.java index 24c5a650..8568fc46 100644 --- a/operation-domain/src/main/java/org/operation/schedule/Schedule.java +++ b/operation-domain/src/main/java/org/operation/schedule/Schedule.java @@ -2,7 +2,7 @@ import lombok.Getter; import lombok.NoArgsConstructor; -import org.operation.BaseEntity; +import org.operation.common.domain.BaseEntity; import org.operation.lecture.Attribute; import javax.persistence.*; diff --git a/operation-storage/db-jpa/build.gradle b/operation-storage/db-jpa/build.gradle new file mode 100644 index 00000000..1ebaba4d --- /dev/null +++ b/operation-storage/db-jpa/build.gradle @@ -0,0 +1,19 @@ +plugins { + id 'java' +} + +group = 'org.sopt.makers' +version = '0.0.1-SNAPSHOT' + +repositories { + mavenCentral() +} + +dependencies { + testImplementation platform('org.junit:junit-bom:5.9.1') + testImplementation 'org.junit.jupiter:junit-jupiter' +} + +test { + useJUnitPlatform() +} \ No newline at end of file diff --git a/src/main/java/org/sopt/makers/operation/handler/ErrorHandler.java b/src/main/java/org/sopt/makers/operation/handler/ErrorHandler.java deleted file mode 100644 index 0532a1fa..00000000 --- a/src/main/java/org/sopt/makers/operation/handler/ErrorHandler.java +++ /dev/null @@ -1,65 +0,0 @@ -package org.sopt.makers.operation.handler; - -import static org.sopt.makers.operation.dto.ResponseDTO.*; -import static org.sopt.makers.operation.common.ExceptionMessage.*; -import static org.springframework.http.HttpStatus.*; - -import java.time.format.DateTimeParseException; - -import org.sopt.makers.operation.exception.*; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.ExceptionHandler; -import org.springframework.web.bind.annotation.RestControllerAdvice; -import lombok.extern.slf4j.Slf4j; - -@Slf4j -@RestControllerAdvice -public class ErrorHandler { - @ExceptionHandler(AdminFailureException.class) - public ResponseEntity authFailureException (AdminFailureException ex) { - log.error(ex.getMessage()); - return ResponseEntity.status(BAD_REQUEST).body(fail(ex.getMessage())); - } - - @ExceptionHandler(TokenException.class) - public ResponseEntity tokenException (TokenException ex) { - log.error(ex.getMessage()); - return ResponseEntity.status(BAD_REQUEST).body(fail(ex.getMessage())); - } - - @ExceptionHandler(IllegalStateException.class) - public ResponseEntity illegalStateExceptionException (IllegalStateException ex) { - log.error(ex.getMessage()); - return ResponseEntity.status(BAD_REQUEST).body(fail(ex.getMessage())); - } - - @ExceptionHandler(MemberException.class) - public ResponseEntity memberException (MemberException ex) { - log.error(ex.getMessage()); - return ResponseEntity.status(NOT_FOUND).body(fail(ex.getMessage())); - } - - @ExceptionHandler(LectureException.class) - public ResponseEntity lectureException (LectureException ex) { - log.error(ex.getMessage()); - return ResponseEntity.status(NOT_FOUND).body(fail(ex.getMessage())); - } - - @ExceptionHandler(SubLectureException.class) - public ResponseEntity subLectureException (SubLectureException ex) { - log.error(ex.getMessage()); - return ResponseEntity.status(NOT_FOUND).body(fail(ex.getMessage())); - } - - @ExceptionHandler(DateTimeParseException.class) - public ResponseEntity dateTimeParseException () { - return ResponseEntity.status(BAD_REQUEST).body(fail(FAULT_DATE_FORMATTER.getName())); - } - - @ExceptionHandler(AlarmException.class) - public ResponseEntity AlarmException (AlarmException ex) { - log.error(ex.getMessage()); - return ResponseEntity.status(BAD_REQUEST).body(fail(ex.getMessage())); - } - -} From ef9886000259436dded288782da9c584df22f131 Mon Sep 17 00:00:00 2001 From: thguss Date: Sat, 3 Feb 2024 07:05:36 +0900 Subject: [PATCH 046/141] =?UTF-8?q?[FIX]=203=EC=B0=A8=20=EB=B6=84=EB=A6=AC?= =?UTF-8?q?=20(api=20=EB=AA=A8=EB=93=88=20=EB=B6=84=EB=A6=AC)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/cd-dev.yml | 2 +- operation-api/build.gradle | 5 +- .../api/AttendanceApiController.java | 5 +- .../attendance/service/AttendanceService.java | 8 + .../app/lecture/api/LectureApiController.java | 9 +- .../app/lecture/service/LectureService.java | 10 ++ .../app/member/api/MemberApiController.java | 9 +- .../app/member/service/MemberService.java | 9 + .../schedule/api/ScheduleApiController.java | 5 +- .../schedule/service}/ScheduleService.java | 4 +- .../common}/scheduler/LectureScheduler.java | 4 +- .../scheduler/service}/LectureService.java | 2 +- .../common/util/ApiResponseUtil.java | 8 + .../operation/common/util/CommonUtils.java | 10 ++ .../operation/web/alarm/AlarmController.java | 88 ---------- .../org/operation/web/alarm/api/AlarmApi.java | 114 +++++++++++++ .../web/alarm/api/AlarmApiController.java | 70 ++++++++ .../web/alarm/message/SuccessMessage.java | 6 +- .../web/alarm/service/AlarmService.java | 17 ++ .../web/attendnace/AttendanceController.java | 57 ------- .../web/attendnace/api/AttendanceApi.java | 91 ++++++++++ .../api/AttendanceApiController.java | 57 +++++++ .../attendnace/message/SuccessMessage.java | 5 +- .../attendnace/service/AttendanceService.java | 15 ++ .../web/lecture/LectureController.java | 97 ----------- .../operation/web/lecture/api/LectureApi.java | 147 ++++++++++++++++ .../web/lecture/api/LectureApiController.java | 83 +++++++++ .../web/lecture/message/SuccessMessage.java | 8 +- .../web/lecture/service/LectureService.java | 19 +++ .../web/member/MemberController.java | 29 ---- .../operation/web/member/api/MemberApi.java | 31 ++++ .../web/member/api/MemberApiController.java | 32 ++++ .../web/member/message/SuccessMessage.java | 2 +- .../web/member/service/MemberService.java | 9 + .../src}/main/resources/application.yml | 0 .../src}/main/resources/console-appender.xml | 0 .../main/resources/file-error-appender.xml | 0 .../main/resources/file-info-appender.xml | 0 .../src}/main/resources/logback-spring.xml | 0 .../admin/dto/response/RefreshResponse.java | 10 -- operation-domain/build.gradle | 7 +- .../operation/alarm/{ => domain}/Alarm.java | 32 ++-- .../alarm/{ => domain}/Attribute.java | 2 +- .../operation/alarm/{ => domain}/Status.java | 2 +- .../operation/alarm/message/ErrorMessage.java | 15 ++ .../repository}/AlarmCustomRepository.java | 8 +- .../alarm/repository}/AlarmRepository.java | 4 +- .../repository}/AlarmRepositoryImpl.java | 7 +- .../attendance/{ => domain}/Attendance.java | 10 +- .../{ => domain}/AttendanceStatus.java | 2 +- .../{ => domain}/SubAttendance.java | 6 +- .../attendance/message/ErrorMessage.java | 14 ++ .../AttendanceCustomRepository.java | 8 +- .../attendance/AttendanceRepository.java | 14 +- .../attendance/AttendanceRepositoryImpl.java | 9 +- .../SubAttendanceRepository.java | 4 +- .../converter/StringListConverter.java | 2 +- .../java/org/operation/lecture/Lecture.java | 2 +- .../org/operation/lecture/SubLecture.java | 15 +- .../lecture/message/ErrorMessage.java | 24 +++ .../lecture/LectureCustomRepository.java | 7 +- .../repository/lecture/LectureRepository.java | 2 +- .../lecture/LectureRepositoryImpl.java | 26 +-- .../subLecture}/SubLectureRepository.java | 8 +- .../main/java/org/operation/member/ObYb.java | 5 - .../operation/member/{ => domain}/Member.java | 16 +- .../org/operation/member/domain/ObYb.java | 5 + .../member/message/ErrorMessage.java | 13 ++ .../repository}/MemberCustomRepository.java | 8 +- .../member/repository}/MemberRepository.java | 8 +- .../repository}/MemberRepositoryImpl.java | 10 +- .../schedule/{ => domain}/Schedule.java | 2 +- .../repository}/ScheduleCustomRepository.java | 6 +- .../repository}/ScheduleRepository.java | 2 +- .../repository}/ScheduleRepositoryImpl.java | 15 +- operation-external/build.gradle | 6 +- .../operation/client/alarm/AlarmSender.java | 7 + .../client/alarm/AlarmSenderImpl.java | 92 ++++++++++ .../client/playground/PlayGroundServer.java | 8 + .../playground/PlayGroundServerImpl.java | 18 +- .../operation/config/RestTemplateConfig.java | 2 +- .../build.gradle | 1 + .../dto/request/AttendanceRequest.java | 0 .../dto/response/AttendanceResponse.java | 12 ++ .../dto/response/AttendancesResponse.java | 18 ++ .../service/AttendanceServiceImpl.java | 115 +++++++++++++ .../response/LectureCurrentRoundResponse.java | 15 ++ .../dto}/response/LectureResponseType.java | 2 +- .../dto/response/TodayLectureResponse.java | 20 +-- .../lecture/service}/LectureServiceImpl.java | 64 ++++--- .../response/AttendanceTotalResponseDTO.java | 9 +- .../dto}/response/AttendanceTotalVO.java | 10 +- .../dto/response/MemberScoreGetResponse.java | 11 ++ .../member/service}/MemberServiceImpl.java | 28 +-- .../dto}/response/SchedulesResponseDTO.java | 11 +- .../service}/ScheduleServiceImpl.java | 8 +- .../operation/common}/config/ValueConfig.java | 25 ++- .../common/dto/MemberSearchCondition.java | 9 + .../exception/AdminFailureException.java | 0 .../common/exception/AlarmException.java | 0 .../common/exception/LectureException.java | 0 .../common/exception/MemberException.java | 0 .../common/exception/SubLectureException.java | 0 .../common/exception/TokenException.java | 0 .../common/service}/LectureServiceImpl.java | 23 +-- .../security/AdminAuthentication.java | 2 +- .../operation/security}/SecurityConfig.java | 2 +- .../security/jwt/JwtAuthenticationFilter.java | 2 +- .../security/jwt/JwtExceptionFilter.java | 2 +- .../security/jwt/JwtTokenProvider.java | 5 +- .../operation/security/jwt/JwtTokenType.java | 2 +- .../web/admin/dto/request/LoginRequest.java | 0 .../web/admin/dto/request/SignUpRequest.java | 0 .../web/admin/dto/response/LoginResponse.java | 0 .../admin/dto/response/RefreshResponse.java | 13 ++ .../admin/dto/response/SignUpResponse.java | 0 .../web/admin/repository/AdminRepository.java | 0 .../web/admin/service/AdminServiceImpl.java | 4 +- .../web/alarm/dto/request/AlarmRequest.java | 10 +- .../alarm/dto/request/AlarmSendRequest.java | 6 + .../alarm/dto/request/AlarmSenderRequest.java | 12 +- .../response/AlarmInactiveListResponse.java | 8 + .../web/alarm/dto/response/AlarmResponse.java | 10 +- .../alarm/dto/response/AlarmsResponse.java | 10 +- .../web/alarm/service}/AlarmServiceImpl.java | 90 +++++----- .../request/SubAttendanceUpdateRequest.java | 9 + .../response/AttendanceMemberResponse.java | 14 +- .../dto/response/AttendancesResponse.java | 17 ++ .../dto/response/MemberResponse.java | 16 +- .../response/SubAttendanceUpdateResponse.java | 13 ++ .../service/AttendanceServiceImpl.java | 77 +++++++++ .../dto/request/AttendanceRequest.java | 8 + .../lecture/dto/request/LectureRequest.java | 9 +- .../dto/response/AttendanceResponse.java | 10 +- .../dto}/response/AttendancesStatusVO.java | 6 +- .../dto/response/LectureDetailResponse.java | 8 +- .../lecture/dto/response/LectureResponse.java | 14 +- .../dto/response/LecturesResponse.java | 12 +- .../lecture/service}/LectureServiceImpl.java | 86 +++++----- .../dto/response/AttendanceTotalCountVO.java | 17 ++ .../dto/response/AttendanceTotalVO.java | 32 ++++ .../dto/response/MemberListGetResponse.java | 24 +++ .../member/dto/response/MembersResponse.java | 13 ++ .../member/service}/MemberServiceImpl.java | 35 ++-- operation-storage/build.gradle | 19 --- operation-storage/db-jpa/build.gradle | 19 --- settings.gradle | 2 +- .../operation/common/ExceptionMessage.java | 37 ---- .../operation/common/ResponseMessage.java | 32 ---- .../alarm/request/AlarmSendRequestDTO.java | 4 - .../AlarmInactiveListResponseDTO.java | 6 - .../alarm/response/AlarmSendResponseDTO.java | 8 - .../SubAttendanceUpdateRequestDTO.java | 9 - .../response/AttendResponseDTO.java | 11 -- .../response/AttendanceTotalCountVO.java | 17 -- .../response/AttendancesResponseDTO.java | 16 -- .../SubAttendanceUpdateResponseDTO.java | 13 -- .../lecture/request/AttendanceRequestDTO.java | 8 - .../LectureCurrentRoundResponseDTO.java | 15 -- .../dto/member/request/MemberRequestDTO.java | 15 -- .../response/MemberListGetResponse.java | 26 --- .../response/MemberScoreGetResponse.java | 11 -- .../response/MemberSearchCondition.java | 6 - .../member/response/MembersResponseDTO.java | 12 -- .../operation/external/alarm/AlarmSender.java | 7 - .../external/alarm/AlarmSenderImpl.java | 105 ------------ .../external/playground/PlayGroundServer.java | 8 - .../app/attendance/AttendanceService.java | 8 - .../app/attendance/AttendanceServiceImpl.java | 86 ---------- .../service/app/lecture/LectureService.java | 10 -- .../service/app/member/MemberService.java | 9 - .../service/web/alarm/AlarmService.java | 18 -- .../web/attendance/AttendanceService.java | 15 -- .../web/attendance/AttendanceServiceImpl.java | 75 --------- .../service/web/lecture/LectureService.java | 21 --- .../service/web/member/MemberService.java | 9 - .../OperationServerApplicationTests.java | 9 - .../controller/web/LectureControllerTest.java | 159 ------------------ .../operation/fixture/LectureFixture.java | 145 ---------------- .../service/web/LectureServiceImplTest.java | 112 ------------ 180 files changed, 1805 insertions(+), 1786 deletions(-) create mode 100644 operation-api/src/main/java/org/operation/app/attendance/service/AttendanceService.java create mode 100644 operation-api/src/main/java/org/operation/app/lecture/service/LectureService.java create mode 100644 operation-api/src/main/java/org/operation/app/member/service/MemberService.java rename {src/main/java/org/sopt/makers/operation/service/app/schedule => operation-api/src/main/java/org/operation/app/schedule/service}/ScheduleService.java (52%) rename {src/main/java/org/sopt/makers/operation => operation-api/src/main/java/org/operation/common}/scheduler/LectureScheduler.java (80%) rename {src/main/java/org/sopt/makers/operation/service/batch => operation-api/src/main/java/org/operation/common/scheduler/service}/LectureService.java (54%) delete mode 100644 operation-api/src/main/java/org/operation/web/alarm/AlarmController.java create mode 100644 operation-api/src/main/java/org/operation/web/alarm/service/AlarmService.java delete mode 100644 operation-api/src/main/java/org/operation/web/attendnace/AttendanceController.java create mode 100644 operation-api/src/main/java/org/operation/web/attendnace/service/AttendanceService.java delete mode 100644 operation-api/src/main/java/org/operation/web/lecture/LectureController.java create mode 100644 operation-api/src/main/java/org/operation/web/lecture/service/LectureService.java delete mode 100644 operation-api/src/main/java/org/operation/web/member/MemberController.java create mode 100644 operation-api/src/main/java/org/operation/web/member/service/MemberService.java rename {src => operation-api/src}/main/resources/application.yml (100%) rename {src => operation-api/src}/main/resources/console-appender.xml (100%) rename {src => operation-api/src}/main/resources/file-error-appender.xml (100%) rename {src => operation-api/src}/main/resources/file-info-appender.xml (100%) rename {src => operation-api/src}/main/resources/logback-spring.xml (100%) delete mode 100644 operation-business/src/main/java/org/operation/web/admin/dto/response/RefreshResponse.java rename operation-domain/src/main/java/org/operation/alarm/{ => domain}/Alarm.java (66%) rename operation-domain/src/main/java/org/operation/alarm/{ => domain}/Attribute.java (83%) rename operation-domain/src/main/java/org/operation/alarm/{ => domain}/Status.java (83%) create mode 100644 operation-domain/src/main/java/org/operation/alarm/message/ErrorMessage.java rename {src/main/java/org/sopt/makers/operation/repository/alarm => operation-domain/src/main/java/org/operation/alarm/repository}/AlarmCustomRepository.java (63%) rename {src/main/java/org/sopt/makers/operation/repository/alarm => operation-domain/src/main/java/org/operation/alarm/repository}/AlarmRepository.java (64%) rename {src/main/java/org/sopt/makers/operation/repository/alarm => operation-domain/src/main/java/org/operation/alarm/repository}/AlarmRepositoryImpl.java (90%) rename operation-domain/src/main/java/org/operation/attendance/{ => domain}/Attendance.java (92%) rename operation-domain/src/main/java/org/operation/attendance/{ => domain}/AttendanceStatus.java (86%) rename operation-domain/src/main/java/org/operation/attendance/{ => domain}/SubAttendance.java (92%) create mode 100644 operation-domain/src/main/java/org/operation/attendance/message/ErrorMessage.java rename {src/main/java/org/sopt/makers/operation => operation-domain/src/main/java/org/operation/attendance}/repository/attendance/AttendanceCustomRepository.java (68%) rename {src/main/java/org/sopt/makers/operation => operation-domain/src/main/java/org/operation/attendance}/repository/attendance/AttendanceRepository.java (55%) rename {src/main/java/org/sopt/makers/operation => operation-domain/src/main/java/org/operation/attendance}/repository/attendance/AttendanceRepositoryImpl.java (98%) rename {src/main/java/org/sopt/makers/operation/repository/attendance => operation-domain/src/main/java/org/operation/attendance/repository/subAttendance}/SubAttendanceRepository.java (82%) rename {src/main/java/org/sopt/makers => operation-domain/src/main/java/org}/operation/converter/StringListConverter.java (96%) create mode 100644 operation-domain/src/main/java/org/operation/lecture/message/ErrorMessage.java rename {src/main/java/org/sopt/makers/operation => operation-domain/src/main/java/org/operation/lecture}/repository/lecture/LectureCustomRepository.java (73%) rename {src/main/java/org/sopt/makers/operation => operation-domain/src/main/java/org/operation/lecture}/repository/lecture/LectureRepository.java (79%) rename {src/main/java/org/sopt/makers/operation => operation-domain/src/main/java/org/operation/lecture}/repository/lecture/LectureRepositoryImpl.java (97%) rename {src/main/java/org/sopt/makers/operation/repository/lecture => operation-domain/src/main/java/org/operation/lecture/repository/subLecture}/SubLectureRepository.java (91%) delete mode 100644 operation-domain/src/main/java/org/operation/member/ObYb.java rename operation-domain/src/main/java/org/operation/member/{ => domain}/Member.java (72%) create mode 100644 operation-domain/src/main/java/org/operation/member/domain/ObYb.java create mode 100644 operation-domain/src/main/java/org/operation/member/message/ErrorMessage.java rename {src/main/java/org/sopt/makers/operation/repository/member => operation-domain/src/main/java/org/operation/member/repository}/MemberCustomRepository.java (66%) rename {src/main/java/org/sopt/makers/operation/repository/member => operation-domain/src/main/java/org/operation/member/repository}/MemberRepository.java (78%) rename {src/main/java/org/sopt/makers/operation/repository/member => operation-domain/src/main/java/org/operation/member/repository}/MemberRepositoryImpl.java (96%) rename operation-domain/src/main/java/org/operation/schedule/{ => domain}/Schedule.java (94%) rename {src/main/java/org/sopt/makers/operation/repository/schedule => operation-domain/src/main/java/org/operation/schedule/repository}/ScheduleCustomRepository.java (66%) rename {src/main/java/org/sopt/makers/operation/repository/schedule => operation-domain/src/main/java/org/operation/schedule/repository}/ScheduleRepository.java (78%) rename {src/main/java/org/sopt/makers/operation/repository/schedule => operation-domain/src/main/java/org/operation/schedule/repository}/ScheduleRepositoryImpl.java (76%) create mode 100644 operation-external/src/main/java/org/operation/client/alarm/AlarmSender.java create mode 100644 operation-external/src/main/java/org/operation/client/alarm/AlarmSenderImpl.java create mode 100644 operation-external/src/main/java/org/operation/client/playground/PlayGroundServer.java rename {src/main/java/org/sopt/makers/operation/external => operation-external/src/main/java/org/operation/client}/playground/PlayGroundServerImpl.java (72%) rename {src/main/java/org/sopt/makers => operation-external/src/main/java/org}/operation/config/RestTemplateConfig.java (87%) rename {operation-business => operation-service}/build.gradle (88%) rename {operation-business => operation-service}/src/main/java/org/operation/app/attendance/dto/request/AttendanceRequest.java (100%) create mode 100644 operation-service/src/main/java/org/operation/app/attendance/dto/response/AttendanceResponse.java create mode 100644 operation-service/src/main/java/org/operation/app/attendance/dto/response/AttendancesResponse.java create mode 100644 operation-service/src/main/java/org/operation/app/attendance/service/AttendanceServiceImpl.java create mode 100644 operation-service/src/main/java/org/operation/app/lecture/dto/response/LectureCurrentRoundResponse.java rename {src/main/java/org/sopt/makers/operation/dto/lecture => operation-service/src/main/java/org/operation/app/lecture/dto}/response/LectureResponseType.java (59%) rename src/main/java/org/sopt/makers/operation/dto/lecture/response/TodayLectureResponseDTO.java => operation-service/src/main/java/org/operation/app/lecture/dto/response/TodayLectureResponse.java (81%) rename {src/main/java/org/sopt/makers/operation/service/app/lecture => operation-service/src/main/java/org/operation/app/lecture/service}/LectureServiceImpl.java (65%) rename {src/main/java/org/sopt/makers/operation/dto/attendance => operation-service/src/main/java/org/operation/app/member/dto}/response/AttendanceTotalResponseDTO.java (75%) rename {src/main/java/org/sopt/makers/operation/dto/attendance => operation-service/src/main/java/org/operation/app/member/dto}/response/AttendanceTotalVO.java (85%) create mode 100644 operation-service/src/main/java/org/operation/app/member/dto/response/MemberScoreGetResponse.java rename {src/main/java/org/sopt/makers/operation/service/app/member => operation-service/src/main/java/org/operation/app/member/service}/MemberServiceImpl.java (78%) rename {src/main/java/org/sopt/makers/operation/dto/schedule => operation-service/src/main/java/org/operation/app/schedule/dto}/response/SchedulesResponseDTO.java (93%) rename {src/main/java/org/sopt/makers/operation/service/app/schedule => operation-service/src/main/java/org/operation/app/schedule/service}/ScheduleServiceImpl.java (91%) rename {src/main/java/org/sopt/makers/operation => operation-service/src/main/java/org/operation/common}/config/ValueConfig.java (57%) create mode 100644 operation-service/src/main/java/org/operation/common/dto/MemberSearchCondition.java rename {operation-business => operation-service}/src/main/java/org/operation/common/exception/AdminFailureException.java (100%) rename {operation-business => operation-service}/src/main/java/org/operation/common/exception/AlarmException.java (100%) rename {operation-business => operation-service}/src/main/java/org/operation/common/exception/LectureException.java (100%) rename {operation-business => operation-service}/src/main/java/org/operation/common/exception/MemberException.java (100%) rename {operation-business => operation-service}/src/main/java/org/operation/common/exception/SubLectureException.java (100%) rename {operation-business => operation-service}/src/main/java/org/operation/common/exception/TokenException.java (100%) rename {src/main/java/org/sopt/makers/operation/service/batch => operation-service/src/main/java/org/operation/common/service}/LectureServiceImpl.java (68%) rename {src/main/java/org/sopt/makers => operation-service/src/main/java/org}/operation/security/AdminAuthentication.java (90%) rename {src/main/java/org/sopt/makers/operation/config => operation-service/src/main/java/org/operation/security}/SecurityConfig.java (98%) rename {src/main/java/org/sopt/makers => operation-service/src/main/java/org}/operation/security/jwt/JwtAuthenticationFilter.java (97%) rename {src/main/java/org/sopt/makers => operation-service/src/main/java/org}/operation/security/jwt/JwtExceptionFilter.java (96%) rename {src/main/java/org/sopt/makers => operation-service/src/main/java/org}/operation/security/jwt/JwtTokenProvider.java (98%) rename {src/main/java/org/sopt/makers => operation-service/src/main/java/org}/operation/security/jwt/JwtTokenType.java (62%) rename {operation-business => operation-service}/src/main/java/org/operation/web/admin/dto/request/LoginRequest.java (100%) rename {operation-business => operation-service}/src/main/java/org/operation/web/admin/dto/request/SignUpRequest.java (100%) rename {operation-business => operation-service}/src/main/java/org/operation/web/admin/dto/response/LoginResponse.java (100%) create mode 100644 operation-service/src/main/java/org/operation/web/admin/dto/response/RefreshResponse.java rename {operation-business => operation-service}/src/main/java/org/operation/web/admin/dto/response/SignUpResponse.java (100%) rename {operation-business => operation-service}/src/main/java/org/operation/web/admin/repository/AdminRepository.java (100%) rename {operation-business => operation-service}/src/main/java/org/operation/web/admin/service/AdminServiceImpl.java (96%) rename src/main/java/org/sopt/makers/operation/dto/alarm/request/AlarmRequestDTO.java => operation-service/src/main/java/org/operation/web/alarm/dto/request/AlarmRequest.java (55%) create mode 100644 operation-service/src/main/java/org/operation/web/alarm/dto/request/AlarmSendRequest.java rename src/main/java/org/sopt/makers/operation/dto/alarm/request/AlarmSenderDTO.java => operation-service/src/main/java/org/operation/web/alarm/dto/request/AlarmSenderRequest.java (55%) create mode 100644 operation-service/src/main/java/org/operation/web/alarm/dto/response/AlarmInactiveListResponse.java rename src/main/java/org/sopt/makers/operation/dto/alarm/response/AlarmResponseDTO.java => operation-service/src/main/java/org/operation/web/alarm/dto/response/AlarmResponse.java (74%) rename src/main/java/org/sopt/makers/operation/dto/alarm/response/AlarmsResponseDTO.java => operation-service/src/main/java/org/operation/web/alarm/dto/response/AlarmsResponse.java (71%) rename {src/main/java/org/sopt/makers/operation/service/web/alarm => operation-service/src/main/java/org/operation/web/alarm/service}/AlarmServiceImpl.java (51%) create mode 100644 operation-service/src/main/java/org/operation/web/attendance/dto/request/SubAttendanceUpdateRequest.java rename src/main/java/org/sopt/makers/operation/dto/attendance/response/AttendanceMemberResponseDTO.java => operation-service/src/main/java/org/operation/web/attendance/dto/response/AttendanceMemberResponse.java (73%) create mode 100644 operation-service/src/main/java/org/operation/web/attendance/dto/response/AttendancesResponse.java rename src/main/java/org/sopt/makers/operation/dto/attendance/response/MemberResponseDTO.java => operation-service/src/main/java/org/operation/web/attendance/dto/response/MemberResponse.java (71%) create mode 100644 operation-service/src/main/java/org/operation/web/attendance/dto/response/SubAttendanceUpdateResponse.java create mode 100644 operation-service/src/main/java/org/operation/web/attendance/service/AttendanceServiceImpl.java create mode 100644 operation-service/src/main/java/org/operation/web/lecture/dto/request/AttendanceRequest.java rename src/main/java/org/sopt/makers/operation/dto/lecture/request/LectureRequestDTO.java => operation-service/src/main/java/org/operation/web/lecture/dto/request/LectureRequest.java (81%) rename src/main/java/org/sopt/makers/operation/dto/lecture/response/AttendanceResponseDTO.java => operation-service/src/main/java/org/operation/web/lecture/dto/response/AttendanceResponse.java (53%) rename {src/main/java/org/sopt/makers/operation/dto/lecture => operation-service/src/main/java/org/operation/web/lecture/dto}/response/AttendancesStatusVO.java (82%) rename src/main/java/org/sopt/makers/operation/dto/lecture/response/LectureDetailResponseDTO.java => operation-service/src/main/java/org/operation/web/lecture/dto/response/LectureDetailResponse.java (72%) rename src/main/java/org/sopt/makers/operation/dto/lecture/response/LectureResponseDTO.java => operation-service/src/main/java/org/operation/web/lecture/dto/response/LectureResponse.java (84%) rename src/main/java/org/sopt/makers/operation/dto/lecture/response/LecturesResponseDTO.java => operation-service/src/main/java/org/operation/web/lecture/dto/response/LecturesResponse.java (79%) rename {src/main/java/org/sopt/makers/operation/service/web/lecture => operation-service/src/main/java/org/operation/web/lecture/service}/LectureServiceImpl.java (61%) create mode 100644 operation-service/src/main/java/org/operation/web/member/dto/response/AttendanceTotalCountVO.java create mode 100644 operation-service/src/main/java/org/operation/web/member/dto/response/AttendanceTotalVO.java create mode 100644 operation-service/src/main/java/org/operation/web/member/dto/response/MemberListGetResponse.java create mode 100644 operation-service/src/main/java/org/operation/web/member/dto/response/MembersResponse.java rename {src/main/java/org/sopt/makers/operation/service/web/member => operation-service/src/main/java/org/operation/web/member/service}/MemberServiceImpl.java (72%) delete mode 100644 operation-storage/build.gradle delete mode 100644 operation-storage/db-jpa/build.gradle delete mode 100644 src/main/java/org/sopt/makers/operation/common/ExceptionMessage.java delete mode 100644 src/main/java/org/sopt/makers/operation/common/ResponseMessage.java delete mode 100644 src/main/java/org/sopt/makers/operation/dto/alarm/request/AlarmSendRequestDTO.java delete mode 100644 src/main/java/org/sopt/makers/operation/dto/alarm/response/AlarmInactiveListResponseDTO.java delete mode 100644 src/main/java/org/sopt/makers/operation/dto/alarm/response/AlarmSendResponseDTO.java delete mode 100644 src/main/java/org/sopt/makers/operation/dto/attendance/request/SubAttendanceUpdateRequestDTO.java delete mode 100644 src/main/java/org/sopt/makers/operation/dto/attendance/response/AttendResponseDTO.java delete mode 100644 src/main/java/org/sopt/makers/operation/dto/attendance/response/AttendanceTotalCountVO.java delete mode 100644 src/main/java/org/sopt/makers/operation/dto/attendance/response/AttendancesResponseDTO.java delete mode 100644 src/main/java/org/sopt/makers/operation/dto/attendance/response/SubAttendanceUpdateResponseDTO.java delete mode 100644 src/main/java/org/sopt/makers/operation/dto/lecture/request/AttendanceRequestDTO.java delete mode 100644 src/main/java/org/sopt/makers/operation/dto/lecture/response/LectureCurrentRoundResponseDTO.java delete mode 100644 src/main/java/org/sopt/makers/operation/dto/member/request/MemberRequestDTO.java delete mode 100644 src/main/java/org/sopt/makers/operation/dto/member/response/MemberListGetResponse.java delete mode 100644 src/main/java/org/sopt/makers/operation/dto/member/response/MemberScoreGetResponse.java delete mode 100644 src/main/java/org/sopt/makers/operation/dto/member/response/MemberSearchCondition.java delete mode 100644 src/main/java/org/sopt/makers/operation/dto/member/response/MembersResponseDTO.java delete mode 100644 src/main/java/org/sopt/makers/operation/external/alarm/AlarmSender.java delete mode 100644 src/main/java/org/sopt/makers/operation/external/alarm/AlarmSenderImpl.java delete mode 100644 src/main/java/org/sopt/makers/operation/external/playground/PlayGroundServer.java delete mode 100644 src/main/java/org/sopt/makers/operation/service/app/attendance/AttendanceService.java delete mode 100644 src/main/java/org/sopt/makers/operation/service/app/attendance/AttendanceServiceImpl.java delete mode 100644 src/main/java/org/sopt/makers/operation/service/app/lecture/LectureService.java delete mode 100644 src/main/java/org/sopt/makers/operation/service/app/member/MemberService.java delete mode 100644 src/main/java/org/sopt/makers/operation/service/web/alarm/AlarmService.java delete mode 100644 src/main/java/org/sopt/makers/operation/service/web/attendance/AttendanceService.java delete mode 100644 src/main/java/org/sopt/makers/operation/service/web/attendance/AttendanceServiceImpl.java delete mode 100644 src/main/java/org/sopt/makers/operation/service/web/lecture/LectureService.java delete mode 100644 src/main/java/org/sopt/makers/operation/service/web/member/MemberService.java delete mode 100644 src/test/java/org/sopt/makers/operation/OperationServerApplicationTests.java delete mode 100644 src/test/java/org/sopt/makers/operation/controller/web/LectureControllerTest.java delete mode 100644 src/test/java/org/sopt/makers/operation/fixture/LectureFixture.java delete mode 100644 src/test/java/org/sopt/makers/operation/service/web/LectureServiceImplTest.java diff --git a/.github/workflows/cd-dev.yml b/.github/workflows/cd-dev.yml index 308c2112..e44e7089 100644 --- a/.github/workflows/cd-dev.yml +++ b/.github/workflows/cd-dev.yml @@ -26,7 +26,7 @@ jobs: - name: Create application.yml run: | pwd - touch src/main/resources/application-dev.yml + touch ./module-api/src/main/resources/application-dev.yml echo "${{ secrets.APPLICATION_DEV }}" >> src/main/resources/application-dev.yml cat src/main/resources/application-dev.yml diff --git a/operation-api/build.gradle b/operation-api/build.gradle index 9d3c0444..e9561ca5 100644 --- a/operation-api/build.gradle +++ b/operation-api/build.gradle @@ -7,7 +7,10 @@ tasks.named('jar') { } dependencies { - implementation project(path: ':operation-business') + implementation project(path: ':operation-service') + implementation project(path: ':operation-domain') implementation 'org.springframework.boot:spring-boot-starter-web' + implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.0.2' + implementation 'org.springframework.boot:spring-boot-starter-data-jpa' } diff --git a/operation-api/src/main/java/org/operation/app/attendance/api/AttendanceApiController.java b/operation-api/src/main/java/org/operation/app/attendance/api/AttendanceApiController.java index fbee053e..edb4a710 100644 --- a/operation-api/src/main/java/org/operation/app/attendance/api/AttendanceApiController.java +++ b/operation-api/src/main/java/org/operation/app/attendance/api/AttendanceApiController.java @@ -5,6 +5,7 @@ import java.security.Principal; import org.operation.app.attendance.dto.request.AttendanceRequest; +import org.operation.app.attendance.service.AttendanceService; import org.operation.common.util.CommonUtils; import org.operation.common.util.ApiResponseUtil; import org.operation.common.dto.BaseResponse; @@ -22,14 +23,14 @@ @RequiredArgsConstructor @RequestMapping("/api/v1/app/attendances") public class AttendanceApiController implements AttendanceApi { - // private final AttendanceService attendanceService; + private final AttendanceService attendanceService; private final CommonUtils utils; @Override @PostMapping("/attend") public ResponseEntity> attend(@RequestBody AttendanceRequest request, @NonNull Principal principal) { val memberId = utils.getMemberId(principal); - val response = memberId + ""; // attendanceService.attend(memberId, requestDTO); + val response = attendanceService.attend(memberId, request); return ApiResponseUtil.ok(SUCCESS_GET_ATTENDANCE.getContent(), response); } } diff --git a/operation-api/src/main/java/org/operation/app/attendance/service/AttendanceService.java b/operation-api/src/main/java/org/operation/app/attendance/service/AttendanceService.java new file mode 100644 index 00000000..a7f7eedf --- /dev/null +++ b/operation-api/src/main/java/org/operation/app/attendance/service/AttendanceService.java @@ -0,0 +1,8 @@ +package org.operation.app.attendance.service; + +import org.operation.app.attendance.dto.request.AttendanceRequest; +import org.operation.app.attendance.dto.response.AttendanceResponse; + +public interface AttendanceService { + AttendanceResponse attend(long memberId, AttendanceRequest request); +} diff --git a/operation-api/src/main/java/org/operation/app/lecture/api/LectureApiController.java b/operation-api/src/main/java/org/operation/app/lecture/api/LectureApiController.java index 2b939857..bb83c817 100644 --- a/operation-api/src/main/java/org/operation/app/lecture/api/LectureApiController.java +++ b/operation-api/src/main/java/org/operation/app/lecture/api/LectureApiController.java @@ -4,9 +4,9 @@ import java.security.Principal; +import org.operation.app.lecture.service.LectureService; import org.operation.common.dto.BaseResponse; import org.operation.common.util.ApiResponseUtil; -import org.operation.common.util.CommonUtils; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; @@ -22,21 +22,20 @@ @RequestMapping("/api/v1/app/lectures") public class LectureApiController implements LectureApi { - // private final LectureService lectureService; - private final CommonUtils utils; + private final LectureService lectureService; @Override @GetMapping public ResponseEntity> getTodayLecture(@NonNull Principal principal) { val memberId = Long.parseLong(principal.getName()); - val response = ""; // lectureService.getTodayLecture(memberId); + val response = lectureService.getTodayLecture(memberId); return ApiResponseUtil.ok(SUCCESS_SINGLE_GET_LECTURE.getContent(), response); } @Override @GetMapping("/round/{lectureId}") public ResponseEntity> getRound(@PathVariable long lectureId) { - val response = ""; // lectureService.getCurrentLectureRound(lectureId); + val response = lectureService.getCurrentLectureRound(lectureId); return ApiResponseUtil.ok(SUCCESS_GET_LECTURE_ROUND.getContent(), response); } } diff --git a/operation-api/src/main/java/org/operation/app/lecture/service/LectureService.java b/operation-api/src/main/java/org/operation/app/lecture/service/LectureService.java new file mode 100644 index 00000000..4ed13ba8 --- /dev/null +++ b/operation-api/src/main/java/org/operation/app/lecture/service/LectureService.java @@ -0,0 +1,10 @@ +package org.operation.app.lecture.service; + +import org.operation.app.lecture.dto.response.LectureCurrentRoundResponse; +import org.operation.app.lecture.dto.response.TodayLectureResponse; + +public interface LectureService { + + TodayLectureResponse getTodayLecture(long memberPlaygroundId); + LectureCurrentRoundResponse getCurrentLectureRound(long lectureId); +} diff --git a/operation-api/src/main/java/org/operation/app/member/api/MemberApiController.java b/operation-api/src/main/java/org/operation/app/member/api/MemberApiController.java index 5b3b41b5..2bd286fc 100644 --- a/operation-api/src/main/java/org/operation/app/member/api/MemberApiController.java +++ b/operation-api/src/main/java/org/operation/app/member/api/MemberApiController.java @@ -4,6 +4,7 @@ import java.security.Principal; +import org.operation.app.member.service.MemberService; import org.operation.common.dto.BaseResponse; import org.operation.common.util.ApiResponseUtil; import org.operation.common.util.CommonUtils; @@ -21,14 +22,14 @@ @RequestMapping("/api/v1/app/members") public class MemberApiController implements MemberApi { - // private final MemberService memberService; - private CommonUtils utils; + private final MemberService memberService; + private final CommonUtils utils; @Override @GetMapping("/attendances") public ResponseEntity> getMemberTotalAttendance(@NonNull Principal principal) { val memberId = utils.getMemberId(principal); - val response = ""; // memberService.getMemberTotalAttendance(memberId); + val response = memberService.getMemberTotalAttendance(memberId); return ApiResponseUtil.ok(SUCCESS_TOTAL_ATTENDANCE.getContent(), response); } @@ -36,7 +37,7 @@ public ResponseEntity> getMemberTotalAttendance(@NonNull Princip @GetMapping("/score") public ResponseEntity> getScore(@NonNull Principal principal) { val memberId = utils.getMemberId(principal); - val response = ""; // memberService.getMemberScore(memberId); + val response = memberService.getMemberScore(memberId); return ApiResponseUtil.ok(SUCCESS_GET_ATTENDANCE_SCORE.getContent(), response); } } diff --git a/operation-api/src/main/java/org/operation/app/member/service/MemberService.java b/operation-api/src/main/java/org/operation/app/member/service/MemberService.java new file mode 100644 index 00000000..26d4d7ce --- /dev/null +++ b/operation-api/src/main/java/org/operation/app/member/service/MemberService.java @@ -0,0 +1,9 @@ +package org.operation.app.member.service; + +import org.operation.app.member.dto.response.AttendanceTotalResponseDTO; +import org.operation.app.member.dto.response.MemberScoreGetResponse; + +public interface MemberService { + AttendanceTotalResponseDTO getMemberTotalAttendance(Long playGroundId); + MemberScoreGetResponse getMemberScore(Long playGroundId); +} diff --git a/operation-api/src/main/java/org/operation/app/schedule/api/ScheduleApiController.java b/operation-api/src/main/java/org/operation/app/schedule/api/ScheduleApiController.java index 412e34d4..914f4374 100644 --- a/operation-api/src/main/java/org/operation/app/schedule/api/ScheduleApiController.java +++ b/operation-api/src/main/java/org/operation/app/schedule/api/ScheduleApiController.java @@ -4,6 +4,7 @@ import java.time.LocalDateTime; +import org.operation.app.schedule.service.ScheduleService; import org.operation.common.dto.BaseResponse; import org.operation.common.util.ApiResponseUtil; import org.springframework.format.annotation.DateTimeFormat; @@ -21,7 +22,7 @@ @RequestMapping("/api/v1/app/schedules") public class ScheduleApiController implements ScheduleApi { - // private final ScheduleService scheduleService; + private final ScheduleService scheduleService; @Override @GetMapping @@ -29,7 +30,7 @@ public ResponseEntity> getSchedules( @RequestParam @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDateTime start, @RequestParam @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDateTime end ) { - val response = ""; // scheduleService.getSchedules(start, end); + val response = scheduleService.getSchedules(start, end); return ApiResponseUtil.ok(SUCCESS_GET_SCHEDULES.getContent(), response); } } diff --git a/src/main/java/org/sopt/makers/operation/service/app/schedule/ScheduleService.java b/operation-api/src/main/java/org/operation/app/schedule/service/ScheduleService.java similarity index 52% rename from src/main/java/org/sopt/makers/operation/service/app/schedule/ScheduleService.java rename to operation-api/src/main/java/org/operation/app/schedule/service/ScheduleService.java index e7c74aca..e48cfd9f 100644 --- a/src/main/java/org/sopt/makers/operation/service/app/schedule/ScheduleService.java +++ b/operation-api/src/main/java/org/operation/app/schedule/service/ScheduleService.java @@ -1,8 +1,8 @@ -package org.sopt.makers.operation.service.app.schedule; +package org.operation.app.schedule.service; import java.time.LocalDateTime; -import org.sopt.makers.operation.dto.schedule.response.SchedulesResponseDTO; +import org.operation.app.schedule.dto.response.SchedulesResponseDTO; public interface ScheduleService { SchedulesResponseDTO getSchedules(LocalDateTime start, LocalDateTime end); diff --git a/src/main/java/org/sopt/makers/operation/scheduler/LectureScheduler.java b/operation-api/src/main/java/org/operation/common/scheduler/LectureScheduler.java similarity index 80% rename from src/main/java/org/sopt/makers/operation/scheduler/LectureScheduler.java rename to operation-api/src/main/java/org/operation/common/scheduler/LectureScheduler.java index 16db8642..e1a0d24e 100644 --- a/src/main/java/org/sopt/makers/operation/scheduler/LectureScheduler.java +++ b/operation-api/src/main/java/org/operation/common/scheduler/LectureScheduler.java @@ -1,6 +1,6 @@ -package org.sopt.makers.operation.scheduler; +package org.operation.common.scheduler; -import org.sopt.makers.operation.service.batch.LectureService; +import org.operation.common.scheduler.service.LectureService; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; diff --git a/src/main/java/org/sopt/makers/operation/service/batch/LectureService.java b/operation-api/src/main/java/org/operation/common/scheduler/service/LectureService.java similarity index 54% rename from src/main/java/org/sopt/makers/operation/service/batch/LectureService.java rename to operation-api/src/main/java/org/operation/common/scheduler/service/LectureService.java index b575ebf5..3fc2d719 100644 --- a/src/main/java/org/sopt/makers/operation/service/batch/LectureService.java +++ b/operation-api/src/main/java/org/operation/common/scheduler/service/LectureService.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.service.batch; +package org.operation.common.scheduler.service; public interface LectureService { diff --git a/operation-api/src/main/java/org/operation/common/util/ApiResponseUtil.java b/operation-api/src/main/java/org/operation/common/util/ApiResponseUtil.java index 025d50c1..aaf95a0e 100644 --- a/operation-api/src/main/java/org/operation/common/util/ApiResponseUtil.java +++ b/operation-api/src/main/java/org/operation/common/util/ApiResponseUtil.java @@ -1,5 +1,7 @@ package org.operation.common.util; +import java.net.URI; + import org.operation.common.dto.BaseResponse; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; @@ -21,6 +23,12 @@ static ResponseEntity> ok(HttpHeaders headers, String messag .body(BaseResponse.of(message, data)); } + static ResponseEntity> created(URI uri, String message, T data) { + return ResponseEntity + .created(uri) + .body(BaseResponse.of(message, data)); + } + static ResponseEntity> failure(HttpStatus status, String message) { return ResponseEntity.status(status) .body(BaseResponse.of(message, false)); diff --git a/operation-api/src/main/java/org/operation/common/util/CommonUtils.java b/operation-api/src/main/java/org/operation/common/util/CommonUtils.java index 00a87c4c..e321255c 100644 --- a/operation-api/src/main/java/org/operation/common/util/CommonUtils.java +++ b/operation-api/src/main/java/org/operation/common/util/CommonUtils.java @@ -1,8 +1,10 @@ package org.operation.common.util; +import java.net.URI; import java.security.Principal; import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.support.ServletUriComponentsBuilder; import lombok.NonNull; @@ -11,4 +13,12 @@ public class CommonUtils { public long getMemberId(@NonNull Principal principal) { return Long.parseLong(principal.getName()); } + + public URI getURI(String path, long id) { + return ServletUriComponentsBuilder + .fromCurrentRequest() + .path(path) + .buildAndExpand(id) + .toUri(); + } } diff --git a/operation-api/src/main/java/org/operation/web/alarm/AlarmController.java b/operation-api/src/main/java/org/operation/web/alarm/AlarmController.java deleted file mode 100644 index c234149e..00000000 --- a/operation-api/src/main/java/org/operation/web/alarm/AlarmController.java +++ /dev/null @@ -1,88 +0,0 @@ -package org.operation.web.alarm; - -import io.swagger.annotations.ApiOperation; -import lombok.RequiredArgsConstructor; - -import org.sopt.makers.operation.dto.ResponseDTO; -import org.sopt.makers.operation.dto.alarm.request.AlarmSendRequestDTO; -import org.sopt.makers.operation.service.web.alarm.AlarmService; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import static org.sopt.makers.operation.common.ResponseMessage.SUCCESS_SEND_ALARM; -import static org.sopt.makers.operation.dto.ResponseDTO.*; -import static org.sopt.makers.operation.common.ResponseMessage.*; - -import java.net.URI; - -import org.sopt.makers.operation.dto.alarm.request.AlarmRequestDTO; -import org.sopt.makers.operation.entity.Part; -import org.operation.alarm.Status; -import org.springframework.data.domain.Pageable; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.servlet.support.ServletUriComponentsBuilder; - -import lombok.*; - -@RestController -@RequiredArgsConstructor -@RequestMapping("/api/v1/alarms") -public class AlarmController { - private final AlarmService alarmService; - - @ApiOperation(value = "알림 전송") - @PostMapping("/send") - public ResponseEntity sendAlarm(@RequestBody AlarmSendRequestDTO requestDTO) { - alarmService.sendByAdmin(requestDTO); - return ResponseEntity.ok(ResponseDTO.success(ResponseMessage.SUCCESS_SEND_ALARM.getMessage())); - } - - @ApiOperation("알림 생성") - @PostMapping - public ResponseEntity createAlarm(@RequestBody AlarmRequestDTO requestDTO) { - val alarmId = alarmService.createAlarm(requestDTO); - return ResponseEntity - .created(getURI(alarmId)) - .body(ResponseDTO.success(ResponseMessage.SUCCESS_CREATE_ALARM.getMessage(), alarmId)); - } - - @ApiOperation("알림 리스트 조회") - @GetMapping - public ResponseEntity getAlarms( - @RequestParam(required = false) Integer generation, - @RequestParam(required = false) Part part, - @RequestParam(required = false) Status status, - Pageable pageable - ) { - val response = alarmService.getAlarms(generation, part, status, pageable); - return ResponseEntity.ok(ResponseDTO.success(ResponseMessage.SUCCESS_GET_ALARMS.getMessage(), response)); - } - - @ApiOperation("알림 상세 조회") - @GetMapping("/{alarmId}") - public ResponseEntity getAlarm(@PathVariable Long alarmId) { - val response = alarmService.getAlarm(alarmId); - return ResponseEntity.ok(ResponseDTO.success(ResponseMessage.SUCCESS_GET_ALARM.getMessage(), response)); - } - - @ApiOperation("알림 삭제") - @DeleteMapping("/{alarmId}") - public ResponseEntity deleteAlarm(@PathVariable Long alarmId) { - alarmService.deleteAlarm(alarmId); - return ResponseEntity.ok(ResponseDTO.success(ResponseMessage.SUCCESS_DELETE_ALARM.getMessage())); - } - - private URI getURI(Long alarmId) { - return ServletUriComponentsBuilder - .fromCurrentRequest() - .path("/{alarmId}") - .buildAndExpand(alarmId) - .toUri(); - } -} diff --git a/operation-api/src/main/java/org/operation/web/alarm/api/AlarmApi.java b/operation-api/src/main/java/org/operation/web/alarm/api/AlarmApi.java index 6fdbd7cc..2f8f4549 100644 --- a/operation-api/src/main/java/org/operation/web/alarm/api/AlarmApi.java +++ b/operation-api/src/main/java/org/operation/web/alarm/api/AlarmApi.java @@ -1,4 +1,118 @@ package org.operation.web.alarm.api; +import org.operation.alarm.domain.Status; +import org.operation.common.domain.Part; +import org.operation.common.dto.BaseResponse; +import org.operation.web.alarm.dto.request.AlarmRequest; +import org.operation.web.alarm.dto.request.AlarmSendRequest; +import org.springframework.data.domain.Pageable; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.responses.ApiResponse; + public interface AlarmApi { + + @Operation( + summary = "알림 전송 API", + responses = { + @ApiResponse( + responseCode = "200", + description = "알림 전송 성공" + ), + @ApiResponse( + responseCode = "400", + description = "잘못된 요청" + ), + @ApiResponse( + responseCode = "500", + description = "서버 내부 오류" + ) + } + ) + ResponseEntity> sendAlarm(@RequestBody AlarmSendRequest request); + + @Operation( + summary = "알림 생성 API", + responses = { + @ApiResponse( + responseCode = "200", + description = "알림 생성 성공" + ), + @ApiResponse( + responseCode = "400", + description = "잘못된 요청" + ), + @ApiResponse( + responseCode = "500", + description = "서버 내부 오류" + ) + } + ) + ResponseEntity> createAlarm(@RequestBody AlarmRequest request); + + @Operation( + summary = "알림 리스트 조회 API", + responses = { + @ApiResponse( + responseCode = "200", + description = "알림 리스트 조회 성공" + ), + @ApiResponse( + responseCode = "400", + description = "잘못된 요청" + ), + @ApiResponse( + responseCode = "500", + description = "서버 내부 오류" + ) + } + ) + ResponseEntity> getAlarms( + @RequestParam(required = false) Integer generation, + @RequestParam(required = false) Part part, + @RequestParam(required = false) Status status, + Pageable pageable + ); + + @Operation( + summary = "알림 상세 조회 API", + responses = { + @ApiResponse( + responseCode = "200", + description = "알림 상세 조회 성공" + ), + @ApiResponse( + responseCode = "400", + description = "잘못된 요청" + ), + @ApiResponse( + responseCode = "500", + description = "서버 내부 오류" + ) + } + ) + ResponseEntity> getAlarm(@PathVariable long alarmId); + + @Operation( + summary = "알림 삭제 API", + responses = { + @ApiResponse( + responseCode = "200", + description = "알림 삭제 성공" + ), + @ApiResponse( + responseCode = "400", + description = "잘못된 요청" + ), + @ApiResponse( + responseCode = "500", + description = "서버 내부 오류" + ) + } + ) + ResponseEntity> deleteAlarm(@PathVariable long alarmId); } diff --git a/operation-api/src/main/java/org/operation/web/alarm/api/AlarmApiController.java b/operation-api/src/main/java/org/operation/web/alarm/api/AlarmApiController.java index 7ba68a1f..a67980d2 100644 --- a/operation-api/src/main/java/org/operation/web/alarm/api/AlarmApiController.java +++ b/operation-api/src/main/java/org/operation/web/alarm/api/AlarmApiController.java @@ -1,4 +1,74 @@ package org.operation.web.alarm.api; +import static org.operation.web.alarm.message.SuccessMessage.*; + +import org.operation.alarm.domain.Status; +import org.operation.common.domain.Part; +import org.operation.common.dto.BaseResponse; +import org.operation.common.util.ApiResponseUtil; +import org.operation.common.util.CommonUtils; +import org.operation.web.alarm.dto.request.AlarmRequest; +import org.operation.web.alarm.dto.request.AlarmSendRequest; +import org.operation.web.alarm.service.AlarmService; +import org.springframework.data.domain.Pageable; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import lombok.RequiredArgsConstructor; +import lombok.val; + +@RestController +@RequiredArgsConstructor +@RequestMapping("/api/v1/alarms") public class AlarmApiController implements AlarmApi { + + private final AlarmService alarmService; + private final CommonUtils utils; + + @Override + @PostMapping("/send") + public ResponseEntity> sendAlarm(AlarmSendRequest request) { + alarmService.sendByAdmin(request); + return ApiResponseUtil.ok(SUCCESS_SEND_ALARM.getContent()); + } + + @Override + @PostMapping + public ResponseEntity> createAlarm(AlarmRequest request) { + val alarmId = alarmService.createAlarm(request); + val uri = utils.getURI("/{alarmId}", alarmId); + return ApiResponseUtil.created(uri, SUCCESS_CREATE_ALARM.getContent(), alarmId); + } + + @Override + @GetMapping + public ResponseEntity> getAlarms( + @RequestParam(required = false) Integer generation, + @RequestParam(required = false) Part part, + @RequestParam(required = false) Status status, + Pageable pageable + ) { + val response = alarmService.getAlarms(generation, part, status, pageable); + return ApiResponseUtil.ok(SUCCESS_GET_ALARMS.getContent(), response); + } + + @Override + @GetMapping("/{alarmId}") + public ResponseEntity> getAlarm(@PathVariable long alarmId) { + val response = alarmService.getAlarm(alarmId); + return ApiResponseUtil.ok(SUCCESS_GET_ALARM.getContent(), response); + } + + @Override + @DeleteMapping("/{alarmId}") + public ResponseEntity> deleteAlarm(@PathVariable long alarmId) { + alarmService.deleteAlarm(alarmId); + return ApiResponseUtil.ok(SUCCESS_DELETE_ALARM.getContent()); + } } diff --git a/operation-api/src/main/java/org/operation/web/alarm/message/SuccessMessage.java b/operation-api/src/main/java/org/operation/web/alarm/message/SuccessMessage.java index 4fcf4928..16858ad6 100644 --- a/operation-api/src/main/java/org/operation/web/alarm/message/SuccessMessage.java +++ b/operation-api/src/main/java/org/operation/web/alarm/message/SuccessMessage.java @@ -6,7 +6,11 @@ @Getter @RequiredArgsConstructor public enum SuccessMessage { - + SUCCESS_SEND_ALARM("알림 전송 성공"), + SUCCESS_CREATE_ALARM("알림 생성 성공"), + SUCCESS_GET_ALARMS("알림 리스트 조회 성공"), + SUCCESS_GET_ALARM("알림 상세 조회 성공"), + SUCCESS_DELETE_ALARM("알림 삭제 성공"), ; private final String content; diff --git a/operation-api/src/main/java/org/operation/web/alarm/service/AlarmService.java b/operation-api/src/main/java/org/operation/web/alarm/service/AlarmService.java new file mode 100644 index 00000000..4d581b52 --- /dev/null +++ b/operation-api/src/main/java/org/operation/web/alarm/service/AlarmService.java @@ -0,0 +1,17 @@ +package org.operation.web.alarm.service; + +import org.operation.alarm.domain.Status; +import org.operation.common.domain.Part; +import org.operation.web.alarm.dto.request.AlarmRequest; +import org.operation.web.alarm.dto.request.AlarmSendRequest; +import org.operation.web.alarm.dto.response.AlarmResponse; +import org.operation.web.alarm.dto.response.AlarmsResponse; +import org.springframework.data.domain.Pageable; + +public interface AlarmService { + void sendByAdmin(AlarmSendRequest request); + Long createAlarm(AlarmRequest requestDTO); + AlarmsResponse getAlarms(Integer generation, Part part, Status status, Pageable pageable); + AlarmResponse getAlarm(long alarmId); + void deleteAlarm(Long alarmId); +} diff --git a/operation-api/src/main/java/org/operation/web/attendnace/AttendanceController.java b/operation-api/src/main/java/org/operation/web/attendnace/AttendanceController.java deleted file mode 100644 index 4c972293..00000000 --- a/operation-api/src/main/java/org/operation/web/attendnace/AttendanceController.java +++ /dev/null @@ -1,57 +0,0 @@ -package org.operation.web.attendnace; - -import static org.sopt.makers.operation.common.ResponseMessage.*; - -import org.sopt.makers.operation.dto.ResponseDTO; -import org.sopt.makers.operation.dto.attendance.request.SubAttendanceUpdateRequestDTO; -import org.sopt.makers.operation.entity.Part; -import org.sopt.makers.operation.service.web.attendance.AttendanceService; -import org.springframework.data.domain.Pageable; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PatchMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; - -import io.swagger.annotations.ApiOperation; -import lombok.RequiredArgsConstructor; -import lombok.val; - -@RestController -@RequiredArgsConstructor -@RequestMapping("/api/v1/attendances") -public class AttendanceController { - private final AttendanceService attendanceService; - - @ApiOperation(value = "출석 상태 변경") - @PatchMapping - public ResponseEntity updateSubAttendance(@RequestBody SubAttendanceUpdateRequestDTO requestDTO) { - val response = attendanceService.updateSubAttendance(requestDTO); - return ResponseEntity.ok(ResponseDTO.success(ResponseMessage.SUCCESS_UPDATE_ATTENDANCE_STATUS.getMessage(), response)); - } - - @ApiOperation(value = "회원별 출석 정보 조회") - @GetMapping("/{memberId}") - public ResponseEntity findAttendancesByMember(@PathVariable Long memberId) { - val response = attendanceService.findAttendancesByMember(memberId); - return ResponseEntity.ok(ResponseDTO.success(ResponseMessage.SUCCESS_GET_MEMBER_ATTENDANCE.getMessage(), response)); - } - - @ApiOperation(value = "출석 점수 갱신") - @PatchMapping("/member/{memberId}") - public ResponseEntity updateMemberScore(@PathVariable Long memberId) { - val response = attendanceService.updateMemberScore(memberId); - return ResponseEntity.ok(ResponseDTO.success(ResponseMessage.SUCCESS_UPDATE_MEMBER_SCORE.getMessage(), response)); - } - - @ApiOperation(value = "세션별 출석 정보 조회") - @GetMapping("/lecture/{lectureId}") - public ResponseEntity findAttendancesByLecture( - @PathVariable Long lectureId, @RequestParam(required = false) Part part, Pageable pageable) { - val response = attendanceService.findAttendancesByLecture(lectureId, part, pageable); - return ResponseEntity.ok(ResponseDTO.success(ResponseMessage.SUCCESS_GET_ATTENDANCES.getMessage(), response)); - } -} diff --git a/operation-api/src/main/java/org/operation/web/attendnace/api/AttendanceApi.java b/operation-api/src/main/java/org/operation/web/attendnace/api/AttendanceApi.java index cf92384c..c3c7c9ff 100644 --- a/operation-api/src/main/java/org/operation/web/attendnace/api/AttendanceApi.java +++ b/operation-api/src/main/java/org/operation/web/attendnace/api/AttendanceApi.java @@ -1,4 +1,95 @@ package org.operation.web.attendnace.api; +import org.operation.common.domain.Part; +import org.operation.common.dto.BaseResponse; +import org.operation.web.attendance.dto.request.SubAttendanceUpdateRequest; +import org.springframework.data.domain.Pageable; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.responses.ApiResponse; + public interface AttendanceApi { + + @Operation( + summary = "출석 상태 변경 API", + responses = { + @ApiResponse( + responseCode = "200", + description = "출석 상태 변경 성공" + ), + @ApiResponse( + responseCode = "400", + description = "잘못된 요청" + ), + @ApiResponse( + responseCode = "500", + description = "서버 내부 오류" + ) + } + ) + ResponseEntity> updateSubAttendance(@RequestBody SubAttendanceUpdateRequest request); + + @Operation( + summary = "회원별 출석 정보 조회 API", + responses = { + @ApiResponse( + responseCode = "200", + description = "회원별 출석 정보 조회 성공" + ), + @ApiResponse( + responseCode = "400", + description = "잘못된 요청" + ), + @ApiResponse( + responseCode = "500", + description = "서버 내부 오류" + ) + } + ) + ResponseEntity> findAttendancesByMember(@PathVariable long memberId); + + @Operation( + summary = "출석 점수 갱신 API", + responses = { + @ApiResponse( + responseCode = "200", + description = "출석 점수 갱신 성공" + ), + @ApiResponse( + responseCode = "400", + description = "잘못된 요청" + ), + @ApiResponse( + responseCode = "500", + description = "서버 내부 오류" + ) + } + ) + ResponseEntity> updateMemberScore(@PathVariable long memberId); + + @Operation( + summary = "세션별 출석 정보 조회 API", + responses = { + @ApiResponse( + responseCode = "200", + description = "세션별 출석 정보 조회 성공" + ), + @ApiResponse( + responseCode = "400", + description = "잘못된 요청" + ), + @ApiResponse( + responseCode = "500", + description = "서버 내부 오류" + ) + } + ) + ResponseEntity> findAttendancesByLecture( + @PathVariable long lectureId, + @RequestParam(required = false) Part part, + Pageable pageable); } diff --git a/operation-api/src/main/java/org/operation/web/attendnace/api/AttendanceApiController.java b/operation-api/src/main/java/org/operation/web/attendnace/api/AttendanceApiController.java index 58c4ad39..b369a7ca 100644 --- a/operation-api/src/main/java/org/operation/web/attendnace/api/AttendanceApiController.java +++ b/operation-api/src/main/java/org/operation/web/attendnace/api/AttendanceApiController.java @@ -1,4 +1,61 @@ package org.operation.web.attendnace.api; +import static org.operation.web.attendnace.message.SuccessMessage.*; + +import org.operation.common.domain.Part; +import org.operation.common.dto.BaseResponse; +import org.operation.common.util.ApiResponseUtil; +import org.operation.web.attendance.dto.request.SubAttendanceUpdateRequest; +import org.operation.web.attendnace.service.AttendanceService; +import org.springframework.data.domain.Pageable; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PatchMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import lombok.RequiredArgsConstructor; +import lombok.val; + +@RestController +@RequiredArgsConstructor +@RequestMapping("/api/v1/attendances") public class AttendanceApiController implements AttendanceApi { + + private final AttendanceService attendanceService; + + @Override + @PatchMapping + public ResponseEntity> updateSubAttendance(@RequestBody SubAttendanceUpdateRequest request) { + val response = attendanceService.updateSubAttendance(request); + return ApiResponseUtil.ok(SUCCESS_UPDATE_ATTENDANCE_STATUS.getContent(), response); + } + + @Override + @GetMapping("/{memberId}") + public ResponseEntity> findAttendancesByMember(@PathVariable long memberId) { + val response = attendanceService.findAttendancesByMember(memberId); + return ApiResponseUtil.ok(SUCCESS_GET_MEMBER_ATTENDANCE.getContent(), response); + } + + @Override + @PatchMapping("/member/{memberId}") + public ResponseEntity> updateMemberScore(@PathVariable long memberId) { + val response = attendanceService.updateMemberScore(memberId); + return ApiResponseUtil.ok(SUCCESS_UPDATE_MEMBER_SCORE.getContent(), response); + } + + @Override + @GetMapping("/lecture/{lectureId}") + public ResponseEntity> findAttendancesByLecture( + @PathVariable long lectureId, + @RequestParam(required = false) Part part, + Pageable pageable + ) { + val response = attendanceService.findAttendancesByLecture(lectureId, part, pageable); + return ApiResponseUtil.ok(SUCCESS_GET_ATTENDANCES.getContent(), response); + } } diff --git a/operation-api/src/main/java/org/operation/web/attendnace/message/SuccessMessage.java b/operation-api/src/main/java/org/operation/web/attendnace/message/SuccessMessage.java index ebfd4f69..1be79795 100644 --- a/operation-api/src/main/java/org/operation/web/attendnace/message/SuccessMessage.java +++ b/operation-api/src/main/java/org/operation/web/attendnace/message/SuccessMessage.java @@ -6,7 +6,10 @@ @Getter @RequiredArgsConstructor public enum SuccessMessage { - + SUCCESS_UPDATE_ATTENDANCE_STATUS("출석 상태 변경 성공"), + SUCCESS_GET_MEMBER_ATTENDANCE("회원 출석 정보 조회 성공"), + SUCCESS_UPDATE_MEMBER_SCORE("회원 출석 점수 갱신 성공"), + SUCCESS_GET_ATTENDANCES("출석 리스트 조회 성공"), ; private final String content; diff --git a/operation-api/src/main/java/org/operation/web/attendnace/service/AttendanceService.java b/operation-api/src/main/java/org/operation/web/attendnace/service/AttendanceService.java new file mode 100644 index 00000000..dc8e8743 --- /dev/null +++ b/operation-api/src/main/java/org/operation/web/attendnace/service/AttendanceService.java @@ -0,0 +1,15 @@ +package org.operation.web.attendnace.service; + +import org.operation.common.domain.Part; +import org.operation.web.attendance.dto.request.SubAttendanceUpdateRequest; +import org.operation.web.attendance.dto.response.AttendanceMemberResponse; +import org.operation.web.attendance.dto.response.AttendancesResponse; +import org.operation.web.attendance.dto.response.SubAttendanceUpdateResponse; +import org.springframework.data.domain.Pageable; + +public interface AttendanceService { + SubAttendanceUpdateResponse updateSubAttendance(SubAttendanceUpdateRequest request); + AttendanceMemberResponse findAttendancesByMember(long memberId); + float updateMemberScore(Long memberId); + AttendancesResponse findAttendancesByLecture(long lectureId, Part part, Pageable pageable); +} diff --git a/operation-api/src/main/java/org/operation/web/lecture/LectureController.java b/operation-api/src/main/java/org/operation/web/lecture/LectureController.java deleted file mode 100644 index c5fdbf49..00000000 --- a/operation-api/src/main/java/org/operation/web/lecture/LectureController.java +++ /dev/null @@ -1,97 +0,0 @@ -package org.operation.web.lecture; - -import static org.sopt.makers.operation.dto.ResponseDTO.*; -import static org.sopt.makers.operation.common.ResponseMessage.*; - -import java.net.URI; - -import org.sopt.makers.operation.dto.ResponseDTO; -import org.sopt.makers.operation.dto.lecture.request.AttendanceRequestDTO; -import org.sopt.makers.operation.dto.lecture.request.LectureRequestDTO; -import org.sopt.makers.operation.entity.Part; -import org.sopt.makers.operation.service.web.lecture.LectureService; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PatchMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; -import org.springframework.web.servlet.support.ServletUriComponentsBuilder; - -import io.swagger.annotations.ApiOperation; -import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.RequiredArgsConstructor; -import lombok.val; - -@Tag(name = "Lecture", description = "세션 API") -@RestController -@RequiredArgsConstructor -@RequestMapping("/api/v1/lectures") -public class LectureController { - private final LectureService lectureService; - - @ApiOperation(value = "세션 생성") - @PostMapping - public ResponseEntity createLecture(@RequestBody LectureRequestDTO requestDTO) { - val lectureId = lectureService.createLecture(requestDTO); - return ResponseEntity - .created(getURI(lectureId)) - .body(ResponseDTO.success(ResponseMessage.SUCCESS_CREATE_LECTURE.getMessage(), lectureId)); - } - - @ApiOperation(value = "세션 리스트 조회") - @GetMapping - public ResponseEntity getLectures(@RequestParam int generation, @RequestParam(required = false) Part part) { - val response = lectureService.getLectures(generation, part); - return ResponseEntity.ok(ResponseDTO.success(ResponseMessage.SUCCESS_GET_LECTURES.getMessage(), response)); - } - - @ApiOperation(value = "세션 단일 조회") - @GetMapping("/{lectureId}") - public ResponseEntity getLecture(@PathVariable Long lectureId) { - val response = lectureService.getLecture(lectureId); - return ResponseEntity.ok(ResponseDTO.success(ResponseMessage.SUCCESS_GET_LECTURE.getMessage(), response)); - } - - @ApiOperation(value = "출석 시작") - @PatchMapping("/attendance") - public ResponseEntity startAttendance(@RequestBody AttendanceRequestDTO requestDTO) { - val response = lectureService.startAttendance(requestDTO); - return ResponseEntity - .created(getURI(requestDTO.lectureId())) - .body(ResponseDTO.success(ResponseMessage.SUCCESS_START_ATTENDANCE.getMessage(), response)); - } - - private URI getURI(Long lectureId) { - return ServletUriComponentsBuilder - .fromCurrentRequest() - .path("/{lectureId}") - .buildAndExpand(lectureId) - .toUri(); - } - - @ApiOperation(value = "세션 종료 후 출석 점수 갱신") - @PatchMapping("/{lectureId}") - public ResponseEntity endLecture(@PathVariable Long lectureId) { - lectureService.endLecture(lectureId); - return ResponseEntity.ok(ResponseDTO.success(ResponseMessage.SUCCESS_UPDATE_MEMBER_SCORE.getMessage())); - } - - @ApiOperation(value = "세션 삭제") - @DeleteMapping("/{lectureId}") - public ResponseEntity deleteLecture(@PathVariable Long lectureId) { - lectureService.deleteLecture(lectureId); - return ResponseEntity.ok(ResponseDTO.success(ResponseMessage.SUCCESS_DELETE_LECTURE.getMessage())); - } - - @ApiOperation(value = "세션 팝업용 상세 조회") - @GetMapping("/detail/{lectureId}") - public ResponseEntity getLectureDetail(@PathVariable Long lectureId) { - val response = lectureService.getLectureDetail(lectureId); - return ResponseEntity.ok(ResponseDTO.success(ResponseMessage.SUCCESS_GET_LECTURE.getMessage(), response)); - } -} diff --git a/operation-api/src/main/java/org/operation/web/lecture/api/LectureApi.java b/operation-api/src/main/java/org/operation/web/lecture/api/LectureApi.java index 7b3bf65e..bdfacf62 100644 --- a/operation-api/src/main/java/org/operation/web/lecture/api/LectureApi.java +++ b/operation-api/src/main/java/org/operation/web/lecture/api/LectureApi.java @@ -1,4 +1,151 @@ package org.operation.web.lecture.api; +import org.operation.common.domain.Part; +import org.operation.common.dto.BaseResponse; +import org.operation.web.lecture.dto.request.AttendanceRequest; +import org.operation.web.lecture.dto.request.LectureRequest; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.responses.ApiResponse; + public interface LectureApi { + + @Operation( + summary = "세션 생성 API", + responses = { + @ApiResponse( + responseCode = "200", + description = "세션 생성 성공" + ), + @ApiResponse( + responseCode = "400", + description = "잘못된 요청" + ), + @ApiResponse( + responseCode = "500", + description = "서버 내부 오류" + ) + } + ) + ResponseEntity> createLecture(@RequestBody LectureRequest request); + + @Operation( + summary = "세션 리스트 조회 API", + responses = { + @ApiResponse( + responseCode = "200", + description = "세션 리스트 조회 성공" + ), + @ApiResponse( + responseCode = "400", + description = "잘못된 요청" + ), + @ApiResponse( + responseCode = "500", + description = "서버 내부 오류" + ) + } + ) + ResponseEntity> getLectures( + @RequestParam int generation, + @RequestParam(required = false) Part part); + + @Operation( + summary = "세션 단일 조회 API", + responses = { + @ApiResponse( + responseCode = "200", + description = "세션 단일 조회 성공" + ), + @ApiResponse( + responseCode = "400", + description = "잘못된 요청" + ), + @ApiResponse( + responseCode = "500", + description = "서버 내부 오류" + ) + } + ) + ResponseEntity> getLecture(@PathVariable long lectureId); + + @Operation( + summary = "출석 시작 API", + responses = { + @ApiResponse( + responseCode = "200", + description = "출석 시작 성공" + ), + @ApiResponse( + responseCode = "400", + description = "잘못된 요청" + ), + @ApiResponse( + responseCode = "500", + description = "서버 내부 오류" + ) + } + ) + ResponseEntity> startAttendance(@RequestBody AttendanceRequest request); + + @Operation( + summary = "세션 종료 후 출석 점수 갱신 API", + responses = { + @ApiResponse( + responseCode = "200", + description = "세션 종료 후 출석 점수 갱신 성공" + ), + @ApiResponse( + responseCode = "400", + description = "잘못된 요청" + ), + @ApiResponse( + responseCode = "500", + description = "서버 내부 오류" + ) + } + ) + ResponseEntity> endLecture(@PathVariable long lectureId); + + @Operation( + summary = "세션 삭제 API", + responses = { + @ApiResponse( + responseCode = "200", + description = "세션 삭제 성공" + ), + @ApiResponse( + responseCode = "400", + description = "잘못된 요청" + ), + @ApiResponse( + responseCode = "500", + description = "서버 내부 오류" + ) + } + ) + ResponseEntity> deleteLecture(@PathVariable long lectureId); + + @Operation( + summary = "세션 팝업용 상세 조회 API", + responses = { + @ApiResponse( + responseCode = "200", + description = "세션 팝업용 상세 조회 성공" + ), + @ApiResponse( + responseCode = "400", + description = "잘못된 요청" + ), + @ApiResponse( + responseCode = "500", + description = "서버 내부 오류" + ) + } + ) + ResponseEntity> getLectureDetail(@PathVariable long lectureId); } diff --git a/operation-api/src/main/java/org/operation/web/lecture/api/LectureApiController.java b/operation-api/src/main/java/org/operation/web/lecture/api/LectureApiController.java index 3ec617d9..c6ca1664 100644 --- a/operation-api/src/main/java/org/operation/web/lecture/api/LectureApiController.java +++ b/operation-api/src/main/java/org/operation/web/lecture/api/LectureApiController.java @@ -1,4 +1,87 @@ package org.operation.web.lecture.api; +import static org.operation.web.lecture.message.SuccessMessage.*; + +import org.operation.common.domain.Part; +import org.operation.common.dto.BaseResponse; +import org.operation.common.util.ApiResponseUtil; +import org.operation.common.util.CommonUtils; +import org.operation.web.lecture.dto.request.AttendanceRequest; +import org.operation.web.lecture.dto.request.LectureRequest; +import org.operation.web.lecture.service.LectureService; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PatchMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import lombok.RequiredArgsConstructor; +import lombok.val; + +@RestController +@RequiredArgsConstructor +@RequestMapping("/api/v1/lectures") public class LectureApiController implements LectureApi { + + private final LectureService lectureService; + private final CommonUtils utils; + + @Override + @PostMapping + public ResponseEntity> createLecture(@RequestBody LectureRequest request) { + val lectureId = lectureService.createLecture(request); + val uri = utils.getURI("/{lectureId}", lectureId); + return ApiResponseUtil.created(uri, SUCCESS_CREATE_LECTURE.getContent(), lectureId); + } + + @Override + @GetMapping + public ResponseEntity> getLectures( + @RequestParam int generation, + @RequestParam(required = false) Part part + ) { + val response = lectureService.getLectures(generation, part); + return ApiResponseUtil.ok(SUCCESS_GET_LECTURES.getContent(), response); + } + + @Override + @GetMapping("/{lectureId}") + public ResponseEntity> getLecture(@PathVariable long lectureId) { + val response = lectureService.getLecture(lectureId); + return ApiResponseUtil.ok(SUCCESS_GET_LECTURE.getContent(), response); + } + + @Override + @PatchMapping("/attendance") + public ResponseEntity> startAttendance(AttendanceRequest request) { + val response = lectureService.startAttendance(request); + val uri = utils.getURI("/{lectureId}", response.lectureId()); + return ApiResponseUtil.created(uri, SUCCESS_START_ATTENDANCE.getContent(), response); + } + + @Override + @PatchMapping("/{lectureId}") + public ResponseEntity> endLecture(@PathVariable long lectureId) { + lectureService.endLecture(lectureId); + return ApiResponseUtil.ok(SUCCESS_UPDATE_MEMBER_SCORE.getContent(), lectureService); + } + + @Override + @DeleteMapping("/{lectureId}") + public ResponseEntity> deleteLecture(@PathVariable long lectureId) { + lectureService.deleteLecture(lectureId); + return ApiResponseUtil.ok(SUCCESS_DELETE_LECTURE.getContent()); + } + + @Override + @GetMapping("/detail/{lectureId}") + public ResponseEntity> getLectureDetail(@PathVariable long lectureId) { + val response = lectureService.getLectureDetail(lectureId); + return ApiResponseUtil.ok(SUCCESS_GET_LECTURE.getContent(), response); + } } diff --git a/operation-api/src/main/java/org/operation/web/lecture/message/SuccessMessage.java b/operation-api/src/main/java/org/operation/web/lecture/message/SuccessMessage.java index 63c6bec3..52e93c9a 100644 --- a/operation-api/src/main/java/org/operation/web/lecture/message/SuccessMessage.java +++ b/operation-api/src/main/java/org/operation/web/lecture/message/SuccessMessage.java @@ -6,7 +6,13 @@ @Getter @RequiredArgsConstructor public enum SuccessMessage { - + SUCCESS_CREATE_LECTURE("세션 생성 성공"), + SUCCESS_GET_LECTURES("세션 리스트 조회 성공"), + SUCCESS_GET_LECTURE("세션 상세 조회 성공"), + SUCCESS_START_ATTENDANCE("출석 시작 성공"), + SUCCESS_GET_MEMBERS("유저 리스트 조회 성공"), + SUCCESS_DELETE_LECTURE("세션 삭제 성공"), + SUCCESS_UPDATE_MEMBER_SCORE("회원 출석 점수 갱신 성공"), ; private final String content; diff --git a/operation-api/src/main/java/org/operation/web/lecture/service/LectureService.java b/operation-api/src/main/java/org/operation/web/lecture/service/LectureService.java new file mode 100644 index 00000000..1abc219c --- /dev/null +++ b/operation-api/src/main/java/org/operation/web/lecture/service/LectureService.java @@ -0,0 +1,19 @@ +package org.operation.web.lecture.service; + +import org.operation.common.domain.Part; +import org.operation.web.lecture.dto.request.AttendanceRequest; +import org.operation.web.lecture.dto.request.LectureRequest; +import org.operation.web.lecture.dto.response.AttendanceResponse; +import org.operation.web.lecture.dto.response.LectureDetailResponse; +import org.operation.web.lecture.dto.response.LectureResponse; +import org.operation.web.lecture.dto.response.LecturesResponse; + +public interface LectureService { + long createLecture(LectureRequest request); + LecturesResponse getLectures(int generation, Part part); + LectureResponse getLecture(long lectureId); + AttendanceResponse startAttendance(AttendanceRequest request); + void endLecture(Long lectureId); + void deleteLecture(Long lectureId); + LectureDetailResponse getLectureDetail(long lectureId); +} diff --git a/operation-api/src/main/java/org/operation/web/member/MemberController.java b/operation-api/src/main/java/org/operation/web/member/MemberController.java deleted file mode 100644 index fcaac858..00000000 --- a/operation-api/src/main/java/org/operation/web/member/MemberController.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.operation.web.member; - -import io.swagger.annotations.ApiOperation; -import lombok.RequiredArgsConstructor; -import lombok.val; - -import org.sopt.makers.operation.dto.ResponseDTO; -import org.sopt.makers.operation.entity.Part; -import org.sopt.makers.operation.service.web.member.MemberService; -import org.springframework.data.domain.Pageable; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.*; - -import static org.sopt.makers.operation.common.ResponseMessage.SUCCESS_GET_MEMBERS; - -@RestController -@RequiredArgsConstructor -@RequestMapping("/api/v1/members") -public class MemberController { - private final MemberService memberService; - - @ApiOperation(value = "멤버 리스트 조회") - @GetMapping("/list") - public ResponseEntity getMemberList( - @RequestParam(required = false) Part part, @RequestParam(required = false) Integer generation, Pageable pageable) { - val memberList = memberService.getMemberList(part, generation, pageable); - return ResponseEntity.ok(ResponseDTO.success(ResponseMessage.SUCCESS_GET_MEMBERS.getMessage(), memberList)); - } -} diff --git a/operation-api/src/main/java/org/operation/web/member/api/MemberApi.java b/operation-api/src/main/java/org/operation/web/member/api/MemberApi.java index 480968b1..7cfb5646 100644 --- a/operation-api/src/main/java/org/operation/web/member/api/MemberApi.java +++ b/operation-api/src/main/java/org/operation/web/member/api/MemberApi.java @@ -1,4 +1,35 @@ package org.operation.web.member.api; +import org.operation.common.domain.Part; +import org.operation.common.dto.BaseResponse; +import org.springframework.data.domain.Pageable; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.RequestParam; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.responses.ApiResponse; + public interface MemberApi { + + @Operation( + summary = "멤버 리스트 조회 API", + responses = { + @ApiResponse( + responseCode = "200", + description = "멤버 리스트 조회 성공" + ), + @ApiResponse( + responseCode = "400", + description = "잘못된 요청" + ), + @ApiResponse( + responseCode = "500", + description = "서버 내부 오류" + ) + } + ) + ResponseEntity> getMemberList( + @RequestParam(required = false) Part part, + @RequestParam(required = false) Integer generation, + Pageable pageable); } diff --git a/operation-api/src/main/java/org/operation/web/member/api/MemberApiController.java b/operation-api/src/main/java/org/operation/web/member/api/MemberApiController.java index 29686903..63e97e74 100644 --- a/operation-api/src/main/java/org/operation/web/member/api/MemberApiController.java +++ b/operation-api/src/main/java/org/operation/web/member/api/MemberApiController.java @@ -1,4 +1,36 @@ package org.operation.web.member.api; +import static org.operation.web.member.message.SuccessMessage.*; + +import org.operation.common.domain.Part; +import org.operation.common.dto.BaseResponse; +import org.operation.common.util.ApiResponseUtil; +import org.operation.web.member.service.MemberService; +import org.springframework.data.domain.Pageable; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import lombok.RequiredArgsConstructor; +import lombok.val; + +@RestController +@RequiredArgsConstructor +@RequestMapping("/api/v1/members") public class MemberApiController implements MemberApi { + + private final MemberService memberService; + + @Override + @GetMapping("/list") + public ResponseEntity> getMemberList( + @RequestParam(required = false) Part part, + @RequestParam(required = false) Integer generation, + Pageable pageable + ) { + val response = memberService.getMemberList(part, generation, pageable); + return ApiResponseUtil.ok(SUCCESS_GET_MEMBERS.getContent(), response); + } } diff --git a/operation-api/src/main/java/org/operation/web/member/message/SuccessMessage.java b/operation-api/src/main/java/org/operation/web/member/message/SuccessMessage.java index 84608ca8..d62f23a6 100644 --- a/operation-api/src/main/java/org/operation/web/member/message/SuccessMessage.java +++ b/operation-api/src/main/java/org/operation/web/member/message/SuccessMessage.java @@ -6,7 +6,7 @@ @Getter @RequiredArgsConstructor public enum SuccessMessage { - + SUCCESS_GET_MEMBERS("유저 리스트 조회 성공"), ; private final String content; diff --git a/operation-api/src/main/java/org/operation/web/member/service/MemberService.java b/operation-api/src/main/java/org/operation/web/member/service/MemberService.java new file mode 100644 index 00000000..7853d26e --- /dev/null +++ b/operation-api/src/main/java/org/operation/web/member/service/MemberService.java @@ -0,0 +1,9 @@ +package org.operation.web.member.service; + +import org.operation.common.domain.Part; +import org.operation.web.member.dto.response.MembersResponse; +import org.springframework.data.domain.Pageable; + +public interface MemberService { + MembersResponse getMemberList(Part part, int generation, Pageable pageable); +} diff --git a/src/main/resources/application.yml b/operation-api/src/main/resources/application.yml similarity index 100% rename from src/main/resources/application.yml rename to operation-api/src/main/resources/application.yml diff --git a/src/main/resources/console-appender.xml b/operation-api/src/main/resources/console-appender.xml similarity index 100% rename from src/main/resources/console-appender.xml rename to operation-api/src/main/resources/console-appender.xml diff --git a/src/main/resources/file-error-appender.xml b/operation-api/src/main/resources/file-error-appender.xml similarity index 100% rename from src/main/resources/file-error-appender.xml rename to operation-api/src/main/resources/file-error-appender.xml diff --git a/src/main/resources/file-info-appender.xml b/operation-api/src/main/resources/file-info-appender.xml similarity index 100% rename from src/main/resources/file-info-appender.xml rename to operation-api/src/main/resources/file-info-appender.xml diff --git a/src/main/resources/logback-spring.xml b/operation-api/src/main/resources/logback-spring.xml similarity index 100% rename from src/main/resources/logback-spring.xml rename to operation-api/src/main/resources/logback-spring.xml diff --git a/operation-business/src/main/java/org/operation/web/admin/dto/response/RefreshResponse.java b/operation-business/src/main/java/org/operation/web/admin/dto/response/RefreshResponse.java deleted file mode 100644 index 2c1ad7e3..00000000 --- a/operation-business/src/main/java/org/operation/web/admin/dto/response/RefreshResponse.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.operation.web.admin.dto.response; - -public record RefreshResponse( - String accessToken -) { - - public static RefreshResponse of(String accessToken) { - return new RefreshResponse(accessToken); - } -} \ No newline at end of file diff --git a/operation-domain/build.gradle b/operation-domain/build.gradle index 3ef353e4..2b46598e 100644 --- a/operation-domain/build.gradle +++ b/operation-domain/build.gradle @@ -10,10 +10,11 @@ repositories { } dependencies { - implementation 'org.springframework.boot:spring-boot-starter-data-jpa' + implementation project(path: ':operation-service') - testImplementation platform('org.junit:junit-bom:5.9.1') - testImplementation 'org.junit.jupiter:junit-jupiter' + implementation 'org.springframework.boot:spring-boot-starter-data-jpa' + implementation "com.querydsl:querydsl-jpa:5.0.0" + implementation "com.querydsl:querydsl-apt:5.0.0" } test { diff --git a/operation-domain/src/main/java/org/operation/alarm/Alarm.java b/operation-domain/src/main/java/org/operation/alarm/domain/Alarm.java similarity index 66% rename from operation-domain/src/main/java/org/operation/alarm/Alarm.java rename to operation-domain/src/main/java/org/operation/alarm/domain/Alarm.java index e2217061..c805bbe7 100644 --- a/operation-domain/src/main/java/org/operation/alarm/Alarm.java +++ b/operation-domain/src/main/java/org/operation/alarm/domain/Alarm.java @@ -1,4 +1,4 @@ -package org.operation.alarm; +package org.operation.alarm.domain; import static java.util.Objects.*; import static javax.persistence.EnumType.*; @@ -15,10 +15,10 @@ import javax.persistence.GeneratedValue; import javax.persistence.Id; -import org.sopt.makers.operation.converter.StringListConverter; -import org.sopt.makers.operation.dto.alarm.request.AlarmRequestDTO; import org.operation.common.domain.BaseEntity; import org.operation.common.domain.Part; +import org.operation.converter.StringListConverter; +import org.operation.web.alarm.dto.request.AlarmRequest; import lombok.Getter; import lombok.NoArgsConstructor; @@ -70,22 +70,22 @@ public void updateSendAt() { this.sendAt = LocalDateTime.now(); } - public Alarm(AlarmRequestDTO requestDTO) { - this.generation = requestDTO.generation(); - this.generationAt = requestDTO.generationAt(); - this.attribute = requestDTO.attribute(); - this.title = requestDTO.title(); - this.content = requestDTO.content(); - if (nonNull(requestDTO.link())) { - this.link = requestDTO.link(); + public Alarm(AlarmRequest request) { + this.generation = request.generation(); + this.generationAt = request.generationAt(); + this.attribute = request.attribute(); + this.title = request.title(); + this.content = request.content(); + if (nonNull(request.link())) { + this.link = request.link(); } - if (nonNull(requestDTO.isActive())) { - this.isActive = requestDTO.isActive(); + if (nonNull(request.isActive())) { + this.isActive = request.isActive(); } - if (nonNull(requestDTO.part())) { - this.part = requestDTO.part(); + if (nonNull(request.part())) { + this.part = request.part(); } - this.targetList = nonNull(requestDTO.targetList()) ? requestDTO.targetList() : new ArrayList<>(); + this.targetList = nonNull(request.targetList()) ? request.targetList() : new ArrayList<>(); this.status = Status.BEFORE; } } diff --git a/operation-domain/src/main/java/org/operation/alarm/Attribute.java b/operation-domain/src/main/java/org/operation/alarm/domain/Attribute.java similarity index 83% rename from operation-domain/src/main/java/org/operation/alarm/Attribute.java rename to operation-domain/src/main/java/org/operation/alarm/domain/Attribute.java index 84508927..7d6f9b42 100644 --- a/operation-domain/src/main/java/org/operation/alarm/Attribute.java +++ b/operation-domain/src/main/java/org/operation/alarm/domain/Attribute.java @@ -1,4 +1,4 @@ -package org.operation.alarm; +package org.operation.alarm.domain; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/operation-domain/src/main/java/org/operation/alarm/Status.java b/operation-domain/src/main/java/org/operation/alarm/domain/Status.java similarity index 83% rename from operation-domain/src/main/java/org/operation/alarm/Status.java rename to operation-domain/src/main/java/org/operation/alarm/domain/Status.java index d08ebc4a..821e37bf 100644 --- a/operation-domain/src/main/java/org/operation/alarm/Status.java +++ b/operation-domain/src/main/java/org/operation/alarm/domain/Status.java @@ -1,4 +1,4 @@ -package org.operation.alarm; +package org.operation.alarm.domain; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/operation-domain/src/main/java/org/operation/alarm/message/ErrorMessage.java b/operation-domain/src/main/java/org/operation/alarm/message/ErrorMessage.java new file mode 100644 index 00000000..92466944 --- /dev/null +++ b/operation-domain/src/main/java/org/operation/alarm/message/ErrorMessage.java @@ -0,0 +1,15 @@ +package org.operation.alarm.message; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@AllArgsConstructor +@Getter +public enum ErrorMessage { + FAIL_SEND_ALARM("알림 전송에 실패하였습니다."), + INVALID_ALARM("알림이 존재하지 않습니다."), + FAIL_INACTIVE_USERS("비활동 유저 불러오기에 실패하였습니다."), + ; + + private final String content; +} diff --git a/src/main/java/org/sopt/makers/operation/repository/alarm/AlarmCustomRepository.java b/operation-domain/src/main/java/org/operation/alarm/repository/AlarmCustomRepository.java similarity index 63% rename from src/main/java/org/sopt/makers/operation/repository/alarm/AlarmCustomRepository.java rename to operation-domain/src/main/java/org/operation/alarm/repository/AlarmCustomRepository.java index 5cae219b..46e519f3 100644 --- a/src/main/java/org/sopt/makers/operation/repository/alarm/AlarmCustomRepository.java +++ b/operation-domain/src/main/java/org/operation/alarm/repository/AlarmCustomRepository.java @@ -1,10 +1,10 @@ -package org.sopt.makers.operation.repository.alarm; +package org.operation.alarm.repository; import java.util.List; -import org.sopt.makers.operation.entity.Part; -import org.operation.alarm.Alarm; -import org.operation.alarm.Status; +import org.operation.alarm.domain.Alarm; +import org.operation.alarm.domain.Status; +import org.operation.common.domain.Part; import org.springframework.data.domain.Pageable; public interface AlarmCustomRepository { diff --git a/src/main/java/org/sopt/makers/operation/repository/alarm/AlarmRepository.java b/operation-domain/src/main/java/org/operation/alarm/repository/AlarmRepository.java similarity index 64% rename from src/main/java/org/sopt/makers/operation/repository/alarm/AlarmRepository.java rename to operation-domain/src/main/java/org/operation/alarm/repository/AlarmRepository.java index 94ded05c..2aa000ff 100644 --- a/src/main/java/org/sopt/makers/operation/repository/alarm/AlarmRepository.java +++ b/operation-domain/src/main/java/org/operation/alarm/repository/AlarmRepository.java @@ -1,6 +1,6 @@ -package org.sopt.makers.operation.repository.alarm; +package org.operation.alarm.repository; -import org.operation.alarm.Alarm; +import org.operation.alarm.domain.Alarm; import org.springframework.data.jpa.repository.JpaRepository; public interface AlarmRepository extends JpaRepository, AlarmCustomRepository { diff --git a/src/main/java/org/sopt/makers/operation/repository/alarm/AlarmRepositoryImpl.java b/operation-domain/src/main/java/org/operation/alarm/repository/AlarmRepositoryImpl.java similarity index 90% rename from src/main/java/org/sopt/makers/operation/repository/alarm/AlarmRepositoryImpl.java rename to operation-domain/src/main/java/org/operation/alarm/repository/AlarmRepositoryImpl.java index 5b90acea..5293327f 100644 --- a/src/main/java/org/sopt/makers/operation/repository/alarm/AlarmRepositoryImpl.java +++ b/operation-domain/src/main/java/org/operation/alarm/repository/AlarmRepositoryImpl.java @@ -1,13 +1,16 @@ -package org.sopt.makers.operation.repository.alarm; +package org.operation.alarm.repository; import static java.util.Objects.*; import static org.operation.alarm.QAlarm.*; import java.util.List; -import org.sopt.makers.operation.entity.Part; import org.operation.alarm.Alarm; import org.operation.alarm.Status; +import org.operation.alarm.domain.Alarm; +import org.operation.alarm.domain.Status; +import org.operation.common.domain.Part; +import org.sopt.makers.operation.entity.Part; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Repository; diff --git a/operation-domain/src/main/java/org/operation/attendance/Attendance.java b/operation-domain/src/main/java/org/operation/attendance/domain/Attendance.java similarity index 92% rename from operation-domain/src/main/java/org/operation/attendance/Attendance.java rename to operation-domain/src/main/java/org/operation/attendance/domain/Attendance.java index 7377d7f3..05ed8395 100644 --- a/operation-domain/src/main/java/org/operation/attendance/Attendance.java +++ b/operation-domain/src/main/java/org/operation/attendance/domain/Attendance.java @@ -1,8 +1,8 @@ -package org.operation.attendance; +package org.operation.attendance.domain; import static javax.persistence.GenerationType.*; -import static org.sopt.makers.operation.common.ExceptionMessage.*; -import static org.operation.attendance.AttendanceStatus.*; +import static org.operation.attendance.message.ErrorMessage.*; +import static org.operation.attendance.domain.AttendanceStatus.*; import java.util.ArrayList; import java.util.List; @@ -20,7 +20,7 @@ import javax.persistence.ManyToOne; import javax.persistence.OneToMany; -import org.operation.member.Member; +import org.operation.member.domain.Member; import org.operation.lecture.Lecture; import lombok.*; @@ -96,7 +96,7 @@ public void revertMemberScore() { private SubAttendance getSubAttendanceByRound(int round) { return this.subAttendances.stream().filter(o -> o.getSubLecture().getRound() == round).findFirst() - .orElseThrow(() -> new EntityNotFoundException(INVALID_SUB_ATTENDANCE.getName())); + .orElseThrow(() -> new EntityNotFoundException(INVALID_SUB_ATTENDANCE.getContent())); } private void setMember(Member member) { diff --git a/operation-domain/src/main/java/org/operation/attendance/AttendanceStatus.java b/operation-domain/src/main/java/org/operation/attendance/domain/AttendanceStatus.java similarity index 86% rename from operation-domain/src/main/java/org/operation/attendance/AttendanceStatus.java rename to operation-domain/src/main/java/org/operation/attendance/domain/AttendanceStatus.java index 05dc0176..13ff7055 100644 --- a/operation-domain/src/main/java/org/operation/attendance/AttendanceStatus.java +++ b/operation-domain/src/main/java/org/operation/attendance/domain/AttendanceStatus.java @@ -1,4 +1,4 @@ -package org.operation.attendance; +package org.operation.attendance.domain; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/operation-domain/src/main/java/org/operation/attendance/SubAttendance.java b/operation-domain/src/main/java/org/operation/attendance/domain/SubAttendance.java similarity index 92% rename from operation-domain/src/main/java/org/operation/attendance/SubAttendance.java rename to operation-domain/src/main/java/org/operation/attendance/domain/SubAttendance.java index 216b6180..57f707a6 100644 --- a/operation-domain/src/main/java/org/operation/attendance/SubAttendance.java +++ b/operation-domain/src/main/java/org/operation/attendance/domain/SubAttendance.java @@ -1,4 +1,4 @@ -package org.operation.attendance; +package org.operation.attendance.domain; import static javax.persistence.GenerationType.*; @@ -66,4 +66,8 @@ public void updateStatus(AttendanceStatus status) { this.status = status; this.attendance.updateStatus(); } + + public boolean isMatchRound(int round) { + return this.subLecture.getRound() == round; + } } diff --git a/operation-domain/src/main/java/org/operation/attendance/message/ErrorMessage.java b/operation-domain/src/main/java/org/operation/attendance/message/ErrorMessage.java new file mode 100644 index 00000000..51e7095d --- /dev/null +++ b/operation-domain/src/main/java/org/operation/attendance/message/ErrorMessage.java @@ -0,0 +1,14 @@ +package org.operation.attendance.message; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@AllArgsConstructor +@Getter +public enum ErrorMessage { + INVALID_ATTENDANCE("존재하지 않는 출석 세션입니다."), + INVALID_SUB_ATTENDANCE("존재하지 않는 N차 출석입니다."), + ; + + private final String content; +} diff --git a/src/main/java/org/sopt/makers/operation/repository/attendance/AttendanceCustomRepository.java b/operation-domain/src/main/java/org/operation/attendance/repository/attendance/AttendanceCustomRepository.java similarity index 68% rename from src/main/java/org/sopt/makers/operation/repository/attendance/AttendanceCustomRepository.java rename to operation-domain/src/main/java/org/operation/attendance/repository/attendance/AttendanceCustomRepository.java index 030f6e68..d64665ad 100644 --- a/src/main/java/org/sopt/makers/operation/repository/attendance/AttendanceCustomRepository.java +++ b/operation-domain/src/main/java/org/operation/attendance/repository/attendance/AttendanceCustomRepository.java @@ -1,10 +1,10 @@ -package org.sopt.makers.operation.repository.attendance; +package org.operation.attendance.repository.attendance; import java.util.List; -import org.operation.attendance.Attendance; -import org.operation.member.Member; -import org.sopt.makers.operation.entity.Part; +import org.operation.attendance.domain.Attendance; +import org.operation.common.domain.Part; +import org.operation.member.domain.Member; import org.springframework.data.domain.Pageable; public interface AttendanceCustomRepository { diff --git a/src/main/java/org/sopt/makers/operation/repository/attendance/AttendanceRepository.java b/operation-domain/src/main/java/org/operation/attendance/repository/attendance/AttendanceRepository.java similarity index 55% rename from src/main/java/org/sopt/makers/operation/repository/attendance/AttendanceRepository.java rename to operation-domain/src/main/java/org/operation/attendance/repository/attendance/AttendanceRepository.java index 42bd6741..e3870b9a 100644 --- a/src/main/java/org/sopt/makers/operation/repository/attendance/AttendanceRepository.java +++ b/operation-domain/src/main/java/org/operation/attendance/repository/attendance/AttendanceRepository.java @@ -1,17 +1,15 @@ -package org.sopt.makers.operation.repository.attendance; +package org.operation.attendance.repository.attendance; -import org.operation.attendance.Attendance; +import java.util.Optional; + +import org.operation.attendance.domain.Attendance; import org.operation.lecture.Lecture; +import org.operation.member.domain.Member; import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; -import java.util.Optional; - public interface AttendanceRepository extends JpaRepository, AttendanceCustomRepository { - Optional findAttendanceByLectureIdAndMemberId(Long lectureId, Long memberId); - - @Modifying(clearAutomatically = true, flushAutomatically = true) + Optional findByLectureAndMember(Lecture lecture, Member member); @Query("delete from Attendance a where a.lecture = :lecture") void deleteAllByLecture(Lecture lecture); } diff --git a/src/main/java/org/sopt/makers/operation/repository/attendance/AttendanceRepositoryImpl.java b/operation-domain/src/main/java/org/operation/attendance/repository/attendance/AttendanceRepositoryImpl.java similarity index 98% rename from src/main/java/org/sopt/makers/operation/repository/attendance/AttendanceRepositoryImpl.java rename to operation-domain/src/main/java/org/operation/attendance/repository/attendance/AttendanceRepositoryImpl.java index f4157ff2..3069ed02 100644 --- a/src/main/java/org/sopt/makers/operation/repository/attendance/AttendanceRepositoryImpl.java +++ b/operation-domain/src/main/java/org/operation/attendance/repository/attendance/AttendanceRepositoryImpl.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.repository.attendance; +package org.operation.attendance.repository.attendance; import static com.querydsl.core.types.dsl.Expressions.*; import static java.util.Objects.*; @@ -13,13 +13,11 @@ import java.time.LocalTime; import java.util.List; -import lombok.val; - -import org.sopt.makers.operation.config.ValueConfig; import org.operation.attendance.Attendance; +import org.operation.lecture.LectureStatus; import org.operation.member.Member; +import org.sopt.makers.operation.config.ValueConfig; import org.sopt.makers.operation.entity.Part; -import org.operation.lecture.LectureStatus; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Repository; @@ -27,6 +25,7 @@ import com.querydsl.jpa.impl.JPAQueryFactory; import lombok.RequiredArgsConstructor; +import lombok.val; @Repository @RequiredArgsConstructor diff --git a/src/main/java/org/sopt/makers/operation/repository/attendance/SubAttendanceRepository.java b/operation-domain/src/main/java/org/operation/attendance/repository/subAttendance/SubAttendanceRepository.java similarity index 82% rename from src/main/java/org/sopt/makers/operation/repository/attendance/SubAttendanceRepository.java rename to operation-domain/src/main/java/org/operation/attendance/repository/subAttendance/SubAttendanceRepository.java index c306aa99..7c26039c 100644 --- a/src/main/java/org/sopt/makers/operation/repository/attendance/SubAttendanceRepository.java +++ b/operation-domain/src/main/java/org/operation/attendance/repository/subAttendance/SubAttendanceRepository.java @@ -1,8 +1,8 @@ -package org.sopt.makers.operation.repository.attendance; +package org.operation.attendance.repository.subAttendance; import java.util.List; -import org.operation.attendance.SubAttendance; +import org.operation.attendance.domain.SubAttendance; import org.operation.lecture.SubLecture; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Modifying; diff --git a/src/main/java/org/sopt/makers/operation/converter/StringListConverter.java b/operation-domain/src/main/java/org/operation/converter/StringListConverter.java similarity index 96% rename from src/main/java/org/sopt/makers/operation/converter/StringListConverter.java rename to operation-domain/src/main/java/org/operation/converter/StringListConverter.java index fe244329..43f66b7b 100644 --- a/src/main/java/org/sopt/makers/operation/converter/StringListConverter.java +++ b/operation-domain/src/main/java/org/operation/converter/StringListConverter.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.converter; +package org.operation.converter; import static com.fasterxml.jackson.databind.DeserializationFeature.*; diff --git a/operation-domain/src/main/java/org/operation/lecture/Lecture.java b/operation-domain/src/main/java/org/operation/lecture/Lecture.java index 48850e3a..3660fa94 100644 --- a/operation-domain/src/main/java/org/operation/lecture/Lecture.java +++ b/operation-domain/src/main/java/org/operation/lecture/Lecture.java @@ -15,7 +15,7 @@ import javax.persistence.Id; import javax.persistence.OneToMany; -import org.operation.attendance.Attendance; +import org.operation.attendance.domain.Attendance; import org.operation.common.domain.BaseEntity; import org.operation.common.domain.Part; diff --git a/operation-domain/src/main/java/org/operation/lecture/SubLecture.java b/operation-domain/src/main/java/org/operation/lecture/SubLecture.java index 794de75c..8db85dc8 100644 --- a/operation-domain/src/main/java/org/operation/lecture/SubLecture.java +++ b/operation-domain/src/main/java/org/operation/lecture/SubLecture.java @@ -1,5 +1,6 @@ package org.operation.lecture; +import static java.util.Objects.*; import static javax.persistence.GenerationType.*; import static org.operation.lecture.LectureStatus.*; @@ -17,7 +18,7 @@ import javax.persistence.ManyToOne; import javax.persistence.OneToMany; -import org.operation.attendance.SubAttendance; +import org.operation.attendance.domain.SubAttendance; import lombok.Getter; import lombok.NoArgsConstructor; @@ -69,4 +70,16 @@ private void setLecture(Lecture lecture) { this.lecture = lecture; lecture.getSubLectures().add(this); } + + public boolean isNotStarted() { + return isNull(this.startAt) || isNull(this.code) || this.startAt.isAfter(LocalDateTime.now()); + } + + public boolean isEnded(int attendanceMinute) { + return this.startAt.plusMinutes(attendanceMinute).isBefore(LocalDateTime.now()); + } + + public boolean isMatchCode(String code) { + return this.code.equals(code); + } } diff --git a/operation-domain/src/main/java/org/operation/lecture/message/ErrorMessage.java b/operation-domain/src/main/java/org/operation/lecture/message/ErrorMessage.java new file mode 100644 index 00000000..339de202 --- /dev/null +++ b/operation-domain/src/main/java/org/operation/lecture/message/ErrorMessage.java @@ -0,0 +1,24 @@ +package org.operation.lecture.message; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@AllArgsConstructor +@Getter +public enum ErrorMessage { + INVALID_SUB_LECTURE("존재하지 않는 세션입니다."), + INVALID_CODE("코드가 일치하지 않아요!"), + NOT_STARTED_NTH_ATTENDANCE("차 출석 시작 전입니다."), + ENDED_ATTENDANCE("차 출석이 이미 종료되었습니다."), + INVALID_LECTURE("존재하지 않는 세션입니다."), + NOT_END_TIME_YET("세션 종료 시간이 지나지 않았습니다."), + NO_SUB_LECTURE_EQUAL_ROUND("해당 라운드와 일치하는 출석 세션이 없습니다."), + END_LECTURE("이미 종료된 세션입니다."), + NOT_STARTED_PRE_ATTENDANCE("이전의 출석체크가 시작되지 않았습니다."), + INVALID_COUNT_SESSION("세션의 개수가 올바르지 않습니다."), + NO_SESSION("오늘 세션이 없습니다."), + NOT_STARTED_ATTENDANCE("출석 시작 전입니다."), + ; + + private final String content; +} diff --git a/src/main/java/org/sopt/makers/operation/repository/lecture/LectureCustomRepository.java b/operation-domain/src/main/java/org/operation/lecture/repository/lecture/LectureCustomRepository.java similarity index 73% rename from src/main/java/org/sopt/makers/operation/repository/lecture/LectureCustomRepository.java rename to operation-domain/src/main/java/org/operation/lecture/repository/lecture/LectureCustomRepository.java index e1fe62bf..89bffb58 100644 --- a/src/main/java/org/sopt/makers/operation/repository/lecture/LectureCustomRepository.java +++ b/operation-domain/src/main/java/org/operation/lecture/repository/lecture/LectureCustomRepository.java @@ -1,10 +1,11 @@ -package org.sopt.makers.operation.repository.lecture; +package org.operation.lecture.repository.lecture; -import org.sopt.makers.operation.entity.Part; -import org.operation.lecture.Lecture; import java.util.List; import java.util.Optional; +import org.operation.common.domain.Part; +import org.operation.lecture.Lecture; + public interface LectureCustomRepository { List find(int generation, Part part); List findLecturesToBeEnd(); diff --git a/src/main/java/org/sopt/makers/operation/repository/lecture/LectureRepository.java b/operation-domain/src/main/java/org/operation/lecture/repository/lecture/LectureRepository.java similarity index 79% rename from src/main/java/org/sopt/makers/operation/repository/lecture/LectureRepository.java rename to operation-domain/src/main/java/org/operation/lecture/repository/lecture/LectureRepository.java index e1ab6e91..860939d4 100644 --- a/src/main/java/org/sopt/makers/operation/repository/lecture/LectureRepository.java +++ b/operation-domain/src/main/java/org/operation/lecture/repository/lecture/LectureRepository.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.repository.lecture; +package org.operation.lecture.repository.lecture; import org.operation.lecture.Lecture; import org.springframework.data.jpa.repository.JpaRepository; diff --git a/src/main/java/org/sopt/makers/operation/repository/lecture/LectureRepositoryImpl.java b/operation-domain/src/main/java/org/operation/lecture/repository/lecture/LectureRepositoryImpl.java similarity index 97% rename from src/main/java/org/sopt/makers/operation/repository/lecture/LectureRepositoryImpl.java rename to operation-domain/src/main/java/org/operation/lecture/repository/lecture/LectureRepositoryImpl.java index 371f77c5..51a1ded6 100644 --- a/src/main/java/org/sopt/makers/operation/repository/lecture/LectureRepositoryImpl.java +++ b/operation-domain/src/main/java/org/operation/lecture/repository/lecture/LectureRepositoryImpl.java @@ -1,15 +1,4 @@ -package org.sopt.makers.operation.repository.lecture; - -import com.querydsl.core.types.dsl.BooleanExpression; -import com.querydsl.jpa.impl.JPAQueryFactory; -import lombok.RequiredArgsConstructor; -import org.sopt.makers.operation.entity.Part; -import org.operation.lecture.Lecture; -import org.springframework.stereotype.Repository; - -import java.time.LocalDateTime; -import java.util.List; -import java.util.Optional; +package org.operation.lecture.repository.lecture; import static java.util.Objects.*; import static org.operation.attendance.QAttendance.*; @@ -17,6 +6,19 @@ import static org.operation.lecture.QLecture.*; import static org.operation.member.QMember.*; +import java.time.LocalDateTime; +import java.util.List; +import java.util.Optional; + +import org.operation.lecture.Lecture; +import org.sopt.makers.operation.entity.Part; +import org.springframework.stereotype.Repository; + +import com.querydsl.core.types.dsl.BooleanExpression; +import com.querydsl.jpa.impl.JPAQueryFactory; + +import lombok.RequiredArgsConstructor; + @Repository @RequiredArgsConstructor public class LectureRepositoryImpl implements LectureCustomRepository { diff --git a/src/main/java/org/sopt/makers/operation/repository/lecture/SubLectureRepository.java b/operation-domain/src/main/java/org/operation/lecture/repository/subLecture/SubLectureRepository.java similarity index 91% rename from src/main/java/org/sopt/makers/operation/repository/lecture/SubLectureRepository.java rename to operation-domain/src/main/java/org/operation/lecture/repository/subLecture/SubLectureRepository.java index 0907b027..23bc1415 100644 --- a/src/main/java/org/sopt/makers/operation/repository/lecture/SubLectureRepository.java +++ b/operation-domain/src/main/java/org/operation/lecture/repository/subLecture/SubLectureRepository.java @@ -1,13 +1,13 @@ -package org.sopt.makers.operation.repository.lecture; +package org.operation.lecture.repository.subLecture; + +import java.util.Optional; -import org.operation.lecture.SubLecture; import org.operation.lecture.Lecture; +import org.operation.lecture.SubLecture; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; -import java.util.Optional; - public interface SubLectureRepository extends JpaRepository { Optional findById(Long subLectureId); diff --git a/operation-domain/src/main/java/org/operation/member/ObYb.java b/operation-domain/src/main/java/org/operation/member/ObYb.java deleted file mode 100644 index 5d0178fa..00000000 --- a/operation-domain/src/main/java/org/operation/member/ObYb.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.operation.member; - -public enum ObYb { - OB, YB -} diff --git a/operation-domain/src/main/java/org/operation/member/Member.java b/operation-domain/src/main/java/org/operation/member/domain/Member.java similarity index 72% rename from operation-domain/src/main/java/org/operation/member/Member.java rename to operation-domain/src/main/java/org/operation/member/domain/Member.java index 4d8c5e58..a1094153 100644 --- a/operation-domain/src/main/java/org/operation/member/Member.java +++ b/operation-domain/src/main/java/org/operation/member/domain/Member.java @@ -1,4 +1,4 @@ -package org.operation.member; +package org.operation.member.domain; import static org.operation.lecture.LectureStatus.*; @@ -14,9 +14,8 @@ import javax.persistence.Id; import javax.persistence.OneToMany; -import org.sopt.makers.operation.dto.member.request.MemberRequestDTO; import org.operation.common.domain.Part; -import org.operation.attendance.Attendance; +import org.operation.attendance.domain.Attendance; import lombok.Getter; import lombok.NoArgsConstructor; @@ -48,17 +47,6 @@ public class Member { @OneToMany(mappedBy = "member") List attendances = new ArrayList<>(); - public Member(MemberRequestDTO requestDTO) { - this.playgroundId = requestDTO.playgroundId(); - this.name = requestDTO.name(); - this.generation = requestDTO.generation(); - this.obyb = requestDTO.obyb(); - this.part = requestDTO.part(); - this.university = requestDTO.university(); - this.phone = requestDTO.phone(); - this.score = 2; - } - public void updateScore(float score) { this.score += score; } diff --git a/operation-domain/src/main/java/org/operation/member/domain/ObYb.java b/operation-domain/src/main/java/org/operation/member/domain/ObYb.java new file mode 100644 index 00000000..5ec8b407 --- /dev/null +++ b/operation-domain/src/main/java/org/operation/member/domain/ObYb.java @@ -0,0 +1,5 @@ +package org.operation.member.domain; + +public enum ObYb { + OB, YB +} diff --git a/operation-domain/src/main/java/org/operation/member/message/ErrorMessage.java b/operation-domain/src/main/java/org/operation/member/message/ErrorMessage.java new file mode 100644 index 00000000..ea74617e --- /dev/null +++ b/operation-domain/src/main/java/org/operation/member/message/ErrorMessage.java @@ -0,0 +1,13 @@ +package org.operation.member.message; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@AllArgsConstructor +@Getter +public enum ErrorMessage { + INVALID_MEMBER("존재하지 않는 회원입니다.") + ; + + private final String content; +} diff --git a/src/main/java/org/sopt/makers/operation/repository/member/MemberCustomRepository.java b/operation-domain/src/main/java/org/operation/member/repository/MemberCustomRepository.java similarity index 66% rename from src/main/java/org/sopt/makers/operation/repository/member/MemberCustomRepository.java rename to operation-domain/src/main/java/org/operation/member/repository/MemberCustomRepository.java index 2dbc950a..f0bdfb58 100644 --- a/src/main/java/org/sopt/makers/operation/repository/member/MemberCustomRepository.java +++ b/operation-domain/src/main/java/org/operation/member/repository/MemberCustomRepository.java @@ -1,11 +1,11 @@ -package org.sopt.makers.operation.repository.member; +package org.operation.member.repository; import java.util.List; import java.util.Optional; -import org.sopt.makers.operation.dto.member.response.MemberSearchCondition; -import org.operation.member.Member; -import org.sopt.makers.operation.entity.Part; +import org.operation.common.domain.Part; +import org.operation.common.dto.MemberSearchCondition; +import org.operation.member.domain.Member; import org.springframework.data.domain.Pageable; public interface MemberCustomRepository { diff --git a/src/main/java/org/sopt/makers/operation/repository/member/MemberRepository.java b/operation-domain/src/main/java/org/operation/member/repository/MemberRepository.java similarity index 78% rename from src/main/java/org/sopt/makers/operation/repository/member/MemberRepository.java rename to operation-domain/src/main/java/org/operation/member/repository/MemberRepository.java index 1cf0fa1d..94d64825 100644 --- a/src/main/java/org/sopt/makers/operation/repository/member/MemberRepository.java +++ b/operation-domain/src/main/java/org/operation/member/repository/MemberRepository.java @@ -1,10 +1,10 @@ -package org.sopt.makers.operation.repository.member; - -import org.operation.member.Member; -import org.springframework.data.jpa.repository.JpaRepository; +package org.operation.member.repository; import java.util.Optional; +import org.operation.member.domain.Member; +import org.springframework.data.jpa.repository.JpaRepository; + public interface MemberRepository extends JpaRepository, MemberCustomRepository { Optional getMemberByPlaygroundIdAndGeneration(Long id, int generation); boolean existsByPlaygroundId(Long id); diff --git a/src/main/java/org/sopt/makers/operation/repository/member/MemberRepositoryImpl.java b/operation-domain/src/main/java/org/operation/member/repository/MemberRepositoryImpl.java similarity index 96% rename from src/main/java/org/sopt/makers/operation/repository/member/MemberRepositoryImpl.java rename to operation-domain/src/main/java/org/operation/member/repository/MemberRepositoryImpl.java index 10b2a5e1..40b6122e 100644 --- a/src/main/java/org/sopt/makers/operation/repository/member/MemberRepositoryImpl.java +++ b/operation-domain/src/main/java/org/operation/member/repository/MemberRepositoryImpl.java @@ -1,23 +1,23 @@ -package org.sopt.makers.operation.repository.member; +package org.operation.member.repository; import static java.util.Objects.*; -import static org.sopt.makers.operation.entity.Part.*; import static org.operation.attendance.QAttendance.*; import static org.operation.lecture.QLecture.*; import static org.operation.member.QMember.*; +import static org.sopt.makers.operation.entity.Part.*; import java.util.List; import java.util.Optional; -import com.querydsl.core.types.dsl.Expressions; -import com.querydsl.core.types.dsl.StringExpression; +import org.operation.member.domain.Member; import org.sopt.makers.operation.dto.member.response.MemberSearchCondition; -import org.operation.member.Member; import org.sopt.makers.operation.entity.Part; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Repository; import com.querydsl.core.types.dsl.BooleanExpression; +import com.querydsl.core.types.dsl.Expressions; +import com.querydsl.core.types.dsl.StringExpression; import com.querydsl.jpa.impl.JPAQueryFactory; import lombok.RequiredArgsConstructor; diff --git a/operation-domain/src/main/java/org/operation/schedule/Schedule.java b/operation-domain/src/main/java/org/operation/schedule/domain/Schedule.java similarity index 94% rename from operation-domain/src/main/java/org/operation/schedule/Schedule.java rename to operation-domain/src/main/java/org/operation/schedule/domain/Schedule.java index 8568fc46..1c0670bf 100644 --- a/operation-domain/src/main/java/org/operation/schedule/Schedule.java +++ b/operation-domain/src/main/java/org/operation/schedule/domain/Schedule.java @@ -1,4 +1,4 @@ -package org.operation.schedule; +package org.operation.schedule.domain; import lombok.Getter; import lombok.NoArgsConstructor; diff --git a/src/main/java/org/sopt/makers/operation/repository/schedule/ScheduleCustomRepository.java b/operation-domain/src/main/java/org/operation/schedule/repository/ScheduleCustomRepository.java similarity index 66% rename from src/main/java/org/sopt/makers/operation/repository/schedule/ScheduleCustomRepository.java rename to operation-domain/src/main/java/org/operation/schedule/repository/ScheduleCustomRepository.java index 0a6fde17..741b89c5 100644 --- a/src/main/java/org/sopt/makers/operation/repository/schedule/ScheduleCustomRepository.java +++ b/operation-domain/src/main/java/org/operation/schedule/repository/ScheduleCustomRepository.java @@ -1,10 +1,10 @@ -package org.sopt.makers.operation.repository.schedule; - -import org.operation.schedule.Schedule; +package org.operation.schedule.repository; import java.time.LocalDateTime; import java.util.List; +import org.operation.schedule.domain.Schedule; + public interface ScheduleCustomRepository { List findBetweenStartAndEnd(LocalDateTime start, LocalDateTime end); } diff --git a/src/main/java/org/sopt/makers/operation/repository/schedule/ScheduleRepository.java b/operation-domain/src/main/java/org/operation/schedule/repository/ScheduleRepository.java similarity index 78% rename from src/main/java/org/sopt/makers/operation/repository/schedule/ScheduleRepository.java rename to operation-domain/src/main/java/org/operation/schedule/repository/ScheduleRepository.java index d943a11e..9b1aafbb 100644 --- a/src/main/java/org/sopt/makers/operation/repository/schedule/ScheduleRepository.java +++ b/operation-domain/src/main/java/org/operation/schedule/repository/ScheduleRepository.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.repository.schedule; +package org.operation.schedule.repository; import org.operation.member.Member; import org.springframework.data.jpa.repository.JpaRepository; diff --git a/src/main/java/org/sopt/makers/operation/repository/schedule/ScheduleRepositoryImpl.java b/operation-domain/src/main/java/org/operation/schedule/repository/ScheduleRepositoryImpl.java similarity index 76% rename from src/main/java/org/sopt/makers/operation/repository/schedule/ScheduleRepositoryImpl.java rename to operation-domain/src/main/java/org/operation/schedule/repository/ScheduleRepositoryImpl.java index e230dc36..2e275c01 100644 --- a/src/main/java/org/sopt/makers/operation/repository/schedule/ScheduleRepositoryImpl.java +++ b/operation-domain/src/main/java/org/operation/schedule/repository/ScheduleRepositoryImpl.java @@ -1,17 +1,16 @@ -package org.sopt.makers.operation.repository.schedule; +package org.operation.schedule.repository; -import com.querydsl.core.types.dsl.BooleanExpression; -import com.querydsl.jpa.impl.JPAQueryFactory; +import static org.operation.schedule.QSchedule.*; -import lombok.RequiredArgsConstructor; +import java.time.LocalDateTime; +import java.util.List; -import org.operation.schedule.Schedule; +import org.operation.schedule.domain.Schedule; import org.springframework.stereotype.Repository; -import java.time.LocalDateTime; -import java.util.List; +import com.querydsl.jpa.impl.JPAQueryFactory; -import static org.operation.schedule.QSchedule.schedule; +import lombok.RequiredArgsConstructor; @Repository @RequiredArgsConstructor diff --git a/operation-external/build.gradle b/operation-external/build.gradle index 1ebaba4d..34afb625 100644 --- a/operation-external/build.gradle +++ b/operation-external/build.gradle @@ -10,8 +10,10 @@ repositories { } dependencies { - testImplementation platform('org.junit:junit-bom:5.9.1') - testImplementation 'org.junit.jupiter:junit-jupiter' + implementation project(path: ':operation-service') + implementation project(path: ':operation-domain') + + implementation 'org.springframework.boot:spring-boot-starter-web' } test { diff --git a/operation-external/src/main/java/org/operation/client/alarm/AlarmSender.java b/operation-external/src/main/java/org/operation/client/alarm/AlarmSender.java new file mode 100644 index 00000000..456a7ba5 --- /dev/null +++ b/operation-external/src/main/java/org/operation/client/alarm/AlarmSender.java @@ -0,0 +1,7 @@ +package org.operation.client.alarm; + +import org.operation.web.alarm.dto.request.AlarmSenderRequest; + +public interface AlarmSender { + void send(AlarmSenderRequest request); +} diff --git a/operation-external/src/main/java/org/operation/client/alarm/AlarmSenderImpl.java b/operation-external/src/main/java/org/operation/client/alarm/AlarmSenderImpl.java new file mode 100644 index 00000000..fcb013b2 --- /dev/null +++ b/operation-external/src/main/java/org/operation/client/alarm/AlarmSenderImpl.java @@ -0,0 +1,92 @@ +package org.operation.client.alarm; + +import static java.util.Objects.*; +import static java.util.UUID.*; +import static org.operation.alarm.message.ErrorMessage.*; +import static org.springframework.http.MediaType.*; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + +import org.operation.common.config.ValueConfig; +import org.operation.common.exception.AlarmException; +import org.operation.web.alarm.dto.request.AlarmSenderRequest; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.stereotype.Component; +import org.springframework.web.client.HttpClientErrorException; +import org.springframework.web.client.RestTemplate; + +import lombok.RequiredArgsConstructor; +import lombok.val; + +@Component +@RequiredArgsConstructor +public class AlarmSenderImpl implements AlarmSender { + + private final RestTemplate restTemplate; + private final ValueConfig valueConfig; + + @Override + public void send(AlarmSenderRequest request) { + try { + val host = valueConfig.getNOTIFICATION_URL(); + val entity = getEntity(request); + restTemplate.postForEntity(host, entity, AlarmSenderRequest.class); + } catch (HttpClientErrorException e) { + throw new AlarmException(FAIL_SEND_ALARM.getContent()); + } + } + + private HttpEntity> getEntity(AlarmSenderRequest request) { + val alarmRequest = getAlarmRequest(request); + val headers = getHeaders(); + return new HttpEntity<>(alarmRequest, headers); + } + + private Map getAlarmRequest(AlarmSenderRequest request) { + val alarmRequest = new HashMap<>(); + val link = request.link(); + val linkKey = getLinkKey(link); + + if (!linkKey.isEmpty()) { + alarmRequest.put(linkKey, link); + } + + alarmRequest.put("userIds", request.targetList()); + alarmRequest.put("title", request.title()); + alarmRequest.put("content", request.content()); + alarmRequest.put("category", request.attribute()); + + return alarmRequest; + } + + private String getLinkKey(String link) { + val appLinkList = valueConfig.getAPP_LINK_LIST(); + val webLinkList = valueConfig.getWEB_LINK_LIST(); + + if (nonNull(link)) { + if (appLinkList.contains(link)) { + return "appLink"; + } else if (webLinkList.contains(link)) { + return "webLink"; + } + } + return ""; + } + + private HttpHeaders getHeaders() { + val headers = new HttpHeaders(); + val key = valueConfig.getNOTIFICATION_KEY(); + + headers.setContentType(APPLICATION_JSON); + headers.setAccept(Collections.singletonList(APPLICATION_JSON)); + headers.add("action", "send"); + headers.add("transactionId", randomUUID().toString()); + headers.add("service", "operation"); + headers.add("x-api-key", key); + + return headers; + } +} diff --git a/operation-external/src/main/java/org/operation/client/playground/PlayGroundServer.java b/operation-external/src/main/java/org/operation/client/playground/PlayGroundServer.java new file mode 100644 index 00000000..fe7e4f34 --- /dev/null +++ b/operation-external/src/main/java/org/operation/client/playground/PlayGroundServer.java @@ -0,0 +1,8 @@ +package org.operation.client.playground; + +import org.operation.common.domain.Part; +import org.operation.web.alarm.dto.response.AlarmInactiveListResponse; + +public interface PlayGroundServer { + AlarmInactiveListResponse getInactiveMembers(int generation, Part part); +} diff --git a/src/main/java/org/sopt/makers/operation/external/playground/PlayGroundServerImpl.java b/operation-external/src/main/java/org/operation/client/playground/PlayGroundServerImpl.java similarity index 72% rename from src/main/java/org/sopt/makers/operation/external/playground/PlayGroundServerImpl.java rename to operation-external/src/main/java/org/operation/client/playground/PlayGroundServerImpl.java index 8ec7c1e5..fd8fffb1 100644 --- a/src/main/java/org/sopt/makers/operation/external/playground/PlayGroundServerImpl.java +++ b/operation-external/src/main/java/org/operation/client/playground/PlayGroundServerImpl.java @@ -1,12 +1,12 @@ -package org.sopt.makers.operation.external.playground; +package org.operation.client.playground; -import static org.sopt.makers.operation.common.ExceptionMessage.*; -import static org.sopt.makers.operation.entity.Part.*; +import static org.operation.alarm.message.ErrorMessage.*; +import static org.operation.common.domain.Part.*; import static org.springframework.http.HttpMethod.*; -import org.sopt.makers.operation.dto.alarm.response.AlarmInactiveListResponseDTO; -import org.sopt.makers.operation.entity.Part; -import org.sopt.makers.operation.exception.AlarmException; +import org.operation.common.domain.Part; +import org.operation.common.exception.AlarmException; +import org.operation.web.alarm.dto.response.AlarmInactiveListResponse; import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; @@ -27,16 +27,16 @@ public class PlayGroundServerImpl implements PlayGroundServer { private String playGroundToken; @Override - public AlarmInactiveListResponseDTO getInactiveMembers(int generation, Part part) { + public AlarmInactiveListResponse getInactiveMembers(int generation, Part part) { val uri = getInactiveUserURI(part, generation); val headers = getHeaders(); val entity = new HttpEntity<>(null, headers); try { - val response = restTemplate.exchange(uri, GET, entity, AlarmInactiveListResponseDTO.class); + val response = restTemplate.exchange(uri, GET, entity, AlarmInactiveListResponse.class); return response.getBody(); } catch (Exception e) { - throw new AlarmException(FAIL_INACTIVE_USERS.getName()); + throw new AlarmException(FAIL_INACTIVE_USERS.getContent()); } } diff --git a/src/main/java/org/sopt/makers/operation/config/RestTemplateConfig.java b/operation-external/src/main/java/org/operation/config/RestTemplateConfig.java similarity index 87% rename from src/main/java/org/sopt/makers/operation/config/RestTemplateConfig.java rename to operation-external/src/main/java/org/operation/config/RestTemplateConfig.java index 8a73e425..dbd27cb1 100644 --- a/src/main/java/org/sopt/makers/operation/config/RestTemplateConfig.java +++ b/operation-external/src/main/java/org/operation/config/RestTemplateConfig.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.config; +package org.operation.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/operation-business/build.gradle b/operation-service/build.gradle similarity index 88% rename from operation-business/build.gradle rename to operation-service/build.gradle index 6b3ca8cb..02c3e606 100644 --- a/operation-business/build.gradle +++ b/operation-service/build.gradle @@ -12,6 +12,7 @@ repositories { dependencies { implementation project(path: ':operation-api') implementation project(path: ':operation-domain') + implementation project(path: ':operation-external') implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.springframework.boot:spring-boot-starter-data-jpa' diff --git a/operation-business/src/main/java/org/operation/app/attendance/dto/request/AttendanceRequest.java b/operation-service/src/main/java/org/operation/app/attendance/dto/request/AttendanceRequest.java similarity index 100% rename from operation-business/src/main/java/org/operation/app/attendance/dto/request/AttendanceRequest.java rename to operation-service/src/main/java/org/operation/app/attendance/dto/request/AttendanceRequest.java diff --git a/operation-service/src/main/java/org/operation/app/attendance/dto/response/AttendanceResponse.java b/operation-service/src/main/java/org/operation/app/attendance/dto/response/AttendanceResponse.java new file mode 100644 index 00000000..5b2711ff --- /dev/null +++ b/operation-service/src/main/java/org/operation/app/attendance/dto/response/AttendanceResponse.java @@ -0,0 +1,12 @@ +package org.operation.app.attendance.dto.response; + +import org.operation.attendance.domain.SubAttendance; + +public record AttendanceResponse( + Long subLectureId +) { + + public static AttendanceResponse of(SubAttendance subAttendance) { + return new AttendanceResponse(subAttendance.getSubLecture().getId()); + } +} diff --git a/operation-service/src/main/java/org/operation/app/attendance/dto/response/AttendancesResponse.java b/operation-service/src/main/java/org/operation/app/attendance/dto/response/AttendancesResponse.java new file mode 100644 index 00000000..9b2640bb --- /dev/null +++ b/operation-service/src/main/java/org/operation/app/attendance/dto/response/AttendancesResponse.java @@ -0,0 +1,18 @@ +package org.operation.app.attendance.dto.response; + +import java.util.List; + +import org.operation.attendance.domain.Attendance; +import org.operation.web.attendance.dto.response.MemberResponse; +import org.operation.web.member.dto.response.MemberListGetResponse; + +public record AttendancesResponse( + List attendances, + int totalCount +) { + public static AttendancesResponse of(List attendances, int totalCount) { + return new AttendancesResponse( + attendances.stream().map(MemberResponse::of).toList(), + totalCount); + } +} diff --git a/operation-service/src/main/java/org/operation/app/attendance/service/AttendanceServiceImpl.java b/operation-service/src/main/java/org/operation/app/attendance/service/AttendanceServiceImpl.java new file mode 100644 index 00000000..abb47ccf --- /dev/null +++ b/operation-service/src/main/java/org/operation/app/attendance/service/AttendanceServiceImpl.java @@ -0,0 +1,115 @@ +package org.operation.app.attendance.service; + +import static org.operation.attendance.domain.AttendanceStatus.*; +import static org.operation.attendance.message.ErrorMessage.*; +import static org.operation.lecture.message.ErrorMessage.*; +import static org.operation.member.message.ErrorMessage.*; + +import org.operation.app.attendance.dto.request.AttendanceRequest; +import org.operation.app.attendance.dto.response.AttendanceResponse; +import org.operation.attendance.domain.Attendance; +import org.operation.attendance.domain.SubAttendance; +import org.operation.attendance.repository.attendance.AttendanceRepository; +import org.operation.common.config.ValueConfig; +import org.operation.common.exception.LectureException; +import org.operation.common.exception.MemberException; +import org.operation.common.exception.SubLectureException; +import org.operation.lecture.Lecture; +import org.operation.lecture.SubLecture; +import org.operation.lecture.repository.subLecture.SubLectureRepository; +import org.operation.member.domain.Member; +import org.operation.member.repository.MemberRepository; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import lombok.val; + +@Slf4j +@Service +@RequiredArgsConstructor +@Transactional(readOnly = true) +public class AttendanceServiceImpl implements AttendanceService { + + private final AttendanceRepository attendanceRepository; + private final MemberRepository memberRepository; + private final SubLectureRepository subLectureRepository; + private final ValueConfig valueConfig; + + @Override + @Transactional + public AttendanceResponse attend(long playgroundId, AttendanceRequest request) { + val subAttendance = getSubAttendance(request.subLectureId(), request.code(), playgroundId); + subAttendance.updateStatus(ATTENDANCE); + return AttendanceResponse.of(subAttendance); + } + + private SubAttendance getSubAttendance(long subLectureId, String code, long playgroundId) { + val subLecture = getSubLecture(subLectureId, code); + val attendance = getAttendance(subLecture, playgroundId); + return getSubAttendance(attendance, subLecture.getRound()); + } + + private SubLecture getSubLecture(long subLectureId, String code) { + val subLecture = findSubLecture(subLectureId); + checkSubLectureValidity(subLecture); + checkMatchedCode(subLecture, code); + return subLecture; + } + + private SubLecture findSubLecture(long subLectureId) { + return subLectureRepository + .findById(subLectureId) + .orElseThrow(() -> new SubLectureException(INVALID_SUB_LECTURE.getContent())); + } + + private void checkSubLectureValidity(SubLecture subLecture) { + checkSubLectureStarted(subLecture); + checkSubLectureEnded(subLecture); + } + + private void checkSubLectureStarted(SubLecture subLecture) { + if (subLecture.isNotStarted()) { + throw new LectureException(NOT_STARTED_NTH_ATTENDANCE.getContent()); + } + } + + private void checkSubLectureEnded(SubLecture subLecture) { + val attendanceMinute = valueConfig.getATTENDANCE_MINUTE(); + if (subLecture.isEnded(attendanceMinute)) { + throw new LectureException(subLecture.getRound() + ENDED_ATTENDANCE.getContent()); + } + } + + private void checkMatchedCode(SubLecture subLecture, String code) { + if (subLecture.isMatchCode(code)) { + throw new SubLectureException(INVALID_CODE.getContent()); + } + } + + private Attendance getAttendance(SubLecture subLecture, long playgroundId) { + val lecture = subLecture.getLecture(); + val generation = valueConfig.getGENERATION(); + val member = findMember(playgroundId, generation); + return findAttendance(lecture, member); + } + + private Member findMember(long playgroundId, int generation) { + return memberRepository + .getMemberByPlaygroundIdAndGeneration(playgroundId, generation) + .orElseThrow(() -> new MemberException(INVALID_MEMBER.getContent())); + } + + private Attendance findAttendance(Lecture lecture, Member member) { + return attendanceRepository.findByLectureAndMember(lecture, member) + .orElseThrow(() -> new LectureException(INVALID_ATTENDANCE.getContent())); + } + + private SubAttendance getSubAttendance(Attendance attendance, int round) { + return attendance.getSubAttendances().stream() + .filter(subAttendance -> subAttendance.isMatchRound(round)) + .findFirst() + .orElseThrow(() -> new SubLectureException(INVALID_SUB_ATTENDANCE.getContent())); + } +} diff --git a/operation-service/src/main/java/org/operation/app/lecture/dto/response/LectureCurrentRoundResponse.java b/operation-service/src/main/java/org/operation/app/lecture/dto/response/LectureCurrentRoundResponse.java new file mode 100644 index 00000000..8d3b8e1a --- /dev/null +++ b/operation-service/src/main/java/org/operation/app/lecture/dto/response/LectureCurrentRoundResponse.java @@ -0,0 +1,15 @@ +package org.operation.app.lecture.dto.response; + +import org.operation.lecture.SubLecture; + +public record LectureCurrentRoundResponse( + Long id, + int round +) { + public static LectureCurrentRoundResponse of(SubLecture subLecture){ + return new LectureCurrentRoundResponse( + subLecture.getId(), + subLecture.getRound() + ); + } +} diff --git a/src/main/java/org/sopt/makers/operation/dto/lecture/response/LectureResponseType.java b/operation-service/src/main/java/org/operation/app/lecture/dto/response/LectureResponseType.java similarity index 59% rename from src/main/java/org/sopt/makers/operation/dto/lecture/response/LectureResponseType.java rename to operation-service/src/main/java/org/operation/app/lecture/dto/response/LectureResponseType.java index cc3de48b..d154fd7a 100644 --- a/src/main/java/org/sopt/makers/operation/dto/lecture/response/LectureResponseType.java +++ b/operation-service/src/main/java/org/operation/app/lecture/dto/response/LectureResponseType.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.dto.lecture.response; +package org.operation.app.lecture.dto.response; public enum LectureResponseType { NO_SESSION, HAS_ATTENDANCE, NO_ATTENDANCE diff --git a/src/main/java/org/sopt/makers/operation/dto/lecture/response/TodayLectureResponseDTO.java b/operation-service/src/main/java/org/operation/app/lecture/dto/response/TodayLectureResponse.java similarity index 81% rename from src/main/java/org/sopt/makers/operation/dto/lecture/response/TodayLectureResponseDTO.java rename to operation-service/src/main/java/org/operation/app/lecture/dto/response/TodayLectureResponse.java index 8e395522..eb0318b7 100644 --- a/src/main/java/org/sopt/makers/operation/dto/lecture/response/TodayLectureResponseDTO.java +++ b/operation-service/src/main/java/org/operation/app/lecture/dto/response/TodayLectureResponse.java @@ -1,18 +1,18 @@ -package org.sopt.makers.operation.dto.lecture.response; - -import lombok.Builder; - -import org.operation.attendance.AttendanceStatus; -import org.operation.attendance.SubAttendance; -import org.operation.lecture.Lecture; +package org.operation.app.lecture.dto.response; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.List; import java.util.stream.Collectors; +import org.operation.attendance.domain.AttendanceStatus; +import org.operation.attendance.domain.SubAttendance; +import org.operation.lecture.Lecture; + +import lombok.Builder; + @Builder -public record TodayLectureResponseDTO( +public record TodayLectureResponse( LectureResponseType type, Long id, String location, @@ -22,9 +22,9 @@ public record TodayLectureResponseDTO( String message, List attendances ) { - public static TodayLectureResponseDTO of(LectureResponseType type, Lecture lecture, String message, List attendances) { + public static TodayLectureResponse of(LectureResponseType type, Lecture lecture, String message, List attendances) { - return TodayLectureResponseDTO.builder() + return TodayLectureResponse.builder() .type(type) .id(lecture.getId()) .location(lecture.getPlace()) diff --git a/src/main/java/org/sopt/makers/operation/service/app/lecture/LectureServiceImpl.java b/operation-service/src/main/java/org/operation/app/lecture/service/LectureServiceImpl.java similarity index 65% rename from src/main/java/org/sopt/makers/operation/service/app/lecture/LectureServiceImpl.java rename to operation-service/src/main/java/org/operation/app/lecture/service/LectureServiceImpl.java index 3a733332..8fcec5a0 100644 --- a/src/main/java/org/sopt/makers/operation/service/app/lecture/LectureServiceImpl.java +++ b/operation-service/src/main/java/org/operation/app/lecture/service/LectureServiceImpl.java @@ -1,10 +1,8 @@ -package org.sopt.makers.operation.service.app.lecture; +package org.operation.app.lecture.service; -import static org.sopt.makers.operation.common.ExceptionMessage.NO_SESSION; -import static org.sopt.makers.operation.common.ExceptionMessage.*; -import static org.sopt.makers.operation.dto.lecture.response.LectureResponseType.*; -import static org.operation.attendance.AttendanceStatus.*; +import static org.operation.attendance.domain.AttendanceStatus.*; import static org.operation.lecture.LectureStatus.*; +import static org.operation.lecture.message.ErrorMessage.*; import java.time.LocalDate; import java.time.LocalDateTime; @@ -12,19 +10,19 @@ import java.util.Collections; import java.util.List; -import org.sopt.makers.operation.config.ValueConfig; -import org.sopt.makers.operation.dto.lecture.response.LectureCurrentRoundResponseDTO; -import org.sopt.makers.operation.dto.lecture.response.LectureResponseType; -import org.sopt.makers.operation.dto.lecture.response.TodayLectureResponseDTO; -import org.operation.attendance.Attendance; -import org.operation.attendance.SubAttendance; +import org.operation.app.lecture.dto.response.LectureCurrentRoundResponse; +import org.operation.app.lecture.dto.response.LectureResponseType; +import org.operation.app.lecture.dto.response.TodayLectureResponse; +import org.operation.attendance.domain.Attendance; +import org.operation.attendance.domain.SubAttendance; +import org.operation.attendance.repository.attendance.AttendanceRepository; +import org.operation.common.config.ValueConfig; +import org.operation.common.exception.LectureException; +import org.operation.common.exception.SubLectureException; +import org.operation.lecture.repository.lecture.LectureRepository; import org.operation.lecture.Attribute; import org.operation.lecture.Lecture; import org.operation.lecture.SubLecture; -import org.sopt.makers.operation.exception.LectureException; -import org.sopt.makers.operation.exception.SubLectureException; -import org.sopt.makers.operation.repository.attendance.AttendanceRepository; -import org.sopt.makers.operation.repository.lecture.LectureRepository; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -41,7 +39,7 @@ public class LectureServiceImpl implements LectureService { private final ValueConfig valueConfig; @Override - public TodayLectureResponseDTO getTodayLecture(long memberPlaygroundId) { + public TodayLectureResponse getTodayLecture(long memberPlaygroundId) { val attendances = attendanceRepository.findToday(memberPlaygroundId); checkAttendancesSize(attendances); @@ -54,8 +52,8 @@ public TodayLectureResponseDTO getTodayLecture(long memberPlaygroundId) { val responseType = getResponseType(lecture); val message = getMessage(lecture.getAttribute()); - if (responseType.equals(NO_ATTENDANCE) || lecture.isBefore()) { - return TodayLectureResponseDTO.of(responseType, lecture, message, Collections.emptyList()); + if (responseType.equals(LectureResponseType.NO_ATTENDANCE) || lecture.isBefore()) { + return TodayLectureResponse.of(responseType, lecture, message, Collections.emptyList()); } val subAttendances = attendance.getSubAttendances(); @@ -63,8 +61,8 @@ public TodayLectureResponseDTO getTodayLecture(long memberPlaygroundId) { return getTodayLectureResponse(subAttendance, responseType, lecture); } - private TodayLectureResponseDTO getEmptyResponse() { - return TodayLectureResponseDTO.builder() + private TodayLectureResponse getEmptyResponse() { + return TodayLectureResponse.builder() .type(LectureResponseType.NO_SESSION) .id(0L) .location("") @@ -78,7 +76,7 @@ private TodayLectureResponseDTO getEmptyResponse() { private void checkAttendancesSize(List attendances) { if (attendances.size() > valueConfig.getSUB_LECTURE_MAX_ROUND()) { - throw new LectureException(INVALID_COUNT_SESSION.getName()); + throw new LectureException(INVALID_COUNT_SESSION.getContent()); } } @@ -93,7 +91,7 @@ private int getAttendanceIndex() { private LectureResponseType getResponseType(Lecture lecture) { val attribute = lecture.getAttribute(); - return attribute.equals(Attribute.ETC) ? NO_ATTENDANCE : HAS_ATTENDANCE; + return attribute.equals(Attribute.ETC) ? LectureResponseType.NO_ATTENDANCE : LectureResponseType.HAS_ATTENDANCE; } private String getMessage(Attribute attribute) { @@ -104,30 +102,30 @@ private String getMessage(Attribute attribute) { }; } - private TodayLectureResponseDTO getTodayLectureResponse(SubAttendance subAttendance, LectureResponseType responseType, Lecture lecture) { + private TodayLectureResponse getTodayLectureResponse(SubAttendance subAttendance, LectureResponseType responseType, Lecture lecture) { val subLecture = subAttendance.getSubLecture(); val isOnAttendanceCheck = LocalDateTime.now().isBefore(subLecture.getStartAt().plusMinutes(10)); val message = getMessage(lecture.getAttribute()); if (isOnAttendanceCheck && subAttendance.getStatus().equals(ABSENT)) { - return TodayLectureResponseDTO.of(responseType, lecture, message, Collections.emptyList()); + return TodayLectureResponse.of(responseType, lecture, message, Collections.emptyList()); } - return TodayLectureResponseDTO.of(responseType, lecture, message, Collections.singletonList(subAttendance)); + return TodayLectureResponse.of(responseType, lecture, message, Collections.singletonList(subAttendance)); } @Override - public LectureCurrentRoundResponseDTO getCurrentLectureRound(long lectureId) { + public LectureCurrentRoundResponse getCurrentLectureRound(long lectureId) { val lecture = findLecture(lectureId); val subLecture = getSubLecture(lecture); checkLectureExist(lecture); checkLectureBefore(lecture); checkEndAttendance(subLecture); checkLectureEnd(lecture); - return LectureCurrentRoundResponseDTO.of(subLecture); + return LectureCurrentRoundResponse.of(subLecture); } private Lecture findLecture(Long id) { return lectureRepository.findById(id) - .orElseThrow(() -> new LectureException(INVALID_LECTURE.getName())); + .orElseThrow(() -> new LectureException(INVALID_LECTURE.getContent())); } private SubLecture getSubLecture(Lecture lecture) { @@ -140,7 +138,7 @@ private SubLecture getSubLecture(Lecture lecture, int round) { return lecture.getSubLectures().stream() .filter(l -> l.getRound() == round) .findFirst() - .orElseThrow(() -> new SubLectureException(NO_SUB_LECTURE_EQUAL_ROUND.getName())); + .orElseThrow(() -> new SubLectureException(NO_SUB_LECTURE_EQUAL_ROUND.getContent())); } private void checkLectureExist(Lecture lecture) { @@ -149,19 +147,19 @@ private void checkLectureExist(Lecture lecture) { val endOfDay = LocalDateTime.of(today, LocalTime.MAX); val startAt = lecture.getStartDate(); if (startAt.isBefore(startOfDay) || startAt.isAfter(endOfDay)) { - throw new LectureException(NO_SESSION.getName()); + throw new LectureException(NO_SESSION.getContent()); } } private void checkLectureBefore(Lecture lecture) { if (lecture.isBefore()) { - throw new LectureException(NOT_STARTED_ATTENDANCE.getName()); + throw new LectureException(NOT_STARTED_ATTENDANCE.getContent()); } } private void checkEndAttendance(SubLecture subLecture) { if (isEndAttendance(subLecture)) { - throw new LectureException(subLecture.getRound() + ENDED_ATTENDANCE.getName()); + throw new LectureException(subLecture.getRound() + ENDED_ATTENDANCE.getContent()); } } @@ -175,7 +173,7 @@ private boolean isEndAttendance(SubLecture subLecture) { private void checkLectureEnd(Lecture lecture) { if (lecture.isEnd()) { - throw new LectureException(END_LECTURE.getName()); + throw new LectureException(END_LECTURE.getContent()); } } } diff --git a/src/main/java/org/sopt/makers/operation/dto/attendance/response/AttendanceTotalResponseDTO.java b/operation-service/src/main/java/org/operation/app/member/dto/response/AttendanceTotalResponseDTO.java similarity index 75% rename from src/main/java/org/sopt/makers/operation/dto/attendance/response/AttendanceTotalResponseDTO.java rename to operation-service/src/main/java/org/operation/app/member/dto/response/AttendanceTotalResponseDTO.java index af3ec806..4451c458 100644 --- a/src/main/java/org/sopt/makers/operation/dto/attendance/response/AttendanceTotalResponseDTO.java +++ b/operation-service/src/main/java/org/operation/app/member/dto/response/AttendanceTotalResponseDTO.java @@ -1,10 +1,11 @@ -package org.sopt.makers.operation.dto.attendance.response; - -import org.operation.member.Member; -import org.sopt.makers.operation.entity.Part; +package org.operation.app.member.dto.response; import java.util.List; +import org.operation.common.domain.Part; +import org.operation.member.domain.Member; +import org.operation.web.member.dto.response.AttendanceTotalCountVO; + public record AttendanceTotalResponseDTO( Part part, int generation, diff --git a/src/main/java/org/sopt/makers/operation/dto/attendance/response/AttendanceTotalVO.java b/operation-service/src/main/java/org/operation/app/member/dto/response/AttendanceTotalVO.java similarity index 85% rename from src/main/java/org/sopt/makers/operation/dto/attendance/response/AttendanceTotalVO.java rename to operation-service/src/main/java/org/operation/app/member/dto/response/AttendanceTotalVO.java index 45a2b9c0..6b4cb7a6 100644 --- a/src/main/java/org/sopt/makers/operation/dto/attendance/response/AttendanceTotalVO.java +++ b/operation-service/src/main/java/org/operation/app/member/dto/response/AttendanceTotalVO.java @@ -1,11 +1,11 @@ -package org.sopt.makers.operation.dto.attendance.response; - -import org.operation.attendance.Attendance; -import org.operation.attendance.AttendanceStatus; -import org.operation.lecture.Attribute; +package org.operation.app.member.dto.response; import java.time.format.DateTimeFormatter; +import org.operation.attendance.domain.Attendance; +import org.operation.attendance.domain.AttendanceStatus; +import org.operation.lecture.Attribute; + public record AttendanceTotalVO( Attribute attribute, String name, diff --git a/operation-service/src/main/java/org/operation/app/member/dto/response/MemberScoreGetResponse.java b/operation-service/src/main/java/org/operation/app/member/dto/response/MemberScoreGetResponse.java new file mode 100644 index 00000000..c7199651 --- /dev/null +++ b/operation-service/src/main/java/org/operation/app/member/dto/response/MemberScoreGetResponse.java @@ -0,0 +1,11 @@ +package org.operation.app.member.dto.response; + +public record MemberScoreGetResponse( + float score +) { + public static MemberScoreGetResponse of(float score){ + return new MemberScoreGetResponse( + score + ); + } +} diff --git a/src/main/java/org/sopt/makers/operation/service/app/member/MemberServiceImpl.java b/operation-service/src/main/java/org/operation/app/member/service/MemberServiceImpl.java similarity index 78% rename from src/main/java/org/sopt/makers/operation/service/app/member/MemberServiceImpl.java rename to operation-service/src/main/java/org/operation/app/member/service/MemberServiceImpl.java index 67cce15a..11a2b053 100644 --- a/src/main/java/org/sopt/makers/operation/service/app/member/MemberServiceImpl.java +++ b/operation-service/src/main/java/org/operation/app/member/service/MemberServiceImpl.java @@ -1,21 +1,21 @@ -package org.sopt.makers.operation.service.app.member; +package org.operation.app.member.service; -import static org.sopt.makers.operation.common.ExceptionMessage.*; +import static org.operation.member.message.ErrorMessage.*; import java.util.EnumMap; import java.util.List; -import org.sopt.makers.operation.config.ValueConfig; -import org.sopt.makers.operation.dto.attendance.response.AttendanceTotalCountVO; -import org.sopt.makers.operation.dto.attendance.response.AttendanceTotalResponseDTO; -import org.sopt.makers.operation.dto.attendance.response.AttendanceTotalVO; -import org.sopt.makers.operation.dto.member.response.MemberScoreGetResponse; -import org.operation.attendance.AttendanceStatus; +import org.operation.app.member.dto.response.AttendanceTotalResponseDTO; +import org.operation.app.member.dto.response.AttendanceTotalVO; +import org.operation.app.member.dto.response.MemberScoreGetResponse; +import org.operation.attendance.domain.AttendanceStatus; +import org.operation.attendance.repository.attendance.AttendanceRepository; +import org.operation.common.config.ValueConfig; +import org.operation.common.exception.MemberException; import org.operation.lecture.Attribute; -import org.operation.member.Member; -import org.sopt.makers.operation.exception.MemberException; -import org.sopt.makers.operation.repository.attendance.AttendanceRepository; -import org.sopt.makers.operation.repository.member.MemberRepository; +import org.operation.member.domain.Member; +import org.operation.member.repository.MemberRepository; +import org.operation.web.member.dto.response.AttendanceTotalCountVO; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -33,7 +33,7 @@ public class MemberServiceImpl implements MemberService { @Override public AttendanceTotalResponseDTO getMemberTotalAttendance(Long playGroundId) { val member = memberRepository.getMemberByPlaygroundIdAndGeneration(playGroundId, valueConfig.getGENERATION()) - .orElseThrow(() -> new MemberException(INVALID_MEMBER.getName())); + .orElseThrow(() -> new MemberException(INVALID_MEMBER.getContent())); val attendances = findAttendances(member); val countAttendance = countAttendance(attendances); @@ -47,7 +47,7 @@ public AttendanceTotalResponseDTO getMemberTotalAttendance(Long playGroundId) { @Override public MemberScoreGetResponse getMemberScore(Long playGroundId) { val member = memberRepository.getMemberByPlaygroundIdAndGeneration(playGroundId, valueConfig.getGENERATION()) - .orElseThrow(() -> new MemberException(INVALID_MEMBER.getName())); + .orElseThrow(() -> new MemberException(INVALID_MEMBER.getContent())); return MemberScoreGetResponse.of(member.getScore()); } diff --git a/src/main/java/org/sopt/makers/operation/dto/schedule/response/SchedulesResponseDTO.java b/operation-service/src/main/java/org/operation/app/schedule/dto/response/SchedulesResponseDTO.java similarity index 93% rename from src/main/java/org/sopt/makers/operation/dto/schedule/response/SchedulesResponseDTO.java rename to operation-service/src/main/java/org/operation/app/schedule/dto/response/SchedulesResponseDTO.java index 1d19d54d..204412b5 100644 --- a/src/main/java/org/sopt/makers/operation/dto/schedule/response/SchedulesResponseDTO.java +++ b/operation-service/src/main/java/org/operation/app/schedule/dto/response/SchedulesResponseDTO.java @@ -1,8 +1,4 @@ -package org.sopt.makers.operation.dto.schedule.response; - -import lombok.*; -import org.operation.lecture.Attribute; -import org.operation.schedule.Schedule; +package org.operation.app.schedule.dto.response; import java.time.LocalDate; import java.time.format.TextStyle; @@ -10,6 +6,11 @@ import java.util.Locale; import java.util.Map; +import org.operation.lecture.Attribute; +import org.operation.schedule.domain.Schedule; + +import lombok.Builder; + public record SchedulesResponseDTO( List dates ) { diff --git a/src/main/java/org/sopt/makers/operation/service/app/schedule/ScheduleServiceImpl.java b/operation-service/src/main/java/org/operation/app/schedule/service/ScheduleServiceImpl.java similarity index 91% rename from src/main/java/org/sopt/makers/operation/service/app/schedule/ScheduleServiceImpl.java rename to operation-service/src/main/java/org/operation/app/schedule/service/ScheduleServiceImpl.java index ddc2840c..10d8542c 100644 --- a/src/main/java/org/sopt/makers/operation/service/app/schedule/ScheduleServiceImpl.java +++ b/operation-service/src/main/java/org/operation/app/schedule/service/ScheduleServiceImpl.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.service.app.schedule; +package org.operation.app.schedule.service; import java.time.Duration; import java.time.LocalDate; @@ -10,9 +10,9 @@ import java.util.stream.Collectors; import java.util.stream.LongStream; -import org.sopt.makers.operation.dto.schedule.response.SchedulesResponseDTO; -import org.operation.schedule.Schedule; -import org.sopt.makers.operation.repository.schedule.ScheduleRepository; +import org.operation.app.schedule.dto.response.SchedulesResponseDTO; +import org.operation.schedule.domain.Schedule; +import org.operation.schedule.repository.ScheduleRepository; import org.springframework.stereotype.Service; import lombok.RequiredArgsConstructor; diff --git a/src/main/java/org/sopt/makers/operation/config/ValueConfig.java b/operation-service/src/main/java/org/operation/common/config/ValueConfig.java similarity index 57% rename from src/main/java/org/sopt/makers/operation/config/ValueConfig.java rename to operation-service/src/main/java/org/operation/common/config/ValueConfig.java index 1031b635..0dd4f57f 100644 --- a/src/main/java/org/sopt/makers/operation/config/ValueConfig.java +++ b/operation-service/src/main/java/org/operation/common/config/ValueConfig.java @@ -1,4 +1,7 @@ -package org.sopt.makers.operation.config; +package org.operation.common.config; + +import java.util.Arrays; +import java.util.List; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Configuration; @@ -21,10 +24,30 @@ public class ValueConfig { private String ADMIN_DEV_URL; @Value("${admin.url.local}") private String ADMIN_LOCAL_URL; + @Value("${notification.key}") + private String NOTIFICATION_KEY; + @Value("${notification.url}") + private String NOTIFICATION_URL; private final int SUB_LECTURE_MAX_ROUND = 2; private final String ETC_MESSAGE = "출석 점수가 반영되지 않아요."; private final String SEMINAR_MESSAGE = ""; private final String EVENT_MESSAGE = "행사도 참여하고, 출석점수도 받고, 일석이조!"; private final String SWAGGER_URI = "/swagger-ui/**"; + private final int ATTENDANCE_MINUTE = 10; + + private final List APP_LINK_LIST = Arrays.asList( + "home", + "home/notification", + "home/mypage", + "home/attendance", + "home/attendance/attendance-modal", + "home/soptamp", + "home/soptamp/entire-ranking", + "home/soptamp/current-generation-ranking" + ); + private final List WEB_LINK_LIST = Arrays.asList( + "https://playground.sopt.org/members", + "https://playground.sopt.org/group" + ); } diff --git a/operation-service/src/main/java/org/operation/common/dto/MemberSearchCondition.java b/operation-service/src/main/java/org/operation/common/dto/MemberSearchCondition.java new file mode 100644 index 00000000..85d48129 --- /dev/null +++ b/operation-service/src/main/java/org/operation/common/dto/MemberSearchCondition.java @@ -0,0 +1,9 @@ +package org.operation.common.dto; + +import org.operation.common.domain.Part; + +public record MemberSearchCondition( + Part part, + int generation +) { +} diff --git a/operation-business/src/main/java/org/operation/common/exception/AdminFailureException.java b/operation-service/src/main/java/org/operation/common/exception/AdminFailureException.java similarity index 100% rename from operation-business/src/main/java/org/operation/common/exception/AdminFailureException.java rename to operation-service/src/main/java/org/operation/common/exception/AdminFailureException.java diff --git a/operation-business/src/main/java/org/operation/common/exception/AlarmException.java b/operation-service/src/main/java/org/operation/common/exception/AlarmException.java similarity index 100% rename from operation-business/src/main/java/org/operation/common/exception/AlarmException.java rename to operation-service/src/main/java/org/operation/common/exception/AlarmException.java diff --git a/operation-business/src/main/java/org/operation/common/exception/LectureException.java b/operation-service/src/main/java/org/operation/common/exception/LectureException.java similarity index 100% rename from operation-business/src/main/java/org/operation/common/exception/LectureException.java rename to operation-service/src/main/java/org/operation/common/exception/LectureException.java diff --git a/operation-business/src/main/java/org/operation/common/exception/MemberException.java b/operation-service/src/main/java/org/operation/common/exception/MemberException.java similarity index 100% rename from operation-business/src/main/java/org/operation/common/exception/MemberException.java rename to operation-service/src/main/java/org/operation/common/exception/MemberException.java diff --git a/operation-business/src/main/java/org/operation/common/exception/SubLectureException.java b/operation-service/src/main/java/org/operation/common/exception/SubLectureException.java similarity index 100% rename from operation-business/src/main/java/org/operation/common/exception/SubLectureException.java rename to operation-service/src/main/java/org/operation/common/exception/SubLectureException.java diff --git a/operation-business/src/main/java/org/operation/common/exception/TokenException.java b/operation-service/src/main/java/org/operation/common/exception/TokenException.java similarity index 100% rename from operation-business/src/main/java/org/operation/common/exception/TokenException.java rename to operation-service/src/main/java/org/operation/common/exception/TokenException.java diff --git a/src/main/java/org/sopt/makers/operation/service/batch/LectureServiceImpl.java b/operation-service/src/main/java/org/operation/common/service/LectureServiceImpl.java similarity index 68% rename from src/main/java/org/sopt/makers/operation/service/batch/LectureServiceImpl.java rename to operation-service/src/main/java/org/operation/common/service/LectureServiceImpl.java index cdbb9e7a..61d01745 100644 --- a/src/main/java/org/sopt/makers/operation/service/batch/LectureServiceImpl.java +++ b/operation-service/src/main/java/org/operation/common/service/LectureServiceImpl.java @@ -1,19 +1,20 @@ -package org.sopt.makers.operation.service.batch; +package org.operation.common.service; -import static org.sopt.makers.operation.common.ExceptionMessage.*; -import static org.operation.alarm.Attribute.*; +import static org.operation.alarm.domain.Attribute.*; +import static org.operation.lecture.message.ErrorMessage.*; import java.util.*; import lombok.val; -import org.sopt.makers.operation.config.ValueConfig; -import org.sopt.makers.operation.dto.alarm.request.AlarmSenderDTO; +import org.operation.client.alarm.AlarmSender; +import org.operation.common.config.ValueConfig; +import org.operation.common.exception.LectureException; +import org.operation.common.scheduler.service.LectureService; import org.operation.lecture.Lecture; -import org.sopt.makers.operation.exception.LectureException; -import org.sopt.makers.operation.external.alarm.AlarmSender; -import org.sopt.makers.operation.repository.lecture.LectureRepository; +import org.operation.lecture.repository.lecture.LectureRepository; +import org.operation.web.alarm.dto.request.AlarmSenderRequest; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -44,12 +45,12 @@ private void endLecture(Long lectureId) { private Lecture findLecture(Long id) { return lectureRepository.findById(id) - .orElseThrow(() -> new LectureException(INVALID_LECTURE.getName())); + .orElseThrow(() -> new LectureException(INVALID_LECTURE.getContent())); } private void checkEndLectureValidity(Lecture lecture) { if (!lecture.isEnd()) { - throw new LectureException(NOT_END_TIME_YET.getName()); + throw new LectureException(NOT_END_TIME_YET.getContent()); } } @@ -57,7 +58,7 @@ private void sendAlarm(Lecture lecture) { val alarmTitle = getAlarmTitle(lecture); val alarmContent = valueConfig.getALARM_MESSAGE_CONTENT(); val memberPlaygroundIds = getMemberPlaygroundIds(lecture); - alarmSender.send(new AlarmSenderDTO(alarmTitle, alarmContent, memberPlaygroundIds, NEWS, null)); + alarmSender.send(new AlarmSenderRequest(alarmTitle, alarmContent, memberPlaygroundIds, NEWS, null)); } private List getMemberPlaygroundIds(Lecture lecture) { diff --git a/src/main/java/org/sopt/makers/operation/security/AdminAuthentication.java b/operation-service/src/main/java/org/operation/security/AdminAuthentication.java similarity index 90% rename from src/main/java/org/sopt/makers/operation/security/AdminAuthentication.java rename to operation-service/src/main/java/org/operation/security/AdminAuthentication.java index 2385c90e..e814d182 100644 --- a/src/main/java/org/sopt/makers/operation/security/AdminAuthentication.java +++ b/operation-service/src/main/java/org/operation/security/AdminAuthentication.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.security; +package org.operation.security; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.GrantedAuthority; diff --git a/src/main/java/org/sopt/makers/operation/config/SecurityConfig.java b/operation-service/src/main/java/org/operation/security/SecurityConfig.java similarity index 98% rename from src/main/java/org/sopt/makers/operation/config/SecurityConfig.java rename to operation-service/src/main/java/org/operation/security/SecurityConfig.java index 57f051d1..4165b3e7 100644 --- a/src/main/java/org/sopt/makers/operation/config/SecurityConfig.java +++ b/operation-service/src/main/java/org/operation/security/SecurityConfig.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.config; +package org.operation.security; import lombok.RequiredArgsConstructor; import lombok.val; diff --git a/src/main/java/org/sopt/makers/operation/security/jwt/JwtAuthenticationFilter.java b/operation-service/src/main/java/org/operation/security/jwt/JwtAuthenticationFilter.java similarity index 97% rename from src/main/java/org/sopt/makers/operation/security/jwt/JwtAuthenticationFilter.java rename to operation-service/src/main/java/org/operation/security/jwt/JwtAuthenticationFilter.java index 064af05a..f847633f 100644 --- a/src/main/java/org/sopt/makers/operation/security/jwt/JwtAuthenticationFilter.java +++ b/operation-service/src/main/java/org/operation/security/jwt/JwtAuthenticationFilter.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.security.jwt; +package org.operation.security.jwt; import lombok.RequiredArgsConstructor; import lombok.val; diff --git a/src/main/java/org/sopt/makers/operation/security/jwt/JwtExceptionFilter.java b/operation-service/src/main/java/org/operation/security/jwt/JwtExceptionFilter.java similarity index 96% rename from src/main/java/org/sopt/makers/operation/security/jwt/JwtExceptionFilter.java rename to operation-service/src/main/java/org/operation/security/jwt/JwtExceptionFilter.java index cf2e8eb9..d6f85589 100644 --- a/src/main/java/org/sopt/makers/operation/security/jwt/JwtExceptionFilter.java +++ b/operation-service/src/main/java/org/operation/security/jwt/JwtExceptionFilter.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.security.jwt; +package org.operation.security.jwt; import org.sopt.makers.operation.exception.TokenException; import org.springframework.http.HttpStatus; diff --git a/src/main/java/org/sopt/makers/operation/security/jwt/JwtTokenProvider.java b/operation-service/src/main/java/org/operation/security/jwt/JwtTokenProvider.java similarity index 98% rename from src/main/java/org/sopt/makers/operation/security/jwt/JwtTokenProvider.java rename to operation-service/src/main/java/org/operation/security/jwt/JwtTokenProvider.java index e43cf11e..a1834bb0 100644 --- a/src/main/java/org/sopt/makers/operation/security/jwt/JwtTokenProvider.java +++ b/operation-service/src/main/java/org/operation/security/jwt/JwtTokenProvider.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.security.jwt; +package org.operation.security.jwt; import io.jsonwebtoken.Claims; import io.jsonwebtoken.ExpiredJwtException; @@ -7,9 +7,10 @@ import io.jsonwebtoken.security.SignatureException; import lombok.RequiredArgsConstructor; import lombok.val; + +import org.operation.security.AdminAuthentication; import org.sopt.makers.operation.common.ExceptionMessage; import org.sopt.makers.operation.exception.TokenException; -import org.sopt.makers.operation.security.AdminAuthentication; import org.springframework.beans.factory.annotation.Value; import org.springframework.security.core.Authentication; import org.springframework.stereotype.Service; diff --git a/src/main/java/org/sopt/makers/operation/security/jwt/JwtTokenType.java b/operation-service/src/main/java/org/operation/security/jwt/JwtTokenType.java similarity index 62% rename from src/main/java/org/sopt/makers/operation/security/jwt/JwtTokenType.java rename to operation-service/src/main/java/org/operation/security/jwt/JwtTokenType.java index 753724db..85e8a15b 100644 --- a/src/main/java/org/sopt/makers/operation/security/jwt/JwtTokenType.java +++ b/operation-service/src/main/java/org/operation/security/jwt/JwtTokenType.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.security.jwt; +package org.operation.security.jwt; public enum JwtTokenType { ACCESS_TOKEN, REFRESH_TOKEN, APP_ACCESS_TOKEN diff --git a/operation-business/src/main/java/org/operation/web/admin/dto/request/LoginRequest.java b/operation-service/src/main/java/org/operation/web/admin/dto/request/LoginRequest.java similarity index 100% rename from operation-business/src/main/java/org/operation/web/admin/dto/request/LoginRequest.java rename to operation-service/src/main/java/org/operation/web/admin/dto/request/LoginRequest.java diff --git a/operation-business/src/main/java/org/operation/web/admin/dto/request/SignUpRequest.java b/operation-service/src/main/java/org/operation/web/admin/dto/request/SignUpRequest.java similarity index 100% rename from operation-business/src/main/java/org/operation/web/admin/dto/request/SignUpRequest.java rename to operation-service/src/main/java/org/operation/web/admin/dto/request/SignUpRequest.java diff --git a/operation-business/src/main/java/org/operation/web/admin/dto/response/LoginResponse.java b/operation-service/src/main/java/org/operation/web/admin/dto/response/LoginResponse.java similarity index 100% rename from operation-business/src/main/java/org/operation/web/admin/dto/response/LoginResponse.java rename to operation-service/src/main/java/org/operation/web/admin/dto/response/LoginResponse.java diff --git a/operation-service/src/main/java/org/operation/web/admin/dto/response/RefreshResponse.java b/operation-service/src/main/java/org/operation/web/admin/dto/response/RefreshResponse.java new file mode 100644 index 00000000..bf7116ff --- /dev/null +++ b/operation-service/src/main/java/org/operation/web/admin/dto/response/RefreshResponse.java @@ -0,0 +1,13 @@ +package org.operation.web.admin.dto.response; + +import org.operation.admin.domain.Admin; + +public record RefreshResponse( + String accessToken, + String refreshToken +) { + + public static RefreshResponse of(String accessToken, Admin admin) { + return new RefreshResponse(accessToken, admin.getRefreshToken()); + } +} \ No newline at end of file diff --git a/operation-business/src/main/java/org/operation/web/admin/dto/response/SignUpResponse.java b/operation-service/src/main/java/org/operation/web/admin/dto/response/SignUpResponse.java similarity index 100% rename from operation-business/src/main/java/org/operation/web/admin/dto/response/SignUpResponse.java rename to operation-service/src/main/java/org/operation/web/admin/dto/response/SignUpResponse.java diff --git a/operation-business/src/main/java/org/operation/web/admin/repository/AdminRepository.java b/operation-service/src/main/java/org/operation/web/admin/repository/AdminRepository.java similarity index 100% rename from operation-business/src/main/java/org/operation/web/admin/repository/AdminRepository.java rename to operation-service/src/main/java/org/operation/web/admin/repository/AdminRepository.java diff --git a/operation-business/src/main/java/org/operation/web/admin/service/AdminServiceImpl.java b/operation-service/src/main/java/org/operation/web/admin/service/AdminServiceImpl.java similarity index 96% rename from operation-business/src/main/java/org/operation/web/admin/service/AdminServiceImpl.java rename to operation-service/src/main/java/org/operation/web/admin/service/AdminServiceImpl.java index 54ef08f7..de3afa2a 100644 --- a/operation-business/src/main/java/org/operation/web/admin/service/AdminServiceImpl.java +++ b/operation-service/src/main/java/org/operation/web/admin/service/AdminServiceImpl.java @@ -1,6 +1,8 @@ package org.operation.web.admin.service; import org.operation.admin.domain.Admin; +import org.operation.security.AdminAuthentication; +import org.operation.security.jwt.JwtTokenProvider; import org.operation.web.admin.dto.request.LoginRequest; import org.operation.web.admin.dto.request.SignUpRequest; import org.operation.web.admin.dto.response.LoginResponse; @@ -90,7 +92,7 @@ public RefreshResponse refresh(String refreshToken) { val newRefreshToken = jwtTokenProvider.generateRefreshToken(adminAuthentication); admin.updateRefreshToken(newRefreshToken);*/ - return RefreshResponse.of(newAccessToken); + return RefreshResponse.of(newAccessToken, admin); } public void validateRefreshToken(Admin admin, String refreshToken) { diff --git a/src/main/java/org/sopt/makers/operation/dto/alarm/request/AlarmRequestDTO.java b/operation-service/src/main/java/org/operation/web/alarm/dto/request/AlarmRequest.java similarity index 55% rename from src/main/java/org/sopt/makers/operation/dto/alarm/request/AlarmRequestDTO.java rename to operation-service/src/main/java/org/operation/web/alarm/dto/request/AlarmRequest.java index 1b1144e5..92d0cdc0 100644 --- a/src/main/java/org/sopt/makers/operation/dto/alarm/request/AlarmRequestDTO.java +++ b/operation-service/src/main/java/org/operation/web/alarm/dto/request/AlarmRequest.java @@ -1,12 +1,12 @@ -package org.sopt.makers.operation.dto.alarm.request; +package org.operation.web.alarm.dto.request; import java.util.List; -import org.sopt.makers.operation.entity.Part; -import org.operation.alarm.Alarm; -import org.operation.alarm.Attribute; +import org.operation.common.domain.Part; +import org.operation.alarm.domain.Alarm; +import org.operation.alarm.domain.Attribute; -public record AlarmRequestDTO( +public record AlarmRequest( int generation, int generationAt, Attribute attribute, diff --git a/operation-service/src/main/java/org/operation/web/alarm/dto/request/AlarmSendRequest.java b/operation-service/src/main/java/org/operation/web/alarm/dto/request/AlarmSendRequest.java new file mode 100644 index 00000000..dad218cc --- /dev/null +++ b/operation-service/src/main/java/org/operation/web/alarm/dto/request/AlarmSendRequest.java @@ -0,0 +1,6 @@ +package org.operation.web.alarm.dto.request; + +public record AlarmSendRequest( + long alarmId +) { +} diff --git a/src/main/java/org/sopt/makers/operation/dto/alarm/request/AlarmSenderDTO.java b/operation-service/src/main/java/org/operation/web/alarm/dto/request/AlarmSenderRequest.java similarity index 55% rename from src/main/java/org/sopt/makers/operation/dto/alarm/request/AlarmSenderDTO.java rename to operation-service/src/main/java/org/operation/web/alarm/dto/request/AlarmSenderRequest.java index 9cc2dbc4..4dc4ad5c 100644 --- a/src/main/java/org/sopt/makers/operation/dto/alarm/request/AlarmSenderDTO.java +++ b/operation-service/src/main/java/org/operation/web/alarm/dto/request/AlarmSenderRequest.java @@ -1,22 +1,22 @@ -package org.sopt.makers.operation.dto.alarm.request; +package org.operation.web.alarm.dto.request; import java.util.List; -import org.operation.alarm.Alarm; -import org.operation.alarm.Attribute; +import org.operation.alarm.domain.Alarm; +import org.operation.alarm.domain.Attribute; import lombok.Builder; @Builder -public record AlarmSenderDTO( +public record AlarmSenderRequest( String title, String content, List targetList, Attribute attribute, String link ) { - public static AlarmSenderDTO of (Alarm alarm, List targetList) { - return AlarmSenderDTO.builder() + public static AlarmSenderRequest of (Alarm alarm, List targetList) { + return builder() .title(alarm.getTitle()) .content(alarm.getContent()) .targetList(targetList) diff --git a/operation-service/src/main/java/org/operation/web/alarm/dto/response/AlarmInactiveListResponse.java b/operation-service/src/main/java/org/operation/web/alarm/dto/response/AlarmInactiveListResponse.java new file mode 100644 index 00000000..d3030d2a --- /dev/null +++ b/operation-service/src/main/java/org/operation/web/alarm/dto/response/AlarmInactiveListResponse.java @@ -0,0 +1,8 @@ +package org.operation.web.alarm.dto.response; + +import java.util.List; + +public record AlarmInactiveListResponse( + List memberIds +) { +} diff --git a/src/main/java/org/sopt/makers/operation/dto/alarm/response/AlarmResponseDTO.java b/operation-service/src/main/java/org/operation/web/alarm/dto/response/AlarmResponse.java similarity index 74% rename from src/main/java/org/sopt/makers/operation/dto/alarm/response/AlarmResponseDTO.java rename to operation-service/src/main/java/org/operation/web/alarm/dto/response/AlarmResponse.java index f31530fe..1f034d84 100644 --- a/src/main/java/org/sopt/makers/operation/dto/alarm/response/AlarmResponseDTO.java +++ b/operation-service/src/main/java/org/operation/web/alarm/dto/response/AlarmResponse.java @@ -1,13 +1,13 @@ -package org.sopt.makers.operation.dto.alarm.response; +package org.operation.web.alarm.dto.response; import static java.util.Objects.*; -import org.operation.alarm.Alarm; +import org.operation.alarm.domain.Alarm; import lombok.Builder; @Builder -public record AlarmResponseDTO( +public record AlarmResponse( String attribute, String part, Boolean isActive, @@ -17,8 +17,8 @@ public record AlarmResponseDTO( String createdAt, String sendAt ) { - public static AlarmResponseDTO of(Alarm alarm) { - return AlarmResponseDTO.builder() + public static AlarmResponse of(Alarm alarm) { + return AlarmResponse.builder() .attribute(alarm.getAttribute().getName()) .part(nonNull(alarm.getPart()) ? alarm.getPart().getName() : null) .isActive(alarm.getIsActive()) diff --git a/src/main/java/org/sopt/makers/operation/dto/alarm/response/AlarmsResponseDTO.java b/operation-service/src/main/java/org/operation/web/alarm/dto/response/AlarmsResponse.java similarity index 71% rename from src/main/java/org/sopt/makers/operation/dto/alarm/response/AlarmsResponseDTO.java rename to operation-service/src/main/java/org/operation/web/alarm/dto/response/AlarmsResponse.java index 689c8ae3..0906460a 100644 --- a/src/main/java/org/sopt/makers/operation/dto/alarm/response/AlarmsResponseDTO.java +++ b/operation-service/src/main/java/org/operation/web/alarm/dto/response/AlarmsResponse.java @@ -1,19 +1,19 @@ -package org.sopt.makers.operation.dto.alarm.response; +package org.operation.web.alarm.dto.response; import static java.util.Objects.*; import java.util.List; -import org.operation.alarm.Alarm; +import org.operation.alarm.domain.Alarm; import lombok.Builder; -public record AlarmsResponseDTO( +public record AlarmsResponse( List alarms, int totalCount ) { - public static AlarmsResponseDTO of(List alarms, int totalCount) { - return new AlarmsResponseDTO(alarms.stream().map(AlarmVO::of).toList(), totalCount); + public static AlarmsResponse of(List alarms, int totalCount) { + return new AlarmsResponse(alarms.stream().map(AlarmVO::of).toList(), totalCount); } @Builder diff --git a/src/main/java/org/sopt/makers/operation/service/web/alarm/AlarmServiceImpl.java b/operation-service/src/main/java/org/operation/web/alarm/service/AlarmServiceImpl.java similarity index 51% rename from src/main/java/org/sopt/makers/operation/service/web/alarm/AlarmServiceImpl.java rename to operation-service/src/main/java/org/operation/web/alarm/service/AlarmServiceImpl.java index 738528e9..62ae30ab 100644 --- a/src/main/java/org/sopt/makers/operation/service/web/alarm/AlarmServiceImpl.java +++ b/operation-service/src/main/java/org/operation/web/alarm/service/AlarmServiceImpl.java @@ -1,35 +1,32 @@ -package org.sopt.makers.operation.service.web.alarm; +package org.operation.web.alarm.service; import static java.util.Objects.*; -import static org.sopt.makers.operation.common.ExceptionMessage.*; -import static org.sopt.makers.operation.entity.Part.*; -import static org.operation.alarm.Status.*; - -import org.sopt.makers.operation.config.ValueConfig; -import org.sopt.makers.operation.dto.alarm.request.AlarmSendRequestDTO; -import org.sopt.makers.operation.dto.alarm.request.AlarmSenderDTO; -import org.sopt.makers.operation.dto.member.response.MemberSearchCondition; -import org.sopt.makers.operation.entity.Part; -import org.operation.alarm.Status; -import org.sopt.makers.operation.exception.AlarmException; -import org.sopt.makers.operation.external.alarm.AlarmSender; -import org.sopt.makers.operation.external.playground.PlayGroundServer; -import org.sopt.makers.operation.repository.alarm.AlarmRepository; -import org.sopt.makers.operation.repository.member.MemberRepository; +import static org.operation.alarm.domain.Status.*; +import static org.operation.alarm.message.ErrorMessage.*; + +import java.util.List; + +import org.operation.alarm.domain.Alarm; +import org.operation.alarm.domain.Status; +import org.operation.alarm.repository.AlarmRepository; +import org.operation.client.alarm.AlarmSender; +import org.operation.client.playground.PlayGroundServer; +import org.operation.common.config.ValueConfig; +import org.operation.common.domain.Part; +import org.operation.common.dto.MemberSearchCondition; +import org.operation.common.exception.AlarmException; +import org.operation.member.repository.MemberRepository; +import org.operation.web.alarm.dto.request.AlarmRequest; +import org.operation.web.alarm.dto.request.AlarmSendRequest; +import org.operation.web.alarm.dto.request.AlarmSenderRequest; +import org.operation.web.alarm.dto.response.AlarmResponse; +import org.operation.web.alarm.dto.response.AlarmsResponse; +import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import javax.persistence.EntityNotFoundException; - -import java.util.*; - -import lombok.*; - -import org.sopt.makers.operation.dto.alarm.request.AlarmRequestDTO; -import org.sopt.makers.operation.dto.alarm.response.AlarmResponseDTO; -import org.sopt.makers.operation.dto.alarm.response.AlarmsResponseDTO; -import org.operation.alarm.Alarm; -import org.springframework.data.domain.Pageable; +import lombok.RequiredArgsConstructor; +import lombok.val; @Service @RequiredArgsConstructor @@ -43,19 +40,25 @@ public class AlarmServiceImpl implements AlarmService { @Override @Transactional - public void sendByAdmin(AlarmSendRequestDTO requestDTO) { - val alarm = findAlarm(requestDTO.alarmId()); + public void sendByAdmin(AlarmSendRequest request) { + val alarm = findAlarm(request.alarmId()); + if (alarm.getStatus().equals(AFTER)) { - throw new AlarmException(ALREADY_SEND_ALARM.getName()); + throw new AlarmException(FAIL_SEND_ALARM.getContent()); } val targetIdList = getTargetIdList(alarm); - alarmSender.send(AlarmSenderDTO.of(alarm, targetIdList)); + alarmSender.send(AlarmSenderRequest.of(alarm, targetIdList)); alarm.updateStatus(); alarm.updateSendAt(); } + private Alarm findAlarm(long id) { + return alarmRepository.findById(id) + .orElseThrow(() -> new AlarmException(INVALID_ALARM.getContent())); + } + private List getTargetIdList(Alarm alarm) { val targetList = alarm.getTargetList(); if (!targetList.isEmpty()) { @@ -74,14 +77,18 @@ private List getTargetIdList(Alarm alarm) { } private List getActiveTargetList(Part part) { - part = part.equals(ALL) ? null : part; - val members = memberRepository.search(new MemberSearchCondition(part, valueConfig.getGENERATION())); + val generation = valueConfig.getGENERATION(); + val members = memberRepository.search(new MemberSearchCondition(getPart(part), generation)); return members.stream() .filter(member -> nonNull(member.getPlaygroundId())) .map(member -> String.valueOf(member.getPlaygroundId())) .toList(); } + private Part getPart(Part part) { + return part.equals(Part.ALL) ? null : part; + } + private List getInactiveTargetList(int generation, Part part) { val members = playGroundServer.getInactiveMembers(generation, part); return members.memberIds().stream() @@ -91,23 +98,23 @@ private List getInactiveTargetList(int generation, Part part) { @Override @Transactional - public Long createAlarm(AlarmRequestDTO requestDTO) { - val alarmEntity = requestDTO.toEntity(); + public Long createAlarm(AlarmRequest request) { + val alarmEntity = request.toEntity(); val savedAlarm = alarmRepository.save(alarmEntity); return savedAlarm.getId(); } @Override - public AlarmsResponseDTO getAlarms(Integer generation, Part part, Status status, Pageable pageable) { + public AlarmsResponse getAlarms(Integer generation, Part part, Status status, Pageable pageable) { val alarms = alarmRepository.getAlarms(generation, part, status, pageable); val alarmsCount = alarmRepository.countByGenerationAndPartAndStatus(generation, part, status); - return AlarmsResponseDTO.of(alarms, alarmsCount); + return AlarmsResponse.of(alarms, alarmsCount); } @Override - public AlarmResponseDTO getAlarm(Long alarmId) { + public AlarmResponse getAlarm(long alarmId) { val alarm = findAlarm(alarmId); - return AlarmResponseDTO.of(alarm); + return AlarmResponse.of(alarm); } @Override @@ -116,9 +123,4 @@ public void deleteAlarm(Long alarmId) { val alarm = findAlarm(alarmId); alarmRepository.delete(alarm); } - - private Alarm findAlarm(Long alarmId) { - return alarmRepository.findById(alarmId) - .orElseThrow(() -> new EntityNotFoundException(INVALID_ALARM.getName())); - } } diff --git a/operation-service/src/main/java/org/operation/web/attendance/dto/request/SubAttendanceUpdateRequest.java b/operation-service/src/main/java/org/operation/web/attendance/dto/request/SubAttendanceUpdateRequest.java new file mode 100644 index 00000000..eb2d48fc --- /dev/null +++ b/operation-service/src/main/java/org/operation/web/attendance/dto/request/SubAttendanceUpdateRequest.java @@ -0,0 +1,9 @@ +package org.operation.web.attendance.dto.request; + +import org.operation.attendance.domain.AttendanceStatus; + +public record SubAttendanceUpdateRequest( + Long subAttendanceId, + AttendanceStatus status +) { +} diff --git a/src/main/java/org/sopt/makers/operation/dto/attendance/response/AttendanceMemberResponseDTO.java b/operation-service/src/main/java/org/operation/web/attendance/dto/response/AttendanceMemberResponse.java similarity index 73% rename from src/main/java/org/sopt/makers/operation/dto/attendance/response/AttendanceMemberResponseDTO.java rename to operation-service/src/main/java/org/operation/web/attendance/dto/response/AttendanceMemberResponse.java index c91fddbe..ced0dba0 100644 --- a/src/main/java/org/sopt/makers/operation/dto/attendance/response/AttendanceMemberResponseDTO.java +++ b/operation-service/src/main/java/org/operation/web/attendance/dto/response/AttendanceMemberResponse.java @@ -1,12 +1,12 @@ -package org.sopt.makers.operation.dto.attendance.response; +package org.operation.web.attendance.dto.response; import java.util.List; -import org.operation.attendance.Attendance; -import org.operation.member.Member; -import org.operation.attendance.SubAttendance; +import org.operation.attendance.domain.Attendance; +import org.operation.attendance.domain.SubAttendance; +import org.operation.member.domain.Member; -public record AttendanceMemberResponseDTO( +public record AttendanceMemberResponse( String name, float score, String part, @@ -14,8 +14,8 @@ public record AttendanceMemberResponseDTO( String phone, List lectures ) { - public static AttendanceMemberResponseDTO of(Member member, List attendances) { - return new AttendanceMemberResponseDTO( + public static AttendanceMemberResponse of(Member member, List attendances) { + return new AttendanceMemberResponse( member.getName(), member.getScore(), member.getPart().getName(), diff --git a/operation-service/src/main/java/org/operation/web/attendance/dto/response/AttendancesResponse.java b/operation-service/src/main/java/org/operation/web/attendance/dto/response/AttendancesResponse.java new file mode 100644 index 00000000..160919a5 --- /dev/null +++ b/operation-service/src/main/java/org/operation/web/attendance/dto/response/AttendancesResponse.java @@ -0,0 +1,17 @@ +package org.operation.web.attendance.dto.response; + +import java.util.List; + +import org.operation.attendance.domain.Attendance; + +public record AttendancesResponse( + List attendances, + int totalCount +) { + + public static AttendancesResponse of(List attendances, int totalCount) { + return new AttendancesResponse( + attendances.stream().map(MemberResponse::of).toList(), + totalCount); + } +} diff --git a/src/main/java/org/sopt/makers/operation/dto/attendance/response/MemberResponseDTO.java b/operation-service/src/main/java/org/operation/web/attendance/dto/response/MemberResponse.java similarity index 71% rename from src/main/java/org/sopt/makers/operation/dto/attendance/response/MemberResponseDTO.java rename to operation-service/src/main/java/org/operation/web/attendance/dto/response/MemberResponse.java index 69029e58..5baebe36 100644 --- a/src/main/java/org/sopt/makers/operation/dto/attendance/response/MemberResponseDTO.java +++ b/operation-service/src/main/java/org/operation/web/attendance/dto/response/MemberResponse.java @@ -1,21 +1,21 @@ -package org.sopt.makers.operation.dto.attendance.response; +package org.operation.web.attendance.dto.response; import java.util.List; -import org.operation.attendance.Attendance; -import org.operation.attendance.AttendanceStatus; -import org.operation.member.Member; -import org.operation.attendance.SubAttendance; +import org.operation.attendance.domain.Attendance; +import org.operation.attendance.domain.AttendanceStatus; +import org.operation.attendance.domain.SubAttendance; +import org.operation.member.domain.Member; -public record MemberResponseDTO ( +public record MemberResponse( Long attendanceId, MemberVO member, List attendances, float updatedScore ) { - public static MemberResponseDTO of(Attendance attendance) { - return new MemberResponseDTO( + public static MemberResponse of(Attendance attendance) { + return new MemberResponse( attendance.getId(), MemberVO.of(attendance.getMember()), attendance.getSubAttendances().stream().map(SubAttendanceVO::of).toList(), diff --git a/operation-service/src/main/java/org/operation/web/attendance/dto/response/SubAttendanceUpdateResponse.java b/operation-service/src/main/java/org/operation/web/attendance/dto/response/SubAttendanceUpdateResponse.java new file mode 100644 index 00000000..f0016565 --- /dev/null +++ b/operation-service/src/main/java/org/operation/web/attendance/dto/response/SubAttendanceUpdateResponse.java @@ -0,0 +1,13 @@ +package org.operation.web.attendance.dto.response; + +import org.operation.attendance.domain.AttendanceStatus; +import org.operation.attendance.domain.SubAttendance; + +public record SubAttendanceUpdateResponse( + Long subAttendanceId, + AttendanceStatus status +) { + public static SubAttendanceUpdateResponse of(SubAttendance subAttendance) { + return new SubAttendanceUpdateResponse(subAttendance.getId(), subAttendance.getStatus()); + } +} diff --git a/operation-service/src/main/java/org/operation/web/attendance/service/AttendanceServiceImpl.java b/operation-service/src/main/java/org/operation/web/attendance/service/AttendanceServiceImpl.java new file mode 100644 index 00000000..097300fe --- /dev/null +++ b/operation-service/src/main/java/org/operation/web/attendance/service/AttendanceServiceImpl.java @@ -0,0 +1,77 @@ +package org.operation.web.attendance.service; + +import static org.operation.attendance.message.ErrorMessage.*; +import static org.operation.member.message.ErrorMessage.*; + +import org.operation.attendance.domain.SubAttendance; +import org.operation.attendance.repository.attendance.AttendanceRepository; +import org.operation.attendance.repository.subAttendance.SubAttendanceRepository; +import org.operation.common.domain.Part; +import org.operation.common.exception.LectureException; +import org.operation.common.exception.MemberException; +import org.operation.member.domain.Member; +import org.operation.member.repository.MemberRepository; +import org.operation.web.attendance.dto.request.SubAttendanceUpdateRequest; +import org.operation.web.attendance.dto.response.AttendanceMemberResponse; +import org.operation.web.attendance.dto.response.AttendancesResponse; +import org.operation.web.attendance.dto.response.SubAttendanceUpdateResponse; +import org.operation.web.attendnace.service.AttendanceService; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import lombok.val; + +@Slf4j +@Service +@RequiredArgsConstructor +@Transactional(readOnly = true) +public class AttendanceServiceImpl implements AttendanceService { + + private final SubAttendanceRepository subAttendanceRepository; + private final MemberRepository memberRepository; + private final AttendanceRepository attendanceRepository; + + @Override + @Transactional + public SubAttendanceUpdateResponse updateSubAttendance(SubAttendanceUpdateRequest request) { + val subAttendance = findSubAttendance(request.subAttendanceId()); + subAttendance.updateStatus(request.status()); + return SubAttendanceUpdateResponse.of(subAttendance); + } + + private SubAttendance findSubAttendance(Long id) { + return subAttendanceRepository.findById(id) + .orElseThrow(() -> new LectureException(INVALID_ATTENDANCE.getContent())); + } + + @Override + public AttendanceMemberResponse findAttendancesByMember(long memberId) { + val member = findMember(memberId); + val attendances = attendanceRepository.findByMember(member); + return AttendanceMemberResponse.of(member, attendances); + } + + private Member findMember(Long id) { + return memberRepository.findById(id) + .orElseThrow(() -> new MemberException(INVALID_MEMBER.getContent())); + } + + @Override + @Transactional + public float updateMemberScore(Long memberId) { + val member = memberRepository.find(memberId) + .orElseThrow(() -> new MemberException(INVALID_MEMBER.getContent())); + member.updateTotalScore(); + return member.getScore(); + } + + @Override + public AttendancesResponse findAttendancesByLecture(long lectureId, Part part, Pageable pageable) { + val attendances = attendanceRepository.findByLecture(lectureId, part, pageable); + val attendancesCount = attendanceRepository.countByLectureIdAndPart(lectureId, part); + return AttendancesResponse.of(attendances, attendancesCount); + } +} diff --git a/operation-service/src/main/java/org/operation/web/lecture/dto/request/AttendanceRequest.java b/operation-service/src/main/java/org/operation/web/lecture/dto/request/AttendanceRequest.java new file mode 100644 index 00000000..65dd2497 --- /dev/null +++ b/operation-service/src/main/java/org/operation/web/lecture/dto/request/AttendanceRequest.java @@ -0,0 +1,8 @@ +package org.operation.web.lecture.dto.request; + +public record AttendanceRequest( + Long lectureId, + int round, + String code +) { +} diff --git a/src/main/java/org/sopt/makers/operation/dto/lecture/request/LectureRequestDTO.java b/operation-service/src/main/java/org/operation/web/lecture/dto/request/LectureRequest.java similarity index 81% rename from src/main/java/org/sopt/makers/operation/dto/lecture/request/LectureRequestDTO.java rename to operation-service/src/main/java/org/operation/web/lecture/dto/request/LectureRequest.java index 4232f149..9abbdbc4 100644 --- a/src/main/java/org/sopt/makers/operation/dto/lecture/request/LectureRequestDTO.java +++ b/operation-service/src/main/java/org/operation/web/lecture/dto/request/LectureRequest.java @@ -1,16 +1,17 @@ -package org.sopt.makers.operation.dto.lecture.request; +package org.operation.web.lecture.dto.request; import java.time.LocalDateTime; import java.time.format.DateTimeParseException; +import org.operation.common.domain.Part; import org.operation.lecture.Attribute; import org.operation.lecture.Lecture; -import org.sopt.makers.operation.entity.Part; -import lombok.*; +import lombok.Builder; +import lombok.NonNull; @Builder -public record LectureRequestDTO( +public record LectureRequest( @NonNull Part part, @NonNull String name, int generation, diff --git a/src/main/java/org/sopt/makers/operation/dto/lecture/response/AttendanceResponseDTO.java b/operation-service/src/main/java/org/operation/web/lecture/dto/response/AttendanceResponse.java similarity index 53% rename from src/main/java/org/sopt/makers/operation/dto/lecture/response/AttendanceResponseDTO.java rename to operation-service/src/main/java/org/operation/web/lecture/dto/response/AttendanceResponse.java index d3265f65..b5f6506b 100644 --- a/src/main/java/org/sopt/makers/operation/dto/lecture/response/AttendanceResponseDTO.java +++ b/operation-service/src/main/java/org/operation/web/lecture/dto/response/AttendanceResponse.java @@ -1,18 +1,18 @@ -package org.sopt.makers.operation.dto.lecture.response; +package org.operation.web.lecture.dto.response; -import org.operation.lecture.SubLecture; import org.operation.lecture.Lecture; +import org.operation.lecture.SubLecture; import lombok.Builder; @Builder -public record AttendanceResponseDTO( +public record AttendanceResponse( Long lectureId, Long subLectureId ) { - public static AttendanceResponseDTO of(Lecture lecture, SubLecture subLecture) { - return AttendanceResponseDTO.builder() + public static AttendanceResponse of(Lecture lecture, SubLecture subLecture) { + return AttendanceResponse.builder() .lectureId(lecture.getId()) .subLectureId(subLecture.getId()) .build(); diff --git a/src/main/java/org/sopt/makers/operation/dto/lecture/response/AttendancesStatusVO.java b/operation-service/src/main/java/org/operation/web/lecture/dto/response/AttendancesStatusVO.java similarity index 82% rename from src/main/java/org/sopt/makers/operation/dto/lecture/response/AttendancesStatusVO.java rename to operation-service/src/main/java/org/operation/web/lecture/dto/response/AttendancesStatusVO.java index 1d9cf535..59d74220 100644 --- a/src/main/java/org/sopt/makers/operation/dto/lecture/response/AttendancesStatusVO.java +++ b/operation-service/src/main/java/org/operation/web/lecture/dto/response/AttendancesStatusVO.java @@ -1,10 +1,10 @@ -package org.sopt.makers.operation.dto.lecture.response; +package org.operation.web.lecture.dto.response; -import static org.operation.attendance.AttendanceStatus.*; +import static org.operation.attendance.domain.AttendanceStatus.*; import java.time.LocalDateTime; -import org.operation.attendance.AttendanceStatus; +import org.operation.attendance.domain.AttendanceStatus; import org.operation.lecture.Lecture; import lombok.Builder; diff --git a/src/main/java/org/sopt/makers/operation/dto/lecture/response/LectureDetailResponseDTO.java b/operation-service/src/main/java/org/operation/web/lecture/dto/response/LectureDetailResponse.java similarity index 72% rename from src/main/java/org/sopt/makers/operation/dto/lecture/response/LectureDetailResponseDTO.java rename to operation-service/src/main/java/org/operation/web/lecture/dto/response/LectureDetailResponse.java index 4b5e3804..6955180b 100644 --- a/src/main/java/org/sopt/makers/operation/dto/lecture/response/LectureDetailResponseDTO.java +++ b/operation-service/src/main/java/org/operation/web/lecture/dto/response/LectureDetailResponse.java @@ -1,11 +1,11 @@ -package org.sopt.makers.operation.dto.lecture.response; +package org.operation.web.lecture.dto.response; import org.operation.lecture.Lecture; import lombok.Builder; @Builder -public record LectureDetailResponseDTO( +public record LectureDetailResponse( Long lectureId, String part, String name, @@ -15,8 +15,8 @@ public record LectureDetailResponseDTO( String endDate, int generation ) { - public static LectureDetailResponseDTO of(Lecture lecture) { - return LectureDetailResponseDTO.builder() + public static LectureDetailResponse of(Lecture lecture) { + return LectureDetailResponse.builder() .lectureId(lecture.getId()) .part(lecture.getPart().getName()) .name(lecture.getName()) diff --git a/src/main/java/org/sopt/makers/operation/dto/lecture/response/LectureResponseDTO.java b/operation-service/src/main/java/org/operation/web/lecture/dto/response/LectureResponse.java similarity index 84% rename from src/main/java/org/sopt/makers/operation/dto/lecture/response/LectureResponseDTO.java rename to operation-service/src/main/java/org/operation/web/lecture/dto/response/LectureResponse.java index 4178dc5d..3fe86672 100644 --- a/src/main/java/org/sopt/makers/operation/dto/lecture/response/LectureResponseDTO.java +++ b/operation-service/src/main/java/org/operation/web/lecture/dto/response/LectureResponse.java @@ -1,20 +1,20 @@ -package org.sopt.makers.operation.dto.lecture.response; +package org.operation.web.lecture.dto.response; import static java.util.Objects.*; import java.time.LocalDateTime; import java.util.List; -import org.sopt.makers.operation.entity.Part; -import org.operation.lecture.SubLecture; +import org.operation.common.domain.Part; import org.operation.lecture.Attribute; import org.operation.lecture.Lecture; import org.operation.lecture.LectureStatus; +import org.operation.lecture.SubLecture; -import lombok.*; +import lombok.Builder; @Builder -public record LectureResponseDTO( +public record LectureResponse( Long lectureId, String name, int generation, @@ -25,8 +25,8 @@ public record LectureResponseDTO( LectureStatus status ) { - public static LectureResponseDTO of(Lecture lecture) { - return LectureResponseDTO.builder() + public static LectureResponse of(Lecture lecture) { + return LectureResponse.builder() .lectureId(lecture.getId()) .name(lecture.getName()) .generation(lecture.getGeneration()) diff --git a/src/main/java/org/sopt/makers/operation/dto/lecture/response/LecturesResponseDTO.java b/operation-service/src/main/java/org/operation/web/lecture/dto/response/LecturesResponse.java similarity index 79% rename from src/main/java/org/sopt/makers/operation/dto/lecture/response/LecturesResponseDTO.java rename to operation-service/src/main/java/org/operation/web/lecture/dto/response/LecturesResponse.java index e4ba8c5c..1fe17d50 100644 --- a/src/main/java/org/sopt/makers/operation/dto/lecture/response/LecturesResponseDTO.java +++ b/operation-service/src/main/java/org/operation/web/lecture/dto/response/LecturesResponse.java @@ -1,20 +1,20 @@ -package org.sopt.makers.operation.dto.lecture.response; +package org.operation.web.lecture.dto.response; import java.util.List; -import org.sopt.makers.operation.entity.Part; +import org.operation.common.domain.Part; import org.operation.lecture.Attribute; import org.operation.lecture.Lecture; -import lombok.*; +import lombok.Builder; -public record LecturesResponseDTO( +public record LecturesResponse( int generation, List lectures ) { - public static LecturesResponseDTO of(int generation, List lectures) { - return new LecturesResponseDTO( + public static LecturesResponse of(int generation, List lectures) { + return new LecturesResponse( generation, lectures.stream().map(LectureVO::of).toList() ); diff --git a/src/main/java/org/sopt/makers/operation/service/web/lecture/LectureServiceImpl.java b/operation-service/src/main/java/org/operation/web/lecture/service/LectureServiceImpl.java similarity index 61% rename from src/main/java/org/sopt/makers/operation/service/web/lecture/LectureServiceImpl.java rename to operation-service/src/main/java/org/operation/web/lecture/service/LectureServiceImpl.java index 8ee6d8d5..eb77a6c3 100644 --- a/src/main/java/org/sopt/makers/operation/service/web/lecture/LectureServiceImpl.java +++ b/operation-service/src/main/java/org/operation/web/lecture/service/LectureServiceImpl.java @@ -1,33 +1,33 @@ -package org.sopt.makers.operation.service.web.lecture; +package org.operation.web.lecture.service; -import static org.sopt.makers.operation.common.ExceptionMessage.*; -import static org.operation.alarm.Attribute.*; +import static org.operation.alarm.domain.Attribute.*; +import static org.operation.lecture.message.ErrorMessage.*; import java.util.List; import java.util.stream.Stream; -import org.sopt.makers.operation.config.ValueConfig; -import org.sopt.makers.operation.dto.alarm.request.AlarmSenderDTO; -import org.sopt.makers.operation.dto.lecture.request.AttendanceRequestDTO; -import org.sopt.makers.operation.dto.lecture.request.LectureRequestDTO; -import org.sopt.makers.operation.dto.lecture.response.AttendanceResponseDTO; -import org.sopt.makers.operation.dto.lecture.response.LectureDetailResponseDTO; -import org.sopt.makers.operation.dto.lecture.response.LectureResponseDTO; -import org.sopt.makers.operation.dto.lecture.response.LecturesResponseDTO; -import org.sopt.makers.operation.entity.Part; -import org.operation.attendance.Attendance; -import org.operation.attendance.SubAttendance; +import org.operation.attendance.domain.Attendance; +import org.operation.attendance.domain.SubAttendance; +import org.operation.attendance.repository.attendance.AttendanceRepository; +import org.operation.attendance.repository.subAttendance.SubAttendanceRepository; +import org.operation.client.alarm.AlarmSender; +import org.operation.common.config.ValueConfig; +import org.operation.common.domain.Part; +import org.operation.common.exception.LectureException; +import org.operation.common.exception.SubLectureException; import org.operation.lecture.Lecture; import org.operation.lecture.SubLecture; -import org.operation.member.Member; -import org.sopt.makers.operation.exception.LectureException; -import org.sopt.makers.operation.exception.SubLectureException; -import org.sopt.makers.operation.external.alarm.AlarmSender; -import org.sopt.makers.operation.repository.attendance.AttendanceRepository; -import org.sopt.makers.operation.repository.attendance.SubAttendanceRepository; -import org.sopt.makers.operation.repository.lecture.LectureRepository; -import org.sopt.makers.operation.repository.lecture.SubLectureRepository; -import org.sopt.makers.operation.repository.member.MemberRepository; +import org.operation.lecture.repository.lecture.LectureRepository; +import org.operation.lecture.repository.subLecture.SubLectureRepository; +import org.operation.member.domain.Member; +import org.operation.member.repository.MemberRepository; +import org.operation.web.alarm.dto.request.AlarmSenderRequest; +import org.operation.web.lecture.dto.request.AttendanceRequest; +import org.operation.web.lecture.dto.request.LectureRequest; +import org.operation.web.lecture.dto.response.AttendanceResponse; +import org.operation.web.lecture.dto.response.LectureDetailResponse; +import org.operation.web.lecture.dto.response.LectureResponse; +import org.operation.web.lecture.dto.response.LecturesResponse; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -49,7 +49,7 @@ public class LectureServiceImpl implements LectureService { @Override @Transactional - public long createLecture(LectureRequestDTO request) { + public long createLecture(LectureRequest request) { val savedLecture = saveLecture(request); createSubLectures(savedLecture); createAttendance(request.generation(), request.part(), savedLecture); @@ -57,7 +57,7 @@ public long createLecture(LectureRequestDTO request) { return savedLecture.getId(); } - private Lecture saveLecture(LectureRequestDTO request) { + private Lecture saveLecture(LectureRequest request) { val lecture = request.toEntity(); return lectureRepository.save(lecture); } @@ -92,32 +92,32 @@ private void saveSubAttendance(Attendance attendance, SubLecture subLecture) { } @Override - public LecturesResponseDTO getLectures(int generation, Part part) { + public LecturesResponse getLectures(int generation, Part part) { val lectures = lectureRepository.find(generation, part); - return LecturesResponseDTO.of(generation, lectures); + return LecturesResponse.of(generation, lectures); } @Override - public LectureResponseDTO getLecture(long lectureId) { + public LectureResponse getLecture(long lectureId) { Lecture lecture = findLecture(lectureId); - return LectureResponseDTO.of(lecture); + return LectureResponse.of(lecture); } @Override @Transactional - public AttendanceResponseDTO startAttendance(AttendanceRequestDTO requestDTO) { - val lecture = findLecture(requestDTO.lectureId()); - checkStartAttendanceValidity(lecture, requestDTO.round()); - val subLecture = getSubLecture(lecture, requestDTO.round()); - subLecture.startAttendance(requestDTO.code()); - return AttendanceResponseDTO.of(lecture, subLecture); + public AttendanceResponse startAttendance(AttendanceRequest request) { + val lecture = findLecture(request.lectureId()); + checkStartAttendanceValidity(lecture, request.round()); + val subLecture = getSubLecture(lecture, request.round()); + subLecture.startAttendance(request.code()); + return AttendanceResponse.of(lecture, subLecture); } private void checkStartAttendanceValidity(Lecture lecture, int round) { if (lecture.isEnd()) { - throw new LectureException(END_LECTURE.getName()); + throw new LectureException(END_LECTURE.getContent()); } else if (round == 2 && lecture.isBefore()) { - throw new LectureException(NOT_STARTED_PRE_ATTENDANCE.getName()); + throw new LectureException(NOT_STARTED_PRE_ATTENDANCE.getContent()); } } @@ -148,19 +148,19 @@ private void restoreAttendances(List attendances) { } @Override - public LectureDetailResponseDTO getLectureDetail(long lectureId) { + public LectureDetailResponse getLectureDetail(long lectureId) { val lecture = findLecture(lectureId); - return LectureDetailResponseDTO.of(lecture); + return LectureDetailResponse.of(lecture); } private Lecture findLecture(Long id) { return lectureRepository.findById(id) - .orElseThrow(() -> new LectureException(INVALID_LECTURE.getName())); + .orElseThrow(() -> new LectureException(INVALID_LECTURE.getContent())); } private void checkEndLectureValidity(Lecture lecture) { if (!lecture.isEnd()) { - throw new LectureException(NOT_END_TIME_YET.getName()); + throw new LectureException(NOT_END_TIME_YET.getContent()); } } @@ -168,7 +168,7 @@ private void sendAlarm(Lecture lecture) { val alarmTitle = getAlarmTitle(lecture); val alarmContent = valueConfig.getALARM_MESSAGE_CONTENT(); val memberPlaygroundIds = getMemberPlaygroundIds(lecture); - alarmSender.send(new AlarmSenderDTO(alarmTitle, alarmContent, memberPlaygroundIds, NEWS, null)); + alarmSender.send(new AlarmSenderRequest(alarmTitle, alarmContent, memberPlaygroundIds, NEWS, null)); } private List getMemberPlaygroundIds(Lecture lecture) { @@ -186,7 +186,7 @@ private SubLecture getSubLecture(Lecture lecture, int round) { return lecture.getSubLectures().stream() .filter(l -> l.getRound() == round) .findFirst() - .orElseThrow(() -> new SubLectureException(NO_SUB_LECTURE_EQUAL_ROUND.getName())); + .orElseThrow(() -> new SubLectureException(NO_SUB_LECTURE_EQUAL_ROUND.getContent())); } } diff --git a/operation-service/src/main/java/org/operation/web/member/dto/response/AttendanceTotalCountVO.java b/operation-service/src/main/java/org/operation/web/member/dto/response/AttendanceTotalCountVO.java new file mode 100644 index 00000000..f65a63a7 --- /dev/null +++ b/operation-service/src/main/java/org/operation/web/member/dto/response/AttendanceTotalCountVO.java @@ -0,0 +1,17 @@ +package org.operation.web.member.dto.response; + +public record AttendanceTotalCountVO( + int attendance, + int absent, + int tardy, + int participate +) { + public static AttendanceTotalCountVO of(int attendance, int absent, int tardy, int participate){ + return new AttendanceTotalCountVO( + attendance, + absent, + tardy, + participate + ); + } +} diff --git a/operation-service/src/main/java/org/operation/web/member/dto/response/AttendanceTotalVO.java b/operation-service/src/main/java/org/operation/web/member/dto/response/AttendanceTotalVO.java new file mode 100644 index 00000000..b471fe39 --- /dev/null +++ b/operation-service/src/main/java/org/operation/web/member/dto/response/AttendanceTotalVO.java @@ -0,0 +1,32 @@ +package org.operation.web.member.dto.response; + +import java.time.format.DateTimeFormatter; + +import org.operation.attendance.domain.Attendance; +import org.operation.attendance.domain.AttendanceStatus; +import org.operation.lecture.Attribute; + +public record AttendanceTotalVO( + Attribute attribute, + String name, + AttendanceStatus status, + String date +) { + public static AttendanceTotalVO of(Attendance attendance){ + return new AttendanceTotalVO( + attendance.getLecture().getAttribute(), + attendance.getLecture().getName(), + attendance.getStatus(), + attendance.getLecture().getStartDate() + .format(DateTimeFormatter.ofPattern("M월 d일")) + ); + } + + public static AttendanceTotalVO getTotalAttendanceVO(Attendance attendance) { + return AttendanceTotalVO.of(attendance); + } + + public static AttendanceStatus getAttendanceStatus(AttendanceTotalVO attendance) { + return attendance.status(); + } +} diff --git a/operation-service/src/main/java/org/operation/web/member/dto/response/MemberListGetResponse.java b/operation-service/src/main/java/org/operation/web/member/dto/response/MemberListGetResponse.java new file mode 100644 index 00000000..c4afd5d5 --- /dev/null +++ b/operation-service/src/main/java/org/operation/web/member/dto/response/MemberListGetResponse.java @@ -0,0 +1,24 @@ +package org.operation.web.member.dto.response; + +import org.operation.common.domain.Part; +import org.operation.member.domain.Member; + +public record MemberListGetResponse( + Long id, + String name, + String university, + Part part, + float score, + AttendanceTotalCountVO total +) { + public static MemberListGetResponse of(Member member, AttendanceTotalCountVO total){ + return new MemberListGetResponse( + member.getId(), + member.getName(), + member.getUniversity(), + member.getPart(), + member.getScore(), + total + ); + } +} diff --git a/operation-service/src/main/java/org/operation/web/member/dto/response/MembersResponse.java b/operation-service/src/main/java/org/operation/web/member/dto/response/MembersResponse.java new file mode 100644 index 00000000..df23adf6 --- /dev/null +++ b/operation-service/src/main/java/org/operation/web/member/dto/response/MembersResponse.java @@ -0,0 +1,13 @@ +package org.operation.web.member.dto.response; + +import java.util.List; + +public record MembersResponse( + List members, + int totalCount +) { + public static MembersResponse of(List members, int totalCount) { + return new MembersResponse(members, totalCount); + } + +} diff --git a/src/main/java/org/sopt/makers/operation/service/web/member/MemberServiceImpl.java b/operation-service/src/main/java/org/operation/web/member/service/MemberServiceImpl.java similarity index 72% rename from src/main/java/org/sopt/makers/operation/service/web/member/MemberServiceImpl.java rename to operation-service/src/main/java/org/operation/web/member/service/MemberServiceImpl.java index 722e8951..9f1b852c 100644 --- a/src/main/java/org/sopt/makers/operation/service/web/member/MemberServiceImpl.java +++ b/operation-service/src/main/java/org/operation/web/member/service/MemberServiceImpl.java @@ -1,34 +1,35 @@ -package org.sopt.makers.operation.service.web.member; +package org.operation.web.member.service; -import lombok.RequiredArgsConstructor; -import lombok.val; +import java.util.EnumMap; +import java.util.List; -import org.sopt.makers.operation.dto.attendance.response.AttendanceTotalCountVO; -import org.sopt.makers.operation.dto.attendance.response.AttendanceTotalVO; -import org.sopt.makers.operation.dto.member.response.MemberListGetResponse; -import org.sopt.makers.operation.dto.member.response.MemberSearchCondition; -import org.sopt.makers.operation.dto.member.response.MembersResponseDTO; -import org.operation.attendance.AttendanceStatus; -import org.operation.member.Member; -import org.sopt.makers.operation.entity.Part; -import org.sopt.makers.operation.repository.attendance.AttendanceRepository; -import org.sopt.makers.operation.repository.member.MemberRepository; +import org.operation.attendance.domain.AttendanceStatus; +import org.operation.attendance.repository.attendance.AttendanceRepository; +import org.operation.common.domain.Part; +import org.operation.common.dto.MemberSearchCondition; +import org.operation.member.domain.Member; +import org.operation.member.repository.MemberRepository; +import org.operation.web.member.dto.response.AttendanceTotalCountVO; +import org.operation.web.member.dto.response.AttendanceTotalVO; +import org.operation.web.member.dto.response.MemberListGetResponse; +import org.operation.web.member.dto.response.MembersResponse; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.EnumMap; -import java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.val; @Service @RequiredArgsConstructor @Transactional(readOnly = true) public class MemberServiceImpl implements MemberService { + private final MemberRepository memberRepository; private final AttendanceRepository attendanceRepository; @Override - public MembersResponseDTO getMemberList(Part part, int generation, Pageable pageable) { + public MembersResponse getMemberList(Part part, int generation, Pageable pageable) { if (part.equals(Part.ALL)) { part = null; } @@ -42,7 +43,7 @@ public MembersResponseDTO getMemberList(Part part, int generation, Pageable page }).toList(); val membersCount = memberRepository.countByGenerationAndPart(generation, part); - return MembersResponseDTO.of(members, membersCount); + return MembersResponse.of(members, membersCount); } private List findAttendances(Member member) { diff --git a/operation-storage/build.gradle b/operation-storage/build.gradle deleted file mode 100644 index 1ebaba4d..00000000 --- a/operation-storage/build.gradle +++ /dev/null @@ -1,19 +0,0 @@ -plugins { - id 'java' -} - -group = 'org.sopt.makers' -version = '0.0.1-SNAPSHOT' - -repositories { - mavenCentral() -} - -dependencies { - testImplementation platform('org.junit:junit-bom:5.9.1') - testImplementation 'org.junit.jupiter:junit-jupiter' -} - -test { - useJUnitPlatform() -} \ No newline at end of file diff --git a/operation-storage/db-jpa/build.gradle b/operation-storage/db-jpa/build.gradle deleted file mode 100644 index 1ebaba4d..00000000 --- a/operation-storage/db-jpa/build.gradle +++ /dev/null @@ -1,19 +0,0 @@ -plugins { - id 'java' -} - -group = 'org.sopt.makers' -version = '0.0.1-SNAPSHOT' - -repositories { - mavenCentral() -} - -dependencies { - testImplementation platform('org.junit:junit-bom:5.9.1') - testImplementation 'org.junit.jupiter:junit-jupiter' -} - -test { - useJUnitPlatform() -} \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 2988048c..353d1be8 100644 --- a/settings.gradle +++ b/settings.gradle @@ -4,5 +4,5 @@ include 'operation-auth' include 'operation-domain' include 'operation-external' include 'operation-storage' -include 'operation-business' +include 'operation-service' diff --git a/src/main/java/org/sopt/makers/operation/common/ExceptionMessage.java b/src/main/java/org/sopt/makers/operation/common/ExceptionMessage.java deleted file mode 100644 index b9226037..00000000 --- a/src/main/java/org/sopt/makers/operation/common/ExceptionMessage.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.sopt.makers.operation.common; - -import lombok.AllArgsConstructor; -import lombok.Getter; - -@AllArgsConstructor -@Getter -public enum ExceptionMessage { - INVALID_MEMBER("존재하지 않는 회원입니다."), - INVALID_LECTURE("존재하지 않는 세션입니다."), - INVALID_SUB_LECTURE("존재하지 않는 세션입니다."), - INVALID_ATTENDANCE("존재하지 않는 출석 세션입니다."), - INVALID_SUB_ATTENDANCE("존재하지 않는 N차 출석입니다."), - INVALID_TOKEN("유효하지 않은 토큰입니다."), - EXPIRED_TOKEN("만료된 토큰입니다."), - INVALID_SIGNATURE("유효하지 않은 서명입니다."), - INVALID_AUTH_REQUEST("빈 토큰입니다."), - NOT_STARTED_PRE_ATTENDANCE("이전의 출석체크가 시작되지 않았습니다."), - NO_SESSION("오늘 세션이 없습니다."), - NOT_STARTED_ATTENDANCE("출석 시작 전입니다."), - NOT_STARTED_NTH_ATTENDANCE("차 출석 시작 전입니다."), - ENDED_ATTENDANCE("차 출석이 이미 종료되었습니다."), - INVALID_COUNT_SESSION("세션의 개수가 올바르지 않습니다."), - INVALID_CODE("코드가 일치하지 않아요!"), - NOT_END_TIME_YET("세션 종료 시간이 지나지 않았습니다."), - END_LECTURE("이미 종료된 세션입니다."), - NO_SUB_LECTURE_EQUAL_ROUND("해당 라운드와 일치하는 출석 세션이 없습니다."), - FAULT_DATE_FORMATTER("잘못된 날짜 형식입니다."), - DUPLICATED_MEMBER("이미 존재하는 회원입니다."), - INVALID_ALARM("알림이 존재하지 않습니다."), - ALREADY_SEND_ALARM("이미 전송된 알림입니다."), - INVALID_LINK("유효하지 않는 링크입니다."), - FAIL_SEND_ALARM("알림 전송에 실패하였습니다."), - FAIL_INACTIVE_USERS("비활동 유저 불러오기에 실패하였습니다."); - - private final String name; -} diff --git a/src/main/java/org/sopt/makers/operation/common/ResponseMessage.java b/src/main/java/org/sopt/makers/operation/common/ResponseMessage.java deleted file mode 100644 index 59d0d592..00000000 --- a/src/main/java/org/sopt/makers/operation/common/ResponseMessage.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.sopt.makers.operation.common; - - -public enum ResponseMessage { - // - // /** auth **/ - - // - // SUCCESS_CREATE_MEMBER("회원 등록 성공"), - // - // /** attendance **/ - // SUCCESS_UPDATE_ATTENDANCE_STATUS("출석 상태 변경 성공"), - // SUCCESS_GET_MEMBER_ATTENDANCE("회원 출석 정보 조회 성공"), - // SUCCESS_UPDATE_MEMBER_SCORE("회원 출석 점수 갱신 성공"), - // SUCCESS_GET_ATTENDANCES("출석 리스트 조회 성공"), - // - // /** lecture **/ - // SUCCESS_CREATE_LECTURE("세션 생성 성공"), - // SUCCESS_GET_LECTURES("세션 리스트 조회 성공"), - // SUCCESS_GET_LECTURE("세션 상세 조회 성공"), - // SUCCESS_START_ATTENDANCE("출석 시작 성공"), - // SUCCESS_GET_MEMBERS("유저 리스트 조회 성공"), - // SUCCESS_DELETE_LECTURE("세션 삭제 성공"), - // - // /** alarm **/ - // SUCCESS_SEND_ALARM("알림 전송 성공"), - // SUCCESS_CREATE_ALARM("알림 생성 성공"), - // SUCCESS_GET_ALARMS("알림 리스트 조회 성공"), - // SUCCESS_GET_ALARM("알림 상세 조회 성공"), - // SUCCESS_DELETE_ALARM("알림 삭제 성공"), - -} diff --git a/src/main/java/org/sopt/makers/operation/dto/alarm/request/AlarmSendRequestDTO.java b/src/main/java/org/sopt/makers/operation/dto/alarm/request/AlarmSendRequestDTO.java deleted file mode 100644 index 7dee9460..00000000 --- a/src/main/java/org/sopt/makers/operation/dto/alarm/request/AlarmSendRequestDTO.java +++ /dev/null @@ -1,4 +0,0 @@ -package org.sopt.makers.operation.dto.alarm.request; - -public record AlarmSendRequestDTO(Long alarmId) { -} diff --git a/src/main/java/org/sopt/makers/operation/dto/alarm/response/AlarmInactiveListResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/alarm/response/AlarmInactiveListResponseDTO.java deleted file mode 100644 index 86f5f23d..00000000 --- a/src/main/java/org/sopt/makers/operation/dto/alarm/response/AlarmInactiveListResponseDTO.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.sopt.makers.operation.dto.alarm.response; - -import java.util.List; - -public record AlarmInactiveListResponseDTO(List memberIds) { -} diff --git a/src/main/java/org/sopt/makers/operation/dto/alarm/response/AlarmSendResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/alarm/response/AlarmSendResponseDTO.java deleted file mode 100644 index b6e9f3d0..00000000 --- a/src/main/java/org/sopt/makers/operation/dto/alarm/response/AlarmSendResponseDTO.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.sopt.makers.operation.dto.alarm.response; - -public record AlarmSendResponseDTO( - int status, - boolean success, - String message -) { -} \ No newline at end of file diff --git a/src/main/java/org/sopt/makers/operation/dto/attendance/request/SubAttendanceUpdateRequestDTO.java b/src/main/java/org/sopt/makers/operation/dto/attendance/request/SubAttendanceUpdateRequestDTO.java deleted file mode 100644 index d6fee73b..00000000 --- a/src/main/java/org/sopt/makers/operation/dto/attendance/request/SubAttendanceUpdateRequestDTO.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.sopt.makers.operation.dto.attendance.request; - -import org.operation.attendance.AttendanceStatus; - -public record SubAttendanceUpdateRequestDTO( - Long subAttendanceId, - AttendanceStatus status -) { -} diff --git a/src/main/java/org/sopt/makers/operation/dto/attendance/response/AttendResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/attendance/response/AttendResponseDTO.java deleted file mode 100644 index 080b7753..00000000 --- a/src/main/java/org/sopt/makers/operation/dto/attendance/response/AttendResponseDTO.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.sopt.makers.operation.dto.attendance.response; - -public record AttendResponseDTO( - Long subLectureId -) { - public static AttendResponseDTO of(Long subLectureId){ - return new AttendResponseDTO( - subLectureId - ); - } -} diff --git a/src/main/java/org/sopt/makers/operation/dto/attendance/response/AttendanceTotalCountVO.java b/src/main/java/org/sopt/makers/operation/dto/attendance/response/AttendanceTotalCountVO.java deleted file mode 100644 index 0bf0b01b..00000000 --- a/src/main/java/org/sopt/makers/operation/dto/attendance/response/AttendanceTotalCountVO.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.sopt.makers.operation.dto.attendance.response; - -public record AttendanceTotalCountVO( - int attendance, - int absent, - int tardy, - int participate -) { - public static AttendanceTotalCountVO of(int attendance, int absent, int tardy, int participate){ - return new AttendanceTotalCountVO( - attendance, - absent, - tardy, - participate - ); - } -} diff --git a/src/main/java/org/sopt/makers/operation/dto/attendance/response/AttendancesResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/attendance/response/AttendancesResponseDTO.java deleted file mode 100644 index eceaa7b6..00000000 --- a/src/main/java/org/sopt/makers/operation/dto/attendance/response/AttendancesResponseDTO.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.sopt.makers.operation.dto.attendance.response; - -import java.util.List; - -import org.operation.attendance.Attendance; - -public record AttendancesResponseDTO( - List attendances, - int totalCount -) { - public static AttendancesResponseDTO of(List attendances, int totalCount) { - return new AttendancesResponseDTO( - attendances.stream().map(MemberResponseDTO::of).toList(), - totalCount); - } -} diff --git a/src/main/java/org/sopt/makers/operation/dto/attendance/response/SubAttendanceUpdateResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/attendance/response/SubAttendanceUpdateResponseDTO.java deleted file mode 100644 index 34b333d5..00000000 --- a/src/main/java/org/sopt/makers/operation/dto/attendance/response/SubAttendanceUpdateResponseDTO.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.sopt.makers.operation.dto.attendance.response; - -import org.operation.attendance.AttendanceStatus; -import org.operation.attendance.SubAttendance; - -public record SubAttendanceUpdateResponseDTO( - Long subAttendanceId, - AttendanceStatus status -) { - public static SubAttendanceUpdateResponseDTO of(SubAttendance subAttendance) { - return new SubAttendanceUpdateResponseDTO(subAttendance.getId(), subAttendance.getStatus()); - } -} diff --git a/src/main/java/org/sopt/makers/operation/dto/lecture/request/AttendanceRequestDTO.java b/src/main/java/org/sopt/makers/operation/dto/lecture/request/AttendanceRequestDTO.java deleted file mode 100644 index 9319dec9..00000000 --- a/src/main/java/org/sopt/makers/operation/dto/lecture/request/AttendanceRequestDTO.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.sopt.makers.operation.dto.lecture.request; - -public record AttendanceRequestDTO( - Long lectureId, - int round, - String code -) { -} diff --git a/src/main/java/org/sopt/makers/operation/dto/lecture/response/LectureCurrentRoundResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/lecture/response/LectureCurrentRoundResponseDTO.java deleted file mode 100644 index 900247dd..00000000 --- a/src/main/java/org/sopt/makers/operation/dto/lecture/response/LectureCurrentRoundResponseDTO.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.sopt.makers.operation.dto.lecture.response; - -import org.operation.lecture.SubLecture; - -public record LectureCurrentRoundResponseDTO( - Long id, - int round -) { - public static LectureCurrentRoundResponseDTO of(SubLecture subLecture){ - return new LectureCurrentRoundResponseDTO( - subLecture.getId(), - subLecture.getRound() - ); - } -} diff --git a/src/main/java/org/sopt/makers/operation/dto/member/request/MemberRequestDTO.java b/src/main/java/org/sopt/makers/operation/dto/member/request/MemberRequestDTO.java deleted file mode 100644 index b0ec6fcf..00000000 --- a/src/main/java/org/sopt/makers/operation/dto/member/request/MemberRequestDTO.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.sopt.makers.operation.dto.member.request; - -import org.operation.member.ObYb; -import org.sopt.makers.operation.entity.Part; - -public record MemberRequestDTO( - Long playgroundId, - String name, - int generation, - ObYb obyb, - Part part, - String university, - String phone -) { -} diff --git a/src/main/java/org/sopt/makers/operation/dto/member/response/MemberListGetResponse.java b/src/main/java/org/sopt/makers/operation/dto/member/response/MemberListGetResponse.java deleted file mode 100644 index f22161f3..00000000 --- a/src/main/java/org/sopt/makers/operation/dto/member/response/MemberListGetResponse.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.sopt.makers.operation.dto.member.response; - -import org.sopt.makers.operation.dto.attendance.response.AttendanceTotalCountVO; -import org.operation.member.Member; -import org.sopt.makers.operation.entity.Part; - -public record MemberListGetResponse( - Long id, - String name, - String university, - Part part, - float score, - AttendanceTotalCountVO total -) -{ - public static MemberListGetResponse of(Member member, AttendanceTotalCountVO total){ - return new MemberListGetResponse( - member.getId(), - member.getName(), - member.getUniversity(), - member.getPart(), - member.getScore(), - total - ); - } -} diff --git a/src/main/java/org/sopt/makers/operation/dto/member/response/MemberScoreGetResponse.java b/src/main/java/org/sopt/makers/operation/dto/member/response/MemberScoreGetResponse.java deleted file mode 100644 index b308d309..00000000 --- a/src/main/java/org/sopt/makers/operation/dto/member/response/MemberScoreGetResponse.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.sopt.makers.operation.dto.member.response; - -public record MemberScoreGetResponse( - float score -) { - public static MemberScoreGetResponse of(float score){ - return new MemberScoreGetResponse( - score - ); - } -} diff --git a/src/main/java/org/sopt/makers/operation/dto/member/response/MemberSearchCondition.java b/src/main/java/org/sopt/makers/operation/dto/member/response/MemberSearchCondition.java deleted file mode 100644 index f3cbe9d6..00000000 --- a/src/main/java/org/sopt/makers/operation/dto/member/response/MemberSearchCondition.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.sopt.makers.operation.dto.member.response; - -import org.sopt.makers.operation.entity.Part; - -public record MemberSearchCondition(Part part, int generation) { -} diff --git a/src/main/java/org/sopt/makers/operation/dto/member/response/MembersResponseDTO.java b/src/main/java/org/sopt/makers/operation/dto/member/response/MembersResponseDTO.java deleted file mode 100644 index ff90b0b4..00000000 --- a/src/main/java/org/sopt/makers/operation/dto/member/response/MembersResponseDTO.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.sopt.makers.operation.dto.member.response; - -import java.util.List; - -public record MembersResponseDTO( - List members, - int totalCount -) { - public static MembersResponseDTO of(List members, int totalCount) { - return new MembersResponseDTO(members, totalCount); - } -} diff --git a/src/main/java/org/sopt/makers/operation/external/alarm/AlarmSender.java b/src/main/java/org/sopt/makers/operation/external/alarm/AlarmSender.java deleted file mode 100644 index fec5ad40..00000000 --- a/src/main/java/org/sopt/makers/operation/external/alarm/AlarmSender.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.sopt.makers.operation.external.alarm; - -import org.sopt.makers.operation.dto.alarm.request.AlarmSenderDTO; - -public interface AlarmSender { - void send(AlarmSenderDTO alarmSenderDTO); -} diff --git a/src/main/java/org/sopt/makers/operation/external/alarm/AlarmSenderImpl.java b/src/main/java/org/sopt/makers/operation/external/alarm/AlarmSenderImpl.java deleted file mode 100644 index e24783b2..00000000 --- a/src/main/java/org/sopt/makers/operation/external/alarm/AlarmSenderImpl.java +++ /dev/null @@ -1,105 +0,0 @@ -package org.sopt.makers.operation.external.alarm; - -import static java.util.Objects.*; -import static java.util.UUID.*; -import static org.sopt.makers.operation.common.ExceptionMessage.*; -import static org.springframework.http.MediaType.*; - -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.sopt.makers.operation.dto.alarm.response.AlarmSendResponseDTO; -import org.sopt.makers.operation.dto.alarm.request.AlarmSenderDTO; -import org.sopt.makers.operation.exception.AlarmException; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.http.HttpEntity; -import org.springframework.http.HttpHeaders; -import org.springframework.stereotype.Component; -import org.springframework.web.client.HttpClientErrorException; -import org.springframework.web.client.RestTemplate; - -import lombok.RequiredArgsConstructor; -import lombok.val; - -@Component -@RequiredArgsConstructor -public class AlarmSenderImpl implements AlarmSender { - private final RestTemplate restTemplate; - - @Value("${notification.key}") - private String key; - @Value("${notification.url}") - private String host; - - private final List appLinkList = Arrays.asList( - "home", - "home/notification", - "home/mypage", - "home/attendance", - "home/attendance/attendance-modal", - "home/soptamp", - "home/soptamp/entire-ranking", - "home/soptamp/current-generation-ranking" - ); - private final List webLinkList = Arrays.asList( - "https://playground.sopt.org/members", - "https://playground.sopt.org/group" - ); - - @Override - public void send(AlarmSenderDTO alarmSenderDTO) { - val alarmRequest = getAlarmRequest(alarmSenderDTO); - val headers = getHeaders(); - val entity = new HttpEntity<>(alarmRequest, headers); - - try { - restTemplate.postForEntity(host, entity, AlarmSendResponseDTO.class); - } catch (HttpClientErrorException e) { - throw new AlarmException(FAIL_SEND_ALARM.getName()); - } - } - - private Map getAlarmRequest(AlarmSenderDTO alarmSenderDTO) { - val alarmRequest = new HashMap<>(); - val link = alarmSenderDTO.link(); - val linkKey = getLinkKey(link); - - if (!linkKey.isEmpty()) { - alarmRequest.put(linkKey, link); - } - - alarmRequest.put("userIds", alarmSenderDTO.targetList()); - alarmRequest.put("title", alarmSenderDTO.title()); - alarmRequest.put("content", alarmSenderDTO.content()); - alarmRequest.put("category", alarmSenderDTO.attribute()); - - return alarmRequest; - } - - private String getLinkKey(String link) { - if (nonNull(link)) { - if (appLinkList.contains(link)) { - return "appLink"; - } else if (webLinkList.contains(link)) { - return "webLink"; - } - } - return ""; - } - - private HttpHeaders getHeaders() { - val headers = new HttpHeaders(); - - headers.setContentType(APPLICATION_JSON); - headers.setAccept(Collections.singletonList(APPLICATION_JSON)); - headers.add("action", "send"); - headers.add("transactionId", randomUUID().toString()); - headers.add("service", "operation"); - headers.add("x-api-key", key); - - return headers; - } -} diff --git a/src/main/java/org/sopt/makers/operation/external/playground/PlayGroundServer.java b/src/main/java/org/sopt/makers/operation/external/playground/PlayGroundServer.java deleted file mode 100644 index e911fefc..00000000 --- a/src/main/java/org/sopt/makers/operation/external/playground/PlayGroundServer.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.sopt.makers.operation.external.playground; - -import org.sopt.makers.operation.dto.alarm.response.AlarmInactiveListResponseDTO; -import org.sopt.makers.operation.entity.Part; - -public interface PlayGroundServer { - AlarmInactiveListResponseDTO getInactiveMembers(int generation, Part part); -} diff --git a/src/main/java/org/sopt/makers/operation/service/app/attendance/AttendanceService.java b/src/main/java/org/sopt/makers/operation/service/app/attendance/AttendanceService.java deleted file mode 100644 index 2dae3298..00000000 --- a/src/main/java/org/sopt/makers/operation/service/app/attendance/AttendanceService.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.sopt.makers.operation.service.app.attendance; - -import org.sopt.makers.operation.dto.attendance.response.AttendResponseDTO; -import org.springframework.data.domain.Pageable; - -public interface AttendanceService { - AttendResponseDTO attend(Long playGroundId, AttendRequestDTO requestDTO); -} diff --git a/src/main/java/org/sopt/makers/operation/service/app/attendance/AttendanceServiceImpl.java b/src/main/java/org/sopt/makers/operation/service/app/attendance/AttendanceServiceImpl.java deleted file mode 100644 index d05a39ea..00000000 --- a/src/main/java/org/sopt/makers/operation/service/app/attendance/AttendanceServiceImpl.java +++ /dev/null @@ -1,86 +0,0 @@ -package org.sopt.makers.operation.service.app.attendance; - -import static java.util.Objects.*; -import static org.sopt.makers.operation.common.ExceptionMessage.*; - -import java.time.LocalDateTime; - -import org.sopt.makers.operation.config.ValueConfig; -import org.sopt.makers.operation.dto.attendance.response.AttendResponseDTO; -import org.operation.attendance.AttendanceStatus; -import org.sopt.makers.operation.exception.LectureException; -import org.sopt.makers.operation.exception.MemberException; -import org.sopt.makers.operation.exception.SubLectureException; -import org.sopt.makers.operation.repository.attendance.AttendanceRepository; -import org.sopt.makers.operation.repository.lecture.SubLectureRepository; -import org.sopt.makers.operation.repository.member.MemberRepository; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import lombok.val; - -@Slf4j -@Service -@RequiredArgsConstructor -@Transactional(readOnly = true) -public class AttendanceServiceImpl implements AttendanceService { - - private final MemberRepository memberRepository; - private final SubLectureRepository subLectureRepository; - private final AttendanceRepository attendanceRepository; - private final ValueConfig valueConfig; - - @Override - @Transactional - public AttendResponseDTO attend(Long playGroundId, AttendRequestDTO requestDTO) { - log.info("[Attendance: attend start] id: " + playGroundId); - val member = memberRepository.getMemberByPlaygroundIdAndGeneration(playGroundId, valueConfig.getGENERATION()) - .orElseThrow(() -> new MemberException(INVALID_MEMBER.getName())); - - val memberId = member.getId(); - - val now = LocalDateTime.now(); - - val subLecture = subLectureRepository.findById(requestDTO.subLectureId()) - .orElseThrow(() -> new SubLectureException(INVALID_SUB_LECTURE.getName())); - - if (!nonNull(subLecture.getStartAt()) || !nonNull(subLecture.getCode())) { - throw new LectureException(NOT_STARTED_ATTENDANCE.getName()); - } - - val currentRound = subLecture.getRound(); - - if (!subLecture.getCode().equals(requestDTO.code())) { - throw new SubLectureException(INVALID_CODE.getName()); - } - - if (now.isBefore(subLecture.getStartAt())) { - throw new LectureException(subLecture.getRound() + NOT_STARTED_NTH_ATTENDANCE.getName()); - } - - if (now.isAfter(subLecture.getStartAt().plusMinutes(10))) { - throw new LectureException(subLecture.getRound() + ENDED_ATTENDANCE.getName()); - } - - val attendance = attendanceRepository.findAttendanceByLectureIdAndMemberId(subLecture.getLecture().getId(), memberId) - .orElseThrow(() -> new LectureException(INVALID_ATTENDANCE.getName())); - - val currentRoundSubAttendance = attendance.getSubAttendances() - .stream() - .filter(subAttendance -> subAttendance.getSubLecture().getRound() == currentRound) - .findFirst() - .orElseThrow(() -> new SubLectureException(INVALID_SUB_ATTENDANCE.getName())); - - currentRoundSubAttendance.updateStatus(AttendanceStatus.ATTENDANCE); - - log.info("[Attendance:currentRound update] id: " + playGroundId + " subStatus: " + currentRoundSubAttendance.getStatus()); - - attendance.updateStatus(); - - log.info("[Attendance:attendance update] id: " + playGroundId + " subStatus: " + attendance.getStatus()); - - return AttendResponseDTO.of(subLecture.getId()); - } -} diff --git a/src/main/java/org/sopt/makers/operation/service/app/lecture/LectureService.java b/src/main/java/org/sopt/makers/operation/service/app/lecture/LectureService.java deleted file mode 100644 index ade68b23..00000000 --- a/src/main/java/org/sopt/makers/operation/service/app/lecture/LectureService.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.sopt.makers.operation.service.app.lecture; - -import org.sopt.makers.operation.dto.lecture.response.LectureCurrentRoundResponseDTO; -import org.sopt.makers.operation.dto.lecture.response.TodayLectureResponseDTO; - -public interface LectureService { - - TodayLectureResponseDTO getTodayLecture(long memberPlaygroundId); - LectureCurrentRoundResponseDTO getCurrentLectureRound(long lectureId); -} diff --git a/src/main/java/org/sopt/makers/operation/service/app/member/MemberService.java b/src/main/java/org/sopt/makers/operation/service/app/member/MemberService.java deleted file mode 100644 index ff5e10c5..00000000 --- a/src/main/java/org/sopt/makers/operation/service/app/member/MemberService.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.sopt.makers.operation.service.app.member; - -import org.sopt.makers.operation.dto.attendance.response.AttendanceTotalResponseDTO; -import org.sopt.makers.operation.dto.member.response.MemberScoreGetResponse; - -public interface MemberService { - AttendanceTotalResponseDTO getMemberTotalAttendance(Long playGroundId); - MemberScoreGetResponse getMemberScore(Long playGroundId); -} diff --git a/src/main/java/org/sopt/makers/operation/service/web/alarm/AlarmService.java b/src/main/java/org/sopt/makers/operation/service/web/alarm/AlarmService.java deleted file mode 100644 index 3c6b3a98..00000000 --- a/src/main/java/org/sopt/makers/operation/service/web/alarm/AlarmService.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.sopt.makers.operation.service.web.alarm; - -import org.sopt.makers.operation.dto.alarm.request.AlarmSendRequestDTO; - -import org.sopt.makers.operation.dto.alarm.request.AlarmRequestDTO; -import org.sopt.makers.operation.dto.alarm.response.AlarmResponseDTO; -import org.sopt.makers.operation.dto.alarm.response.AlarmsResponseDTO; -import org.sopt.makers.operation.entity.Part; -import org.operation.alarm.Status; -import org.springframework.data.domain.Pageable; - -public interface AlarmService { - void sendByAdmin(AlarmSendRequestDTO requestDTO); - Long createAlarm(AlarmRequestDTO requestDTO); - AlarmsResponseDTO getAlarms(Integer generation, Part part, Status status, Pageable pageable); - AlarmResponseDTO getAlarm(Long alarmId); - void deleteAlarm(Long alarmId); -} diff --git a/src/main/java/org/sopt/makers/operation/service/web/attendance/AttendanceService.java b/src/main/java/org/sopt/makers/operation/service/web/attendance/AttendanceService.java deleted file mode 100644 index 3010bb44..00000000 --- a/src/main/java/org/sopt/makers/operation/service/web/attendance/AttendanceService.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.sopt.makers.operation.service.web.attendance; - -import org.sopt.makers.operation.dto.attendance.request.SubAttendanceUpdateRequestDTO; -import org.sopt.makers.operation.dto.attendance.response.AttendanceMemberResponseDTO; -import org.sopt.makers.operation.dto.attendance.response.AttendancesResponseDTO; -import org.sopt.makers.operation.dto.attendance.response.SubAttendanceUpdateResponseDTO; -import org.sopt.makers.operation.entity.Part; -import org.springframework.data.domain.Pageable; - -public interface AttendanceService { - SubAttendanceUpdateResponseDTO updateSubAttendance(SubAttendanceUpdateRequestDTO requestDTO); - AttendanceMemberResponseDTO findAttendancesByMember(Long memberId); - float updateMemberScore(Long memberId); - AttendancesResponseDTO findAttendancesByLecture(Long lectureId, Part part, Pageable pageable); -} diff --git a/src/main/java/org/sopt/makers/operation/service/web/attendance/AttendanceServiceImpl.java b/src/main/java/org/sopt/makers/operation/service/web/attendance/AttendanceServiceImpl.java deleted file mode 100644 index bcd5c2bb..00000000 --- a/src/main/java/org/sopt/makers/operation/service/web/attendance/AttendanceServiceImpl.java +++ /dev/null @@ -1,75 +0,0 @@ -package org.sopt.makers.operation.service.web.attendance; - -import static org.sopt.makers.operation.common.ExceptionMessage.*; - -import org.sopt.makers.operation.dto.attendance.request.SubAttendanceUpdateRequestDTO; -import org.sopt.makers.operation.dto.attendance.response.AttendanceMemberResponseDTO; -import org.sopt.makers.operation.dto.attendance.response.AttendancesResponseDTO; -import org.sopt.makers.operation.dto.attendance.response.SubAttendanceUpdateResponseDTO; -import org.sopt.makers.operation.entity.Part; -import org.operation.attendance.SubAttendance; -import org.operation.member.Member; -import org.sopt.makers.operation.exception.LectureException; -import org.sopt.makers.operation.exception.MemberException; -import org.sopt.makers.operation.repository.attendance.AttendanceRepository; -import org.sopt.makers.operation.repository.attendance.SubAttendanceRepository; -import org.sopt.makers.operation.repository.member.MemberRepository; -import org.springframework.data.domain.Pageable; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import lombok.val; - -@Slf4j -@Service -@RequiredArgsConstructor -@Transactional(readOnly = true) -public class AttendanceServiceImpl implements AttendanceService { - - private final SubAttendanceRepository subAttendanceRepository; - private final MemberRepository memberRepository; - private final AttendanceRepository attendanceRepository; - - @Override - @Transactional - public SubAttendanceUpdateResponseDTO updateSubAttendance(SubAttendanceUpdateRequestDTO requestDTO) { - val subAttendance = findSubAttendance(requestDTO.subAttendanceId()); - subAttendance.updateStatus(requestDTO.status()); - return SubAttendanceUpdateResponseDTO.of(subAttendance); - } - - @Override - public AttendanceMemberResponseDTO findAttendancesByMember(Long memberId) { - val member = findMember(memberId); - val attendances = attendanceRepository.findByMember(member); - return AttendanceMemberResponseDTO.of(member, attendances); - } - - @Override - @Transactional - public float updateMemberScore(Long memberId) { - Member member = memberRepository.find(memberId) - .orElseThrow(() -> new MemberException(INVALID_MEMBER.getName())); - member.updateTotalScore(); - return member.getScore(); - } - - @Override - public AttendancesResponseDTO findAttendancesByLecture(Long lectureId, Part part, Pageable pageable) { - val attendances = attendanceRepository.findByLecture(lectureId, part, pageable); - val attendancesCount = attendanceRepository.countByLectureIdAndPart(lectureId, part); - return AttendancesResponseDTO.of(attendances, attendancesCount); - } - - private Member findMember(Long id) { - return memberRepository.findById(id) - .orElseThrow(() -> new MemberException(INVALID_MEMBER.getName())); - } - - private SubAttendance findSubAttendance(Long id) { - return subAttendanceRepository.findById(id) - .orElseThrow(() -> new LectureException(INVALID_ATTENDANCE.getName())); - } -} diff --git a/src/main/java/org/sopt/makers/operation/service/web/lecture/LectureService.java b/src/main/java/org/sopt/makers/operation/service/web/lecture/LectureService.java deleted file mode 100644 index 59e819c6..00000000 --- a/src/main/java/org/sopt/makers/operation/service/web/lecture/LectureService.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.sopt.makers.operation.service.web.lecture; - -import org.sopt.makers.operation.dto.lecture.request.AttendanceRequestDTO; -import org.sopt.makers.operation.dto.lecture.request.LectureRequestDTO; -import org.sopt.makers.operation.dto.lecture.response.AttendanceResponseDTO; -import org.sopt.makers.operation.dto.lecture.response.LectureDetailResponseDTO; -import org.sopt.makers.operation.dto.lecture.response.LectureResponseDTO; -import org.sopt.makers.operation.dto.lecture.response.LecturesResponseDTO; -import org.sopt.makers.operation.entity.Part; - -public interface LectureService { - - /** WEB **/ - long createLecture(LectureRequestDTO requestDTO); - LecturesResponseDTO getLectures(int generation, Part part); - LectureResponseDTO getLecture(long lectureId); - AttendanceResponseDTO startAttendance(AttendanceRequestDTO requestDTO); - void endLecture(Long lectureId); - void deleteLecture(Long lectureId); - LectureDetailResponseDTO getLectureDetail(long lectureId); -} diff --git a/src/main/java/org/sopt/makers/operation/service/web/member/MemberService.java b/src/main/java/org/sopt/makers/operation/service/web/member/MemberService.java deleted file mode 100644 index d7985148..00000000 --- a/src/main/java/org/sopt/makers/operation/service/web/member/MemberService.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.sopt.makers.operation.service.web.member; - -import org.sopt.makers.operation.dto.member.response.MembersResponseDTO; -import org.sopt.makers.operation.entity.Part; -import org.springframework.data.domain.Pageable; - -public interface MemberService { - MembersResponseDTO getMemberList(Part part, int generation, Pageable pageable); -} diff --git a/src/test/java/org/sopt/makers/operation/OperationServerApplicationTests.java b/src/test/java/org/sopt/makers/operation/OperationServerApplicationTests.java deleted file mode 100644 index 88d23c80..00000000 --- a/src/test/java/org/sopt/makers/operation/OperationServerApplicationTests.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.sopt.makers.operation; - -import org.junit.jupiter.api.Test; -import org.springframework.boot.test.context.SpringBootTest; - -@SpringBootTest -class OperationServerApplicationTests { - -} diff --git a/src/test/java/org/sopt/makers/operation/controller/web/LectureControllerTest.java b/src/test/java/org/sopt/makers/operation/controller/web/LectureControllerTest.java deleted file mode 100644 index 08848629..00000000 --- a/src/test/java/org/sopt/makers/operation/controller/web/LectureControllerTest.java +++ /dev/null @@ -1,159 +0,0 @@ -package org.sopt.makers.operation.controller.web; - -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.junit.jupiter.MockitoExtension; -import org.sopt.makers.operation.dto.lecture.request.AttendanceRequestDTO; -import org.sopt.makers.operation.dto.lecture.response.AttendanceResponseDTO; -import org.sopt.makers.operation.dto.lecture.response.LectureDetailResponseDTO; -import org.sopt.makers.operation.dto.lecture.request.LectureRequestDTO; -import org.sopt.makers.operation.dto.lecture.response.LectureResponseDTO; -import org.sopt.makers.operation.dto.lecture.response.LecturesResponseDTO; -import org.sopt.makers.operation.service.web.lecture.LectureService; -import org.springframework.http.MediaType; -import org.springframework.test.web.servlet.MockMvc; -import org.springframework.test.web.servlet.ResultActions; -import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; -import org.springframework.test.web.servlet.setup.MockMvcBuilders; -import org.springframework.util.LinkedMultiValueMap; -import org.springframework.util.MultiValueMap; - -import static org.mockito.Mockito.*; -import static org.sopt.makers.operation.fixture.LectureFixture.*; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; - -import com.google.gson.Gson; - -@ExtendWith(MockitoExtension.class) -class LectureControllerTest { - - @InjectMocks - private LectureController lectureController; - - @Mock - private LectureService lectureService; - - private MockMvc mockMvc; - - private final String DEFAULT_URI = "/api/v1/lectures"; - - @BeforeEach - public void init() { - mockMvc = MockMvcBuilders.standaloneSetup(lectureController).build(); - } - - @DisplayName("세션 생성 성공") - @Test - void success_createLecture() throws Exception { - // given - LectureRequestDTO request = lectureRequest(); - long response = lectureId(); - - doReturn(response).when(lectureService).createLecture(any()); - - // when - ResultActions resultActions = mockMvc.perform( - MockMvcRequestBuilders.post(DEFAULT_URI) - .contentType(MediaType.APPLICATION_JSON) - .content(new Gson().toJson(request))); - - // then - resultActions.andExpect(status().isCreated()); - } - - @DisplayName("세션 목록 조회 성공") - @Test - void success_getLectureList() throws Exception { - // given - LecturesResponseDTO response = lecturesResponse(); - MultiValueMap queries = new LinkedMultiValueMap<>(); - queries.add("generation", String.valueOf(LECTURE_GENERATION)); - - doReturn(response).when(lectureService).getLectures(anyInt(), any()); - - // when - ResultActions resultActions = mockMvc.perform( - MockMvcRequestBuilders.get(DEFAULT_URI) - .queryParams(queries)); - - // then - resultActions.andExpect(status().isOk()); - } - - @DisplayName("세션 단일 조회 성공") - @Test - void success_getLecture() throws Exception { - // given - LectureResponseDTO response = lectureResponse(); - - doReturn(response).when(lectureService).getLecture(anyLong()); - - // when - ResultActions resultActions = mockMvc.perform( - MockMvcRequestBuilders.get(DEFAULT_URI + "/{lectureId}", anyLong())); - - // then - resultActions.andExpect(status().isOk()); - } - - @DisplayName("출석 시작 성공") - @Test - void success_startAttendance() throws Exception { - // given - AttendanceRequestDTO request = attendanceRequest(); - AttendanceResponseDTO response = attendanceResponse(); - - doReturn(response).when(lectureService).startAttendance(any()); - - // when - ResultActions resultActions = mockMvc.perform( - MockMvcRequestBuilders.patch(DEFAULT_URI + "/attendance") - .contentType(MediaType.APPLICATION_JSON) - .content(new Gson().toJson(request))); - - // then - resultActions.andExpect(status().isCreated()); - } - - @DisplayName("출석 종료 성공") - @Test - void success_finishLecture() throws Exception { - // when - ResultActions resultActions = mockMvc.perform( - MockMvcRequestBuilders.patch(DEFAULT_URI + "/{lectureId}", anyLong())); - - // then - resultActions.andExpect(status().isOk()); - } - - @DisplayName("세션 삭제 성공") - @Test - void success_deleteLecture() throws Exception { - // when - ResultActions resultActions = mockMvc.perform( - MockMvcRequestBuilders.delete(DEFAULT_URI + "/{lectureId}", anyLong())); - - // then - resultActions.andExpect(status().isOk()); - } - - @DisplayName("세션 상세 조회 성공") - @Test - void success_getLectureDetail() throws Exception { - // given - LectureDetailResponseDTO response = lectureDetail(); - - doReturn(response).when(lectureService).getLectureDetail(anyLong()); - - // when - ResultActions resultActions = mockMvc.perform( - MockMvcRequestBuilders.get(DEFAULT_URI + "/detail/{lectureId}", anyLong())); - - // then - resultActions.andExpect(status().isOk()); - } -} \ No newline at end of file diff --git a/src/test/java/org/sopt/makers/operation/fixture/LectureFixture.java b/src/test/java/org/sopt/makers/operation/fixture/LectureFixture.java deleted file mode 100644 index b0ee79fd..00000000 --- a/src/test/java/org/sopt/makers/operation/fixture/LectureFixture.java +++ /dev/null @@ -1,145 +0,0 @@ -package org.sopt.makers.operation.fixture; - -import java.time.LocalDateTime; -import java.util.List; -import java.util.stream.Stream; - -import org.sopt.makers.operation.dto.lecture.request.AttendanceRequestDTO; -import org.sopt.makers.operation.dto.lecture.response.AttendanceResponseDTO; -import org.sopt.makers.operation.dto.lecture.response.AttendancesStatusVO; -import org.sopt.makers.operation.dto.lecture.response.LectureDetailResponseDTO; -import org.sopt.makers.operation.dto.lecture.request.LectureRequestDTO; -import org.sopt.makers.operation.dto.lecture.response.LectureResponseDTO; -import org.sopt.makers.operation.dto.lecture.response.LectureResponseDTO.SubLectureVO; -import org.sopt.makers.operation.dto.lecture.response.LecturesResponseDTO; -import org.sopt.makers.operation.dto.lecture.response.LecturesResponseDTO.LectureVO; -import org.sopt.makers.operation.entity.Part; -import org.operation.lecture.SubLecture; -import org.operation.lecture.Attribute; -import org.operation.lecture.Lecture; -import org.operation.lecture.LectureStatus; - -public class LectureFixture { - - public static final String LECTURE_NAME = "테스트 이름"; - public static final Part LECTURE_PART = Part.ALL; - public static final int LECTURE_GENERATION = 30; - public static final String LECTURE_PLACE = "테스트 장소"; - public static final LocalDateTime NOW = LocalDateTime.now(); - public static final Attribute LECTURE_ATTRIBUTE = Attribute.ETC; - public static final LectureStatus LECTURE_STATUS = LectureStatus.BEFORE; - public static final int LIST_SIZE = 5; - public static final String SUB_LECTURE_CODE = "code"; - - public static LectureRequestDTO lectureRequest() { - return LectureRequestDTO.builder() - .part(LECTURE_PART) - .name(LECTURE_NAME) - .generation(LECTURE_GENERATION) - .place(LECTURE_PLACE) - .startDate(NOW.toString()) - .endDate(NOW.plusHours(4).toString()) - .attribute(LECTURE_ATTRIBUTE) - .build(); - } - - public static Lecture lectureEnd() { - Lecture lecture = lectureRequest().toEntity(); - lecture.updateToEnd(); - return lecture; - } - - public static long lectureId() { - return 0L; - } - - public static LecturesResponseDTO lecturesResponse() { - return new LecturesResponseDTO(LECTURE_GENERATION, lectures()); - } - - private static List lectures() { - return Stream.iterate(1, i -> i + 1).limit(LIST_SIZE) - .map(LectureFixture::lecture).toList(); - } - - private static LectureVO lecture(int i) { - return LectureVO.builder() - .lectureId(0L) - .name(LECTURE_NAME + i) - .partValue(Part.ALL) - .partName(Part.ALL.getName()) - .startDate(NOW.plusHours(i).toString()) - .endDate(NOW.plusHours(i + 4).toString()) - .attributeValue(LECTURE_ATTRIBUTE) - .attributeName(LECTURE_ATTRIBUTE.getName()) - .place(LECTURE_PLACE + i) - .attendances(attendancesStatus()) - .build(); - } - - public static LectureResponseDTO lectureResponse() { - return LectureResponseDTO.builder() - .lectureId(0L) - .name(LECTURE_NAME) - .generation(LECTURE_GENERATION) - .part(LECTURE_PART) - .attribute(LECTURE_ATTRIBUTE) - .subLectures(subLectures()) - .attendances(attendancesStatus()) - .status(LECTURE_STATUS) - .build(); - } - - private static AttendancesStatusVO attendancesStatus() { - return AttendancesStatusVO.builder() - .attendance(80) - .absent(0) - .tardy(10) - .unknown(10) - .build(); - } - - private static List subLectures() { - return Stream.iterate(1, i -> i + 1).limit(LIST_SIZE) - .map(LectureFixture::subLecture).toList(); - } - - private static SubLectureVO subLecture(int i) { - return SubLectureVO.builder() - .subLectureId((long)i) - .round(i % 2) - .startAt(NOW.toString()) - .code(SUB_LECTURE_CODE) - .build(); - } - - public static AttendanceResponseDTO attendanceResponse() { - return new AttendanceResponseDTO(0L, 0L); - } - - public static AttendanceRequestDTO attendanceRequest() { - return new AttendanceRequestDTO(0L, 1, SUB_LECTURE_CODE); - } - - public static LectureDetailResponseDTO lectureDetail() { - return LectureDetailResponseDTO.builder() - .lectureId(0L) - .part(LECTURE_PART.getName()) - .name(LECTURE_NAME) - .place(LECTURE_PLACE) - .attribute(LECTURE_ATTRIBUTE.getName()) - .startDate(NOW.toString()) - .endDate(NOW.plusHours(4).toString()) - .generation(LECTURE_GENERATION) - .build(); - } - - public static List lectureList() { - return Stream.iterate(1, i -> i + 1).limit(LIST_SIZE) - .map(i -> lectureRequest().toEntity()).toList(); - } - - public static SubLecture subLecture(Lecture lecture) { - return new SubLecture(lecture, 1); - } -} diff --git a/src/test/java/org/sopt/makers/operation/service/web/LectureServiceImplTest.java b/src/test/java/org/sopt/makers/operation/service/web/LectureServiceImplTest.java deleted file mode 100644 index f960d735..00000000 --- a/src/test/java/org/sopt/makers/operation/service/web/LectureServiceImplTest.java +++ /dev/null @@ -1,112 +0,0 @@ -package org.sopt.makers.operation.service.web; - -import static org.hamcrest.MatcherAssert.*; -import static org.hamcrest.Matchers.*; -import static org.sopt.makers.operation.fixture.LectureFixture.*; - -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.junit.jupiter.MockitoExtension; -import org.sopt.makers.operation.config.ValueConfig; -import org.sopt.makers.operation.dto.lecture.request.AttendanceRequestDTO; -import org.sopt.makers.operation.dto.lecture.response.LectureResponseDTO; -import org.sopt.makers.operation.dto.lecture.response.LecturesResponseDTO; -import org.operation.lecture.Lecture; -import org.sopt.makers.operation.external.alarm.AlarmSender; -import org.sopt.makers.operation.repository.lecture.LectureRepository; -import org.sopt.makers.operation.repository.member.MemberRepository; -import org.sopt.makers.operation.service.web.lecture.LectureServiceImpl; - -import static org.mockito.Mockito.*; - -import java.util.Optional; - -@ExtendWith(MockitoExtension.class) -class LectureServiceImplTest { - - @InjectMocks - LectureServiceImpl lectureService; - - @Mock - private LectureRepository lectureRepository; - @Mock - private MemberRepository memberRepository; - @Mock - private AlarmSender alarmSender; - @Mock - ValueConfig valueConfig; - - @DisplayName("세션 목록 조회") - @Test - void getLectures() { - // given - doReturn(lectureList()).when(lectureRepository).find(anyInt(), any()); - - // when - LecturesResponseDTO response = lectureService.getLectures(LECTURE_GENERATION, LECTURE_PART); - - // then - assertThat(response.lectures().size(), is(equalTo(LIST_SIZE))); - - // verify - verify(lectureRepository, times(1)).find(anyInt(), any()); - } - - @DisplayName("세션 단건 조회") - @Test - void getLecture() { - // given - Lecture lecture = lectureRequest().toEntity(); - long lectureId = lectureId(); - - doReturn(Optional.of(lecture)).when(lectureRepository).findById(anyLong()); - - // when - LectureResponseDTO response = lectureService.getLecture(lectureId); - - // then - assertThat(response.name(), is(equalTo(lecture.getName()))); - assertThat(response.generation(), is(equalTo(lecture.getGeneration()))); - assertThat(response.part(), is(equalTo(lecture.getPart()))); - assertThat(response.attribute(), is(equalTo(lecture.getAttribute()))); - - // verify - verify(lectureRepository, times(1)).findById(anyLong()); - } - - @DisplayName("출석 시작") - @Test - void startAttendance() { - // given - Lecture lecture = lectureRequest().toEntity(); - subLecture(lecture); - AttendanceRequestDTO request = attendanceRequest(); - - doReturn(Optional.of(lecture)).when(lectureRepository).findById(anyLong()); - - // when - lectureService.startAttendance(request); - - // verify - verify(lectureRepository, times(1)).findById(anyLong()); - } - - @DisplayName("세션 종료") - @Test - void endLecture() { - // given - long lectureId = lectureId(); - Lecture lecture = lectureEnd(); - - doReturn(Optional.of(lecture)).when(lectureRepository).findById(anyLong()); - - // when - lectureService.endLecture(lectureId); - - // verify - verify(lectureRepository, times(1)).findById(anyLong()); - } -} \ No newline at end of file From e581301a13cec91a26574eafa4924e04bed3929a Mon Sep 17 00:00:00 2001 From: dragontaek-lee Date: Sun, 4 Feb 2024 21:05:36 +0900 Subject: [PATCH 047/141] =?UTF-8?q?[FEAT]=20dependencies=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- operation-api/build.gradle | 2 ++ operation-auth/build.gradle | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/operation-api/build.gradle b/operation-api/build.gradle index 6b6e0471..1ff018b4 100644 --- a/operation-api/build.gradle +++ b/operation-api/build.gradle @@ -8,7 +8,9 @@ tasks.named('jar') { dependencies { implementation project(path: ':operation-domain') + implementation project(path: ':operation-auth') implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.0.2' + implementation 'org.springframework.boot:spring-boot-starter-security' } diff --git a/operation-auth/build.gradle b/operation-auth/build.gradle index 8fcc6037..ce6b9e29 100644 --- a/operation-auth/build.gradle +++ b/operation-auth/build.gradle @@ -11,6 +11,10 @@ dependencies { // jwt implementation group: 'io.jsonwebtoken', name: 'jjwt-api', version: '0.11.2' + implementation group: 'javax.xml.bind', name: 'jaxb-api', version: '2.1' runtimeOnly group: 'io.jsonwebtoken', name: 'jjwt-impl', version: '0.11.2' runtimeOnly group: 'io.jsonwebtoken', name: 'jjwt-jackson', version: '0.11.2' + + implementation 'org.springframework.boot:spring-boot-starter-web' + } \ No newline at end of file From d3f1cf23f1b945ab49924c019ed074cc217b55fa Mon Sep 17 00:00:00 2001 From: dragontaek-lee Date: Sun, 4 Feb 2024 21:06:53 +0900 Subject: [PATCH 048/141] =?UTF-8?q?[FEAT]=20auth=20=EB=AA=A8=EB=93=88=20?= =?UTF-8?q?=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../authentication}/AdminAuthentication.java | 4 +-- .../operation/config/SecurityConfig.java | 19 +++++------ .../filter}/JwtAuthenticationFilter.java | 8 ++--- .../operation/filter}/JwtExceptionFilter.java | 26 +++++++------- .../operation}/jwt/JwtTokenProvider.java | 34 +++++++------------ .../makers/operation}/jwt/JwtTokenType.java | 2 +- 6 files changed, 40 insertions(+), 53 deletions(-) rename {src/main/java/org/sopt/makers/operation/security => operation-auth/src/main/java/org/sopt/makers/operation/authentication}/AdminAuthentication.java (89%) rename {src => operation-auth/src}/main/java/org/sopt/makers/operation/config/SecurityConfig.java (82%) rename {src/main/java/org/sopt/makers/operation/security/jwt => operation-auth/src/main/java/org/sopt/makers/operation/filter}/JwtAuthenticationFilter.java (87%) rename {src/main/java/org/sopt/makers/operation/security/jwt => operation-auth/src/main/java/org/sopt/makers/operation/filter}/JwtExceptionFilter.java (51%) rename {src/main/java/org/sopt/makers/operation/security => operation-auth/src/main/java/org/sopt/makers/operation}/jwt/JwtTokenProvider.java (79%) rename {src/main/java/org/sopt/makers/operation/security => operation-auth/src/main/java/org/sopt/makers/operation}/jwt/JwtTokenType.java (62%) diff --git a/src/main/java/org/sopt/makers/operation/security/AdminAuthentication.java b/operation-auth/src/main/java/org/sopt/makers/operation/authentication/AdminAuthentication.java similarity index 89% rename from src/main/java/org/sopt/makers/operation/security/AdminAuthentication.java rename to operation-auth/src/main/java/org/sopt/makers/operation/authentication/AdminAuthentication.java index 2385c90e..bfbca60a 100644 --- a/src/main/java/org/sopt/makers/operation/security/AdminAuthentication.java +++ b/operation-auth/src/main/java/org/sopt/makers/operation/authentication/AdminAuthentication.java @@ -1,11 +1,11 @@ -package org.sopt.makers.operation.security; +package org.sopt.makers.operation.authentication; + import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.GrantedAuthority; import java.util.Collection; public class AdminAuthentication extends UsernamePasswordAuthenticationToken { - public AdminAuthentication(Object principal, Object credentials, Collection authorities) { super(principal, credentials, authorities); } diff --git a/src/main/java/org/sopt/makers/operation/config/SecurityConfig.java b/operation-auth/src/main/java/org/sopt/makers/operation/config/SecurityConfig.java similarity index 82% rename from src/main/java/org/sopt/makers/operation/config/SecurityConfig.java rename to operation-auth/src/main/java/org/sopt/makers/operation/config/SecurityConfig.java index 57f051d1..d69ab4e6 100644 --- a/src/main/java/org/sopt/makers/operation/config/SecurityConfig.java +++ b/operation-auth/src/main/java/org/sopt/makers/operation/config/SecurityConfig.java @@ -2,10 +2,8 @@ import lombok.RequiredArgsConstructor; import lombok.val; - -import org.sopt.makers.operation.config.ValueConfig; -import org.sopt.makers.operation.security.jwt.JwtAuthenticationFilter; -import org.sopt.makers.operation.security.jwt.JwtExceptionFilter; +import org.sopt.makers.operation.filter.JwtAuthenticationFilter; +import org.sopt.makers.operation.filter.JwtExceptionFilter; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Profile; @@ -26,7 +24,7 @@ public class SecurityConfig { private final JwtAuthenticationFilter jwtAuthenticationFilter; private final JwtExceptionFilter jwtExceptionFilter; - private final ValueConfig valueConfig; + //private final ValueConfig valueConfig; @Bean public static PasswordEncoder passwordEncoder() { @@ -37,7 +35,7 @@ public static PasswordEncoder passwordEncoder() { @Profile("dev") public SecurityFilterChain filterChainDev(HttpSecurity http) throws Exception { setHttp(http); - http.authorizeRequests().antMatchers(valueConfig.getSWAGGER_URI()).permitAll(); + http.authorizeRequests().antMatchers("/swagger-ui/**").permitAll(); return http.build(); } @@ -45,10 +43,9 @@ public SecurityFilterChain filterChainDev(HttpSecurity http) throws Exception { @Profile("prod") public SecurityFilterChain filterChainProd(HttpSecurity http) throws Exception { setHttp(http); - http.authorizeRequests().antMatchers(valueConfig.getSWAGGER_URI()).authenticated(); + http.authorizeRequests().antMatchers("/swagger-ui/**").authenticated(); return http.build(); } - private void setHttp(HttpSecurity http) throws Exception { http.antMatcher("/**") .httpBasic().disable() @@ -72,9 +69,9 @@ private void setHttp(HttpSecurity http) throws Exception { public CorsConfigurationSource corsConfigurationSource() { val configuration = new CorsConfiguration(); - configuration.addAllowedOrigin(valueConfig.getADMIN_PROD_URL()); - configuration.addAllowedOrigin(valueConfig.getADMIN_DEV_URL()); - configuration.addAllowedOrigin(valueConfig.getADMIN_LOCAL_URL()); + //configuration.addAllowedOrigin(valueConfig.getADMIN_PROD_URL()); + //configuration.addAllowedOrigin(valueConfig.getADMIN_DEV_URL()); + //configuration.addAllowedOrigin(valueConfig.getADMIN_LOCAL_URL()); configuration.addAllowedHeader("*"); configuration.addAllowedMethod("*"); configuration.setAllowCredentials(true); diff --git a/src/main/java/org/sopt/makers/operation/security/jwt/JwtAuthenticationFilter.java b/operation-auth/src/main/java/org/sopt/makers/operation/filter/JwtAuthenticationFilter.java similarity index 87% rename from src/main/java/org/sopt/makers/operation/security/jwt/JwtAuthenticationFilter.java rename to operation-auth/src/main/java/org/sopt/makers/operation/filter/JwtAuthenticationFilter.java index 064af05a..7221d217 100644 --- a/src/main/java/org/sopt/makers/operation/security/jwt/JwtAuthenticationFilter.java +++ b/operation-auth/src/main/java/org/sopt/makers/operation/filter/JwtAuthenticationFilter.java @@ -1,9 +1,9 @@ -package org.sopt.makers.operation.security.jwt; +package org.sopt.makers.operation.filter; import lombok.RequiredArgsConstructor; import lombok.val; -import org.sopt.makers.operation.common.ExceptionMessage; -import org.sopt.makers.operation.exception.TokenException; +import org.sopt.makers.operation.jwt.JwtTokenProvider; +import org.sopt.makers.operation.jwt.JwtTokenType; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.web.authentication.WebAuthenticationDetailsSource; @@ -42,7 +42,7 @@ public void doFilterInternal(HttpServletRequest request, HttpServletResponse res private void checkJwtAvailable (String token, JwtTokenType jwtTokenType) { if (token == null || !jwtTokenProvider.validateTokenExpiration(token, jwtTokenType)) { - throw new TokenException(ExceptionMessage.INVALID_AUTH_REQUEST.getName()); + throw new IllegalArgumentException("빈 토큰입니다."); } } diff --git a/src/main/java/org/sopt/makers/operation/security/jwt/JwtExceptionFilter.java b/operation-auth/src/main/java/org/sopt/makers/operation/filter/JwtExceptionFilter.java similarity index 51% rename from src/main/java/org/sopt/makers/operation/security/jwt/JwtExceptionFilter.java rename to operation-auth/src/main/java/org/sopt/makers/operation/filter/JwtExceptionFilter.java index b398b3ab..1e1cb0ae 100644 --- a/src/main/java/org/sopt/makers/operation/security/jwt/JwtExceptionFilter.java +++ b/operation-auth/src/main/java/org/sopt/makers/operation/filter/JwtExceptionFilter.java @@ -1,7 +1,5 @@ -package org.sopt.makers.operation.security.jwt; +package org.sopt.makers.operation.filter; -import org.sopt.makers.operation.dto.ResponseDTO; -import org.sopt.makers.operation.exception.TokenException; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.stereotype.Component; @@ -24,16 +22,16 @@ protected void doFilterInternal(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, FilterChain filterChain ) throws ServletException, IOException { - try { - filterChain.doFilter(httpServletRequest, httpServletResponse); - } catch(TokenException e) { - val objectMapper = new ObjectMapper(); - val jsonResponse = objectMapper.writeValueAsString(ResponseDTO.fail(e.getMessage())); - - httpServletResponse.setStatus(HttpStatus.UNAUTHORIZED.value()); - httpServletResponse.setContentType(MediaType.APPLICATION_JSON_VALUE); - httpServletResponse.setCharacterEncoding("UTF-8"); - httpServletResponse.getWriter().write(jsonResponse); - } +// try { +// filterChain.doFilter(httpServletRequest, httpServletResponse); +// } catch(TokenException e) { +// val objectMapper = new ObjectMapper(); +// //val jsonResponse = objectMapper.writeValueAsString(ResponseDTO.fail(e.getMessage())); +// +// httpServletResponse.setStatus(HttpStatus.UNAUTHORIZED.value()); +// httpServletResponse.setContentType(MediaType.APPLICATION_JSON_VALUE); +// httpServletResponse.setCharacterEncoding("UTF-8"); +// //httpServletResponse.getWriter().write(jsonResponse); +// } } } \ No newline at end of file diff --git a/src/main/java/org/sopt/makers/operation/security/jwt/JwtTokenProvider.java b/operation-auth/src/main/java/org/sopt/makers/operation/jwt/JwtTokenProvider.java similarity index 79% rename from src/main/java/org/sopt/makers/operation/security/jwt/JwtTokenProvider.java rename to operation-auth/src/main/java/org/sopt/makers/operation/jwt/JwtTokenProvider.java index e43cf11e..6feef300 100644 --- a/src/main/java/org/sopt/makers/operation/security/jwt/JwtTokenProvider.java +++ b/operation-auth/src/main/java/org/sopt/makers/operation/jwt/JwtTokenProvider.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.security.jwt; +package org.sopt.makers.operation.jwt; import io.jsonwebtoken.Claims; import io.jsonwebtoken.ExpiredJwtException; @@ -7,13 +7,12 @@ import io.jsonwebtoken.security.SignatureException; import lombok.RequiredArgsConstructor; import lombok.val; -import org.sopt.makers.operation.common.ExceptionMessage; -import org.sopt.makers.operation.exception.TokenException; -import org.sopt.makers.operation.security.AdminAuthentication; +import org.sopt.makers.operation.authentication.AdminAuthentication; +//import org.sopt.makers.operation.common.ExceptionMessage; +//import org.sopt.makers.operation.exception.TokenException; import org.springframework.beans.factory.annotation.Value; import org.springframework.security.core.Authentication; import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; import org.springframework.util.StringUtils; import javax.crypto.spec.SecretKeySpec; @@ -28,7 +27,6 @@ import java.util.Map; @RequiredArgsConstructor -@Transactional(readOnly = true) @Service public class JwtTokenProvider { @@ -41,7 +39,7 @@ public class JwtTokenProvider { @Value("${spring.jwt.secretKey.app}") private String appAccessSecretKey; - public String generateAccessToken(Authentication authentication) { + public String generateAccessToken(final Authentication authentication) { val encodedKey = encodeKey(accessSecretKey); val secretKeyBytes = DatatypeConverter.parseBase64Binary(encodedKey); val accessKey = new SecretKeySpec(secretKeyBytes, SignatureAlgorithm.HS256.getJcaName()); @@ -54,7 +52,7 @@ public String generateAccessToken(Authentication authentication) { .compact(); } - public String generateRefreshToken(Authentication authentication) { + public String generateRefreshToken(final Authentication authentication) { val encodedKey = encodeKey(refreshSecretKey); val secretKeyBytes = DatatypeConverter.parseBase64Binary(encodedKey); val refreshKey = new SecretKeySpec(secretKeyBytes, SignatureAlgorithm.HS256.getJcaName()); @@ -71,10 +69,8 @@ public boolean validateTokenExpiration(String token, JwtTokenType jwtTokenType) try { getClaimsFromToken(token, jwtTokenType); return true; - } catch (ExpiredJwtException e) { - throw new TokenException(ExceptionMessage.EXPIRED_TOKEN.getName()); - } catch (SignatureException e) { - throw new TokenException(ExceptionMessage.INVALID_SIGNATURE.getName()); + } catch (ExpiredJwtException | SignatureException e) { + return false; } } @@ -90,10 +86,8 @@ public Long getPlayGroundId(String token, JwtTokenType jwtTokenType) { val claims = getClaimsFromToken(token, jwtTokenType); return Long.parseLong(claims.get("playgroundId").toString()); - } catch (ExpiredJwtException e) { - throw new TokenException(ExceptionMessage.EXPIRED_TOKEN.getName()); - } catch (SignatureException e) { - throw new TokenException(ExceptionMessage.INVALID_SIGNATURE.getName()); + } catch (ExpiredJwtException | SignatureException ignored) { + throw new RuntimeException("유효하지 않은 토큰입니다."); } } @@ -102,10 +96,8 @@ public Long getId(String token, JwtTokenType jwtTokenType) { val claims = getClaimsFromToken(token, jwtTokenType); return Long.parseLong(claims.getSubject()); - } catch (ExpiredJwtException e) { - throw new TokenException(ExceptionMessage.EXPIRED_TOKEN.getName()); - } catch (SecurityException e) { - throw new TokenException(ExceptionMessage.INVALID_SIGNATURE.getName()); + } catch (ExpiredJwtException | SignatureException ignored) { + throw new RuntimeException("유효하지 않은 토큰입니다."); } } @@ -144,7 +136,7 @@ private LocalDateTime setExpireTime(LocalDateTime now, JwtTokenType jwtTokenType return switch (jwtTokenType) { case ACCESS_TOKEN -> now.plusHours(5); case REFRESH_TOKEN -> now.plusWeeks(2); - case APP_ACCESS_TOKEN -> throw new TokenException(ExceptionMessage.INVALID_TOKEN.getName()); + case APP_ACCESS_TOKEN -> null; }; } diff --git a/src/main/java/org/sopt/makers/operation/security/jwt/JwtTokenType.java b/operation-auth/src/main/java/org/sopt/makers/operation/jwt/JwtTokenType.java similarity index 62% rename from src/main/java/org/sopt/makers/operation/security/jwt/JwtTokenType.java rename to operation-auth/src/main/java/org/sopt/makers/operation/jwt/JwtTokenType.java index 753724db..385ec839 100644 --- a/src/main/java/org/sopt/makers/operation/security/jwt/JwtTokenType.java +++ b/operation-auth/src/main/java/org/sopt/makers/operation/jwt/JwtTokenType.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.security.jwt; +package org.sopt.makers.operation.jwt; public enum JwtTokenType { ACCESS_TOKEN, REFRESH_TOKEN, APP_ACCESS_TOKEN From 65f48ea2b66af0aeb541e454b76af08b68fe8870 Mon Sep 17 00:00:00 2001 From: thguss Date: Sun, 4 Feb 2024 22:05:08 +0900 Subject: [PATCH 049/141] =?UTF-8?q?[FIX]=20QueryDSL=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../attendance/service/AttendanceService.java | 8 - .../app/lecture/service/LectureService.java | 10 -- .../app/member/service/MemberService.java | 9 - .../scheduler/service/LectureService.java | 6 - .../web/admin/service/AdminService.java | 13 -- .../attendnace/service/AttendanceService.java | 15 -- .../web/lecture/service/LectureService.java | 19 -- .../web/member/service/MemberService.java | 9 - .../operation/OperationApplication.java | 2 +- .../app/attendance/api/AttendanceApi.java | 6 +- .../api/AttendanceApiController.java | 14 +- .../attendance/message/SuccessMessage.java | 2 +- .../attendance/service/AttendanceService.java | 8 + .../operation/app/lecture/api/LectureApi.java | 4 +- .../app/lecture/api/LectureApiController.java | 10 +- .../app/lecture/message/SuccessMessage.java | 2 +- .../app/lecture/service/LectureService.java | 10 ++ .../operation/app/member/api/MemberApi.java | 5 +- .../app/member/api/MemberApiController.java | 12 +- .../app/member/message/SuccessMessage.java | 2 +- .../app/member/service/MemberService.java | 9 + .../app/schedule/api/ScheduleApi.java | 4 +- .../schedule/api/ScheduleApiController.java | 10 +- .../app/schedule/message/SuccessMessage.java | 2 +- .../app/schedule/service/ScheduleService.java | 4 +- .../common/config/SwaggerConfig.java | 2 +- .../common/config/TimezoneConfig.java | 2 +- .../operation/common/dto/BaseResponse.java | 2 +- .../common/handler/ErrorHandler.java | 18 +- .../common/scheduler/LectureScheduler.java | 4 +- .../scheduler/service/LectureService.java | 6 + .../common/util/ApiResponseUtil.java | 4 +- .../operation/common/util/CommonUtils.java | 2 +- .../makers}/operation/common/util/Cookie.java | 2 +- .../operation/web/admin/api/AdminApi.java | 8 +- .../web/admin/api/AdminApiController.java | 16 +- .../web/admin/message/SuccessMessage.java | 2 +- .../web/admin/service/AdminService.java | 13 ++ .../operation/web/alarm/api/AlarmApi.java | 10 +- .../web/alarm/api/AlarmApiController.java | 18 +- .../web/alarm/message/SuccessMessage.java | 2 +- .../web/alarm/service/AlarmService.java | 12 +- .../web/attendnace/api/AttendanceApi.java | 8 +- .../api/AttendanceApiController.java | 14 +- .../attendnace/message/SuccessMessage.java | 2 +- .../attendnace/service/AttendanceService.java | 15 ++ .../operation/web/lecture/api/LectureApi.java | 10 +- .../web/lecture/api/LectureApiController.java | 18 +- .../web/lecture/message/SuccessMessage.java | 2 +- .../web/lecture/service/LectureService.java | 19 ++ .../operation/web/member/api/MemberApi.java | 6 +- .../web/member/api/MemberApiController.java | 12 +- .../web/member/message/SuccessMessage.java | 2 +- .../web/member/service/MemberService.java | 9 + operation-common/build.gradle | 18 ++ .../makers/operation}/config/ValueConfig.java | 2 +- operation-domain/build.gradle | 33 +++- .../repository/lecture/LectureRepository.java | 7 - .../org/operation/member/domain/ObYb.java | 5 - .../operation}/config/JpaAuditingConfig.java | 2 +- .../config/JpaQueryFactoryConfig.java | 2 +- .../makers/operation}/domain/BaseEntity.java | 2 +- .../makers/operation}/domain/Part.java | 2 +- .../operation/domain}/admin/domain/Admin.java | 2 +- .../domain}/admin/domain/AdminStatus.java | 2 +- .../operation/domain}/admin/domain/Role.java | 2 +- .../operation/domain}/alarm/domain/Alarm.java | 10 +- .../domain}/alarm/domain/Attribute.java | 2 +- .../domain}/alarm/domain/Status.java | 2 +- .../domain}/alarm/message/ErrorMessage.java | 2 +- .../repository/AlarmCustomRepository.java | 8 +- .../alarm/repository/AlarmRepository.java | 4 +- .../alarm/repository/AlarmRepositoryImpl.java | 13 +- .../domain}/attendance/domain/Attendance.java | 12 +- .../attendance/domain/AttendanceStatus.java | 2 +- .../attendance/domain/SubAttendance.java | 9 +- .../attendance/message/ErrorMessage.java | 2 +- .../AttendanceCustomRepository.java | 8 +- .../attendance/AttendanceRepository.java | 8 +- .../attendance/AttendanceRepositoryImpl.java | 21 ++- .../SubAttendanceRepository.java | 7 +- .../converter/StringListConverter.java | 9 +- .../operation/domain}/lecture/Attribute.java | 2 +- .../operation/domain}/lecture/Lecture.java | 10 +- .../domain}/lecture/LectureStatus.java | 2 +- .../operation/domain}/lecture/SubLecture.java | 6 +- .../domain}/lecture/message/ErrorMessage.java | 2 +- .../lecture/LectureCustomRepository.java | 6 +- .../repository/lecture/LectureRepository.java | 7 + .../lecture/LectureRepositoryImpl.java | 14 +- .../subLecture/SubLectureRepository.java | 9 +- .../domain}/member/domain/Member.java | 8 +- .../operation/domain/member/domain/ObYb.java | 5 + .../domain}/member/message/ErrorMessage.java | 2 +- .../repository/MemberCustomRepository.java | 8 +- .../member/repository/MemberRepository.java | 4 +- .../repository/MemberRepositoryImpl.java | 16 +- .../domain}/schedule/domain/Schedule.java | 22 ++- .../repository/ScheduleCustomRepository.java | 4 +- .../repository/ScheduleRepository.java | 4 +- .../repository/ScheduleRepositoryImpl.java | 6 +- .../makers/operation/dto}/AlarmRequest.java | 8 +- .../operation/dto/MemberSearchCondition.java | 9 + operation-external/build.gradle | 2 +- .../operation/client/alarm/AlarmSender.java | 7 - .../client/playground/PlayGroundServer.java | 8 - .../operation/client/alarm/AlarmSender.java | 7 + .../client/alarm/AlarmSenderImpl.java | 8 +- .../client/playground/PlayGroundServer.java | 8 + .../playground/PlayGroundServerImpl.java | 10 +- .../operation/config/RestTemplateConfig.java | 2 +- operation-service/build.gradle | 2 +- .../common/dto/MemberSearchCondition.java | 9 - .../security/AdminAuthentication.java | 12 -- .../operation/security/SecurityConfig.java | 88 --------- .../security/jwt/JwtAuthenticationFilter.java | 54 ------ .../security/jwt/JwtExceptionFilter.java | 38 ---- .../security/jwt/JwtTokenProvider.java | 169 ------------------ .../operation/security/jwt/JwtTokenType.java | 5 - .../alarm/dto/request/AlarmSendRequest.java | 6 - .../dto/request/AttendanceRequest.java | 2 +- .../dto/response/AttendanceResponse.java | 2 +- .../dto/response/AttendancesResponse.java | 5 +- .../service/AttendanceServiceImpl.java | 14 +- .../response/LectureCurrentRoundResponse.java | 2 +- .../dto/response/LectureResponseType.java | 2 +- .../dto/response/TodayLectureResponse.java | 2 +- .../lecture/service/LectureServiceImpl.java | 14 +- .../response/AttendanceTotalResponseDTO.java | 6 +- .../dto/response/AttendanceTotalVO.java | 2 +- .../dto/response/MemberScoreGetResponse.java | 2 +- .../app/member/service/MemberServiceImpl.java | 14 +- .../dto/response/SchedulesResponseDTO.java | 2 +- .../schedule/service/ScheduleServiceImpl.java | 4 +- .../exception/AdminFailureException.java | 2 +- .../common/exception/AlarmException.java | 2 +- .../common/exception/LectureException.java | 2 +- .../common/exception/MemberException.java | 2 +- .../common/exception/SubLectureException.java | 2 +- .../common/exception/TokenException.java | 2 +- .../common/service/LectureServiceImpl.java | 10 +- .../web/admin/dto/request/LoginRequest.java | 2 +- .../web/admin/dto/request/SignUpRequest.java | 2 +- .../web/admin/dto/response/LoginResponse.java | 2 +- .../admin/dto/response/RefreshResponse.java | 2 +- .../admin/dto/response/SignUpResponse.java | 2 +- .../web/admin/repository/AdminRepository.java | 2 +- .../web/admin/service/AdminServiceImpl.java | 16 +- .../alarm/dto/request/AlarmSendRequest.java | 6 + .../alarm/dto/request/AlarmSenderRequest.java | 2 +- .../response/AlarmInactiveListResponse.java | 2 +- .../web/alarm/dto/response/AlarmResponse.java | 2 +- .../alarm/dto/response/AlarmsResponse.java | 2 +- .../web/alarm/service/AlarmServiceImpl.java | 20 +-- .../request/SubAttendanceUpdateRequest.java | 2 +- .../response/AttendanceMemberResponse.java | 2 +- .../dto/response/AttendancesResponse.java | 2 +- .../dto/response/MemberResponse.java | 2 +- .../response/SubAttendanceUpdateResponse.java | 2 +- .../service/AttendanceServiceImpl.java | 18 +- .../dto/request/AttendanceRequest.java | 2 +- .../lecture/dto/request/LectureRequest.java | 4 +- .../dto/response/AttendanceResponse.java | 2 +- .../dto/response/AttendancesStatusVO.java | 2 +- .../dto/response/LectureDetailResponse.java | 2 +- .../lecture/dto/response/LectureResponse.java | 4 +- .../dto/response/LecturesResponse.java | 4 +- .../lecture/service/LectureServiceImpl.java | 24 +-- .../dto/response/AttendanceTotalCountVO.java | 2 +- .../dto/response/AttendanceTotalVO.java | 2 +- .../dto/response/MemberListGetResponse.java | 4 +- .../member/dto/response/MembersResponse.java | 2 +- .../web/member/service/MemberServiceImpl.java | 14 +- settings.gradle | 1 + 174 files changed, 579 insertions(+), 897 deletions(-) delete mode 100644 operation-api/src/main/java/org/operation/app/attendance/service/AttendanceService.java delete mode 100644 operation-api/src/main/java/org/operation/app/lecture/service/LectureService.java delete mode 100644 operation-api/src/main/java/org/operation/app/member/service/MemberService.java delete mode 100644 operation-api/src/main/java/org/operation/common/scheduler/service/LectureService.java delete mode 100644 operation-api/src/main/java/org/operation/web/admin/service/AdminService.java delete mode 100644 operation-api/src/main/java/org/operation/web/attendnace/service/AttendanceService.java delete mode 100644 operation-api/src/main/java/org/operation/web/lecture/service/LectureService.java delete mode 100644 operation-api/src/main/java/org/operation/web/member/service/MemberService.java rename operation-api/src/main/java/org/{ => sopt/makers}/operation/OperationApplication.java (89%) rename operation-api/src/main/java/org/{ => sopt/makers}/operation/app/attendance/api/AttendanceApi.java (84%) rename operation-api/src/main/java/org/{ => sopt/makers}/operation/app/attendance/api/AttendanceApiController.java (67%) rename operation-api/src/main/java/org/{ => sopt/makers}/operation/app/attendance/message/SuccessMessage.java (77%) create mode 100644 operation-api/src/main/java/org/sopt/makers/operation/app/attendance/service/AttendanceService.java rename operation-api/src/main/java/org/{ => sopt/makers}/operation/app/lecture/api/LectureApi.java (93%) rename operation-api/src/main/java/org/{ => sopt/makers}/operation/app/lecture/api/LectureApiController.java (78%) rename operation-api/src/main/java/org/{ => sopt/makers}/operation/app/lecture/message/SuccessMessage.java (83%) create mode 100644 operation-api/src/main/java/org/sopt/makers/operation/app/lecture/service/LectureService.java rename operation-api/src/main/java/org/{ => sopt/makers}/operation/app/member/api/MemberApi.java (93%) rename operation-api/src/main/java/org/{ => sopt/makers}/operation/app/member/api/MemberApiController.java (76%) rename operation-api/src/main/java/org/{ => sopt/makers}/operation/app/member/message/SuccessMessage.java (84%) create mode 100644 operation-api/src/main/java/org/sopt/makers/operation/app/member/service/MemberService.java rename operation-api/src/main/java/org/{ => sopt/makers}/operation/app/schedule/api/ScheduleApi.java (90%) rename operation-api/src/main/java/org/{ => sopt/makers}/operation/app/schedule/api/ScheduleApiController.java (76%) rename operation-api/src/main/java/org/{ => sopt/makers}/operation/app/schedule/message/SuccessMessage.java (79%) rename operation-api/src/main/java/org/{ => sopt/makers}/operation/app/schedule/service/ScheduleService.java (51%) rename operation-api/src/main/java/org/{ => sopt/makers}/operation/common/config/SwaggerConfig.java (94%) rename operation-api/src/main/java/org/{ => sopt/makers}/operation/common/config/TimezoneConfig.java (87%) rename operation-api/src/main/java/org/{ => sopt/makers}/operation/common/dto/BaseResponse.java (93%) rename operation-api/src/main/java/org/{ => sopt/makers}/operation/common/handler/ErrorHandler.java (80%) rename operation-api/src/main/java/org/{ => sopt/makers}/operation/common/scheduler/LectureScheduler.java (78%) create mode 100644 operation-api/src/main/java/org/sopt/makers/operation/common/scheduler/service/LectureService.java rename operation-api/src/main/java/org/{ => sopt/makers}/operation/common/util/ApiResponseUtil.java (90%) rename operation-api/src/main/java/org/{ => sopt/makers}/operation/common/util/CommonUtils.java (91%) rename operation-api/src/main/java/org/{ => sopt/makers}/operation/common/util/Cookie.java (94%) rename operation-api/src/main/java/org/{ => sopt/makers}/operation/web/admin/api/AdminApi.java (88%) rename operation-api/src/main/java/org/{ => sopt/makers}/operation/web/admin/api/AdminApiController.java (75%) rename operation-api/src/main/java/org/{ => sopt/makers}/operation/web/admin/message/SuccessMessage.java (84%) create mode 100644 operation-api/src/main/java/org/sopt/makers/operation/web/admin/service/AdminService.java rename operation-api/src/main/java/org/{ => sopt/makers}/operation/web/alarm/api/AlarmApi.java (91%) rename operation-api/src/main/java/org/{ => sopt/makers}/operation/web/alarm/api/AlarmApiController.java (80%) rename operation-api/src/main/java/org/{ => sopt/makers}/operation/web/alarm/message/SuccessMessage.java (88%) rename operation-api/src/main/java/org/{ => sopt/makers}/operation/web/alarm/service/AlarmService.java (50%) rename operation-api/src/main/java/org/{ => sopt/makers}/operation/web/attendnace/api/AttendanceApi.java (90%) rename operation-api/src/main/java/org/{ => sopt/makers}/operation/web/attendnace/api/AttendanceApiController.java (81%) rename operation-api/src/main/java/org/{ => sopt/makers}/operation/web/attendnace/message/SuccessMessage.java (88%) create mode 100644 operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/service/AttendanceService.java rename operation-api/src/main/java/org/{ => sopt/makers}/operation/web/lecture/api/LectureApi.java (92%) rename operation-api/src/main/java/org/{ => sopt/makers}/operation/web/lecture/api/LectureApiController.java (83%) rename operation-api/src/main/java/org/{ => sopt/makers}/operation/web/lecture/message/SuccessMessage.java (90%) create mode 100644 operation-api/src/main/java/org/sopt/makers/operation/web/lecture/service/LectureService.java rename operation-api/src/main/java/org/{ => sopt/makers}/operation/web/member/api/MemberApi.java (84%) rename operation-api/src/main/java/org/{ => sopt/makers}/operation/web/member/api/MemberApiController.java (72%) rename operation-api/src/main/java/org/{ => sopt/makers}/operation/web/member/message/SuccessMessage.java (80%) create mode 100644 operation-api/src/main/java/org/sopt/makers/operation/web/member/service/MemberService.java create mode 100644 operation-common/build.gradle rename {operation-service/src/main/java/org/operation/common => operation-common/src/main/java/org/sopt/makers/operation}/config/ValueConfig.java (97%) delete mode 100644 operation-domain/src/main/java/org/operation/lecture/repository/lecture/LectureRepository.java delete mode 100644 operation-domain/src/main/java/org/operation/member/domain/ObYb.java rename operation-domain/src/main/java/org/{operation/common => sopt/makers/operation}/config/JpaAuditingConfig.java (82%) rename operation-domain/src/main/java/org/{operation/common => sopt/makers/operation}/config/JpaQueryFactoryConfig.java (89%) rename operation-domain/src/main/java/org/{operation/common => sopt/makers/operation}/domain/BaseEntity.java (92%) rename operation-domain/src/main/java/org/{operation/common => sopt/makers/operation}/domain/Part.java (86%) rename operation-domain/src/main/java/org/{operation => sopt/makers/operation/domain}/admin/domain/Admin.java (95%) rename operation-domain/src/main/java/org/{operation => sopt/makers/operation/domain}/admin/domain/AdminStatus.java (56%) rename operation-domain/src/main/java/org/{operation => sopt/makers/operation/domain}/admin/domain/Role.java (71%) rename operation-domain/src/main/java/org/{operation => sopt/makers/operation/domain}/alarm/domain/Alarm.java (87%) rename operation-domain/src/main/java/org/{operation => sopt/makers/operation/domain}/alarm/domain/Attribute.java (76%) rename operation-domain/src/main/java/org/{operation => sopt/makers/operation/domain}/alarm/domain/Status.java (76%) rename operation-domain/src/main/java/org/{operation => sopt/makers/operation/domain}/alarm/message/ErrorMessage.java (86%) rename operation-domain/src/main/java/org/{operation => sopt/makers/operation/domain}/alarm/repository/AlarmCustomRepository.java (56%) rename operation-domain/src/main/java/org/{operation => sopt/makers/operation/domain}/alarm/repository/AlarmRepository.java (57%) rename operation-domain/src/main/java/org/{operation => sopt/makers/operation/domain}/alarm/repository/AlarmRepositoryImpl.java (81%) rename operation-domain/src/main/java/org/{operation => sopt/makers/operation/domain}/attendance/domain/Attendance.java (88%) rename operation-domain/src/main/java/org/{operation => sopt/makers/operation/domain}/attendance/domain/AttendanceStatus.java (82%) rename operation-domain/src/main/java/org/{operation => sopt/makers/operation/domain}/attendance/domain/SubAttendance.java (86%) rename operation-domain/src/main/java/org/{operation => sopt/makers/operation/domain}/attendance/message/ErrorMessage.java (82%) rename operation-domain/src/main/java/org/{operation => sopt/makers/operation/domain}/attendance/repository/attendance/AttendanceCustomRepository.java (62%) rename operation-domain/src/main/java/org/{operation => sopt/makers/operation/domain}/attendance/repository/attendance/AttendanceRepository.java (62%) rename operation-domain/src/main/java/org/{operation => sopt/makers/operation/domain}/attendance/repository/attendance/AttendanceRepositoryImpl.java (82%) rename operation-domain/src/main/java/org/{operation => sopt/makers/operation/domain}/attendance/repository/subAttendance/SubAttendanceRepository.java (59%) rename operation-domain/src/main/java/org/{operation => sopt/makers/operation/domain}/converter/StringListConverter.java (88%) rename operation-domain/src/main/java/org/{operation => sopt/makers/operation/domain}/lecture/Attribute.java (79%) rename operation-domain/src/main/java/org/{operation => sopt/makers/operation/domain}/lecture/Lecture.java (86%) rename operation-domain/src/main/java/org/{operation => sopt/makers/operation/domain}/lecture/LectureStatus.java (54%) rename operation-domain/src/main/java/org/{operation => sopt/makers/operation/domain}/lecture/SubLecture.java (90%) rename operation-domain/src/main/java/org/{operation => sopt/makers/operation/domain}/lecture/message/ErrorMessage.java (94%) rename operation-domain/src/main/java/org/{operation => sopt/makers/operation/domain}/lecture/repository/lecture/LectureCustomRepository.java (57%) create mode 100644 operation-domain/src/main/java/org/sopt/makers/operation/domain/lecture/repository/lecture/LectureRepository.java rename operation-domain/src/main/java/org/{operation => sopt/makers/operation/domain}/lecture/repository/lecture/LectureRepositoryImpl.java (79%) rename operation-domain/src/main/java/org/{operation => sopt/makers/operation/domain}/lecture/repository/subLecture/SubLectureRepository.java (52%) rename operation-domain/src/main/java/org/{operation => sopt/makers/operation/domain}/member/domain/Member.java (82%) create mode 100644 operation-domain/src/main/java/org/sopt/makers/operation/domain/member/domain/ObYb.java rename operation-domain/src/main/java/org/{operation => sopt/makers/operation/domain}/member/message/ErrorMessage.java (78%) rename operation-domain/src/main/java/org/{operation => sopt/makers/operation/domain}/member/repository/MemberCustomRepository.java (64%) rename operation-domain/src/main/java/org/{operation => sopt/makers/operation/domain}/member/repository/MemberRepository.java (72%) rename operation-domain/src/main/java/org/{operation => sopt/makers/operation/domain}/member/repository/MemberRepositoryImpl.java (82%) rename operation-domain/src/main/java/org/{operation => sopt/makers/operation/domain}/schedule/domain/Schedule.java (53%) rename operation-domain/src/main/java/org/{operation => sopt/makers/operation/domain}/schedule/repository/ScheduleCustomRepository.java (59%) rename operation-domain/src/main/java/org/{operation => sopt/makers/operation/domain}/schedule/repository/ScheduleRepository.java (57%) rename operation-domain/src/main/java/org/{operation => sopt/makers/operation/domain}/schedule/repository/ScheduleRepositoryImpl.java (76%) rename {operation-service/src/main/java/org/operation/web/alarm/dto/request => operation-domain/src/main/java/org/sopt/makers/operation/dto}/AlarmRequest.java (56%) create mode 100644 operation-domain/src/main/java/org/sopt/makers/operation/dto/MemberSearchCondition.java delete mode 100644 operation-external/src/main/java/org/operation/client/alarm/AlarmSender.java delete mode 100644 operation-external/src/main/java/org/operation/client/playground/PlayGroundServer.java create mode 100644 operation-external/src/main/java/org/sopt/makers/operation/client/alarm/AlarmSender.java rename operation-external/src/main/java/org/{ => sopt/makers}/operation/client/alarm/AlarmSenderImpl.java (90%) create mode 100644 operation-external/src/main/java/org/sopt/makers/operation/client/playground/PlayGroundServer.java rename operation-external/src/main/java/org/{ => sopt/makers}/operation/client/playground/PlayGroundServerImpl.java (84%) rename operation-external/src/main/java/org/{ => sopt/makers}/operation/config/RestTemplateConfig.java (87%) delete mode 100644 operation-service/src/main/java/org/operation/common/dto/MemberSearchCondition.java delete mode 100644 operation-service/src/main/java/org/operation/security/AdminAuthentication.java delete mode 100644 operation-service/src/main/java/org/operation/security/SecurityConfig.java delete mode 100644 operation-service/src/main/java/org/operation/security/jwt/JwtAuthenticationFilter.java delete mode 100644 operation-service/src/main/java/org/operation/security/jwt/JwtExceptionFilter.java delete mode 100644 operation-service/src/main/java/org/operation/security/jwt/JwtTokenProvider.java delete mode 100644 operation-service/src/main/java/org/operation/security/jwt/JwtTokenType.java delete mode 100644 operation-service/src/main/java/org/operation/web/alarm/dto/request/AlarmSendRequest.java rename operation-service/src/main/java/org/{ => sopt/makers}/operation/app/attendance/dto/request/AttendanceRequest.java (58%) rename operation-service/src/main/java/org/{ => sopt/makers}/operation/app/attendance/dto/response/AttendanceResponse.java (81%) rename operation-service/src/main/java/org/{ => sopt/makers}/operation/app/attendance/dto/response/AttendancesResponse.java (66%) rename operation-service/src/main/java/org/{ => sopt/makers}/operation/app/attendance/service/AttendanceServiceImpl.java (89%) rename operation-service/src/main/java/org/{ => sopt/makers}/operation/app/lecture/dto/response/LectureCurrentRoundResponse.java (84%) rename operation-service/src/main/java/org/{ => sopt/makers}/operation/app/lecture/dto/response/LectureResponseType.java (58%) rename operation-service/src/main/java/org/{ => sopt/makers}/operation/app/lecture/dto/response/TodayLectureResponse.java (97%) rename operation-service/src/main/java/org/{ => sopt/makers}/operation/app/lecture/service/LectureServiceImpl.java (92%) rename operation-service/src/main/java/org/{ => sopt/makers}/operation/app/member/dto/response/AttendanceTotalResponseDTO.java (78%) rename operation-service/src/main/java/org/{ => sopt/makers}/operation/app/member/dto/response/AttendanceTotalVO.java (94%) rename operation-service/src/main/java/org/{ => sopt/makers}/operation/app/member/dto/response/MemberScoreGetResponse.java (74%) rename operation-service/src/main/java/org/{ => sopt/makers}/operation/app/member/service/MemberServiceImpl.java (87%) rename operation-service/src/main/java/org/{ => sopt/makers}/operation/app/schedule/dto/response/SchedulesResponseDTO.java (96%) rename operation-service/src/main/java/org/{ => sopt/makers}/operation/app/schedule/service/ScheduleServiceImpl.java (95%) rename operation-service/src/main/java/org/{ => sopt/makers}/operation/common/exception/AdminFailureException.java (77%) rename operation-service/src/main/java/org/{ => sopt/makers}/operation/common/exception/AlarmException.java (75%) rename operation-service/src/main/java/org/{ => sopt/makers}/operation/common/exception/LectureException.java (75%) rename operation-service/src/main/java/org/{ => sopt/makers}/operation/common/exception/MemberException.java (75%) rename operation-service/src/main/java/org/{ => sopt/makers}/operation/common/exception/SubLectureException.java (76%) rename operation-service/src/main/java/org/{ => sopt/makers}/operation/common/exception/TokenException.java (74%) rename operation-service/src/main/java/org/{ => sopt/makers}/operation/common/service/LectureServiceImpl.java (86%) rename operation-service/src/main/java/org/{ => sopt/makers}/operation/web/admin/dto/request/LoginRequest.java (54%) rename operation-service/src/main/java/org/{ => sopt/makers}/operation/web/admin/dto/request/SignUpRequest.java (86%) rename operation-service/src/main/java/org/{ => sopt/makers}/operation/web/admin/dto/response/LoginResponse.java (94%) rename operation-service/src/main/java/org/{ => sopt/makers}/operation/web/admin/dto/response/RefreshResponse.java (83%) rename operation-service/src/main/java/org/{ => sopt/makers}/operation/web/admin/dto/response/SignUpResponse.java (89%) rename operation-service/src/main/java/org/{ => sopt/makers}/operation/web/admin/repository/AdminRepository.java (86%) rename operation-service/src/main/java/org/{ => sopt/makers}/operation/web/admin/service/AdminServiceImpl.java (87%) create mode 100644 operation-service/src/main/java/org/sopt/makers/operation/web/alarm/dto/request/AlarmSendRequest.java rename operation-service/src/main/java/org/{ => sopt/makers}/operation/web/alarm/dto/request/AlarmSenderRequest.java (90%) rename operation-service/src/main/java/org/{ => sopt/makers}/operation/web/alarm/dto/response/AlarmInactiveListResponse.java (62%) rename operation-service/src/main/java/org/{ => sopt/makers}/operation/web/alarm/dto/response/AlarmResponse.java (92%) rename operation-service/src/main/java/org/{ => sopt/makers}/operation/web/alarm/dto/response/AlarmsResponse.java (94%) rename operation-service/src/main/java/org/{ => sopt/makers}/operation/web/alarm/service/AlarmServiceImpl.java (85%) rename operation-service/src/main/java/org/{ => sopt/makers}/operation/web/attendance/dto/request/SubAttendanceUpdateRequest.java (71%) rename operation-service/src/main/java/org/{ => sopt/makers}/operation/web/attendance/dto/response/AttendanceMemberResponse.java (95%) rename operation-service/src/main/java/org/{ => sopt/makers}/operation/web/attendance/dto/response/AttendancesResponse.java (85%) rename operation-service/src/main/java/org/{ => sopt/makers}/operation/web/attendance/dto/response/MemberResponse.java (95%) rename operation-service/src/main/java/org/{ => sopt/makers}/operation/web/attendance/dto/response/SubAttendanceUpdateResponse.java (85%) rename operation-service/src/main/java/org/{ => sopt/makers}/operation/web/attendance/service/AttendanceServiceImpl.java (79%) rename operation-service/src/main/java/org/{ => sopt/makers}/operation/web/lecture/dto/request/AttendanceRequest.java (58%) rename operation-service/src/main/java/org/{ => sopt/makers}/operation/web/lecture/dto/request/LectureRequest.java (88%) rename operation-service/src/main/java/org/{ => sopt/makers}/operation/web/lecture/dto/response/AttendanceResponse.java (86%) rename operation-service/src/main/java/org/{ => sopt/makers}/operation/web/lecture/dto/response/AttendancesStatusVO.java (94%) rename operation-service/src/main/java/org/{ => sopt/makers}/operation/web/lecture/dto/response/LectureDetailResponse.java (91%) rename operation-service/src/main/java/org/{ => sopt/makers}/operation/web/lecture/dto/response/LectureResponse.java (93%) rename operation-service/src/main/java/org/{ => sopt/makers}/operation/web/lecture/dto/response/LecturesResponse.java (91%) rename operation-service/src/main/java/org/{ => sopt/makers}/operation/web/lecture/service/LectureServiceImpl.java (88%) rename operation-service/src/main/java/org/{ => sopt/makers}/operation/web/member/dto/response/AttendanceTotalCountVO.java (83%) rename operation-service/src/main/java/org/{ => sopt/makers}/operation/web/member/dto/response/AttendanceTotalVO.java (93%) rename operation-service/src/main/java/org/{ => sopt/makers}/operation/web/member/dto/response/MemberListGetResponse.java (81%) rename operation-service/src/main/java/org/{ => sopt/makers}/operation/web/member/dto/response/MembersResponse.java (81%) rename operation-service/src/main/java/org/{ => sopt/makers}/operation/web/member/service/MemberServiceImpl.java (85%) diff --git a/operation-api/src/main/java/org/operation/app/attendance/service/AttendanceService.java b/operation-api/src/main/java/org/operation/app/attendance/service/AttendanceService.java deleted file mode 100644 index a7f7eedf..00000000 --- a/operation-api/src/main/java/org/operation/app/attendance/service/AttendanceService.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.operation.app.attendance.service; - -import org.operation.app.attendance.dto.request.AttendanceRequest; -import org.operation.app.attendance.dto.response.AttendanceResponse; - -public interface AttendanceService { - AttendanceResponse attend(long memberId, AttendanceRequest request); -} diff --git a/operation-api/src/main/java/org/operation/app/lecture/service/LectureService.java b/operation-api/src/main/java/org/operation/app/lecture/service/LectureService.java deleted file mode 100644 index 4ed13ba8..00000000 --- a/operation-api/src/main/java/org/operation/app/lecture/service/LectureService.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.operation.app.lecture.service; - -import org.operation.app.lecture.dto.response.LectureCurrentRoundResponse; -import org.operation.app.lecture.dto.response.TodayLectureResponse; - -public interface LectureService { - - TodayLectureResponse getTodayLecture(long memberPlaygroundId); - LectureCurrentRoundResponse getCurrentLectureRound(long lectureId); -} diff --git a/operation-api/src/main/java/org/operation/app/member/service/MemberService.java b/operation-api/src/main/java/org/operation/app/member/service/MemberService.java deleted file mode 100644 index 26d4d7ce..00000000 --- a/operation-api/src/main/java/org/operation/app/member/service/MemberService.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.operation.app.member.service; - -import org.operation.app.member.dto.response.AttendanceTotalResponseDTO; -import org.operation.app.member.dto.response.MemberScoreGetResponse; - -public interface MemberService { - AttendanceTotalResponseDTO getMemberTotalAttendance(Long playGroundId); - MemberScoreGetResponse getMemberScore(Long playGroundId); -} diff --git a/operation-api/src/main/java/org/operation/common/scheduler/service/LectureService.java b/operation-api/src/main/java/org/operation/common/scheduler/service/LectureService.java deleted file mode 100644 index 3fc2d719..00000000 --- a/operation-api/src/main/java/org/operation/common/scheduler/service/LectureService.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.operation.common.scheduler.service; - -public interface LectureService { - - void endLectures(); -} diff --git a/operation-api/src/main/java/org/operation/web/admin/service/AdminService.java b/operation-api/src/main/java/org/operation/web/admin/service/AdminService.java deleted file mode 100644 index 91a196bc..00000000 --- a/operation-api/src/main/java/org/operation/web/admin/service/AdminService.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.operation.web.admin.service; - -import org.operation.web.admin.dto.request.LoginRequest; -import org.operation.web.admin.dto.request.SignUpRequest; -import org.operation.web.admin.dto.response.LoginResponse; -import org.operation.web.admin.dto.response.RefreshResponse; -import org.operation.web.admin.dto.response.SignUpResponse; - -public interface AdminService { - SignUpResponse signUp(SignUpRequest request); - LoginResponse login(LoginRequest request); - RefreshResponse refresh(String refreshToken); -} diff --git a/operation-api/src/main/java/org/operation/web/attendnace/service/AttendanceService.java b/operation-api/src/main/java/org/operation/web/attendnace/service/AttendanceService.java deleted file mode 100644 index dc8e8743..00000000 --- a/operation-api/src/main/java/org/operation/web/attendnace/service/AttendanceService.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.operation.web.attendnace.service; - -import org.operation.common.domain.Part; -import org.operation.web.attendance.dto.request.SubAttendanceUpdateRequest; -import org.operation.web.attendance.dto.response.AttendanceMemberResponse; -import org.operation.web.attendance.dto.response.AttendancesResponse; -import org.operation.web.attendance.dto.response.SubAttendanceUpdateResponse; -import org.springframework.data.domain.Pageable; - -public interface AttendanceService { - SubAttendanceUpdateResponse updateSubAttendance(SubAttendanceUpdateRequest request); - AttendanceMemberResponse findAttendancesByMember(long memberId); - float updateMemberScore(Long memberId); - AttendancesResponse findAttendancesByLecture(long lectureId, Part part, Pageable pageable); -} diff --git a/operation-api/src/main/java/org/operation/web/lecture/service/LectureService.java b/operation-api/src/main/java/org/operation/web/lecture/service/LectureService.java deleted file mode 100644 index 1abc219c..00000000 --- a/operation-api/src/main/java/org/operation/web/lecture/service/LectureService.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.operation.web.lecture.service; - -import org.operation.common.domain.Part; -import org.operation.web.lecture.dto.request.AttendanceRequest; -import org.operation.web.lecture.dto.request.LectureRequest; -import org.operation.web.lecture.dto.response.AttendanceResponse; -import org.operation.web.lecture.dto.response.LectureDetailResponse; -import org.operation.web.lecture.dto.response.LectureResponse; -import org.operation.web.lecture.dto.response.LecturesResponse; - -public interface LectureService { - long createLecture(LectureRequest request); - LecturesResponse getLectures(int generation, Part part); - LectureResponse getLecture(long lectureId); - AttendanceResponse startAttendance(AttendanceRequest request); - void endLecture(Long lectureId); - void deleteLecture(Long lectureId); - LectureDetailResponse getLectureDetail(long lectureId); -} diff --git a/operation-api/src/main/java/org/operation/web/member/service/MemberService.java b/operation-api/src/main/java/org/operation/web/member/service/MemberService.java deleted file mode 100644 index 7853d26e..00000000 --- a/operation-api/src/main/java/org/operation/web/member/service/MemberService.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.operation.web.member.service; - -import org.operation.common.domain.Part; -import org.operation.web.member.dto.response.MembersResponse; -import org.springframework.data.domain.Pageable; - -public interface MemberService { - MembersResponse getMemberList(Part part, int generation, Pageable pageable); -} diff --git a/operation-api/src/main/java/org/operation/OperationApplication.java b/operation-api/src/main/java/org/sopt/makers/operation/OperationApplication.java similarity index 89% rename from operation-api/src/main/java/org/operation/OperationApplication.java rename to operation-api/src/main/java/org/sopt/makers/operation/OperationApplication.java index cc496cb9..75a483aa 100644 --- a/operation-api/src/main/java/org/operation/OperationApplication.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/OperationApplication.java @@ -1,4 +1,4 @@ -package org.operation; +package org.sopt.makers.operation; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; diff --git a/operation-api/src/main/java/org/operation/app/attendance/api/AttendanceApi.java b/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/api/AttendanceApi.java similarity index 84% rename from operation-api/src/main/java/org/operation/app/attendance/api/AttendanceApi.java rename to operation-api/src/main/java/org/sopt/makers/operation/app/attendance/api/AttendanceApi.java index 1c461aee..15fd02de 100644 --- a/operation-api/src/main/java/org/operation/app/attendance/api/AttendanceApi.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/api/AttendanceApi.java @@ -1,9 +1,9 @@ -package org.operation.app.attendance.api; +package org.sopt.makers.operation.app.attendance.api; import java.security.Principal; -import org.operation.app.attendance.dto.request.AttendanceRequest; -import org.operation.common.dto.BaseResponse; +import org.sopt.makers.operation.app.attendance.dto.request.AttendanceRequest; +import org.sopt.makers.operation.common.dto.BaseResponse; import org.springframework.http.ResponseEntity; import io.swagger.v3.oas.annotations.Parameter; diff --git a/operation-api/src/main/java/org/operation/app/attendance/api/AttendanceApiController.java b/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/api/AttendanceApiController.java similarity index 67% rename from operation-api/src/main/java/org/operation/app/attendance/api/AttendanceApiController.java rename to operation-api/src/main/java/org/sopt/makers/operation/app/attendance/api/AttendanceApiController.java index edb4a710..19f0c71b 100644 --- a/operation-api/src/main/java/org/operation/app/attendance/api/AttendanceApiController.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/api/AttendanceApiController.java @@ -1,14 +1,14 @@ -package org.operation.app.attendance.api; +package org.sopt.makers.operation.app.attendance.api; -import static org.operation.app.attendance.message.SuccessMessage.*; +import static org.sopt.makers.operation.app.attendance.message.SuccessMessage.*; import java.security.Principal; -import org.operation.app.attendance.dto.request.AttendanceRequest; -import org.operation.app.attendance.service.AttendanceService; -import org.operation.common.util.CommonUtils; -import org.operation.common.util.ApiResponseUtil; -import org.operation.common.dto.BaseResponse; +import org.sopt.makers.operation.app.attendance.dto.request.AttendanceRequest; +import org.sopt.makers.operation.app.attendance.service.AttendanceService; +import org.sopt.makers.operation.common.util.CommonUtils; +import org.sopt.makers.operation.common.util.ApiResponseUtil; +import org.sopt.makers.operation.common.dto.BaseResponse; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; diff --git a/operation-api/src/main/java/org/operation/app/attendance/message/SuccessMessage.java b/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/message/SuccessMessage.java similarity index 77% rename from operation-api/src/main/java/org/operation/app/attendance/message/SuccessMessage.java rename to operation-api/src/main/java/org/sopt/makers/operation/app/attendance/message/SuccessMessage.java index b1e20d5c..16cadea6 100644 --- a/operation-api/src/main/java/org/operation/app/attendance/message/SuccessMessage.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/message/SuccessMessage.java @@ -1,4 +1,4 @@ -package org.operation.app.attendance.message; +package org.sopt.makers.operation.app.attendance.message; import lombok.Getter; import lombok.RequiredArgsConstructor; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/service/AttendanceService.java b/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/service/AttendanceService.java new file mode 100644 index 00000000..290e9cab --- /dev/null +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/service/AttendanceService.java @@ -0,0 +1,8 @@ +package org.sopt.makers.operation.app.attendance.service; + +import org.sopt.makers.operation.app.attendance.dto.request.AttendanceRequest; +import org.sopt.makers.operation.app.attendance.dto.response.AttendanceResponse; + +public interface AttendanceService { + AttendanceResponse attend(long memberId, AttendanceRequest request); +} diff --git a/operation-api/src/main/java/org/operation/app/lecture/api/LectureApi.java b/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/api/LectureApi.java similarity index 93% rename from operation-api/src/main/java/org/operation/app/lecture/api/LectureApi.java rename to operation-api/src/main/java/org/sopt/makers/operation/app/lecture/api/LectureApi.java index 42e8b826..410582de 100644 --- a/operation-api/src/main/java/org/operation/app/lecture/api/LectureApi.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/api/LectureApi.java @@ -1,8 +1,8 @@ -package org.operation.app.lecture.api; +package org.sopt.makers.operation.app.lecture.api; import java.security.Principal; -import org.operation.common.dto.BaseResponse; +import org.sopt.makers.operation.common.dto.BaseResponse; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PathVariable; diff --git a/operation-api/src/main/java/org/operation/app/lecture/api/LectureApiController.java b/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/api/LectureApiController.java similarity index 78% rename from operation-api/src/main/java/org/operation/app/lecture/api/LectureApiController.java rename to operation-api/src/main/java/org/sopt/makers/operation/app/lecture/api/LectureApiController.java index bb83c817..bd3b997b 100644 --- a/operation-api/src/main/java/org/operation/app/lecture/api/LectureApiController.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/api/LectureApiController.java @@ -1,12 +1,12 @@ -package org.operation.app.lecture.api; +package org.sopt.makers.operation.app.lecture.api; -import static org.operation.app.lecture.message.SuccessMessage.*; +import static org.sopt.makers.operation.app.lecture.message.SuccessMessage.*; import java.security.Principal; -import org.operation.app.lecture.service.LectureService; -import org.operation.common.dto.BaseResponse; -import org.operation.common.util.ApiResponseUtil; +import org.sopt.makers.operation.app.lecture.service.LectureService; +import org.sopt.makers.operation.common.dto.BaseResponse; +import org.sopt.makers.operation.common.util.ApiResponseUtil; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; diff --git a/operation-api/src/main/java/org/operation/app/lecture/message/SuccessMessage.java b/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/message/SuccessMessage.java similarity index 83% rename from operation-api/src/main/java/org/operation/app/lecture/message/SuccessMessage.java rename to operation-api/src/main/java/org/sopt/makers/operation/app/lecture/message/SuccessMessage.java index 2790fa80..79bfeda1 100644 --- a/operation-api/src/main/java/org/operation/app/lecture/message/SuccessMessage.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/message/SuccessMessage.java @@ -1,4 +1,4 @@ -package org.operation.app.lecture.message; +package org.sopt.makers.operation.app.lecture.message; import lombok.Getter; import lombok.RequiredArgsConstructor; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/service/LectureService.java b/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/service/LectureService.java new file mode 100644 index 00000000..39cb498d --- /dev/null +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/service/LectureService.java @@ -0,0 +1,10 @@ +package org.sopt.makers.operation.app.lecture.service; + +import org.sopt.makers.operation.app.lecture.dto.response.LectureCurrentRoundResponse; +import org.sopt.makers.operation.app.lecture.dto.response.TodayLectureResponse; + +public interface LectureService { + + TodayLectureResponse getTodayLecture(long memberPlaygroundId); + LectureCurrentRoundResponse getCurrentLectureRound(long lectureId); +} diff --git a/operation-api/src/main/java/org/operation/app/member/api/MemberApi.java b/operation-api/src/main/java/org/sopt/makers/operation/app/member/api/MemberApi.java similarity index 93% rename from operation-api/src/main/java/org/operation/app/member/api/MemberApi.java rename to operation-api/src/main/java/org/sopt/makers/operation/app/member/api/MemberApi.java index 2fef1e53..ed3973f4 100644 --- a/operation-api/src/main/java/org/operation/app/member/api/MemberApi.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/member/api/MemberApi.java @@ -1,8 +1,8 @@ -package org.operation.app.member.api; +package org.sopt.makers.operation.app.member.api; import java.security.Principal; -import org.operation.common.dto.BaseResponse; +import org.sopt.makers.operation.common.dto.BaseResponse; import org.springframework.http.ResponseEntity; import io.swagger.v3.oas.annotations.Operation; @@ -10,7 +10,6 @@ import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.security.SecurityRequirement; import lombok.NonNull; -import lombok.val; public interface MemberApi { diff --git a/operation-api/src/main/java/org/operation/app/member/api/MemberApiController.java b/operation-api/src/main/java/org/sopt/makers/operation/app/member/api/MemberApiController.java similarity index 76% rename from operation-api/src/main/java/org/operation/app/member/api/MemberApiController.java rename to operation-api/src/main/java/org/sopt/makers/operation/app/member/api/MemberApiController.java index 2bd286fc..424fe469 100644 --- a/operation-api/src/main/java/org/operation/app/member/api/MemberApiController.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/member/api/MemberApiController.java @@ -1,13 +1,13 @@ -package org.operation.app.member.api; +package org.sopt.makers.operation.app.member.api; -import static org.operation.app.member.message.SuccessMessage.*; +import static org.sopt.makers.operation.app.member.message.SuccessMessage.*; import java.security.Principal; -import org.operation.app.member.service.MemberService; -import org.operation.common.dto.BaseResponse; -import org.operation.common.util.ApiResponseUtil; -import org.operation.common.util.CommonUtils; +import org.sopt.makers.operation.app.member.service.MemberService; +import org.sopt.makers.operation.common.dto.BaseResponse; +import org.sopt.makers.operation.common.util.ApiResponseUtil; +import org.sopt.makers.operation.common.util.CommonUtils; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; diff --git a/operation-api/src/main/java/org/operation/app/member/message/SuccessMessage.java b/operation-api/src/main/java/org/sopt/makers/operation/app/member/message/SuccessMessage.java similarity index 84% rename from operation-api/src/main/java/org/operation/app/member/message/SuccessMessage.java rename to operation-api/src/main/java/org/sopt/makers/operation/app/member/message/SuccessMessage.java index fb495b9c..b9d0569c 100644 --- a/operation-api/src/main/java/org/operation/app/member/message/SuccessMessage.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/member/message/SuccessMessage.java @@ -1,4 +1,4 @@ -package org.operation.app.member.message; +package org.sopt.makers.operation.app.member.message; import lombok.Getter; import lombok.RequiredArgsConstructor; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/member/service/MemberService.java b/operation-api/src/main/java/org/sopt/makers/operation/app/member/service/MemberService.java new file mode 100644 index 00000000..af2ede48 --- /dev/null +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/member/service/MemberService.java @@ -0,0 +1,9 @@ +package org.sopt.makers.operation.app.member.service; + +import org.sopt.makers.operation.app.member.dto.response.AttendanceTotalResponseDTO; +import org.sopt.makers.operation.app.member.dto.response.MemberScoreGetResponse; + +public interface MemberService { + AttendanceTotalResponseDTO getMemberTotalAttendance(Long playGroundId); + MemberScoreGetResponse getMemberScore(Long playGroundId); +} diff --git a/operation-api/src/main/java/org/operation/app/schedule/api/ScheduleApi.java b/operation-api/src/main/java/org/sopt/makers/operation/app/schedule/api/ScheduleApi.java similarity index 90% rename from operation-api/src/main/java/org/operation/app/schedule/api/ScheduleApi.java rename to operation-api/src/main/java/org/sopt/makers/operation/app/schedule/api/ScheduleApi.java index 82153825..1a781363 100644 --- a/operation-api/src/main/java/org/operation/app/schedule/api/ScheduleApi.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/schedule/api/ScheduleApi.java @@ -1,8 +1,8 @@ -package org.operation.app.schedule.api; +package org.sopt.makers.operation.app.schedule.api; import java.time.LocalDateTime; -import org.operation.common.dto.BaseResponse; +import org.sopt.makers.operation.common.dto.BaseResponse; import org.springframework.format.annotation.DateTimeFormat; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.RequestParam; diff --git a/operation-api/src/main/java/org/operation/app/schedule/api/ScheduleApiController.java b/operation-api/src/main/java/org/sopt/makers/operation/app/schedule/api/ScheduleApiController.java similarity index 76% rename from operation-api/src/main/java/org/operation/app/schedule/api/ScheduleApiController.java rename to operation-api/src/main/java/org/sopt/makers/operation/app/schedule/api/ScheduleApiController.java index 914f4374..5149ab41 100644 --- a/operation-api/src/main/java/org/operation/app/schedule/api/ScheduleApiController.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/schedule/api/ScheduleApiController.java @@ -1,12 +1,12 @@ -package org.operation.app.schedule.api; +package org.sopt.makers.operation.app.schedule.api; -import static org.operation.app.schedule.message.SuccessMessage.*; +import static org.sopt.makers.operation.app.schedule.message.SuccessMessage.*; import java.time.LocalDateTime; -import org.operation.app.schedule.service.ScheduleService; -import org.operation.common.dto.BaseResponse; -import org.operation.common.util.ApiResponseUtil; +import org.sopt.makers.operation.app.schedule.service.ScheduleService; +import org.sopt.makers.operation.common.dto.BaseResponse; +import org.sopt.makers.operation.common.util.ApiResponseUtil; import org.springframework.format.annotation.DateTimeFormat; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; diff --git a/operation-api/src/main/java/org/operation/app/schedule/message/SuccessMessage.java b/operation-api/src/main/java/org/sopt/makers/operation/app/schedule/message/SuccessMessage.java similarity index 79% rename from operation-api/src/main/java/org/operation/app/schedule/message/SuccessMessage.java rename to operation-api/src/main/java/org/sopt/makers/operation/app/schedule/message/SuccessMessage.java index 659e1e08..f16ed797 100644 --- a/operation-api/src/main/java/org/operation/app/schedule/message/SuccessMessage.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/schedule/message/SuccessMessage.java @@ -1,4 +1,4 @@ -package org.operation.app.schedule.message; +package org.sopt.makers.operation.app.schedule.message; import lombok.Getter; import lombok.RequiredArgsConstructor; diff --git a/operation-api/src/main/java/org/operation/app/schedule/service/ScheduleService.java b/operation-api/src/main/java/org/sopt/makers/operation/app/schedule/service/ScheduleService.java similarity index 51% rename from operation-api/src/main/java/org/operation/app/schedule/service/ScheduleService.java rename to operation-api/src/main/java/org/sopt/makers/operation/app/schedule/service/ScheduleService.java index e48cfd9f..ef80edd7 100644 --- a/operation-api/src/main/java/org/operation/app/schedule/service/ScheduleService.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/schedule/service/ScheduleService.java @@ -1,8 +1,8 @@ -package org.operation.app.schedule.service; +package org.sopt.makers.operation.app.schedule.service; import java.time.LocalDateTime; -import org.operation.app.schedule.dto.response.SchedulesResponseDTO; +import org.sopt.makers.operation.app.schedule.dto.response.SchedulesResponseDTO; public interface ScheduleService { SchedulesResponseDTO getSchedules(LocalDateTime start, LocalDateTime end); diff --git a/operation-api/src/main/java/org/operation/common/config/SwaggerConfig.java b/operation-api/src/main/java/org/sopt/makers/operation/common/config/SwaggerConfig.java similarity index 94% rename from operation-api/src/main/java/org/operation/common/config/SwaggerConfig.java rename to operation-api/src/main/java/org/sopt/makers/operation/common/config/SwaggerConfig.java index ae1be08c..59fb7d46 100644 --- a/operation-api/src/main/java/org/operation/common/config/SwaggerConfig.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/common/config/SwaggerConfig.java @@ -1,4 +1,4 @@ -package org.operation.common.config; +package org.sopt.makers.operation.common.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/operation-api/src/main/java/org/operation/common/config/TimezoneConfig.java b/operation-api/src/main/java/org/sopt/makers/operation/common/config/TimezoneConfig.java similarity index 87% rename from operation-api/src/main/java/org/operation/common/config/TimezoneConfig.java rename to operation-api/src/main/java/org/sopt/makers/operation/common/config/TimezoneConfig.java index 0274dce2..4555d81b 100644 --- a/operation-api/src/main/java/org/operation/common/config/TimezoneConfig.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/common/config/TimezoneConfig.java @@ -1,4 +1,4 @@ -package org.operation.common.config; +package org.sopt.makers.operation.common.config; import java.util.TimeZone; diff --git a/operation-api/src/main/java/org/operation/common/dto/BaseResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/common/dto/BaseResponse.java similarity index 93% rename from operation-api/src/main/java/org/operation/common/dto/BaseResponse.java rename to operation-api/src/main/java/org/sopt/makers/operation/common/dto/BaseResponse.java index e0e97810..1ba03a2e 100644 --- a/operation-api/src/main/java/org/operation/common/dto/BaseResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/common/dto/BaseResponse.java @@ -1,4 +1,4 @@ -package org.operation.common.dto; +package org.sopt.makers.operation.common.dto; import com.fasterxml.jackson.annotation.JsonInclude; diff --git a/operation-api/src/main/java/org/operation/common/handler/ErrorHandler.java b/operation-api/src/main/java/org/sopt/makers/operation/common/handler/ErrorHandler.java similarity index 80% rename from operation-api/src/main/java/org/operation/common/handler/ErrorHandler.java rename to operation-api/src/main/java/org/sopt/makers/operation/common/handler/ErrorHandler.java index 1f769822..3c81da5e 100644 --- a/operation-api/src/main/java/org/operation/common/handler/ErrorHandler.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/common/handler/ErrorHandler.java @@ -1,17 +1,17 @@ -package org.operation.common.handler; +package org.sopt.makers.operation.common.handler; import static org.springframework.http.HttpStatus.*; import java.time.format.DateTimeParseException; -import org.operation.common.dto.BaseResponse; -import org.operation.common.exception.MemberException; -import org.operation.common.util.ApiResponseUtil; -import org.operation.common.exception.AdminFailureException; -import org.operation.common.exception.TokenException; -import org.operation.common.exception.AlarmException; -import org.operation.common.exception.LectureException; -import org.operation.common.exception.SubLectureException; +import org.sopt.makers.operation.common.dto.BaseResponse; +import org.sopt.makers.operation.common.exception.MemberException; +import org.sopt.makers.operation.common.util.ApiResponseUtil; +import org.sopt.makers.operation.common.exception.AdminFailureException; +import org.sopt.makers.operation.common.exception.TokenException; +import org.sopt.makers.operation.common.exception.AlarmException; +import org.sopt.makers.operation.common.exception.LectureException; +import org.sopt.makers.operation.common.exception.SubLectureException; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RestControllerAdvice; diff --git a/operation-api/src/main/java/org/operation/common/scheduler/LectureScheduler.java b/operation-api/src/main/java/org/sopt/makers/operation/common/scheduler/LectureScheduler.java similarity index 78% rename from operation-api/src/main/java/org/operation/common/scheduler/LectureScheduler.java rename to operation-api/src/main/java/org/sopt/makers/operation/common/scheduler/LectureScheduler.java index e1a0d24e..c88673b2 100644 --- a/operation-api/src/main/java/org/operation/common/scheduler/LectureScheduler.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/common/scheduler/LectureScheduler.java @@ -1,6 +1,6 @@ -package org.operation.common.scheduler; +package org.sopt.makers.operation.common.scheduler; -import org.operation.common.scheduler.service.LectureService; +import org.sopt.makers.operation.common.scheduler.service.LectureService; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/common/scheduler/service/LectureService.java b/operation-api/src/main/java/org/sopt/makers/operation/common/scheduler/service/LectureService.java new file mode 100644 index 00000000..bab3d588 --- /dev/null +++ b/operation-api/src/main/java/org/sopt/makers/operation/common/scheduler/service/LectureService.java @@ -0,0 +1,6 @@ +package org.sopt.makers.operation.common.scheduler.service; + +public interface LectureService { + + void endLectures(); +} diff --git a/operation-api/src/main/java/org/operation/common/util/ApiResponseUtil.java b/operation-api/src/main/java/org/sopt/makers/operation/common/util/ApiResponseUtil.java similarity index 90% rename from operation-api/src/main/java/org/operation/common/util/ApiResponseUtil.java rename to operation-api/src/main/java/org/sopt/makers/operation/common/util/ApiResponseUtil.java index aaf95a0e..635c34d0 100644 --- a/operation-api/src/main/java/org/operation/common/util/ApiResponseUtil.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/common/util/ApiResponseUtil.java @@ -1,8 +1,8 @@ -package org.operation.common.util; +package org.sopt.makers.operation.common.util; import java.net.URI; -import org.operation.common.dto.BaseResponse; +import org.sopt.makers.operation.common.dto.BaseResponse; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; diff --git a/operation-api/src/main/java/org/operation/common/util/CommonUtils.java b/operation-api/src/main/java/org/sopt/makers/operation/common/util/CommonUtils.java similarity index 91% rename from operation-api/src/main/java/org/operation/common/util/CommonUtils.java rename to operation-api/src/main/java/org/sopt/makers/operation/common/util/CommonUtils.java index e321255c..fcd29e70 100644 --- a/operation-api/src/main/java/org/operation/common/util/CommonUtils.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/common/util/CommonUtils.java @@ -1,4 +1,4 @@ -package org.operation.common.util; +package org.sopt.makers.operation.common.util; import java.net.URI; import java.security.Principal; diff --git a/operation-api/src/main/java/org/operation/common/util/Cookie.java b/operation-api/src/main/java/org/sopt/makers/operation/common/util/Cookie.java similarity index 94% rename from operation-api/src/main/java/org/operation/common/util/Cookie.java rename to operation-api/src/main/java/org/sopt/makers/operation/common/util/Cookie.java index bc3f574a..849bed17 100644 --- a/operation-api/src/main/java/org/operation/common/util/Cookie.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/common/util/Cookie.java @@ -1,4 +1,4 @@ -package org.operation.common.util; +package org.sopt.makers.operation.common.util; import lombok.val; import org.springframework.context.annotation.Configuration; diff --git a/operation-api/src/main/java/org/operation/web/admin/api/AdminApi.java b/operation-api/src/main/java/org/sopt/makers/operation/web/admin/api/AdminApi.java similarity index 88% rename from operation-api/src/main/java/org/operation/web/admin/api/AdminApi.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/admin/api/AdminApi.java index 08b435d5..d016e5bb 100644 --- a/operation-api/src/main/java/org/operation/web/admin/api/AdminApi.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/admin/api/AdminApi.java @@ -1,8 +1,8 @@ -package org.operation.web.admin.api; +package org.sopt.makers.operation.web.admin.api; -import org.operation.common.dto.BaseResponse; -import org.operation.web.admin.dto.request.LoginRequest; -import org.operation.web.admin.dto.request.SignUpRequest; +import org.sopt.makers.operation.common.dto.BaseResponse; +import org.sopt.makers.operation.web.admin.dto.request.LoginRequest; +import org.sopt.makers.operation.web.admin.dto.request.SignUpRequest; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.CookieValue; import org.springframework.web.bind.annotation.RequestBody; diff --git a/operation-api/src/main/java/org/operation/web/admin/api/AdminApiController.java b/operation-api/src/main/java/org/sopt/makers/operation/web/admin/api/AdminApiController.java similarity index 75% rename from operation-api/src/main/java/org/operation/web/admin/api/AdminApiController.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/admin/api/AdminApiController.java index 37ef4da4..905b3e3d 100644 --- a/operation-api/src/main/java/org/operation/web/admin/api/AdminApiController.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/admin/api/AdminApiController.java @@ -1,13 +1,13 @@ -package org.operation.web.admin.api; +package org.sopt.makers.operation.web.admin.api; -import static org.operation.web.admin.message.SuccessMessage.*; +import static org.sopt.makers.operation.web.admin.message.SuccessMessage.*; -import org.operation.common.dto.BaseResponse; -import org.operation.common.util.ApiResponseUtil; -import org.operation.common.util.Cookie; -import org.operation.web.admin.dto.request.LoginRequest; -import org.operation.web.admin.dto.request.SignUpRequest; -import org.operation.web.admin.service.AdminService; +import org.sopt.makers.operation.common.dto.BaseResponse; +import org.sopt.makers.operation.common.util.ApiResponseUtil; +import org.sopt.makers.operation.common.util.Cookie; +import org.sopt.makers.operation.web.admin.dto.request.LoginRequest; +import org.sopt.makers.operation.web.admin.dto.request.SignUpRequest; +import org.sopt.makers.operation.web.admin.service.AdminService; import org.springframework.context.annotation.ComponentScan; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PatchMapping; diff --git a/operation-api/src/main/java/org/operation/web/admin/message/SuccessMessage.java b/operation-api/src/main/java/org/sopt/makers/operation/web/admin/message/SuccessMessage.java similarity index 84% rename from operation-api/src/main/java/org/operation/web/admin/message/SuccessMessage.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/admin/message/SuccessMessage.java index 2bf6a6f9..2aea3dc4 100644 --- a/operation-api/src/main/java/org/operation/web/admin/message/SuccessMessage.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/admin/message/SuccessMessage.java @@ -1,4 +1,4 @@ -package org.operation.web.admin.message; +package org.sopt.makers.operation.web.admin.message; import lombok.Getter; import lombok.RequiredArgsConstructor; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/admin/service/AdminService.java b/operation-api/src/main/java/org/sopt/makers/operation/web/admin/service/AdminService.java new file mode 100644 index 00000000..241b6f9b --- /dev/null +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/admin/service/AdminService.java @@ -0,0 +1,13 @@ +package org.sopt.makers.operation.web.admin.service; + +import org.sopt.makers.operation.web.admin.dto.request.LoginRequest; +import org.sopt.makers.operation.web.admin.dto.request.SignUpRequest; +import org.sopt.makers.operation.web.admin.dto.response.LoginResponse; +import org.sopt.makers.operation.web.admin.dto.response.RefreshResponse; +import org.sopt.makers.operation.web.admin.dto.response.SignUpResponse; + +public interface AdminService { + SignUpResponse signUp(SignUpRequest request); + LoginResponse login(LoginRequest request); + RefreshResponse refresh(String refreshToken); +} diff --git a/operation-api/src/main/java/org/operation/web/alarm/api/AlarmApi.java b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/api/AlarmApi.java similarity index 91% rename from operation-api/src/main/java/org/operation/web/alarm/api/AlarmApi.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/alarm/api/AlarmApi.java index 2f8f4549..4c31b1f8 100644 --- a/operation-api/src/main/java/org/operation/web/alarm/api/AlarmApi.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/api/AlarmApi.java @@ -1,10 +1,10 @@ -package org.operation.web.alarm.api; +package org.sopt.makers.operation.web.alarm.api; import org.operation.alarm.domain.Status; -import org.operation.common.domain.Part; -import org.operation.common.dto.BaseResponse; -import org.operation.web.alarm.dto.request.AlarmRequest; -import org.operation.web.alarm.dto.request.AlarmSendRequest; +import org.sopt.makers.operation.domain.Part; +import org.sopt.makers.operation.common.dto.BaseResponse; +import org.sopt.makers.operation.dto.AlarmRequest; +import org.sopt.makers.operation.web.alarm.dto.request.AlarmSendRequest; import org.springframework.data.domain.Pageable; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PathVariable; diff --git a/operation-api/src/main/java/org/operation/web/alarm/api/AlarmApiController.java b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/api/AlarmApiController.java similarity index 80% rename from operation-api/src/main/java/org/operation/web/alarm/api/AlarmApiController.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/alarm/api/AlarmApiController.java index a67980d2..a8bbffa9 100644 --- a/operation-api/src/main/java/org/operation/web/alarm/api/AlarmApiController.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/api/AlarmApiController.java @@ -1,15 +1,15 @@ -package org.operation.web.alarm.api; +package org.sopt.makers.operation.web.alarm.api; -import static org.operation.web.alarm.message.SuccessMessage.*; +import static org.sopt.makers.operation.web.alarm.message.SuccessMessage.*; import org.operation.alarm.domain.Status; -import org.operation.common.domain.Part; -import org.operation.common.dto.BaseResponse; -import org.operation.common.util.ApiResponseUtil; -import org.operation.common.util.CommonUtils; -import org.operation.web.alarm.dto.request.AlarmRequest; -import org.operation.web.alarm.dto.request.AlarmSendRequest; -import org.operation.web.alarm.service.AlarmService; +import org.sopt.makers.operation.domain.Part; +import org.sopt.makers.operation.common.dto.BaseResponse; +import org.sopt.makers.operation.common.util.ApiResponseUtil; +import org.sopt.makers.operation.common.util.CommonUtils; +import org.sopt.makers.operation.dto.AlarmRequest; +import org.sopt.makers.operation.web.alarm.dto.request.AlarmSendRequest; +import org.sopt.makers.operation.web.alarm.service.AlarmService; import org.springframework.data.domain.Pageable; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.DeleteMapping; diff --git a/operation-api/src/main/java/org/operation/web/alarm/message/SuccessMessage.java b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/message/SuccessMessage.java similarity index 88% rename from operation-api/src/main/java/org/operation/web/alarm/message/SuccessMessage.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/alarm/message/SuccessMessage.java index 16858ad6..f343d905 100644 --- a/operation-api/src/main/java/org/operation/web/alarm/message/SuccessMessage.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/message/SuccessMessage.java @@ -1,4 +1,4 @@ -package org.operation.web.alarm.message; +package org.sopt.makers.operation.web.alarm.message; import lombok.Getter; import lombok.RequiredArgsConstructor; diff --git a/operation-api/src/main/java/org/operation/web/alarm/service/AlarmService.java b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/service/AlarmService.java similarity index 50% rename from operation-api/src/main/java/org/operation/web/alarm/service/AlarmService.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/alarm/service/AlarmService.java index 4d581b52..b58fdd5a 100644 --- a/operation-api/src/main/java/org/operation/web/alarm/service/AlarmService.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/service/AlarmService.java @@ -1,11 +1,11 @@ -package org.operation.web.alarm.service; +package org.sopt.makers.operation.web.alarm.service; import org.operation.alarm.domain.Status; -import org.operation.common.domain.Part; -import org.operation.web.alarm.dto.request.AlarmRequest; -import org.operation.web.alarm.dto.request.AlarmSendRequest; -import org.operation.web.alarm.dto.response.AlarmResponse; -import org.operation.web.alarm.dto.response.AlarmsResponse; +import org.sopt.makers.operation.domain.Part; +import org.sopt.makers.operation.dto.AlarmRequest; +import org.sopt.makers.operation.web.alarm.dto.request.AlarmSendRequest; +import org.sopt.makers.operation.web.alarm.dto.response.AlarmResponse; +import org.sopt.makers.operation.web.alarm.dto.response.AlarmsResponse; import org.springframework.data.domain.Pageable; public interface AlarmService { diff --git a/operation-api/src/main/java/org/operation/web/attendnace/api/AttendanceApi.java b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/api/AttendanceApi.java similarity index 90% rename from operation-api/src/main/java/org/operation/web/attendnace/api/AttendanceApi.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/api/AttendanceApi.java index c3c7c9ff..2be56092 100644 --- a/operation-api/src/main/java/org/operation/web/attendnace/api/AttendanceApi.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/api/AttendanceApi.java @@ -1,8 +1,8 @@ -package org.operation.web.attendnace.api; +package org.sopt.makers.operation.web.attendnace.api; -import org.operation.common.domain.Part; -import org.operation.common.dto.BaseResponse; -import org.operation.web.attendance.dto.request.SubAttendanceUpdateRequest; +import org.sopt.makers.operation.domain.Part; +import org.sopt.makers.operation.common.dto.BaseResponse; +import org.sopt.makers.operation.web.attendance.dto.request.SubAttendanceUpdateRequest; import org.springframework.data.domain.Pageable; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PathVariable; diff --git a/operation-api/src/main/java/org/operation/web/attendnace/api/AttendanceApiController.java b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/api/AttendanceApiController.java similarity index 81% rename from operation-api/src/main/java/org/operation/web/attendnace/api/AttendanceApiController.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/api/AttendanceApiController.java index b369a7ca..c3184936 100644 --- a/operation-api/src/main/java/org/operation/web/attendnace/api/AttendanceApiController.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/api/AttendanceApiController.java @@ -1,12 +1,12 @@ -package org.operation.web.attendnace.api; +package org.sopt.makers.operation.web.attendnace.api; -import static org.operation.web.attendnace.message.SuccessMessage.*; +import static org.sopt.makers.operation.web.attendnace.message.SuccessMessage.*; -import org.operation.common.domain.Part; -import org.operation.common.dto.BaseResponse; -import org.operation.common.util.ApiResponseUtil; -import org.operation.web.attendance.dto.request.SubAttendanceUpdateRequest; -import org.operation.web.attendnace.service.AttendanceService; +import org.sopt.makers.operation.domain.Part; +import org.sopt.makers.operation.common.dto.BaseResponse; +import org.sopt.makers.operation.common.util.ApiResponseUtil; +import org.sopt.makers.operation.web.attendance.dto.request.SubAttendanceUpdateRequest; +import org.sopt.makers.operation.web.attendnace.service.AttendanceService; import org.springframework.data.domain.Pageable; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; diff --git a/operation-api/src/main/java/org/operation/web/attendnace/message/SuccessMessage.java b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/message/SuccessMessage.java similarity index 88% rename from operation-api/src/main/java/org/operation/web/attendnace/message/SuccessMessage.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/message/SuccessMessage.java index 1be79795..128a4e1f 100644 --- a/operation-api/src/main/java/org/operation/web/attendnace/message/SuccessMessage.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/message/SuccessMessage.java @@ -1,4 +1,4 @@ -package org.operation.web.attendnace.message; +package org.sopt.makers.operation.web.attendnace.message; import lombok.Getter; import lombok.RequiredArgsConstructor; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/service/AttendanceService.java b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/service/AttendanceService.java new file mode 100644 index 00000000..2506df51 --- /dev/null +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/service/AttendanceService.java @@ -0,0 +1,15 @@ +package org.sopt.makers.operation.web.attendnace.service; + +import org.sopt.makers.operation.domain.Part; +import org.sopt.makers.operation.web.attendance.dto.request.SubAttendanceUpdateRequest; +import org.sopt.makers.operation.web.attendance.dto.response.AttendanceMemberResponse; +import org.sopt.makers.operation.web.attendance.dto.response.AttendancesResponse; +import org.sopt.makers.operation.web.attendance.dto.response.SubAttendanceUpdateResponse; +import org.springframework.data.domain.Pageable; + +public interface AttendanceService { + SubAttendanceUpdateResponse updateSubAttendance(SubAttendanceUpdateRequest request); + AttendanceMemberResponse findAttendancesByMember(long memberId); + float updateMemberScore(Long memberId); + AttendancesResponse findAttendancesByLecture(long lectureId, Part part, Pageable pageable); +} diff --git a/operation-api/src/main/java/org/operation/web/lecture/api/LectureApi.java b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/api/LectureApi.java similarity index 92% rename from operation-api/src/main/java/org/operation/web/lecture/api/LectureApi.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/lecture/api/LectureApi.java index bdfacf62..9d45bb29 100644 --- a/operation-api/src/main/java/org/operation/web/lecture/api/LectureApi.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/api/LectureApi.java @@ -1,9 +1,9 @@ -package org.operation.web.lecture.api; +package org.sopt.makers.operation.web.lecture.api; -import org.operation.common.domain.Part; -import org.operation.common.dto.BaseResponse; -import org.operation.web.lecture.dto.request.AttendanceRequest; -import org.operation.web.lecture.dto.request.LectureRequest; +import org.sopt.makers.operation.domain.Part; +import org.sopt.makers.operation.common.dto.BaseResponse; +import org.sopt.makers.operation.web.lecture.dto.request.AttendanceRequest; +import org.sopt.makers.operation.web.lecture.dto.request.LectureRequest; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; diff --git a/operation-api/src/main/java/org/operation/web/lecture/api/LectureApiController.java b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/api/LectureApiController.java similarity index 83% rename from operation-api/src/main/java/org/operation/web/lecture/api/LectureApiController.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/lecture/api/LectureApiController.java index c6ca1664..8cfb8620 100644 --- a/operation-api/src/main/java/org/operation/web/lecture/api/LectureApiController.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/api/LectureApiController.java @@ -1,14 +1,14 @@ -package org.operation.web.lecture.api; +package org.sopt.makers.operation.web.lecture.api; -import static org.operation.web.lecture.message.SuccessMessage.*; +import static org.sopt.makers.operation.web.lecture.message.SuccessMessage.*; -import org.operation.common.domain.Part; -import org.operation.common.dto.BaseResponse; -import org.operation.common.util.ApiResponseUtil; -import org.operation.common.util.CommonUtils; -import org.operation.web.lecture.dto.request.AttendanceRequest; -import org.operation.web.lecture.dto.request.LectureRequest; -import org.operation.web.lecture.service.LectureService; +import org.sopt.makers.operation.domain.Part; +import org.sopt.makers.operation.common.dto.BaseResponse; +import org.sopt.makers.operation.common.util.ApiResponseUtil; +import org.sopt.makers.operation.common.util.CommonUtils; +import org.sopt.makers.operation.web.lecture.dto.request.AttendanceRequest; +import org.sopt.makers.operation.web.lecture.dto.request.LectureRequest; +import org.sopt.makers.operation.web.lecture.service.LectureService; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; diff --git a/operation-api/src/main/java/org/operation/web/lecture/message/SuccessMessage.java b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/message/SuccessMessage.java similarity index 90% rename from operation-api/src/main/java/org/operation/web/lecture/message/SuccessMessage.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/lecture/message/SuccessMessage.java index 52e93c9a..128f2ba7 100644 --- a/operation-api/src/main/java/org/operation/web/lecture/message/SuccessMessage.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/message/SuccessMessage.java @@ -1,4 +1,4 @@ -package org.operation.web.lecture.message; +package org.sopt.makers.operation.web.lecture.message; import lombok.Getter; import lombok.RequiredArgsConstructor; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/service/LectureService.java b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/service/LectureService.java new file mode 100644 index 00000000..31f48c22 --- /dev/null +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/service/LectureService.java @@ -0,0 +1,19 @@ +package org.sopt.makers.operation.web.lecture.service; + +import org.sopt.makers.operation.domain.Part; +import org.sopt.makers.operation.web.lecture.dto.request.AttendanceRequest; +import org.sopt.makers.operation.web.lecture.dto.request.LectureRequest; +import org.sopt.makers.operation.web.lecture.dto.response.AttendanceResponse; +import org.sopt.makers.operation.web.lecture.dto.response.LectureDetailResponse; +import org.sopt.makers.operation.web.lecture.dto.response.LectureResponse; +import org.sopt.makers.operation.web.lecture.dto.response.LecturesResponse; + +public interface LectureService { + long createLecture(LectureRequest request); + LecturesResponse getLectures(int generation, Part part); + LectureResponse getLecture(long lectureId); + AttendanceResponse startAttendance(AttendanceRequest request); + void endLecture(Long lectureId); + void deleteLecture(Long lectureId); + LectureDetailResponse getLectureDetail(long lectureId); +} diff --git a/operation-api/src/main/java/org/operation/web/member/api/MemberApi.java b/operation-api/src/main/java/org/sopt/makers/operation/web/member/api/MemberApi.java similarity index 84% rename from operation-api/src/main/java/org/operation/web/member/api/MemberApi.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/member/api/MemberApi.java index 7cfb5646..b35c4bfb 100644 --- a/operation-api/src/main/java/org/operation/web/member/api/MemberApi.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/member/api/MemberApi.java @@ -1,7 +1,7 @@ -package org.operation.web.member.api; +package org.sopt.makers.operation.web.member.api; -import org.operation.common.domain.Part; -import org.operation.common.dto.BaseResponse; +import org.sopt.makers.operation.domain.Part; +import org.sopt.makers.operation.common.dto.BaseResponse; import org.springframework.data.domain.Pageable; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.RequestParam; diff --git a/operation-api/src/main/java/org/operation/web/member/api/MemberApiController.java b/operation-api/src/main/java/org/sopt/makers/operation/web/member/api/MemberApiController.java similarity index 72% rename from operation-api/src/main/java/org/operation/web/member/api/MemberApiController.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/member/api/MemberApiController.java index 63e97e74..ec735980 100644 --- a/operation-api/src/main/java/org/operation/web/member/api/MemberApiController.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/member/api/MemberApiController.java @@ -1,11 +1,11 @@ -package org.operation.web.member.api; +package org.sopt.makers.operation.web.member.api; -import static org.operation.web.member.message.SuccessMessage.*; +import static org.sopt.makers.operation.web.member.message.SuccessMessage.*; -import org.operation.common.domain.Part; -import org.operation.common.dto.BaseResponse; -import org.operation.common.util.ApiResponseUtil; -import org.operation.web.member.service.MemberService; +import org.sopt.makers.operation.domain.Part; +import org.sopt.makers.operation.common.dto.BaseResponse; +import org.sopt.makers.operation.common.util.ApiResponseUtil; +import org.sopt.makers.operation.web.member.service.MemberService; import org.springframework.data.domain.Pageable; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; diff --git a/operation-api/src/main/java/org/operation/web/member/message/SuccessMessage.java b/operation-api/src/main/java/org/sopt/makers/operation/web/member/message/SuccessMessage.java similarity index 80% rename from operation-api/src/main/java/org/operation/web/member/message/SuccessMessage.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/member/message/SuccessMessage.java index d62f23a6..39648185 100644 --- a/operation-api/src/main/java/org/operation/web/member/message/SuccessMessage.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/member/message/SuccessMessage.java @@ -1,4 +1,4 @@ -package org.operation.web.member.message; +package org.sopt.makers.operation.web.member.message; import lombok.Getter; import lombok.RequiredArgsConstructor; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/member/service/MemberService.java b/operation-api/src/main/java/org/sopt/makers/operation/web/member/service/MemberService.java new file mode 100644 index 00000000..bd2ba65a --- /dev/null +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/member/service/MemberService.java @@ -0,0 +1,9 @@ +package org.sopt.makers.operation.web.member.service; + +import org.sopt.makers.operation.domain.Part; +import org.sopt.makers.operation.web.member.dto.response.MembersResponse; +import org.springframework.data.domain.Pageable; + +public interface MemberService { + MembersResponse getMemberList(Part part, int generation, Pageable pageable); +} diff --git a/operation-common/build.gradle b/operation-common/build.gradle new file mode 100644 index 00000000..5d71a3a5 --- /dev/null +++ b/operation-common/build.gradle @@ -0,0 +1,18 @@ +plugins { + id 'java' +} + +group = 'org.sopt.makers' +version = '0.0.1-SNAPSHOT' + +repositories { + mavenCentral() +} + +dependencies { + implementation 'org.springframework.boot:spring-boot-starter-web' +} + +test { + useJUnitPlatform() +} \ No newline at end of file diff --git a/operation-service/src/main/java/org/operation/common/config/ValueConfig.java b/operation-common/src/main/java/org/sopt/makers/operation/config/ValueConfig.java similarity index 97% rename from operation-service/src/main/java/org/operation/common/config/ValueConfig.java rename to operation-common/src/main/java/org/sopt/makers/operation/config/ValueConfig.java index 0dd4f57f..54081b76 100644 --- a/operation-service/src/main/java/org/operation/common/config/ValueConfig.java +++ b/operation-common/src/main/java/org/sopt/makers/operation/config/ValueConfig.java @@ -1,4 +1,4 @@ -package org.operation.common.config; +package org.sopt.makers.operation.config; import java.util.Arrays; import java.util.List; diff --git a/operation-domain/build.gradle b/operation-domain/build.gradle index 2b46598e..80988c3c 100644 --- a/operation-domain/build.gradle +++ b/operation-domain/build.gradle @@ -1,5 +1,12 @@ +buildscript { + ext { + queryDslVersion = "5.0.0" + } +} + plugins { id 'java' + id 'com.ewerk.gradle.plugins.querydsl' version '1.0.10' } group = 'org.sopt.makers' @@ -10,13 +17,37 @@ repositories { } dependencies { - implementation project(path: ':operation-service') + implementation project(path: ':operation-common') implementation 'org.springframework.boot:spring-boot-starter-data-jpa' implementation "com.querydsl:querydsl-jpa:5.0.0" implementation "com.querydsl:querydsl-apt:5.0.0" + + // https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind + implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.14.0-rc1' + + } test { useJUnitPlatform() +} + +def querydslDir = "$buildDir/generated/querydsl" + +querydsl { + jpa = true + querydslSourcesDir = querydslDir +} +sourceSets { + main.java.srcDir querydslDir +} +compileQuerydsl{ + options.annotationProcessorPath = configurations.querydsl +} +configurations { + compileOnly { + extendsFrom annotationProcessor + } + querydsl.extendsFrom compileClasspath } \ No newline at end of file diff --git a/operation-domain/src/main/java/org/operation/lecture/repository/lecture/LectureRepository.java b/operation-domain/src/main/java/org/operation/lecture/repository/lecture/LectureRepository.java deleted file mode 100644 index 860939d4..00000000 --- a/operation-domain/src/main/java/org/operation/lecture/repository/lecture/LectureRepository.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.operation.lecture.repository.lecture; - -import org.operation.lecture.Lecture; -import org.springframework.data.jpa.repository.JpaRepository; - -public interface LectureRepository extends JpaRepository, LectureCustomRepository { -} diff --git a/operation-domain/src/main/java/org/operation/member/domain/ObYb.java b/operation-domain/src/main/java/org/operation/member/domain/ObYb.java deleted file mode 100644 index 5ec8b407..00000000 --- a/operation-domain/src/main/java/org/operation/member/domain/ObYb.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.operation.member.domain; - -public enum ObYb { - OB, YB -} diff --git a/operation-domain/src/main/java/org/operation/common/config/JpaAuditingConfig.java b/operation-domain/src/main/java/org/sopt/makers/operation/config/JpaAuditingConfig.java similarity index 82% rename from operation-domain/src/main/java/org/operation/common/config/JpaAuditingConfig.java rename to operation-domain/src/main/java/org/sopt/makers/operation/config/JpaAuditingConfig.java index 289d6216..b6561dd0 100644 --- a/operation-domain/src/main/java/org/operation/common/config/JpaAuditingConfig.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/config/JpaAuditingConfig.java @@ -1,4 +1,4 @@ -package org.operation.common.config; +package org.sopt.makers.operation.config; import org.springframework.context.annotation.Configuration; import org.springframework.data.jpa.repository.config.EnableJpaAuditing; diff --git a/operation-domain/src/main/java/org/operation/common/config/JpaQueryFactoryConfig.java b/operation-domain/src/main/java/org/sopt/makers/operation/config/JpaQueryFactoryConfig.java similarity index 89% rename from operation-domain/src/main/java/org/operation/common/config/JpaQueryFactoryConfig.java rename to operation-domain/src/main/java/org/sopt/makers/operation/config/JpaQueryFactoryConfig.java index bad707c2..06d4078c 100644 --- a/operation-domain/src/main/java/org/operation/common/config/JpaQueryFactoryConfig.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/config/JpaQueryFactoryConfig.java @@ -1,4 +1,4 @@ -package org.operation.common.config; +package org.sopt.makers.operation.config; import javax.persistence.EntityManager; diff --git a/operation-domain/src/main/java/org/operation/common/domain/BaseEntity.java b/operation-domain/src/main/java/org/sopt/makers/operation/domain/BaseEntity.java similarity index 92% rename from operation-domain/src/main/java/org/operation/common/domain/BaseEntity.java rename to operation-domain/src/main/java/org/sopt/makers/operation/domain/BaseEntity.java index 3456d884..50003bef 100644 --- a/operation-domain/src/main/java/org/operation/common/domain/BaseEntity.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/domain/BaseEntity.java @@ -1,4 +1,4 @@ -package org.operation.common.domain; +package org.sopt.makers.operation.domain; import java.time.LocalDateTime; diff --git a/operation-domain/src/main/java/org/operation/common/domain/Part.java b/operation-domain/src/main/java/org/sopt/makers/operation/domain/Part.java similarity index 86% rename from operation-domain/src/main/java/org/operation/common/domain/Part.java rename to operation-domain/src/main/java/org/sopt/makers/operation/domain/Part.java index 22cdc785..e36f50f6 100644 --- a/operation-domain/src/main/java/org/operation/common/domain/Part.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/domain/Part.java @@ -1,4 +1,4 @@ -package org.operation.common.domain; +package org.sopt.makers.operation.domain; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/operation-domain/src/main/java/org/operation/admin/domain/Admin.java b/operation-domain/src/main/java/org/sopt/makers/operation/domain/admin/domain/Admin.java similarity index 95% rename from operation-domain/src/main/java/org/operation/admin/domain/Admin.java rename to operation-domain/src/main/java/org/sopt/makers/operation/domain/admin/domain/Admin.java index dd0f4a0c..10d4290c 100644 --- a/operation-domain/src/main/java/org/operation/admin/domain/Admin.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/domain/admin/domain/Admin.java @@ -1,4 +1,4 @@ -package org.operation.admin.domain; +package org.sopt.makers.operation.domain.admin.domain; import lombok.Builder; import lombok.Getter; diff --git a/operation-domain/src/main/java/org/operation/admin/domain/AdminStatus.java b/operation-domain/src/main/java/org/sopt/makers/operation/domain/admin/domain/AdminStatus.java similarity index 56% rename from operation-domain/src/main/java/org/operation/admin/domain/AdminStatus.java rename to operation-domain/src/main/java/org/sopt/makers/operation/domain/admin/domain/AdminStatus.java index c61f09b2..f0b8a372 100644 --- a/operation-domain/src/main/java/org/operation/admin/domain/AdminStatus.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/domain/admin/domain/AdminStatus.java @@ -1,4 +1,4 @@ -package org.operation.admin.domain; +package org.sopt.makers.operation.domain.admin.domain; public enum AdminStatus { DEVELOPER, SOPT, MAKERS, NOT_CERTIFIED diff --git a/operation-domain/src/main/java/org/operation/admin/domain/Role.java b/operation-domain/src/main/java/org/sopt/makers/operation/domain/admin/domain/Role.java similarity index 71% rename from operation-domain/src/main/java/org/operation/admin/domain/Role.java rename to operation-domain/src/main/java/org/sopt/makers/operation/domain/admin/domain/Role.java index c2985f69..f27c610b 100644 --- a/operation-domain/src/main/java/org/operation/admin/domain/Role.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/domain/admin/domain/Role.java @@ -1,4 +1,4 @@ -package org.operation.admin.domain; +package org.sopt.makers.operation.domain.admin.domain; public enum Role { OPERATION_TEAM, PRESIDENT, VICE_PRESIDENT, AFFAIRS, MANAGE, MEDIA, PLAN, DESIGN, WEB, ANDROID, IOS, SERVER, MAKERS diff --git a/operation-domain/src/main/java/org/operation/alarm/domain/Alarm.java b/operation-domain/src/main/java/org/sopt/makers/operation/domain/alarm/domain/Alarm.java similarity index 87% rename from operation-domain/src/main/java/org/operation/alarm/domain/Alarm.java rename to operation-domain/src/main/java/org/sopt/makers/operation/domain/alarm/domain/Alarm.java index c805bbe7..b59e43cb 100644 --- a/operation-domain/src/main/java/org/operation/alarm/domain/Alarm.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/domain/alarm/domain/Alarm.java @@ -1,4 +1,4 @@ -package org.operation.alarm.domain; +package org.sopt.makers.operation.domain.alarm.domain; import static java.util.Objects.*; import static javax.persistence.EnumType.*; @@ -15,10 +15,10 @@ import javax.persistence.GeneratedValue; import javax.persistence.Id; -import org.operation.common.domain.BaseEntity; -import org.operation.common.domain.Part; -import org.operation.converter.StringListConverter; -import org.operation.web.alarm.dto.request.AlarmRequest; +import org.sopt.makers.operation.domain.BaseEntity; +import org.sopt.makers.operation.domain.Part; +import org.sopt.makers.operation.domain.converter.StringListConverter; +import org.sopt.makers.operation.dto.AlarmRequest; import lombok.Getter; import lombok.NoArgsConstructor; diff --git a/operation-domain/src/main/java/org/operation/alarm/domain/Attribute.java b/operation-domain/src/main/java/org/sopt/makers/operation/domain/alarm/domain/Attribute.java similarity index 76% rename from operation-domain/src/main/java/org/operation/alarm/domain/Attribute.java rename to operation-domain/src/main/java/org/sopt/makers/operation/domain/alarm/domain/Attribute.java index 7d6f9b42..3a79c02f 100644 --- a/operation-domain/src/main/java/org/operation/alarm/domain/Attribute.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/domain/alarm/domain/Attribute.java @@ -1,4 +1,4 @@ -package org.operation.alarm.domain; +package org.sopt.makers.operation.domain.alarm.domain; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/operation-domain/src/main/java/org/operation/alarm/domain/Status.java b/operation-domain/src/main/java/org/sopt/makers/operation/domain/alarm/domain/Status.java similarity index 76% rename from operation-domain/src/main/java/org/operation/alarm/domain/Status.java rename to operation-domain/src/main/java/org/sopt/makers/operation/domain/alarm/domain/Status.java index 821e37bf..4d711d9f 100644 --- a/operation-domain/src/main/java/org/operation/alarm/domain/Status.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/domain/alarm/domain/Status.java @@ -1,4 +1,4 @@ -package org.operation.alarm.domain; +package org.sopt.makers.operation.domain.alarm.domain; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/operation-domain/src/main/java/org/operation/alarm/message/ErrorMessage.java b/operation-domain/src/main/java/org/sopt/makers/operation/domain/alarm/message/ErrorMessage.java similarity index 86% rename from operation-domain/src/main/java/org/operation/alarm/message/ErrorMessage.java rename to operation-domain/src/main/java/org/sopt/makers/operation/domain/alarm/message/ErrorMessage.java index 92466944..a7f752c1 100644 --- a/operation-domain/src/main/java/org/operation/alarm/message/ErrorMessage.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/domain/alarm/message/ErrorMessage.java @@ -1,4 +1,4 @@ -package org.operation.alarm.message; +package org.sopt.makers.operation.domain.alarm.message; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/operation-domain/src/main/java/org/operation/alarm/repository/AlarmCustomRepository.java b/operation-domain/src/main/java/org/sopt/makers/operation/domain/alarm/repository/AlarmCustomRepository.java similarity index 56% rename from operation-domain/src/main/java/org/operation/alarm/repository/AlarmCustomRepository.java rename to operation-domain/src/main/java/org/sopt/makers/operation/domain/alarm/repository/AlarmCustomRepository.java index 46e519f3..59216a41 100644 --- a/operation-domain/src/main/java/org/operation/alarm/repository/AlarmCustomRepository.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/domain/alarm/repository/AlarmCustomRepository.java @@ -1,10 +1,10 @@ -package org.operation.alarm.repository; +package org.sopt.makers.operation.domain.alarm.repository; import java.util.List; -import org.operation.alarm.domain.Alarm; -import org.operation.alarm.domain.Status; -import org.operation.common.domain.Part; +import org.sopt.makers.operation.domain.Part; +import org.sopt.makers.operation.domain.alarm.domain.Alarm; +import org.sopt.makers.operation.domain.alarm.domain.Status; import org.springframework.data.domain.Pageable; public interface AlarmCustomRepository { diff --git a/operation-domain/src/main/java/org/operation/alarm/repository/AlarmRepository.java b/operation-domain/src/main/java/org/sopt/makers/operation/domain/alarm/repository/AlarmRepository.java similarity index 57% rename from operation-domain/src/main/java/org/operation/alarm/repository/AlarmRepository.java rename to operation-domain/src/main/java/org/sopt/makers/operation/domain/alarm/repository/AlarmRepository.java index 2aa000ff..a11c2dc7 100644 --- a/operation-domain/src/main/java/org/operation/alarm/repository/AlarmRepository.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/domain/alarm/repository/AlarmRepository.java @@ -1,6 +1,6 @@ -package org.operation.alarm.repository; +package org.sopt.makers.operation.domain.alarm.repository; -import org.operation.alarm.domain.Alarm; +import org.sopt.makers.operation.domain.alarm.domain.Alarm; import org.springframework.data.jpa.repository.JpaRepository; public interface AlarmRepository extends JpaRepository, AlarmCustomRepository { diff --git a/operation-domain/src/main/java/org/operation/alarm/repository/AlarmRepositoryImpl.java b/operation-domain/src/main/java/org/sopt/makers/operation/domain/alarm/repository/AlarmRepositoryImpl.java similarity index 81% rename from operation-domain/src/main/java/org/operation/alarm/repository/AlarmRepositoryImpl.java rename to operation-domain/src/main/java/org/sopt/makers/operation/domain/alarm/repository/AlarmRepositoryImpl.java index 5293327f..d03663d7 100644 --- a/operation-domain/src/main/java/org/operation/alarm/repository/AlarmRepositoryImpl.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/domain/alarm/repository/AlarmRepositoryImpl.java @@ -1,16 +1,13 @@ -package org.operation.alarm.repository; +package org.sopt.makers.operation.domain.alarm.repository; import static java.util.Objects.*; -import static org.operation.alarm.QAlarm.*; +import static org.sopt.makers.operation.domain.alarm.domain.QAlarm.*; import java.util.List; -import org.operation.alarm.Alarm; -import org.operation.alarm.Status; -import org.operation.alarm.domain.Alarm; -import org.operation.alarm.domain.Status; -import org.operation.common.domain.Part; -import org.sopt.makers.operation.entity.Part; +import org.sopt.makers.operation.domain.Part; +import org.sopt.makers.operation.domain.alarm.domain.Alarm; +import org.sopt.makers.operation.domain.alarm.domain.Status; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Repository; diff --git a/operation-domain/src/main/java/org/operation/attendance/domain/Attendance.java b/operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/domain/Attendance.java similarity index 88% rename from operation-domain/src/main/java/org/operation/attendance/domain/Attendance.java rename to operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/domain/Attendance.java index 05ed8395..f516089f 100644 --- a/operation-domain/src/main/java/org/operation/attendance/domain/Attendance.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/domain/Attendance.java @@ -1,8 +1,8 @@ -package org.operation.attendance.domain; +package org.sopt.makers.operation.domain.attendance.domain; import static javax.persistence.GenerationType.*; -import static org.operation.attendance.message.ErrorMessage.*; -import static org.operation.attendance.domain.AttendanceStatus.*; +import static org.sopt.makers.operation.domain.attendance.domain.AttendanceStatus.*; +import static org.sopt.makers.operation.domain.attendance.message.ErrorMessage.*; import java.util.ArrayList; import java.util.List; @@ -20,8 +20,8 @@ import javax.persistence.ManyToOne; import javax.persistence.OneToMany; -import org.operation.member.domain.Member; -import org.operation.lecture.Lecture; +import org.sopt.makers.operation.domain.lecture.Lecture; +import org.sopt.makers.operation.domain.member.domain.Member; import lombok.*; @@ -51,7 +51,7 @@ public class Attendance { public Attendance(Member member, Lecture lecture) { setMember(member); setLecture(lecture); - this.status = AttendanceStatus.ABSENT; + this.status = ABSENT; } public void updateStatus() { diff --git a/operation-domain/src/main/java/org/operation/attendance/domain/AttendanceStatus.java b/operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/domain/AttendanceStatus.java similarity index 82% rename from operation-domain/src/main/java/org/operation/attendance/domain/AttendanceStatus.java rename to operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/domain/AttendanceStatus.java index 13ff7055..17bf33d1 100644 --- a/operation-domain/src/main/java/org/operation/attendance/domain/AttendanceStatus.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/domain/AttendanceStatus.java @@ -1,4 +1,4 @@ -package org.operation.attendance.domain; +package org.sopt.makers.operation.domain.attendance.domain; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/operation-domain/src/main/java/org/operation/attendance/domain/SubAttendance.java b/operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/domain/SubAttendance.java similarity index 86% rename from operation-domain/src/main/java/org/operation/attendance/domain/SubAttendance.java rename to operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/domain/SubAttendance.java index 57f707a6..68d4988e 100644 --- a/operation-domain/src/main/java/org/operation/attendance/domain/SubAttendance.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/domain/SubAttendance.java @@ -1,6 +1,7 @@ -package org.operation.attendance.domain; +package org.sopt.makers.operation.domain.attendance.domain; import static javax.persistence.GenerationType.*; +import static org.sopt.makers.operation.domain.attendance.domain.AttendanceStatus.*; import java.util.Objects; @@ -14,8 +15,8 @@ import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; -import org.operation.common.domain.BaseEntity; -import org.operation.lecture.SubLecture; +import org.sopt.makers.operation.domain.BaseEntity; +import org.sopt.makers.operation.domain.lecture.SubLecture; import lombok.Getter; import lombok.NoArgsConstructor; @@ -43,7 +44,7 @@ public class SubAttendance extends BaseEntity { public SubAttendance(Attendance attendance, SubLecture subLecture) { setAttendance(attendance); setSubLecture(subLecture); - status = AttendanceStatus.ABSENT; + status = ABSENT; } private void setAttendance(Attendance attendance) { diff --git a/operation-domain/src/main/java/org/operation/attendance/message/ErrorMessage.java b/operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/message/ErrorMessage.java similarity index 82% rename from operation-domain/src/main/java/org/operation/attendance/message/ErrorMessage.java rename to operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/message/ErrorMessage.java index 51e7095d..1f99f645 100644 --- a/operation-domain/src/main/java/org/operation/attendance/message/ErrorMessage.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/message/ErrorMessage.java @@ -1,4 +1,4 @@ -package org.operation.attendance.message; +package org.sopt.makers.operation.domain.attendance.message; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/operation-domain/src/main/java/org/operation/attendance/repository/attendance/AttendanceCustomRepository.java b/operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/repository/attendance/AttendanceCustomRepository.java similarity index 62% rename from operation-domain/src/main/java/org/operation/attendance/repository/attendance/AttendanceCustomRepository.java rename to operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/repository/attendance/AttendanceCustomRepository.java index d64665ad..bf2dc6f7 100644 --- a/operation-domain/src/main/java/org/operation/attendance/repository/attendance/AttendanceCustomRepository.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/repository/attendance/AttendanceCustomRepository.java @@ -1,10 +1,10 @@ -package org.operation.attendance.repository.attendance; +package org.sopt.makers.operation.domain.attendance.repository.attendance; import java.util.List; -import org.operation.attendance.domain.Attendance; -import org.operation.common.domain.Part; -import org.operation.member.domain.Member; +import org.sopt.makers.operation.domain.Part; +import org.sopt.makers.operation.domain.attendance.domain.Attendance; +import org.sopt.makers.operation.domain.member.domain.Member; import org.springframework.data.domain.Pageable; public interface AttendanceCustomRepository { diff --git a/operation-domain/src/main/java/org/operation/attendance/repository/attendance/AttendanceRepository.java b/operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/repository/attendance/AttendanceRepository.java similarity index 62% rename from operation-domain/src/main/java/org/operation/attendance/repository/attendance/AttendanceRepository.java rename to operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/repository/attendance/AttendanceRepository.java index e3870b9a..2d95b801 100644 --- a/operation-domain/src/main/java/org/operation/attendance/repository/attendance/AttendanceRepository.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/repository/attendance/AttendanceRepository.java @@ -1,10 +1,10 @@ -package org.operation.attendance.repository.attendance; +package org.sopt.makers.operation.domain.attendance.repository.attendance; import java.util.Optional; -import org.operation.attendance.domain.Attendance; -import org.operation.lecture.Lecture; -import org.operation.member.domain.Member; +import org.sopt.makers.operation.domain.attendance.domain.Attendance; +import org.sopt.makers.operation.domain.lecture.Lecture; +import org.sopt.makers.operation.domain.member.domain.Member; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; diff --git a/operation-domain/src/main/java/org/operation/attendance/repository/attendance/AttendanceRepositoryImpl.java b/operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/repository/attendance/AttendanceRepositoryImpl.java similarity index 82% rename from operation-domain/src/main/java/org/operation/attendance/repository/attendance/AttendanceRepositoryImpl.java rename to operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/repository/attendance/AttendanceRepositoryImpl.java index 3069ed02..4c2fbd5e 100644 --- a/operation-domain/src/main/java/org/operation/attendance/repository/attendance/AttendanceRepositoryImpl.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/repository/attendance/AttendanceRepositoryImpl.java @@ -1,23 +1,23 @@ -package org.operation.attendance.repository.attendance; +package org.sopt.makers.operation.domain.attendance.repository.attendance; import static com.querydsl.core.types.dsl.Expressions.*; import static java.util.Objects.*; -import static org.operation.attendance.QAttendance.*; -import static org.operation.attendance.QSubAttendance.*; -import static org.operation.lecture.QLecture.*; -import static org.operation.lecture.QSubLecture.*; -import static org.operation.member.QMember.*; +import static org.sopt.makers.operation.domain.attendance.domain.QAttendance.*; +import static org.sopt.makers.operation.domain.attendance.domain.QSubAttendance.*; +import static org.sopt.makers.operation.domain.lecture.QLecture.*; +import static org.sopt.makers.operation.domain.lecture.QSubLecture.*; +import static org.sopt.makers.operation.domain.member.domain.QMember.*; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.LocalTime; import java.util.List; -import org.operation.attendance.Attendance; -import org.operation.lecture.LectureStatus; -import org.operation.member.Member; import org.sopt.makers.operation.config.ValueConfig; -import org.sopt.makers.operation.entity.Part; +import org.sopt.makers.operation.domain.Part; +import org.sopt.makers.operation.domain.attendance.domain.Attendance; +import org.sopt.makers.operation.domain.lecture.LectureStatus; +import org.sopt.makers.operation.domain.member.domain.Member; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Repository; @@ -36,7 +36,6 @@ public class AttendanceRepositoryImpl implements AttendanceCustomRepository { @Override public List findAttendanceByMemberId(Long memberId) { - return queryFactory .select(attendance) .from(attendance) diff --git a/operation-domain/src/main/java/org/operation/attendance/repository/subAttendance/SubAttendanceRepository.java b/operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/repository/subAttendance/SubAttendanceRepository.java similarity index 59% rename from operation-domain/src/main/java/org/operation/attendance/repository/subAttendance/SubAttendanceRepository.java rename to operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/repository/subAttendance/SubAttendanceRepository.java index 7c26039c..a5449b4c 100644 --- a/operation-domain/src/main/java/org/operation/attendance/repository/subAttendance/SubAttendanceRepository.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/repository/subAttendance/SubAttendanceRepository.java @@ -1,14 +1,13 @@ -package org.operation.attendance.repository.subAttendance; +package org.sopt.makers.operation.domain.attendance.repository.subAttendance; import java.util.List; -import org.operation.attendance.domain.SubAttendance; -import org.operation.lecture.SubLecture; +import org.sopt.makers.operation.domain.lecture.SubLecture; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; -public interface SubAttendanceRepository extends JpaRepository { +public interface SubAttendanceRepository extends JpaRepository { @Modifying(clearAutomatically = true, flushAutomatically = true) @Query("delete from SubAttendance sa where sa.subLecture in :subLectures") void deleteAllBySubLectureIn(List subLectures); diff --git a/operation-domain/src/main/java/org/operation/converter/StringListConverter.java b/operation-domain/src/main/java/org/sopt/makers/operation/domain/converter/StringListConverter.java similarity index 88% rename from operation-domain/src/main/java/org/operation/converter/StringListConverter.java rename to operation-domain/src/main/java/org/sopt/makers/operation/domain/converter/StringListConverter.java index 43f66b7b..08cf717d 100644 --- a/operation-domain/src/main/java/org/operation/converter/StringListConverter.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/domain/converter/StringListConverter.java @@ -1,15 +1,14 @@ -package org.operation.converter; +package org.sopt.makers.operation.domain.converter; import static com.fasterxml.jackson.databind.DeserializationFeature.*; -import java.util.List; import java.io.IOException; +import java.util.List; import javax.persistence.AttributeConverter; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; public class StringListConverter implements AttributeConverter, String> { private static final ObjectMapper mapper = new ObjectMapper() @@ -20,7 +19,7 @@ public class StringListConverter implements AttributeConverter, Str public String convertToDatabaseColumn(List attribute) { try { return mapper.writeValueAsString(attribute); - } catch (JsonProcessingException ex) { + } catch (IOException ex) { throw new IllegalArgumentException(ex.getMessage()); } } diff --git a/operation-domain/src/main/java/org/operation/lecture/Attribute.java b/operation-domain/src/main/java/org/sopt/makers/operation/domain/lecture/Attribute.java similarity index 79% rename from operation-domain/src/main/java/org/operation/lecture/Attribute.java rename to operation-domain/src/main/java/org/sopt/makers/operation/domain/lecture/Attribute.java index cf57c07f..fbc707ac 100644 --- a/operation-domain/src/main/java/org/operation/lecture/Attribute.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/domain/lecture/Attribute.java @@ -1,4 +1,4 @@ -package org.operation.lecture; +package org.sopt.makers.operation.domain.lecture; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/operation-domain/src/main/java/org/operation/lecture/Lecture.java b/operation-domain/src/main/java/org/sopt/makers/operation/domain/lecture/Lecture.java similarity index 86% rename from operation-domain/src/main/java/org/operation/lecture/Lecture.java rename to operation-domain/src/main/java/org/sopt/makers/operation/domain/lecture/Lecture.java index 3660fa94..b9a7621c 100644 --- a/operation-domain/src/main/java/org/operation/lecture/Lecture.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/domain/lecture/Lecture.java @@ -1,7 +1,7 @@ -package org.operation.lecture; +package org.sopt.makers.operation.domain.lecture; import static javax.persistence.GenerationType.*; -import static org.operation.lecture.LectureStatus.*; +import static org.sopt.makers.operation.domain.lecture.LectureStatus.*; import java.time.LocalDateTime; import java.util.ArrayList; @@ -15,9 +15,9 @@ import javax.persistence.Id; import javax.persistence.OneToMany; -import org.operation.attendance.domain.Attendance; -import org.operation.common.domain.BaseEntity; -import org.operation.common.domain.Part; +import org.sopt.makers.operation.domain.BaseEntity; +import org.sopt.makers.operation.domain.Part; +import org.sopt.makers.operation.domain.attendance.domain.Attendance; import lombok.Builder; import lombok.Getter; diff --git a/operation-domain/src/main/java/org/operation/lecture/LectureStatus.java b/operation-domain/src/main/java/org/sopt/makers/operation/domain/lecture/LectureStatus.java similarity index 54% rename from operation-domain/src/main/java/org/operation/lecture/LectureStatus.java rename to operation-domain/src/main/java/org/sopt/makers/operation/domain/lecture/LectureStatus.java index 5852af16..2547743f 100644 --- a/operation-domain/src/main/java/org/operation/lecture/LectureStatus.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/domain/lecture/LectureStatus.java @@ -1,4 +1,4 @@ -package org.operation.lecture; +package org.sopt.makers.operation.domain.lecture; public enum LectureStatus { BEFORE, FIRST, SECOND, END diff --git a/operation-domain/src/main/java/org/operation/lecture/SubLecture.java b/operation-domain/src/main/java/org/sopt/makers/operation/domain/lecture/SubLecture.java similarity index 90% rename from operation-domain/src/main/java/org/operation/lecture/SubLecture.java rename to operation-domain/src/main/java/org/sopt/makers/operation/domain/lecture/SubLecture.java index 8db85dc8..1cbedbd4 100644 --- a/operation-domain/src/main/java/org/operation/lecture/SubLecture.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/domain/lecture/SubLecture.java @@ -1,8 +1,8 @@ -package org.operation.lecture; +package org.sopt.makers.operation.domain.lecture; import static java.util.Objects.*; import static javax.persistence.GenerationType.*; -import static org.operation.lecture.LectureStatus.*; +import static org.sopt.makers.operation.domain.lecture.LectureStatus.*; import java.time.LocalDateTime; import java.util.ArrayList; @@ -18,7 +18,7 @@ import javax.persistence.ManyToOne; import javax.persistence.OneToMany; -import org.operation.attendance.domain.SubAttendance; +import org.sopt.makers.operation.domain.attendance.domain.SubAttendance; import lombok.Getter; import lombok.NoArgsConstructor; diff --git a/operation-domain/src/main/java/org/operation/lecture/message/ErrorMessage.java b/operation-domain/src/main/java/org/sopt/makers/operation/domain/lecture/message/ErrorMessage.java similarity index 94% rename from operation-domain/src/main/java/org/operation/lecture/message/ErrorMessage.java rename to operation-domain/src/main/java/org/sopt/makers/operation/domain/lecture/message/ErrorMessage.java index 339de202..ace1abfd 100644 --- a/operation-domain/src/main/java/org/operation/lecture/message/ErrorMessage.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/domain/lecture/message/ErrorMessage.java @@ -1,4 +1,4 @@ -package org.operation.lecture.message; +package org.sopt.makers.operation.domain.lecture.message; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/operation-domain/src/main/java/org/operation/lecture/repository/lecture/LectureCustomRepository.java b/operation-domain/src/main/java/org/sopt/makers/operation/domain/lecture/repository/lecture/LectureCustomRepository.java similarity index 57% rename from operation-domain/src/main/java/org/operation/lecture/repository/lecture/LectureCustomRepository.java rename to operation-domain/src/main/java/org/sopt/makers/operation/domain/lecture/repository/lecture/LectureCustomRepository.java index 89bffb58..e8d863d1 100644 --- a/operation-domain/src/main/java/org/operation/lecture/repository/lecture/LectureCustomRepository.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/domain/lecture/repository/lecture/LectureCustomRepository.java @@ -1,10 +1,10 @@ -package org.operation.lecture.repository.lecture; +package org.sopt.makers.operation.domain.lecture.repository.lecture; import java.util.List; import java.util.Optional; -import org.operation.common.domain.Part; -import org.operation.lecture.Lecture; +import org.sopt.makers.operation.domain.Part; +import org.sopt.makers.operation.domain.lecture.Lecture; public interface LectureCustomRepository { List find(int generation, Part part); diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/domain/lecture/repository/lecture/LectureRepository.java b/operation-domain/src/main/java/org/sopt/makers/operation/domain/lecture/repository/lecture/LectureRepository.java new file mode 100644 index 00000000..1c9e07dc --- /dev/null +++ b/operation-domain/src/main/java/org/sopt/makers/operation/domain/lecture/repository/lecture/LectureRepository.java @@ -0,0 +1,7 @@ +package org.sopt.makers.operation.domain.lecture.repository.lecture; + +import org.sopt.makers.operation.domain.lecture.Lecture; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface LectureRepository extends JpaRepository, LectureCustomRepository { +} diff --git a/operation-domain/src/main/java/org/operation/lecture/repository/lecture/LectureRepositoryImpl.java b/operation-domain/src/main/java/org/sopt/makers/operation/domain/lecture/repository/lecture/LectureRepositoryImpl.java similarity index 79% rename from operation-domain/src/main/java/org/operation/lecture/repository/lecture/LectureRepositoryImpl.java rename to operation-domain/src/main/java/org/sopt/makers/operation/domain/lecture/repository/lecture/LectureRepositoryImpl.java index 51a1ded6..a1bef91c 100644 --- a/operation-domain/src/main/java/org/operation/lecture/repository/lecture/LectureRepositoryImpl.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/domain/lecture/repository/lecture/LectureRepositoryImpl.java @@ -1,17 +1,17 @@ -package org.operation.lecture.repository.lecture; +package org.sopt.makers.operation.domain.lecture.repository.lecture; import static java.util.Objects.*; -import static org.operation.attendance.QAttendance.*; -import static org.operation.lecture.LectureStatus.*; -import static org.operation.lecture.QLecture.*; -import static org.operation.member.QMember.*; +import static org.sopt.makers.operation.domain.attendance.domain.QAttendance.*; +import static org.sopt.makers.operation.domain.lecture.LectureStatus.*; +import static org.sopt.makers.operation.domain.lecture.QLecture.*; +import static org.sopt.makers.operation.domain.member.domain.QMember.*; import java.time.LocalDateTime; import java.util.List; import java.util.Optional; -import org.operation.lecture.Lecture; -import org.sopt.makers.operation.entity.Part; +import org.sopt.makers.operation.domain.Part; +import org.sopt.makers.operation.domain.lecture.Lecture; import org.springframework.stereotype.Repository; import com.querydsl.core.types.dsl.BooleanExpression; diff --git a/operation-domain/src/main/java/org/operation/lecture/repository/subLecture/SubLectureRepository.java b/operation-domain/src/main/java/org/sopt/makers/operation/domain/lecture/repository/subLecture/SubLectureRepository.java similarity index 52% rename from operation-domain/src/main/java/org/operation/lecture/repository/subLecture/SubLectureRepository.java rename to operation-domain/src/main/java/org/sopt/makers/operation/domain/lecture/repository/subLecture/SubLectureRepository.java index 23bc1415..627b984a 100644 --- a/operation-domain/src/main/java/org/operation/lecture/repository/subLecture/SubLectureRepository.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/domain/lecture/repository/subLecture/SubLectureRepository.java @@ -1,15 +1,14 @@ -package org.operation.lecture.repository.subLecture; +package org.sopt.makers.operation.domain.lecture.repository.subLecture; import java.util.Optional; -import org.operation.lecture.Lecture; -import org.operation.lecture.SubLecture; +import org.sopt.makers.operation.domain.lecture.Lecture; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; -public interface SubLectureRepository extends JpaRepository { - Optional findById(Long subLectureId); +public interface SubLectureRepository extends JpaRepository { + Optional findById(Long subLectureId); @Modifying(clearAutomatically = true, flushAutomatically = true) @Query("delete from SubLecture sl where sl.lecture = :lecture") diff --git a/operation-domain/src/main/java/org/operation/member/domain/Member.java b/operation-domain/src/main/java/org/sopt/makers/operation/domain/member/domain/Member.java similarity index 82% rename from operation-domain/src/main/java/org/operation/member/domain/Member.java rename to operation-domain/src/main/java/org/sopt/makers/operation/domain/member/domain/Member.java index a1094153..bbf834ef 100644 --- a/operation-domain/src/main/java/org/operation/member/domain/Member.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/domain/member/domain/Member.java @@ -1,6 +1,6 @@ -package org.operation.member.domain; +package org.sopt.makers.operation.domain.member.domain; -import static org.operation.lecture.LectureStatus.*; +import static org.sopt.makers.operation.domain.lecture.LectureStatus.*; import java.util.ArrayList; import java.util.List; @@ -14,8 +14,8 @@ import javax.persistence.Id; import javax.persistence.OneToMany; -import org.operation.common.domain.Part; -import org.operation.attendance.domain.Attendance; +import org.sopt.makers.operation.domain.Part; +import org.sopt.makers.operation.domain.attendance.domain.Attendance; import lombok.Getter; import lombok.NoArgsConstructor; diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/domain/member/domain/ObYb.java b/operation-domain/src/main/java/org/sopt/makers/operation/domain/member/domain/ObYb.java new file mode 100644 index 00000000..ab33b218 --- /dev/null +++ b/operation-domain/src/main/java/org/sopt/makers/operation/domain/member/domain/ObYb.java @@ -0,0 +1,5 @@ +package org.sopt.makers.operation.domain.member.domain; + +public enum ObYb { + OB, YB +} diff --git a/operation-domain/src/main/java/org/operation/member/message/ErrorMessage.java b/operation-domain/src/main/java/org/sopt/makers/operation/domain/member/message/ErrorMessage.java similarity index 78% rename from operation-domain/src/main/java/org/operation/member/message/ErrorMessage.java rename to operation-domain/src/main/java/org/sopt/makers/operation/domain/member/message/ErrorMessage.java index ea74617e..5d9e94ba 100644 --- a/operation-domain/src/main/java/org/operation/member/message/ErrorMessage.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/domain/member/message/ErrorMessage.java @@ -1,4 +1,4 @@ -package org.operation.member.message; +package org.sopt.makers.operation.domain.member.message; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/operation-domain/src/main/java/org/operation/member/repository/MemberCustomRepository.java b/operation-domain/src/main/java/org/sopt/makers/operation/domain/member/repository/MemberCustomRepository.java similarity index 64% rename from operation-domain/src/main/java/org/operation/member/repository/MemberCustomRepository.java rename to operation-domain/src/main/java/org/sopt/makers/operation/domain/member/repository/MemberCustomRepository.java index f0bdfb58..a4b04b70 100644 --- a/operation-domain/src/main/java/org/operation/member/repository/MemberCustomRepository.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/domain/member/repository/MemberCustomRepository.java @@ -1,11 +1,11 @@ -package org.operation.member.repository; +package org.sopt.makers.operation.domain.member.repository; import java.util.List; import java.util.Optional; -import org.operation.common.domain.Part; -import org.operation.common.dto.MemberSearchCondition; -import org.operation.member.domain.Member; +import org.sopt.makers.operation.domain.Part; +import org.sopt.makers.operation.domain.member.domain.Member; +import org.sopt.makers.operation.dto.MemberSearchCondition; import org.springframework.data.domain.Pageable; public interface MemberCustomRepository { diff --git a/operation-domain/src/main/java/org/operation/member/repository/MemberRepository.java b/operation-domain/src/main/java/org/sopt/makers/operation/domain/member/repository/MemberRepository.java similarity index 72% rename from operation-domain/src/main/java/org/operation/member/repository/MemberRepository.java rename to operation-domain/src/main/java/org/sopt/makers/operation/domain/member/repository/MemberRepository.java index 94d64825..3aa00973 100644 --- a/operation-domain/src/main/java/org/operation/member/repository/MemberRepository.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/domain/member/repository/MemberRepository.java @@ -1,8 +1,8 @@ -package org.operation.member.repository; +package org.sopt.makers.operation.domain.member.repository; import java.util.Optional; -import org.operation.member.domain.Member; +import org.sopt.makers.operation.domain.member.domain.Member; import org.springframework.data.jpa.repository.JpaRepository; public interface MemberRepository extends JpaRepository, MemberCustomRepository { diff --git a/operation-domain/src/main/java/org/operation/member/repository/MemberRepositoryImpl.java b/operation-domain/src/main/java/org/sopt/makers/operation/domain/member/repository/MemberRepositoryImpl.java similarity index 82% rename from operation-domain/src/main/java/org/operation/member/repository/MemberRepositoryImpl.java rename to operation-domain/src/main/java/org/sopt/makers/operation/domain/member/repository/MemberRepositoryImpl.java index 40b6122e..0a6ef13d 100644 --- a/operation-domain/src/main/java/org/operation/member/repository/MemberRepositoryImpl.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/domain/member/repository/MemberRepositoryImpl.java @@ -1,17 +1,17 @@ -package org.operation.member.repository; +package org.sopt.makers.operation.domain.member.repository; import static java.util.Objects.*; -import static org.operation.attendance.QAttendance.*; -import static org.operation.lecture.QLecture.*; -import static org.operation.member.QMember.*; -import static org.sopt.makers.operation.entity.Part.*; +import static org.sopt.makers.operation.domain.Part.*; +import static org.sopt.makers.operation.domain.attendance.domain.QAttendance.*; +import static org.sopt.makers.operation.domain.lecture.QLecture.*; +import static org.sopt.makers.operation.domain.member.domain.QMember.*; import java.util.List; import java.util.Optional; -import org.operation.member.domain.Member; -import org.sopt.makers.operation.dto.member.response.MemberSearchCondition; -import org.sopt.makers.operation.entity.Part; +import org.sopt.makers.operation.domain.Part; +import org.sopt.makers.operation.domain.member.domain.Member; +import org.sopt.makers.operation.dto.MemberSearchCondition; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Repository; diff --git a/operation-domain/src/main/java/org/operation/schedule/domain/Schedule.java b/operation-domain/src/main/java/org/sopt/makers/operation/domain/schedule/domain/Schedule.java similarity index 53% rename from operation-domain/src/main/java/org/operation/schedule/domain/Schedule.java rename to operation-domain/src/main/java/org/sopt/makers/operation/domain/schedule/domain/Schedule.java index 1c0670bf..7364e885 100644 --- a/operation-domain/src/main/java/org/operation/schedule/domain/Schedule.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/domain/schedule/domain/Schedule.java @@ -1,15 +1,21 @@ -package org.operation.schedule.domain; +package org.sopt.makers.operation.domain.schedule.domain; -import lombok.Getter; -import lombok.NoArgsConstructor; -import org.operation.common.domain.BaseEntity; -import org.operation.lecture.Attribute; +import static javax.persistence.EnumType.*; +import static javax.persistence.GenerationType.*; -import javax.persistence.*; import java.time.LocalDateTime; -import static javax.persistence.EnumType.STRING; -import static javax.persistence.GenerationType.IDENTITY; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Enumerated; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; + +import org.sopt.makers.operation.domain.BaseEntity; +import org.sopt.makers.operation.domain.lecture.Attribute; + +import lombok.Getter; +import lombok.NoArgsConstructor; @Entity @NoArgsConstructor diff --git a/operation-domain/src/main/java/org/operation/schedule/repository/ScheduleCustomRepository.java b/operation-domain/src/main/java/org/sopt/makers/operation/domain/schedule/repository/ScheduleCustomRepository.java similarity index 59% rename from operation-domain/src/main/java/org/operation/schedule/repository/ScheduleCustomRepository.java rename to operation-domain/src/main/java/org/sopt/makers/operation/domain/schedule/repository/ScheduleCustomRepository.java index 741b89c5..b60289fa 100644 --- a/operation-domain/src/main/java/org/operation/schedule/repository/ScheduleCustomRepository.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/domain/schedule/repository/ScheduleCustomRepository.java @@ -1,9 +1,9 @@ -package org.operation.schedule.repository; +package org.sopt.makers.operation.domain.schedule.repository; import java.time.LocalDateTime; import java.util.List; -import org.operation.schedule.domain.Schedule; +import org.sopt.makers.operation.domain.schedule.domain.Schedule; public interface ScheduleCustomRepository { List findBetweenStartAndEnd(LocalDateTime start, LocalDateTime end); diff --git a/operation-domain/src/main/java/org/operation/schedule/repository/ScheduleRepository.java b/operation-domain/src/main/java/org/sopt/makers/operation/domain/schedule/repository/ScheduleRepository.java similarity index 57% rename from operation-domain/src/main/java/org/operation/schedule/repository/ScheduleRepository.java rename to operation-domain/src/main/java/org/sopt/makers/operation/domain/schedule/repository/ScheduleRepository.java index 9b1aafbb..16986dd7 100644 --- a/operation-domain/src/main/java/org/operation/schedule/repository/ScheduleRepository.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/domain/schedule/repository/ScheduleRepository.java @@ -1,6 +1,6 @@ -package org.operation.schedule.repository; +package org.sopt.makers.operation.domain.schedule.repository; -import org.operation.member.Member; +import org.sopt.makers.operation.domain.member.domain.Member; import org.springframework.data.jpa.repository.JpaRepository; public interface ScheduleRepository extends JpaRepository, ScheduleCustomRepository { diff --git a/operation-domain/src/main/java/org/operation/schedule/repository/ScheduleRepositoryImpl.java b/operation-domain/src/main/java/org/sopt/makers/operation/domain/schedule/repository/ScheduleRepositoryImpl.java similarity index 76% rename from operation-domain/src/main/java/org/operation/schedule/repository/ScheduleRepositoryImpl.java rename to operation-domain/src/main/java/org/sopt/makers/operation/domain/schedule/repository/ScheduleRepositoryImpl.java index 2e275c01..73dadcc0 100644 --- a/operation-domain/src/main/java/org/operation/schedule/repository/ScheduleRepositoryImpl.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/domain/schedule/repository/ScheduleRepositoryImpl.java @@ -1,11 +1,11 @@ -package org.operation.schedule.repository; +package org.sopt.makers.operation.domain.schedule.repository; -import static org.operation.schedule.QSchedule.*; +import static org.sopt.makers.operation.domain.schedule.domain.QSchedule.*; import java.time.LocalDateTime; import java.util.List; -import org.operation.schedule.domain.Schedule; +import org.sopt.makers.operation.domain.schedule.domain.Schedule; import org.springframework.stereotype.Repository; import com.querydsl.jpa.impl.JPAQueryFactory; diff --git a/operation-service/src/main/java/org/operation/web/alarm/dto/request/AlarmRequest.java b/operation-domain/src/main/java/org/sopt/makers/operation/dto/AlarmRequest.java similarity index 56% rename from operation-service/src/main/java/org/operation/web/alarm/dto/request/AlarmRequest.java rename to operation-domain/src/main/java/org/sopt/makers/operation/dto/AlarmRequest.java index 92d0cdc0..084aa24d 100644 --- a/operation-service/src/main/java/org/operation/web/alarm/dto/request/AlarmRequest.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/dto/AlarmRequest.java @@ -1,10 +1,10 @@ -package org.operation.web.alarm.dto.request; +package org.sopt.makers.operation.dto; import java.util.List; -import org.operation.common.domain.Part; -import org.operation.alarm.domain.Alarm; -import org.operation.alarm.domain.Attribute; +import org.sopt.makers.operation.domain.Part; +import org.sopt.makers.operation.domain.alarm.domain.Alarm; +import org.sopt.makers.operation.domain.alarm.domain.Attribute; public record AlarmRequest( int generation, diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/dto/MemberSearchCondition.java b/operation-domain/src/main/java/org/sopt/makers/operation/dto/MemberSearchCondition.java new file mode 100644 index 00000000..ce0f8ec0 --- /dev/null +++ b/operation-domain/src/main/java/org/sopt/makers/operation/dto/MemberSearchCondition.java @@ -0,0 +1,9 @@ +package org.sopt.makers.operation.dto; + +import org.sopt.makers.operation.domain.Part; + +public record MemberSearchCondition( + Part part, + int generation +) { +} diff --git a/operation-external/build.gradle b/operation-external/build.gradle index 34afb625..ce4cc19f 100644 --- a/operation-external/build.gradle +++ b/operation-external/build.gradle @@ -10,7 +10,7 @@ repositories { } dependencies { - implementation project(path: ':operation-service') +// implementation project(path: ':operation-service') implementation project(path: ':operation-domain') implementation 'org.springframework.boot:spring-boot-starter-web' diff --git a/operation-external/src/main/java/org/operation/client/alarm/AlarmSender.java b/operation-external/src/main/java/org/operation/client/alarm/AlarmSender.java deleted file mode 100644 index 456a7ba5..00000000 --- a/operation-external/src/main/java/org/operation/client/alarm/AlarmSender.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.operation.client.alarm; - -import org.operation.web.alarm.dto.request.AlarmSenderRequest; - -public interface AlarmSender { - void send(AlarmSenderRequest request); -} diff --git a/operation-external/src/main/java/org/operation/client/playground/PlayGroundServer.java b/operation-external/src/main/java/org/operation/client/playground/PlayGroundServer.java deleted file mode 100644 index fe7e4f34..00000000 --- a/operation-external/src/main/java/org/operation/client/playground/PlayGroundServer.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.operation.client.playground; - -import org.operation.common.domain.Part; -import org.operation.web.alarm.dto.response.AlarmInactiveListResponse; - -public interface PlayGroundServer { - AlarmInactiveListResponse getInactiveMembers(int generation, Part part); -} diff --git a/operation-external/src/main/java/org/sopt/makers/operation/client/alarm/AlarmSender.java b/operation-external/src/main/java/org/sopt/makers/operation/client/alarm/AlarmSender.java new file mode 100644 index 00000000..3b4175a1 --- /dev/null +++ b/operation-external/src/main/java/org/sopt/makers/operation/client/alarm/AlarmSender.java @@ -0,0 +1,7 @@ +package org.sopt.makers.operation.client.alarm; + +import org.sopt.makers.operation.web.alarm.dto.request.AlarmSenderRequest; + +public interface AlarmSender { + void send(AlarmSenderRequest request); +} diff --git a/operation-external/src/main/java/org/operation/client/alarm/AlarmSenderImpl.java b/operation-external/src/main/java/org/sopt/makers/operation/client/alarm/AlarmSenderImpl.java similarity index 90% rename from operation-external/src/main/java/org/operation/client/alarm/AlarmSenderImpl.java rename to operation-external/src/main/java/org/sopt/makers/operation/client/alarm/AlarmSenderImpl.java index fcb013b2..ce310b8f 100644 --- a/operation-external/src/main/java/org/operation/client/alarm/AlarmSenderImpl.java +++ b/operation-external/src/main/java/org/sopt/makers/operation/client/alarm/AlarmSenderImpl.java @@ -1,4 +1,4 @@ -package org.operation.client.alarm; +package org.sopt.makers.operation.client.alarm; import static java.util.Objects.*; import static java.util.UUID.*; @@ -9,9 +9,9 @@ import java.util.HashMap; import java.util.Map; -import org.operation.common.config.ValueConfig; -import org.operation.common.exception.AlarmException; -import org.operation.web.alarm.dto.request.AlarmSenderRequest; +import org.sopt.makers.operation.common.config.ValueConfig; +import org.sopt.makers.operation.common.exception.AlarmException; +import org.sopt.makers.operation.web.alarm.dto.request.AlarmSenderRequest; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.stereotype.Component; diff --git a/operation-external/src/main/java/org/sopt/makers/operation/client/playground/PlayGroundServer.java b/operation-external/src/main/java/org/sopt/makers/operation/client/playground/PlayGroundServer.java new file mode 100644 index 00000000..723913a3 --- /dev/null +++ b/operation-external/src/main/java/org/sopt/makers/operation/client/playground/PlayGroundServer.java @@ -0,0 +1,8 @@ +package org.sopt.makers.operation.client.playground; + +import org.sopt.makers.operation.domain.Part; +import org.sopt.makers.operation.web.alarm.dto.response.AlarmInactiveListResponse; + +public interface PlayGroundServer { + AlarmInactiveListResponse getInactiveMembers(int generation, Part part); +} diff --git a/operation-external/src/main/java/org/operation/client/playground/PlayGroundServerImpl.java b/operation-external/src/main/java/org/sopt/makers/operation/client/playground/PlayGroundServerImpl.java similarity index 84% rename from operation-external/src/main/java/org/operation/client/playground/PlayGroundServerImpl.java rename to operation-external/src/main/java/org/sopt/makers/operation/client/playground/PlayGroundServerImpl.java index fd8fffb1..331a6fdb 100644 --- a/operation-external/src/main/java/org/operation/client/playground/PlayGroundServerImpl.java +++ b/operation-external/src/main/java/org/sopt/makers/operation/client/playground/PlayGroundServerImpl.java @@ -1,12 +1,12 @@ -package org.operation.client.playground; +package org.sopt.makers.operation.client.playground; import static org.operation.alarm.message.ErrorMessage.*; -import static org.operation.common.domain.Part.*; +import static org.sopt.makers.operation.domain.Part.*; import static org.springframework.http.HttpMethod.*; -import org.operation.common.domain.Part; -import org.operation.common.exception.AlarmException; -import org.operation.web.alarm.dto.response.AlarmInactiveListResponse; +import org.sopt.makers.operation.common.exception.AlarmException; +import org.sopt.makers.operation.domain.Part; +import org.sopt.makers.operation.web.alarm.dto.response.AlarmInactiveListResponse; import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; diff --git a/operation-external/src/main/java/org/operation/config/RestTemplateConfig.java b/operation-external/src/main/java/org/sopt/makers/operation/config/RestTemplateConfig.java similarity index 87% rename from operation-external/src/main/java/org/operation/config/RestTemplateConfig.java rename to operation-external/src/main/java/org/sopt/makers/operation/config/RestTemplateConfig.java index dbd27cb1..8a73e425 100644 --- a/operation-external/src/main/java/org/operation/config/RestTemplateConfig.java +++ b/operation-external/src/main/java/org/sopt/makers/operation/config/RestTemplateConfig.java @@ -1,4 +1,4 @@ -package org.operation.config; +package org.sopt.makers.operation.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/operation-service/build.gradle b/operation-service/build.gradle index 02c3e606..81d88ec7 100644 --- a/operation-service/build.gradle +++ b/operation-service/build.gradle @@ -10,7 +10,7 @@ repositories { } dependencies { - implementation project(path: ':operation-api') +// implementation project(path: ':operation-api') implementation project(path: ':operation-domain') implementation project(path: ':operation-external') diff --git a/operation-service/src/main/java/org/operation/common/dto/MemberSearchCondition.java b/operation-service/src/main/java/org/operation/common/dto/MemberSearchCondition.java deleted file mode 100644 index 85d48129..00000000 --- a/operation-service/src/main/java/org/operation/common/dto/MemberSearchCondition.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.operation.common.dto; - -import org.operation.common.domain.Part; - -public record MemberSearchCondition( - Part part, - int generation -) { -} diff --git a/operation-service/src/main/java/org/operation/security/AdminAuthentication.java b/operation-service/src/main/java/org/operation/security/AdminAuthentication.java deleted file mode 100644 index e814d182..00000000 --- a/operation-service/src/main/java/org/operation/security/AdminAuthentication.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.operation.security; -import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; -import org.springframework.security.core.GrantedAuthority; - -import java.util.Collection; - -public class AdminAuthentication extends UsernamePasswordAuthenticationToken { - - public AdminAuthentication(Object principal, Object credentials, Collection authorities) { - super(principal, credentials, authorities); - } -} \ No newline at end of file diff --git a/operation-service/src/main/java/org/operation/security/SecurityConfig.java b/operation-service/src/main/java/org/operation/security/SecurityConfig.java deleted file mode 100644 index 4165b3e7..00000000 --- a/operation-service/src/main/java/org/operation/security/SecurityConfig.java +++ /dev/null @@ -1,88 +0,0 @@ -package org.operation.security; - -import lombok.RequiredArgsConstructor; -import lombok.val; - -import org.sopt.makers.operation.config.ValueConfig; -import org.sopt.makers.operation.security.jwt.JwtAuthenticationFilter; -import org.sopt.makers.operation.security.jwt.JwtExceptionFilter; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Profile; -import org.springframework.security.config.annotation.web.builders.HttpSecurity; -import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; -import org.springframework.security.config.http.SessionCreationPolicy; -import org.springframework.security.crypto.factory.PasswordEncoderFactories; -import org.springframework.security.crypto.password.PasswordEncoder; -import org.springframework.security.web.SecurityFilterChain; -import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; -import org.springframework.web.cors.CorsConfiguration; -import org.springframework.web.cors.CorsConfigurationSource; -import org.springframework.web.cors.UrlBasedCorsConfigurationSource; - -@RequiredArgsConstructor -@EnableWebSecurity -@Configuration -public class SecurityConfig { - private final JwtAuthenticationFilter jwtAuthenticationFilter; - private final JwtExceptionFilter jwtExceptionFilter; - private final ValueConfig valueConfig; - - @Bean - public static PasswordEncoder passwordEncoder() { - return PasswordEncoderFactories.createDelegatingPasswordEncoder(); - } - - @Bean - @Profile("dev") - public SecurityFilterChain filterChainDev(HttpSecurity http) throws Exception { - setHttp(http); - http.authorizeRequests().antMatchers(valueConfig.getSWAGGER_URI()).permitAll(); - return http.build(); - } - - @Bean - @Profile("prod") - public SecurityFilterChain filterChainProd(HttpSecurity http) throws Exception { - setHttp(http); - http.authorizeRequests().antMatchers(valueConfig.getSWAGGER_URI()).authenticated(); - return http.build(); - } - - private void setHttp(HttpSecurity http) throws Exception { - http.antMatcher("/**") - .httpBasic().disable() - .csrf().disable() - .formLogin().disable() - .cors().configurationSource(corsConfigurationSource()) - .and() - .authorizeRequests() - .antMatchers("/api/v1/auth/**", "/exception/**").permitAll() - .and() - .authorizeRequests() - .antMatchers("/api/v1/**").authenticated() - .and() - .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS) - .and() - .addFilterBefore(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class) - .addFilterBefore(jwtExceptionFilter, JwtAuthenticationFilter.class); - } - - @Bean - public CorsConfigurationSource corsConfigurationSource() { - val configuration = new CorsConfiguration(); - - configuration.addAllowedOrigin(valueConfig.getADMIN_PROD_URL()); - configuration.addAllowedOrigin(valueConfig.getADMIN_DEV_URL()); - configuration.addAllowedOrigin(valueConfig.getADMIN_LOCAL_URL()); - configuration.addAllowedHeader("*"); - configuration.addAllowedMethod("*"); - configuration.setAllowCredentials(true); - - val source = new UrlBasedCorsConfigurationSource(); - - source.registerCorsConfiguration("/**", configuration); - - return source; - } -} diff --git a/operation-service/src/main/java/org/operation/security/jwt/JwtAuthenticationFilter.java b/operation-service/src/main/java/org/operation/security/jwt/JwtAuthenticationFilter.java deleted file mode 100644 index f847633f..00000000 --- a/operation-service/src/main/java/org/operation/security/jwt/JwtAuthenticationFilter.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.operation.security.jwt; - -import lombok.RequiredArgsConstructor; -import lombok.val; -import org.sopt.makers.operation.common.ExceptionMessage; -import org.sopt.makers.operation.exception.TokenException; -import org.springframework.security.core.context.SecurityContextHolder; -import org.springframework.security.web.authentication.WebAuthenticationDetailsSource; - -import javax.servlet.*; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; - -import org.springframework.stereotype.Component; -import org.springframework.web.filter.OncePerRequestFilter; - -@Component -@RequiredArgsConstructor -public class JwtAuthenticationFilter extends OncePerRequestFilter { - - private final JwtTokenProvider jwtTokenProvider; - - @Override - public void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException { - val uri = request.getRequestURI(); - - if ((uri.startsWith("/api/v1")) && !uri.contains("auth")) { - val token = jwtTokenProvider.resolveToken(request); - - val jwtTokenType = validateTokenType(request); - - checkJwtAvailable(token, jwtTokenType); - - val auth = jwtTokenProvider.getAuthentication(token, jwtTokenType); - auth.setDetails(new WebAuthenticationDetailsSource().buildDetails(request)); - SecurityContextHolder.getContext().setAuthentication(auth); - } - - chain.doFilter(request, response); - } - - private void checkJwtAvailable (String token, JwtTokenType jwtTokenType) { - if (token == null || !jwtTokenProvider.validateTokenExpiration(token, jwtTokenType)) { - throw new TokenException(ExceptionMessage.INVALID_AUTH_REQUEST.getName()); - } - } - - private JwtTokenType validateTokenType(HttpServletRequest request) { - return request.getRequestURI().startsWith("/api/v1/app") ? - JwtTokenType.APP_ACCESS_TOKEN : - JwtTokenType.ACCESS_TOKEN; - } -} \ No newline at end of file diff --git a/operation-service/src/main/java/org/operation/security/jwt/JwtExceptionFilter.java b/operation-service/src/main/java/org/operation/security/jwt/JwtExceptionFilter.java deleted file mode 100644 index d6f85589..00000000 --- a/operation-service/src/main/java/org/operation/security/jwt/JwtExceptionFilter.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.operation.security.jwt; - -import org.sopt.makers.operation.exception.TokenException; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; -import org.springframework.stereotype.Component; -import org.springframework.web.filter.OncePerRequestFilter; - -import lombok.val; -import com.fasterxml.jackson.databind.ObjectMapper; - -import javax.servlet.FilterChain; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; - -@Component -public class JwtExceptionFilter extends OncePerRequestFilter { - - @Override - protected void doFilterInternal(HttpServletRequest httpServletRequest, - HttpServletResponse httpServletResponse, - FilterChain filterChain - ) throws ServletException, IOException { - try { - filterChain.doFilter(httpServletRequest, httpServletResponse); - } catch(TokenException e) { - val objectMapper = new ObjectMapper(); - val jsonResponse = objectMapper.writeValueAsString(ResponseDTO.fail(e.getMessage())); - - httpServletResponse.setStatus(HttpStatus.UNAUTHORIZED.value()); - httpServletResponse.setContentType(MediaType.APPLICATION_JSON_VALUE); - httpServletResponse.setCharacterEncoding("UTF-8"); - httpServletResponse.getWriter().write(jsonResponse); - } - } -} \ No newline at end of file diff --git a/operation-service/src/main/java/org/operation/security/jwt/JwtTokenProvider.java b/operation-service/src/main/java/org/operation/security/jwt/JwtTokenProvider.java deleted file mode 100644 index a1834bb0..00000000 --- a/operation-service/src/main/java/org/operation/security/jwt/JwtTokenProvider.java +++ /dev/null @@ -1,169 +0,0 @@ -package org.operation.security.jwt; - -import io.jsonwebtoken.Claims; -import io.jsonwebtoken.ExpiredJwtException; -import io.jsonwebtoken.Jwts; -import io.jsonwebtoken.SignatureAlgorithm; -import io.jsonwebtoken.security.SignatureException; -import lombok.RequiredArgsConstructor; -import lombok.val; - -import org.operation.security.AdminAuthentication; -import org.sopt.makers.operation.common.ExceptionMessage; -import org.sopt.makers.operation.exception.TokenException; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.security.core.Authentication; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.util.StringUtils; - -import javax.crypto.spec.SecretKeySpec; -import javax.servlet.http.HttpServletRequest; -import javax.xml.bind.DatatypeConverter; -import java.nio.charset.StandardCharsets; -import java.time.LocalDateTime; -import java.time.ZoneId; -import java.util.Base64; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; - -@RequiredArgsConstructor -@Transactional(readOnly = true) -@Service -public class JwtTokenProvider { - - @Value("${spring.jwt.secretKey.access}") - private String accessSecretKey; - - @Value("${spring.jwt.secretKey.refresh}") - private String refreshSecretKey; - - @Value("${spring.jwt.secretKey.app}") - private String appAccessSecretKey; - - public String generateAccessToken(Authentication authentication) { - val encodedKey = encodeKey(accessSecretKey); - val secretKeyBytes = DatatypeConverter.parseBase64Binary(encodedKey); - val accessKey = new SecretKeySpec(secretKeyBytes, SignatureAlgorithm.HS256.getJcaName()); - - return Jwts.builder() - .setSubject(String.valueOf(authentication.getPrincipal())) - .setHeader(createHeader()) - .setExpiration(createExpireDate(JwtTokenType.ACCESS_TOKEN)) - .signWith(accessKey, SignatureAlgorithm.HS256) - .compact(); - } - - public String generateRefreshToken(Authentication authentication) { - val encodedKey = encodeKey(refreshSecretKey); - val secretKeyBytes = DatatypeConverter.parseBase64Binary(encodedKey); - val refreshKey = new SecretKeySpec(secretKeyBytes, SignatureAlgorithm.HS256.getJcaName()); - - return Jwts.builder() - .setSubject(String.valueOf(authentication.getPrincipal())) - .setHeader(createHeader()) - .setExpiration(createExpireDate(JwtTokenType.REFRESH_TOKEN)) - .signWith(refreshKey, SignatureAlgorithm.HS256) - .compact(); - } - - public boolean validateTokenExpiration(String token, JwtTokenType jwtTokenType) { - try { - getClaimsFromToken(token, jwtTokenType); - return true; - } catch (ExpiredJwtException e) { - throw new TokenException(ExceptionMessage.EXPIRED_TOKEN.getName()); - } catch (SignatureException e) { - throw new TokenException(ExceptionMessage.INVALID_SIGNATURE.getName()); - } - } - - public AdminAuthentication getAuthentication(String token, JwtTokenType jwtTokenType) { - return switch (jwtTokenType) { - case ACCESS_TOKEN, REFRESH_TOKEN -> new AdminAuthentication(getId(token, jwtTokenType), null, null); - case APP_ACCESS_TOKEN -> new AdminAuthentication(getPlayGroundId(token, jwtTokenType), null, null); - }; - } - - public Long getPlayGroundId(String token, JwtTokenType jwtTokenType) { - try { - val claims = getClaimsFromToken(token, jwtTokenType); - - return Long.parseLong(claims.get("playgroundId").toString()); - } catch (ExpiredJwtException e) { - throw new TokenException(ExceptionMessage.EXPIRED_TOKEN.getName()); - } catch (SignatureException e) { - throw new TokenException(ExceptionMessage.INVALID_SIGNATURE.getName()); - } - } - - public Long getId(String token, JwtTokenType jwtTokenType) { - try { - val claims = getClaimsFromToken(token, jwtTokenType); - - return Long.parseLong(claims.getSubject()); - } catch (ExpiredJwtException e) { - throw new TokenException(ExceptionMessage.EXPIRED_TOKEN.getName()); - } catch (SecurityException e) { - throw new TokenException(ExceptionMessage.INVALID_SIGNATURE.getName()); - } - } - - private Claims getClaimsFromToken(String token, JwtTokenType jwtTokenType) { - val encodedKey = encodeKey(setSecretKey(jwtTokenType)); - - return Jwts.parserBuilder() - .setSigningKey(encodedKey) - .build() - .parseClaimsJws(token) - .getBody(); - } - - public String resolveToken(HttpServletRequest request) { - val headerAuth = request.getHeader("Authorization"); - return (StringUtils.hasText(headerAuth)) ? headerAuth : null; - } - - private String encodeKey(String secretKey) { - return Base64.getEncoder().encodeToString(secretKey.getBytes(StandardCharsets.UTF_8)); - } - - private LocalDateTime getCurrentTime() { - return LocalDateTime.now(); - } - - private String setSecretKey(JwtTokenType jwtTokenType) { - return switch (jwtTokenType) { - case ACCESS_TOKEN -> accessSecretKey; - case REFRESH_TOKEN -> refreshSecretKey; - case APP_ACCESS_TOKEN -> appAccessSecretKey; - }; - } - - private LocalDateTime setExpireTime(LocalDateTime now, JwtTokenType jwtTokenType) { - return switch (jwtTokenType) { - case ACCESS_TOKEN -> now.plusHours(5); - case REFRESH_TOKEN -> now.plusWeeks(2); - case APP_ACCESS_TOKEN -> throw new TokenException(ExceptionMessage.INVALID_TOKEN.getName()); - }; - } - - private Map createHeader() { - Map header = new HashMap<>(); - - header.put("typ", "JWT"); - header.put("alg", "HS256"); - header.put("regDate", System.currentTimeMillis()); - - return header; - } - - private Date createExpireDate(JwtTokenType jwtTokenType) { - val now = getCurrentTime(); - val expireTime = setExpireTime(now, jwtTokenType); - - return Date.from(expireTime.atZone(ZoneId.systemDefault()).toInstant()); - } - -} \ No newline at end of file diff --git a/operation-service/src/main/java/org/operation/security/jwt/JwtTokenType.java b/operation-service/src/main/java/org/operation/security/jwt/JwtTokenType.java deleted file mode 100644 index 85e8a15b..00000000 --- a/operation-service/src/main/java/org/operation/security/jwt/JwtTokenType.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.operation.security.jwt; - -public enum JwtTokenType { - ACCESS_TOKEN, REFRESH_TOKEN, APP_ACCESS_TOKEN -} diff --git a/operation-service/src/main/java/org/operation/web/alarm/dto/request/AlarmSendRequest.java b/operation-service/src/main/java/org/operation/web/alarm/dto/request/AlarmSendRequest.java deleted file mode 100644 index dad218cc..00000000 --- a/operation-service/src/main/java/org/operation/web/alarm/dto/request/AlarmSendRequest.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.operation.web.alarm.dto.request; - -public record AlarmSendRequest( - long alarmId -) { -} diff --git a/operation-service/src/main/java/org/operation/app/attendance/dto/request/AttendanceRequest.java b/operation-service/src/main/java/org/sopt/makers/operation/app/attendance/dto/request/AttendanceRequest.java similarity index 58% rename from operation-service/src/main/java/org/operation/app/attendance/dto/request/AttendanceRequest.java rename to operation-service/src/main/java/org/sopt/makers/operation/app/attendance/dto/request/AttendanceRequest.java index 2f7dbe86..15060be0 100644 --- a/operation-service/src/main/java/org/operation/app/attendance/dto/request/AttendanceRequest.java +++ b/operation-service/src/main/java/org/sopt/makers/operation/app/attendance/dto/request/AttendanceRequest.java @@ -1,4 +1,4 @@ -package org.operation.app.attendance.dto.request; +package org.sopt.makers.operation.app.attendance.dto.request; public record AttendanceRequest( Long subLectureId, diff --git a/operation-service/src/main/java/org/operation/app/attendance/dto/response/AttendanceResponse.java b/operation-service/src/main/java/org/sopt/makers/operation/app/attendance/dto/response/AttendanceResponse.java similarity index 81% rename from operation-service/src/main/java/org/operation/app/attendance/dto/response/AttendanceResponse.java rename to operation-service/src/main/java/org/sopt/makers/operation/app/attendance/dto/response/AttendanceResponse.java index 5b2711ff..1bfeba45 100644 --- a/operation-service/src/main/java/org/operation/app/attendance/dto/response/AttendanceResponse.java +++ b/operation-service/src/main/java/org/sopt/makers/operation/app/attendance/dto/response/AttendanceResponse.java @@ -1,4 +1,4 @@ -package org.operation.app.attendance.dto.response; +package org.sopt.makers.operation.app.attendance.dto.response; import org.operation.attendance.domain.SubAttendance; diff --git a/operation-service/src/main/java/org/operation/app/attendance/dto/response/AttendancesResponse.java b/operation-service/src/main/java/org/sopt/makers/operation/app/attendance/dto/response/AttendancesResponse.java similarity index 66% rename from operation-service/src/main/java/org/operation/app/attendance/dto/response/AttendancesResponse.java rename to operation-service/src/main/java/org/sopt/makers/operation/app/attendance/dto/response/AttendancesResponse.java index 9b2640bb..174a6b55 100644 --- a/operation-service/src/main/java/org/operation/app/attendance/dto/response/AttendancesResponse.java +++ b/operation-service/src/main/java/org/sopt/makers/operation/app/attendance/dto/response/AttendancesResponse.java @@ -1,10 +1,9 @@ -package org.operation.app.attendance.dto.response; +package org.sopt.makers.operation.app.attendance.dto.response; import java.util.List; import org.operation.attendance.domain.Attendance; -import org.operation.web.attendance.dto.response.MemberResponse; -import org.operation.web.member.dto.response.MemberListGetResponse; +import org.sopt.makers.operation.web.attendance.dto.response.MemberResponse; public record AttendancesResponse( List attendances, diff --git a/operation-service/src/main/java/org/operation/app/attendance/service/AttendanceServiceImpl.java b/operation-service/src/main/java/org/sopt/makers/operation/app/attendance/service/AttendanceServiceImpl.java similarity index 89% rename from operation-service/src/main/java/org/operation/app/attendance/service/AttendanceServiceImpl.java rename to operation-service/src/main/java/org/sopt/makers/operation/app/attendance/service/AttendanceServiceImpl.java index abb47ccf..17c80098 100644 --- a/operation-service/src/main/java/org/operation/app/attendance/service/AttendanceServiceImpl.java +++ b/operation-service/src/main/java/org/sopt/makers/operation/app/attendance/service/AttendanceServiceImpl.java @@ -1,19 +1,19 @@ -package org.operation.app.attendance.service; +package org.sopt.makers.operation.app.attendance.service; import static org.operation.attendance.domain.AttendanceStatus.*; import static org.operation.attendance.message.ErrorMessage.*; import static org.operation.lecture.message.ErrorMessage.*; import static org.operation.member.message.ErrorMessage.*; -import org.operation.app.attendance.dto.request.AttendanceRequest; -import org.operation.app.attendance.dto.response.AttendanceResponse; +import org.sopt.makers.operation.app.attendance.dto.request.AttendanceRequest; +import org.sopt.makers.operation.app.attendance.dto.response.AttendanceResponse; import org.operation.attendance.domain.Attendance; import org.operation.attendance.domain.SubAttendance; import org.operation.attendance.repository.attendance.AttendanceRepository; -import org.operation.common.config.ValueConfig; -import org.operation.common.exception.LectureException; -import org.operation.common.exception.MemberException; -import org.operation.common.exception.SubLectureException; +import org.sopt.makers.operation.common.config.ValueConfig; +import org.sopt.makers.operation.common.exception.LectureException; +import org.sopt.makers.operation.common.exception.MemberException; +import org.sopt.makers.operation.common.exception.SubLectureException; import org.operation.lecture.Lecture; import org.operation.lecture.SubLecture; import org.operation.lecture.repository.subLecture.SubLectureRepository; diff --git a/operation-service/src/main/java/org/operation/app/lecture/dto/response/LectureCurrentRoundResponse.java b/operation-service/src/main/java/org/sopt/makers/operation/app/lecture/dto/response/LectureCurrentRoundResponse.java similarity index 84% rename from operation-service/src/main/java/org/operation/app/lecture/dto/response/LectureCurrentRoundResponse.java rename to operation-service/src/main/java/org/sopt/makers/operation/app/lecture/dto/response/LectureCurrentRoundResponse.java index 8d3b8e1a..798fc4cf 100644 --- a/operation-service/src/main/java/org/operation/app/lecture/dto/response/LectureCurrentRoundResponse.java +++ b/operation-service/src/main/java/org/sopt/makers/operation/app/lecture/dto/response/LectureCurrentRoundResponse.java @@ -1,4 +1,4 @@ -package org.operation.app.lecture.dto.response; +package org.sopt.makers.operation.app.lecture.dto.response; import org.operation.lecture.SubLecture; diff --git a/operation-service/src/main/java/org/operation/app/lecture/dto/response/LectureResponseType.java b/operation-service/src/main/java/org/sopt/makers/operation/app/lecture/dto/response/LectureResponseType.java similarity index 58% rename from operation-service/src/main/java/org/operation/app/lecture/dto/response/LectureResponseType.java rename to operation-service/src/main/java/org/sopt/makers/operation/app/lecture/dto/response/LectureResponseType.java index d154fd7a..ac9e5c3b 100644 --- a/operation-service/src/main/java/org/operation/app/lecture/dto/response/LectureResponseType.java +++ b/operation-service/src/main/java/org/sopt/makers/operation/app/lecture/dto/response/LectureResponseType.java @@ -1,4 +1,4 @@ -package org.operation.app.lecture.dto.response; +package org.sopt.makers.operation.app.lecture.dto.response; public enum LectureResponseType { NO_SESSION, HAS_ATTENDANCE, NO_ATTENDANCE diff --git a/operation-service/src/main/java/org/operation/app/lecture/dto/response/TodayLectureResponse.java b/operation-service/src/main/java/org/sopt/makers/operation/app/lecture/dto/response/TodayLectureResponse.java similarity index 97% rename from operation-service/src/main/java/org/operation/app/lecture/dto/response/TodayLectureResponse.java rename to operation-service/src/main/java/org/sopt/makers/operation/app/lecture/dto/response/TodayLectureResponse.java index eb0318b7..e70c146e 100644 --- a/operation-service/src/main/java/org/operation/app/lecture/dto/response/TodayLectureResponse.java +++ b/operation-service/src/main/java/org/sopt/makers/operation/app/lecture/dto/response/TodayLectureResponse.java @@ -1,4 +1,4 @@ -package org.operation.app.lecture.dto.response; +package org.sopt.makers.operation.app.lecture.dto.response; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; diff --git a/operation-service/src/main/java/org/operation/app/lecture/service/LectureServiceImpl.java b/operation-service/src/main/java/org/sopt/makers/operation/app/lecture/service/LectureServiceImpl.java similarity index 92% rename from operation-service/src/main/java/org/operation/app/lecture/service/LectureServiceImpl.java rename to operation-service/src/main/java/org/sopt/makers/operation/app/lecture/service/LectureServiceImpl.java index 8fcec5a0..d0e0d9b2 100644 --- a/operation-service/src/main/java/org/operation/app/lecture/service/LectureServiceImpl.java +++ b/operation-service/src/main/java/org/sopt/makers/operation/app/lecture/service/LectureServiceImpl.java @@ -1,4 +1,4 @@ -package org.operation.app.lecture.service; +package org.sopt.makers.operation.app.lecture.service; import static org.operation.attendance.domain.AttendanceStatus.*; import static org.operation.lecture.LectureStatus.*; @@ -10,15 +10,15 @@ import java.util.Collections; import java.util.List; -import org.operation.app.lecture.dto.response.LectureCurrentRoundResponse; -import org.operation.app.lecture.dto.response.LectureResponseType; -import org.operation.app.lecture.dto.response.TodayLectureResponse; +import org.sopt.makers.operation.app.lecture.dto.response.LectureCurrentRoundResponse; +import org.sopt.makers.operation.app.lecture.dto.response.LectureResponseType; +import org.sopt.makers.operation.app.lecture.dto.response.TodayLectureResponse; import org.operation.attendance.domain.Attendance; import org.operation.attendance.domain.SubAttendance; import org.operation.attendance.repository.attendance.AttendanceRepository; -import org.operation.common.config.ValueConfig; -import org.operation.common.exception.LectureException; -import org.operation.common.exception.SubLectureException; +import org.sopt.makers.operation.common.config.ValueConfig; +import org.sopt.makers.operation.common.exception.LectureException; +import org.sopt.makers.operation.common.exception.SubLectureException; import org.operation.lecture.repository.lecture.LectureRepository; import org.operation.lecture.Attribute; import org.operation.lecture.Lecture; diff --git a/operation-service/src/main/java/org/operation/app/member/dto/response/AttendanceTotalResponseDTO.java b/operation-service/src/main/java/org/sopt/makers/operation/app/member/dto/response/AttendanceTotalResponseDTO.java similarity index 78% rename from operation-service/src/main/java/org/operation/app/member/dto/response/AttendanceTotalResponseDTO.java rename to operation-service/src/main/java/org/sopt/makers/operation/app/member/dto/response/AttendanceTotalResponseDTO.java index 4451c458..2c4bbd80 100644 --- a/operation-service/src/main/java/org/operation/app/member/dto/response/AttendanceTotalResponseDTO.java +++ b/operation-service/src/main/java/org/sopt/makers/operation/app/member/dto/response/AttendanceTotalResponseDTO.java @@ -1,10 +1,10 @@ -package org.operation.app.member.dto.response; +package org.sopt.makers.operation.app.member.dto.response; import java.util.List; -import org.operation.common.domain.Part; +import org.sopt.makers.operation.domain.Part; import org.operation.member.domain.Member; -import org.operation.web.member.dto.response.AttendanceTotalCountVO; +import org.sopt.makers.operation.web.member.dto.response.AttendanceTotalCountVO; public record AttendanceTotalResponseDTO( Part part, diff --git a/operation-service/src/main/java/org/operation/app/member/dto/response/AttendanceTotalVO.java b/operation-service/src/main/java/org/sopt/makers/operation/app/member/dto/response/AttendanceTotalVO.java similarity index 94% rename from operation-service/src/main/java/org/operation/app/member/dto/response/AttendanceTotalVO.java rename to operation-service/src/main/java/org/sopt/makers/operation/app/member/dto/response/AttendanceTotalVO.java index 6b4cb7a6..5e420e26 100644 --- a/operation-service/src/main/java/org/operation/app/member/dto/response/AttendanceTotalVO.java +++ b/operation-service/src/main/java/org/sopt/makers/operation/app/member/dto/response/AttendanceTotalVO.java @@ -1,4 +1,4 @@ -package org.operation.app.member.dto.response; +package org.sopt.makers.operation.app.member.dto.response; import java.time.format.DateTimeFormatter; diff --git a/operation-service/src/main/java/org/operation/app/member/dto/response/MemberScoreGetResponse.java b/operation-service/src/main/java/org/sopt/makers/operation/app/member/dto/response/MemberScoreGetResponse.java similarity index 74% rename from operation-service/src/main/java/org/operation/app/member/dto/response/MemberScoreGetResponse.java rename to operation-service/src/main/java/org/sopt/makers/operation/app/member/dto/response/MemberScoreGetResponse.java index c7199651..c15151bc 100644 --- a/operation-service/src/main/java/org/operation/app/member/dto/response/MemberScoreGetResponse.java +++ b/operation-service/src/main/java/org/sopt/makers/operation/app/member/dto/response/MemberScoreGetResponse.java @@ -1,4 +1,4 @@ -package org.operation.app.member.dto.response; +package org.sopt.makers.operation.app.member.dto.response; public record MemberScoreGetResponse( float score diff --git a/operation-service/src/main/java/org/operation/app/member/service/MemberServiceImpl.java b/operation-service/src/main/java/org/sopt/makers/operation/app/member/service/MemberServiceImpl.java similarity index 87% rename from operation-service/src/main/java/org/operation/app/member/service/MemberServiceImpl.java rename to operation-service/src/main/java/org/sopt/makers/operation/app/member/service/MemberServiceImpl.java index 11a2b053..83072049 100644 --- a/operation-service/src/main/java/org/operation/app/member/service/MemberServiceImpl.java +++ b/operation-service/src/main/java/org/sopt/makers/operation/app/member/service/MemberServiceImpl.java @@ -1,21 +1,21 @@ -package org.operation.app.member.service; +package org.sopt.makers.operation.app.member.service; import static org.operation.member.message.ErrorMessage.*; import java.util.EnumMap; import java.util.List; -import org.operation.app.member.dto.response.AttendanceTotalResponseDTO; -import org.operation.app.member.dto.response.AttendanceTotalVO; -import org.operation.app.member.dto.response.MemberScoreGetResponse; +import org.sopt.makers.operation.app.member.dto.response.AttendanceTotalResponseDTO; +import org.sopt.makers.operation.app.member.dto.response.AttendanceTotalVO; +import org.sopt.makers.operation.app.member.dto.response.MemberScoreGetResponse; import org.operation.attendance.domain.AttendanceStatus; import org.operation.attendance.repository.attendance.AttendanceRepository; -import org.operation.common.config.ValueConfig; -import org.operation.common.exception.MemberException; +import org.sopt.makers.operation.common.config.ValueConfig; +import org.sopt.makers.operation.common.exception.MemberException; import org.operation.lecture.Attribute; import org.operation.member.domain.Member; import org.operation.member.repository.MemberRepository; -import org.operation.web.member.dto.response.AttendanceTotalCountVO; +import org.sopt.makers.operation.web.member.dto.response.AttendanceTotalCountVO; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; diff --git a/operation-service/src/main/java/org/operation/app/schedule/dto/response/SchedulesResponseDTO.java b/operation-service/src/main/java/org/sopt/makers/operation/app/schedule/dto/response/SchedulesResponseDTO.java similarity index 96% rename from operation-service/src/main/java/org/operation/app/schedule/dto/response/SchedulesResponseDTO.java rename to operation-service/src/main/java/org/sopt/makers/operation/app/schedule/dto/response/SchedulesResponseDTO.java index 204412b5..706f7cbe 100644 --- a/operation-service/src/main/java/org/operation/app/schedule/dto/response/SchedulesResponseDTO.java +++ b/operation-service/src/main/java/org/sopt/makers/operation/app/schedule/dto/response/SchedulesResponseDTO.java @@ -1,4 +1,4 @@ -package org.operation.app.schedule.dto.response; +package org.sopt.makers.operation.app.schedule.dto.response; import java.time.LocalDate; import java.time.format.TextStyle; diff --git a/operation-service/src/main/java/org/operation/app/schedule/service/ScheduleServiceImpl.java b/operation-service/src/main/java/org/sopt/makers/operation/app/schedule/service/ScheduleServiceImpl.java similarity index 95% rename from operation-service/src/main/java/org/operation/app/schedule/service/ScheduleServiceImpl.java rename to operation-service/src/main/java/org/sopt/makers/operation/app/schedule/service/ScheduleServiceImpl.java index 10d8542c..85fa45b9 100644 --- a/operation-service/src/main/java/org/operation/app/schedule/service/ScheduleServiceImpl.java +++ b/operation-service/src/main/java/org/sopt/makers/operation/app/schedule/service/ScheduleServiceImpl.java @@ -1,4 +1,4 @@ -package org.operation.app.schedule.service; +package org.sopt.makers.operation.app.schedule.service; import java.time.Duration; import java.time.LocalDate; @@ -10,7 +10,7 @@ import java.util.stream.Collectors; import java.util.stream.LongStream; -import org.operation.app.schedule.dto.response.SchedulesResponseDTO; +import org.sopt.makers.operation.app.schedule.dto.response.SchedulesResponseDTO; import org.operation.schedule.domain.Schedule; import org.operation.schedule.repository.ScheduleRepository; import org.springframework.stereotype.Service; diff --git a/operation-service/src/main/java/org/operation/common/exception/AdminFailureException.java b/operation-service/src/main/java/org/sopt/makers/operation/common/exception/AdminFailureException.java similarity index 77% rename from operation-service/src/main/java/org/operation/common/exception/AdminFailureException.java rename to operation-service/src/main/java/org/sopt/makers/operation/common/exception/AdminFailureException.java index dca2f1cc..5eccd7a9 100644 --- a/operation-service/src/main/java/org/operation/common/exception/AdminFailureException.java +++ b/operation-service/src/main/java/org/sopt/makers/operation/common/exception/AdminFailureException.java @@ -1,4 +1,4 @@ -package org.operation.common.exception; +package org.sopt.makers.operation.common.exception; public class AdminFailureException extends RuntimeException { public AdminFailureException(String message) { diff --git a/operation-service/src/main/java/org/operation/common/exception/AlarmException.java b/operation-service/src/main/java/org/sopt/makers/operation/common/exception/AlarmException.java similarity index 75% rename from operation-service/src/main/java/org/operation/common/exception/AlarmException.java rename to operation-service/src/main/java/org/sopt/makers/operation/common/exception/AlarmException.java index ce3ec426..f1fa3e80 100644 --- a/operation-service/src/main/java/org/operation/common/exception/AlarmException.java +++ b/operation-service/src/main/java/org/sopt/makers/operation/common/exception/AlarmException.java @@ -1,4 +1,4 @@ -package org.operation.common.exception; +package org.sopt.makers.operation.common.exception; public class AlarmException extends RuntimeException { public AlarmException(String message) { diff --git a/operation-service/src/main/java/org/operation/common/exception/LectureException.java b/operation-service/src/main/java/org/sopt/makers/operation/common/exception/LectureException.java similarity index 75% rename from operation-service/src/main/java/org/operation/common/exception/LectureException.java rename to operation-service/src/main/java/org/sopt/makers/operation/common/exception/LectureException.java index c0dfaa5d..0345d924 100644 --- a/operation-service/src/main/java/org/operation/common/exception/LectureException.java +++ b/operation-service/src/main/java/org/sopt/makers/operation/common/exception/LectureException.java @@ -1,4 +1,4 @@ -package org.operation.common.exception; +package org.sopt.makers.operation.common.exception; public class LectureException extends RuntimeException { public LectureException(String message) { diff --git a/operation-service/src/main/java/org/operation/common/exception/MemberException.java b/operation-service/src/main/java/org/sopt/makers/operation/common/exception/MemberException.java similarity index 75% rename from operation-service/src/main/java/org/operation/common/exception/MemberException.java rename to operation-service/src/main/java/org/sopt/makers/operation/common/exception/MemberException.java index 9981e98f..ea65c473 100644 --- a/operation-service/src/main/java/org/operation/common/exception/MemberException.java +++ b/operation-service/src/main/java/org/sopt/makers/operation/common/exception/MemberException.java @@ -1,4 +1,4 @@ -package org.operation.common.exception; +package org.sopt.makers.operation.common.exception; public class MemberException extends RuntimeException { public MemberException(String message) { diff --git a/operation-service/src/main/java/org/operation/common/exception/SubLectureException.java b/operation-service/src/main/java/org/sopt/makers/operation/common/exception/SubLectureException.java similarity index 76% rename from operation-service/src/main/java/org/operation/common/exception/SubLectureException.java rename to operation-service/src/main/java/org/sopt/makers/operation/common/exception/SubLectureException.java index e19c7a77..33dfab05 100644 --- a/operation-service/src/main/java/org/operation/common/exception/SubLectureException.java +++ b/operation-service/src/main/java/org/sopt/makers/operation/common/exception/SubLectureException.java @@ -1,4 +1,4 @@ -package org.operation.common.exception; +package org.sopt.makers.operation.common.exception; public class SubLectureException extends RuntimeException { public SubLectureException(String message) { diff --git a/operation-service/src/main/java/org/operation/common/exception/TokenException.java b/operation-service/src/main/java/org/sopt/makers/operation/common/exception/TokenException.java similarity index 74% rename from operation-service/src/main/java/org/operation/common/exception/TokenException.java rename to operation-service/src/main/java/org/sopt/makers/operation/common/exception/TokenException.java index b56db1b6..d5a67a5d 100644 --- a/operation-service/src/main/java/org/operation/common/exception/TokenException.java +++ b/operation-service/src/main/java/org/sopt/makers/operation/common/exception/TokenException.java @@ -1,4 +1,4 @@ -package org.operation.common.exception; +package org.sopt.makers.operation.common.exception; public class TokenException extends RuntimeException { public TokenException(String message) { super("[TokenException] : " + message); diff --git a/operation-service/src/main/java/org/operation/common/service/LectureServiceImpl.java b/operation-service/src/main/java/org/sopt/makers/operation/common/service/LectureServiceImpl.java similarity index 86% rename from operation-service/src/main/java/org/operation/common/service/LectureServiceImpl.java rename to operation-service/src/main/java/org/sopt/makers/operation/common/service/LectureServiceImpl.java index 61d01745..b94401f8 100644 --- a/operation-service/src/main/java/org/operation/common/service/LectureServiceImpl.java +++ b/operation-service/src/main/java/org/sopt/makers/operation/common/service/LectureServiceImpl.java @@ -1,4 +1,4 @@ -package org.operation.common.service; +package org.sopt.makers.operation.common.service; import static org.operation.alarm.domain.Attribute.*; import static org.operation.lecture.message.ErrorMessage.*; @@ -8,13 +8,13 @@ import lombok.val; import org.operation.client.alarm.AlarmSender; -import org.operation.common.config.ValueConfig; -import org.operation.common.exception.LectureException; -import org.operation.common.scheduler.service.LectureService; +import org.sopt.makers.operation.common.config.ValueConfig; +import org.sopt.makers.operation.common.exception.LectureException; +import org.sopt.makers.operation.common.scheduler.service.LectureService; import org.operation.lecture.Lecture; import org.operation.lecture.repository.lecture.LectureRepository; -import org.operation.web.alarm.dto.request.AlarmSenderRequest; +import org.sopt.makers.operation.web.alarm.dto.request.AlarmSenderRequest; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; diff --git a/operation-service/src/main/java/org/operation/web/admin/dto/request/LoginRequest.java b/operation-service/src/main/java/org/sopt/makers/operation/web/admin/dto/request/LoginRequest.java similarity index 54% rename from operation-service/src/main/java/org/operation/web/admin/dto/request/LoginRequest.java rename to operation-service/src/main/java/org/sopt/makers/operation/web/admin/dto/request/LoginRequest.java index 4f390246..d612c34f 100644 --- a/operation-service/src/main/java/org/operation/web/admin/dto/request/LoginRequest.java +++ b/operation-service/src/main/java/org/sopt/makers/operation/web/admin/dto/request/LoginRequest.java @@ -1,4 +1,4 @@ -package org.operation.web.admin.dto.request; +package org.sopt.makers.operation.web.admin.dto.request; public record LoginRequest( String email, diff --git a/operation-service/src/main/java/org/operation/web/admin/dto/request/SignUpRequest.java b/operation-service/src/main/java/org/sopt/makers/operation/web/admin/dto/request/SignUpRequest.java similarity index 86% rename from operation-service/src/main/java/org/operation/web/admin/dto/request/SignUpRequest.java rename to operation-service/src/main/java/org/sopt/makers/operation/web/admin/dto/request/SignUpRequest.java index 828e5620..59956aa0 100644 --- a/operation-service/src/main/java/org/operation/web/admin/dto/request/SignUpRequest.java +++ b/operation-service/src/main/java/org/sopt/makers/operation/web/admin/dto/request/SignUpRequest.java @@ -1,4 +1,4 @@ -package org.operation.web.admin.dto.request; +package org.sopt.makers.operation.web.admin.dto.request; import org.operation.admin.domain.Admin; import org.operation.admin.domain.Role; diff --git a/operation-service/src/main/java/org/operation/web/admin/dto/response/LoginResponse.java b/operation-service/src/main/java/org/sopt/makers/operation/web/admin/dto/response/LoginResponse.java similarity index 94% rename from operation-service/src/main/java/org/operation/web/admin/dto/response/LoginResponse.java rename to operation-service/src/main/java/org/sopt/makers/operation/web/admin/dto/response/LoginResponse.java index 7f3db527..8356c3c2 100644 --- a/operation-service/src/main/java/org/operation/web/admin/dto/response/LoginResponse.java +++ b/operation-service/src/main/java/org/sopt/makers/operation/web/admin/dto/response/LoginResponse.java @@ -1,4 +1,4 @@ -package org.operation.web.admin.dto.response; +package org.sopt.makers.operation.web.admin.dto.response; import lombok.AccessLevel; import lombok.Builder; diff --git a/operation-service/src/main/java/org/operation/web/admin/dto/response/RefreshResponse.java b/operation-service/src/main/java/org/sopt/makers/operation/web/admin/dto/response/RefreshResponse.java similarity index 83% rename from operation-service/src/main/java/org/operation/web/admin/dto/response/RefreshResponse.java rename to operation-service/src/main/java/org/sopt/makers/operation/web/admin/dto/response/RefreshResponse.java index bf7116ff..22187e23 100644 --- a/operation-service/src/main/java/org/operation/web/admin/dto/response/RefreshResponse.java +++ b/operation-service/src/main/java/org/sopt/makers/operation/web/admin/dto/response/RefreshResponse.java @@ -1,4 +1,4 @@ -package org.operation.web.admin.dto.response; +package org.sopt.makers.operation.web.admin.dto.response; import org.operation.admin.domain.Admin; diff --git a/operation-service/src/main/java/org/operation/web/admin/dto/response/SignUpResponse.java b/operation-service/src/main/java/org/sopt/makers/operation/web/admin/dto/response/SignUpResponse.java similarity index 89% rename from operation-service/src/main/java/org/operation/web/admin/dto/response/SignUpResponse.java rename to operation-service/src/main/java/org/sopt/makers/operation/web/admin/dto/response/SignUpResponse.java index 45db8905..1baf0fe8 100644 --- a/operation-service/src/main/java/org/operation/web/admin/dto/response/SignUpResponse.java +++ b/operation-service/src/main/java/org/sopt/makers/operation/web/admin/dto/response/SignUpResponse.java @@ -1,4 +1,4 @@ -package org.operation.web.admin.dto.response; +package org.sopt.makers.operation.web.admin.dto.response; import org.operation.admin.domain.Admin; import org.operation.admin.domain.Role; diff --git a/operation-service/src/main/java/org/operation/web/admin/repository/AdminRepository.java b/operation-service/src/main/java/org/sopt/makers/operation/web/admin/repository/AdminRepository.java similarity index 86% rename from operation-service/src/main/java/org/operation/web/admin/repository/AdminRepository.java rename to operation-service/src/main/java/org/sopt/makers/operation/web/admin/repository/AdminRepository.java index 0cf07686..ac255bc5 100644 --- a/operation-service/src/main/java/org/operation/web/admin/repository/AdminRepository.java +++ b/operation-service/src/main/java/org/sopt/makers/operation/web/admin/repository/AdminRepository.java @@ -1,4 +1,4 @@ -package org.operation.web.admin.repository; +package org.sopt.makers.operation.web.admin.repository; import java.util.Optional; diff --git a/operation-service/src/main/java/org/operation/web/admin/service/AdminServiceImpl.java b/operation-service/src/main/java/org/sopt/makers/operation/web/admin/service/AdminServiceImpl.java similarity index 87% rename from operation-service/src/main/java/org/operation/web/admin/service/AdminServiceImpl.java rename to operation-service/src/main/java/org/sopt/makers/operation/web/admin/service/AdminServiceImpl.java index de3afa2a..f80ccdfa 100644 --- a/operation-service/src/main/java/org/operation/web/admin/service/AdminServiceImpl.java +++ b/operation-service/src/main/java/org/sopt/makers/operation/web/admin/service/AdminServiceImpl.java @@ -1,15 +1,15 @@ -package org.operation.web.admin.service; +package org.sopt.makers.operation.web.admin.service; import org.operation.admin.domain.Admin; import org.operation.security.AdminAuthentication; import org.operation.security.jwt.JwtTokenProvider; -import org.operation.web.admin.dto.request.LoginRequest; -import org.operation.web.admin.dto.request.SignUpRequest; -import org.operation.web.admin.dto.response.LoginResponse; -import org.operation.web.admin.dto.response.RefreshResponse; -import org.operation.web.admin.dto.response.SignUpResponse; -import org.operation.common.exception.AdminFailureException; -import org.operation.web.admin.repository.AdminRepository; +import org.sopt.makers.operation.web.admin.dto.request.LoginRequest; +import org.sopt.makers.operation.web.admin.dto.request.SignUpRequest; +import org.sopt.makers.operation.web.admin.dto.response.LoginResponse; +import org.sopt.makers.operation.web.admin.dto.response.RefreshResponse; +import org.sopt.makers.operation.web.admin.dto.response.SignUpResponse; +import org.sopt.makers.operation.common.exception.AdminFailureException; +import org.sopt.makers.operation.web.admin.repository.AdminRepository; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; diff --git a/operation-service/src/main/java/org/sopt/makers/operation/web/alarm/dto/request/AlarmSendRequest.java b/operation-service/src/main/java/org/sopt/makers/operation/web/alarm/dto/request/AlarmSendRequest.java new file mode 100644 index 00000000..a3a30aea --- /dev/null +++ b/operation-service/src/main/java/org/sopt/makers/operation/web/alarm/dto/request/AlarmSendRequest.java @@ -0,0 +1,6 @@ +package org.sopt.makers.operation.web.alarm.dto.request; + +public record AlarmSendRequest( + long alarmId +) { +} diff --git a/operation-service/src/main/java/org/operation/web/alarm/dto/request/AlarmSenderRequest.java b/operation-service/src/main/java/org/sopt/makers/operation/web/alarm/dto/request/AlarmSenderRequest.java similarity index 90% rename from operation-service/src/main/java/org/operation/web/alarm/dto/request/AlarmSenderRequest.java rename to operation-service/src/main/java/org/sopt/makers/operation/web/alarm/dto/request/AlarmSenderRequest.java index 4dc4ad5c..ab6fdaf4 100644 --- a/operation-service/src/main/java/org/operation/web/alarm/dto/request/AlarmSenderRequest.java +++ b/operation-service/src/main/java/org/sopt/makers/operation/web/alarm/dto/request/AlarmSenderRequest.java @@ -1,4 +1,4 @@ -package org.operation.web.alarm.dto.request; +package org.sopt.makers.operation.web.alarm.dto.request; import java.util.List; diff --git a/operation-service/src/main/java/org/operation/web/alarm/dto/response/AlarmInactiveListResponse.java b/operation-service/src/main/java/org/sopt/makers/operation/web/alarm/dto/response/AlarmInactiveListResponse.java similarity index 62% rename from operation-service/src/main/java/org/operation/web/alarm/dto/response/AlarmInactiveListResponse.java rename to operation-service/src/main/java/org/sopt/makers/operation/web/alarm/dto/response/AlarmInactiveListResponse.java index d3030d2a..da930125 100644 --- a/operation-service/src/main/java/org/operation/web/alarm/dto/response/AlarmInactiveListResponse.java +++ b/operation-service/src/main/java/org/sopt/makers/operation/web/alarm/dto/response/AlarmInactiveListResponse.java @@ -1,4 +1,4 @@ -package org.operation.web.alarm.dto.response; +package org.sopt.makers.operation.web.alarm.dto.response; import java.util.List; diff --git a/operation-service/src/main/java/org/operation/web/alarm/dto/response/AlarmResponse.java b/operation-service/src/main/java/org/sopt/makers/operation/web/alarm/dto/response/AlarmResponse.java similarity index 92% rename from operation-service/src/main/java/org/operation/web/alarm/dto/response/AlarmResponse.java rename to operation-service/src/main/java/org/sopt/makers/operation/web/alarm/dto/response/AlarmResponse.java index 1f034d84..24ada7f4 100644 --- a/operation-service/src/main/java/org/operation/web/alarm/dto/response/AlarmResponse.java +++ b/operation-service/src/main/java/org/sopt/makers/operation/web/alarm/dto/response/AlarmResponse.java @@ -1,4 +1,4 @@ -package org.operation.web.alarm.dto.response; +package org.sopt.makers.operation.web.alarm.dto.response; import static java.util.Objects.*; diff --git a/operation-service/src/main/java/org/operation/web/alarm/dto/response/AlarmsResponse.java b/operation-service/src/main/java/org/sopt/makers/operation/web/alarm/dto/response/AlarmsResponse.java similarity index 94% rename from operation-service/src/main/java/org/operation/web/alarm/dto/response/AlarmsResponse.java rename to operation-service/src/main/java/org/sopt/makers/operation/web/alarm/dto/response/AlarmsResponse.java index 0906460a..84a40166 100644 --- a/operation-service/src/main/java/org/operation/web/alarm/dto/response/AlarmsResponse.java +++ b/operation-service/src/main/java/org/sopt/makers/operation/web/alarm/dto/response/AlarmsResponse.java @@ -1,4 +1,4 @@ -package org.operation.web.alarm.dto.response; +package org.sopt.makers.operation.web.alarm.dto.response; import static java.util.Objects.*; diff --git a/operation-service/src/main/java/org/operation/web/alarm/service/AlarmServiceImpl.java b/operation-service/src/main/java/org/sopt/makers/operation/web/alarm/service/AlarmServiceImpl.java similarity index 85% rename from operation-service/src/main/java/org/operation/web/alarm/service/AlarmServiceImpl.java rename to operation-service/src/main/java/org/sopt/makers/operation/web/alarm/service/AlarmServiceImpl.java index 62ae30ab..be596058 100644 --- a/operation-service/src/main/java/org/operation/web/alarm/service/AlarmServiceImpl.java +++ b/operation-service/src/main/java/org/sopt/makers/operation/web/alarm/service/AlarmServiceImpl.java @@ -1,4 +1,4 @@ -package org.operation.web.alarm.service; +package org.sopt.makers.operation.web.alarm.service; import static java.util.Objects.*; import static org.operation.alarm.domain.Status.*; @@ -11,16 +11,16 @@ import org.operation.alarm.repository.AlarmRepository; import org.operation.client.alarm.AlarmSender; import org.operation.client.playground.PlayGroundServer; -import org.operation.common.config.ValueConfig; -import org.operation.common.domain.Part; -import org.operation.common.dto.MemberSearchCondition; -import org.operation.common.exception.AlarmException; +import org.sopt.makers.operation.common.config.ValueConfig; +import org.sopt.makers.operation.domain.Part; +import org.sopt.makers.operation.dto.MemberSearchCondition; +import org.sopt.makers.operation.common.exception.AlarmException; import org.operation.member.repository.MemberRepository; -import org.operation.web.alarm.dto.request.AlarmRequest; -import org.operation.web.alarm.dto.request.AlarmSendRequest; -import org.operation.web.alarm.dto.request.AlarmSenderRequest; -import org.operation.web.alarm.dto.response.AlarmResponse; -import org.operation.web.alarm.dto.response.AlarmsResponse; +import org.sopt.makers.operation.dto.AlarmRequest; +import org.sopt.makers.operation.web.alarm.dto.request.AlarmSendRequest; +import org.sopt.makers.operation.web.alarm.dto.request.AlarmSenderRequest; +import org.sopt.makers.operation.web.alarm.dto.response.AlarmResponse; +import org.sopt.makers.operation.web.alarm.dto.response.AlarmsResponse; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; diff --git a/operation-service/src/main/java/org/operation/web/attendance/dto/request/SubAttendanceUpdateRequest.java b/operation-service/src/main/java/org/sopt/makers/operation/web/attendance/dto/request/SubAttendanceUpdateRequest.java similarity index 71% rename from operation-service/src/main/java/org/operation/web/attendance/dto/request/SubAttendanceUpdateRequest.java rename to operation-service/src/main/java/org/sopt/makers/operation/web/attendance/dto/request/SubAttendanceUpdateRequest.java index eb2d48fc..1b71fb81 100644 --- a/operation-service/src/main/java/org/operation/web/attendance/dto/request/SubAttendanceUpdateRequest.java +++ b/operation-service/src/main/java/org/sopt/makers/operation/web/attendance/dto/request/SubAttendanceUpdateRequest.java @@ -1,4 +1,4 @@ -package org.operation.web.attendance.dto.request; +package org.sopt.makers.operation.web.attendance.dto.request; import org.operation.attendance.domain.AttendanceStatus; diff --git a/operation-service/src/main/java/org/operation/web/attendance/dto/response/AttendanceMemberResponse.java b/operation-service/src/main/java/org/sopt/makers/operation/web/attendance/dto/response/AttendanceMemberResponse.java similarity index 95% rename from operation-service/src/main/java/org/operation/web/attendance/dto/response/AttendanceMemberResponse.java rename to operation-service/src/main/java/org/sopt/makers/operation/web/attendance/dto/response/AttendanceMemberResponse.java index ced0dba0..d946ee83 100644 --- a/operation-service/src/main/java/org/operation/web/attendance/dto/response/AttendanceMemberResponse.java +++ b/operation-service/src/main/java/org/sopt/makers/operation/web/attendance/dto/response/AttendanceMemberResponse.java @@ -1,4 +1,4 @@ -package org.operation.web.attendance.dto.response; +package org.sopt.makers.operation.web.attendance.dto.response; import java.util.List; diff --git a/operation-service/src/main/java/org/operation/web/attendance/dto/response/AttendancesResponse.java b/operation-service/src/main/java/org/sopt/makers/operation/web/attendance/dto/response/AttendancesResponse.java similarity index 85% rename from operation-service/src/main/java/org/operation/web/attendance/dto/response/AttendancesResponse.java rename to operation-service/src/main/java/org/sopt/makers/operation/web/attendance/dto/response/AttendancesResponse.java index 160919a5..a5dfe1b2 100644 --- a/operation-service/src/main/java/org/operation/web/attendance/dto/response/AttendancesResponse.java +++ b/operation-service/src/main/java/org/sopt/makers/operation/web/attendance/dto/response/AttendancesResponse.java @@ -1,4 +1,4 @@ -package org.operation.web.attendance.dto.response; +package org.sopt.makers.operation.web.attendance.dto.response; import java.util.List; diff --git a/operation-service/src/main/java/org/operation/web/attendance/dto/response/MemberResponse.java b/operation-service/src/main/java/org/sopt/makers/operation/web/attendance/dto/response/MemberResponse.java similarity index 95% rename from operation-service/src/main/java/org/operation/web/attendance/dto/response/MemberResponse.java rename to operation-service/src/main/java/org/sopt/makers/operation/web/attendance/dto/response/MemberResponse.java index 5baebe36..7af248ca 100644 --- a/operation-service/src/main/java/org/operation/web/attendance/dto/response/MemberResponse.java +++ b/operation-service/src/main/java/org/sopt/makers/operation/web/attendance/dto/response/MemberResponse.java @@ -1,4 +1,4 @@ -package org.operation.web.attendance.dto.response; +package org.sopt.makers.operation.web.attendance.dto.response; import java.util.List; diff --git a/operation-service/src/main/java/org/operation/web/attendance/dto/response/SubAttendanceUpdateResponse.java b/operation-service/src/main/java/org/sopt/makers/operation/web/attendance/dto/response/SubAttendanceUpdateResponse.java similarity index 85% rename from operation-service/src/main/java/org/operation/web/attendance/dto/response/SubAttendanceUpdateResponse.java rename to operation-service/src/main/java/org/sopt/makers/operation/web/attendance/dto/response/SubAttendanceUpdateResponse.java index f0016565..31db0ef2 100644 --- a/operation-service/src/main/java/org/operation/web/attendance/dto/response/SubAttendanceUpdateResponse.java +++ b/operation-service/src/main/java/org/sopt/makers/operation/web/attendance/dto/response/SubAttendanceUpdateResponse.java @@ -1,4 +1,4 @@ -package org.operation.web.attendance.dto.response; +package org.sopt.makers.operation.web.attendance.dto.response; import org.operation.attendance.domain.AttendanceStatus; import org.operation.attendance.domain.SubAttendance; diff --git a/operation-service/src/main/java/org/operation/web/attendance/service/AttendanceServiceImpl.java b/operation-service/src/main/java/org/sopt/makers/operation/web/attendance/service/AttendanceServiceImpl.java similarity index 79% rename from operation-service/src/main/java/org/operation/web/attendance/service/AttendanceServiceImpl.java rename to operation-service/src/main/java/org/sopt/makers/operation/web/attendance/service/AttendanceServiceImpl.java index 097300fe..89d646da 100644 --- a/operation-service/src/main/java/org/operation/web/attendance/service/AttendanceServiceImpl.java +++ b/operation-service/src/main/java/org/sopt/makers/operation/web/attendance/service/AttendanceServiceImpl.java @@ -1,4 +1,4 @@ -package org.operation.web.attendance.service; +package org.sopt.makers.operation.web.attendance.service; import static org.operation.attendance.message.ErrorMessage.*; import static org.operation.member.message.ErrorMessage.*; @@ -6,16 +6,16 @@ import org.operation.attendance.domain.SubAttendance; import org.operation.attendance.repository.attendance.AttendanceRepository; import org.operation.attendance.repository.subAttendance.SubAttendanceRepository; -import org.operation.common.domain.Part; -import org.operation.common.exception.LectureException; -import org.operation.common.exception.MemberException; +import org.sopt.makers.operation.domain.Part; +import org.sopt.makers.operation.common.exception.LectureException; +import org.sopt.makers.operation.common.exception.MemberException; import org.operation.member.domain.Member; import org.operation.member.repository.MemberRepository; -import org.operation.web.attendance.dto.request.SubAttendanceUpdateRequest; -import org.operation.web.attendance.dto.response.AttendanceMemberResponse; -import org.operation.web.attendance.dto.response.AttendancesResponse; -import org.operation.web.attendance.dto.response.SubAttendanceUpdateResponse; -import org.operation.web.attendnace.service.AttendanceService; +import org.sopt.makers.operation.web.attendance.dto.request.SubAttendanceUpdateRequest; +import org.sopt.makers.operation.web.attendance.dto.response.AttendanceMemberResponse; +import org.sopt.makers.operation.web.attendance.dto.response.AttendancesResponse; +import org.sopt.makers.operation.web.attendance.dto.response.SubAttendanceUpdateResponse; +import org.sopt.makers.operation.web.attendnace.service.AttendanceService; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; diff --git a/operation-service/src/main/java/org/operation/web/lecture/dto/request/AttendanceRequest.java b/operation-service/src/main/java/org/sopt/makers/operation/web/lecture/dto/request/AttendanceRequest.java similarity index 58% rename from operation-service/src/main/java/org/operation/web/lecture/dto/request/AttendanceRequest.java rename to operation-service/src/main/java/org/sopt/makers/operation/web/lecture/dto/request/AttendanceRequest.java index 65dd2497..c543b046 100644 --- a/operation-service/src/main/java/org/operation/web/lecture/dto/request/AttendanceRequest.java +++ b/operation-service/src/main/java/org/sopt/makers/operation/web/lecture/dto/request/AttendanceRequest.java @@ -1,4 +1,4 @@ -package org.operation.web.lecture.dto.request; +package org.sopt.makers.operation.web.lecture.dto.request; public record AttendanceRequest( Long lectureId, diff --git a/operation-service/src/main/java/org/operation/web/lecture/dto/request/LectureRequest.java b/operation-service/src/main/java/org/sopt/makers/operation/web/lecture/dto/request/LectureRequest.java similarity index 88% rename from operation-service/src/main/java/org/operation/web/lecture/dto/request/LectureRequest.java rename to operation-service/src/main/java/org/sopt/makers/operation/web/lecture/dto/request/LectureRequest.java index 9abbdbc4..545ca5e8 100644 --- a/operation-service/src/main/java/org/operation/web/lecture/dto/request/LectureRequest.java +++ b/operation-service/src/main/java/org/sopt/makers/operation/web/lecture/dto/request/LectureRequest.java @@ -1,9 +1,9 @@ -package org.operation.web.lecture.dto.request; +package org.sopt.makers.operation.web.lecture.dto.request; import java.time.LocalDateTime; import java.time.format.DateTimeParseException; -import org.operation.common.domain.Part; +import org.sopt.makers.operation.domain.Part; import org.operation.lecture.Attribute; import org.operation.lecture.Lecture; diff --git a/operation-service/src/main/java/org/operation/web/lecture/dto/response/AttendanceResponse.java b/operation-service/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/AttendanceResponse.java similarity index 86% rename from operation-service/src/main/java/org/operation/web/lecture/dto/response/AttendanceResponse.java rename to operation-service/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/AttendanceResponse.java index b5f6506b..467b2f2a 100644 --- a/operation-service/src/main/java/org/operation/web/lecture/dto/response/AttendanceResponse.java +++ b/operation-service/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/AttendanceResponse.java @@ -1,4 +1,4 @@ -package org.operation.web.lecture.dto.response; +package org.sopt.makers.operation.web.lecture.dto.response; import org.operation.lecture.Lecture; import org.operation.lecture.SubLecture; diff --git a/operation-service/src/main/java/org/operation/web/lecture/dto/response/AttendancesStatusVO.java b/operation-service/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/AttendancesStatusVO.java similarity index 94% rename from operation-service/src/main/java/org/operation/web/lecture/dto/response/AttendancesStatusVO.java rename to operation-service/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/AttendancesStatusVO.java index 59d74220..5b624d6a 100644 --- a/operation-service/src/main/java/org/operation/web/lecture/dto/response/AttendancesStatusVO.java +++ b/operation-service/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/AttendancesStatusVO.java @@ -1,4 +1,4 @@ -package org.operation.web.lecture.dto.response; +package org.sopt.makers.operation.web.lecture.dto.response; import static org.operation.attendance.domain.AttendanceStatus.*; diff --git a/operation-service/src/main/java/org/operation/web/lecture/dto/response/LectureDetailResponse.java b/operation-service/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureDetailResponse.java similarity index 91% rename from operation-service/src/main/java/org/operation/web/lecture/dto/response/LectureDetailResponse.java rename to operation-service/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureDetailResponse.java index 6955180b..65dafdf5 100644 --- a/operation-service/src/main/java/org/operation/web/lecture/dto/response/LectureDetailResponse.java +++ b/operation-service/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureDetailResponse.java @@ -1,4 +1,4 @@ -package org.operation.web.lecture.dto.response; +package org.sopt.makers.operation.web.lecture.dto.response; import org.operation.lecture.Lecture; diff --git a/operation-service/src/main/java/org/operation/web/lecture/dto/response/LectureResponse.java b/operation-service/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureResponse.java similarity index 93% rename from operation-service/src/main/java/org/operation/web/lecture/dto/response/LectureResponse.java rename to operation-service/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureResponse.java index 3fe86672..2bdf8f20 100644 --- a/operation-service/src/main/java/org/operation/web/lecture/dto/response/LectureResponse.java +++ b/operation-service/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureResponse.java @@ -1,11 +1,11 @@ -package org.operation.web.lecture.dto.response; +package org.sopt.makers.operation.web.lecture.dto.response; import static java.util.Objects.*; import java.time.LocalDateTime; import java.util.List; -import org.operation.common.domain.Part; +import org.sopt.makers.operation.domain.Part; import org.operation.lecture.Attribute; import org.operation.lecture.Lecture; import org.operation.lecture.LectureStatus; diff --git a/operation-service/src/main/java/org/operation/web/lecture/dto/response/LecturesResponse.java b/operation-service/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LecturesResponse.java similarity index 91% rename from operation-service/src/main/java/org/operation/web/lecture/dto/response/LecturesResponse.java rename to operation-service/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LecturesResponse.java index 1fe17d50..cdb32ae0 100644 --- a/operation-service/src/main/java/org/operation/web/lecture/dto/response/LecturesResponse.java +++ b/operation-service/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LecturesResponse.java @@ -1,8 +1,8 @@ -package org.operation.web.lecture.dto.response; +package org.sopt.makers.operation.web.lecture.dto.response; import java.util.List; -import org.operation.common.domain.Part; +import org.sopt.makers.operation.domain.Part; import org.operation.lecture.Attribute; import org.operation.lecture.Lecture; diff --git a/operation-service/src/main/java/org/operation/web/lecture/service/LectureServiceImpl.java b/operation-service/src/main/java/org/sopt/makers/operation/web/lecture/service/LectureServiceImpl.java similarity index 88% rename from operation-service/src/main/java/org/operation/web/lecture/service/LectureServiceImpl.java rename to operation-service/src/main/java/org/sopt/makers/operation/web/lecture/service/LectureServiceImpl.java index eb77a6c3..1cc73f57 100644 --- a/operation-service/src/main/java/org/operation/web/lecture/service/LectureServiceImpl.java +++ b/operation-service/src/main/java/org/sopt/makers/operation/web/lecture/service/LectureServiceImpl.java @@ -1,4 +1,4 @@ -package org.operation.web.lecture.service; +package org.sopt.makers.operation.web.lecture.service; import static org.operation.alarm.domain.Attribute.*; import static org.operation.lecture.message.ErrorMessage.*; @@ -11,23 +11,23 @@ import org.operation.attendance.repository.attendance.AttendanceRepository; import org.operation.attendance.repository.subAttendance.SubAttendanceRepository; import org.operation.client.alarm.AlarmSender; -import org.operation.common.config.ValueConfig; -import org.operation.common.domain.Part; -import org.operation.common.exception.LectureException; -import org.operation.common.exception.SubLectureException; +import org.sopt.makers.operation.common.config.ValueConfig; +import org.sopt.makers.operation.domain.Part; +import org.sopt.makers.operation.common.exception.LectureException; +import org.sopt.makers.operation.common.exception.SubLectureException; import org.operation.lecture.Lecture; import org.operation.lecture.SubLecture; import org.operation.lecture.repository.lecture.LectureRepository; import org.operation.lecture.repository.subLecture.SubLectureRepository; import org.operation.member.domain.Member; import org.operation.member.repository.MemberRepository; -import org.operation.web.alarm.dto.request.AlarmSenderRequest; -import org.operation.web.lecture.dto.request.AttendanceRequest; -import org.operation.web.lecture.dto.request.LectureRequest; -import org.operation.web.lecture.dto.response.AttendanceResponse; -import org.operation.web.lecture.dto.response.LectureDetailResponse; -import org.operation.web.lecture.dto.response.LectureResponse; -import org.operation.web.lecture.dto.response.LecturesResponse; +import org.sopt.makers.operation.web.alarm.dto.request.AlarmSenderRequest; +import org.sopt.makers.operation.web.lecture.dto.request.AttendanceRequest; +import org.sopt.makers.operation.web.lecture.dto.request.LectureRequest; +import org.sopt.makers.operation.web.lecture.dto.response.AttendanceResponse; +import org.sopt.makers.operation.web.lecture.dto.response.LectureDetailResponse; +import org.sopt.makers.operation.web.lecture.dto.response.LectureResponse; +import org.sopt.makers.operation.web.lecture.dto.response.LecturesResponse; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; diff --git a/operation-service/src/main/java/org/operation/web/member/dto/response/AttendanceTotalCountVO.java b/operation-service/src/main/java/org/sopt/makers/operation/web/member/dto/response/AttendanceTotalCountVO.java similarity index 83% rename from operation-service/src/main/java/org/operation/web/member/dto/response/AttendanceTotalCountVO.java rename to operation-service/src/main/java/org/sopt/makers/operation/web/member/dto/response/AttendanceTotalCountVO.java index f65a63a7..773f9b51 100644 --- a/operation-service/src/main/java/org/operation/web/member/dto/response/AttendanceTotalCountVO.java +++ b/operation-service/src/main/java/org/sopt/makers/operation/web/member/dto/response/AttendanceTotalCountVO.java @@ -1,4 +1,4 @@ -package org.operation.web.member.dto.response; +package org.sopt.makers.operation.web.member.dto.response; public record AttendanceTotalCountVO( int attendance, diff --git a/operation-service/src/main/java/org/operation/web/member/dto/response/AttendanceTotalVO.java b/operation-service/src/main/java/org/sopt/makers/operation/web/member/dto/response/AttendanceTotalVO.java similarity index 93% rename from operation-service/src/main/java/org/operation/web/member/dto/response/AttendanceTotalVO.java rename to operation-service/src/main/java/org/sopt/makers/operation/web/member/dto/response/AttendanceTotalVO.java index b471fe39..46127030 100644 --- a/operation-service/src/main/java/org/operation/web/member/dto/response/AttendanceTotalVO.java +++ b/operation-service/src/main/java/org/sopt/makers/operation/web/member/dto/response/AttendanceTotalVO.java @@ -1,4 +1,4 @@ -package org.operation.web.member.dto.response; +package org.sopt.makers.operation.web.member.dto.response; import java.time.format.DateTimeFormatter; diff --git a/operation-service/src/main/java/org/operation/web/member/dto/response/MemberListGetResponse.java b/operation-service/src/main/java/org/sopt/makers/operation/web/member/dto/response/MemberListGetResponse.java similarity index 81% rename from operation-service/src/main/java/org/operation/web/member/dto/response/MemberListGetResponse.java rename to operation-service/src/main/java/org/sopt/makers/operation/web/member/dto/response/MemberListGetResponse.java index c4afd5d5..92db0bac 100644 --- a/operation-service/src/main/java/org/operation/web/member/dto/response/MemberListGetResponse.java +++ b/operation-service/src/main/java/org/sopt/makers/operation/web/member/dto/response/MemberListGetResponse.java @@ -1,6 +1,6 @@ -package org.operation.web.member.dto.response; +package org.sopt.makers.operation.web.member.dto.response; -import org.operation.common.domain.Part; +import org.sopt.makers.operation.domain.Part; import org.operation.member.domain.Member; public record MemberListGetResponse( diff --git a/operation-service/src/main/java/org/operation/web/member/dto/response/MembersResponse.java b/operation-service/src/main/java/org/sopt/makers/operation/web/member/dto/response/MembersResponse.java similarity index 81% rename from operation-service/src/main/java/org/operation/web/member/dto/response/MembersResponse.java rename to operation-service/src/main/java/org/sopt/makers/operation/web/member/dto/response/MembersResponse.java index df23adf6..fcc209f3 100644 --- a/operation-service/src/main/java/org/operation/web/member/dto/response/MembersResponse.java +++ b/operation-service/src/main/java/org/sopt/makers/operation/web/member/dto/response/MembersResponse.java @@ -1,4 +1,4 @@ -package org.operation.web.member.dto.response; +package org.sopt.makers.operation.web.member.dto.response; import java.util.List; diff --git a/operation-service/src/main/java/org/operation/web/member/service/MemberServiceImpl.java b/operation-service/src/main/java/org/sopt/makers/operation/web/member/service/MemberServiceImpl.java similarity index 85% rename from operation-service/src/main/java/org/operation/web/member/service/MemberServiceImpl.java rename to operation-service/src/main/java/org/sopt/makers/operation/web/member/service/MemberServiceImpl.java index 9f1b852c..9a4b49f4 100644 --- a/operation-service/src/main/java/org/operation/web/member/service/MemberServiceImpl.java +++ b/operation-service/src/main/java/org/sopt/makers/operation/web/member/service/MemberServiceImpl.java @@ -1,18 +1,18 @@ -package org.operation.web.member.service; +package org.sopt.makers.operation.web.member.service; import java.util.EnumMap; import java.util.List; import org.operation.attendance.domain.AttendanceStatus; import org.operation.attendance.repository.attendance.AttendanceRepository; -import org.operation.common.domain.Part; -import org.operation.common.dto.MemberSearchCondition; +import org.sopt.makers.operation.domain.Part; +import org.sopt.makers.operation.dto.MemberSearchCondition; import org.operation.member.domain.Member; import org.operation.member.repository.MemberRepository; -import org.operation.web.member.dto.response.AttendanceTotalCountVO; -import org.operation.web.member.dto.response.AttendanceTotalVO; -import org.operation.web.member.dto.response.MemberListGetResponse; -import org.operation.web.member.dto.response.MembersResponse; +import org.sopt.makers.operation.web.member.dto.response.AttendanceTotalCountVO; +import org.sopt.makers.operation.web.member.dto.response.AttendanceTotalVO; +import org.sopt.makers.operation.web.member.dto.response.MemberListGetResponse; +import org.sopt.makers.operation.web.member.dto.response.MembersResponse; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; diff --git a/settings.gradle b/settings.gradle index 353d1be8..aba15a9a 100644 --- a/settings.gradle +++ b/settings.gradle @@ -5,4 +5,5 @@ include 'operation-domain' include 'operation-external' include 'operation-storage' include 'operation-service' +include 'operation-common' From 58e754afd77b36a5b12bf58ea398b9e6fd965bad Mon Sep 17 00:00:00 2001 From: thguss Date: Sun, 4 Feb 2024 23:41:28 +0900 Subject: [PATCH 050/141] =?UTF-8?q?[REFACTOR]=20=EC=9A=A9=ED=83=9D=20?= =?UTF-8?q?=EC=86=8C=ED=98=84=20=EB=AA=A8=EB=93=88=20=EC=84=A4=EA=B3=84=20?= =?UTF-8?q?=EC=97=B4=ED=98=88=EB=85=BC=EC=9D=98,,?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- operation-api/build.gradle | 2 +- .../api/AttendanceApiController.java | 5 +-- .../dto/request/AttendanceRequest.java | 6 ++-- .../dto/response/AttendanceResponse.java | 0 .../dto/response/AttendancesResponse.java | 0 .../attendance/message/SuccessMessage.java | 13 ------- .../service/AttendanceServiceImpl.java | 21 +++-------- .../operation/common/dto/BaseResponse.java | 2 +- .../common/util/ApiResponseUtil.java | 35 +++++++++---------- .../response/LectureCurrentRoundResponse.java | 2 +- .../dto/response/LectureResponseType.java | 2 +- .../dto/response/TodayLectureResponse.java | 2 +- .../lecture/service/LectureServiceImpl.java | 8 ++--- .../response/AttendanceTotalResponseDTO.java | 4 +-- .../dto/response/AttendanceTotalVO.java | 2 +- .../dto/response/MemberScoreGetResponse.java | 2 +- .../app/member/service/MemberServiceImpl.java | 10 +++--- .../dto/response/SchedulesResponseDTO.java | 2 +- .../schedule/service/ScheduleServiceImpl.java | 4 +-- .../service}/service/LectureServiceImpl.java | 2 +- .../web/admin/dto/request/LoginRequest.java | 2 +- .../web/admin/dto/request/SignUpRequest.java | 2 +- .../web/admin/dto/response/LoginResponse.java | 2 +- .../admin/dto/response/RefreshResponse.java | 2 +- .../admin/dto/response/SignUpResponse.java | 2 +- .../web/admin/repository/AdminRepository.java | 2 +- .../web/admin/service/AdminServiceImpl.java | 14 ++++---- .../alarm/dto/request/AlarmSendRequest.java | 6 ++++ .../response/AlarmInactiveListResponse.java | 2 +- .../web/alarm/dto/response/AlarmResponse.java | 2 +- .../alarm/dto/response/AlarmsResponse.java | 2 +- .../web/alarm/service/AlarmServiceImpl.java | 8 ++--- .../request/SubAttendanceUpdateRequest.java | 2 +- .../response/AttendanceMemberResponse.java | 2 +- .../dto/response/AttendancesResponse.java | 2 +- .../dto/response/MemberResponse.java | 2 +- .../response/SubAttendanceUpdateResponse.java | 2 +- .../service/AttendanceServiceImpl.java | 10 +++--- .../dto/request/AttendanceRequest.java | 2 +- .../lecture/dto/request/LectureRequest.java | 2 +- .../dto/response/AttendanceResponse.java | 2 +- .../dto/response/AttendancesStatusVO.java | 2 +- .../dto/response/LectureDetailResponse.java | 2 +- .../lecture/dto/response/LectureResponse.java | 2 +- .../dto/response/LecturesResponse.java | 2 +- .../lecture/service/LectureServiceImpl.java | 14 ++++---- .../dto/response/AttendanceTotalCountVO.java | 2 +- .../dto/response/AttendanceTotalVO.java | 2 +- .../dto/response/MemberListGetResponse.java | 2 +- .../member/dto/response/MembersResponse.java | 2 +- .../web/member/service/MemberServiceImpl.java | 10 +++--- .../operation/code/failure/FailureCode.java | 8 +++++ .../operation/code/success/SuccessCode.java | 8 +++++ .../success/app/AttendanceSuccessCode.java | 18 ++++++++++ .../operation/dto}/AlarmSenderRequest.java | 5 +-- .../exception/AdminFailureException.java | 2 +- .../operation}/exception/AlarmException.java | 2 +- .../exception/LectureException.java | 2 +- .../operation}/exception/MemberException.java | 2 +- .../exception/SubLectureException.java | 2 +- .../operation}/exception/TokenException.java | 2 +- operation-external/build.gradle | 2 +- .../operation/client/alarm/AlarmSender.java | 2 +- .../client/alarm/AlarmSenderImpl.java | 8 ++--- operation-service/build.gradle | 23 ------------ .../alarm/dto/request/AlarmSendRequest.java | 6 ---- settings.gradle | 4 +-- 67 files changed, 158 insertions(+), 174 deletions(-) rename {operation-service => operation-api}/src/main/java/org/sopt/makers/operation/app/attendance/dto/request/AttendanceRequest.java (56%) rename {operation-service => operation-api}/src/main/java/org/sopt/makers/operation/app/attendance/dto/response/AttendanceResponse.java (100%) rename {operation-service => operation-api}/src/main/java/org/sopt/makers/operation/app/attendance/dto/response/AttendancesResponse.java (100%) delete mode 100644 operation-api/src/main/java/org/sopt/makers/operation/app/attendance/message/SuccessMessage.java rename {operation-service => operation-api}/src/main/java/org/sopt/makers/operation/app/attendance/service/AttendanceServiceImpl.java (79%) rename {operation-service/src/main/java/org/sopt/makers/operation => operation-api/src/main/java/org/sopt/makers/operation/service}/app/lecture/dto/response/LectureCurrentRoundResponse.java (83%) rename {operation-service/src/main/java/org/sopt/makers/operation => operation-api/src/main/java/org/sopt/makers/operation/service}/app/lecture/dto/response/LectureResponseType.java (54%) rename {operation-service/src/main/java/org/sopt/makers/operation => operation-api/src/main/java/org/sopt/makers/operation/service}/app/lecture/dto/response/TodayLectureResponse.java (96%) rename {operation-service/src/main/java/org/sopt/makers/operation => operation-api/src/main/java/org/sopt/makers/operation/service}/app/lecture/service/LectureServiceImpl.java (94%) rename {operation-service/src/main/java/org/sopt/makers/operation => operation-api/src/main/java/org/sopt/makers/operation/service}/app/member/dto/response/AttendanceTotalResponseDTO.java (82%) rename {operation-service/src/main/java/org/sopt/makers/operation => operation-api/src/main/java/org/sopt/makers/operation/service}/app/member/dto/response/AttendanceTotalVO.java (93%) rename {operation-service/src/main/java/org/sopt/makers/operation => operation-api/src/main/java/org/sopt/makers/operation/service}/app/member/dto/response/MemberScoreGetResponse.java (71%) rename {operation-service/src/main/java/org/sopt/makers/operation => operation-api/src/main/java/org/sopt/makers/operation/service}/app/member/service/MemberServiceImpl.java (89%) rename {operation-service/src/main/java/org/sopt/makers/operation => operation-api/src/main/java/org/sopt/makers/operation/service}/app/schedule/dto/response/SchedulesResponseDTO.java (96%) rename {operation-service/src/main/java/org/sopt/makers/operation => operation-api/src/main/java/org/sopt/makers/operation/service}/app/schedule/service/ScheduleServiceImpl.java (94%) rename {operation-service/src/main/java/org/sopt/makers/operation/common => operation-api/src/main/java/org/sopt/makers/operation/service}/service/LectureServiceImpl.java (97%) rename {operation-service/src/main/java/org/sopt/makers/operation => operation-api/src/main/java/org/sopt/makers/operation/service}/web/admin/dto/request/LoginRequest.java (51%) rename {operation-service/src/main/java/org/sopt/makers/operation => operation-api/src/main/java/org/sopt/makers/operation/service}/web/admin/dto/request/SignUpRequest.java (84%) rename {operation-service/src/main/java/org/sopt/makers/operation => operation-api/src/main/java/org/sopt/makers/operation/service}/web/admin/dto/response/LoginResponse.java (94%) rename {operation-service/src/main/java/org/sopt/makers/operation => operation-api/src/main/java/org/sopt/makers/operation/service}/web/admin/dto/response/RefreshResponse.java (81%) rename {operation-service/src/main/java/org/sopt/makers/operation => operation-api/src/main/java/org/sopt/makers/operation/service}/web/admin/dto/response/SignUpResponse.java (88%) rename {operation-service/src/main/java/org/sopt/makers/operation => operation-api/src/main/java/org/sopt/makers/operation/service}/web/admin/repository/AdminRepository.java (84%) rename {operation-service/src/main/java/org/sopt/makers/operation => operation-api/src/main/java/org/sopt/makers/operation/service}/web/admin/service/AdminServiceImpl.java (87%) create mode 100644 operation-api/src/main/java/org/sopt/makers/operation/service/web/alarm/dto/request/AlarmSendRequest.java rename {operation-service/src/main/java/org/sopt/makers/operation => operation-api/src/main/java/org/sopt/makers/operation/service}/web/alarm/dto/response/AlarmInactiveListResponse.java (59%) rename {operation-service/src/main/java/org/sopt/makers/operation => operation-api/src/main/java/org/sopt/makers/operation/service}/web/alarm/dto/response/AlarmResponse.java (91%) rename {operation-service/src/main/java/org/sopt/makers/operation => operation-api/src/main/java/org/sopt/makers/operation/service}/web/alarm/dto/response/AlarmsResponse.java (93%) rename {operation-service/src/main/java/org/sopt/makers/operation => operation-api/src/main/java/org/sopt/makers/operation/service}/web/alarm/service/AlarmServiceImpl.java (92%) rename {operation-service/src/main/java/org/sopt/makers/operation => operation-api/src/main/java/org/sopt/makers/operation/service}/web/attendance/dto/request/SubAttendanceUpdateRequest.java (68%) rename {operation-service/src/main/java/org/sopt/makers/operation => operation-api/src/main/java/org/sopt/makers/operation/service}/web/attendance/dto/response/AttendanceMemberResponse.java (94%) rename {operation-service/src/main/java/org/sopt/makers/operation => operation-api/src/main/java/org/sopt/makers/operation/service}/web/attendance/dto/response/AttendancesResponse.java (83%) rename {operation-service/src/main/java/org/sopt/makers/operation => operation-api/src/main/java/org/sopt/makers/operation/service}/web/attendance/dto/response/MemberResponse.java (94%) rename {operation-service/src/main/java/org/sopt/makers/operation => operation-api/src/main/java/org/sopt/makers/operation/service}/web/attendance/dto/response/SubAttendanceUpdateResponse.java (84%) rename {operation-service/src/main/java/org/sopt/makers/operation => operation-api/src/main/java/org/sopt/makers/operation/service}/web/attendance/service/AttendanceServiceImpl.java (86%) rename {operation-service/src/main/java/org/sopt/makers/operation => operation-api/src/main/java/org/sopt/makers/operation/service}/web/lecture/dto/request/AttendanceRequest.java (55%) rename {operation-service/src/main/java/org/sopt/makers/operation => operation-api/src/main/java/org/sopt/makers/operation/service}/web/lecture/dto/request/LectureRequest.java (92%) rename {operation-service/src/main/java/org/sopt/makers/operation => operation-api/src/main/java/org/sopt/makers/operation/service}/web/lecture/dto/response/AttendanceResponse.java (85%) rename {operation-service/src/main/java/org/sopt/makers/operation => operation-api/src/main/java/org/sopt/makers/operation/service}/web/lecture/dto/response/AttendancesStatusVO.java (93%) rename {operation-service/src/main/java/org/sopt/makers/operation => operation-api/src/main/java/org/sopt/makers/operation/service}/web/lecture/dto/response/LectureDetailResponse.java (90%) rename {operation-service/src/main/java/org/sopt/makers/operation => operation-api/src/main/java/org/sopt/makers/operation/service}/web/lecture/dto/response/LectureResponse.java (95%) rename {operation-service/src/main/java/org/sopt/makers/operation => operation-api/src/main/java/org/sopt/makers/operation/service}/web/lecture/dto/response/LecturesResponse.java (94%) rename {operation-service/src/main/java/org/sopt/makers/operation => operation-api/src/main/java/org/sopt/makers/operation/service}/web/lecture/service/LectureServiceImpl.java (91%) rename {operation-service/src/main/java/org/sopt/makers/operation => operation-api/src/main/java/org/sopt/makers/operation/service}/web/member/dto/response/AttendanceTotalCountVO.java (82%) rename {operation-service/src/main/java/org/sopt/makers/operation => operation-api/src/main/java/org/sopt/makers/operation/service}/web/member/dto/response/AttendanceTotalVO.java (92%) rename {operation-service/src/main/java/org/sopt/makers/operation => operation-api/src/main/java/org/sopt/makers/operation/service}/web/member/dto/response/MemberListGetResponse.java (88%) rename {operation-service/src/main/java/org/sopt/makers/operation => operation-api/src/main/java/org/sopt/makers/operation/service}/web/member/dto/response/MembersResponse.java (79%) rename {operation-service/src/main/java/org/sopt/makers/operation => operation-api/src/main/java/org/sopt/makers/operation/service}/web/member/service/MemberServiceImpl.java (87%) create mode 100644 operation-common/src/main/java/org/sopt/makers/operation/code/failure/FailureCode.java create mode 100644 operation-common/src/main/java/org/sopt/makers/operation/code/success/SuccessCode.java create mode 100644 operation-common/src/main/java/org/sopt/makers/operation/code/success/app/AttendanceSuccessCode.java rename {operation-service/src/main/java/org/sopt/makers/operation/web/alarm/dto/request => operation-common/src/main/java/org/sopt/makers/operation/dto}/AlarmSenderRequest.java (75%) rename {operation-service/src/main/java/org/sopt/makers/operation/common => operation-common/src/main/java/org/sopt/makers/operation}/exception/AdminFailureException.java (77%) rename {operation-service/src/main/java/org/sopt/makers/operation/common => operation-common/src/main/java/org/sopt/makers/operation}/exception/AlarmException.java (75%) rename {operation-service/src/main/java/org/sopt/makers/operation/common => operation-common/src/main/java/org/sopt/makers/operation}/exception/LectureException.java (75%) rename {operation-service/src/main/java/org/sopt/makers/operation/common => operation-common/src/main/java/org/sopt/makers/operation}/exception/MemberException.java (75%) rename {operation-service/src/main/java/org/sopt/makers/operation/common => operation-common/src/main/java/org/sopt/makers/operation}/exception/SubLectureException.java (76%) rename {operation-service/src/main/java/org/sopt/makers/operation/common => operation-common/src/main/java/org/sopt/makers/operation}/exception/TokenException.java (74%) delete mode 100644 operation-service/build.gradle delete mode 100644 operation-service/src/main/java/org/sopt/makers/operation/web/alarm/dto/request/AlarmSendRequest.java diff --git a/operation-api/build.gradle b/operation-api/build.gradle index f2b7bd49..6e2830bd 100644 --- a/operation-api/build.gradle +++ b/operation-api/build.gradle @@ -7,9 +7,9 @@ tasks.named('jar') { } dependencies { - implementation project(path: ':operation-service') implementation project(path: ':operation-domain') implementation project(path: ':operation-auth') + implementation project(path: ':operation-common') implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.0.2' diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/api/AttendanceApiController.java b/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/api/AttendanceApiController.java index 19f0c71b..f533cc03 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/api/AttendanceApiController.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/api/AttendanceApiController.java @@ -1,6 +1,6 @@ package org.sopt.makers.operation.app.attendance.api; -import static org.sopt.makers.operation.app.attendance.message.SuccessMessage.*; +import static org.sopt.makers.operation.code.success.app.AttendanceSuccessCode.*; import java.security.Principal; @@ -23,6 +23,7 @@ @RequiredArgsConstructor @RequestMapping("/api/v1/app/attendances") public class AttendanceApiController implements AttendanceApi { + private final AttendanceService attendanceService; private final CommonUtils utils; @@ -31,6 +32,6 @@ public class AttendanceApiController implements AttendanceApi { public ResponseEntity> attend(@RequestBody AttendanceRequest request, @NonNull Principal principal) { val memberId = utils.getMemberId(principal); val response = attendanceService.attend(memberId, request); - return ApiResponseUtil.ok(SUCCESS_GET_ATTENDANCE.getContent(), response); + return ApiResponseUtil.success(SUCCESS_GET_ATTENDANCE, response); } } diff --git a/operation-service/src/main/java/org/sopt/makers/operation/app/attendance/dto/request/AttendanceRequest.java b/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/dto/request/AttendanceRequest.java similarity index 56% rename from operation-service/src/main/java/org/sopt/makers/operation/app/attendance/dto/request/AttendanceRequest.java rename to operation-api/src/main/java/org/sopt/makers/operation/app/attendance/dto/request/AttendanceRequest.java index 15060be0..04df0c1c 100644 --- a/operation-service/src/main/java/org/sopt/makers/operation/app/attendance/dto/request/AttendanceRequest.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/dto/request/AttendanceRequest.java @@ -1,7 +1,9 @@ package org.sopt.makers.operation.app.attendance.dto.request; +import lombok.NonNull; + public record AttendanceRequest( - Long subLectureId, - String code + long subLectureId, + @NonNull String code ) { } diff --git a/operation-service/src/main/java/org/sopt/makers/operation/app/attendance/dto/response/AttendanceResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/dto/response/AttendanceResponse.java similarity index 100% rename from operation-service/src/main/java/org/sopt/makers/operation/app/attendance/dto/response/AttendanceResponse.java rename to operation-api/src/main/java/org/sopt/makers/operation/app/attendance/dto/response/AttendanceResponse.java diff --git a/operation-service/src/main/java/org/sopt/makers/operation/app/attendance/dto/response/AttendancesResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/dto/response/AttendancesResponse.java similarity index 100% rename from operation-service/src/main/java/org/sopt/makers/operation/app/attendance/dto/response/AttendancesResponse.java rename to operation-api/src/main/java/org/sopt/makers/operation/app/attendance/dto/response/AttendancesResponse.java diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/message/SuccessMessage.java b/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/message/SuccessMessage.java deleted file mode 100644 index 16cadea6..00000000 --- a/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/message/SuccessMessage.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.sopt.makers.operation.app.attendance.message; - -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -@Getter -@RequiredArgsConstructor -public enum SuccessMessage { - SUCCESS_GET_ATTENDANCE("출석 성공"), - ; - - private final String content; -} diff --git a/operation-service/src/main/java/org/sopt/makers/operation/app/attendance/service/AttendanceServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/service/AttendanceServiceImpl.java similarity index 79% rename from operation-service/src/main/java/org/sopt/makers/operation/app/attendance/service/AttendanceServiceImpl.java rename to operation-api/src/main/java/org/sopt/makers/operation/app/attendance/service/AttendanceServiceImpl.java index 17c80098..657101aa 100644 --- a/operation-service/src/main/java/org/sopt/makers/operation/app/attendance/service/AttendanceServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/service/AttendanceServiceImpl.java @@ -1,24 +1,13 @@ package org.sopt.makers.operation.app.attendance.service; -import static org.operation.attendance.domain.AttendanceStatus.*; -import static org.operation.attendance.message.ErrorMessage.*; -import static org.operation.lecture.message.ErrorMessage.*; -import static org.operation.member.message.ErrorMessage.*; +import static org.sopt.makers.operation.domain.attendance.domain.AttendanceStatus.*; import org.sopt.makers.operation.app.attendance.dto.request.AttendanceRequest; import org.sopt.makers.operation.app.attendance.dto.response.AttendanceResponse; -import org.operation.attendance.domain.Attendance; -import org.operation.attendance.domain.SubAttendance; -import org.operation.attendance.repository.attendance.AttendanceRepository; -import org.sopt.makers.operation.common.config.ValueConfig; -import org.sopt.makers.operation.common.exception.LectureException; -import org.sopt.makers.operation.common.exception.MemberException; -import org.sopt.makers.operation.common.exception.SubLectureException; -import org.operation.lecture.Lecture; -import org.operation.lecture.SubLecture; -import org.operation.lecture.repository.subLecture.SubLectureRepository; -import org.operation.member.domain.Member; -import org.operation.member.repository.MemberRepository; +import org.sopt.makers.operation.config.ValueConfig; +import org.sopt.makers.operation.domain.attendance.repository.attendance.AttendanceRepository; +import org.sopt.makers.operation.domain.lecture.repository.subLecture.SubLectureRepository; +import org.sopt.makers.operation.domain.member.repository.MemberRepository; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/common/dto/BaseResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/common/dto/BaseResponse.java index 1ba03a2e..4fc57453 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/common/dto/BaseResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/common/dto/BaseResponse.java @@ -23,7 +23,7 @@ public static BaseResponse of(String message, T data) { .build(); } - public static BaseResponse of(String message, boolean isSuccess) { + public static BaseResponse of(boolean isSuccess, String message) { return BaseResponse.builder() .success(isSuccess) .message(message) diff --git a/operation-api/src/main/java/org/sopt/makers/operation/common/util/ApiResponseUtil.java b/operation-api/src/main/java/org/sopt/makers/operation/common/util/ApiResponseUtil.java index 635c34d0..6d140ca7 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/common/util/ApiResponseUtil.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/common/util/ApiResponseUtil.java @@ -1,36 +1,35 @@ package org.sopt.makers.operation.common.util; -import java.net.URI; - +import org.sopt.makers.operation.code.failure.FailureCode; +import org.sopt.makers.operation.code.success.SuccessCode; import org.sopt.makers.operation.common.dto.BaseResponse; import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; public interface ApiResponseUtil { - static ResponseEntity> ok(String message, T data) { - return ResponseEntity.ok(BaseResponse.of(message, data)); + static ResponseEntity> success(SuccessCode code, T data) { + return ResponseEntity + .status(code.getStatus()) + .body(BaseResponse.of(code.getMessage(), data)); } - static ResponseEntity> ok(String message) { - return ResponseEntity.ok(BaseResponse.of(message, true)); + static ResponseEntity> success(SuccessCode code) { + return ResponseEntity + .status(code.getStatus()) + .body(BaseResponse.of(true, code.getMessage())); } - static ResponseEntity> ok(HttpHeaders headers, String message, T data) { - return ResponseEntity.status(HttpStatus.OK) + static ResponseEntity> success(SuccessCode code, HttpHeaders headers, T data) { + return ResponseEntity + .status(code.getStatus()) .headers(headers) - .body(BaseResponse.of(message, data)); + .body(BaseResponse.of(code.getMessage(), data)); } - static ResponseEntity> created(URI uri, String message, T data) { + static ResponseEntity> failure(FailureCode code) { return ResponseEntity - .created(uri) - .body(BaseResponse.of(message, data)); - } - - static ResponseEntity> failure(HttpStatus status, String message) { - return ResponseEntity.status(status) - .body(BaseResponse.of(message, false)); + .status(code.getStatus()) + .body(BaseResponse.of(false, code.getMessage())); } } diff --git a/operation-service/src/main/java/org/sopt/makers/operation/app/lecture/dto/response/LectureCurrentRoundResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/service/app/lecture/dto/response/LectureCurrentRoundResponse.java similarity index 83% rename from operation-service/src/main/java/org/sopt/makers/operation/app/lecture/dto/response/LectureCurrentRoundResponse.java rename to operation-api/src/main/java/org/sopt/makers/operation/service/app/lecture/dto/response/LectureCurrentRoundResponse.java index 798fc4cf..34cdeb1f 100644 --- a/operation-service/src/main/java/org/sopt/makers/operation/app/lecture/dto/response/LectureCurrentRoundResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/service/app/lecture/dto/response/LectureCurrentRoundResponse.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.app.lecture.dto.response; +package org.sopt.makers.operation.service.app.lecture.dto.response; import org.operation.lecture.SubLecture; diff --git a/operation-service/src/main/java/org/sopt/makers/operation/app/lecture/dto/response/LectureResponseType.java b/operation-api/src/main/java/org/sopt/makers/operation/service/app/lecture/dto/response/LectureResponseType.java similarity index 54% rename from operation-service/src/main/java/org/sopt/makers/operation/app/lecture/dto/response/LectureResponseType.java rename to operation-api/src/main/java/org/sopt/makers/operation/service/app/lecture/dto/response/LectureResponseType.java index ac9e5c3b..f3f81bd2 100644 --- a/operation-service/src/main/java/org/sopt/makers/operation/app/lecture/dto/response/LectureResponseType.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/service/app/lecture/dto/response/LectureResponseType.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.app.lecture.dto.response; +package org.sopt.makers.operation.service.app.lecture.dto.response; public enum LectureResponseType { NO_SESSION, HAS_ATTENDANCE, NO_ATTENDANCE diff --git a/operation-service/src/main/java/org/sopt/makers/operation/app/lecture/dto/response/TodayLectureResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/service/app/lecture/dto/response/TodayLectureResponse.java similarity index 96% rename from operation-service/src/main/java/org/sopt/makers/operation/app/lecture/dto/response/TodayLectureResponse.java rename to operation-api/src/main/java/org/sopt/makers/operation/service/app/lecture/dto/response/TodayLectureResponse.java index e70c146e..03e08a60 100644 --- a/operation-service/src/main/java/org/sopt/makers/operation/app/lecture/dto/response/TodayLectureResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/service/app/lecture/dto/response/TodayLectureResponse.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.app.lecture.dto.response; +package org.sopt.makers.operation.service.app.lecture.dto.response; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; diff --git a/operation-service/src/main/java/org/sopt/makers/operation/app/lecture/service/LectureServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/service/app/lecture/service/LectureServiceImpl.java similarity index 94% rename from operation-service/src/main/java/org/sopt/makers/operation/app/lecture/service/LectureServiceImpl.java rename to operation-api/src/main/java/org/sopt/makers/operation/service/app/lecture/service/LectureServiceImpl.java index d0e0d9b2..5d2355d1 100644 --- a/operation-service/src/main/java/org/sopt/makers/operation/app/lecture/service/LectureServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/service/app/lecture/service/LectureServiceImpl.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.app.lecture.service; +package org.sopt.makers.operation.service.app.lecture.service; import static org.operation.attendance.domain.AttendanceStatus.*; import static org.operation.lecture.LectureStatus.*; @@ -10,9 +10,9 @@ import java.util.Collections; import java.util.List; -import org.sopt.makers.operation.app.lecture.dto.response.LectureCurrentRoundResponse; -import org.sopt.makers.operation.app.lecture.dto.response.LectureResponseType; -import org.sopt.makers.operation.app.lecture.dto.response.TodayLectureResponse; +import org.sopt.makers.operation.service.app.lecture.dto.response.LectureCurrentRoundResponse; +import org.sopt.makers.operation.service.app.lecture.dto.response.LectureResponseType; +import org.sopt.makers.operation.service.app.lecture.dto.response.TodayLectureResponse; import org.operation.attendance.domain.Attendance; import org.operation.attendance.domain.SubAttendance; import org.operation.attendance.repository.attendance.AttendanceRepository; diff --git a/operation-service/src/main/java/org/sopt/makers/operation/app/member/dto/response/AttendanceTotalResponseDTO.java b/operation-api/src/main/java/org/sopt/makers/operation/service/app/member/dto/response/AttendanceTotalResponseDTO.java similarity index 82% rename from operation-service/src/main/java/org/sopt/makers/operation/app/member/dto/response/AttendanceTotalResponseDTO.java rename to operation-api/src/main/java/org/sopt/makers/operation/service/app/member/dto/response/AttendanceTotalResponseDTO.java index 2c4bbd80..a35eaf2c 100644 --- a/operation-service/src/main/java/org/sopt/makers/operation/app/member/dto/response/AttendanceTotalResponseDTO.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/service/app/member/dto/response/AttendanceTotalResponseDTO.java @@ -1,10 +1,10 @@ -package org.sopt.makers.operation.app.member.dto.response; +package org.sopt.makers.operation.service.app.member.dto.response; import java.util.List; import org.sopt.makers.operation.domain.Part; import org.operation.member.domain.Member; -import org.sopt.makers.operation.web.member.dto.response.AttendanceTotalCountVO; +import org.sopt.makers.operation.service.web.member.dto.response.AttendanceTotalCountVO; public record AttendanceTotalResponseDTO( Part part, diff --git a/operation-service/src/main/java/org/sopt/makers/operation/app/member/dto/response/AttendanceTotalVO.java b/operation-api/src/main/java/org/sopt/makers/operation/service/app/member/dto/response/AttendanceTotalVO.java similarity index 93% rename from operation-service/src/main/java/org/sopt/makers/operation/app/member/dto/response/AttendanceTotalVO.java rename to operation-api/src/main/java/org/sopt/makers/operation/service/app/member/dto/response/AttendanceTotalVO.java index 5e420e26..1eb7ae95 100644 --- a/operation-service/src/main/java/org/sopt/makers/operation/app/member/dto/response/AttendanceTotalVO.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/service/app/member/dto/response/AttendanceTotalVO.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.app.member.dto.response; +package org.sopt.makers.operation.service.app.member.dto.response; import java.time.format.DateTimeFormatter; diff --git a/operation-service/src/main/java/org/sopt/makers/operation/app/member/dto/response/MemberScoreGetResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/service/app/member/dto/response/MemberScoreGetResponse.java similarity index 71% rename from operation-service/src/main/java/org/sopt/makers/operation/app/member/dto/response/MemberScoreGetResponse.java rename to operation-api/src/main/java/org/sopt/makers/operation/service/app/member/dto/response/MemberScoreGetResponse.java index c15151bc..ccef19ae 100644 --- a/operation-service/src/main/java/org/sopt/makers/operation/app/member/dto/response/MemberScoreGetResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/service/app/member/dto/response/MemberScoreGetResponse.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.app.member.dto.response; +package org.sopt.makers.operation.service.app.member.dto.response; public record MemberScoreGetResponse( float score diff --git a/operation-service/src/main/java/org/sopt/makers/operation/app/member/service/MemberServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/service/app/member/service/MemberServiceImpl.java similarity index 89% rename from operation-service/src/main/java/org/sopt/makers/operation/app/member/service/MemberServiceImpl.java rename to operation-api/src/main/java/org/sopt/makers/operation/service/app/member/service/MemberServiceImpl.java index 83072049..5b83191e 100644 --- a/operation-service/src/main/java/org/sopt/makers/operation/app/member/service/MemberServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/service/app/member/service/MemberServiceImpl.java @@ -1,13 +1,13 @@ -package org.sopt.makers.operation.app.member.service; +package org.sopt.makers.operation.service.app.member.service; import static org.operation.member.message.ErrorMessage.*; import java.util.EnumMap; import java.util.List; -import org.sopt.makers.operation.app.member.dto.response.AttendanceTotalResponseDTO; -import org.sopt.makers.operation.app.member.dto.response.AttendanceTotalVO; -import org.sopt.makers.operation.app.member.dto.response.MemberScoreGetResponse; +import org.sopt.makers.operation.service.app.member.dto.response.AttendanceTotalResponseDTO; +import org.sopt.makers.operation.service.app.member.dto.response.AttendanceTotalVO; +import org.sopt.makers.operation.service.app.member.dto.response.MemberScoreGetResponse; import org.operation.attendance.domain.AttendanceStatus; import org.operation.attendance.repository.attendance.AttendanceRepository; import org.sopt.makers.operation.common.config.ValueConfig; @@ -15,7 +15,7 @@ import org.operation.lecture.Attribute; import org.operation.member.domain.Member; import org.operation.member.repository.MemberRepository; -import org.sopt.makers.operation.web.member.dto.response.AttendanceTotalCountVO; +import org.sopt.makers.operation.service.web.member.dto.response.AttendanceTotalCountVO; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; diff --git a/operation-service/src/main/java/org/sopt/makers/operation/app/schedule/dto/response/SchedulesResponseDTO.java b/operation-api/src/main/java/org/sopt/makers/operation/service/app/schedule/dto/response/SchedulesResponseDTO.java similarity index 96% rename from operation-service/src/main/java/org/sopt/makers/operation/app/schedule/dto/response/SchedulesResponseDTO.java rename to operation-api/src/main/java/org/sopt/makers/operation/service/app/schedule/dto/response/SchedulesResponseDTO.java index 706f7cbe..f6c77d4a 100644 --- a/operation-service/src/main/java/org/sopt/makers/operation/app/schedule/dto/response/SchedulesResponseDTO.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/service/app/schedule/dto/response/SchedulesResponseDTO.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.app.schedule.dto.response; +package org.sopt.makers.operation.service.app.schedule.dto.response; import java.time.LocalDate; import java.time.format.TextStyle; diff --git a/operation-service/src/main/java/org/sopt/makers/operation/app/schedule/service/ScheduleServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/service/app/schedule/service/ScheduleServiceImpl.java similarity index 94% rename from operation-service/src/main/java/org/sopt/makers/operation/app/schedule/service/ScheduleServiceImpl.java rename to operation-api/src/main/java/org/sopt/makers/operation/service/app/schedule/service/ScheduleServiceImpl.java index 85fa45b9..8cf7e139 100644 --- a/operation-service/src/main/java/org/sopt/makers/operation/app/schedule/service/ScheduleServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/service/app/schedule/service/ScheduleServiceImpl.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.app.schedule.service; +package org.sopt.makers.operation.service.app.schedule.service; import java.time.Duration; import java.time.LocalDate; @@ -10,7 +10,7 @@ import java.util.stream.Collectors; import java.util.stream.LongStream; -import org.sopt.makers.operation.app.schedule.dto.response.SchedulesResponseDTO; +import org.sopt.makers.operation.service.app.schedule.dto.response.SchedulesResponseDTO; import org.operation.schedule.domain.Schedule; import org.operation.schedule.repository.ScheduleRepository; import org.springframework.stereotype.Service; diff --git a/operation-service/src/main/java/org/sopt/makers/operation/common/service/LectureServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/service/service/LectureServiceImpl.java similarity index 97% rename from operation-service/src/main/java/org/sopt/makers/operation/common/service/LectureServiceImpl.java rename to operation-api/src/main/java/org/sopt/makers/operation/service/service/LectureServiceImpl.java index b94401f8..56a77fbe 100644 --- a/operation-service/src/main/java/org/sopt/makers/operation/common/service/LectureServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/service/service/LectureServiceImpl.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.common.service; +package org.sopt.makers.operation.service.service; import static org.operation.alarm.domain.Attribute.*; import static org.operation.lecture.message.ErrorMessage.*; diff --git a/operation-service/src/main/java/org/sopt/makers/operation/web/admin/dto/request/LoginRequest.java b/operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/dto/request/LoginRequest.java similarity index 51% rename from operation-service/src/main/java/org/sopt/makers/operation/web/admin/dto/request/LoginRequest.java rename to operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/dto/request/LoginRequest.java index d612c34f..1cce0ddc 100644 --- a/operation-service/src/main/java/org/sopt/makers/operation/web/admin/dto/request/LoginRequest.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/dto/request/LoginRequest.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.web.admin.dto.request; +package org.sopt.makers.operation.service.web.admin.dto.request; public record LoginRequest( String email, diff --git a/operation-service/src/main/java/org/sopt/makers/operation/web/admin/dto/request/SignUpRequest.java b/operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/dto/request/SignUpRequest.java similarity index 84% rename from operation-service/src/main/java/org/sopt/makers/operation/web/admin/dto/request/SignUpRequest.java rename to operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/dto/request/SignUpRequest.java index 59956aa0..255eab06 100644 --- a/operation-service/src/main/java/org/sopt/makers/operation/web/admin/dto/request/SignUpRequest.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/dto/request/SignUpRequest.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.web.admin.dto.request; +package org.sopt.makers.operation.service.web.admin.dto.request; import org.operation.admin.domain.Admin; import org.operation.admin.domain.Role; diff --git a/operation-service/src/main/java/org/sopt/makers/operation/web/admin/dto/response/LoginResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/dto/response/LoginResponse.java similarity index 94% rename from operation-service/src/main/java/org/sopt/makers/operation/web/admin/dto/response/LoginResponse.java rename to operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/dto/response/LoginResponse.java index 8356c3c2..7e802ee9 100644 --- a/operation-service/src/main/java/org/sopt/makers/operation/web/admin/dto/response/LoginResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/dto/response/LoginResponse.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.web.admin.dto.response; +package org.sopt.makers.operation.service.web.admin.dto.response; import lombok.AccessLevel; import lombok.Builder; diff --git a/operation-service/src/main/java/org/sopt/makers/operation/web/admin/dto/response/RefreshResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/dto/response/RefreshResponse.java similarity index 81% rename from operation-service/src/main/java/org/sopt/makers/operation/web/admin/dto/response/RefreshResponse.java rename to operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/dto/response/RefreshResponse.java index 22187e23..9d521e51 100644 --- a/operation-service/src/main/java/org/sopt/makers/operation/web/admin/dto/response/RefreshResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/dto/response/RefreshResponse.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.web.admin.dto.response; +package org.sopt.makers.operation.service.web.admin.dto.response; import org.operation.admin.domain.Admin; diff --git a/operation-service/src/main/java/org/sopt/makers/operation/web/admin/dto/response/SignUpResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/dto/response/SignUpResponse.java similarity index 88% rename from operation-service/src/main/java/org/sopt/makers/operation/web/admin/dto/response/SignUpResponse.java rename to operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/dto/response/SignUpResponse.java index 1baf0fe8..628e13db 100644 --- a/operation-service/src/main/java/org/sopt/makers/operation/web/admin/dto/response/SignUpResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/dto/response/SignUpResponse.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.web.admin.dto.response; +package org.sopt.makers.operation.service.web.admin.dto.response; import org.operation.admin.domain.Admin; import org.operation.admin.domain.Role; diff --git a/operation-service/src/main/java/org/sopt/makers/operation/web/admin/repository/AdminRepository.java b/operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/repository/AdminRepository.java similarity index 84% rename from operation-service/src/main/java/org/sopt/makers/operation/web/admin/repository/AdminRepository.java rename to operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/repository/AdminRepository.java index ac255bc5..d1680a2d 100644 --- a/operation-service/src/main/java/org/sopt/makers/operation/web/admin/repository/AdminRepository.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/repository/AdminRepository.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.web.admin.repository; +package org.sopt.makers.operation.service.web.admin.repository; import java.util.Optional; diff --git a/operation-service/src/main/java/org/sopt/makers/operation/web/admin/service/AdminServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/service/AdminServiceImpl.java similarity index 87% rename from operation-service/src/main/java/org/sopt/makers/operation/web/admin/service/AdminServiceImpl.java rename to operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/service/AdminServiceImpl.java index f80ccdfa..76e65ff2 100644 --- a/operation-service/src/main/java/org/sopt/makers/operation/web/admin/service/AdminServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/service/AdminServiceImpl.java @@ -1,15 +1,15 @@ -package org.sopt.makers.operation.web.admin.service; +package org.sopt.makers.operation.service.web.admin.service; import org.operation.admin.domain.Admin; import org.operation.security.AdminAuthentication; import org.operation.security.jwt.JwtTokenProvider; -import org.sopt.makers.operation.web.admin.dto.request.LoginRequest; -import org.sopt.makers.operation.web.admin.dto.request.SignUpRequest; -import org.sopt.makers.operation.web.admin.dto.response.LoginResponse; -import org.sopt.makers.operation.web.admin.dto.response.RefreshResponse; -import org.sopt.makers.operation.web.admin.dto.response.SignUpResponse; +import org.sopt.makers.operation.service.web.admin.dto.request.SignUpRequest; +import org.sopt.makers.operation.service.web.admin.dto.response.SignUpResponse; +import org.sopt.makers.operation.service.web.admin.dto.request.LoginRequest; +import org.sopt.makers.operation.service.web.admin.dto.response.LoginResponse; +import org.sopt.makers.operation.service.web.admin.dto.response.RefreshResponse; import org.sopt.makers.operation.common.exception.AdminFailureException; -import org.sopt.makers.operation.web.admin.repository.AdminRepository; +import org.sopt.makers.operation.service.web.admin.repository.AdminRepository; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/web/alarm/dto/request/AlarmSendRequest.java b/operation-api/src/main/java/org/sopt/makers/operation/service/web/alarm/dto/request/AlarmSendRequest.java new file mode 100644 index 00000000..60507102 --- /dev/null +++ b/operation-api/src/main/java/org/sopt/makers/operation/service/web/alarm/dto/request/AlarmSendRequest.java @@ -0,0 +1,6 @@ +package org.sopt.makers.operation.service.web.alarm.dto.request; + +public record AlarmSendRequest( + long alarmId +) { +} diff --git a/operation-service/src/main/java/org/sopt/makers/operation/web/alarm/dto/response/AlarmInactiveListResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/service/web/alarm/dto/response/AlarmInactiveListResponse.java similarity index 59% rename from operation-service/src/main/java/org/sopt/makers/operation/web/alarm/dto/response/AlarmInactiveListResponse.java rename to operation-api/src/main/java/org/sopt/makers/operation/service/web/alarm/dto/response/AlarmInactiveListResponse.java index da930125..6731ebba 100644 --- a/operation-service/src/main/java/org/sopt/makers/operation/web/alarm/dto/response/AlarmInactiveListResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/service/web/alarm/dto/response/AlarmInactiveListResponse.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.web.alarm.dto.response; +package org.sopt.makers.operation.service.web.alarm.dto.response; import java.util.List; diff --git a/operation-service/src/main/java/org/sopt/makers/operation/web/alarm/dto/response/AlarmResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/service/web/alarm/dto/response/AlarmResponse.java similarity index 91% rename from operation-service/src/main/java/org/sopt/makers/operation/web/alarm/dto/response/AlarmResponse.java rename to operation-api/src/main/java/org/sopt/makers/operation/service/web/alarm/dto/response/AlarmResponse.java index 24ada7f4..2dfc63ec 100644 --- a/operation-service/src/main/java/org/sopt/makers/operation/web/alarm/dto/response/AlarmResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/service/web/alarm/dto/response/AlarmResponse.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.web.alarm.dto.response; +package org.sopt.makers.operation.service.web.alarm.dto.response; import static java.util.Objects.*; diff --git a/operation-service/src/main/java/org/sopt/makers/operation/web/alarm/dto/response/AlarmsResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/service/web/alarm/dto/response/AlarmsResponse.java similarity index 93% rename from operation-service/src/main/java/org/sopt/makers/operation/web/alarm/dto/response/AlarmsResponse.java rename to operation-api/src/main/java/org/sopt/makers/operation/service/web/alarm/dto/response/AlarmsResponse.java index 84a40166..01e49edb 100644 --- a/operation-service/src/main/java/org/sopt/makers/operation/web/alarm/dto/response/AlarmsResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/service/web/alarm/dto/response/AlarmsResponse.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.web.alarm.dto.response; +package org.sopt.makers.operation.service.web.alarm.dto.response; import static java.util.Objects.*; diff --git a/operation-service/src/main/java/org/sopt/makers/operation/web/alarm/service/AlarmServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/service/web/alarm/service/AlarmServiceImpl.java similarity index 92% rename from operation-service/src/main/java/org/sopt/makers/operation/web/alarm/service/AlarmServiceImpl.java rename to operation-api/src/main/java/org/sopt/makers/operation/service/web/alarm/service/AlarmServiceImpl.java index be596058..9417ea8f 100644 --- a/operation-service/src/main/java/org/sopt/makers/operation/web/alarm/service/AlarmServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/service/web/alarm/service/AlarmServiceImpl.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.web.alarm.service; +package org.sopt.makers.operation.service.web.alarm.service; import static java.util.Objects.*; import static org.operation.alarm.domain.Status.*; @@ -17,10 +17,10 @@ import org.sopt.makers.operation.common.exception.AlarmException; import org.operation.member.repository.MemberRepository; import org.sopt.makers.operation.dto.AlarmRequest; -import org.sopt.makers.operation.web.alarm.dto.request.AlarmSendRequest; +import org.sopt.makers.operation.service.web.alarm.dto.request.AlarmSendRequest; +import org.sopt.makers.operation.service.web.alarm.dto.response.AlarmResponse; +import org.sopt.makers.operation.service.web.alarm.dto.response.AlarmsResponse; import org.sopt.makers.operation.web.alarm.dto.request.AlarmSenderRequest; -import org.sopt.makers.operation.web.alarm.dto.response.AlarmResponse; -import org.sopt.makers.operation.web.alarm.dto.response.AlarmsResponse; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; diff --git a/operation-service/src/main/java/org/sopt/makers/operation/web/attendance/dto/request/SubAttendanceUpdateRequest.java b/operation-api/src/main/java/org/sopt/makers/operation/service/web/attendance/dto/request/SubAttendanceUpdateRequest.java similarity index 68% rename from operation-service/src/main/java/org/sopt/makers/operation/web/attendance/dto/request/SubAttendanceUpdateRequest.java rename to operation-api/src/main/java/org/sopt/makers/operation/service/web/attendance/dto/request/SubAttendanceUpdateRequest.java index 1b71fb81..0cadb355 100644 --- a/operation-service/src/main/java/org/sopt/makers/operation/web/attendance/dto/request/SubAttendanceUpdateRequest.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/service/web/attendance/dto/request/SubAttendanceUpdateRequest.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.web.attendance.dto.request; +package org.sopt.makers.operation.service.web.attendance.dto.request; import org.operation.attendance.domain.AttendanceStatus; diff --git a/operation-service/src/main/java/org/sopt/makers/operation/web/attendance/dto/response/AttendanceMemberResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/service/web/attendance/dto/response/AttendanceMemberResponse.java similarity index 94% rename from operation-service/src/main/java/org/sopt/makers/operation/web/attendance/dto/response/AttendanceMemberResponse.java rename to operation-api/src/main/java/org/sopt/makers/operation/service/web/attendance/dto/response/AttendanceMemberResponse.java index d946ee83..13f365b6 100644 --- a/operation-service/src/main/java/org/sopt/makers/operation/web/attendance/dto/response/AttendanceMemberResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/service/web/attendance/dto/response/AttendanceMemberResponse.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.web.attendance.dto.response; +package org.sopt.makers.operation.service.web.attendance.dto.response; import java.util.List; diff --git a/operation-service/src/main/java/org/sopt/makers/operation/web/attendance/dto/response/AttendancesResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/service/web/attendance/dto/response/AttendancesResponse.java similarity index 83% rename from operation-service/src/main/java/org/sopt/makers/operation/web/attendance/dto/response/AttendancesResponse.java rename to operation-api/src/main/java/org/sopt/makers/operation/service/web/attendance/dto/response/AttendancesResponse.java index a5dfe1b2..d5c300fe 100644 --- a/operation-service/src/main/java/org/sopt/makers/operation/web/attendance/dto/response/AttendancesResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/service/web/attendance/dto/response/AttendancesResponse.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.web.attendance.dto.response; +package org.sopt.makers.operation.service.web.attendance.dto.response; import java.util.List; diff --git a/operation-service/src/main/java/org/sopt/makers/operation/web/attendance/dto/response/MemberResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/service/web/attendance/dto/response/MemberResponse.java similarity index 94% rename from operation-service/src/main/java/org/sopt/makers/operation/web/attendance/dto/response/MemberResponse.java rename to operation-api/src/main/java/org/sopt/makers/operation/service/web/attendance/dto/response/MemberResponse.java index 7af248ca..04ba446a 100644 --- a/operation-service/src/main/java/org/sopt/makers/operation/web/attendance/dto/response/MemberResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/service/web/attendance/dto/response/MemberResponse.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.web.attendance.dto.response; +package org.sopt.makers.operation.service.web.attendance.dto.response; import java.util.List; diff --git a/operation-service/src/main/java/org/sopt/makers/operation/web/attendance/dto/response/SubAttendanceUpdateResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/service/web/attendance/dto/response/SubAttendanceUpdateResponse.java similarity index 84% rename from operation-service/src/main/java/org/sopt/makers/operation/web/attendance/dto/response/SubAttendanceUpdateResponse.java rename to operation-api/src/main/java/org/sopt/makers/operation/service/web/attendance/dto/response/SubAttendanceUpdateResponse.java index 31db0ef2..f6fbc20c 100644 --- a/operation-service/src/main/java/org/sopt/makers/operation/web/attendance/dto/response/SubAttendanceUpdateResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/service/web/attendance/dto/response/SubAttendanceUpdateResponse.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.web.attendance.dto.response; +package org.sopt.makers.operation.service.web.attendance.dto.response; import org.operation.attendance.domain.AttendanceStatus; import org.operation.attendance.domain.SubAttendance; diff --git a/operation-service/src/main/java/org/sopt/makers/operation/web/attendance/service/AttendanceServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/service/web/attendance/service/AttendanceServiceImpl.java similarity index 86% rename from operation-service/src/main/java/org/sopt/makers/operation/web/attendance/service/AttendanceServiceImpl.java rename to operation-api/src/main/java/org/sopt/makers/operation/service/web/attendance/service/AttendanceServiceImpl.java index 89d646da..8682435a 100644 --- a/operation-service/src/main/java/org/sopt/makers/operation/web/attendance/service/AttendanceServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/service/web/attendance/service/AttendanceServiceImpl.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.web.attendance.service; +package org.sopt.makers.operation.service.web.attendance.service; import static org.operation.attendance.message.ErrorMessage.*; import static org.operation.member.message.ErrorMessage.*; @@ -11,10 +11,10 @@ import org.sopt.makers.operation.common.exception.MemberException; import org.operation.member.domain.Member; import org.operation.member.repository.MemberRepository; -import org.sopt.makers.operation.web.attendance.dto.request.SubAttendanceUpdateRequest; -import org.sopt.makers.operation.web.attendance.dto.response.AttendanceMemberResponse; -import org.sopt.makers.operation.web.attendance.dto.response.AttendancesResponse; -import org.sopt.makers.operation.web.attendance.dto.response.SubAttendanceUpdateResponse; +import org.sopt.makers.operation.service.web.attendance.dto.request.SubAttendanceUpdateRequest; +import org.sopt.makers.operation.service.web.attendance.dto.response.AttendanceMemberResponse; +import org.sopt.makers.operation.service.web.attendance.dto.response.AttendancesResponse; +import org.sopt.makers.operation.service.web.attendance.dto.response.SubAttendanceUpdateResponse; import org.sopt.makers.operation.web.attendnace.service.AttendanceService; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; diff --git a/operation-service/src/main/java/org/sopt/makers/operation/web/lecture/dto/request/AttendanceRequest.java b/operation-api/src/main/java/org/sopt/makers/operation/service/web/lecture/dto/request/AttendanceRequest.java similarity index 55% rename from operation-service/src/main/java/org/sopt/makers/operation/web/lecture/dto/request/AttendanceRequest.java rename to operation-api/src/main/java/org/sopt/makers/operation/service/web/lecture/dto/request/AttendanceRequest.java index c543b046..c75abc75 100644 --- a/operation-service/src/main/java/org/sopt/makers/operation/web/lecture/dto/request/AttendanceRequest.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/service/web/lecture/dto/request/AttendanceRequest.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.web.lecture.dto.request; +package org.sopt.makers.operation.service.web.lecture.dto.request; public record AttendanceRequest( Long lectureId, diff --git a/operation-service/src/main/java/org/sopt/makers/operation/web/lecture/dto/request/LectureRequest.java b/operation-api/src/main/java/org/sopt/makers/operation/service/web/lecture/dto/request/LectureRequest.java similarity index 92% rename from operation-service/src/main/java/org/sopt/makers/operation/web/lecture/dto/request/LectureRequest.java rename to operation-api/src/main/java/org/sopt/makers/operation/service/web/lecture/dto/request/LectureRequest.java index 545ca5e8..09ae5b16 100644 --- a/operation-service/src/main/java/org/sopt/makers/operation/web/lecture/dto/request/LectureRequest.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/service/web/lecture/dto/request/LectureRequest.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.web.lecture.dto.request; +package org.sopt.makers.operation.service.web.lecture.dto.request; import java.time.LocalDateTime; import java.time.format.DateTimeParseException; diff --git a/operation-service/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/AttendanceResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/service/web/lecture/dto/response/AttendanceResponse.java similarity index 85% rename from operation-service/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/AttendanceResponse.java rename to operation-api/src/main/java/org/sopt/makers/operation/service/web/lecture/dto/response/AttendanceResponse.java index 467b2f2a..0c0f4279 100644 --- a/operation-service/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/AttendanceResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/service/web/lecture/dto/response/AttendanceResponse.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.web.lecture.dto.response; +package org.sopt.makers.operation.service.web.lecture.dto.response; import org.operation.lecture.Lecture; import org.operation.lecture.SubLecture; diff --git a/operation-service/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/AttendancesStatusVO.java b/operation-api/src/main/java/org/sopt/makers/operation/service/web/lecture/dto/response/AttendancesStatusVO.java similarity index 93% rename from operation-service/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/AttendancesStatusVO.java rename to operation-api/src/main/java/org/sopt/makers/operation/service/web/lecture/dto/response/AttendancesStatusVO.java index 5b624d6a..f0e5a59a 100644 --- a/operation-service/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/AttendancesStatusVO.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/service/web/lecture/dto/response/AttendancesStatusVO.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.web.lecture.dto.response; +package org.sopt.makers.operation.service.web.lecture.dto.response; import static org.operation.attendance.domain.AttendanceStatus.*; diff --git a/operation-service/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureDetailResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/service/web/lecture/dto/response/LectureDetailResponse.java similarity index 90% rename from operation-service/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureDetailResponse.java rename to operation-api/src/main/java/org/sopt/makers/operation/service/web/lecture/dto/response/LectureDetailResponse.java index 65dafdf5..6f8fe278 100644 --- a/operation-service/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureDetailResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/service/web/lecture/dto/response/LectureDetailResponse.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.web.lecture.dto.response; +package org.sopt.makers.operation.service.web.lecture.dto.response; import org.operation.lecture.Lecture; diff --git a/operation-service/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/service/web/lecture/dto/response/LectureResponse.java similarity index 95% rename from operation-service/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureResponse.java rename to operation-api/src/main/java/org/sopt/makers/operation/service/web/lecture/dto/response/LectureResponse.java index 2bdf8f20..3aa7d495 100644 --- a/operation-service/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/service/web/lecture/dto/response/LectureResponse.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.web.lecture.dto.response; +package org.sopt.makers.operation.service.web.lecture.dto.response; import static java.util.Objects.*; diff --git a/operation-service/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LecturesResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/service/web/lecture/dto/response/LecturesResponse.java similarity index 94% rename from operation-service/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LecturesResponse.java rename to operation-api/src/main/java/org/sopt/makers/operation/service/web/lecture/dto/response/LecturesResponse.java index cdb32ae0..86790900 100644 --- a/operation-service/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LecturesResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/service/web/lecture/dto/response/LecturesResponse.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.web.lecture.dto.response; +package org.sopt.makers.operation.service.web.lecture.dto.response; import java.util.List; diff --git a/operation-service/src/main/java/org/sopt/makers/operation/web/lecture/service/LectureServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/service/web/lecture/service/LectureServiceImpl.java similarity index 91% rename from operation-service/src/main/java/org/sopt/makers/operation/web/lecture/service/LectureServiceImpl.java rename to operation-api/src/main/java/org/sopt/makers/operation/service/web/lecture/service/LectureServiceImpl.java index 1cc73f57..7f3c2811 100644 --- a/operation-service/src/main/java/org/sopt/makers/operation/web/lecture/service/LectureServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/service/web/lecture/service/LectureServiceImpl.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.web.lecture.service; +package org.sopt.makers.operation.service.web.lecture.service; import static org.operation.alarm.domain.Attribute.*; import static org.operation.lecture.message.ErrorMessage.*; @@ -21,13 +21,13 @@ import org.operation.lecture.repository.subLecture.SubLectureRepository; import org.operation.member.domain.Member; import org.operation.member.repository.MemberRepository; +import org.sopt.makers.operation.service.web.lecture.dto.request.AttendanceRequest; +import org.sopt.makers.operation.service.web.lecture.dto.request.LectureRequest; +import org.sopt.makers.operation.service.web.lecture.dto.response.AttendanceResponse; +import org.sopt.makers.operation.service.web.lecture.dto.response.LectureDetailResponse; +import org.sopt.makers.operation.service.web.lecture.dto.response.LectureResponse; +import org.sopt.makers.operation.service.web.lecture.dto.response.LecturesResponse; import org.sopt.makers.operation.web.alarm.dto.request.AlarmSenderRequest; -import org.sopt.makers.operation.web.lecture.dto.request.AttendanceRequest; -import org.sopt.makers.operation.web.lecture.dto.request.LectureRequest; -import org.sopt.makers.operation.web.lecture.dto.response.AttendanceResponse; -import org.sopt.makers.operation.web.lecture.dto.response.LectureDetailResponse; -import org.sopt.makers.operation.web.lecture.dto.response.LectureResponse; -import org.sopt.makers.operation.web.lecture.dto.response.LecturesResponse; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; diff --git a/operation-service/src/main/java/org/sopt/makers/operation/web/member/dto/response/AttendanceTotalCountVO.java b/operation-api/src/main/java/org/sopt/makers/operation/service/web/member/dto/response/AttendanceTotalCountVO.java similarity index 82% rename from operation-service/src/main/java/org/sopt/makers/operation/web/member/dto/response/AttendanceTotalCountVO.java rename to operation-api/src/main/java/org/sopt/makers/operation/service/web/member/dto/response/AttendanceTotalCountVO.java index 773f9b51..758761a8 100644 --- a/operation-service/src/main/java/org/sopt/makers/operation/web/member/dto/response/AttendanceTotalCountVO.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/service/web/member/dto/response/AttendanceTotalCountVO.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.web.member.dto.response; +package org.sopt.makers.operation.service.web.member.dto.response; public record AttendanceTotalCountVO( int attendance, diff --git a/operation-service/src/main/java/org/sopt/makers/operation/web/member/dto/response/AttendanceTotalVO.java b/operation-api/src/main/java/org/sopt/makers/operation/service/web/member/dto/response/AttendanceTotalVO.java similarity index 92% rename from operation-service/src/main/java/org/sopt/makers/operation/web/member/dto/response/AttendanceTotalVO.java rename to operation-api/src/main/java/org/sopt/makers/operation/service/web/member/dto/response/AttendanceTotalVO.java index 46127030..4a8e9d4c 100644 --- a/operation-service/src/main/java/org/sopt/makers/operation/web/member/dto/response/AttendanceTotalVO.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/service/web/member/dto/response/AttendanceTotalVO.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.web.member.dto.response; +package org.sopt.makers.operation.service.web.member.dto.response; import java.time.format.DateTimeFormatter; diff --git a/operation-service/src/main/java/org/sopt/makers/operation/web/member/dto/response/MemberListGetResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/service/web/member/dto/response/MemberListGetResponse.java similarity index 88% rename from operation-service/src/main/java/org/sopt/makers/operation/web/member/dto/response/MemberListGetResponse.java rename to operation-api/src/main/java/org/sopt/makers/operation/service/web/member/dto/response/MemberListGetResponse.java index 92db0bac..c133aec9 100644 --- a/operation-service/src/main/java/org/sopt/makers/operation/web/member/dto/response/MemberListGetResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/service/web/member/dto/response/MemberListGetResponse.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.web.member.dto.response; +package org.sopt.makers.operation.service.web.member.dto.response; import org.sopt.makers.operation.domain.Part; import org.operation.member.domain.Member; diff --git a/operation-service/src/main/java/org/sopt/makers/operation/web/member/dto/response/MembersResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/service/web/member/dto/response/MembersResponse.java similarity index 79% rename from operation-service/src/main/java/org/sopt/makers/operation/web/member/dto/response/MembersResponse.java rename to operation-api/src/main/java/org/sopt/makers/operation/service/web/member/dto/response/MembersResponse.java index fcc209f3..c605164a 100644 --- a/operation-service/src/main/java/org/sopt/makers/operation/web/member/dto/response/MembersResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/service/web/member/dto/response/MembersResponse.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.web.member.dto.response; +package org.sopt.makers.operation.service.web.member.dto.response; import java.util.List; diff --git a/operation-service/src/main/java/org/sopt/makers/operation/web/member/service/MemberServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/service/web/member/service/MemberServiceImpl.java similarity index 87% rename from operation-service/src/main/java/org/sopt/makers/operation/web/member/service/MemberServiceImpl.java rename to operation-api/src/main/java/org/sopt/makers/operation/service/web/member/service/MemberServiceImpl.java index 9a4b49f4..1dc4819a 100644 --- a/operation-service/src/main/java/org/sopt/makers/operation/web/member/service/MemberServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/service/web/member/service/MemberServiceImpl.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.web.member.service; +package org.sopt.makers.operation.service.web.member.service; import java.util.EnumMap; import java.util.List; @@ -9,10 +9,10 @@ import org.sopt.makers.operation.dto.MemberSearchCondition; import org.operation.member.domain.Member; import org.operation.member.repository.MemberRepository; -import org.sopt.makers.operation.web.member.dto.response.AttendanceTotalCountVO; -import org.sopt.makers.operation.web.member.dto.response.AttendanceTotalVO; -import org.sopt.makers.operation.web.member.dto.response.MemberListGetResponse; -import org.sopt.makers.operation.web.member.dto.response.MembersResponse; +import org.sopt.makers.operation.service.web.member.dto.response.AttendanceTotalCountVO; +import org.sopt.makers.operation.service.web.member.dto.response.AttendanceTotalVO; +import org.sopt.makers.operation.service.web.member.dto.response.MemberListGetResponse; +import org.sopt.makers.operation.service.web.member.dto.response.MembersResponse; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; diff --git a/operation-common/src/main/java/org/sopt/makers/operation/code/failure/FailureCode.java b/operation-common/src/main/java/org/sopt/makers/operation/code/failure/FailureCode.java new file mode 100644 index 00000000..5363d453 --- /dev/null +++ b/operation-common/src/main/java/org/sopt/makers/operation/code/failure/FailureCode.java @@ -0,0 +1,8 @@ +package org.sopt.makers.operation.code.failure; + +import org.springframework.http.HttpStatus; + +public interface FailureCode { + HttpStatus getStatus(); + String getMessage(); +} diff --git a/operation-common/src/main/java/org/sopt/makers/operation/code/success/SuccessCode.java b/operation-common/src/main/java/org/sopt/makers/operation/code/success/SuccessCode.java new file mode 100644 index 00000000..e4575f0e --- /dev/null +++ b/operation-common/src/main/java/org/sopt/makers/operation/code/success/SuccessCode.java @@ -0,0 +1,8 @@ +package org.sopt.makers.operation.code.success; + +import org.springframework.http.HttpStatus; + +public interface SuccessCode { + HttpStatus getStatus(); + String getMessage(); +} diff --git a/operation-common/src/main/java/org/sopt/makers/operation/code/success/app/AttendanceSuccessCode.java b/operation-common/src/main/java/org/sopt/makers/operation/code/success/app/AttendanceSuccessCode.java new file mode 100644 index 00000000..863518cf --- /dev/null +++ b/operation-common/src/main/java/org/sopt/makers/operation/code/success/app/AttendanceSuccessCode.java @@ -0,0 +1,18 @@ +package org.sopt.makers.operation.code.success.app; + +import static org.springframework.http.HttpStatus.*; + +import org.sopt.makers.operation.code.success.SuccessCode; +import org.springframework.http.HttpStatus; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public enum AttendanceSuccessCode implements SuccessCode { + SUCCESS_GET_ATTENDANCE(OK, "출석 성공"); + + private final HttpStatus status; + private final String message; +} diff --git a/operation-service/src/main/java/org/sopt/makers/operation/web/alarm/dto/request/AlarmSenderRequest.java b/operation-common/src/main/java/org/sopt/makers/operation/dto/AlarmSenderRequest.java similarity index 75% rename from operation-service/src/main/java/org/sopt/makers/operation/web/alarm/dto/request/AlarmSenderRequest.java rename to operation-common/src/main/java/org/sopt/makers/operation/dto/AlarmSenderRequest.java index ab6fdaf4..de60a8f8 100644 --- a/operation-service/src/main/java/org/sopt/makers/operation/web/alarm/dto/request/AlarmSenderRequest.java +++ b/operation-common/src/main/java/org/sopt/makers/operation/dto/AlarmSenderRequest.java @@ -1,10 +1,7 @@ -package org.sopt.makers.operation.web.alarm.dto.request; +package org.sopt.makers.operation.dto; import java.util.List; -import org.operation.alarm.domain.Alarm; -import org.operation.alarm.domain.Attribute; - import lombok.Builder; @Builder diff --git a/operation-service/src/main/java/org/sopt/makers/operation/common/exception/AdminFailureException.java b/operation-common/src/main/java/org/sopt/makers/operation/exception/AdminFailureException.java similarity index 77% rename from operation-service/src/main/java/org/sopt/makers/operation/common/exception/AdminFailureException.java rename to operation-common/src/main/java/org/sopt/makers/operation/exception/AdminFailureException.java index 5eccd7a9..6e254a7d 100644 --- a/operation-service/src/main/java/org/sopt/makers/operation/common/exception/AdminFailureException.java +++ b/operation-common/src/main/java/org/sopt/makers/operation/exception/AdminFailureException.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.common.exception; +package org.sopt.makers.operation.exception; public class AdminFailureException extends RuntimeException { public AdminFailureException(String message) { diff --git a/operation-service/src/main/java/org/sopt/makers/operation/common/exception/AlarmException.java b/operation-common/src/main/java/org/sopt/makers/operation/exception/AlarmException.java similarity index 75% rename from operation-service/src/main/java/org/sopt/makers/operation/common/exception/AlarmException.java rename to operation-common/src/main/java/org/sopt/makers/operation/exception/AlarmException.java index f1fa3e80..d27e1e2c 100644 --- a/operation-service/src/main/java/org/sopt/makers/operation/common/exception/AlarmException.java +++ b/operation-common/src/main/java/org/sopt/makers/operation/exception/AlarmException.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.common.exception; +package org.sopt.makers.operation.exception; public class AlarmException extends RuntimeException { public AlarmException(String message) { diff --git a/operation-service/src/main/java/org/sopt/makers/operation/common/exception/LectureException.java b/operation-common/src/main/java/org/sopt/makers/operation/exception/LectureException.java similarity index 75% rename from operation-service/src/main/java/org/sopt/makers/operation/common/exception/LectureException.java rename to operation-common/src/main/java/org/sopt/makers/operation/exception/LectureException.java index 0345d924..d5040bf5 100644 --- a/operation-service/src/main/java/org/sopt/makers/operation/common/exception/LectureException.java +++ b/operation-common/src/main/java/org/sopt/makers/operation/exception/LectureException.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.common.exception; +package org.sopt.makers.operation.exception; public class LectureException extends RuntimeException { public LectureException(String message) { diff --git a/operation-service/src/main/java/org/sopt/makers/operation/common/exception/MemberException.java b/operation-common/src/main/java/org/sopt/makers/operation/exception/MemberException.java similarity index 75% rename from operation-service/src/main/java/org/sopt/makers/operation/common/exception/MemberException.java rename to operation-common/src/main/java/org/sopt/makers/operation/exception/MemberException.java index ea65c473..9aceb62e 100644 --- a/operation-service/src/main/java/org/sopt/makers/operation/common/exception/MemberException.java +++ b/operation-common/src/main/java/org/sopt/makers/operation/exception/MemberException.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.common.exception; +package org.sopt.makers.operation.exception; public class MemberException extends RuntimeException { public MemberException(String message) { diff --git a/operation-service/src/main/java/org/sopt/makers/operation/common/exception/SubLectureException.java b/operation-common/src/main/java/org/sopt/makers/operation/exception/SubLectureException.java similarity index 76% rename from operation-service/src/main/java/org/sopt/makers/operation/common/exception/SubLectureException.java rename to operation-common/src/main/java/org/sopt/makers/operation/exception/SubLectureException.java index 33dfab05..3d9d4612 100644 --- a/operation-service/src/main/java/org/sopt/makers/operation/common/exception/SubLectureException.java +++ b/operation-common/src/main/java/org/sopt/makers/operation/exception/SubLectureException.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.common.exception; +package org.sopt.makers.operation.exception; public class SubLectureException extends RuntimeException { public SubLectureException(String message) { diff --git a/operation-service/src/main/java/org/sopt/makers/operation/common/exception/TokenException.java b/operation-common/src/main/java/org/sopt/makers/operation/exception/TokenException.java similarity index 74% rename from operation-service/src/main/java/org/sopt/makers/operation/common/exception/TokenException.java rename to operation-common/src/main/java/org/sopt/makers/operation/exception/TokenException.java index d5a67a5d..a1bcc83f 100644 --- a/operation-service/src/main/java/org/sopt/makers/operation/common/exception/TokenException.java +++ b/operation-common/src/main/java/org/sopt/makers/operation/exception/TokenException.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.common.exception; +package org.sopt.makers.operation.exception; public class TokenException extends RuntimeException { public TokenException(String message) { super("[TokenException] : " + message); diff --git a/operation-external/build.gradle b/operation-external/build.gradle index ce4cc19f..0b2a6923 100644 --- a/operation-external/build.gradle +++ b/operation-external/build.gradle @@ -10,8 +10,8 @@ repositories { } dependencies { -// implementation project(path: ':operation-service') implementation project(path: ':operation-domain') + implementation project(path: ':operation-common') implementation 'org.springframework.boot:spring-boot-starter-web' } diff --git a/operation-external/src/main/java/org/sopt/makers/operation/client/alarm/AlarmSender.java b/operation-external/src/main/java/org/sopt/makers/operation/client/alarm/AlarmSender.java index 3b4175a1..96089f46 100644 --- a/operation-external/src/main/java/org/sopt/makers/operation/client/alarm/AlarmSender.java +++ b/operation-external/src/main/java/org/sopt/makers/operation/client/alarm/AlarmSender.java @@ -1,6 +1,6 @@ package org.sopt.makers.operation.client.alarm; -import org.sopt.makers.operation.web.alarm.dto.request.AlarmSenderRequest; +import org.sopt.makers.operation.dto.AlarmSenderRequest; public interface AlarmSender { void send(AlarmSenderRequest request); diff --git a/operation-external/src/main/java/org/sopt/makers/operation/client/alarm/AlarmSenderImpl.java b/operation-external/src/main/java/org/sopt/makers/operation/client/alarm/AlarmSenderImpl.java index ce310b8f..6b7e29ac 100644 --- a/operation-external/src/main/java/org/sopt/makers/operation/client/alarm/AlarmSenderImpl.java +++ b/operation-external/src/main/java/org/sopt/makers/operation/client/alarm/AlarmSenderImpl.java @@ -2,16 +2,16 @@ import static java.util.Objects.*; import static java.util.UUID.*; -import static org.operation.alarm.message.ErrorMessage.*; +import static org.sopt.makers.operation.domain.alarm.message.ErrorMessage.*; import static org.springframework.http.MediaType.*; import java.util.Collections; import java.util.HashMap; import java.util.Map; -import org.sopt.makers.operation.common.config.ValueConfig; -import org.sopt.makers.operation.common.exception.AlarmException; -import org.sopt.makers.operation.web.alarm.dto.request.AlarmSenderRequest; +import org.sopt.makers.operation.config.ValueConfig; +import org.sopt.makers.operation.dto.AlarmSenderRequest; +import org.sopt.makers.operation.exception.AlarmException; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.stereotype.Component; diff --git a/operation-service/build.gradle b/operation-service/build.gradle deleted file mode 100644 index 81d88ec7..00000000 --- a/operation-service/build.gradle +++ /dev/null @@ -1,23 +0,0 @@ -plugins { - id 'java' -} - -group = 'org.sopt.makers' -version = '0.0.1-SNAPSHOT' - -repositories { - mavenCentral() -} - -dependencies { -// implementation project(path: ':operation-api') - implementation project(path: ':operation-domain') - implementation project(path: ':operation-external') - - implementation 'org.springframework.boot:spring-boot-starter-web' - implementation 'org.springframework.boot:spring-boot-starter-data-jpa' -} - -test { - useJUnitPlatform() -} \ No newline at end of file diff --git a/operation-service/src/main/java/org/sopt/makers/operation/web/alarm/dto/request/AlarmSendRequest.java b/operation-service/src/main/java/org/sopt/makers/operation/web/alarm/dto/request/AlarmSendRequest.java deleted file mode 100644 index a3a30aea..00000000 --- a/operation-service/src/main/java/org/sopt/makers/operation/web/alarm/dto/request/AlarmSendRequest.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.sopt.makers.operation.web.alarm.dto.request; - -public record AlarmSendRequest( - long alarmId -) { -} diff --git a/settings.gradle b/settings.gradle index aba15a9a..c0c519a6 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,9 +1,7 @@ rootProject.name = 'operation' include 'operation-api' include 'operation-auth' +include 'operation-common' include 'operation-domain' include 'operation-external' -include 'operation-storage' -include 'operation-service' -include 'operation-common' From d2ed0c928eed6cd1b87f2b05e58a9d21cb3c594e Mon Sep 17 00:00:00 2001 From: thguss Date: Mon, 5 Feb 2024 01:06:44 +0900 Subject: [PATCH 051/141] =?UTF-8?q?[FIX]=20=EB=A6=AC=ED=8C=A9=ED=86=A0?= =?UTF-8?q?=EB=A7=81=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operation/web/alarm/api/AlarmApi.java | 2 +- .../web/alarm/api/AlarmApiController.java | 19 ++++++++----------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/api/AlarmApi.java b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/api/AlarmApi.java index 4c31b1f8..60197b12 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/api/AlarmApi.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/api/AlarmApi.java @@ -1,8 +1,8 @@ package org.sopt.makers.operation.web.alarm.api; -import org.operation.alarm.domain.Status; import org.sopt.makers.operation.domain.Part; import org.sopt.makers.operation.common.dto.BaseResponse; +import org.sopt.makers.operation.domain.alarm.domain.Status; import org.sopt.makers.operation.dto.AlarmRequest; import org.sopt.makers.operation.web.alarm.dto.request.AlarmSendRequest; import org.springframework.data.domain.Pageable; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/api/AlarmApiController.java b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/api/AlarmApiController.java index a8bbffa9..ecf63437 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/api/AlarmApiController.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/api/AlarmApiController.java @@ -1,12 +1,11 @@ package org.sopt.makers.operation.web.alarm.api; -import static org.sopt.makers.operation.web.alarm.message.SuccessMessage.*; +import static org.sopt.makers.operation.code.success.web.AlarmSuccessCode.*; -import org.operation.alarm.domain.Status; import org.sopt.makers.operation.domain.Part; import org.sopt.makers.operation.common.dto.BaseResponse; import org.sopt.makers.operation.common.util.ApiResponseUtil; -import org.sopt.makers.operation.common.util.CommonUtils; +import org.sopt.makers.operation.domain.alarm.domain.Status; import org.sopt.makers.operation.dto.AlarmRequest; import org.sopt.makers.operation.web.alarm.dto.request.AlarmSendRequest; import org.sopt.makers.operation.web.alarm.service.AlarmService; @@ -29,21 +28,19 @@ public class AlarmApiController implements AlarmApi { private final AlarmService alarmService; - private final CommonUtils utils; @Override @PostMapping("/send") public ResponseEntity> sendAlarm(AlarmSendRequest request) { alarmService.sendByAdmin(request); - return ApiResponseUtil.ok(SUCCESS_SEND_ALARM.getContent()); + return ApiResponseUtil.success(SUCCESS_SEND_ALARM); } @Override @PostMapping public ResponseEntity> createAlarm(AlarmRequest request) { - val alarmId = alarmService.createAlarm(request); - val uri = utils.getURI("/{alarmId}", alarmId); - return ApiResponseUtil.created(uri, SUCCESS_CREATE_ALARM.getContent(), alarmId); + val response = alarmService.createAlarm(request); + return ApiResponseUtil.success(SUCCESS_CREATE_ALARM, response); } @Override @@ -55,20 +52,20 @@ public ResponseEntity> getAlarms( Pageable pageable ) { val response = alarmService.getAlarms(generation, part, status, pageable); - return ApiResponseUtil.ok(SUCCESS_GET_ALARMS.getContent(), response); + return ApiResponseUtil.success(SUCCESS_GET_ALARMS, response); } @Override @GetMapping("/{alarmId}") public ResponseEntity> getAlarm(@PathVariable long alarmId) { val response = alarmService.getAlarm(alarmId); - return ApiResponseUtil.ok(SUCCESS_GET_ALARM.getContent(), response); + return ApiResponseUtil.success(SUCCESS_GET_ALARM, response); } @Override @DeleteMapping("/{alarmId}") public ResponseEntity> deleteAlarm(@PathVariable long alarmId) { alarmService.deleteAlarm(alarmId); - return ApiResponseUtil.ok(SUCCESS_DELETE_ALARM.getContent()); + return ApiResponseUtil.success(SUCCESS_DELETE_ALARM); } } From 65b4bb0ec10984e2e8ec929eb700bfbd9e49eaed Mon Sep 17 00:00:00 2001 From: thguss Date: Mon, 5 Feb 2024 01:13:42 +0900 Subject: [PATCH 052/141] =?UTF-8?q?[ADD]=20FailureCode=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../code/failure/AlarmFailureCode.java | 20 +++++++++++++++++++ .../exception/AdminFailureException.java | 13 ++++++++++-- .../operation/exception/AlarmException.java | 14 +++++++++++-- .../operation/exception/LectureException.java | 13 ++++++++++-- .../operation/exception/MemberException.java | 13 ++++++++++-- .../exception/SubLectureException.java | 13 ++++++++++-- .../operation/exception/TokenException.java | 14 +++++++++++-- 7 files changed, 88 insertions(+), 12 deletions(-) create mode 100644 operation-common/src/main/java/org/sopt/makers/operation/code/failure/AlarmFailureCode.java diff --git a/operation-common/src/main/java/org/sopt/makers/operation/code/failure/AlarmFailureCode.java b/operation-common/src/main/java/org/sopt/makers/operation/code/failure/AlarmFailureCode.java new file mode 100644 index 00000000..aeaef689 --- /dev/null +++ b/operation-common/src/main/java/org/sopt/makers/operation/code/failure/AlarmFailureCode.java @@ -0,0 +1,20 @@ +package org.sopt.makers.operation.code.failure; + +import static org.springframework.http.HttpStatus.*; + +import org.springframework.http.HttpStatus; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +@Getter +public enum AlarmFailureCode implements FailureCode { + FAIL_SEND_ALARM(BAD_REQUEST, "알림 전송에 실패하였습니다."), + INVALID_ALARM(NOT_FOUND, "알림이 존재하지 않습니다."), + FAIL_INACTIVE_USERS(BAD_REQUEST, "비활동 유저 불러오기에 실패하였습니다."), + ; + + private final HttpStatus status; + private final String message; +} diff --git a/operation-common/src/main/java/org/sopt/makers/operation/exception/AdminFailureException.java b/operation-common/src/main/java/org/sopt/makers/operation/exception/AdminFailureException.java index 6e254a7d..d19abe71 100644 --- a/operation-common/src/main/java/org/sopt/makers/operation/exception/AdminFailureException.java +++ b/operation-common/src/main/java/org/sopt/makers/operation/exception/AdminFailureException.java @@ -1,7 +1,16 @@ package org.sopt.makers.operation.exception; +import org.sopt.makers.operation.code.failure.FailureCode; + +import lombok.Getter; + +@Getter public class AdminFailureException extends RuntimeException { - public AdminFailureException(String message) { - super("[AuthFailureException] : " + message); + + private final FailureCode failureCode; + + public AdminFailureException(FailureCode failureCode) { + super("[AuthFailureException] : " + failureCode.getMessage()); + this.failureCode = failureCode; } } diff --git a/operation-common/src/main/java/org/sopt/makers/operation/exception/AlarmException.java b/operation-common/src/main/java/org/sopt/makers/operation/exception/AlarmException.java index d27e1e2c..c31cf79b 100644 --- a/operation-common/src/main/java/org/sopt/makers/operation/exception/AlarmException.java +++ b/operation-common/src/main/java/org/sopt/makers/operation/exception/AlarmException.java @@ -1,7 +1,17 @@ package org.sopt.makers.operation.exception; +import org.sopt.makers.operation.code.failure.AlarmFailureCode; +import org.sopt.makers.operation.code.failure.FailureCode; + +import lombok.Getter; + +@Getter public class AlarmException extends RuntimeException { - public AlarmException(String message) { - super("[AlarmException] : " + message); + + private final FailureCode failureCode; + + public AlarmException(AlarmFailureCode failureCode) { + super("[AlarmException] : " + failureCode.getMessage()); + this.failureCode = failureCode; } } diff --git a/operation-common/src/main/java/org/sopt/makers/operation/exception/LectureException.java b/operation-common/src/main/java/org/sopt/makers/operation/exception/LectureException.java index d5040bf5..355c0f63 100644 --- a/operation-common/src/main/java/org/sopt/makers/operation/exception/LectureException.java +++ b/operation-common/src/main/java/org/sopt/makers/operation/exception/LectureException.java @@ -1,7 +1,16 @@ package org.sopt.makers.operation.exception; +import org.sopt.makers.operation.code.failure.FailureCode; + +import lombok.Getter; + +@Getter public class LectureException extends RuntimeException { - public LectureException(String message) { - super("[LectureException] : " + message); + + private final FailureCode failureCode; + + public LectureException(FailureCode failureCode) { + super("[LectureException] : " + failureCode.getMessage()); + this.failureCode = failureCode; } } \ No newline at end of file diff --git a/operation-common/src/main/java/org/sopt/makers/operation/exception/MemberException.java b/operation-common/src/main/java/org/sopt/makers/operation/exception/MemberException.java index 9aceb62e..7e0209f6 100644 --- a/operation-common/src/main/java/org/sopt/makers/operation/exception/MemberException.java +++ b/operation-common/src/main/java/org/sopt/makers/operation/exception/MemberException.java @@ -1,7 +1,16 @@ package org.sopt.makers.operation.exception; +import org.sopt.makers.operation.code.failure.FailureCode; + +import lombok.Getter; + +@Getter public class MemberException extends RuntimeException { - public MemberException(String message) { - super("[MemberException] : " + message); + + private final FailureCode failureCode; + + public MemberException(FailureCode failureCode) { + super("[MemberException] : " + failureCode.getMessage()); + this.failureCode = failureCode; } } diff --git a/operation-common/src/main/java/org/sopt/makers/operation/exception/SubLectureException.java b/operation-common/src/main/java/org/sopt/makers/operation/exception/SubLectureException.java index 3d9d4612..881dc269 100644 --- a/operation-common/src/main/java/org/sopt/makers/operation/exception/SubLectureException.java +++ b/operation-common/src/main/java/org/sopt/makers/operation/exception/SubLectureException.java @@ -1,7 +1,16 @@ package org.sopt.makers.operation.exception; +import org.sopt.makers.operation.code.failure.FailureCode; + +import lombok.Getter; + +@Getter public class SubLectureException extends RuntimeException { - public SubLectureException(String message) { - super("[SubLectureException] : " + message); + + private final FailureCode failureCode; + + public SubLectureException(FailureCode failureCode) { + super("[SubLectureException] : " + failureCode.getMessage()); + this.failureCode = failureCode; } } diff --git a/operation-common/src/main/java/org/sopt/makers/operation/exception/TokenException.java b/operation-common/src/main/java/org/sopt/makers/operation/exception/TokenException.java index a1bcc83f..dc555a28 100644 --- a/operation-common/src/main/java/org/sopt/makers/operation/exception/TokenException.java +++ b/operation-common/src/main/java/org/sopt/makers/operation/exception/TokenException.java @@ -1,6 +1,16 @@ package org.sopt.makers.operation.exception; + +import org.sopt.makers.operation.code.failure.FailureCode; + +import lombok.Getter; + +@Getter public class TokenException extends RuntimeException { - public TokenException(String message) { - super("[TokenException] : " + message); + + private final FailureCode failureCode; + + public TokenException(FailureCode failureCode) { + super("[TokenException] : " + failureCode.getMessage()); + this.failureCode = failureCode; } } From 7e37d18ad5e13e71ba389fed2b761df5201b50d4 Mon Sep 17 00:00:00 2001 From: thguss Date: Mon, 5 Feb 2024 01:27:15 +0900 Subject: [PATCH 053/141] =?UTF-8?q?[CHORE]=20gradle=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- operation-api/build.gradle | 3 ++- operation-external/build.gradle | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/operation-api/build.gradle b/operation-api/build.gradle index 6e2830bd..c77b8cdf 100644 --- a/operation-api/build.gradle +++ b/operation-api/build.gradle @@ -7,9 +7,10 @@ tasks.named('jar') { } dependencies { - implementation project(path: ':operation-domain') implementation project(path: ':operation-auth') implementation project(path: ':operation-common') + implementation project(path: ':operation-domain') + implementation project(path: ':operation-external') implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.0.2' diff --git a/operation-external/build.gradle b/operation-external/build.gradle index 0b2a6923..843048bc 100644 --- a/operation-external/build.gradle +++ b/operation-external/build.gradle @@ -10,8 +10,8 @@ repositories { } dependencies { - implementation project(path: ':operation-domain') implementation project(path: ':operation-common') + implementation project(path: ':operation-domain') implementation 'org.springframework.boot:spring-boot-starter-web' } From 430758c4c66647c044cc3b7b62e94498d90c4ef8 Mon Sep 17 00:00:00 2001 From: thguss Date: Mon, 5 Feb 2024 01:28:06 +0900 Subject: [PATCH 054/141] =?UTF-8?q?[ADD]=20failureCode=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../code/failure/LectureFailureCode.java | 18 ++++++++++++++++++ .../operation/exception/ScheduleException.java | 16 ++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 operation-common/src/main/java/org/sopt/makers/operation/code/failure/LectureFailureCode.java create mode 100644 operation-common/src/main/java/org/sopt/makers/operation/exception/ScheduleException.java diff --git a/operation-common/src/main/java/org/sopt/makers/operation/code/failure/LectureFailureCode.java b/operation-common/src/main/java/org/sopt/makers/operation/code/failure/LectureFailureCode.java new file mode 100644 index 00000000..711f2578 --- /dev/null +++ b/operation-common/src/main/java/org/sopt/makers/operation/code/failure/LectureFailureCode.java @@ -0,0 +1,18 @@ +package org.sopt.makers.operation.code.failure; + +import static org.springframework.http.HttpStatus.*; + +import org.springframework.http.HttpStatus; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +@Getter +public enum LectureFailureCode implements FailureCode { + INVALID_DATE_PATTERN(BAD_REQUEST, "유효하지 않은 날짜 형식입니다."), + ; + + private final HttpStatus status; + private final String message; +} diff --git a/operation-common/src/main/java/org/sopt/makers/operation/exception/ScheduleException.java b/operation-common/src/main/java/org/sopt/makers/operation/exception/ScheduleException.java new file mode 100644 index 00000000..579e2506 --- /dev/null +++ b/operation-common/src/main/java/org/sopt/makers/operation/exception/ScheduleException.java @@ -0,0 +1,16 @@ +package org.sopt.makers.operation.exception; + +import org.sopt.makers.operation.code.failure.FailureCode; + +import lombok.Getter; + +@Getter +public class ScheduleException extends RuntimeException { + + private final FailureCode failureCode; + + public ScheduleException(FailureCode failureCode) { + super("[ScheduleException] : " + failureCode.getMessage()); + this.failureCode = failureCode; + } +} From 9bb5b86c498c8d225ec5ce8bf67e25f8615ee8da Mon Sep 17 00:00:00 2001 From: thguss Date: Mon, 5 Feb 2024 01:28:30 +0900 Subject: [PATCH 055/141] =?UTF-8?q?[ADD]=20=EC=98=88=EC=99=B8=20=EC=BB=A4?= =?UTF-8?q?=EC=8A=A4=ED=85=80=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/handler/ErrorHandler.java | 42 +++++++++---------- .../DateTimeParseCustomException.java | 18 ++++++++ 2 files changed, 38 insertions(+), 22 deletions(-) create mode 100644 operation-common/src/main/java/org/sopt/makers/operation/exception/DateTimeParseCustomException.java diff --git a/operation-api/src/main/java/org/sopt/makers/operation/common/handler/ErrorHandler.java b/operation-api/src/main/java/org/sopt/makers/operation/common/handler/ErrorHandler.java index 3c81da5e..f5efd723 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/common/handler/ErrorHandler.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/common/handler/ErrorHandler.java @@ -1,17 +1,15 @@ package org.sopt.makers.operation.common.handler; -import static org.springframework.http.HttpStatus.*; - -import java.time.format.DateTimeParseException; - import org.sopt.makers.operation.common.dto.BaseResponse; -import org.sopt.makers.operation.common.exception.MemberException; import org.sopt.makers.operation.common.util.ApiResponseUtil; -import org.sopt.makers.operation.common.exception.AdminFailureException; -import org.sopt.makers.operation.common.exception.TokenException; -import org.sopt.makers.operation.common.exception.AlarmException; -import org.sopt.makers.operation.common.exception.LectureException; -import org.sopt.makers.operation.common.exception.SubLectureException; +import org.sopt.makers.operation.exception.AdminFailureException; +import org.sopt.makers.operation.exception.AlarmException; +import org.sopt.makers.operation.exception.DateTimeParseCustomException; +import org.sopt.makers.operation.exception.LectureException; +import org.sopt.makers.operation.exception.MemberException; +import org.sopt.makers.operation.exception.ScheduleException; +import org.sopt.makers.operation.exception.SubLectureException; +import org.sopt.makers.operation.exception.TokenException; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RestControllerAdvice; @@ -25,48 +23,48 @@ public class ErrorHandler { @ExceptionHandler(AdminFailureException.class) public ResponseEntity> authFailureException(AdminFailureException ex) { log.error(ex.getMessage()); - return ApiResponseUtil.failure(BAD_REQUEST, ex.getMessage()); + return ApiResponseUtil.failure(ex.getFailureCode()); } @ExceptionHandler(TokenException.class) public ResponseEntity> tokenException(TokenException ex) { log.error(ex.getMessage()); - return ApiResponseUtil.failure(BAD_REQUEST, ex.getMessage()); + return ApiResponseUtil.failure(ex.getFailureCode()); } - @ExceptionHandler(IllegalStateException.class) - public ResponseEntity> illegalStateExceptionException(IllegalStateException ex) { + @ExceptionHandler(ScheduleException.class) + public ResponseEntity> scheduleException(ScheduleException ex) { log.error(ex.getMessage()); - return ApiResponseUtil.failure(BAD_REQUEST, ex.getMessage()); + return ApiResponseUtil.failure(ex.getFailureCode()); } @ExceptionHandler(MemberException.class) public ResponseEntity> memberException(MemberException ex) { log.error(ex.getMessage()); - return ApiResponseUtil.failure(NOT_FOUND, ex.getMessage()); + return ApiResponseUtil.failure(ex.getFailureCode()); } @ExceptionHandler(LectureException.class) public ResponseEntity> lectureException(LectureException ex) { log.error(ex.getMessage()); - return ApiResponseUtil.failure(NOT_FOUND, ex.getMessage()); + return ApiResponseUtil.failure(ex.getFailureCode()); } @ExceptionHandler(SubLectureException.class) public ResponseEntity> subLectureException(SubLectureException ex) { log.error(ex.getMessage()); - return ApiResponseUtil.failure(NOT_FOUND, ex.getMessage()); + return ApiResponseUtil.failure(ex.getFailureCode()); } - @ExceptionHandler(DateTimeParseException.class) - public ResponseEntity> dateTimeParseException(DateTimeParseException ex) { - return ApiResponseUtil.failure(BAD_REQUEST, ex.getMessage()); + @ExceptionHandler(DateTimeParseCustomException.class) + public ResponseEntity> dateTimeParseException(DateTimeParseCustomException ex) { + return ApiResponseUtil.failure(ex.getFailureCode()); } @ExceptionHandler(AlarmException.class) public ResponseEntity> alarmException(AlarmException ex) { log.error(ex.getMessage()); - return ApiResponseUtil.failure(BAD_REQUEST, ex.getMessage()); + return ApiResponseUtil.failure(ex.getFailureCode()); } } diff --git a/operation-common/src/main/java/org/sopt/makers/operation/exception/DateTimeParseCustomException.java b/operation-common/src/main/java/org/sopt/makers/operation/exception/DateTimeParseCustomException.java new file mode 100644 index 00000000..3a129a4e --- /dev/null +++ b/operation-common/src/main/java/org/sopt/makers/operation/exception/DateTimeParseCustomException.java @@ -0,0 +1,18 @@ +package org.sopt.makers.operation.exception; + +import java.time.format.DateTimeParseException; + +import org.sopt.makers.operation.code.failure.FailureCode; + +import lombok.Getter; + +@Getter +public class DateTimeParseCustomException extends DateTimeParseException { + + private final FailureCode failureCode; + + public DateTimeParseCustomException(FailureCode failureCode, String input, int index) { + super("[DateTimeParseException] : " + failureCode.getMessage(), input, index); + this.failureCode = failureCode; + } +} From 4c2652fe1fb9d0cb1b78dad4e3bb60ceab99dee7 Mon Sep 17 00:00:00 2001 From: thguss Date: Mon, 5 Feb 2024 01:28:52 +0900 Subject: [PATCH 056/141] =?UTF-8?q?[DELETE]=20=ED=81=B4=EB=9E=98=EC=8A=A4?= =?UTF-8?q?=20=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alarm/dto/request/AlarmSendRequest.java | 6 - .../web/alarm/service/AlarmServiceImpl.java | 126 ------------------ .../domain/alarm/message/ErrorMessage.java | 15 --- 3 files changed, 147 deletions(-) delete mode 100644 operation-api/src/main/java/org/sopt/makers/operation/service/web/alarm/dto/request/AlarmSendRequest.java delete mode 100644 operation-api/src/main/java/org/sopt/makers/operation/service/web/alarm/service/AlarmServiceImpl.java delete mode 100644 operation-domain/src/main/java/org/sopt/makers/operation/domain/alarm/message/ErrorMessage.java diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/web/alarm/dto/request/AlarmSendRequest.java b/operation-api/src/main/java/org/sopt/makers/operation/service/web/alarm/dto/request/AlarmSendRequest.java deleted file mode 100644 index 60507102..00000000 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/web/alarm/dto/request/AlarmSendRequest.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.sopt.makers.operation.service.web.alarm.dto.request; - -public record AlarmSendRequest( - long alarmId -) { -} diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/web/alarm/service/AlarmServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/service/web/alarm/service/AlarmServiceImpl.java deleted file mode 100644 index 9417ea8f..00000000 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/web/alarm/service/AlarmServiceImpl.java +++ /dev/null @@ -1,126 +0,0 @@ -package org.sopt.makers.operation.service.web.alarm.service; - -import static java.util.Objects.*; -import static org.operation.alarm.domain.Status.*; -import static org.operation.alarm.message.ErrorMessage.*; - -import java.util.List; - -import org.operation.alarm.domain.Alarm; -import org.operation.alarm.domain.Status; -import org.operation.alarm.repository.AlarmRepository; -import org.operation.client.alarm.AlarmSender; -import org.operation.client.playground.PlayGroundServer; -import org.sopt.makers.operation.common.config.ValueConfig; -import org.sopt.makers.operation.domain.Part; -import org.sopt.makers.operation.dto.MemberSearchCondition; -import org.sopt.makers.operation.common.exception.AlarmException; -import org.operation.member.repository.MemberRepository; -import org.sopt.makers.operation.dto.AlarmRequest; -import org.sopt.makers.operation.service.web.alarm.dto.request.AlarmSendRequest; -import org.sopt.makers.operation.service.web.alarm.dto.response.AlarmResponse; -import org.sopt.makers.operation.service.web.alarm.dto.response.AlarmsResponse; -import org.sopt.makers.operation.web.alarm.dto.request.AlarmSenderRequest; -import org.springframework.data.domain.Pageable; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import lombok.RequiredArgsConstructor; -import lombok.val; - -@Service -@RequiredArgsConstructor -public class AlarmServiceImpl implements AlarmService { - - private final AlarmRepository alarmRepository; - private final MemberRepository memberRepository; - private final AlarmSender alarmSender; - private final PlayGroundServer playGroundServer; - private final ValueConfig valueConfig; - - @Override - @Transactional - public void sendByAdmin(AlarmSendRequest request) { - val alarm = findAlarm(request.alarmId()); - - if (alarm.getStatus().equals(AFTER)) { - throw new AlarmException(FAIL_SEND_ALARM.getContent()); - } - - val targetIdList = getTargetIdList(alarm); - alarmSender.send(AlarmSenderRequest.of(alarm, targetIdList)); - - alarm.updateStatus(); - alarm.updateSendAt(); - } - - private Alarm findAlarm(long id) { - return alarmRepository.findById(id) - .orElseThrow(() -> new AlarmException(INVALID_ALARM.getContent())); - } - - private List getTargetIdList(Alarm alarm) { - val targetList = alarm.getTargetList(); - if (!targetList.isEmpty()) { - return targetList; - } - - val activeTargetList = getActiveTargetList(alarm.getPart()); - if (alarm.getIsActive()) { - return activeTargetList; - } - - val inactiveTargetList = getInactiveTargetList(valueConfig.getGENERATION(), alarm.getPart()); - return inactiveTargetList.stream() - .filter(target -> !activeTargetList.contains(target)) - .toList(); - } - - private List getActiveTargetList(Part part) { - val generation = valueConfig.getGENERATION(); - val members = memberRepository.search(new MemberSearchCondition(getPart(part), generation)); - return members.stream() - .filter(member -> nonNull(member.getPlaygroundId())) - .map(member -> String.valueOf(member.getPlaygroundId())) - .toList(); - } - - private Part getPart(Part part) { - return part.equals(Part.ALL) ? null : part; - } - - private List getInactiveTargetList(int generation, Part part) { - val members = playGroundServer.getInactiveMembers(generation, part); - return members.memberIds().stream() - .map(String::valueOf) - .toList(); - } - - @Override - @Transactional - public Long createAlarm(AlarmRequest request) { - val alarmEntity = request.toEntity(); - val savedAlarm = alarmRepository.save(alarmEntity); - return savedAlarm.getId(); - } - - @Override - public AlarmsResponse getAlarms(Integer generation, Part part, Status status, Pageable pageable) { - val alarms = alarmRepository.getAlarms(generation, part, status, pageable); - val alarmsCount = alarmRepository.countByGenerationAndPartAndStatus(generation, part, status); - return AlarmsResponse.of(alarms, alarmsCount); - } - - @Override - public AlarmResponse getAlarm(long alarmId) { - val alarm = findAlarm(alarmId); - return AlarmResponse.of(alarm); - } - - @Override - @Transactional - public void deleteAlarm(Long alarmId) { - val alarm = findAlarm(alarmId); - alarmRepository.delete(alarm); - } -} diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/domain/alarm/message/ErrorMessage.java b/operation-domain/src/main/java/org/sopt/makers/operation/domain/alarm/message/ErrorMessage.java deleted file mode 100644 index a7f752c1..00000000 --- a/operation-domain/src/main/java/org/sopt/makers/operation/domain/alarm/message/ErrorMessage.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.sopt.makers.operation.domain.alarm.message; - -import lombok.AllArgsConstructor; -import lombok.Getter; - -@AllArgsConstructor -@Getter -public enum ErrorMessage { - FAIL_SEND_ALARM("알림 전송에 실패하였습니다."), - INVALID_ALARM("알림이 존재하지 않습니다."), - FAIL_INACTIVE_USERS("비활동 유저 불러오기에 실패하였습니다."), - ; - - private final String content; -} From 9301e9d5805a94329b6416e9eaa08d98aee079bc Mon Sep 17 00:00:00 2001 From: thguss Date: Mon, 5 Feb 2024 01:32:10 +0900 Subject: [PATCH 057/141] =?UTF-8?q?[REFACTOR]=20=EC=95=8C=EB=A6=BC=20?= =?UTF-8?q?=EC=A0=84=EC=86=A1=20=EA=B8=B0=EB=8A=A5=20=EB=A6=AC=ED=8C=A9?= =?UTF-8?q?=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alarm/dto/request/AlarmSendRequest.java | 6 + .../response/AlarmInactiveListResponse.java | 2 +- .../web/alarm/service/AlarmService.java | 2 +- .../web/alarm/service/AlarmServiceImpl.java | 137 ++++++++++++++++++ .../code/success/web/AlarmSuccessCode.java | 23 +++ .../operation/domain/alarm/domain/Alarm.java | 24 +-- .../repository/MemberCustomRepository.java | 1 + .../repository/MemberRepositoryImpl.java | 12 +- .../operation/client/alarm/AlarmSender.java | 2 +- .../client/alarm/dto/AlarmSenderRequest.java | 29 ++++ .../client/playground/PlayGroundServer.java | 4 +- .../playground/PlayGroundServerImpl.java | 12 +- .../dto/InactiveMemberListResponse.java | 8 + 13 files changed, 241 insertions(+), 21 deletions(-) create mode 100644 operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/request/AlarmSendRequest.java rename operation-api/src/main/java/org/sopt/makers/operation/{service => }/web/alarm/dto/response/AlarmInactiveListResponse.java (59%) create mode 100644 operation-api/src/main/java/org/sopt/makers/operation/web/alarm/service/AlarmServiceImpl.java create mode 100644 operation-common/src/main/java/org/sopt/makers/operation/code/success/web/AlarmSuccessCode.java create mode 100644 operation-external/src/main/java/org/sopt/makers/operation/client/alarm/dto/AlarmSenderRequest.java create mode 100644 operation-external/src/main/java/org/sopt/makers/operation/client/playground/dto/InactiveMemberListResponse.java diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/request/AlarmSendRequest.java b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/request/AlarmSendRequest.java new file mode 100644 index 00000000..a3a30aea --- /dev/null +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/request/AlarmSendRequest.java @@ -0,0 +1,6 @@ +package org.sopt.makers.operation.web.alarm.dto.request; + +public record AlarmSendRequest( + long alarmId +) { +} diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/web/alarm/dto/response/AlarmInactiveListResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/response/AlarmInactiveListResponse.java similarity index 59% rename from operation-api/src/main/java/org/sopt/makers/operation/service/web/alarm/dto/response/AlarmInactiveListResponse.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/response/AlarmInactiveListResponse.java index 6731ebba..da930125 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/web/alarm/dto/response/AlarmInactiveListResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/response/AlarmInactiveListResponse.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.service.web.alarm.dto.response; +package org.sopt.makers.operation.web.alarm.dto.response; import java.util.List; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/service/AlarmService.java b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/service/AlarmService.java index b58fdd5a..54153e2b 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/service/AlarmService.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/service/AlarmService.java @@ -1,7 +1,7 @@ package org.sopt.makers.operation.web.alarm.service; -import org.operation.alarm.domain.Status; import org.sopt.makers.operation.domain.Part; +import org.sopt.makers.operation.domain.alarm.domain.Status; import org.sopt.makers.operation.dto.AlarmRequest; import org.sopt.makers.operation.web.alarm.dto.request.AlarmSendRequest; import org.sopt.makers.operation.web.alarm.dto.response.AlarmResponse; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/service/AlarmServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/service/AlarmServiceImpl.java new file mode 100644 index 00000000..b0a376e1 --- /dev/null +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/service/AlarmServiceImpl.java @@ -0,0 +1,137 @@ +package org.sopt.makers.operation.web.alarm.service; + +import static java.util.Objects.*; +import static org.sopt.makers.operation.code.failure.AlarmFailureCode.*; + +import java.util.List; + +import org.sopt.makers.operation.client.alarm.AlarmSender; +import org.sopt.makers.operation.client.alarm.dto.AlarmSenderRequest; +import org.sopt.makers.operation.client.playground.PlayGroundServer; +import org.sopt.makers.operation.config.ValueConfig; +import org.sopt.makers.operation.domain.Part; +import org.sopt.makers.operation.domain.alarm.domain.Alarm; +import org.sopt.makers.operation.domain.alarm.domain.Status; +import org.sopt.makers.operation.domain.alarm.repository.AlarmRepository; +import org.sopt.makers.operation.domain.member.repository.MemberRepository; +import org.sopt.makers.operation.dto.AlarmRequest; +import org.sopt.makers.operation.exception.AlarmException; +import org.sopt.makers.operation.web.alarm.dto.request.AlarmSendRequest; +import org.sopt.makers.operation.web.alarm.dto.response.AlarmResponse; +import org.sopt.makers.operation.web.alarm.dto.response.AlarmsResponse; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import lombok.RequiredArgsConstructor; +import lombok.val; + +@Service +@RequiredArgsConstructor +public class AlarmServiceImpl implements AlarmService { + + private final AlarmRepository alarmRepository; + private final MemberRepository memberRepository; + private final AlarmSender alarmSender; + private final PlayGroundServer playGroundServer; + private final ValueConfig valueConfig; + + @Override + @Transactional + public void sendByAdmin(AlarmSendRequest request) { + val alarm = getAlarmReadyToSend(request.alarmId()); + val targetIdList = getTargets(alarm); + sendAlarmToTargets(alarm, targetIdList); + } +리 + private Alarm getAlarmReadyToSend(long alarmId) { + val alarm = findAlarm(alarmId); + checkAlarmReadyToSend(alarm); + return alarm; + } + + private Alarm findAlarm(long id) { + return alarmRepository.findById(id) + .orElseThrow(() -> new AlarmException(INVALID_ALARM)); + } + + private void checkAlarmReadyToSend(Alarm alarm) { + if (alarm.isSent()) { + throw new AlarmException(FAIL_SEND_ALARM); + } + } + + private List getTargets(Alarm alarm) { + if (alarm.hasEmptyTargetList()) { + return alarm.getTargetList(); + } + return getTargetsByActivityStatus(alarm.getIsActive(), alarm.getPart()); + } + + private List getTargetsByActivityStatus(boolean isActive, Part part) { + if (isActive) { + return getActiveTargets(part); + } else { + return getInactiveTargets(part); + } + } + + private List getActiveTargets(Part part) { + val generation = valueConfig.getGENERATION(); + val memberList = memberRepository.find(generation, part); + return memberList.stream() + .filter(member -> nonNull(member.getPlaygroundId())) + .map(member -> String.valueOf(member.getPlaygroundId())) + .toList(); + } + + private List getInactiveTargets(Part part) { + val generation = valueConfig.getGENERATION(); + val memberList = getInactiveMemberIdsFromPlayground(generation, part); + val activeTargetList = getActiveTargets(part); + return memberList.stream() + .filter(target -> !activeTargetList.contains(target)) + .toList(); + } + + private List getInactiveMemberIdsFromPlayground(int generation, Part part) { + val memberIdList = playGroundServer.getInactiveMembers(generation, part).memberIds(); + return memberIdList.stream() + .map(String::valueOf) + .toList(); + } + + private void sendAlarmToTargets(Alarm alarm, List targetIdList) { + val alarmRequest = AlarmSenderRequest.of(alarm, targetIdList); + alarmSender.send(alarmRequest); + alarm.updateToSent(); + } + + @Override + @Transactional + public Long createAlarm(AlarmRequest request) { + val alarmEntity = request.toEntity(); + val savedAlarm = alarmRepository.save(alarmEntity); + return savedAlarm.getId(); + } + + @Override + public AlarmsResponse getAlarms(Integer generation, Part part, Status status, Pageable pageable) { + val alarms = alarmRepository.getAlarms(generation, part, status, pageable); + val alarmsCount = alarmRepository.countByGenerationAndPartAndStatus(generation, part, status); + return AlarmsResponse.of(alarms, alarmsCount); + } + + @Override + public AlarmResponse getAlarm(long alarmId) { + val alarm = findAlarm(alarmId); + return AlarmResponse.of(alarm); + } + + @Override + @Transactional + public void deleteAlarm(Long alarmId) { + val alarm = findAlarm(alarmId); + alarmRepository.delete(alarm); + } +} diff --git a/operation-common/src/main/java/org/sopt/makers/operation/code/success/web/AlarmSuccessCode.java b/operation-common/src/main/java/org/sopt/makers/operation/code/success/web/AlarmSuccessCode.java new file mode 100644 index 00000000..f1526ee2 --- /dev/null +++ b/operation-common/src/main/java/org/sopt/makers/operation/code/success/web/AlarmSuccessCode.java @@ -0,0 +1,23 @@ +package org.sopt.makers.operation.code.success.web; + +import static org.springframework.http.HttpStatus.*; + +import org.sopt.makers.operation.code.success.SuccessCode; +import org.springframework.http.HttpStatus; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +@Getter +public enum AlarmSuccessCode implements SuccessCode { + SUCCESS_SEND_ALARM(OK, "알림 전송 성공"), + SUCCESS_CREATE_ALARM(CREATED, "알림 생성 성공"), + SUCCESS_GET_ALARMS(OK, "알림 리스트 조회 성공"), + SUCCESS_GET_ALARM(OK, "알림 상세 조회 성공"), + SUCCESS_DELETE_ALARM(OK, "알림 삭제 성공"), + ; + + private final HttpStatus status; + private final String message; +} diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/domain/alarm/domain/Alarm.java b/operation-domain/src/main/java/org/sopt/makers/operation/domain/alarm/domain/Alarm.java index b59e43cb..bea80b75 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/domain/alarm/domain/Alarm.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/domain/alarm/domain/Alarm.java @@ -3,6 +3,7 @@ import static java.util.Objects.*; import static javax.persistence.EnumType.*; import static javax.persistence.GenerationType.*; +import static org.sopt.makers.operation.domain.alarm.domain.Status.*; import java.time.LocalDateTime; import java.util.ArrayList; @@ -62,14 +63,6 @@ public class Alarm extends BaseEntity { private LocalDateTime sendAt; - public void updateStatus() { - this.status = Status.AFTER; - } - - public void updateSendAt() { - this.sendAt = LocalDateTime.now(); - } - public Alarm(AlarmRequest request) { this.generation = request.generation(); this.generationAt = request.generationAt(); @@ -86,6 +79,19 @@ public Alarm(AlarmRequest request) { this.part = request.part(); } this.targetList = nonNull(request.targetList()) ? request.targetList() : new ArrayList<>(); - this.status = Status.BEFORE; + this.status = BEFORE; + } + + public boolean isSent() { + return this.status.equals(AFTER); + } + + public boolean hasEmptyTargetList() { + return this.targetList.isEmpty(); + } + + public void updateToSent() { + this.status = AFTER; + this.sendAt = LocalDateTime.now(); } } diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/domain/member/repository/MemberCustomRepository.java b/operation-domain/src/main/java/org/sopt/makers/operation/domain/member/repository/MemberCustomRepository.java index a4b04b70..b8a3aa2d 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/domain/member/repository/MemberCustomRepository.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/domain/member/repository/MemberCustomRepository.java @@ -13,5 +13,6 @@ public interface MemberCustomRepository { List search(MemberSearchCondition condition); Optional find(Long memberId); int countByGenerationAndPart(int generation, Part part); + List findOrderByName(int generation, Part part); List find(int generation, Part part); } diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/domain/member/repository/MemberRepositoryImpl.java b/operation-domain/src/main/java/org/sopt/makers/operation/domain/member/repository/MemberRepositoryImpl.java index 0a6ef13d..df86a6c6 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/domain/member/repository/MemberRepositoryImpl.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/domain/member/repository/MemberRepositoryImpl.java @@ -81,7 +81,7 @@ public int countByGenerationAndPart(int generation, Part part) { } @Override - public List find(int generation, Part part) { + public List findOrderByName(int generation, Part part) { StringExpression firstName = Expressions.stringTemplate("SUBSTR({0}, 1, 1)", member.name); return queryFactory @@ -93,6 +93,16 @@ public List find(int generation, Part part) { .fetch(); } + @Override + public List find(int generation, Part part) { + return queryFactory + .selectFrom(member) + .where( + member.generation.eq(generation), + partEq(part)) + .fetch(); + } + private BooleanExpression partEq(Part part) { return (isNull(part) || part.equals(ALL)) ? null : member.part.eq(part); } diff --git a/operation-external/src/main/java/org/sopt/makers/operation/client/alarm/AlarmSender.java b/operation-external/src/main/java/org/sopt/makers/operation/client/alarm/AlarmSender.java index 96089f46..60e39472 100644 --- a/operation-external/src/main/java/org/sopt/makers/operation/client/alarm/AlarmSender.java +++ b/operation-external/src/main/java/org/sopt/makers/operation/client/alarm/AlarmSender.java @@ -1,6 +1,6 @@ package org.sopt.makers.operation.client.alarm; -import org.sopt.makers.operation.dto.AlarmSenderRequest; +import org.sopt.makers.operation.client.alarm.dto.AlarmSenderRequest; public interface AlarmSender { void send(AlarmSenderRequest request); diff --git a/operation-external/src/main/java/org/sopt/makers/operation/client/alarm/dto/AlarmSenderRequest.java b/operation-external/src/main/java/org/sopt/makers/operation/client/alarm/dto/AlarmSenderRequest.java new file mode 100644 index 00000000..2b94ac93 --- /dev/null +++ b/operation-external/src/main/java/org/sopt/makers/operation/client/alarm/dto/AlarmSenderRequest.java @@ -0,0 +1,29 @@ +package org.sopt.makers.operation.client.alarm.dto; + +import java.util.List; + +import org.sopt.makers.operation.domain.alarm.domain.Alarm; +import org.sopt.makers.operation.domain.alarm.domain.Attribute; + +import lombok.AccessLevel; +import lombok.Builder; + +@Builder(access = AccessLevel.PRIVATE) +public record AlarmSenderRequest( + String title, + String content, + List targetList, + Attribute attribute, + String link +) { + + public static AlarmSenderRequest of (Alarm alarm, List targetList) { + return AlarmSenderRequest.builder() + .title(alarm.getTitle()) + .content(alarm.getContent()) + .targetList(targetList) + .attribute(alarm.getAttribute()) + .link(alarm.getLink()) + .build(); + } +} diff --git a/operation-external/src/main/java/org/sopt/makers/operation/client/playground/PlayGroundServer.java b/operation-external/src/main/java/org/sopt/makers/operation/client/playground/PlayGroundServer.java index 723913a3..f2d79241 100644 --- a/operation-external/src/main/java/org/sopt/makers/operation/client/playground/PlayGroundServer.java +++ b/operation-external/src/main/java/org/sopt/makers/operation/client/playground/PlayGroundServer.java @@ -1,8 +1,8 @@ package org.sopt.makers.operation.client.playground; +import org.sopt.makers.operation.client.playground.dto.InactiveMemberListResponse; import org.sopt.makers.operation.domain.Part; -import org.sopt.makers.operation.web.alarm.dto.response.AlarmInactiveListResponse; public interface PlayGroundServer { - AlarmInactiveListResponse getInactiveMembers(int generation, Part part); + InactiveMemberListResponse getInactiveMembers(int generation, Part part); } diff --git a/operation-external/src/main/java/org/sopt/makers/operation/client/playground/PlayGroundServerImpl.java b/operation-external/src/main/java/org/sopt/makers/operation/client/playground/PlayGroundServerImpl.java index 331a6fdb..1d68719d 100644 --- a/operation-external/src/main/java/org/sopt/makers/operation/client/playground/PlayGroundServerImpl.java +++ b/operation-external/src/main/java/org/sopt/makers/operation/client/playground/PlayGroundServerImpl.java @@ -1,12 +1,12 @@ package org.sopt.makers.operation.client.playground; -import static org.operation.alarm.message.ErrorMessage.*; +import static org.sopt.makers.operation.code.failure.AlarmFailureCode.*; import static org.sopt.makers.operation.domain.Part.*; import static org.springframework.http.HttpMethod.*; -import org.sopt.makers.operation.common.exception.AlarmException; +import org.sopt.makers.operation.client.playground.dto.InactiveMemberListResponse; import org.sopt.makers.operation.domain.Part; -import org.sopt.makers.operation.web.alarm.dto.response.AlarmInactiveListResponse; +import org.sopt.makers.operation.exception.AlarmException; import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; @@ -27,16 +27,16 @@ public class PlayGroundServerImpl implements PlayGroundServer { private String playGroundToken; @Override - public AlarmInactiveListResponse getInactiveMembers(int generation, Part part) { + public InactiveMemberListResponse getInactiveMembers(int generation, Part part) { val uri = getInactiveUserURI(part, generation); val headers = getHeaders(); val entity = new HttpEntity<>(null, headers); try { - val response = restTemplate.exchange(uri, GET, entity, AlarmInactiveListResponse.class); + val response = restTemplate.exchange(uri, GET, entity, InactiveMemberListResponse.class); return response.getBody(); } catch (Exception e) { - throw new AlarmException(FAIL_INACTIVE_USERS.getContent()); + throw new AlarmException(FAIL_INACTIVE_USERS); } } diff --git a/operation-external/src/main/java/org/sopt/makers/operation/client/playground/dto/InactiveMemberListResponse.java b/operation-external/src/main/java/org/sopt/makers/operation/client/playground/dto/InactiveMemberListResponse.java new file mode 100644 index 00000000..e4c7b6e9 --- /dev/null +++ b/operation-external/src/main/java/org/sopt/makers/operation/client/playground/dto/InactiveMemberListResponse.java @@ -0,0 +1,8 @@ +package org.sopt.makers.operation.client.playground.dto; + +import java.util.List; + +public record InactiveMemberListResponse( + List memberIds +) { +} From c612c210c45d9149a30fec4316a3480a3576dfab Mon Sep 17 00:00:00 2001 From: thguss Date: Mon, 5 Feb 2024 01:37:21 +0900 Subject: [PATCH 058/141] =?UTF-8?q?[FIX]=20=EC=98=88=EC=99=B8=20=EC=BB=A4?= =?UTF-8?q?=EC=8A=A4=ED=85=80=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/response/SchedulesResponseDTO.java | 4 ++-- .../schedule/service/ScheduleServiceImpl.java | 11 ++++++++--- .../code/failure/ScheduleFailureCode.java | 18 ++++++++++++++++++ 3 files changed, 28 insertions(+), 5 deletions(-) create mode 100644 operation-common/src/main/java/org/sopt/makers/operation/code/failure/ScheduleFailureCode.java diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/app/schedule/dto/response/SchedulesResponseDTO.java b/operation-api/src/main/java/org/sopt/makers/operation/service/app/schedule/dto/response/SchedulesResponseDTO.java index f6c77d4a..4b7d37e2 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/app/schedule/dto/response/SchedulesResponseDTO.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/service/app/schedule/dto/response/SchedulesResponseDTO.java @@ -6,8 +6,8 @@ import java.util.Locale; import java.util.Map; -import org.operation.lecture.Attribute; -import org.operation.schedule.domain.Schedule; +import org.sopt.makers.operation.domain.lecture.Attribute; +import org.sopt.makers.operation.domain.schedule.domain.Schedule; import lombok.Builder; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/app/schedule/service/ScheduleServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/service/app/schedule/service/ScheduleServiceImpl.java index 8cf7e139..4f587631 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/app/schedule/service/ScheduleServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/service/app/schedule/service/ScheduleServiceImpl.java @@ -1,5 +1,7 @@ package org.sopt.makers.operation.service.app.schedule.service; +import static org.sopt.makers.operation.code.failure.ScheduleFailureCode.*; + import java.time.Duration; import java.time.LocalDate; import java.time.LocalDateTime; @@ -10,9 +12,11 @@ import java.util.stream.Collectors; import java.util.stream.LongStream; +import org.sopt.makers.operation.app.schedule.service.ScheduleService; +import org.sopt.makers.operation.domain.schedule.domain.Schedule; +import org.sopt.makers.operation.domain.schedule.repository.ScheduleRepository; +import org.sopt.makers.operation.exception.ScheduleException; import org.sopt.makers.operation.service.app.schedule.dto.response.SchedulesResponseDTO; -import org.operation.schedule.domain.Schedule; -import org.operation.schedule.repository.ScheduleRepository; import org.springframework.stereotype.Service; import lombok.RequiredArgsConstructor; @@ -21,6 +25,7 @@ @Service @RequiredArgsConstructor public class ScheduleServiceImpl implements ScheduleService { + private final ScheduleRepository scheduleRepository; @Override @@ -50,7 +55,7 @@ private Map> initScheduleMap(LocalDateTime startAt, Lo private void validDuration(long duration) { //TODO: 추후 응답 값 형식 변경 후 삭제될 수 있는 메소드 if (duration > 50) { - throw new IllegalStateException("조회할 날짜 기간은 50일을 넘길 수 없습니다."); + throw new ScheduleException(INVALID_DATE_PERM); } } diff --git a/operation-common/src/main/java/org/sopt/makers/operation/code/failure/ScheduleFailureCode.java b/operation-common/src/main/java/org/sopt/makers/operation/code/failure/ScheduleFailureCode.java new file mode 100644 index 00000000..7d4ffca5 --- /dev/null +++ b/operation-common/src/main/java/org/sopt/makers/operation/code/failure/ScheduleFailureCode.java @@ -0,0 +1,18 @@ +package org.sopt.makers.operation.code.failure; + +import static org.springframework.http.HttpStatus.*; + +import org.springframework.http.HttpStatus; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +@Getter +public enum ScheduleFailureCode implements FailureCode { + INVALID_DATE_PERM(BAD_REQUEST, "조회할 날짜 기간은 50일을 넘길 수 없습니다."); + ; + + private final HttpStatus status; + private final String message; +} From f3f487188975aba57fcf3efc1757c96bb9790aaa Mon Sep 17 00:00:00 2001 From: thguss Date: Mon, 5 Feb 2024 01:37:54 +0900 Subject: [PATCH 059/141] =?UTF-8?q?[DELETE]=20=EC=98=A4=ED=83=80=20?= =?UTF-8?q?=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../makers/operation/web/alarm/service/AlarmServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/service/AlarmServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/service/AlarmServiceImpl.java index b0a376e1..9ae5b31d 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/service/AlarmServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/service/AlarmServiceImpl.java @@ -43,7 +43,7 @@ public void sendByAdmin(AlarmSendRequest request) { val targetIdList = getTargets(alarm); sendAlarmToTargets(alarm, targetIdList); } -리 + private Alarm getAlarmReadyToSend(long alarmId) { val alarm = findAlarm(alarmId); checkAlarmReadyToSend(alarm); From 3e12d516f98e64fa028b690173fd73d51f0fdf31 Mon Sep 17 00:00:00 2001 From: thguss Date: Mon, 5 Feb 2024 01:38:12 +0900 Subject: [PATCH 060/141] =?UTF-8?q?[DELETE]=20=EB=A9=94=EC=86=8C=EB=93=9C?= =?UTF-8?q?=20=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sopt/makers/operation/common/util/CommonUtils.java | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/operation-api/src/main/java/org/sopt/makers/operation/common/util/CommonUtils.java b/operation-api/src/main/java/org/sopt/makers/operation/common/util/CommonUtils.java index fcd29e70..40b7f0e7 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/common/util/CommonUtils.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/common/util/CommonUtils.java @@ -1,10 +1,8 @@ package org.sopt.makers.operation.common.util; -import java.net.URI; import java.security.Principal; import org.springframework.context.annotation.Configuration; -import org.springframework.web.servlet.support.ServletUriComponentsBuilder; import lombok.NonNull; @@ -13,12 +11,4 @@ public class CommonUtils { public long getMemberId(@NonNull Principal principal) { return Long.parseLong(principal.getName()); } - - public URI getURI(String path, long id) { - return ServletUriComponentsBuilder - .fromCurrentRequest() - .path(path) - .buildAndExpand(id) - .toUri(); - } } From da4df4cd8788c548fe375848e5b06ceff8a4e2a8 Mon Sep 17 00:00:00 2001 From: thguss Date: Mon, 5 Feb 2024 01:38:35 +0900 Subject: [PATCH 061/141] =?UTF-8?q?[FIX]=20=EC=BB=A4=EC=8A=A4=ED=85=80=20?= =?UTF-8?q?=EC=98=88=EC=99=B8=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/lecture/dto/request/LectureRequest.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/web/lecture/dto/request/LectureRequest.java b/operation-api/src/main/java/org/sopt/makers/operation/service/web/lecture/dto/request/LectureRequest.java index 09ae5b16..aec322b0 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/web/lecture/dto/request/LectureRequest.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/service/web/lecture/dto/request/LectureRequest.java @@ -1,11 +1,14 @@ package org.sopt.makers.operation.service.web.lecture.dto.request; +import static org.sopt.makers.operation.code.failure.LectureFailureCode.*; + import java.time.LocalDateTime; import java.time.format.DateTimeParseException; import org.sopt.makers.operation.domain.Part; -import org.operation.lecture.Attribute; -import org.operation.lecture.Lecture; +import org.sopt.makers.operation.domain.lecture.Attribute; +import org.sopt.makers.operation.domain.lecture.Lecture; +import org.sopt.makers.operation.exception.DateTimeParseCustomException; import lombok.Builder; import lombok.NonNull; @@ -33,7 +36,11 @@ public Lecture toEntity() { .build(); } - private LocalDateTime convertLocalDateTime(String date) throws DateTimeParseException { - return LocalDateTime.parse(date); + private LocalDateTime convertLocalDateTime(String date) { + try { + return LocalDateTime.parse(date); + } catch (DateTimeParseException exception) { + throw new DateTimeParseCustomException(INVALID_DATE_PATTERN, date, exception.getErrorIndex()); + } } } From ec41d2c35c0507d4f3e313bc2b55ddcdb721b9d7 Mon Sep 17 00:00:00 2001 From: thguss Date: Mon, 5 Feb 2024 13:17:23 +0900 Subject: [PATCH 062/141] =?UTF-8?q?[REFACTOR]=20=EC=95=8C=EB=A6=BC=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1=20=EA=B8=B0=EB=8A=A5=20=EB=A6=AC=ED=8C=A9?= =?UTF-8?q?=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operation/web/alarm/api/AlarmApi.java | 2 +- .../web/alarm/api/AlarmApiController.java | 2 +- .../web/alarm/dto/request}/AlarmRequest.java | 14 ++++- .../web/alarm/service/AlarmService.java | 4 +- .../web/alarm/service/AlarmServiceImpl.java | 4 +- .../operation/domain/alarm/domain/Alarm.java | 51 +++++++++++++------ 6 files changed, 53 insertions(+), 24 deletions(-) rename {operation-domain/src/main/java/org/sopt/makers/operation/dto => operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/request}/AlarmRequest.java (54%) diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/api/AlarmApi.java b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/api/AlarmApi.java index 60197b12..c32b3f78 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/api/AlarmApi.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/api/AlarmApi.java @@ -3,7 +3,7 @@ import org.sopt.makers.operation.domain.Part; import org.sopt.makers.operation.common.dto.BaseResponse; import org.sopt.makers.operation.domain.alarm.domain.Status; -import org.sopt.makers.operation.dto.AlarmRequest; +import org.sopt.makers.operation.web.alarm.dto.request.AlarmRequest; import org.sopt.makers.operation.web.alarm.dto.request.AlarmSendRequest; import org.springframework.data.domain.Pageable; import org.springframework.http.ResponseEntity; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/api/AlarmApiController.java b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/api/AlarmApiController.java index ecf63437..23ed799b 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/api/AlarmApiController.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/api/AlarmApiController.java @@ -6,7 +6,7 @@ import org.sopt.makers.operation.common.dto.BaseResponse; import org.sopt.makers.operation.common.util.ApiResponseUtil; import org.sopt.makers.operation.domain.alarm.domain.Status; -import org.sopt.makers.operation.dto.AlarmRequest; +import org.sopt.makers.operation.web.alarm.dto.request.AlarmRequest; import org.sopt.makers.operation.web.alarm.dto.request.AlarmSendRequest; import org.sopt.makers.operation.web.alarm.service.AlarmService; import org.springframework.data.domain.Pageable; diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/dto/AlarmRequest.java b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/request/AlarmRequest.java similarity index 54% rename from operation-domain/src/main/java/org/sopt/makers/operation/dto/AlarmRequest.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/request/AlarmRequest.java index 084aa24d..cd468d78 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/dto/AlarmRequest.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/request/AlarmRequest.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.dto; +package org.sopt.makers.operation.web.alarm.dto.request; import java.util.List; @@ -18,6 +18,16 @@ public record AlarmRequest( List targetList ) { public Alarm toEntity() { - return new Alarm(this); + return Alarm.builder() + .generation(this.generation) + .generationAt(this.generationAt) + .attribute(this.attribute) + .title(this.title) + .content(this.content) + .link(this.link) + .isActive(this.isActive) + .part(this.part) + .targetList(this.targetList) + .build(); } } diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/service/AlarmService.java b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/service/AlarmService.java index 54153e2b..e81c537c 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/service/AlarmService.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/service/AlarmService.java @@ -2,7 +2,7 @@ import org.sopt.makers.operation.domain.Part; import org.sopt.makers.operation.domain.alarm.domain.Status; -import org.sopt.makers.operation.dto.AlarmRequest; +import org.sopt.makers.operation.web.alarm.dto.request.AlarmRequest; import org.sopt.makers.operation.web.alarm.dto.request.AlarmSendRequest; import org.sopt.makers.operation.web.alarm.dto.response.AlarmResponse; import org.sopt.makers.operation.web.alarm.dto.response.AlarmsResponse; @@ -10,7 +10,7 @@ public interface AlarmService { void sendByAdmin(AlarmSendRequest request); - Long createAlarm(AlarmRequest requestDTO); + long createAlarm(AlarmRequest requestDTO); AlarmsResponse getAlarms(Integer generation, Part part, Status status, Pageable pageable); AlarmResponse getAlarm(long alarmId); void deleteAlarm(Long alarmId); diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/service/AlarmServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/service/AlarmServiceImpl.java index 9ae5b31d..2797a941 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/service/AlarmServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/service/AlarmServiceImpl.java @@ -14,7 +14,7 @@ import org.sopt.makers.operation.domain.alarm.domain.Status; import org.sopt.makers.operation.domain.alarm.repository.AlarmRepository; import org.sopt.makers.operation.domain.member.repository.MemberRepository; -import org.sopt.makers.operation.dto.AlarmRequest; +import org.sopt.makers.operation.web.alarm.dto.request.AlarmRequest; import org.sopt.makers.operation.exception.AlarmException; import org.sopt.makers.operation.web.alarm.dto.request.AlarmSendRequest; import org.sopt.makers.operation.web.alarm.dto.response.AlarmResponse; @@ -109,7 +109,7 @@ private void sendAlarmToTargets(Alarm alarm, List targetIdList) { @Override @Transactional - public Long createAlarm(AlarmRequest request) { + public long createAlarm(AlarmRequest request) { val alarmEntity = request.toEntity(); val savedAlarm = alarmRepository.save(alarmEntity); return savedAlarm.getId(); diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/domain/alarm/domain/Alarm.java b/operation-domain/src/main/java/org/sopt/makers/operation/domain/alarm/domain/Alarm.java index bea80b75..898eb576 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/domain/alarm/domain/Alarm.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/domain/alarm/domain/Alarm.java @@ -19,8 +19,8 @@ import org.sopt.makers.operation.domain.BaseEntity; import org.sopt.makers.operation.domain.Part; import org.sopt.makers.operation.domain.converter.StringListConverter; -import org.sopt.makers.operation.dto.AlarmRequest; +import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; @@ -63,23 +63,42 @@ public class Alarm extends BaseEntity { private LocalDateTime sendAt; - public Alarm(AlarmRequest request) { - this.generation = request.generation(); - this.generationAt = request.generationAt(); - this.attribute = request.attribute(); - this.title = request.title(); - this.content = request.content(); - if (nonNull(request.link())) { - this.link = request.link(); - } - if (nonNull(request.isActive())) { - this.isActive = request.isActive(); + @Builder + public Alarm( + int generation, + int generationAt, + Attribute attribute, + String title, + String content, + String link, + Boolean isActive, + Part part, + List targetList + ) { + this.generation = generation; + this.generationAt = generationAt; + this.attribute = attribute; + this.title = title; + this.content = content; + setLink(link); + setTargetsInfo(isActive, part, targetList); + this.status = BEFORE; + } + + private void setLink(String link) { + if (nonNull(link)) { + this.link = link; } - if (nonNull(request.part())) { - this.part = request.part(); + } + + private void setTargetsInfo(Boolean isActive, Part part, List targetList) { + if (nonNull(targetList)) { + this.targetList = targetList; + } else { + this.isActive = isActive; + this.part = part; + this.targetList = new ArrayList<>(); } - this.targetList = nonNull(request.targetList()) ? request.targetList() : new ArrayList<>(); - this.status = BEFORE; } public boolean isSent() { From 862ac49b2c04edbe6b97ab67995dce08bdfcc90e Mon Sep 17 00:00:00 2001 From: thguss Date: Mon, 5 Feb 2024 13:28:43 +0900 Subject: [PATCH 063/141] =?UTF-8?q?[REFACTOR]=20=EC=95=8C=EB=A6=BC=20?= =?UTF-8?q?=EB=A6=AC=EC=8A=A4=ED=8A=B8=20=EC=A1=B0=ED=9A=8C=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=20=EB=A6=AC=ED=8C=A9=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alarm/dto/response/AlarmsResponse.java | 41 -------------- .../alarm/dto/response/AlarmListResponse.java | 54 +++++++++++++++++++ .../web/alarm/service/AlarmService.java | 4 +- .../repository/AlarmCustomRepository.java | 4 +- .../alarm/repository/AlarmRepositoryImpl.java | 4 +- 5 files changed, 60 insertions(+), 47 deletions(-) delete mode 100644 operation-api/src/main/java/org/sopt/makers/operation/service/web/alarm/dto/response/AlarmsResponse.java create mode 100644 operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/response/AlarmListResponse.java diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/web/alarm/dto/response/AlarmsResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/service/web/alarm/dto/response/AlarmsResponse.java deleted file mode 100644 index 01e49edb..00000000 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/web/alarm/dto/response/AlarmsResponse.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.sopt.makers.operation.service.web.alarm.dto.response; - -import static java.util.Objects.*; - -import java.util.List; - -import org.operation.alarm.domain.Alarm; - -import lombok.Builder; - -public record AlarmsResponse( - List alarms, - int totalCount -) { - public static AlarmsResponse of(List alarms, int totalCount) { - return new AlarmsResponse(alarms.stream().map(AlarmVO::of).toList(), totalCount); - } - - @Builder - record AlarmVO( - Long alarmId, - String part, - String attribute, - String title, - String content, - String sendAt, - String status - ) { - static AlarmVO of(Alarm alarm) { - return AlarmVO.builder() - .alarmId(alarm.getId()) - .part(nonNull(alarm.getPart()) ? alarm.getPart().getName() : null) - .attribute(alarm.getAttribute().getName()) - .title(alarm.getTitle()) - .content(alarm.getContent()) - .sendAt(nonNull(alarm.getSendAt()) ? alarm.getSendAt().toString() : null) - .status(alarm.getStatus().getName()) - .build(); - } - } -} diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/response/AlarmListResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/response/AlarmListResponse.java new file mode 100644 index 00000000..2c59a91e --- /dev/null +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/response/AlarmListResponse.java @@ -0,0 +1,54 @@ +package org.sopt.makers.operation.web.alarm.dto.response; + +import static java.util.Objects.*; + +import java.util.List; + +import org.sopt.makers.operation.domain.alarm.domain.Alarm; + +import lombok.AccessLevel; +import lombok.Builder; + +@Builder(access = AccessLevel.PRIVATE) +public record AlarmListResponse( + List alarms, + int totalCount +) { + public static AlarmListResponse of(List alarmList, int totalCount) { + return AlarmListResponse.builder() + .alarms(alarmList.stream().map(AlarmVO::of).toList()) + .totalCount(totalCount) + .build(); + } + + @Builder + private record AlarmVO( + long alarmId, + String part, + String attribute, + String title, + String content, + String sendAt, + String status + ) { + private static AlarmVO of(Alarm alarm) { + return AlarmVO.builder() + .alarmId(alarm.getId()) + .part(getPartName(alarm)) + .attribute(alarm.getAttribute().getName()) + .title(alarm.getTitle()) + .content(alarm.getContent()) + .sendAt(getSendAt(alarm)) + .status(alarm.getStatus().getName()) + .build(); + } + + private static String getPartName(Alarm alarm) { + return nonNull(alarm.getPart()) ? alarm.getPart().getName() : null; + } + + private static String getSendAt(Alarm alarm) { + return nonNull(alarm.getSendAt()) ? alarm.getSendAt().toString() : null; + } + } +} diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/service/AlarmService.java b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/service/AlarmService.java index e81c537c..c0e1de0f 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/service/AlarmService.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/service/AlarmService.java @@ -5,13 +5,13 @@ import org.sopt.makers.operation.web.alarm.dto.request.AlarmRequest; import org.sopt.makers.operation.web.alarm.dto.request.AlarmSendRequest; import org.sopt.makers.operation.web.alarm.dto.response.AlarmResponse; -import org.sopt.makers.operation.web.alarm.dto.response.AlarmsResponse; +import org.sopt.makers.operation.web.alarm.dto.response.AlarmListResponse; import org.springframework.data.domain.Pageable; public interface AlarmService { void sendByAdmin(AlarmSendRequest request); long createAlarm(AlarmRequest requestDTO); - AlarmsResponse getAlarms(Integer generation, Part part, Status status, Pageable pageable); + AlarmListResponse getAlarms(Integer generation, Part part, Status status, Pageable pageable); AlarmResponse getAlarm(long alarmId); void deleteAlarm(Long alarmId); } diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/domain/alarm/repository/AlarmCustomRepository.java b/operation-domain/src/main/java/org/sopt/makers/operation/domain/alarm/repository/AlarmCustomRepository.java index 59216a41..871e8717 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/domain/alarm/repository/AlarmCustomRepository.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/domain/alarm/repository/AlarmCustomRepository.java @@ -8,6 +8,6 @@ import org.springframework.data.domain.Pageable; public interface AlarmCustomRepository { - List getAlarms(Integer generation, Part part, Status status, Pageable pageable); - int countByGenerationAndPartAndStatus(int generation, Part part, Status status); + List findOrderByCreatedDate(Integer generation, Part part, Status status, Pageable pageable); + int count(int generation, Part part, Status status); } diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/domain/alarm/repository/AlarmRepositoryImpl.java b/operation-domain/src/main/java/org/sopt/makers/operation/domain/alarm/repository/AlarmRepositoryImpl.java index d03663d7..54651679 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/domain/alarm/repository/AlarmRepositoryImpl.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/domain/alarm/repository/AlarmRepositoryImpl.java @@ -22,7 +22,7 @@ public class AlarmRepositoryImpl implements AlarmCustomRepository { private final JPAQueryFactory queryFactory; @Override - public List getAlarms(Integer generation, Part part, Status status, Pageable pageable) { + public List findOrderByCreatedDate(Integer generation, Part part, Status status, Pageable pageable) { return queryFactory .selectFrom(alarm) .where( @@ -37,7 +37,7 @@ public List getAlarms(Integer generation, Part part, Status status, Pagea } @Override - public int countByGenerationAndPartAndStatus(int generation, Part part, Status status) { + public int count(int generation, Part part, Status status) { return Math.toIntExact(queryFactory .select(alarm.count()) .from(alarm) From c1d35a1fed7518f5361742b9fa8c13faadb17578 Mon Sep 17 00:00:00 2001 From: thguss Date: Mon, 5 Feb 2024 13:33:27 +0900 Subject: [PATCH 064/141] =?UTF-8?q?[REFACTOR]=20=EC=95=8C=EB=A6=BC=20?= =?UTF-8?q?=EB=8B=A8=EA=B1=B4=EC=A1=B0=ED=9A=8C=20=EA=B8=B0=EB=8A=A5=20?= =?UTF-8?q?=EB=A6=AC=ED=8C=A9=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alarm/dto/response/AlarmListResponse.java | 14 ++++++++------ .../web/alarm/dto/response/AlarmResponse.java | 19 +++++++++++++++---- .../web/alarm/service/AlarmServiceImpl.java | 10 +++++----- 3 files changed, 28 insertions(+), 15 deletions(-) rename operation-api/src/main/java/org/sopt/makers/operation/{service => }/web/alarm/dto/response/AlarmResponse.java (52%) diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/response/AlarmListResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/response/AlarmListResponse.java index 2c59a91e..17251584 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/response/AlarmListResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/response/AlarmListResponse.java @@ -2,8 +2,10 @@ import static java.util.Objects.*; +import java.time.LocalDateTime; import java.util.List; +import org.sopt.makers.operation.domain.Part; import org.sopt.makers.operation.domain.alarm.domain.Alarm; import lombok.AccessLevel; @@ -34,21 +36,21 @@ private record AlarmVO( private static AlarmVO of(Alarm alarm) { return AlarmVO.builder() .alarmId(alarm.getId()) - .part(getPartName(alarm)) + .part(getPartName(alarm.getPart())) .attribute(alarm.getAttribute().getName()) .title(alarm.getTitle()) .content(alarm.getContent()) - .sendAt(getSendAt(alarm)) + .sendAt(getSendAt(alarm.getSendAt())) .status(alarm.getStatus().getName()) .build(); } - private static String getPartName(Alarm alarm) { - return nonNull(alarm.getPart()) ? alarm.getPart().getName() : null; + private static String getPartName(Part part) { + return nonNull(part) ? part.getName() : null; } - private static String getSendAt(Alarm alarm) { - return nonNull(alarm.getSendAt()) ? alarm.getSendAt().toString() : null; + private static String getSendAt(LocalDateTime sendAt) { + return nonNull(sendAt) ? sendAt.toString() : null; } } } diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/web/alarm/dto/response/AlarmResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/response/AlarmResponse.java similarity index 52% rename from operation-api/src/main/java/org/sopt/makers/operation/service/web/alarm/dto/response/AlarmResponse.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/response/AlarmResponse.java index 2dfc63ec..51ad6b8d 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/web/alarm/dto/response/AlarmResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/response/AlarmResponse.java @@ -1,8 +1,11 @@ -package org.sopt.makers.operation.service.web.alarm.dto.response; +package org.sopt.makers.operation.web.alarm.dto.response; import static java.util.Objects.*; -import org.operation.alarm.domain.Alarm; +import java.time.LocalDateTime; + +import org.sopt.makers.operation.domain.Part; +import org.sopt.makers.operation.domain.alarm.domain.Alarm; import lombok.Builder; @@ -20,13 +23,21 @@ public record AlarmResponse( public static AlarmResponse of(Alarm alarm) { return AlarmResponse.builder() .attribute(alarm.getAttribute().getName()) - .part(nonNull(alarm.getPart()) ? alarm.getPart().getName() : null) + .part(getPartName(alarm.getPart())) .isActive(alarm.getIsActive()) .title(alarm.getTitle()) .content(alarm.getContent()) .link(alarm.getLink()) .createdAt(alarm.getCreatedDate().toString()) - .sendAt(nonNull(alarm.getSendAt()) ? alarm.getSendAt().toString() : null) + .sendAt(getSendAt(alarm.getSendAt())) .build(); } + + private static String getPartName(Part part) { + return nonNull(part) ? part.getName() : null; + } + + private static String getSendAt(LocalDateTime sendAt) { + return nonNull(sendAt) ? sendAt.toString() : null; + } } diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/service/AlarmServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/service/AlarmServiceImpl.java index 2797a941..ce28224b 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/service/AlarmServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/service/AlarmServiceImpl.java @@ -18,7 +18,7 @@ import org.sopt.makers.operation.exception.AlarmException; import org.sopt.makers.operation.web.alarm.dto.request.AlarmSendRequest; import org.sopt.makers.operation.web.alarm.dto.response.AlarmResponse; -import org.sopt.makers.operation.web.alarm.dto.response.AlarmsResponse; +import org.sopt.makers.operation.web.alarm.dto.response.AlarmListResponse; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -116,10 +116,10 @@ public long createAlarm(AlarmRequest request) { } @Override - public AlarmsResponse getAlarms(Integer generation, Part part, Status status, Pageable pageable) { - val alarms = alarmRepository.getAlarms(generation, part, status, pageable); - val alarmsCount = alarmRepository.countByGenerationAndPartAndStatus(generation, part, status); - return AlarmsResponse.of(alarms, alarmsCount); + public AlarmListResponse getAlarms(Integer generation, Part part, Status status, Pageable pageable) { + val alarmList = alarmRepository.findOrderByCreatedDate(generation, part, status, pageable); + val totalCount = alarmRepository.count(generation, part, status); + return AlarmListResponse.of(alarmList, totalCount); } @Override From 2ac752c201c2eb761387c3b7b2b56cd786f86b5d Mon Sep 17 00:00:00 2001 From: thguss Date: Mon, 5 Feb 2024 13:34:32 +0900 Subject: [PATCH 065/141] =?UTF-8?q?[REFACTOR]=20=EC=95=8C=EB=A6=BC=20?= =?UTF-8?q?=EC=82=AD=EC=A0=9C=20=EA=B8=B0=EB=8A=A5=20=EB=A6=AC=ED=8C=A9?= =?UTF-8?q?=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sopt/makers/operation/web/alarm/service/AlarmService.java | 2 +- .../makers/operation/web/alarm/service/AlarmServiceImpl.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/service/AlarmService.java b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/service/AlarmService.java index c0e1de0f..7a6c573d 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/service/AlarmService.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/service/AlarmService.java @@ -13,5 +13,5 @@ public interface AlarmService { long createAlarm(AlarmRequest requestDTO); AlarmListResponse getAlarms(Integer generation, Part part, Status status, Pageable pageable); AlarmResponse getAlarm(long alarmId); - void deleteAlarm(Long alarmId); + void deleteAlarm(long alarmId); } diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/service/AlarmServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/service/AlarmServiceImpl.java index ce28224b..cdddeeaf 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/service/AlarmServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/service/AlarmServiceImpl.java @@ -130,7 +130,7 @@ public AlarmResponse getAlarm(long alarmId) { @Override @Transactional - public void deleteAlarm(Long alarmId) { + public void deleteAlarm(long alarmId) { val alarm = findAlarm(alarmId); alarmRepository.delete(alarm); } From 40557b85a55174b4a088bcf4e95e60160a17c006 Mon Sep 17 00:00:00 2001 From: thguss Date: Mon, 5 Feb 2024 13:37:44 +0900 Subject: [PATCH 066/141] =?UTF-8?q?[DELETE]=20=ED=81=B4=EB=9E=98=EC=8A=A4?= =?UTF-8?q?=20=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/alarm/dto/response/AlarmInactiveListResponse.java | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/response/AlarmInactiveListResponse.java diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/response/AlarmInactiveListResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/response/AlarmInactiveListResponse.java deleted file mode 100644 index da930125..00000000 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/response/AlarmInactiveListResponse.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.sopt.makers.operation.web.alarm.dto.response; - -import java.util.List; - -public record AlarmInactiveListResponse( - List memberIds -) { -} From e3557896f5ce5f6a9e34145d2a385d7b853527f5 Mon Sep 17 00:00:00 2001 From: thguss Date: Mon, 5 Feb 2024 13:38:28 +0900 Subject: [PATCH 067/141] =?UTF-8?q?[DELETE]=20=ED=81=B4=EB=9E=98=EC=8A=A4?= =?UTF-8?q?=20=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/alarm/message/SuccessMessage.java | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 operation-api/src/main/java/org/sopt/makers/operation/web/alarm/message/SuccessMessage.java diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/message/SuccessMessage.java b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/message/SuccessMessage.java deleted file mode 100644 index f343d905..00000000 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/message/SuccessMessage.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.sopt.makers.operation.web.alarm.message; - -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -@Getter -@RequiredArgsConstructor -public enum SuccessMessage { - SUCCESS_SEND_ALARM("알림 전송 성공"), - SUCCESS_CREATE_ALARM("알림 생성 성공"), - SUCCESS_GET_ALARMS("알림 리스트 조회 성공"), - SUCCESS_GET_ALARM("알림 상세 조회 성공"), - SUCCESS_DELETE_ALARM("알림 삭제 성공"), - ; - - private final String content; -} From fc8689362e3c6f21f744d45d3138fbc27711ed80 Mon Sep 17 00:00:00 2001 From: thguss Date: Mon, 5 Feb 2024 13:41:40 +0900 Subject: [PATCH 068/141] =?UTF-8?q?[DELETE]=20=ED=81=B4=EB=9E=98=EC=8A=A4?= =?UTF-8?q?=20=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operation/dto/AlarmSenderRequest.java | 24 ------------------- .../client/alarm/AlarmSenderImpl.java | 6 ++--- 2 files changed, 3 insertions(+), 27 deletions(-) delete mode 100644 operation-common/src/main/java/org/sopt/makers/operation/dto/AlarmSenderRequest.java diff --git a/operation-common/src/main/java/org/sopt/makers/operation/dto/AlarmSenderRequest.java b/operation-common/src/main/java/org/sopt/makers/operation/dto/AlarmSenderRequest.java deleted file mode 100644 index de60a8f8..00000000 --- a/operation-common/src/main/java/org/sopt/makers/operation/dto/AlarmSenderRequest.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.sopt.makers.operation.dto; - -import java.util.List; - -import lombok.Builder; - -@Builder -public record AlarmSenderRequest( - String title, - String content, - List targetList, - Attribute attribute, - String link -) { - public static AlarmSenderRequest of (Alarm alarm, List targetList) { - return builder() - .title(alarm.getTitle()) - .content(alarm.getContent()) - .targetList(targetList) - .attribute(alarm.getAttribute()) - .link(alarm.getLink()) - .build(); - } -} diff --git a/operation-external/src/main/java/org/sopt/makers/operation/client/alarm/AlarmSenderImpl.java b/operation-external/src/main/java/org/sopt/makers/operation/client/alarm/AlarmSenderImpl.java index 6b7e29ac..8f3e59f4 100644 --- a/operation-external/src/main/java/org/sopt/makers/operation/client/alarm/AlarmSenderImpl.java +++ b/operation-external/src/main/java/org/sopt/makers/operation/client/alarm/AlarmSenderImpl.java @@ -2,15 +2,15 @@ import static java.util.Objects.*; import static java.util.UUID.*; -import static org.sopt.makers.operation.domain.alarm.message.ErrorMessage.*; +import static org.sopt.makers.operation.code.failure.AlarmFailureCode.*; import static org.springframework.http.MediaType.*; import java.util.Collections; import java.util.HashMap; import java.util.Map; +import org.sopt.makers.operation.client.alarm.dto.AlarmSenderRequest; import org.sopt.makers.operation.config.ValueConfig; -import org.sopt.makers.operation.dto.AlarmSenderRequest; import org.sopt.makers.operation.exception.AlarmException; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; @@ -35,7 +35,7 @@ public void send(AlarmSenderRequest request) { val entity = getEntity(request); restTemplate.postForEntity(host, entity, AlarmSenderRequest.class); } catch (HttpClientErrorException e) { - throw new AlarmException(FAIL_SEND_ALARM.getContent()); + throw new AlarmException(FAIL_SEND_ALARM); } } From 0eadf51d73c7a42701846e4b5995efeb41420b77 Mon Sep 17 00:00:00 2001 From: thguss Date: Mon, 5 Feb 2024 13:55:46 +0900 Subject: [PATCH 069/141] =?UTF-8?q?[FIX]=20Success=20Code=20=EB=B0=98?= =?UTF-8?q?=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../attendnace/api/AttendanceApiController.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/api/AttendanceApiController.java b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/api/AttendanceApiController.java index c3184936..90cf0774 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/api/AttendanceApiController.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/api/AttendanceApiController.java @@ -1,11 +1,11 @@ package org.sopt.makers.operation.web.attendnace.api; -import static org.sopt.makers.operation.web.attendnace.message.SuccessMessage.*; +import static org.sopt.makers.operation.code.success.web.AttendanceSuccessCode.*; import org.sopt.makers.operation.domain.Part; import org.sopt.makers.operation.common.dto.BaseResponse; import org.sopt.makers.operation.common.util.ApiResponseUtil; -import org.sopt.makers.operation.web.attendance.dto.request.SubAttendanceUpdateRequest; +import org.sopt.makers.operation.web.attendnace.dto.request.UpdatedSubAttendanceRequest; import org.sopt.makers.operation.web.attendnace.service.AttendanceService; import org.springframework.data.domain.Pageable; import org.springframework.http.ResponseEntity; @@ -29,23 +29,23 @@ public class AttendanceApiController implements AttendanceApi { @Override @PatchMapping - public ResponseEntity> updateSubAttendance(@RequestBody SubAttendanceUpdateRequest request) { + public ResponseEntity> updateSubAttendance(@RequestBody UpdatedSubAttendanceRequest request) { val response = attendanceService.updateSubAttendance(request); - return ApiResponseUtil.ok(SUCCESS_UPDATE_ATTENDANCE_STATUS.getContent(), response); + return ApiResponseUtil.success(SUCCESS_UPDATE_ATTENDANCE_STATUS, response); } @Override @GetMapping("/{memberId}") public ResponseEntity> findAttendancesByMember(@PathVariable long memberId) { val response = attendanceService.findAttendancesByMember(memberId); - return ApiResponseUtil.ok(SUCCESS_GET_MEMBER_ATTENDANCE.getContent(), response); + return ApiResponseUtil.success(SUCCESS_GET_MEMBER_ATTENDANCE, response); } @Override @PatchMapping("/member/{memberId}") public ResponseEntity> updateMemberScore(@PathVariable long memberId) { val response = attendanceService.updateMemberScore(memberId); - return ApiResponseUtil.ok(SUCCESS_UPDATE_MEMBER_SCORE.getContent(), response); + return ApiResponseUtil.success(SUCCESS_UPDATE_MEMBER_SCORE, response); } @Override @@ -56,6 +56,6 @@ public ResponseEntity> findAttendancesByLecture( Pageable pageable ) { val response = attendanceService.findAttendancesByLecture(lectureId, part, pageable); - return ApiResponseUtil.ok(SUCCESS_GET_ATTENDANCES.getContent(), response); + return ApiResponseUtil.success(SUCCESS_GET_ATTENDANCES, response); } } From 05353ef5f8dc51ccc752c474bcd14e9dd4f8a935 Mon Sep 17 00:00:00 2001 From: thguss Date: Mon, 5 Feb 2024 13:56:25 +0900 Subject: [PATCH 070/141] =?UTF-8?q?[FIX]=20Success=20Code=20=EB=B0=98?= =?UTF-8?q?=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../code/failure/AttendanceFailureCode.java | 19 ++++++++++++++++ .../success/web/AttendanceSuccessCode.java | 22 +++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 operation-common/src/main/java/org/sopt/makers/operation/code/failure/AttendanceFailureCode.java create mode 100644 operation-common/src/main/java/org/sopt/makers/operation/code/success/web/AttendanceSuccessCode.java diff --git a/operation-common/src/main/java/org/sopt/makers/operation/code/failure/AttendanceFailureCode.java b/operation-common/src/main/java/org/sopt/makers/operation/code/failure/AttendanceFailureCode.java new file mode 100644 index 00000000..d39fe3d1 --- /dev/null +++ b/operation-common/src/main/java/org/sopt/makers/operation/code/failure/AttendanceFailureCode.java @@ -0,0 +1,19 @@ +package org.sopt.makers.operation.code.failure; + +import static org.springframework.http.HttpStatus.*; + +import org.springframework.http.HttpStatus; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +@Getter +public enum AttendanceFailureCode implements FailureCode { + INVALID_ATTENDANCE(NOT_FOUND, "존재하지 않는 출석 세션입니다."), + INVALID_SUB_ATTENDANCE(NOT_FOUND, "존재하지 않는 N차 출석입니다."), + ; + + private final HttpStatus status; + private final String message; +} diff --git a/operation-common/src/main/java/org/sopt/makers/operation/code/success/web/AttendanceSuccessCode.java b/operation-common/src/main/java/org/sopt/makers/operation/code/success/web/AttendanceSuccessCode.java new file mode 100644 index 00000000..21c8e634 --- /dev/null +++ b/operation-common/src/main/java/org/sopt/makers/operation/code/success/web/AttendanceSuccessCode.java @@ -0,0 +1,22 @@ +package org.sopt.makers.operation.code.success.web; + +import static org.springframework.http.HttpStatus.*; + +import org.sopt.makers.operation.code.success.SuccessCode; +import org.springframework.http.HttpStatus; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +@Getter +public enum AttendanceSuccessCode implements SuccessCode { + SUCCESS_UPDATE_ATTENDANCE_STATUS(OK, "출석 상태 변경 성공"), + SUCCESS_GET_MEMBER_ATTENDANCE(OK, "회원 출석 정보 조회 성공"), + SUCCESS_UPDATE_MEMBER_SCORE(OK, "회원 출석 점수 갱신 성공"), + SUCCESS_GET_ATTENDANCES(OK, "출석 리스트 조회 성공"), + ; + + private final HttpStatus status; + private final String message; +} From e6caa792f4b1503c78e6c27af73e61f001a7883c Mon Sep 17 00:00:00 2001 From: thguss Date: Mon, 5 Feb 2024 13:57:00 +0900 Subject: [PATCH 071/141] =?UTF-8?q?[REFACTOR]=20DTO=20=ED=81=B4=EB=9E=98?= =?UTF-8?q?=EC=8A=A4=20=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../request/SubAttendanceUpdateRequest.java | 9 --------- .../dto/response/AttendancesResponse.java | 17 ---------------- .../response/SubAttendanceUpdateResponse.java | 13 ------------ .../web/attendnace/api/AttendanceApi.java | 4 ++-- .../request/UpdatedSubAttendanceRequest.java | 9 +++++++++ .../dto/response/AttendanceListResponse.java | 17 ++++++++++++++++ .../response/AttendanceMemberResponse.java | 8 ++++---- .../dto/response/MemberResponse.java | 10 +++++----- .../UpdatedSubAttendanceResponse.java | 20 +++++++++++++++++++ 9 files changed, 57 insertions(+), 50 deletions(-) delete mode 100644 operation-api/src/main/java/org/sopt/makers/operation/service/web/attendance/dto/request/SubAttendanceUpdateRequest.java delete mode 100644 operation-api/src/main/java/org/sopt/makers/operation/service/web/attendance/dto/response/AttendancesResponse.java delete mode 100644 operation-api/src/main/java/org/sopt/makers/operation/service/web/attendance/dto/response/SubAttendanceUpdateResponse.java create mode 100644 operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/request/UpdatedSubAttendanceRequest.java create mode 100644 operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/AttendanceListResponse.java rename operation-api/src/main/java/org/sopt/makers/operation/{service/web/attendance => web/attendnace}/dto/response/AttendanceMemberResponse.java (81%) rename operation-api/src/main/java/org/sopt/makers/operation/{service/web/attendance => web/attendnace}/dto/response/MemberResponse.java (74%) create mode 100644 operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/UpdatedSubAttendanceResponse.java diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/web/attendance/dto/request/SubAttendanceUpdateRequest.java b/operation-api/src/main/java/org/sopt/makers/operation/service/web/attendance/dto/request/SubAttendanceUpdateRequest.java deleted file mode 100644 index 0cadb355..00000000 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/web/attendance/dto/request/SubAttendanceUpdateRequest.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.sopt.makers.operation.service.web.attendance.dto.request; - -import org.operation.attendance.domain.AttendanceStatus; - -public record SubAttendanceUpdateRequest( - Long subAttendanceId, - AttendanceStatus status -) { -} diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/web/attendance/dto/response/AttendancesResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/service/web/attendance/dto/response/AttendancesResponse.java deleted file mode 100644 index d5c300fe..00000000 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/web/attendance/dto/response/AttendancesResponse.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.sopt.makers.operation.service.web.attendance.dto.response; - -import java.util.List; - -import org.operation.attendance.domain.Attendance; - -public record AttendancesResponse( - List attendances, - int totalCount -) { - - public static AttendancesResponse of(List attendances, int totalCount) { - return new AttendancesResponse( - attendances.stream().map(MemberResponse::of).toList(), - totalCount); - } -} diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/web/attendance/dto/response/SubAttendanceUpdateResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/service/web/attendance/dto/response/SubAttendanceUpdateResponse.java deleted file mode 100644 index f6fbc20c..00000000 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/web/attendance/dto/response/SubAttendanceUpdateResponse.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.sopt.makers.operation.service.web.attendance.dto.response; - -import org.operation.attendance.domain.AttendanceStatus; -import org.operation.attendance.domain.SubAttendance; - -public record SubAttendanceUpdateResponse( - Long subAttendanceId, - AttendanceStatus status -) { - public static SubAttendanceUpdateResponse of(SubAttendance subAttendance) { - return new SubAttendanceUpdateResponse(subAttendance.getId(), subAttendance.getStatus()); - } -} diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/api/AttendanceApi.java b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/api/AttendanceApi.java index 2be56092..2e7562f7 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/api/AttendanceApi.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/api/AttendanceApi.java @@ -2,7 +2,7 @@ import org.sopt.makers.operation.domain.Part; import org.sopt.makers.operation.common.dto.BaseResponse; -import org.sopt.makers.operation.web.attendance.dto.request.SubAttendanceUpdateRequest; +import org.sopt.makers.operation.web.attendnace.dto.request.UpdatedSubAttendanceRequest; import org.springframework.data.domain.Pageable; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PathVariable; @@ -31,7 +31,7 @@ public interface AttendanceApi { ) } ) - ResponseEntity> updateSubAttendance(@RequestBody SubAttendanceUpdateRequest request); + ResponseEntity> updateSubAttendance(@RequestBody UpdatedSubAttendanceRequest request); @Operation( summary = "회원별 출석 정보 조회 API", diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/request/UpdatedSubAttendanceRequest.java b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/request/UpdatedSubAttendanceRequest.java new file mode 100644 index 00000000..be35babd --- /dev/null +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/request/UpdatedSubAttendanceRequest.java @@ -0,0 +1,9 @@ +package org.sopt.makers.operation.web.attendnace.dto.request; + +import org.sopt.makers.operation.domain.attendance.domain.AttendanceStatus; + +public record UpdatedSubAttendanceRequest( + long subAttendanceId, + AttendanceStatus status +) { +} diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/AttendanceListResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/AttendanceListResponse.java new file mode 100644 index 00000000..88859c5d --- /dev/null +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/AttendanceListResponse.java @@ -0,0 +1,17 @@ +package org.sopt.makers.operation.web.attendnace.dto.response; + +import java.util.List; + +import org.sopt.makers.operation.domain.attendance.domain.Attendance; + +public record AttendanceListResponse( + List attendances, + int totalCount +) { + + public static AttendanceListResponse of(List attendances, int totalCount) { + return new AttendanceListResponse( + attendances.stream().map(MemberResponse::of).toList(), + totalCount); + } +} diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/web/attendance/dto/response/AttendanceMemberResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/AttendanceMemberResponse.java similarity index 81% rename from operation-api/src/main/java/org/sopt/makers/operation/service/web/attendance/dto/response/AttendanceMemberResponse.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/AttendanceMemberResponse.java index 13f365b6..09194949 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/web/attendance/dto/response/AttendanceMemberResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/AttendanceMemberResponse.java @@ -1,10 +1,10 @@ -package org.sopt.makers.operation.service.web.attendance.dto.response; +package org.sopt.makers.operation.web.attendnace.dto.response; import java.util.List; -import org.operation.attendance.domain.Attendance; -import org.operation.attendance.domain.SubAttendance; -import org.operation.member.domain.Member; +import org.sopt.makers.operation.domain.attendance.domain.Attendance; +import org.sopt.makers.operation.domain.attendance.domain.SubAttendance; +import org.sopt.makers.operation.domain.member.domain.Member; public record AttendanceMemberResponse( String name, diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/web/attendance/dto/response/MemberResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/MemberResponse.java similarity index 74% rename from operation-api/src/main/java/org/sopt/makers/operation/service/web/attendance/dto/response/MemberResponse.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/MemberResponse.java index 04ba446a..0aa76f7e 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/web/attendance/dto/response/MemberResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/MemberResponse.java @@ -1,11 +1,11 @@ -package org.sopt.makers.operation.service.web.attendance.dto.response; +package org.sopt.makers.operation.web.attendnace.dto.response; import java.util.List; -import org.operation.attendance.domain.Attendance; -import org.operation.attendance.domain.AttendanceStatus; -import org.operation.attendance.domain.SubAttendance; -import org.operation.member.domain.Member; +import org.sopt.makers.operation.domain.attendance.domain.Attendance; +import org.sopt.makers.operation.domain.attendance.domain.AttendanceStatus; +import org.sopt.makers.operation.domain.attendance.domain.SubAttendance; +import org.sopt.makers.operation.domain.member.domain.Member; public record MemberResponse( Long attendanceId, diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/UpdatedSubAttendanceResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/UpdatedSubAttendanceResponse.java new file mode 100644 index 00000000..6ce177d2 --- /dev/null +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/UpdatedSubAttendanceResponse.java @@ -0,0 +1,20 @@ +package org.sopt.makers.operation.web.attendnace.dto.response; + +import org.sopt.makers.operation.domain.attendance.domain.AttendanceStatus; +import org.sopt.makers.operation.domain.attendance.domain.SubAttendance; + +import lombok.AccessLevel; +import lombok.Builder; + +@Builder(access = AccessLevel.PRIVATE) +public record UpdatedSubAttendanceResponse( + long subAttendanceId, + AttendanceStatus status +) { + public static UpdatedSubAttendanceResponse of(SubAttendance subAttendance) { + return UpdatedSubAttendanceResponse.builder() + .subAttendanceId(subAttendance.getId()) + .status(subAttendance.getStatus()) + .build(); + } +} From e4ea96d778a539c6d4883041fd3b795cd71d9419 Mon Sep 17 00:00:00 2001 From: thguss Date: Mon, 5 Feb 2024 13:57:13 +0900 Subject: [PATCH 072/141] =?UTF-8?q?[DELETE]=20=ED=81=B4=EB=9E=98=EC=8A=A4?= =?UTF-8?q?=20=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/attendnace/message/SuccessMessage.java | 16 ---------------- .../domain/attendance/message/ErrorMessage.java | 14 -------------- 2 files changed, 30 deletions(-) delete mode 100644 operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/message/SuccessMessage.java delete mode 100644 operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/message/ErrorMessage.java diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/message/SuccessMessage.java b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/message/SuccessMessage.java deleted file mode 100644 index 128a4e1f..00000000 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/message/SuccessMessage.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.sopt.makers.operation.web.attendnace.message; - -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -@Getter -@RequiredArgsConstructor -public enum SuccessMessage { - SUCCESS_UPDATE_ATTENDANCE_STATUS("출석 상태 변경 성공"), - SUCCESS_GET_MEMBER_ATTENDANCE("회원 출석 정보 조회 성공"), - SUCCESS_UPDATE_MEMBER_SCORE("회원 출석 점수 갱신 성공"), - SUCCESS_GET_ATTENDANCES("출석 리스트 조회 성공"), - ; - - private final String content; -} diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/message/ErrorMessage.java b/operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/message/ErrorMessage.java deleted file mode 100644 index 1f99f645..00000000 --- a/operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/message/ErrorMessage.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.sopt.makers.operation.domain.attendance.message; - -import lombok.AllArgsConstructor; -import lombok.Getter; - -@AllArgsConstructor -@Getter -public enum ErrorMessage { - INVALID_ATTENDANCE("존재하지 않는 출석 세션입니다."), - INVALID_SUB_ATTENDANCE("존재하지 않는 N차 출석입니다."), - ; - - private final String content; -} From 049da3b464e83f594404d041360644df091698a1 Mon Sep 17 00:00:00 2001 From: thguss Date: Mon, 5 Feb 2024 13:57:33 +0900 Subject: [PATCH 073/141] =?UTF-8?q?[FIX]=20DTO=20=ED=81=B4=EB=9E=98?= =?UTF-8?q?=EC=8A=A4=20=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/attendnace/service/AttendanceService.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/service/AttendanceService.java b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/service/AttendanceService.java index 2506df51..86c3c093 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/service/AttendanceService.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/service/AttendanceService.java @@ -1,15 +1,15 @@ package org.sopt.makers.operation.web.attendnace.service; import org.sopt.makers.operation.domain.Part; -import org.sopt.makers.operation.web.attendance.dto.request.SubAttendanceUpdateRequest; -import org.sopt.makers.operation.web.attendance.dto.response.AttendanceMemberResponse; -import org.sopt.makers.operation.web.attendance.dto.response.AttendancesResponse; -import org.sopt.makers.operation.web.attendance.dto.response.SubAttendanceUpdateResponse; +import org.sopt.makers.operation.web.attendnace.dto.request.UpdatedSubAttendanceRequest; +import org.sopt.makers.operation.web.attendnace.dto.response.AttendanceListResponse; +import org.sopt.makers.operation.web.attendnace.dto.response.AttendanceMemberResponse; +import org.sopt.makers.operation.web.attendnace.dto.response.UpdatedSubAttendanceResponse; import org.springframework.data.domain.Pageable; public interface AttendanceService { - SubAttendanceUpdateResponse updateSubAttendance(SubAttendanceUpdateRequest request); + UpdatedSubAttendanceResponse updateSubAttendance(UpdatedSubAttendanceRequest request); AttendanceMemberResponse findAttendancesByMember(long memberId); float updateMemberScore(Long memberId); - AttendancesResponse findAttendancesByLecture(long lectureId, Part part, Pageable pageable); + AttendanceListResponse findAttendancesByLecture(long lectureId, Part part, Pageable pageable); } From e29aa392390b924f83bdd4be5d9ce61de61a32cb Mon Sep 17 00:00:00 2001 From: thguss Date: Mon, 5 Feb 2024 13:58:14 +0900 Subject: [PATCH 074/141] =?UTF-8?q?[REFACTOR]=20=EC=84=9C=EB=B8=8C=20?= =?UTF-8?q?=EC=B6=9C=EC=84=9D=20=EC=A0=95=EB=B3=B4=20=EC=97=85=EB=8D=B0?= =?UTF-8?q?=EC=9D=B4=ED=8A=B8=20=EA=B8=B0=EB=8A=A5=20=EB=A6=AC=ED=8C=A9?= =?UTF-8?q?=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/AttendanceServiceImpl.java | 40 +++++++++---------- 1 file changed, 18 insertions(+), 22 deletions(-) rename operation-api/src/main/java/org/sopt/makers/operation/{service/web/attendance => web/attendnace}/service/AttendanceServiceImpl.java (52%) diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/web/attendance/service/AttendanceServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/service/AttendanceServiceImpl.java similarity index 52% rename from operation-api/src/main/java/org/sopt/makers/operation/service/web/attendance/service/AttendanceServiceImpl.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/service/AttendanceServiceImpl.java index 8682435a..56ff9a82 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/web/attendance/service/AttendanceServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/service/AttendanceServiceImpl.java @@ -1,21 +1,17 @@ -package org.sopt.makers.operation.service.web.attendance.service; +package org.sopt.makers.operation.web.attendnace.service; -import static org.operation.attendance.message.ErrorMessage.*; -import static org.operation.member.message.ErrorMessage.*; +import static org.sopt.makers.operation.code.failure.AttendanceFailureCode.*; -import org.operation.attendance.domain.SubAttendance; -import org.operation.attendance.repository.attendance.AttendanceRepository; -import org.operation.attendance.repository.subAttendance.SubAttendanceRepository; import org.sopt.makers.operation.domain.Part; -import org.sopt.makers.operation.common.exception.LectureException; -import org.sopt.makers.operation.common.exception.MemberException; -import org.operation.member.domain.Member; -import org.operation.member.repository.MemberRepository; -import org.sopt.makers.operation.service.web.attendance.dto.request.SubAttendanceUpdateRequest; -import org.sopt.makers.operation.service.web.attendance.dto.response.AttendanceMemberResponse; -import org.sopt.makers.operation.service.web.attendance.dto.response.AttendancesResponse; -import org.sopt.makers.operation.service.web.attendance.dto.response.SubAttendanceUpdateResponse; -import org.sopt.makers.operation.web.attendnace.service.AttendanceService; +import org.sopt.makers.operation.domain.attendance.domain.SubAttendance; +import org.sopt.makers.operation.domain.attendance.repository.attendance.AttendanceRepository; +import org.sopt.makers.operation.domain.attendance.repository.subAttendance.SubAttendanceRepository; +import org.sopt.makers.operation.domain.member.repository.MemberRepository; +import org.sopt.makers.operation.exception.LectureException; +import org.sopt.makers.operation.web.attendnace.dto.request.UpdatedSubAttendanceRequest; +import org.sopt.makers.operation.web.attendnace.dto.response.AttendanceMemberResponse; +import org.sopt.makers.operation.web.attendnace.dto.response.AttendanceListResponse; +import org.sopt.makers.operation.web.attendnace.dto.response.UpdatedSubAttendanceResponse; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -30,21 +26,21 @@ @Transactional(readOnly = true) public class AttendanceServiceImpl implements AttendanceService { + private final AttendanceRepository attendanceRepository; private final SubAttendanceRepository subAttendanceRepository; private final MemberRepository memberRepository; - private final AttendanceRepository attendanceRepository; @Override @Transactional - public SubAttendanceUpdateResponse updateSubAttendance(SubAttendanceUpdateRequest request) { + public UpdatedSubAttendanceResponse updateSubAttendance(UpdatedSubAttendanceRequest request) { val subAttendance = findSubAttendance(request.subAttendanceId()); subAttendance.updateStatus(request.status()); - return SubAttendanceUpdateResponse.of(subAttendance); + return UpdatedSubAttendanceResponse.of(subAttendance); } - private SubAttendance findSubAttendance(Long id) { + private SubAttendance findSubAttendance(long id) { return subAttendanceRepository.findById(id) - .orElseThrow(() -> new LectureException(INVALID_ATTENDANCE.getContent())); + .orElseThrow(() -> new LectureException(INVALID_ATTENDANCE)); } @Override @@ -69,9 +65,9 @@ public float updateMemberScore(Long memberId) { } @Override - public AttendancesResponse findAttendancesByLecture(long lectureId, Part part, Pageable pageable) { + public AttendanceListResponse findAttendancesByLecture(long lectureId, Part part, Pageable pageable) { val attendances = attendanceRepository.findByLecture(lectureId, part, pageable); val attendancesCount = attendanceRepository.countByLectureIdAndPart(lectureId, part); - return AttendancesResponse.of(attendances, attendancesCount); + return AttendanceListResponse.of(attendances, attendancesCount); } } From e901f42c4f649567ac42c89a6dc8b63a9f85f839 Mon Sep 17 00:00:00 2001 From: thguss Date: Mon, 5 Feb 2024 14:04:50 +0900 Subject: [PATCH 075/141] =?UTF-8?q?[REFACTOR]=20=ED=9A=8C=EC=9B=90=20?= =?UTF-8?q?=EC=B6=9C=EC=84=9D=20=EB=A6=AC=EC=8A=A4=ED=8A=B8=20=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C=20=EA=B8=B0=EB=8A=A5=20=EB=A6=AC=ED=8C=A9=ED=86=A0?= =?UTF-8?q?=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/response/AttendanceMemberResponse.java | 4 ++-- .../service/AttendanceServiceImpl.java | 14 ++++++++------ .../code/failure/MemberFailureCode.java | 18 ++++++++++++++++++ .../attendance/AttendanceCustomRepository.java | 2 +- .../attendance/AttendanceRepositoryImpl.java | 2 +- .../domain/member/message/ErrorMessage.java | 13 ------------- 6 files changed, 30 insertions(+), 23 deletions(-) create mode 100644 operation-common/src/main/java/org/sopt/makers/operation/code/failure/MemberFailureCode.java delete mode 100644 operation-domain/src/main/java/org/sopt/makers/operation/domain/member/message/ErrorMessage.java diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/AttendanceMemberResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/AttendanceMemberResponse.java index 09194949..3afa6b11 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/AttendanceMemberResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/AttendanceMemberResponse.java @@ -14,14 +14,14 @@ public record AttendanceMemberResponse( String phone, List lectures ) { - public static AttendanceMemberResponse of(Member member, List attendances) { + public static AttendanceMemberResponse of(Member member, List attendanceList) { return new AttendanceMemberResponse( member.getName(), member.getScore(), member.getPart().getName(), member.getUniversity(), member.getPhone(), - attendances.stream().map(LectureVO::of).toList()); + attendanceList.stream().map(LectureVO::of).toList()); } record LectureVO( diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/service/AttendanceServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/service/AttendanceServiceImpl.java index 56ff9a82..912c0b06 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/service/AttendanceServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/service/AttendanceServiceImpl.java @@ -1,13 +1,16 @@ package org.sopt.makers.operation.web.attendnace.service; import static org.sopt.makers.operation.code.failure.AttendanceFailureCode.*; +import static org.sopt.makers.operation.code.failure.MemberFailureCode.*; import org.sopt.makers.operation.domain.Part; import org.sopt.makers.operation.domain.attendance.domain.SubAttendance; import org.sopt.makers.operation.domain.attendance.repository.attendance.AttendanceRepository; import org.sopt.makers.operation.domain.attendance.repository.subAttendance.SubAttendanceRepository; +import org.sopt.makers.operation.domain.member.domain.Member; import org.sopt.makers.operation.domain.member.repository.MemberRepository; import org.sopt.makers.operation.exception.LectureException; +import org.sopt.makers.operation.exception.MemberException; import org.sopt.makers.operation.web.attendnace.dto.request.UpdatedSubAttendanceRequest; import org.sopt.makers.operation.web.attendnace.dto.response.AttendanceMemberResponse; import org.sopt.makers.operation.web.attendnace.dto.response.AttendanceListResponse; @@ -46,20 +49,19 @@ private SubAttendance findSubAttendance(long id) { @Override public AttendanceMemberResponse findAttendancesByMember(long memberId) { val member = findMember(memberId); - val attendances = attendanceRepository.findByMember(member); - return AttendanceMemberResponse.of(member, attendances); + val attendanceList = attendanceRepository.findFetchJoin(member); + return AttendanceMemberResponse.of(member, attendanceList); } - private Member findMember(Long id) { + private Member findMember(long id) { return memberRepository.findById(id) - .orElseThrow(() -> new MemberException(INVALID_MEMBER.getContent())); + .orElseThrow(() -> new MemberException(INVALID_MEMBER)); } @Override @Transactional public float updateMemberScore(Long memberId) { - val member = memberRepository.find(memberId) - .orElseThrow(() -> new MemberException(INVALID_MEMBER.getContent())); + val member = findMember(memberId); member.updateTotalScore(); return member.getScore(); } diff --git a/operation-common/src/main/java/org/sopt/makers/operation/code/failure/MemberFailureCode.java b/operation-common/src/main/java/org/sopt/makers/operation/code/failure/MemberFailureCode.java new file mode 100644 index 00000000..fcb0ef99 --- /dev/null +++ b/operation-common/src/main/java/org/sopt/makers/operation/code/failure/MemberFailureCode.java @@ -0,0 +1,18 @@ +package org.sopt.makers.operation.code.failure; + +import static org.springframework.http.HttpStatus.*; + +import org.springframework.http.HttpStatus; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +@Getter +public enum MemberFailureCode implements FailureCode { + INVALID_MEMBER(NOT_FOUND, "존재하지 않는 회원입니다.") + ; + + private final HttpStatus status; + private final String message; +} diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/repository/attendance/AttendanceCustomRepository.java b/operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/repository/attendance/AttendanceCustomRepository.java index bf2dc6f7..94417cd1 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/repository/attendance/AttendanceCustomRepository.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/repository/attendance/AttendanceCustomRepository.java @@ -10,7 +10,7 @@ public interface AttendanceCustomRepository { List findAttendanceByMemberId(Long memberId); List findByLecture(Long lectureId, Part part, Pageable pageable); - List findByMember(Member member); + List findFetchJoin(Member member); List findToday(long memberPlaygroundId); int countByLectureIdAndPart(long lectureId, Part part); } diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/repository/attendance/AttendanceRepositoryImpl.java b/operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/repository/attendance/AttendanceRepositoryImpl.java index 4c2fbd5e..e57e2ea9 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/repository/attendance/AttendanceRepositoryImpl.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/repository/attendance/AttendanceRepositoryImpl.java @@ -67,7 +67,7 @@ public List findByLecture(Long lectureId, Part part, Pageable pageab } @Override - public List findByMember(Member member) { + public List findFetchJoin(Member member) { return queryFactory .selectFrom(attendance) .leftJoin(attendance.subAttendances, subAttendance).fetchJoin().distinct() diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/domain/member/message/ErrorMessage.java b/operation-domain/src/main/java/org/sopt/makers/operation/domain/member/message/ErrorMessage.java deleted file mode 100644 index 5d9e94ba..00000000 --- a/operation-domain/src/main/java/org/sopt/makers/operation/domain/member/message/ErrorMessage.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.sopt.makers.operation.domain.member.message; - -import lombok.AllArgsConstructor; -import lombok.Getter; - -@AllArgsConstructor -@Getter -public enum ErrorMessage { - INVALID_MEMBER("존재하지 않는 회원입니다.") - ; - - private final String content; -} From f7ee84c714a99e9582488aa95244ebe68d9813b6 Mon Sep 17 00:00:00 2001 From: thguss Date: Mon, 5 Feb 2024 14:13:37 +0900 Subject: [PATCH 076/141] =?UTF-8?q?[REFACTOR]=20=ED=9A=8C=EC=9B=90=20?= =?UTF-8?q?=EC=A0=84=EC=B2=B4=20=EC=B6=9C=EC=84=9D=20=EC=A0=90=EC=88=98=20?= =?UTF-8?q?=EA=B3=84=EC=82=B0=20=EB=B0=8F=20=EC=97=85=EB=8D=B0=EC=9D=B4?= =?UTF-8?q?=ED=8A=B8=20=EA=B8=B0=EB=8A=A5=20=EB=A6=AC=ED=8C=A9=ED=86=A0?= =?UTF-8?q?=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operation/common/handler/ErrorHandler.java | 7 +++++++ .../attendnace/api/AttendanceApiController.java | 2 +- .../attendnace/service/AttendanceService.java | 2 +- .../service/AttendanceServiceImpl.java | 2 +- .../operation/exception/AttendanceException.java | 16 ++++++++++++++++ .../domain/attendance/domain/Attendance.java | 13 +++++++++---- .../operation/domain/member/domain/Member.java | 14 ++++++++------ 7 files changed, 43 insertions(+), 13 deletions(-) create mode 100644 operation-common/src/main/java/org/sopt/makers/operation/exception/AttendanceException.java diff --git a/operation-api/src/main/java/org/sopt/makers/operation/common/handler/ErrorHandler.java b/operation-api/src/main/java/org/sopt/makers/operation/common/handler/ErrorHandler.java index f5efd723..d2b4c882 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/common/handler/ErrorHandler.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/common/handler/ErrorHandler.java @@ -4,6 +4,7 @@ import org.sopt.makers.operation.common.util.ApiResponseUtil; import org.sopt.makers.operation.exception.AdminFailureException; import org.sopt.makers.operation.exception.AlarmException; +import org.sopt.makers.operation.exception.AttendanceException; import org.sopt.makers.operation.exception.DateTimeParseCustomException; import org.sopt.makers.operation.exception.LectureException; import org.sopt.makers.operation.exception.MemberException; @@ -67,4 +68,10 @@ public ResponseEntity> alarmException(AlarmException ex) { return ApiResponseUtil.failure(ex.getFailureCode()); } + @ExceptionHandler(AttendanceException.class) + public ResponseEntity> attendanceException(AttendanceException ex) { + log.error(ex.getMessage()); + return ApiResponseUtil.failure(ex.getFailureCode()); + } + } diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/api/AttendanceApiController.java b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/api/AttendanceApiController.java index 90cf0774..b9813d48 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/api/AttendanceApiController.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/api/AttendanceApiController.java @@ -44,7 +44,7 @@ public ResponseEntity> findAttendancesByMember(@PathVariable lon @Override @PatchMapping("/member/{memberId}") public ResponseEntity> updateMemberScore(@PathVariable long memberId) { - val response = attendanceService.updateMemberScore(memberId); + val response = attendanceService.updateMemberAllScore(memberId); return ApiResponseUtil.success(SUCCESS_UPDATE_MEMBER_SCORE, response); } diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/service/AttendanceService.java b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/service/AttendanceService.java index 86c3c093..5bb04078 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/service/AttendanceService.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/service/AttendanceService.java @@ -10,6 +10,6 @@ public interface AttendanceService { UpdatedSubAttendanceResponse updateSubAttendance(UpdatedSubAttendanceRequest request); AttendanceMemberResponse findAttendancesByMember(long memberId); - float updateMemberScore(Long memberId); + float updateMemberAllScore(long memberId); AttendanceListResponse findAttendancesByLecture(long lectureId, Part part, Pageable pageable); } diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/service/AttendanceServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/service/AttendanceServiceImpl.java index 912c0b06..233d1b75 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/service/AttendanceServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/service/AttendanceServiceImpl.java @@ -60,7 +60,7 @@ private Member findMember(long id) { @Override @Transactional - public float updateMemberScore(Long memberId) { + public float updateMemberAllScore(long memberId) { val member = findMember(memberId); member.updateTotalScore(); return member.getScore(); diff --git a/operation-common/src/main/java/org/sopt/makers/operation/exception/AttendanceException.java b/operation-common/src/main/java/org/sopt/makers/operation/exception/AttendanceException.java new file mode 100644 index 00000000..6b374182 --- /dev/null +++ b/operation-common/src/main/java/org/sopt/makers/operation/exception/AttendanceException.java @@ -0,0 +1,16 @@ +package org.sopt.makers.operation.exception; + +import org.sopt.makers.operation.code.failure.FailureCode; + +import lombok.Getter; + +@Getter +public class AttendanceException extends RuntimeException { + + private final FailureCode failureCode; + + public AttendanceException(FailureCode failureCode) { + super("[AttendanceException] : " + failureCode.getMessage()); + this.failureCode = failureCode; + } +} diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/domain/Attendance.java b/operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/domain/Attendance.java index f516089f..35ffdbc9 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/domain/Attendance.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/domain/Attendance.java @@ -1,8 +1,8 @@ package org.sopt.makers.operation.domain.attendance.domain; import static javax.persistence.GenerationType.*; +import static org.sopt.makers.operation.code.failure.AttendanceFailureCode.*; import static org.sopt.makers.operation.domain.attendance.domain.AttendanceStatus.*; -import static org.sopt.makers.operation.domain.attendance.message.ErrorMessage.*; import java.util.ArrayList; import java.util.List; @@ -10,7 +10,6 @@ import javax.persistence.Column; import javax.persistence.Entity; -import javax.persistence.EntityNotFoundException; import javax.persistence.EnumType; import javax.persistence.Enumerated; import javax.persistence.FetchType; @@ -22,6 +21,7 @@ import org.sopt.makers.operation.domain.lecture.Lecture; import org.sopt.makers.operation.domain.member.domain.Member; +import org.sopt.makers.operation.exception.AttendanceException; import lombok.*; @@ -71,7 +71,8 @@ public AttendanceStatus getStatus() { } public float getScore() { - return switch (this.lecture.getAttribute()) { + val lectureAttribute = this.lecture.getAttribute(); + return switch (lectureAttribute) { case SEMINAR -> { if (this.status.equals(ABSENT)) { yield -1f; @@ -96,7 +97,7 @@ public void revertMemberScore() { private SubAttendance getSubAttendanceByRound(int round) { return this.subAttendances.stream().filter(o -> o.getSubLecture().getRound() == round).findFirst() - .orElseThrow(() -> new EntityNotFoundException(INVALID_SUB_ATTENDANCE.getContent())); + .orElseThrow(() -> new AttendanceException(INVALID_SUB_ATTENDANCE)); } private void setMember(Member member) { @@ -114,4 +115,8 @@ private void setLecture(Lecture lecture) { this.lecture = lecture; lecture.getAttendances().add(this); } + + public boolean isEnd() { + return this.lecture.isEnd(); + } } diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/domain/member/domain/Member.java b/operation-domain/src/main/java/org/sopt/makers/operation/domain/member/domain/Member.java index bbf834ef..bb810288 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/domain/member/domain/Member.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/domain/member/domain/Member.java @@ -1,7 +1,5 @@ package org.sopt.makers.operation.domain.member.domain; -import static org.sopt.makers.operation.domain.lecture.LectureStatus.*; - import java.util.ArrayList; import java.util.List; @@ -52,9 +50,13 @@ public void updateScore(float score) { } public void updateTotalScore() { - this.score = (float) (2 + this.attendances.stream() - .filter(attendance -> attendance.getLecture().getLectureStatus().equals(END)) - .mapToDouble(Attendance::getScore) - .sum()); + this.score = calcAllAttendances(); + } + + private float calcAllAttendances() { + return (float) (2 + this.attendances.stream() + .filter(Attendance::isEnd) + .mapToDouble(Attendance::getScore) + .sum()); } } From ca09311d58c078193d9caa61fe4eab5c2bbd178c Mon Sep 17 00:00:00 2001 From: thguss Date: Mon, 5 Feb 2024 14:33:02 +0900 Subject: [PATCH 077/141] =?UTF-8?q?[REFACTOR]=20=EC=84=B8=EC=85=98?= =?UTF-8?q?=EB=B3=84=20=EC=B6=9C=EC=84=9D=20=EB=A6=AC=EC=8A=A4=ED=8A=B8=20?= =?UTF-8?q?=EC=A1=B0=ED=9A=8C=20=EA=B8=B0=EB=8A=A5=20=EB=A6=AC=ED=8C=A9?= =?UTF-8?q?=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/response/AttendanceListResponse.java | 69 +++++++++++++++++-- .../dto/response/MemberResponse.java | 44 ------------ .../service/AttendanceServiceImpl.java | 17 ++++- .../code/failure/LectureFailureCode.java | 1 + .../AttendanceCustomRepository.java | 5 +- .../attendance/AttendanceRepositoryImpl.java | 17 ++--- 6 files changed, 91 insertions(+), 62 deletions(-) delete mode 100644 operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/MemberResponse.java diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/AttendanceListResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/AttendanceListResponse.java index 88859c5d..2d0aed65 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/AttendanceListResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/AttendanceListResponse.java @@ -3,15 +3,74 @@ import java.util.List; import org.sopt.makers.operation.domain.attendance.domain.Attendance; +import org.sopt.makers.operation.domain.attendance.domain.AttendanceStatus; +import org.sopt.makers.operation.domain.attendance.domain.SubAttendance; +import org.sopt.makers.operation.domain.member.domain.Member; +import lombok.AccessLevel; +import lombok.Builder; + +@Builder(access = AccessLevel.PRIVATE) public record AttendanceListResponse( - List attendances, + List attendances, int totalCount ) { - public static AttendanceListResponse of(List attendances, int totalCount) { - return new AttendanceListResponse( - attendances.stream().map(MemberResponse::of).toList(), - totalCount); + public static AttendanceListResponse of(List attendanceList, int totalCount) { + return AttendanceListResponse.builder() + .attendances(attendanceList.stream().map(AttendanceVO::of).toList()) + .totalCount(totalCount) + .build(); + } + + @Builder(access = AccessLevel.PRIVATE) + private record AttendanceVO( + long attendanceId, + MemberVO member, + List attendances, + float updatedScore + ) { + private static AttendanceVO of(Attendance attendance) { + return AttendanceVO.builder() + .attendanceId(attendance.getId()) + .member(MemberVO.of(attendance.getMember())) + .attendances(attendance.getSubAttendances().stream().map(SubAttendanceVO::of).toList()) + .updatedScore(attendance.getScore()) + .build(); + } + } + + @Builder(access = AccessLevel.PRIVATE) + private record MemberVO( + long memberId, + String name, + String university, + String part + ) { + private static MemberVO of(Member member) { + return MemberVO.builder() + .memberId(member.getId()) + .name(member.getName()) + .university(member.getUniversity()) + .part(member.getPart().getName()) + .build(); + } + } + + @Builder(access = AccessLevel.PRIVATE) + private record SubAttendanceVO( + long subAttendanceId, + int round, + AttendanceStatus status, + String updateAt + ) { + private static SubAttendanceVO of(SubAttendance subAttendance) { + return SubAttendanceVO.builder() + .subAttendanceId(subAttendance.getId()) + .round(subAttendance.getSubLecture().getRound()) + .status(subAttendance.getStatus()) + .updateAt(subAttendance.getLastModifiedDate().toString()) + .build(); + } } } diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/MemberResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/MemberResponse.java deleted file mode 100644 index 0aa76f7e..00000000 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/MemberResponse.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.sopt.makers.operation.web.attendnace.dto.response; - -import java.util.List; - -import org.sopt.makers.operation.domain.attendance.domain.Attendance; -import org.sopt.makers.operation.domain.attendance.domain.AttendanceStatus; -import org.sopt.makers.operation.domain.attendance.domain.SubAttendance; -import org.sopt.makers.operation.domain.member.domain.Member; - -public record MemberResponse( - Long attendanceId, - MemberVO member, - List attendances, - float updatedScore -) { - - public static MemberResponse of(Attendance attendance) { - return new MemberResponse( - attendance.getId(), - MemberVO.of(attendance.getMember()), - attendance.getSubAttendances().stream().map(SubAttendanceVO::of).toList(), - attendance.getScore()); - } - - record MemberVO(Long memberId, String name, String university, String part) { - static MemberVO of(Member member) { - return new MemberVO( - member.getId(), - member.getName(), - member.getUniversity(), - member.getPart().getName()); - } - } - - record SubAttendanceVO(Long subAttendanceId, int round, AttendanceStatus status, String updateAt) { - static SubAttendanceVO of(SubAttendance subAttendance) { - return new SubAttendanceVO( - subAttendance.getId(), - subAttendance.getSubLecture().getRound(), - subAttendance.getStatus(), - subAttendance.getLastModifiedDate().toString()); - } - } -} diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/service/AttendanceServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/service/AttendanceServiceImpl.java index 233d1b75..51b29b69 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/service/AttendanceServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/service/AttendanceServiceImpl.java @@ -1,12 +1,16 @@ package org.sopt.makers.operation.web.attendnace.service; import static org.sopt.makers.operation.code.failure.AttendanceFailureCode.*; +import static org.sopt.makers.operation.code.failure.LectureFailureCode.*; import static org.sopt.makers.operation.code.failure.MemberFailureCode.*; +import org.sopt.makers.operation.code.failure.LectureFailureCode; import org.sopt.makers.operation.domain.Part; import org.sopt.makers.operation.domain.attendance.domain.SubAttendance; import org.sopt.makers.operation.domain.attendance.repository.attendance.AttendanceRepository; import org.sopt.makers.operation.domain.attendance.repository.subAttendance.SubAttendanceRepository; +import org.sopt.makers.operation.domain.lecture.Lecture; +import org.sopt.makers.operation.domain.lecture.repository.lecture.LectureRepository; import org.sopt.makers.operation.domain.member.domain.Member; import org.sopt.makers.operation.domain.member.repository.MemberRepository; import org.sopt.makers.operation.exception.LectureException; @@ -32,6 +36,7 @@ public class AttendanceServiceImpl implements AttendanceService { private final AttendanceRepository attendanceRepository; private final SubAttendanceRepository subAttendanceRepository; private final MemberRepository memberRepository; + private final LectureRepository lectureRepository; @Override @Transactional @@ -68,8 +73,14 @@ public float updateMemberAllScore(long memberId) { @Override public AttendanceListResponse findAttendancesByLecture(long lectureId, Part part, Pageable pageable) { - val attendances = attendanceRepository.findByLecture(lectureId, part, pageable); - val attendancesCount = attendanceRepository.countByLectureIdAndPart(lectureId, part); - return AttendanceListResponse.of(attendances, attendancesCount); + val lecture = findLecture(lectureId); + val attendanceList = attendanceRepository.findFetchJoin(lecture, part, pageable); + val totalCount = attendanceRepository.count(lecture, part); + return AttendanceListResponse.of(attendanceList, totalCount); + } + + private Lecture findLecture(long id) { + return lectureRepository.findById(id) + .orElseThrow(() -> new LectureException(INVALID_LECTURE)); } } diff --git a/operation-common/src/main/java/org/sopt/makers/operation/code/failure/LectureFailureCode.java b/operation-common/src/main/java/org/sopt/makers/operation/code/failure/LectureFailureCode.java index 711f2578..9e8fc48d 100644 --- a/operation-common/src/main/java/org/sopt/makers/operation/code/failure/LectureFailureCode.java +++ b/operation-common/src/main/java/org/sopt/makers/operation/code/failure/LectureFailureCode.java @@ -11,6 +11,7 @@ @Getter public enum LectureFailureCode implements FailureCode { INVALID_DATE_PATTERN(BAD_REQUEST, "유효하지 않은 날짜 형식입니다."), + INVALID_LECTURE(NOT_FOUND, "유효하지 않은 세션입니다."), ; private final HttpStatus status; diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/repository/attendance/AttendanceCustomRepository.java b/operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/repository/attendance/AttendanceCustomRepository.java index 94417cd1..aaa91d2f 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/repository/attendance/AttendanceCustomRepository.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/repository/attendance/AttendanceCustomRepository.java @@ -4,13 +4,14 @@ import org.sopt.makers.operation.domain.Part; import org.sopt.makers.operation.domain.attendance.domain.Attendance; +import org.sopt.makers.operation.domain.lecture.Lecture; import org.sopt.makers.operation.domain.member.domain.Member; import org.springframework.data.domain.Pageable; public interface AttendanceCustomRepository { List findAttendanceByMemberId(Long memberId); - List findByLecture(Long lectureId, Part part, Pageable pageable); + List findFetchJoin(Lecture lecture, Part part, Pageable pageable); List findFetchJoin(Member member); List findToday(long memberPlaygroundId); - int countByLectureIdAndPart(long lectureId, Part part); + int count(Lecture lecture, Part part); } diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/repository/attendance/AttendanceRepositoryImpl.java b/operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/repository/attendance/AttendanceRepositoryImpl.java index e57e2ea9..4bdd66ce 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/repository/attendance/AttendanceRepositoryImpl.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/repository/attendance/AttendanceRepositoryImpl.java @@ -2,6 +2,7 @@ import static com.querydsl.core.types.dsl.Expressions.*; import static java.util.Objects.*; +import static org.sopt.makers.operation.domain.Part.*; import static org.sopt.makers.operation.domain.attendance.domain.QAttendance.*; import static org.sopt.makers.operation.domain.attendance.domain.QSubAttendance.*; import static org.sopt.makers.operation.domain.lecture.QLecture.*; @@ -16,6 +17,7 @@ import org.sopt.makers.operation.config.ValueConfig; import org.sopt.makers.operation.domain.Part; import org.sopt.makers.operation.domain.attendance.domain.Attendance; +import org.sopt.makers.operation.domain.lecture.Lecture; import org.sopt.makers.operation.domain.lecture.LectureStatus; import org.sopt.makers.operation.domain.member.domain.Member; import org.springframework.data.domain.Pageable; @@ -49,15 +51,14 @@ public List findAttendanceByMemberId(Long memberId) { } @Override - public List findByLecture(Long lectureId, Part part, Pageable pageable) { + public List findFetchJoin(Lecture lecture, Part part, Pageable pageable) { return queryFactory .selectFrom(attendance) .leftJoin(attendance.subAttendances, subAttendance).fetchJoin() .leftJoin(subAttendance.subLecture, subLecture).fetchJoin() - .leftJoin(attendance.lecture, lecture).fetchJoin() .leftJoin(attendance.member, member).fetchJoin() .where( - attendance.lecture.id.eq(lectureId), + attendance.lecture.eq(lecture), partEq(part) ) .orderBy(stringTemplate("SUBSTR({0}, 1, 1)", member.name).asc()) @@ -92,26 +93,26 @@ public List findToday(long memberPlaygroundId) { .where( member.playgroundId.eq(memberPlaygroundId), member.generation.eq(valueConfig.getGENERATION()), - lecture.part.eq(member.part).or(lecture.part.eq(Part.ALL)), + lecture.part.eq(member.part).or(lecture.part.eq(ALL)), lecture.startDate.between(startOfDay, endOfDay)) .orderBy(lecture.startDate.asc()) .fetch(); } @Override - public int countByLectureIdAndPart(long lectureId, Part part) { + public int count(Lecture lecture, Part part) { return Math.toIntExact(queryFactory .select(attendance.count()) .from(attendance) .where( - attendance.lecture.id.eq(lectureId), - nonNull(part) ? attendance.member.part.eq(part) : null + attendance.lecture.eq(lecture), + partEq(part) ) .fetchFirst() ); } private BooleanExpression partEq(Part part) { - return nonNull(part) ? member.part.eq(part) : null; + return (isNull(part) || part.equals(ALL)) ? null : attendance.member.part.eq(part); } } From 93bead0da1c7506c0b4fc91bfe76a5270b420585 Mon Sep 17 00:00:00 2001 From: thguss Date: Tue, 6 Feb 2024 14:19:58 +0900 Subject: [PATCH 078/141] =?UTF-8?q?[REFACTOR]=20Lecture=20=EC=BB=A8?= =?UTF-8?q?=ED=8A=B8=EB=A1=A4=EB=9F=AC=20=EB=A6=AC=ED=8C=A9=ED=86=A0?= =?UTF-8?q?=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/lecture/api/LectureApiController.java | 20 ++++++--------- .../dto/request/AttendanceRequest.java | 2 +- .../lecture/dto/request/LectureRequest.java | 2 +- .../dto/response/AttendanceResponse.java | 2 +- .../dto/response/AttendancesStatusVO.java | 2 +- .../dto/response/LectureDetailResponse.java | 2 +- .../lecture/dto/response/LectureResponse.java | 2 +- .../dto/response/LecturesResponse.java | 2 +- .../web/lecture/message/SuccessMessage.java | 19 -------------- .../lecture/service/LectureServiceImpl.java | 14 +++++------ .../code/success/web/LectureSuccessCode.java | 25 +++++++++++++++++++ 11 files changed, 47 insertions(+), 45 deletions(-) rename operation-api/src/main/java/org/sopt/makers/operation/{service => }/web/lecture/dto/request/AttendanceRequest.java (55%) rename operation-api/src/main/java/org/sopt/makers/operation/{service => }/web/lecture/dto/request/LectureRequest.java (94%) rename operation-api/src/main/java/org/sopt/makers/operation/{service => }/web/lecture/dto/response/AttendanceResponse.java (85%) rename operation-api/src/main/java/org/sopt/makers/operation/{service => }/web/lecture/dto/response/AttendancesStatusVO.java (93%) rename operation-api/src/main/java/org/sopt/makers/operation/{service => }/web/lecture/dto/response/LectureDetailResponse.java (90%) rename operation-api/src/main/java/org/sopt/makers/operation/{service => }/web/lecture/dto/response/LectureResponse.java (95%) rename operation-api/src/main/java/org/sopt/makers/operation/{service => }/web/lecture/dto/response/LecturesResponse.java (94%) delete mode 100644 operation-api/src/main/java/org/sopt/makers/operation/web/lecture/message/SuccessMessage.java rename operation-api/src/main/java/org/sopt/makers/operation/{service => }/web/lecture/service/LectureServiceImpl.java (91%) create mode 100644 operation-common/src/main/java/org/sopt/makers/operation/code/success/web/LectureSuccessCode.java diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/api/LectureApiController.java b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/api/LectureApiController.java index 8cfb8620..ef9fae6b 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/api/LectureApiController.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/api/LectureApiController.java @@ -1,11 +1,10 @@ package org.sopt.makers.operation.web.lecture.api; -import static org.sopt.makers.operation.web.lecture.message.SuccessMessage.*; +import static org.sopt.makers.operation.code.success.web.LectureSuccessCode.*; import org.sopt.makers.operation.domain.Part; import org.sopt.makers.operation.common.dto.BaseResponse; import org.sopt.makers.operation.common.util.ApiResponseUtil; -import org.sopt.makers.operation.common.util.CommonUtils; import org.sopt.makers.operation.web.lecture.dto.request.AttendanceRequest; import org.sopt.makers.operation.web.lecture.dto.request.LectureRequest; import org.sopt.makers.operation.web.lecture.service.LectureService; @@ -29,14 +28,12 @@ public class LectureApiController implements LectureApi { private final LectureService lectureService; - private final CommonUtils utils; @Override @PostMapping public ResponseEntity> createLecture(@RequestBody LectureRequest request) { val lectureId = lectureService.createLecture(request); - val uri = utils.getURI("/{lectureId}", lectureId); - return ApiResponseUtil.created(uri, SUCCESS_CREATE_LECTURE.getContent(), lectureId); + return ApiResponseUtil.success(SUCCESS_CREATE_LECTURE, lectureId); } @Override @@ -46,42 +43,41 @@ public ResponseEntity> getLectures( @RequestParam(required = false) Part part ) { val response = lectureService.getLectures(generation, part); - return ApiResponseUtil.ok(SUCCESS_GET_LECTURES.getContent(), response); + return ApiResponseUtil.success(SUCCESS_GET_LECTURES, response); } @Override @GetMapping("/{lectureId}") public ResponseEntity> getLecture(@PathVariable long lectureId) { val response = lectureService.getLecture(lectureId); - return ApiResponseUtil.ok(SUCCESS_GET_LECTURE.getContent(), response); + return ApiResponseUtil.success(SUCCESS_GET_LECTURE, response); } @Override @PatchMapping("/attendance") public ResponseEntity> startAttendance(AttendanceRequest request) { val response = lectureService.startAttendance(request); - val uri = utils.getURI("/{lectureId}", response.lectureId()); - return ApiResponseUtil.created(uri, SUCCESS_START_ATTENDANCE.getContent(), response); + return ApiResponseUtil.success(SUCCESS_START_ATTENDANCE, response); } @Override @PatchMapping("/{lectureId}") public ResponseEntity> endLecture(@PathVariable long lectureId) { lectureService.endLecture(lectureId); - return ApiResponseUtil.ok(SUCCESS_UPDATE_MEMBER_SCORE.getContent(), lectureService); + return ApiResponseUtil.success(SUCCESS_UPDATE_MEMBER_SCORE); } @Override @DeleteMapping("/{lectureId}") public ResponseEntity> deleteLecture(@PathVariable long lectureId) { lectureService.deleteLecture(lectureId); - return ApiResponseUtil.ok(SUCCESS_DELETE_LECTURE.getContent()); + return ApiResponseUtil.success(SUCCESS_DELETE_LECTURE); } @Override @GetMapping("/detail/{lectureId}") public ResponseEntity> getLectureDetail(@PathVariable long lectureId) { val response = lectureService.getLectureDetail(lectureId); - return ApiResponseUtil.ok(SUCCESS_GET_LECTURE.getContent(), response); + return ApiResponseUtil.success(SUCCESS_GET_LECTURE, response); } } diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/web/lecture/dto/request/AttendanceRequest.java b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/request/AttendanceRequest.java similarity index 55% rename from operation-api/src/main/java/org/sopt/makers/operation/service/web/lecture/dto/request/AttendanceRequest.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/request/AttendanceRequest.java index c75abc75..c543b046 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/web/lecture/dto/request/AttendanceRequest.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/request/AttendanceRequest.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.service.web.lecture.dto.request; +package org.sopt.makers.operation.web.lecture.dto.request; public record AttendanceRequest( Long lectureId, diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/web/lecture/dto/request/LectureRequest.java b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/request/LectureRequest.java similarity index 94% rename from operation-api/src/main/java/org/sopt/makers/operation/service/web/lecture/dto/request/LectureRequest.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/request/LectureRequest.java index aec322b0..194a5d75 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/web/lecture/dto/request/LectureRequest.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/request/LectureRequest.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.service.web.lecture.dto.request; +package org.sopt.makers.operation.web.lecture.dto.request; import static org.sopt.makers.operation.code.failure.LectureFailureCode.*; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/web/lecture/dto/response/AttendanceResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/AttendanceResponse.java similarity index 85% rename from operation-api/src/main/java/org/sopt/makers/operation/service/web/lecture/dto/response/AttendanceResponse.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/AttendanceResponse.java index 0c0f4279..467b2f2a 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/web/lecture/dto/response/AttendanceResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/AttendanceResponse.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.service.web.lecture.dto.response; +package org.sopt.makers.operation.web.lecture.dto.response; import org.operation.lecture.Lecture; import org.operation.lecture.SubLecture; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/web/lecture/dto/response/AttendancesStatusVO.java b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/AttendancesStatusVO.java similarity index 93% rename from operation-api/src/main/java/org/sopt/makers/operation/service/web/lecture/dto/response/AttendancesStatusVO.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/AttendancesStatusVO.java index f0e5a59a..5b624d6a 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/web/lecture/dto/response/AttendancesStatusVO.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/AttendancesStatusVO.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.service.web.lecture.dto.response; +package org.sopt.makers.operation.web.lecture.dto.response; import static org.operation.attendance.domain.AttendanceStatus.*; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/web/lecture/dto/response/LectureDetailResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureDetailResponse.java similarity index 90% rename from operation-api/src/main/java/org/sopt/makers/operation/service/web/lecture/dto/response/LectureDetailResponse.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureDetailResponse.java index 6f8fe278..65dafdf5 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/web/lecture/dto/response/LectureDetailResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureDetailResponse.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.service.web.lecture.dto.response; +package org.sopt.makers.operation.web.lecture.dto.response; import org.operation.lecture.Lecture; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/web/lecture/dto/response/LectureResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureResponse.java similarity index 95% rename from operation-api/src/main/java/org/sopt/makers/operation/service/web/lecture/dto/response/LectureResponse.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureResponse.java index 3aa7d495..2bdf8f20 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/web/lecture/dto/response/LectureResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureResponse.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.service.web.lecture.dto.response; +package org.sopt.makers.operation.web.lecture.dto.response; import static java.util.Objects.*; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/web/lecture/dto/response/LecturesResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LecturesResponse.java similarity index 94% rename from operation-api/src/main/java/org/sopt/makers/operation/service/web/lecture/dto/response/LecturesResponse.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LecturesResponse.java index 86790900..cdb32ae0 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/web/lecture/dto/response/LecturesResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LecturesResponse.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.service.web.lecture.dto.response; +package org.sopt.makers.operation.web.lecture.dto.response; import java.util.List; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/message/SuccessMessage.java b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/message/SuccessMessage.java deleted file mode 100644 index 128f2ba7..00000000 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/message/SuccessMessage.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.sopt.makers.operation.web.lecture.message; - -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -@Getter -@RequiredArgsConstructor -public enum SuccessMessage { - SUCCESS_CREATE_LECTURE("세션 생성 성공"), - SUCCESS_GET_LECTURES("세션 리스트 조회 성공"), - SUCCESS_GET_LECTURE("세션 상세 조회 성공"), - SUCCESS_START_ATTENDANCE("출석 시작 성공"), - SUCCESS_GET_MEMBERS("유저 리스트 조회 성공"), - SUCCESS_DELETE_LECTURE("세션 삭제 성공"), - SUCCESS_UPDATE_MEMBER_SCORE("회원 출석 점수 갱신 성공"), - ; - - private final String content; -} diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/web/lecture/service/LectureServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/service/LectureServiceImpl.java similarity index 91% rename from operation-api/src/main/java/org/sopt/makers/operation/service/web/lecture/service/LectureServiceImpl.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/lecture/service/LectureServiceImpl.java index 7f3c2811..dd002d4d 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/web/lecture/service/LectureServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/service/LectureServiceImpl.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.service.web.lecture.service; +package org.sopt.makers.operation.web.lecture.service; import static org.operation.alarm.domain.Attribute.*; import static org.operation.lecture.message.ErrorMessage.*; @@ -21,12 +21,12 @@ import org.operation.lecture.repository.subLecture.SubLectureRepository; import org.operation.member.domain.Member; import org.operation.member.repository.MemberRepository; -import org.sopt.makers.operation.service.web.lecture.dto.request.AttendanceRequest; -import org.sopt.makers.operation.service.web.lecture.dto.request.LectureRequest; -import org.sopt.makers.operation.service.web.lecture.dto.response.AttendanceResponse; -import org.sopt.makers.operation.service.web.lecture.dto.response.LectureDetailResponse; -import org.sopt.makers.operation.service.web.lecture.dto.response.LectureResponse; -import org.sopt.makers.operation.service.web.lecture.dto.response.LecturesResponse; +import org.sopt.makers.operation.web.lecture.dto.request.AttendanceRequest; +import org.sopt.makers.operation.web.lecture.dto.request.LectureRequest; +import org.sopt.makers.operation.web.lecture.dto.response.AttendanceResponse; +import org.sopt.makers.operation.web.lecture.dto.response.LectureDetailResponse; +import org.sopt.makers.operation.web.lecture.dto.response.LectureResponse; +import org.sopt.makers.operation.web.lecture.dto.response.LecturesResponse; import org.sopt.makers.operation.web.alarm.dto.request.AlarmSenderRequest; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; diff --git a/operation-common/src/main/java/org/sopt/makers/operation/code/success/web/LectureSuccessCode.java b/operation-common/src/main/java/org/sopt/makers/operation/code/success/web/LectureSuccessCode.java new file mode 100644 index 00000000..f466151b --- /dev/null +++ b/operation-common/src/main/java/org/sopt/makers/operation/code/success/web/LectureSuccessCode.java @@ -0,0 +1,25 @@ +package org.sopt.makers.operation.code.success.web; + +import static org.springframework.http.HttpStatus.*; + +import org.sopt.makers.operation.code.success.SuccessCode; +import org.springframework.http.HttpStatus; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +@Getter +public enum LectureSuccessCode implements SuccessCode { + SUCCESS_CREATE_LECTURE(CREATED, "세션 생성 성공"), + SUCCESS_GET_LECTURES(OK, "세션 리스트 조회 성공"), + SUCCESS_GET_LECTURE(OK, "세션 상세 조회 성공"), + SUCCESS_START_ATTENDANCE(CREATED, "출석 시작 성공"), + SUCCESS_GET_MEMBERS(OK, "유저 리스트 조회 성공"), + SUCCESS_DELETE_LECTURE(OK, "세션 삭제 성공"), + SUCCESS_UPDATE_MEMBER_SCORE(OK, "회원 출석 점수 갱신 성공"), + ; + + private final HttpStatus status; + private final String message; +} From bd1b53474c203bd50d835fbc3a0378a607580f02 Mon Sep 17 00:00:00 2001 From: thguss Date: Tue, 6 Feb 2024 15:05:54 +0900 Subject: [PATCH 079/141] =?UTF-8?q?[REFACTOR]=20Lecture=20=EC=84=9C?= =?UTF-8?q?=EB=B9=84=EC=8A=A4=20=EB=A6=AC=ED=8C=A9=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/request/AttendanceRequest.java | 2 +- .../dto/response/AttendanceResponse.java | 4 +- .../dto/response/AttendanceStatusListVO.java | 40 ++++ .../dto/response/AttendancesStatusVO.java | 37 ---- .../dto/response/LectureDetailResponse.java | 2 +- ...Response.java => LectureListResponse.java} | 23 +-- .../lecture/dto/response/LectureResponse.java | 12 +- .../web/lecture/service/LectureService.java | 8 +- .../lecture/service/LectureServiceImpl.java | 180 +++++++++--------- .../code/failure/LectureFailureCode.java | 13 +- .../domain/attendance/domain/Attendance.java | 2 +- .../domain/lecture/message/ErrorMessage.java | 24 --- .../client/alarm/dto/AlarmSenderRequest.java | 27 ++- 13 files changed, 199 insertions(+), 175 deletions(-) create mode 100644 operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/AttendanceStatusListVO.java delete mode 100644 operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/AttendancesStatusVO.java rename operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/{LecturesResponse.java => LectureListResponse.java} (62%) delete mode 100644 operation-domain/src/main/java/org/sopt/makers/operation/domain/lecture/message/ErrorMessage.java diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/request/AttendanceRequest.java b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/request/AttendanceRequest.java index c543b046..dd7043e6 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/request/AttendanceRequest.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/request/AttendanceRequest.java @@ -1,7 +1,7 @@ package org.sopt.makers.operation.web.lecture.dto.request; public record AttendanceRequest( - Long lectureId, + long lectureId, int round, String code ) { diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/AttendanceResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/AttendanceResponse.java index 467b2f2a..3b3159c2 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/AttendanceResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/AttendanceResponse.java @@ -1,7 +1,7 @@ package org.sopt.makers.operation.web.lecture.dto.response; -import org.operation.lecture.Lecture; -import org.operation.lecture.SubLecture; +import org.sopt.makers.operation.domain.lecture.Lecture; +import org.sopt.makers.operation.domain.lecture.SubLecture; import lombok.Builder; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/AttendanceStatusListVO.java b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/AttendanceStatusListVO.java new file mode 100644 index 00000000..f3389734 --- /dev/null +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/AttendanceStatusListVO.java @@ -0,0 +1,40 @@ +package org.sopt.makers.operation.web.lecture.dto.response; + +import static org.sopt.makers.operation.domain.attendance.domain.AttendanceStatus.*; + +import org.sopt.makers.operation.domain.attendance.domain.AttendanceStatus; +import org.sopt.makers.operation.domain.lecture.Lecture; + +import lombok.Builder; + +@Builder +public record AttendanceStatusListVO( + int attendance, + int absent, + int tardy, + int unknown +) { + + public static AttendanceStatusListVO of(Lecture lecture) { + return AttendanceStatusListVO.builder() + .attendance(getCount(lecture, ATTENDANCE)) + .absent(getAbsentCount(lecture)) + .tardy(getCount(lecture, TARDY)) + .unknown(getUnknownCount(lecture)) + .build(); + } + + private static int getCount(Lecture lecture, AttendanceStatus status) { + return (int)lecture.getAttendances().stream() + .filter(attendance -> attendance.getStatus().equals(status)) + .count(); + } + + private static int getAbsentCount(Lecture lecture) { + return lecture.isEnd() ? getCount(lecture, ABSENT) : 0; + } + + private static int getUnknownCount(Lecture lecture) { + return lecture.isEnd() ? 0 : getCount(lecture, ABSENT); + } +} diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/AttendancesStatusVO.java b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/AttendancesStatusVO.java deleted file mode 100644 index 5b624d6a..00000000 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/AttendancesStatusVO.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.sopt.makers.operation.web.lecture.dto.response; - -import static org.operation.attendance.domain.AttendanceStatus.*; - -import java.time.LocalDateTime; - -import org.operation.attendance.domain.AttendanceStatus; -import org.operation.lecture.Lecture; - -import lombok.Builder; - -@Builder -public record AttendancesStatusVO( - int attendance, - int absent, - int tardy, - int unknown -) { - public static AttendancesStatusVO of(Lecture lecture) { - return AttendancesStatusVO.builder() - .attendance(getCount(lecture, ATTENDANCE)) - .absent(isEnd(lecture) ? getCount(lecture, ABSENT) : 0) - .tardy(getCount(lecture, TARDY)) - .unknown(isEnd(lecture) ? 0 : getCount(lecture, ABSENT)) - .build(); - } - - public static int getCount(Lecture lecture, AttendanceStatus status) { - return (int)lecture.getAttendances().stream() - .filter(attendance -> attendance.getStatus().equals(status)) - .count(); - } - - public static boolean isEnd(Lecture lecture) { - return lecture.getEndDate().isBefore(LocalDateTime.now()); - } -} diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureDetailResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureDetailResponse.java index 65dafdf5..9a290a9c 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureDetailResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureDetailResponse.java @@ -1,6 +1,6 @@ package org.sopt.makers.operation.web.lecture.dto.response; -import org.operation.lecture.Lecture; +import org.sopt.makers.operation.domain.lecture.Lecture; import lombok.Builder; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LecturesResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureListResponse.java similarity index 62% rename from operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LecturesResponse.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureListResponse.java index cdb32ae0..ac758686 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LecturesResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureListResponse.java @@ -3,21 +3,23 @@ import java.util.List; import org.sopt.makers.operation.domain.Part; -import org.operation.lecture.Attribute; -import org.operation.lecture.Lecture; +import org.sopt.makers.operation.domain.lecture.Attribute; +import org.sopt.makers.operation.domain.lecture.Lecture; +import lombok.AccessLevel; import lombok.Builder; -public record LecturesResponse( +@Builder(access = AccessLevel.PRIVATE) +public record LectureListResponse( int generation, List lectures ) { - public static LecturesResponse of(int generation, List lectures) { - return new LecturesResponse( - generation, - lectures.stream().map(LectureVO::of).toList() - ); + public static LectureListResponse of(int generation, List lectureList) { + return LectureListResponse.builder() + .generation(generation) + .lectures(lectureList.stream().map(LectureVO::of).toList()) + .build(); } @Builder @@ -31,7 +33,7 @@ public record LectureVO( Attribute attributeValue, String attributeName, String place, - AttendancesStatusVO attendances + AttendanceStatusListVO attendances ) { private static LectureVO of(Lecture lecture) { return LectureVO.builder() @@ -44,9 +46,8 @@ private static LectureVO of(Lecture lecture) { .attributeValue(lecture.getAttribute()) .attributeName(lecture.getAttribute().getName()) .place(lecture.getPlace()) - .attendances(AttendancesStatusVO.of(lecture)) + .attendances(AttendanceStatusListVO.of(lecture)) .build(); } } } - diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureResponse.java index 2bdf8f20..afa15f31 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureResponse.java @@ -6,10 +6,10 @@ import java.util.List; import org.sopt.makers.operation.domain.Part; -import org.operation.lecture.Attribute; -import org.operation.lecture.Lecture; -import org.operation.lecture.LectureStatus; -import org.operation.lecture.SubLecture; +import org.sopt.makers.operation.domain.lecture.Attribute; +import org.sopt.makers.operation.domain.lecture.Lecture; +import org.sopt.makers.operation.domain.lecture.LectureStatus; +import org.sopt.makers.operation.domain.lecture.SubLecture; import lombok.Builder; @@ -21,7 +21,7 @@ public record LectureResponse( Part part, Attribute attribute, List subLectures, - AttendancesStatusVO attendances, + AttendanceStatusListVO attendances, LectureStatus status ) { @@ -33,7 +33,7 @@ public static LectureResponse of(Lecture lecture) { .part(lecture.getPart()) .attribute(lecture.getAttribute()) .subLectures(lecture.getSubLectures().stream().map(SubLectureVO::of).toList()) - .attendances(AttendancesStatusVO.of(lecture)) + .attendances(AttendanceStatusListVO.of(lecture)) .status(lecture.getLectureStatus()) .build(); } diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/service/LectureService.java b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/service/LectureService.java index 31f48c22..a785c99b 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/service/LectureService.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/service/LectureService.java @@ -6,14 +6,14 @@ import org.sopt.makers.operation.web.lecture.dto.response.AttendanceResponse; import org.sopt.makers.operation.web.lecture.dto.response.LectureDetailResponse; import org.sopt.makers.operation.web.lecture.dto.response.LectureResponse; -import org.sopt.makers.operation.web.lecture.dto.response.LecturesResponse; +import org.sopt.makers.operation.web.lecture.dto.response.LectureListResponse; public interface LectureService { long createLecture(LectureRequest request); - LecturesResponse getLectures(int generation, Part part); + LectureListResponse getLectures(int generation, Part part); LectureResponse getLecture(long lectureId); AttendanceResponse startAttendance(AttendanceRequest request); - void endLecture(Long lectureId); - void deleteLecture(Long lectureId); + void endLecture(long lectureId); + void deleteLecture(long lectureId); LectureDetailResponse getLectureDetail(long lectureId); } diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/service/LectureServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/service/LectureServiceImpl.java index dd002d4d..584e0cf2 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/service/LectureServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/service/LectureServiceImpl.java @@ -1,33 +1,32 @@ package org.sopt.makers.operation.web.lecture.service; -import static org.operation.alarm.domain.Attribute.*; -import static org.operation.lecture.message.ErrorMessage.*; +import static org.sopt.makers.operation.code.failure.LectureFailureCode.*; import java.util.List; import java.util.stream.Stream; -import org.operation.attendance.domain.Attendance; -import org.operation.attendance.domain.SubAttendance; -import org.operation.attendance.repository.attendance.AttendanceRepository; -import org.operation.attendance.repository.subAttendance.SubAttendanceRepository; -import org.operation.client.alarm.AlarmSender; -import org.sopt.makers.operation.common.config.ValueConfig; +import org.sopt.makers.operation.client.alarm.AlarmSender; +import org.sopt.makers.operation.client.alarm.dto.AlarmSenderRequest; +import org.sopt.makers.operation.config.ValueConfig; import org.sopt.makers.operation.domain.Part; -import org.sopt.makers.operation.common.exception.LectureException; -import org.sopt.makers.operation.common.exception.SubLectureException; -import org.operation.lecture.Lecture; -import org.operation.lecture.SubLecture; -import org.operation.lecture.repository.lecture.LectureRepository; -import org.operation.lecture.repository.subLecture.SubLectureRepository; -import org.operation.member.domain.Member; -import org.operation.member.repository.MemberRepository; +import org.sopt.makers.operation.domain.attendance.domain.Attendance; +import org.sopt.makers.operation.domain.attendance.domain.SubAttendance; +import org.sopt.makers.operation.domain.attendance.repository.attendance.AttendanceRepository; +import org.sopt.makers.operation.domain.attendance.repository.subAttendance.SubAttendanceRepository; +import org.sopt.makers.operation.domain.lecture.Lecture; +import org.sopt.makers.operation.domain.lecture.SubLecture; +import org.sopt.makers.operation.domain.lecture.repository.lecture.LectureRepository; +import org.sopt.makers.operation.domain.lecture.repository.subLecture.SubLectureRepository; +import org.sopt.makers.operation.domain.member.domain.Member; +import org.sopt.makers.operation.domain.member.repository.MemberRepository; +import org.sopt.makers.operation.exception.LectureException; +import org.sopt.makers.operation.exception.SubLectureException; import org.sopt.makers.operation.web.lecture.dto.request.AttendanceRequest; import org.sopt.makers.operation.web.lecture.dto.request.LectureRequest; import org.sopt.makers.operation.web.lecture.dto.response.AttendanceResponse; import org.sopt.makers.operation.web.lecture.dto.response.LectureDetailResponse; import org.sopt.makers.operation.web.lecture.dto.response.LectureResponse; -import org.sopt.makers.operation.web.lecture.dto.response.LecturesResponse; -import org.sopt.makers.operation.web.alarm.dto.request.AlarmSenderRequest; +import org.sopt.makers.operation.web.lecture.dto.response.LectureListResponse; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -51,19 +50,19 @@ public class LectureServiceImpl implements LectureService { @Transactional public long createLecture(LectureRequest request) { val savedLecture = saveLecture(request); - createSubLectures(savedLecture); - createAttendance(request.generation(), request.part(), savedLecture); - createSubAttendances(savedLecture); + saveAttendances(request.generation(), request.part(), savedLecture); return savedLecture.getId(); } private Lecture saveLecture(LectureRequest request) { - val lecture = request.toEntity(); - return lectureRepository.save(lecture); + val savedLecture = lectureRepository.save(request.toEntity()); + saveSubLectures(savedLecture); + return savedLecture; } - private void createSubLectures(Lecture lecture) { - Stream.iterate(1, i -> i + 1).limit(valueConfig.getSUB_LECTURE_MAX_ROUND()) + private void saveSubLectures(Lecture lecture) { + val maxRound = valueConfig.getSUB_LECTURE_MAX_ROUND(); + Stream.iterate(1, i -> i + 1).limit(maxRound) .forEach(round -> saveSubLecture(lecture, round)); } @@ -71,20 +70,19 @@ private void saveSubLecture(Lecture lecture, int round) { subLectureRepository.save(new SubLecture(lecture, round)); } - private void createAttendance(int generation, Part part, Lecture lecture) { - memberRepository.find(generation, part).forEach(member -> saveAttendance(member, lecture)); + private void saveAttendances(int generation, Part part, Lecture lecture) { + memberRepository.find(generation, part) + .forEach(member -> saveAttendance(member, lecture)); } private void saveAttendance(Member member, Lecture lecture) { - attendanceRepository.save(new Attendance(member, lecture)); - } - - private void createSubAttendances(Lecture lecture) { - lecture.getAttendances().forEach(this::saveSubAttendances); + val savedAttendance = attendanceRepository.save(new Attendance(member, lecture)); + saveSubAttendances(savedAttendance); } private void saveSubAttendances(Attendance attendance) { - attendance.getLecture().getSubLectures().forEach(subLecture -> saveSubAttendance(attendance, subLecture)); + attendance.getLecture().getSubLectures() + .forEach(subLecture -> saveSubAttendance(attendance, subLecture)); } private void saveSubAttendance(Attendance attendance, SubLecture subLecture) { @@ -92,101 +90,111 @@ private void saveSubAttendance(Attendance attendance, SubLecture subLecture) { } @Override - public LecturesResponse getLectures(int generation, Part part) { - val lectures = lectureRepository.find(generation, part); - return LecturesResponse.of(generation, lectures); + public LectureListResponse getLectures(int generation, Part part) { + val lectureList = findLectures(generation, part); + return LectureListResponse.of(generation, lectureList); + } + + private List findLectures(int generation, Part part) { + return lectureRepository.find(generation, part); } @Override public LectureResponse getLecture(long lectureId) { - Lecture lecture = findLecture(lectureId); + val lecture = findLecture(lectureId); return LectureResponse.of(lecture); } + private Lecture findLecture(long id) { + return lectureRepository.findById(id) + .orElseThrow(() -> new LectureException(INVALID_LECTURE)); + } + @Override @Transactional public AttendanceResponse startAttendance(AttendanceRequest request) { - val lecture = findLecture(request.lectureId()); - checkStartAttendanceValidity(lecture, request.round()); - val subLecture = getSubLecture(lecture, request.round()); + val lecture = getLectureToStartAttendance(request.lectureId(), request.round()); + val subLecture = getSubLectureToStartAttendance(lecture, request.round()); subLecture.startAttendance(request.code()); return AttendanceResponse.of(lecture, subLecture); } + private Lecture getLectureToStartAttendance(long lectureId, int round) { + val lecture = findLecture(lectureId); + checkStartAttendanceValidity(lecture, round); + return lecture; + } + private void checkStartAttendanceValidity(Lecture lecture, int round) { if (lecture.isEnd()) { - throw new LectureException(END_LECTURE.getContent()); + throw new LectureException(END_LECTURE); } else if (round == 2 && lecture.isBefore()) { - throw new LectureException(NOT_STARTED_PRE_ATTENDANCE.getContent()); + throw new LectureException(NOT_STARTED_PRE_ATTENDANCE); } } + private SubLecture getSubLectureToStartAttendance(Lecture lecture, int round) { + return lecture.getSubLectures().stream() + .filter(l -> l.getRound() == round) + .findFirst() + .orElseThrow(() -> new SubLectureException(NO_SUB_LECTURE_EQUAL_ROUND)); + } + @Override @Transactional - public void endLecture(Long lectureId) { - val lecture = findLecture(lectureId); - checkEndLectureValidity(lecture); + public void endLecture(long lectureId) { + val lecture = getLectureToEnd(lectureId); lecture.updateToEnd(); sendAlarm(lecture); } - @Override - @Transactional - public void deleteLecture(Long lectureId) { + private Lecture getLectureToEnd(long lectureId) { val lecture = findLecture(lectureId); - if (lecture.isEnd()) { - restoreAttendances(lecture.getAttendances()); - } - subAttendanceRepository.deleteAllBySubLectureIn(lecture.getSubLectures()); - subLectureRepository.deleteAllByLecture(lecture); - attendanceRepository.deleteAllByLecture(lecture); - lectureRepository.deleteById(lectureId); + checkEndLectureValidity(lecture); + return lecture; } - private void restoreAttendances(List attendances) { - attendances.forEach(Attendance::revertMemberScore); + private void checkEndLectureValidity(Lecture lecture) { + if (!lecture.isEnd()) { + throw new LectureException(NOT_END_TIME_YET); + } } - @Override - public LectureDetailResponse getLectureDetail(long lectureId) { - val lecture = findLecture(lectureId); - return LectureDetailResponse.of(lecture); + private void sendAlarm(Lecture lecture) { + val alarmRequest = AlarmSenderRequest.of(lecture, valueConfig); + alarmSender.send(alarmRequest); } - private Lecture findLecture(Long id) { - return lectureRepository.findById(id) - .orElseThrow(() -> new LectureException(INVALID_LECTURE.getContent())); + @Override + @Transactional + public void deleteLecture(long lectureId) { + val lecture = getLectureToDelete(lectureId); + deleteRelationship(lecture); + lectureRepository.deleteById(lectureId); } - private void checkEndLectureValidity(Lecture lecture) { - if (!lecture.isEnd()) { - throw new LectureException(NOT_END_TIME_YET.getContent()); + private Lecture getLectureToDelete(long lectureId) { + val lecture = findLecture(lectureId); + if (lecture.isEnd()) { + restoreAttendances(lecture.getAttendances()); } + return lecture; } - private void sendAlarm(Lecture lecture) { - val alarmTitle = getAlarmTitle(lecture); - val alarmContent = valueConfig.getALARM_MESSAGE_CONTENT(); - val memberPlaygroundIds = getMemberPlaygroundIds(lecture); - alarmSender.send(new AlarmSenderRequest(alarmTitle, alarmContent, memberPlaygroundIds, NEWS, null)); - } - - private List getMemberPlaygroundIds(Lecture lecture) { - return lecture.getAttendances().stream() - .map(attendance -> String.valueOf(attendance.getMember().getPlaygroundId())) - .filter(id -> !id.equals("null")) - .toList(); + private void restoreAttendances(List attendances) { + attendances.forEach(Attendance::restoreMemberScore); } - private String getAlarmTitle(Lecture lecture) { - return lecture.getName() + " " + valueConfig.getALARM_MESSAGE_TITLE(); + private void deleteRelationship(Lecture lecture) { + subAttendanceRepository.deleteAllBySubLectureIn(lecture.getSubLectures()); + subLectureRepository.deleteAllByLecture(lecture); + attendanceRepository.deleteAllByLecture(lecture); } - private SubLecture getSubLecture(Lecture lecture, int round) { - return lecture.getSubLectures().stream() - .filter(l -> l.getRound() == round) - .findFirst() - .orElseThrow(() -> new SubLectureException(NO_SUB_LECTURE_EQUAL_ROUND.getContent())); + @Override + public LectureDetailResponse getLectureDetail(long lectureId) { + val lecture = findLecture(lectureId); + return LectureDetailResponse.of(lecture); } } diff --git a/operation-common/src/main/java/org/sopt/makers/operation/code/failure/LectureFailureCode.java b/operation-common/src/main/java/org/sopt/makers/operation/code/failure/LectureFailureCode.java index 9e8fc48d..c23d10a8 100644 --- a/operation-common/src/main/java/org/sopt/makers/operation/code/failure/LectureFailureCode.java +++ b/operation-common/src/main/java/org/sopt/makers/operation/code/failure/LectureFailureCode.java @@ -11,7 +11,18 @@ @Getter public enum LectureFailureCode implements FailureCode { INVALID_DATE_PATTERN(BAD_REQUEST, "유효하지 않은 날짜 형식입니다."), - INVALID_LECTURE(NOT_FOUND, "유효하지 않은 세션입니다."), + INVALID_SUB_LECTURE(NOT_FOUND, "존재하지 않는 세션입니다."), + INVALID_CODE(BAD_REQUEST, "코드가 일치하지 않아요!"), + NOT_STARTED_NTH_ATTENDANCE(BAD_REQUEST, "차 출석 시작 전입니다."), + ENDED_ATTENDANCE(BAD_REQUEST, "차 출석이 이미 종료되었습니다."), + INVALID_LECTURE(NOT_FOUND, "존재하지 않는 세션입니다."), + NOT_END_TIME_YET(BAD_REQUEST, "세션 종료 시간이 지나지 않았습니다."), + NO_SUB_LECTURE_EQUAL_ROUND(NOT_FOUND, "해당 라운드와 일치하는 출석 세션이 없습니다."), + END_LECTURE(BAD_REQUEST, "이미 종료된 세션입니다."), + NOT_STARTED_PRE_ATTENDANCE(BAD_REQUEST, "이전의 출석체크가 시작되지 않았습니다."), + INVALID_COUNT_SESSION(BAD_REQUEST, "세션의 개수가 올바르지 않습니다."), + NO_SESSION(NOT_FOUND, "오늘 세션이 없습니다."), + NOT_STARTED_ATTENDANCE(BAD_REQUEST, "출석 시작 전입니다."), ; private final HttpStatus status; diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/domain/Attendance.java b/operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/domain/Attendance.java index 35ffdbc9..031051ab 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/domain/Attendance.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/domain/Attendance.java @@ -91,7 +91,7 @@ public void updateMemberScore() { this.member.updateScore(this.getScore()); } - public void revertMemberScore() { + public void restoreMemberScore() { this.member.updateScore((-1) * this.getScore()); } diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/domain/lecture/message/ErrorMessage.java b/operation-domain/src/main/java/org/sopt/makers/operation/domain/lecture/message/ErrorMessage.java deleted file mode 100644 index ace1abfd..00000000 --- a/operation-domain/src/main/java/org/sopt/makers/operation/domain/lecture/message/ErrorMessage.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.sopt.makers.operation.domain.lecture.message; - -import lombok.AllArgsConstructor; -import lombok.Getter; - -@AllArgsConstructor -@Getter -public enum ErrorMessage { - INVALID_SUB_LECTURE("존재하지 않는 세션입니다."), - INVALID_CODE("코드가 일치하지 않아요!"), - NOT_STARTED_NTH_ATTENDANCE("차 출석 시작 전입니다."), - ENDED_ATTENDANCE("차 출석이 이미 종료되었습니다."), - INVALID_LECTURE("존재하지 않는 세션입니다."), - NOT_END_TIME_YET("세션 종료 시간이 지나지 않았습니다."), - NO_SUB_LECTURE_EQUAL_ROUND("해당 라운드와 일치하는 출석 세션이 없습니다."), - END_LECTURE("이미 종료된 세션입니다."), - NOT_STARTED_PRE_ATTENDANCE("이전의 출석체크가 시작되지 않았습니다."), - INVALID_COUNT_SESSION("세션의 개수가 올바르지 않습니다."), - NO_SESSION("오늘 세션이 없습니다."), - NOT_STARTED_ATTENDANCE("출석 시작 전입니다."), - ; - - private final String content; -} diff --git a/operation-external/src/main/java/org/sopt/makers/operation/client/alarm/dto/AlarmSenderRequest.java b/operation-external/src/main/java/org/sopt/makers/operation/client/alarm/dto/AlarmSenderRequest.java index 2b94ac93..b8d1322d 100644 --- a/operation-external/src/main/java/org/sopt/makers/operation/client/alarm/dto/AlarmSenderRequest.java +++ b/operation-external/src/main/java/org/sopt/makers/operation/client/alarm/dto/AlarmSenderRequest.java @@ -1,12 +1,17 @@ package org.sopt.makers.operation.client.alarm.dto; +import static org.sopt.makers.operation.domain.alarm.domain.Attribute.*; + import java.util.List; +import org.sopt.makers.operation.config.ValueConfig; import org.sopt.makers.operation.domain.alarm.domain.Alarm; import org.sopt.makers.operation.domain.alarm.domain.Attribute; +import org.sopt.makers.operation.domain.lecture.Lecture; import lombok.AccessLevel; import lombok.Builder; +import lombok.val; @Builder(access = AccessLevel.PRIVATE) public record AlarmSenderRequest( @@ -17,7 +22,7 @@ public record AlarmSenderRequest( String link ) { - public static AlarmSenderRequest of (Alarm alarm, List targetList) { + public static AlarmSenderRequest of(Alarm alarm, List targetList) { return AlarmSenderRequest.builder() .title(alarm.getTitle()) .content(alarm.getContent()) @@ -26,4 +31,24 @@ public static AlarmSenderRequest of (Alarm alarm, List targetList) { .link(alarm.getLink()) .build(); } + + public static AlarmSenderRequest of(Lecture lecture, ValueConfig valueConfig) { + val title = lecture.getName() + " " + valueConfig.getALARM_MESSAGE_TITLE(); + val content = valueConfig.getALARM_MESSAGE_CONTENT(); + val targetList = getTargetsFromLecture(lecture); + return AlarmSenderRequest.builder() + .title(title) + .content(content) + .targetList(targetList) + .attribute(NEWS) + .build(); + } + + private static List getTargetsFromLecture(Lecture lecture) { + return lecture.getAttendances().stream() + .map(attendance -> String.valueOf(attendance.getMember().getPlaygroundId())) + .filter(id -> !id.equals("null")) + .toList(); + } + } From a9a9fb073503ece2aed2c72dc8d2432692ee1bf2 Mon Sep 17 00:00:00 2001 From: thguss Date: Tue, 6 Feb 2024 15:25:21 +0900 Subject: [PATCH 080/141] =?UTF-8?q?[REFACTOR]=20Member=20=EB=A6=AC?= =?UTF-8?q?=ED=8C=A9=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../response/AttendanceTotalResponseDTO.java | 1 - .../app/member/service/MemberServiceImpl.java | 1 - .../dto/response/AttendanceTotalCountVO.java | 17 ----- .../dto/response/AttendanceTotalVO.java | 32 -------- .../dto/response/MemberListGetResponse.java | 24 ------ .../member/dto/response/MembersResponse.java | 13 ---- .../web/member/service/MemberServiceImpl.java | 73 ------------------- .../web/member/api/MemberApiController.java | 4 +- .../dto/response/MemberListResponse.java | 71 ++++++++++++++++++ .../web/member/message/SuccessMessage.java | 13 ---- .../web/member/service/MemberService.java | 4 +- .../web/member/service/MemberServiceImpl.java | 26 +++++++ .../code/success/web/MemberSuccessCode.java | 19 +++++ .../repository/MemberCustomRepository.java | 3 +- .../repository/MemberRepositoryImpl.java | 20 ++++- 15 files changed, 139 insertions(+), 182 deletions(-) delete mode 100644 operation-api/src/main/java/org/sopt/makers/operation/service/web/member/dto/response/AttendanceTotalCountVO.java delete mode 100644 operation-api/src/main/java/org/sopt/makers/operation/service/web/member/dto/response/AttendanceTotalVO.java delete mode 100644 operation-api/src/main/java/org/sopt/makers/operation/service/web/member/dto/response/MemberListGetResponse.java delete mode 100644 operation-api/src/main/java/org/sopt/makers/operation/service/web/member/dto/response/MembersResponse.java delete mode 100644 operation-api/src/main/java/org/sopt/makers/operation/service/web/member/service/MemberServiceImpl.java create mode 100644 operation-api/src/main/java/org/sopt/makers/operation/web/member/dto/response/MemberListResponse.java delete mode 100644 operation-api/src/main/java/org/sopt/makers/operation/web/member/message/SuccessMessage.java create mode 100644 operation-api/src/main/java/org/sopt/makers/operation/web/member/service/MemberServiceImpl.java create mode 100644 operation-common/src/main/java/org/sopt/makers/operation/code/success/web/MemberSuccessCode.java diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/app/member/dto/response/AttendanceTotalResponseDTO.java b/operation-api/src/main/java/org/sopt/makers/operation/service/app/member/dto/response/AttendanceTotalResponseDTO.java index a35eaf2c..ffcb5d4e 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/app/member/dto/response/AttendanceTotalResponseDTO.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/service/app/member/dto/response/AttendanceTotalResponseDTO.java @@ -4,7 +4,6 @@ import org.sopt.makers.operation.domain.Part; import org.operation.member.domain.Member; -import org.sopt.makers.operation.service.web.member.dto.response.AttendanceTotalCountVO; public record AttendanceTotalResponseDTO( Part part, diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/app/member/service/MemberServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/service/app/member/service/MemberServiceImpl.java index 5b83191e..63a0f27a 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/app/member/service/MemberServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/service/app/member/service/MemberServiceImpl.java @@ -15,7 +15,6 @@ import org.operation.lecture.Attribute; import org.operation.member.domain.Member; import org.operation.member.repository.MemberRepository; -import org.sopt.makers.operation.service.web.member.dto.response.AttendanceTotalCountVO; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/web/member/dto/response/AttendanceTotalCountVO.java b/operation-api/src/main/java/org/sopt/makers/operation/service/web/member/dto/response/AttendanceTotalCountVO.java deleted file mode 100644 index 758761a8..00000000 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/web/member/dto/response/AttendanceTotalCountVO.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.sopt.makers.operation.service.web.member.dto.response; - -public record AttendanceTotalCountVO( - int attendance, - int absent, - int tardy, - int participate -) { - public static AttendanceTotalCountVO of(int attendance, int absent, int tardy, int participate){ - return new AttendanceTotalCountVO( - attendance, - absent, - tardy, - participate - ); - } -} diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/web/member/dto/response/AttendanceTotalVO.java b/operation-api/src/main/java/org/sopt/makers/operation/service/web/member/dto/response/AttendanceTotalVO.java deleted file mode 100644 index 4a8e9d4c..00000000 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/web/member/dto/response/AttendanceTotalVO.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.sopt.makers.operation.service.web.member.dto.response; - -import java.time.format.DateTimeFormatter; - -import org.operation.attendance.domain.Attendance; -import org.operation.attendance.domain.AttendanceStatus; -import org.operation.lecture.Attribute; - -public record AttendanceTotalVO( - Attribute attribute, - String name, - AttendanceStatus status, - String date -) { - public static AttendanceTotalVO of(Attendance attendance){ - return new AttendanceTotalVO( - attendance.getLecture().getAttribute(), - attendance.getLecture().getName(), - attendance.getStatus(), - attendance.getLecture().getStartDate() - .format(DateTimeFormatter.ofPattern("M월 d일")) - ); - } - - public static AttendanceTotalVO getTotalAttendanceVO(Attendance attendance) { - return AttendanceTotalVO.of(attendance); - } - - public static AttendanceStatus getAttendanceStatus(AttendanceTotalVO attendance) { - return attendance.status(); - } -} diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/web/member/dto/response/MemberListGetResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/service/web/member/dto/response/MemberListGetResponse.java deleted file mode 100644 index c133aec9..00000000 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/web/member/dto/response/MemberListGetResponse.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.sopt.makers.operation.service.web.member.dto.response; - -import org.sopt.makers.operation.domain.Part; -import org.operation.member.domain.Member; - -public record MemberListGetResponse( - Long id, - String name, - String university, - Part part, - float score, - AttendanceTotalCountVO total -) { - public static MemberListGetResponse of(Member member, AttendanceTotalCountVO total){ - return new MemberListGetResponse( - member.getId(), - member.getName(), - member.getUniversity(), - member.getPart(), - member.getScore(), - total - ); - } -} diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/web/member/dto/response/MembersResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/service/web/member/dto/response/MembersResponse.java deleted file mode 100644 index c605164a..00000000 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/web/member/dto/response/MembersResponse.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.sopt.makers.operation.service.web.member.dto.response; - -import java.util.List; - -public record MembersResponse( - List members, - int totalCount -) { - public static MembersResponse of(List members, int totalCount) { - return new MembersResponse(members, totalCount); - } - -} diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/web/member/service/MemberServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/service/web/member/service/MemberServiceImpl.java deleted file mode 100644 index 1dc4819a..00000000 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/web/member/service/MemberServiceImpl.java +++ /dev/null @@ -1,73 +0,0 @@ -package org.sopt.makers.operation.service.web.member.service; - -import java.util.EnumMap; -import java.util.List; - -import org.operation.attendance.domain.AttendanceStatus; -import org.operation.attendance.repository.attendance.AttendanceRepository; -import org.sopt.makers.operation.domain.Part; -import org.sopt.makers.operation.dto.MemberSearchCondition; -import org.operation.member.domain.Member; -import org.operation.member.repository.MemberRepository; -import org.sopt.makers.operation.service.web.member.dto.response.AttendanceTotalCountVO; -import org.sopt.makers.operation.service.web.member.dto.response.AttendanceTotalVO; -import org.sopt.makers.operation.service.web.member.dto.response.MemberListGetResponse; -import org.sopt.makers.operation.service.web.member.dto.response.MembersResponse; -import org.springframework.data.domain.Pageable; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import lombok.RequiredArgsConstructor; -import lombok.val; - -@Service -@RequiredArgsConstructor -@Transactional(readOnly = true) -public class MemberServiceImpl implements MemberService { - - private final MemberRepository memberRepository; - private final AttendanceRepository attendanceRepository; - - @Override - public MembersResponse getMemberList(Part part, int generation, Pageable pageable) { - if (part.equals(Part.ALL)) { - part = null; - } - - val members = memberRepository.search(new MemberSearchCondition(part, generation), pageable) - .stream().map(member -> { - val attendances = findAttendances(member); - val countAttendance = countAttendance(attendances); - val total = translateAttendanceStatus(countAttendance); - return MemberListGetResponse.of(member, total); - }).toList(); - val membersCount = memberRepository.countByGenerationAndPart(generation, part); - - return MembersResponse.of(members, membersCount); - } - - private List findAttendances(Member member) { - return attendanceRepository.findAttendanceByMemberId(member.getId()) - .stream().map(AttendanceTotalVO::getTotalAttendanceVO) - .toList(); - } - - private EnumMap countAttendance(List attendances) { - return attendances.stream() - .map(AttendanceTotalVO::getAttendanceStatus) - .collect( - () -> new EnumMap<>(AttendanceStatus.class), - (map, status) -> map.merge(status, 1, Integer::sum), - (map1, map2) -> map2.forEach((status, count) -> map1.merge(status, count, Integer::sum)) - ); - } - - private AttendanceTotalCountVO translateAttendanceStatus(EnumMap countAttendance) { - return AttendanceTotalCountVO.of( - countAttendance.getOrDefault(AttendanceStatus.ATTENDANCE, 0), - countAttendance.getOrDefault(AttendanceStatus.ABSENT, 0), - countAttendance.getOrDefault(AttendanceStatus.TARDY, 0), - countAttendance.getOrDefault(AttendanceStatus.PARTICIPATE, 0) - ); - } -} diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/member/api/MemberApiController.java b/operation-api/src/main/java/org/sopt/makers/operation/web/member/api/MemberApiController.java index ec735980..fa0b4ff5 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/member/api/MemberApiController.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/member/api/MemberApiController.java @@ -1,6 +1,6 @@ package org.sopt.makers.operation.web.member.api; -import static org.sopt.makers.operation.web.member.message.SuccessMessage.*; +import static org.sopt.makers.operation.code.success.web.MemberSuccessCode.*; import org.sopt.makers.operation.domain.Part; import org.sopt.makers.operation.common.dto.BaseResponse; @@ -31,6 +31,6 @@ public ResponseEntity> getMemberList( Pageable pageable ) { val response = memberService.getMemberList(part, generation, pageable); - return ApiResponseUtil.ok(SUCCESS_GET_MEMBERS.getContent(), response); + return ApiResponseUtil.success(SUCCESS_GET_MEMBERS, response); } } diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/member/dto/response/MemberListResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/web/member/dto/response/MemberListResponse.java new file mode 100644 index 00000000..cc579b3b --- /dev/null +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/member/dto/response/MemberListResponse.java @@ -0,0 +1,71 @@ +package org.sopt.makers.operation.web.member.dto.response; + +import static org.sopt.makers.operation.domain.attendance.domain.AttendanceStatus.*; + +import java.util.List; + +import org.sopt.makers.operation.domain.Part; +import org.sopt.makers.operation.domain.attendance.domain.AttendanceStatus; +import org.sopt.makers.operation.domain.member.domain.Member; + +import lombok.AccessLevel; +import lombok.Builder; + +@Builder(access = AccessLevel.PRIVATE) +public record MemberListResponse( + List members, + int totalCount +) { + public static MemberListResponse of(List memberList, int totalCount) { + return MemberListResponse.builder() + .members(memberList.stream().map(MemberVO::of).toList()) + .totalCount(totalCount) + .build(); + } + + @Builder(access = AccessLevel.PRIVATE) + private record MemberVO( + Long id, + String name, + String university, + Part part, + float score, + AttendanceInfo total + ) { + + private static MemberVO of(Member member) { + return MemberVO.builder() + .id(member.getId()) + .name(member.getName()) + .university(member.getUniversity()) + .part(member.getPart()) + .score(member.getScore()) + .total(AttendanceInfo.of(member)) + .build(); + } + } + + @Builder(access = AccessLevel.PRIVATE) + private record AttendanceInfo( + int attendance, + int absent, + int tardy, + int participate + ) { + + private static AttendanceInfo of(Member member) { + return AttendanceInfo.builder() + .attendance(getCount(member, ATTENDANCE)) + .absent(getCount(member, ABSENT)) + .tardy(getCount(member, TARDY)) + .participate(getCount(member, PARTICIPATE)) + .build(); + } + + private static int getCount(Member member, AttendanceStatus status) { + return (int)member.getAttendances().stream() + .filter(attendance -> attendance.getStatus().equals(status)) + .count(); + } + } +} diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/member/message/SuccessMessage.java b/operation-api/src/main/java/org/sopt/makers/operation/web/member/message/SuccessMessage.java deleted file mode 100644 index 39648185..00000000 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/member/message/SuccessMessage.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.sopt.makers.operation.web.member.message; - -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -@Getter -@RequiredArgsConstructor -public enum SuccessMessage { - SUCCESS_GET_MEMBERS("유저 리스트 조회 성공"), - ; - - private final String content; -} diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/member/service/MemberService.java b/operation-api/src/main/java/org/sopt/makers/operation/web/member/service/MemberService.java index bd2ba65a..d4e817ba 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/member/service/MemberService.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/member/service/MemberService.java @@ -1,9 +1,9 @@ package org.sopt.makers.operation.web.member.service; import org.sopt.makers.operation.domain.Part; -import org.sopt.makers.operation.web.member.dto.response.MembersResponse; +import org.sopt.makers.operation.web.member.dto.response.MemberListResponse; import org.springframework.data.domain.Pageable; public interface MemberService { - MembersResponse getMemberList(Part part, int generation, Pageable pageable); + MemberListResponse getMembers(Part part, int generation, Pageable pageable); } diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/member/service/MemberServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/web/member/service/MemberServiceImpl.java new file mode 100644 index 00000000..a2eaac89 --- /dev/null +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/member/service/MemberServiceImpl.java @@ -0,0 +1,26 @@ +package org.sopt.makers.operation.web.member.service; + +import org.sopt.makers.operation.domain.Part; +import org.sopt.makers.operation.domain.member.repository.MemberRepository; +import org.sopt.makers.operation.web.member.dto.response.MemberListResponse; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import lombok.RequiredArgsConstructor; +import lombok.val; + +@Service +@RequiredArgsConstructor +@Transactional(readOnly = true) +public class MemberServiceImpl implements MemberService { + + private final MemberRepository memberRepository; + + @Override + public MemberListResponse getMembers(Part part, int generation, Pageable pageable) { + val memberList = memberRepository.find(generation, part, pageable); + val totalCount = memberRepository.count(generation, part); + return MemberListResponse.of(memberList, totalCount); + } +} diff --git a/operation-common/src/main/java/org/sopt/makers/operation/code/success/web/MemberSuccessCode.java b/operation-common/src/main/java/org/sopt/makers/operation/code/success/web/MemberSuccessCode.java new file mode 100644 index 00000000..1bb0ea65 --- /dev/null +++ b/operation-common/src/main/java/org/sopt/makers/operation/code/success/web/MemberSuccessCode.java @@ -0,0 +1,19 @@ +package org.sopt.makers.operation.code.success.web; + +import static org.springframework.http.HttpStatus.*; + +import org.sopt.makers.operation.code.success.SuccessCode; +import org.springframework.http.HttpStatus; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +@Getter +public enum MemberSuccessCode implements SuccessCode { + SUCCESS_GET_MEMBERS(OK, "유저 리스트 조회 성공"), + ; + + private final HttpStatus status; + private final String message; +} diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/domain/member/repository/MemberCustomRepository.java b/operation-domain/src/main/java/org/sopt/makers/operation/domain/member/repository/MemberCustomRepository.java index b8a3aa2d..d6cff00c 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/domain/member/repository/MemberCustomRepository.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/domain/member/repository/MemberCustomRepository.java @@ -12,7 +12,8 @@ public interface MemberCustomRepository { List search(MemberSearchCondition condition, Pageable pageable); List search(MemberSearchCondition condition); Optional find(Long memberId); - int countByGenerationAndPart(int generation, Part part); + int count(int generation, Part part); List findOrderByName(int generation, Part part); List find(int generation, Part part); + List find(int generation, Part part, Pageable pageable); } diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/domain/member/repository/MemberRepositoryImpl.java b/operation-domain/src/main/java/org/sopt/makers/operation/domain/member/repository/MemberRepositoryImpl.java index df86a6c6..dc754b84 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/domain/member/repository/MemberRepositoryImpl.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/domain/member/repository/MemberRepositoryImpl.java @@ -69,13 +69,13 @@ public Optional find(Long memberId) { } @Override - public int countByGenerationAndPart(int generation, Part part) { + public int count(int generation, Part part) { return Math.toIntExact(queryFactory .select(member.count()) .from(member) .where( member.generation.eq(generation), - (nonNull(part) && !part.equals(ALL)) ? member.part.eq(part) : null + partEq(part) ) .fetchFirst()); } @@ -83,7 +83,6 @@ public int countByGenerationAndPart(int generation, Part part) { @Override public List findOrderByName(int generation, Part part) { StringExpression firstName = Expressions.stringTemplate("SUBSTR({0}, 1, 1)", member.name); - return queryFactory .selectFrom(member) .where( @@ -106,4 +105,19 @@ public List find(int generation, Part part) { private BooleanExpression partEq(Part part) { return (isNull(part) || part.equals(ALL)) ? null : member.part.eq(part); } + + @Override + public List find(int generation, Part part, Pageable pageable) { + StringExpression firstName = Expressions.stringTemplate("SUBSTR({0}, 1, 1)", member.name); + return queryFactory + .selectFrom(member) + .where( + partEq(part), + member.generation.eq(generation) + ) + .offset(pageable.getOffset()) + .limit(pageable.getPageSize()) + .orderBy(firstName.asc()) + .fetch(); + } } From 7a09850e7b11a9883a5102f828361fe90a409b93 Mon Sep 17 00:00:00 2001 From: thguss Date: Tue, 6 Feb 2024 15:25:48 +0900 Subject: [PATCH 081/141] =?UTF-8?q?[REFACTOR]=20Member=20=EB=A6=AC?= =?UTF-8?q?=ED=8C=A9=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../makers/operation/web/member/api/MemberApiController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/member/api/MemberApiController.java b/operation-api/src/main/java/org/sopt/makers/operation/web/member/api/MemberApiController.java index fa0b4ff5..94b317a5 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/member/api/MemberApiController.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/member/api/MemberApiController.java @@ -30,7 +30,7 @@ public ResponseEntity> getMemberList( @RequestParam(required = false) Integer generation, Pageable pageable ) { - val response = memberService.getMemberList(part, generation, pageable); + val response = memberService.getMembers(part, generation, pageable); return ApiResponseUtil.success(SUCCESS_GET_MEMBERS, response); } } From a9b8c0d3b77d2eedc5c88923ee14355540a1f448 Mon Sep 17 00:00:00 2001 From: thguss Date: Tue, 6 Feb 2024 15:34:02 +0900 Subject: [PATCH 082/141] =?UTF-8?q?[REFACTOR]=20Schedule=20=EB=A6=AC?= =?UTF-8?q?=ED=8C=A9=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../schedule/api/ScheduleApiController.java | 4 +-- .../dto/response/ScheduleListResponse.java} | 8 ++--- .../app/schedule/message/SuccessMessage.java | 13 -------- .../app/schedule/service/ScheduleService.java | 4 +-- .../schedule/service/ScheduleServiceImpl.java | 30 ++++++++++--------- .../code/success/app/ScheduleSuccessCode.java | 19 ++++++++++++ 6 files changed, 43 insertions(+), 35 deletions(-) rename operation-api/src/main/java/org/sopt/makers/operation/{service/app/schedule/dto/response/SchedulesResponseDTO.java => app/schedule/dto/response/ScheduleListResponse.java} (88%) delete mode 100644 operation-api/src/main/java/org/sopt/makers/operation/app/schedule/message/SuccessMessage.java rename operation-api/src/main/java/org/sopt/makers/operation/{service => }/app/schedule/service/ScheduleServiceImpl.java (77%) create mode 100644 operation-common/src/main/java/org/sopt/makers/operation/code/success/app/ScheduleSuccessCode.java diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/schedule/api/ScheduleApiController.java b/operation-api/src/main/java/org/sopt/makers/operation/app/schedule/api/ScheduleApiController.java index 5149ab41..8a148fd7 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/app/schedule/api/ScheduleApiController.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/schedule/api/ScheduleApiController.java @@ -1,6 +1,6 @@ package org.sopt.makers.operation.app.schedule.api; -import static org.sopt.makers.operation.app.schedule.message.SuccessMessage.*; +import static org.sopt.makers.operation.code.success.app.ScheduleSuccessCode.*; import java.time.LocalDateTime; @@ -31,6 +31,6 @@ public ResponseEntity> getSchedules( @RequestParam @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDateTime end ) { val response = scheduleService.getSchedules(start, end); - return ApiResponseUtil.ok(SUCCESS_GET_SCHEDULES.getContent(), response); + return ApiResponseUtil.success(SUCCESS_GET_SCHEDULES, response); } } diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/app/schedule/dto/response/SchedulesResponseDTO.java b/operation-api/src/main/java/org/sopt/makers/operation/app/schedule/dto/response/ScheduleListResponse.java similarity index 88% rename from operation-api/src/main/java/org/sopt/makers/operation/service/app/schedule/dto/response/SchedulesResponseDTO.java rename to operation-api/src/main/java/org/sopt/makers/operation/app/schedule/dto/response/ScheduleListResponse.java index 4b7d37e2..651758f3 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/app/schedule/dto/response/SchedulesResponseDTO.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/schedule/dto/response/ScheduleListResponse.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.service.app.schedule.dto.response; +package org.sopt.makers.operation.app.schedule.dto.response; import java.time.LocalDate; import java.time.format.TextStyle; @@ -11,11 +11,11 @@ import lombok.Builder; -public record SchedulesResponseDTO( +public record ScheduleListResponse( List dates ) { - public static SchedulesResponseDTO of(Map> scheduleMap) { - return new SchedulesResponseDTO( + public static ScheduleListResponse of(Map> scheduleMap) { + return new ScheduleListResponse( scheduleMap.keySet().stream().sorted() .map(key -> DateVO.of(key, scheduleMap.get(key))) .toList() diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/schedule/message/SuccessMessage.java b/operation-api/src/main/java/org/sopt/makers/operation/app/schedule/message/SuccessMessage.java deleted file mode 100644 index f16ed797..00000000 --- a/operation-api/src/main/java/org/sopt/makers/operation/app/schedule/message/SuccessMessage.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.sopt.makers.operation.app.schedule.message; - -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -@Getter -@RequiredArgsConstructor -public enum SuccessMessage { - SUCCESS_GET_SCHEDULES("일정 리스트 조회 성공") - ; - - private final String content; -} diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/schedule/service/ScheduleService.java b/operation-api/src/main/java/org/sopt/makers/operation/app/schedule/service/ScheduleService.java index ef80edd7..1fdc193e 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/app/schedule/service/ScheduleService.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/schedule/service/ScheduleService.java @@ -2,8 +2,8 @@ import java.time.LocalDateTime; -import org.sopt.makers.operation.app.schedule.dto.response.SchedulesResponseDTO; +import org.sopt.makers.operation.app.schedule.dto.response.ScheduleListResponse; public interface ScheduleService { - SchedulesResponseDTO getSchedules(LocalDateTime start, LocalDateTime end); + ScheduleListResponse getSchedules(LocalDateTime start, LocalDateTime end); } diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/app/schedule/service/ScheduleServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/app/schedule/service/ScheduleServiceImpl.java similarity index 77% rename from operation-api/src/main/java/org/sopt/makers/operation/service/app/schedule/service/ScheduleServiceImpl.java rename to operation-api/src/main/java/org/sopt/makers/operation/app/schedule/service/ScheduleServiceImpl.java index 4f587631..11bd6886 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/app/schedule/service/ScheduleServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/schedule/service/ScheduleServiceImpl.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.service.app.schedule.service; +package org.sopt.makers.operation.app.schedule.service; import static org.sopt.makers.operation.code.failure.ScheduleFailureCode.*; @@ -10,13 +10,12 @@ import java.util.List; import java.util.Map; import java.util.stream.Collectors; -import java.util.stream.LongStream; +import java.util.stream.IntStream; -import org.sopt.makers.operation.app.schedule.service.ScheduleService; import org.sopt.makers.operation.domain.schedule.domain.Schedule; import org.sopt.makers.operation.domain.schedule.repository.ScheduleRepository; import org.sopt.makers.operation.exception.ScheduleException; -import org.sopt.makers.operation.service.app.schedule.dto.response.SchedulesResponseDTO; +import org.sopt.makers.operation.app.schedule.dto.response.ScheduleListResponse; import org.springframework.stereotype.Service; import lombok.RequiredArgsConstructor; @@ -29,10 +28,10 @@ public class ScheduleServiceImpl implements ScheduleService { private final ScheduleRepository scheduleRepository; @Override - public SchedulesResponseDTO getSchedules(LocalDateTime start, LocalDateTime end) { - val schedules = scheduleRepository.findBetweenStartAndEnd(start, end); - val scheduleMap = classifiedByDate(schedules, start, end); - return SchedulesResponseDTO.of(scheduleMap); + public ScheduleListResponse getSchedules(LocalDateTime start, LocalDateTime end) { + val scheduleList = scheduleRepository.findBetweenStartAndEnd(start, end); + val scheduleMap = classifiedByDate(scheduleList, start, end); + return ScheduleListResponse.of(scheduleMap); } private Map> classifiedByDate(List schedules, LocalDateTime startAt, LocalDateTime endAt) { @@ -43,18 +42,21 @@ private Map> classifiedByDate(List schedules private Map> initScheduleMap(LocalDateTime startAt, LocalDateTime endAt) { //TODO: 클라이언트 개발 시간 리소스 절약을 위해 해당 메소드 활용, 가능한 일정이 존재하는 날짜만 key로 가지는 HashMap로 변경 요망 + val duration = getDuration(startAt, endAt); + return IntStream.range(0, duration) + .mapToObj(startAt::plusDays) + .collect(Collectors.toMap(LocalDateTime::toLocalDate, date -> new ArrayList<>())); + } + + private int getDuration(LocalDateTime startAt, LocalDateTime endAt) { val duration = Duration.between(startAt, endAt).toDays() + 1; validDuration(duration); - return LongStream.range(0, duration) - .mapToObj(startAt::plusDays) - .collect(Collectors.toMap( - LocalDateTime::toLocalDate, - date -> new ArrayList<>())); + return (int)duration; } private void validDuration(long duration) { //TODO: 추후 응답 값 형식 변경 후 삭제될 수 있는 메소드 - if (duration > 50) { + if (duration <= 0|| duration > 50) { throw new ScheduleException(INVALID_DATE_PERM); } } diff --git a/operation-common/src/main/java/org/sopt/makers/operation/code/success/app/ScheduleSuccessCode.java b/operation-common/src/main/java/org/sopt/makers/operation/code/success/app/ScheduleSuccessCode.java new file mode 100644 index 00000000..a6cf8515 --- /dev/null +++ b/operation-common/src/main/java/org/sopt/makers/operation/code/success/app/ScheduleSuccessCode.java @@ -0,0 +1,19 @@ +package org.sopt.makers.operation.code.success.app; + +import static org.springframework.http.HttpStatus.*; + +import org.sopt.makers.operation.code.success.SuccessCode; +import org.springframework.http.HttpStatus; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public enum ScheduleSuccessCode implements SuccessCode { + SUCCESS_GET_SCHEDULES(OK, "일정 리스트 조회 성공"), + ; + + private final HttpStatus status; + private final String message; +} From f7fb7291e3604262768ac308951b51c535a28d8c Mon Sep 17 00:00:00 2001 From: thguss Date: Tue, 6 Feb 2024 15:38:17 +0900 Subject: [PATCH 083/141] =?UTF-8?q?[REFACTOR]=20=EB=A6=AC=ED=8C=A9?= =?UTF-8?q?=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/scheduler/LectureScheduler.java | 2 +- .../scheduler/service/LectureService.java | 6 - .../response/LectureCurrentRoundResponse.java | 15 -- .../dto/response/LectureResponseType.java | 5 - .../dto/response/TodayLectureResponse.java | 62 ------ .../lecture/service/LectureServiceImpl.java | 179 ------------------ .../response/AttendanceTotalResponseDTO.java | 27 --- .../dto/response/AttendanceTotalVO.java | 32 ---- .../dto/response/MemberScoreGetResponse.java | 11 -- .../app/member/service/MemberServiceImpl.java | 87 --------- .../service/service/LectureServiceImpl.java | 75 -------- .../web/admin/dto/request/LoginRequest.java | 7 - .../web/admin/dto/request/SignUpRequest.java | 21 -- .../web/admin/dto/response/LoginResponse.java | 38 ---- .../admin/dto/response/RefreshResponse.java | 13 -- .../admin/dto/response/SignUpResponse.java | 25 --- .../web/admin/repository/AdminRepository.java | 14 -- .../web/admin/service/AdminServiceImpl.java | 108 ----------- .../web/lecture/service/LectureService.java | 1 + .../lecture/service/LectureServiceImpl.java | 7 + 20 files changed, 9 insertions(+), 726 deletions(-) delete mode 100644 operation-api/src/main/java/org/sopt/makers/operation/common/scheduler/service/LectureService.java delete mode 100644 operation-api/src/main/java/org/sopt/makers/operation/service/app/lecture/dto/response/LectureCurrentRoundResponse.java delete mode 100644 operation-api/src/main/java/org/sopt/makers/operation/service/app/lecture/dto/response/LectureResponseType.java delete mode 100644 operation-api/src/main/java/org/sopt/makers/operation/service/app/lecture/dto/response/TodayLectureResponse.java delete mode 100644 operation-api/src/main/java/org/sopt/makers/operation/service/app/lecture/service/LectureServiceImpl.java delete mode 100644 operation-api/src/main/java/org/sopt/makers/operation/service/app/member/dto/response/AttendanceTotalResponseDTO.java delete mode 100644 operation-api/src/main/java/org/sopt/makers/operation/service/app/member/dto/response/AttendanceTotalVO.java delete mode 100644 operation-api/src/main/java/org/sopt/makers/operation/service/app/member/dto/response/MemberScoreGetResponse.java delete mode 100644 operation-api/src/main/java/org/sopt/makers/operation/service/app/member/service/MemberServiceImpl.java delete mode 100644 operation-api/src/main/java/org/sopt/makers/operation/service/service/LectureServiceImpl.java delete mode 100644 operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/dto/request/LoginRequest.java delete mode 100644 operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/dto/request/SignUpRequest.java delete mode 100644 operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/dto/response/LoginResponse.java delete mode 100644 operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/dto/response/RefreshResponse.java delete mode 100644 operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/dto/response/SignUpResponse.java delete mode 100644 operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/repository/AdminRepository.java delete mode 100644 operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/service/AdminServiceImpl.java diff --git a/operation-api/src/main/java/org/sopt/makers/operation/common/scheduler/LectureScheduler.java b/operation-api/src/main/java/org/sopt/makers/operation/common/scheduler/LectureScheduler.java index c88673b2..8cd1223f 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/common/scheduler/LectureScheduler.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/common/scheduler/LectureScheduler.java @@ -1,6 +1,6 @@ package org.sopt.makers.operation.common.scheduler; -import org.sopt.makers.operation.common.scheduler.service.LectureService; +import org.sopt.makers.operation.web.lecture.service.LectureService; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/common/scheduler/service/LectureService.java b/operation-api/src/main/java/org/sopt/makers/operation/common/scheduler/service/LectureService.java deleted file mode 100644 index bab3d588..00000000 --- a/operation-api/src/main/java/org/sopt/makers/operation/common/scheduler/service/LectureService.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.sopt.makers.operation.common.scheduler.service; - -public interface LectureService { - - void endLectures(); -} diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/app/lecture/dto/response/LectureCurrentRoundResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/service/app/lecture/dto/response/LectureCurrentRoundResponse.java deleted file mode 100644 index 34cdeb1f..00000000 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/app/lecture/dto/response/LectureCurrentRoundResponse.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.sopt.makers.operation.service.app.lecture.dto.response; - -import org.operation.lecture.SubLecture; - -public record LectureCurrentRoundResponse( - Long id, - int round -) { - public static LectureCurrentRoundResponse of(SubLecture subLecture){ - return new LectureCurrentRoundResponse( - subLecture.getId(), - subLecture.getRound() - ); - } -} diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/app/lecture/dto/response/LectureResponseType.java b/operation-api/src/main/java/org/sopt/makers/operation/service/app/lecture/dto/response/LectureResponseType.java deleted file mode 100644 index f3f81bd2..00000000 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/app/lecture/dto/response/LectureResponseType.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.sopt.makers.operation.service.app.lecture.dto.response; - -public enum LectureResponseType { - NO_SESSION, HAS_ATTENDANCE, NO_ATTENDANCE -} diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/app/lecture/dto/response/TodayLectureResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/service/app/lecture/dto/response/TodayLectureResponse.java deleted file mode 100644 index 03e08a60..00000000 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/app/lecture/dto/response/TodayLectureResponse.java +++ /dev/null @@ -1,62 +0,0 @@ -package org.sopt.makers.operation.service.app.lecture.dto.response; - -import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; -import java.util.List; -import java.util.stream.Collectors; - -import org.operation.attendance.domain.AttendanceStatus; -import org.operation.attendance.domain.SubAttendance; -import org.operation.lecture.Lecture; - -import lombok.Builder; - -@Builder -public record TodayLectureResponse( - LectureResponseType type, - Long id, - String location, - String name, - String startDate, - String endDate, - String message, - List attendances -) { - public static TodayLectureResponse of(LectureResponseType type, Lecture lecture, String message, List attendances) { - - return TodayLectureResponse.builder() - .type(type) - .id(lecture.getId()) - .location(lecture.getPlace()) - .name(lecture.getName()) - .startDate(lecture.getStartDate().format(convertFormat())) - .endDate(lecture.getEndDate().format(convertFormat())) - .message(message) - .attendances(attendances.stream() - .map(subAttendance -> LectureGetResponseVO.of(subAttendance.getStatus(), subAttendance.getLastModifiedDate())) - .collect(Collectors.toList())) - .build(); - } - - private static DateTimeFormatter convertFormat() { - return DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss"); - } - - @Builder - record LectureGetResponseVO( - AttendanceStatus status, - String attendedAt - - ) { - public static LectureGetResponseVO of(AttendanceStatus status, LocalDateTime attendedAt) { - return LectureGetResponseVO.builder() - .status(status) - .attendedAt(attendedAt.format((convertFormat()))) - .build(); - } - - private static DateTimeFormatter convertFormat() { - return DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss"); - } - } -} diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/app/lecture/service/LectureServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/service/app/lecture/service/LectureServiceImpl.java deleted file mode 100644 index 5d2355d1..00000000 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/app/lecture/service/LectureServiceImpl.java +++ /dev/null @@ -1,179 +0,0 @@ -package org.sopt.makers.operation.service.app.lecture.service; - -import static org.operation.attendance.domain.AttendanceStatus.*; -import static org.operation.lecture.LectureStatus.*; -import static org.operation.lecture.message.ErrorMessage.*; - -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.time.LocalTime; -import java.util.Collections; -import java.util.List; - -import org.sopt.makers.operation.service.app.lecture.dto.response.LectureCurrentRoundResponse; -import org.sopt.makers.operation.service.app.lecture.dto.response.LectureResponseType; -import org.sopt.makers.operation.service.app.lecture.dto.response.TodayLectureResponse; -import org.operation.attendance.domain.Attendance; -import org.operation.attendance.domain.SubAttendance; -import org.operation.attendance.repository.attendance.AttendanceRepository; -import org.sopt.makers.operation.common.config.ValueConfig; -import org.sopt.makers.operation.common.exception.LectureException; -import org.sopt.makers.operation.common.exception.SubLectureException; -import org.operation.lecture.repository.lecture.LectureRepository; -import org.operation.lecture.Attribute; -import org.operation.lecture.Lecture; -import org.operation.lecture.SubLecture; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import lombok.RequiredArgsConstructor; -import lombok.val; - -@Service -@RequiredArgsConstructor -@Transactional(readOnly = true) -public class LectureServiceImpl implements LectureService { - - private final LectureRepository lectureRepository; - private final AttendanceRepository attendanceRepository; - private final ValueConfig valueConfig; - - @Override - public TodayLectureResponse getTodayLecture(long memberPlaygroundId) { - val attendances = attendanceRepository.findToday(memberPlaygroundId); - checkAttendancesSize(attendances); - - if (attendances.isEmpty()) { - return getEmptyResponse(); - } - - val attendance = getNowAttendance(attendances); - val lecture = attendance.getLecture(); - val responseType = getResponseType(lecture); - val message = getMessage(lecture.getAttribute()); - - if (responseType.equals(LectureResponseType.NO_ATTENDANCE) || lecture.isBefore()) { - return TodayLectureResponse.of(responseType, lecture, message, Collections.emptyList()); - } - - val subAttendances = attendance.getSubAttendances(); - val subAttendance = lecture.isFirst() ? subAttendances.get(0) : subAttendances.get(1); - return getTodayLectureResponse(subAttendance, responseType, lecture); - } - - private TodayLectureResponse getEmptyResponse() { - return TodayLectureResponse.builder() - .type(LectureResponseType.NO_SESSION) - .id(0L) - .location("") - .name("") - .startDate("") - .endDate("") - .message("") - .attendances(Collections.emptyList()) - .build(); - } - - private void checkAttendancesSize(List attendances) { - if (attendances.size() > valueConfig.getSUB_LECTURE_MAX_ROUND()) { - throw new LectureException(INVALID_COUNT_SESSION.getContent()); - } - } - - private Attendance getNowAttendance(List attendances) { - val index = getAttendanceIndex(); - return attendances.get(index); - } - - private int getAttendanceIndex() { - return (LocalDateTime.now().getHour() >= 16) ? 1 : 0; - } - - private LectureResponseType getResponseType(Lecture lecture) { - val attribute = lecture.getAttribute(); - return attribute.equals(Attribute.ETC) ? LectureResponseType.NO_ATTENDANCE : LectureResponseType.HAS_ATTENDANCE; - } - - private String getMessage(Attribute attribute) { - return switch (attribute) { - case SEMINAR -> valueConfig.getSEMINAR_MESSAGE(); - case EVENT -> valueConfig.getEVENT_MESSAGE(); - case ETC -> valueConfig.getETC_MESSAGE(); - }; - } - - private TodayLectureResponse getTodayLectureResponse(SubAttendance subAttendance, LectureResponseType responseType, Lecture lecture) { - val subLecture = subAttendance.getSubLecture(); - val isOnAttendanceCheck = LocalDateTime.now().isBefore(subLecture.getStartAt().plusMinutes(10)); - val message = getMessage(lecture.getAttribute()); - if (isOnAttendanceCheck && subAttendance.getStatus().equals(ABSENT)) { - return TodayLectureResponse.of(responseType, lecture, message, Collections.emptyList()); - } - return TodayLectureResponse.of(responseType, lecture, message, Collections.singletonList(subAttendance)); - } - - @Override - public LectureCurrentRoundResponse getCurrentLectureRound(long lectureId) { - val lecture = findLecture(lectureId); - val subLecture = getSubLecture(lecture); - checkLectureExist(lecture); - checkLectureBefore(lecture); - checkEndAttendance(subLecture); - checkLectureEnd(lecture); - return LectureCurrentRoundResponse.of(subLecture); - } - - private Lecture findLecture(Long id) { - return lectureRepository.findById(id) - .orElseThrow(() -> new LectureException(INVALID_LECTURE.getContent())); - } - - private SubLecture getSubLecture(Lecture lecture) { - val status = lecture.getLectureStatus(); - val round = status.equals(FIRST) ? 1 : 2; - return getSubLecture(lecture, round); - } - - private SubLecture getSubLecture(Lecture lecture, int round) { - return lecture.getSubLectures().stream() - .filter(l -> l.getRound() == round) - .findFirst() - .orElseThrow(() -> new SubLectureException(NO_SUB_LECTURE_EQUAL_ROUND.getContent())); - } - - private void checkLectureExist(Lecture lecture) { - val today = LocalDate.now(); - val startOfDay = today.atStartOfDay(); - val endOfDay = LocalDateTime.of(today, LocalTime.MAX); - val startAt = lecture.getStartDate(); - if (startAt.isBefore(startOfDay) || startAt.isAfter(endOfDay)) { - throw new LectureException(NO_SESSION.getContent()); - } - } - - private void checkLectureBefore(Lecture lecture) { - if (lecture.isBefore()) { - throw new LectureException(NOT_STARTED_ATTENDANCE.getContent()); - } - } - - private void checkEndAttendance(SubLecture subLecture) { - if (isEndAttendance(subLecture)) { - throw new LectureException(subLecture.getRound() + ENDED_ATTENDANCE.getContent()); - } - } - - private boolean isEndAttendance(SubLecture subLecture) { - val status = subLecture.getLecture().getLectureStatus(); - if (LocalDateTime.now().isAfter(subLecture.getStartAt().plusMinutes(10))) { - return status.equals(FIRST) || status.equals(SECOND); - } - return false; - } - - private void checkLectureEnd(Lecture lecture) { - if (lecture.isEnd()) { - throw new LectureException(END_LECTURE.getContent()); - } - } -} diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/app/member/dto/response/AttendanceTotalResponseDTO.java b/operation-api/src/main/java/org/sopt/makers/operation/service/app/member/dto/response/AttendanceTotalResponseDTO.java deleted file mode 100644 index ffcb5d4e..00000000 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/app/member/dto/response/AttendanceTotalResponseDTO.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.sopt.makers.operation.service.app.member.dto.response; - -import java.util.List; - -import org.sopt.makers.operation.domain.Part; -import org.operation.member.domain.Member; - -public record AttendanceTotalResponseDTO( - Part part, - int generation, - String name, - float score, - AttendanceTotalCountVO total, - List attendances -) -{ - public static AttendanceTotalResponseDTO of(Member member, AttendanceTotalCountVO total, List attendances){ - return new AttendanceTotalResponseDTO( - member.getPart(), - member.getGeneration(), - member.getName(), - member.getScore(), - total, - attendances - ); - } -} diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/app/member/dto/response/AttendanceTotalVO.java b/operation-api/src/main/java/org/sopt/makers/operation/service/app/member/dto/response/AttendanceTotalVO.java deleted file mode 100644 index 1eb7ae95..00000000 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/app/member/dto/response/AttendanceTotalVO.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.sopt.makers.operation.service.app.member.dto.response; - -import java.time.format.DateTimeFormatter; - -import org.operation.attendance.domain.Attendance; -import org.operation.attendance.domain.AttendanceStatus; -import org.operation.lecture.Attribute; - -public record AttendanceTotalVO( - Attribute attribute, - String name, - AttendanceStatus status, - String date -) { - public static AttendanceTotalVO of(Attendance attendance){ - return new AttendanceTotalVO( - attendance.getLecture().getAttribute(), - attendance.getLecture().getName(), - attendance.getStatus(), - attendance.getLecture().getStartDate() - .format(DateTimeFormatter.ofPattern("M월 d일")) - ); - } - - public static AttendanceTotalVO getTotalAttendanceVO(Attendance attendance) { - return AttendanceTotalVO.of(attendance); - } - - public static AttendanceStatus getAttendanceStatus(AttendanceTotalVO attendance) { - return attendance.status(); - } -} diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/app/member/dto/response/MemberScoreGetResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/service/app/member/dto/response/MemberScoreGetResponse.java deleted file mode 100644 index ccef19ae..00000000 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/app/member/dto/response/MemberScoreGetResponse.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.sopt.makers.operation.service.app.member.dto.response; - -public record MemberScoreGetResponse( - float score -) { - public static MemberScoreGetResponse of(float score){ - return new MemberScoreGetResponse( - score - ); - } -} diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/app/member/service/MemberServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/service/app/member/service/MemberServiceImpl.java deleted file mode 100644 index 63a0f27a..00000000 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/app/member/service/MemberServiceImpl.java +++ /dev/null @@ -1,87 +0,0 @@ -package org.sopt.makers.operation.service.app.member.service; - -import static org.operation.member.message.ErrorMessage.*; - -import java.util.EnumMap; -import java.util.List; - -import org.sopt.makers.operation.service.app.member.dto.response.AttendanceTotalResponseDTO; -import org.sopt.makers.operation.service.app.member.dto.response.AttendanceTotalVO; -import org.sopt.makers.operation.service.app.member.dto.response.MemberScoreGetResponse; -import org.operation.attendance.domain.AttendanceStatus; -import org.operation.attendance.repository.attendance.AttendanceRepository; -import org.sopt.makers.operation.common.config.ValueConfig; -import org.sopt.makers.operation.common.exception.MemberException; -import org.operation.lecture.Attribute; -import org.operation.member.domain.Member; -import org.operation.member.repository.MemberRepository; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import lombok.RequiredArgsConstructor; -import lombok.val; - -@Service -@RequiredArgsConstructor -@Transactional(readOnly = true) -public class MemberServiceImpl implements MemberService { - private final MemberRepository memberRepository; - private final AttendanceRepository attendanceRepository; - private final ValueConfig valueConfig; - - @Override - public AttendanceTotalResponseDTO getMemberTotalAttendance(Long playGroundId) { - val member = memberRepository.getMemberByPlaygroundIdAndGeneration(playGroundId, valueConfig.getGENERATION()) - .orElseThrow(() -> new MemberException(INVALID_MEMBER.getContent())); - - val attendances = findAttendances(member); - val countAttendance = countAttendance(attendances); - val total = translateAttendanceStatus(countAttendance); - - val filteredAttendances = filterEtcNoAppearance(attendances); - - return AttendanceTotalResponseDTO.of(member, total, filteredAttendances); - } - - @Override - public MemberScoreGetResponse getMemberScore(Long playGroundId) { - val member = memberRepository.getMemberByPlaygroundIdAndGeneration(playGroundId, valueConfig.getGENERATION()) - .orElseThrow(() -> new MemberException(INVALID_MEMBER.getContent())); - - return MemberScoreGetResponse.of(member.getScore()); - } - - private List filterEtcNoAppearance(List attendances) { - return attendances.stream() - .filter(attendanceTotalVO -> - !(attendanceTotalVO.attribute().equals(Attribute.ETC) - && attendanceTotalVO.status().equals(AttendanceStatus.NOT_PARTICIPATE)) - ) - .toList(); - } - - private List findAttendances(Member member) { - return attendanceRepository.findAttendanceByMemberId(member.getId()) - .stream().map(AttendanceTotalVO::getTotalAttendanceVO) - .toList(); - } - - private EnumMap countAttendance(List attendances) { - return attendances.stream() - .map(AttendanceTotalVO::getAttendanceStatus) - .collect( - () -> new EnumMap<>(AttendanceStatus.class), - (map, status) -> map.merge(status, 1, Integer::sum), - (map1, map2) -> map2.forEach((status, count) -> map1.merge(status, count, Integer::sum)) - ); - } - - private AttendanceTotalCountVO translateAttendanceStatus(EnumMap countAttendance) { - return AttendanceTotalCountVO.of( - countAttendance.getOrDefault(AttendanceStatus.ATTENDANCE, 0), - countAttendance.getOrDefault(AttendanceStatus.ABSENT, 0), - countAttendance.getOrDefault(AttendanceStatus.TARDY, 0), - countAttendance.getOrDefault(AttendanceStatus.PARTICIPATE, 0) - ); - } -} diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/service/LectureServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/service/service/LectureServiceImpl.java deleted file mode 100644 index 56a77fbe..00000000 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/service/LectureServiceImpl.java +++ /dev/null @@ -1,75 +0,0 @@ -package org.sopt.makers.operation.service.service; - -import static org.operation.alarm.domain.Attribute.*; -import static org.operation.lecture.message.ErrorMessage.*; - -import java.util.*; - -import lombok.val; - -import org.operation.client.alarm.AlarmSender; -import org.sopt.makers.operation.common.config.ValueConfig; -import org.sopt.makers.operation.common.exception.LectureException; -import org.sopt.makers.operation.common.scheduler.service.LectureService; - -import org.operation.lecture.Lecture; -import org.operation.lecture.repository.lecture.LectureRepository; -import org.sopt.makers.operation.web.alarm.dto.request.AlarmSenderRequest; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import lombok.RequiredArgsConstructor; - -@Service -@RequiredArgsConstructor -@Transactional(readOnly = true) -public class LectureServiceImpl implements LectureService { - - private final LectureRepository lectureRepository; - private final AlarmSender alarmSender; - private final ValueConfig valueConfig; - - @Override - @Transactional - public void endLectures() { - val lectures = lectureRepository.findLecturesToBeEnd(); - lectures.forEach(lecture -> endLecture(lecture.getId())); - } - - private void endLecture(Long lectureId) { - val lecture = findLecture(lectureId); - checkEndLectureValidity(lecture); - lecture.updateToEnd(); - sendAlarm(lecture); - } - - private Lecture findLecture(Long id) { - return lectureRepository.findById(id) - .orElseThrow(() -> new LectureException(INVALID_LECTURE.getContent())); - } - - private void checkEndLectureValidity(Lecture lecture) { - if (!lecture.isEnd()) { - throw new LectureException(NOT_END_TIME_YET.getContent()); - } - } - - private void sendAlarm(Lecture lecture) { - val alarmTitle = getAlarmTitle(lecture); - val alarmContent = valueConfig.getALARM_MESSAGE_CONTENT(); - val memberPlaygroundIds = getMemberPlaygroundIds(lecture); - alarmSender.send(new AlarmSenderRequest(alarmTitle, alarmContent, memberPlaygroundIds, NEWS, null)); - } - - private List getMemberPlaygroundIds(Lecture lecture) { - return lecture.getAttendances().stream() - .map(attendance -> String.valueOf(attendance.getMember().getPlaygroundId())) - .filter(id -> !id.equals("null")) - .toList(); - } - - private String getAlarmTitle(Lecture lecture) { - return lecture.getName() + " " + valueConfig.getALARM_MESSAGE_TITLE(); - } - -} diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/dto/request/LoginRequest.java b/operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/dto/request/LoginRequest.java deleted file mode 100644 index 1cce0ddc..00000000 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/dto/request/LoginRequest.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.sopt.makers.operation.service.web.admin.dto.request; - -public record LoginRequest( - String email, - String password -) { -} diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/dto/request/SignUpRequest.java b/operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/dto/request/SignUpRequest.java deleted file mode 100644 index 255eab06..00000000 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/dto/request/SignUpRequest.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.sopt.makers.operation.service.web.admin.dto.request; - -import org.operation.admin.domain.Admin; -import org.operation.admin.domain.Role; - -public record SignUpRequest( - String email, - String password, - String name, - Role role -) { - - public Admin toEntity() { - return Admin.builder() - .email(this.email) - .password(this.password) - .name(this.name) - .role(this.role) - .build(); - } -} diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/dto/response/LoginResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/dto/response/LoginResponse.java deleted file mode 100644 index 7e802ee9..00000000 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/dto/response/LoginResponse.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.sopt.makers.operation.service.web.admin.dto.response; - -import lombok.AccessLevel; -import lombok.Builder; -import org.operation.admin.domain.Admin; -import org.operation.admin.domain.AdminStatus; - -@Builder(access = AccessLevel.PRIVATE) -public record LoginResponse( - LoginResponseVO loginResponseVO, - String refreshToken -) { - - public static LoginResponse of(Admin admin, String accessToken) { - return builder() - .loginResponseVO(LoginResponseVO.of(admin, accessToken)) - .refreshToken(admin.getRefreshToken()) - .build(); - } - - @Builder - record LoginResponseVO( - Long id, - String name, - AdminStatus adminStatus, - String accessToken - ) { - - public static LoginResponseVO of(Admin admin, String accessToken) { - return builder() - .id(admin.getId()) - .name(admin.getName()) - .adminStatus(admin.getStatus()) - .accessToken(accessToken) - .build(); - } - } -} diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/dto/response/RefreshResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/dto/response/RefreshResponse.java deleted file mode 100644 index 9d521e51..00000000 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/dto/response/RefreshResponse.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.sopt.makers.operation.service.web.admin.dto.response; - -import org.operation.admin.domain.Admin; - -public record RefreshResponse( - String accessToken, - String refreshToken -) { - - public static RefreshResponse of(String accessToken, Admin admin) { - return new RefreshResponse(accessToken, admin.getRefreshToken()); - } -} \ No newline at end of file diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/dto/response/SignUpResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/dto/response/SignUpResponse.java deleted file mode 100644 index 628e13db..00000000 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/dto/response/SignUpResponse.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.sopt.makers.operation.service.web.admin.dto.response; - -import org.operation.admin.domain.Admin; -import org.operation.admin.domain.Role; - -import lombok.AccessLevel; -import lombok.Builder; - -@Builder(access = AccessLevel.PRIVATE) -public record SignUpResponse( - Long id, - String email, - String name, - Role role -) { - - public static SignUpResponse of(Admin admin) { - return SignUpResponse.builder() - .id(admin.getId()) - .email(admin.getEmail()) - .name(admin.getName()) - .role(admin.getRole()) - .build(); - } -} diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/repository/AdminRepository.java b/operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/repository/AdminRepository.java deleted file mode 100644 index d1680a2d..00000000 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/repository/AdminRepository.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.sopt.makers.operation.service.web.admin.repository; - -import java.util.Optional; - -import org.operation.admin.domain.Admin; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.stereotype.Repository; - -@Repository -public interface AdminRepository extends JpaRepository { - Optional findByEmail(String email); - boolean existsByEmail(String email); - -} diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/service/AdminServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/service/AdminServiceImpl.java deleted file mode 100644 index 76e65ff2..00000000 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/service/AdminServiceImpl.java +++ /dev/null @@ -1,108 +0,0 @@ -package org.sopt.makers.operation.service.web.admin.service; - -import org.operation.admin.domain.Admin; -import org.operation.security.AdminAuthentication; -import org.operation.security.jwt.JwtTokenProvider; -import org.sopt.makers.operation.service.web.admin.dto.request.SignUpRequest; -import org.sopt.makers.operation.service.web.admin.dto.response.SignUpResponse; -import org.sopt.makers.operation.service.web.admin.dto.request.LoginRequest; -import org.sopt.makers.operation.service.web.admin.dto.response.LoginResponse; -import org.sopt.makers.operation.service.web.admin.dto.response.RefreshResponse; -import org.sopt.makers.operation.common.exception.AdminFailureException; -import org.sopt.makers.operation.service.web.admin.repository.AdminRepository; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import lombok.RequiredArgsConstructor; -import lombok.val; - -@RequiredArgsConstructor -@Service -@Transactional(readOnly = true) -public class AdminServiceImpl implements AdminService { - - private final JwtTokenProvider jwtTokenProvider; //TODO auth - private final PasswordEncoder passwordEncoder; //TODO auth - private final AdminRepository adminRepository; - - @Override - @Transactional - public SignUpResponse signUp(SignUpRequest request){ - checkEmailDuplicated(request.email()); - val admin = adminRepository.save(request.toEntity()); - return SignUpResponse.of(admin); - } - - private void checkEmailDuplicated(String email) { - val isExist = adminRepository.existsByEmail(email); - if (isExist) { - throw new AdminFailureException("중복되는 이메일입니다"); //TODO: ExceptionMessage - } - } - - @Override - @Transactional - public LoginResponse login(LoginRequest request) { - val admin = findByEmail(request.email()); - checkPasswordMatched(request.password(), admin); - checkAdminAllowed(admin); - val refreshToken = generateRefreshToken(); - admin.updateRefreshToken(refreshToken); - val accessToken = generateAccessToken(admin); - return LoginResponse.of(admin, accessToken); - } - - private String generateAccessToken(Admin admin) { - val adminAuthentication = new AdminAuthentication(admin.getId(), null, null); - return jwtTokenProvider.generateAccessToken(adminAuthentication); - } - - private String generateRefreshToken() { - val authentication = new AdminAuthentication(admin.getId(), null, null); - return jwtTokenProvider.generateRefreshToken(authentication); - } - - private Admin findByEmail(String email) { - return adminRepository.findByEmail(email) - .orElseThrow(() -> new AdminFailureException("이메일이 존재하지 않습니다")); //TODO: message - } - - private void checkPasswordMatched(String password, Admin admin) { // TODO: admin 내부로 옮기는 게 좋지 않을까..? - if (!passwordEncoder.matches(password, admin.getPassword())) { - throw new AdminFailureException("비밀번호가 일치하지 않습니다"); - } - } - - private void checkAdminAllowed(Admin admin) { - if (admin.isNotAllowed()) { - throw new AdminFailureException("승인되지 않은 계정입니다"); - } - } - - @Override - @Transactional - public RefreshResponse refresh(String refreshToken) { - val adminId = jwtTokenProvider.getId(refreshToken, JwtTokenType.REFRESH_TOKEN); - val admin = findById((Long)adminId); - validateRefreshToken(admin, refreshToken); - val newAccessToken = generateAccessToken(); - - //TODO: 재발급 때 access만 해주지 않나?? - /* - val newRefreshToken = jwtTokenProvider.generateRefreshToken(adminAuthentication); - admin.updateRefreshToken(newRefreshToken);*/ - - return RefreshResponse.of(newAccessToken, admin); - } - - public void validateRefreshToken(Admin admin, String refreshToken) { - if(!admin.getRefreshToken().equals(refreshToken)) { - throw new AdminFailureException("토큰이 일치하지 않습니다"); //TODO: message - } - } - - private Admin findById(Long adminId) { - return adminRepository.findById(adminId) - .orElseThrow(() -> new AdminFailureException(INVALID_MEMBER.getName())); - } -} diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/service/LectureService.java b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/service/LectureService.java index a785c99b..54ca1f2e 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/service/LectureService.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/service/LectureService.java @@ -14,6 +14,7 @@ public interface LectureService { LectureResponse getLecture(long lectureId); AttendanceResponse startAttendance(AttendanceRequest request); void endLecture(long lectureId); + void endLectures(); void deleteLecture(long lectureId); LectureDetailResponse getLectureDetail(long lectureId); } diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/service/LectureServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/service/LectureServiceImpl.java index 584e0cf2..7602e240 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/service/LectureServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/service/LectureServiceImpl.java @@ -165,6 +165,13 @@ private void sendAlarm(Lecture lecture) { alarmSender.send(alarmRequest); } + @Override + @Transactional + public void endLectures() { + val lectures = lectureRepository.findLecturesToBeEnd(); + lectures.forEach(lecture -> endLecture(lecture.getId())); + } + @Override @Transactional public void deleteLecture(long lectureId) { From c60e184ecfd6e4fae44db8a922ca06a521d7fe74 Mon Sep 17 00:00:00 2001 From: thguss Date: Tue, 6 Feb 2024 15:38:57 +0900 Subject: [PATCH 084/141] =?UTF-8?q?[REFACTOR]=20=EB=A6=AC=ED=8C=A9?= =?UTF-8?q?=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operation/{common => }/scheduler/LectureScheduler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename operation-api/src/main/java/org/sopt/makers/operation/{common => }/scheduler/LectureScheduler.java (90%) diff --git a/operation-api/src/main/java/org/sopt/makers/operation/common/scheduler/LectureScheduler.java b/operation-api/src/main/java/org/sopt/makers/operation/scheduler/LectureScheduler.java similarity index 90% rename from operation-api/src/main/java/org/sopt/makers/operation/common/scheduler/LectureScheduler.java rename to operation-api/src/main/java/org/sopt/makers/operation/scheduler/LectureScheduler.java index 8cd1223f..909be2ee 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/common/scheduler/LectureScheduler.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/scheduler/LectureScheduler.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.common.scheduler; +package org.sopt.makers.operation.scheduler; import org.sopt.makers.operation.web.lecture.service.LectureService; import org.springframework.scheduling.annotation.EnableScheduling; From 0bae65e8548056ed8a219275d0327f6ebe8a1b6b Mon Sep 17 00:00:00 2001 From: thguss Date: Tue, 6 Feb 2024 15:41:39 +0900 Subject: [PATCH 085/141] =?UTF-8?q?[REFACTOR]=20=EB=A6=AC=ED=8C=A9?= =?UTF-8?q?=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/AttendanceServiceImpl.java | 8 +++---- .../dto/response/ScheduleListResponse.java | 4 ++-- .../schedule/service/ScheduleServiceImpl.java | 4 ++-- .../operation/web/alarm/api/AlarmApi.java | 4 ++-- .../web/alarm/api/AlarmApiController.java | 4 ++-- .../web/alarm/dto/request/AlarmRequest.java | 6 ++--- .../alarm/dto/response/AlarmListResponse.java | 4 ++-- .../web/alarm/dto/response/AlarmResponse.java | 4 ++-- .../web/alarm/service/AlarmService.java | 4 ++-- .../web/alarm/service/AlarmServiceImpl.java | 10 ++++----- .../web/attendnace/api/AttendanceApi.java | 2 +- .../api/AttendanceApiController.java | 2 +- .../request/UpdatedSubAttendanceRequest.java | 2 +- .../dto/response/AttendanceListResponse.java | 8 +++---- .../response/AttendanceMemberResponse.java | 6 ++--- .../UpdatedSubAttendanceResponse.java | 4 ++-- .../attendnace/service/AttendanceService.java | 2 +- .../service/AttendanceServiceImpl.java | 17 +++++++------- .../operation/web/lecture/api/LectureApi.java | 2 +- .../web/lecture/api/LectureApiController.java | 2 +- .../lecture/dto/request/LectureRequest.java | 6 ++--- .../dto/response/AttendanceResponse.java | 4 ++-- .../dto/response/AttendanceStatusListVO.java | 6 ++--- .../dto/response/LectureDetailResponse.java | 2 +- .../dto/response/LectureListResponse.java | 6 ++--- .../lecture/dto/response/LectureResponse.java | 10 ++++----- .../web/lecture/service/LectureService.java | 2 +- .../lecture/service/LectureServiceImpl.java | 22 +++++++++---------- .../operation/web/member/api/MemberApi.java | 2 +- .../web/member/api/MemberApiController.java | 2 +- .../dto/response/MemberListResponse.java | 8 +++---- .../web/member/service/MemberService.java | 2 +- .../web/member/service/MemberServiceImpl.java | 4 ++-- .../{domain => }/admin/domain/Admin.java | 2 +- .../admin/domain/AdminStatus.java | 2 +- .../{domain => }/admin/domain/Role.java | 2 +- .../{domain => }/alarm/domain/Alarm.java | 15 ++++++------- .../{domain => }/alarm/domain/Attribute.java | 2 +- .../{domain => }/alarm/domain/Status.java | 2 +- .../repository/AlarmCustomRepository.java | 8 +++---- .../alarm/repository/AlarmRepository.java | 4 ++-- .../alarm/repository/AlarmRepositoryImpl.java | 8 +++---- .../attendance/domain/Attendance.java | 8 +++---- .../attendance/domain/AttendanceStatus.java | 2 +- .../attendance/domain/SubAttendance.java | 8 +++---- .../AttendanceCustomRepository.java | 10 ++++----- .../attendance/AttendanceRepository.java | 8 +++---- .../attendance/AttendanceRepositoryImpl.java | 14 ++++++------ .../SubAttendanceRepository.java | 7 +++--- .../config/JpaAuditingConfig.java | 2 +- .../config/JpaQueryFactoryConfig.java | 2 +- .../{ => common}/domain/BaseEntity.java | 2 +- .../operation/{ => common}/domain/Part.java | 2 +- .../operation/domain/member/domain/ObYb.java | 5 ----- .../operation/dto/MemberSearchCondition.java | 9 -------- .../lecture => lecture/domain}/Attribute.java | 2 +- .../lecture => lecture/domain}/Lecture.java | 10 ++++----- .../domain}/LectureStatus.java | 2 +- .../domain}/SubLecture.java | 9 ++++---- .../lecture/LectureCustomRepository.java | 6 ++--- .../repository/lecture/LectureRepository.java | 4 ++-- .../lecture/LectureRepositoryImpl.java | 10 ++++----- .../subLecture/SubLectureRepository.java | 9 ++++---- .../{domain => }/member/domain/Member.java | 6 ++--- .../makers/operation/member/domain/ObYb.java | 5 +++++ .../repository/MemberCustomRepository.java | 8 +++---- .../member/repository/MemberRepository.java | 4 ++-- .../repository/MemberRepositoryImpl.java | 10 ++++----- .../converter/StringListConverter.java | 2 +- .../schedule/domain/Schedule.java | 6 ++--- .../repository/ScheduleCustomRepository.java | 4 ++-- .../repository/ScheduleRepository.java | 4 ++-- .../repository/ScheduleRepositoryImpl.java | 4 ++-- .../client/alarm/dto/AlarmSenderRequest.java | 8 +++---- .../client/playground/PlayGroundServer.java | 2 +- .../playground/PlayGroundServerImpl.java | 4 ++-- 76 files changed, 204 insertions(+), 214 deletions(-) rename operation-domain/src/main/java/org/sopt/makers/operation/{domain => }/admin/domain/Admin.java (95%) rename operation-domain/src/main/java/org/sopt/makers/operation/{domain => }/admin/domain/AdminStatus.java (56%) rename operation-domain/src/main/java/org/sopt/makers/operation/{domain => }/admin/domain/Role.java (71%) rename operation-domain/src/main/java/org/sopt/makers/operation/{domain => }/alarm/domain/Alarm.java (85%) rename operation-domain/src/main/java/org/sopt/makers/operation/{domain => }/alarm/domain/Attribute.java (76%) rename operation-domain/src/main/java/org/sopt/makers/operation/{domain => }/alarm/domain/Status.java (76%) rename operation-domain/src/main/java/org/sopt/makers/operation/{domain => }/alarm/repository/AlarmCustomRepository.java (54%) rename operation-domain/src/main/java/org/sopt/makers/operation/{domain => }/alarm/repository/AlarmRepository.java (57%) rename operation-domain/src/main/java/org/sopt/makers/operation/{domain => }/alarm/repository/AlarmRepositoryImpl.java (87%) rename operation-domain/src/main/java/org/sopt/makers/operation/{domain => }/attendance/domain/Attendance.java (92%) rename operation-domain/src/main/java/org/sopt/makers/operation/{domain => }/attendance/domain/AttendanceStatus.java (82%) rename operation-domain/src/main/java/org/sopt/makers/operation/{domain => }/attendance/domain/SubAttendance.java (87%) rename operation-domain/src/main/java/org/sopt/makers/operation/{domain => }/attendance/repository/attendance/AttendanceCustomRepository.java (56%) rename operation-domain/src/main/java/org/sopt/makers/operation/{domain => }/attendance/repository/attendance/AttendanceRepository.java (62%) rename operation-domain/src/main/java/org/sopt/makers/operation/{domain => }/attendance/repository/attendance/AttendanceRepositoryImpl.java (89%) rename operation-domain/src/main/java/org/sopt/makers/operation/{domain => }/attendance/repository/subAttendance/SubAttendanceRepository.java (58%) rename operation-domain/src/main/java/org/sopt/makers/operation/{ => common}/config/JpaAuditingConfig.java (80%) rename operation-domain/src/main/java/org/sopt/makers/operation/{ => common}/config/JpaQueryFactoryConfig.java (87%) rename operation-domain/src/main/java/org/sopt/makers/operation/{ => common}/domain/BaseEntity.java (91%) rename operation-domain/src/main/java/org/sopt/makers/operation/{ => common}/domain/Part.java (84%) delete mode 100644 operation-domain/src/main/java/org/sopt/makers/operation/domain/member/domain/ObYb.java delete mode 100644 operation-domain/src/main/java/org/sopt/makers/operation/dto/MemberSearchCondition.java rename operation-domain/src/main/java/org/sopt/makers/operation/{domain/lecture => lecture/domain}/Attribute.java (79%) rename operation-domain/src/main/java/org/sopt/makers/operation/{domain/lecture => lecture/domain}/Lecture.java (86%) rename operation-domain/src/main/java/org/sopt/makers/operation/{domain/lecture => lecture/domain}/LectureStatus.java (54%) rename operation-domain/src/main/java/org/sopt/makers/operation/{domain/lecture => lecture/domain}/SubLecture.java (89%) rename operation-domain/src/main/java/org/sopt/makers/operation/{domain => }/lecture/repository/lecture/LectureCustomRepository.java (57%) rename operation-domain/src/main/java/org/sopt/makers/operation/{domain => }/lecture/repository/lecture/LectureRepository.java (56%) rename operation-domain/src/main/java/org/sopt/makers/operation/{domain => }/lecture/repository/lecture/LectureRepositoryImpl.java (86%) rename operation-domain/src/main/java/org/sopt/makers/operation/{domain => }/lecture/repository/subLecture/SubLectureRepository.java (52%) rename operation-domain/src/main/java/org/sopt/makers/operation/{domain => }/member/domain/Member.java (87%) create mode 100644 operation-domain/src/main/java/org/sopt/makers/operation/member/domain/ObYb.java rename operation-domain/src/main/java/org/sopt/makers/operation/{domain => }/member/repository/MemberCustomRepository.java (69%) rename operation-domain/src/main/java/org/sopt/makers/operation/{domain => }/member/repository/MemberRepository.java (72%) rename operation-domain/src/main/java/org/sopt/makers/operation/{domain => }/member/repository/MemberRepositoryImpl.java (91%) rename operation-domain/src/main/java/org/sopt/makers/operation/{domain => schedule}/converter/StringListConverter.java (95%) rename operation-domain/src/main/java/org/sopt/makers/operation/{domain => }/schedule/domain/Schedule.java (82%) rename operation-domain/src/main/java/org/sopt/makers/operation/{domain => }/schedule/repository/ScheduleCustomRepository.java (59%) rename operation-domain/src/main/java/org/sopt/makers/operation/{domain => }/schedule/repository/ScheduleRepository.java (57%) rename operation-domain/src/main/java/org/sopt/makers/operation/{domain => }/schedule/repository/ScheduleRepositoryImpl.java (85%) diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/service/AttendanceServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/service/AttendanceServiceImpl.java index 657101aa..79de0d51 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/service/AttendanceServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/service/AttendanceServiceImpl.java @@ -1,13 +1,13 @@ package org.sopt.makers.operation.app.attendance.service; -import static org.sopt.makers.operation.domain.attendance.domain.AttendanceStatus.*; +import static org.sopt.makers.operation.attendance.domain.AttendanceStatus.*; import org.sopt.makers.operation.app.attendance.dto.request.AttendanceRequest; import org.sopt.makers.operation.app.attendance.dto.response.AttendanceResponse; import org.sopt.makers.operation.config.ValueConfig; -import org.sopt.makers.operation.domain.attendance.repository.attendance.AttendanceRepository; -import org.sopt.makers.operation.domain.lecture.repository.subLecture.SubLectureRepository; -import org.sopt.makers.operation.domain.member.repository.MemberRepository; +import org.sopt.makers.operation.attendance.repository.attendance.AttendanceRepository; +import org.sopt.makers.operation.lecture.repository.subLecture.SubLectureRepository; +import org.sopt.makers.operation.member.repository.MemberRepository; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/schedule/dto/response/ScheduleListResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/app/schedule/dto/response/ScheduleListResponse.java index 651758f3..a7f3f4f1 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/app/schedule/dto/response/ScheduleListResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/schedule/dto/response/ScheduleListResponse.java @@ -6,8 +6,8 @@ import java.util.Locale; import java.util.Map; -import org.sopt.makers.operation.domain.lecture.Attribute; -import org.sopt.makers.operation.domain.schedule.domain.Schedule; +import org.sopt.makers.operation.lecture.domain.Attribute; +import org.sopt.makers.operation.schedule.domain.Schedule; import lombok.Builder; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/schedule/service/ScheduleServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/app/schedule/service/ScheduleServiceImpl.java index 11bd6886..e9b71ea0 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/app/schedule/service/ScheduleServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/schedule/service/ScheduleServiceImpl.java @@ -12,8 +12,8 @@ import java.util.stream.Collectors; import java.util.stream.IntStream; -import org.sopt.makers.operation.domain.schedule.domain.Schedule; -import org.sopt.makers.operation.domain.schedule.repository.ScheduleRepository; +import org.sopt.makers.operation.schedule.domain.Schedule; +import org.sopt.makers.operation.schedule.repository.ScheduleRepository; import org.sopt.makers.operation.exception.ScheduleException; import org.sopt.makers.operation.app.schedule.dto.response.ScheduleListResponse; import org.springframework.stereotype.Service; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/api/AlarmApi.java b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/api/AlarmApi.java index c32b3f78..38b60a58 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/api/AlarmApi.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/api/AlarmApi.java @@ -1,8 +1,8 @@ package org.sopt.makers.operation.web.alarm.api; -import org.sopt.makers.operation.domain.Part; +import org.sopt.makers.operation.common.domain.Part; import org.sopt.makers.operation.common.dto.BaseResponse; -import org.sopt.makers.operation.domain.alarm.domain.Status; +import org.sopt.makers.operation.alarm.domain.Status; import org.sopt.makers.operation.web.alarm.dto.request.AlarmRequest; import org.sopt.makers.operation.web.alarm.dto.request.AlarmSendRequest; import org.springframework.data.domain.Pageable; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/api/AlarmApiController.java b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/api/AlarmApiController.java index 23ed799b..fdd48db9 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/api/AlarmApiController.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/api/AlarmApiController.java @@ -2,10 +2,10 @@ import static org.sopt.makers.operation.code.success.web.AlarmSuccessCode.*; -import org.sopt.makers.operation.domain.Part; +import org.sopt.makers.operation.common.domain.Part; import org.sopt.makers.operation.common.dto.BaseResponse; import org.sopt.makers.operation.common.util.ApiResponseUtil; -import org.sopt.makers.operation.domain.alarm.domain.Status; +import org.sopt.makers.operation.alarm.domain.Status; import org.sopt.makers.operation.web.alarm.dto.request.AlarmRequest; import org.sopt.makers.operation.web.alarm.dto.request.AlarmSendRequest; import org.sopt.makers.operation.web.alarm.service.AlarmService; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/request/AlarmRequest.java b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/request/AlarmRequest.java index cd468d78..68281b55 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/request/AlarmRequest.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/request/AlarmRequest.java @@ -2,9 +2,9 @@ import java.util.List; -import org.sopt.makers.operation.domain.Part; -import org.sopt.makers.operation.domain.alarm.domain.Alarm; -import org.sopt.makers.operation.domain.alarm.domain.Attribute; +import org.sopt.makers.operation.common.domain.Part; +import org.sopt.makers.operation.alarm.domain.Alarm; +import org.sopt.makers.operation.alarm.domain.Attribute; public record AlarmRequest( int generation, diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/response/AlarmListResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/response/AlarmListResponse.java index 17251584..24841c70 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/response/AlarmListResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/response/AlarmListResponse.java @@ -5,8 +5,8 @@ import java.time.LocalDateTime; import java.util.List; -import org.sopt.makers.operation.domain.Part; -import org.sopt.makers.operation.domain.alarm.domain.Alarm; +import org.sopt.makers.operation.common.domain.Part; +import org.sopt.makers.operation.alarm.domain.Alarm; import lombok.AccessLevel; import lombok.Builder; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/response/AlarmResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/response/AlarmResponse.java index 51ad6b8d..d7bb25f0 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/response/AlarmResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/response/AlarmResponse.java @@ -4,8 +4,8 @@ import java.time.LocalDateTime; -import org.sopt.makers.operation.domain.Part; -import org.sopt.makers.operation.domain.alarm.domain.Alarm; +import org.sopt.makers.operation.common.domain.Part; +import org.sopt.makers.operation.alarm.domain.Alarm; import lombok.Builder; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/service/AlarmService.java b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/service/AlarmService.java index 7a6c573d..c1fe4019 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/service/AlarmService.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/service/AlarmService.java @@ -1,7 +1,7 @@ package org.sopt.makers.operation.web.alarm.service; -import org.sopt.makers.operation.domain.Part; -import org.sopt.makers.operation.domain.alarm.domain.Status; +import org.sopt.makers.operation.common.domain.Part; +import org.sopt.makers.operation.alarm.domain.Status; import org.sopt.makers.operation.web.alarm.dto.request.AlarmRequest; import org.sopt.makers.operation.web.alarm.dto.request.AlarmSendRequest; import org.sopt.makers.operation.web.alarm.dto.response.AlarmResponse; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/service/AlarmServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/service/AlarmServiceImpl.java index cdddeeaf..b5c0f317 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/service/AlarmServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/service/AlarmServiceImpl.java @@ -9,11 +9,11 @@ import org.sopt.makers.operation.client.alarm.dto.AlarmSenderRequest; import org.sopt.makers.operation.client.playground.PlayGroundServer; import org.sopt.makers.operation.config.ValueConfig; -import org.sopt.makers.operation.domain.Part; -import org.sopt.makers.operation.domain.alarm.domain.Alarm; -import org.sopt.makers.operation.domain.alarm.domain.Status; -import org.sopt.makers.operation.domain.alarm.repository.AlarmRepository; -import org.sopt.makers.operation.domain.member.repository.MemberRepository; +import org.sopt.makers.operation.common.domain.Part; +import org.sopt.makers.operation.alarm.domain.Alarm; +import org.sopt.makers.operation.alarm.domain.Status; +import org.sopt.makers.operation.alarm.repository.AlarmRepository; +import org.sopt.makers.operation.member.repository.MemberRepository; import org.sopt.makers.operation.web.alarm.dto.request.AlarmRequest; import org.sopt.makers.operation.exception.AlarmException; import org.sopt.makers.operation.web.alarm.dto.request.AlarmSendRequest; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/api/AttendanceApi.java b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/api/AttendanceApi.java index 2e7562f7..0e369fc5 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/api/AttendanceApi.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/api/AttendanceApi.java @@ -1,6 +1,6 @@ package org.sopt.makers.operation.web.attendnace.api; -import org.sopt.makers.operation.domain.Part; +import org.sopt.makers.operation.common.domain.Part; import org.sopt.makers.operation.common.dto.BaseResponse; import org.sopt.makers.operation.web.attendnace.dto.request.UpdatedSubAttendanceRequest; import org.springframework.data.domain.Pageable; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/api/AttendanceApiController.java b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/api/AttendanceApiController.java index b9813d48..53a7d312 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/api/AttendanceApiController.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/api/AttendanceApiController.java @@ -2,7 +2,7 @@ import static org.sopt.makers.operation.code.success.web.AttendanceSuccessCode.*; -import org.sopt.makers.operation.domain.Part; +import org.sopt.makers.operation.common.domain.Part; import org.sopt.makers.operation.common.dto.BaseResponse; import org.sopt.makers.operation.common.util.ApiResponseUtil; import org.sopt.makers.operation.web.attendnace.dto.request.UpdatedSubAttendanceRequest; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/request/UpdatedSubAttendanceRequest.java b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/request/UpdatedSubAttendanceRequest.java index be35babd..3865572e 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/request/UpdatedSubAttendanceRequest.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/request/UpdatedSubAttendanceRequest.java @@ -1,6 +1,6 @@ package org.sopt.makers.operation.web.attendnace.dto.request; -import org.sopt.makers.operation.domain.attendance.domain.AttendanceStatus; +import org.sopt.makers.operation.attendance.domain.AttendanceStatus; public record UpdatedSubAttendanceRequest( long subAttendanceId, diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/AttendanceListResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/AttendanceListResponse.java index 2d0aed65..66f8240a 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/AttendanceListResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/AttendanceListResponse.java @@ -2,10 +2,10 @@ import java.util.List; -import org.sopt.makers.operation.domain.attendance.domain.Attendance; -import org.sopt.makers.operation.domain.attendance.domain.AttendanceStatus; -import org.sopt.makers.operation.domain.attendance.domain.SubAttendance; -import org.sopt.makers.operation.domain.member.domain.Member; +import org.sopt.makers.operation.attendance.domain.Attendance; +import org.sopt.makers.operation.attendance.domain.AttendanceStatus; +import org.sopt.makers.operation.attendance.domain.SubAttendance; +import org.sopt.makers.operation.member.domain.Member; import lombok.AccessLevel; import lombok.Builder; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/AttendanceMemberResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/AttendanceMemberResponse.java index 3afa6b11..215b7916 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/AttendanceMemberResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/AttendanceMemberResponse.java @@ -2,9 +2,9 @@ import java.util.List; -import org.sopt.makers.operation.domain.attendance.domain.Attendance; -import org.sopt.makers.operation.domain.attendance.domain.SubAttendance; -import org.sopt.makers.operation.domain.member.domain.Member; +import org.sopt.makers.operation.attendance.domain.Attendance; +import org.sopt.makers.operation.attendance.domain.SubAttendance; +import org.sopt.makers.operation.member.domain.Member; public record AttendanceMemberResponse( String name, diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/UpdatedSubAttendanceResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/UpdatedSubAttendanceResponse.java index 6ce177d2..a4798d00 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/UpdatedSubAttendanceResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/UpdatedSubAttendanceResponse.java @@ -1,7 +1,7 @@ package org.sopt.makers.operation.web.attendnace.dto.response; -import org.sopt.makers.operation.domain.attendance.domain.AttendanceStatus; -import org.sopt.makers.operation.domain.attendance.domain.SubAttendance; +import org.sopt.makers.operation.attendance.domain.AttendanceStatus; +import org.sopt.makers.operation.attendance.domain.SubAttendance; import lombok.AccessLevel; import lombok.Builder; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/service/AttendanceService.java b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/service/AttendanceService.java index 5bb04078..916e47d1 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/service/AttendanceService.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/service/AttendanceService.java @@ -1,6 +1,6 @@ package org.sopt.makers.operation.web.attendnace.service; -import org.sopt.makers.operation.domain.Part; +import org.sopt.makers.operation.common.domain.Part; import org.sopt.makers.operation.web.attendnace.dto.request.UpdatedSubAttendanceRequest; import org.sopt.makers.operation.web.attendnace.dto.response.AttendanceListResponse; import org.sopt.makers.operation.web.attendnace.dto.response.AttendanceMemberResponse; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/service/AttendanceServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/service/AttendanceServiceImpl.java index 51b29b69..88bd75dd 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/service/AttendanceServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/service/AttendanceServiceImpl.java @@ -4,15 +4,14 @@ import static org.sopt.makers.operation.code.failure.LectureFailureCode.*; import static org.sopt.makers.operation.code.failure.MemberFailureCode.*; -import org.sopt.makers.operation.code.failure.LectureFailureCode; -import org.sopt.makers.operation.domain.Part; -import org.sopt.makers.operation.domain.attendance.domain.SubAttendance; -import org.sopt.makers.operation.domain.attendance.repository.attendance.AttendanceRepository; -import org.sopt.makers.operation.domain.attendance.repository.subAttendance.SubAttendanceRepository; -import org.sopt.makers.operation.domain.lecture.Lecture; -import org.sopt.makers.operation.domain.lecture.repository.lecture.LectureRepository; -import org.sopt.makers.operation.domain.member.domain.Member; -import org.sopt.makers.operation.domain.member.repository.MemberRepository; +import org.sopt.makers.operation.common.domain.Part; +import org.sopt.makers.operation.attendance.domain.SubAttendance; +import org.sopt.makers.operation.attendance.repository.attendance.AttendanceRepository; +import org.sopt.makers.operation.attendance.repository.subAttendance.SubAttendanceRepository; +import org.sopt.makers.operation.lecture.domain.Lecture; +import org.sopt.makers.operation.lecture.repository.lecture.LectureRepository; +import org.sopt.makers.operation.member.domain.Member; +import org.sopt.makers.operation.member.repository.MemberRepository; import org.sopt.makers.operation.exception.LectureException; import org.sopt.makers.operation.exception.MemberException; import org.sopt.makers.operation.web.attendnace.dto.request.UpdatedSubAttendanceRequest; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/api/LectureApi.java b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/api/LectureApi.java index 9d45bb29..463f4d05 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/api/LectureApi.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/api/LectureApi.java @@ -1,6 +1,6 @@ package org.sopt.makers.operation.web.lecture.api; -import org.sopt.makers.operation.domain.Part; +import org.sopt.makers.operation.common.domain.Part; import org.sopt.makers.operation.common.dto.BaseResponse; import org.sopt.makers.operation.web.lecture.dto.request.AttendanceRequest; import org.sopt.makers.operation.web.lecture.dto.request.LectureRequest; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/api/LectureApiController.java b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/api/LectureApiController.java index ef9fae6b..952066fc 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/api/LectureApiController.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/api/LectureApiController.java @@ -2,7 +2,7 @@ import static org.sopt.makers.operation.code.success.web.LectureSuccessCode.*; -import org.sopt.makers.operation.domain.Part; +import org.sopt.makers.operation.common.domain.Part; import org.sopt.makers.operation.common.dto.BaseResponse; import org.sopt.makers.operation.common.util.ApiResponseUtil; import org.sopt.makers.operation.web.lecture.dto.request.AttendanceRequest; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/request/LectureRequest.java b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/request/LectureRequest.java index 194a5d75..c27aad55 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/request/LectureRequest.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/request/LectureRequest.java @@ -5,9 +5,9 @@ import java.time.LocalDateTime; import java.time.format.DateTimeParseException; -import org.sopt.makers.operation.domain.Part; -import org.sopt.makers.operation.domain.lecture.Attribute; -import org.sopt.makers.operation.domain.lecture.Lecture; +import org.sopt.makers.operation.common.domain.Part; +import org.sopt.makers.operation.lecture.domain.Attribute; +import org.sopt.makers.operation.lecture.domain.Lecture; import org.sopt.makers.operation.exception.DateTimeParseCustomException; import lombok.Builder; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/AttendanceResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/AttendanceResponse.java index 3b3159c2..cdb149b5 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/AttendanceResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/AttendanceResponse.java @@ -1,7 +1,7 @@ package org.sopt.makers.operation.web.lecture.dto.response; -import org.sopt.makers.operation.domain.lecture.Lecture; -import org.sopt.makers.operation.domain.lecture.SubLecture; +import org.sopt.makers.operation.lecture.domain.Lecture; +import org.sopt.makers.operation.lecture.domain.SubLecture; import lombok.Builder; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/AttendanceStatusListVO.java b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/AttendanceStatusListVO.java index f3389734..6ef3d909 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/AttendanceStatusListVO.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/AttendanceStatusListVO.java @@ -1,9 +1,9 @@ package org.sopt.makers.operation.web.lecture.dto.response; -import static org.sopt.makers.operation.domain.attendance.domain.AttendanceStatus.*; +import static org.sopt.makers.operation.attendance.domain.AttendanceStatus.*; -import org.sopt.makers.operation.domain.attendance.domain.AttendanceStatus; -import org.sopt.makers.operation.domain.lecture.Lecture; +import org.sopt.makers.operation.attendance.domain.AttendanceStatus; +import org.sopt.makers.operation.lecture.domain.Lecture; import lombok.Builder; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureDetailResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureDetailResponse.java index 9a290a9c..60d4c244 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureDetailResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureDetailResponse.java @@ -1,6 +1,6 @@ package org.sopt.makers.operation.web.lecture.dto.response; -import org.sopt.makers.operation.domain.lecture.Lecture; +import org.sopt.makers.operation.lecture.domain.Lecture; import lombok.Builder; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureListResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureListResponse.java index ac758686..f3426a5b 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureListResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureListResponse.java @@ -2,9 +2,9 @@ import java.util.List; -import org.sopt.makers.operation.domain.Part; -import org.sopt.makers.operation.domain.lecture.Attribute; -import org.sopt.makers.operation.domain.lecture.Lecture; +import org.sopt.makers.operation.common.domain.Part; +import org.sopt.makers.operation.lecture.domain.Attribute; +import org.sopt.makers.operation.lecture.domain.Lecture; import lombok.AccessLevel; import lombok.Builder; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureResponse.java index afa15f31..cec5b93b 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureResponse.java @@ -5,11 +5,11 @@ import java.time.LocalDateTime; import java.util.List; -import org.sopt.makers.operation.domain.Part; -import org.sopt.makers.operation.domain.lecture.Attribute; -import org.sopt.makers.operation.domain.lecture.Lecture; -import org.sopt.makers.operation.domain.lecture.LectureStatus; -import org.sopt.makers.operation.domain.lecture.SubLecture; +import org.sopt.makers.operation.common.domain.Part; +import org.sopt.makers.operation.lecture.domain.Attribute; +import org.sopt.makers.operation.lecture.domain.Lecture; +import org.sopt.makers.operation.lecture.domain.LectureStatus; +import org.sopt.makers.operation.lecture.domain.SubLecture; import lombok.Builder; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/service/LectureService.java b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/service/LectureService.java index 54ca1f2e..a2516568 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/service/LectureService.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/service/LectureService.java @@ -1,6 +1,6 @@ package org.sopt.makers.operation.web.lecture.service; -import org.sopt.makers.operation.domain.Part; +import org.sopt.makers.operation.common.domain.Part; import org.sopt.makers.operation.web.lecture.dto.request.AttendanceRequest; import org.sopt.makers.operation.web.lecture.dto.request.LectureRequest; import org.sopt.makers.operation.web.lecture.dto.response.AttendanceResponse; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/service/LectureServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/service/LectureServiceImpl.java index 7602e240..a6d94b5e 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/service/LectureServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/service/LectureServiceImpl.java @@ -8,17 +8,17 @@ import org.sopt.makers.operation.client.alarm.AlarmSender; import org.sopt.makers.operation.client.alarm.dto.AlarmSenderRequest; import org.sopt.makers.operation.config.ValueConfig; -import org.sopt.makers.operation.domain.Part; -import org.sopt.makers.operation.domain.attendance.domain.Attendance; -import org.sopt.makers.operation.domain.attendance.domain.SubAttendance; -import org.sopt.makers.operation.domain.attendance.repository.attendance.AttendanceRepository; -import org.sopt.makers.operation.domain.attendance.repository.subAttendance.SubAttendanceRepository; -import org.sopt.makers.operation.domain.lecture.Lecture; -import org.sopt.makers.operation.domain.lecture.SubLecture; -import org.sopt.makers.operation.domain.lecture.repository.lecture.LectureRepository; -import org.sopt.makers.operation.domain.lecture.repository.subLecture.SubLectureRepository; -import org.sopt.makers.operation.domain.member.domain.Member; -import org.sopt.makers.operation.domain.member.repository.MemberRepository; +import org.sopt.makers.operation.common.domain.Part; +import org.sopt.makers.operation.attendance.domain.Attendance; +import org.sopt.makers.operation.attendance.domain.SubAttendance; +import org.sopt.makers.operation.attendance.repository.attendance.AttendanceRepository; +import org.sopt.makers.operation.attendance.repository.subAttendance.SubAttendanceRepository; +import org.sopt.makers.operation.lecture.domain.Lecture; +import org.sopt.makers.operation.lecture.domain.SubLecture; +import org.sopt.makers.operation.lecture.repository.lecture.LectureRepository; +import org.sopt.makers.operation.lecture.repository.subLecture.SubLectureRepository; +import org.sopt.makers.operation.member.domain.Member; +import org.sopt.makers.operation.member.repository.MemberRepository; import org.sopt.makers.operation.exception.LectureException; import org.sopt.makers.operation.exception.SubLectureException; import org.sopt.makers.operation.web.lecture.dto.request.AttendanceRequest; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/member/api/MemberApi.java b/operation-api/src/main/java/org/sopt/makers/operation/web/member/api/MemberApi.java index b35c4bfb..ac160e0f 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/member/api/MemberApi.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/member/api/MemberApi.java @@ -1,6 +1,6 @@ package org.sopt.makers.operation.web.member.api; -import org.sopt.makers.operation.domain.Part; +import org.sopt.makers.operation.common.domain.Part; import org.sopt.makers.operation.common.dto.BaseResponse; import org.springframework.data.domain.Pageable; import org.springframework.http.ResponseEntity; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/member/api/MemberApiController.java b/operation-api/src/main/java/org/sopt/makers/operation/web/member/api/MemberApiController.java index 94b317a5..0a9dd4f7 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/member/api/MemberApiController.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/member/api/MemberApiController.java @@ -2,7 +2,7 @@ import static org.sopt.makers.operation.code.success.web.MemberSuccessCode.*; -import org.sopt.makers.operation.domain.Part; +import org.sopt.makers.operation.common.domain.Part; import org.sopt.makers.operation.common.dto.BaseResponse; import org.sopt.makers.operation.common.util.ApiResponseUtil; import org.sopt.makers.operation.web.member.service.MemberService; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/member/dto/response/MemberListResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/web/member/dto/response/MemberListResponse.java index cc579b3b..b26eb7d6 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/member/dto/response/MemberListResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/member/dto/response/MemberListResponse.java @@ -1,12 +1,12 @@ package org.sopt.makers.operation.web.member.dto.response; -import static org.sopt.makers.operation.domain.attendance.domain.AttendanceStatus.*; +import static org.sopt.makers.operation.attendance.domain.AttendanceStatus.*; import java.util.List; -import org.sopt.makers.operation.domain.Part; -import org.sopt.makers.operation.domain.attendance.domain.AttendanceStatus; -import org.sopt.makers.operation.domain.member.domain.Member; +import org.sopt.makers.operation.common.domain.Part; +import org.sopt.makers.operation.attendance.domain.AttendanceStatus; +import org.sopt.makers.operation.member.domain.Member; import lombok.AccessLevel; import lombok.Builder; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/member/service/MemberService.java b/operation-api/src/main/java/org/sopt/makers/operation/web/member/service/MemberService.java index d4e817ba..4ea1efe0 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/member/service/MemberService.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/member/service/MemberService.java @@ -1,6 +1,6 @@ package org.sopt.makers.operation.web.member.service; -import org.sopt.makers.operation.domain.Part; +import org.sopt.makers.operation.common.domain.Part; import org.sopt.makers.operation.web.member.dto.response.MemberListResponse; import org.springframework.data.domain.Pageable; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/member/service/MemberServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/web/member/service/MemberServiceImpl.java index a2eaac89..7a021141 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/member/service/MemberServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/member/service/MemberServiceImpl.java @@ -1,7 +1,7 @@ package org.sopt.makers.operation.web.member.service; -import org.sopt.makers.operation.domain.Part; -import org.sopt.makers.operation.domain.member.repository.MemberRepository; +import org.sopt.makers.operation.common.domain.Part; +import org.sopt.makers.operation.member.repository.MemberRepository; import org.sopt.makers.operation.web.member.dto.response.MemberListResponse; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/domain/admin/domain/Admin.java b/operation-domain/src/main/java/org/sopt/makers/operation/admin/domain/Admin.java similarity index 95% rename from operation-domain/src/main/java/org/sopt/makers/operation/domain/admin/domain/Admin.java rename to operation-domain/src/main/java/org/sopt/makers/operation/admin/domain/Admin.java index 10d4290c..3d096942 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/domain/admin/domain/Admin.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/admin/domain/Admin.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.domain.admin.domain; +package org.sopt.makers.operation.admin.domain; import lombok.Builder; import lombok.Getter; diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/domain/admin/domain/AdminStatus.java b/operation-domain/src/main/java/org/sopt/makers/operation/admin/domain/AdminStatus.java similarity index 56% rename from operation-domain/src/main/java/org/sopt/makers/operation/domain/admin/domain/AdminStatus.java rename to operation-domain/src/main/java/org/sopt/makers/operation/admin/domain/AdminStatus.java index f0b8a372..74acd24c 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/domain/admin/domain/AdminStatus.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/admin/domain/AdminStatus.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.domain.admin.domain; +package org.sopt.makers.operation.admin.domain; public enum AdminStatus { DEVELOPER, SOPT, MAKERS, NOT_CERTIFIED diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/domain/admin/domain/Role.java b/operation-domain/src/main/java/org/sopt/makers/operation/admin/domain/Role.java similarity index 71% rename from operation-domain/src/main/java/org/sopt/makers/operation/domain/admin/domain/Role.java rename to operation-domain/src/main/java/org/sopt/makers/operation/admin/domain/Role.java index f27c610b..0da770ba 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/domain/admin/domain/Role.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/admin/domain/Role.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.domain.admin.domain; +package org.sopt.makers.operation.admin.domain; public enum Role { OPERATION_TEAM, PRESIDENT, VICE_PRESIDENT, AFFAIRS, MANAGE, MEDIA, PLAN, DESIGN, WEB, ANDROID, IOS, SERVER, MAKERS diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/domain/alarm/domain/Alarm.java b/operation-domain/src/main/java/org/sopt/makers/operation/alarm/domain/Alarm.java similarity index 85% rename from operation-domain/src/main/java/org/sopt/makers/operation/domain/alarm/domain/Alarm.java rename to operation-domain/src/main/java/org/sopt/makers/operation/alarm/domain/Alarm.java index 898eb576..4d92b248 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/domain/alarm/domain/Alarm.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/alarm/domain/Alarm.java @@ -1,9 +1,8 @@ -package org.sopt.makers.operation.domain.alarm.domain; +package org.sopt.makers.operation.alarm.domain; import static java.util.Objects.*; import static javax.persistence.EnumType.*; import static javax.persistence.GenerationType.*; -import static org.sopt.makers.operation.domain.alarm.domain.Status.*; import java.time.LocalDateTime; import java.util.ArrayList; @@ -16,9 +15,9 @@ import javax.persistence.GeneratedValue; import javax.persistence.Id; -import org.sopt.makers.operation.domain.BaseEntity; -import org.sopt.makers.operation.domain.Part; -import org.sopt.makers.operation.domain.converter.StringListConverter; +import org.sopt.makers.operation.common.domain.BaseEntity; +import org.sopt.makers.operation.common.domain.Part; +import org.sopt.makers.operation.schedule.converter.StringListConverter; import lombok.Builder; import lombok.Getter; @@ -82,7 +81,7 @@ public Alarm( this.content = content; setLink(link); setTargetsInfo(isActive, part, targetList); - this.status = BEFORE; + this.status = Status.BEFORE; } private void setLink(String link) { @@ -102,7 +101,7 @@ private void setTargetsInfo(Boolean isActive, Part part, List targetList } public boolean isSent() { - return this.status.equals(AFTER); + return this.status.equals(Status.AFTER); } public boolean hasEmptyTargetList() { @@ -110,7 +109,7 @@ public boolean hasEmptyTargetList() { } public void updateToSent() { - this.status = AFTER; + this.status = Status.AFTER; this.sendAt = LocalDateTime.now(); } } diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/domain/alarm/domain/Attribute.java b/operation-domain/src/main/java/org/sopt/makers/operation/alarm/domain/Attribute.java similarity index 76% rename from operation-domain/src/main/java/org/sopt/makers/operation/domain/alarm/domain/Attribute.java rename to operation-domain/src/main/java/org/sopt/makers/operation/alarm/domain/Attribute.java index 3a79c02f..86a15275 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/domain/alarm/domain/Attribute.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/alarm/domain/Attribute.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.domain.alarm.domain; +package org.sopt.makers.operation.alarm.domain; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/domain/alarm/domain/Status.java b/operation-domain/src/main/java/org/sopt/makers/operation/alarm/domain/Status.java similarity index 76% rename from operation-domain/src/main/java/org/sopt/makers/operation/domain/alarm/domain/Status.java rename to operation-domain/src/main/java/org/sopt/makers/operation/alarm/domain/Status.java index 4d711d9f..5f34a054 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/domain/alarm/domain/Status.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/alarm/domain/Status.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.domain.alarm.domain; +package org.sopt.makers.operation.alarm.domain; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/domain/alarm/repository/AlarmCustomRepository.java b/operation-domain/src/main/java/org/sopt/makers/operation/alarm/repository/AlarmCustomRepository.java similarity index 54% rename from operation-domain/src/main/java/org/sopt/makers/operation/domain/alarm/repository/AlarmCustomRepository.java rename to operation-domain/src/main/java/org/sopt/makers/operation/alarm/repository/AlarmCustomRepository.java index 871e8717..daa0c892 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/domain/alarm/repository/AlarmCustomRepository.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/alarm/repository/AlarmCustomRepository.java @@ -1,10 +1,10 @@ -package org.sopt.makers.operation.domain.alarm.repository; +package org.sopt.makers.operation.alarm.repository; import java.util.List; -import org.sopt.makers.operation.domain.Part; -import org.sopt.makers.operation.domain.alarm.domain.Alarm; -import org.sopt.makers.operation.domain.alarm.domain.Status; +import org.sopt.makers.operation.alarm.domain.Alarm; +import org.sopt.makers.operation.alarm.domain.Status; +import org.sopt.makers.operation.common.domain.Part; import org.springframework.data.domain.Pageable; public interface AlarmCustomRepository { diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/domain/alarm/repository/AlarmRepository.java b/operation-domain/src/main/java/org/sopt/makers/operation/alarm/repository/AlarmRepository.java similarity index 57% rename from operation-domain/src/main/java/org/sopt/makers/operation/domain/alarm/repository/AlarmRepository.java rename to operation-domain/src/main/java/org/sopt/makers/operation/alarm/repository/AlarmRepository.java index a11c2dc7..216a5e78 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/domain/alarm/repository/AlarmRepository.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/alarm/repository/AlarmRepository.java @@ -1,6 +1,6 @@ -package org.sopt.makers.operation.domain.alarm.repository; +package org.sopt.makers.operation.alarm.repository; -import org.sopt.makers.operation.domain.alarm.domain.Alarm; +import org.sopt.makers.operation.alarm.domain.Alarm; import org.springframework.data.jpa.repository.JpaRepository; public interface AlarmRepository extends JpaRepository, AlarmCustomRepository { diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/domain/alarm/repository/AlarmRepositoryImpl.java b/operation-domain/src/main/java/org/sopt/makers/operation/alarm/repository/AlarmRepositoryImpl.java similarity index 87% rename from operation-domain/src/main/java/org/sopt/makers/operation/domain/alarm/repository/AlarmRepositoryImpl.java rename to operation-domain/src/main/java/org/sopt/makers/operation/alarm/repository/AlarmRepositoryImpl.java index 54651679..f8f4f0a2 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/domain/alarm/repository/AlarmRepositoryImpl.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/alarm/repository/AlarmRepositoryImpl.java @@ -1,13 +1,13 @@ -package org.sopt.makers.operation.domain.alarm.repository; +package org.sopt.makers.operation.alarm.repository; import static java.util.Objects.*; import static org.sopt.makers.operation.domain.alarm.domain.QAlarm.*; import java.util.List; -import org.sopt.makers.operation.domain.Part; -import org.sopt.makers.operation.domain.alarm.domain.Alarm; -import org.sopt.makers.operation.domain.alarm.domain.Status; +import org.sopt.makers.operation.common.domain.Part; +import org.sopt.makers.operation.alarm.domain.Alarm; +import org.sopt.makers.operation.alarm.domain.Status; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Repository; diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/domain/Attendance.java b/operation-domain/src/main/java/org/sopt/makers/operation/attendance/domain/Attendance.java similarity index 92% rename from operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/domain/Attendance.java rename to operation-domain/src/main/java/org/sopt/makers/operation/attendance/domain/Attendance.java index 031051ab..d5799e7f 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/domain/Attendance.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/attendance/domain/Attendance.java @@ -1,8 +1,8 @@ -package org.sopt.makers.operation.domain.attendance.domain; +package org.sopt.makers.operation.attendance.domain; import static javax.persistence.GenerationType.*; import static org.sopt.makers.operation.code.failure.AttendanceFailureCode.*; -import static org.sopt.makers.operation.domain.attendance.domain.AttendanceStatus.*; +import static org.sopt.makers.operation.attendance.domain.AttendanceStatus.*; import java.util.ArrayList; import java.util.List; @@ -19,8 +19,8 @@ import javax.persistence.ManyToOne; import javax.persistence.OneToMany; -import org.sopt.makers.operation.domain.lecture.Lecture; -import org.sopt.makers.operation.domain.member.domain.Member; +import org.sopt.makers.operation.lecture.domain.Lecture; +import org.sopt.makers.operation.member.domain.Member; import org.sopt.makers.operation.exception.AttendanceException; import lombok.*; diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/domain/AttendanceStatus.java b/operation-domain/src/main/java/org/sopt/makers/operation/attendance/domain/AttendanceStatus.java similarity index 82% rename from operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/domain/AttendanceStatus.java rename to operation-domain/src/main/java/org/sopt/makers/operation/attendance/domain/AttendanceStatus.java index 17bf33d1..a8b496c2 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/domain/AttendanceStatus.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/attendance/domain/AttendanceStatus.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.domain.attendance.domain; +package org.sopt.makers.operation.attendance.domain; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/domain/SubAttendance.java b/operation-domain/src/main/java/org/sopt/makers/operation/attendance/domain/SubAttendance.java similarity index 87% rename from operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/domain/SubAttendance.java rename to operation-domain/src/main/java/org/sopt/makers/operation/attendance/domain/SubAttendance.java index 68d4988e..db7911d4 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/domain/SubAttendance.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/attendance/domain/SubAttendance.java @@ -1,7 +1,7 @@ -package org.sopt.makers.operation.domain.attendance.domain; +package org.sopt.makers.operation.attendance.domain; import static javax.persistence.GenerationType.*; -import static org.sopt.makers.operation.domain.attendance.domain.AttendanceStatus.*; +import static org.sopt.makers.operation.attendance.domain.AttendanceStatus.*; import java.util.Objects; @@ -15,8 +15,8 @@ import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; -import org.sopt.makers.operation.domain.BaseEntity; -import org.sopt.makers.operation.domain.lecture.SubLecture; +import org.sopt.makers.operation.common.domain.BaseEntity; +import org.sopt.makers.operation.lecture.domain.SubLecture; import lombok.Getter; import lombok.NoArgsConstructor; diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/repository/attendance/AttendanceCustomRepository.java b/operation-domain/src/main/java/org/sopt/makers/operation/attendance/repository/attendance/AttendanceCustomRepository.java similarity index 56% rename from operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/repository/attendance/AttendanceCustomRepository.java rename to operation-domain/src/main/java/org/sopt/makers/operation/attendance/repository/attendance/AttendanceCustomRepository.java index aaa91d2f..2dee226d 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/repository/attendance/AttendanceCustomRepository.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/attendance/repository/attendance/AttendanceCustomRepository.java @@ -1,11 +1,11 @@ -package org.sopt.makers.operation.domain.attendance.repository.attendance; +package org.sopt.makers.operation.attendance.repository.attendance; import java.util.List; -import org.sopt.makers.operation.domain.Part; -import org.sopt.makers.operation.domain.attendance.domain.Attendance; -import org.sopt.makers.operation.domain.lecture.Lecture; -import org.sopt.makers.operation.domain.member.domain.Member; +import org.sopt.makers.operation.common.domain.Part; +import org.sopt.makers.operation.attendance.domain.Attendance; +import org.sopt.makers.operation.lecture.domain.Lecture; +import org.sopt.makers.operation.member.domain.Member; import org.springframework.data.domain.Pageable; public interface AttendanceCustomRepository { diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/repository/attendance/AttendanceRepository.java b/operation-domain/src/main/java/org/sopt/makers/operation/attendance/repository/attendance/AttendanceRepository.java similarity index 62% rename from operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/repository/attendance/AttendanceRepository.java rename to operation-domain/src/main/java/org/sopt/makers/operation/attendance/repository/attendance/AttendanceRepository.java index 2d95b801..e8741851 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/repository/attendance/AttendanceRepository.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/attendance/repository/attendance/AttendanceRepository.java @@ -1,10 +1,10 @@ -package org.sopt.makers.operation.domain.attendance.repository.attendance; +package org.sopt.makers.operation.attendance.repository.attendance; import java.util.Optional; -import org.sopt.makers.operation.domain.attendance.domain.Attendance; -import org.sopt.makers.operation.domain.lecture.Lecture; -import org.sopt.makers.operation.domain.member.domain.Member; +import org.sopt.makers.operation.attendance.domain.Attendance; +import org.sopt.makers.operation.lecture.domain.Lecture; +import org.sopt.makers.operation.member.domain.Member; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/repository/attendance/AttendanceRepositoryImpl.java b/operation-domain/src/main/java/org/sopt/makers/operation/attendance/repository/attendance/AttendanceRepositoryImpl.java similarity index 89% rename from operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/repository/attendance/AttendanceRepositoryImpl.java rename to operation-domain/src/main/java/org/sopt/makers/operation/attendance/repository/attendance/AttendanceRepositoryImpl.java index 4bdd66ce..6dda2da6 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/repository/attendance/AttendanceRepositoryImpl.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/attendance/repository/attendance/AttendanceRepositoryImpl.java @@ -1,8 +1,8 @@ -package org.sopt.makers.operation.domain.attendance.repository.attendance; +package org.sopt.makers.operation.attendance.repository.attendance; import static com.querydsl.core.types.dsl.Expressions.*; import static java.util.Objects.*; -import static org.sopt.makers.operation.domain.Part.*; +import static org.sopt.makers.operation.common.domain.Part.*; import static org.sopt.makers.operation.domain.attendance.domain.QAttendance.*; import static org.sopt.makers.operation.domain.attendance.domain.QSubAttendance.*; import static org.sopt.makers.operation.domain.lecture.QLecture.*; @@ -15,11 +15,11 @@ import java.util.List; import org.sopt.makers.operation.config.ValueConfig; -import org.sopt.makers.operation.domain.Part; -import org.sopt.makers.operation.domain.attendance.domain.Attendance; -import org.sopt.makers.operation.domain.lecture.Lecture; -import org.sopt.makers.operation.domain.lecture.LectureStatus; -import org.sopt.makers.operation.domain.member.domain.Member; +import org.sopt.makers.operation.common.domain.Part; +import org.sopt.makers.operation.attendance.domain.Attendance; +import org.sopt.makers.operation.lecture.domain.Lecture; +import org.sopt.makers.operation.lecture.domain.LectureStatus; +import org.sopt.makers.operation.member.domain.Member; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Repository; diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/repository/subAttendance/SubAttendanceRepository.java b/operation-domain/src/main/java/org/sopt/makers/operation/attendance/repository/subAttendance/SubAttendanceRepository.java similarity index 58% rename from operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/repository/subAttendance/SubAttendanceRepository.java rename to operation-domain/src/main/java/org/sopt/makers/operation/attendance/repository/subAttendance/SubAttendanceRepository.java index a5449b4c..a3cf761f 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/domain/attendance/repository/subAttendance/SubAttendanceRepository.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/attendance/repository/subAttendance/SubAttendanceRepository.java @@ -1,13 +1,14 @@ -package org.sopt.makers.operation.domain.attendance.repository.subAttendance; +package org.sopt.makers.operation.attendance.repository.subAttendance; import java.util.List; -import org.sopt.makers.operation.domain.lecture.SubLecture; +import org.sopt.makers.operation.attendance.domain.SubAttendance; +import org.sopt.makers.operation.lecture.domain.SubLecture; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; -public interface SubAttendanceRepository extends JpaRepository { +public interface SubAttendanceRepository extends JpaRepository { @Modifying(clearAutomatically = true, flushAutomatically = true) @Query("delete from SubAttendance sa where sa.subLecture in :subLectures") void deleteAllBySubLectureIn(List subLectures); diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/config/JpaAuditingConfig.java b/operation-domain/src/main/java/org/sopt/makers/operation/common/config/JpaAuditingConfig.java similarity index 80% rename from operation-domain/src/main/java/org/sopt/makers/operation/config/JpaAuditingConfig.java rename to operation-domain/src/main/java/org/sopt/makers/operation/common/config/JpaAuditingConfig.java index b6561dd0..72be7d31 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/config/JpaAuditingConfig.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/common/config/JpaAuditingConfig.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.config; +package org.sopt.makers.operation.common.config; import org.springframework.context.annotation.Configuration; import org.springframework.data.jpa.repository.config.EnableJpaAuditing; diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/config/JpaQueryFactoryConfig.java b/operation-domain/src/main/java/org/sopt/makers/operation/common/config/JpaQueryFactoryConfig.java similarity index 87% rename from operation-domain/src/main/java/org/sopt/makers/operation/config/JpaQueryFactoryConfig.java rename to operation-domain/src/main/java/org/sopt/makers/operation/common/config/JpaQueryFactoryConfig.java index 06d4078c..6618030a 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/config/JpaQueryFactoryConfig.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/common/config/JpaQueryFactoryConfig.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.config; +package org.sopt.makers.operation.common.config; import javax.persistence.EntityManager; diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/domain/BaseEntity.java b/operation-domain/src/main/java/org/sopt/makers/operation/common/domain/BaseEntity.java similarity index 91% rename from operation-domain/src/main/java/org/sopt/makers/operation/domain/BaseEntity.java rename to operation-domain/src/main/java/org/sopt/makers/operation/common/domain/BaseEntity.java index 50003bef..5b541aee 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/domain/BaseEntity.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/common/domain/BaseEntity.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.domain; +package org.sopt.makers.operation.common.domain; import java.time.LocalDateTime; diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/domain/Part.java b/operation-domain/src/main/java/org/sopt/makers/operation/common/domain/Part.java similarity index 84% rename from operation-domain/src/main/java/org/sopt/makers/operation/domain/Part.java rename to operation-domain/src/main/java/org/sopt/makers/operation/common/domain/Part.java index e36f50f6..e39f073c 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/domain/Part.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/common/domain/Part.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.domain; +package org.sopt.makers.operation.common.domain; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/domain/member/domain/ObYb.java b/operation-domain/src/main/java/org/sopt/makers/operation/domain/member/domain/ObYb.java deleted file mode 100644 index ab33b218..00000000 --- a/operation-domain/src/main/java/org/sopt/makers/operation/domain/member/domain/ObYb.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.sopt.makers.operation.domain.member.domain; - -public enum ObYb { - OB, YB -} diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/dto/MemberSearchCondition.java b/operation-domain/src/main/java/org/sopt/makers/operation/dto/MemberSearchCondition.java deleted file mode 100644 index ce0f8ec0..00000000 --- a/operation-domain/src/main/java/org/sopt/makers/operation/dto/MemberSearchCondition.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.sopt.makers.operation.dto; - -import org.sopt.makers.operation.domain.Part; - -public record MemberSearchCondition( - Part part, - int generation -) { -} diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/domain/lecture/Attribute.java b/operation-domain/src/main/java/org/sopt/makers/operation/lecture/domain/Attribute.java similarity index 79% rename from operation-domain/src/main/java/org/sopt/makers/operation/domain/lecture/Attribute.java rename to operation-domain/src/main/java/org/sopt/makers/operation/lecture/domain/Attribute.java index fbc707ac..a2f273d9 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/domain/lecture/Attribute.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/lecture/domain/Attribute.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.domain.lecture; +package org.sopt.makers.operation.lecture.domain; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/domain/lecture/Lecture.java b/operation-domain/src/main/java/org/sopt/makers/operation/lecture/domain/Lecture.java similarity index 86% rename from operation-domain/src/main/java/org/sopt/makers/operation/domain/lecture/Lecture.java rename to operation-domain/src/main/java/org/sopt/makers/operation/lecture/domain/Lecture.java index b9a7621c..9de07bd3 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/domain/lecture/Lecture.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/lecture/domain/Lecture.java @@ -1,7 +1,7 @@ -package org.sopt.makers.operation.domain.lecture; +package org.sopt.makers.operation.lecture.domain; import static javax.persistence.GenerationType.*; -import static org.sopt.makers.operation.domain.lecture.LectureStatus.*; +import static org.sopt.makers.operation.lecture.domain.LectureStatus.*; import java.time.LocalDateTime; import java.util.ArrayList; @@ -15,9 +15,9 @@ import javax.persistence.Id; import javax.persistence.OneToMany; -import org.sopt.makers.operation.domain.BaseEntity; -import org.sopt.makers.operation.domain.Part; -import org.sopt.makers.operation.domain.attendance.domain.Attendance; +import org.sopt.makers.operation.common.domain.BaseEntity; +import org.sopt.makers.operation.common.domain.Part; +import org.sopt.makers.operation.attendance.domain.Attendance; import lombok.Builder; import lombok.Getter; diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/domain/lecture/LectureStatus.java b/operation-domain/src/main/java/org/sopt/makers/operation/lecture/domain/LectureStatus.java similarity index 54% rename from operation-domain/src/main/java/org/sopt/makers/operation/domain/lecture/LectureStatus.java rename to operation-domain/src/main/java/org/sopt/makers/operation/lecture/domain/LectureStatus.java index 2547743f..246827ff 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/domain/lecture/LectureStatus.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/lecture/domain/LectureStatus.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.domain.lecture; +package org.sopt.makers.operation.lecture.domain; public enum LectureStatus { BEFORE, FIRST, SECOND, END diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/domain/lecture/SubLecture.java b/operation-domain/src/main/java/org/sopt/makers/operation/lecture/domain/SubLecture.java similarity index 89% rename from operation-domain/src/main/java/org/sopt/makers/operation/domain/lecture/SubLecture.java rename to operation-domain/src/main/java/org/sopt/makers/operation/lecture/domain/SubLecture.java index 1cbedbd4..a2daf293 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/domain/lecture/SubLecture.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/lecture/domain/SubLecture.java @@ -1,8 +1,7 @@ -package org.sopt.makers.operation.domain.lecture; +package org.sopt.makers.operation.lecture.domain; import static java.util.Objects.*; import static javax.persistence.GenerationType.*; -import static org.sopt.makers.operation.domain.lecture.LectureStatus.*; import java.time.LocalDateTime; import java.util.ArrayList; @@ -18,7 +17,7 @@ import javax.persistence.ManyToOne; import javax.persistence.OneToMany; -import org.sopt.makers.operation.domain.attendance.domain.SubAttendance; +import org.sopt.makers.operation.attendance.domain.SubAttendance; import lombok.Getter; import lombok.NoArgsConstructor; @@ -57,8 +56,8 @@ public void startAttendance(String code) { private LectureStatus getUpdatedStatus() { return switch (this.round) { - case 1 -> FIRST; - case 2 -> SECOND; + case 1 -> LectureStatus.FIRST; + case 2 -> LectureStatus.SECOND; default -> this.lecture.getLectureStatus(); }; } diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/domain/lecture/repository/lecture/LectureCustomRepository.java b/operation-domain/src/main/java/org/sopt/makers/operation/lecture/repository/lecture/LectureCustomRepository.java similarity index 57% rename from operation-domain/src/main/java/org/sopt/makers/operation/domain/lecture/repository/lecture/LectureCustomRepository.java rename to operation-domain/src/main/java/org/sopt/makers/operation/lecture/repository/lecture/LectureCustomRepository.java index e8d863d1..dcb2ca20 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/domain/lecture/repository/lecture/LectureCustomRepository.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/lecture/repository/lecture/LectureCustomRepository.java @@ -1,10 +1,10 @@ -package org.sopt.makers.operation.domain.lecture.repository.lecture; +package org.sopt.makers.operation.lecture.repository.lecture; import java.util.List; import java.util.Optional; -import org.sopt.makers.operation.domain.Part; -import org.sopt.makers.operation.domain.lecture.Lecture; +import org.sopt.makers.operation.common.domain.Part; +import org.sopt.makers.operation.lecture.domain.Lecture; public interface LectureCustomRepository { List find(int generation, Part part); diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/domain/lecture/repository/lecture/LectureRepository.java b/operation-domain/src/main/java/org/sopt/makers/operation/lecture/repository/lecture/LectureRepository.java similarity index 56% rename from operation-domain/src/main/java/org/sopt/makers/operation/domain/lecture/repository/lecture/LectureRepository.java rename to operation-domain/src/main/java/org/sopt/makers/operation/lecture/repository/lecture/LectureRepository.java index 1c9e07dc..210f9f7a 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/domain/lecture/repository/lecture/LectureRepository.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/lecture/repository/lecture/LectureRepository.java @@ -1,6 +1,6 @@ -package org.sopt.makers.operation.domain.lecture.repository.lecture; +package org.sopt.makers.operation.lecture.repository.lecture; -import org.sopt.makers.operation.domain.lecture.Lecture; +import org.sopt.makers.operation.lecture.domain.Lecture; import org.springframework.data.jpa.repository.JpaRepository; public interface LectureRepository extends JpaRepository, LectureCustomRepository { diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/domain/lecture/repository/lecture/LectureRepositoryImpl.java b/operation-domain/src/main/java/org/sopt/makers/operation/lecture/repository/lecture/LectureRepositoryImpl.java similarity index 86% rename from operation-domain/src/main/java/org/sopt/makers/operation/domain/lecture/repository/lecture/LectureRepositoryImpl.java rename to operation-domain/src/main/java/org/sopt/makers/operation/lecture/repository/lecture/LectureRepositoryImpl.java index a1bef91c..28ff304d 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/domain/lecture/repository/lecture/LectureRepositoryImpl.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/lecture/repository/lecture/LectureRepositoryImpl.java @@ -1,8 +1,7 @@ -package org.sopt.makers.operation.domain.lecture.repository.lecture; +package org.sopt.makers.operation.lecture.repository.lecture; import static java.util.Objects.*; import static org.sopt.makers.operation.domain.attendance.domain.QAttendance.*; -import static org.sopt.makers.operation.domain.lecture.LectureStatus.*; import static org.sopt.makers.operation.domain.lecture.QLecture.*; import static org.sopt.makers.operation.domain.member.domain.QMember.*; @@ -10,8 +9,9 @@ import java.util.List; import java.util.Optional; -import org.sopt.makers.operation.domain.Part; -import org.sopt.makers.operation.domain.lecture.Lecture; +import org.sopt.makers.operation.common.domain.Part; +import org.sopt.makers.operation.lecture.domain.Lecture; +import org.sopt.makers.operation.lecture.domain.LectureStatus; import org.springframework.stereotype.Repository; import com.querydsl.core.types.dsl.BooleanExpression; @@ -44,7 +44,7 @@ public List findLecturesToBeEnd() { .leftJoin(attendance.member, member).fetchJoin().distinct() .where( lecture.endDate.before(LocalDateTime.now()), - lecture.lectureStatus.ne(END) + lecture.lectureStatus.ne(LectureStatus.END) ) .fetch(); } diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/domain/lecture/repository/subLecture/SubLectureRepository.java b/operation-domain/src/main/java/org/sopt/makers/operation/lecture/repository/subLecture/SubLectureRepository.java similarity index 52% rename from operation-domain/src/main/java/org/sopt/makers/operation/domain/lecture/repository/subLecture/SubLectureRepository.java rename to operation-domain/src/main/java/org/sopt/makers/operation/lecture/repository/subLecture/SubLectureRepository.java index 627b984a..99b30998 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/domain/lecture/repository/subLecture/SubLectureRepository.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/lecture/repository/subLecture/SubLectureRepository.java @@ -1,14 +1,15 @@ -package org.sopt.makers.operation.domain.lecture.repository.subLecture; +package org.sopt.makers.operation.lecture.repository.subLecture; import java.util.Optional; -import org.sopt.makers.operation.domain.lecture.Lecture; +import org.sopt.makers.operation.lecture.domain.Lecture; +import org.sopt.makers.operation.lecture.domain.SubLecture; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; -public interface SubLectureRepository extends JpaRepository { - Optional findById(Long subLectureId); +public interface SubLectureRepository extends JpaRepository { + Optional findById(Long subLectureId); @Modifying(clearAutomatically = true, flushAutomatically = true) @Query("delete from SubLecture sl where sl.lecture = :lecture") diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/domain/member/domain/Member.java b/operation-domain/src/main/java/org/sopt/makers/operation/member/domain/Member.java similarity index 87% rename from operation-domain/src/main/java/org/sopt/makers/operation/domain/member/domain/Member.java rename to operation-domain/src/main/java/org/sopt/makers/operation/member/domain/Member.java index bb810288..c3bfb20a 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/domain/member/domain/Member.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/member/domain/Member.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.domain.member.domain; +package org.sopt.makers.operation.member.domain; import java.util.ArrayList; import java.util.List; @@ -12,8 +12,8 @@ import javax.persistence.Id; import javax.persistence.OneToMany; -import org.sopt.makers.operation.domain.Part; -import org.sopt.makers.operation.domain.attendance.domain.Attendance; +import org.sopt.makers.operation.attendance.domain.Attendance; +import org.sopt.makers.operation.common.domain.Part; import lombok.Getter; import lombok.NoArgsConstructor; diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/member/domain/ObYb.java b/operation-domain/src/main/java/org/sopt/makers/operation/member/domain/ObYb.java new file mode 100644 index 00000000..672c84e6 --- /dev/null +++ b/operation-domain/src/main/java/org/sopt/makers/operation/member/domain/ObYb.java @@ -0,0 +1,5 @@ +package org.sopt.makers.operation.member.domain; + +public enum ObYb { + OB, YB +} diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/domain/member/repository/MemberCustomRepository.java b/operation-domain/src/main/java/org/sopt/makers/operation/member/repository/MemberCustomRepository.java similarity index 69% rename from operation-domain/src/main/java/org/sopt/makers/operation/domain/member/repository/MemberCustomRepository.java rename to operation-domain/src/main/java/org/sopt/makers/operation/member/repository/MemberCustomRepository.java index d6cff00c..9df04192 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/domain/member/repository/MemberCustomRepository.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/member/repository/MemberCustomRepository.java @@ -1,11 +1,11 @@ -package org.sopt.makers.operation.domain.member.repository; +package org.sopt.makers.operation.member.repository; import java.util.List; import java.util.Optional; -import org.sopt.makers.operation.domain.Part; -import org.sopt.makers.operation.domain.member.domain.Member; -import org.sopt.makers.operation.dto.MemberSearchCondition; +import org.sopt.makers.operation.common.domain.Part; +import org.sopt.makers.operation.member.domain.Member; +import org.sopt.makers.operation.common.dto.MemberSearchCondition; import org.springframework.data.domain.Pageable; public interface MemberCustomRepository { diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/domain/member/repository/MemberRepository.java b/operation-domain/src/main/java/org/sopt/makers/operation/member/repository/MemberRepository.java similarity index 72% rename from operation-domain/src/main/java/org/sopt/makers/operation/domain/member/repository/MemberRepository.java rename to operation-domain/src/main/java/org/sopt/makers/operation/member/repository/MemberRepository.java index 3aa00973..fa970fe6 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/domain/member/repository/MemberRepository.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/member/repository/MemberRepository.java @@ -1,8 +1,8 @@ -package org.sopt.makers.operation.domain.member.repository; +package org.sopt.makers.operation.member.repository; import java.util.Optional; -import org.sopt.makers.operation.domain.member.domain.Member; +import org.sopt.makers.operation.member.domain.Member; import org.springframework.data.jpa.repository.JpaRepository; public interface MemberRepository extends JpaRepository, MemberCustomRepository { diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/domain/member/repository/MemberRepositoryImpl.java b/operation-domain/src/main/java/org/sopt/makers/operation/member/repository/MemberRepositoryImpl.java similarity index 91% rename from operation-domain/src/main/java/org/sopt/makers/operation/domain/member/repository/MemberRepositoryImpl.java rename to operation-domain/src/main/java/org/sopt/makers/operation/member/repository/MemberRepositoryImpl.java index dc754b84..35e4914e 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/domain/member/repository/MemberRepositoryImpl.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/member/repository/MemberRepositoryImpl.java @@ -1,7 +1,7 @@ -package org.sopt.makers.operation.domain.member.repository; +package org.sopt.makers.operation.member.repository; import static java.util.Objects.*; -import static org.sopt.makers.operation.domain.Part.*; +import static org.sopt.makers.operation.common.domain.Part.*; import static org.sopt.makers.operation.domain.attendance.domain.QAttendance.*; import static org.sopt.makers.operation.domain.lecture.QLecture.*; import static org.sopt.makers.operation.domain.member.domain.QMember.*; @@ -9,9 +9,9 @@ import java.util.List; import java.util.Optional; -import org.sopt.makers.operation.domain.Part; -import org.sopt.makers.operation.domain.member.domain.Member; -import org.sopt.makers.operation.dto.MemberSearchCondition; +import org.sopt.makers.operation.common.domain.Part; +import org.sopt.makers.operation.member.domain.Member; +import org.sopt.makers.operation.common.dto.MemberSearchCondition; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Repository; diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/domain/converter/StringListConverter.java b/operation-domain/src/main/java/org/sopt/makers/operation/schedule/converter/StringListConverter.java similarity index 95% rename from operation-domain/src/main/java/org/sopt/makers/operation/domain/converter/StringListConverter.java rename to operation-domain/src/main/java/org/sopt/makers/operation/schedule/converter/StringListConverter.java index 08cf717d..967cc4ef 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/domain/converter/StringListConverter.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/schedule/converter/StringListConverter.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.domain.converter; +package org.sopt.makers.operation.schedule.converter; import static com.fasterxml.jackson.databind.DeserializationFeature.*; diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/domain/schedule/domain/Schedule.java b/operation-domain/src/main/java/org/sopt/makers/operation/schedule/domain/Schedule.java similarity index 82% rename from operation-domain/src/main/java/org/sopt/makers/operation/domain/schedule/domain/Schedule.java rename to operation-domain/src/main/java/org/sopt/makers/operation/schedule/domain/Schedule.java index 7364e885..0973e924 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/domain/schedule/domain/Schedule.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/schedule/domain/Schedule.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.domain.schedule.domain; +package org.sopt.makers.operation.schedule.domain; import static javax.persistence.EnumType.*; import static javax.persistence.GenerationType.*; @@ -11,8 +11,8 @@ import javax.persistence.GeneratedValue; import javax.persistence.Id; -import org.sopt.makers.operation.domain.BaseEntity; -import org.sopt.makers.operation.domain.lecture.Attribute; +import org.sopt.makers.operation.common.domain.BaseEntity; +import org.sopt.makers.operation.lecture.domain.Attribute; import lombok.Getter; import lombok.NoArgsConstructor; diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/domain/schedule/repository/ScheduleCustomRepository.java b/operation-domain/src/main/java/org/sopt/makers/operation/schedule/repository/ScheduleCustomRepository.java similarity index 59% rename from operation-domain/src/main/java/org/sopt/makers/operation/domain/schedule/repository/ScheduleCustomRepository.java rename to operation-domain/src/main/java/org/sopt/makers/operation/schedule/repository/ScheduleCustomRepository.java index b60289fa..2e50bbfa 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/domain/schedule/repository/ScheduleCustomRepository.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/schedule/repository/ScheduleCustomRepository.java @@ -1,9 +1,9 @@ -package org.sopt.makers.operation.domain.schedule.repository; +package org.sopt.makers.operation.schedule.repository; import java.time.LocalDateTime; import java.util.List; -import org.sopt.makers.operation.domain.schedule.domain.Schedule; +import org.sopt.makers.operation.schedule.domain.Schedule; public interface ScheduleCustomRepository { List findBetweenStartAndEnd(LocalDateTime start, LocalDateTime end); diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/domain/schedule/repository/ScheduleRepository.java b/operation-domain/src/main/java/org/sopt/makers/operation/schedule/repository/ScheduleRepository.java similarity index 57% rename from operation-domain/src/main/java/org/sopt/makers/operation/domain/schedule/repository/ScheduleRepository.java rename to operation-domain/src/main/java/org/sopt/makers/operation/schedule/repository/ScheduleRepository.java index 16986dd7..2226c637 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/domain/schedule/repository/ScheduleRepository.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/schedule/repository/ScheduleRepository.java @@ -1,6 +1,6 @@ -package org.sopt.makers.operation.domain.schedule.repository; +package org.sopt.makers.operation.schedule.repository; -import org.sopt.makers.operation.domain.member.domain.Member; +import org.sopt.makers.operation.member.domain.Member; import org.springframework.data.jpa.repository.JpaRepository; public interface ScheduleRepository extends JpaRepository, ScheduleCustomRepository { diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/domain/schedule/repository/ScheduleRepositoryImpl.java b/operation-domain/src/main/java/org/sopt/makers/operation/schedule/repository/ScheduleRepositoryImpl.java similarity index 85% rename from operation-domain/src/main/java/org/sopt/makers/operation/domain/schedule/repository/ScheduleRepositoryImpl.java rename to operation-domain/src/main/java/org/sopt/makers/operation/schedule/repository/ScheduleRepositoryImpl.java index 73dadcc0..d703da9e 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/domain/schedule/repository/ScheduleRepositoryImpl.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/schedule/repository/ScheduleRepositoryImpl.java @@ -1,11 +1,11 @@ -package org.sopt.makers.operation.domain.schedule.repository; +package org.sopt.makers.operation.schedule.repository; import static org.sopt.makers.operation.domain.schedule.domain.QSchedule.*; import java.time.LocalDateTime; import java.util.List; -import org.sopt.makers.operation.domain.schedule.domain.Schedule; +import org.sopt.makers.operation.schedule.domain.Schedule; import org.springframework.stereotype.Repository; import com.querydsl.jpa.impl.JPAQueryFactory; diff --git a/operation-external/src/main/java/org/sopt/makers/operation/client/alarm/dto/AlarmSenderRequest.java b/operation-external/src/main/java/org/sopt/makers/operation/client/alarm/dto/AlarmSenderRequest.java index b8d1322d..7043fc9c 100644 --- a/operation-external/src/main/java/org/sopt/makers/operation/client/alarm/dto/AlarmSenderRequest.java +++ b/operation-external/src/main/java/org/sopt/makers/operation/client/alarm/dto/AlarmSenderRequest.java @@ -1,13 +1,13 @@ package org.sopt.makers.operation.client.alarm.dto; -import static org.sopt.makers.operation.domain.alarm.domain.Attribute.*; +import static org.sopt.makers.operation.alarm.domain.Attribute.*; import java.util.List; import org.sopt.makers.operation.config.ValueConfig; -import org.sopt.makers.operation.domain.alarm.domain.Alarm; -import org.sopt.makers.operation.domain.alarm.domain.Attribute; -import org.sopt.makers.operation.domain.lecture.Lecture; +import org.sopt.makers.operation.alarm.domain.Alarm; +import org.sopt.makers.operation.alarm.domain.Attribute; +import org.sopt.makers.operation.lecture.domain.Lecture; import lombok.AccessLevel; import lombok.Builder; diff --git a/operation-external/src/main/java/org/sopt/makers/operation/client/playground/PlayGroundServer.java b/operation-external/src/main/java/org/sopt/makers/operation/client/playground/PlayGroundServer.java index f2d79241..6ea44b8c 100644 --- a/operation-external/src/main/java/org/sopt/makers/operation/client/playground/PlayGroundServer.java +++ b/operation-external/src/main/java/org/sopt/makers/operation/client/playground/PlayGroundServer.java @@ -1,7 +1,7 @@ package org.sopt.makers.operation.client.playground; import org.sopt.makers.operation.client.playground.dto.InactiveMemberListResponse; -import org.sopt.makers.operation.domain.Part; +import org.sopt.makers.operation.common.domain.Part; public interface PlayGroundServer { InactiveMemberListResponse getInactiveMembers(int generation, Part part); diff --git a/operation-external/src/main/java/org/sopt/makers/operation/client/playground/PlayGroundServerImpl.java b/operation-external/src/main/java/org/sopt/makers/operation/client/playground/PlayGroundServerImpl.java index 1d68719d..1e4b651f 100644 --- a/operation-external/src/main/java/org/sopt/makers/operation/client/playground/PlayGroundServerImpl.java +++ b/operation-external/src/main/java/org/sopt/makers/operation/client/playground/PlayGroundServerImpl.java @@ -1,11 +1,11 @@ package org.sopt.makers.operation.client.playground; import static org.sopt.makers.operation.code.failure.AlarmFailureCode.*; -import static org.sopt.makers.operation.domain.Part.*; +import static org.sopt.makers.operation.common.domain.Part.*; import static org.springframework.http.HttpMethod.*; import org.sopt.makers.operation.client.playground.dto.InactiveMemberListResponse; -import org.sopt.makers.operation.domain.Part; +import org.sopt.makers.operation.common.domain.Part; import org.sopt.makers.operation.exception.AlarmException; import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpEntity; From 33a34028cc47d29a89b38edcc8f680029a67148c Mon Sep 17 00:00:00 2001 From: dragontaek-lee Date: Fri, 9 Feb 2024 14:25:24 +0900 Subject: [PATCH 086/141] =?UTF-8?q?[FEAT]=20=EB=8F=84=EB=A9=94=EC=9D=B8?= =?UTF-8?q?=EB=B3=84=20failureCode=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../code/failure/admin/AdminFailureCode.java | 22 +++++++++++++++++ .../attendance/AttendanceFailureCode.java | 17 +++++++++++++ .../failure/lecture/lectureFailureCode.java | 24 +++++++++++++++++++ .../failure/member/memberFailureCode.java | 17 +++++++++++++ .../subAttendanceFailureCode.java | 18 ++++++++++++++ .../subLecture/subLectureFailureCode.java | 18 ++++++++++++++ 6 files changed, 116 insertions(+) create mode 100644 operation-common/src/main/java/org/sopt/makers/operation/code/failure/admin/AdminFailureCode.java create mode 100644 operation-common/src/main/java/org/sopt/makers/operation/code/failure/attendance/AttendanceFailureCode.java create mode 100644 operation-common/src/main/java/org/sopt/makers/operation/code/failure/lecture/lectureFailureCode.java create mode 100644 operation-common/src/main/java/org/sopt/makers/operation/code/failure/member/memberFailureCode.java create mode 100644 operation-common/src/main/java/org/sopt/makers/operation/code/failure/subAttendance/subAttendanceFailureCode.java create mode 100644 operation-common/src/main/java/org/sopt/makers/operation/code/failure/subLecture/subLectureFailureCode.java diff --git a/operation-common/src/main/java/org/sopt/makers/operation/code/failure/admin/AdminFailureCode.java b/operation-common/src/main/java/org/sopt/makers/operation/code/failure/admin/AdminFailureCode.java new file mode 100644 index 00000000..f7a26c46 --- /dev/null +++ b/operation-common/src/main/java/org/sopt/makers/operation/code/failure/admin/AdminFailureCode.java @@ -0,0 +1,22 @@ +package org.sopt.makers.operation.code.failure.admin; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; +import org.sopt.makers.operation.code.failure.FailureCode; +import org.springframework.http.HttpStatus; + +import static org.springframework.http.HttpStatus.BAD_REQUEST; + +@Getter +@RequiredArgsConstructor +public enum AdminFailureCode implements FailureCode { + DUPLICATED_EMAIL(BAD_REQUEST,"중복되는 이메일입니다."), + INVALID_EMAIL(BAD_REQUEST,"이메일이 존재하지 않습니다."), + INVALID_PASSWORD(BAD_REQUEST,"비밀번호가 일치하지 않습니다."), + NOT_APPROVED_ACCOUNT(BAD_REQUEST,"승인되지 않은 계정입니다."), + INVALID_TOKEN(BAD_REQUEST,"토큰이 일치하지 않습니다."), + ; + + private final HttpStatus status; + private final String message; +} diff --git a/operation-common/src/main/java/org/sopt/makers/operation/code/failure/attendance/AttendanceFailureCode.java b/operation-common/src/main/java/org/sopt/makers/operation/code/failure/attendance/AttendanceFailureCode.java new file mode 100644 index 00000000..1c35e1ed --- /dev/null +++ b/operation-common/src/main/java/org/sopt/makers/operation/code/failure/attendance/AttendanceFailureCode.java @@ -0,0 +1,17 @@ +package org.sopt.makers.operation.code.failure.attendance; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; +import org.sopt.makers.operation.code.failure.FailureCode; +import org.springframework.http.HttpStatus; + +import static org.springframework.http.HttpStatus.BAD_REQUEST; + +@Getter +@RequiredArgsConstructor +public enum AttendanceFailureCode implements FailureCode { + INVALID_ATTENDANCE(BAD_REQUEST, "존재하지 않는 출석 세션입니다."); + + private final HttpStatus status; + private final String message; +} diff --git a/operation-common/src/main/java/org/sopt/makers/operation/code/failure/lecture/lectureFailureCode.java b/operation-common/src/main/java/org/sopt/makers/operation/code/failure/lecture/lectureFailureCode.java new file mode 100644 index 00000000..af3502e3 --- /dev/null +++ b/operation-common/src/main/java/org/sopt/makers/operation/code/failure/lecture/lectureFailureCode.java @@ -0,0 +1,24 @@ +package org.sopt.makers.operation.code.failure.lecture; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; +import org.sopt.makers.operation.code.failure.FailureCode; +import org.springframework.http.HttpStatus; + +import static org.springframework.http.HttpStatus.BAD_REQUEST; + +@Getter +@RequiredArgsConstructor +public enum lectureFailureCode implements FailureCode { + NOT_STARTED_NTH_ATTENDANCE(BAD_REQUEST, "차 출석 시작 전입니다."), + INVALID_ATTENDANCE(BAD_REQUEST,"존재하지 않는 출석 세션입니다."), + ENDED_ATTENDANCE(BAD_REQUEST, "차 출석이 이미 종료되었습니다."), + INVALID_COUNT_SESSION(BAD_REQUEST,"세션의 개수가 올바르지 않습니다."), + INVALID_LECTURE(BAD_REQUEST,"존재하지 않는 세션입니다."), + NO_SESSION(BAD_REQUEST,"오늘 세션이 없습니다."), + NOT_STARTED_ATTENDANCE(BAD_REQUEST,"출석 시작 전입니다."), + END_LECTURE(BAD_REQUEST,"이미 종료된 세션입니다."); + + private final HttpStatus status; + private final String message; +} diff --git a/operation-common/src/main/java/org/sopt/makers/operation/code/failure/member/memberFailureCode.java b/operation-common/src/main/java/org/sopt/makers/operation/code/failure/member/memberFailureCode.java new file mode 100644 index 00000000..7e9fc0bc --- /dev/null +++ b/operation-common/src/main/java/org/sopt/makers/operation/code/failure/member/memberFailureCode.java @@ -0,0 +1,17 @@ +package org.sopt.makers.operation.code.failure.member; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; +import org.sopt.makers.operation.code.failure.FailureCode; +import org.springframework.http.HttpStatus; + +import static org.springframework.http.HttpStatus.BAD_REQUEST; + +@Getter +@RequiredArgsConstructor +public enum memberFailureCode implements FailureCode { + INVALID_MEMBER(BAD_REQUEST, "존재하지 않는 회원입니다."); + + private final HttpStatus status; + private final String message; +} diff --git a/operation-common/src/main/java/org/sopt/makers/operation/code/failure/subAttendance/subAttendanceFailureCode.java b/operation-common/src/main/java/org/sopt/makers/operation/code/failure/subAttendance/subAttendanceFailureCode.java new file mode 100644 index 00000000..b024a7e7 --- /dev/null +++ b/operation-common/src/main/java/org/sopt/makers/operation/code/failure/subAttendance/subAttendanceFailureCode.java @@ -0,0 +1,18 @@ +package org.sopt.makers.operation.code.failure.subAttendance; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; +import org.sopt.makers.operation.code.failure.FailureCode; +import org.springframework.http.HttpStatus; + +import static org.springframework.http.HttpStatus.BAD_REQUEST; + +@Getter +@RequiredArgsConstructor +public enum subAttendanceFailureCode implements FailureCode { + INVALID_SUB_LECTURE(BAD_REQUEST, "존재하지 않는 세션입니다."), + INVALID_CODE(BAD_REQUEST, "코드가 일치하지 않아요!"); + + private final HttpStatus status; + private final String message; +} diff --git a/operation-common/src/main/java/org/sopt/makers/operation/code/failure/subLecture/subLectureFailureCode.java b/operation-common/src/main/java/org/sopt/makers/operation/code/failure/subLecture/subLectureFailureCode.java new file mode 100644 index 00000000..5da961ab --- /dev/null +++ b/operation-common/src/main/java/org/sopt/makers/operation/code/failure/subLecture/subLectureFailureCode.java @@ -0,0 +1,18 @@ +package org.sopt.makers.operation.code.failure.subLecture; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; +import org.sopt.makers.operation.code.failure.FailureCode; +import org.springframework.http.HttpStatus; + +import static org.springframework.http.HttpStatus.BAD_REQUEST; + +@Getter +@RequiredArgsConstructor +public enum subLectureFailureCode implements FailureCode { + INVALID_SUB_ATTENDANCE(BAD_REQUEST, "존재하지 않는 N차 출석입니다."), + NO_SUB_LECTURE_EQUAL_ROUND(BAD_REQUEST,"해당 라운드와 일치하는 출석 세션이 없습니다."); + + private final HttpStatus status; + private final String message; +} From 5f767479698c943320a1cf858a6599207a930820 Mon Sep 17 00:00:00 2001 From: dragontaek-lee Date: Fri, 9 Feb 2024 14:25:57 +0900 Subject: [PATCH 087/141] =?UTF-8?q?[FEAT]=20=EB=8F=84=EB=A9=94=EC=9D=B8?= =?UTF-8?q?=EB=B3=84=20SucessCode=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../success/app/AttendanceSuccessCode.java | 2 +- .../code/success/app/LectureSuccessCode.java | 18 +++++++++++++++++ .../code/success/app/MemberSuccessCode.java | 18 +++++++++++++++++ .../code/success/web/AdminSuccessCode.java | 20 +++++++++++++++++++ 4 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 operation-common/src/main/java/org/sopt/makers/operation/code/success/app/LectureSuccessCode.java create mode 100644 operation-common/src/main/java/org/sopt/makers/operation/code/success/app/MemberSuccessCode.java create mode 100644 operation-common/src/main/java/org/sopt/makers/operation/code/success/web/AdminSuccessCode.java diff --git a/operation-common/src/main/java/org/sopt/makers/operation/code/success/app/AttendanceSuccessCode.java b/operation-common/src/main/java/org/sopt/makers/operation/code/success/app/AttendanceSuccessCode.java index 863518cf..67b66bd5 100644 --- a/operation-common/src/main/java/org/sopt/makers/operation/code/success/app/AttendanceSuccessCode.java +++ b/operation-common/src/main/java/org/sopt/makers/operation/code/success/app/AttendanceSuccessCode.java @@ -11,7 +11,7 @@ @Getter @RequiredArgsConstructor public enum AttendanceSuccessCode implements SuccessCode { - SUCCESS_GET_ATTENDANCE(OK, "출석 성공"); + SUCCESS_ATTEND(OK, "출석 성공"); private final HttpStatus status; private final String message; diff --git a/operation-common/src/main/java/org/sopt/makers/operation/code/success/app/LectureSuccessCode.java b/operation-common/src/main/java/org/sopt/makers/operation/code/success/app/LectureSuccessCode.java new file mode 100644 index 00000000..c5ac68a8 --- /dev/null +++ b/operation-common/src/main/java/org/sopt/makers/operation/code/success/app/LectureSuccessCode.java @@ -0,0 +1,18 @@ +package org.sopt.makers.operation.code.success.app; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; +import org.sopt.makers.operation.code.success.SuccessCode; +import org.springframework.http.HttpStatus; + +import static org.springframework.http.HttpStatus.OK; + +@Getter +@RequiredArgsConstructor +public enum LectureSuccessCode implements SuccessCode { + SUCCESS_SINGLE_GET_LECTURE(OK,"세션 조회 성공"), + SUCCESS_GET_LECTURE_ROUND(OK,"출석 차수 조회 성공"); + + private final HttpStatus status; + private final String message; +} diff --git a/operation-common/src/main/java/org/sopt/makers/operation/code/success/app/MemberSuccessCode.java b/operation-common/src/main/java/org/sopt/makers/operation/code/success/app/MemberSuccessCode.java new file mode 100644 index 00000000..19513fba --- /dev/null +++ b/operation-common/src/main/java/org/sopt/makers/operation/code/success/app/MemberSuccessCode.java @@ -0,0 +1,18 @@ +package org.sopt.makers.operation.code.success.app; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; +import org.sopt.makers.operation.code.success.SuccessCode; +import org.springframework.http.HttpStatus; + +import static org.springframework.http.HttpStatus.OK; + +@Getter +@RequiredArgsConstructor +public enum MemberSuccessCode implements SuccessCode { + SUCCESS_GET_TOTAL_ATTENDANCE(OK,"전체 출석정보 조회 성공"), + SUCCESS_GET_ATTENDANCE_SCORE(OK,"출석 점수 조회 성공"); + + private final HttpStatus status; + private final String message; +} diff --git a/operation-common/src/main/java/org/sopt/makers/operation/code/success/web/AdminSuccessCode.java b/operation-common/src/main/java/org/sopt/makers/operation/code/success/web/AdminSuccessCode.java new file mode 100644 index 00000000..cf6d82e3 --- /dev/null +++ b/operation-common/src/main/java/org/sopt/makers/operation/code/success/web/AdminSuccessCode.java @@ -0,0 +1,20 @@ +package org.sopt.makers.operation.code.success.web; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; +import org.sopt.makers.operation.code.success.SuccessCode; +import org.springframework.http.HttpStatus; + +import static org.springframework.http.HttpStatus.OK; + +@Getter +@RequiredArgsConstructor +public enum AdminSuccessCode implements SuccessCode { + SUCCESS_ATTEND(OK, "출석 성공"), + SUCCESS_SIGN_UP(OK,"회원 가입 성공"), + SUCCESS_LOGIN_UP(OK,"로그인 성공"), + SUCCESS_GET_REFRESH_TOKEN(OK,"토큰 재발급 성공"); + + private final HttpStatus status; + private final String message; +} From 179aaf34525b3a1ed8ba25e7241b46c5a1d66be9 Mon Sep 17 00:00:00 2001 From: dragontaek-lee Date: Fri, 9 Feb 2024 14:27:38 +0900 Subject: [PATCH 088/141] =?UTF-8?q?[FEAT]=20web=20admin=20api=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/admin/api/AdminApiController.java | 8 +-- .../web/admin/dto/request/LoginRequest.java | 2 +- .../web/admin/dto/request/SignUpRequest.java | 6 +- .../web/admin/dto/response/LoginResponse.java | 7 ++- .../admin/dto/response/RefreshResponse.java | 4 +- .../admin/dto/response/SignUpResponse.java | 7 +-- .../web/admin/service/AdminServiceImpl.java | 58 +++++++++---------- .../admin/repository/AdminRepository.java | 4 +- 8 files changed, 48 insertions(+), 48 deletions(-) rename operation-api/src/main/java/org/sopt/makers/operation/{service => }/web/admin/dto/request/LoginRequest.java (51%) rename operation-api/src/main/java/org/sopt/makers/operation/{service => }/web/admin/dto/request/SignUpRequest.java (61%) rename operation-api/src/main/java/org/sopt/makers/operation/{service => }/web/admin/dto/response/LoginResponse.java (83%) rename operation-api/src/main/java/org/sopt/makers/operation/{service => }/web/admin/dto/response/RefreshResponse.java (67%) rename operation-api/src/main/java/org/sopt/makers/operation/{service => }/web/admin/dto/response/SignUpResponse.java (69%) rename operation-api/src/main/java/org/sopt/makers/operation/{service => }/web/admin/service/AdminServiceImpl.java (58%) rename {operation-api/src/main/java/org/sopt/makers/operation/service/web => operation-domain/src/main/java/org/sopt/makers/operation/domain}/admin/repository/AdminRepository.java (72%) diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/admin/api/AdminApiController.java b/operation-api/src/main/java/org/sopt/makers/operation/web/admin/api/AdminApiController.java index 905b3e3d..ecb13579 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/admin/api/AdminApiController.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/admin/api/AdminApiController.java @@ -1,6 +1,6 @@ package org.sopt.makers.operation.web.admin.api; -import static org.sopt.makers.operation.web.admin.message.SuccessMessage.*; +import static org.sopt.makers.operation.code.success.web.AdminSuccessCode.*; import org.sopt.makers.operation.common.dto.BaseResponse; import org.sopt.makers.operation.common.util.ApiResponseUtil; @@ -31,7 +31,7 @@ public class AdminApiController implements AdminApi { @PostMapping("/signup") public ResponseEntity> signup(SignUpRequest signUpRequestDTO) { val response = authService.signUp(signUpRequestDTO); - return ApiResponseUtil.ok(SUCCESS_SIGN_UP.getContent(), response); + return ApiResponseUtil.success(SUCCESS_SIGN_UP, response); } @Override @@ -39,7 +39,7 @@ public ResponseEntity> signup(SignUpRequest signUpRequestDTO) { public ResponseEntity> login(LoginRequest userLoginRequestDTO) { val response = authService.login(userLoginRequestDTO); val headers = cookie.setRefreshToken(response.refreshToken()); - return ApiResponseUtil.ok(headers, SUCCESS_LOGIN_UP.getContent(), response.loginResponseVO()); + return ApiResponseUtil.success(SUCCESS_LOGIN_UP, headers, response.loginResponseVO()); } @Override @@ -47,6 +47,6 @@ public ResponseEntity> login(LoginRequest userLoginRequestDTO) { public ResponseEntity> refresh(String refreshToken) { val response = authService.refresh(refreshToken); val headers = cookie.setRefreshToken(response.refreshToken()); - return ApiResponseUtil.ok(headers, SUCCESS_GET_REFRESH_TOKEN.getContent(), response.accessToken()); + return ApiResponseUtil.success(SUCCESS_GET_REFRESH_TOKEN, headers, response.accessToken()); } } diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/dto/request/LoginRequest.java b/operation-api/src/main/java/org/sopt/makers/operation/web/admin/dto/request/LoginRequest.java similarity index 51% rename from operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/dto/request/LoginRequest.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/admin/dto/request/LoginRequest.java index 1cce0ddc..d612c34f 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/dto/request/LoginRequest.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/admin/dto/request/LoginRequest.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.service.web.admin.dto.request; +package org.sopt.makers.operation.web.admin.dto.request; public record LoginRequest( String email, diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/dto/request/SignUpRequest.java b/operation-api/src/main/java/org/sopt/makers/operation/web/admin/dto/request/SignUpRequest.java similarity index 61% rename from operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/dto/request/SignUpRequest.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/admin/dto/request/SignUpRequest.java index 255eab06..3cb05502 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/dto/request/SignUpRequest.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/admin/dto/request/SignUpRequest.java @@ -1,7 +1,7 @@ -package org.sopt.makers.operation.service.web.admin.dto.request; +package org.sopt.makers.operation.web.admin.dto.request; -import org.operation.admin.domain.Admin; -import org.operation.admin.domain.Role; +import org.sopt.makers.operation.domain.admin.domain.Admin; +import org.sopt.makers.operation.domain.admin.domain.Role; public record SignUpRequest( String email, diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/dto/response/LoginResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/web/admin/dto/response/LoginResponse.java similarity index 83% rename from operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/dto/response/LoginResponse.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/admin/dto/response/LoginResponse.java index 7e802ee9..26091536 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/dto/response/LoginResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/admin/dto/response/LoginResponse.java @@ -1,9 +1,10 @@ -package org.sopt.makers.operation.service.web.admin.dto.response; +package org.sopt.makers.operation.web.admin.dto.response; import lombok.AccessLevel; import lombok.Builder; -import org.operation.admin.domain.Admin; -import org.operation.admin.domain.AdminStatus; + +import org.sopt.makers.operation.domain.admin.domain.Admin; +import org.sopt.makers.operation.domain.admin.domain.AdminStatus; @Builder(access = AccessLevel.PRIVATE) public record LoginResponse( diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/dto/response/RefreshResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/web/admin/dto/response/RefreshResponse.java similarity index 67% rename from operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/dto/response/RefreshResponse.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/admin/dto/response/RefreshResponse.java index 9d521e51..534f70d0 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/dto/response/RefreshResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/admin/dto/response/RefreshResponse.java @@ -1,6 +1,6 @@ -package org.sopt.makers.operation.service.web.admin.dto.response; +package org.sopt.makers.operation.web.admin.dto.response; -import org.operation.admin.domain.Admin; +import org.sopt.makers.operation.domain.admin.domain.Admin; public record RefreshResponse( String accessToken, diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/dto/response/SignUpResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/web/admin/dto/response/SignUpResponse.java similarity index 69% rename from operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/dto/response/SignUpResponse.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/admin/dto/response/SignUpResponse.java index 628e13db..6f29d2cf 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/dto/response/SignUpResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/admin/dto/response/SignUpResponse.java @@ -1,10 +1,9 @@ -package org.sopt.makers.operation.service.web.admin.dto.response; - -import org.operation.admin.domain.Admin; -import org.operation.admin.domain.Role; +package org.sopt.makers.operation.web.admin.dto.response; import lombok.AccessLevel; import lombok.Builder; +import org.sopt.makers.operation.domain.admin.domain.Admin; +import org.sopt.makers.operation.domain.admin.domain.Role; @Builder(access = AccessLevel.PRIVATE) public record SignUpResponse( diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/service/AdminServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/web/admin/service/AdminServiceImpl.java similarity index 58% rename from operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/service/AdminServiceImpl.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/admin/service/AdminServiceImpl.java index 76e65ff2..56d87471 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/service/AdminServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/admin/service/AdminServiceImpl.java @@ -1,15 +1,20 @@ -package org.sopt.makers.operation.service.web.admin.service; - -import org.operation.admin.domain.Admin; -import org.operation.security.AdminAuthentication; -import org.operation.security.jwt.JwtTokenProvider; -import org.sopt.makers.operation.service.web.admin.dto.request.SignUpRequest; -import org.sopt.makers.operation.service.web.admin.dto.response.SignUpResponse; -import org.sopt.makers.operation.service.web.admin.dto.request.LoginRequest; -import org.sopt.makers.operation.service.web.admin.dto.response.LoginResponse; -import org.sopt.makers.operation.service.web.admin.dto.response.RefreshResponse; -import org.sopt.makers.operation.common.exception.AdminFailureException; -import org.sopt.makers.operation.service.web.admin.repository.AdminRepository; +package org.sopt.makers.operation.web.admin.service; + +import static org.sopt.makers.operation.code.failure.member.memberFailureCode.*; +import static org.sopt.makers.operation.code.failure.admin.AdminFailureCode.*; + +import org.sopt.makers.operation.authentication.AdminAuthentication; +import org.sopt.makers.operation.domain.admin.domain.Admin; +import org.sopt.makers.operation.exception.AdminFailureException; +import org.sopt.makers.operation.jwt.JwtTokenProvider; +import org.sopt.makers.operation.jwt.JwtTokenType; +import org.sopt.makers.operation.web.admin.dto.request.SignUpRequest; +import org.sopt.makers.operation.web.admin.dto.response.SignUpResponse; +import org.sopt.makers.operation.web.admin.dto.request.LoginRequest; +import org.sopt.makers.operation.web.admin.dto.response.LoginResponse; +import org.sopt.makers.operation.web.admin.dto.response.RefreshResponse; +import org.sopt.makers.operation.domain.admin.repository.AdminRepository; +import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -21,8 +26,8 @@ @Transactional(readOnly = true) public class AdminServiceImpl implements AdminService { - private final JwtTokenProvider jwtTokenProvider; //TODO auth - private final PasswordEncoder passwordEncoder; //TODO auth + private final JwtTokenProvider jwtTokenProvider; + private final PasswordEncoder passwordEncoder; private final AdminRepository adminRepository; @Override @@ -36,7 +41,7 @@ public SignUpResponse signUp(SignUpRequest request){ private void checkEmailDuplicated(String email) { val isExist = adminRepository.existsByEmail(email); if (isExist) { - throw new AdminFailureException("중복되는 이메일입니다"); //TODO: ExceptionMessage + throw new AdminFailureException(DUPLICATED_EMAIL.getMessage()); } } @@ -46,7 +51,7 @@ public LoginResponse login(LoginRequest request) { val admin = findByEmail(request.email()); checkPasswordMatched(request.password(), admin); checkAdminAllowed(admin); - val refreshToken = generateRefreshToken(); + val refreshToken = generateRefreshToken(admin); admin.updateRefreshToken(refreshToken); val accessToken = generateAccessToken(admin); return LoginResponse.of(admin, accessToken); @@ -57,25 +62,25 @@ private String generateAccessToken(Admin admin) { return jwtTokenProvider.generateAccessToken(adminAuthentication); } - private String generateRefreshToken() { + private String generateRefreshToken(Admin admin) { val authentication = new AdminAuthentication(admin.getId(), null, null); return jwtTokenProvider.generateRefreshToken(authentication); } private Admin findByEmail(String email) { return adminRepository.findByEmail(email) - .orElseThrow(() -> new AdminFailureException("이메일이 존재하지 않습니다")); //TODO: message + .orElseThrow(() -> new AdminFailureException(INVALID_EMAIL.getMessage())); } private void checkPasswordMatched(String password, Admin admin) { // TODO: admin 내부로 옮기는 게 좋지 않을까..? if (!passwordEncoder.matches(password, admin.getPassword())) { - throw new AdminFailureException("비밀번호가 일치하지 않습니다"); + throw new AdminFailureException(INVALID_PASSWORD.getMessage()); } } private void checkAdminAllowed(Admin admin) { if (admin.isNotAllowed()) { - throw new AdminFailureException("승인되지 않은 계정입니다"); + throw new AdminFailureException(NOT_APPROVED_ACCOUNT.getMessage()); } } @@ -83,26 +88,21 @@ private void checkAdminAllowed(Admin admin) { @Transactional public RefreshResponse refresh(String refreshToken) { val adminId = jwtTokenProvider.getId(refreshToken, JwtTokenType.REFRESH_TOKEN); - val admin = findById((Long)adminId); + val admin = findById(adminId); validateRefreshToken(admin, refreshToken); - val newAccessToken = generateAccessToken(); - - //TODO: 재발급 때 access만 해주지 않나?? - /* - val newRefreshToken = jwtTokenProvider.generateRefreshToken(adminAuthentication); - admin.updateRefreshToken(newRefreshToken);*/ + val newAccessToken = generateAccessToken(admin); return RefreshResponse.of(newAccessToken, admin); } public void validateRefreshToken(Admin admin, String refreshToken) { if(!admin.getRefreshToken().equals(refreshToken)) { - throw new AdminFailureException("토큰이 일치하지 않습니다"); //TODO: message + throw new AdminFailureException(INVALID_TOKEN.getMessage()); } } private Admin findById(Long adminId) { return adminRepository.findById(adminId) - .orElseThrow(() -> new AdminFailureException(INVALID_MEMBER.getName())); + .orElseThrow(() -> new AdminFailureException(INVALID_MEMBER.getMessage())); } } diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/repository/AdminRepository.java b/operation-domain/src/main/java/org/sopt/makers/operation/domain/admin/repository/AdminRepository.java similarity index 72% rename from operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/repository/AdminRepository.java rename to operation-domain/src/main/java/org/sopt/makers/operation/domain/admin/repository/AdminRepository.java index d1680a2d..384d29f3 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/web/admin/repository/AdminRepository.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/domain/admin/repository/AdminRepository.java @@ -1,8 +1,8 @@ -package org.sopt.makers.operation.service.web.admin.repository; +package org.sopt.makers.operation.domain.admin.repository; import java.util.Optional; -import org.operation.admin.domain.Admin; +import org.sopt.makers.operation.domain.admin.domain.Admin; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; From 6ebbd6b000a06291be68920f389d5cf8a7049d4a Mon Sep 17 00:00:00 2001 From: dragontaek-lee Date: Fri, 9 Feb 2024 14:29:30 +0900 Subject: [PATCH 089/141] =?UTF-8?q?[FEAT]=20app=20attendance=20api=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/AttendanceApiController.java | 2 +- .../dto/response/AttendanceResponse.java | 2 +- .../service/AttendanceServiceImpl.java | 29 +++++++++++++------ .../response/AttendanceTotalResponseDTO.java | 4 +-- .../dto/response/AttendanceTotalVO.java | 8 ++--- 5 files changed, 28 insertions(+), 17 deletions(-) rename operation-api/src/main/java/org/sopt/makers/operation/{service => }/app/member/dto/response/AttendanceTotalResponseDTO.java (86%) rename operation-api/src/main/java/org/sopt/makers/operation/{service => }/app/member/dto/response/AttendanceTotalVO.java (76%) diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/api/AttendanceApiController.java b/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/api/AttendanceApiController.java index f533cc03..8b9b0da0 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/api/AttendanceApiController.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/api/AttendanceApiController.java @@ -32,6 +32,6 @@ public class AttendanceApiController implements AttendanceApi { public ResponseEntity> attend(@RequestBody AttendanceRequest request, @NonNull Principal principal) { val memberId = utils.getMemberId(principal); val response = attendanceService.attend(memberId, request); - return ApiResponseUtil.success(SUCCESS_GET_ATTENDANCE, response); + return ApiResponseUtil.success(SUCCESS_ATTEND, response); } } diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/dto/response/AttendanceResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/dto/response/AttendanceResponse.java index 1bfeba45..fc0520bd 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/dto/response/AttendanceResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/dto/response/AttendanceResponse.java @@ -1,6 +1,6 @@ package org.sopt.makers.operation.app.attendance.dto.response; -import org.operation.attendance.domain.SubAttendance; +import org.sopt.makers.operation.domain.attendance.domain.SubAttendance; public record AttendanceResponse( Long subLectureId diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/service/AttendanceServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/service/AttendanceServiceImpl.java index 657101aa..fbfa8b3d 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/service/AttendanceServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/service/AttendanceServiceImpl.java @@ -1,16 +1,27 @@ package org.sopt.makers.operation.app.attendance.service; import static org.sopt.makers.operation.domain.attendance.domain.AttendanceStatus.*; - +import static org.sopt.makers.operation.code.failure.member.memberFailureCode.*; +import static org.sopt.makers.operation.code.failure.subAttendance.subAttendanceFailureCode.*; +import static org.sopt.makers.operation.code.failure.lecture.lectureFailureCode.*; +import static org.sopt.makers.operation.code.failure.subLecture.subLectureFailureCode.*; + +import org.sopt.makers.operation.domain.attendance.domain.SubAttendance; +import org.sopt.makers.operation.domain.lecture.Lecture; +import org.sopt.makers.operation.domain.lecture.SubLecture; +import org.sopt.makers.operation.domain.attendance.domain.Attendance; +import org.sopt.makers.operation.domain.member.domain.Member; import org.sopt.makers.operation.app.attendance.dto.request.AttendanceRequest; import org.sopt.makers.operation.app.attendance.dto.response.AttendanceResponse; import org.sopt.makers.operation.config.ValueConfig; import org.sopt.makers.operation.domain.attendance.repository.attendance.AttendanceRepository; import org.sopt.makers.operation.domain.lecture.repository.subLecture.SubLectureRepository; import org.sopt.makers.operation.domain.member.repository.MemberRepository; +import org.sopt.makers.operation.exception.SubLectureException; +import org.sopt.makers.operation.exception.LectureException; +import org.sopt.makers.operation.exception.MemberException; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; - import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import lombok.val; @@ -50,7 +61,7 @@ private SubLecture getSubLecture(long subLectureId, String code) { private SubLecture findSubLecture(long subLectureId) { return subLectureRepository .findById(subLectureId) - .orElseThrow(() -> new SubLectureException(INVALID_SUB_LECTURE.getContent())); + .orElseThrow(() -> new SubLectureException(INVALID_ATTENDANCE.getMessage())); } private void checkSubLectureValidity(SubLecture subLecture) { @@ -60,20 +71,20 @@ private void checkSubLectureValidity(SubLecture subLecture) { private void checkSubLectureStarted(SubLecture subLecture) { if (subLecture.isNotStarted()) { - throw new LectureException(NOT_STARTED_NTH_ATTENDANCE.getContent()); + throw new LectureException(NOT_STARTED_NTH_ATTENDANCE.getMessage()); } } private void checkSubLectureEnded(SubLecture subLecture) { val attendanceMinute = valueConfig.getATTENDANCE_MINUTE(); if (subLecture.isEnded(attendanceMinute)) { - throw new LectureException(subLecture.getRound() + ENDED_ATTENDANCE.getContent()); + throw new LectureException(subLecture.getRound() + ENDED_ATTENDANCE.getMessage()); } } private void checkMatchedCode(SubLecture subLecture, String code) { if (subLecture.isMatchCode(code)) { - throw new SubLectureException(INVALID_CODE.getContent()); + throw new SubLectureException(INVALID_CODE.getMessage()); } } @@ -87,18 +98,18 @@ private Attendance getAttendance(SubLecture subLecture, long playgroundId) { private Member findMember(long playgroundId, int generation) { return memberRepository .getMemberByPlaygroundIdAndGeneration(playgroundId, generation) - .orElseThrow(() -> new MemberException(INVALID_MEMBER.getContent())); + .orElseThrow(() -> new MemberException(INVALID_MEMBER.getMessage())); } private Attendance findAttendance(Lecture lecture, Member member) { return attendanceRepository.findByLectureAndMember(lecture, member) - .orElseThrow(() -> new LectureException(INVALID_ATTENDANCE.getContent())); + .orElseThrow(() -> new LectureException(INVALID_ATTENDANCE.getMessage())); } private SubAttendance getSubAttendance(Attendance attendance, int round) { return attendance.getSubAttendances().stream() .filter(subAttendance -> subAttendance.isMatchRound(round)) .findFirst() - .orElseThrow(() -> new SubLectureException(INVALID_SUB_ATTENDANCE.getContent())); + .orElseThrow(() -> new SubLectureException(INVALID_SUB_ATTENDANCE.getMessage())); } } diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/app/member/dto/response/AttendanceTotalResponseDTO.java b/operation-api/src/main/java/org/sopt/makers/operation/app/member/dto/response/AttendanceTotalResponseDTO.java similarity index 86% rename from operation-api/src/main/java/org/sopt/makers/operation/service/app/member/dto/response/AttendanceTotalResponseDTO.java rename to operation-api/src/main/java/org/sopt/makers/operation/app/member/dto/response/AttendanceTotalResponseDTO.java index a35eaf2c..2469c02b 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/app/member/dto/response/AttendanceTotalResponseDTO.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/member/dto/response/AttendanceTotalResponseDTO.java @@ -1,9 +1,9 @@ -package org.sopt.makers.operation.service.app.member.dto.response; +package org.sopt.makers.operation.app.member.dto.response; import java.util.List; import org.sopt.makers.operation.domain.Part; -import org.operation.member.domain.Member; +import org.sopt.makers.operation.domain.member.domain.Member; import org.sopt.makers.operation.service.web.member.dto.response.AttendanceTotalCountVO; public record AttendanceTotalResponseDTO( diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/app/member/dto/response/AttendanceTotalVO.java b/operation-api/src/main/java/org/sopt/makers/operation/app/member/dto/response/AttendanceTotalVO.java similarity index 76% rename from operation-api/src/main/java/org/sopt/makers/operation/service/app/member/dto/response/AttendanceTotalVO.java rename to operation-api/src/main/java/org/sopt/makers/operation/app/member/dto/response/AttendanceTotalVO.java index 1eb7ae95..15957684 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/app/member/dto/response/AttendanceTotalVO.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/member/dto/response/AttendanceTotalVO.java @@ -1,10 +1,10 @@ -package org.sopt.makers.operation.service.app.member.dto.response; +package org.sopt.makers.operation.app.member.dto.response; import java.time.format.DateTimeFormatter; -import org.operation.attendance.domain.Attendance; -import org.operation.attendance.domain.AttendanceStatus; -import org.operation.lecture.Attribute; +import org.sopt.makers.operation.domain.attendance.domain.Attendance; +import org.sopt.makers.operation.domain.attendance.domain.AttendanceStatus; +import org.sopt.makers.operation.domain.lecture.Attribute; public record AttendanceTotalVO( Attribute attribute, From 0634c0221b4e965347746879cd96838d5c6dd09d Mon Sep 17 00:00:00 2001 From: dragontaek-lee Date: Fri, 9 Feb 2024 14:29:44 +0900 Subject: [PATCH 090/141] =?UTF-8?q?[FEAT]=20app=20lecture=20api=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/lecture/api/LectureApiController.java | 11 +- .../response/LectureCurrentRoundResponse.java | 4 +- .../dto/response/LectureResponseType.java | 2 +- .../dto/response/TodayLectureResponse.java | 9 +- .../lecture/service/LectureServiceImpl.java | 180 ++++++++++++++++++ .../lecture/service/LectureServiceImpl.java | 179 ----------------- .../service/service/LectureServiceImpl.java | 75 -------- 7 files changed, 191 insertions(+), 269 deletions(-) rename operation-api/src/main/java/org/sopt/makers/operation/{service => }/app/lecture/dto/response/LectureCurrentRoundResponse.java (71%) rename operation-api/src/main/java/org/sopt/makers/operation/{service => }/app/lecture/dto/response/LectureResponseType.java (54%) rename operation-api/src/main/java/org/sopt/makers/operation/{service => }/app/lecture/dto/response/TodayLectureResponse.java (87%) create mode 100644 operation-api/src/main/java/org/sopt/makers/operation/app/lecture/service/LectureServiceImpl.java delete mode 100644 operation-api/src/main/java/org/sopt/makers/operation/service/app/lecture/service/LectureServiceImpl.java delete mode 100644 operation-api/src/main/java/org/sopt/makers/operation/service/service/LectureServiceImpl.java diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/api/LectureApiController.java b/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/api/LectureApiController.java index bd3b997b..58606485 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/api/LectureApiController.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/api/LectureApiController.java @@ -1,6 +1,6 @@ package org.sopt.makers.operation.app.lecture.api; -import static org.sopt.makers.operation.app.lecture.message.SuccessMessage.*; +import static org.sopt.makers.operation.code.success.app.LectureSuccessCode.*; import java.security.Principal; @@ -8,10 +8,7 @@ import org.sopt.makers.operation.common.dto.BaseResponse; import org.sopt.makers.operation.common.util.ApiResponseUtil; import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import lombok.NonNull; import lombok.RequiredArgsConstructor; @@ -29,13 +26,13 @@ public class LectureApiController implements LectureApi { public ResponseEntity> getTodayLecture(@NonNull Principal principal) { val memberId = Long.parseLong(principal.getName()); val response = lectureService.getTodayLecture(memberId); - return ApiResponseUtil.ok(SUCCESS_SINGLE_GET_LECTURE.getContent(), response); + return ApiResponseUtil.success(SUCCESS_SINGLE_GET_LECTURE, response); } @Override @GetMapping("/round/{lectureId}") public ResponseEntity> getRound(@PathVariable long lectureId) { val response = lectureService.getCurrentLectureRound(lectureId); - return ApiResponseUtil.ok(SUCCESS_GET_LECTURE_ROUND.getContent(), response); + return ApiResponseUtil.success(SUCCESS_GET_LECTURE_ROUND, response); } } diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/app/lecture/dto/response/LectureCurrentRoundResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/dto/response/LectureCurrentRoundResponse.java similarity index 71% rename from operation-api/src/main/java/org/sopt/makers/operation/service/app/lecture/dto/response/LectureCurrentRoundResponse.java rename to operation-api/src/main/java/org/sopt/makers/operation/app/lecture/dto/response/LectureCurrentRoundResponse.java index 34cdeb1f..3a400811 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/app/lecture/dto/response/LectureCurrentRoundResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/dto/response/LectureCurrentRoundResponse.java @@ -1,6 +1,6 @@ -package org.sopt.makers.operation.service.app.lecture.dto.response; +package org.sopt.makers.operation.app.lecture.dto.response; -import org.operation.lecture.SubLecture; +import org.sopt.makers.operation.domain.lecture.SubLecture; public record LectureCurrentRoundResponse( Long id, diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/app/lecture/dto/response/LectureResponseType.java b/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/dto/response/LectureResponseType.java similarity index 54% rename from operation-api/src/main/java/org/sopt/makers/operation/service/app/lecture/dto/response/LectureResponseType.java rename to operation-api/src/main/java/org/sopt/makers/operation/app/lecture/dto/response/LectureResponseType.java index f3f81bd2..ac9e5c3b 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/app/lecture/dto/response/LectureResponseType.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/dto/response/LectureResponseType.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.service.app.lecture.dto.response; +package org.sopt.makers.operation.app.lecture.dto.response; public enum LectureResponseType { NO_SESSION, HAS_ATTENDANCE, NO_ATTENDANCE diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/app/lecture/dto/response/TodayLectureResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/dto/response/TodayLectureResponse.java similarity index 87% rename from operation-api/src/main/java/org/sopt/makers/operation/service/app/lecture/dto/response/TodayLectureResponse.java rename to operation-api/src/main/java/org/sopt/makers/operation/app/lecture/dto/response/TodayLectureResponse.java index 03e08a60..b7726b9a 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/app/lecture/dto/response/TodayLectureResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/dto/response/TodayLectureResponse.java @@ -1,15 +1,14 @@ -package org.sopt.makers.operation.service.app.lecture.dto.response; +package org.sopt.makers.operation.app.lecture.dto.response; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.List; import java.util.stream.Collectors; -import org.operation.attendance.domain.AttendanceStatus; -import org.operation.attendance.domain.SubAttendance; -import org.operation.lecture.Lecture; - import lombok.Builder; +import org.sopt.makers.operation.domain.attendance.domain.AttendanceStatus; +import org.sopt.makers.operation.domain.attendance.domain.SubAttendance; +import org.sopt.makers.operation.domain.lecture.Lecture; @Builder public record TodayLectureResponse( diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/service/LectureServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/service/LectureServiceImpl.java new file mode 100644 index 00000000..15a96a06 --- /dev/null +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/service/LectureServiceImpl.java @@ -0,0 +1,180 @@ +package org.sopt.makers.operation.app.lecture.service; + +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.util.Collections; +import java.util.List; + +import static org.sopt.makers.operation.domain.attendance.domain.AttendanceStatus.*; +import static org.sopt.makers.operation.domain.lecture.LectureStatus.*; +import static org.sopt.makers.operation.code.failure.lecture.lectureFailureCode.*; +import static org.sopt.makers.operation.code.failure.subLecture.subLectureFailureCode.*; + +import org.sopt.makers.operation.app.lecture.dto.response.LectureCurrentRoundResponse; +import org.sopt.makers.operation.app.lecture.dto.response.LectureResponseType; +import org.sopt.makers.operation.app.lecture.dto.response.TodayLectureResponse; +import org.sopt.makers.operation.config.ValueConfig; +import org.sopt.makers.operation.domain.attendance.domain.SubAttendance; +import org.sopt.makers.operation.domain.attendance.repository.attendance.AttendanceRepository; +import org.sopt.makers.operation.domain.lecture.Attribute; +import org.sopt.makers.operation.domain.lecture.Lecture; +import org.sopt.makers.operation.domain.lecture.SubLecture; +import org.sopt.makers.operation.domain.attendance.domain.Attendance; +import org.sopt.makers.operation.domain.lecture.repository.lecture.LectureRepository; +import org.sopt.makers.operation.exception.LectureException; +import org.sopt.makers.operation.exception.SubLectureException; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import lombok.RequiredArgsConstructor; +import lombok.val; + +@Service +@RequiredArgsConstructor +@Transactional(readOnly = true) +public class LectureServiceImpl implements LectureService { + + private final LectureRepository lectureRepository; + private final AttendanceRepository attendanceRepository; + private final ValueConfig valueConfig; + + @Override + public TodayLectureResponse getTodayLecture(long memberPlaygroundId) { + val attendances = attendanceRepository.findToday(memberPlaygroundId); + checkAttendancesSize(attendances); + + if (attendances.isEmpty()) { + return getEmptyResponse(); + } + + val attendance = getNowAttendance(attendances); + val lecture = attendance.getLecture(); + val responseType = getResponseType(lecture); + val message = getMessage(lecture.getAttribute()); + + if (responseType.equals(LectureResponseType.NO_ATTENDANCE) || lecture.isBefore()) { + return TodayLectureResponse.of(responseType, lecture, message, Collections.emptyList()); + } + + val subAttendances = attendance.getSubAttendances(); + val subAttendance = lecture.isFirst() ? subAttendances.get(0) : subAttendances.get(1); + return getTodayLectureResponse(subAttendance, responseType, lecture); + } + + private TodayLectureResponse getEmptyResponse() { + return TodayLectureResponse.builder() + .type(LectureResponseType.NO_SESSION) + .id(0L) + .location("") + .name("") + .startDate("") + .endDate("") + .message("") + .attendances(Collections.emptyList()) + .build(); + } + + private void checkAttendancesSize(List attendances) { + if (attendances.size() > valueConfig.getSUB_LECTURE_MAX_ROUND()) { + throw new LectureException(INVALID_COUNT_SESSION.getMessage()); + } + } + + private Attendance getNowAttendance(List attendances) { + val index = getAttendanceIndex(); + return attendances.get(index); + } + + private int getAttendanceIndex() { + return (LocalDateTime.now().getHour() >= 16) ? 1 : 0; + } + + private LectureResponseType getResponseType(Lecture lecture) { + val attribute = lecture.getAttribute(); + return attribute.equals(Attribute.ETC) ? LectureResponseType.NO_ATTENDANCE : LectureResponseType.HAS_ATTENDANCE; + } + + private String getMessage(Attribute attribute) { + return switch (attribute) { + case SEMINAR -> valueConfig.getSEMINAR_MESSAGE(); + case EVENT -> valueConfig.getEVENT_MESSAGE(); + case ETC -> valueConfig.getETC_MESSAGE(); + }; + } + + private TodayLectureResponse getTodayLectureResponse(SubAttendance subAttendance, LectureResponseType responseType, Lecture lecture) { + val subLecture = subAttendance.getSubLecture(); + val isOnAttendanceCheck = LocalDateTime.now().isBefore(subLecture.getStartAt().plusMinutes(10)); + val message = getMessage(lecture.getAttribute()); + if (isOnAttendanceCheck && subAttendance.getStatus().equals(ABSENT)) { + return TodayLectureResponse.of(responseType, lecture, message, Collections.emptyList()); + } + return TodayLectureResponse.of(responseType, lecture, message, Collections.singletonList(subAttendance)); + } + + @Override + public LectureCurrentRoundResponse getCurrentLectureRound(long lectureId) { + val lecture = findLecture(lectureId); + val subLecture = getSubLecture(lecture); + checkLectureExist(lecture); + checkLectureBefore(lecture); + checkEndAttendance(subLecture); + checkLectureEnd(lecture); + return LectureCurrentRoundResponse.of(subLecture); + } + + private Lecture findLecture(Long id) { + return lectureRepository.findById(id) + .orElseThrow(() -> new LectureException(INVALID_LECTURE.getMessage())); + } + + private SubLecture getSubLecture(Lecture lecture) { + val status = lecture.getLectureStatus(); + val round = status.equals(FIRST) ? 1 : 2; + return getSubLecture(lecture, round); + } + + private SubLecture getSubLecture(Lecture lecture, int round) { + return lecture.getSubLectures().stream() + .filter(l -> l.getRound() == round) + .findFirst() + .orElseThrow(() -> new SubLectureException(NO_SUB_LECTURE_EQUAL_ROUND.getMessage())); + } + + private void checkLectureExist(Lecture lecture) { + val today = LocalDate.now(); + val startOfDay = today.atStartOfDay(); + val endOfDay = LocalDateTime.of(today, LocalTime.MAX); + val startAt = lecture.getStartDate(); + if (startAt.isBefore(startOfDay) || startAt.isAfter(endOfDay)) { + throw new LectureException(NO_SESSION.getMessage()); + } + } + + private void checkLectureBefore(Lecture lecture) { + if (lecture.isBefore()) { + throw new LectureException(NOT_STARTED_ATTENDANCE.getMessage()); + } + } + + private void checkEndAttendance(SubLecture subLecture) { + if (isEndAttendance(subLecture)) { + throw new LectureException(subLecture.getRound() + ENDED_ATTENDANCE.getMessage()); + } + } + + private boolean isEndAttendance(SubLecture subLecture) { + val status = subLecture.getLecture().getLectureStatus(); + if (LocalDateTime.now().isAfter(subLecture.getStartAt().plusMinutes(10))) { + return status.equals(FIRST) || status.equals(SECOND); + } + return false; + } + + private void checkLectureEnd(Lecture lecture) { + if (lecture.isEnd()) { + throw new LectureException(END_LECTURE.getMessage()); + } + } +} diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/app/lecture/service/LectureServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/service/app/lecture/service/LectureServiceImpl.java deleted file mode 100644 index 5d2355d1..00000000 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/app/lecture/service/LectureServiceImpl.java +++ /dev/null @@ -1,179 +0,0 @@ -package org.sopt.makers.operation.service.app.lecture.service; - -import static org.operation.attendance.domain.AttendanceStatus.*; -import static org.operation.lecture.LectureStatus.*; -import static org.operation.lecture.message.ErrorMessage.*; - -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.time.LocalTime; -import java.util.Collections; -import java.util.List; - -import org.sopt.makers.operation.service.app.lecture.dto.response.LectureCurrentRoundResponse; -import org.sopt.makers.operation.service.app.lecture.dto.response.LectureResponseType; -import org.sopt.makers.operation.service.app.lecture.dto.response.TodayLectureResponse; -import org.operation.attendance.domain.Attendance; -import org.operation.attendance.domain.SubAttendance; -import org.operation.attendance.repository.attendance.AttendanceRepository; -import org.sopt.makers.operation.common.config.ValueConfig; -import org.sopt.makers.operation.common.exception.LectureException; -import org.sopt.makers.operation.common.exception.SubLectureException; -import org.operation.lecture.repository.lecture.LectureRepository; -import org.operation.lecture.Attribute; -import org.operation.lecture.Lecture; -import org.operation.lecture.SubLecture; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import lombok.RequiredArgsConstructor; -import lombok.val; - -@Service -@RequiredArgsConstructor -@Transactional(readOnly = true) -public class LectureServiceImpl implements LectureService { - - private final LectureRepository lectureRepository; - private final AttendanceRepository attendanceRepository; - private final ValueConfig valueConfig; - - @Override - public TodayLectureResponse getTodayLecture(long memberPlaygroundId) { - val attendances = attendanceRepository.findToday(memberPlaygroundId); - checkAttendancesSize(attendances); - - if (attendances.isEmpty()) { - return getEmptyResponse(); - } - - val attendance = getNowAttendance(attendances); - val lecture = attendance.getLecture(); - val responseType = getResponseType(lecture); - val message = getMessage(lecture.getAttribute()); - - if (responseType.equals(LectureResponseType.NO_ATTENDANCE) || lecture.isBefore()) { - return TodayLectureResponse.of(responseType, lecture, message, Collections.emptyList()); - } - - val subAttendances = attendance.getSubAttendances(); - val subAttendance = lecture.isFirst() ? subAttendances.get(0) : subAttendances.get(1); - return getTodayLectureResponse(subAttendance, responseType, lecture); - } - - private TodayLectureResponse getEmptyResponse() { - return TodayLectureResponse.builder() - .type(LectureResponseType.NO_SESSION) - .id(0L) - .location("") - .name("") - .startDate("") - .endDate("") - .message("") - .attendances(Collections.emptyList()) - .build(); - } - - private void checkAttendancesSize(List attendances) { - if (attendances.size() > valueConfig.getSUB_LECTURE_MAX_ROUND()) { - throw new LectureException(INVALID_COUNT_SESSION.getContent()); - } - } - - private Attendance getNowAttendance(List attendances) { - val index = getAttendanceIndex(); - return attendances.get(index); - } - - private int getAttendanceIndex() { - return (LocalDateTime.now().getHour() >= 16) ? 1 : 0; - } - - private LectureResponseType getResponseType(Lecture lecture) { - val attribute = lecture.getAttribute(); - return attribute.equals(Attribute.ETC) ? LectureResponseType.NO_ATTENDANCE : LectureResponseType.HAS_ATTENDANCE; - } - - private String getMessage(Attribute attribute) { - return switch (attribute) { - case SEMINAR -> valueConfig.getSEMINAR_MESSAGE(); - case EVENT -> valueConfig.getEVENT_MESSAGE(); - case ETC -> valueConfig.getETC_MESSAGE(); - }; - } - - private TodayLectureResponse getTodayLectureResponse(SubAttendance subAttendance, LectureResponseType responseType, Lecture lecture) { - val subLecture = subAttendance.getSubLecture(); - val isOnAttendanceCheck = LocalDateTime.now().isBefore(subLecture.getStartAt().plusMinutes(10)); - val message = getMessage(lecture.getAttribute()); - if (isOnAttendanceCheck && subAttendance.getStatus().equals(ABSENT)) { - return TodayLectureResponse.of(responseType, lecture, message, Collections.emptyList()); - } - return TodayLectureResponse.of(responseType, lecture, message, Collections.singletonList(subAttendance)); - } - - @Override - public LectureCurrentRoundResponse getCurrentLectureRound(long lectureId) { - val lecture = findLecture(lectureId); - val subLecture = getSubLecture(lecture); - checkLectureExist(lecture); - checkLectureBefore(lecture); - checkEndAttendance(subLecture); - checkLectureEnd(lecture); - return LectureCurrentRoundResponse.of(subLecture); - } - - private Lecture findLecture(Long id) { - return lectureRepository.findById(id) - .orElseThrow(() -> new LectureException(INVALID_LECTURE.getContent())); - } - - private SubLecture getSubLecture(Lecture lecture) { - val status = lecture.getLectureStatus(); - val round = status.equals(FIRST) ? 1 : 2; - return getSubLecture(lecture, round); - } - - private SubLecture getSubLecture(Lecture lecture, int round) { - return lecture.getSubLectures().stream() - .filter(l -> l.getRound() == round) - .findFirst() - .orElseThrow(() -> new SubLectureException(NO_SUB_LECTURE_EQUAL_ROUND.getContent())); - } - - private void checkLectureExist(Lecture lecture) { - val today = LocalDate.now(); - val startOfDay = today.atStartOfDay(); - val endOfDay = LocalDateTime.of(today, LocalTime.MAX); - val startAt = lecture.getStartDate(); - if (startAt.isBefore(startOfDay) || startAt.isAfter(endOfDay)) { - throw new LectureException(NO_SESSION.getContent()); - } - } - - private void checkLectureBefore(Lecture lecture) { - if (lecture.isBefore()) { - throw new LectureException(NOT_STARTED_ATTENDANCE.getContent()); - } - } - - private void checkEndAttendance(SubLecture subLecture) { - if (isEndAttendance(subLecture)) { - throw new LectureException(subLecture.getRound() + ENDED_ATTENDANCE.getContent()); - } - } - - private boolean isEndAttendance(SubLecture subLecture) { - val status = subLecture.getLecture().getLectureStatus(); - if (LocalDateTime.now().isAfter(subLecture.getStartAt().plusMinutes(10))) { - return status.equals(FIRST) || status.equals(SECOND); - } - return false; - } - - private void checkLectureEnd(Lecture lecture) { - if (lecture.isEnd()) { - throw new LectureException(END_LECTURE.getContent()); - } - } -} diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/service/LectureServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/service/service/LectureServiceImpl.java deleted file mode 100644 index 56a77fbe..00000000 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/service/LectureServiceImpl.java +++ /dev/null @@ -1,75 +0,0 @@ -package org.sopt.makers.operation.service.service; - -import static org.operation.alarm.domain.Attribute.*; -import static org.operation.lecture.message.ErrorMessage.*; - -import java.util.*; - -import lombok.val; - -import org.operation.client.alarm.AlarmSender; -import org.sopt.makers.operation.common.config.ValueConfig; -import org.sopt.makers.operation.common.exception.LectureException; -import org.sopt.makers.operation.common.scheduler.service.LectureService; - -import org.operation.lecture.Lecture; -import org.operation.lecture.repository.lecture.LectureRepository; -import org.sopt.makers.operation.web.alarm.dto.request.AlarmSenderRequest; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import lombok.RequiredArgsConstructor; - -@Service -@RequiredArgsConstructor -@Transactional(readOnly = true) -public class LectureServiceImpl implements LectureService { - - private final LectureRepository lectureRepository; - private final AlarmSender alarmSender; - private final ValueConfig valueConfig; - - @Override - @Transactional - public void endLectures() { - val lectures = lectureRepository.findLecturesToBeEnd(); - lectures.forEach(lecture -> endLecture(lecture.getId())); - } - - private void endLecture(Long lectureId) { - val lecture = findLecture(lectureId); - checkEndLectureValidity(lecture); - lecture.updateToEnd(); - sendAlarm(lecture); - } - - private Lecture findLecture(Long id) { - return lectureRepository.findById(id) - .orElseThrow(() -> new LectureException(INVALID_LECTURE.getContent())); - } - - private void checkEndLectureValidity(Lecture lecture) { - if (!lecture.isEnd()) { - throw new LectureException(NOT_END_TIME_YET.getContent()); - } - } - - private void sendAlarm(Lecture lecture) { - val alarmTitle = getAlarmTitle(lecture); - val alarmContent = valueConfig.getALARM_MESSAGE_CONTENT(); - val memberPlaygroundIds = getMemberPlaygroundIds(lecture); - alarmSender.send(new AlarmSenderRequest(alarmTitle, alarmContent, memberPlaygroundIds, NEWS, null)); - } - - private List getMemberPlaygroundIds(Lecture lecture) { - return lecture.getAttendances().stream() - .map(attendance -> String.valueOf(attendance.getMember().getPlaygroundId())) - .filter(id -> !id.equals("null")) - .toList(); - } - - private String getAlarmTitle(Lecture lecture) { - return lecture.getName() + " " + valueConfig.getALARM_MESSAGE_TITLE(); - } - -} From a1da08b3b7c6794727e882e070a9cd5a58901ee2 Mon Sep 17 00:00:00 2001 From: dragontaek-lee Date: Fri, 9 Feb 2024 14:29:54 +0900 Subject: [PATCH 091/141] =?UTF-8?q?[FEAT]=20app=20member=20api=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/member/api/MemberApiController.java | 6 ++-- .../dto/response/MemberScoreGetResponse.java | 2 +- .../app/member/service/MemberServiceImpl.java | 30 +++++++++---------- .../dto/response/MemberListGetResponse.java | 2 +- 4 files changed, 20 insertions(+), 20 deletions(-) rename operation-api/src/main/java/org/sopt/makers/operation/{service => }/app/member/dto/response/MemberScoreGetResponse.java (71%) rename operation-api/src/main/java/org/sopt/makers/operation/{service => }/app/member/service/MemberServiceImpl.java (76%) diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/member/api/MemberApiController.java b/operation-api/src/main/java/org/sopt/makers/operation/app/member/api/MemberApiController.java index 424fe469..21bbbd25 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/app/member/api/MemberApiController.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/member/api/MemberApiController.java @@ -1,6 +1,6 @@ package org.sopt.makers.operation.app.member.api; -import static org.sopt.makers.operation.app.member.message.SuccessMessage.*; +import static org.sopt.makers.operation.code.success.app.MemberSuccessCode.*; import java.security.Principal; @@ -30,7 +30,7 @@ public class MemberApiController implements MemberApi { public ResponseEntity> getMemberTotalAttendance(@NonNull Principal principal) { val memberId = utils.getMemberId(principal); val response = memberService.getMemberTotalAttendance(memberId); - return ApiResponseUtil.ok(SUCCESS_TOTAL_ATTENDANCE.getContent(), response); + return ApiResponseUtil.success(SUCCESS_GET_TOTAL_ATTENDANCE, response); } @Override @@ -38,6 +38,6 @@ public ResponseEntity> getMemberTotalAttendance(@NonNull Princip public ResponseEntity> getScore(@NonNull Principal principal) { val memberId = utils.getMemberId(principal); val response = memberService.getMemberScore(memberId); - return ApiResponseUtil.ok(SUCCESS_GET_ATTENDANCE_SCORE.getContent(), response); + return ApiResponseUtil.success(SUCCESS_GET_ATTENDANCE_SCORE, response); } } diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/app/member/dto/response/MemberScoreGetResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/app/member/dto/response/MemberScoreGetResponse.java similarity index 71% rename from operation-api/src/main/java/org/sopt/makers/operation/service/app/member/dto/response/MemberScoreGetResponse.java rename to operation-api/src/main/java/org/sopt/makers/operation/app/member/dto/response/MemberScoreGetResponse.java index ccef19ae..c15151bc 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/app/member/dto/response/MemberScoreGetResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/member/dto/response/MemberScoreGetResponse.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.service.app.member.dto.response; +package org.sopt.makers.operation.app.member.dto.response; public record MemberScoreGetResponse( float score diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/app/member/service/MemberServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/app/member/service/MemberServiceImpl.java similarity index 76% rename from operation-api/src/main/java/org/sopt/makers/operation/service/app/member/service/MemberServiceImpl.java rename to operation-api/src/main/java/org/sopt/makers/operation/app/member/service/MemberServiceImpl.java index 5b83191e..47f3af1e 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/app/member/service/MemberServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/member/service/MemberServiceImpl.java @@ -1,20 +1,20 @@ -package org.sopt.makers.operation.service.app.member.service; +package org.sopt.makers.operation.app.member.service; -import static org.operation.member.message.ErrorMessage.*; +import static org.sopt.makers.operation.domain.lecture.Attribute.*; +import static org.sopt.makers.operation.code.failure.member.memberFailureCode.*; import java.util.EnumMap; import java.util.List; -import org.sopt.makers.operation.service.app.member.dto.response.AttendanceTotalResponseDTO; -import org.sopt.makers.operation.service.app.member.dto.response.AttendanceTotalVO; -import org.sopt.makers.operation.service.app.member.dto.response.MemberScoreGetResponse; -import org.operation.attendance.domain.AttendanceStatus; -import org.operation.attendance.repository.attendance.AttendanceRepository; -import org.sopt.makers.operation.common.config.ValueConfig; -import org.sopt.makers.operation.common.exception.MemberException; -import org.operation.lecture.Attribute; -import org.operation.member.domain.Member; -import org.operation.member.repository.MemberRepository; +import org.sopt.makers.operation.app.member.dto.response.AttendanceTotalResponseDTO; +import org.sopt.makers.operation.app.member.dto.response.AttendanceTotalVO; +import org.sopt.makers.operation.app.member.dto.response.MemberScoreGetResponse; +import org.sopt.makers.operation.config.ValueConfig; +import org.sopt.makers.operation.domain.attendance.domain.AttendanceStatus; +import org.sopt.makers.operation.domain.attendance.repository.attendance.AttendanceRepository; +import org.sopt.makers.operation.domain.member.domain.Member; +import org.sopt.makers.operation.domain.member.repository.MemberRepository; +import org.sopt.makers.operation.exception.MemberException; import org.sopt.makers.operation.service.web.member.dto.response.AttendanceTotalCountVO; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -33,7 +33,7 @@ public class MemberServiceImpl implements MemberService { @Override public AttendanceTotalResponseDTO getMemberTotalAttendance(Long playGroundId) { val member = memberRepository.getMemberByPlaygroundIdAndGeneration(playGroundId, valueConfig.getGENERATION()) - .orElseThrow(() -> new MemberException(INVALID_MEMBER.getContent())); + .orElseThrow(() -> new MemberException(INVALID_MEMBER.getMessage())); val attendances = findAttendances(member); val countAttendance = countAttendance(attendances); @@ -47,7 +47,7 @@ public AttendanceTotalResponseDTO getMemberTotalAttendance(Long playGroundId) { @Override public MemberScoreGetResponse getMemberScore(Long playGroundId) { val member = memberRepository.getMemberByPlaygroundIdAndGeneration(playGroundId, valueConfig.getGENERATION()) - .orElseThrow(() -> new MemberException(INVALID_MEMBER.getContent())); + .orElseThrow(() -> new MemberException(INVALID_MEMBER.getMessage())); return MemberScoreGetResponse.of(member.getScore()); } @@ -55,7 +55,7 @@ public MemberScoreGetResponse getMemberScore(Long playGroundId) { private List filterEtcNoAppearance(List attendances) { return attendances.stream() .filter(attendanceTotalVO -> - !(attendanceTotalVO.attribute().equals(Attribute.ETC) + !(attendanceTotalVO.attribute().equals(ETC) && attendanceTotalVO.status().equals(AttendanceStatus.NOT_PARTICIPATE)) ) .toList(); diff --git a/operation-api/src/main/java/org/sopt/makers/operation/service/web/member/dto/response/MemberListGetResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/service/web/member/dto/response/MemberListGetResponse.java index c133aec9..1ff0d745 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/service/web/member/dto/response/MemberListGetResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/service/web/member/dto/response/MemberListGetResponse.java @@ -1,7 +1,7 @@ package org.sopt.makers.operation.service.web.member.dto.response; import org.sopt.makers.operation.domain.Part; -import org.operation.member.domain.Member; +import org.sopt.makers.operation.domain.member.domain.Member; public record MemberListGetResponse( Long id, From ed8b8f8d196bf495ca728eecffe1424cd7fdc876 Mon Sep 17 00:00:00 2001 From: dragontaek-lee Date: Fri, 9 Feb 2024 14:37:05 +0900 Subject: [PATCH 092/141] =?UTF-8?q?[FIX]=20app=20attendance=20=EB=B6=88?= =?UTF-8?q?=ED=95=84=EC=9A=94=ED=95=9C=20dto=20=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/response/AttendancesResponse.java | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 operation-api/src/main/java/org/sopt/makers/operation/app/attendance/dto/response/AttendancesResponse.java diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/dto/response/AttendancesResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/dto/response/AttendancesResponse.java deleted file mode 100644 index 174a6b55..00000000 --- a/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/dto/response/AttendancesResponse.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.sopt.makers.operation.app.attendance.dto.response; - -import java.util.List; - -import org.operation.attendance.domain.Attendance; -import org.sopt.makers.operation.web.attendance.dto.response.MemberResponse; - -public record AttendancesResponse( - List attendances, - int totalCount -) { - public static AttendancesResponse of(List attendances, int totalCount) { - return new AttendancesResponse( - attendances.stream().map(MemberResponse::of).toList(), - totalCount); - } -} From 0f6e879270495af1fb8e02a783fa240faa046956 Mon Sep 17 00:00:00 2001 From: thguss Date: Sat, 10 Feb 2024 19:09:49 +0900 Subject: [PATCH 093/141] =?UTF-8?q?[CHORE]=20=ED=8C=A8=ED=82=A4=EC=A7=80?= =?UTF-8?q?=20=EC=9D=B4=EB=8F=99=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lecture/service/LectureServiceImpl.java | 35 +++++------ .../operation/common/dto/BaseResponse.java | 2 - .../org/sopt/makers/operation/AuthRoot.java | 4 ++ .../alarm/repository/AlarmRepositoryImpl.java | 2 +- .../attendance/AttendanceRepositoryImpl.java | 10 ++-- .../lecture/LectureRepositoryImpl.java | 6 +- .../repository/MemberCustomRepository.java | 6 -- .../repository/MemberRepositoryImpl.java | 58 +------------------ .../repository/ScheduleRepositoryImpl.java | 2 +- 9 files changed, 33 insertions(+), 92 deletions(-) create mode 100644 operation-auth/src/main/java/org/sopt/makers/operation/AuthRoot.java diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/service/LectureServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/service/LectureServiceImpl.java index a0d32fd6..f80675e9 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/service/LectureServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/service/LectureServiceImpl.java @@ -6,24 +6,25 @@ import java.util.Collections; import java.util.List; -import static org.sopt.makers.operation.domain.attendance.domain.AttendanceStatus.*; -import static org.sopt.makers.operation.domain.lecture.LectureStatus.*; +import static org.sopt.makers.operation.attendance.domain.AttendanceStatus.*; import static org.sopt.makers.operation.code.failure.lecture.LectureFailureCode.*; import static org.sopt.makers.operation.code.failure.subLecture.subLectureFailureCode.*; +import static org.sopt.makers.operation.lecture.domain.Attribute.*; +import static org.sopt.makers.operation.lecture.domain.LectureStatus.*; import org.sopt.makers.operation.app.lecture.dto.response.LectureCurrentRoundResponse; import org.sopt.makers.operation.app.lecture.dto.response.LectureResponseType; import org.sopt.makers.operation.app.lecture.dto.response.TodayLectureResponse; +import org.sopt.makers.operation.attendance.domain.Attendance; +import org.sopt.makers.operation.attendance.domain.SubAttendance; +import org.sopt.makers.operation.attendance.repository.attendance.AttendanceRepository; import org.sopt.makers.operation.config.ValueConfig; -import org.sopt.makers.operation.domain.attendance.domain.SubAttendance; -import org.sopt.makers.operation.domain.attendance.repository.attendance.AttendanceRepository; -import org.sopt.makers.operation.domain.lecture.Attribute; -import org.sopt.makers.operation.domain.lecture.Lecture; -import org.sopt.makers.operation.domain.lecture.SubLecture; -import org.sopt.makers.operation.domain.attendance.domain.Attendance; -import org.sopt.makers.operation.domain.lecture.repository.lecture.LectureRepository; import org.sopt.makers.operation.exception.LectureException; import org.sopt.makers.operation.exception.SubLectureException; +import org.sopt.makers.operation.lecture.domain.Attribute; +import org.sopt.makers.operation.lecture.domain.Lecture; +import org.sopt.makers.operation.lecture.domain.SubLecture; +import org.sopt.makers.operation.lecture.repository.lecture.LectureRepository; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -77,7 +78,7 @@ private TodayLectureResponse getEmptyResponse() { private void checkAttendancesSize(List attendances) { if (attendances.size() > valueConfig.getSUB_LECTURE_MAX_ROUND()) { - throw new LectureException(INVALID_COUNT_SESSION.getMessage()); + throw new LectureException(INVALID_COUNT_SESSION); } } @@ -92,7 +93,7 @@ private int getAttendanceIndex() { private LectureResponseType getResponseType(Lecture lecture) { val attribute = lecture.getAttribute(); - return attribute.equals(Attribute.ETC) ? LectureResponseType.NO_ATTENDANCE : LectureResponseType.HAS_ATTENDANCE; + return attribute.equals(ETC) ? LectureResponseType.NO_ATTENDANCE : LectureResponseType.HAS_ATTENDANCE; } private String getMessage(Attribute attribute) { @@ -126,7 +127,7 @@ public LectureCurrentRoundResponse getCurrentLectureRound(long lectureId) { private Lecture findLecture(Long id) { return lectureRepository.findById(id) - .orElseThrow(() -> new LectureException(INVALID_LECTURE.getMessage())); + .orElseThrow(() -> new LectureException(INVALID_LECTURE)); } private SubLecture getSubLecture(Lecture lecture) { @@ -139,7 +140,7 @@ private SubLecture getSubLecture(Lecture lecture, int round) { return lecture.getSubLectures().stream() .filter(l -> l.getRound() == round) .findFirst() - .orElseThrow(() -> new SubLectureException(NO_SUB_LECTURE_EQUAL_ROUND.getMessage())); + .orElseThrow(() -> new SubLectureException(NO_SUB_LECTURE_EQUAL_ROUND)); } private void checkLectureExist(Lecture lecture) { @@ -148,19 +149,19 @@ private void checkLectureExist(Lecture lecture) { val endOfDay = LocalDateTime.of(today, LocalTime.MAX); val startAt = lecture.getStartDate(); if (startAt.isBefore(startOfDay) || startAt.isAfter(endOfDay)) { - throw new LectureException(NO_SESSION.getMessage()); + throw new LectureException(NO_SESSION); } } private void checkLectureBefore(Lecture lecture) { if (lecture.isBefore()) { - throw new LectureException(NOT_STARTED_ATTENDANCE.getMessage()); + throw new LectureException(NOT_STARTED_ATTENDANCE); } } private void checkEndAttendance(SubLecture subLecture) { if (isEndAttendance(subLecture)) { - throw new LectureException(subLecture.getRound() + ENDED_ATTENDANCE.getMessage()); + throw new LectureException(ENDED_ATTENDANCE, subLecture.getRound()); } } @@ -174,7 +175,7 @@ private boolean isEndAttendance(SubLecture subLecture) { private void checkLectureEnd(Lecture lecture) { if (lecture.isEnd()) { - throw new LectureException(END_LECTURE.getMessage()); + throw new LectureException(END_LECTURE); } } } diff --git a/operation-api/src/main/java/org/sopt/makers/operation/common/dto/BaseResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/common/dto/BaseResponse.java index 4fc57453..cbc20d60 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/common/dto/BaseResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/common/dto/BaseResponse.java @@ -3,11 +3,9 @@ import com.fasterxml.jackson.annotation.JsonInclude; import lombok.AccessLevel; -import lombok.AllArgsConstructor; import lombok.Builder; @Builder(access = AccessLevel.PRIVATE) -@AllArgsConstructor(access = AccessLevel.PRIVATE) public record BaseResponse ( boolean success, String message, diff --git a/operation-auth/src/main/java/org/sopt/makers/operation/AuthRoot.java b/operation-auth/src/main/java/org/sopt/makers/operation/AuthRoot.java new file mode 100644 index 00000000..5046a789 --- /dev/null +++ b/operation-auth/src/main/java/org/sopt/makers/operation/AuthRoot.java @@ -0,0 +1,4 @@ +package org.sopt.makers.operation; + +public interface AuthRoot { +} diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/alarm/repository/AlarmRepositoryImpl.java b/operation-domain/src/main/java/org/sopt/makers/operation/alarm/repository/AlarmRepositoryImpl.java index f8f4f0a2..7924b6f1 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/alarm/repository/AlarmRepositoryImpl.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/alarm/repository/AlarmRepositoryImpl.java @@ -1,7 +1,7 @@ package org.sopt.makers.operation.alarm.repository; import static java.util.Objects.*; -import static org.sopt.makers.operation.domain.alarm.domain.QAlarm.*; +import static org.sopt.makers.operation.alarm.domain.QAlarm.*; import java.util.List; diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/attendance/repository/attendance/AttendanceRepositoryImpl.java b/operation-domain/src/main/java/org/sopt/makers/operation/attendance/repository/attendance/AttendanceRepositoryImpl.java index 6dda2da6..9020a32e 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/attendance/repository/attendance/AttendanceRepositoryImpl.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/attendance/repository/attendance/AttendanceRepositoryImpl.java @@ -2,12 +2,12 @@ import static com.querydsl.core.types.dsl.Expressions.*; import static java.util.Objects.*; +import static org.sopt.makers.operation.attendance.domain.QAttendance.*; +import static org.sopt.makers.operation.attendance.domain.QSubAttendance.*; import static org.sopt.makers.operation.common.domain.Part.*; -import static org.sopt.makers.operation.domain.attendance.domain.QAttendance.*; -import static org.sopt.makers.operation.domain.attendance.domain.QSubAttendance.*; -import static org.sopt.makers.operation.domain.lecture.QLecture.*; -import static org.sopt.makers.operation.domain.lecture.QSubLecture.*; -import static org.sopt.makers.operation.domain.member.domain.QMember.*; +import static org.sopt.makers.operation.lecture.domain.QLecture.*; +import static org.sopt.makers.operation.lecture.domain.QSubLecture.*; +import static org.sopt.makers.operation.member.domain.QMember.*; import java.time.LocalDate; import java.time.LocalDateTime; diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/lecture/repository/lecture/LectureRepositoryImpl.java b/operation-domain/src/main/java/org/sopt/makers/operation/lecture/repository/lecture/LectureRepositoryImpl.java index 28ff304d..33f09eb1 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/lecture/repository/lecture/LectureRepositoryImpl.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/lecture/repository/lecture/LectureRepositoryImpl.java @@ -1,9 +1,9 @@ package org.sopt.makers.operation.lecture.repository.lecture; import static java.util.Objects.*; -import static org.sopt.makers.operation.domain.attendance.domain.QAttendance.*; -import static org.sopt.makers.operation.domain.lecture.QLecture.*; -import static org.sopt.makers.operation.domain.member.domain.QMember.*; +import static org.sopt.makers.operation.attendance.domain.QAttendance.*; +import static org.sopt.makers.operation.lecture.domain.QLecture.*; +import static org.sopt.makers.operation.member.domain.QMember.*; import java.time.LocalDateTime; import java.util.List; diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/member/repository/MemberCustomRepository.java b/operation-domain/src/main/java/org/sopt/makers/operation/member/repository/MemberCustomRepository.java index 9df04192..93493bbe 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/member/repository/MemberCustomRepository.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/member/repository/MemberCustomRepository.java @@ -1,19 +1,13 @@ package org.sopt.makers.operation.member.repository; import java.util.List; -import java.util.Optional; import org.sopt.makers.operation.common.domain.Part; import org.sopt.makers.operation.member.domain.Member; -import org.sopt.makers.operation.common.dto.MemberSearchCondition; import org.springframework.data.domain.Pageable; public interface MemberCustomRepository { - List search(MemberSearchCondition condition, Pageable pageable); - List search(MemberSearchCondition condition); - Optional find(Long memberId); int count(int generation, Part part); - List findOrderByName(int generation, Part part); List find(int generation, Part part); List find(int generation, Part part, Pageable pageable); } diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/member/repository/MemberRepositoryImpl.java b/operation-domain/src/main/java/org/sopt/makers/operation/member/repository/MemberRepositoryImpl.java index 35e4914e..4f4a17f8 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/member/repository/MemberRepositoryImpl.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/member/repository/MemberRepositoryImpl.java @@ -2,16 +2,12 @@ import static java.util.Objects.*; import static org.sopt.makers.operation.common.domain.Part.*; -import static org.sopt.makers.operation.domain.attendance.domain.QAttendance.*; -import static org.sopt.makers.operation.domain.lecture.QLecture.*; -import static org.sopt.makers.operation.domain.member.domain.QMember.*; +import static org.sopt.makers.operation.member.domain.QMember.*; import java.util.List; -import java.util.Optional; import org.sopt.makers.operation.common.domain.Part; import org.sopt.makers.operation.member.domain.Member; -import org.sopt.makers.operation.common.dto.MemberSearchCondition; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Repository; @@ -28,46 +24,6 @@ public class MemberRepositoryImpl implements MemberCustomRepository { private final JPAQueryFactory queryFactory; - @Override - public List search(MemberSearchCondition condition, Pageable pageable) { - StringExpression firstName = Expressions.stringTemplate("SUBSTR({0}, 1, 1)", member.name); - - return queryFactory - .selectFrom(member) - .where( - partEq(condition.part()), - member.generation.eq(condition.generation()) - ) - .offset(pageable.getOffset()) - .limit(pageable.getPageSize()) - .orderBy(firstName.asc()) - .fetch(); - } - - @Override - public List search(MemberSearchCondition condition) { - StringExpression firstName = Expressions.stringTemplate("SUBSTR({0}, 1, 1)", member.name); - - return queryFactory - .selectFrom(member) - .where( - partEq(condition.part()), - member.generation.eq(condition.generation()) - ) - .orderBy(firstName.asc()) - .fetch(); - } - - @Override - public Optional find(Long memberId) { - return queryFactory - .selectFrom(member) - .join(member.attendances, attendance).fetchJoin().distinct() - .join(attendance.lecture, lecture).fetchJoin() - .where(member.id.eq(memberId)) - .stream().findFirst(); - } - @Override public int count(int generation, Part part) { return Math.toIntExact(queryFactory @@ -80,18 +36,6 @@ public int count(int generation, Part part) { .fetchFirst()); } - @Override - public List findOrderByName(int generation, Part part) { - StringExpression firstName = Expressions.stringTemplate("SUBSTR({0}, 1, 1)", member.name); - return queryFactory - .selectFrom(member) - .where( - member.generation.eq(generation), - partEq(part)) - .orderBy(firstName.asc()) - .fetch(); - } - @Override public List find(int generation, Part part) { return queryFactory diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/schedule/repository/ScheduleRepositoryImpl.java b/operation-domain/src/main/java/org/sopt/makers/operation/schedule/repository/ScheduleRepositoryImpl.java index d703da9e..b557fdcd 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/schedule/repository/ScheduleRepositoryImpl.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/schedule/repository/ScheduleRepositoryImpl.java @@ -1,6 +1,6 @@ package org.sopt.makers.operation.schedule.repository; -import static org.sopt.makers.operation.domain.schedule.domain.QSchedule.*; +import static org.sopt.makers.operation.schedule.domain.QSchedule.*; import java.time.LocalDateTime; import java.util.List; From 28835d61d937513a34bb61e62caf8856aa5d7a0f Mon Sep 17 00:00:00 2001 From: thguss Date: Sat, 10 Feb 2024 19:13:15 +0900 Subject: [PATCH 094/141] =?UTF-8?q?[CHORE]=20bootjar=20false=20=EC=84=B8?= =?UTF-8?q?=ED=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- operation-auth/build.gradle | 4 ++-- .../src/main/java/org/sopt/makers/operation/AuthRoot.java | 4 ---- 2 files changed, 2 insertions(+), 6 deletions(-) delete mode 100644 operation-auth/src/main/java/org/sopt/makers/operation/AuthRoot.java diff --git a/operation-auth/build.gradle b/operation-auth/build.gradle index ce6b9e29..414b2b62 100644 --- a/operation-auth/build.gradle +++ b/operation-auth/build.gradle @@ -1,9 +1,9 @@ tasks.named('bootJar') { - enabled = true + enabled = false } tasks.named('jar') { - enabled = false + enabled = true } dependencies { diff --git a/operation-auth/src/main/java/org/sopt/makers/operation/AuthRoot.java b/operation-auth/src/main/java/org/sopt/makers/operation/AuthRoot.java deleted file mode 100644 index 5046a789..00000000 --- a/operation-auth/src/main/java/org/sopt/makers/operation/AuthRoot.java +++ /dev/null @@ -1,4 +0,0 @@ -package org.sopt.makers.operation; - -public interface AuthRoot { -} From 8e3223d8938ad646ac5be496289816fc3d89de6e Mon Sep 17 00:00:00 2001 From: thguss Date: Sat, 10 Feb 2024 20:40:18 +0900 Subject: [PATCH 095/141] =?UTF-8?q?[CHORE]=202=EC=B0=A8=20=EB=A6=AC?= =?UTF-8?q?=ED=8C=A9=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 42 +++++---- operation-api/build.gradle | 17 ++-- .../operation/OperationApplication.java | 4 +- ...tendanceApi.java => AppAttendanceApi.java} | 4 +- ...r.java => AppAttendanceApiController.java} | 10 +-- ...Service.java => AppAttendanceService.java} | 2 +- ...mpl.java => AppAttendanceServiceImpl.java} | 2 +- .../{LectureApi.java => AppLectureApi.java} | 4 +- ...ller.java => AppLectureApiController.java} | 10 +-- .../app/lecture/message/SuccessMessage.java | 14 --- ...ureService.java => AppLectureService.java} | 2 +- ...ceImpl.java => AppLectureServiceImpl.java} | 2 +- .../api/{MemberApi.java => AppMemberApi.java} | 4 +- ...oller.java => AppMemberApiController.java} | 10 +-- .../app/member/message/SuccessMessage.java | 14 --- ...mberService.java => AppMemberService.java} | 2 +- ...iceImpl.java => AppMemberServiceImpl.java} | 2 +- .../app/schedule/api/ScheduleApi.java | 2 +- .../schedule/api/ScheduleApiController.java | 4 +- .../common/config/SwaggerConfig.java | 86 ++++++++++++++----- .../common/config/TimezoneConfig.java | 4 +- .../common/handler/ErrorHandler.java | 4 +- .../operation/scheduler/LectureScheduler.java | 4 +- .../operation/test/HealthCheckController.java | 13 +++ .../operation/web/admin/api/AdminApi.java | 2 +- .../web/admin/api/AdminApiController.java | 4 +- .../web/admin/message/SuccessMessage.java | 15 ---- .../operation/web/alarm/api/AlarmApi.java | 2 +- .../web/alarm/api/AlarmApiController.java | 4 +- ...tendanceApi.java => WebAttendanceApi.java} | 4 +- ...r.java => WebAttendanceApiController.java} | 10 +-- ...Service.java => WebAttendanceService.java} | 2 +- ...mpl.java => WebAttendanceServiceImpl.java} | 2 +- .../{LectureApi.java => WebLectureApi.java} | 4 +- ...ller.java => WebLectureApiController.java} | 10 +-- ...ureService.java => WebLectureService.java} | 2 +- ...ceImpl.java => WebLectureServiceImpl.java} | 2 +- .../api/{MemberApi.java => WebMemberApi.java} | 4 +- ...oller.java => WebMemberApiController.java} | 10 +-- ...mberService.java => WebMemberService.java} | 2 +- ...iceImpl.java => WebMemberServiceImpl.java} | 2 +- operation-auth/build.gradle | 17 ++-- .../org/sopt/makers/operation/AuthRoot.java | 4 + .../operation/config/SecurityConfig.java | 21 +++-- .../filter/JwtAuthenticationFilter.java | 10 ++- .../operation/filter/JwtExceptionFilter.java | 41 +++++---- .../operation/jwt/JwtTokenProvider.java | 5 +- operation-common/build.gradle | 15 +--- .../org/sopt/makers/operation/CommonRoot.java | 4 + .../makers/operation}/dto/BaseResponse.java | 2 +- .../operation}/util/ApiResponseUtil.java | 4 +- operation-domain/build.gradle | 60 ++++--------- .../org/sopt/makers/operation/DomainRoot.java | 4 + .../makers/operation/admin/domain/Admin.java | 13 +-- .../makers/operation/alarm/domain/Alarm.java | 25 +++--- .../attendance/domain/Attendance.java | 26 +++--- .../attendance/domain/SubAttendance.java | 24 +++--- .../common/config/JpaQueryFactoryConfig.java | 4 +- .../operation/common/domain/BaseEntity.java | 5 +- .../operation/lecture/domain/Lecture.java | 20 ++--- .../operation/lecture/domain/SubLecture.java | 22 ++--- .../operation/member/domain/Member.java | 20 ++--- .../converter/StringListConverter.java | 4 +- .../operation/schedule/domain/Schedule.java | 20 ++--- operation-external/build.gradle | 11 +-- .../sopt/makers/operation/ExternalRoot.java | 4 + 66 files changed, 371 insertions(+), 357 deletions(-) rename operation-api/src/main/java/org/sopt/makers/operation/app/attendance/api/{AttendanceApi.java => AppAttendanceApi.java} (92%) rename operation-api/src/main/java/org/sopt/makers/operation/app/attendance/api/{AttendanceApiController.java => AppAttendanceApiController.java} (78%) rename operation-api/src/main/java/org/sopt/makers/operation/app/attendance/service/{AttendanceService.java => AppAttendanceService.java} (87%) rename operation-api/src/main/java/org/sopt/makers/operation/app/attendance/service/{AttendanceServiceImpl.java => AppAttendanceServiceImpl.java} (98%) rename operation-api/src/main/java/org/sopt/makers/operation/app/lecture/api/{LectureApi.java => AppLectureApi.java} (94%) rename operation-api/src/main/java/org/sopt/makers/operation/app/lecture/api/{LectureApiController.java => AppLectureApiController.java} (77%) delete mode 100644 operation-api/src/main/java/org/sopt/makers/operation/app/lecture/message/SuccessMessage.java rename operation-api/src/main/java/org/sopt/makers/operation/app/lecture/service/{LectureService.java => AppLectureService.java} (90%) rename operation-api/src/main/java/org/sopt/makers/operation/app/lecture/service/{LectureServiceImpl.java => AppLectureServiceImpl.java} (99%) rename operation-api/src/main/java/org/sopt/makers/operation/app/member/api/{MemberApi.java => AppMemberApi.java} (94%) rename operation-api/src/main/java/org/sopt/makers/operation/app/member/api/{MemberApiController.java => AppMemberApiController.java} (81%) delete mode 100644 operation-api/src/main/java/org/sopt/makers/operation/app/member/message/SuccessMessage.java rename operation-api/src/main/java/org/sopt/makers/operation/app/member/service/{MemberService.java => AppMemberService.java} (90%) rename operation-api/src/main/java/org/sopt/makers/operation/app/member/service/{MemberServiceImpl.java => AppMemberServiceImpl.java} (97%) create mode 100644 operation-api/src/main/java/org/sopt/makers/operation/test/HealthCheckController.java delete mode 100644 operation-api/src/main/java/org/sopt/makers/operation/web/admin/message/SuccessMessage.java rename operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/api/{AttendanceApi.java => WebAttendanceApi.java} (96%) rename operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/api/{AttendanceApiController.java => WebAttendanceApiController.java} (87%) rename operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/service/{AttendanceService.java => WebAttendanceService.java} (95%) rename operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/service/{AttendanceServiceImpl.java => WebAttendanceServiceImpl.java} (97%) rename operation-api/src/main/java/org/sopt/makers/operation/web/lecture/api/{LectureApi.java => WebLectureApi.java} (97%) rename operation-api/src/main/java/org/sopt/makers/operation/web/lecture/api/{LectureApiController.java => WebLectureApiController.java} (90%) rename operation-api/src/main/java/org/sopt/makers/operation/web/lecture/service/{LectureService.java => WebLectureService.java} (96%) rename operation-api/src/main/java/org/sopt/makers/operation/web/lecture/service/{LectureServiceImpl.java => WebLectureServiceImpl.java} (99%) rename operation-api/src/main/java/org/sopt/makers/operation/web/member/api/{MemberApi.java => WebMemberApi.java} (91%) rename operation-api/src/main/java/org/sopt/makers/operation/web/member/api/{MemberApiController.java => WebMemberApiController.java} (78%) rename operation-api/src/main/java/org/sopt/makers/operation/web/member/service/{MemberService.java => WebMemberService.java} (89%) rename operation-api/src/main/java/org/sopt/makers/operation/web/member/service/{MemberServiceImpl.java => WebMemberServiceImpl.java} (93%) create mode 100644 operation-auth/src/main/java/org/sopt/makers/operation/AuthRoot.java create mode 100644 operation-common/src/main/java/org/sopt/makers/operation/CommonRoot.java rename {operation-api/src/main/java/org/sopt/makers/operation/common => operation-common/src/main/java/org/sopt/makers/operation}/dto/BaseResponse.java (93%) rename {operation-api/src/main/java/org/sopt/makers/operation/common => operation-common/src/main/java/org/sopt/makers/operation}/util/ApiResponseUtil.java (90%) create mode 100644 operation-domain/src/main/java/org/sopt/makers/operation/DomainRoot.java create mode 100644 operation-external/src/main/java/org/sopt/makers/operation/ExternalRoot.java diff --git a/build.gradle b/build.gradle index e7a3630d..d5421610 100644 --- a/build.gradle +++ b/build.gradle @@ -1,49 +1,47 @@ +buildscript { + repositories { + mavenCentral() + } +} + plugins { id 'java' - id 'org.springframework.boot' version '2.7.4' + id 'org.springframework.boot' version '3.0.0' id 'io.spring.dependency-management' version '1.1.0' } allprojects { - group = 'org.sopt.makers' + apply plugin: 'java' + apply plugin: 'org.springframework.boot' + apply plugin: 'io.spring.dependency-management' + + group = 'org.sopt.makers.operation' version = '0.0.1-SNAPSHOT' sourceCompatibility = '17' repositories { mavenCentral() } -} -configurations { - compileOnly { - extendsFrom annotationProcessor + configurations { + compileOnly { + extendsFrom annotationProcessor + } } -} - -subprojects { - apply plugin: 'java' - apply plugin: 'org.springframework.boot' - apply plugin: 'io.spring.dependency-management' dependencies { // lombok compileOnly 'org.projectlombok:lombok' annotationProcessor 'org.projectlombok:lombok' + testAnnotationProcessor 'org.projectlombok:lombok' + testCompileOnly 'org.projectlombok:lombok' // test testImplementation 'org.springframework.boot:spring-boot-starter-test' - } - - tasks.named('bootJar') { - enabled = false - } - - tasks.named('jar') { - enabled = true + testImplementation 'org.springframework.security:spring-security-test' } tasks.named('test') { useJUnitPlatform() } -} - +} \ No newline at end of file diff --git a/operation-api/build.gradle b/operation-api/build.gradle index c77b8cdf..da393882 100644 --- a/operation-api/build.gradle +++ b/operation-api/build.gradle @@ -1,19 +1,24 @@ -tasks.named('bootJar') { - enabled = true +jar { + enabled = false } -tasks.named('jar') { - enabled = false +bootJar { + enabled = true } dependencies { + // module implementation project(path: ':operation-auth') implementation project(path: ':operation-common') implementation project(path: ':operation-domain') implementation project(path: ':operation-external') implementation 'org.springframework.boot:spring-boot-starter-web' - implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.0.2' implementation 'org.springframework.boot:spring-boot-starter-security' implementation 'org.springframework.boot:spring-boot-starter-data-jpa' -} + + // swagger + implementation 'io.springfox:springfox-boot-starter:3.0.0' + implementation 'io.springfox:springfox-swagger-ui:3.0.0' + +} \ No newline at end of file diff --git a/operation-api/src/main/java/org/sopt/makers/operation/OperationApplication.java b/operation-api/src/main/java/org/sopt/makers/operation/OperationApplication.java index 75a483aa..ee82620f 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/OperationApplication.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/OperationApplication.java @@ -3,7 +3,9 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -@SpringBootApplication +@SpringBootApplication( + scanBasePackageClasses = {AuthRoot.class, CommonRoot.class, DomainRoot.class, ExternalRoot.class} +) public class OperationApplication { public static void main(String[] args) { diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/api/AttendanceApi.java b/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/api/AppAttendanceApi.java similarity index 92% rename from operation-api/src/main/java/org/sopt/makers/operation/app/attendance/api/AttendanceApi.java rename to operation-api/src/main/java/org/sopt/makers/operation/app/attendance/api/AppAttendanceApi.java index 15fd02de..28ba0ef9 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/api/AttendanceApi.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/api/AppAttendanceApi.java @@ -3,7 +3,7 @@ import java.security.Principal; import org.sopt.makers.operation.app.attendance.dto.request.AttendanceRequest; -import org.sopt.makers.operation.common.dto.BaseResponse; +import org.sopt.makers.operation.dto.BaseResponse; import org.springframework.http.ResponseEntity; import io.swagger.v3.oas.annotations.Parameter; @@ -15,7 +15,7 @@ import lombok.NonNull; @Tag(name = "앱 출석 관련 API") -public interface AttendanceApi { +public interface AppAttendanceApi { @Operation( security = @SecurityRequirement(name = "Authorization"), diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/api/AttendanceApiController.java b/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/api/AppAttendanceApiController.java similarity index 78% rename from operation-api/src/main/java/org/sopt/makers/operation/app/attendance/api/AttendanceApiController.java rename to operation-api/src/main/java/org/sopt/makers/operation/app/attendance/api/AppAttendanceApiController.java index 8b9b0da0..627fd9de 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/api/AttendanceApiController.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/api/AppAttendanceApiController.java @@ -5,10 +5,10 @@ import java.security.Principal; import org.sopt.makers.operation.app.attendance.dto.request.AttendanceRequest; -import org.sopt.makers.operation.app.attendance.service.AttendanceService; +import org.sopt.makers.operation.app.attendance.service.AppAttendanceService; import org.sopt.makers.operation.common.util.CommonUtils; -import org.sopt.makers.operation.common.util.ApiResponseUtil; -import org.sopt.makers.operation.common.dto.BaseResponse; +import org.sopt.makers.operation.util.ApiResponseUtil; +import org.sopt.makers.operation.dto.BaseResponse; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -22,9 +22,9 @@ @RestController @RequiredArgsConstructor @RequestMapping("/api/v1/app/attendances") -public class AttendanceApiController implements AttendanceApi { +public class AppAttendanceApiController implements AppAttendanceApi { - private final AttendanceService attendanceService; + private final AppAttendanceService attendanceService; private final CommonUtils utils; @Override diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/service/AttendanceService.java b/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/service/AppAttendanceService.java similarity index 87% rename from operation-api/src/main/java/org/sopt/makers/operation/app/attendance/service/AttendanceService.java rename to operation-api/src/main/java/org/sopt/makers/operation/app/attendance/service/AppAttendanceService.java index 290e9cab..5c14a275 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/service/AttendanceService.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/service/AppAttendanceService.java @@ -3,6 +3,6 @@ import org.sopt.makers.operation.app.attendance.dto.request.AttendanceRequest; import org.sopt.makers.operation.app.attendance.dto.response.AttendanceResponse; -public interface AttendanceService { +public interface AppAttendanceService { AttendanceResponse attend(long memberId, AttendanceRequest request); } diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/service/AttendanceServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/service/AppAttendanceServiceImpl.java similarity index 98% rename from operation-api/src/main/java/org/sopt/makers/operation/app/attendance/service/AttendanceServiceImpl.java rename to operation-api/src/main/java/org/sopt/makers/operation/app/attendance/service/AppAttendanceServiceImpl.java index b2f2c35a..7978e904 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/service/AttendanceServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/service/AppAttendanceServiceImpl.java @@ -30,7 +30,7 @@ @Service @RequiredArgsConstructor @Transactional(readOnly = true) -public class AttendanceServiceImpl implements AttendanceService { +public class AppAttendanceServiceImpl implements AppAttendanceService { private final AttendanceRepository attendanceRepository; private final MemberRepository memberRepository; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/api/LectureApi.java b/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/api/AppLectureApi.java similarity index 94% rename from operation-api/src/main/java/org/sopt/makers/operation/app/lecture/api/LectureApi.java rename to operation-api/src/main/java/org/sopt/makers/operation/app/lecture/api/AppLectureApi.java index 410582de..095c0a6f 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/api/LectureApi.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/api/AppLectureApi.java @@ -2,7 +2,7 @@ import java.security.Principal; -import org.sopt.makers.operation.common.dto.BaseResponse; +import org.sopt.makers.operation.dto.BaseResponse; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PathVariable; @@ -14,7 +14,7 @@ import lombok.NonNull; @Tag(name = "앱 세션 관련 API") -public interface LectureApi { +public interface AppLectureApi { @Operation( security = @SecurityRequirement(name = "Authorization"), diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/api/LectureApiController.java b/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/api/AppLectureApiController.java similarity index 77% rename from operation-api/src/main/java/org/sopt/makers/operation/app/lecture/api/LectureApiController.java rename to operation-api/src/main/java/org/sopt/makers/operation/app/lecture/api/AppLectureApiController.java index 58606485..4db6f636 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/api/LectureApiController.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/api/AppLectureApiController.java @@ -4,9 +4,9 @@ import java.security.Principal; -import org.sopt.makers.operation.app.lecture.service.LectureService; -import org.sopt.makers.operation.common.dto.BaseResponse; -import org.sopt.makers.operation.common.util.ApiResponseUtil; +import org.sopt.makers.operation.app.lecture.service.AppLectureService; +import org.sopt.makers.operation.dto.BaseResponse; +import org.sopt.makers.operation.util.ApiResponseUtil; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; @@ -17,9 +17,9 @@ @RestController @RequiredArgsConstructor @RequestMapping("/api/v1/app/lectures") -public class LectureApiController implements LectureApi { +public class AppLectureApiController implements AppLectureApi { - private final LectureService lectureService; + private final AppLectureService lectureService; @Override @GetMapping diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/message/SuccessMessage.java b/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/message/SuccessMessage.java deleted file mode 100644 index 79bfeda1..00000000 --- a/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/message/SuccessMessage.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.sopt.makers.operation.app.lecture.message; - -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -@Getter -@RequiredArgsConstructor -public enum SuccessMessage { - SUCCESS_SINGLE_GET_LECTURE("세션 조회 성공"), - SUCCESS_GET_LECTURE_ROUND("출석 차수 조회 성공"), - ; - - private final String content; -} diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/service/LectureService.java b/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/service/AppLectureService.java similarity index 90% rename from operation-api/src/main/java/org/sopt/makers/operation/app/lecture/service/LectureService.java rename to operation-api/src/main/java/org/sopt/makers/operation/app/lecture/service/AppLectureService.java index 39cb498d..4a7f113e 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/service/LectureService.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/service/AppLectureService.java @@ -3,7 +3,7 @@ import org.sopt.makers.operation.app.lecture.dto.response.LectureCurrentRoundResponse; import org.sopt.makers.operation.app.lecture.dto.response.TodayLectureResponse; -public interface LectureService { +public interface AppLectureService { TodayLectureResponse getTodayLecture(long memberPlaygroundId); LectureCurrentRoundResponse getCurrentLectureRound(long lectureId); diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/service/LectureServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/service/AppLectureServiceImpl.java similarity index 99% rename from operation-api/src/main/java/org/sopt/makers/operation/app/lecture/service/LectureServiceImpl.java rename to operation-api/src/main/java/org/sopt/makers/operation/app/lecture/service/AppLectureServiceImpl.java index f80675e9..df0fd4d5 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/service/LectureServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/service/AppLectureServiceImpl.java @@ -34,7 +34,7 @@ @Service @RequiredArgsConstructor @Transactional(readOnly = true) -public class LectureServiceImpl implements LectureService { +public class AppLectureServiceImpl implements AppLectureService { private final LectureRepository lectureRepository; private final AttendanceRepository attendanceRepository; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/member/api/MemberApi.java b/operation-api/src/main/java/org/sopt/makers/operation/app/member/api/AppMemberApi.java similarity index 94% rename from operation-api/src/main/java/org/sopt/makers/operation/app/member/api/MemberApi.java rename to operation-api/src/main/java/org/sopt/makers/operation/app/member/api/AppMemberApi.java index ed3973f4..88771cb8 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/app/member/api/MemberApi.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/member/api/AppMemberApi.java @@ -2,7 +2,7 @@ import java.security.Principal; -import org.sopt.makers.operation.common.dto.BaseResponse; +import org.sopt.makers.operation.dto.BaseResponse; import org.springframework.http.ResponseEntity; import io.swagger.v3.oas.annotations.Operation; @@ -11,7 +11,7 @@ import io.swagger.v3.oas.annotations.security.SecurityRequirement; import lombok.NonNull; -public interface MemberApi { +public interface AppMemberApi { @Operation( security = @SecurityRequirement(name = "Authorization"), diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/member/api/MemberApiController.java b/operation-api/src/main/java/org/sopt/makers/operation/app/member/api/AppMemberApiController.java similarity index 81% rename from operation-api/src/main/java/org/sopt/makers/operation/app/member/api/MemberApiController.java rename to operation-api/src/main/java/org/sopt/makers/operation/app/member/api/AppMemberApiController.java index 21bbbd25..caad302b 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/app/member/api/MemberApiController.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/member/api/AppMemberApiController.java @@ -4,9 +4,9 @@ import java.security.Principal; -import org.sopt.makers.operation.app.member.service.MemberService; -import org.sopt.makers.operation.common.dto.BaseResponse; -import org.sopt.makers.operation.common.util.ApiResponseUtil; +import org.sopt.makers.operation.app.member.service.AppMemberService; +import org.sopt.makers.operation.dto.BaseResponse; +import org.sopt.makers.operation.util.ApiResponseUtil; import org.sopt.makers.operation.common.util.CommonUtils; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; @@ -20,9 +20,9 @@ @RestController @RequiredArgsConstructor @RequestMapping("/api/v1/app/members") -public class MemberApiController implements MemberApi { +public class AppMemberApiController implements AppMemberApi { - private final MemberService memberService; + private final AppMemberService memberService; private final CommonUtils utils; @Override diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/member/message/SuccessMessage.java b/operation-api/src/main/java/org/sopt/makers/operation/app/member/message/SuccessMessage.java deleted file mode 100644 index b9d0569c..00000000 --- a/operation-api/src/main/java/org/sopt/makers/operation/app/member/message/SuccessMessage.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.sopt.makers.operation.app.member.message; - -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -@Getter -@RequiredArgsConstructor -public enum SuccessMessage { - SUCCESS_TOTAL_ATTENDANCE("전체 출석 정보 조회 성공"), - SUCCESS_GET_ATTENDANCE_SCORE("출석 점수 조회 성공"), - ; - - private final String content; -} diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/member/service/MemberService.java b/operation-api/src/main/java/org/sopt/makers/operation/app/member/service/AppMemberService.java similarity index 90% rename from operation-api/src/main/java/org/sopt/makers/operation/app/member/service/MemberService.java rename to operation-api/src/main/java/org/sopt/makers/operation/app/member/service/AppMemberService.java index af2ede48..db0afb33 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/app/member/service/MemberService.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/member/service/AppMemberService.java @@ -3,7 +3,7 @@ import org.sopt.makers.operation.app.member.dto.response.AttendanceTotalResponseDTO; import org.sopt.makers.operation.app.member.dto.response.MemberScoreGetResponse; -public interface MemberService { +public interface AppMemberService { AttendanceTotalResponseDTO getMemberTotalAttendance(Long playGroundId); MemberScoreGetResponse getMemberScore(Long playGroundId); } diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/member/service/MemberServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/app/member/service/AppMemberServiceImpl.java similarity index 97% rename from operation-api/src/main/java/org/sopt/makers/operation/app/member/service/MemberServiceImpl.java rename to operation-api/src/main/java/org/sopt/makers/operation/app/member/service/AppMemberServiceImpl.java index cdbcb8ea..7cdab0e9 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/app/member/service/MemberServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/member/service/AppMemberServiceImpl.java @@ -23,7 +23,7 @@ @Service @RequiredArgsConstructor @Transactional(readOnly = true) -public class MemberServiceImpl implements MemberService { +public class AppMemberServiceImpl implements AppMemberService { private final MemberRepository memberRepository; private final AttendanceRepository attendanceRepository; private final ValueConfig valueConfig; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/schedule/api/ScheduleApi.java b/operation-api/src/main/java/org/sopt/makers/operation/app/schedule/api/ScheduleApi.java index 1a781363..9fcc6627 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/app/schedule/api/ScheduleApi.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/schedule/api/ScheduleApi.java @@ -2,7 +2,7 @@ import java.time.LocalDateTime; -import org.sopt.makers.operation.common.dto.BaseResponse; +import org.sopt.makers.operation.dto.BaseResponse; import org.springframework.format.annotation.DateTimeFormat; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.RequestParam; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/schedule/api/ScheduleApiController.java b/operation-api/src/main/java/org/sopt/makers/operation/app/schedule/api/ScheduleApiController.java index 8a148fd7..9d608cfd 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/app/schedule/api/ScheduleApiController.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/schedule/api/ScheduleApiController.java @@ -5,8 +5,8 @@ import java.time.LocalDateTime; import org.sopt.makers.operation.app.schedule.service.ScheduleService; -import org.sopt.makers.operation.common.dto.BaseResponse; -import org.sopt.makers.operation.common.util.ApiResponseUtil; +import org.sopt.makers.operation.dto.BaseResponse; +import org.sopt.makers.operation.util.ApiResponseUtil; import org.springframework.format.annotation.DateTimeFormat; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/common/config/SwaggerConfig.java b/operation-api/src/main/java/org/sopt/makers/operation/common/config/SwaggerConfig.java index 59fb7d46..9fbedf35 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/common/config/SwaggerConfig.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/common/config/SwaggerConfig.java @@ -1,31 +1,75 @@ package org.sopt.makers.operation.common.config; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.EnableWebMvc; + +import springfox.documentation.builders.ApiInfoBuilder; +import springfox.documentation.builders.PathSelectors; +import springfox.documentation.builders.RequestHandlerSelectors; +import springfox.documentation.service.ApiInfo; +import springfox.documentation.service.ApiKey; +import springfox.documentation.service.AuthorizationScope; +import springfox.documentation.service.SecurityReference; +import springfox.documentation.spi.DocumentationType; +import springfox.documentation.spi.service.contexts.SecurityContext; +import springfox.documentation.spring.web.plugins.Docket; +import springfox.documentation.swagger2.annotations.EnableSwagger2; -import io.swagger.v3.oas.annotations.enums.SecuritySchemeIn; -import io.swagger.v3.oas.annotations.enums.SecuritySchemeType; -import io.swagger.v3.oas.annotations.security.SecurityScheme; -import io.swagger.v3.oas.models.OpenAPI; -import io.swagger.v3.oas.models.info.Info; - -@SecurityScheme( - name = "Authorization", - type = SecuritySchemeType.HTTP, - in = SecuritySchemeIn.HEADER, - bearerFormat = "JWT", - scheme = "Bearer" -) @Configuration +@EnableSwagger2 +@EnableWebMvc public class SwaggerConfig { + private ApiInfo swaggerInfo() { + return new ApiInfoBuilder().title("Makers Operation API") + .description("Makers Operation API Docs").build(); + } + @Bean - public OpenAPI api() { - Info info = new Info() - .title("SOPT Makers API Docs") - .version("v1.0.0") - .description("SOPT Makers API 명세서"); - return new OpenAPI() - .info(info); + public Docket swaggerApi() { + return new Docket(DocumentationType.SWAGGER_2) + .securityContexts(List.of(securityContext())) + .securitySchemes(List.of(apiKey())) + .consumes(getConsumeContentTypes()) + .produces(getProduceContentTypes()) + .apiInfo(swaggerInfo()).select() + .apis(RequestHandlerSelectors.basePackage("org.sopt.makers.operation.controller")) + .paths(PathSelectors.any()) + .build() + .useDefaultResponseMessages(false); + } + + private Set getConsumeContentTypes() { + Set consumes = new HashSet<>(); + consumes.add("application/json"); + return consumes; + } + + private Set getProduceContentTypes() { + Set produces = new HashSet<>(); + produces.add("application/json"); + return produces; + } + + private SecurityContext securityContext() { + return SecurityContext.builder() + .securityReferences(defaultAuth()) + .build(); + } + + private List defaultAuth() { + AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything"); + AuthorizationScope[] authorizationScopes = new AuthorizationScope[1]; + authorizationScopes[0] = authorizationScope; + return List.of(new SecurityReference("Authorization", authorizationScopes)); + } + + private ApiKey apiKey() { + return new ApiKey("Authorization", "Authorization", "header"); } -} +} \ No newline at end of file diff --git a/operation-api/src/main/java/org/sopt/makers/operation/common/config/TimezoneConfig.java b/operation-api/src/main/java/org/sopt/makers/operation/common/config/TimezoneConfig.java index 4555d81b..bbf0503d 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/common/config/TimezoneConfig.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/common/config/TimezoneConfig.java @@ -2,10 +2,10 @@ import java.util.TimeZone; -import javax.annotation.PostConstruct; - import org.springframework.context.annotation.Configuration; +import jakarta.annotation.PostConstruct; + @Configuration public class TimezoneConfig { //TODO: 타임 체크 로컬에서 UTF로 바꿔서 체크 diff --git a/operation-api/src/main/java/org/sopt/makers/operation/common/handler/ErrorHandler.java b/operation-api/src/main/java/org/sopt/makers/operation/common/handler/ErrorHandler.java index d2b4c882..5a4093f2 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/common/handler/ErrorHandler.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/common/handler/ErrorHandler.java @@ -1,7 +1,7 @@ package org.sopt.makers.operation.common.handler; -import org.sopt.makers.operation.common.dto.BaseResponse; -import org.sopt.makers.operation.common.util.ApiResponseUtil; +import org.sopt.makers.operation.dto.BaseResponse; +import org.sopt.makers.operation.util.ApiResponseUtil; import org.sopt.makers.operation.exception.AdminFailureException; import org.sopt.makers.operation.exception.AlarmException; import org.sopt.makers.operation.exception.AttendanceException; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/scheduler/LectureScheduler.java b/operation-api/src/main/java/org/sopt/makers/operation/scheduler/LectureScheduler.java index 909be2ee..16a914eb 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/scheduler/LectureScheduler.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/scheduler/LectureScheduler.java @@ -1,6 +1,6 @@ package org.sopt.makers.operation.scheduler; -import org.sopt.makers.operation.web.lecture.service.LectureService; +import org.sopt.makers.operation.web.lecture.service.WebLectureService; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; @@ -12,7 +12,7 @@ @RequiredArgsConstructor public class LectureScheduler { - private final LectureService lectureService; + private final WebLectureService lectureService; @Scheduled(cron = "0 0 0 ? * SUN") public void endLecture() { diff --git a/operation-api/src/main/java/org/sopt/makers/operation/test/HealthCheckController.java b/operation-api/src/main/java/org/sopt/makers/operation/test/HealthCheckController.java new file mode 100644 index 00000000..77b16e71 --- /dev/null +++ b/operation-api/src/main/java/org/sopt/makers/operation/test/HealthCheckController.java @@ -0,0 +1,13 @@ +package org.sopt.makers.operation.test; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class HealthCheckController { + + @GetMapping("/") + public String healthCheck() { + return "Hello Operation!"; + } +} diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/admin/api/AdminApi.java b/operation-api/src/main/java/org/sopt/makers/operation/web/admin/api/AdminApi.java index d016e5bb..4b222fdc 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/admin/api/AdminApi.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/admin/api/AdminApi.java @@ -1,6 +1,6 @@ package org.sopt.makers.operation.web.admin.api; -import org.sopt.makers.operation.common.dto.BaseResponse; +import org.sopt.makers.operation.dto.BaseResponse; import org.sopt.makers.operation.web.admin.dto.request.LoginRequest; import org.sopt.makers.operation.web.admin.dto.request.SignUpRequest; import org.springframework.http.ResponseEntity; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/admin/api/AdminApiController.java b/operation-api/src/main/java/org/sopt/makers/operation/web/admin/api/AdminApiController.java index ecb13579..8273df83 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/admin/api/AdminApiController.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/admin/api/AdminApiController.java @@ -2,8 +2,8 @@ import static org.sopt.makers.operation.code.success.web.AdminSuccessCode.*; -import org.sopt.makers.operation.common.dto.BaseResponse; -import org.sopt.makers.operation.common.util.ApiResponseUtil; +import org.sopt.makers.operation.dto.BaseResponse; +import org.sopt.makers.operation.util.ApiResponseUtil; import org.sopt.makers.operation.common.util.Cookie; import org.sopt.makers.operation.web.admin.dto.request.LoginRequest; import org.sopt.makers.operation.web.admin.dto.request.SignUpRequest; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/admin/message/SuccessMessage.java b/operation-api/src/main/java/org/sopt/makers/operation/web/admin/message/SuccessMessage.java deleted file mode 100644 index 2aea3dc4..00000000 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/admin/message/SuccessMessage.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.sopt.makers.operation.web.admin.message; - -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -@Getter -@RequiredArgsConstructor -public enum SuccessMessage { - SUCCESS_SIGN_UP("회원 가입 성공"), - SUCCESS_LOGIN_UP("로그인 성공"), - SUCCESS_GET_REFRESH_TOKEN("토큰 재발급 성공"), - ; - - private final String content; -} diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/api/AlarmApi.java b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/api/AlarmApi.java index 38b60a58..7c6c7019 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/api/AlarmApi.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/api/AlarmApi.java @@ -1,7 +1,7 @@ package org.sopt.makers.operation.web.alarm.api; import org.sopt.makers.operation.common.domain.Part; -import org.sopt.makers.operation.common.dto.BaseResponse; +import org.sopt.makers.operation.dto.BaseResponse; import org.sopt.makers.operation.alarm.domain.Status; import org.sopt.makers.operation.web.alarm.dto.request.AlarmRequest; import org.sopt.makers.operation.web.alarm.dto.request.AlarmSendRequest; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/api/AlarmApiController.java b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/api/AlarmApiController.java index fdd48db9..b4a22223 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/api/AlarmApiController.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/api/AlarmApiController.java @@ -3,8 +3,8 @@ import static org.sopt.makers.operation.code.success.web.AlarmSuccessCode.*; import org.sopt.makers.operation.common.domain.Part; -import org.sopt.makers.operation.common.dto.BaseResponse; -import org.sopt.makers.operation.common.util.ApiResponseUtil; +import org.sopt.makers.operation.dto.BaseResponse; +import org.sopt.makers.operation.util.ApiResponseUtil; import org.sopt.makers.operation.alarm.domain.Status; import org.sopt.makers.operation.web.alarm.dto.request.AlarmRequest; import org.sopt.makers.operation.web.alarm.dto.request.AlarmSendRequest; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/api/AttendanceApi.java b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/api/WebAttendanceApi.java similarity index 96% rename from operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/api/AttendanceApi.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/api/WebAttendanceApi.java index 0e369fc5..8ce1e92b 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/api/AttendanceApi.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/api/WebAttendanceApi.java @@ -1,7 +1,7 @@ package org.sopt.makers.operation.web.attendnace.api; import org.sopt.makers.operation.common.domain.Part; -import org.sopt.makers.operation.common.dto.BaseResponse; +import org.sopt.makers.operation.dto.BaseResponse; import org.sopt.makers.operation.web.attendnace.dto.request.UpdatedSubAttendanceRequest; import org.springframework.data.domain.Pageable; import org.springframework.http.ResponseEntity; @@ -12,7 +12,7 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.responses.ApiResponse; -public interface AttendanceApi { +public interface WebAttendanceApi { @Operation( summary = "출석 상태 변경 API", diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/api/AttendanceApiController.java b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/api/WebAttendanceApiController.java similarity index 87% rename from operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/api/AttendanceApiController.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/api/WebAttendanceApiController.java index 53a7d312..c83c5c77 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/api/AttendanceApiController.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/api/WebAttendanceApiController.java @@ -3,10 +3,10 @@ import static org.sopt.makers.operation.code.success.web.AttendanceSuccessCode.*; import org.sopt.makers.operation.common.domain.Part; -import org.sopt.makers.operation.common.dto.BaseResponse; -import org.sopt.makers.operation.common.util.ApiResponseUtil; +import org.sopt.makers.operation.dto.BaseResponse; +import org.sopt.makers.operation.util.ApiResponseUtil; import org.sopt.makers.operation.web.attendnace.dto.request.UpdatedSubAttendanceRequest; -import org.sopt.makers.operation.web.attendnace.service.AttendanceService; +import org.sopt.makers.operation.web.attendnace.service.WebAttendanceService; import org.springframework.data.domain.Pageable; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; @@ -23,9 +23,9 @@ @RestController @RequiredArgsConstructor @RequestMapping("/api/v1/attendances") -public class AttendanceApiController implements AttendanceApi { +public class WebAttendanceApiController implements WebAttendanceApi { - private final AttendanceService attendanceService; + private final WebAttendanceService attendanceService; @Override @PatchMapping diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/service/AttendanceService.java b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/service/WebAttendanceService.java similarity index 95% rename from operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/service/AttendanceService.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/service/WebAttendanceService.java index 916e47d1..da1a93a6 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/service/AttendanceService.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/service/WebAttendanceService.java @@ -7,7 +7,7 @@ import org.sopt.makers.operation.web.attendnace.dto.response.UpdatedSubAttendanceResponse; import org.springframework.data.domain.Pageable; -public interface AttendanceService { +public interface WebAttendanceService { UpdatedSubAttendanceResponse updateSubAttendance(UpdatedSubAttendanceRequest request); AttendanceMemberResponse findAttendancesByMember(long memberId); float updateMemberAllScore(long memberId); diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/service/AttendanceServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/service/WebAttendanceServiceImpl.java similarity index 97% rename from operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/service/AttendanceServiceImpl.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/service/WebAttendanceServiceImpl.java index 88bd75dd..0aa6908f 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/service/AttendanceServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/service/WebAttendanceServiceImpl.java @@ -30,7 +30,7 @@ @Service @RequiredArgsConstructor @Transactional(readOnly = true) -public class AttendanceServiceImpl implements AttendanceService { +public class WebAttendanceServiceImpl implements WebAttendanceService { private final AttendanceRepository attendanceRepository; private final SubAttendanceRepository subAttendanceRepository; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/api/LectureApi.java b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/api/WebLectureApi.java similarity index 97% rename from operation-api/src/main/java/org/sopt/makers/operation/web/lecture/api/LectureApi.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/lecture/api/WebLectureApi.java index 463f4d05..fd70e6e1 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/api/LectureApi.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/api/WebLectureApi.java @@ -1,7 +1,7 @@ package org.sopt.makers.operation.web.lecture.api; import org.sopt.makers.operation.common.domain.Part; -import org.sopt.makers.operation.common.dto.BaseResponse; +import org.sopt.makers.operation.dto.BaseResponse; import org.sopt.makers.operation.web.lecture.dto.request.AttendanceRequest; import org.sopt.makers.operation.web.lecture.dto.request.LectureRequest; import org.springframework.http.ResponseEntity; @@ -12,7 +12,7 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.responses.ApiResponse; -public interface LectureApi { +public interface WebLectureApi { @Operation( summary = "세션 생성 API", diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/api/LectureApiController.java b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/api/WebLectureApiController.java similarity index 90% rename from operation-api/src/main/java/org/sopt/makers/operation/web/lecture/api/LectureApiController.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/lecture/api/WebLectureApiController.java index 952066fc..2876e6e3 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/api/LectureApiController.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/api/WebLectureApiController.java @@ -3,11 +3,11 @@ import static org.sopt.makers.operation.code.success.web.LectureSuccessCode.*; import org.sopt.makers.operation.common.domain.Part; -import org.sopt.makers.operation.common.dto.BaseResponse; -import org.sopt.makers.operation.common.util.ApiResponseUtil; +import org.sopt.makers.operation.dto.BaseResponse; +import org.sopt.makers.operation.util.ApiResponseUtil; import org.sopt.makers.operation.web.lecture.dto.request.AttendanceRequest; import org.sopt.makers.operation.web.lecture.dto.request.LectureRequest; -import org.sopt.makers.operation.web.lecture.service.LectureService; +import org.sopt.makers.operation.web.lecture.service.WebLectureService; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; @@ -25,9 +25,9 @@ @RestController @RequiredArgsConstructor @RequestMapping("/api/v1/lectures") -public class LectureApiController implements LectureApi { +public class WebLectureApiController implements WebLectureApi { - private final LectureService lectureService; + private final WebLectureService lectureService; @Override @PostMapping diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/service/LectureService.java b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/service/WebLectureService.java similarity index 96% rename from operation-api/src/main/java/org/sopt/makers/operation/web/lecture/service/LectureService.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/lecture/service/WebLectureService.java index a2516568..2063e431 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/service/LectureService.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/service/WebLectureService.java @@ -8,7 +8,7 @@ import org.sopt.makers.operation.web.lecture.dto.response.LectureResponse; import org.sopt.makers.operation.web.lecture.dto.response.LectureListResponse; -public interface LectureService { +public interface WebLectureService { long createLecture(LectureRequest request); LectureListResponse getLectures(int generation, Part part); LectureResponse getLecture(long lectureId); diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/service/LectureServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/service/WebLectureServiceImpl.java similarity index 99% rename from operation-api/src/main/java/org/sopt/makers/operation/web/lecture/service/LectureServiceImpl.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/lecture/service/WebLectureServiceImpl.java index a6d94b5e..ffcdad07 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/service/LectureServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/service/WebLectureServiceImpl.java @@ -36,7 +36,7 @@ @Service @RequiredArgsConstructor @Transactional(readOnly = true) -public class LectureServiceImpl implements LectureService { +public class WebLectureServiceImpl implements WebLectureService { private final LectureRepository lectureRepository; private final SubLectureRepository subLectureRepository; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/member/api/MemberApi.java b/operation-api/src/main/java/org/sopt/makers/operation/web/member/api/WebMemberApi.java similarity index 91% rename from operation-api/src/main/java/org/sopt/makers/operation/web/member/api/MemberApi.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/member/api/WebMemberApi.java index ac160e0f..01d96e8e 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/member/api/MemberApi.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/member/api/WebMemberApi.java @@ -1,7 +1,7 @@ package org.sopt.makers.operation.web.member.api; import org.sopt.makers.operation.common.domain.Part; -import org.sopt.makers.operation.common.dto.BaseResponse; +import org.sopt.makers.operation.dto.BaseResponse; import org.springframework.data.domain.Pageable; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.RequestParam; @@ -9,7 +9,7 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.responses.ApiResponse; -public interface MemberApi { +public interface WebMemberApi { @Operation( summary = "멤버 리스트 조회 API", diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/member/api/MemberApiController.java b/operation-api/src/main/java/org/sopt/makers/operation/web/member/api/WebMemberApiController.java similarity index 78% rename from operation-api/src/main/java/org/sopt/makers/operation/web/member/api/MemberApiController.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/member/api/WebMemberApiController.java index 0a9dd4f7..5c9a3c32 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/member/api/MemberApiController.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/member/api/WebMemberApiController.java @@ -3,9 +3,9 @@ import static org.sopt.makers.operation.code.success.web.MemberSuccessCode.*; import org.sopt.makers.operation.common.domain.Part; -import org.sopt.makers.operation.common.dto.BaseResponse; -import org.sopt.makers.operation.common.util.ApiResponseUtil; -import org.sopt.makers.operation.web.member.service.MemberService; +import org.sopt.makers.operation.dto.BaseResponse; +import org.sopt.makers.operation.util.ApiResponseUtil; +import org.sopt.makers.operation.web.member.service.WebMemberService; import org.springframework.data.domain.Pageable; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; @@ -19,9 +19,9 @@ @RestController @RequiredArgsConstructor @RequestMapping("/api/v1/members") -public class MemberApiController implements MemberApi { +public class WebMemberApiController implements WebMemberApi { - private final MemberService memberService; + private final WebMemberService memberService; @Override @GetMapping("/list") diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/member/service/MemberService.java b/operation-api/src/main/java/org/sopt/makers/operation/web/member/service/WebMemberService.java similarity index 89% rename from operation-api/src/main/java/org/sopt/makers/operation/web/member/service/MemberService.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/member/service/WebMemberService.java index 4ea1efe0..ae5ac58b 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/member/service/MemberService.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/member/service/WebMemberService.java @@ -4,6 +4,6 @@ import org.sopt.makers.operation.web.member.dto.response.MemberListResponse; import org.springframework.data.domain.Pageable; -public interface MemberService { +public interface WebMemberService { MemberListResponse getMembers(Part part, int generation, Pageable pageable); } diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/member/service/MemberServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/web/member/service/WebMemberServiceImpl.java similarity index 93% rename from operation-api/src/main/java/org/sopt/makers/operation/web/member/service/MemberServiceImpl.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/member/service/WebMemberServiceImpl.java index 7a021141..c84e5a27 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/member/service/MemberServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/member/service/WebMemberServiceImpl.java @@ -13,7 +13,7 @@ @Service @RequiredArgsConstructor @Transactional(readOnly = true) -public class MemberServiceImpl implements MemberService { +public class WebMemberServiceImpl implements WebMemberService { private final MemberRepository memberRepository; diff --git a/operation-auth/build.gradle b/operation-auth/build.gradle index 414b2b62..8509938c 100644 --- a/operation-auth/build.gradle +++ b/operation-auth/build.gradle @@ -1,20 +1,21 @@ -tasks.named('bootJar') { - enabled = false +jar { + enabled = true } -tasks.named('jar') { - enabled = true +bootJar { + enabled = false } dependencies { + implementation project(':operation-common') + implementation 'org.springframework.boot:spring-boot-starter-security' // jwt - implementation group: 'io.jsonwebtoken', name: 'jjwt-api', version: '0.11.2' + implementation group: 'io.jsonwebtoken', name: 'jjwt-api', version: '0.11.5' + implementation group: 'io.jsonwebtoken', name: 'jjwt-impl', version: '0.11.5' + implementation group: 'io.jsonwebtoken', name: 'jjwt-jackson', version: '0.11.5' implementation group: 'javax.xml.bind', name: 'jaxb-api', version: '2.1' - runtimeOnly group: 'io.jsonwebtoken', name: 'jjwt-impl', version: '0.11.2' - runtimeOnly group: 'io.jsonwebtoken', name: 'jjwt-jackson', version: '0.11.2' implementation 'org.springframework.boot:spring-boot-starter-web' - } \ No newline at end of file diff --git a/operation-auth/src/main/java/org/sopt/makers/operation/AuthRoot.java b/operation-auth/src/main/java/org/sopt/makers/operation/AuthRoot.java new file mode 100644 index 00000000..5046a789 --- /dev/null +++ b/operation-auth/src/main/java/org/sopt/makers/operation/AuthRoot.java @@ -0,0 +1,4 @@ +package org.sopt.makers.operation; + +public interface AuthRoot { +} diff --git a/operation-auth/src/main/java/org/sopt/makers/operation/config/SecurityConfig.java b/operation-auth/src/main/java/org/sopt/makers/operation/config/SecurityConfig.java index d69ab4e6..f1e8a15e 100644 --- a/operation-auth/src/main/java/org/sopt/makers/operation/config/SecurityConfig.java +++ b/operation-auth/src/main/java/org/sopt/makers/operation/config/SecurityConfig.java @@ -14,6 +14,7 @@ import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.web.SecurityFilterChain; import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; +import org.springframework.security.web.util.matcher.AntPathRequestMatcher; import org.springframework.web.cors.CorsConfiguration; import org.springframework.web.cors.CorsConfigurationSource; import org.springframework.web.cors.UrlBasedCorsConfigurationSource; @@ -34,8 +35,9 @@ public static PasswordEncoder passwordEncoder() { @Bean @Profile("dev") public SecurityFilterChain filterChainDev(HttpSecurity http) throws Exception { + http.authorizeHttpRequests(authorizeHttpRequests -> authorizeHttpRequests + .requestMatchers(new AntPathRequestMatcher("/swagger-ui/**")).permitAll()); setHttp(http); - http.authorizeRequests().antMatchers("/swagger-ui/**").permitAll(); return http.build(); } @@ -43,23 +45,20 @@ public SecurityFilterChain filterChainDev(HttpSecurity http) throws Exception { @Profile("prod") public SecurityFilterChain filterChainProd(HttpSecurity http) throws Exception { setHttp(http); - http.authorizeRequests().antMatchers("/swagger-ui/**").authenticated(); return http.build(); } private void setHttp(HttpSecurity http) throws Exception { - http.antMatcher("/**") - .httpBasic().disable() + http.httpBasic().disable() .csrf().disable() .formLogin().disable() .cors().configurationSource(corsConfigurationSource()) .and() - .authorizeRequests() - .antMatchers("/api/v1/auth/**", "/exception/**").permitAll() - .and() - .authorizeRequests() - .antMatchers("/api/v1/**").authenticated() - .and() - .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS) + .authorizeHttpRequests(authorizeHttpRequests -> + authorizeHttpRequests + .requestMatchers(new AntPathRequestMatcher("/api/v1/auth", "POST")).permitAll() + .requestMatchers(new AntPathRequestMatcher("/error")).permitAll() + .anyRequest().authenticated()) + .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS) .and() .addFilterBefore(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class) .addFilterBefore(jwtExceptionFilter, JwtAuthenticationFilter.class); diff --git a/operation-auth/src/main/java/org/sopt/makers/operation/filter/JwtAuthenticationFilter.java b/operation-auth/src/main/java/org/sopt/makers/operation/filter/JwtAuthenticationFilter.java index 7221d217..57e74c8a 100644 --- a/operation-auth/src/main/java/org/sopt/makers/operation/filter/JwtAuthenticationFilter.java +++ b/operation-auth/src/main/java/org/sopt/makers/operation/filter/JwtAuthenticationFilter.java @@ -1,5 +1,9 @@ package org.sopt.makers.operation.filter; +import jakarta.servlet.FilterChain; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import lombok.RequiredArgsConstructor; import lombok.val; import org.sopt.makers.operation.jwt.JwtTokenProvider; @@ -7,9 +11,6 @@ import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.web.authentication.WebAuthenticationDetailsSource; -import javax.servlet.*; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; import java.io.IOException; import org.springframework.stereotype.Component; @@ -22,7 +23,8 @@ public class JwtAuthenticationFilter extends OncePerRequestFilter { private final JwtTokenProvider jwtTokenProvider; @Override - public void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException { + public void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) + throws IOException, ServletException { val uri = request.getRequestURI(); if ((uri.startsWith("/api/v1")) && !uri.contains("auth")) { diff --git a/operation-auth/src/main/java/org/sopt/makers/operation/filter/JwtExceptionFilter.java b/operation-auth/src/main/java/org/sopt/makers/operation/filter/JwtExceptionFilter.java index 1e1cb0ae..3ec3e421 100644 --- a/operation-auth/src/main/java/org/sopt/makers/operation/filter/JwtExceptionFilter.java +++ b/operation-auth/src/main/java/org/sopt/makers/operation/filter/JwtExceptionFilter.java @@ -1,17 +1,24 @@ package org.sopt.makers.operation.filter; +import static org.sopt.makers.operation.code.failure.admin.AdminFailureCode.*; + +import org.sopt.makers.operation.code.failure.admin.AdminFailureCode; +import org.sopt.makers.operation.dto.BaseResponse; +import org.sopt.makers.operation.exception.TokenException; +import org.sopt.makers.operation.util.ApiResponseUtil; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Component; import org.springframework.web.filter.OncePerRequestFilter; +import jakarta.servlet.FilterChain; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import lombok.val; import com.fasterxml.jackson.databind.ObjectMapper; -import javax.servlet.FilterChain; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; import java.io.IOException; @Component @@ -22,16 +29,20 @@ protected void doFilterInternal(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, FilterChain filterChain ) throws ServletException, IOException { -// try { -// filterChain.doFilter(httpServletRequest, httpServletResponse); -// } catch(TokenException e) { -// val objectMapper = new ObjectMapper(); -// //val jsonResponse = objectMapper.writeValueAsString(ResponseDTO.fail(e.getMessage())); -// -// httpServletResponse.setStatus(HttpStatus.UNAUTHORIZED.value()); -// httpServletResponse.setContentType(MediaType.APPLICATION_JSON_VALUE); -// httpServletResponse.setCharacterEncoding("UTF-8"); -// //httpServletResponse.getWriter().write(jsonResponse); -// } + try { + filterChain.doFilter(httpServletRequest, httpServletResponse); + } catch(TokenException e) { + val objectMapper = new ObjectMapper(); + val jsonResponse = objectMapper.writeValueAsString(getFailureResponse()); + + httpServletResponse.setStatus(HttpStatus.UNAUTHORIZED.value()); + httpServletResponse.setContentType(MediaType.APPLICATION_JSON_VALUE); + httpServletResponse.setCharacterEncoding("UTF-8"); + httpServletResponse.getWriter().write(jsonResponse); + } + } + + private ResponseEntity> getFailureResponse() { + return ApiResponseUtil.failure(INVALID_TOKEN); } } \ No newline at end of file diff --git a/operation-auth/src/main/java/org/sopt/makers/operation/jwt/JwtTokenProvider.java b/operation-auth/src/main/java/org/sopt/makers/operation/jwt/JwtTokenProvider.java index 6feef300..e7fc7a1d 100644 --- a/operation-auth/src/main/java/org/sopt/makers/operation/jwt/JwtTokenProvider.java +++ b/operation-auth/src/main/java/org/sopt/makers/operation/jwt/JwtTokenProvider.java @@ -5,19 +5,18 @@ import io.jsonwebtoken.Jwts; import io.jsonwebtoken.SignatureAlgorithm; import io.jsonwebtoken.security.SignatureException; +import jakarta.servlet.http.HttpServletRequest; import lombok.RequiredArgsConstructor; import lombok.val; import org.sopt.makers.operation.authentication.AdminAuthentication; -//import org.sopt.makers.operation.common.ExceptionMessage; -//import org.sopt.makers.operation.exception.TokenException; import org.springframework.beans.factory.annotation.Value; import org.springframework.security.core.Authentication; import org.springframework.stereotype.Service; import org.springframework.util.StringUtils; import javax.crypto.spec.SecretKeySpec; -import javax.servlet.http.HttpServletRequest; import javax.xml.bind.DatatypeConverter; + import java.nio.charset.StandardCharsets; import java.time.LocalDateTime; import java.time.ZoneId; diff --git a/operation-common/build.gradle b/operation-common/build.gradle index 5d71a3a5..4712a383 100644 --- a/operation-common/build.gradle +++ b/operation-common/build.gradle @@ -1,18 +1,11 @@ -plugins { - id 'java' +jar { + enabled = true } -group = 'org.sopt.makers' -version = '0.0.1-SNAPSHOT' - -repositories { - mavenCentral() +bootJar { + enabled = false } dependencies { implementation 'org.springframework.boot:spring-boot-starter-web' -} - -test { - useJUnitPlatform() } \ No newline at end of file diff --git a/operation-common/src/main/java/org/sopt/makers/operation/CommonRoot.java b/operation-common/src/main/java/org/sopt/makers/operation/CommonRoot.java new file mode 100644 index 00000000..c2e06e1f --- /dev/null +++ b/operation-common/src/main/java/org/sopt/makers/operation/CommonRoot.java @@ -0,0 +1,4 @@ +package org.sopt.makers.operation; + +public interface CommonRoot { +} diff --git a/operation-api/src/main/java/org/sopt/makers/operation/common/dto/BaseResponse.java b/operation-common/src/main/java/org/sopt/makers/operation/dto/BaseResponse.java similarity index 93% rename from operation-api/src/main/java/org/sopt/makers/operation/common/dto/BaseResponse.java rename to operation-common/src/main/java/org/sopt/makers/operation/dto/BaseResponse.java index cbc20d60..65b13917 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/common/dto/BaseResponse.java +++ b/operation-common/src/main/java/org/sopt/makers/operation/dto/BaseResponse.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.common.dto; +package org.sopt.makers.operation.dto; import com.fasterxml.jackson.annotation.JsonInclude; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/common/util/ApiResponseUtil.java b/operation-common/src/main/java/org/sopt/makers/operation/util/ApiResponseUtil.java similarity index 90% rename from operation-api/src/main/java/org/sopt/makers/operation/common/util/ApiResponseUtil.java rename to operation-common/src/main/java/org/sopt/makers/operation/util/ApiResponseUtil.java index 6d140ca7..aa70a45e 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/common/util/ApiResponseUtil.java +++ b/operation-common/src/main/java/org/sopt/makers/operation/util/ApiResponseUtil.java @@ -1,8 +1,8 @@ -package org.sopt.makers.operation.common.util; +package org.sopt.makers.operation.util; import org.sopt.makers.operation.code.failure.FailureCode; import org.sopt.makers.operation.code.success.SuccessCode; -import org.sopt.makers.operation.common.dto.BaseResponse; +import org.sopt.makers.operation.dto.BaseResponse; import org.springframework.http.HttpHeaders; import org.springframework.http.ResponseEntity; diff --git a/operation-domain/build.gradle b/operation-domain/build.gradle index 80988c3c..88f53245 100644 --- a/operation-domain/build.gradle +++ b/operation-domain/build.gradle @@ -1,53 +1,31 @@ -buildscript { - ext { - queryDslVersion = "5.0.0" - } +jar { + enabled = true } -plugins { - id 'java' - id 'com.ewerk.gradle.plugins.querydsl' version '1.0.10' -} - -group = 'org.sopt.makers' -version = '0.0.1-SNAPSHOT' - -repositories { - mavenCentral() +bootJar { + enabled = false } dependencies { implementation project(path: ':operation-common') + // QueryDSL +// implementation "com.querydsl:querydsl-jpa:5.0.0" +// implementation "com.querydsl:querydsl-apt:5.0.0" +// testImplementation 'junit:junit:4.13.1' +// testImplementation 'junit:junit:4.13.1' + implementation 'com.querydsl:querydsl-jpa:5.0.0:jakarta' + annotationProcessor "com.querydsl:querydsl-apt:5.0.0:jakarta" + annotationProcessor "jakarta.annotation:jakarta.annotation-api" + annotationProcessor "jakarta.persistence:jakarta.persistence-api" + + // jpa implementation 'org.springframework.boot:spring-boot-starter-data-jpa' - implementation "com.querydsl:querydsl-jpa:5.0.0" - implementation "com.querydsl:querydsl-apt:5.0.0" + + // db + runtimeOnly 'com.h2database:h2' + runtimeOnly 'org.postgresql:postgresql' // https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.14.0-rc1' - - -} - -test { - useJUnitPlatform() -} - -def querydslDir = "$buildDir/generated/querydsl" - -querydsl { - jpa = true - querydslSourcesDir = querydslDir -} -sourceSets { - main.java.srcDir querydslDir -} -compileQuerydsl{ - options.annotationProcessorPath = configurations.querydsl } -configurations { - compileOnly { - extendsFrom annotationProcessor - } - querydsl.extendsFrom compileClasspath -} \ No newline at end of file diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/DomainRoot.java b/operation-domain/src/main/java/org/sopt/makers/operation/DomainRoot.java new file mode 100644 index 00000000..8b4c7f74 --- /dev/null +++ b/operation-domain/src/main/java/org/sopt/makers/operation/DomainRoot.java @@ -0,0 +1,4 @@ +package org.sopt.makers.operation; + +public interface DomainRoot { +} diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/admin/domain/Admin.java b/operation-domain/src/main/java/org/sopt/makers/operation/admin/domain/Admin.java index 3d096942..0e09590e 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/admin/domain/Admin.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/admin/domain/Admin.java @@ -1,21 +1,24 @@ package org.sopt.makers.operation.admin.domain; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.EnumType; +import jakarta.persistence.Enumerated; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; -import javax.persistence.*; - -import static javax.persistence.GenerationType.IDENTITY; - @Getter @Setter @Entity @NoArgsConstructor public class Admin { @Id - @GeneratedValue(strategy = IDENTITY) + @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "admin_id") private Long id; diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/alarm/domain/Alarm.java b/operation-domain/src/main/java/org/sopt/makers/operation/alarm/domain/Alarm.java index 4d92b248..3d3f4c35 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/alarm/domain/Alarm.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/alarm/domain/Alarm.java @@ -1,24 +1,23 @@ package org.sopt.makers.operation.alarm.domain; import static java.util.Objects.*; -import static javax.persistence.EnumType.*; -import static javax.persistence.GenerationType.*; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; -import javax.persistence.Column; -import javax.persistence.Convert; -import javax.persistence.Entity; -import javax.persistence.Enumerated; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; - import org.sopt.makers.operation.common.domain.BaseEntity; import org.sopt.makers.operation.common.domain.Part; import org.sopt.makers.operation.schedule.converter.StringListConverter; +import jakarta.persistence.Column; +import jakarta.persistence.Convert; +import jakarta.persistence.Entity; +import jakarta.persistence.EnumType; +import jakarta.persistence.Enumerated; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; @@ -28,7 +27,7 @@ @Getter public class Alarm extends BaseEntity { @Id - @GeneratedValue(strategy = IDENTITY) + @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "alarm_id") private Long id; @@ -37,7 +36,7 @@ public class Alarm extends BaseEntity { private int generationAt; @Column(nullable = false) - @Enumerated(value = STRING) + @Enumerated(value = EnumType.STRING) private Attribute attribute; private String title; @@ -49,7 +48,7 @@ public class Alarm extends BaseEntity { private Boolean isActive; - @Enumerated(value = STRING) + @Enumerated(value = EnumType.STRING) private Part part; @Column(columnDefinition = "TEXT", nullable = false) @@ -57,7 +56,7 @@ public class Alarm extends BaseEntity { private List targetList; @Column(nullable = false) - @Enumerated(value = STRING) + @Enumerated(value = EnumType.STRING) private Status status; private LocalDateTime sendAt; diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/attendance/domain/Attendance.java b/operation-domain/src/main/java/org/sopt/makers/operation/attendance/domain/Attendance.java index d5799e7f..120938e3 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/attendance/domain/Attendance.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/attendance/domain/Attendance.java @@ -1,6 +1,6 @@ package org.sopt.makers.operation.attendance.domain; -import static javax.persistence.GenerationType.*; +import static jakarta.persistence.GenerationType.*; import static org.sopt.makers.operation.code.failure.AttendanceFailureCode.*; import static org.sopt.makers.operation.attendance.domain.AttendanceStatus.*; @@ -8,21 +8,20 @@ import java.util.List; import java.util.Objects; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.EnumType; -import javax.persistence.Enumerated; -import javax.persistence.FetchType; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; -import javax.persistence.OneToMany; - import org.sopt.makers.operation.lecture.domain.Lecture; import org.sopt.makers.operation.member.domain.Member; import org.sopt.makers.operation.exception.AttendanceException; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.EnumType; +import jakarta.persistence.Enumerated; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.OneToMany; import lombok.*; @Entity @@ -30,7 +29,8 @@ @Getter public class Attendance { - @Id @GeneratedValue(strategy = IDENTITY) + @Id + @GeneratedValue(strategy = IDENTITY) @Column(name = "attendance_id") private Long id; diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/attendance/domain/SubAttendance.java b/operation-domain/src/main/java/org/sopt/makers/operation/attendance/domain/SubAttendance.java index db7911d4..b9c0f667 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/attendance/domain/SubAttendance.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/attendance/domain/SubAttendance.java @@ -1,23 +1,22 @@ package org.sopt.makers.operation.attendance.domain; -import static javax.persistence.GenerationType.*; import static org.sopt.makers.operation.attendance.domain.AttendanceStatus.*; import java.util.Objects; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.EnumType; -import javax.persistence.Enumerated; -import javax.persistence.FetchType; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; - import org.sopt.makers.operation.common.domain.BaseEntity; import org.sopt.makers.operation.lecture.domain.SubLecture; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.EnumType; +import jakarta.persistence.Enumerated; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; import lombok.Getter; import lombok.NoArgsConstructor; @@ -26,7 +25,8 @@ @NoArgsConstructor public class SubAttendance extends BaseEntity { - @Id @GeneratedValue(strategy = IDENTITY) + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "sub_attendance_id") private Long id; diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/common/config/JpaQueryFactoryConfig.java b/operation-domain/src/main/java/org/sopt/makers/operation/common/config/JpaQueryFactoryConfig.java index 6618030a..355cdb28 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/common/config/JpaQueryFactoryConfig.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/common/config/JpaQueryFactoryConfig.java @@ -1,12 +1,12 @@ package org.sopt.makers.operation.common.config; -import javax.persistence.EntityManager; - import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import com.querydsl.jpa.impl.JPAQueryFactory; +import jakarta.persistence.EntityManager; + @Configuration public class JpaQueryFactoryConfig { diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/common/domain/BaseEntity.java b/operation-domain/src/main/java/org/sopt/makers/operation/common/domain/BaseEntity.java index 5b541aee..ec685458 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/common/domain/BaseEntity.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/common/domain/BaseEntity.java @@ -2,13 +2,12 @@ import java.time.LocalDateTime; -import javax.persistence.EntityListeners; -import javax.persistence.MappedSuperclass; - import org.springframework.data.annotation.CreatedDate; import org.springframework.data.annotation.LastModifiedDate; import org.springframework.data.jpa.domain.support.AuditingEntityListener; +import jakarta.persistence.EntityListeners; +import jakarta.persistence.MappedSuperclass; import lombok.Getter; @EntityListeners(AuditingEntityListener.class) diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/lecture/domain/Lecture.java b/operation-domain/src/main/java/org/sopt/makers/operation/lecture/domain/Lecture.java index 9de07bd3..77b85f1a 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/lecture/domain/Lecture.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/lecture/domain/Lecture.java @@ -1,24 +1,23 @@ package org.sopt.makers.operation.lecture.domain; -import static javax.persistence.GenerationType.*; import static org.sopt.makers.operation.lecture.domain.LectureStatus.*; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.EnumType; -import javax.persistence.Enumerated; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; -import javax.persistence.OneToMany; - import org.sopt.makers.operation.common.domain.BaseEntity; import org.sopt.makers.operation.common.domain.Part; import org.sopt.makers.operation.attendance.domain.Attendance; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.EnumType; +import jakarta.persistence.Enumerated; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.OneToMany; import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; @@ -28,7 +27,8 @@ @Getter public class Lecture extends BaseEntity { - @Id @GeneratedValue(strategy = IDENTITY) + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "lecture_id") private Long id; diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/lecture/domain/SubLecture.java b/operation-domain/src/main/java/org/sopt/makers/operation/lecture/domain/SubLecture.java index a2daf293..5204e6fa 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/lecture/domain/SubLecture.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/lecture/domain/SubLecture.java @@ -1,24 +1,23 @@ package org.sopt.makers.operation.lecture.domain; import static java.util.Objects.*; -import static javax.persistence.GenerationType.*; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; import java.util.Objects; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.FetchType; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; -import javax.persistence.OneToMany; - import org.sopt.makers.operation.attendance.domain.SubAttendance; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.OneToMany; import lombok.Getter; import lombok.NoArgsConstructor; @@ -27,7 +26,8 @@ @Getter public class SubLecture { - @Id @GeneratedValue(strategy = IDENTITY) + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "sub_lecture_id") private Long id; diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/member/domain/Member.java b/operation-domain/src/main/java/org/sopt/makers/operation/member/domain/Member.java index c3bfb20a..caafb2c5 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/member/domain/Member.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/member/domain/Member.java @@ -3,18 +3,17 @@ import java.util.ArrayList; import java.util.List; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.EnumType; -import javax.persistence.Enumerated; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.OneToMany; - import org.sopt.makers.operation.attendance.domain.Attendance; import org.sopt.makers.operation.common.domain.Part; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.EnumType; +import jakarta.persistence.Enumerated; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.OneToMany; import lombok.Getter; import lombok.NoArgsConstructor; @@ -23,7 +22,8 @@ @Getter public class Member { - @Id @GeneratedValue(strategy = GenerationType.IDENTITY) + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "member_id") private Long id; diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/schedule/converter/StringListConverter.java b/operation-domain/src/main/java/org/sopt/makers/operation/schedule/converter/StringListConverter.java index 967cc4ef..4f0fdc2d 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/schedule/converter/StringListConverter.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/schedule/converter/StringListConverter.java @@ -5,11 +5,11 @@ import java.io.IOException; import java.util.List; -import javax.persistence.AttributeConverter; - import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; +import jakarta.persistence.AttributeConverter; + public class StringListConverter implements AttributeConverter, String> { private static final ObjectMapper mapper = new ObjectMapper() .configure(FAIL_ON_UNKNOWN_PROPERTIES, false) diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/schedule/domain/Schedule.java b/operation-domain/src/main/java/org/sopt/makers/operation/schedule/domain/Schedule.java index 0973e924..5d14ce03 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/schedule/domain/Schedule.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/schedule/domain/Schedule.java @@ -1,19 +1,17 @@ package org.sopt.makers.operation.schedule.domain; -import static javax.persistence.EnumType.*; -import static javax.persistence.GenerationType.*; - import java.time.LocalDateTime; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Enumerated; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; - import org.sopt.makers.operation.common.domain.BaseEntity; import org.sopt.makers.operation.lecture.domain.Attribute; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.EnumType; +import jakarta.persistence.Enumerated; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; import lombok.Getter; import lombok.NoArgsConstructor; @@ -22,7 +20,7 @@ @Getter public class Schedule extends BaseEntity { @Id - @GeneratedValue(strategy = IDENTITY) + @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "schedule_id") private Long id; @@ -31,7 +29,7 @@ public class Schedule extends BaseEntity { private LocalDateTime endDate; @Column(nullable = false) - @Enumerated(value = STRING) + @Enumerated(value = EnumType.STRING) private Attribute attribute; private String title; diff --git a/operation-external/build.gradle b/operation-external/build.gradle index 843048bc..4c29cb51 100644 --- a/operation-external/build.gradle +++ b/operation-external/build.gradle @@ -1,12 +1,9 @@ -plugins { - id 'java' +jar { + enabled = true } -group = 'org.sopt.makers' -version = '0.0.1-SNAPSHOT' - -repositories { - mavenCentral() +bootJar { + enabled = false } dependencies { diff --git a/operation-external/src/main/java/org/sopt/makers/operation/ExternalRoot.java b/operation-external/src/main/java/org/sopt/makers/operation/ExternalRoot.java new file mode 100644 index 00000000..a3168705 --- /dev/null +++ b/operation-external/src/main/java/org/sopt/makers/operation/ExternalRoot.java @@ -0,0 +1,4 @@ +package org.sopt.makers.operation; + +public interface ExternalRoot { +} From 6baa62be08991c0939a38e81c0bbaab4b195a246 Mon Sep 17 00:00:00 2001 From: thguss Date: Sat, 10 Feb 2024 20:56:44 +0900 Subject: [PATCH 096/141] =?UTF-8?q?[FIX]=20=EC=8A=A4=EC=9B=A8=EA=B1=B0=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- operation-api/build.gradle | 3 +- .../common/config/SwaggerConfig.java | 84 +++++-------------- 2 files changed, 20 insertions(+), 67 deletions(-) diff --git a/operation-api/build.gradle b/operation-api/build.gradle index da393882..3ca855d1 100644 --- a/operation-api/build.gradle +++ b/operation-api/build.gradle @@ -18,7 +18,6 @@ dependencies { implementation 'org.springframework.boot:spring-boot-starter-data-jpa' // swagger - implementation 'io.springfox:springfox-boot-starter:3.0.0' - implementation 'io.springfox:springfox-swagger-ui:3.0.0' + implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.0.2' } \ No newline at end of file diff --git a/operation-api/src/main/java/org/sopt/makers/operation/common/config/SwaggerConfig.java b/operation-api/src/main/java/org/sopt/makers/operation/common/config/SwaggerConfig.java index 9fbedf35..ebed88c3 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/common/config/SwaggerConfig.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/common/config/SwaggerConfig.java @@ -1,75 +1,29 @@ package org.sopt.makers.operation.common.config; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - +import io.swagger.v3.oas.annotations.enums.SecuritySchemeIn; +import io.swagger.v3.oas.annotations.enums.SecuritySchemeType; +import io.swagger.v3.oas.annotations.security.SecurityScheme; +import io.swagger.v3.oas.models.OpenAPI; +import io.swagger.v3.oas.models.info.Info; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.web.servlet.config.annotation.EnableWebMvc; - -import springfox.documentation.builders.ApiInfoBuilder; -import springfox.documentation.builders.PathSelectors; -import springfox.documentation.builders.RequestHandlerSelectors; -import springfox.documentation.service.ApiInfo; -import springfox.documentation.service.ApiKey; -import springfox.documentation.service.AuthorizationScope; -import springfox.documentation.service.SecurityReference; -import springfox.documentation.spi.DocumentationType; -import springfox.documentation.spi.service.contexts.SecurityContext; -import springfox.documentation.spring.web.plugins.Docket; -import springfox.documentation.swagger2.annotations.EnableSwagger2; +@SecurityScheme( + name = "Authorization", + type = SecuritySchemeType.HTTP, + in = SecuritySchemeIn.HEADER, + bearerFormat = "JWT", + scheme = "Bearer" +) @Configuration -@EnableSwagger2 -@EnableWebMvc public class SwaggerConfig { - - private ApiInfo swaggerInfo() { - return new ApiInfoBuilder().title("Makers Operation API") - .description("Makers Operation API Docs").build(); - } - @Bean - public Docket swaggerApi() { - return new Docket(DocumentationType.SWAGGER_2) - .securityContexts(List.of(securityContext())) - .securitySchemes(List.of(apiKey())) - .consumes(getConsumeContentTypes()) - .produces(getProduceContentTypes()) - .apiInfo(swaggerInfo()).select() - .apis(RequestHandlerSelectors.basePackage("org.sopt.makers.operation.controller")) - .paths(PathSelectors.any()) - .build() - .useDefaultResponseMessages(false); - } - - private Set getConsumeContentTypes() { - Set consumes = new HashSet<>(); - consumes.add("application/json"); - return consumes; - } - - private Set getProduceContentTypes() { - Set produces = new HashSet<>(); - produces.add("application/json"); - return produces; - } - - private SecurityContext securityContext() { - return SecurityContext.builder() - .securityReferences(defaultAuth()) - .build(); - } - - private List defaultAuth() { - AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything"); - AuthorizationScope[] authorizationScopes = new AuthorizationScope[1]; - authorizationScopes[0] = authorizationScope; - return List.of(new SecurityReference("Authorization", authorizationScopes)); - } - - private ApiKey apiKey() { - return new ApiKey("Authorization", "Authorization", "header"); + public OpenAPI api() { + Info info = new Info() + .title("Doorip API Docs") + .version("v1.0") + .description("Doorip 서비스 API 명세서 입니다."); + return new OpenAPI() + .info(info); } } \ No newline at end of file From e4df272a63e6dcb5e1e2339966b60d6240699e87 Mon Sep 17 00:00:00 2001 From: thguss Date: Sat, 10 Feb 2024 21:07:29 +0900 Subject: [PATCH 097/141] =?UTF-8?q?[ADD]=20test=20=EA=B2=BD=EB=A1=9C=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- operation-api/build.gradle | 1 + .../org/sopt/makers/operation/test/HealthCheckController.java | 4 +++- .../java/org/sopt/makers/operation/config/SecurityConfig.java | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/operation-api/build.gradle b/operation-api/build.gradle index 3ca855d1..2d20d26b 100644 --- a/operation-api/build.gradle +++ b/operation-api/build.gradle @@ -16,6 +16,7 @@ dependencies { implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.springframework.boot:spring-boot-starter-security' implementation 'org.springframework.boot:spring-boot-starter-data-jpa' + implementation 'org.springframework.boot:spring-boot-starter-validation' // swagger implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.0.2' diff --git a/operation-api/src/main/java/org/sopt/makers/operation/test/HealthCheckController.java b/operation-api/src/main/java/org/sopt/makers/operation/test/HealthCheckController.java index 77b16e71..efebcb82 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/test/HealthCheckController.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/test/HealthCheckController.java @@ -1,12 +1,14 @@ package org.sopt.makers.operation.test; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController +@RequestMapping("/api/v1/test") public class HealthCheckController { - @GetMapping("/") + @GetMapping public String healthCheck() { return "Hello Operation!"; } diff --git a/operation-auth/src/main/java/org/sopt/makers/operation/config/SecurityConfig.java b/operation-auth/src/main/java/org/sopt/makers/operation/config/SecurityConfig.java index f1e8a15e..bfec89f8 100644 --- a/operation-auth/src/main/java/org/sopt/makers/operation/config/SecurityConfig.java +++ b/operation-auth/src/main/java/org/sopt/makers/operation/config/SecurityConfig.java @@ -56,6 +56,7 @@ private void setHttp(HttpSecurity http) throws Exception { .authorizeHttpRequests(authorizeHttpRequests -> authorizeHttpRequests .requestMatchers(new AntPathRequestMatcher("/api/v1/auth", "POST")).permitAll() + .requestMatchers(new AntPathRequestMatcher("/api/v1/test", "GET")).permitAll() .requestMatchers(new AntPathRequestMatcher("/error")).permitAll() .anyRequest().authenticated()) .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS) From 0c4824177515c2128f249b48989dc5be983a3ac5 Mon Sep 17 00:00:00 2001 From: dragontaek-lee Date: Sat, 10 Feb 2024 22:53:25 +0900 Subject: [PATCH 098/141] =?UTF-8?q?[FEAT]=20queryDsl=20generated=20ignore?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 601e1684..5df0f4ca 100644 --- a/.gitignore +++ b/.gitignore @@ -38,4 +38,6 @@ out/ .vscode/ ### config yml ### -application-**.yml \ No newline at end of file +application-**.yml + +*/src/main/generated \ No newline at end of file From a60123a8ab96c8b538e1b794b9fcdaaca11aa244 Mon Sep 17 00:00:00 2001 From: dragontaek-lee Date: Sat, 10 Feb 2024 22:53:47 +0900 Subject: [PATCH 099/141] =?UTF-8?q?[FIX]=20=EB=A6=AC=ED=94=84=EB=A0=88?= =?UTF-8?q?=EC=8B=9C=20=EC=97=90=EB=9F=AC=20=EB=A9=94=EC=84=B8=EC=A7=80=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../makers/operation/code/failure/admin/AdminFailureCode.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/operation-common/src/main/java/org/sopt/makers/operation/code/failure/admin/AdminFailureCode.java b/operation-common/src/main/java/org/sopt/makers/operation/code/failure/admin/AdminFailureCode.java index f7a26c46..eeadbd2d 100644 --- a/operation-common/src/main/java/org/sopt/makers/operation/code/failure/admin/AdminFailureCode.java +++ b/operation-common/src/main/java/org/sopt/makers/operation/code/failure/admin/AdminFailureCode.java @@ -14,7 +14,7 @@ public enum AdminFailureCode implements FailureCode { INVALID_EMAIL(BAD_REQUEST,"이메일이 존재하지 않습니다."), INVALID_PASSWORD(BAD_REQUEST,"비밀번호가 일치하지 않습니다."), NOT_APPROVED_ACCOUNT(BAD_REQUEST,"승인되지 않은 계정입니다."), - INVALID_TOKEN(BAD_REQUEST,"토큰이 일치하지 않습니다."), + INVALID_REFRESH_TOKEN(BAD_REQUEST,"유효하지 않은 리프레시 토큰입니다."), ; private final HttpStatus status; From 516329ce53c6550aefd59a27e1d687a376a6c8ed Mon Sep 17 00:00:00 2001 From: dragontaek-lee Date: Sat, 10 Feb 2024 22:53:58 +0900 Subject: [PATCH 100/141] =?UTF-8?q?[FEAT]=20=ED=86=A0=ED=81=B0=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=EB=A9=94=EC=84=B8=EC=A7=80=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../code/failure/TokenFailureCode.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 operation-common/src/main/java/org/sopt/makers/operation/code/failure/TokenFailureCode.java diff --git a/operation-common/src/main/java/org/sopt/makers/operation/code/failure/TokenFailureCode.java b/operation-common/src/main/java/org/sopt/makers/operation/code/failure/TokenFailureCode.java new file mode 100644 index 00000000..5713fec5 --- /dev/null +++ b/operation-common/src/main/java/org/sopt/makers/operation/code/failure/TokenFailureCode.java @@ -0,0 +1,18 @@ +package org.sopt.makers.operation.code.failure; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; + +import static org.springframework.http.HttpStatus.BAD_REQUEST; + +@RequiredArgsConstructor +@Getter +public enum TokenFailureCode implements FailureCode { + EMPTY_TOKEN(BAD_REQUEST, "빈 토큰입니다."), + INVALID_TOKEN(BAD_REQUEST, "유효하지 않은 토큰입니다.") + ; + + private final HttpStatus status; + private final String message; +} From 6874fed8a6be873573e63d4a015213b11faec97c Mon Sep 17 00:00:00 2001 From: dragontaek-lee Date: Sat, 10 Feb 2024 22:54:20 +0900 Subject: [PATCH 101/141] =?UTF-8?q?[FIX]=20=EB=A6=AC=ED=94=84=EB=A0=88?= =?UTF-8?q?=EC=8B=9C=20=EC=97=90=EB=9F=AC=20=EB=A9=94=EC=84=B8=EC=A7=80=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../makers/operation/web/admin/service/AdminServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/admin/service/AdminServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/web/admin/service/AdminServiceImpl.java index ad9100a4..b18d02f4 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/admin/service/AdminServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/admin/service/AdminServiceImpl.java @@ -97,7 +97,7 @@ public RefreshResponse refresh(String refreshToken) { public void validateRefreshToken(Admin admin, String refreshToken) { if(!admin.getRefreshToken().equals(refreshToken)) { - throw new AdminFailureException(INVALID_TOKEN); + throw new AdminFailureException(INVALID_REFRESH_TOKEN); } } From c9c0cd1c77a872fc446472fd960f83b448b1f420 Mon Sep 17 00:00:00 2001 From: dragontaek-lee Date: Sat, 10 Feb 2024 22:54:40 +0900 Subject: [PATCH 102/141] =?UTF-8?q?[FIX]=20=EC=BB=A4=EC=8A=A4=ED=85=80=20j?= =?UTF-8?q?wt=20filter=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../makers/operation/config/SecurityConfig.java | 11 +++++------ .../operation/filter/JwtAuthenticationFilter.java | 8 +++++--- .../makers/operation/filter/JwtExceptionFilter.java | 10 ++++------ .../sopt/makers/operation/jwt/JwtTokenProvider.java | 13 ++++++++----- 4 files changed, 22 insertions(+), 20 deletions(-) diff --git a/operation-auth/src/main/java/org/sopt/makers/operation/config/SecurityConfig.java b/operation-auth/src/main/java/org/sopt/makers/operation/config/SecurityConfig.java index bfec89f8..567c4d67 100644 --- a/operation-auth/src/main/java/org/sopt/makers/operation/config/SecurityConfig.java +++ b/operation-auth/src/main/java/org/sopt/makers/operation/config/SecurityConfig.java @@ -25,7 +25,7 @@ public class SecurityConfig { private final JwtAuthenticationFilter jwtAuthenticationFilter; private final JwtExceptionFilter jwtExceptionFilter; - //private final ValueConfig valueConfig; + private final ValueConfig valueConfig; @Bean public static PasswordEncoder passwordEncoder() { @@ -55,8 +55,7 @@ private void setHttp(HttpSecurity http) throws Exception { .and() .authorizeHttpRequests(authorizeHttpRequests -> authorizeHttpRequests - .requestMatchers(new AntPathRequestMatcher("/api/v1/auth", "POST")).permitAll() - .requestMatchers(new AntPathRequestMatcher("/api/v1/test", "GET")).permitAll() + .requestMatchers(new AntPathRequestMatcher("/api/v1/auth/*")).permitAll() .requestMatchers(new AntPathRequestMatcher("/error")).permitAll() .anyRequest().authenticated()) .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS) @@ -69,9 +68,9 @@ private void setHttp(HttpSecurity http) throws Exception { public CorsConfigurationSource corsConfigurationSource() { val configuration = new CorsConfiguration(); - //configuration.addAllowedOrigin(valueConfig.getADMIN_PROD_URL()); - //configuration.addAllowedOrigin(valueConfig.getADMIN_DEV_URL()); - //configuration.addAllowedOrigin(valueConfig.getADMIN_LOCAL_URL()); + configuration.addAllowedOrigin(valueConfig.getADMIN_PROD_URL()); + configuration.addAllowedOrigin(valueConfig.getADMIN_DEV_URL()); + configuration.addAllowedOrigin(valueConfig.getADMIN_LOCAL_URL()); configuration.addAllowedHeader("*"); configuration.addAllowedMethod("*"); configuration.setAllowCredentials(true); diff --git a/operation-auth/src/main/java/org/sopt/makers/operation/filter/JwtAuthenticationFilter.java b/operation-auth/src/main/java/org/sopt/makers/operation/filter/JwtAuthenticationFilter.java index 57e74c8a..eed6ec00 100644 --- a/operation-auth/src/main/java/org/sopt/makers/operation/filter/JwtAuthenticationFilter.java +++ b/operation-auth/src/main/java/org/sopt/makers/operation/filter/JwtAuthenticationFilter.java @@ -1,11 +1,14 @@ package org.sopt.makers.operation.filter; +import static org.sopt.makers.operation.code.failure.TokenFailureCode.*; + import jakarta.servlet.FilterChain; import jakarta.servlet.ServletException; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; import lombok.RequiredArgsConstructor; import lombok.val; +import org.sopt.makers.operation.exception.TokenException; import org.sopt.makers.operation.jwt.JwtTokenProvider; import org.sopt.makers.operation.jwt.JwtTokenType; import org.springframework.security.core.context.SecurityContextHolder; @@ -23,8 +26,7 @@ public class JwtAuthenticationFilter extends OncePerRequestFilter { private final JwtTokenProvider jwtTokenProvider; @Override - public void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) - throws IOException, ServletException { + public void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException { val uri = request.getRequestURI(); if ((uri.startsWith("/api/v1")) && !uri.contains("auth")) { @@ -44,7 +46,7 @@ public void doFilterInternal(HttpServletRequest request, HttpServletResponse res private void checkJwtAvailable (String token, JwtTokenType jwtTokenType) { if (token == null || !jwtTokenProvider.validateTokenExpiration(token, jwtTokenType)) { - throw new IllegalArgumentException("빈 토큰입니다."); + throw new TokenException(EMPTY_TOKEN); } } diff --git a/operation-auth/src/main/java/org/sopt/makers/operation/filter/JwtExceptionFilter.java b/operation-auth/src/main/java/org/sopt/makers/operation/filter/JwtExceptionFilter.java index 3ec3e421..a0517f11 100644 --- a/operation-auth/src/main/java/org/sopt/makers/operation/filter/JwtExceptionFilter.java +++ b/operation-auth/src/main/java/org/sopt/makers/operation/filter/JwtExceptionFilter.java @@ -1,8 +1,6 @@ package org.sopt.makers.operation.filter; -import static org.sopt.makers.operation.code.failure.admin.AdminFailureCode.*; - -import org.sopt.makers.operation.code.failure.admin.AdminFailureCode; +import org.sopt.makers.operation.code.failure.FailureCode; import org.sopt.makers.operation.dto.BaseResponse; import org.sopt.makers.operation.exception.TokenException; import org.sopt.makers.operation.util.ApiResponseUtil; @@ -33,7 +31,7 @@ protected void doFilterInternal(HttpServletRequest httpServletRequest, filterChain.doFilter(httpServletRequest, httpServletResponse); } catch(TokenException e) { val objectMapper = new ObjectMapper(); - val jsonResponse = objectMapper.writeValueAsString(getFailureResponse()); + val jsonResponse = objectMapper.writeValueAsString(getFailureResponse(e.getFailureCode())); httpServletResponse.setStatus(HttpStatus.UNAUTHORIZED.value()); httpServletResponse.setContentType(MediaType.APPLICATION_JSON_VALUE); @@ -42,7 +40,7 @@ protected void doFilterInternal(HttpServletRequest httpServletRequest, } } - private ResponseEntity> getFailureResponse() { - return ApiResponseUtil.failure(INVALID_TOKEN); + private ResponseEntity> getFailureResponse(FailureCode failureCode) { + return ApiResponseUtil.failure(failureCode); } } \ No newline at end of file diff --git a/operation-auth/src/main/java/org/sopt/makers/operation/jwt/JwtTokenProvider.java b/operation-auth/src/main/java/org/sopt/makers/operation/jwt/JwtTokenProvider.java index e7fc7a1d..ae249d01 100644 --- a/operation-auth/src/main/java/org/sopt/makers/operation/jwt/JwtTokenProvider.java +++ b/operation-auth/src/main/java/org/sopt/makers/operation/jwt/JwtTokenProvider.java @@ -1,5 +1,7 @@ package org.sopt.makers.operation.jwt; +import static org.sopt.makers.operation.code.failure.TokenFailureCode.*; + import io.jsonwebtoken.Claims; import io.jsonwebtoken.ExpiredJwtException; import io.jsonwebtoken.Jwts; @@ -9,6 +11,7 @@ import lombok.RequiredArgsConstructor; import lombok.val; import org.sopt.makers.operation.authentication.AdminAuthentication; +import org.sopt.makers.operation.exception.TokenException; import org.springframework.beans.factory.annotation.Value; import org.springframework.security.core.Authentication; import org.springframework.stereotype.Service; @@ -85,8 +88,8 @@ public Long getPlayGroundId(String token, JwtTokenType jwtTokenType) { val claims = getClaimsFromToken(token, jwtTokenType); return Long.parseLong(claims.get("playgroundId").toString()); - } catch (ExpiredJwtException | SignatureException ignored) { - throw new RuntimeException("유효하지 않은 토큰입니다."); + } catch (ExpiredJwtException | SignatureException e) { + throw new TokenException(INVALID_TOKEN); } } @@ -95,8 +98,8 @@ public Long getId(String token, JwtTokenType jwtTokenType) { val claims = getClaimsFromToken(token, jwtTokenType); return Long.parseLong(claims.getSubject()); - } catch (ExpiredJwtException | SignatureException ignored) { - throw new RuntimeException("유효하지 않은 토큰입니다."); + } catch (ExpiredJwtException | SignatureException e) { + throw new TokenException(INVALID_TOKEN); } } @@ -135,7 +138,7 @@ private LocalDateTime setExpireTime(LocalDateTime now, JwtTokenType jwtTokenType return switch (jwtTokenType) { case ACCESS_TOKEN -> now.plusHours(5); case REFRESH_TOKEN -> now.plusWeeks(2); - case APP_ACCESS_TOKEN -> null; + case APP_ACCESS_TOKEN -> throw new TokenException(INVALID_TOKEN); }; } From ea16d01a46c7120f6351e465e77578c264a5c6d3 Mon Sep 17 00:00:00 2001 From: dragontaek-lee Date: Sat, 10 Feb 2024 23:08:13 +0900 Subject: [PATCH 103/141] =?UTF-8?q?[FIX]=20swagger=20config=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/sopt/makers/operation/config/SecurityConfig.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/operation-auth/src/main/java/org/sopt/makers/operation/config/SecurityConfig.java b/operation-auth/src/main/java/org/sopt/makers/operation/config/SecurityConfig.java index 567c4d67..b3786a58 100644 --- a/operation-auth/src/main/java/org/sopt/makers/operation/config/SecurityConfig.java +++ b/operation-auth/src/main/java/org/sopt/makers/operation/config/SecurityConfig.java @@ -36,7 +36,9 @@ public static PasswordEncoder passwordEncoder() { @Profile("dev") public SecurityFilterChain filterChainDev(HttpSecurity http) throws Exception { http.authorizeHttpRequests(authorizeHttpRequests -> authorizeHttpRequests - .requestMatchers(new AntPathRequestMatcher("/swagger-ui/**")).permitAll()); + .requestMatchers(new AntPathRequestMatcher("/swagger-ui/**")).permitAll() + .requestMatchers(new AntPathRequestMatcher("/v3/**")).permitAll() + ); setHttp(http); return http.build(); } From 2b7e00c28cf6a93f1aab8b184efec338d75743f0 Mon Sep 17 00:00:00 2001 From: dragontaek-lee Date: Sat, 10 Feb 2024 23:11:02 +0900 Subject: [PATCH 104/141] =?UTF-8?q?[FIX]=20swagger=20=EC=A0=9C=EB=AA=A9,?= =?UTF-8?q?=EC=84=A4=EB=AA=85=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sopt/makers/operation/common/config/SwaggerConfig.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/operation-api/src/main/java/org/sopt/makers/operation/common/config/SwaggerConfig.java b/operation-api/src/main/java/org/sopt/makers/operation/common/config/SwaggerConfig.java index ebed88c3..8d8c0134 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/common/config/SwaggerConfig.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/common/config/SwaggerConfig.java @@ -20,9 +20,9 @@ public class SwaggerConfig { @Bean public OpenAPI api() { Info info = new Info() - .title("Doorip API Docs") - .version("v1.0") - .description("Doorip 서비스 API 명세서 입니다."); + .title("Makers Operation API Docs") + .version("v2.0") + .description("운영 프로덕트 API 명세서 입니다."); return new OpenAPI() .info(info); } From f103a0f441ffb48e494a040ca079cd767156267e Mon Sep 17 00:00:00 2001 From: thguss Date: Mon, 12 Feb 2024 22:55:10 +0900 Subject: [PATCH 105/141] =?UTF-8?q?[FIX]=20=EC=84=A4=EC=A0=95=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=20=EA=B2=BD=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/cd-dev.yml | 7 ++++--- .github/workflows/cd-prod.yml | 7 ++++--- .github/workflows/ci.yml | 7 ++++--- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.github/workflows/cd-dev.yml b/.github/workflows/cd-dev.yml index e44e7089..44d549ad 100644 --- a/.github/workflows/cd-dev.yml +++ b/.github/workflows/cd-dev.yml @@ -26,9 +26,10 @@ jobs: - name: Create application.yml run: | pwd - touch ./module-api/src/main/resources/application-dev.yml - echo "${{ secrets.APPLICATION_DEV }}" >> src/main/resources/application-dev.yml - cat src/main/resources/application-dev.yml + cd ./operation-api/src/main/resources + touch ./application-dev.yml + echo "${{ secrets.APPLICATION_DEV }}" >> ./application-dev.yml + cat ./application-dev.yml - name: Build with Gradle run: ./gradlew build diff --git a/.github/workflows/cd-prod.yml b/.github/workflows/cd-prod.yml index fcf8f2db..19038e1c 100644 --- a/.github/workflows/cd-prod.yml +++ b/.github/workflows/cd-prod.yml @@ -26,9 +26,10 @@ jobs: - name: Create application.yml run: | pwd - touch src/main/resources/application-prod.yml - echo "${{ secrets.APPLICATION_PROD }}" >> src/main/resources/application-prod.yml - cat src/main/resources/application-prod.yml + cd ./operation-api/src/main/resources + touch ./application-prod.yml + echo "${{ secrets.APPLICATION_PROD }}" >> ./application-prod.yml + cat ./application-prod.yml - name: Build with Gradle run: ./gradlew build diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3120e8b6..32b14339 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,9 +26,10 @@ jobs: - name: Create application.yml run: | pwd - touch src/main/resources/application-dev.yml - echo "${{ secrets.APPLICATION_DEV }}" >> src/main/resources/application-dev.yml - cat src/main/resources/application-dev.yml + cd ./operation-api/src/main/resources + touch ./application-dev.yml + echo "${{ secrets.APPLICATION_DEV }}" >> ./application-dev.yml + cat ./application-dev.yml - name: Build with Gradle run: ./gradlew build From 868becb2aaf55fe9b04c5f2de28b12b5574266be Mon Sep 17 00:00:00 2001 From: thguss Date: Mon, 12 Feb 2024 22:58:07 +0900 Subject: [PATCH 106/141] =?UTF-8?q?[ADD]=20jar=20=EC=98=B5=EC=85=98=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/build.gradle b/build.gradle index d5421610..a8f27535 100644 --- a/build.gradle +++ b/build.gradle @@ -44,4 +44,12 @@ allprojects { tasks.named('test') { useJUnitPlatform() } +} + +jar { + enabled = true +} + +bootJar { + enabled = false } \ No newline at end of file From 5f9bec39091f05733cc216a2963a305224a8b899 Mon Sep 17 00:00:00 2001 From: thguss Date: Thu, 15 Feb 2024 11:13:38 +0900 Subject: [PATCH 107/141] =?UTF-8?q?[REFACTOR]=20api=20=EB=AA=A8=EB=93=88?= =?UTF-8?q?=20=EB=A6=AC=ED=8C=A9=ED=86=A0=EB=A7=81=20(web(admin-x),=20app-?= =?UTF-8?q?schedule)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../schedule/api/ScheduleApiController.java | 5 +- .../dto/response/ScheduleListGetResponse.java | 68 ++++++++ .../dto/response/ScheduleListResponse.java | 58 ------- .../app/schedule/service/ScheduleService.java | 4 +- .../schedule/service/ScheduleServiceImpl.java | 62 ++++--- .../operation/web/alarm/api/AlarmApi.java | 34 ++-- .../web/alarm/api/AlarmApiController.java | 10 +- ...rmRequest.java => AlarmCreateRequest.java} | 3 +- .../dto/response/AlarmCreateResponse.java | 19 +++ ...armResponse.java => AlarmGetResponse.java} | 15 +- ...esponse.java => AlarmListGetResponse.java} | 29 ++-- .../web/alarm/service/AlarmService.java | 15 +- .../web/alarm/service/AlarmServiceImpl.java | 128 +++++++------- .../web/attendnace/api/WebAttendanceApi.java | 4 +- .../api/WebAttendanceApiController.java | 10 +- ...t.java => SubAttendanceUpdateRequest.java} | 2 +- ...> AttendanceListByLectureGetResponse.java} | 37 ++-- .../AttendanceListByMemberGetResponse.java | 67 ++++++++ .../response/AttendanceMemberResponse.java | 55 ------ .../response/MemberScoreUpdateResponse.java | 19 +++ ....java => SubAttendanceUpdateResponse.java} | 12 +- .../service/WebAttendanceService.java | 17 +- .../service/WebAttendanceServiceImpl.java | 49 +++--- .../web/lecture/api/WebLectureApi.java | 8 +- .../lecture/api/WebLectureApiController.java | 14 +- ...Request.java => LectureCreateRequest.java} | 5 +- ...quest.java => SubLectureStartRequest.java} | 2 +- ...java => AttendanceStatusListResponse.java} | 9 +- .../dto/response/LectureCreateResponse.java | 19 +++ ...nse.java => LectureDetailGetResponse.java} | 13 +- ...eResponse.java => LectureGetResponse.java} | 31 ++-- ...ponse.java => LectureListGetResponse.java} | 30 ++-- ...onse.java => SubLectureStartResponse.java} | 14 +- .../lecture/service/WebLectureService.java | 23 +-- .../service/WebLectureServiceImpl.java | 161 ++++++++---------- .../web/member/api/WebMemberApi.java | 4 +- .../member/api/WebMemberApiController.java | 4 +- ...sponse.java => MemberListGetResponse.java} | 36 ++-- .../web/member/service/WebMemberService.java | 4 +- .../member/service/WebMemberServiceImpl.java | 8 +- .../code/failure/AlarmFailureCode.java | 1 + .../makers/operation/config/ValueConfig.java | 8 + .../makers/operation/dto/BaseResponse.java | 4 +- .../makers/operation/alarm/domain/Alarm.java | 9 +- .../operation/lecture/domain/SubLecture.java | 4 +- .../lecture/LectureCustomRepository.java | 3 +- .../lecture/LectureRepositoryImpl.java | 13 +- .../repository/ScheduleCustomRepository.java | 2 +- .../repository/ScheduleRepositoryImpl.java | 10 +- .../client/playground/PlayGroundServer.java | 4 +- .../playground/PlayGroundServerImpl.java | 25 +-- ...sponse.java => MemberListGetResponse.java} | 2 +- 52 files changed, 653 insertions(+), 539 deletions(-) create mode 100644 operation-api/src/main/java/org/sopt/makers/operation/app/schedule/dto/response/ScheduleListGetResponse.java delete mode 100644 operation-api/src/main/java/org/sopt/makers/operation/app/schedule/dto/response/ScheduleListResponse.java rename operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/request/{AlarmRequest.java => AlarmCreateRequest.java} (95%) create mode 100644 operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/response/AlarmCreateResponse.java rename operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/response/{AlarmResponse.java => AlarmGetResponse.java} (71%) rename operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/response/{AlarmListResponse.java => AlarmListGetResponse.java} (60%) rename operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/request/{UpdatedSubAttendanceRequest.java => SubAttendanceUpdateRequest.java} (81%) rename operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/{AttendanceListResponse.java => AttendanceListByLectureGetResponse.java} (63%) create mode 100644 operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/AttendanceListByMemberGetResponse.java delete mode 100644 operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/AttendanceMemberResponse.java create mode 100644 operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/MemberScoreUpdateResponse.java rename operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/{UpdatedSubAttendanceResponse.java => SubAttendanceUpdateResponse.java} (61%) rename operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/request/{LectureRequest.java => LectureCreateRequest.java} (92%) rename operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/request/{AttendanceRequest.java => SubLectureStartRequest.java} (73%) rename operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/{AttendanceStatusListVO.java => AttendanceStatusListResponse.java} (81%) create mode 100644 operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureCreateResponse.java rename operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/{LectureDetailResponse.java => LectureDetailGetResponse.java} (72%) rename operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/{LectureResponse.java => LectureGetResponse.java} (68%) rename operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/{LectureListResponse.java => LectureListGetResponse.java} (60%) rename operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/{AttendanceResponse.java => SubLectureStartResponse.java} (52%) rename operation-api/src/main/java/org/sopt/makers/operation/web/member/dto/response/{MemberListResponse.java => MemberListGetResponse.java} (60%) rename operation-external/src/main/java/org/sopt/makers/operation/client/playground/dto/{InactiveMemberListResponse.java => MemberListGetResponse.java} (72%) diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/schedule/api/ScheduleApiController.java b/operation-api/src/main/java/org/sopt/makers/operation/app/schedule/api/ScheduleApiController.java index 9d608cfd..542ce85c 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/app/schedule/api/ScheduleApiController.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/schedule/api/ScheduleApiController.java @@ -1,6 +1,7 @@ package org.sopt.makers.operation.app.schedule.api; import static org.sopt.makers.operation.code.success.app.ScheduleSuccessCode.*; +import static org.springframework.format.annotation.DateTimeFormat.ISO.*; import java.time.LocalDateTime; @@ -27,8 +28,8 @@ public class ScheduleApiController implements ScheduleApi { @Override @GetMapping public ResponseEntity> getSchedules( - @RequestParam @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDateTime start, - @RequestParam @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDateTime end + @RequestParam @DateTimeFormat(iso = DATE_TIME) LocalDateTime start, + @RequestParam @DateTimeFormat(iso = DATE_TIME) LocalDateTime end ) { val response = scheduleService.getSchedules(start, end); return ApiResponseUtil.success(SUCCESS_GET_SCHEDULES, response); diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/schedule/dto/response/ScheduleListGetResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/app/schedule/dto/response/ScheduleListGetResponse.java new file mode 100644 index 00000000..c2f38087 --- /dev/null +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/schedule/dto/response/ScheduleListGetResponse.java @@ -0,0 +1,68 @@ +package org.sopt.makers.operation.app.schedule.dto.response; + +import static java.time.format.TextStyle.*; +import static java.util.Locale.*; +import static lombok.AccessLevel.*; + +import java.time.LocalDate; +import java.util.List; +import java.util.Map; + +import org.sopt.makers.operation.lecture.domain.Attribute; +import org.sopt.makers.operation.schedule.domain.Schedule; + +import lombok.Builder; + +@Builder(access = PRIVATE) +public record ScheduleListGetResponse( + List dates +) { + + public static ScheduleListGetResponse of(Map> scheduleMap) { + return ScheduleListGetResponse.builder() + .dates(getDates(scheduleMap)) + .build(); + } + + private static List getDates(Map> scheduleMap) { + return scheduleMap.keySet().stream().sorted() + .map(key -> DateResponse.of(key, scheduleMap.get(key))) + .toList(); + } + + @Builder(access = PRIVATE) + record DateResponse( + String date, + String dayOfWeek, + List schedules + ) { + + private static DateResponse of(LocalDate date, List schedules) { + return DateResponse.builder() + .date(date.toString()) + .dayOfWeek(date.getDayOfWeek().getDisplayName(SHORT, KOREAN)) + .schedules(schedules.stream().map(ScheduleResponse::of).toList()) + .build(); + } + } + + @Builder(access = PRIVATE) + record ScheduleResponse( + long scheduleId, + String startDate, + String endDate, + Attribute attribute, + String title + ) { + + private static ScheduleResponse of(Schedule schedule) { + return ScheduleResponse.builder() + .scheduleId(schedule.getId()) + .startDate(schedule.getStartDate().toString()) + .endDate(schedule.getEndDate().toString()) + .attribute(schedule.getAttribute()) + .title(schedule.getTitle()) + .build(); + } + } +} diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/schedule/dto/response/ScheduleListResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/app/schedule/dto/response/ScheduleListResponse.java deleted file mode 100644 index a7f3f4f1..00000000 --- a/operation-api/src/main/java/org/sopt/makers/operation/app/schedule/dto/response/ScheduleListResponse.java +++ /dev/null @@ -1,58 +0,0 @@ -package org.sopt.makers.operation.app.schedule.dto.response; - -import java.time.LocalDate; -import java.time.format.TextStyle; -import java.util.List; -import java.util.Locale; -import java.util.Map; - -import org.sopt.makers.operation.lecture.domain.Attribute; -import org.sopt.makers.operation.schedule.domain.Schedule; - -import lombok.Builder; - -public record ScheduleListResponse( - List dates -) { - public static ScheduleListResponse of(Map> scheduleMap) { - return new ScheduleListResponse( - scheduleMap.keySet().stream().sorted() - .map(key -> DateVO.of(key, scheduleMap.get(key))) - .toList() - ); - } - - @Builder - record DateVO( - String date, - String dayOfWeek, - List schedules - ) { - static DateVO of(LocalDate date, List schedules) { - return DateVO.builder() - .date(date.toString()) - .dayOfWeek(date.getDayOfWeek().getDisplayName(TextStyle.SHORT, Locale.KOREAN)) - .schedules(schedules.stream().map(ScheduleVO::of).toList()) - .build(); - } - } - - @Builder - record ScheduleVO( - Long scheduleId, - String startDate, - String endDate, - Attribute attribute, - String title - ) { - static ScheduleVO of(Schedule schedule) { - return ScheduleVO.builder() - .scheduleId(schedule.getId()) - .startDate(schedule.getStartDate().toString()) - .endDate(schedule.getEndDate().toString()) - .attribute(schedule.getAttribute()) - .title(schedule.getTitle()) - .build(); - } - } -} diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/schedule/service/ScheduleService.java b/operation-api/src/main/java/org/sopt/makers/operation/app/schedule/service/ScheduleService.java index 1fdc193e..3f84203a 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/app/schedule/service/ScheduleService.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/schedule/service/ScheduleService.java @@ -2,8 +2,8 @@ import java.time.LocalDateTime; -import org.sopt.makers.operation.app.schedule.dto.response.ScheduleListResponse; +import org.sopt.makers.operation.app.schedule.dto.response.ScheduleListGetResponse; public interface ScheduleService { - ScheduleListResponse getSchedules(LocalDateTime start, LocalDateTime end); + ScheduleListGetResponse getSchedules(LocalDateTime startAt, LocalDateTime endAt); } diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/schedule/service/ScheduleServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/app/schedule/service/ScheduleServiceImpl.java index e9b71ea0..74cb962b 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/app/schedule/service/ScheduleServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/schedule/service/ScheduleServiceImpl.java @@ -1,21 +1,23 @@ package org.sopt.makers.operation.app.schedule.service; +import static java.time.temporal.ChronoUnit.*; import static org.sopt.makers.operation.code.failure.ScheduleFailureCode.*; import java.time.Duration; import java.time.LocalDate; import java.time.LocalDateTime; -import java.time.temporal.ChronoUnit; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.stream.Collectors; import java.util.stream.IntStream; +import java.util.stream.Stream; +import org.sopt.makers.operation.config.ValueConfig; import org.sopt.makers.operation.schedule.domain.Schedule; import org.sopt.makers.operation.schedule.repository.ScheduleRepository; import org.sopt.makers.operation.exception.ScheduleException; -import org.sopt.makers.operation.app.schedule.dto.response.ScheduleListResponse; +import org.sopt.makers.operation.app.schedule.dto.response.ScheduleListGetResponse; import org.springframework.stereotype.Service; import lombok.RequiredArgsConstructor; @@ -27,20 +29,26 @@ public class ScheduleServiceImpl implements ScheduleService { private final ScheduleRepository scheduleRepository; + private final ValueConfig valueConfig; + @Override - public ScheduleListResponse getSchedules(LocalDateTime start, LocalDateTime end) { - val scheduleList = scheduleRepository.findBetweenStartAndEnd(start, end); - val scheduleMap = classifiedByDate(scheduleList, start, end); - return ScheduleListResponse.of(scheduleMap); + public ScheduleListGetResponse getSchedules(LocalDateTime startAt, LocalDateTime endAt) { + val schedules = scheduleRepository.findBetween(startAt, endAt); + val scheduleMap = getClassifiedMap(schedules, startAt, endAt); + return ScheduleListGetResponse.of(scheduleMap); } - private Map> classifiedByDate(List schedules, LocalDateTime startAt, LocalDateTime endAt) { - val scheduleMap = initScheduleMap(startAt, endAt); - schedules.forEach(schedule -> putScheduleMap(scheduleMap, schedule)); + private Map> getClassifiedMap( + List schedules, + LocalDateTime startAt, + LocalDateTime endAt + ) { + val scheduleMap = getInitializedMap(startAt, endAt); + schedules.forEach(schedule -> putScheduleToMap(scheduleMap, schedule)); return scheduleMap; } - private Map> initScheduleMap(LocalDateTime startAt, LocalDateTime endAt) { + private Map> getInitializedMap(LocalDateTime startAt, LocalDateTime endAt) { //TODO: 클라이언트 개발 시간 리소스 절약을 위해 해당 메소드 활용, 가능한 일정이 존재하는 날짜만 key로 가지는 HashMap로 변경 요망 val duration = getDuration(startAt, endAt); return IntStream.range(0, duration) @@ -50,32 +58,38 @@ private Map> initScheduleMap(LocalDateTime startAt, Lo private int getDuration(LocalDateTime startAt, LocalDateTime endAt) { val duration = Duration.between(startAt, endAt).toDays() + 1; - validDuration(duration); - return (int)duration; - } + val minDuration = valueConfig.getMIN_SCHEDULE_DURATION(); + val maxDuration = valueConfig.getMAX_SCHEDULE_DURATION(); - private void validDuration(long duration) { - //TODO: 추후 응답 값 형식 변경 후 삭제될 수 있는 메소드 - if (duration <= 0|| duration > 50) { + if (duration < minDuration || duration > maxDuration) { throw new ScheduleException(INVALID_DATE_PERM); } + + return (int)duration; } - private void putScheduleMap(Map> scheduleMap, Schedule schedule) { - val duration = ChronoUnit.DAYS.between(schedule.getStartDate(), schedule.getEndDate()); + private void putScheduleToMap(Map> scheduleMap, Schedule schedule) { + val duration = DAYS.between(schedule.getStartDate(), schedule.getEndDate()); + val dayDuration = valueConfig.getDAY_DURATION(); + val twoDaysDuration = valueConfig.getTWO_DAYS_DURATION(); + scheduleMap.computeIfAbsent(schedule.getStartDate().toLocalDate(), k -> new ArrayList<>()).add(schedule); - if (duration >= 1) { + + if (duration >= dayDuration) { scheduleMap.computeIfAbsent(schedule.getEndDate().toLocalDate(), k -> new ArrayList<>()).add(schedule); - if (duration >= 2) { + if (duration >= twoDaysDuration) { putScheduleMapBetween(scheduleMap, schedule, (int)duration); } } } private void putScheduleMapBetween(Map> scheduleMap, Schedule schedule, int duration) { - for (int i = 1; i < duration; i++) { - val date = schedule.getStartDate().plusDays(i).toLocalDate(); - scheduleMap.computeIfAbsent(date, k -> new ArrayList<>()).add(schedule); - } + Stream.iterate(1, i -> i + 1).limit(duration - 1) + .forEach(i -> putScheduleAtDayCount(scheduleMap, schedule, i)); + } + + private void putScheduleAtDayCount(Map> scheduleMap, Schedule schedule, int dayCount) { + val date = schedule.getStartDate().plusDays(dayCount).toLocalDate(); + scheduleMap.computeIfAbsent(date, k -> new ArrayList<>()).add(schedule); } } diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/api/AlarmApi.java b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/api/AlarmApi.java index 7c6c7019..b0052754 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/api/AlarmApi.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/api/AlarmApi.java @@ -3,7 +3,7 @@ import org.sopt.makers.operation.common.domain.Part; import org.sopt.makers.operation.dto.BaseResponse; import org.sopt.makers.operation.alarm.domain.Status; -import org.sopt.makers.operation.web.alarm.dto.request.AlarmRequest; +import org.sopt.makers.operation.web.alarm.dto.request.AlarmCreateRequest; import org.sopt.makers.operation.web.alarm.dto.request.AlarmSendRequest; import org.springframework.data.domain.Pageable; import org.springframework.http.ResponseEntity; @@ -25,7 +25,19 @@ public interface AlarmApi { ), @ApiResponse( responseCode = "400", - description = "잘못된 요청" + description = "알림 전송에 실패하였습니다." + ), + @ApiResponse( + responseCode = "400", + description = "전송된 알림입니다." + ), + @ApiResponse( + responseCode = "400", + description = "비활동 유저 불러오기에 실패하였습니다." + ), + @ApiResponse( + responseCode = "404", + description = "알림이 존재하지 않습니다." ), @ApiResponse( responseCode = "500", @@ -42,17 +54,13 @@ public interface AlarmApi { responseCode = "200", description = "알림 생성 성공" ), - @ApiResponse( - responseCode = "400", - description = "잘못된 요청" - ), @ApiResponse( responseCode = "500", description = "서버 내부 오류" ) } ) - ResponseEntity> createAlarm(@RequestBody AlarmRequest request); + ResponseEntity> createAlarm(@RequestBody AlarmCreateRequest request); @Operation( summary = "알림 리스트 조회 API", @@ -61,10 +69,6 @@ public interface AlarmApi { responseCode = "200", description = "알림 리스트 조회 성공" ), - @ApiResponse( - responseCode = "400", - description = "잘못된 요청" - ), @ApiResponse( responseCode = "500", description = "서버 내부 오류" @@ -86,8 +90,8 @@ ResponseEntity> getAlarms( description = "알림 상세 조회 성공" ), @ApiResponse( - responseCode = "400", - description = "잘못된 요청" + responseCode = "404", + description = "알림이 존재하지 않습니다." ), @ApiResponse( responseCode = "500", @@ -105,8 +109,8 @@ ResponseEntity> getAlarms( description = "알림 삭제 성공" ), @ApiResponse( - responseCode = "400", - description = "잘못된 요청" + responseCode = "404", + description = "알림이 존재하지 않습니다." ), @ApiResponse( responseCode = "500", diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/api/AlarmApiController.java b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/api/AlarmApiController.java index b4a22223..88c1523c 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/api/AlarmApiController.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/api/AlarmApiController.java @@ -6,7 +6,7 @@ import org.sopt.makers.operation.dto.BaseResponse; import org.sopt.makers.operation.util.ApiResponseUtil; import org.sopt.makers.operation.alarm.domain.Status; -import org.sopt.makers.operation.web.alarm.dto.request.AlarmRequest; +import org.sopt.makers.operation.web.alarm.dto.request.AlarmCreateRequest; import org.sopt.makers.operation.web.alarm.dto.request.AlarmSendRequest; import org.sopt.makers.operation.web.alarm.service.AlarmService; import org.springframework.data.domain.Pageable; @@ -32,15 +32,15 @@ public class AlarmApiController implements AlarmApi { @Override @PostMapping("/send") public ResponseEntity> sendAlarm(AlarmSendRequest request) { - alarmService.sendByAdmin(request); + alarmService.sendAlarm(request); return ApiResponseUtil.success(SUCCESS_SEND_ALARM); } @Override @PostMapping - public ResponseEntity> createAlarm(AlarmRequest request) { - val response = alarmService.createAlarm(request); - return ApiResponseUtil.success(SUCCESS_CREATE_ALARM, response); + public ResponseEntity> createAlarm(AlarmCreateRequest request) { + val response = alarmService.saveAlarm(request); + return ApiResponseUtil.success(SUCCESS_CREATE_ALARM, response.alarmId()); } @Override diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/request/AlarmRequest.java b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/request/AlarmCreateRequest.java similarity index 95% rename from operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/request/AlarmRequest.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/request/AlarmCreateRequest.java index 68281b55..d2ad0347 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/request/AlarmRequest.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/request/AlarmCreateRequest.java @@ -6,7 +6,7 @@ import org.sopt.makers.operation.alarm.domain.Alarm; import org.sopt.makers.operation.alarm.domain.Attribute; -public record AlarmRequest( +public record AlarmCreateRequest( int generation, int generationAt, Attribute attribute, @@ -17,6 +17,7 @@ public record AlarmRequest( Part part, List targetList ) { + public Alarm toEntity() { return Alarm.builder() .generation(this.generation) diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/response/AlarmCreateResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/response/AlarmCreateResponse.java new file mode 100644 index 00000000..d6e237c2 --- /dev/null +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/response/AlarmCreateResponse.java @@ -0,0 +1,19 @@ +package org.sopt.makers.operation.web.alarm.dto.response; + +import static lombok.AccessLevel.*; + +import org.sopt.makers.operation.alarm.domain.Alarm; + +import lombok.Builder; + +@Builder(access = PRIVATE) +public record AlarmCreateResponse( + long alarmId +) { + + public static AlarmCreateResponse of(Alarm alarm) { + return AlarmCreateResponse.builder() + .alarmId(alarm.getId()) + .build(); + } +} diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/response/AlarmResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/response/AlarmGetResponse.java similarity index 71% rename from operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/response/AlarmResponse.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/response/AlarmGetResponse.java index d7bb25f0..56fe9ec2 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/response/AlarmResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/response/AlarmGetResponse.java @@ -1,27 +1,34 @@ package org.sopt.makers.operation.web.alarm.dto.response; +import static com.fasterxml.jackson.annotation.JsonInclude.Include.*; import static java.util.Objects.*; +import static lombok.AccessLevel.*; import java.time.LocalDateTime; import org.sopt.makers.operation.common.domain.Part; import org.sopt.makers.operation.alarm.domain.Alarm; +import com.fasterxml.jackson.annotation.JsonInclude; + import lombok.Builder; -@Builder -public record AlarmResponse( +@Builder(access = PRIVATE) +public record AlarmGetResponse( String attribute, + @JsonInclude(value = NON_NULL) String part, Boolean isActive, String title, String content, String link, String createdAt, + @JsonInclude(value = NON_NULL) String sendAt ) { - public static AlarmResponse of(Alarm alarm) { - return AlarmResponse.builder() + + public static AlarmGetResponse of(Alarm alarm) { + return AlarmGetResponse.builder() .attribute(alarm.getAttribute().getName()) .part(getPartName(alarm.getPart())) .isActive(alarm.getIsActive()) diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/response/AlarmListResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/response/AlarmListGetResponse.java similarity index 60% rename from operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/response/AlarmListResponse.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/response/AlarmListGetResponse.java index 24841c70..c37b31e8 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/response/AlarmListResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/dto/response/AlarmListGetResponse.java @@ -1,6 +1,8 @@ package org.sopt.makers.operation.web.alarm.dto.response; +import static com.fasterxml.jackson.annotation.JsonInclude.Include.*; import static java.util.Objects.*; +import static lombok.AccessLevel.*; import java.time.LocalDateTime; import java.util.List; @@ -8,33 +10,38 @@ import org.sopt.makers.operation.common.domain.Part; import org.sopt.makers.operation.alarm.domain.Alarm; -import lombok.AccessLevel; +import com.fasterxml.jackson.annotation.JsonInclude; + import lombok.Builder; -@Builder(access = AccessLevel.PRIVATE) -public record AlarmListResponse( - List alarms, +@Builder(access = PRIVATE) +public record AlarmListGetResponse( + List alarms, int totalCount ) { - public static AlarmListResponse of(List alarmList, int totalCount) { - return AlarmListResponse.builder() - .alarms(alarmList.stream().map(AlarmVO::of).toList()) + + public static AlarmListGetResponse of(List alarmList, int totalCount) { + return AlarmListGetResponse.builder() + .alarms(alarmList.stream().map(AlarmResponse::of).toList()) .totalCount(totalCount) .build(); } - @Builder - private record AlarmVO( + @Builder(access = PRIVATE) + private record AlarmResponse( long alarmId, + @JsonInclude(value = NON_NULL) String part, String attribute, String title, String content, + @JsonInclude(value = NON_NULL) String sendAt, String status ) { - private static AlarmVO of(Alarm alarm) { - return AlarmVO.builder() + + private static AlarmResponse of(Alarm alarm) { + return AlarmResponse.builder() .alarmId(alarm.getId()) .part(getPartName(alarm.getPart())) .attribute(alarm.getAttribute().getName()) diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/service/AlarmService.java b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/service/AlarmService.java index c1fe4019..94a551a6 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/service/AlarmService.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/service/AlarmService.java @@ -2,16 +2,17 @@ import org.sopt.makers.operation.common.domain.Part; import org.sopt.makers.operation.alarm.domain.Status; -import org.sopt.makers.operation.web.alarm.dto.request.AlarmRequest; +import org.sopt.makers.operation.web.alarm.dto.request.AlarmCreateRequest; import org.sopt.makers.operation.web.alarm.dto.request.AlarmSendRequest; -import org.sopt.makers.operation.web.alarm.dto.response.AlarmResponse; -import org.sopt.makers.operation.web.alarm.dto.response.AlarmListResponse; +import org.sopt.makers.operation.web.alarm.dto.response.AlarmCreateResponse; +import org.sopt.makers.operation.web.alarm.dto.response.AlarmGetResponse; +import org.sopt.makers.operation.web.alarm.dto.response.AlarmListGetResponse; import org.springframework.data.domain.Pageable; public interface AlarmService { - void sendByAdmin(AlarmSendRequest request); - long createAlarm(AlarmRequest requestDTO); - AlarmListResponse getAlarms(Integer generation, Part part, Status status, Pageable pageable); - AlarmResponse getAlarm(long alarmId); + void sendAlarm(AlarmSendRequest request); + AlarmCreateResponse saveAlarm(AlarmCreateRequest requestDTO); + AlarmListGetResponse getAlarms(Integer generation, Part part, Status status, Pageable pageable); + AlarmGetResponse getAlarm(long alarmId); void deleteAlarm(long alarmId); } diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/service/AlarmServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/service/AlarmServiceImpl.java index b5c0f317..a6229e65 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/service/AlarmServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/alarm/service/AlarmServiceImpl.java @@ -1,9 +1,9 @@ package org.sopt.makers.operation.web.alarm.service; -import static java.util.Objects.*; import static org.sopt.makers.operation.code.failure.AlarmFailureCode.*; import java.util.List; +import java.util.Objects; import org.sopt.makers.operation.client.alarm.AlarmSender; import org.sopt.makers.operation.client.alarm.dto.AlarmSenderRequest; @@ -13,12 +13,14 @@ import org.sopt.makers.operation.alarm.domain.Alarm; import org.sopt.makers.operation.alarm.domain.Status; import org.sopt.makers.operation.alarm.repository.AlarmRepository; +import org.sopt.makers.operation.member.domain.Member; import org.sopt.makers.operation.member.repository.MemberRepository; -import org.sopt.makers.operation.web.alarm.dto.request.AlarmRequest; +import org.sopt.makers.operation.web.alarm.dto.request.AlarmCreateRequest; import org.sopt.makers.operation.exception.AlarmException; import org.sopt.makers.operation.web.alarm.dto.request.AlarmSendRequest; -import org.sopt.makers.operation.web.alarm.dto.response.AlarmResponse; -import org.sopt.makers.operation.web.alarm.dto.response.AlarmListResponse; +import org.sopt.makers.operation.web.alarm.dto.response.AlarmCreateResponse; +import org.sopt.makers.operation.web.alarm.dto.response.AlarmGetResponse; +import org.sopt.makers.operation.web.alarm.dto.response.AlarmListGetResponse; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -32,21 +34,52 @@ public class AlarmServiceImpl implements AlarmService { private final AlarmRepository alarmRepository; private final MemberRepository memberRepository; + private final AlarmSender alarmSender; private final PlayGroundServer playGroundServer; private final ValueConfig valueConfig; @Override @Transactional - public void sendByAdmin(AlarmSendRequest request) { + public void sendAlarm(AlarmSendRequest request) { val alarm = getAlarmReadyToSend(request.alarmId()); - val targetIdList = getTargets(alarm); - sendAlarmToTargets(alarm, targetIdList); + val targets = getTargets(alarm); + alarmSender.send(AlarmSenderRequest.of(alarm, targets)); + alarm.updateToSent(); + } + + @Override + @Transactional + public AlarmCreateResponse saveAlarm(AlarmCreateRequest request) { + val savedAlarm = alarmRepository.save(request.toEntity()); + return AlarmCreateResponse.of(savedAlarm); + } + + @Override + public AlarmListGetResponse getAlarms(Integer generation, Part part, Status status, Pageable pageable) { + val alarms = alarmRepository.findOrderByCreatedDate(generation, part, status, pageable); + val totalCount = alarmRepository.count(generation, part, status); + return AlarmListGetResponse.of(alarms, totalCount); + } + + @Override + public AlarmGetResponse getAlarm(long alarmId) { + val alarm = findAlarm(alarmId); + return AlarmGetResponse.of(alarm); + } + + @Override + @Transactional + public void deleteAlarm(long alarmId) { + val alarm = findAlarm(alarmId); + alarmRepository.delete(alarm); } private Alarm getAlarmReadyToSend(long alarmId) { val alarm = findAlarm(alarmId); - checkAlarmReadyToSend(alarm); + if (alarm.isSent()) { + throw new AlarmException(SENT_ALARM); + } return alarm; } @@ -55,83 +88,38 @@ private Alarm findAlarm(long id) { .orElseThrow(() -> new AlarmException(INVALID_ALARM)); } - private void checkAlarmReadyToSend(Alarm alarm) { - if (alarm.isSent()) { - throw new AlarmException(FAIL_SEND_ALARM); - } - } - private List getTargets(Alarm alarm) { - if (alarm.hasEmptyTargetList()) { - return alarm.getTargetList(); - } - return getTargetsByActivityStatus(alarm.getIsActive(), alarm.getPart()); + return alarm.hasTargets() + ? alarm.getTargetList() + : getTargetsByActivityAndPart(alarm.getIsActive(), alarm.getPart()); } - private List getTargetsByActivityStatus(boolean isActive, Part part) { - if (isActive) { - return getActiveTargets(part); - } else { - return getInactiveTargets(part); - } + private List getTargetsByActivityAndPart(boolean isActive, Part part) { + return isActive ? getActiveTargets(part) : getInactiveTargets(part); } private List getActiveTargets(Part part) { val generation = valueConfig.getGENERATION(); - val memberList = memberRepository.find(generation, part); - return memberList.stream() - .filter(member -> nonNull(member.getPlaygroundId())) - .map(member -> String.valueOf(member.getPlaygroundId())) - .toList(); + val members = memberRepository.find(generation, part); + return members.stream() + .map(Member::getPlaygroundId) + .filter(Objects::nonNull) + .map(String::valueOf) + .toList(); } private List getInactiveTargets(Part part) { val generation = valueConfig.getGENERATION(); - val memberList = getInactiveMemberIdsFromPlayground(generation, part); - val activeTargetList = getActiveTargets(part); - return memberList.stream() - .filter(target -> !activeTargetList.contains(target)) + val activePlaygroundIds = getActiveTargets(part); + return getPlaygroundIds(generation, part).stream() + .filter(id -> !activePlaygroundIds.contains(id)) .toList(); } - private List getInactiveMemberIdsFromPlayground(int generation, Part part) { - val memberIdList = playGroundServer.getInactiveMembers(generation, part).memberIds(); - return memberIdList.stream() + private List getPlaygroundIds(int generation, Part part) { + val members = playGroundServer.getMembers(generation, part); + return members.memberIds().stream() .map(String::valueOf) .toList(); } - - private void sendAlarmToTargets(Alarm alarm, List targetIdList) { - val alarmRequest = AlarmSenderRequest.of(alarm, targetIdList); - alarmSender.send(alarmRequest); - alarm.updateToSent(); - } - - @Override - @Transactional - public long createAlarm(AlarmRequest request) { - val alarmEntity = request.toEntity(); - val savedAlarm = alarmRepository.save(alarmEntity); - return savedAlarm.getId(); - } - - @Override - public AlarmListResponse getAlarms(Integer generation, Part part, Status status, Pageable pageable) { - val alarmList = alarmRepository.findOrderByCreatedDate(generation, part, status, pageable); - val totalCount = alarmRepository.count(generation, part, status); - return AlarmListResponse.of(alarmList, totalCount); - } - - @Override - public AlarmResponse getAlarm(long alarmId) { - val alarm = findAlarm(alarmId); - return AlarmResponse.of(alarm); - } - - @Override - @Transactional - public void deleteAlarm(long alarmId) { - val alarm = findAlarm(alarmId); - alarmRepository.delete(alarm); - } } diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/api/WebAttendanceApi.java b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/api/WebAttendanceApi.java index 8ce1e92b..1efb6170 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/api/WebAttendanceApi.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/api/WebAttendanceApi.java @@ -2,7 +2,7 @@ import org.sopt.makers.operation.common.domain.Part; import org.sopt.makers.operation.dto.BaseResponse; -import org.sopt.makers.operation.web.attendnace.dto.request.UpdatedSubAttendanceRequest; +import org.sopt.makers.operation.web.attendnace.dto.request.SubAttendanceUpdateRequest; import org.springframework.data.domain.Pageable; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PathVariable; @@ -31,7 +31,7 @@ public interface WebAttendanceApi { ) } ) - ResponseEntity> updateSubAttendance(@RequestBody UpdatedSubAttendanceRequest request); + ResponseEntity> updateSubAttendance(@RequestBody SubAttendanceUpdateRequest request); @Operation( summary = "회원별 출석 정보 조회 API", diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/api/WebAttendanceApiController.java b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/api/WebAttendanceApiController.java index c83c5c77..062b682d 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/api/WebAttendanceApiController.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/api/WebAttendanceApiController.java @@ -5,7 +5,7 @@ import org.sopt.makers.operation.common.domain.Part; import org.sopt.makers.operation.dto.BaseResponse; import org.sopt.makers.operation.util.ApiResponseUtil; -import org.sopt.makers.operation.web.attendnace.dto.request.UpdatedSubAttendanceRequest; +import org.sopt.makers.operation.web.attendnace.dto.request.SubAttendanceUpdateRequest; import org.sopt.makers.operation.web.attendnace.service.WebAttendanceService; import org.springframework.data.domain.Pageable; import org.springframework.http.ResponseEntity; @@ -29,7 +29,7 @@ public class WebAttendanceApiController implements WebAttendanceApi { @Override @PatchMapping - public ResponseEntity> updateSubAttendance(@RequestBody UpdatedSubAttendanceRequest request) { + public ResponseEntity> updateSubAttendance(@RequestBody SubAttendanceUpdateRequest request) { val response = attendanceService.updateSubAttendance(request); return ApiResponseUtil.success(SUCCESS_UPDATE_ATTENDANCE_STATUS, response); } @@ -37,7 +37,7 @@ public ResponseEntity> updateSubAttendance(@RequestBody UpdatedS @Override @GetMapping("/{memberId}") public ResponseEntity> findAttendancesByMember(@PathVariable long memberId) { - val response = attendanceService.findAttendancesByMember(memberId); + val response = attendanceService.getAttendancesByMember(memberId); return ApiResponseUtil.success(SUCCESS_GET_MEMBER_ATTENDANCE, response); } @@ -45,7 +45,7 @@ public ResponseEntity> findAttendancesByMember(@PathVariable lon @PatchMapping("/member/{memberId}") public ResponseEntity> updateMemberScore(@PathVariable long memberId) { val response = attendanceService.updateMemberAllScore(memberId); - return ApiResponseUtil.success(SUCCESS_UPDATE_MEMBER_SCORE, response); + return ApiResponseUtil.success(SUCCESS_UPDATE_MEMBER_SCORE, response.score()); } @Override @@ -55,7 +55,7 @@ public ResponseEntity> findAttendancesByLecture( @RequestParam(required = false) Part part, Pageable pageable ) { - val response = attendanceService.findAttendancesByLecture(lectureId, part, pageable); + val response = attendanceService.getAttendancesByLecture(lectureId, part, pageable); return ApiResponseUtil.success(SUCCESS_GET_ATTENDANCES, response); } } diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/request/UpdatedSubAttendanceRequest.java b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/request/SubAttendanceUpdateRequest.java similarity index 81% rename from operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/request/UpdatedSubAttendanceRequest.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/request/SubAttendanceUpdateRequest.java index 3865572e..91b22a61 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/request/UpdatedSubAttendanceRequest.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/request/SubAttendanceUpdateRequest.java @@ -2,7 +2,7 @@ import org.sopt.makers.operation.attendance.domain.AttendanceStatus; -public record UpdatedSubAttendanceRequest( +public record SubAttendanceUpdateRequest( long subAttendanceId, AttendanceStatus status ) { diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/AttendanceListResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/AttendanceListByLectureGetResponse.java similarity index 63% rename from operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/AttendanceListResponse.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/AttendanceListByLectureGetResponse.java index 66f8240a..9e048d9f 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/AttendanceListResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/AttendanceListByLectureGetResponse.java @@ -1,5 +1,7 @@ package org.sopt.makers.operation.web.attendnace.dto.response; +import static lombok.AccessLevel.*; + import java.util.List; import org.sopt.makers.operation.attendance.domain.Attendance; @@ -7,48 +9,47 @@ import org.sopt.makers.operation.attendance.domain.SubAttendance; import org.sopt.makers.operation.member.domain.Member; -import lombok.AccessLevel; import lombok.Builder; -@Builder(access = AccessLevel.PRIVATE) -public record AttendanceListResponse( - List attendances, +@Builder(access = PRIVATE) +public record AttendanceListByLectureGetResponse( + List attendances, int totalCount ) { - public static AttendanceListResponse of(List attendanceList, int totalCount) { - return AttendanceListResponse.builder() - .attendances(attendanceList.stream().map(AttendanceVO::of).toList()) + public static AttendanceListByLectureGetResponse of(List attendanceList, int totalCount) { + return AttendanceListByLectureGetResponse.builder() + .attendances(attendanceList.stream().map(AttendanceResponse::of).toList()) .totalCount(totalCount) .build(); } - @Builder(access = AccessLevel.PRIVATE) - private record AttendanceVO( + @Builder(access = PRIVATE) + private record AttendanceResponse( long attendanceId, - MemberVO member, + MemberResponse member, List attendances, float updatedScore ) { - private static AttendanceVO of(Attendance attendance) { - return AttendanceVO.builder() + private static AttendanceResponse of(Attendance attendance) { + return AttendanceResponse.builder() .attendanceId(attendance.getId()) - .member(MemberVO.of(attendance.getMember())) + .member(MemberResponse.of(attendance.getMember())) .attendances(attendance.getSubAttendances().stream().map(SubAttendanceVO::of).toList()) .updatedScore(attendance.getScore()) .build(); } } - @Builder(access = AccessLevel.PRIVATE) - private record MemberVO( + @Builder(access = PRIVATE) + private record MemberResponse( long memberId, String name, String university, String part ) { - private static MemberVO of(Member member) { - return MemberVO.builder() + private static MemberResponse of(Member member) { + return MemberResponse.builder() .memberId(member.getId()) .name(member.getName()) .university(member.getUniversity()) @@ -57,7 +58,7 @@ private static MemberVO of(Member member) { } } - @Builder(access = AccessLevel.PRIVATE) + @Builder(access = PRIVATE) private record SubAttendanceVO( long subAttendanceId, int round, diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/AttendanceListByMemberGetResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/AttendanceListByMemberGetResponse.java new file mode 100644 index 00000000..7a6a13fc --- /dev/null +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/AttendanceListByMemberGetResponse.java @@ -0,0 +1,67 @@ +package org.sopt.makers.operation.web.attendnace.dto.response; + +import static lombok.AccessLevel.*; + +import java.util.List; + +import org.sopt.makers.operation.attendance.domain.Attendance; +import org.sopt.makers.operation.attendance.domain.SubAttendance; +import org.sopt.makers.operation.member.domain.Member; + +import lombok.Builder; + +@Builder(access = PRIVATE) +public record AttendanceListByMemberGetResponse( + String name, + float score, + String part, + String university, + String phone, + List lectures +) { + + public static AttendanceListByMemberGetResponse of(Member member, List attendances) { + return AttendanceListByMemberGetResponse.builder() + .name(member.getName()) + .score(member.getScore()) + .part(member.getPart().getName()) + .university(member.getUniversity()) + .phone(member.getPhone()) + .lectures(attendances.stream().map(LectureResponse::of).toList()) + .build(); + } + + @Builder(access = PRIVATE) + record LectureResponse( + String lecture, + float additiveScore, + String status, + List attendances + ) { + + public static LectureResponse of(Attendance attendance) { + return LectureResponse.builder() + .lecture(attendance.getLecture().getName()) + .additiveScore(attendance.getScore()) + .status(attendance.getStatus().getName()) + .attendances(attendance.getSubAttendances().stream().map(AttendanceResponse::of).toList()) + .build(); + } + } + + @Builder(access = PRIVATE) + record AttendanceResponse( + int round, + String status, + String date + ) { + + public static AttendanceResponse of(SubAttendance subAttendance) { + return AttendanceResponse.builder() + .round(subAttendance.getSubLecture().getRound()) + .status(subAttendance.getStatus().getName()) + .date(subAttendance.getLastModifiedDate().toString()) + .build(); + } + } +} diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/AttendanceMemberResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/AttendanceMemberResponse.java deleted file mode 100644 index 215b7916..00000000 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/AttendanceMemberResponse.java +++ /dev/null @@ -1,55 +0,0 @@ -package org.sopt.makers.operation.web.attendnace.dto.response; - -import java.util.List; - -import org.sopt.makers.operation.attendance.domain.Attendance; -import org.sopt.makers.operation.attendance.domain.SubAttendance; -import org.sopt.makers.operation.member.domain.Member; - -public record AttendanceMemberResponse( - String name, - float score, - String part, - String university, - String phone, - List lectures -) { - public static AttendanceMemberResponse of(Member member, List attendanceList) { - return new AttendanceMemberResponse( - member.getName(), - member.getScore(), - member.getPart().getName(), - member.getUniversity(), - member.getPhone(), - attendanceList.stream().map(LectureVO::of).toList()); - } - - record LectureVO( - String lecture, - float additiveScore, - String status, - List attendances - ) { - public static LectureVO of(Attendance attendance) { - return new LectureVO( - attendance.getLecture().getName(), - attendance.getScore(), - attendance.getStatus().getName(), - attendance.getSubAttendances().stream().map(AttendanceVO::of).toList()); - } - } - - record AttendanceVO( - int round, - String status, - String date - ) { - public static AttendanceVO of(SubAttendance subAttendance) { - return new AttendanceVO( - subAttendance.getSubLecture().getRound(), - subAttendance.getStatus().getName(), - subAttendance.getLastModifiedDate().toString() - ); - } - } -} diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/MemberScoreUpdateResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/MemberScoreUpdateResponse.java new file mode 100644 index 00000000..9069918a --- /dev/null +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/MemberScoreUpdateResponse.java @@ -0,0 +1,19 @@ +package org.sopt.makers.operation.web.attendnace.dto.response; + +import static lombok.AccessLevel.*; + +import org.sopt.makers.operation.member.domain.Member; + +import lombok.Builder; + +@Builder(access = PRIVATE) +public record MemberScoreUpdateResponse( + float score +) { + + public static MemberScoreUpdateResponse of(Member member) { + return MemberScoreUpdateResponse.builder() + .score(member.getScore()) + .build(); + } +} diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/UpdatedSubAttendanceResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/SubAttendanceUpdateResponse.java similarity index 61% rename from operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/UpdatedSubAttendanceResponse.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/SubAttendanceUpdateResponse.java index a4798d00..15f6faba 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/UpdatedSubAttendanceResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/dto/response/SubAttendanceUpdateResponse.java @@ -1,18 +1,20 @@ package org.sopt.makers.operation.web.attendnace.dto.response; +import static lombok.AccessLevel.*; + import org.sopt.makers.operation.attendance.domain.AttendanceStatus; import org.sopt.makers.operation.attendance.domain.SubAttendance; -import lombok.AccessLevel; import lombok.Builder; -@Builder(access = AccessLevel.PRIVATE) -public record UpdatedSubAttendanceResponse( +@Builder(access = PRIVATE) +public record SubAttendanceUpdateResponse( long subAttendanceId, AttendanceStatus status ) { - public static UpdatedSubAttendanceResponse of(SubAttendance subAttendance) { - return UpdatedSubAttendanceResponse.builder() + + public static SubAttendanceUpdateResponse of(SubAttendance subAttendance) { + return SubAttendanceUpdateResponse.builder() .subAttendanceId(subAttendance.getId()) .status(subAttendance.getStatus()) .build(); diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/service/WebAttendanceService.java b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/service/WebAttendanceService.java index da1a93a6..affade26 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/service/WebAttendanceService.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/service/WebAttendanceService.java @@ -1,15 +1,16 @@ package org.sopt.makers.operation.web.attendnace.service; import org.sopt.makers.operation.common.domain.Part; -import org.sopt.makers.operation.web.attendnace.dto.request.UpdatedSubAttendanceRequest; -import org.sopt.makers.operation.web.attendnace.dto.response.AttendanceListResponse; -import org.sopt.makers.operation.web.attendnace.dto.response.AttendanceMemberResponse; -import org.sopt.makers.operation.web.attendnace.dto.response.UpdatedSubAttendanceResponse; +import org.sopt.makers.operation.web.attendnace.dto.request.SubAttendanceUpdateRequest; +import org.sopt.makers.operation.web.attendnace.dto.response.AttendanceListByLectureGetResponse; +import org.sopt.makers.operation.web.attendnace.dto.response.AttendanceListByMemberGetResponse; +import org.sopt.makers.operation.web.attendnace.dto.response.MemberScoreUpdateResponse; +import org.sopt.makers.operation.web.attendnace.dto.response.SubAttendanceUpdateResponse; import org.springframework.data.domain.Pageable; public interface WebAttendanceService { - UpdatedSubAttendanceResponse updateSubAttendance(UpdatedSubAttendanceRequest request); - AttendanceMemberResponse findAttendancesByMember(long memberId); - float updateMemberAllScore(long memberId); - AttendanceListResponse findAttendancesByLecture(long lectureId, Part part, Pageable pageable); + SubAttendanceUpdateResponse updateSubAttendance(SubAttendanceUpdateRequest request); + AttendanceListByMemberGetResponse getAttendancesByMember(long memberId); + MemberScoreUpdateResponse updateMemberAllScore(long memberId); + AttendanceListByLectureGetResponse getAttendancesByLecture(long lectureId, Part part, Pageable pageable); } diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/service/WebAttendanceServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/service/WebAttendanceServiceImpl.java index 0aa6908f..b64ebca2 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/service/WebAttendanceServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/attendnace/service/WebAttendanceServiceImpl.java @@ -14,10 +14,11 @@ import org.sopt.makers.operation.member.repository.MemberRepository; import org.sopt.makers.operation.exception.LectureException; import org.sopt.makers.operation.exception.MemberException; -import org.sopt.makers.operation.web.attendnace.dto.request.UpdatedSubAttendanceRequest; -import org.sopt.makers.operation.web.attendnace.dto.response.AttendanceMemberResponse; -import org.sopt.makers.operation.web.attendnace.dto.response.AttendanceListResponse; -import org.sopt.makers.operation.web.attendnace.dto.response.UpdatedSubAttendanceResponse; +import org.sopt.makers.operation.web.attendnace.dto.request.SubAttendanceUpdateRequest; +import org.sopt.makers.operation.web.attendnace.dto.response.AttendanceListByMemberGetResponse; +import org.sopt.makers.operation.web.attendnace.dto.response.AttendanceListByLectureGetResponse; +import org.sopt.makers.operation.web.attendnace.dto.response.MemberScoreUpdateResponse; +import org.sopt.makers.operation.web.attendnace.dto.response.SubAttendanceUpdateResponse; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -39,43 +40,43 @@ public class WebAttendanceServiceImpl implements WebAttendanceService { @Override @Transactional - public UpdatedSubAttendanceResponse updateSubAttendance(UpdatedSubAttendanceRequest request) { + public SubAttendanceUpdateResponse updateSubAttendance(SubAttendanceUpdateRequest request) { val subAttendance = findSubAttendance(request.subAttendanceId()); subAttendance.updateStatus(request.status()); - return UpdatedSubAttendanceResponse.of(subAttendance); - } - - private SubAttendance findSubAttendance(long id) { - return subAttendanceRepository.findById(id) - .orElseThrow(() -> new LectureException(INVALID_ATTENDANCE)); + return SubAttendanceUpdateResponse.of(subAttendance); } @Override - public AttendanceMemberResponse findAttendancesByMember(long memberId) { + public AttendanceListByMemberGetResponse getAttendancesByMember(long memberId) { val member = findMember(memberId); - val attendanceList = attendanceRepository.findFetchJoin(member); - return AttendanceMemberResponse.of(member, attendanceList); - } - - private Member findMember(long id) { - return memberRepository.findById(id) - .orElseThrow(() -> new MemberException(INVALID_MEMBER)); + val attendances = attendanceRepository.findFetchJoin(member); + return AttendanceListByMemberGetResponse.of(member, attendances); } @Override @Transactional - public float updateMemberAllScore(long memberId) { + public MemberScoreUpdateResponse updateMemberAllScore(long memberId) { val member = findMember(memberId); member.updateTotalScore(); - return member.getScore(); + return MemberScoreUpdateResponse.of(member); } @Override - public AttendanceListResponse findAttendancesByLecture(long lectureId, Part part, Pageable pageable) { + public AttendanceListByLectureGetResponse getAttendancesByLecture(long lectureId, Part part, Pageable pageable) { val lecture = findLecture(lectureId); - val attendanceList = attendanceRepository.findFetchJoin(lecture, part, pageable); + val attendances = attendanceRepository.findFetchJoin(lecture, part, pageable); val totalCount = attendanceRepository.count(lecture, part); - return AttendanceListResponse.of(attendanceList, totalCount); + return AttendanceListByLectureGetResponse.of(attendances, totalCount); + } + + private SubAttendance findSubAttendance(long id) { + return subAttendanceRepository.findById(id) + .orElseThrow(() -> new LectureException(INVALID_ATTENDANCE)); + } + + private Member findMember(long id) { + return memberRepository.findById(id) + .orElseThrow(() -> new MemberException(INVALID_MEMBER)); } private Lecture findLecture(long id) { diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/api/WebLectureApi.java b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/api/WebLectureApi.java index fd70e6e1..802ff563 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/api/WebLectureApi.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/api/WebLectureApi.java @@ -2,8 +2,8 @@ import org.sopt.makers.operation.common.domain.Part; import org.sopt.makers.operation.dto.BaseResponse; -import org.sopt.makers.operation.web.lecture.dto.request.AttendanceRequest; -import org.sopt.makers.operation.web.lecture.dto.request.LectureRequest; +import org.sopt.makers.operation.web.lecture.dto.request.SubLectureStartRequest; +import org.sopt.makers.operation.web.lecture.dto.request.LectureCreateRequest; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; @@ -31,7 +31,7 @@ public interface WebLectureApi { ) } ) - ResponseEntity> createLecture(@RequestBody LectureRequest request); + ResponseEntity> createLecture(@RequestBody LectureCreateRequest request); @Operation( summary = "세션 리스트 조회 API", @@ -90,7 +90,7 @@ ResponseEntity> getLectures( ) } ) - ResponseEntity> startAttendance(@RequestBody AttendanceRequest request); + ResponseEntity> startSubLecture(@RequestBody SubLectureStartRequest request); @Operation( summary = "세션 종료 후 출석 점수 갱신 API", diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/api/WebLectureApiController.java b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/api/WebLectureApiController.java index 2876e6e3..4ecd093c 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/api/WebLectureApiController.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/api/WebLectureApiController.java @@ -5,8 +5,8 @@ import org.sopt.makers.operation.common.domain.Part; import org.sopt.makers.operation.dto.BaseResponse; import org.sopt.makers.operation.util.ApiResponseUtil; -import org.sopt.makers.operation.web.lecture.dto.request.AttendanceRequest; -import org.sopt.makers.operation.web.lecture.dto.request.LectureRequest; +import org.sopt.makers.operation.web.lecture.dto.request.SubLectureStartRequest; +import org.sopt.makers.operation.web.lecture.dto.request.LectureCreateRequest; import org.sopt.makers.operation.web.lecture.service.WebLectureService; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.DeleteMapping; @@ -31,9 +31,9 @@ public class WebLectureApiController implements WebLectureApi { @Override @PostMapping - public ResponseEntity> createLecture(@RequestBody LectureRequest request) { - val lectureId = lectureService.createLecture(request); - return ApiResponseUtil.success(SUCCESS_CREATE_LECTURE, lectureId); + public ResponseEntity> createLecture(@RequestBody LectureCreateRequest request) { + val response = lectureService.createLecture(request); + return ApiResponseUtil.success(SUCCESS_CREATE_LECTURE, response.lectureId()); } @Override @@ -55,8 +55,8 @@ public ResponseEntity> getLecture(@PathVariable long lectureId) @Override @PatchMapping("/attendance") - public ResponseEntity> startAttendance(AttendanceRequest request) { - val response = lectureService.startAttendance(request); + public ResponseEntity> startSubLecture(SubLectureStartRequest request) { + val response = lectureService.startSubLecture(request); return ApiResponseUtil.success(SUCCESS_START_ATTENDANCE, response); } diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/request/LectureRequest.java b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/request/LectureCreateRequest.java similarity index 92% rename from operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/request/LectureRequest.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/request/LectureCreateRequest.java index c27aad55..17c6f32c 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/request/LectureRequest.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/request/LectureCreateRequest.java @@ -1,5 +1,6 @@ package org.sopt.makers.operation.web.lecture.dto.request; +import static lombok.AccessLevel.*; import static org.sopt.makers.operation.code.failure.LectureFailureCode.*; import java.time.LocalDateTime; @@ -13,8 +14,8 @@ import lombok.Builder; import lombok.NonNull; -@Builder -public record LectureRequest( +@Builder(access = PRIVATE) +public record LectureCreateRequest( @NonNull Part part, @NonNull String name, int generation, diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/request/AttendanceRequest.java b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/request/SubLectureStartRequest.java similarity index 73% rename from operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/request/AttendanceRequest.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/request/SubLectureStartRequest.java index dd7043e6..71aadcef 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/request/AttendanceRequest.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/request/SubLectureStartRequest.java @@ -1,6 +1,6 @@ package org.sopt.makers.operation.web.lecture.dto.request; -public record AttendanceRequest( +public record SubLectureStartRequest( long lectureId, int round, String code diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/AttendanceStatusListVO.java b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/AttendanceStatusListResponse.java similarity index 81% rename from operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/AttendanceStatusListVO.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/AttendanceStatusListResponse.java index 6ef3d909..bddfb4bb 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/AttendanceStatusListVO.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/AttendanceStatusListResponse.java @@ -1,5 +1,6 @@ package org.sopt.makers.operation.web.lecture.dto.response; +import static lombok.AccessLevel.*; import static org.sopt.makers.operation.attendance.domain.AttendanceStatus.*; import org.sopt.makers.operation.attendance.domain.AttendanceStatus; @@ -7,16 +8,16 @@ import lombok.Builder; -@Builder -public record AttendanceStatusListVO( +@Builder(access = PRIVATE) +public record AttendanceStatusListResponse( int attendance, int absent, int tardy, int unknown ) { - public static AttendanceStatusListVO of(Lecture lecture) { - return AttendanceStatusListVO.builder() + public static AttendanceStatusListResponse of(Lecture lecture) { + return AttendanceStatusListResponse.builder() .attendance(getCount(lecture, ATTENDANCE)) .absent(getAbsentCount(lecture)) .tardy(getCount(lecture, TARDY)) diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureCreateResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureCreateResponse.java new file mode 100644 index 00000000..c47b36f0 --- /dev/null +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureCreateResponse.java @@ -0,0 +1,19 @@ +package org.sopt.makers.operation.web.lecture.dto.response; + +import static lombok.AccessLevel.*; + +import org.sopt.makers.operation.lecture.domain.Lecture; + +import lombok.Builder; + +@Builder(access = PRIVATE) +public record LectureCreateResponse( + long lectureId +) { + + public static LectureCreateResponse of(Lecture lecture) { + return LectureCreateResponse.builder() + .lectureId(lecture.getId()) + .build(); + } +} diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureDetailResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureDetailGetResponse.java similarity index 72% rename from operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureDetailResponse.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureDetailGetResponse.java index 60d4c244..e09424c0 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureDetailResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureDetailGetResponse.java @@ -1,12 +1,14 @@ package org.sopt.makers.operation.web.lecture.dto.response; +import static lombok.AccessLevel.*; + import org.sopt.makers.operation.lecture.domain.Lecture; import lombok.Builder; -@Builder -public record LectureDetailResponse( - Long lectureId, +@Builder(access = PRIVATE) +public record LectureDetailGetResponse( + long lectureId, String part, String name, String place, @@ -15,8 +17,9 @@ public record LectureDetailResponse( String endDate, int generation ) { - public static LectureDetailResponse of(Lecture lecture) { - return LectureDetailResponse.builder() + + public static LectureDetailGetResponse of(Lecture lecture) { + return LectureDetailGetResponse.builder() .lectureId(lecture.getId()) .part(lecture.getPart().getName()) .name(lecture.getName()) diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureGetResponse.java similarity index 68% rename from operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureResponse.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureGetResponse.java index cec5b93b..c478c31a 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureGetResponse.java @@ -1,6 +1,7 @@ package org.sopt.makers.operation.web.lecture.dto.response; import static java.util.Objects.*; +import static lombok.AccessLevel.*; import java.time.LocalDateTime; import java.util.List; @@ -13,40 +14,42 @@ import lombok.Builder; -@Builder -public record LectureResponse( - Long lectureId, +@Builder(access = PRIVATE) +public record LectureGetResponse( + long lectureId, String name, int generation, Part part, Attribute attribute, - List subLectures, - AttendanceStatusListVO attendances, + List subLectures, + AttendanceStatusListResponse attendances, LectureStatus status ) { - public static LectureResponse of(Lecture lecture) { - return LectureResponse.builder() + + public static LectureGetResponse of(Lecture lecture) { + return LectureGetResponse.builder() .lectureId(lecture.getId()) .name(lecture.getName()) .generation(lecture.getGeneration()) .part(lecture.getPart()) .attribute(lecture.getAttribute()) - .subLectures(lecture.getSubLectures().stream().map(SubLectureVO::of).toList()) - .attendances(AttendanceStatusListVO.of(lecture)) + .subLectures(lecture.getSubLectures().stream().map(SubLectureResponse::of).toList()) + .attendances(AttendanceStatusListResponse.of(lecture)) .status(lecture.getLectureStatus()) .build(); } - @Builder - public record SubLectureVO( - Long subLectureId, + @Builder(access = PRIVATE) + public record SubLectureResponse( + long subLectureId, int round, String startAt, String code ) { - private static SubLectureVO of(SubLecture subLecture) { - return SubLectureVO.builder() + + private static SubLectureResponse of(SubLecture subLecture) { + return SubLectureResponse.builder() .subLectureId(subLecture.getId()) .round(subLecture.getRound()) .startAt(getStartAt(subLecture.getStartAt())) diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureListResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureListGetResponse.java similarity index 60% rename from operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureListResponse.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureListGetResponse.java index f3426a5b..f1ef0c0f 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureListResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/LectureListGetResponse.java @@ -1,30 +1,31 @@ package org.sopt.makers.operation.web.lecture.dto.response; +import static lombok.AccessLevel.*; + import java.util.List; import org.sopt.makers.operation.common.domain.Part; import org.sopt.makers.operation.lecture.domain.Attribute; import org.sopt.makers.operation.lecture.domain.Lecture; -import lombok.AccessLevel; import lombok.Builder; -@Builder(access = AccessLevel.PRIVATE) -public record LectureListResponse( +@Builder(access = PRIVATE) +public record LectureListGetResponse( int generation, - List lectures + List lectures ) { - public static LectureListResponse of(int generation, List lectureList) { - return LectureListResponse.builder() + public static LectureListGetResponse of(int generation, List lectureList) { + return LectureListGetResponse.builder() .generation(generation) - .lectures(lectureList.stream().map(LectureVO::of).toList()) + .lectures(lectureList.stream().map(LectureResponse::of).toList()) .build(); } - @Builder - public record LectureVO( - Long lectureId, + @Builder(access = PRIVATE) + public record LectureResponse( + long lectureId, String name, Part partValue, String partName, @@ -33,10 +34,11 @@ public record LectureVO( Attribute attributeValue, String attributeName, String place, - AttendanceStatusListVO attendances + AttendanceStatusListResponse attendances ) { - private static LectureVO of(Lecture lecture) { - return LectureVO.builder() + + private static LectureResponse of(Lecture lecture) { + return LectureResponse.builder() .lectureId(lecture.getId()) .name(lecture.getName()) .partValue(lecture.getPart()) @@ -46,7 +48,7 @@ private static LectureVO of(Lecture lecture) { .attributeValue(lecture.getAttribute()) .attributeName(lecture.getAttribute().getName()) .place(lecture.getPlace()) - .attendances(AttendanceStatusListVO.of(lecture)) + .attendances(AttendanceStatusListResponse.of(lecture)) .build(); } } diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/AttendanceResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/SubLectureStartResponse.java similarity index 52% rename from operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/AttendanceResponse.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/SubLectureStartResponse.java index cdb149b5..1e6941b8 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/AttendanceResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/response/SubLectureStartResponse.java @@ -1,18 +1,20 @@ package org.sopt.makers.operation.web.lecture.dto.response; +import static lombok.AccessLevel.*; + import org.sopt.makers.operation.lecture.domain.Lecture; import org.sopt.makers.operation.lecture.domain.SubLecture; import lombok.Builder; -@Builder -public record AttendanceResponse( - Long lectureId, - Long subLectureId +@Builder(access = PRIVATE) +public record SubLectureStartResponse( + long lectureId, + long subLectureId ) { - public static AttendanceResponse of(Lecture lecture, SubLecture subLecture) { - return AttendanceResponse.builder() + public static SubLectureStartResponse of(Lecture lecture, SubLecture subLecture) { + return SubLectureStartResponse.builder() .lectureId(lecture.getId()) .subLectureId(subLecture.getId()) .build(); diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/service/WebLectureService.java b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/service/WebLectureService.java index 2063e431..8fa12dcb 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/service/WebLectureService.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/service/WebLectureService.java @@ -1,20 +1,21 @@ package org.sopt.makers.operation.web.lecture.service; import org.sopt.makers.operation.common.domain.Part; -import org.sopt.makers.operation.web.lecture.dto.request.AttendanceRequest; -import org.sopt.makers.operation.web.lecture.dto.request.LectureRequest; -import org.sopt.makers.operation.web.lecture.dto.response.AttendanceResponse; -import org.sopt.makers.operation.web.lecture.dto.response.LectureDetailResponse; -import org.sopt.makers.operation.web.lecture.dto.response.LectureResponse; -import org.sopt.makers.operation.web.lecture.dto.response.LectureListResponse; +import org.sopt.makers.operation.web.lecture.dto.request.SubLectureStartRequest; +import org.sopt.makers.operation.web.lecture.dto.request.LectureCreateRequest; +import org.sopt.makers.operation.web.lecture.dto.response.SubLectureStartResponse; +import org.sopt.makers.operation.web.lecture.dto.response.LectureCreateResponse; +import org.sopt.makers.operation.web.lecture.dto.response.LectureDetailGetResponse; +import org.sopt.makers.operation.web.lecture.dto.response.LectureGetResponse; +import org.sopt.makers.operation.web.lecture.dto.response.LectureListGetResponse; public interface WebLectureService { - long createLecture(LectureRequest request); - LectureListResponse getLectures(int generation, Part part); - LectureResponse getLecture(long lectureId); - AttendanceResponse startAttendance(AttendanceRequest request); + LectureCreateResponse createLecture(LectureCreateRequest request); + LectureListGetResponse getLectures(int generation, Part part); + LectureGetResponse getLecture(long lectureId); + SubLectureStartResponse startSubLecture(SubLectureStartRequest request); void endLecture(long lectureId); void endLectures(); void deleteLecture(long lectureId); - LectureDetailResponse getLectureDetail(long lectureId); + LectureDetailGetResponse getLectureDetail(long lectureId); } diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/service/WebLectureServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/service/WebLectureServiceImpl.java index ffcdad07..d0c3411d 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/service/WebLectureServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/service/WebLectureServiceImpl.java @@ -21,12 +21,13 @@ import org.sopt.makers.operation.member.repository.MemberRepository; import org.sopt.makers.operation.exception.LectureException; import org.sopt.makers.operation.exception.SubLectureException; -import org.sopt.makers.operation.web.lecture.dto.request.AttendanceRequest; -import org.sopt.makers.operation.web.lecture.dto.request.LectureRequest; -import org.sopt.makers.operation.web.lecture.dto.response.AttendanceResponse; -import org.sopt.makers.operation.web.lecture.dto.response.LectureDetailResponse; -import org.sopt.makers.operation.web.lecture.dto.response.LectureResponse; -import org.sopt.makers.operation.web.lecture.dto.response.LectureListResponse; +import org.sopt.makers.operation.web.lecture.dto.request.SubLectureStartRequest; +import org.sopt.makers.operation.web.lecture.dto.request.LectureCreateRequest; +import org.sopt.makers.operation.web.lecture.dto.response.SubLectureStartResponse; +import org.sopt.makers.operation.web.lecture.dto.response.LectureCreateResponse; +import org.sopt.makers.operation.web.lecture.dto.response.LectureDetailGetResponse; +import org.sopt.makers.operation.web.lecture.dto.response.LectureGetResponse; +import org.sopt.makers.operation.web.lecture.dto.response.LectureListGetResponse; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -43,24 +44,75 @@ public class WebLectureServiceImpl implements WebLectureService { private final AttendanceRepository attendanceRepository; private final SubAttendanceRepository subAttendanceRepository; private final MemberRepository memberRepository; + private final AlarmSender alarmSender; private final ValueConfig valueConfig; @Override @Transactional - public long createLecture(LectureRequest request) { + public LectureCreateResponse createLecture(LectureCreateRequest request) { val savedLecture = saveLecture(request); - saveAttendances(request.generation(), request.part(), savedLecture); - return savedLecture.getId(); + createAttendances(request.generation(), request.part(), savedLecture); + return LectureCreateResponse.of(savedLecture); + } + + @Override + public LectureListGetResponse getLectures(int generation, Part part) { + val lectures = lectureRepository.find(generation, part); + return LectureListGetResponse.of(generation, lectures); + } + + @Override + public LectureGetResponse getLecture(long lectureId) { + val lecture = findLecture(lectureId); + return LectureGetResponse.of(lecture); + } + + @Override + @Transactional + public SubLectureStartResponse startSubLecture(SubLectureStartRequest request) { + val lecture = getLectureToStartAttendance(request.lectureId(), request.round()); + val subLecture = getSubLectureToStartAttendance(lecture, request.round()); + subLecture.updateCode(request.code()); + return SubLectureStartResponse.of(lecture, subLecture); + } + + @Override + @Transactional + public void endLecture(long lectureId) { + val lecture = getLectureReadyToEnd(lectureId); + lecture.updateToEnd(); + sendAlarm(lecture); + } + + @Override + @Transactional + public void endLectures() { + val lectures = lectureRepository.findLecturesReadyToEnd(); + lectures.forEach(lecture -> endLecture(lecture.getId())); + } + + @Override + @Transactional + public void deleteLecture(long lectureId) { + val lecture = getLectureToDelete(lectureId); + deleteRelationship(lecture); + lectureRepository.deleteById(lectureId); + } + + @Override + public LectureDetailGetResponse getLectureDetail(long lectureId) { + val lecture = findLecture(lectureId); + return LectureDetailGetResponse.of(lecture); } - private Lecture saveLecture(LectureRequest request) { + private Lecture saveLecture(LectureCreateRequest request) { val savedLecture = lectureRepository.save(request.toEntity()); - saveSubLectures(savedLecture); + createSubLectures(savedLecture); return savedLecture; } - private void saveSubLectures(Lecture lecture) { + private void createSubLectures(Lecture lecture) { val maxRound = valueConfig.getSUB_LECTURE_MAX_ROUND(); Stream.iterate(1, i -> i + 1).limit(maxRound) .forEach(round -> saveSubLecture(lecture, round)); @@ -70,67 +122,38 @@ private void saveSubLecture(Lecture lecture, int round) { subLectureRepository.save(new SubLecture(lecture, round)); } - private void saveAttendances(int generation, Part part, Lecture lecture) { - memberRepository.find(generation, part) - .forEach(member -> saveAttendance(member, lecture)); + private void createAttendances(int generation, Part part, Lecture lecture) { + val members = memberRepository.find(generation, part); + members.forEach(member -> saveAttendance(member, lecture)); } private void saveAttendance(Member member, Lecture lecture) { val savedAttendance = attendanceRepository.save(new Attendance(member, lecture)); - saveSubAttendances(savedAttendance); + createSubAttendances(savedAttendance); } - private void saveSubAttendances(Attendance attendance) { - attendance.getLecture().getSubLectures() - .forEach(subLecture -> saveSubAttendance(attendance, subLecture)); + private void createSubAttendances(Attendance attendance) { + val subLectures = attendance.getLecture().getSubLectures(); + subLectures.forEach(subLecture -> saveSubAttendance(attendance, subLecture)); } private void saveSubAttendance(Attendance attendance, SubLecture subLecture) { subAttendanceRepository.save(new SubAttendance(attendance, subLecture)); } - @Override - public LectureListResponse getLectures(int generation, Part part) { - val lectureList = findLectures(generation, part); - return LectureListResponse.of(generation, lectureList); - } - - private List findLectures(int generation, Part part) { - return lectureRepository.find(generation, part); - } - - @Override - public LectureResponse getLecture(long lectureId) { - val lecture = findLecture(lectureId); - return LectureResponse.of(lecture); - } - private Lecture findLecture(long id) { return lectureRepository.findById(id) .orElseThrow(() -> new LectureException(INVALID_LECTURE)); } - @Override - @Transactional - public AttendanceResponse startAttendance(AttendanceRequest request) { - val lecture = getLectureToStartAttendance(request.lectureId(), request.round()); - val subLecture = getSubLectureToStartAttendance(lecture, request.round()); - subLecture.startAttendance(request.code()); - return AttendanceResponse.of(lecture, subLecture); - } - private Lecture getLectureToStartAttendance(long lectureId, int round) { val lecture = findLecture(lectureId); - checkStartAttendanceValidity(lecture, round); - return lecture; - } - - private void checkStartAttendanceValidity(Lecture lecture, int round) { if (lecture.isEnd()) { throw new LectureException(END_LECTURE); } else if (round == 2 && lecture.isBefore()) { throw new LectureException(NOT_STARTED_PRE_ATTENDANCE); } + return lecture; } private SubLecture getSubLectureToStartAttendance(Lecture lecture, int round) { @@ -140,44 +163,16 @@ private SubLecture getSubLectureToStartAttendance(Lecture lecture, int round) { .orElseThrow(() -> new SubLectureException(NO_SUB_LECTURE_EQUAL_ROUND)); } - @Override - @Transactional - public void endLecture(long lectureId) { - val lecture = getLectureToEnd(lectureId); - lecture.updateToEnd(); - sendAlarm(lecture); - } - - private Lecture getLectureToEnd(long lectureId) { + private Lecture getLectureReadyToEnd(long lectureId) { val lecture = findLecture(lectureId); - checkEndLectureValidity(lecture); - return lecture; - } - - private void checkEndLectureValidity(Lecture lecture) { if (!lecture.isEnd()) { throw new LectureException(NOT_END_TIME_YET); } + return lecture; } private void sendAlarm(Lecture lecture) { - val alarmRequest = AlarmSenderRequest.of(lecture, valueConfig); - alarmSender.send(alarmRequest); - } - - @Override - @Transactional - public void endLectures() { - val lectures = lectureRepository.findLecturesToBeEnd(); - lectures.forEach(lecture -> endLecture(lecture.getId())); - } - - @Override - @Transactional - public void deleteLecture(long lectureId) { - val lecture = getLectureToDelete(lectureId); - deleteRelationship(lecture); - lectureRepository.deleteById(lectureId); + alarmSender.send(AlarmSenderRequest.of(lecture, valueConfig)); } private Lecture getLectureToDelete(long lectureId) { @@ -198,10 +193,4 @@ private void deleteRelationship(Lecture lecture) { attendanceRepository.deleteAllByLecture(lecture); } - @Override - public LectureDetailResponse getLectureDetail(long lectureId) { - val lecture = findLecture(lectureId); - return LectureDetailResponse.of(lecture); - } - } diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/member/api/WebMemberApi.java b/operation-api/src/main/java/org/sopt/makers/operation/web/member/api/WebMemberApi.java index 01d96e8e..9801990d 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/member/api/WebMemberApi.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/member/api/WebMemberApi.java @@ -28,8 +28,8 @@ public interface WebMemberApi { ) } ) - ResponseEntity> getMemberList( + ResponseEntity> getMembers( @RequestParam(required = false) Part part, - @RequestParam(required = false) Integer generation, + @RequestParam int generation, Pageable pageable); } diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/member/api/WebMemberApiController.java b/operation-api/src/main/java/org/sopt/makers/operation/web/member/api/WebMemberApiController.java index 5c9a3c32..0f39709b 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/member/api/WebMemberApiController.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/member/api/WebMemberApiController.java @@ -25,9 +25,9 @@ public class WebMemberApiController implements WebMemberApi { @Override @GetMapping("/list") - public ResponseEntity> getMemberList( + public ResponseEntity> getMembers( @RequestParam(required = false) Part part, - @RequestParam(required = false) Integer generation, + @RequestParam int generation, Pageable pageable ) { val response = memberService.getMembers(part, generation, pageable); diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/member/dto/response/MemberListResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/web/member/dto/response/MemberListGetResponse.java similarity index 60% rename from operation-api/src/main/java/org/sopt/makers/operation/web/member/dto/response/MemberListResponse.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/member/dto/response/MemberListGetResponse.java index b26eb7d6..477b28d9 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/member/dto/response/MemberListResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/member/dto/response/MemberListGetResponse.java @@ -1,5 +1,6 @@ package org.sopt.makers.operation.web.member.dto.response; +import static lombok.AccessLevel.*; import static org.sopt.makers.operation.attendance.domain.AttendanceStatus.*; import java.util.List; @@ -8,53 +9,52 @@ import org.sopt.makers.operation.attendance.domain.AttendanceStatus; import org.sopt.makers.operation.member.domain.Member; -import lombok.AccessLevel; import lombok.Builder; -@Builder(access = AccessLevel.PRIVATE) -public record MemberListResponse( - List members, +@Builder(access = PRIVATE) +public record MemberListGetResponse( + List members, int totalCount ) { - public static MemberListResponse of(List memberList, int totalCount) { - return MemberListResponse.builder() - .members(memberList.stream().map(MemberVO::of).toList()) + public static MemberListGetResponse of(List memberList, int totalCount) { + return MemberListGetResponse.builder() + .members(memberList.stream().map(MemberResponse::of).toList()) .totalCount(totalCount) .build(); } - @Builder(access = AccessLevel.PRIVATE) - private record MemberVO( - Long id, + @Builder(access = PRIVATE) + private record MemberResponse( + long id, String name, String university, Part part, float score, - AttendanceInfo total + AttendanceStatusResponse total ) { - private static MemberVO of(Member member) { - return MemberVO.builder() + private static MemberResponse of(Member member) { + return MemberResponse.builder() .id(member.getId()) .name(member.getName()) .university(member.getUniversity()) .part(member.getPart()) .score(member.getScore()) - .total(AttendanceInfo.of(member)) + .total(AttendanceStatusResponse.of(member)) .build(); } } - @Builder(access = AccessLevel.PRIVATE) - private record AttendanceInfo( + @Builder(access = PRIVATE) + private record AttendanceStatusResponse( int attendance, int absent, int tardy, int participate ) { - private static AttendanceInfo of(Member member) { - return AttendanceInfo.builder() + private static AttendanceStatusResponse of(Member member) { + return AttendanceStatusResponse.builder() .attendance(getCount(member, ATTENDANCE)) .absent(getCount(member, ABSENT)) .tardy(getCount(member, TARDY)) diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/member/service/WebMemberService.java b/operation-api/src/main/java/org/sopt/makers/operation/web/member/service/WebMemberService.java index ae5ac58b..2c8edacb 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/member/service/WebMemberService.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/member/service/WebMemberService.java @@ -1,9 +1,9 @@ package org.sopt.makers.operation.web.member.service; import org.sopt.makers.operation.common.domain.Part; -import org.sopt.makers.operation.web.member.dto.response.MemberListResponse; +import org.sopt.makers.operation.web.member.dto.response.MemberListGetResponse; import org.springframework.data.domain.Pageable; public interface WebMemberService { - MemberListResponse getMembers(Part part, int generation, Pageable pageable); + MemberListGetResponse getMembers(Part part, int generation, Pageable pageable); } diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/member/service/WebMemberServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/web/member/service/WebMemberServiceImpl.java index c84e5a27..c02a78eb 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/member/service/WebMemberServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/member/service/WebMemberServiceImpl.java @@ -2,7 +2,7 @@ import org.sopt.makers.operation.common.domain.Part; import org.sopt.makers.operation.member.repository.MemberRepository; -import org.sopt.makers.operation.web.member.dto.response.MemberListResponse; +import org.sopt.makers.operation.web.member.dto.response.MemberListGetResponse; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -18,9 +18,9 @@ public class WebMemberServiceImpl implements WebMemberService { private final MemberRepository memberRepository; @Override - public MemberListResponse getMembers(Part part, int generation, Pageable pageable) { - val memberList = memberRepository.find(generation, part, pageable); + public MemberListGetResponse getMembers(Part part, int generation, Pageable pageable) { + val members = memberRepository.find(generation, part, pageable); val totalCount = memberRepository.count(generation, part); - return MemberListResponse.of(memberList, totalCount); + return MemberListGetResponse.of(members, totalCount); } } diff --git a/operation-common/src/main/java/org/sopt/makers/operation/code/failure/AlarmFailureCode.java b/operation-common/src/main/java/org/sopt/makers/operation/code/failure/AlarmFailureCode.java index aeaef689..ce9ae1ac 100644 --- a/operation-common/src/main/java/org/sopt/makers/operation/code/failure/AlarmFailureCode.java +++ b/operation-common/src/main/java/org/sopt/makers/operation/code/failure/AlarmFailureCode.java @@ -11,6 +11,7 @@ @Getter public enum AlarmFailureCode implements FailureCode { FAIL_SEND_ALARM(BAD_REQUEST, "알림 전송에 실패하였습니다."), + SENT_ALARM(BAD_REQUEST, "전송된 알림입니다."), INVALID_ALARM(NOT_FOUND, "알림이 존재하지 않습니다."), FAIL_INACTIVE_USERS(BAD_REQUEST, "비활동 유저 불러오기에 실패하였습니다."), ; diff --git a/operation-common/src/main/java/org/sopt/makers/operation/config/ValueConfig.java b/operation-common/src/main/java/org/sopt/makers/operation/config/ValueConfig.java index 54081b76..90756781 100644 --- a/operation-common/src/main/java/org/sopt/makers/operation/config/ValueConfig.java +++ b/operation-common/src/main/java/org/sopt/makers/operation/config/ValueConfig.java @@ -28,6 +28,10 @@ public class ValueConfig { private String NOTIFICATION_KEY; @Value("${notification.url}") private String NOTIFICATION_URL; + @Value("${sopt.makers.playground.server}") + private String playGroundURI; + @Value("${sopt.makers.playground.token}") + private String playGroundToken; private final int SUB_LECTURE_MAX_ROUND = 2; private final String ETC_MESSAGE = "출석 점수가 반영되지 않아요."; @@ -35,6 +39,10 @@ public class ValueConfig { private final String EVENT_MESSAGE = "행사도 참여하고, 출석점수도 받고, 일석이조!"; private final String SWAGGER_URI = "/swagger-ui/**"; private final int ATTENDANCE_MINUTE = 10; + private final int MIN_SCHEDULE_DURATION = 1; + private final int MAX_SCHEDULE_DURATION = 50; + private final int DAY_DURATION = 1; + private final int TWO_DAYS_DURATION = 2; private final List APP_LINK_LIST = Arrays.asList( "home", diff --git a/operation-common/src/main/java/org/sopt/makers/operation/dto/BaseResponse.java b/operation-common/src/main/java/org/sopt/makers/operation/dto/BaseResponse.java index 65b13917..4fb2c888 100644 --- a/operation-common/src/main/java/org/sopt/makers/operation/dto/BaseResponse.java +++ b/operation-common/src/main/java/org/sopt/makers/operation/dto/BaseResponse.java @@ -1,5 +1,7 @@ package org.sopt.makers.operation.dto; +import static com.fasterxml.jackson.annotation.JsonInclude.Include.*; + import com.fasterxml.jackson.annotation.JsonInclude; import lombok.AccessLevel; @@ -9,7 +11,7 @@ public record BaseResponse ( boolean success, String message, - @JsonInclude(value = JsonInclude.Include.NON_NULL) + @JsonInclude(value = NON_NULL) T data ) { diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/alarm/domain/Alarm.java b/operation-domain/src/main/java/org/sopt/makers/operation/alarm/domain/Alarm.java index 3d3f4c35..93e029e8 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/alarm/domain/Alarm.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/alarm/domain/Alarm.java @@ -5,6 +5,7 @@ import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; +import java.util.Objects; import org.sopt.makers.operation.common.domain.BaseEntity; import org.sopt.makers.operation.common.domain.Part; @@ -103,12 +104,12 @@ public boolean isSent() { return this.status.equals(Status.AFTER); } - public boolean hasEmptyTargetList() { - return this.targetList.isEmpty(); - } - public void updateToSent() { this.status = Status.AFTER; this.sendAt = LocalDateTime.now(); } + + public boolean hasTargets() { + return Objects.isNull(this.isActive) || Objects.isNull(this.part); + } } diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/lecture/domain/SubLecture.java b/operation-domain/src/main/java/org/sopt/makers/operation/lecture/domain/SubLecture.java index 5204e6fa..840481d8 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/lecture/domain/SubLecture.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/lecture/domain/SubLecture.java @@ -48,9 +48,9 @@ public SubLecture(Lecture lecture, int round) { this.round = round; } - public void startAttendance(String code) { - this.startAt = LocalDateTime.now(); + public void updateCode(String code) { this.code = code; + this.startAt = LocalDateTime.now(); this.lecture.updateStatus(getUpdatedStatus()); } diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/lecture/repository/lecture/LectureCustomRepository.java b/operation-domain/src/main/java/org/sopt/makers/operation/lecture/repository/lecture/LectureCustomRepository.java index dcb2ca20..738e1679 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/lecture/repository/lecture/LectureCustomRepository.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/lecture/repository/lecture/LectureCustomRepository.java @@ -8,6 +8,5 @@ public interface LectureCustomRepository { List find(int generation, Part part); - List findLecturesToBeEnd(); - Optional find(Long lectureId); + List findLecturesReadyToEnd(); } diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/lecture/repository/lecture/LectureRepositoryImpl.java b/operation-domain/src/main/java/org/sopt/makers/operation/lecture/repository/lecture/LectureRepositoryImpl.java index 33f09eb1..281831ae 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/lecture/repository/lecture/LectureRepositoryImpl.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/lecture/repository/lecture/LectureRepositoryImpl.java @@ -7,7 +7,6 @@ import java.time.LocalDateTime; import java.util.List; -import java.util.Optional; import org.sopt.makers.operation.common.domain.Part; import org.sopt.makers.operation.lecture.domain.Lecture; @@ -37,7 +36,7 @@ public List find(int generation, Part part) { } @Override - public List findLecturesToBeEnd() { + public List findLecturesReadyToEnd() { return queryFactory .selectFrom(lecture) .leftJoin(lecture.attendances, attendance).fetchJoin().distinct() @@ -49,16 +48,6 @@ public List findLecturesToBeEnd() { .fetch(); } - @Override - public Optional find(Long lectureId) { - return queryFactory - .selectFrom(lecture) - .leftJoin(lecture.attendances, attendance).fetchJoin().distinct() - .leftJoin(attendance.member, member).fetchJoin().distinct() - .where(lecture.id.eq(lectureId)) - .stream().findFirst(); - } - private BooleanExpression partEq(Part part) { return nonNull(part) ? lecture.part.eq(part) : null; } diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/schedule/repository/ScheduleCustomRepository.java b/operation-domain/src/main/java/org/sopt/makers/operation/schedule/repository/ScheduleCustomRepository.java index 2e50bbfa..ce77b40d 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/schedule/repository/ScheduleCustomRepository.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/schedule/repository/ScheduleCustomRepository.java @@ -6,5 +6,5 @@ import org.sopt.makers.operation.schedule.domain.Schedule; public interface ScheduleCustomRepository { - List findBetweenStartAndEnd(LocalDateTime start, LocalDateTime end); + List findBetween(LocalDateTime startDate, LocalDateTime endDate); } diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/schedule/repository/ScheduleRepositoryImpl.java b/operation-domain/src/main/java/org/sopt/makers/operation/schedule/repository/ScheduleRepositoryImpl.java index b557fdcd..92090bab 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/schedule/repository/ScheduleRepositoryImpl.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/schedule/repository/ScheduleRepositoryImpl.java @@ -19,13 +19,17 @@ public class ScheduleRepositoryImpl implements ScheduleCustomRepository { private final JPAQueryFactory queryFactory; @Override - public List findBetweenStartAndEnd(LocalDateTime start, LocalDateTime end) { + public List findBetween(LocalDateTime startDate, LocalDateTime endDate) { return queryFactory .select(schedule) .from(schedule) .where( - schedule.startDate.between(start, end) - .or(schedule.endDate.between(start, end)) + schedule.startDate.eq(startDate) + .or(schedule.startDate.between(startDate, endDate)) + .or(schedule.startDate.eq(endDate)) + .or(schedule.endDate.eq(startDate)) + .or(schedule.endDate.between(startDate, endDate)) + .or(schedule.endDate.eq(endDate)) ) .orderBy(schedule.startDate.asc()) .fetch(); diff --git a/operation-external/src/main/java/org/sopt/makers/operation/client/playground/PlayGroundServer.java b/operation-external/src/main/java/org/sopt/makers/operation/client/playground/PlayGroundServer.java index 6ea44b8c..9230281e 100644 --- a/operation-external/src/main/java/org/sopt/makers/operation/client/playground/PlayGroundServer.java +++ b/operation-external/src/main/java/org/sopt/makers/operation/client/playground/PlayGroundServer.java @@ -1,8 +1,8 @@ package org.sopt.makers.operation.client.playground; -import org.sopt.makers.operation.client.playground.dto.InactiveMemberListResponse; +import org.sopt.makers.operation.client.playground.dto.MemberListGetResponse; import org.sopt.makers.operation.common.domain.Part; public interface PlayGroundServer { - InactiveMemberListResponse getInactiveMembers(int generation, Part part); + MemberListGetResponse getMembers(int generation, Part part); } diff --git a/operation-external/src/main/java/org/sopt/makers/operation/client/playground/PlayGroundServerImpl.java b/operation-external/src/main/java/org/sopt/makers/operation/client/playground/PlayGroundServerImpl.java index 1e4b651f..c48cd3f7 100644 --- a/operation-external/src/main/java/org/sopt/makers/operation/client/playground/PlayGroundServerImpl.java +++ b/operation-external/src/main/java/org/sopt/makers/operation/client/playground/PlayGroundServerImpl.java @@ -4,10 +4,10 @@ import static org.sopt.makers.operation.common.domain.Part.*; import static org.springframework.http.HttpMethod.*; -import org.sopt.makers.operation.client.playground.dto.InactiveMemberListResponse; +import org.sopt.makers.operation.client.playground.dto.MemberListGetResponse; import org.sopt.makers.operation.common.domain.Part; +import org.sopt.makers.operation.config.ValueConfig; import org.sopt.makers.operation.exception.AlarmException; -import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.stereotype.Component; @@ -19,31 +19,29 @@ @Component @RequiredArgsConstructor public class PlayGroundServerImpl implements PlayGroundServer { - private final RestTemplate restTemplate; - @Value("${sopt.makers.playground.server}") - private String playGroundURI; - @Value("${sopt.makers.playground.token}") - private String playGroundToken; + private final RestTemplate restTemplate; + private final ValueConfig valueConfig; @Override - public InactiveMemberListResponse getInactiveMembers(int generation, Part part) { - val uri = getInactiveUserURI(part, generation); + public MemberListGetResponse getMembers(int generation, Part part) { + val uri = getPlaygroundMemberUri(part, generation); val headers = getHeaders(); val entity = new HttpEntity<>(null, headers); try { - val response = restTemplate.exchange(uri, GET, entity, InactiveMemberListResponse.class); + val response = restTemplate.exchange(uri, GET, entity, MemberListGetResponse.class); return response.getBody(); } catch (Exception e) { throw new AlarmException(FAIL_INACTIVE_USERS); } } - private String getInactiveUserURI(Part part, int generation) { + private String getPlaygroundMemberUri(Part part, int generation) { val uri = new StringBuilder(); + val playGroundUri = valueConfig.getPlayGroundURI(); - uri.append(playGroundURI) + uri.append(playGroundUri) .append("/internal/api/v1/members/inactivity?generation=") .append(generation); @@ -56,8 +54,11 @@ private String getInactiveUserURI(Part part, int generation) { private HttpHeaders getHeaders() { val headers = new HttpHeaders(); + val playGroundToken = valueConfig.getPlayGroundToken(); + headers.add("content-type", "application/json;charset=UTF-8"); headers.add("Authorization", playGroundToken); + return headers; } } diff --git a/operation-external/src/main/java/org/sopt/makers/operation/client/playground/dto/InactiveMemberListResponse.java b/operation-external/src/main/java/org/sopt/makers/operation/client/playground/dto/MemberListGetResponse.java similarity index 72% rename from operation-external/src/main/java/org/sopt/makers/operation/client/playground/dto/InactiveMemberListResponse.java rename to operation-external/src/main/java/org/sopt/makers/operation/client/playground/dto/MemberListGetResponse.java index e4c7b6e9..15fab5f9 100644 --- a/operation-external/src/main/java/org/sopt/makers/operation/client/playground/dto/InactiveMemberListResponse.java +++ b/operation-external/src/main/java/org/sopt/makers/operation/client/playground/dto/MemberListGetResponse.java @@ -2,7 +2,7 @@ import java.util.List; -public record InactiveMemberListResponse( +public record MemberListGetResponse( List memberIds ) { } From c15cf7bb2a738f5c6a96031ca2f91949eca90c90 Mon Sep 17 00:00:00 2001 From: thguss Date: Thu, 15 Feb 2024 11:15:39 +0900 Subject: [PATCH 108/141] =?UTF-8?q?[REFACTOR]=20repository=20=EC=9D=B4?= =?UTF-8?q?=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../makers/operation/web/admin/service/AdminServiceImpl.java | 2 +- .../{domain => }/admin/repository/AdminRepository.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename operation-domain/src/main/java/org/sopt/makers/operation/{domain => }/admin/repository/AdminRepository.java (85%) diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/admin/service/AdminServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/web/admin/service/AdminServiceImpl.java index b18d02f4..f93e4861 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/admin/service/AdminServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/admin/service/AdminServiceImpl.java @@ -13,7 +13,7 @@ import org.sopt.makers.operation.web.admin.dto.request.LoginRequest; import org.sopt.makers.operation.web.admin.dto.response.LoginResponse; import org.sopt.makers.operation.web.admin.dto.response.RefreshResponse; -import org.sopt.makers.operation.domain.admin.repository.AdminRepository; +import org.sopt.makers.operation.admin.repository.AdminRepository; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/domain/admin/repository/AdminRepository.java b/operation-domain/src/main/java/org/sopt/makers/operation/admin/repository/AdminRepository.java similarity index 85% rename from operation-domain/src/main/java/org/sopt/makers/operation/domain/admin/repository/AdminRepository.java rename to operation-domain/src/main/java/org/sopt/makers/operation/admin/repository/AdminRepository.java index 6c8eb3de..f520b31a 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/domain/admin/repository/AdminRepository.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/admin/repository/AdminRepository.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.domain.admin.repository; +package org.sopt.makers.operation.admin.repository; import java.util.Optional; From e9fd01a03ab246af8a14132502b6d3ac44d81e48 Mon Sep 17 00:00:00 2001 From: thguss Date: Thu, 15 Feb 2024 11:23:12 +0900 Subject: [PATCH 109/141] =?UTF-8?q?[REFACTOR]=20domain=20=EB=AA=A8?= =?UTF-8?q?=EB=93=88=20=EB=A6=AC=ED=8C=A9=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../makers/operation/alarm/domain/Alarm.java | 1 + .../attendance/domain/Attendance.java | 46 ++++++++++--------- .../attendance/domain/AttendanceStatus.java | 8 +++- .../operation/lecture/domain/Attribute.java | 5 +- .../operation/lecture/domain/Lecture.java | 11 ++++- .../operation/lecture/domain/SubLecture.java | 16 +++---- .../subLecture/SubLectureRepository.java | 4 -- .../member/repository/MemberRepository.java | 1 - .../operation/schedule/domain/Schedule.java | 1 + 9 files changed, 55 insertions(+), 38 deletions(-) diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/alarm/domain/Alarm.java b/operation-domain/src/main/java/org/sopt/makers/operation/alarm/domain/Alarm.java index 93e029e8..9c33824b 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/alarm/domain/Alarm.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/alarm/domain/Alarm.java @@ -27,6 +27,7 @@ @NoArgsConstructor @Getter public class Alarm extends BaseEntity { + @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "alarm_id") diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/attendance/domain/Attendance.java b/operation-domain/src/main/java/org/sopt/makers/operation/attendance/domain/Attendance.java index 120938e3..8398cca1 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/attendance/domain/Attendance.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/attendance/domain/Attendance.java @@ -54,6 +54,22 @@ public Attendance(Member member, Lecture lecture) { this.status = ABSENT; } + private void setMember(Member member) { + if (Objects.nonNull(this.member)) { + this.member.getAttendances().remove(this); + } + this.member = member; + member.getAttendances().add(this); + } + + private void setLecture(Lecture lecture) { + if (Objects.nonNull(this.lecture)) { + this.lecture.getAttendances().remove(this); + } + this.lecture = lecture; + lecture.getAttendances().add(this); + } + public void updateStatus() { this.status = getStatus(); } @@ -61,6 +77,7 @@ public void updateStatus() { public AttendanceStatus getStatus() { val first = getSubAttendanceByRound(1); val second = getSubAttendanceByRound(2); + return switch (this.lecture.getAttribute()) { case SEMINAR -> second.getStatus().equals(ATTENDANCE) ? first.getStatus().equals(ATTENDANCE) ? ATTENDANCE : TARDY @@ -72,6 +89,7 @@ public AttendanceStatus getStatus() { public float getScore() { val lectureAttribute = this.lecture.getAttribute(); + return switch (lectureAttribute) { case SEMINAR -> { if (this.status.equals(ABSENT)) { @@ -95,28 +113,14 @@ public void restoreMemberScore() { this.member.updateScore((-1) * this.getScore()); } - private SubAttendance getSubAttendanceByRound(int round) { - return this.subAttendances.stream().filter(o -> o.getSubLecture().getRound() == round).findFirst() - .orElseThrow(() -> new AttendanceException(INVALID_SUB_ATTENDANCE)); - } - - private void setMember(Member member) { - if (Objects.nonNull(this.member)) { - this.member.getAttendances().remove(this); - } - this.member = member; - member.getAttendances().add(this); - } - - private void setLecture(Lecture lecture) { - if (Objects.nonNull(this.lecture)) { - this.lecture.getAttendances().remove(this); - } - this.lecture = lecture; - lecture.getAttendances().add(this); - } - public boolean isEnd() { return this.lecture.isEnd(); } + + private SubAttendance getSubAttendanceByRound(int round) { + return this.subAttendances.stream() + .filter(o -> o.getSubLecture().getRound() == round) + .findFirst() + .orElseThrow(() -> new AttendanceException(INVALID_SUB_ATTENDANCE)); + } } diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/attendance/domain/AttendanceStatus.java b/operation-domain/src/main/java/org/sopt/makers/operation/attendance/domain/AttendanceStatus.java index a8b496c2..1ad72922 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/attendance/domain/AttendanceStatus.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/attendance/domain/AttendanceStatus.java @@ -6,7 +6,13 @@ @AllArgsConstructor @Getter public enum AttendanceStatus { - ATTENDANCE("출석"), ABSENT("결석"), TARDY("지각"), LEAVE_EARLY("조퇴"), PARTICIPATE("참여"), NOT_PARTICIPATE("미참여"); + ATTENDANCE("출석"), + ABSENT("결석"), + TARDY("지각"), + LEAVE_EARLY("조퇴"), + PARTICIPATE("참여"), + NOT_PARTICIPATE("미참여") + ; final String name; } diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/lecture/domain/Attribute.java b/operation-domain/src/main/java/org/sopt/makers/operation/lecture/domain/Attribute.java index a2f273d9..1a46a21e 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/lecture/domain/Attribute.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/lecture/domain/Attribute.java @@ -6,7 +6,10 @@ @Getter @AllArgsConstructor public enum Attribute { - SEMINAR("세미나"), EVENT("행사"), ETC("기타"); + SEMINAR("세미나"), + EVENT("행사"), + ETC("기타"), + ; private final String name; } diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/lecture/domain/Lecture.java b/operation-domain/src/main/java/org/sopt/makers/operation/lecture/domain/Lecture.java index 77b85f1a..577982b3 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/lecture/domain/Lecture.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/lecture/domain/Lecture.java @@ -58,8 +58,15 @@ public class Lecture extends BaseEntity { List attendances = new ArrayList<>(); @Builder - public Lecture(String name, Part part, int generation, String place, LocalDateTime startDate, LocalDateTime endDate, - Attribute attribute) { + public Lecture( + String name, + Part part, + int generation, + String place, + LocalDateTime startDate, + LocalDateTime endDate, + Attribute attribute + ) { this.name = name; this.part = part; this.generation = generation; diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/lecture/domain/SubLecture.java b/operation-domain/src/main/java/org/sopt/makers/operation/lecture/domain/SubLecture.java index 840481d8..47b85b0f 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/lecture/domain/SubLecture.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/lecture/domain/SubLecture.java @@ -48,6 +48,14 @@ public SubLecture(Lecture lecture, int round) { this.round = round; } + private void setLecture(Lecture lecture) { + if (Objects.nonNull(this.lecture)) { + this.lecture.getSubLectures().remove(this); + } + this.lecture = lecture; + lecture.getSubLectures().add(this); + } + public void updateCode(String code) { this.code = code; this.startAt = LocalDateTime.now(); @@ -62,14 +70,6 @@ private LectureStatus getUpdatedStatus() { }; } - private void setLecture(Lecture lecture) { - if (Objects.nonNull(this.lecture)) { - this.lecture.getSubLectures().remove(this); - } - this.lecture = lecture; - lecture.getSubLectures().add(this); - } - public boolean isNotStarted() { return isNull(this.startAt) || isNull(this.code) || this.startAt.isAfter(LocalDateTime.now()); } diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/lecture/repository/subLecture/SubLectureRepository.java b/operation-domain/src/main/java/org/sopt/makers/operation/lecture/repository/subLecture/SubLectureRepository.java index 99b30998..f34934ea 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/lecture/repository/subLecture/SubLectureRepository.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/lecture/repository/subLecture/SubLectureRepository.java @@ -1,7 +1,5 @@ package org.sopt.makers.operation.lecture.repository.subLecture; -import java.util.Optional; - import org.sopt.makers.operation.lecture.domain.Lecture; import org.sopt.makers.operation.lecture.domain.SubLecture; import org.springframework.data.jpa.repository.JpaRepository; @@ -9,8 +7,6 @@ import org.springframework.data.jpa.repository.Query; public interface SubLectureRepository extends JpaRepository { - Optional findById(Long subLectureId); - @Modifying(clearAutomatically = true, flushAutomatically = true) @Query("delete from SubLecture sl where sl.lecture = :lecture") void deleteAllByLecture(Lecture lecture); diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/member/repository/MemberRepository.java b/operation-domain/src/main/java/org/sopt/makers/operation/member/repository/MemberRepository.java index fa970fe6..45184292 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/member/repository/MemberRepository.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/member/repository/MemberRepository.java @@ -7,5 +7,4 @@ public interface MemberRepository extends JpaRepository, MemberCustomRepository { Optional getMemberByPlaygroundIdAndGeneration(Long id, int generation); - boolean existsByPlaygroundId(Long id); } diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/schedule/domain/Schedule.java b/operation-domain/src/main/java/org/sopt/makers/operation/schedule/domain/Schedule.java index 5d14ce03..6852ef09 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/schedule/domain/Schedule.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/schedule/domain/Schedule.java @@ -19,6 +19,7 @@ @NoArgsConstructor @Getter public class Schedule extends BaseEntity { + @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "schedule_id") From a467f24a41715a79311aff48006505dceb404f07 Mon Sep 17 00:00:00 2001 From: dragontaek-lee Date: Fri, 16 Feb 2024 00:02:32 +0900 Subject: [PATCH 110/141] =?UTF-8?q?[REFATOR]=20attendance=20=EB=A6=AC?= =?UTF-8?q?=ED=8C=A9=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/attendance/api/AppAttendanceApi.java | 4 ++-- .../api/AppAttendanceApiController.java | 5 ++--- .../dto/request/LectureAttendRequest.java | 9 +++++++++ .../dto/response/LectureAttendResponse.java | 15 +++++++++++++++ .../attendance/service/AppAttendanceService.java | 6 +++--- .../service/AppAttendanceServiceImpl.java | 8 ++++---- 6 files changed, 35 insertions(+), 12 deletions(-) create mode 100644 operation-api/src/main/java/org/sopt/makers/operation/app/attendance/dto/request/LectureAttendRequest.java create mode 100644 operation-api/src/main/java/org/sopt/makers/operation/app/attendance/dto/response/LectureAttendResponse.java diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/api/AppAttendanceApi.java b/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/api/AppAttendanceApi.java index 28ba0ef9..cf6c86cb 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/api/AppAttendanceApi.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/api/AppAttendanceApi.java @@ -2,7 +2,7 @@ import java.security.Principal; -import org.sopt.makers.operation.app.attendance.dto.request.AttendanceRequest; +import org.sopt.makers.operation.app.attendance.dto.request.LectureAttendRequest; import org.sopt.makers.operation.dto.BaseResponse; import org.springframework.http.ResponseEntity; @@ -36,6 +36,6 @@ public interface AppAttendanceApi { } ) ResponseEntity> attend( - @RequestBody AttendanceRequest request, + @RequestBody LectureAttendRequest request, @Parameter(hidden = true) @NonNull Principal principal); } diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/api/AppAttendanceApiController.java b/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/api/AppAttendanceApiController.java index 627fd9de..0415f03b 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/api/AppAttendanceApiController.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/api/AppAttendanceApiController.java @@ -4,7 +4,7 @@ import java.security.Principal; -import org.sopt.makers.operation.app.attendance.dto.request.AttendanceRequest; +import org.sopt.makers.operation.app.attendance.dto.request.LectureAttendRequest; import org.sopt.makers.operation.app.attendance.service.AppAttendanceService; import org.sopt.makers.operation.common.util.CommonUtils; import org.sopt.makers.operation.util.ApiResponseUtil; @@ -15,7 +15,6 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import lombok.NonNull; import lombok.RequiredArgsConstructor; import lombok.val; @@ -29,7 +28,7 @@ public class AppAttendanceApiController implements AppAttendanceApi { @Override @PostMapping("/attend") - public ResponseEntity> attend(@RequestBody AttendanceRequest request, @NonNull Principal principal) { + public ResponseEntity> attend(@RequestBody LectureAttendRequest request, Principal principal) { val memberId = utils.getMemberId(principal); val response = attendanceService.attend(memberId, request); return ApiResponseUtil.success(SUCCESS_ATTEND, response); diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/dto/request/LectureAttendRequest.java b/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/dto/request/LectureAttendRequest.java new file mode 100644 index 00000000..794dd562 --- /dev/null +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/dto/request/LectureAttendRequest.java @@ -0,0 +1,9 @@ +package org.sopt.makers.operation.app.attendance.dto.request; + +import lombok.NonNull; + +public record LectureAttendRequest( + long subLectureId, + @NonNull String code +) { +} diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/dto/response/LectureAttendResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/dto/response/LectureAttendResponse.java new file mode 100644 index 00000000..5a50ea63 --- /dev/null +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/dto/response/LectureAttendResponse.java @@ -0,0 +1,15 @@ +package org.sopt.makers.operation.app.attendance.dto.response; + +import lombok.Builder; +import org.sopt.makers.operation.attendance.domain.SubAttendance; + +@Builder +public record LectureAttendResponse( + Long subLectureId +) { + public static LectureAttendResponse of(SubAttendance subAttendance) { + return LectureAttendResponse.builder() + .subLectureId(subAttendance.getSubLecture().getId()) + .build(); + } +} diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/service/AppAttendanceService.java b/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/service/AppAttendanceService.java index 5c14a275..3d0c5668 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/service/AppAttendanceService.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/service/AppAttendanceService.java @@ -1,8 +1,8 @@ package org.sopt.makers.operation.app.attendance.service; -import org.sopt.makers.operation.app.attendance.dto.request.AttendanceRequest; -import org.sopt.makers.operation.app.attendance.dto.response.AttendanceResponse; +import org.sopt.makers.operation.app.attendance.dto.request.LectureAttendRequest; +import org.sopt.makers.operation.app.attendance.dto.response.LectureAttendResponse; public interface AppAttendanceService { - AttendanceResponse attend(long memberId, AttendanceRequest request); + LectureAttendResponse attend(long memberId, LectureAttendRequest request); } diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/service/AppAttendanceServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/service/AppAttendanceServiceImpl.java index 7978e904..a72dee33 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/service/AppAttendanceServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/service/AppAttendanceServiceImpl.java @@ -6,8 +6,8 @@ import static org.sopt.makers.operation.code.failure.lecture.LectureFailureCode.*; import static org.sopt.makers.operation.code.failure.subLecture.subLectureFailureCode.*; -import org.sopt.makers.operation.app.attendance.dto.request.AttendanceRequest; -import org.sopt.makers.operation.app.attendance.dto.response.AttendanceResponse; +import org.sopt.makers.operation.app.attendance.dto.request.LectureAttendRequest; +import org.sopt.makers.operation.app.attendance.dto.response.LectureAttendResponse; import org.sopt.makers.operation.attendance.domain.Attendance; import org.sopt.makers.operation.attendance.domain.SubAttendance; import org.sopt.makers.operation.attendance.repository.attendance.AttendanceRepository; @@ -39,10 +39,10 @@ public class AppAttendanceServiceImpl implements AppAttendanceService { @Override @Transactional - public AttendanceResponse attend(long playgroundId, AttendanceRequest request) { + public LectureAttendResponse attend(long playgroundId, LectureAttendRequest request) { val subAttendance = getSubAttendance(request.subLectureId(), request.code(), playgroundId); subAttendance.updateStatus(ATTENDANCE); - return AttendanceResponse.of(subAttendance); + return LectureAttendResponse.of(subAttendance); } private SubAttendance getSubAttendance(long subLectureId, String code, long playgroundId) { From 492ef6d6b6c63a099d00f8e5e419c11a752097ce Mon Sep 17 00:00:00 2001 From: dragontaek-lee Date: Fri, 16 Feb 2024 00:03:04 +0900 Subject: [PATCH 111/141] =?UTF-8?q?[REFATOR]=20member=20=EB=A6=AC=ED=8C=A9?= =?UTF-8?q?=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/member/dto/response/AttendanceTotalResponseDTO.java | 1 - .../operation/app/member/service/AppMemberServiceImpl.java | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/member/dto/response/AttendanceTotalResponseDTO.java b/operation-api/src/main/java/org/sopt/makers/operation/app/member/dto/response/AttendanceTotalResponseDTO.java index d0c010ba..8758e2ff 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/app/member/dto/response/AttendanceTotalResponseDTO.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/member/dto/response/AttendanceTotalResponseDTO.java @@ -2,7 +2,6 @@ import java.util.List; -import org.sopt.makers.operation.app.attendance.dto.response.AttendanceTotalVO; import org.sopt.makers.operation.common.domain.Part; import org.sopt.makers.operation.member.domain.Member; diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/member/service/AppMemberServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/app/member/service/AppMemberServiceImpl.java index 7cdab0e9..f56a849a 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/app/member/service/AppMemberServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/member/service/AppMemberServiceImpl.java @@ -7,7 +7,7 @@ import java.util.List; import org.sopt.makers.operation.app.member.dto.response.AttendanceTotalResponseDTO; -import org.sopt.makers.operation.app.attendance.dto.response.AttendanceTotalVO; +import org.sopt.makers.operation.app.member.dto.response.AttendanceTotalVO; import org.sopt.makers.operation.app.member.dto.response.MemberScoreGetResponse; import org.sopt.makers.operation.attendance.repository.attendance.AttendanceRepository; import org.sopt.makers.operation.config.ValueConfig; From 3f3e9fc30d973d3d492f5baae85625fe490a7571 Mon Sep 17 00:00:00 2001 From: dragontaek-lee Date: Fri, 16 Feb 2024 00:04:03 +0900 Subject: [PATCH 112/141] =?UTF-8?q?[REFATOR]=20=EB=B6=88=ED=95=84=EC=9A=94?= =?UTF-8?q?=ED=95=9C=20DTO=20=EC=A0=9C=EA=B1=B0,=20member=20DTO=20?= =?UTF-8?q?=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../attendance/dto/request/AttendanceRequest.java | 9 --------- .../attendance/dto/response/AttendanceResponse.java | 12 ------------ .../dto/response/AttendanceTotalVO.java | 2 +- 3 files changed, 1 insertion(+), 22 deletions(-) delete mode 100644 operation-api/src/main/java/org/sopt/makers/operation/app/attendance/dto/request/AttendanceRequest.java delete mode 100644 operation-api/src/main/java/org/sopt/makers/operation/app/attendance/dto/response/AttendanceResponse.java rename operation-api/src/main/java/org/sopt/makers/operation/app/{attendance => member}/dto/response/AttendanceTotalVO.java (94%) diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/dto/request/AttendanceRequest.java b/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/dto/request/AttendanceRequest.java deleted file mode 100644 index 04df0c1c..00000000 --- a/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/dto/request/AttendanceRequest.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.sopt.makers.operation.app.attendance.dto.request; - -import lombok.NonNull; - -public record AttendanceRequest( - long subLectureId, - @NonNull String code -) { -} diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/dto/response/AttendanceResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/dto/response/AttendanceResponse.java deleted file mode 100644 index 20a398ce..00000000 --- a/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/dto/response/AttendanceResponse.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.sopt.makers.operation.app.attendance.dto.response; - -import org.sopt.makers.operation.attendance.domain.SubAttendance; - -public record AttendanceResponse( - Long subLectureId -) { - - public static AttendanceResponse of(SubAttendance subAttendance) { - return new AttendanceResponse(subAttendance.getSubLecture().getId()); - } -} diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/dto/response/AttendanceTotalVO.java b/operation-api/src/main/java/org/sopt/makers/operation/app/member/dto/response/AttendanceTotalVO.java similarity index 94% rename from operation-api/src/main/java/org/sopt/makers/operation/app/attendance/dto/response/AttendanceTotalVO.java rename to operation-api/src/main/java/org/sopt/makers/operation/app/member/dto/response/AttendanceTotalVO.java index e111af62..e9754509 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/dto/response/AttendanceTotalVO.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/member/dto/response/AttendanceTotalVO.java @@ -1,4 +1,4 @@ -package org.sopt.makers.operation.app.attendance.dto.response; +package org.sopt.makers.operation.app.member.dto.response; import java.time.format.DateTimeFormatter; From 2452b71855a7f71719d6072a7b4004fc0badada9 Mon Sep 17 00:00:00 2001 From: dragontaek-lee Date: Fri, 16 Feb 2024 00:04:32 +0900 Subject: [PATCH 113/141] =?UTF-8?q?[REFATOR]=20=EB=8B=B9=EC=9D=BC=20?= =?UTF-8?q?=EC=B6=9C=EC=84=9D=20=EC=A0=95=EB=B3=B4=20=EB=88=84=EB=9D=BD?= =?UTF-8?q?=EB=90=9C=20=EB=A1=9C=EC=A7=81=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/AppLectureServiceImpl.java | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/service/AppLectureServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/service/AppLectureServiceImpl.java index df0fd4d5..2d1c3442 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/service/AppLectureServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/service/AppLectureServiceImpl.java @@ -59,8 +59,12 @@ public TodayLectureResponse getTodayLecture(long memberPlaygroundId) { } val subAttendances = attendance.getSubAttendances(); - val subAttendance = lecture.isFirst() ? subAttendances.get(0) : subAttendances.get(1); - return getTodayLectureResponse(subAttendance, responseType, lecture); + + if (lecture.isFirst()) { + return getTodayFirstLectureResponse(subAttendances.get(0), responseType, lecture); + } + + return getTodaySecondLectureResponse(subAttendances, responseType, lecture); } private TodayLectureResponse getEmptyResponse() { @@ -104,7 +108,7 @@ private String getMessage(Attribute attribute) { }; } - private TodayLectureResponse getTodayLectureResponse(SubAttendance subAttendance, LectureResponseType responseType, Lecture lecture) { + private TodayLectureResponse getTodayFirstLectureResponse(SubAttendance subAttendance, LectureResponseType responseType, Lecture lecture) { val subLecture = subAttendance.getSubLecture(); val isOnAttendanceCheck = LocalDateTime.now().isBefore(subLecture.getStartAt().plusMinutes(10)); val message = getMessage(lecture.getAttribute()); @@ -114,6 +118,21 @@ private TodayLectureResponse getTodayLectureResponse(SubAttendance subAttendance return TodayLectureResponse.of(responseType, lecture, message, Collections.singletonList(subAttendance)); } + private TodayLectureResponse getTodaySecondLectureResponse( + List subAttendances, + LectureResponseType responseType, + Lecture lecture + ) { + val subAttendance = subAttendances.get(1); + val subLecture = subAttendance.getSubLecture(); + val isOnAttendanceCheck = LocalDateTime.now().isBefore(subLecture.getStartAt().plusMinutes(10)); + val message = getMessage(lecture.getAttribute()); + if (isOnAttendanceCheck && subAttendance.getStatus().equals(ABSENT)) { + return TodayLectureResponse.of(responseType, lecture, message, Collections.singletonList(subAttendances.get(0))); + } + return TodayLectureResponse.of(responseType, lecture, message, subAttendances); + } + @Override public LectureCurrentRoundResponse getCurrentLectureRound(long lectureId) { val lecture = findLecture(lectureId); From 6719fa49d2c94569ddd9e15bbf890de587615983 Mon Sep 17 00:00:00 2001 From: thguss Date: Fri, 16 Feb 2024 00:28:25 +0900 Subject: [PATCH 114/141] =?UTF-8?q?[ADD]=20NonNull=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/lecture/dto/request/SubLectureStartRequest.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/request/SubLectureStartRequest.java b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/request/SubLectureStartRequest.java index 71aadcef..aedeec2c 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/request/SubLectureStartRequest.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/dto/request/SubLectureStartRequest.java @@ -1,8 +1,10 @@ package org.sopt.makers.operation.web.lecture.dto.request; +import lombok.NonNull; + public record SubLectureStartRequest( long lectureId, int round, - String code + @NonNull String code ) { } From 9d03d55a73ecce3bd3c8822ca27655c75cca7a1b Mon Sep 17 00:00:00 2001 From: dragontaek-lee Date: Fri, 16 Feb 2024 00:33:43 +0900 Subject: [PATCH 115/141] =?UTF-8?q?[FIX]=20=EC=BD=94=EB=93=9C=EB=A6=AC?= =?UTF-8?q?=EB=B7=B0=20=EB=B0=98=EC=98=81:=20=EC=9B=90=EC=8B=9C=ED=83=80?= =?UTF-8?q?=EC=9E=85,=20PRIVATE=20=EC=98=B5=EC=85=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/response/LectureAttendResponse.java | 7 +++++-- .../response/LectureCurrentRoundResponse.java | 14 ++++++++----- .../dto/response/TodayLectureResponse.java | 21 ++++++++++++++++--- .../service/AppLectureServiceImpl.java | 15 +------------ .../response/AttendanceTotalResponseDTO.java | 20 +++++++++++------- .../dto/response/MemberScoreGetResponse.java | 11 +++++++--- 6 files changed, 53 insertions(+), 35 deletions(-) diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/dto/response/LectureAttendResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/dto/response/LectureAttendResponse.java index 5a50ea63..442b05b3 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/dto/response/LectureAttendResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/dto/response/LectureAttendResponse.java @@ -1,11 +1,14 @@ package org.sopt.makers.operation.app.attendance.dto.response; +import static lombok.AccessLevel.*; + import lombok.Builder; + import org.sopt.makers.operation.attendance.domain.SubAttendance; -@Builder +@Builder(access = PRIVATE) public record LectureAttendResponse( - Long subLectureId + long subLectureId ) { public static LectureAttendResponse of(SubAttendance subAttendance) { return LectureAttendResponse.builder() diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/dto/response/LectureCurrentRoundResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/dto/response/LectureCurrentRoundResponse.java index fec03c1f..231ea7c9 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/dto/response/LectureCurrentRoundResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/dto/response/LectureCurrentRoundResponse.java @@ -1,15 +1,19 @@ package org.sopt.makers.operation.app.lecture.dto.response; +import lombok.Builder; import org.sopt.makers.operation.lecture.domain.SubLecture; +import static lombok.AccessLevel.PRIVATE; + +@Builder(access = PRIVATE) public record LectureCurrentRoundResponse( - Long id, + long id, int round ) { public static LectureCurrentRoundResponse of(SubLecture subLecture){ - return new LectureCurrentRoundResponse( - subLecture.getId(), - subLecture.getRound() - ); + return LectureCurrentRoundResponse.builder() + .id(subLecture.getId()) + .round(subLecture.getRound()) + .build(); } } diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/dto/response/TodayLectureResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/dto/response/TodayLectureResponse.java index bfe8d1b4..e5de11eb 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/dto/response/TodayLectureResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/dto/response/TodayLectureResponse.java @@ -2,19 +2,22 @@ import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; +import java.util.Collections; import java.util.List; import java.util.stream.Collectors; +import static lombok.AccessLevel.*; + import org.sopt.makers.operation.attendance.domain.AttendanceStatus; import org.sopt.makers.operation.attendance.domain.SubAttendance; import org.sopt.makers.operation.lecture.domain.Lecture; import lombok.Builder; -@Builder +@Builder(access = PRIVATE) public record TodayLectureResponse( LectureResponseType type, - Long id, + long id, String location, String name, String startDate, @@ -23,7 +26,6 @@ public record TodayLectureResponse( List attendances ) { public static TodayLectureResponse of(LectureResponseType type, Lecture lecture, String message, List attendances) { - return TodayLectureResponse.builder() .type(type) .id(lecture.getId()) @@ -38,6 +40,19 @@ public static TodayLectureResponse of(LectureResponseType type, Lecture lecture, .build(); } + public static TodayLectureResponse getEmptyResponse() { + return TodayLectureResponse.builder() + .type(LectureResponseType.NO_SESSION) + .id(0L) + .location("") + .name("") + .startDate("") + .endDate("") + .message("") + .attendances(Collections.emptyList()) + .build(); + } + private static DateTimeFormatter convertFormat() { return DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss"); } diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/service/AppLectureServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/service/AppLectureServiceImpl.java index 2d1c3442..ee895ffb 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/service/AppLectureServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/service/AppLectureServiceImpl.java @@ -46,7 +46,7 @@ public TodayLectureResponse getTodayLecture(long memberPlaygroundId) { checkAttendancesSize(attendances); if (attendances.isEmpty()) { - return getEmptyResponse(); + return TodayLectureResponse.getEmptyResponse(); } val attendance = getNowAttendance(attendances); @@ -67,19 +67,6 @@ public TodayLectureResponse getTodayLecture(long memberPlaygroundId) { return getTodaySecondLectureResponse(subAttendances, responseType, lecture); } - private TodayLectureResponse getEmptyResponse() { - return TodayLectureResponse.builder() - .type(LectureResponseType.NO_SESSION) - .id(0L) - .location("") - .name("") - .startDate("") - .endDate("") - .message("") - .attendances(Collections.emptyList()) - .build(); - } - private void checkAttendancesSize(List attendances) { if (attendances.size() > valueConfig.getSUB_LECTURE_MAX_ROUND()) { throw new LectureException(INVALID_COUNT_SESSION); diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/member/dto/response/AttendanceTotalResponseDTO.java b/operation-api/src/main/java/org/sopt/makers/operation/app/member/dto/response/AttendanceTotalResponseDTO.java index 8758e2ff..1bf8f22a 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/app/member/dto/response/AttendanceTotalResponseDTO.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/member/dto/response/AttendanceTotalResponseDTO.java @@ -2,9 +2,13 @@ import java.util.List; +import lombok.Builder; import org.sopt.makers.operation.common.domain.Part; import org.sopt.makers.operation.member.domain.Member; +import static lombok.AccessLevel.PRIVATE; + +@Builder(access = PRIVATE) public record AttendanceTotalResponseDTO( Part part, int generation, @@ -14,14 +18,14 @@ public record AttendanceTotalResponseDTO( List attendances ) { public static AttendanceTotalResponseDTO of(Member member, List attendances){ - return new AttendanceTotalResponseDTO( - member.getPart(), - member.getGeneration(), - member.getName(), - member.getScore(), - getTotal(member), - attendances - ); + return AttendanceTotalResponseDTO.builder() + .part(member.getPart()) + .generation(member.getGeneration()) + .name(member.getName()) + .score(member.getScore()) + .total(getTotal(member)) + .attendances(attendances) + .build(); } private static AttendanceStatusListVO getTotal(Member member) { diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/member/dto/response/MemberScoreGetResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/app/member/dto/response/MemberScoreGetResponse.java index c15151bc..6dfc6601 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/app/member/dto/response/MemberScoreGetResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/member/dto/response/MemberScoreGetResponse.java @@ -1,11 +1,16 @@ package org.sopt.makers.operation.app.member.dto.response; +import static lombok.AccessLevel.PRIVATE; + +import lombok.Builder; + +@Builder(access = PRIVATE) public record MemberScoreGetResponse( float score ) { public static MemberScoreGetResponse of(float score){ - return new MemberScoreGetResponse( - score - ); + return MemberScoreGetResponse.builder() + .score(score) + .build(); } } From dca3eda1469e2f5890e53fd9a42580664f449da9 Mon Sep 17 00:00:00 2001 From: dragontaek-lee Date: Fri, 16 Feb 2024 00:39:00 +0900 Subject: [PATCH 116/141] =?UTF-8?q?[REFACTOR]=20=EC=B6=9C=EC=84=9D=20?= =?UTF-8?q?=EC=A4=91=20=EA=B2=B0=EC=84=9D=20=ED=8C=90=EB=B3=84=20=EB=A9=94?= =?UTF-8?q?=EC=86=8C=EB=93=9C=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/lecture/service/AppLectureServiceImpl.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/service/AppLectureServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/service/AppLectureServiceImpl.java index ee895ffb..7f5fe825 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/service/AppLectureServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/service/AppLectureServiceImpl.java @@ -73,6 +73,11 @@ private void checkAttendancesSize(List attendances) { } } + private boolean checkOnAttendanceAbsence(SubLecture subLecture, SubAttendance subAttendance) { + val isOnAttendanceCheck = LocalDateTime.now().isBefore(subLecture.getStartAt().plusMinutes(10)); + return isOnAttendanceCheck && subAttendance.getStatus().equals(ABSENT); + } + private Attendance getNowAttendance(List attendances) { val index = getAttendanceIndex(); return attendances.get(index); @@ -97,9 +102,8 @@ private String getMessage(Attribute attribute) { private TodayLectureResponse getTodayFirstLectureResponse(SubAttendance subAttendance, LectureResponseType responseType, Lecture lecture) { val subLecture = subAttendance.getSubLecture(); - val isOnAttendanceCheck = LocalDateTime.now().isBefore(subLecture.getStartAt().plusMinutes(10)); val message = getMessage(lecture.getAttribute()); - if (isOnAttendanceCheck && subAttendance.getStatus().equals(ABSENT)) { + if (checkOnAttendanceAbsence(subLecture, subAttendance)) { return TodayLectureResponse.of(responseType, lecture, message, Collections.emptyList()); } return TodayLectureResponse.of(responseType, lecture, message, Collections.singletonList(subAttendance)); @@ -112,9 +116,8 @@ private TodayLectureResponse getTodaySecondLectureResponse( ) { val subAttendance = subAttendances.get(1); val subLecture = subAttendance.getSubLecture(); - val isOnAttendanceCheck = LocalDateTime.now().isBefore(subLecture.getStartAt().plusMinutes(10)); val message = getMessage(lecture.getAttribute()); - if (isOnAttendanceCheck && subAttendance.getStatus().equals(ABSENT)) { + if (checkOnAttendanceAbsence(subLecture, subAttendance)) { return TodayLectureResponse.of(responseType, lecture, message, Collections.singletonList(subAttendances.get(0))); } return TodayLectureResponse.of(responseType, lecture, message, subAttendances); From b8219223bbca1f3df26010c9eb93a6b7f2761e9e Mon Sep 17 00:00:00 2001 From: thguss Date: Fri, 16 Feb 2024 01:10:19 +0900 Subject: [PATCH 117/141] =?UTF-8?q?[FIX]=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20?= =?UTF-8?q?=EA=B2=BD=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 --- .../java/org/sopt/makers/operation/config/SecurityConfig.java | 2 ++ .../sopt/makers/operation/filter/JwtAuthenticationFilter.java | 2 +- scripts/health_check.sh | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/operation-auth/src/main/java/org/sopt/makers/operation/config/SecurityConfig.java b/operation-auth/src/main/java/org/sopt/makers/operation/config/SecurityConfig.java index b3786a58..ce3aa176 100644 --- a/operation-auth/src/main/java/org/sopt/makers/operation/config/SecurityConfig.java +++ b/operation-auth/src/main/java/org/sopt/makers/operation/config/SecurityConfig.java @@ -49,6 +49,7 @@ public SecurityFilterChain filterChainProd(HttpSecurity http) throws Exception { setHttp(http); return http.build(); } + private void setHttp(HttpSecurity http) throws Exception { http.httpBasic().disable() .csrf().disable() @@ -58,6 +59,7 @@ private void setHttp(HttpSecurity http) throws Exception { .authorizeHttpRequests(authorizeHttpRequests -> authorizeHttpRequests .requestMatchers(new AntPathRequestMatcher("/api/v1/auth/*")).permitAll() + .requestMatchers(new AntPathRequestMatcher("/api/v1/test/**")).permitAll() .requestMatchers(new AntPathRequestMatcher("/error")).permitAll() .anyRequest().authenticated()) .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS) diff --git a/operation-auth/src/main/java/org/sopt/makers/operation/filter/JwtAuthenticationFilter.java b/operation-auth/src/main/java/org/sopt/makers/operation/filter/JwtAuthenticationFilter.java index eed6ec00..7440b615 100644 --- a/operation-auth/src/main/java/org/sopt/makers/operation/filter/JwtAuthenticationFilter.java +++ b/operation-auth/src/main/java/org/sopt/makers/operation/filter/JwtAuthenticationFilter.java @@ -29,7 +29,7 @@ public class JwtAuthenticationFilter extends OncePerRequestFilter { public void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException { val uri = request.getRequestURI(); - if ((uri.startsWith("/api/v1")) && !uri.contains("auth")) { + if ((uri.startsWith("/api/v1")) && !uri.contains("auth") && !uri.contains("test")) { val token = jwtTokenProvider.resolveToken(request); val jwtTokenType = validateTokenType(request); diff --git a/scripts/health_check.sh b/scripts/health_check.sh index 9f72a26a..a6390126 100644 --- a/scripts/health_check.sh +++ b/scripts/health_check.sh @@ -13,12 +13,12 @@ else fi -echo "> Start health check of WAS at 'http://127.0.0.1:${TARGET_PORT}' ..." +echo "> Start health check of WAS at 'http://127.0.0.1:${TARGET_PORT}/api/v1/test' ..." for RETRY_COUNT in {1..10} do echo "> #${RETRY_COUNT} trying..." - RESPONSE_CODE=$(curl -s -o /dev/null -w "%{http_code}" http://127.0.0.1:${TARGET_PORT}) + RESPONSE_CODE=$(curl -s -o /dev/null -w "%{http_code}" http://127.0.0.1:${TARGET_PORT}/api/v1/test) if [ ${RESPONSE_CODE} -eq 200 ]; then echo "> New WAS successfully running" From 8318ebbb67dc4c99efe3f8e4c3ae306580e852d0 Mon Sep 17 00:00:00 2001 From: thguss Date: Fri, 16 Feb 2024 01:25:09 +0900 Subject: [PATCH 118/141] =?UTF-8?q?[FIX]=20=EA=B2=BD=EB=A1=9C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/run_new_was.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/run_new_was.sh b/scripts/run_new_was.sh index 195b050b..ac5c1dab 100644 --- a/scripts/run_new_was.sh +++ b/scripts/run_new_was.sh @@ -22,13 +22,13 @@ fi if [ "$DEPLOYMENT_GROUP_NAME" == "prod" ] then - nohup java -jar -Dserver.port=${TARGET_PORT} -Dspring.profiles.active=prod /home/ubuntu/operation/build/libs/operation-0.0.1-SNAPSHOT.jar > /dev/null 2> /dev/null < /dev/null & + nohup java -jar -Dserver.port=${TARGET_PORT} -Dspring.profiles.active=prod /home/ubuntu/operation/operation-api/build/libs/operation-api-0.0.1-SNAPSHOT.jar > /dev/null 2> /dev/null < /dev/null & echo "> Now new WAS runs at ${TARGET_PORT}." fi if [ "$DEPLOYMENT_GROUP_NAME" == "dev" ] then - nohup java -jar -Dserver.port=${TARGET_PORT} -Dspring.profiles.active=dev /home/ubuntu/operation/build/libs/operation-0.0.1-SNAPSHOT.jar > /dev/null 2> /dev/null < /dev/null & + nohup java -jar -Dserver.port=${TARGET_PORT} -Dspring.profiles.active=dev /home/ubuntu/operation/operation-api/build/libs/operation-api-0.0.1-SNAPSHOT.jar > /dev/null 2> /dev/null < /dev/null & echo "> Now new WAS runs at ${TARGET_PORT}." fi From e06d45c6eb2d061a47324c59cc88976b32539750 Mon Sep 17 00:00:00 2001 From: dragontaek-lee Date: Sat, 17 Feb 2024 18:38:09 +0900 Subject: [PATCH 119/141] =?UTF-8?q?[REFACTOR]=20=EB=8B=A8=EC=9D=BC=20?= =?UTF-8?q?=EC=84=B8=EB=AF=B8=EB=82=98=20=EC=83=81=ED=83=9C=20=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C=20=EB=B0=98=ED=99=98=20=EA=B0=92=20=EB=A6=AC=ED=8C=A9?= =?UTF-8?q?=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/AppLectureServiceImpl.java | 64 ++++++++++++------- 1 file changed, 42 insertions(+), 22 deletions(-) diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/service/AppLectureServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/service/AppLectureServiceImpl.java index 7f5fe825..52370190 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/service/AppLectureServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/service/AppLectureServiceImpl.java @@ -60,11 +60,7 @@ public TodayLectureResponse getTodayLecture(long memberPlaygroundId) { val subAttendances = attendance.getSubAttendances(); - if (lecture.isFirst()) { - return getTodayFirstLectureResponse(subAttendances.get(0), responseType, lecture); - } - - return getTodaySecondLectureResponse(subAttendances, responseType, lecture); + return getTodayLectureResponse(subAttendances, responseType, lecture); } private void checkAttendancesSize(List attendances) { @@ -79,12 +75,21 @@ private boolean checkOnAttendanceAbsence(SubLecture subLecture, SubAttendance su } private Attendance getNowAttendance(List attendances) { - val index = getAttendanceIndex(); + val index = getAttendanceIndex(attendances); return attendances.get(index); } - private int getAttendanceIndex() { - return (LocalDateTime.now().getHour() >= 16) ? 1 : 0; + private int getAttendanceIndex(List attendances) { + return (LocalDateTime.now().getHour() >= 16 && attendances.size() == 2) ? 1 : 0; + } + + private SubAttendance getNowSubAttendance(List subAttendances, Lecture lecture) { + val index = getSubAttendanceIndex(lecture); + return subAttendances.get(index); + } + + private int getSubAttendanceIndex(Lecture lecture) { + return lecture.isFirst() ? 0 : 1; } private LectureResponseType getResponseType(Lecture lecture) { @@ -100,27 +105,42 @@ private String getMessage(Attribute attribute) { }; } - private TodayLectureResponse getTodayFirstLectureResponse(SubAttendance subAttendance, LectureResponseType responseType, Lecture lecture) { + private TodayLectureResponse getTodayLectureResponse( + List subAttendances, + LectureResponseType responseType, + Lecture lecture + ) { + val subAttendance = getNowSubAttendance(subAttendances, lecture); val subLecture = subAttendance.getSubLecture(); val message = getMessage(lecture.getAttribute()); + if (checkOnAttendanceAbsence(subLecture, subAttendance)) { - return TodayLectureResponse.of(responseType, lecture, message, Collections.emptyList()); + return getOnAttendanceLectureResponse(subAttendance, lecture, responseType, message); } - return TodayLectureResponse.of(responseType, lecture, message, Collections.singletonList(subAttendance)); + + return getAttendanceLectureResponse(subAttendances, lecture, responseType, message); } - private TodayLectureResponse getTodaySecondLectureResponse( - List subAttendances, - LectureResponseType responseType, - Lecture lecture + private TodayLectureResponse getOnAttendanceLectureResponse( + SubAttendance subAttendance, + Lecture lecture, + LectureResponseType responseType, + String message ) { - val subAttendance = subAttendances.get(1); - val subLecture = subAttendance.getSubLecture(); - val message = getMessage(lecture.getAttribute()); - if (checkOnAttendanceAbsence(subLecture, subAttendance)) { - return TodayLectureResponse.of(responseType, lecture, message, Collections.singletonList(subAttendances.get(0))); - } - return TodayLectureResponse.of(responseType, lecture, message, subAttendances); + return lecture.isFirst() + ? TodayLectureResponse.of(responseType, lecture, message, Collections.emptyList()) + : TodayLectureResponse.of(responseType, lecture, message, Collections.singletonList(subAttendance)); + } + + private TodayLectureResponse getAttendanceLectureResponse( + List subAttendances, + Lecture lecture, + LectureResponseType responseType, + String message + ) { + return lecture.isFirst() + ? TodayLectureResponse.of(responseType, lecture, message, Collections.singletonList(getNowSubAttendance(subAttendances, lecture))) + : TodayLectureResponse.of(responseType, lecture, message, subAttendances); } @Override From a2ee522b0f3c9daea69c609267dafa828d80534c Mon Sep 17 00:00:00 2001 From: dragontaek-lee Date: Sun, 18 Feb 2024 22:40:57 +0900 Subject: [PATCH 120/141] =?UTF-8?q?[FIX]=20=EC=BD=94=EB=93=9C=20=EA=B2=80?= =?UTF-8?q?=EC=A6=9D=20=EB=A1=9C=EC=A7=81=20=EC=98=A4=EB=A5=98=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/attendance/service/AppAttendanceServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/service/AppAttendanceServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/service/AppAttendanceServiceImpl.java index a72dee33..af4f4b59 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/service/AppAttendanceServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/attendance/service/AppAttendanceServiceImpl.java @@ -83,7 +83,7 @@ private void checkSubLectureEnded(SubLecture subLecture) { } private void checkMatchedCode(SubLecture subLecture, String code) { - if (subLecture.isMatchCode(code)) { + if (!subLecture.isMatchCode(code)) { throw new SubLectureException(INVALID_CODE); } } From f9ad834e85ff3c433456dd14fcafbaeba9c0b98b Mon Sep 17 00:00:00 2001 From: thguss Date: Sun, 18 Feb 2024 22:44:22 +0900 Subject: [PATCH 121/141] =?UTF-8?q?[FIX]=20=EC=84=B8=EC=85=98=20=EC=A2=85?= =?UTF-8?q?=EB=A3=8C=20=EC=98=88=EC=99=B8=EC=B2=98=EB=A6=AC=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operation/web/lecture/api/WebLectureApiController.java | 2 +- .../operation/web/lecture/service/WebLectureServiceImpl.java | 5 ++++- .../operation/code/success/web/LectureSuccessCode.java | 1 + .../org/sopt/makers/operation/lecture/domain/Lecture.java | 4 ++++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/api/WebLectureApiController.java b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/api/WebLectureApiController.java index 4ecd093c..33913f1e 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/api/WebLectureApiController.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/api/WebLectureApiController.java @@ -64,7 +64,7 @@ public ResponseEntity> startSubLecture(SubLectureStartRequest re @PatchMapping("/{lectureId}") public ResponseEntity> endLecture(@PathVariable long lectureId) { lectureService.endLecture(lectureId); - return ApiResponseUtil.success(SUCCESS_UPDATE_MEMBER_SCORE); + return ApiResponseUtil.success(SUCCESS_END_LECTURE); } @Override diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/service/WebLectureServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/service/WebLectureServiceImpl.java index d0c3411d..a350ff54 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/service/WebLectureServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/service/WebLectureServiceImpl.java @@ -165,9 +165,12 @@ private SubLecture getSubLectureToStartAttendance(Lecture lecture, int round) { private Lecture getLectureReadyToEnd(long lectureId) { val lecture = findLecture(lectureId); - if (!lecture.isEnd()) { + if (lecture.isNotYetToEnd()) { throw new LectureException(NOT_END_TIME_YET); } + if (lecture.isEnd()) { + throw new LectureException(END_LECTURE); + } return lecture; } diff --git a/operation-common/src/main/java/org/sopt/makers/operation/code/success/web/LectureSuccessCode.java b/operation-common/src/main/java/org/sopt/makers/operation/code/success/web/LectureSuccessCode.java index f466151b..beeee546 100644 --- a/operation-common/src/main/java/org/sopt/makers/operation/code/success/web/LectureSuccessCode.java +++ b/operation-common/src/main/java/org/sopt/makers/operation/code/success/web/LectureSuccessCode.java @@ -18,6 +18,7 @@ public enum LectureSuccessCode implements SuccessCode { SUCCESS_GET_MEMBERS(OK, "유저 리스트 조회 성공"), SUCCESS_DELETE_LECTURE(OK, "세션 삭제 성공"), SUCCESS_UPDATE_MEMBER_SCORE(OK, "회원 출석 점수 갱신 성공"), + SUCCESS_END_LECTURE(OK, "세션 종료 성공"), ; private final HttpStatus status; diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/lecture/domain/Lecture.java b/operation-domain/src/main/java/org/sopt/makers/operation/lecture/domain/Lecture.java index 577982b3..7d412863 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/lecture/domain/Lecture.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/lecture/domain/Lecture.java @@ -97,4 +97,8 @@ public boolean isBefore() { public boolean isFirst() { return this.lectureStatus.equals(FIRST); } + + public boolean isNotYetToEnd() { + return this.endDate.isAfter(LocalDateTime.now()); + } } From 120c9468c4ad8da7ba7a46a6f89a1fc7d20ff314 Mon Sep 17 00:00:00 2001 From: dragontaek-lee Date: Sun, 18 Feb 2024 22:51:17 +0900 Subject: [PATCH 122/141] =?UTF-8?q?[FIX]=20=ED=9A=8C=EC=9B=90=EA=B0=80?= =?UTF-8?q?=EC=9E=85=20=EB=B9=84=EB=B0=80=EB=B2=88=ED=98=B8=20=EC=95=94?= =?UTF-8?q?=ED=98=B8=ED=99=94=20=EB=88=84=EB=9D=BD=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operation/web/admin/dto/request/SignUpRequest.java | 4 ++-- .../makers/operation/web/admin/service/AdminServiceImpl.java | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/admin/dto/request/SignUpRequest.java b/operation-api/src/main/java/org/sopt/makers/operation/web/admin/dto/request/SignUpRequest.java index 87f77268..8fed9817 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/admin/dto/request/SignUpRequest.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/admin/dto/request/SignUpRequest.java @@ -10,10 +10,10 @@ public record SignUpRequest( Role role ) { - public Admin toEntity() { + public Admin toEntity(String encodedPassword) { return Admin.builder() .email(this.email) - .password(this.password) + .password(encodedPassword) .name(this.name) .role(this.role) .build(); diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/admin/service/AdminServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/web/admin/service/AdminServiceImpl.java index f93e4861..6c2c1e17 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/admin/service/AdminServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/admin/service/AdminServiceImpl.java @@ -34,7 +34,8 @@ public class AdminServiceImpl implements AdminService { @Transactional public SignUpResponse signUp(SignUpRequest request){ checkEmailDuplicated(request.email()); - val admin = adminRepository.save(request.toEntity()); + val entity = request.toEntity(passwordEncoder.encode(request.password())); + val admin = adminRepository.save(entity); return SignUpResponse.of(admin); } @@ -72,7 +73,7 @@ private Admin findByEmail(String email) { .orElseThrow(() -> new AdminFailureException(INVALID_EMAIL)); } - private void checkPasswordMatched(String password, Admin admin) { // TODO: admin 내부로 옮기는 게 좋지 않을까..? + private void checkPasswordMatched(String password, Admin admin) { if (!passwordEncoder.matches(password, admin.getPassword())) { throw new AdminFailureException(INVALID_PASSWORD); } From 8ea47c170ba175caf533a35d0c52a21ee1df0bbb Mon Sep 17 00:00:00 2001 From: thguss Date: Sun, 18 Feb 2024 22:55:53 +0900 Subject: [PATCH 123/141] =?UTF-8?q?[FIX]=20JPA=20=EB=A9=94=EC=86=8C?= =?UTF-8?q?=EB=93=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operation/web/lecture/service/WebLectureServiceImpl.java | 2 +- .../attendance/repository/attendance/AttendanceRepository.java | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/service/WebLectureServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/service/WebLectureServiceImpl.java index a350ff54..c11adc30 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/service/WebLectureServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/lecture/service/WebLectureServiceImpl.java @@ -193,7 +193,7 @@ private void restoreAttendances(List attendances) { private void deleteRelationship(Lecture lecture) { subAttendanceRepository.deleteAllBySubLectureIn(lecture.getSubLectures()); subLectureRepository.deleteAllByLecture(lecture); - attendanceRepository.deleteAllByLecture(lecture); + attendanceRepository.deleteByLecture(lecture); } } diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/attendance/repository/attendance/AttendanceRepository.java b/operation-domain/src/main/java/org/sopt/makers/operation/attendance/repository/attendance/AttendanceRepository.java index e8741851..01bdf46e 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/attendance/repository/attendance/AttendanceRepository.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/attendance/repository/attendance/AttendanceRepository.java @@ -10,6 +10,5 @@ public interface AttendanceRepository extends JpaRepository, AttendanceCustomRepository { Optional findByLectureAndMember(Lecture lecture, Member member); - @Query("delete from Attendance a where a.lecture = :lecture") - void deleteAllByLecture(Lecture lecture); + void deleteByLecture(Lecture lecture); } From 4ee19c5b9fa0d49715572386531c9c7a590bf42a Mon Sep 17 00:00:00 2001 From: dragontaek-lee Date: Sun, 18 Feb 2024 23:04:05 +0900 Subject: [PATCH 124/141] =?UTF-8?q?[REFACTOR]=20=EB=A6=AC=ED=94=84?= =?UTF-8?q?=EB=A0=88=EC=8B=9C=20=EC=97=91=EC=84=B8=EC=8A=A4=EB=A7=8C=20?= =?UTF-8?q?=EA=B0=B1=EC=8B=A0=ED=95=98=EB=8F=84=EB=A1=9D=20=EB=A1=9C?= =?UTF-8?q?=EC=A7=81=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/admin/api/AdminApiController.java | 3 +-- .../web/admin/dto/response/RefreshResponse.java | 14 +++++++++----- .../web/admin/service/AdminServiceImpl.java | 4 ++-- .../makers/operation/admin/domain/Admin.java | 16 +++++++--------- 4 files changed, 19 insertions(+), 18 deletions(-) diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/admin/api/AdminApiController.java b/operation-api/src/main/java/org/sopt/makers/operation/web/admin/api/AdminApiController.java index 8273df83..d173ffc3 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/admin/api/AdminApiController.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/admin/api/AdminApiController.java @@ -46,7 +46,6 @@ public ResponseEntity> login(LoginRequest userLoginRequestDTO) { @PatchMapping("/refresh") public ResponseEntity> refresh(String refreshToken) { val response = authService.refresh(refreshToken); - val headers = cookie.setRefreshToken(response.refreshToken()); - return ApiResponseUtil.success(SUCCESS_GET_REFRESH_TOKEN, headers, response.accessToken()); + return ApiResponseUtil.success(SUCCESS_GET_REFRESH_TOKEN, response); } } diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/admin/dto/response/RefreshResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/web/admin/dto/response/RefreshResponse.java index a66ef05b..b52b20df 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/admin/dto/response/RefreshResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/admin/dto/response/RefreshResponse.java @@ -1,13 +1,17 @@ package org.sopt.makers.operation.web.admin.dto.response; -import org.sopt.makers.operation.admin.domain.Admin; +import lombok.Builder; +import static lombok.AccessLevel.PRIVATE; + +@Builder(access = PRIVATE) public record RefreshResponse( - String accessToken, - String refreshToken + String accessToken ) { - public static RefreshResponse of(String accessToken, Admin admin) { - return new RefreshResponse(accessToken, admin.getRefreshToken()); + public static RefreshResponse of(String accessToken) { + return RefreshResponse.builder() + .accessToken(accessToken) + .build(); } } \ No newline at end of file diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/admin/service/AdminServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/web/admin/service/AdminServiceImpl.java index 6c2c1e17..c4364672 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/admin/service/AdminServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/admin/service/AdminServiceImpl.java @@ -93,11 +93,11 @@ public RefreshResponse refresh(String refreshToken) { validateRefreshToken(admin, refreshToken); val newAccessToken = generateAccessToken(admin); - return RefreshResponse.of(newAccessToken, admin); + return RefreshResponse.of(newAccessToken); } public void validateRefreshToken(Admin admin, String refreshToken) { - if(!admin.getRefreshToken().equals(refreshToken)) { + if (!admin.isMatchRefreshToken(refreshToken)) { throw new AdminFailureException(INVALID_REFRESH_TOKEN); } } diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/admin/domain/Admin.java b/operation-domain/src/main/java/org/sopt/makers/operation/admin/domain/Admin.java index 0e09590e..d2921d0b 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/admin/domain/Admin.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/admin/domain/Admin.java @@ -11,6 +11,9 @@ import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; +import org.sopt.makers.operation.exception.AdminFailureException; + +import static org.sopt.makers.operation.code.failure.admin.AdminFailureCode.INVALID_REFRESH_TOKEN; @Getter @Setter @@ -40,15 +43,6 @@ public class Admin { @Column(name="refresh_token") private String refreshToken; - @Builder - public Admin(String email, String password, String name, Role role) { - this.email = email; - this.password = password; - this.name = name; - this.role = role; - this.status = AdminStatus.NOT_CERTIFIED; - } - public void updateRefreshToken(String refreshToken) { this.refreshToken = refreshToken; } @@ -56,4 +50,8 @@ public void updateRefreshToken(String refreshToken) { public boolean isNotAllowed() { return this.status.equals(AdminStatus.NOT_CERTIFIED); } + + public boolean isMatchRefreshToken(String refreshToken) { + return this.getRefreshToken().equals(refreshToken); + } } From 1e57f5c130a30c26ee77ae4ad0c949394ae00f23 Mon Sep 17 00:00:00 2001 From: dragontaek-lee Date: Sun, 18 Feb 2024 23:04:25 +0900 Subject: [PATCH 125/141] =?UTF-8?q?[REFACTOR]=20builder=20access=20static?= =?UTF-8?q?=ED=95=98=EA=B2=8C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operation/web/admin/dto/response/LoginResponse.java | 8 ++++---- .../operation/web/admin/dto/response/SignUpResponse.java | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/admin/dto/response/LoginResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/web/admin/dto/response/LoginResponse.java index 6aa415e7..9f72926b 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/admin/dto/response/LoginResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/admin/dto/response/LoginResponse.java @@ -1,12 +1,12 @@ package org.sopt.makers.operation.web.admin.dto.response; -import lombok.AccessLevel; -import lombok.Builder; - import org.sopt.makers.operation.admin.domain.Admin; import org.sopt.makers.operation.admin.domain.AdminStatus; +import lombok.Builder; + +import static lombok.AccessLevel.PRIVATE; -@Builder(access = AccessLevel.PRIVATE) +@Builder(access = PRIVATE) public record LoginResponse( LoginResponseVO loginResponseVO, String refreshToken diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/admin/dto/response/SignUpResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/web/admin/dto/response/SignUpResponse.java index ad36d462..319c8322 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/admin/dto/response/SignUpResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/admin/dto/response/SignUpResponse.java @@ -2,11 +2,11 @@ import org.sopt.makers.operation.admin.domain.Admin; import org.sopt.makers.operation.admin.domain.Role; - -import lombok.AccessLevel; import lombok.Builder; -@Builder(access = AccessLevel.PRIVATE) +import static lombok.AccessLevel.PRIVATE; + +@Builder(access = PRIVATE) public record SignUpResponse( Long id, String email, From 743621e7ad7cd2b3ac398efe1f6e796448854aeb Mon Sep 17 00:00:00 2001 From: dragontaek-lee Date: Sun, 18 Feb 2024 23:54:43 +0900 Subject: [PATCH 126/141] =?UTF-8?q?[FIX]=20admin=20builder=20=EB=B3=B5?= =?UTF-8?q?=EA=B5=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sopt/makers/operation/admin/domain/Admin.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/admin/domain/Admin.java b/operation-domain/src/main/java/org/sopt/makers/operation/admin/domain/Admin.java index d2921d0b..0f61782c 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/admin/domain/Admin.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/admin/domain/Admin.java @@ -11,9 +11,6 @@ import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; -import org.sopt.makers.operation.exception.AdminFailureException; - -import static org.sopt.makers.operation.code.failure.admin.AdminFailureCode.INVALID_REFRESH_TOKEN; @Getter @Setter @@ -43,6 +40,15 @@ public class Admin { @Column(name="refresh_token") private String refreshToken; + @Builder + public Admin(String email, String password, String name, Role role) { + this.email = email; + this.password = password; + this.name = name; + this.role = role; + this.status = AdminStatus.NOT_CERTIFIED; + } + public void updateRefreshToken(String refreshToken) { this.refreshToken = refreshToken; } From 36352f4d20ea46e3c34a822c14cf399f4131b173 Mon Sep 17 00:00:00 2001 From: dragontaek-lee Date: Mon, 19 Feb 2024 00:17:42 +0900 Subject: [PATCH 127/141] =?UTF-8?q?[FIX]=20=EA=B8=B0=EC=88=98=EB=B3=84=20?= =?UTF-8?q?=ED=95=B4=EC=BB=A4=ED=86=A4=20=EC=8B=9C=EA=B0=84,=20=EC=84=B8?= =?UTF-8?q?=EC=85=98=20=EA=B0=9C=EC=88=98=20=EC=83=81=EC=88=98=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/org/sopt/makers/operation/config/ValueConfig.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/operation-common/src/main/java/org/sopt/makers/operation/config/ValueConfig.java b/operation-common/src/main/java/org/sopt/makers/operation/config/ValueConfig.java index 90756781..8070b02a 100644 --- a/operation-common/src/main/java/org/sopt/makers/operation/config/ValueConfig.java +++ b/operation-common/src/main/java/org/sopt/makers/operation/config/ValueConfig.java @@ -34,6 +34,7 @@ public class ValueConfig { private String playGroundToken; private final int SUB_LECTURE_MAX_ROUND = 2; + private final int MAX_LECTURE_COUNT = 2; private final String ETC_MESSAGE = "출석 점수가 반영되지 않아요."; private final String SEMINAR_MESSAGE = ""; private final String EVENT_MESSAGE = "행사도 참여하고, 출석점수도 받고, 일석이조!"; @@ -43,6 +44,7 @@ public class ValueConfig { private final int MAX_SCHEDULE_DURATION = 50; private final int DAY_DURATION = 1; private final int TWO_DAYS_DURATION = 2; + private final int HACKATHON_LECTURE_START_HOUR = 16; private final List APP_LINK_LIST = Arrays.asList( "home", From 618db4d661caec0ea534047fa9deb4fbdc42cc59 Mon Sep 17 00:00:00 2001 From: dragontaek-lee Date: Mon, 19 Feb 2024 00:18:11 +0900 Subject: [PATCH 128/141] =?UTF-8?q?[REFACTOR]=20subLecture=20=EC=B6=9C?= =?UTF-8?q?=EC=84=9D=20=EC=A7=84=ED=96=89=20=EC=8B=9C=EA=B0=84=20=ED=8C=90?= =?UTF-8?q?=EB=B3=84=20=EB=A1=9C=EC=A7=81=20=EC=82=AC=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/AppLectureServiceImpl.java | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/service/AppLectureServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/service/AppLectureServiceImpl.java index 52370190..0eb3abaa 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/service/AppLectureServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/service/AppLectureServiceImpl.java @@ -70,8 +70,8 @@ private void checkAttendancesSize(List attendances) { } private boolean checkOnAttendanceAbsence(SubLecture subLecture, SubAttendance subAttendance) { - val isOnAttendanceCheck = LocalDateTime.now().isBefore(subLecture.getStartAt().plusMinutes(10)); - return isOnAttendanceCheck && subAttendance.getStatus().equals(ABSENT); + val isOnAttendanceCheck = subLecture.isEnded(valueConfig.getATTENDANCE_MINUTE()); + return !isOnAttendanceCheck && subAttendance.getStatus().equals(ABSENT); } private Attendance getNowAttendance(List attendances) { @@ -80,7 +80,11 @@ private Attendance getNowAttendance(List attendances) { } private int getAttendanceIndex(List attendances) { - return (LocalDateTime.now().getHour() >= 16 && attendances.size() == 2) ? 1 : 0; + val isMultipleAttendance = ( + LocalDateTime.now().getHour() >= valueConfig.getHACKATHON_LECTURE_START_HOUR() + && attendances.size() == valueConfig.getMAX_LECTURE_COUNT() + ); + return isMultipleAttendance ? 1 : 0; } private SubAttendance getNowSubAttendance(List subAttendances, Lecture lecture) { @@ -189,19 +193,11 @@ private void checkLectureBefore(Lecture lecture) { } private void checkEndAttendance(SubLecture subLecture) { - if (isEndAttendance(subLecture)) { + if (subLecture.isEnded(valueConfig.getATTENDANCE_MINUTE())) { throw new LectureException(ENDED_ATTENDANCE, subLecture.getRound()); } } - private boolean isEndAttendance(SubLecture subLecture) { - val status = subLecture.getLecture().getLectureStatus(); - if (LocalDateTime.now().isAfter(subLecture.getStartAt().plusMinutes(10))) { - return status.equals(FIRST) || status.equals(SECOND); - } - return false; - } - private void checkLectureEnd(Lecture lecture) { if (lecture.isEnd()) { throw new LectureException(END_LECTURE); From 6a4c050bc613675654a0d6b0d19302e07e5aa55f Mon Sep 17 00:00:00 2001 From: Sohyeon Kim Date: Wed, 28 Feb 2024 13:25:24 +0900 Subject: [PATCH 129/141] Update README.md --- README.md | 116 ++++++++++++++++++++---------------------------------- 1 file changed, 43 insertions(+), 73 deletions(-) diff --git a/README.md b/README.md index ebe176e8..f5199570 100644 --- a/README.md +++ b/README.md @@ -1,29 +1,59 @@ -# sopt-operation-backend -**메이커스 운영팀 서버** : 출석 관리 어드민 서비스, 회원 출석 체크 서비스, 알림 전송 서비스 +# SOPT 메이커스 운영 프로덕트 서버 +> SOPT 활동 기수 회원과 임원진의 편리한 운영을 위한 서비스를 만들어요. + +### 웹 어드민 (임원진 대상) +- 세미나, 행사 등 **세션 생성** +- 활동 기수 회원의 **출석 내역 관리** +- 푸시 알림을 전송할 **공지 및 소식 작성, 푸시알림 전송** + +### 출석 앱 (활동 기수 회원 대상) +- 참여한 세션 **출석 체크**, **자신의 출석 내역 조회** + +
+ +## Server Acrchitecture + +image + +
+ +## Used Stacks +image
-## 🛠 Used Stacks +## 프로젝트 폴더 구조 +### 멀티모듈 구조 +``` +📁 operation-api # Controller, Service +📁 operation-auth # Authentication 관련 기능 +📁 operation-common # 공통 기능 +📁 operation-domain # Entity +📁 operation-external # 외부 API 기능(SOPT 메이커스 내 플레이그라운드, 알림TF) +``` -- Java 17 -- Gradle -- Spring Boot 2.7.4 -- Spring Data JPA -- PostgreSQL +### 모듈 내 구조 +``` +📁 src +|_ 📁 main +|_ |_ 📁 app # 앱 기능 +|_ |_ 📁 common # 공통 기능 +|_ |_ 📁 web # 웹 기능 +```
-## 👥 팀원 +## Member | [이용택](https://github.com/dragontaek-lee)| [김소현](https://github.com/thguss)| |:-----:|:------:| | | | -|- 프로젝트 초기 세팅
- HTTPS 설정
- 회원 출석 체크 서비스|- 프로젝트 초기 세팅
- CICD 환경 구축
- 출석 관리 어드민 서비스| +|- 프로젝트 초기 세팅
- HTTPS 설정
- (App)회원 출석 체크 기능
- 알림TF|- 프로젝트 초기 세팅
- CICD 환경 구축
- (Web)세션 출석 관리 기능
- 알림 관리 기능|
-## 📏 Process +## Process 1. 개발 전에 `github issue`를 생성해주세요! 1. 템플릿에 맞게 내용을 작성한다 2. Assignees, Label을 단다 @@ -38,12 +68,10 @@ 7. `approve`가 완료되었다면 `merge`를 진행해주세!요 > `코드 외적인 부분`(환경변수, db 필드 및 테이블 수정, 인프라 세팅 등) 수정사항이 있다면 팀원에게 먼저 물어보고 진행하거나, 그러지 못하였더라면 빠르게 전달해주세요!(카톡, 슬랙, 디코 등) -> -
-## 🌴 Commit Convention +## Commit Convention | 태그 이름 | 설명 | | --- | --- | | [CHORE] | 코드 수정, 내부 파일 수정 | @@ -61,7 +89,7 @@
-## ✨ Branch Strategy +## Branch Strategy - `main`, `develop`, `feature` 브랜치가 있습니다! - **main**은 production용 브랜치입니다 - 실서비스용 ec2(**makers.operation.prod)**로 배포되도록 파이프라인이 구축되어 있습니다 @@ -72,61 +100,3 @@ - 각자 이슈에 대한 작업물의 브랜치입니다 - develop에 PR을 거쳐 merge 해주세요 -
- -## 🗂 프로젝트 폴더 구조 - -``` -📁 src -|_ 📁 main -|_ |_ 📁 common -|_ |_ 📁 config -|_ |_ 📁 controller -|_ |_ 📁 dto -|_ |_ 📁 entity -|_ |_ 📁 exception -|_ |_ 📁 repository -|_ |_ 📁 security -|_ |_ 📁 service -|_ |_ 📁 util - -``` - -
- -## 🌴 Dependencies Module -build.gradle -``` -dependencies { - implementation 'org.springframework.boot:spring-boot-starter-data-jpa' - implementation 'org.springframework.boot:spring-boot-starter-validation' - implementation 'org.springframework.boot:spring-boot-starter-web' - implementation 'org.springframework.boot:spring-boot-starter-security' - implementation "com.querydsl:querydsl-jpa:${queryDslVersion}" - implementation "com.querydsl:querydsl-apt:${queryDslVersion}" - - compileOnly 'org.projectlombok:lombok' - runtimeOnly 'com.h2database:h2' - runtimeOnly 'org.postgresql:postgresql' - annotationProcessor 'org.projectlombok:lombok' - - // jwt - implementation group: 'io.jsonwebtoken', name: 'jjwt-api', version: '0.11.2' - runtimeOnly group: 'io.jsonwebtoken', name: 'jjwt-impl', version: '0.11.2' - runtimeOnly group: 'io.jsonwebtoken', name: 'jjwt-jackson', version: '0.11.2' - - testImplementation 'org.springframework.boot:spring-boot-starter-test' - - // swagger - implementation 'io.springfox:springfox-boot-starter:3.0.0' - implementation 'io.springfox:springfox-swagger-ui:3.0.0' -} - -``` - -
- - -## 🏗 Architecture -![image](https://user-images.githubusercontent.com/55437339/236621230-8d2dd581-c68d-44e9-bc0d-ea35dee08ebe.png) - From 71840f2d513c2461619a77b21a99ef006f4b79e7 Mon Sep 17 00:00:00 2001 From: dragontaek-lee Date: Wed, 28 Feb 2024 21:14:14 +0900 Subject: [PATCH 130/141] =?UTF-8?q?[FEAT]=20admin=20=EC=95=94=ED=98=B8=20?= =?UTF-8?q?=EC=B2=B4=ED=81=AC=20=EC=9A=A9=EB=8F=84=20=EC=9D=98=EC=A1=B4?= =?UTF-8?q?=EC=84=B1=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- operation-domain/build.gradle | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/operation-domain/build.gradle b/operation-domain/build.gradle index 88f53245..2c0374ea 100644 --- a/operation-domain/build.gradle +++ b/operation-domain/build.gradle @@ -9,11 +9,8 @@ bootJar { dependencies { implementation project(path: ':operation-common') - // QueryDSL -// implementation "com.querydsl:querydsl-jpa:5.0.0" -// implementation "com.querydsl:querydsl-apt:5.0.0" -// testImplementation 'junit:junit:4.13.1' -// testImplementation 'junit:junit:4.13.1' + implementation 'org.springframework.boot:spring-boot-starter-security' + implementation 'com.querydsl:querydsl-jpa:5.0.0:jakarta' annotationProcessor "com.querydsl:querydsl-apt:5.0.0:jakarta" annotationProcessor "jakarta.annotation:jakarta.annotation-api" From ad1063bc113093e8c60ec0576074d6856fd07881 Mon Sep 17 00:00:00 2001 From: dragontaek-lee Date: Wed, 28 Feb 2024 21:14:46 +0900 Subject: [PATCH 131/141] =?UTF-8?q?[FEAT]=20=EC=96=B4=EB=93=9C=EB=AF=BC=20?= =?UTF-8?q?=EC=95=94=ED=98=B8=20=EC=B2=B4=ED=81=AC=20=EB=A9=94=EC=86=8C?= =?UTF-8?q?=EB=93=9C=20admin=20entity=EB=A1=9C=20=EC=9D=B4=EA=B4=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operation/web/admin/service/AdminServiceImpl.java | 2 +- .../java/org/sopt/makers/operation/admin/domain/Admin.java | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/admin/service/AdminServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/web/admin/service/AdminServiceImpl.java index c4364672..21b35497 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/admin/service/AdminServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/admin/service/AdminServiceImpl.java @@ -74,7 +74,7 @@ private Admin findByEmail(String email) { } private void checkPasswordMatched(String password, Admin admin) { - if (!passwordEncoder.matches(password, admin.getPassword())) { + if (!admin.checkPasswordMatched(passwordEncoder, password)) { throw new AdminFailureException(INVALID_PASSWORD); } } diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/admin/domain/Admin.java b/operation-domain/src/main/java/org/sopt/makers/operation/admin/domain/Admin.java index 0f61782c..f4f406d0 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/admin/domain/Admin.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/admin/domain/Admin.java @@ -1,5 +1,7 @@ package org.sopt.makers.operation.admin.domain; +import org.springframework.security.crypto.password.PasswordEncoder; + import jakarta.persistence.Column; import jakarta.persistence.Entity; import jakarta.persistence.EnumType; @@ -17,6 +19,7 @@ @Entity @NoArgsConstructor public class Admin { + @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "admin_id") @@ -60,4 +63,8 @@ public boolean isNotAllowed() { public boolean isMatchRefreshToken(String refreshToken) { return this.getRefreshToken().equals(refreshToken); } + + public boolean checkPasswordMatched(PasswordEncoder passwordEncoder, String password) { + return passwordEncoder.matches(password, this.password); + } } From b100117d412709398955c9e06e5ff63ca0133812 Mon Sep 17 00:00:00 2001 From: dragontaek-lee Date: Wed, 28 Feb 2024 21:20:45 +0900 Subject: [PATCH 132/141] =?UTF-8?q?[FIX]=20=EC=86=9D=EC=BB=A4=ED=86=A4=20?= =?UTF-8?q?=EC=84=B8=EC=85=98=20=ED=8C=90=EB=B3=84=20=EB=A9=94=EC=86=8C?= =?UTF-8?q?=EB=93=9C=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/lecture/service/AppLectureServiceImpl.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/service/AppLectureServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/service/AppLectureServiceImpl.java index 0eb3abaa..97084578 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/service/AppLectureServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/service/AppLectureServiceImpl.java @@ -80,12 +80,13 @@ private Attendance getNowAttendance(List attendances) { } private int getAttendanceIndex(List attendances) { - val isMultipleAttendance = ( - LocalDateTime.now().getHour() >= valueConfig.getHACKATHON_LECTURE_START_HOUR() - && attendances.size() == valueConfig.getMAX_LECTURE_COUNT() - ); + val isMultipleAttendance = getIsMultipleAttendance(attendances.size()); return isMultipleAttendance ? 1 : 0; } + private boolean getIsMultipleAttendance(int lectureCount) { + return LocalDateTime.now().getHour() >= valueConfig.getHACKATHON_LECTURE_START_HOUR() + && lectureCount == valueConfig.getMAX_LECTURE_COUNT(); + } private SubAttendance getNowSubAttendance(List subAttendances, Lecture lecture) { val index = getSubAttendanceIndex(lecture); From 5e837788ef3bca7c345b1810280d4b3cf776778c Mon Sep 17 00:00:00 2001 From: dragontaek-lee Date: Wed, 28 Feb 2024 21:28:09 +0900 Subject: [PATCH 133/141] =?UTF-8?q?[FIX]=20=ED=98=84=EC=9E=AC=20=EC=B6=9C?= =?UTF-8?q?=EC=84=9D=20=EC=A0=95=EB=B3=B4=20response=20=EA=B4=80=EB=A0=A8?= =?UTF-8?q?=20=EB=A9=94=EC=86=8C=EB=93=9C=20DTO=EB=A1=9C=20=EC=9D=B4?= =?UTF-8?q?=EA=B4=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/response/TodayLectureResponse.java | 23 ++++++++++++++++ .../service/AppLectureServiceImpl.java | 26 ++----------------- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/dto/response/TodayLectureResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/dto/response/TodayLectureResponse.java index e5de11eb..c3d2a370 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/dto/response/TodayLectureResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/dto/response/TodayLectureResponse.java @@ -57,6 +57,29 @@ private static DateTimeFormatter convertFormat() { return DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss"); } + public static TodayLectureResponse getOnAttendanceLectureResponse( + SubAttendance subAttendance, + Lecture lecture, + LectureResponseType responseType, + String message + ) { + return lecture.isFirst() + ? TodayLectureResponse.of(responseType, lecture, message, Collections.emptyList()) + : TodayLectureResponse.of(responseType, lecture, message, Collections.singletonList(subAttendance)); + } + + public static TodayLectureResponse getAttendanceLectureResponse( + List subAttendances, + SubAttendance subAttendance, + Lecture lecture, + LectureResponseType responseType, + String message + ) { + return lecture.isFirst() + ? TodayLectureResponse.of(responseType, lecture, message, Collections.singletonList(subAttendance)) + : TodayLectureResponse.of(responseType, lecture, message, subAttendances); + } + @Builder record LectureGetResponseVO( AttendanceStatus status, diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/service/AppLectureServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/service/AppLectureServiceImpl.java index 97084578..d7e8551d 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/service/AppLectureServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/service/AppLectureServiceImpl.java @@ -120,32 +120,10 @@ private TodayLectureResponse getTodayLectureResponse( val message = getMessage(lecture.getAttribute()); if (checkOnAttendanceAbsence(subLecture, subAttendance)) { - return getOnAttendanceLectureResponse(subAttendance, lecture, responseType, message); + return TodayLectureResponse.getOnAttendanceLectureResponse(subAttendance, lecture, responseType, message); } - return getAttendanceLectureResponse(subAttendances, lecture, responseType, message); - } - - private TodayLectureResponse getOnAttendanceLectureResponse( - SubAttendance subAttendance, - Lecture lecture, - LectureResponseType responseType, - String message - ) { - return lecture.isFirst() - ? TodayLectureResponse.of(responseType, lecture, message, Collections.emptyList()) - : TodayLectureResponse.of(responseType, lecture, message, Collections.singletonList(subAttendance)); - } - - private TodayLectureResponse getAttendanceLectureResponse( - List subAttendances, - Lecture lecture, - LectureResponseType responseType, - String message - ) { - return lecture.isFirst() - ? TodayLectureResponse.of(responseType, lecture, message, Collections.singletonList(getNowSubAttendance(subAttendances, lecture))) - : TodayLectureResponse.of(responseType, lecture, message, subAttendances); + return TodayLectureResponse.getAttendanceLectureResponse(subAttendances, subAttendance, lecture, responseType, message); } @Override From 6d2ec1e60e6f05da16ad8a3a842f7692560c6477 Mon Sep 17 00:00:00 2001 From: dragontaek-lee Date: Wed, 28 Feb 2024 21:29:14 +0900 Subject: [PATCH 134/141] =?UTF-8?q?[FIX]=20=EB=A6=AC=ED=94=84=EB=A0=88?= =?UTF-8?q?=EC=8B=9C=20=ED=86=A0=ED=81=B0=20response=20DTO=20=EC=BB=A8?= =?UTF-8?q?=EB=B2=A4=EC=85=98=EC=97=90=20=EB=A7=9E=EA=B2=8C=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../{RefreshResponse.java => TokenRefreshGetResponse.java} | 6 +++--- .../makers/operation/web/admin/service/AdminService.java | 4 ++-- .../operation/web/admin/service/AdminServiceImpl.java | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) rename operation-api/src/main/java/org/sopt/makers/operation/web/admin/dto/response/{RefreshResponse.java => TokenRefreshGetResponse.java} (60%) diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/admin/dto/response/RefreshResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/web/admin/dto/response/TokenRefreshGetResponse.java similarity index 60% rename from operation-api/src/main/java/org/sopt/makers/operation/web/admin/dto/response/RefreshResponse.java rename to operation-api/src/main/java/org/sopt/makers/operation/web/admin/dto/response/TokenRefreshGetResponse.java index b52b20df..68cdf41b 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/admin/dto/response/RefreshResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/admin/dto/response/TokenRefreshGetResponse.java @@ -5,12 +5,12 @@ import static lombok.AccessLevel.PRIVATE; @Builder(access = PRIVATE) -public record RefreshResponse( +public record TokenRefreshGetResponse( String accessToken ) { - public static RefreshResponse of(String accessToken) { - return RefreshResponse.builder() + public static TokenRefreshGetResponse of(String accessToken) { + return TokenRefreshGetResponse.builder() .accessToken(accessToken) .build(); } diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/admin/service/AdminService.java b/operation-api/src/main/java/org/sopt/makers/operation/web/admin/service/AdminService.java index 241b6f9b..030eecb5 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/admin/service/AdminService.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/admin/service/AdminService.java @@ -3,11 +3,11 @@ import org.sopt.makers.operation.web.admin.dto.request.LoginRequest; import org.sopt.makers.operation.web.admin.dto.request.SignUpRequest; import org.sopt.makers.operation.web.admin.dto.response.LoginResponse; -import org.sopt.makers.operation.web.admin.dto.response.RefreshResponse; +import org.sopt.makers.operation.web.admin.dto.response.TokenRefreshGetResponse; import org.sopt.makers.operation.web.admin.dto.response.SignUpResponse; public interface AdminService { SignUpResponse signUp(SignUpRequest request); LoginResponse login(LoginRequest request); - RefreshResponse refresh(String refreshToken); + TokenRefreshGetResponse refresh(String refreshToken); } diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/admin/service/AdminServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/web/admin/service/AdminServiceImpl.java index 21b35497..07c25816 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/admin/service/AdminServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/admin/service/AdminServiceImpl.java @@ -12,7 +12,7 @@ import org.sopt.makers.operation.web.admin.dto.response.SignUpResponse; import org.sopt.makers.operation.web.admin.dto.request.LoginRequest; import org.sopt.makers.operation.web.admin.dto.response.LoginResponse; -import org.sopt.makers.operation.web.admin.dto.response.RefreshResponse; +import org.sopt.makers.operation.web.admin.dto.response.TokenRefreshGetResponse; import org.sopt.makers.operation.admin.repository.AdminRepository; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.stereotype.Service; @@ -87,13 +87,13 @@ private void checkAdminAllowed(Admin admin) { @Override @Transactional - public RefreshResponse refresh(String refreshToken) { + public TokenRefreshGetResponse refresh(String refreshToken) { val adminId = jwtTokenProvider.getId(refreshToken, JwtTokenType.REFRESH_TOKEN); val admin = findById(adminId); validateRefreshToken(admin, refreshToken); val newAccessToken = generateAccessToken(admin); - return RefreshResponse.of(newAccessToken); + return TokenRefreshGetResponse.of(newAccessToken); } public void validateRefreshToken(Admin admin, String refreshToken) { From 2e6ec3691af2da38fdb9b3784fe7d132c0147639 Mon Sep 17 00:00:00 2001 From: dragontaek-lee Date: Wed, 28 Feb 2024 21:32:41 +0900 Subject: [PATCH 135/141] =?UTF-8?q?[FIX]=20=EC=9B=90=EC=8B=9C=ED=83=80?= =?UTF-8?q?=EC=9E=85=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../makers/operation/web/admin/dto/response/SignUpResponse.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/admin/dto/response/SignUpResponse.java b/operation-api/src/main/java/org/sopt/makers/operation/web/admin/dto/response/SignUpResponse.java index 319c8322..5eb18f59 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/admin/dto/response/SignUpResponse.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/admin/dto/response/SignUpResponse.java @@ -8,7 +8,7 @@ @Builder(access = PRIVATE) public record SignUpResponse( - Long id, + long id, String email, String name, Role role From 887ddf49913b18a8e5aa1ae27dde2ea8e87999b2 Mon Sep 17 00:00:00 2001 From: dragontaek-lee Date: Wed, 28 Feb 2024 21:33:26 +0900 Subject: [PATCH 136/141] =?UTF-8?q?[FIX]=20=EB=B3=80=EC=88=98=EB=AA=85=20?= =?UTF-8?q?=EB=AA=85=EB=A3=8C=ED=95=98=EA=B2=8C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../makers/operation/web/admin/service/AdminServiceImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/operation-api/src/main/java/org/sopt/makers/operation/web/admin/service/AdminServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/web/admin/service/AdminServiceImpl.java index 07c25816..e775cfd9 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/web/admin/service/AdminServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/web/admin/service/AdminServiceImpl.java @@ -34,8 +34,8 @@ public class AdminServiceImpl implements AdminService { @Transactional public SignUpResponse signUp(SignUpRequest request){ checkEmailDuplicated(request.email()); - val entity = request.toEntity(passwordEncoder.encode(request.password())); - val admin = adminRepository.save(entity); + val adminEntity = request.toEntity(passwordEncoder.encode(request.password())); + val admin = adminRepository.save(adminEntity); return SignUpResponse.of(admin); } From 2c54d0331d3632b50d90da28b14cc41fe76d52e1 Mon Sep 17 00:00:00 2001 From: dragontaek-lee Date: Wed, 28 Feb 2024 22:31:26 +0900 Subject: [PATCH 137/141] =?UTF-8?q?[FIX]=20=ED=86=A0=ED=81=B0=20=EC=9C=A0?= =?UTF-8?q?=ED=9A=A8=EC=84=B1=20=EC=98=A4=EB=A5=98=20=ED=85=8D=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sopt/makers/operation/filter/JwtAuthenticationFilter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/operation-auth/src/main/java/org/sopt/makers/operation/filter/JwtAuthenticationFilter.java b/operation-auth/src/main/java/org/sopt/makers/operation/filter/JwtAuthenticationFilter.java index 7440b615..ff8a552c 100644 --- a/operation-auth/src/main/java/org/sopt/makers/operation/filter/JwtAuthenticationFilter.java +++ b/operation-auth/src/main/java/org/sopt/makers/operation/filter/JwtAuthenticationFilter.java @@ -46,7 +46,7 @@ public void doFilterInternal(HttpServletRequest request, HttpServletResponse res private void checkJwtAvailable (String token, JwtTokenType jwtTokenType) { if (token == null || !jwtTokenProvider.validateTokenExpiration(token, jwtTokenType)) { - throw new TokenException(EMPTY_TOKEN); + throw new TokenException(INVALID_TOKEN); } } From 1ac3e6b8e07695712e0f8cb4bf952c84541ae691 Mon Sep 17 00:00:00 2001 From: dragontaek-lee Date: Thu, 28 Mar 2024 21:16:54 +0900 Subject: [PATCH 138/141] =?UTF-8?q?[FIX]=20=EC=B6=94=EA=B0=80=EB=90=9C=20?= =?UTF-8?q?=EC=96=B4=EB=93=9C=EB=AF=BC=20=EB=8F=84=EB=A9=94=EC=9D=B8=20?= =?UTF-8?q?=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/sopt/makers/operation/config/SecurityConfig.java | 2 ++ .../java/org/sopt/makers/operation/config/ValueConfig.java | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/operation-auth/src/main/java/org/sopt/makers/operation/config/SecurityConfig.java b/operation-auth/src/main/java/org/sopt/makers/operation/config/SecurityConfig.java index ce3aa176..cd21f2fb 100644 --- a/operation-auth/src/main/java/org/sopt/makers/operation/config/SecurityConfig.java +++ b/operation-auth/src/main/java/org/sopt/makers/operation/config/SecurityConfig.java @@ -74,6 +74,8 @@ public CorsConfigurationSource corsConfigurationSource() { configuration.addAllowedOrigin(valueConfig.getADMIN_PROD_URL()); configuration.addAllowedOrigin(valueConfig.getADMIN_DEV_URL()); + configuration.addAllowedOrigin(valueConfig.getADMIN_PROD_URL_LEGACY()); + configuration.addAllowedOrigin(valueConfig.getADMIN_DEV_URL_LEGACY()); configuration.addAllowedOrigin(valueConfig.getADMIN_LOCAL_URL()); configuration.addAllowedHeader("*"); configuration.addAllowedMethod("*"); diff --git a/operation-common/src/main/java/org/sopt/makers/operation/config/ValueConfig.java b/operation-common/src/main/java/org/sopt/makers/operation/config/ValueConfig.java index 8070b02a..cdeaa8a7 100644 --- a/operation-common/src/main/java/org/sopt/makers/operation/config/ValueConfig.java +++ b/operation-common/src/main/java/org/sopt/makers/operation/config/ValueConfig.java @@ -22,6 +22,10 @@ public class ValueConfig { private String ADMIN_PROD_URL; @Value("${admin.url.dev}") private String ADMIN_DEV_URL; + @Value("${admin.url.prod_legacy}") + private String ADMIN_PROD_URL_LEGACY; + @Value("${admin.url.dev_legacy}") + private String ADMIN_DEV_URL_LEGACY; @Value("${admin.url.local}") private String ADMIN_LOCAL_URL; @Value("${notification.key}") From 3ddfa71f7c49394e5699cfa50a140db2d283e9ed Mon Sep 17 00:00:00 2001 From: yummygyudon Date: Sat, 30 Mar 2024 03:26:56 +0900 Subject: [PATCH 139/141] =?UTF-8?q?HOT=20FIX()=20:=2034=EA=B8=B0=20?= =?UTF-8?q?=EC=B6=9C=EC=84=9D=20=EC=A0=90=EC=88=98=20=EC=97=B0=EC=82=B0=20?= =?UTF-8?q?=EB=B0=A9=EC=8B=9D=20=EC=88=98=EC=A0=95=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operation/attendance/domain/Attendance.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/attendance/domain/Attendance.java b/operation-domain/src/main/java/org/sopt/makers/operation/attendance/domain/Attendance.java index 8398cca1..ce8fab55 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/attendance/domain/Attendance.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/attendance/domain/Attendance.java @@ -79,9 +79,15 @@ public AttendanceStatus getStatus() { val second = getSubAttendanceByRound(2); return switch (this.lecture.getAttribute()) { - case SEMINAR -> second.getStatus().equals(ATTENDANCE) - ? first.getStatus().equals(ATTENDANCE) ? ATTENDANCE : TARDY - : ABSENT; + case SEMINAR -> { + if (first.getStatus().equals(ATTENDANCE) && second.getStatus().equals(ATTENDANCE)) { + yield ATTENDANCE; + } + yield first.getStatus().equals(ABSENT) && second.getStatus().equals(ABSENT) ? ABSENT : TARDY; + } +// case SEMINAR -> second.getStatus().equals(ATTENDANCE) +// ? first.getStatus().equals(ATTENDANCE) ? ATTENDANCE : TARDY +// : ABSENT; case EVENT -> second.getStatus().equals(ATTENDANCE) ? ATTENDANCE : ABSENT; case ETC -> second.getStatus().equals(ATTENDANCE) ? PARTICIPATE : NOT_PARTICIPATE; }; From 57d0ef34f39ba9be85a47502f028622ca66117ee Mon Sep 17 00:00:00 2001 From: yummygyudon Date: Sat, 30 Mar 2024 03:30:07 +0900 Subject: [PATCH 140/141] =?UTF-8?q?CHORE(`Attendance`)=20:=20=EB=B6=88?= =?UTF-8?q?=ED=95=84=EC=9A=94=ED=95=9C=20=EC=A3=BC=EC=84=9D=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sopt/makers/operation/attendance/domain/Attendance.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/operation-domain/src/main/java/org/sopt/makers/operation/attendance/domain/Attendance.java b/operation-domain/src/main/java/org/sopt/makers/operation/attendance/domain/Attendance.java index ce8fab55..c2d7f64d 100644 --- a/operation-domain/src/main/java/org/sopt/makers/operation/attendance/domain/Attendance.java +++ b/operation-domain/src/main/java/org/sopt/makers/operation/attendance/domain/Attendance.java @@ -85,9 +85,6 @@ public AttendanceStatus getStatus() { } yield first.getStatus().equals(ABSENT) && second.getStatus().equals(ABSENT) ? ABSENT : TARDY; } -// case SEMINAR -> second.getStatus().equals(ATTENDANCE) -// ? first.getStatus().equals(ATTENDANCE) ? ATTENDANCE : TARDY -// : ABSENT; case EVENT -> second.getStatus().equals(ATTENDANCE) ? ATTENDANCE : ABSENT; case ETC -> second.getStatus().equals(ATTENDANCE) ? PARTICIPATE : NOT_PARTICIPATE; }; From 689e4291ebd2d74782cb7ded1d771c0eaff6932d Mon Sep 17 00:00:00 2001 From: yummygyudon Date: Sat, 30 Mar 2024 13:21:11 +0900 Subject: [PATCH 141/141] =?UTF-8?q?[CHORE]=20develop=20=EB=B8=8C=EB=9E=9C?= =?UTF-8?q?=EC=B9=98=20=EB=82=B4=20Security=20Config=20=EC=B5=9C=EC=8B=A0?= =?UTF-8?q?=20=EB=B2=84=EC=A0=84=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operation/config/SecurityConfig.java | 75 ++++++++++--------- 1 file changed, 39 insertions(+), 36 deletions(-) diff --git a/operation-auth/src/main/java/org/sopt/makers/operation/config/SecurityConfig.java b/operation-auth/src/main/java/org/sopt/makers/operation/config/SecurityConfig.java index 1b2625b5..cd21f2fb 100644 --- a/operation-auth/src/main/java/org/sopt/makers/operation/config/SecurityConfig.java +++ b/operation-auth/src/main/java/org/sopt/makers/operation/config/SecurityConfig.java @@ -1,12 +1,12 @@ -package org.sopt.makers.operation.security.config; +package org.sopt.makers.operation.config; import lombok.RequiredArgsConstructor; import lombok.val; -import org.sopt.makers.operation.security.jwt.JwtAuthenticationFilter; -import org.sopt.makers.operation.security.jwt.JwtExceptionFilter; -import org.springframework.beans.factory.annotation.Value; +import org.sopt.makers.operation.filter.JwtAuthenticationFilter; +import org.sopt.makers.operation.filter.JwtExceptionFilter; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Profile; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.http.SessionCreationPolicy; @@ -14,6 +14,7 @@ import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.web.SecurityFilterChain; import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; +import org.springframework.security.web.util.matcher.AntPathRequestMatcher; import org.springframework.web.cors.CorsConfiguration; import org.springframework.web.cors.CorsConfigurationSource; import org.springframework.web.cors.UrlBasedCorsConfigurationSource; @@ -24,56 +25,58 @@ public class SecurityConfig { private final JwtAuthenticationFilter jwtAuthenticationFilter; private final JwtExceptionFilter jwtExceptionFilter; - - @Value("${admin.url.prod}") - private String ADMIN_PROD_URL; - - @Value("${admin.url.dev}") - private String ADMIN_DEV_URL; - - @Value("${admin.url.prod_legacy}") - private String ADMIN_PROD_URL_LEGACY; - - @Value("${admin.url.dev_legacy}") - private String ADMIN_DEV_URL_LEGACY; - - @Value("${admin.url.local}") - private String ADMIN_LOCAL_URL; + private final ValueConfig valueConfig; @Bean public static PasswordEncoder passwordEncoder() { return PasswordEncoderFactories.createDelegatingPasswordEncoder(); } + @Bean - public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { - return http.antMatcher("/**") - .httpBasic().disable() + @Profile("dev") + public SecurityFilterChain filterChainDev(HttpSecurity http) throws Exception { + http.authorizeHttpRequests(authorizeHttpRequests -> authorizeHttpRequests + .requestMatchers(new AntPathRequestMatcher("/swagger-ui/**")).permitAll() + .requestMatchers(new AntPathRequestMatcher("/v3/**")).permitAll() + ); + setHttp(http); + return http.build(); + } + + @Bean + @Profile("prod") + public SecurityFilterChain filterChainProd(HttpSecurity http) throws Exception { + setHttp(http); + return http.build(); + } + + private void setHttp(HttpSecurity http) throws Exception { + http.httpBasic().disable() .csrf().disable() .formLogin().disable() .cors().configurationSource(corsConfigurationSource()) .and() - .authorizeRequests() - .antMatchers("/api/v1/auth/**","/exception/**").permitAll() - .and() - .authorizeRequests() - .antMatchers("/api/v1/**", "/swagger-ui/**").authenticated() - .and() - .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS) + .authorizeHttpRequests(authorizeHttpRequests -> + authorizeHttpRequests + .requestMatchers(new AntPathRequestMatcher("/api/v1/auth/*")).permitAll() + .requestMatchers(new AntPathRequestMatcher("/api/v1/test/**")).permitAll() + .requestMatchers(new AntPathRequestMatcher("/error")).permitAll() + .anyRequest().authenticated()) + .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS) .and() .addFilterBefore(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class) - .addFilterBefore(jwtExceptionFilter, JwtAuthenticationFilter.class) - .build(); + .addFilterBefore(jwtExceptionFilter, JwtAuthenticationFilter.class); } @Bean public CorsConfigurationSource corsConfigurationSource() { val configuration = new CorsConfiguration(); - configuration.addAllowedOrigin(ADMIN_PROD_URL); - configuration.addAllowedOrigin(ADMIN_DEV_URL); - configuration.addAllowedOrigin(ADMIN_LOCAL_URL); - configuration.addAllowedOrigin(ADMIN_PROD_URL_LEGACY); - configuration.addAllowedOrigin(ADMIN_DEV_URL_LEGACY); + configuration.addAllowedOrigin(valueConfig.getADMIN_PROD_URL()); + configuration.addAllowedOrigin(valueConfig.getADMIN_DEV_URL()); + configuration.addAllowedOrigin(valueConfig.getADMIN_PROD_URL_LEGACY()); + configuration.addAllowedOrigin(valueConfig.getADMIN_DEV_URL_LEGACY()); + configuration.addAllowedOrigin(valueConfig.getADMIN_LOCAL_URL()); configuration.addAllowedHeader("*"); configuration.addAllowedMethod("*"); configuration.setAllowCredentials(true);