Skip to content

Commit

Permalink
feat: 포토가이드 생성 api - 토큰 검증 로직 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
daeunkwak committed Oct 30, 2023
1 parent 093ab98 commit cc7e2a4
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/main/java/app/gangdan/please/api/HeartController.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class HeartController {
private final HeartService heartService;

@Tag(name = "heart")
@ApiOperation(value = "좋아요 생성 api")
@ApiOperation(value = "좋아요 생성 api - 토큰 필요")
@PostMapping(value="/{photoGuideId}")
public ResponseEntity<HeartCreateResponseDto> createHeart(@ApiIgnore @RequestMemberId Long memberId,
@PathVariable("photoGuideId") Long photoGuideId){
Expand All @@ -31,7 +31,7 @@ public ResponseEntity<HeartCreateResponseDto> createHeart(@ApiIgnore @RequestMem
}

@Tag(name = "heart")
@ApiOperation(value = "좋아요 삭제 api")
@ApiOperation(value = "좋아요 삭제 api - 토큰 필요")
@DeleteMapping("/{heartId}")
public ResponseEntity<?> deleteHeart(@ApiIgnore @RequestMemberId Long memberId,
@PathVariable("heartId") Long heartId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,17 @@ public ResponseEntity<PhotoGuideCreateResponseDto> createPhotoGuide(@RequestPart


@Tag(name = "photoGuide")
@ApiOperation(value = "포토 가이드 등록 리메이크 api")
@ApiOperation(value = "포토 가이드 등록 리메이크 api - 토큰 필요")
@PostMapping("/test")
public ResponseEntity<PhotoGuideCreateResponseDto> createPhotoGuideTest(@RequestBody PhotoGuideRequestDtoV2 req) throws IOException, ImageProcessingException {
public ResponseEntity<PhotoGuideCreateResponseDto> createPhotoGuideTest(@RequestBody PhotoGuideRequestDtoV2 req,
@ApiIgnore @RequestMemberId Long memberId) throws IOException, ImageProcessingException {

log.info("길이확인:::: " + req.getOriginalImage());
log.info("memberId ::: " + memberId);
log.info("PhotoGuideRequestDtoV2: {}", req.toString());

// PhotoGuide 생성
PhotoGuide photoGuide = photoGuideService.createPhotoGuideV2(req);
PhotoGuide photoGuide = photoGuideService.createPhotoGuideV2(req, memberId);

imageService.saveOriginalImageV2(photoGuide, req.getOriginalImage());
imageService.saveContourImageV2(photoGuide, req.getContourImage());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public ResponseJwtTokenDto googleLoginV2(String tokenString) {

OAuthAttributes socialUserInfo = generateSocialInfoFromIdToken(idToken);

log.info("oauthAttributes: {}", socialUserInfo.toString());
log.info("oauthAttributes: {}", socialUserInfo.toString());

final Optional<Member> foundMember = memberRepository.findByEmail(email);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,11 @@ public PhotoGuide createPhotoGuide(Long memberId, MultipartFile requestImage) th
/**
* 포토 가이드 생성 v2
*/
public PhotoGuide createPhotoGuideV2(PhotoGuideRequestDtoV2 req) throws IOException, ImageProcessingException {
public PhotoGuide createPhotoGuideV2(PhotoGuideRequestDtoV2 req, Long memberId) throws IOException, ImageProcessingException {

if (memberId != req.getMemberId()) {
throw new BadRequestException("가이드를 생성할 권한이 없습니다.");
}

PhotoSpot photoSpot;
// image metadata -> 위도, 경도 추출
Expand Down

0 comments on commit cc7e2a4

Please sign in to comment.