Skip to content

Commit

Permalink
#3 fix : 회원 프로필 이미지 업로드 & 수정 & 회원 프로필 RES 응답 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
Suanna01 committed Apr 17, 2023
1 parent 6538235 commit 8b63402
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/main/java/com/zatch/zatchserver/controller/UserController.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ public ResponseEntity patchNickname(@PathVariable("userId") Long userId
}
}

@ApiResponses(value = {
@ApiResponse(code = 200, message = "Success", response = GetProfileResDto.class,
examples = @Example(@ExampleProperty(value = "{'property1': 'value1', 'property2': 'value2'}", mediaType = MediaType.APPLICATION_JSON_VALUE)))
})
@GetMapping("/{userId}/profile")
@ApiOperation(value = "회원 프로필", notes = "회원 프로필 API")
public ResponseEntity getProfile(@PathVariable("userId") Long userId) {
Expand All @@ -143,7 +147,7 @@ public ResponseEntity postAddress(@PathVariable("userId") Long userId, @RequestB
}

@GetMapping("/{userId}/mypage")
@ApiOperation(value = "회원 프로필", notes = "회원 프로필 API")
@ApiOperation(value = "회원 마이페이지", notes = "회원 마이페이지 API")
public ResponseEntity getMypage(@PathVariable("userId") Long userId) {
try {
String user_id = userService.mypage(userId);
Expand All @@ -155,7 +159,7 @@ public ResponseEntity getMypage(@PathVariable("userId") Long userId) {
}

@ApiResponses(value = {
@ApiResponse(code = 200, message = "Success", response = GetUserResDto.class,
@ApiResponse(code = 200, message = "Success", response = PostProfileImgDto.class,
examples = @Example(@ExampleProperty(value = "{'property1': 'value1', 'property2': 'value2'}", mediaType = MediaType.APPLICATION_JSON_VALUE)))
})
@PostMapping("/{userId}/upload_profile")
Expand All @@ -170,6 +174,10 @@ public ResponseEntity uploadProfile(@PathVariable("userId") Long userId, @Reques
}
}

@ApiResponses(value = {
@ApiResponse(code = 200, message = "Success", response = PostProfileImgDto.class,
examples = @Example(@ExampleProperty(value = "{'property1': 'value1', 'property2': 'value2'}", mediaType = MediaType.APPLICATION_JSON_VALUE)))
})
@PatchMapping("/{userId}/patch_profile")
@ApiOperation(value = "회원 프로필 이미지 수정", notes = "회원 프로필 이미지 수정 API")
public ResponseEntity patchProfile(@PathVariable("userId") Long userId, @RequestParam(value="image") MultipartFile image) {
Expand Down
15 changes: 15 additions & 0 deletions src/main/java/com/zatch/zatchserver/dto/PostProfileImgDto.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.zatch.zatchserver.dto;

import lombok.AllArgsConstructor;
import lombok.Getter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.web.multipart.MultipartFile;

@Getter
@AllArgsConstructor
@ApiModel(description = "프로필 업로드")
public class PostProfileImgDto {
@ApiModelProperty(value = "프로필 이미지 url", example = "https://아마존.이미지예시.png")
private MultipartFile image;
}

0 comments on commit 8b63402

Please sign in to comment.