-
Notifications
You must be signed in to change notification settings - Fork 70
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-32][BE][산토리 & 포키] IssueTracker 5차 PR #237
base: team-32
Are you sure you want to change the base?
Changes from all commits
91084c1
53d56dd
4851abd
7bf558d
51b26bd
a882d27
10e891e
f49f23a
46c5dcc
da0eb2d
93ba08b
a74782d
ce86ad0
0b24365
d339c59
056999a
f30ab23
b031de5
0549cf0
a4aca8b
2e49f07
d130535
b8d00e0
b1a6f04
3d4ec4c
45b4e7c
9ef688d
1a7fdfb
3003785
94c36c3
ebff7c8
8b23037
3d36625
247f6ba
9648fed
967a251
44b21bd
a5dfbd9
635ef6a
2c08fb1
f75e6ec
073c5a2
387add8
a7e5acb
164053a
a407ad6
548f7b0
e2022d2
13ede8f
f1fad6b
eb1f94b
fa1476a
6eae0be
46ae914
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [ "deploy" ] | ||
pull_request: | ||
branches: [ "develop-BE" ] | ||
|
||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: "./be" | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set application.yml for deploy | ||
working-directory: ./be/src/main/resources | ||
run: | | ||
cat /dev/null > application.yml | ||
echo "${{ secrets.APPLICATION_DEVELOP }}" >> ./application.yml | ||
echo "${{ secrets.APPLICATION }}" >> ./application-prod.yml | ||
|
||
- name: Setup Java JDK | ||
uses: actions/[email protected] | ||
with: | ||
distribution: 'adopt-hotspot' | ||
java-version: '11' | ||
|
||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
|
||
- name: Setup MySQL | ||
uses: mirromutth/[email protected] | ||
with: | ||
mysql database: issuetracker | ||
mysql user: root | ||
mysql root password: ${{ secrets.MYSQL_ROOT_PASSWORD }} | ||
|
||
- name: Build with Gradle | ||
run: ./gradlew build | ||
|
||
- name: Docker Login | ||
uses: docker/[email protected] | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_SECRET }} | ||
|
||
- name: Docker build | ||
run: | | ||
docker build -t issue-tracker . | ||
docker tag issue-tracker ${{ secrets.DOCKERHUB_USERNAME }}/issue-tracker:latest | ||
docker push ${{ secrets.DOCKERHUB_USERNAME }}/issue-tracker:latest | ||
|
||
- name: deploy! | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ secrets.SSH_HOST }} | ||
username: ubuntu | ||
key: ${{ secrets.PRIVATE_KEY }} | ||
envs: GITHUB_SHA | ||
script: | | ||
sudo docker ps -a -q -f "name=issue-tracker" | grep -q . && sudo docker stop issue-tracker && sudo docker rm issue-tracker | true | ||
sudo docker rmi ${{ secrets.DOCKERHUB_USERNAME }}/issue-tracker:latest | ||
sudo docker pull ${{ secrets.DOCKERHUB_USERNAME }}/issue-tracker:latest | ||
sudo docker tag ${{ secrets.DOCKERHUB_USERNAME }}/issue-tracker:latest issue-tracker | ||
sudo docker run -d --name issue-tracker -p 80:8080 issue-tracker |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
FROM adoptopenjdk/openjdk11 | ||
ARG JAR_FILE=build/libs/*.jar | ||
COPY ${JAR_FILE} app.jar | ||
ENTRYPOINT ["java", "-Dspring.profiles.active=prod", "-jar", "/app.jar"] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.codesquad.issuetracker.comment.domain; | ||
|
||
import com.codesquad.issuetracker.common.domain.BaseEntity; | ||
import com.codesquad.issuetracker.issue.domain.Issue; | ||
import com.codesquad.issuetracker.user.domain.User; | ||
|
||
import javax.persistence.*; | ||
|
||
@Entity | ||
public class Comment extends BaseEntity { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
private String content; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
private User user; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
private Issue issue; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.codesquad.issuetracker.common.domain; | ||
|
||
import org.springframework.data.annotation.CreatedDate; | ||
import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
|
||
import javax.persistence.Column; | ||
import javax.persistence.EntityListeners; | ||
import javax.persistence.MappedSuperclass; | ||
import java.time.LocalDateTime; | ||
|
||
@MappedSuperclass | ||
@EntityListeners(AuditingEntityListener.class) | ||
public class BaseEntity { | ||
|
||
@CreatedDate | ||
@Column(columnDefinition = "TIMESTAMP", nullable = false) | ||
private LocalDateTime createdAt; | ||
|
||
@Column(columnDefinition = "BOOLEAN", nullable = false) | ||
private boolean isDeleted; | ||
Comment on lines
+19
to
+20
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. soft delete도 적용하시는군요! |
||
|
||
protected void changeDeleted(boolean isDeleted) { | ||
this.isDeleted = isDeleted; | ||
} | ||
Comment on lines
+22
to
+24
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 다시 복구 시킬 케이스도 고려하신걸까요? |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.codesquad.issuetracker.common.properties; | ||
|
||
import lombok.Getter; | ||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
import org.springframework.boot.context.properties.ConstructorBinding; | ||
|
||
@Getter | ||
@ConstructorBinding | ||
@ConfigurationProperties(prefix = "oauth.github") | ||
public class GithubProperty { | ||
|
||
private final String clientId; | ||
private final String clientSecret; | ||
private final String redirectUrl; | ||
private final String accessTokenUrl; | ||
private final String resourceUrl; | ||
|
||
public GithubProperty(String clientId, String clientSecret, String redirectUrl, String accessTokenUrl, String resourceUrl) { | ||
this.clientId = clientId; | ||
this.clientSecret = clientSecret; | ||
this.redirectUrl = redirectUrl; | ||
this.accessTokenUrl = accessTokenUrl; | ||
this.resourceUrl = resourceUrl; | ||
} | ||
} | ||
Comment on lines
+10
to
+25
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. abstract_class로 빼보는건 어떨까요? |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.codesquad.issuetracker.common.properties; | ||
|
||
import lombok.Getter; | ||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
import org.springframework.boot.context.properties.ConstructorBinding; | ||
|
||
@Getter | ||
@ConstructorBinding | ||
@ConfigurationProperties(prefix = "oauth.google") | ||
public class GoogleProperty { | ||
|
||
private final String clientId; | ||
private final String clientSecret; | ||
private final String redirectUrl; | ||
private final String accessTokenUrl; | ||
private final String resourceUrl; | ||
|
||
|
||
public GoogleProperty(String clientId, String clientSecret, String redirectUrl, String accessTokenUrl, String resourceUrl) { | ||
this.clientId = clientId; | ||
this.clientSecret = clientSecret; | ||
this.redirectUrl = redirectUrl; | ||
this.accessTokenUrl = accessTokenUrl; | ||
this.resourceUrl = resourceUrl; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.codesquad.issuetracker.exception.domain.type; | ||
|
||
import lombok.Getter; | ||
import org.springframework.http.HttpStatus; | ||
|
||
@Getter | ||
public enum IssueExceptionType implements ExceptionType { | ||
|
||
NOT_FOUND(HttpStatus.NOT_FOUND, "ISSUE001", "이슈를 찾을 수 없습니다"); | ||
|
||
private final HttpStatus statusCode; | ||
private final String errorCode; | ||
private final String message; | ||
|
||
IssueExceptionType(HttpStatus statusCode, String errorCode, String message) { | ||
this.statusCode = statusCode; | ||
this.errorCode = errorCode; | ||
this.message = message; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.codesquad.issuetracker.exception.domain.type; | ||
|
||
import lombok.Getter; | ||
import org.springframework.http.HttpStatus; | ||
|
||
@Getter | ||
public enum MilestoneExceptionType implements ExceptionType{ | ||
|
||
NOT_FOUND(HttpStatus.NOT_FOUND, "MILE001", "마일스톤이 존재하지 않습니다."); | ||
|
||
private final HttpStatus statusCode; | ||
private final String errorCode; | ||
private final String message; | ||
|
||
MilestoneExceptionType(HttpStatus statusCode, String errorCode, String message) { | ||
this.statusCode = statusCode; | ||
this.errorCode = errorCode; | ||
this.message = message; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
꼭 EnumMap으로 만들필요가 있을까요? enummap이 가져다주는 어떤 장점이 있는지 고려해보시면 좋을 것 같습니다 ㅎㅎ