diff --git a/src/main/java/com/umc/networkingService/config/WebMvcConfig.java b/src/main/java/com/umc/networkingService/config/WebMvcConfig.java new file mode 100644 index 00000000..6302b224 --- /dev/null +++ b/src/main/java/com/umc/networkingService/config/WebMvcConfig.java @@ -0,0 +1,22 @@ +package com.umc.networkingService.config; + +import com.umc.networkingService.domain.member.interceptor.LastActiveInterceptor; +import lombok.RequiredArgsConstructor; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.InterceptorRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +@Configuration +@RequiredArgsConstructor +public class WebMvcConfig implements WebMvcConfigurer { + + private final LastActiveInterceptor lastActiveInterceptor; + + @Override + public void addInterceptors(InterceptorRegistry registry) { + registry.addInterceptor(lastActiveInterceptor) + .addPathPatterns("/**") // 모든 요청에 대해 인터셉터 적용 + .excludePathPatterns("/v3/**", "/swagger-ui/**") // 스웨거 요청은 제외 + .excludePathPatterns("/members/login"); // 로그인 API 제외 + } +} diff --git a/src/main/java/com/umc/networkingService/domain/invite/controller/InviteController.java b/src/main/java/com/umc/networkingService/domain/invite/controller/InviteController.java index a7f91868..66adc43b 100644 --- a/src/main/java/com/umc/networkingService/domain/invite/controller/InviteController.java +++ b/src/main/java/com/umc/networkingService/domain/invite/controller/InviteController.java @@ -17,8 +17,6 @@ import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.*; -import java.util.List; - @Tag(name = "초대 API", description = "초대 관련 API") @RestController @RequiredArgsConstructor @@ -43,7 +41,7 @@ public BaseResponse createInviteCode(@CurrentMember Member @ApiResponse(responseCode = "COMMON200", description = "성공") }) @GetMapping("/staff/invites") - public BaseResponse> inquiryMyInviteCode(@CurrentMember Member member) { + public BaseResponse inquiryMyInviteCode(@CurrentMember Member member) { return BaseResponse.onSuccess(inviteService.inquiryMyInviteCode(member)); } diff --git a/src/main/java/com/umc/networkingService/domain/invite/dto/response/InviteInquiryMineResponse.java b/src/main/java/com/umc/networkingService/domain/invite/dto/response/InviteInquiryMineResponse.java index 493f1847..d8e019fd 100644 --- a/src/main/java/com/umc/networkingService/domain/invite/dto/response/InviteInquiryMineResponse.java +++ b/src/main/java/com/umc/networkingService/domain/invite/dto/response/InviteInquiryMineResponse.java @@ -5,11 +5,20 @@ import lombok.Getter; import java.time.LocalDateTime; +import java.util.List; @Getter @AllArgsConstructor public class InviteInquiryMineResponse { - private String inviteCode; - private Role role; - private LocalDateTime createdAt; + + private List invites; + + @Getter + @AllArgsConstructor + public static class InviteInfo { + private String inviteCode; + private Role role; + private LocalDateTime createdAt; + } + } diff --git a/src/main/java/com/umc/networkingService/domain/invite/mapper/InviteMapper.java b/src/main/java/com/umc/networkingService/domain/invite/mapper/InviteMapper.java index cd4e0c6e..0ba95baa 100644 --- a/src/main/java/com/umc/networkingService/domain/invite/mapper/InviteMapper.java +++ b/src/main/java/com/umc/networkingService/domain/invite/mapper/InviteMapper.java @@ -7,7 +7,7 @@ @Component public class InviteMapper { - public InviteInquiryMineResponse toInquiryMineResponse(Invite invite) { - return new InviteInquiryMineResponse(invite.getCode(), invite.getRole(), invite.getCreatedAt()); + public InviteInquiryMineResponse.InviteInfo toInquiryMineResponse(Invite invite) { + return new InviteInquiryMineResponse.InviteInfo(invite.getCode(), invite.getRole(), invite.getCreatedAt()); } } diff --git a/src/main/java/com/umc/networkingService/domain/invite/service/InviteService.java b/src/main/java/com/umc/networkingService/domain/invite/service/InviteService.java index f40100e7..d32215e8 100644 --- a/src/main/java/com/umc/networkingService/domain/invite/service/InviteService.java +++ b/src/main/java/com/umc/networkingService/domain/invite/service/InviteService.java @@ -6,10 +6,8 @@ import com.umc.networkingService.domain.member.entity.Member; import com.umc.networkingService.global.common.enums.Role; -import java.util.List; - public interface InviteService { InviteCreateResponse createInviteCode(Member member, Role role); InviteAuthenticateResponse authenticateInviteCode(Member member, String inviteCode); - List inquiryMyInviteCode(Member member); + InviteInquiryMineResponse inquiryMyInviteCode(Member member); } diff --git a/src/main/java/com/umc/networkingService/domain/invite/service/InviteServiceImpl.java b/src/main/java/com/umc/networkingService/domain/invite/service/InviteServiceImpl.java index 2453abe4..c0f1b42e 100644 --- a/src/main/java/com/umc/networkingService/domain/invite/service/InviteServiceImpl.java +++ b/src/main/java/com/umc/networkingService/domain/invite/service/InviteServiceImpl.java @@ -62,13 +62,15 @@ public InviteAuthenticateResponse authenticateInviteCode(Member member, String i // 나의 초대 코드 조회 함수 @Override - public List inquiryMyInviteCode(Member member) { + public InviteInquiryMineResponse inquiryMyInviteCode(Member member) { // 본인이 생성한 초대 코드 조회 List savedInvites = inviteRepository.findAllByMember(member); - return savedInvites.stream() + List invites = savedInvites.stream() .map(inviteMapper::toInquiryMineResponse) .toList(); + + return new InviteInquiryMineResponse(invites); } // 본인의 역할 이상의 역할 부여를 확인하는 함수 diff --git a/src/main/java/com/umc/networkingService/domain/member/controller/AuthController.java b/src/main/java/com/umc/networkingService/domain/member/controller/AuthController.java index 3afb80d5..6de5408a 100644 --- a/src/main/java/com/umc/networkingService/domain/member/controller/AuthController.java +++ b/src/main/java/com/umc/networkingService/domain/member/controller/AuthController.java @@ -28,7 +28,7 @@ public class AuthController { @Operation(summary = "소셜 로그인", description = "네이버, 카카오, 구글, 애플 로그인") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "로그인 성공"), + @ApiResponse(responseCode = "COMMON200", description = "로그인 성공"), @ApiResponse(responseCode = "AUTH007", description = "외부 소셜 서버와의 통신 에러" , content = @Content(schema = @Schema(implementation = BaseResponse.class))) }) diff --git a/src/main/java/com/umc/networkingService/domain/member/controller/StaffMemberController.java b/src/main/java/com/umc/networkingService/domain/member/controller/StaffMemberController.java index 6c9497dc..671ebcd5 100644 --- a/src/main/java/com/umc/networkingService/domain/member/controller/StaffMemberController.java +++ b/src/main/java/com/umc/networkingService/domain/member/controller/StaffMemberController.java @@ -3,7 +3,7 @@ import com.umc.networkingService.config.security.auth.CurrentMember; import com.umc.networkingService.domain.member.dto.request.MemberUpdateProfileRequest; import com.umc.networkingService.domain.member.dto.response.MemberIdResponse; -import com.umc.networkingService.domain.member.dto.response.MemberSearchInfoResponse; +import com.umc.networkingService.domain.member.dto.response.MemberSearchInfosResponse; import com.umc.networkingService.domain.member.entity.Member; import com.umc.networkingService.domain.member.service.MemberService; import com.umc.networkingService.global.common.base.BaseResponse; @@ -14,7 +14,6 @@ import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.*; -import java.util.List; import java.util.UUID; @Tag(name = "운영진용 멤버 API", description = "운영진용 멤버 관련 API") @@ -42,8 +41,8 @@ public BaseResponse updateProfile(@CurrentMember Member member @ApiResponse(responseCode = "MEMBER006", description = "[닉네임/이름] 양식에 맞지 않을 경우 발생") }) @GetMapping("/search") - public BaseResponse> searchMemberInfo(@CurrentMember Member member, - @RequestParam String keyword) { + public BaseResponse searchMemberInfo(@CurrentMember Member member, + @RequestParam String keyword) { return BaseResponse.onSuccess(memberService.searchMemberInfo(member, keyword)); } diff --git a/src/main/java/com/umc/networkingService/domain/member/dto/response/MemberSearchInfoResponse.java b/src/main/java/com/umc/networkingService/domain/member/dto/response/MemberSearchInfoResponse.java deleted file mode 100644 index 5a7b24ee..00000000 --- a/src/main/java/com/umc/networkingService/domain/member/dto/response/MemberSearchInfoResponse.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.umc.networkingService.domain.member.dto.response; - -import com.umc.networkingService.domain.member.dto.SemesterPartInfo; -import lombok.Builder; -import lombok.Getter; - -import java.util.List; -import java.util.UUID; - -@Getter -@Builder -public class MemberSearchInfoResponse { - private UUID memberId; - private String universityName; - private List campusPositions; - private List centerPositions; - private List semesterParts; -} diff --git a/src/main/java/com/umc/networkingService/domain/member/dto/response/MemberSearchInfosResponse.java b/src/main/java/com/umc/networkingService/domain/member/dto/response/MemberSearchInfosResponse.java new file mode 100644 index 00000000..3480b25b --- /dev/null +++ b/src/main/java/com/umc/networkingService/domain/member/dto/response/MemberSearchInfosResponse.java @@ -0,0 +1,25 @@ +package com.umc.networkingService.domain.member.dto.response; + +import com.umc.networkingService.domain.member.dto.SemesterPartInfo; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; + +import java.util.List; +import java.util.UUID; + +@Getter +@AllArgsConstructor +public class MemberSearchInfosResponse { + private List members; + + @Getter + @Builder + public static class MemberInfo { + private UUID memberId; + private String universityName; + private List campusPositions; + private List centerPositions; + private List semesterParts; + } +} diff --git a/src/main/java/com/umc/networkingService/domain/member/entity/Member.java b/src/main/java/com/umc/networkingService/domain/member/entity/Member.java index 024949df..54c7798a 100644 --- a/src/main/java/com/umc/networkingService/domain/member/entity/Member.java +++ b/src/main/java/com/umc/networkingService/domain/member/entity/Member.java @@ -12,6 +12,7 @@ import org.hibernate.annotations.SQLRestriction; import org.hibernate.annotations.UuidGenerator; +import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; import java.util.UUID; @@ -72,8 +73,11 @@ public class Member extends BaseEntity { private String gitNickname; - private String notionLink; + private String notionLink; + private LocalDateTime lastActiveTime; + + // 기본 정보 설정 함수 public void setMemberInfo(String name, String nickname, University university, Branch branch) { this.name = name; this.nickname = nickname; @@ -81,6 +85,7 @@ public void setMemberInfo(String name, String nickname, University university, B this.branch = branch; } + // 기본 정보 업데이트 함수 public void updateMemberInfo(MemberUpdateMyProfileRequest request, String profileImage) { this.name = request.getName(); this.nickname = request.getNickname(); @@ -88,23 +93,35 @@ public void updateMemberInfo(MemberUpdateMyProfileRequest request, String profil this.profileImage = profileImage; } + // 직책 업데이트 함수 public void updatePositions(List memberPositions) { this.positions = memberPositions; } + // 기수별 파트 업데이트 함수 public void updateSemesterParts(List semesterParts) { this.semesterParts = semesterParts; } + + // 깃허브 닉네임 업데이트 함수 public void authenticateGithub(String gitNickname) { this.gitNickname = gitNickname; } + // 기여도 포인트 업데이트 함수 public void updateContributionPoint(Long usedPoint) { if (this.contributionPoint == null) this.contributionPoint = usedPoint; else this.contributionPoint += usedPoint; } + // Role 업데이트 함수 public void updateRole(Role role) { this.role = role; } + + // 최근 활동 시간 업데이트 함수 + public void updateLastActiveTime(LocalDateTime lastActiveTime) { + this.lastActiveTime = lastActiveTime; + } + } diff --git a/src/main/java/com/umc/networkingService/domain/member/interceptor/LastActiveInterceptor.java b/src/main/java/com/umc/networkingService/domain/member/interceptor/LastActiveInterceptor.java new file mode 100644 index 00000000..14101d26 --- /dev/null +++ b/src/main/java/com/umc/networkingService/domain/member/interceptor/LastActiveInterceptor.java @@ -0,0 +1,28 @@ +package com.umc.networkingService.domain.member.interceptor; + +import com.umc.networkingService.config.security.auth.PrincipalDetails; +import com.umc.networkingService.domain.member.entity.Member; +import com.umc.networkingService.domain.member.service.MemberService; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.stereotype.Component; +import org.springframework.web.servlet.HandlerInterceptor; + +@Component +public class LastActiveInterceptor implements HandlerInterceptor { + @Autowired + private MemberService memberService; + + @Override + public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) { + Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); + PrincipalDetails principalDetails = (PrincipalDetails) authentication.getPrincipal(); + Member member = principalDetails.getMember(); + memberService.updateMemberActiveTime(member.getId()); + + return true; + } +} diff --git a/src/main/java/com/umc/networkingService/domain/member/mapper/MemberMapper.java b/src/main/java/com/umc/networkingService/domain/member/mapper/MemberMapper.java index c251c0fa..1efee450 100644 --- a/src/main/java/com/umc/networkingService/domain/member/mapper/MemberMapper.java +++ b/src/main/java/com/umc/networkingService/domain/member/mapper/MemberMapper.java @@ -84,9 +84,10 @@ public MemberInquiryPointsResponse toInquiryPointsResponse(Long point, .build(); } - public MemberSearchInfoResponse toSearchMembersResponse(Member member, List campusPositions, List centerPositions) { + public MemberSearchInfosResponse.MemberInfo toSearchMembersResponse( + Member member, List campusPositions, List centerPositions) { - return MemberSearchInfoResponse.builder() + return MemberSearchInfosResponse.MemberInfo.builder() .memberId(member.getId()) .universityName(member.getUniversity().getName()) .campusPositions(campusPositions) diff --git a/src/main/java/com/umc/networkingService/domain/member/service/AuthServiceImpl.java b/src/main/java/com/umc/networkingService/domain/member/service/AuthServiceImpl.java index cbaf19f1..407b3aa9 100644 --- a/src/main/java/com/umc/networkingService/domain/member/service/AuthServiceImpl.java +++ b/src/main/java/com/umc/networkingService/domain/member/service/AuthServiceImpl.java @@ -144,7 +144,8 @@ private MemberLoginResponse loginByApple(final String accessToken){ return saveNewMember(clientId, SocialType.APPLE); } // 2. 있으면 : 새로운 토큰 반환 - return getNewToken(getMember.get(), true); + boolean isServiceMember = getMember.get().getName() != null; + return getNewToken(getMember.get(), isServiceMember); } private MemberLoginResponse loginByKakao(final String accessToken){ @@ -173,7 +174,9 @@ private MemberLoginResponse loginByNaver(final String accessToken){ return saveNewMember(clientId,SocialType.NAVER); } // 2. 있으면 (이미 로그인 했던 적이 있는 경우) - return getNewToken(getMember.get(), true); + boolean isServiceMember = getMember.get().getName() != null; + + return getNewToken(getMember.get(), isServiceMember); } private MemberLoginResponse loginByGoogle(final String accessToken){ @@ -187,7 +190,8 @@ private MemberLoginResponse loginByGoogle(final String accessToken){ return saveNewMember(clientId, SocialType.GOOGLE); } // 2. 있으면 : 새로운 토큰 반환 - return getNewToken(getMember.get(), true); + boolean isServiceMember = getMember.get().getName() != null; + return getNewToken(getMember.get(), isServiceMember); } private MemberLoginResponse saveNewMember(String clientId, SocialType socialType) { diff --git a/src/main/java/com/umc/networkingService/domain/member/service/MemberService.java b/src/main/java/com/umc/networkingService/domain/member/service/MemberService.java index 380162e7..8bdd8e6d 100644 --- a/src/main/java/com/umc/networkingService/domain/member/service/MemberService.java +++ b/src/main/java/com/umc/networkingService/domain/member/service/MemberService.java @@ -7,7 +7,6 @@ import com.umc.networkingService.global.common.base.EntityLoader; import org.springframework.web.multipart.MultipartFile; -import java.util.List; import java.util.UUID; public interface MemberService extends EntityLoader { @@ -18,6 +17,7 @@ public interface MemberService extends EntityLoader { MemberInquiryInfoWithPointResponse inquiryInfoWithPoint(Member member); MemberInquiryGithubResponse inquiryGithubImage(Member member); MemberInquiryPointsResponse inquiryMemberPoints(Member member); - List searchMemberInfo(Member member, String keyword); + MemberSearchInfosResponse searchMemberInfo(Member member, String keyword); + void updateMemberActiveTime(UUID memberId); Member saveEntity(Member member); } diff --git a/src/main/java/com/umc/networkingService/domain/member/service/MemberServiceImpl.java b/src/main/java/com/umc/networkingService/domain/member/service/MemberServiceImpl.java index 10fed2c1..7bb855b3 100644 --- a/src/main/java/com/umc/networkingService/domain/member/service/MemberServiceImpl.java +++ b/src/main/java/com/umc/networkingService/domain/member/service/MemberServiceImpl.java @@ -22,6 +22,7 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; +import java.time.LocalDateTime; import java.util.List; import java.util.Optional; import java.util.UUID; @@ -175,7 +176,7 @@ public MemberInquiryPointsResponse inquiryMemberPoints(Member loginMember) { // 멤버 검색 함수(운영진용) @Override - public List searchMemberInfo(Member loginMember, String keyword) { + public MemberSearchInfosResponse searchMemberInfo(Member loginMember, String keyword) { Member member = loadEntity(loginMember.getId()); // keyword 양식 검증 @@ -186,13 +187,22 @@ public List searchMemberInfo(Member loginMember, Strin .filter(searchedMember -> searchedMember.getRole().getPriority() > member.getRole().getPriority()) .toList(); - - return searchedMembers.stream() + List memberInfos = searchedMembers.stream() .map(searchedMember -> memberMapper.toSearchMembersResponse( searchedMember, getPositionNamesByType(searchedMember, PositionType.CAMPUS), getPositionNamesByType(searchedMember, PositionType.CENTER) )).toList(); + + return new MemberSearchInfosResponse(memberInfos); + } + + @Override + @Transactional + public void updateMemberActiveTime(UUID memberId) { + Member loginMember = loadEntity(memberId); + + loginMember.updateLastActiveTime(LocalDateTime.now()); } // 멤버의 새로운 Role 찾기 함수 diff --git a/src/main/java/com/umc/networkingService/domain/schedule/controller/ScheduleController.java b/src/main/java/com/umc/networkingService/domain/schedule/controller/ScheduleController.java index d7c62a81..5cf16baf 100644 --- a/src/main/java/com/umc/networkingService/domain/schedule/controller/ScheduleController.java +++ b/src/main/java/com/umc/networkingService/domain/schedule/controller/ScheduleController.java @@ -2,10 +2,7 @@ import com.umc.networkingService.config.security.auth.CurrentMember; import com.umc.networkingService.domain.member.entity.Member; -import com.umc.networkingService.domain.schedule.dto.request.ScheduleRequest.CreateSchedule; -import com.umc.networkingService.domain.schedule.dto.request.ScheduleRequest.UpdateSchedule; import com.umc.networkingService.domain.schedule.dto.response.ScheduleResponse.ScheduleDetail; -import com.umc.networkingService.domain.schedule.dto.response.ScheduleResponse.ScheduleId; import com.umc.networkingService.domain.schedule.dto.response.ScheduleResponse.ScheduleInfoSummariesInCalendar; import com.umc.networkingService.domain.schedule.dto.response.ScheduleResponse.ScheduleInfoSummaryLists; import com.umc.networkingService.domain.schedule.service.ScheduleService; @@ -14,19 +11,11 @@ import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; -import jakarta.validation.Valid; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.*; + import java.time.LocalDate; import java.util.UUID; -import lombok.RequiredArgsConstructor; -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.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RequestPart; -import org.springframework.web.bind.annotation.RestController; @Tag(name = "일정 API", description = "일정 관련 API") @RestController @@ -40,7 +29,7 @@ public class ScheduleController { @Operation(summary = "일정 조회(Web) - 중앙, 지부, 학교", description = "홈화면의 일정을 조회하는 API입니다.") @GetMapping @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "성공") + @ApiResponse(responseCode = "COMMON200", description = "성공") }) public BaseResponse getScheduleLists(@RequestParam LocalDate date) { @@ -50,7 +39,7 @@ public BaseResponse getScheduleLists(@RequestParam Loc @Operation(summary = "일정 조회(상세조회)", description = "홈화면의 달력에서 일정을 상세조회하는 API입니다.") @GetMapping("/detail/{scheduleId}") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "성공"), + @ApiResponse(responseCode = "COMMON200", description = "성공"), @ApiResponse(responseCode = "SCHEDULE001", description = "존재하지 않은 스케줄입니다.") }) public BaseResponse getScheduleDetail(@CurrentMember Member member, @@ -64,7 +53,7 @@ public BaseResponse getScheduleDetail(@CurrentMember Member memb @Operation(summary = "캘린더 조회 API", description = "홈 화면의 달력을 조회하는 API입니다.") @PostMapping("/calendar") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "성공") + @ApiResponse(responseCode = "COMMON200", description = "성공") }) public BaseResponse getSchedule(@RequestParam LocalDate date) { diff --git a/src/main/java/com/umc/networkingService/domain/schedule/controller/StaffScheduleController.java b/src/main/java/com/umc/networkingService/domain/schedule/controller/StaffScheduleController.java index e667b7c6..f4b514a8 100644 --- a/src/main/java/com/umc/networkingService/domain/schedule/controller/StaffScheduleController.java +++ b/src/main/java/com/umc/networkingService/domain/schedule/controller/StaffScheduleController.java @@ -11,14 +11,10 @@ import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; -import java.util.UUID; import lombok.RequiredArgsConstructor; -import org.springframework.web.bind.annotation.DeleteMapping; -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.RestController; +import org.springframework.web.bind.annotation.*; + +import java.util.UUID; @Tag(name = "운영진 스케줄 API", description = "운영진 스케줄 관련 API") @RestController @@ -31,7 +27,7 @@ public class StaffScheduleController { @Operation(summary = "일정 추가 API", description = "운영진 관리 페이지의 일정을 추가하는 API입니다.") @PostMapping @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "성공") + @ApiResponse(responseCode = "COMMON200", description = "성공") }) public BaseResponse createSchedule(@CurrentMember Member member, @RequestBody CreateSchedule request) { @@ -42,7 +38,7 @@ public BaseResponse createSchedule(@CurrentMember Member member, @Operation(summary = "일정 수정 API", description = "운영진 관리 페이지의 일정을 수정하는 API입니다.") @PostMapping("/update/{scheduleId}") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "성공"), + @ApiResponse(responseCode = "COMMON200", description = "성공"), @ApiResponse(responseCode = "SCHEDULE001", description = "존재하지 않은 스케줄입니다.") }) public BaseResponse updateSchedule(@CurrentMember Member member, @@ -57,7 +53,7 @@ public BaseResponse updateSchedule(@CurrentMember Member member, @Operation(summary = "일정 삭제 API", description = "운영진 관리 페이지의 일정을 삭제하는 API입니다.") @DeleteMapping("/{scheduleId}") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "성공"), + @ApiResponse(responseCode = "COMMON200", description = "성공"), @ApiResponse(responseCode = "SCHEDULE001", description = "존재하지 않은 스케줄입니다.") }) public BaseResponse deleteSchedule(@CurrentMember Member member, diff --git a/src/main/java/com/umc/networkingService/domain/schedule/dto/request/ScheduleRequest.java b/src/main/java/com/umc/networkingService/domain/schedule/dto/request/ScheduleRequest.java index de35796e..649570f2 100644 --- a/src/main/java/com/umc/networkingService/domain/schedule/dto/request/ScheduleRequest.java +++ b/src/main/java/com/umc/networkingService/domain/schedule/dto/request/ScheduleRequest.java @@ -2,13 +2,14 @@ import com.umc.networkingService.domain.board.entity.HostType; import com.umc.networkingService.global.common.enums.Semester; -import java.time.LocalDateTime; -import java.util.List; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; +import java.time.LocalDateTime; +import java.util.List; + public class ScheduleRequest { @Getter @AllArgsConstructor diff --git a/src/main/java/com/umc/networkingService/domain/schedule/dto/response/ScheduleResponse.java b/src/main/java/com/umc/networkingService/domain/schedule/dto/response/ScheduleResponse.java index c79eede8..7008bee0 100644 --- a/src/main/java/com/umc/networkingService/domain/schedule/dto/response/ScheduleResponse.java +++ b/src/main/java/com/umc/networkingService/domain/schedule/dto/response/ScheduleResponse.java @@ -1,18 +1,15 @@ package com.umc.networkingService.domain.schedule.dto.response; import com.umc.networkingService.domain.board.entity.HostType; -import com.umc.networkingService.domain.member.entity.Member; -import com.umc.networkingService.domain.member.entity.PositionType; -import com.umc.networkingService.global.common.enums.Role; -import com.umc.networkingService.global.common.enums.Semester; -import java.time.LocalDateTime; -import java.util.List; -import java.util.UUID; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; +import java.time.LocalDateTime; +import java.util.List; +import java.util.UUID; + public class ScheduleResponse { @Getter diff --git a/src/main/java/com/umc/networkingService/domain/schedule/entity/Schedule.java b/src/main/java/com/umc/networkingService/domain/schedule/entity/Schedule.java index c9f025d9..d0b7e233 100644 --- a/src/main/java/com/umc/networkingService/domain/schedule/entity/Schedule.java +++ b/src/main/java/com/umc/networkingService/domain/schedule/entity/Schedule.java @@ -6,12 +6,7 @@ import com.umc.networkingService.global.common.base.BaseEntity; import com.umc.networkingService.global.common.enums.Semester; import jakarta.persistence.*; -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; +import lombok.*; import org.hibernate.annotations.SQLRestriction; import org.hibernate.annotations.UuidGenerator; diff --git a/src/main/java/com/umc/networkingService/domain/schedule/mapper/ScheduleMapper.java b/src/main/java/com/umc/networkingService/domain/schedule/mapper/ScheduleMapper.java index 2aaeddff..5501efcf 100644 --- a/src/main/java/com/umc/networkingService/domain/schedule/mapper/ScheduleMapper.java +++ b/src/main/java/com/umc/networkingService/domain/schedule/mapper/ScheduleMapper.java @@ -2,18 +2,12 @@ import com.umc.networkingService.domain.member.entity.Member; import com.umc.networkingService.domain.schedule.dto.request.ScheduleRequest.CreateSchedule; -import com.umc.networkingService.domain.schedule.dto.request.ScheduleRequest.UpdateSchedule; -import com.umc.networkingService.domain.schedule.dto.response.ScheduleResponse.ScheduleDetail; -import com.umc.networkingService.domain.schedule.dto.response.ScheduleResponse.ScheduleId; -import com.umc.networkingService.domain.schedule.dto.response.ScheduleResponse.ScheduleInfoSummary; -import com.umc.networkingService.domain.schedule.dto.response.ScheduleResponse.ScheduleInfoSummaryInCalendar; -import com.umc.networkingService.domain.schedule.dto.response.ScheduleResponse.ScheduleInfoSummariesInCalendar; -import com.umc.networkingService.domain.schedule.dto.response.ScheduleResponse.ScheduleInfoSummaryLists; +import com.umc.networkingService.domain.schedule.dto.response.ScheduleResponse.*; import com.umc.networkingService.domain.schedule.entity.Schedule; -import java.time.LocalDateTime; +import org.springframework.stereotype.Component; + import java.util.List; import java.util.UUID; -import org.springframework.stereotype.Component; @Component public class ScheduleMapper { diff --git a/src/main/java/com/umc/networkingService/domain/schedule/repository/ScheduleRepository.java b/src/main/java/com/umc/networkingService/domain/schedule/repository/ScheduleRepository.java index 08342332..f99ce07e 100644 --- a/src/main/java/com/umc/networkingService/domain/schedule/repository/ScheduleRepository.java +++ b/src/main/java/com/umc/networkingService/domain/schedule/repository/ScheduleRepository.java @@ -1,15 +1,13 @@ package com.umc.networkingService.domain.schedule.repository; -import com.umc.networkingService.domain.board.entity.HostType; import com.umc.networkingService.domain.schedule.entity.Schedule; import io.lettuce.core.dynamic.annotation.Param; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; + import java.time.LocalDate; -import java.time.LocalDateTime; -import java.time.Month; import java.util.List; import java.util.UUID; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.Query; public interface ScheduleRepository extends JpaRepository { diff --git a/src/main/java/com/umc/networkingService/domain/schedule/service/ScheduleService.java b/src/main/java/com/umc/networkingService/domain/schedule/service/ScheduleService.java index 3bc0ea70..b960aceb 100644 --- a/src/main/java/com/umc/networkingService/domain/schedule/service/ScheduleService.java +++ b/src/main/java/com/umc/networkingService/domain/schedule/service/ScheduleService.java @@ -7,6 +7,7 @@ import com.umc.networkingService.domain.schedule.dto.response.ScheduleResponse.ScheduleId; import com.umc.networkingService.domain.schedule.dto.response.ScheduleResponse.ScheduleInfoSummariesInCalendar; import com.umc.networkingService.domain.schedule.dto.response.ScheduleResponse.ScheduleInfoSummaryLists; + import java.time.LocalDate; import java.util.UUID; diff --git a/src/main/java/com/umc/networkingService/domain/schedule/service/ScheduleServiceImpl.java b/src/main/java/com/umc/networkingService/domain/schedule/service/ScheduleServiceImpl.java index 02403b8e..c7c5740d 100644 --- a/src/main/java/com/umc/networkingService/domain/schedule/service/ScheduleServiceImpl.java +++ b/src/main/java/com/umc/networkingService/domain/schedule/service/ScheduleServiceImpl.java @@ -4,24 +4,20 @@ import com.umc.networkingService.domain.member.entity.Member; import com.umc.networkingService.domain.schedule.dto.request.ScheduleRequest.CreateSchedule; import com.umc.networkingService.domain.schedule.dto.request.ScheduleRequest.UpdateSchedule; -import com.umc.networkingService.domain.schedule.dto.response.ScheduleResponse.ScheduleDetail; -import com.umc.networkingService.domain.schedule.dto.response.ScheduleResponse.ScheduleId; -import com.umc.networkingService.domain.schedule.dto.response.ScheduleResponse.ScheduleInfoSummariesInCalendar; -import com.umc.networkingService.domain.schedule.dto.response.ScheduleResponse.ScheduleInfoSummary; -import com.umc.networkingService.domain.schedule.dto.response.ScheduleResponse.ScheduleInfoSummaryLists; +import com.umc.networkingService.domain.schedule.dto.response.ScheduleResponse.*; import com.umc.networkingService.domain.schedule.entity.Schedule; import com.umc.networkingService.domain.schedule.mapper.ScheduleMapper; import com.umc.networkingService.domain.schedule.repository.ScheduleRepository; import com.umc.networkingService.global.common.exception.ErrorCode; import com.umc.networkingService.global.common.exception.RestApiException; -import java.time.LocalDate; -import java.time.YearMonth; -import java.util.List; -import java.util.UUID; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.time.LocalDate; +import java.util.List; +import java.util.UUID; + @Service @RequiredArgsConstructor public class ScheduleServiceImpl implements ScheduleService { diff --git a/src/main/java/com/umc/networkingService/domain/session/entity/Session.java b/src/main/java/com/umc/networkingService/domain/session/entity/Session.java deleted file mode 100644 index a21fd320..00000000 --- a/src/main/java/com/umc/networkingService/domain/session/entity/Session.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.umc.networkingService.domain.session.entity; - -import com.umc.networkingService.domain.member.entity.Member; -import com.umc.networkingService.global.common.base.BaseEntity; -import jakarta.persistence.*; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.NoArgsConstructor; -import org.hibernate.annotations.DynamicInsert; -import org.hibernate.annotations.SQLRestriction; -import org.hibernate.annotations.UuidGenerator; - -import java.time.LocalDateTime; -import java.util.UUID; - -@Getter -@Entity -@NoArgsConstructor(access= AccessLevel.PROTECTED) -@SQLRestriction("deleted_at is null") -@DynamicInsert -public class Session extends BaseEntity { - @Id - @UuidGenerator - @Column(name = "session_id") - private UUID id; - - @ManyToOne(fetch = FetchType.LAZY) - private Member member; - - @Column(nullable = false) - private LocalDateTime startTime; - - @Column(nullable = false) - private LocalDateTime endTime; - - @Column(columnDefinition = "boolean default true") - private boolean isConnected; - -} diff --git a/src/main/java/com/umc/networkingService/domain/todoList/controller/TodoListController.java b/src/main/java/com/umc/networkingService/domain/todoList/controller/TodoListController.java index 96182fde..6b617dd9 100644 --- a/src/main/java/com/umc/networkingService/domain/todoList/controller/TodoListController.java +++ b/src/main/java/com/umc/networkingService/domain/todoList/controller/TodoListController.java @@ -4,7 +4,6 @@ import com.umc.networkingService.domain.member.entity.Member; import com.umc.networkingService.domain.todoList.dto.request.TodoListCreateRequest; import com.umc.networkingService.domain.todoList.dto.request.TodoListUpdateRequest; -import com.umc.networkingService.domain.todoList.dto.response.TodoListGetResponse; import com.umc.networkingService.domain.todoList.dto.response.TodoListGetResponses; import com.umc.networkingService.domain.todoList.dto.response.TodoListIdResponse; import com.umc.networkingService.domain.todoList.service.TodoListService; diff --git a/src/main/java/com/umc/networkingService/domain/todoList/dto/response/TodoListIdResponse.java b/src/main/java/com/umc/networkingService/domain/todoList/dto/response/TodoListIdResponse.java index 8c2d066b..ce289a44 100644 --- a/src/main/java/com/umc/networkingService/domain/todoList/dto/response/TodoListIdResponse.java +++ b/src/main/java/com/umc/networkingService/domain/todoList/dto/response/TodoListIdResponse.java @@ -1,7 +1,6 @@ package com.umc.networkingService.domain.todoList.dto.response; import lombok.AllArgsConstructor; -import lombok.Builder; import lombok.Getter; import java.util.UUID; diff --git a/src/main/java/com/umc/networkingService/domain/todoList/service/TodoListService.java b/src/main/java/com/umc/networkingService/domain/todoList/service/TodoListService.java index a6a6a6ff..0c1e55a3 100644 --- a/src/main/java/com/umc/networkingService/domain/todoList/service/TodoListService.java +++ b/src/main/java/com/umc/networkingService/domain/todoList/service/TodoListService.java @@ -3,12 +3,10 @@ import com.umc.networkingService.domain.member.entity.Member; import com.umc.networkingService.domain.todoList.dto.request.TodoListCreateRequest; import com.umc.networkingService.domain.todoList.dto.request.TodoListUpdateRequest; -import com.umc.networkingService.domain.todoList.dto.response.TodoListGetResponse; import com.umc.networkingService.domain.todoList.dto.response.TodoListGetResponses; import com.umc.networkingService.domain.todoList.dto.response.TodoListIdResponse; import java.time.LocalDate; -import java.util.List; import java.util.UUID; public interface TodoListService { diff --git a/src/main/java/com/umc/networkingService/domain/todoList/service/TodoListServiceImpl.java b/src/main/java/com/umc/networkingService/domain/todoList/service/TodoListServiceImpl.java index f99a2533..bcc4f177 100644 --- a/src/main/java/com/umc/networkingService/domain/todoList/service/TodoListServiceImpl.java +++ b/src/main/java/com/umc/networkingService/domain/todoList/service/TodoListServiceImpl.java @@ -8,10 +8,10 @@ import com.umc.networkingService.domain.todoList.entity.ToDoList; import com.umc.networkingService.domain.todoList.mapper.TodoListMapper; import com.umc.networkingService.domain.todoList.repository.TodoListRepository; +import com.umc.networkingService.global.common.exception.ErrorCode; import com.umc.networkingService.global.common.exception.RestApiException; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; -import com.umc.networkingService.global.common.exception.ErrorCode; import org.springframework.transaction.annotation.Transactional; import java.time.LocalDate; diff --git a/src/test/java/com/umc/networkingService/domain/invite/controller/InviteControllerTest.java b/src/test/java/com/umc/networkingService/domain/invite/controller/InviteControllerTest.java index e838d2f3..87f8a805 100644 --- a/src/test/java/com/umc/networkingService/domain/invite/controller/InviteControllerTest.java +++ b/src/test/java/com/umc/networkingService/domain/invite/controller/InviteControllerTest.java @@ -72,11 +72,13 @@ public void inquiryMyInviteCode() throws Exception { // given member.updateRole(Role.BRANCH_STAFF); - List response = List.of( - new InviteInquiryMineResponse("초대 코드1", Role.MEMBER, LocalDateTime.now()), - new InviteInquiryMineResponse("초대 코드2", Role.CAMPUS_STAFF, LocalDateTime.now()) + InviteInquiryMineResponse response = new InviteInquiryMineResponse( + List.of( + new InviteInquiryMineResponse.InviteInfo("초대 코드1", Role.MEMBER, LocalDateTime.now()), + new InviteInquiryMineResponse.InviteInfo("초대 코드2", Role.CAMPUS_STAFF, LocalDateTime.now())) ); + given(inviteService.inquiryMyInviteCode(any())).willReturn(response); given(memberRepository.findById(any(UUID.class))).willReturn(Optional.of(member)); @@ -87,7 +89,7 @@ public void inquiryMyInviteCode() throws Exception { .andExpect(status().isOk()) .andExpect(jsonPath("$.code").value("COMMON200")) .andExpect(jsonPath("$.message").value("요청에 성공하였습니다.")) - .andExpect(jsonPath("$.result").value(hasSize(response.size()))); + .andExpect(jsonPath("$.result").value(hasSize(response.getInvites().size()))); } @DisplayName("초대 코드 인증 API 테스트") diff --git a/src/test/java/com/umc/networkingService/domain/invite/service/InviteServiceIntegrationTest.java b/src/test/java/com/umc/networkingService/domain/invite/service/InviteServiceIntegrationTest.java index 2d3dd771..181d3760 100644 --- a/src/test/java/com/umc/networkingService/domain/invite/service/InviteServiceIntegrationTest.java +++ b/src/test/java/com/umc/networkingService/domain/invite/service/InviteServiceIntegrationTest.java @@ -82,10 +82,10 @@ public void inquiryMyInviteCode() { createInvite("secondInviteCode", Role.CAMPUS_STAFF); // when - List response = inviteService.inquiryMyInviteCode(member); + InviteInquiryMineResponse response = inviteService.inquiryMyInviteCode(member); // then - assertEquals(2, response.size()); + assertEquals(2, response.getInvites().size()); } @Test @@ -94,10 +94,10 @@ public void inquiryMyInviteCode() { public void inquiryMyInviteCodeWithNone() { // when - List response = inviteService.inquiryMyInviteCode(member); + InviteInquiryMineResponse response = inviteService.inquiryMyInviteCode(member); // then - assertEquals(0, response.size()); + assertEquals(0, response.getInvites().size()); } @Test diff --git a/src/test/java/com/umc/networkingService/domain/member/controller/StaffMemberControllerTest.java b/src/test/java/com/umc/networkingService/domain/member/controller/StaffMemberControllerTest.java index 87964ec8..443b5fc2 100644 --- a/src/test/java/com/umc/networkingService/domain/member/controller/StaffMemberControllerTest.java +++ b/src/test/java/com/umc/networkingService/domain/member/controller/StaffMemberControllerTest.java @@ -3,7 +3,7 @@ import com.umc.networkingService.domain.member.dto.SemesterPartInfo; import com.umc.networkingService.domain.member.dto.request.MemberUpdateProfileRequest; import com.umc.networkingService.domain.member.dto.response.MemberIdResponse; -import com.umc.networkingService.domain.member.dto.response.MemberSearchInfoResponse; +import com.umc.networkingService.domain.member.dto.response.MemberSearchInfosResponse; import com.umc.networkingService.domain.member.entity.Member; import com.umc.networkingService.domain.member.entity.SemesterPart; import com.umc.networkingService.domain.member.mapper.MemberMapper; @@ -84,7 +84,7 @@ public void searchMembersInfo() throws Exception { String keyword = "벡스/김준석"; member.updateRole(Role.CENTER_STAFF); - MemberSearchInfoResponse response = MemberSearchInfoResponse.builder() + MemberSearchInfosResponse.MemberInfo responses = MemberSearchInfosResponse.MemberInfo.builder() .memberId(UUID.randomUUID()) .universityName("인하대학교") .campusPositions(List.of("회장")) @@ -95,7 +95,7 @@ public void searchMembersInfo() throws Exception { new SemesterPartInfo(Part.SPRING, Semester.FIFTH) )).build(); - given(memberService.searchMemberInfo(any(), eq(keyword))).willReturn(List.of(response)); + given(memberService.searchMemberInfo(any(), eq(keyword))).willReturn(new MemberSearchInfosResponse(List.of(responses))); given(memberRepository.findById(any(UUID.class))).willReturn(Optional.of(member)); // when & then diff --git a/src/test/java/com/umc/networkingService/domain/member/service/MemberServiceIntegrationTest.java b/src/test/java/com/umc/networkingService/domain/member/service/MemberServiceIntegrationTest.java index d7295583..f74494c6 100644 --- a/src/test/java/com/umc/networkingService/domain/member/service/MemberServiceIntegrationTest.java +++ b/src/test/java/com/umc/networkingService/domain/member/service/MemberServiceIntegrationTest.java @@ -403,11 +403,11 @@ public void searchMemberInfo() { Member staff = createMember("222222", Role.CENTER_STAFF); // when - List responses = memberService.searchMemberInfo(staff, keyword); + MemberSearchInfosResponse responses = memberService.searchMemberInfo(staff, keyword); // then - assertEquals(1, responses.size()); - assertEquals(member.getId(), responses.get(0).getMemberId()); + assertEquals(1, responses.getMembers().size()); + assertEquals(member.getId(), responses.getMembers().get(0).getMemberId()); } @Test @@ -425,10 +425,10 @@ public void searchMembersInfo() { Member staff = createMember("333333", Role.CENTER_STAFF); // when - List responses = memberService.searchMemberInfo(staff, keyword); + MemberSearchInfosResponse responses = memberService.searchMemberInfo(staff, keyword); // then - assertEquals(2, responses.size()); + assertEquals(2, responses.getMembers().size()); } @Test @@ -446,10 +446,10 @@ public void searchMembersInfoByLowRole() { Member staff = createMember("333333", Role.CENTER_STAFF); // when - List responses = memberService.searchMemberInfo(staff, keyword); + MemberSearchInfosResponse responses = memberService.searchMemberInfo(staff, keyword); // then - assertEquals(1, responses.size()); + assertEquals(1, responses.getMembers().size()); }