-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from Team-Walkie/mvc/seungmin
community upload api 구현
- Loading branch information
Showing
19 changed files
with
290 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/main/java/com/whyranoid/walkie/controller/CommunityController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.whyranoid.walkie.controller; | ||
|
||
import com.whyranoid.walkie.dto.request.PostRequest; | ||
import com.whyranoid.walkie.service.CommunityService; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.media.ArraySchema; | ||
import io.swagger.v3.oas.annotations.media.Content; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponse; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.http.HttpHeaders; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@Tag(name = "community", description = "커뮤니티 API") | ||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/api/community") | ||
public class CommunityController { | ||
HttpHeaders httpHeaders = new HttpHeaders(); | ||
|
||
private final CommunityService communityService; | ||
@Operation(summary = "게시글 올리기", description = "커뮤니티에 게시글을 업로드합니다.") | ||
@ApiResponse(responseCode = "200", description = "업로드 성공", content = @Content(array = @ArraySchema(schema = @Schema(implementation = com.whyranoid.walkie.dto.response.ApiResponse.class)))) | ||
@PostMapping("/upload-post") | ||
public ResponseEntity uploadPost( | ||
@RequestBody PostRequest postRequest | ||
) { | ||
return ResponseEntity.ok(communityService.uploadPost(postRequest)); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
src/main/java/com/whyranoid/walkie/dto/request/MyInfoRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.whyranoid.walkie.dto.request; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.*; | ||
|
||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@Getter | ||
@Setter | ||
public class MyInfoRequest { | ||
@Schema(description = "변경하고자 하는 프로필 이미지") | ||
private String profileImg; | ||
|
||
@Schema(description = "변경하고자 하는 닉네임") | ||
private String nickname; | ||
|
||
@Builder | ||
MyInfoRequest(String profileImg, String nickname) { | ||
this.profileImg = profileImg; | ||
this.nickname = nickname; | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
src/main/java/com/whyranoid/walkie/dto/request/PostRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.whyranoid.walkie.dto.request; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.AccessLevel; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import javax.validation.constraints.NotNull; | ||
|
||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@Getter | ||
public class PostRequest { | ||
@NotNull | ||
@Schema(example = "123") | ||
private Long walkieId; | ||
|
||
@NotNull | ||
@Schema(example = "업로드할 사진 이미지 url") | ||
private String photo; | ||
|
||
@NotNull | ||
@Schema(example = "오늘 진짜 많이 걸었다~~") | ||
private String content; | ||
|
||
@Builder | ||
public PostRequest(Long walkieId, String photo, String content) { | ||
this.walkieId = walkieId; | ||
this.photo = photo; | ||
this.content = content; | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
src/main/java/com/whyranoid/walkie/dto/response/MyInfoResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.whyranoid.walkie.dto.response; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
@Builder | ||
public class MyInfoResponse { | ||
@Schema(description = "나의 프로필 이미지") | ||
private String profileImg; | ||
|
||
@Schema(description = "나의 닉네임") | ||
private String nickname; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.