diff --git a/src/main/java/com/moing/backend/domain/board/application/service/SendBoardAlarmUseCase.java b/src/main/java/com/moing/backend/domain/board/application/service/SendBoardAlarmUseCase.java index 91133868..0fd19fe0 100644 --- a/src/main/java/com/moing/backend/domain/board/application/service/SendBoardAlarmUseCase.java +++ b/src/main/java/com/moing/backend/domain/board/application/service/SendBoardAlarmUseCase.java @@ -2,8 +2,6 @@ import com.moing.backend.domain.board.domain.entity.Board; import com.moing.backend.domain.history.application.dto.response.MemberIdAndToken; -import com.moing.backend.domain.history.application.mapper.AlarmHistoryMapper; -import com.moing.backend.domain.history.application.service.SaveMultiAlarmHistoryUseCase; import com.moing.backend.domain.history.domain.entity.AlarmType; import com.moing.backend.domain.history.domain.entity.PagePath; import com.moing.backend.domain.member.domain.entity.Member; @@ -37,11 +35,10 @@ public void sendNewUploadAlarm(BaseServiceResponse baseServiceResponse, Board bo if (board.isNotice()) { String title = NEW_NOTICE_UPLOAD_MESSAGE.title(team.getName()); String body = NEW_NOTICE_UPLOAD_MESSAGE.body(board.getTitle()); - Optional> memberIdAndTokens = teamMemberGetService.getMemberInfoExceptMe(team.getTeamId(), member.getMemberId()); - if (memberIdAndTokens.isPresent() && !memberIdAndTokens.get().isEmpty()) { - //알림 보내기 - eventPublisher.publishEvent(new MultiFcmEvent(title, body, memberIdAndTokens.get(), createIdInfo(team.getTeamId(), board.getBoardId()), team.getName(), AlarmType.NEW_UPLOAD, PagePath.NOTICE_PATH.getValue())); - } + Optional> memberIdAndTokensByPush = teamMemberGetService.getNewUploadPushInfo(team.getTeamId(), member.getMemberId()); + Optional> memberIdAndTokensBySave = teamMemberGetService.getNewUploadSaveInfo(team.getTeamId(), member.getMemberId()); + // 알림 보내기 + eventPublisher.publishEvent(new MultiFcmEvent(title, body, memberIdAndTokensByPush, memberIdAndTokensBySave, createIdInfo(team.getTeamId(), board.getBoardId()), team.getName(), AlarmType.NEW_UPLOAD, PagePath.NOTICE_PATH.getValue())); } } diff --git a/src/main/java/com/moing/backend/domain/fire/application/service/FireThrowAlarmUseCase.java b/src/main/java/com/moing/backend/domain/fire/application/service/FireThrowAlarmUseCase.java index 006dd25f..c76c180b 100644 --- a/src/main/java/com/moing/backend/domain/fire/application/service/FireThrowAlarmUseCase.java +++ b/src/main/java/com/moing/backend/domain/fire/application/service/FireThrowAlarmUseCase.java @@ -37,7 +37,7 @@ public void sendFireThrowAlarm(Member throwMember, Member receiveMember, Team te String message = getMessage(throwMember.getNickName(), receiveMember.getNickName(), randomNum); String idInfo = createIdInfo(mission.getType() == MissionType.REPEAT, mission.getTeam().getTeamId(), mission.getId()); - eventPublisher.publishEvent(new SingleFcmEvent(receiveMember.getFcmToken(), title, message, receiveMember.getMemberId(), idInfo, team.getName(), AlarmType.FIRE, MISSION_PATH.getValue())); + eventPublisher.publishEvent(new SingleFcmEvent(receiveMember, title, message, idInfo, team.getName(), AlarmType.FIRE, MISSION_PATH.getValue())); } public String getMessage(String pusher, String receiver, int num) { diff --git a/src/main/java/com/moing/backend/domain/member/domain/entity/Member.java b/src/main/java/com/moing/backend/domain/member/domain/entity/Member.java index b2c6b0f0..fbaf5da5 100644 --- a/src/main/java/com/moing/backend/domain/member/domain/entity/Member.java +++ b/src/main/java/com/moing/backend/domain/member/domain/entity/Member.java @@ -82,6 +82,8 @@ public class Member extends BaseTimeEntity { private LocalDateTime lastSignInTime; + private boolean isSignOut; + @OneToMany(mappedBy = "member") private List teamMembers = new ArrayList<>(); //최대 3개이므로 양방향 @@ -165,4 +167,12 @@ public void deleteMember(){ this.isDeleted=true; } + public void signOut() { + this.isSignOut = true; + } + + public void signIn() { + this.isSignOut = false; + } + } diff --git a/src/main/java/com/moing/backend/domain/member/domain/service/MemberSaveService.java b/src/main/java/com/moing/backend/domain/member/domain/service/MemberSaveService.java index 3aeff0eb..842027d4 100644 --- a/src/main/java/com/moing/backend/domain/member/domain/service/MemberSaveService.java +++ b/src/main/java/com/moing/backend/domain/member/domain/service/MemberSaveService.java @@ -23,6 +23,7 @@ public Member saveMember(Member member) { } else { findMember.get().updateFcmToken(member.getFcmToken()); findMember.get().updateLastSignInTime(LocalDateTime.now()); + findMember.get().signIn(); return findMember.get(); } } diff --git a/src/main/java/com/moing/backend/domain/mission/application/service/SendMissionCreateAlarmUseCase.java b/src/main/java/com/moing/backend/domain/mission/application/service/SendMissionCreateAlarmUseCase.java index 944ebe1d..5b22d1db 100644 --- a/src/main/java/com/moing/backend/domain/mission/application/service/SendMissionCreateAlarmUseCase.java +++ b/src/main/java/com/moing/backend/domain/mission/application/service/SendMissionCreateAlarmUseCase.java @@ -32,10 +32,10 @@ public void sendNewMissionUploadAlarm(Member member, Mission mission) { String title = team.getName() + " " + NEW_SINGLE_MISSION_COMING.getTitle(); String message = mission.getTitle(); - Optional> memberIdAndTokens = teamMemberGetService.getMemberInfoExceptMe(team.getTeamId(), member.getMemberId()); - if (memberIdAndTokens.isPresent() && !memberIdAndTokens.get().isEmpty()) { - eventPublisher.publishEvent(new MultiFcmEvent(title, message, memberIdAndTokens.get(), createIdInfo(team.getTeamId(), mission.getId()), team.getName(), AlarmType.NEW_UPLOAD, PagePath.MISSION_PATH.getValue())); - } + Optional> memberIdAndTokensByPush = teamMemberGetService.getNewUploadPushInfo(team.getTeamId(), member.getMemberId()); + Optional> memberIdAndTokensBySave = teamMemberGetService.getNewUploadSaveInfo(team.getTeamId(), member.getMemberId()); + // 알림 보내기 + eventPublisher.publishEvent(new MultiFcmEvent(title, message, memberIdAndTokensByPush, memberIdAndTokensBySave, createIdInfo(team.getTeamId(), mission.getId()), team.getName(), AlarmType.NEW_UPLOAD, PagePath.MISSION_PATH.getValue())); } private String createIdInfo(Long teamId, Long missionId) { diff --git a/src/main/java/com/moing/backend/domain/mypage/application/service/SignOutUseCase.java b/src/main/java/com/moing/backend/domain/mypage/application/service/SignOutUseCase.java index 26180396..864b080e 100644 --- a/src/main/java/com/moing/backend/domain/mypage/application/service/SignOutUseCase.java +++ b/src/main/java/com/moing/backend/domain/mypage/application/service/SignOutUseCase.java @@ -1,5 +1,6 @@ package com.moing.backend.domain.mypage.application.service; +import com.moing.backend.domain.member.domain.entity.Member; import com.moing.backend.domain.member.domain.service.MemberGetService; import com.moing.backend.global.config.security.jwt.TokenUtil; import lombok.RequiredArgsConstructor; @@ -11,8 +12,9 @@ public class SignOutUseCase { private final TokenUtil tokenUtil; private final MemberGetService memberGetService; - public void signOut(String socialId){ tokenUtil.expireRefreshToken(socialId); + Member member=memberGetService.getMemberBySocialId(socialId); + member.signOut(); } } diff --git a/src/main/java/com/moing/backend/domain/team/application/service/ApproveTeamUseCase.java b/src/main/java/com/moing/backend/domain/team/application/service/ApproveTeamUseCase.java index 4daedf88..51b8a1db 100644 --- a/src/main/java/com/moing/backend/domain/team/application/service/ApproveTeamUseCase.java +++ b/src/main/java/com/moing/backend/domain/team/application/service/ApproveTeamUseCase.java @@ -31,7 +31,7 @@ public void approveTeams(List teamIds){ String title=APPROVE_TEAM_MESSAGE.title(info.getLeaderName(), info.getTeamName()); String body= APPROVE_TEAM_MESSAGE.body(); - eventPublisher.publishEvent(new SingleFcmEvent(info.getLeaderFcmToken(), title, body, info.getLeaderId(), "", info.getTeamName(), AlarmType.APPROVE_TEAM, HOME_PATH.getValue())); +// eventPublisher.publishEvent(new SingleFcmEvent(info.getLeaderFcmToken(), title, body, info.getLeaderId(), "", info.getTeamName(), AlarmType.APPROVE_TEAM, HOME_PATH.getValue())); } } } diff --git a/src/main/java/com/moing/backend/domain/team/application/service/RejectTeamUseCase.java b/src/main/java/com/moing/backend/domain/team/application/service/RejectTeamUseCase.java index f52b379c..8d4a3c3e 100644 --- a/src/main/java/com/moing/backend/domain/team/application/service/RejectTeamUseCase.java +++ b/src/main/java/com/moing/backend/domain/team/application/service/RejectTeamUseCase.java @@ -31,7 +31,7 @@ public void rejectTeams(List teamIds) { String title = REJECT_TEAM_MESSAGE.title(info.getLeaderName(), info.getTeamName()); String body = REJECT_TEAM_MESSAGE.body(); - eventPublisher.publishEvent(new SingleFcmEvent(info.getLeaderFcmToken(), title, body, info.getLeaderId(), "", info.getTeamName(), AlarmType.REJECT_TEAM, HOME_PATH.getValue())); +// eventPublisher.publishEvent(new SingleFcmEvent(info.getLeaderFcmToken(), title, body, info.getLeaderId(), "", info.getTeamName(), AlarmType.REJECT_TEAM, HOME_PATH.getValue())); } } } diff --git a/src/main/java/com/moing/backend/domain/teamMember/domain/repository/TeamMemberCustomRepository.java b/src/main/java/com/moing/backend/domain/teamMember/domain/repository/TeamMemberCustomRepository.java index a9f0bdfa..15028f4f 100644 --- a/src/main/java/com/moing/backend/domain/teamMember/domain/repository/TeamMemberCustomRepository.java +++ b/src/main/java/com/moing/backend/domain/teamMember/domain/repository/TeamMemberCustomRepository.java @@ -10,7 +10,10 @@ public interface TeamMemberCustomRepository { List findMemberIdsByTeamId(Long teamId); - Optional> findIdAndTokensByTeamIdAndMemberId(Long teamId, Long memberId); + Optional> findNewUploadPushInfo(Long teamId, Long memberId); + Optional> findNewUploadSaveInfo(Long teamId, Long memberId); + Optional> findRemindPushInfo(Long teamId, Long memberId); + Optional> findRemindSaveInfo(Long teamId, Long memberId); Optional> findFcmTokensByTeamIdAndMemberId(Long teamId, Long memberId); List findTeamMemberInfoByTeamId(Long teamId); List findTeamMemberByMemberId(Long memberId); diff --git a/src/main/java/com/moing/backend/domain/teamMember/domain/repository/TeamMemberCustomRepositoryImpl.java b/src/main/java/com/moing/backend/domain/teamMember/domain/repository/TeamMemberCustomRepositoryImpl.java index db8e8ce5..41bf94b2 100644 --- a/src/main/java/com/moing/backend/domain/teamMember/domain/repository/TeamMemberCustomRepositoryImpl.java +++ b/src/main/java/com/moing/backend/domain/teamMember/domain/repository/TeamMemberCustomRepositoryImpl.java @@ -32,13 +32,57 @@ public List findMemberIdsByTeamId(Long teamId) { } @Override - public Optional> findIdAndTokensByTeamIdAndMemberId(Long teamId, Long memberId) { + public Optional> findNewUploadPushInfo(Long teamId, Long memberId) { List result = queryFactory.select(Projections.constructor(MemberIdAndToken.class, teamMember.member.fcmToken, teamMember.member.memberId)) .from(teamMember) .where(teamMember.team.teamId.eq(teamId) .and(teamMember.member.isNewUploadPush.eq(true)) + .and(teamMember.member.isSignOut.eq(false)) + .and(teamMember.member.memberId.ne(memberId)) + .and(teamMember.isDeleted.eq(false))) + .fetch(); + + return result.isEmpty() ? Optional.empty() : Optional.of(result); + } + + @Override + public Optional> findNewUploadSaveInfo(Long teamId, Long memberId) { + List result = queryFactory.select(Projections.constructor(MemberIdAndToken.class, + teamMember.member.fcmToken, + teamMember.member.memberId)) + .from(teamMember) + .where(teamMember.team.teamId.eq(teamId) + .and(teamMember.member.memberId.ne(memberId)) + .and(teamMember.isDeleted.eq(false))) + .fetch(); + + return result.isEmpty() ? Optional.empty() : Optional.of(result); + } + @Override + public Optional> findRemindPushInfo(Long teamId, Long memberId) { + List result = queryFactory.select(Projections.constructor(MemberIdAndToken.class, + teamMember.member.fcmToken, + teamMember.member.memberId)) + .from(teamMember) + .where(teamMember.team.teamId.eq(teamId) + .and(teamMember.member.isRemindPush.eq(true)) + .and(teamMember.member.isSignOut.eq(false)) + .and(teamMember.member.memberId.ne(memberId)) + .and(teamMember.isDeleted.eq(false))) + .fetch(); + + return result.isEmpty() ? Optional.empty() : Optional.of(result); + } + + @Override + public Optional> findRemindSaveInfo(Long teamId, Long memberId) { + List result = queryFactory.select(Projections.constructor(MemberIdAndToken.class, + teamMember.member.fcmToken, + teamMember.member.memberId)) + .from(teamMember) + .where(teamMember.team.teamId.eq(teamId) .and(teamMember.member.memberId.ne(memberId)) .and(teamMember.isDeleted.eq(false))) .fetch(); @@ -52,6 +96,7 @@ public Optional> findFcmTokensByTeamIdAndMemberId(Long teamId, Long .from(teamMember) .where(teamMember.team.teamId.eq(teamId) .and(teamMember.member.isNewUploadPush.eq(true)) + .and(teamMember.member.isSignOut.eq(false)) .and(teamMember.member.memberId.ne(memberId)) .and(teamMember.isDeleted.eq(false))) .fetch(); diff --git a/src/main/java/com/moing/backend/domain/teamMember/domain/service/TeamMemberGetService.java b/src/main/java/com/moing/backend/domain/teamMember/domain/service/TeamMemberGetService.java index 8b76cd09..87d6af25 100644 --- a/src/main/java/com/moing/backend/domain/teamMember/domain/service/TeamMemberGetService.java +++ b/src/main/java/com/moing/backend/domain/teamMember/domain/service/TeamMemberGetService.java @@ -38,7 +38,20 @@ public List getNotDeletedTeamMember(Long memberId){ return teamMemberRepository.findTeamMemberByMemberId(memberId); } - public Optional> getMemberInfoExceptMe(Long teamId, Long memberId) { - return teamMemberRepository.findIdAndTokensByTeamIdAndMemberId(teamId, memberId); + public Optional> getNewUploadPushInfo(Long teamId, Long memberId) { + return teamMemberRepository.findNewUploadPushInfo(teamId, memberId); } + + public Optional> getNewUploadSaveInfo(Long teamId, Long memberId) { + return teamMemberRepository.findNewUploadSaveInfo(teamId, memberId); + } + + public Optional> getRemindPushInfo(Long teamId, Long memberId) { + return teamMemberRepository.findRemindPushInfo(teamId, memberId); + } + + public Optional> getRemindSaveInfo(Long teamId, Long memberId) { + return teamMemberRepository.findRemindSaveInfo(teamId, memberId); + } + } diff --git a/src/main/java/com/moing/backend/global/config/fcm/dto/event/MultiFcmEvent.java b/src/main/java/com/moing/backend/global/config/fcm/dto/event/MultiFcmEvent.java index cecd5b6a..f944e40c 100644 --- a/src/main/java/com/moing/backend/global/config/fcm/dto/event/MultiFcmEvent.java +++ b/src/main/java/com/moing/backend/global/config/fcm/dto/event/MultiFcmEvent.java @@ -6,6 +6,7 @@ import lombok.Getter; import java.util.List; +import java.util.Optional; @Getter @AllArgsConstructor @@ -13,7 +14,8 @@ public class MultiFcmEvent { private String title; private String body; - private List memberIdAndTokens; + private Optional> idAndTokensByPush; + private Optional> idAndTokensBySave; private String idInfo; private String name; private AlarmType alarmType; diff --git a/src/main/java/com/moing/backend/global/config/fcm/dto/event/SingleFcmEvent.java b/src/main/java/com/moing/backend/global/config/fcm/dto/event/SingleFcmEvent.java index bb584296..02b9ab2f 100644 --- a/src/main/java/com/moing/backend/global/config/fcm/dto/event/SingleFcmEvent.java +++ b/src/main/java/com/moing/backend/global/config/fcm/dto/event/SingleFcmEvent.java @@ -2,6 +2,7 @@ import com.moing.backend.domain.history.application.dto.response.MemberIdAndToken; import com.moing.backend.domain.history.domain.entity.AlarmType; +import com.moing.backend.domain.member.domain.entity.Member; import lombok.AllArgsConstructor; import lombok.Getter; @@ -11,10 +12,9 @@ @AllArgsConstructor public class SingleFcmEvent { - private String registrationToken; + private Member member; private String title; private String body; - private Long memberId; private String idInfo; private String name; private AlarmType alarmType; diff --git a/src/main/java/com/moing/backend/global/config/fcm/service/FcmService.java b/src/main/java/com/moing/backend/global/config/fcm/service/FcmService.java index 129ddb72..37983a5c 100644 --- a/src/main/java/com/moing/backend/global/config/fcm/service/FcmService.java +++ b/src/main/java/com/moing/backend/global/config/fcm/service/FcmService.java @@ -26,9 +26,6 @@ public class FcmService { private final FirebaseMessaging firebaseMessaging; - private final SaveMultiAlarmHistoryUseCase saveMultiAlarmHistoryUseCase; - private final SaveSingleAlarmHistoryUseCase saveSingleAlarmHistoryUseCase; - @Retryable(value = FirebaseMessagingException.class, maxAttempts = 3, backoff = @Backoff(delay = 1000)) public SingleResponse sendSingleDevice(SingleRequest toSingleRequest) { @@ -67,7 +64,7 @@ public SingleResponse sendSingleDevice(SingleRequest toSingleRequest) { try { String response = firebaseMessaging.send(message); - saveSingleAlarmHistoryUseCase.saveAlarmHistory(toSingleRequest.getMemberId(), toSingleRequest.getIdInfo(), toSingleRequest.getTitle(), toSingleRequest.getBody(), toSingleRequest.getName(), toSingleRequest.getAlarmType(), toSingleRequest.getPath()); +// saveSingleAlarmHistoryUseCase.saveAlarmHistory(toSingleRequest.getMemberId(), toSingleRequest.getIdInfo(), toSingleRequest.getTitle(), toSingleRequest.getBody(), toSingleRequest.getName(), toSingleRequest.getAlarmType(), toSingleRequest.getPath()); return new SingleResponse(response); } catch (FirebaseMessagingException e) { throw handleException(e); @@ -123,7 +120,6 @@ public MultiResponse sendMultipleDevices(MultiRequest toMultiRequest) { List responses = response.getResponses(); List memberIds = AlarmHistoryMapper.getMemberIds(toMultiRequest.getMemberIdAndTokens()); - saveMultiAlarmHistoryUseCase.saveAlarmHistories(memberIds, toMultiRequest.getIdInfo(), toMultiRequest.getTitle(), toMultiRequest.getBody(), toMultiRequest.getName(), toMultiRequest.getAlarmType(), toMultiRequest.getPath()); for (int i = 0; i < responses.size(); i++) { if (!responses.get(i).isSuccessful()) { diff --git a/src/main/java/com/moing/backend/global/config/fcm/util/FcmMessageUtil.java b/src/main/java/com/moing/backend/global/config/fcm/util/FcmMessageUtil.java index 1bc65d22..de18a5a6 100644 --- a/src/main/java/com/moing/backend/global/config/fcm/util/FcmMessageUtil.java +++ b/src/main/java/com/moing/backend/global/config/fcm/util/FcmMessageUtil.java @@ -1,5 +1,8 @@ package com.moing.backend.global.config.fcm.util; +import com.moing.backend.domain.history.application.mapper.AlarmHistoryMapper; +import com.moing.backend.domain.history.application.service.SaveMultiAlarmHistoryUseCase; +import com.moing.backend.domain.history.application.service.SaveSingleAlarmHistoryUseCase; import com.moing.backend.global.config.fcm.dto.event.MultiFcmEvent; import com.moing.backend.global.config.fcm.dto.event.SingleFcmEvent; import com.moing.backend.global.config.fcm.dto.request.MultiRequest; @@ -16,17 +19,27 @@ public class FcmMessageUtil { private final FcmService fcmService; + private final SaveSingleAlarmHistoryUseCase saveSingleAlarmHistoryUseCase; + private final SaveMultiAlarmHistoryUseCase saveMultiAlarmHistoryUseCase; @Async @TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT) public void onMultiFcmEvent(MultiFcmEvent event) { - fcmService.sendMultipleDevices(new MultiRequest(event.getMemberIdAndTokens(), event.getTitle(), event.getBody(), event.getIdInfo(), event.getName(), event.getAlarmType(), event.getPath())); + if (event.getIdAndTokensByPush().isPresent() && !event.getIdAndTokensByPush().get().isEmpty()) { + fcmService.sendMultipleDevices(new MultiRequest(event.getIdAndTokensByPush().get(), event.getTitle(), event.getBody(), event.getIdInfo(), event.getName(), event.getAlarmType(), event.getPath())); + } + if (event.getIdAndTokensBySave().isPresent() && !event.getIdAndTokensBySave().get().isEmpty()) { + saveMultiAlarmHistoryUseCase.saveAlarmHistories(AlarmHistoryMapper.getMemberIds(event.getIdAndTokensBySave().get()), event.getIdInfo(), event.getTitle(), event.getBody(), event.getName(), event.getAlarmType(), event.getPath()); + } } @Async @TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT) public void onSingleFcmEvent(SingleFcmEvent event) { - fcmService.sendSingleDevice(new SingleRequest(event.getRegistrationToken(), event.getTitle(), event.getBody(), event.getMemberId(), event.getIdInfo(), event.getName(), event.getAlarmType(), event.getPath())); + if (event.getMember().isFirePush() && !event.getMember().isSignOut()) { //알림 on, 로그아웃 안함 + fcmService.sendSingleDevice(new SingleRequest(event.getMember().getFcmToken(), event.getTitle(), event.getBody(), event.getMember().getMemberId(), event.getIdInfo(), event.getName(), event.getAlarmType(), event.getPath())); + } + saveSingleAlarmHistoryUseCase.saveAlarmHistory(event.getMember().getMemberId(), event.getIdInfo(), event.getTitle(), event.getBody(), event.getName(), event.getAlarmType(), event.getPath()); } } diff --git a/src/main/java/com/moing/backend/global/utils/StartupRunner.java b/src/main/java/com/moing/backend/global/utils/StartupRunner.java index 2927490f..7857d309 100644 --- a/src/main/java/com/moing/backend/global/utils/StartupRunner.java +++ b/src/main/java/com/moing/backend/global/utils/StartupRunner.java @@ -1,43 +1,43 @@ -package com.moing.backend.global.utils; - -import com.moing.backend.domain.member.domain.constant.Gender; -import com.moing.backend.domain.member.domain.constant.RegistrationStatus; -import com.moing.backend.domain.member.domain.constant.Role; -import com.moing.backend.domain.member.domain.constant.SocialProvider; -import com.moing.backend.domain.member.domain.entity.Member; -import com.moing.backend.domain.member.domain.service.MemberSaveService; -import com.moing.backend.global.annotation.Util; -import lombok.RequiredArgsConstructor; -import org.springframework.boot.CommandLineRunner; -import org.springframework.stereotype.Component; - -import java.time.LocalDate; - -@Util -@RequiredArgsConstructor -public class StartupRunner implements CommandLineRunner { - - /** - * 테스트용 insert - */ - - private final MemberSaveService memberSaveService; - @Override - public void run(String... args) throws Exception { - Member test01 = new Member(LocalDate.now(), "tester1@test.com", "undef", Gender.WOMAN, "undef", "modagbul_tester1", "undef", SocialProvider.KAKAO, RegistrationStatus.COMPLETED, Role.USER, "KAKAO@tester01"); - memberSaveService.saveMember(test01); - - Member test02=new Member(LocalDate.now(), "tester2@test.com", "undef", Gender.MAN, null, "modagbul_tester2", null, SocialProvider.KAKAO, RegistrationStatus.COMPLETED, Role.USER, "KAKAO@tester02"); - memberSaveService.saveMember(test02); - - Member test03=new Member(LocalDate.now(), "tester3@test.com", "undef", Gender.WOMAN, "undef", "modagbul_tester3", "undef", SocialProvider.APPLE, RegistrationStatus.COMPLETED, Role.USER, "APPLE@tester03"); - memberSaveService.saveMember(test03); - - Member test04=new Member(LocalDate.now(), "tester4@test.com", "undef", Gender.WOMAN, "undef", "modagbul_tester4", "undef", SocialProvider.APPLE, RegistrationStatus.COMPLETED, Role.USER, "APPLE@tester04"); - memberSaveService.saveMember(test04); - - Member test05=new Member(LocalDate.now(), "tester5@test.com", "undef", Gender.WOMAN, "undef", "modagbul_tester5", "undef", SocialProvider.APPLE, RegistrationStatus.COMPLETED, Role.USER, "APPLE@tester05"); - memberSaveService.saveMember(test05); - - } -} +//package com.moing.backend.global.utils; +// +//import com.moing.backend.domain.member.domain.constant.Gender; +//import com.moing.backend.domain.member.domain.constant.RegistrationStatus; +//import com.moing.backend.domain.member.domain.constant.Role; +//import com.moing.backend.domain.member.domain.constant.SocialProvider; +//import com.moing.backend.domain.member.domain.entity.Member; +//import com.moing.backend.domain.member.domain.service.MemberSaveService; +//import com.moing.backend.global.annotation.Util; +//import lombok.RequiredArgsConstructor; +//import org.springframework.boot.CommandLineRunner; +//import org.springframework.stereotype.Component; +// +//import java.time.LocalDate; +// +//@Util +//@RequiredArgsConstructor +//public class StartupRunner implements CommandLineRunner { +// +// /** +// * 테스트용 insert +// */ +// +// private final MemberSaveService memberSaveService; +// @Override +// public void run(String... args) throws Exception { +// Member test01 = new Member(LocalDate.now(), "tester1@test.com", "undef", Gender.WOMAN, "undef", "modagbul_tester1", "undef", SocialProvider.KAKAO, RegistrationStatus.COMPLETED, Role.USER, "KAKAO@tester01"); +// memberSaveService.saveMember(test01); +// +// Member test02=new Member(LocalDate.now(), "tester2@test.com", "undef", Gender.MAN, null, "modagbul_tester2", null, SocialProvider.KAKAO, RegistrationStatus.COMPLETED, Role.USER, "KAKAO@tester02"); +// memberSaveService.saveMember(test02); +// +// Member test03=new Member(LocalDate.now(), "tester3@test.com", "undef", Gender.WOMAN, "undef", "modagbul_tester3", "undef", SocialProvider.APPLE, RegistrationStatus.COMPLETED, Role.USER, "APPLE@tester03"); +// memberSaveService.saveMember(test03); +// +// Member test04=new Member(LocalDate.now(), "tester4@test.com", "undef", Gender.WOMAN, "undef", "modagbul_tester4", "undef", SocialProvider.APPLE, RegistrationStatus.COMPLETED, Role.USER, "APPLE@tester04"); +// memberSaveService.saveMember(test04); +// +// Member test05=new Member(LocalDate.now(), "tester5@test.com", "undef", Gender.WOMAN, "undef", "modagbul_tester5", "undef", SocialProvider.APPLE, RegistrationStatus.COMPLETED, Role.USER, "APPLE@tester05"); +// memberSaveService.saveMember(test05); +// +// } +//}