Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API - v0.0.1 #54

Merged
merged 42 commits into from
Jul 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
5c68580
[feat] querydsl 셋팅, const 셋팅 #1
wjdtkdgns Jun 26, 2023
ecb7d1b
[feat] 에러, response 처리 #1
wjdtkdgns Jun 26, 2023
a29a056
[feat] 스웨거 셋팅, security 기본 셋팅 #1
wjdtkdgns Jun 26, 2023
f5d28e5
[chore] git template 변경
wjdtkdgns Jun 26, 2023
a50908f
[feat] 프로젝트 초기 셋팅
wjdtkdgns Jun 26, 2023
47de437
[feat] 엔티티 설계 및 spring 버전 변경 (#7)
wjdtkdgns Jun 28, 2023
09a4fd5
[feat] redis 셋팅, redisson 셋팅 #6 (#8)
wjdtkdgns Jun 28, 2023
aecd3d5
[feat] depoly flow 설계 (#10)
wjdtkdgns Jun 29, 2023
74a0b71
[fix] action flow 수정
wjdtkdgns Jun 29, 2023
c78510e
[feat] Api module Dockerfile 추가
wjdtkdgns Jun 29, 2023
a84fce7
[fix] action error 처리
wjdtkdgns Jun 29, 2023
45c8b95
[fix] action github ip 받는 로직 수정
wjdtkdgns Jun 29, 2023
85c0429
[fix] ec2 key 변경
wjdtkdgns Jun 29, 2023
b90824e
[fix] action ip remove 로직 변경
wjdtkdgns Jun 29, 2023
e90e1a6
[fix] action ip remove 로직 변경
wjdtkdgns Jun 29, 2023
b2f07ee
[fix] redis 설정 변경
wjdtkdgns Jun 29, 2023
7d22fcc
[fix] redis 설정 변경
wjdtkdgns Jun 29, 2023
61c6acb
[feat] OIDC 셋팅, kakao oauth 구현 (#11)
wjdtkdgns Jun 30, 2023
67fa0f4
[fix] oauth callback url 변경 #4
wjdtkdgns Jun 30, 2023
9a7ed98
[feat] 회원 탈퇴 구현 (#13)
wjdtkdgns Jul 1, 2023
f4479df
[feat] auth 관련 기능 구현 (#14)
wjdtkdgns Jul 2, 2023
8dfa151
[feat] category 수정 관련 기능 구현 (#16)
wjdtkdgns Jul 2, 2023
69789c2
[feat] category 조회 기능 구현 (#21)
wjdtkdgns Jul 4, 2023
f3ceb16
[feat] category 스크랩, 고정 기능 구현 (#22)
wjdtkdgns Jul 5, 2023
fc5ecc9
[feat] presigned 구현 및 topic -> subject 네이밍 변경 (#24)
wjdtkdgns Jul 7, 2023
71125fd
[feat] user 조회 수정 기능 구현 (#26)
wjdtkdgns Jul 7, 2023
b9e53b5
[feat] content 조회, 삭제, 생성 기능 구현 (#28)
wjdtkdgns Jul 7, 2023
9dd9788
[refac] 기획 element 네이밍 변경 반영 (#30)
wjdtkdgns Jul 10, 2023
8905b69
[feat] Tag 수정, 조회 기능 구현 (#32)
wjdtkdgns Jul 12, 2023
f9234dc
[feat] apple 로그인 구현 (#34)
wjdtkdgns Jul 12, 2023
8df2a7b
[feat] 휴지통 조회, 복구 기능 구현 (#36)
wjdtkdgns Jul 14, 2023
ba9c33f
[feat] 신고 기능 구현 #37
wjdtkdgns Jul 16, 2023
dcafd55
[feat] 유저 차단하기 기능 구현 #37
wjdtkdgns Jul 16, 2023
df69b7f
[feat] 유저 차단하기 해제 기능 구현 #37
wjdtkdgns Jul 16, 2023
a4aaf95
[feat] 차단 유저 정보 보기 #37
wjdtkdgns Jul 16, 2023
47e82ce
[feat] 검색 기능 구현 (#41)
wjdtkdgns Jul 18, 2023
4c149cb
[feat] cloudwatch 셋팅 #39 (#42)
wjdtkdgns Jul 18, 2023
49766a8
[refac] auth 부분 리팩토링 및 response 변경 (#44)
wjdtkdgns Jul 19, 2023
9caec82
[fix] 닉네임 검사 로직 변경 (#46)
wjdtkdgns Jul 20, 2023
7edc125
[refac] 컨텐츠 부분 리팩토링 (#48)
wjdtkdgns Jul 20, 2023
58bd986
[refac] archiving 리팩토링 (#51)
wjdtkdgns Jul 21, 2023
5f70239
[feat] prod deploy 셋팅 (#53)
wjdtkdgns Jul 22, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
18 changes: 0 additions & 18 deletions .github/ISSUE_TEMPLATE/issue--user-side-qa.md

This file was deleted.

21 changes: 8 additions & 13 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
## 📝 PR Summary
# 💡 PR Summary - <!--{ 작업 내용 }-->
<!-- 어떤 작업에 대한 PR 인지 위 주석에 적어주세요 -->
## 개요
- close #issueNumber

<!-- 예시) 상품 가격 천단위 humanize intcomma 적용 -->
## 작업사항
- 내용을 적어주세요.

#### 🌲 Working Branch

<!-- 예시) hotfix/price_comma -->

#### 🌲 TODOs

<!-- 예시) * 상품 스토어 리스트 가격 천단위 표기 적용 -->

### Related Issues

<!-- 예시) * resolves #71 -->
## 변경로직
- 내용을 적어주세요.
35 changes: 35 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: CI

on:
pull_request:
branch: 'dev'
types: [ opened, synchronize, reopened ]

jobs:
build:
name: CI
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up Java
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'corretto'

- name: Grant execute permission for gradlew
run: chmod +x gradlew

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

- name: Cache Gradle packages
uses: actions/cache@v1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
79 changes: 79 additions & 0 deletions .github/workflows/DevCICD.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: DEV CI/CD

on:
push:
branches: dev

env:
PROFILE_DEV: dev

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: checkout
uses: actions/checkout@v2

- name: Set up Java
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'corretto'

- name: Grant execute permission for gradlew
run: chmod +x ./gradlew

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

- name: Docker build
run: |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
docker build -t ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_DEV_REPO }} .
docker push ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_DEV_REPO }}:latest

- name: Get Public IP
id: publicip
run: |
response=$(curl -s canhazip.com)
echo "ip='$response'" >> "$GITHUB_OUTPUT"

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_DEV_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_DEV_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}

- name: Add GitHub IP to AWS
run: |
aws ec2 authorize-security-group-ingress --group-id ${{ secrets.AWS_DEV_SG_ID }} --protocol tcp --port ${{ secrets.EC2_SSH_PORT }} --cidr ${{ steps.publicip.outputs.ip }}/32

- name: Deploy
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.EC2_DEV_HOST }}
username: ${{ secrets.EC2_DEV_USERNAME }}
key: ${{ secrets.EC2_DEV_KEY }}
port: ${{ secrets.EC2_SSH_PORT }}
timeout: 60s
script: |
cd allchive-dev

sudo touch .env
echo "${{ secrets.ENV_DEV_VARS }}" | sudo tee .env > /dev/null

sudo docker stop $(sudo docker ps -a -q)
sudo docker rm $(sudo docker ps -a -q)
sudo docker rmi $(sudo docker images -q)
sudo docker pull ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_DEV_REPO }}:latest
sudo docker-compose -f ~/allchive-dev/docker-compose.yml --env-file ~/allchive-dev/.env up --build -d
sudo docker system prune --all -f

- name: Remove IP FROM security group
run: |
aws ec2 revoke-security-group-ingress --group-id ${{ secrets.AWS_DEV_SG_ID }} --protocol tcp --port ${{ secrets.EC2_SSH_PORT }} --cidr ${{ steps.publicip.outputs.ip }}/32
79 changes: 79 additions & 0 deletions .github/workflows/ProdCICD.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: PROD CI/CD

on:
push:
branches: prod

env:
PROFILE_PROD: prod

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: checkout
uses: actions/checkout@v2

- name: Set up Java
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'corretto'

- name: Grant execute permission for gradlew
run: chmod +x ./gradlew

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

- name: Docker build
run: |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
docker build -t ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_PROD_REPO }} .
docker push ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_PROD_REPO }}:latest

- name: Get Public IP
id: publicip
run: |
response=$(curl -s canhazip.com)
echo "ip='$response'" >> "$GITHUB_OUTPUT"

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_PROD_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_PROD_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}

- name: Add GitHub IP to AWS
run: |
aws ec2 authorize-security-group-ingress --group-id ${{ secrets.AWS_PROD_SG_ID }} --protocol tcp --port ${{ secrets.EC2_SSH_PORT }} --cidr ${{ steps.publicip.outputs.ip }}/32

- name: Deploy
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.EC2_PROD_HOST }}
username: ${{ secrets.EC2_PROD_USERNAME }}
key: ${{ secrets.EC2_PROD_KEY }}
port: ${{ secrets.EC2_SSH_PORT }}
timeout: 60s
script: |
cd allchive-prod

sudo touch .env
echo "${{ secrets.ENV_PROD_VARS }}" | sudo tee .env > /dev/null

sudo docker stop $(sudo docker ps -a -q)
sudo docker rm $(sudo docker ps -a -q)
sudo docker rmi $(sudo docker images -q)
sudo docker pull ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_PROD_REPO }}:latest
sudo docker-compose -f ~/allchive-prod/docker-compose.yml --env-file ~/allchive-prod/.env up --build -d
sudo docker system prune --all -f

- name: Remove IP FROM security group
run: |
aws ec2 revoke-security-group-ingress --group-id ${{ secrets.AWS_PROD_SG_ID }} --protocol tcp --port ${{ secrets.EC2_SSH_PORT }} --cidr ${{ steps.publicip.outputs.ip }}/32
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,7 @@ out/
.DS_Store

.env
.env.*
.env.*


Domain/src/main/generated/**/*.java
6 changes: 3 additions & 3 deletions Api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ repositories {

dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-security'

// swagger
implementation 'org.springdoc:springdoc-openapi-ui:1.6.12'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.2'

implementation project(':Domain')
implementation project(':Core')
implementation project(':Infrastructure')
Expand Down
1 change: 0 additions & 1 deletion Api/src/main/java/allchive/server/ApiApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
@SpringBootApplication
public class ApiApplication {
public static void main(String[] args) {
System.out.println("Hello world!");
SpringApplication.run(ApiApplication.class, args);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package allchive.server.api;

public interface SchedulerPackageLocation {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
package allchive.server.api.archiving.controller;


import allchive.server.api.archiving.model.dto.request.CreateArchivingRequest;
import allchive.server.api.archiving.model.dto.request.UpdateArchivingRequest;
import allchive.server.api.archiving.model.dto.response.ArchivingContentsResponse;
import allchive.server.api.archiving.model.dto.response.ArchivingResponse;
import allchive.server.api.archiving.model.dto.response.ArchivingTitleResponse;
import allchive.server.api.archiving.service.*;
import allchive.server.api.common.slice.SliceResponse;
import allchive.server.domain.domains.archiving.domain.enums.Category;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springdoc.api.annotations.ParameterObject;
import org.springframework.data.domain.Pageable;
import org.springframework.data.web.PageableDefault;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/archivings")
@RequiredArgsConstructor
@Slf4j
@Tag(name = "3. [archiving]")
public class ArchivingController {
private final CreateArchivingUseCase createArchivingUseCase;
private final UpdateArchivingUseCase updateArchivingUseCase;
private final DeleteArchivingUseCase deleteArchivingUseCase;
private final GetArchivingUseCase getArchivingUseCase;
private final GetArchivedArchivingUseCase getArchivedArchivingUseCase;
private final GetScrapArchivingUseCase getScrapArchivingUseCase;
private final GetArchivingTitleUseCase getArchivingTitleUseCase;
private final GetArchivingContentsUseCase getArchivingContentsUseCase;
private final UpdateArchivingScrapUseCase updateArchivingScrapUseCase;
private final UpdateArchivingPinUseCase updateArchivingPinUseCase;

@Operation(summary = "아카이빙을 생성합니다.")
@PostMapping()
public void createArchiving(@RequestBody CreateArchivingRequest createArchivingRequest) {
createArchivingUseCase.execute(createArchivingRequest);
}

@Operation(summary = "아카이빙을 수정합니다.")
@PatchMapping(value = "/{archivingId}")
public void updateArchiving(
@PathVariable("archivingId") Long archivingId,
@RequestBody UpdateArchivingRequest updateArchivingRequest) {
updateArchivingUseCase.execute(archivingId, updateArchivingRequest);
}

@Operation(summary = "아카이빙을 삭제합니다.")
@DeleteMapping(value = "/{archivingId}")
public void deleteArchiving(@PathVariable("archivingId") Long archivingId) {
deleteArchivingUseCase.execute(archivingId);
}

@Operation(
summary = "주제별 아카이빙 리스트를 가져옵니다.",
description = "sort parameter는 입력하지 말아주세요! sorting : 스크랩 여부 -> 스크랩 수 -> 생성일자")
@GetMapping()
public SliceResponse<ArchivingResponse> getArchiving(
@RequestParam("category") Category category,
@ParameterObject @PageableDefault(size = 10) Pageable pageable) {
return getArchivingUseCase.execute(category, pageable);
}

@Operation(
summary = "내 아카이빙 주제별 아카이빙 리스트를 가져옵니다.",
description = "sort parameter는 입력하지 말아주세요! sorting : 고정 -> 스크랩 수 -> 생성일자")
@GetMapping(value = "/me/archiving")
public SliceResponse<ArchivingResponse> getArchivedArchiving(
@RequestParam("category") Category category,
@ParameterObject @PageableDefault(size = 10) Pageable pageable) {
return getArchivedArchivingUseCase.execute(category, pageable);
}

@Operation(
summary = "스크랩 주제별 아카이빙 리스트를 가져옵니다.",
description = "sort parameter는 입력하지 말아주세요! sorting : 스크랩 수 -> 생성일자")
@GetMapping(value = "/me/scrap")
public SliceResponse<ArchivingResponse> getScrapArchiving(
@RequestParam("category") Category category,
@ParameterObject @PageableDefault(size = 10) Pageable pageable) {
return getScrapArchivingUseCase.execute(category, pageable);
}

@Operation(summary = "사용 중인 주제 & 아카이빙 리스트를 가져옵니다. (컨텐츠 추가 시 사용)")
@GetMapping(value = "/lists")
public ArchivingTitleResponse getScrapArchiving() {
return getArchivingTitleUseCase.execute();
}

@Operation(summary = "아카이빙별 컨텐츠 리스트를 가져옵니다.")
@GetMapping(value = "/{archivingId}/contents")
public ArchivingContentsResponse getArchivingContents(
@PathVariable("archivingId") Long archivingId,
@ParameterObject @PageableDefault(size = 10) Pageable pageable) {
return getArchivingContentsUseCase.execute(archivingId, pageable);
}

@Operation(summary = "아카이빙을 스크랩합니다.", description = "스크랩 취소면 cancel에 true 값 보내주세요")
@PatchMapping(value = "/{archivingId}/scrap")
public void updateArchivingScrap(
@RequestParam("cancel") Boolean cancel, @PathVariable("archivingId") Long archivingId) {
updateArchivingScrapUseCase.execute(archivingId, cancel);
}

@Operation(summary = "아카이빙을 고정합니다.", description = "고정 취소면 cancel에 true 값 보내주세요")
@PatchMapping(value = "/{archivingId}/pin")
public void updateArchivingPin(
@RequestParam("cancel") Boolean cancel, @PathVariable("archivingId") Long archivingId) {
updateArchivingPinUseCase.execute(archivingId, cancel);
}
}
Loading
Loading