Skip to content

Commit

Permalink
feat : feed upload 기본 세팅 #2
Browse files Browse the repository at this point in the history
  • Loading branch information
jikimomo committed Oct 6, 2022
1 parent f6beea0 commit bcd4d31
Show file tree
Hide file tree
Showing 8 changed files with 90 additions and 0 deletions.
6 changes: 6 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-client'
implementation 'org.springframework.cloud:spring-cloud-starter-openfeign'
implementation 'org.modelmapper:modelmapper:2.3.8'
implementation 'io.springfox:springfox-swagger2:3.0.0'
implementation 'org.springframework:spring-context-support:5.2.0.RELEASE'
implementation 'org.springframework.boot:spring-boot-starter-validation:2.7.2'
implementation group: 'org.springframework.cloud', name: 'spring-cloud-starter-netflix-eureka-client'
compileOnly 'io.springfox:springfox-boot-starter:3.0.0'
compileOnly 'org.projectlombok:lombok'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
runtimeOnly 'mysql:mysql-connector-java'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;

@SpringBootApplication
@EnableDiscoveryClient
public class OnandthefarmSnsserviceApplication {

public static void main(String[] args) {
Expand Down
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);
}
}
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 {
}
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 {
}
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);
}
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;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package com.team6.onandthefarmsnsservice.vo;

public class FeedUploadRequest {
}

0 comments on commit bcd4d31

Please sign in to comment.