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

Refactor/#92 SDK를 활용한 로그인 플로우를 적용 #96

Merged
merged 67 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
46e1509
feat: 분야별 뉴스 통계 화면 구현
realhsb Apr 21, 2024
20472ba
feat: 요일별 뉴스 관람 개수 통계 화면 구현
realhsb Apr 21, 2024
5cca59d
chore: 통계 뷰를 위한 내비게이션 path type 추가
realhsb Apr 21, 2024
0ebde20
feat: 일별 뉴스 관람 통계 그래프 UI 구현. 기능 미완성
realhsb Apr 21, 2024
01fbbf5
feat: 통계 그래프 적용
realhsb Apr 21, 2024
4553f9a
chore: 내비게이션 path type별 화면 전환
realhsb Apr 21, 2024
082239d
chore: UI 수정
realhsb Apr 21, 2024
2c393bd
chore: 파일명 변경 및 불필요한 파일 삭제
realhsb Apr 21, 2024
6aa846f
chore: 레포트뷰 내비게이션바 주석 처리
realhsb Apr 21, 2024
3f40a13
Merge pull request #83 from tukcomCD2024/feat/#82-ios-type-report-view
realhsb Apr 21, 2024
4561663
feat: 화면 요약 뷰 배경
realhsb Apr 21, 2024
4395770
Merge pull request #85 from tukcomCD2024/feat/#84-ios-debate-chat
realhsb Apr 21, 2024
10b9d7d
chore: PathType (북마크, 마이페이지) 추가
realhsb Apr 23, 2024
15e4d48
chore: 북마크뷰 커스텀내비게이션 연결
realhsb Apr 23, 2024
daf0cc3
chore: 메인탭뷰 커스텀 내비게이션 연결
realhsb Apr 23, 2024
d71365c
chore: 온보딩뷰 수정
realhsb Apr 23, 2024
c3026cc
design: 토론 요약 UI 수정
realhsb Apr 23, 2024
b7905dc
chore: 토론 요약 뷰 path type 정의 및 내비게이션 연결
realhsb Apr 23, 2024
35d1690
chore: 토론 요약 뷰 내비게이션 설정
realhsb Apr 23, 2024
6c8d2a9
design: 토론 채팅뷰 UI 재디자인
realhsb Apr 23, 2024
f0ea519
Merge pull request #87 from tukcomCD2024/feat/#86-ios-debate-ui
realhsb Apr 23, 2024
aaafa27
docs: 시스템 디자인 추가
yeonjy Apr 24, 2024
0eabf40
Merge pull request #88 from tukcomCD2024/DeviOS
realhsb Apr 27, 2024
efa9fa5
feat: DailyReport 뷰 및 뷰모델 정의
realhsb Apr 28, 2024
fe3923d
design: 일일 통계 뷰 UI 수정 및 뷰모델 연결
realhsb Apr 28, 2024
c48c61a
feat: 일일 통계 상세 조회수 팝업 추가
realhsb Apr 28, 2024
fa3e8cc
design: 파이차트용 Color Assets 추가
realhsb Apr 28, 2024
ae8c317
chore: NewsType 파일 분리
realhsb Apr 28, 2024
d7dfef4
chore: 변수명 수정
realhsb Apr 28, 2024
92ff4a9
chore: Report 모델 및 뷰모델 구조체 수정
realhsb Apr 28, 2024
7ccb5e0
feat: Report Navigation Path 연결
realhsb Apr 28, 2024
2d7695f
chore: TypeReport 변수 수정
realhsb Apr 28, 2024
e1c01ee
feat: Pie Chart 생성
realhsb Apr 28, 2024
0b79061
feat: Pie Chart 가운데에 많이 본 분야 텍스트 배치
realhsb Apr 28, 2024
d63e7b8
chore: Report View에서 내비게이션 버튼 숨김 설정
realhsb Apr 28, 2024
95897a3
feat: 통계 탭뷰 UI 변경
realhsb Apr 28, 2024
92902fd
feat: 프리뷰 모드에 따른 chart 형태 분기 처리
realhsb Apr 28, 2024
e35a3a1
Merge pull request #91 from tukcomCD2024/feat/#89-ios-charts
realhsb Apr 28, 2024
75a630d
Merge pull request #93 from tukcomCD2024/Dev-backend
yeonjy Apr 28, 2024
9d1c348
Merge pull request #94 from tukcomCD2024/DeviOS
realhsb Apr 28, 2024
f65c266
feat: MemberUpdateDto & MemberServiceDto
yeonjy Apr 29, 2024
bbffe99
refactor: jwt -> security directory
yeonjy Apr 30, 2024
55848fc
feat: InvalidTokenException
yeonjy Apr 30, 2024
159a63c
feat: NotFoundEmailException 구현
yeonjy Apr 30, 2024
e63edda
feat: LoginMemberArgumentResolver 구현
yeonjy Apr 30, 2024
d545a6b
feat: OAuth2ProviderService 구현
yeonjy Apr 30, 2024
25a6fff
refactor: AuthService 위치 변경
yeonjy Apr 30, 2024
f7bdd63
remove: OAuth2 Handler & CustomOAuth2UserService
yeonjy Apr 30, 2024
fe369d3
feat: LoginMemberEmail interface 구현
yeonjy Apr 30, 2024
9357849
refactor: AuthService 디렉터리 변경 반영
yeonjy Apr 30, 2024
cdcfca9
chore: webflux 라이브러리 의존성 추가
yeonjy Apr 30, 2024
846f135
chore: AuthService 디렉터리 변경 반영
yeonjy Apr 30, 2024
53eeeca
feat: updateMember 구현
yeonjy Apr 30, 2024
7e4d2f1
feat: existsMemberByNickname 추가
yeonjy Apr 30, 2024
c815aec
feat: JpaAuditingConfig 구현
yeonjy Apr 30, 2024
b7c6bd0
feat: AuthController 구현
yeonjy Apr 30, 2024
fc3cedc
fix: secretKey -> secret-key
yeonjy Apr 30, 2024
a4211ef
refactor: refreshtoken 검증 로직 변경
yeonjy Apr 30, 2024
55dead6
feat: LoginRequest 구현
yeonjy Apr 30, 2024
a4704b0
feat: SocialType 구현
yeonjy Apr 30, 2024
b31af0f
refactor: sdk를 이용한 로그인 적용
yeonjy Apr 30, 2024
1beb7f5
feat: member update 로직 구현
yeonjy Apr 30, 2024
d1855b8
remove: LoginController
yeonjy Apr 30, 2024
a5b27b4
fix: @EnableJpaAuditing 제거
yeonjy Apr 30, 2024
8656db7
fix: apple silicon chip 오류 해결
yeonjy Apr 30, 2024
341fc04
test: Login Token
yeonjy Apr 30, 2024
34b3eaa
hotfix: package 추가
yeonjy Apr 30, 2024
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
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,21 @@

---

## 📁 개발 시스템 구조도
## 📁 개발 시스템 구성도
![](https://github.com/tukcomCD2024/JinJiHan/assets/81320703/5df840e4-9c04-4d01-8fe1-119f53d4ae12)

## 📙 시스템 디자인
![](https://github.com/tukcomCD2024/JinJiHan/assets/81320703/62e40a3d-8143-4caf-aa55-1a73f7d97e90)

![](https://github.com/tukcomCD2024/JinJiHan/assets/81320703/9694ef38-8112-4448-885c-9a0f49886eb5) | ![](https://github.com/tukcomCD2024/JinJiHan/assets/81320703/7cb02e75-bf3c-4387-bd5c-44d012575c9e)
---|---|

![](https://github.com/tukcomCD2024/JinJiHan/assets/81320703/cece44e4-8a78-4b5b-877f-dc43597d4ecc) | ![](https://github.com/tukcomCD2024/JinJiHan/assets/81320703/af4b50a7-33e8-4563-ac8b-462c87a3b380)
---|---|

![](https://github.com/tukcomCD2024/JinJiHan/assets/81320703/5cb15e5e-4f14-4f62-aad6-93d3de38305c)
---|


## 🔗 ERD
![](https://github.com/tukcomCD2024/JinJiHan/assets/81320703/99ab2be8-b7a0-417e-8e94-6ec2f3f6b118)
Expand Down
8 changes: 8 additions & 0 deletions backend/core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ repositories {
}

dependencies {
if (isAppleSilicon()) {
runtimeOnly("io.netty:netty-resolver-dns-native-macos:4.1.94.Final:osx-aarch_64")
}
implementation 'com.auth0:java-jwt:4.2.1'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
Expand All @@ -37,6 +40,7 @@ dependencies {
implementation 'org.jsoup:jsoup:1.15.3'
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.2.0'
implementation 'org.springframework.boot:spring-boot-starter-data-redis:2.3.1.RELEASE'
implementation 'org.springframework.boot:spring-boot-starter-webflux'

annotationProcessor 'org.projectlombok:lombok'
annotationProcessor 'org.mapstruct:mapstruct-processor:1.5.5.Final'
Expand All @@ -52,3 +56,7 @@ tasks.named('bootBuildImage') {
tasks.named('test') {
useJUnitPlatform()
}

def boolean isAppleSilicon() {
return System.getProperty("os.name") == "Mac OS X" && System.getProperty("os.arch") == "aarch64"
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.scheduling.annotation.EnableScheduling;

@EnableJpaAuditing
@EnableScheduling
@SpringBootApplication
public class BackendApplication {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
import com.rollthedice.backend.domain.bookmark.entity.Bookmark;
import com.rollthedice.backend.domain.bookmark.repository.BookmarkRepository;
import com.rollthedice.backend.domain.member.entity.Member;
import com.rollthedice.backend.domain.member.query.AuthService;
import com.rollthedice.backend.global.oauth2.service.AuthService;
import com.rollthedice.backend.domain.news.dto.response.NewsResponse;
import com.rollthedice.backend.domain.news.entity.News;
import com.rollthedice.backend.domain.news.mapper.NewsMapper;
import com.rollthedice.backend.domain.news.repository.NewsRepository;
import com.rollthedice.backend.domain.news.service.NewsService;
import jakarta.persistence.EntityNotFoundException;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Pageable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import com.rollthedice.backend.domain.debate.mapper.DebateRoomMapper;
import com.rollthedice.backend.domain.debate.repository.DebateRoomRepository;
import com.rollthedice.backend.domain.member.entity.Member;
import com.rollthedice.backend.domain.member.query.AuthService;
import com.rollthedice.backend.global.oauth2.service.AuthService;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,20 +1,34 @@
package com.rollthedice.backend.domain.member.controller;

import com.rollthedice.backend.domain.member.dto.MemberServiceDto;
import com.rollthedice.backend.domain.member.dto.MemberUpdateDto;
import com.rollthedice.backend.domain.member.dto.response.MemberResponse;
import com.rollthedice.backend.domain.member.service.MemberService;
import com.rollthedice.backend.global.annotation.LoginMemberEmail;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

@RestController
@RequiredArgsConstructor
@RequestMapping("members")
public class MemberController {
private final MemberService memberService;

@PostMapping
public ResponseEntity<HttpStatus> updateMember(@LoginMemberEmail String email,
@RequestBody MemberUpdateDto memberUpdateDto) {
MemberServiceDto memberServiceDto = memberUpdateDto.toServiceDto(email);

if (memberService.isDuplicatedNickname(memberServiceDto)) {
return ResponseEntity.status(HttpStatus.CONFLICT).build();
}
memberService.update(memberServiceDto);

return ResponseEntity.status(HttpStatus.OK).build();
}

@ResponseStatus(HttpStatus.OK)
@GetMapping("")
public MemberResponse getMemberInfo() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.rollthedice.backend.domain.member.dto;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;

@Getter
@Builder
@AllArgsConstructor
public class MemberServiceDto {
private String email;
private String nickname;
private String imageUrl;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.rollthedice.backend.domain.member.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@NoArgsConstructor(access = AccessLevel.PRIVATE)
@AllArgsConstructor
@Schema(description = "멤버 업데이트 포맷")
public class MemberUpdateDto {
@Schema(description = "변경할 닉네임")
private String nickname;
@Schema(description = "변경할 이미지 S3 Url")
private String imageUrl;

public MemberServiceDto toServiceDto(String email) {
return MemberServiceDto.builder()
.email(email)
.nickname(this.nickname)
.imageUrl(this.imageUrl)
.build();
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.rollthedice.backend.domain.member.entity;

import com.rollthedice.backend.domain.member.dto.MemberServiceDto;
import com.rollthedice.backend.global.config.BaseTimeEntity;
import jakarta.persistence.*;
import lombok.*;
Expand Down Expand Up @@ -29,10 +30,10 @@ public class Member extends BaseTimeEntity {
@Enumerated(EnumType.STRING)
private Status status;

public Member update(String email, String imageUrl) {
this.email = email;
this.imageUrl = imageUrl;
return this;
public void update(MemberServiceDto dto) {
this.email = dto.getEmail();
this.imageUrl = dto.getImageUrl();
this.nickname = dto.getNickname();
}

public void signUp(String nickname) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
package com.rollthedice.backend.domain.member.entity;

import com.fasterxml.jackson.annotation.JsonCreator;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

@RequiredArgsConstructor
@Getter
public enum SocialType {
APPLE,
KAKAO
APPLE("https://"),
KAKAO("https://kapi.kakao.com/v2/user/me");


private final String providerUrl;

@JsonCreator
public static SocialType from(String s) {
return SocialType.valueOf(s.toUpperCase());
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ public interface MemberRepository extends JpaRepository<Member, Long> {
Optional<Member> findByEmail(String email);

Optional<Member> findBySocialTypeAndOauthId(SocialType socialType, String oauthId);

boolean existsMemberByNickname(String nickname);
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
package com.rollthedice.backend.domain.member.service;

import com.rollthedice.backend.domain.member.dto.MemberServiceDto;
import com.rollthedice.backend.domain.member.dto.SignUpDto;
import com.rollthedice.backend.domain.member.dto.response.MemberResponse;
import com.rollthedice.backend.domain.member.entity.Member;
import com.rollthedice.backend.domain.member.query.AuthService;
import com.rollthedice.backend.global.jwt.refresh.service.RefreshTokenService;
import com.rollthedice.backend.global.jwt.service.JwtService;
import com.rollthedice.backend.domain.member.repository.MemberRepository;
import com.rollthedice.backend.global.oauth2.service.AuthService;
import com.rollthedice.backend.global.security.jwt.refresh.service.RefreshTokenService;
import com.rollthedice.backend.global.security.jwt.service.JwtService;
import jakarta.persistence.EntityNotFoundException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
Expand All @@ -20,15 +23,22 @@ public class MemberService {
private final JwtService jwtService;
private final HttpServletRequest request;
private final HttpServletResponse response;
private final MemberRepository memberRepository;


@Transactional(readOnly = true)
public boolean isDuplicatedNickname(MemberServiceDto memberServiceDto) {
return memberRepository.existsMemberByNickname(memberServiceDto.getNickname());
}

@Transactional
public void signUp(SignUpDto dto) {
Member member = authService.getMember();
member.signUp(dto.getNickname());
public void update(MemberServiceDto memberServiceDto) {
findByEmail(memberServiceDto.getEmail()).update(memberServiceDto);
}

String refreshToken = jwtService.createRefreshToken();
jwtService.setRefreshTokenHeader(response, refreshToken);
refreshTokenService.updateToken(member.getEmail(), refreshToken);
@Transactional(readOnly = true)
public Member findByEmail(String email) {
return memberRepository.findByEmail(email).orElseThrow(EntityNotFoundException::new);
}

public MemberResponse getMemberInfo() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.rollthedice.backend.domain.bookmark.service.BookmarkService;
import com.rollthedice.backend.domain.member.entity.Member;
import com.rollthedice.backend.domain.member.query.AuthService;
import com.rollthedice.backend.global.oauth2.service.AuthService;
import com.rollthedice.backend.domain.news.contentqueue.ContentProducer;
import com.rollthedice.backend.domain.news.dto.ContentMessageDto;
import com.rollthedice.backend.domain.news.dto.NewsUrlDto;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.rollthedice.backend.global.advice;

import com.rollthedice.backend.global.jwt.exception.NotFoundTokenException;
import com.rollthedice.backend.global.security.jwt.exception.NotFoundTokenException;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.rollthedice.backend.global.annotation;

import java.lang.annotation.*;


@Target({ElementType.PARAMETER})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface LoginMemberEmail {
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.rollthedice.backend.global.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;

@Configuration
@EnableJpaAuditing
public class JpaAuditingConfig {
}
Loading
Loading