-
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.
- Loading branch information
Showing
8 changed files
with
90 additions
and
0 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
44 changes: 44 additions & 0 deletions
44
src/main/java/com/team6/onandthefarmsnsservice/controller/SnsController.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 |
---|---|---|
@@ -1,4 +1,48 @@ | ||
package com.team6.onandthefarmsnsservice.controller; | ||
|
||
import com.team6.onandthefarmsnsservice.dto.SnsFeedDto; | ||
import com.team6.onandthefarmsnsservice.service.FeedService; | ||
import com.team6.onandthefarmsnsservice.utils.BaseResponse; | ||
import com.team6.onandthefarmsnsservice.vo.FeedUploadRequest; | ||
import io.swagger.annotations.ApiOperation; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.http.HttpStatus; | ||
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.RestController; | ||
|
||
@RestController | ||
public class SnsController { | ||
|
||
private final FeedService feedService; | ||
|
||
@Autowired | ||
public SnsController(FeedService feedService){ | ||
this.feedService = feedService; | ||
} | ||
|
||
@PostMapping("/api/user/sns/upload") | ||
@ApiOperation("sns 피드 업로드") | ||
public ResponseEntity<BaseResponse> uploadFeed(@RequestBody FeedUploadRequest feedUploadRequest){ | ||
|
||
SnsFeedDto snsFeedDto = null; | ||
|
||
Long feedId = feedService.uploadFeed(snsFeedDto); | ||
|
||
|
||
BaseResponse baseResponse = BaseResponse.builder() | ||
.httpStatus(HttpStatus.CREATED) | ||
.message("feed upload success") | ||
.data(feedId) | ||
.build(); | ||
if(feedId == null){ | ||
baseResponse = BaseResponse.builder() | ||
.httpStatus(HttpStatus.FORBIDDEN) | ||
.message("feed upload fail") | ||
.build(); | ||
} | ||
|
||
return new ResponseEntity(baseResponse, HttpStatus.CREATED); | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
src/main/java/com/team6/onandthefarmsnsservice/dto/SnsFeedDto.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 |
---|---|---|
@@ -1,4 +1,7 @@ | ||
package com.team6.onandthefarmsnsservice.dto; | ||
|
||
import lombok.Data; | ||
|
||
@Data | ||
public class SnsFeedDto { | ||
} |
4 changes: 4 additions & 0 deletions
4
src/main/java/com/team6/onandthefarmsnsservice/repository/FeedRepository.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 |
---|---|---|
@@ -1,4 +1,8 @@ | ||
package com.team6.onandthefarmsnsservice.repository; | ||
|
||
|
||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface FeedRepository { | ||
} |
4 changes: 4 additions & 0 deletions
4
src/main/java/com/team6/onandthefarmsnsservice/service/FeedService.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 |
---|---|---|
@@ -1,4 +1,8 @@ | ||
package com.team6.onandthefarmsnsservice.service; | ||
|
||
import com.team6.onandthefarmsnsservice.dto.SnsFeedDto; | ||
|
||
public interface FeedService { | ||
|
||
Long uploadFeed(SnsFeedDto snsFeedDto); | ||
} |
23 changes: 23 additions & 0 deletions
23
src/main/java/com/team6/onandthefarmsnsservice/service/FeedServiceImpl.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,23 @@ | ||
package com.team6.onandthefarmsnsservice.service; | ||
|
||
import com.team6.onandthefarmsnsservice.dto.SnsFeedDto; | ||
import com.team6.onandthefarmsnsservice.repository.FeedRepository; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
public class FeedServiceImpl implements FeedService{ | ||
|
||
private final FeedRepository feedRepository; | ||
|
||
@Autowired | ||
public FeedServiceImpl(FeedRepository feedRepository){ | ||
this.feedRepository = feedRepository; | ||
} | ||
|
||
|
||
@Override | ||
public Long uploadFeed(SnsFeedDto snsFeedDto) { | ||
return null; | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
src/main/java/com/team6/onandthefarmsnsservice/vo/FeedUploadRequest.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,4 @@ | ||
package com.team6.onandthefarmsnsservice.vo; | ||
|
||
public class FeedUploadRequest { | ||
} |