Skip to content

Commit 3e68b15

Browse files
authored
Merge pull request #149 from Team-Festimate/main
데모데이 관련 내용 배포합니다!
2 parents 0207047 + 016ee9d commit 3e68b15

28 files changed

+458
-315
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,4 @@ out/
3838

3939
### VS Code ###
4040
.vscode/
41+
/mysql-data/

build.gradle

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ plugins {
44
id 'io.spring.dependency-management' version '1.1.7'
55
}
66

7-
group = 'org.festiamte'
7+
group = 'org.festimate'
88
version = '0.0.1-SNAPSHOT'
99

1010
java {
@@ -58,8 +58,26 @@ dependencies {
5858
testImplementation 'io.projectreactor:reactor-test' // WebFlux 테스트 지원
5959
testImplementation 'org.springframework.security:spring-security-test' // Security 테스트 지원
6060
testRuntimeOnly 'org.junit.platform:junit-platform-launcher' // JUnit 테스트 실행기
61+
62+
// --- QueryDSL ---
63+
implementation "com.querydsl:querydsl-jpa:${dependencyManagement.importedProperties['querydsl.version']}:jakarta"
64+
annotationProcessor 'com.querydsl:querydsl-apt:5.0.0:jakarta'
65+
66+
// --- Jakarta Persistence API ---
67+
implementation 'jakarta.persistence:jakarta.persistence-api:3.1.0'
68+
annotationProcessor 'jakarta.persistence:jakarta.persistence-api:3.1.0'
69+
}
70+
71+
sourceSets {
72+
main {
73+
java {
74+
srcDir 'src/main/java'
75+
// Q-타입 생성 위치를 IDE가 인식하도록 추가
76+
srcDir 'build/generated/sources/annotationProcessor/java/main'
77+
}
78+
}
6179
}
6280

6381
tasks.named('test') {
6482
useJUnitPlatform()
65-
}
83+
}

docker-compose.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1+
version: "3"
12
services:
23
mysql:
3-
image: 'mysql:latest'
4+
image: mysql:8.0
5+
container_name: festimate-mysql-1
46
env_file:
57
- .env
68
ports:
7-
- '3306:3306'
9+
- "3306:3306"
10+
volumes:
11+
- ./mysql-data:/var/lib/mysql
12+
restart: unless-stopped

src/main/java/org/festimate/team/api/admin/AdminController.java

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import org.festimate.team.api.point.dto.PointHistoryResponse;
77
import org.festimate.team.global.response.ApiResponse;
88
import org.festimate.team.global.response.ResponseBuilder;
9-
import org.festimate.team.infra.jwt.JwtService;
109
import org.springframework.http.ResponseEntity;
1110
import org.springframework.web.bind.annotation.*;
1211

@@ -16,7 +15,6 @@
1615
@RequestMapping("/v1/admin/festivals")
1716
@RequiredArgsConstructor
1817
public class AdminController {
19-
private final JwtService jwtService;
2018
private final FestivalFacade festivalFacade;
2119
private final FestivalHostFacade festivalHostFacade;
2220
private final ParticipantFacade participantFacade;
@@ -25,85 +23,76 @@ public class AdminController {
2523

2624
@PostMapping()
2725
public ResponseEntity<ApiResponse<FestivalResponse>> createFestival(
28-
@RequestHeader("Authorization") String accessToken,
26+
@RequestAttribute("userId") Long userId,
2927
@RequestBody FestivalRequest request
3028
) {
31-
Long userId = jwtService.parseTokenAndGetUserId(accessToken);
3229
FestivalResponse response = festivalFacade.createFestival(userId, request);
3330
return ResponseBuilder.created(response);
3431
}
3532

3633
@GetMapping()
3734
public ResponseEntity<ApiResponse<List<AdminFestivalResponse>>> getAllFestivals(
38-
@RequestHeader("Authorization") String accessToken
35+
@RequestAttribute("userId") Long userId
3936
) {
40-
Long userId = jwtService.parseTokenAndGetUserId(accessToken);
4137
List<AdminFestivalResponse> response = festivalFacade.getAllFestivals(userId);
4238
return ResponseBuilder.ok(response);
4339
}
4440

4541
@GetMapping("/{festivalId}")
4642
public ResponseEntity<ApiResponse<AdminFestivalDetailResponse>> getFestivalDetail(
47-
@RequestHeader("Authorization") String accessToken,
43+
@RequestAttribute("userId") Long userId,
4844
@PathVariable Long festivalId
4945
) {
50-
Long userId = jwtService.parseTokenAndGetUserId(accessToken);
5146
AdminFestivalDetailResponse response = festivalFacade.getFestivalDetail(userId, festivalId);
5247
return ResponseBuilder.ok(response);
5348
}
5449

5550
@GetMapping("/{festivalId}/participants/search")
5651
public ResponseEntity<ApiResponse<List<SearchParticipantResponse>>> getParticipantByNickname(
57-
@RequestHeader("Authorization") String accessToken,
52+
@RequestAttribute("userId") Long userId,
5853
@PathVariable("festivalId") Long festivalId,
5954
@RequestParam("nickname") String nickname
6055
) {
61-
Long userId = jwtService.parseTokenAndGetUserId(accessToken);
62-
6356
List<SearchParticipantResponse> response = participantFacade.getParticipantByNickname(userId, festivalId, nickname);
6457
return ResponseBuilder.ok(response);
6558
}
6659

6760
@PostMapping("/{festivalId}/points")
6861
public ResponseEntity<ApiResponse<Void>> rechargePoints(
69-
@RequestHeader("Authorization") String accessToken,
62+
@RequestAttribute("userId") Long userId,
7063
@PathVariable("festivalId") Long festivalId,
7164
@RequestBody RechargePointRequest request
7265
) {
73-
Long userId = jwtService.parseTokenAndGetUserId(accessToken);
7466
pointFacade.rechargePoints(userId, festivalId, request);
7567
return ResponseBuilder.ok(null);
7668
}
7769

7870
@PostMapping("/{festivalId}/hosts")
7971
public ResponseEntity<ApiResponse<Void>> addHost(
80-
@RequestHeader("Authorization") String accessToken,
72+
@RequestAttribute("userId") Long userId,
8173
@PathVariable("festivalId") Long festivalId,
8274
@RequestBody AddHostRequest request
8375
) {
84-
Long userId = jwtService.parseTokenAndGetUserId(accessToken);
8576
festivalHostFacade.addHost(userId, festivalId, request);
8677
return ResponseBuilder.created(null);
8778
}
8879

8980
@GetMapping("/{festivalId}/participants/{participantId}/points")
9081
public ResponseEntity<ApiResponse<PointHistoryResponse>> getParticipantPointHistory(
91-
@RequestHeader("Authorization") String accessToken,
82+
@RequestAttribute("userId") Long userId,
9283
@PathVariable("festivalId") Long festivalId,
9384
@PathVariable("participantId") Long participantId
9485
) {
95-
Long userId = jwtService.parseTokenAndGetUserId(accessToken);
9686
PointHistoryResponse response = pointFacade.getParticipantPointHistory(userId, festivalId, participantId);
9787
return ResponseBuilder.ok(response);
9888
}
9989

10090
@GetMapping("/{festivalId}/participants/{participantId}/matchings")
10191
public ResponseEntity<ApiResponse<AdminMatchingResponse>> getParticipantMatchingHistory(
102-
@RequestHeader("Authorization") String accessToken,
92+
@RequestAttribute("userId") Long userId,
10393
@PathVariable("festivalId") Long festivalId,
10494
@PathVariable("participantId") Long participantId
10595
) {
106-
Long userId = jwtService.parseTokenAndGetUserId(accessToken);
10796
AdminMatchingResponse response = matchingFacade.getMatchingSize(userId, festivalId, participantId);
10897
return ResponseBuilder.ok(response);
10998
}

src/main/java/org/festimate/team/api/auth/AuthController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public class AuthController {
2626
public ResponseEntity<ApiResponse<TokenResponse>> login(
2727
@RequestHeader("Authorization") String kakaoAccessToken
2828
) {
29-
log.info("social login - Code: {}", kakaoAccessToken);
29+
log.info("social login - kakaoAccessToken: {}", kakaoAccessToken);
3030

3131
String platformId = loginFacade.getPlatformId(kakaoAccessToken);
3232

src/main/java/org/festimate/team/api/facade/LoginFacade.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import org.festimate.team.domain.auth.service.KakaoLoginService;
77
import org.festimate.team.domain.user.entity.Platform;
88
import org.festimate.team.domain.user.service.UserService;
9-
import org.festimate.team.infra.jwt.JwtService;
9+
import org.festimate.team.infra.jwt.JwtTokenProvider;
1010
import org.springframework.stereotype.Component;
1111
import org.springframework.transaction.annotation.Transactional;
1212

@@ -15,7 +15,7 @@
1515
@RequiredArgsConstructor
1616
public class LoginFacade {
1717

18-
private final JwtService jwtService;
18+
private final JwtTokenProvider jwtTokenProvider;
1919
private final UserService userService;
2020
private final KakaoLoginService kakaoLoginService;
2121

@@ -28,18 +28,18 @@ public TokenResponse login(String platformId, Platform platform) {
2828

2929
private TokenResponse loginExistingUser(Long userId) {
3030
log.info("기존 유저 로그인 성공 - userId: {}", userId);
31-
String newRefreshToken = jwtService.createRefreshToken(userId);
31+
String newRefreshToken = jwtTokenProvider.createRefreshToken(userId);
3232

3333
userService.updateRefreshToken(userId, newRefreshToken);
34-
return new TokenResponse(userId, jwtService.createAccessToken(userId), newRefreshToken);
34+
return new TokenResponse(userId, jwtTokenProvider.createAccessToken(userId), newRefreshToken);
3535
}
3636

3737
public String getPlatformId(String authorization) {
3838
return kakaoLoginService.getKakaoPlatformId(authorization);
3939
}
4040

4141
private TokenResponse createTemporaryToken(String platformId) {
42-
return new TokenResponse(null, jwtService.createTempAccessToken(platformId), jwtService.createTempRefreshToken(platformId));
42+
return new TokenResponse(null, jwtTokenProvider.createTempAccessToken(platformId), jwtTokenProvider.createTempRefreshToken(platformId));
4343
}
4444
}
4545

src/main/java/org/festimate/team/api/facade/ParticipantFacade.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public EntryResponse createParticipant(Long userId, Long festivalId, ProfileRequ
4242
throw new FestimateException(ResponseError.PARTICIPANT_ALREADY_EXISTS);
4343
}
4444
Participant participant = participantService.createParticipant(user, festival, request);
45+
pointService.rechargePoint(participant, 10);
4546
matchingService.matchPendingParticipants(participant);
4647

4748
return EntryResponse.of(participant);

src/main/java/org/festimate/team/api/facade/SignUpFacade.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
import org.festimate.team.domain.user.validator.NicknameValidator;
1010
import org.festimate.team.global.exception.FestimateException;
1111
import org.festimate.team.global.response.ResponseError;
12-
import org.festimate.team.infra.jwt.JwtService;
12+
import org.festimate.team.infra.jwt.JwtTokenProvider;
1313
import org.springframework.stereotype.Component;
1414

1515
@Slf4j
1616
@Component
1717
@RequiredArgsConstructor
1818
public class SignUpFacade {
19-
private final JwtService jwtService;
19+
private final JwtTokenProvider jwtTokenProvider;
2020
private final UserService userService;
2121
private final NicknameValidator nicknameValidator;
2222

@@ -36,8 +36,8 @@ public void validateNickname(String nickname) {
3636

3737
private TokenResponse createTokenResponse(User user) {
3838
log.info("signup success - userId : {}, nickname : {}", user.getUserId(), user.getNickname());
39-
String accessToken = jwtService.createAccessToken(user.getUserId());
40-
String refreshToken = jwtService.createRefreshToken(user.getUserId());
39+
String accessToken = jwtTokenProvider.createAccessToken(user.getUserId());
40+
String refreshToken = jwtTokenProvider.createRefreshToken(user.getUserId());
4141
userService.updateRefreshToken(user.getUserId(), refreshToken);
4242
return TokenResponse.of(user.getUserId(), accessToken, refreshToken);
4343
}

src/main/java/org/festimate/team/api/festival/FestivalController.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,33 +7,29 @@
77
import org.festimate.team.api.festival.dto.FestivalVerifyResponse;
88
import org.festimate.team.global.response.ApiResponse;
99
import org.festimate.team.global.response.ResponseBuilder;
10-
import org.festimate.team.infra.jwt.JwtService;
1110
import org.springframework.http.ResponseEntity;
1211
import org.springframework.web.bind.annotation.*;
1312

1413
@RestController
1514
@RequestMapping("/v1/festivals")
1615
@RequiredArgsConstructor
1716
public class FestivalController {
18-
private final JwtService jwtService;
1917
private final FestivalFacade festivalFacade;
2018

2119
@PostMapping("/verify")
2220
public ResponseEntity<ApiResponse<FestivalVerifyResponse>> verifyFestival(
23-
@RequestHeader("Authorization") String accessToken,
21+
@RequestAttribute("userId") Long userId,
2422
@RequestBody FestivalVerifyRequest request
2523
) {
26-
Long userId = jwtService.parseTokenAndGetUserId(accessToken);
2724
FestivalVerifyResponse response = festivalFacade.verifyFestival(userId, request);
2825
return ResponseBuilder.ok(response);
2926
}
3027

3128
@GetMapping("/{festivalId}")
3229
public ResponseEntity<ApiResponse<FestivalInfoResponse>> getFestivalInfo(
33-
@RequestHeader("Authorization") String accessToken,
30+
@RequestAttribute("userId") Long userId,
3431
@PathVariable("festivalId") Long festivalId
3532
) {
36-
Long userId = jwtService.parseTokenAndGetUserId(accessToken);
3733
FestivalInfoResponse response = festivalFacade.getFestivalInfo(userId, festivalId);
3834
return ResponseBuilder.ok(response);
3935
}

src/main/java/org/festimate/team/api/matching/MatchingController.java

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import org.festimate.team.api.matching.dto.MatchingStatusResponse;
88
import org.festimate.team.global.response.ApiResponse;
99
import org.festimate.team.global.response.ResponseBuilder;
10-
import org.festimate.team.infra.jwt.JwtService;
1110
import org.springframework.http.ResponseEntity;
1211
import org.springframework.web.bind.annotation.*;
1312

@@ -16,38 +15,31 @@
1615
@RequiredArgsConstructor
1716
public class MatchingController {
1817
private final MatchingFacade matchingFacade;
19-
private final JwtService jwtService;
2018

2119
@PostMapping("/{festivalId}/matchings")
2220
public ResponseEntity<ApiResponse<MatchingStatusResponse>> createMatching(
23-
@RequestHeader("Authorization") String accessToken,
21+
@RequestAttribute("userId") Long userId,
2422
@PathVariable("festivalId") Long festivalId
2523
) {
26-
Long userId = jwtService.parseTokenAndGetUserId(accessToken);
27-
2824
MatchingStatusResponse response = matchingFacade.createMatching(userId, festivalId);
2925
return ResponseBuilder.created(response);
3026
}
3127

3228
@GetMapping("/{festivalId}/matchings")
3329
public ResponseEntity<ApiResponse<MatchingListResponse>> getMatching(
34-
@RequestHeader("Authorization") String accessToken,
30+
@RequestAttribute("userId") Long userId,
3531
@PathVariable("festivalId") Long festivalId
3632
) {
37-
Long userId = jwtService.parseTokenAndGetUserId(accessToken);
38-
3933
MatchingListResponse response = matchingFacade.getMatchingList(userId, festivalId);
4034
return ResponseBuilder.ok(response);
4135
}
4236

4337
@GetMapping("/{festivalId}/matchings/{matchingId}")
4438
public ResponseEntity<ApiResponse<MatchingDetailInfo>> getMatchingDetail(
45-
@RequestHeader("Authorization") String accessToken,
39+
@RequestAttribute("userId") Long userId,
4640
@PathVariable("festivalId") Long festivalId,
4741
@PathVariable("matchingId") Long matchingId
4842
) {
49-
Long userId = jwtService.parseTokenAndGetUserId(accessToken);
50-
5143
MatchingDetailInfo response = matchingFacade.getMatchingDetail(userId, festivalId, matchingId);
5244
return ResponseBuilder.ok(response);
5345
}

0 commit comments

Comments
 (0)