Skip to content

Commit

Permalink
merge 충돌해결
Browse files Browse the repository at this point in the history
  • Loading branch information
do-dop committed Aug 15, 2024
2 parents 4d0b41d + 9da305b commit baf814a
Show file tree
Hide file tree
Showing 5 changed files with 315 additions and 233 deletions.
76 changes: 76 additions & 0 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle

name: ttakkeun ci/cd

on:
push:
branches: [ "develop" ]
pull_request:
branches: [ "develop" ]

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'

- name : make application.yml
run: |
mkdir ./src/main/resources
cd ./src/main/resources
touch ./application.yml
echo "${{ secrets.APPLICATION }}" > ./application.yml
shell: bash


# Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies.
# See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md
- name: Setup Gradle
uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0

- name: Build with Gradle Wrapper
run: ./gradlew build

## 웹 이미지 빌드 및 도커허브에 push
- name: Build and push Docker image
run: |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
docker build --platform linux/amd64 -t ${{ secrets.DOCKER_USERNAME }}/ttakkeun .
docker push ${{ secrets.DOCKER_USERNAME }}/ttakkeun
- name: Execute remote SSH commands
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }} # EC2 퍼블릭 IPv4 DNS
username: ubuntu
key: ${{ secrets.KEY }}
script: |
cd /home/ubuntu/
## .env 파일 생성
sudo touch .env
echo "${{ secrets.ENV_VARS }}" | sudo tee .env > /dev/null
## docker-compose.yml 파일 생성
sudo touch docker-compose.yml
echo "${{ secrets.DOCKER_COMPOSE }}" | sudo tee docker-compose.yml > /dev/null
## Docker 작업
sudo docker stop $(docker ps -a -q)
sudo docker rm -f $(docker ps -qa)
sudo docker pull ${{ secrets.DOCKER_USERNAME }}/ttakkeun
sudo docker run -d -p 8080:8080 ${{ secrets.DOCKER_USERNAME }}/ttakkeun
sudo docker image prune -f
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ bin/
out/
!**/src/main/**/out/
!**/src/test/**/out/
#*.yml
docker-compose.yml

### NetBeans ###
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import ttakkeun.ttakkeun_server.dto.diagnose.*;
import ttakkeun.ttakkeun_server.entity.Member;
import ttakkeun.ttakkeun_server.entity.enums.Category;
//import ttakkeun.ttakkeun_server.service.DiagnoseNaverProductService;
import ttakkeun.ttakkeun_server.service.DiagnoseNaverProductService;
import ttakkeun.ttakkeun_server.service.DiagnoseService;
//import ttakkeun.ttakkeun_server.dto.UpdateProductsDTO;

Expand All @@ -26,8 +26,8 @@ public class DiagnoseController {
@Autowired
private final DiagnoseService diagnoseService;

// @Autowired
// private final DiagnoseNaverProductService diagnoseNaverProductService;
@Autowired
private final DiagnoseNaverProductService diagnoseNaverProductService;

// 진단 버튼 클릭시 사용자의 포인트를 조회하는 API
@Operation(summary = "사용자 포인트 조회 API")
Expand Down Expand Up @@ -108,22 +108,22 @@ public ResponseEntity<ApiResponse<UpdateMyPointResponseDTO>> updatePointsByMembe
}

// 네이버 쇼핑 API로 진단 결과 DB 정보 업데이트 API
// @Operation(summary = "추천 제품 네이버 쇼핑 정보로 업데이트")
// @PatchMapping("/{diagnose_id}")
// // 등록되지 않은 제품일 경우 새로운 정보를 등록하지만, 네이버 검색 API로 등록된 제품들은 기존 제품 정보에서 태그값만 업데이트하게 되므로 PATCH 사용하였음
// public ResponseEntity<ApiResponse<UpdateProductsResponseDTO>> updateDiagnoseProducts(@PathVariable("diagnose_id") Long resultId, @RequestBody UpdateProductsRequestDTO products) {
// try {
// UpdateProductsResponseDTO updatedProducts = diagnoseNaverProductService.updateDiagnoseProducts(resultId, products);
// ApiResponse<UpdateProductsResponseDTO> response = ApiResponse.of(SuccessStatus._OK, updatedProducts);
// return ResponseEntity.ok(response);
// } catch (NoSuchElementException e) {
// ApiResponse<UpdateProductsResponseDTO> response = ApiResponse.ofFailure(ErrorStatus.DIAGNOSE_NOT_FOUND, null);
// return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(response);
// } catch (Exception e) {
// ApiResponse<UpdateProductsResponseDTO> response = ApiResponse.ofFailure(ErrorStatus._INTERNAL_SERVER_ERROR, null);
// return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(response);
// }
// }
@Operation(summary = "추천 제품 네이버 쇼핑 정보로 업데이트")
@PatchMapping("/{diagnose_id}")
// 등록되지 않은 제품일 경우 새로운 정보를 등록하지만, 네이버 검색 API로 등록된 제품들은 기존 제품 정보에서 태그값만 업데이트하게 되므로 PATCH 사용하였음
public ResponseEntity<ApiResponse<UpdateProductsResponseDTO>> updateDiagnoseProducts(@PathVariable("diagnose_id") Long resultId, @RequestBody UpdateProductsRequestDTO products) {
try {
UpdateProductsResponseDTO updatedProducts = diagnoseNaverProductService.updateDiagnoseProducts(resultId, products);
ApiResponse<UpdateProductsResponseDTO> response = ApiResponse.of(SuccessStatus._OK, updatedProducts);
return ResponseEntity.ok(response);
} catch (NoSuchElementException e) {
ApiResponse<UpdateProductsResponseDTO> response = ApiResponse.ofFailure(ErrorStatus.DIAGNOSE_NOT_FOUND, null);
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(response);
} catch (Exception e) {
ApiResponse<UpdateProductsResponseDTO> response = ApiResponse.ofFailure(ErrorStatus._INTERNAL_SERVER_ERROR, null);
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(response);
}
}


// 진단서 상세 내용 조회 API
Expand Down
Loading

0 comments on commit baf814a

Please sign in to comment.