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

feature → weekly #62

Merged
merged 101 commits into from
Nov 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
cb0a167
Merge pull request #15 from choboss00/feature/3-branch-mentoring
choboss00 Oct 20, 2023
015f646
fix : MentorPostStateConverter refactor
sjmjys954646 Oct 22, 2023
d215449
fix : mentorPostService 예외처리코드 수정
sjmjys954646 Oct 22, 2023
bd35a2a
feat : searchCategory
sjmjys954646 Oct 22, 2023
80ecfea
Merge pull request #45 from Step3-kakao-tech-campus/weekly
sjmjys954646 Oct 22, 2023
eea24b4
Merge pull request #46 from Step3-kakao-tech-campus/dev
sjmjys954646 Oct 22, 2023
c16258b
feat : mentorPost:
sjmjys954646 Oct 24, 2023
b131d70
feat : mentorPost length exception
sjmjys954646 Oct 24, 2023
d8fed85
feat : findAllByInterestKeyword
sjmjys954646 Oct 24, 2023
ff93ade
fix : mentorPostService string to enum
sjmjys954646 Oct 24, 2023
35d01fd
feat : mentorPostCategory
sjmjys954646 Oct 26, 2023
4ac2ccb
feat : initialize and usercategory video response dto restcontroller
sjmjys954646 Oct 26, 2023
0b02c42
feat : usercategoryVideoResponseDTO videoresponse
sjmjys954646 Oct 26, 2023
cf6799f
Merge pull request #49 from sjmjys954646/feature/3-branch-mentoring
choboss00 Oct 28, 2023
1f51297
Merge pull request #16 from choboss00/feature/3-branch-mentoring
choboss00 Oct 28, 2023
e8aaeac
feat : 멘티 기준 화면 게시글 갯수 보여주는 기능 추가
choboss00 Oct 28, 2023
f931ddd
fix : table 명 변경에 따른 테스트 코드 이름 수정
choboss00 Oct 28, 2023
342134a
test : 멘티 기준 게시글 갯수 로직 테스트
choboss00 Oct 28, 2023
e654ed4
feat : 멘토 : 신청 거부 기능 추가
choboss00 Oct 28, 2023
248d971
test : 멘토 : 신청 거부 기능 테스트
choboss00 Oct 28, 2023
6535981
fix : 멘토링 Accept requestDTO 수정
choboss00 Oct 29, 2023
2dfa3b7
test : 수정 후 로직 테스트
choboss00 Oct 29, 2023
be4cbf3
feat : 멘티 신청 생성 로직 작성
choboss00 Oct 29, 2023
be37f21
test : 멘티 신청 생성 로직 테스트 코드 작성 및 DisplayName 에너테이션 이름 수정
choboss00 Oct 29, 2023
babfe21
fix : 멘토 : 멘티 신청 거부 post -> patch 변경
choboss00 Oct 29, 2023
67453b5
test : patch 변경에 따른 테스트 코드 수정
choboss00 Oct 29, 2023
7233bac
fix : is_deleted SQL문 수정
choboss00 Oct 29, 2023
dbd1dab
feat : 멘티 : 신청 취소 기능 추가
choboss00 Oct 29, 2023
c8653f9
test : 멘티 : 신청 취소 기능 로직 테스트
choboss00 Oct 29, 2023
df05ddf
fix : Request, Response DTO 이름 변경
choboss00 Oct 29, 2023
307efbb
fix : DTO 이름 중복에 의한 이름 수정
choboss00 Oct 29, 2023
5b66af8
fix : DTO 이름 수정
choboss00 Oct 29, 2023
431047d
fix : contact 부분 코드 리팩토링
choboss00 Nov 2, 2023
7801dbd
test : 코드 리팩토링 후 테스트 코드 수정
choboss00 Nov 2, 2023
481a33e
fix : 테스트할 때 작성했던 print문 제거
choboss00 Nov 2, 2023
e18b69e
feat : 예외처리 메소드 작성
choboss00 Nov 2, 2023
dee658a
feat : NotConnectedRegisterUser 인덱싱 적용
choboss00 Nov 2, 2023
26bfcba
feat : AttributeConverter 적용
choboss00 Nov 2, 2023
5724d42
test : AttributeConverter 적용에 따른 테스트 코드 수정
choboss00 Nov 2, 2023
db46671
fix : FE 요청에 맞게 메소드 수정
choboss00 Nov 3, 2023
d291750
test : method 수정에 따른 테스트코드 수정
choboss00 Nov 3, 2023
1a41dcf
fix : service method 파라미터 이름 user -> mentor 변경
choboss00 Nov 3, 2023
f6c3e39
feat : done 화면 조회 response 작성
choboss00 Nov 3, 2023
1c9af4a
feat : video find all service
sjmjys954646 Nov 3, 2023
aa1066e
feat : video soft delete
sjmjys954646 Nov 3, 2023
93d3f2d
feat : videofindall testcode
sjmjys954646 Nov 3, 2023
97ae071
feat : videos/{video-id} restcontroller
sjmjys954646 Nov 3, 2023
7337f40
fix : videofindAll
sjmjys954646 Nov 3, 2023
d4cf0b1
feat : find video
sjmjys954646 Nov 3, 2023
c927432
fix : method 파라미터 이름 변경
choboss00 Nov 3, 2023
ff363aa
feat : 멘티 : done 화면 조회기능 추가
choboss00 Nov 3, 2023
a6e7de3
test : 멘티 : done 화면 조회 테스트
choboss00 Nov 3, 2023
58e52bf
feat : 멘토 기준 화면 조회 기능 추가
choboss00 Nov 3, 2023
8249c76
test : 멘토 기준 화면 조회 테스트
choboss00 Nov 3, 2023
b35345f
feat : 인덱싱 적용
choboss00 Nov 3, 2023
8d62d69
fix : Operation summary 수정
choboss00 Nov 3, 2023
41ad374
feat: update UserDetails
comom87 Nov 3, 2023
9747cb5
feat: update Errors
comom87 Nov 3, 2023
cbeb83a
feat: update JWTToken
comom87 Nov 3, 2023
2c64bc5
feat: update Security Config
comom87 Nov 3, 2023
356e370
feat: update APIResponse Format
comom87 Nov 3, 2023
46a3a5a
feat: update Interest
comom87 Nov 3, 2023
4213cbd
feat: create Refresh Token
comom87 Nov 3, 2023
21a9f64
feat: update User
comom87 Nov 3, 2023
48a7e63
feat: update resources
comom87 Nov 3, 2023
9b259a2
feat: update Mentoring
comom87 Nov 3, 2023
de52ecd
feat: update Video
comom87 Nov 3, 2023
6c35307
feat: update build.gradle
comom87 Nov 3, 2023
b1099a0
Merge pull request #54 from sjmjys954646/feature/2-branch-watching
comom87 Nov 3, 2023
20c7b64
feat : video history
sjmjys954646 Nov 4, 2023
ea5ea9f
fix : video history restcontroller
sjmjys954646 Nov 4, 2023
2bfcfb7
feat : videoHistory fin
sjmjys954646 Nov 4, 2023
ee726e0
feat : testcode update
sjmjys954646 Nov 4, 2023
159b3cc
fix : interest list to interest
sjmjys954646 Nov 4, 2023
7c23c26
feat : findUserCategory sevice
sjmjys954646 Nov 4, 2023
4fe78cf
Merge pull request #55 from cosmos-1885/feature/1-branch-account
sjmjys954646 Nov 4, 2023
5d0e93e
fix : deleteMapping 은 request 를 받지 않으니 Error 제거
choboss00 Nov 4, 2023
a21269a
fix : 멘티의 state 가 나오지 않던 버그 수정
choboss00 Nov 4, 2023
6221e1d
fix : user 인증
choboss00 Nov 4, 2023
7e3e69d
feat : 인증 메소드 추가
choboss00 Nov 4, 2023
d40d684
fix : 파라미터 이름 수정
choboss00 Nov 4, 2023
04555f2
test : mentorPost 테스트 코드 추가 작성
choboss00 Nov 4, 2023
9b151ea
Merge pull request #56 from sjmjys954646/feature/2-branch-watching
comom87 Nov 4, 2023
84639e8
feat : random 4 usercategory native query
sjmjys954646 Nov 4, 2023
2d17601
Merge branch 'master' of https://github.com/Step3-kakao-tech-campus/T…
sjmjys954646 Nov 4, 2023
953f6fe
feat : video show all
sjmjys954646 Nov 4, 2023
d750b8b
fix : videoResponse single
sjmjys954646 Nov 4, 2023
33f2ae1
Merge branch 'feature/1-branch-account' into feature/1-branch-account
choboss00 Nov 5, 2023
f887cb4
Merge pull request #22 from Step3-kakao-tech-campus/feature/1-branch-…
choboss00 Nov 5, 2023
5f92687
Merge pull request #23 from Step3-kakao-tech-campus/feature/2-branch-…
choboss00 Nov 5, 2023
8ac0bc2
Merge pull request #59 from choboss00/feature/2-branch-watching
choboss00 Nov 5, 2023
39333c3
fix : 파일 이름 수정 및 테스트 파일 삭제
choboss00 Nov 5, 2023
a8c3ffe
feat : category filtering
sjmjys954646 Nov 5, 2023
4bf9ffb
Merge pull request #60 from choboss00/feature/2-branch-watching
sjmjys954646 Nov 5, 2023
4ba5445
merge
sjmjys954646 Nov 5, 2023
86f2291
Merge pull request #58 from sjmjys954646/feature/2-branch-watching
sjmjys954646 Nov 5, 2023
158803d
feat : video view add restcontroller
sjmjys954646 Nov 5, 2023
1ad39f4
feat : service add view
sjmjys954646 Nov 5, 2023
f4e6f5b
feat : add request post
sjmjys954646 Nov 5, 2023
72e3755
feat : history add, view add
sjmjys954646 Nov 5, 2023
903fce6
Merge pull request #61 from sjmjys954646/feature/2-branch-watching
choboss00 Nov 5, 2023
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
7 changes: 4 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,15 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-web'
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'com.h2database:h2'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.restdocs:spring-restdocs-mockmvc'
testImplementation 'org.springframework.security:spring-security-test'

// jwt
implementation group: 'com.auth0', name: 'java-jwt', version: '4.3.0'
// JWT Token
implementation group: 'io.jsonwebtoken', name: 'jjwt-api', version: '0.11.5'
runtimeOnly group: 'io.jsonwebtoken', name: 'jjwt-impl', version: '0.11.5'
runtimeOnly group: 'io.jsonwebtoken', name: 'jjwt-jackson', version: '0.11.5'

implementation 'org.springframework.boot:spring-boot-devtools'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@

import java.util.Optional;

@RequiredArgsConstructor
@Service
@RequiredArgsConstructor
public class CustomUserDetailService implements UserDetailsService {
private final UserJPARepository accountJPARepository;

@Override
public UserDetails loadUserByUsername(String email) throws UsernameNotFoundException {
Optional<User> optionalAccount = accountJPARepository.findByEmail(email);
public CustomUserDetails loadUserByUsername(String email) throws UsernameNotFoundException {
Optional<User> optionalUser = accountJPARepository.findByEmail(email);

if (optionalAccount.isEmpty()) {
if (optionalUser.isEmpty()) {
return null;
}
else {
User account = optionalAccount.get();
return new CustomUserDetails(account);
User user = optionalUser.get();
return new CustomUserDetails(user);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,22 @@
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;

@RequiredArgsConstructor
@Getter
@RequiredArgsConstructor
public class CustomUserDetails implements UserDetails {
private final User user;

@Override
public Collection<? extends GrantedAuthority> getAuthorities() {
return Arrays.stream(user.getEmail().split(",")).map(SimpleGrantedAuthority::new).collect(Collectors.toList());
List<GrantedAuthority> authorities = new ArrayList<GrantedAuthority>();
authorities.add(new SimpleGrantedAuthority(user.getRole().toString()));
return authorities;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package com.example.demo.config.errors;

import com.example.demo.config.errors.exception.*;
import com.example.demo.config.utils.ApiUtils;
import com.example.demo.config.utils.ApiResponseBuilder;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

Expand Down Expand Up @@ -38,6 +36,6 @@ public ResponseEntity<?> serverError(Exception500 exception) {

@ExceptionHandler(Exception.class)
public ResponseEntity<?> unknownError(Exception exception) {
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(ApiUtils.error(exception.getMessage()));
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(ApiResponseBuilder.error(exception.getMessage()));
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
package com.example.demo.config.errors.exception;

import com.example.demo.config.utils.ApiUtils;
import com.example.demo.config.utils.ApiResponseBuilder;
import lombok.Getter;
import org.springframework.http.HttpStatus;
import org.springframework.validation.BindingResult;

import java.util.HashMap;
import java.util.Map;

@Getter
Expand All @@ -22,8 +19,8 @@ public Exception400(String message) {
errors = null;
}

public ApiUtils.ApiResponse<?> body(){
return ApiUtils.fail(errors, getMessage());
public ApiResponseBuilder.ApiResponse<?> body(){
return ApiResponseBuilder.fail(errors, getMessage());
}
}

Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
package com.example.demo.config.errors.exception;

import com.example.demo.config.utils.ApiUtils;
import com.example.demo.config.utils.ApiResponseBuilder;
import lombok.Getter;
import org.springframework.http.HttpStatus;

@Getter
public class Exception401 extends RuntimeException {
public Exception401(String message) {
super(message);
}

public ApiUtils.ApiResponse<?> body(){
return ApiUtils.error(getMessage());
public ApiResponseBuilder.ApiResponse<?> body(){
return ApiResponseBuilder.error(getMessage());
}
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
package com.example.demo.config.errors.exception;

import com.example.demo.config.utils.ApiUtils;
import com.example.demo.config.utils.ApiResponseBuilder;
import lombok.Getter;
import org.springframework.http.HttpStatus;

@Getter
public class Exception403 extends RuntimeException {
public Exception403(String message) {
super(message);
}

public ApiUtils.ApiResponse<?> body(){
return ApiUtils.error(getMessage());
public ApiResponseBuilder.ApiResponse<?> body(){
return ApiResponseBuilder.error(getMessage());
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
package com.example.demo.config.errors.exception;

import com.example.demo.config.utils.ApiUtils;
import org.springframework.http.HttpStatus;
import com.example.demo.config.utils.ApiResponseBuilder;

public class Exception404 extends RuntimeException {
public Exception404(String message) {
super(message);
}

public ApiUtils.ApiResponse<?> body(){
return ApiUtils.error(getMessage());
public ApiResponseBuilder.ApiResponse<?> body(){
return ApiResponseBuilder.error(getMessage());
}
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
package com.example.demo.config.errors.exception;

import com.example.demo.config.utils.ApiUtils;
import com.example.demo.config.utils.ApiResponseBuilder;
import lombok.Getter;
import org.springframework.http.HttpStatus;

@Getter
public class Exception500 extends RuntimeException {
public Exception500(String message) {
super(message);
}

public ApiUtils.ApiResponse<?> body() {
return ApiUtils.error(getMessage());
public ApiResponseBuilder.ApiResponse<?> body() {
return ApiResponseBuilder.error(getMessage());
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package com.example.demo.config.jwt;

import com.auth0.jwt.exceptions.SignatureVerificationException;
import com.auth0.jwt.exceptions.TokenExpiredException;
import com.auth0.jwt.interfaces.DecodedJWT;
import com.example.demo.user.User;
import com.example.demo.config.auth.CustomUserDetails;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
Expand All @@ -17,42 +16,35 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

@Slf4j
public class JWTAuthenticationFilter extends BasicAuthenticationFilter {
public JWTAuthenticationFilter(AuthenticationManager authenticationManager) {

private final String Authorization = "Authorization";

private final JWTTokenProvider jwtTokenProvider;

public JWTAuthenticationFilter(AuthenticationManager authenticationManager, JWTTokenProvider jwtTokenProvider) {
super(authenticationManager);
this.jwtTokenProvider = jwtTokenProvider;
}

@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException {
String jwt = request.getHeader(JWTTokenProvider.HEADER);
String jwtAccessToken = request.getHeader(Authorization);

if (jwt == null) {
if (jwtAccessToken == null || !(jwtAccessToken.startsWith("Bearer "))) {
chain.doFilter(request, response);
return;
}

try {
DecodedJWT decodedJWT = JWTTokenProvider.verify(jwt);
int id = decodedJWT.getClaim("user_id").asInt();
String email = decodedJWT.getClaim("user_email").asString();
User user = User.builder().email(email).build();
CustomUserDetails customUserDetails = new CustomUserDetails(user);
Authentication authentication =
new UsernamePasswordAuthenticationToken(
customUserDetails,
customUserDetails.getPassword(),
customUserDetails.getAuthorities()
);
String extractedJwtAccessToken = jwtAccessToken.replace(JWTTokenProvider.Token_Prefix, "");
if (jwtTokenProvider.validateToken(extractedJwtAccessToken)) {
Authentication authentication = jwtTokenProvider.getAuthentication(extractedJwtAccessToken);
SecurityContextHolder.getContext().setAuthentication(authentication);
System.out.println("디버그 : 인증 객체 만들어짐");
} catch (SignatureVerificationException sve) {
System.out.println("토큰 검증 실패");
} catch (TokenExpiredException tee) {
System.out.println("토큰 만료됨");
} finally {
chain.doFilter(request, response);
}
chain.doFilter(request, response);
}
}
Loading
Loading