Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CHORE] 실서버 배포 #307

Merged
merged 2 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.smeem.domain.member.adapter.member.MemberDeleter;
import com.smeem.domain.member.adapter.member.MemberFinder;
import com.smeem.domain.member.adapter.member.MemberSaver;
import com.smeem.domain.visit.adapter.VisitDeleter;
import com.smeem.external.oauth.exception.TokenException;
import com.smeem.domain.member.model.Member;
import com.smeem.domain.member.model.SocialType;
Expand All @@ -19,9 +20,6 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.security.NoSuchAlgorithmException;
import java.security.spec.InvalidKeySpecException;

import static com.smeem.common.code.failure.AuthFailureCode.INVALID_TOKEN;
import static java.util.Objects.nonNull;

Expand All @@ -34,6 +32,7 @@ public class AuthService {
private final MemberSaver memberSaver;
private final MemberDeleter memberDeleter;
private final DiaryDeleter diaryDeleter;
private final VisitDeleter visitDeleter;

private final TokenService tokenService;
private final AppleService appleService;
Expand All @@ -42,7 +41,7 @@ public class AuthService {
private final TrainingTimeService trainingTimeService;

@Transactional
public SignInServiceResponse signIn(final String socialAccessToken, final SignInServiceRequest request) throws NoSuchAlgorithmException, InvalidKeySpecException {
public SignInServiceResponse signIn(final String socialAccessToken, final SignInServiceRequest request) {
val socialType = request.socialType();
val socialId = socialLogin(socialType, socialAccessToken);
val existMember = isMemberBySocialAndSocialId(socialType, socialId);
Expand Down Expand Up @@ -71,6 +70,7 @@ public void withdraw(final long memberId) {
trainingTimeService.deleteAllByMember(member);
memberBadgeService.deleteAllByMember(member);
memberDeleter.deleteById(memberId);
visitDeleter.deleteByMember(member);
}

private Member getMemberBySocialAndSocialId(final SocialType socialType, final String socialId) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.smeem.domain.visit.adapter;

import com.smeem.domain.member.model.Member;
import com.smeem.domain.support.RepositoryAdapter;
import com.smeem.domain.visit.repository.VisitRepository;
import lombok.RequiredArgsConstructor;

@RepositoryAdapter
@RequiredArgsConstructor
public class VisitDeleter {

private final VisitRepository visitRepository;

public void deleteByMember(Member member) {
visitRepository.deleteByMember(member);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ public interface VisitRepository extends JpaRepository<Visit, Long> {

boolean existsByMemberAndVisitedAtBetween(Member member, LocalDateTime start, LocalDateTime end);
int countByMember(Member member);
void deleteByMember(Member member);
}
Loading