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

[Feat] 목표 체계 제거 #252

Merged
merged 2 commits into from
May 18, 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
32 changes: 0 additions & 32 deletions src/main/java/org/winey/server/controller/GoalController.java

This file was deleted.

This file was deleted.

This file was deleted.

6 changes: 0 additions & 6 deletions src/main/java/org/winey/server/domain/feed/Feed.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import lombok.NoArgsConstructor;
import org.winey.server.domain.AuditingTimeEntity;
import org.winey.server.domain.comment.Comment;
import org.winey.server.domain.goal.Goal;
import org.winey.server.domain.user.User;

@Getter
Expand Down Expand Up @@ -39,10 +38,6 @@ public class Feed extends AuditingTimeEntity {
@Column(nullable = false)
private Long feedMoney;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "goal_id")
private Goal goal;

@OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.REMOVE, mappedBy = "feed", orphanRemoval = true)
private List<FeedLike> feedLikes;

Expand All @@ -56,6 +51,5 @@ public Feed(User user, String feedTitle, String feedImage, Long feedMoney, FeedT
this.feedImage = feedImage;
this.feedMoney = feedMoney;
this.feedType = feedType;
this.goal = null;
}
}
92 changes: 0 additions & 92 deletions src/main/java/org/winey/server/domain/goal/Goal.java

This file was deleted.

5 changes: 1 addition & 4 deletions src/main/java/org/winey/server/domain/user/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import org.winey.server.domain.comment.Comment;
import org.winey.server.domain.feed.Feed;
import org.winey.server.domain.feed.FeedLike;
import org.winey.server.domain.goal.Goal;
import org.winey.server.domain.notification.Notification;
import org.winey.server.domain.recommend.Recommend;

Expand Down Expand Up @@ -66,11 +65,9 @@ public class User extends AuditingTimeEntity {
@Column
private Long savedCount;

@OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.REMOVE, mappedBy = "user", orphanRemoval = true)
private List<Goal> goals;

@OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.REMOVE, mappedBy = "user", orphanRemoval = true)
private List<Recommend> recommends;

@OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.REMOVE, mappedBy = "user", orphanRemoval = true)
private List<Feed> feeds;

Expand Down
23 changes: 0 additions & 23 deletions src/main/java/org/winey/server/infrastructure/GoalRepository.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import org.springframework.data.repository.Repository;
import org.springframework.lang.Nullable;
import org.winey.server.domain.feed.Feed;
import org.winey.server.domain.goal.Goal;
import org.winey.server.domain.recommend.Recommend;
import org.winey.server.domain.user.SocialType;
import org.winey.server.domain.user.User;
Expand Down
40 changes: 0 additions & 40 deletions src/main/java/org/winey/server/service/GoalService.java

This file was deleted.

22 changes: 0 additions & 22 deletions src/main/java/org/winey/server/service/auth/AuthService.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@
import java.util.Random;
import java.util.stream.Collectors;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.winey.server.config.jwt.JwtService;
import org.winey.server.controller.request.auth.SignInRequestDto;
import org.winey.server.controller.response.auth.SignInResponseDto;
import org.winey.server.controller.response.auth.TokenResponseDto;
import org.winey.server.domain.goal.Goal;
import org.winey.server.domain.goal.GoalType;
import org.winey.server.domain.notification.NotiType;
import org.winey.server.domain.notification.Notification;
import org.winey.server.domain.user.SocialType;
Expand All @@ -20,23 +17,19 @@
import org.winey.server.exception.model.NotFoundException;
import org.winey.server.exception.model.UnprocessableEntityException;
import org.winey.server.infrastructure.BlockUserRepository;
import org.winey.server.infrastructure.GoalRepository;
import org.winey.server.infrastructure.NotiRepository;
import org.winey.server.infrastructure.UserRepository;
import org.winey.server.service.auth.apple.AppleSignInService;
import org.winey.server.service.auth.kakao.KakaoSignInService;

@Slf4j
@Service
@RequiredArgsConstructor
public class AuthService {
private final AppleSignInService appleSignInService;
private final KakaoSignInService kakaoSignInService;
private final JwtService jwtService;

private final UserRepository userRepository;
private final BlockUserRepository blockUserRepository;
private final GoalRepository goalRepository;


private final Long TOKEN_EXPIRATION_TIME_ACCESS = 100 * 24 * 60 * 60 * 1000L;
Expand All @@ -47,12 +40,9 @@ public class AuthService {
@Transactional
public SignInResponseDto signIn(String socialAccessToken, SignInRequestDto requestDto) {
SocialType socialType = SocialType.valueOf(requestDto.getSocialType());
log.info("after get social type");
String socialId = login(socialType, socialAccessToken);
log.info("after get social info");

Boolean isRegistered = userRepository.existsBySocialIdAndSocialType(socialId, socialType);
log.info("after check isRegistered");
if (!isRegistered) {
String randomString= new Random().ints(6, 0, 36).mapToObj(i -> Character.toString("abcdefghijklmnopqrstuvwxyz0123456789".charAt(i))).collect(Collectors.joining());
while (userRepository.existsByNickname("위니"+randomString)) {
Expand All @@ -75,12 +65,6 @@ public SignInResponseDto signIn(String socialAccessToken, SignInRequestDto reque
.build();
newNoti.updateLinkId(null);
notiRepository.save(newNoti);

Goal newGoal = Goal.builder()
.goalType(GoalType.COMMONER_GOAL)
.user(newUser)
.build();
goalRepository.save(newGoal);
}

User user = userRepository.findBySocialIdAndSocialType(socialId, socialType)
Expand Down Expand Up @@ -140,12 +124,6 @@ public void withdraw(Long userId){
if (user == null) {
throw new NotFoundException(Error.NOT_FOUND_USER_EXCEPTION, Error.NOT_FOUND_USER_EXCEPTION.getMessage());
}
System.out.println("User: " + user);
System.out.println("Goals: " + user.getGoals());
System.out.println("Recommends: " + user.getRecommends());
System.out.println("Feeds: " + user.getFeeds());
System.out.println("FeedLikes: " + user.getFeedLikes());
System.out.println("Comments: "+ user.getComments());

// 유저가 생성한 반응과 관련된 알림 삭제
notiRepository.deleteByRequestUserId(userId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,15 @@

import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.gson.JsonArray;
import java.util.Map;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

import java.util.Map;

@Slf4j
@Service
@RequiredArgsConstructor
public class KakaoSignInService {
Expand All @@ -26,9 +23,7 @@ public String getKaKaoId(String accessToken) {
headers.add("Authorization","Bearer "+ accessToken);
HttpEntity<JsonArray> httpEntity = new HttpEntity<>(headers);
ResponseEntity<Object> responseData;
log.info("before kakao post");
responseData = restTemplate.postForEntity(KAKAO_URL,httpEntity,Object.class);
log.info("after kakao post");
ObjectMapper objectMapper = new ObjectMapper();
return objectMapper.convertValue(responseData.getBody(), Map.class).get("id").toString(); //소셜 id만 가져오는듯.
}
Expand Down
Loading