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

[Team-21][BE][루이1세] 2주차 세번째 PR #215

Open
wants to merge 62 commits into
base: team-21
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 52 commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
24b65be
build: Backend workflow 작성
Louie-03 Jun 23, 2022
bada3f9
Merge pull request #40 from Louie-03/BE-deploy
Louie-03 Jun 23, 2022
f7879f4
refactor: 패키지 변경
rkolx Jun 26, 2022
093cd55
chore: client_id 환경변수 처리
rkolx Jun 26, 2022
78aba46
feat: 이슈 등록 기능 구현
rkolx Jun 26, 2022
3b0cdb0
refactor: 생성자가 아닌 필드에서 값을 초기화하도록 변경
rkolx Jun 26, 2022
d213622
Merge pull request #47 from Louie-03/BE-feature-46
rkolx Jun 26, 2022
cd5ca0b
feat : Issue 등록 기능 사용자 추가
Louie-03 Jun 27, 2022
3bee614
Merge pull request #49 from Louie-03/BE-feature-48
Louie-03 Jun 27, 2022
714de81
refactor : UploadFile과 Comment 엔티티의 연관관계 제거
Louie-03 Jun 27, 2022
9697a76
feat : S3 관련 환경 설정 추가
Louie-03 Jun 27, 2022
42a5cc0
feat : 파일 업로드 기능 구현
Louie-03 Jun 27, 2022
8c3470e
Merge pull request #50 from Louie-03/BE-feature-42
Louie-03 Jun 27, 2022
6b49372
init : Querydsl 환경 설정
Louie-03 Jun 27, 2022
7112736
feat : 로그인 성공 시 avatarImageUrl Response 기능 추가
Louie-03 Jun 28, 2022
c5000f3
fix : CORS 문제 설정 추가
Louie-03 Jun 28, 2022
944ea80
Update gradle.yml
Louie-03 Jun 28, 2022
19de7ac
feat: 필터 검색 동적 쿼리 구현
rkolx Jun 27, 2022
1053173
refactor: 엔티티 @Gatter 추가
rkolx Jun 29, 2022
0a940f0
feat : 이슈 리스트 구현 1단계
rkolx Jun 29, 2022
3c48b39
refactor: Label 엔티티에 IssueLabel 연관관계 제거
rkolx Jun 29, 2022
e20c259
feat : 이슈 리스트 구현
rkolx Jun 29, 2022
70f68f2
Merge pull request #55 from Louie-03/BE-feature-51
rkolx Jun 29, 2022
5706e03
refactor : Getter 생성 및 Response 이름 변경
rkolx Jun 29, 2022
3f9d28b
feat : 이슈 상세 조회 기능 구현
rkolx Jun 29, 2022
ea33276
Merge pull request #58 from Louie-03/BE-feature-56
rkolx Jun 29, 2022
df832f3
feat : 샘플 데이터 추가
Louie-03 Jun 30, 2022
9638e09
fix : 필터 검색 오류 로직 및 메서드명 수정
Louie-03 Jun 30, 2022
a740ab8
fix : 필터 검색 API 결과가 반환되지 않는 오류 수정
Louie-03 Jun 30, 2022
142b675
refactor : TextColor Enum 클래스 생성, Milestone 엔티티 status 필드 제거
Louie-03 Jun 30, 2022
4c98712
refactor: 토큰 헤더-> 바디
rkolx Jun 30, 2022
749ed0b
refactor : cascade 옵션을 통해 최대한 적은 repository를 사용하도록 변경
Louie-03 Jun 30, 2022
9c27c51
Merge pull request #60 from Louie-03/BE-feature-57
Louie-03 Jun 30, 2022
8fad4b2
refactor: DTO 패키지 분리
rkolx Jul 5, 2022
4a31a0c
Merge pull request #61 from Louie-03/BE-feature-59
rkolx Jul 5, 2022
6d474a0
Revert "refactor: DTO 패키지 분리"
rkolx Jul 5, 2022
eb2cb3c
Merge pull request #62 from Louie-03/revert-61-BE-feature-59
rkolx Jul 5, 2022
eb9a582
refactor : DTO 패키지 구조변경
rkolx Jul 5, 2022
ac9b616
Merge pull request #63 from Louie-03/BE-feature-59
rkolx Jul 5, 2022
337405c
refactor: 패키지 구조 변경
rkolx Jul 5, 2022
1a1e782
feat: 이슈 제목 편집 및 삭제 구현
rkolx Jul 5, 2022
cbdf32b
Merge pull request #65 from Louie-03/BE-feature-64
rkolx Jul 5, 2022
af67f7e
feat: 이슈 상태 변경 기능 구현
rkolx Jul 5, 2022
39b34bb
refactor: controller에서 enum을 바로 받을 수 있게 구현 및 Querydsl 상태개수 중복 수정
rkolx Jul 6, 2022
3d4a817
refactor: EnableWebMvc 어노테이션 제거
rkolx Jul 6, 2022
38c6449
Merge pull request #67 from Louie-03/BE-feature-66
rkolx Jul 6, 2022
21a14ed
feat : 코멘트 작성 기능 구현
Louie-03 Jul 6, 2022
912a8e9
Merge pull request #69 from Louie-03/BE-feature-68
Louie-03 Jul 6, 2022
7c0fed5
feat : 코멘트 편집 기능 구현
Louie-03 Jul 6, 2022
8562cef
Merge pull request #71 from Louie-03/BE-feature-70
Louie-03 Jul 6, 2022
0dce6c1
feat: 로그아웃 기능 구현
rkolx Jul 7, 2022
fd69187
Merge pull request #73 from Louie-03/BE-feature-72
rkolx Jul 7, 2022
b196c6c
feat : 라벨 등록 기능 구현
Louie-03 Jul 11, 2022
f488fe5
feat : 라벨 조회 기능 구현
Louie-03 Jul 11, 2022
5e2bd12
feat : 라벨 수정 기능 구현
Louie-03 Jul 11, 2022
2ea43ec
feat : 라벨 삭제 기능 구현
Louie-03 Jul 11, 2022
0e80f58
Merge pull request #76 from Louie-03/BE-feature-75
Louie-03 Jul 11, 2022
66ecb64
feat: 마일스톤 등록기능 구현
rkolx Jul 11, 2022
84b852b
feat: 마일스톤 조회기능 구현
rkolx Jul 11, 2022
343df5b
feat: 마일스톤 수정기능 구현
rkolx Jul 11, 2022
6f15c5d
feat: 마일스톤 삭제기능 구현
rkolx Jul 11, 2022
b5ef834
Merge pull request #77 from Louie-03/BE-feature-74
rkolx Jul 11, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 83 additions & 0 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# 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 package using Gradle and then publish it to GitHub packages when a release is created
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#Publishing-using-gradle

name: Java CI with Gradle

on:
push:
branches: [ BE-deploy ]
pull_request:
branches: [ BE-deploy ]

jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./BE

steps:
- uses: actions/checkout@v2

# JDK11로 gradle 빌드
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'temurin'

- name: Insert data source information into application.yml
run: |
sed -i "s|\${DATASOURCE_URL}|$DATASOURCE_URL|g" ./src/main/resources/application.yml
sed -i "s|\${DATASOURCE_USERNAME}|$DATASOURCE_USERNAME|g" ./src/main/resources/application.yml
sed -i "s|\${DATASOURCE_PASSWORD}|$DATASOURCE_PASSWORD|g" ./src/main/resources/application.yml

sed -i "s|\${OAUTH_CLIENT_ID}|$OAUTH_CLIENT_ID|g" ./src/main/resources/oauth.yml
sed -i "s|\${OAUTH_CLIENT_SECRET}|$OAUTH_CLIENT_SECRET|g" ./src/main/resources/oauth.yml
sed -i "s|\${OAUTH_ACCESS_SCOPE}|$OAUTH_ACCESS_SCOPE|g" ./src/main/resources/oauth.yml
sed -i "s|\${OAUTH_LOGIN_FORM_URL}|$OAUTH_LOGIN_FORM_URL|g" ./src/main/resources/oauth.yml
sed -i "s|\${JWT_ISSUER}|$JWT_ISSUER|g" ./src/main/resources/oauth.yml
sed -i "s|\${JWT_SECRET_KEY}|$JWT_SECRET_KEY|g" ./src/main/resources/oauth.yml

env:
DATASOURCE_URL: ${{ secrets.DATASOURCE_URL }}
DATASOURCE_USERNAME: ${{ secrets.DATASOURCE_USERNAME }}
DATASOURCE_PASSWORD: ${{ secrets.DATASOURCE_PASSWORD }}
OAUTH_CLIENT_ID: ${{ secrets.OAUTH_CLIENT_ID }}
OAUTH_CLIENT_SECRET: ${{ secrets.OAUTH_CLIENT_SECRET }}
OAUTH_ACCESS_SCOPE: ${{ secrets.OAUTH_ACCESS_SCOPE }}
OAUTH_LOGIN_FORM_URL: ${{ secrets.OAUTH_LOGIN_FORM_URL }}
JWT_ISSUER: ${{ secrets.JWT_ISSUER }}
JWT_SECRET_KEY: ${{ secrets.JWT_SECRET_KEY }}

- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build

# 도커 빌드(도커 이미지 생성)
- name: Docker build
run: |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
docker build -t ${{ secrets.DOCKER_USERNAME }}/issue-tracker:1.0 .
docker push ${{ secrets.DOCKER_USERNAME }}/issue-tracker:1.0
docker rmi ${{ secrets.DOCKER_USERNAME }}/issue-tracker:1.0

# 도커 이미지 배포 및 실행(EC2 ubuntu20.04로 배포)
- name: Deploy
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.AWS_HOST_DNS }} #(생성한 인스턴스의 DNS주소)
username: ubuntu
key: ${{ secrets.SSH_PRIVATE_KEY }} #(인스턴스를 생성할 때 다운받은 pem키안에 값을 모두 복사해서 붙여넣기)
envs: GITHUB_SHA
script: |
sudo docker ps -a -q --filter "name=issue-tracker" | grep -q . && docker stop issue-tracker && docker rm issue-tracker | true
sudo docker rmi ${{ secrets.DOCKER_USERNAME }}/issue-tracker:1.0
sudo docker pull ${{ secrets.DOCKER_USERNAME }}/issue-tracker:1.0
sudo docker run -d -p 80:8080 --name issue-tracker -e FILE_UPLOAD_S3_ACCESS_KEY=${{ secrets.FILE_UPLOAD_S3_ACCESS_KEY }} -e FILE_UPLOAD_S3_SECRET_KEY=${{ secrets.FILE_UPLOAD_S3_SECRET_KEY }} ${{ secrets.DOCKER_USERNAME }}/issue-tracker:1.0
sudo docker rmi -f $(docker images -f "dangling=true" -q) || true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea
1 change: 0 additions & 1 deletion BE/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
oauth.yml
HELP.md
.gradle
build/
Expand Down
17 changes: 17 additions & 0 deletions BE/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# JDK11 이미지 사용
FROM openjdk:11-jdk

#마운트에 /tmp를 사용하는 이유
#spring boot의 Tomcat의 default 저장소가 /tmp인데
#위와 같이 볼륨 마운트를 해주면 호스트의 /var/lib/docker에 임시파일을 만들고
#컨테이너 안의 /tmp 와 연결할 수 있다는 뜻입니다.
VOLUME /tmp

# JAR_FILE 변수에 값을 저장
ARG JAR_FILE=./build/libs/*.jar

# 변수에 저장된 것을 컨테이너 실행시 이름을 app.jar파일로 변경하여 컨테이너에 저장
COPY ${JAR_FILE} app.jar

# 빌드된 이미지가 run 될 때 실행할 명령어

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

정리가 꼼꼼해서 좋네요.

ENTRYPOINT ["java","-jar","/app.jar"]
38 changes: 38 additions & 0 deletions BE/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@

- OneTab

- 학습한 내용은 간단하게라도 마크다운 또는 노션으로 정리해서 깃헙에 올리자

- 매일 회고를 작성하자

- 프로젝트를 꼭 진행하자

- 사람들과 연락 & 공유하면서 서로 자극받고 도움이 될 수 있는 좋은 관계를 유지하자

- 잘 설명하지 못하는 내용에 대한 부분을 천천히 채워나가자

- 해당 기술을 사용하는 이유 & 비슷한 기능을 하는 다른 기술과 비교해보자

- 테스트코드도 공부해보자

- 현재까지 진행했던 코쿼 커리큘럼을 다시 진행해보자

- 다른 사람들의 코드와 리뷰를 참고해보자

- 이력서, 코테, 면접을 어떻게 준비할지 고민해보자

- 운동도 하자

- 여유롭지만 오랫동안 지속 가능한 하루 일정을 새워보자

- 슬랙, 카톡, 디코 보면서 사진 저장하기

- 코쿼 사람들 호칭 어떻게 할지 고민하기

- 옷 쇼핑하기

- 카카오페이 엄마한테 물어보고 해지했다가 다시 가입하기

- 리액트 간단하게 써보기

- 채용 담당자가 자소서를 쓸 때 어떤 부분을 볼지 생각해보기
35 changes: 35 additions & 0 deletions BE/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
buildscript {
ext {
queryDslVersion = "5.0.0"
}
}

plugins {
id 'org.springframework.boot' version '2.7.0'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id "com.ewerk.gradle.plugins.querydsl" version "1.0.10"
id 'java'
}

Expand All @@ -12,6 +19,7 @@ configurations {
compileOnly {
extendsFrom annotationProcessor
}
querydsl.extendsFrom compileClasspath
}

repositories {
Expand All @@ -24,14 +32,41 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-webflux'
implementation 'com.github.gavlyukovskiy:p6spy-spring-boot-starter:1.8.0'
implementation 'org.springframework.cloud:spring-cloud-starter-aws:2.2.6.RELEASE'
implementation 'com.auth0:java-jwt:3.19.1'
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'com.h2database:h2'
runtimeOnly 'mysql:mysql-connector-java'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
implementation "com.querydsl:querydsl-jpa:${queryDslVersion}"
annotationProcessor "com.querydsl:querydsl-apt:${queryDslVersion}"
}

tasks.named('test') {
useJUnitPlatform()
}

jar {
enabled = false
}
bootJar {
archivesBaseName = 'app'
archiveFileName = 'app.jar'
archiveVersion = "0.0.0"
}

def querydslDir = "$buildDir/generated/querydsl"

querydsl {
jpa = true
querydslSourcesDir = querydslDir
}

sourceSets {
main.java.srcDir querydslDir
}

compileQuerydsl {
options.annotationProcessorPath = configurations.querydsl
}
Empty file modified BE/gradlew
100644 → 100755
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package louie.hanse.issuetracker.config;

import com.querydsl.jpa.impl.JPAQueryFactory;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class QuerydslConfig {

@PersistenceContext
EntityManager entityManager;

@Bean
public JPAQueryFactory jpaQueryFactory() {
return new JPAQueryFactory(entityManager);
}
}
25 changes: 25 additions & 0 deletions BE/src/main/java/louie/hanse/issuetracker/config/WebConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package louie.hanse.issuetracker.config;

import louie.hanse.issuetracker.converter.StringToStatusConverter;
import org.springframework.context.annotation.Configuration;
import org.springframework.format.FormatterRegistry;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
//@EnableWebMvc
public class WebConfig implements WebMvcConfigurer {

@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOrigins("*")
.allowedMethods("GET", "POST", "PUT", "PATCH", "OPTIONS")
.allowedHeaders("headers");
}

@Override
public void addFormatters(FormatterRegistry registry) {
registry.addConverter(new StringToStatusConverter());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package louie.hanse.issuetracker.converter;

import louie.hanse.issuetracker.domain.Status;
import org.springframework.core.convert.converter.Converter;

public class StringToStatusConverter implements Converter<String, Status> {
@Override
public Status convert(String source) {
return Status.valueOfWithCaseInsensitive(source);
}
}
40 changes: 27 additions & 13 deletions BE/src/main/java/louie/hanse/issuetracker/domain/Comment.java
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
package louie.hanse.issuetracker.domain;

import javax.persistence.*;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

import static javax.persistence.FetchType.LAZY;
import static javax.persistence.GenerationType.*;
import static javax.persistence.GenerationType.IDENTITY;

import java.time.LocalDateTime;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@Entity
@Table(name = "comments")
@NoArgsConstructor(access = AccessLevel.PROTECTED)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

막아두신 것 좋네요.

public class Comment {

@Id @GeneratedValue(strategy = IDENTITY)
private Long id;

@OneToMany(mappedBy = "comment")
private List<UploadFile> uploadFiles = new ArrayList<>();

@ManyToOne(fetch = LAZY)
@JoinColumn
private Issue issue;
Expand All @@ -27,8 +31,18 @@ public class Comment {
@JoinColumn
private Member writer;

private String content;
private LocalDateTime createdDateTime;
private LocalDateTime updatedDateTime;
private String contents;
private LocalDateTime createdDateTime = LocalDateTime.now();
private LocalDateTime updatedDateTime = LocalDateTime.now();

public Comment(Issue issue, String contents) {
this.issue = issue;
issue.addComment(this);
this.contents = contents;
}

public void updateContents(String contents) {
this.contents = contents;
updatedDateTime = LocalDateTime.now();
}
}
Loading