-
Notifications
You must be signed in to change notification settings - Fork 79
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-11][BE][민지노&&필] 3주차 PR 입니다 #283
Open
PhilSoGooood
wants to merge
40
commits into
codesquad-members-2022:team11
Choose a base branch
from
wnsxor1993:BE-develop
base: team11
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 34 commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
4fa868d
feat: Entity 설계
Minzino eb8b8ae
chore: 초기 데이터 입력
PhilSoGooood dfd4694
Merge pull request #37 from wnsxor1993/feature-entity
Minzino 5857eff
Feat: Room 상세 조회기능 구현
Minzino af97364
Chore: GitHub Actions 세팅
Minzino 5bf5331
chore: 패키지 분리
Minzino 2258819
refactor: 상세조회시 DTO를 반환하도록 변경
Minzino 6c166ab
refactor: WishList FetchType LAZY 적용 및 컬럼이름 삭제
Minzino c3eeafc
Merge pull request #43 from wnsxor1993/feature-search
Minzino a96c81a
chore: github actions 설정
PhilSoGooood 19c051f
fix: 배포용 스크립트 파일 수정
Minzino 38845b7
fix: GitHUb Actions 트리커 브랜치 수정
Minzino 2e70228
fix: application.yml 파일 수정
Minzino 059b7b7
feat: MainEvent(히어로 이미지 영역) 엔티티 생성
Minzino 27cd4a6
feat: ArroungSpotDto 생성
Minzino a51fe14
feat: 홈화면 테마 여행지(ThemeSpot) 담당 엔티티와 DTO 생성
Minzino 115554c
fix: 변수 RoomType을 Enum 타입으로 변경
Minzino e5e2e5d
fix: 불필요한 변수 삭제
Minzino 7cdcd50
feat: 행정구역 인기여행지를 받아오기 위한 클래스 생성
Minzino f7020ff
feat: 메인 홈 화면 Controller, Service, Dto 생성
Minzino ab00bfb
fix: Location 생성자를 롬복으로 적용
Minzino a308437
feat: ThemeRepository, MainEventRepository 생성
Minzino 50ee00f
fix: RoomController의 RequestMapping 수정
Minzino 2debc26
Merge pull request #55 from wnsxor1993/feature-district
Minzino efd722f
fix: 행정구역의 구분을 주기위해 Dto에 id를 추가
Minzino f2529fd
feat: Open API를 사용해서 현재위치를 기준으로 여행지와의 거리를 반환
Minzino 52533b6
Merge pull request #64 from wnsxor1993/feature-openapi
PhilSoGooood 55d8840
fix: 라이브러리를 통한 시간 및 거리 단위 변환
PhilSoGooood 9a1480a
Merge pull request #67 from wnsxor1993/feature-openapi
Minzino 4c43731
Update README.md
PhilSoGooood ca38301
refactor: 불필요한 클래스 제거
PhilSoGooood ecf0e0f
refactor: 불필요한 ENUM클래스와 DTO클래스 삭제
Minzino 4921ea2
refactor: 홈화면에서 현재 위치와 여행지와의 거리 및 이동시간을 반환하도록 수정
PhilSoGooood fdd438a
feat: 방 조회 기능 구현
Minzino ce23eeb
test: 배포 테스트
PhilSoGooood 72d7c45
test: 배포 테스트
PhilSoGooood 625a35e
test: 배포 테스트
PhilSoGooood 58f5c58
refactor: 코드 리뷰 반영(반복문 -> stream)
PhilSoGooood 39e2d95
refactor: 코드 리뷰 반영(actuator 사용)
PhilSoGooood 71c9750
chore: 환경 설정 변경
PhilSoGooood File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
# 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 | ||
- 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 | ||
env: | ||
DATASOURCE_URL: ${{ secrets.DATASOURCE_URL }} | ||
DATASOURCE_USERNAME: ${{ secrets.DATASOURCE_USERNAME }} | ||
DATASOURCE_PASSWORD: ${{ secrets.DATASOURCE_PASSWORD }} | ||
|
||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
- name: Build with Gradle | ||
run: ./gradlew bootJar | ||
|
||
# 도커 빌드(도커 이미지 생성) | ||
- name: Docker build | ||
run: | | ||
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} | ||
docker build -t philsogood/airbnb:1.0 . | ||
docker push ${{ secrets.DOCKER_USERNAME }}/airbnb:1.0 | ||
docker rmi ${{ secrets.DOCKER_USERNAME }}/airbnb:1.0 | ||
|
||
# 디렉토리 생성 | ||
- name: Make Directory | ||
run: mkdir -p deploy | ||
|
||
# appspec.yml 파일 복사 | ||
- name: Copy appspec.yml | ||
run: cp appspec.yml ./deploy | ||
|
||
# script files 복사 | ||
- name: Copy script | ||
run: cp ./scripts/*.sh ./deploy | ||
|
||
# 파일 압축 | ||
- name: Make zip file | ||
run: zip -r ./airbnb.zip ./deploy | ||
|
||
# S3와 CodeDeploy를 통한 배포 | ||
- name: Deploy | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: ap-northeast-2 | ||
|
||
|
||
- name: Upload to S3 | ||
run: aws s3 cp --region ap-northeast-2 --acl private ./airbnb.zip s3://airbnb-phil-deploy-dockerimage/ | ||
|
||
- name: Start CodeDeploy | ||
run: aws deploy create-deployment --application-name Airbnb-Codedeploy-Application --deployment-group-name Airbnb-Codedeploy-Target-Group --s3-location bucket=airbnb-phil-deploy-dockerimage,key=airbnb.zip,bundleType=zip | ||
|
||
# 배경 성공시 슬랙 알람 | ||
- name: action-slack | ||
uses: 8398a7/action-slack@v3 | ||
with: | ||
status: ${{ job.status }} | ||
author_name: Github Action Test # default: 8398a7@action-slack | ||
fields: repo,message,commit,author,action,eventName,ref,workflow,job,took | ||
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required | ||
if: always() # Pick up events even if the job fails or is canceled. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# 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 될 때 실행할 명령어 | ||
ENTRYPOINT ["java","-jar","/app.jar"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
version: 0.0 | ||
os: linux | ||
files: | ||
- source: / | ||
destination: /home/ubuntu/app/ | ||
overwrite: yes | ||
|
||
permissions: | ||
- object: / | ||
pattern: "**" | ||
owner: ubuntu | ||
group: ubuntu | ||
|
||
hooks: | ||
ApplicationStart: | ||
- location: deploy.sh | ||
timeout: 60 | ||
runas: ubuntu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# 가동중인 jpa-shop 도커 중단 및 삭제 | ||
sudo docker ps -a -q --filter "name=airbnb" | grep -q . && docker stop airbnb && docker rm airbnb | true | ||
|
||
# 기존 이미지 삭제 | ||
sudo docker rmi philsogood/airbnb:1.0 | ||
|
||
# 도커허브 이미지 pull | ||
sudo docker pull philsogood/airbnb:1.0 | ||
|
||
# 도커 run | ||
sudo docker run -d -p 80:8080 --name airbnb philsogood/airbnb:1.0 | ||
|
||
# 사용하지 않는 불필요한 이미지 삭제 -> 현재 컨테이너가 물고 있는 이미지는 삭제되지 않습니다. | ||
sudo docker rmi -f $(docker images -f "dangling=true" -q) || true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
|
||
insert into room (city, country, state, street, zipcode, average_grade, description, name, price, check_in_time, | ||
check_out_time, number_of_bathroom, number_of_bed, number_of_bedroom, room_type, host_id) | ||
VALUES ('종로구', '한국', '서울시', '짱짱로', 1234, 3, '짱짱이에요', '[독채한옥] 도심속 고요한 휴식의 공간, 서울의하루 가회동', 196714, 14, 10, 2, 2, 2, | ||
'RESIDENCE', 1), | ||
('광주시', '한국', '경기도', '선을로', 1234, 4, '칭찬해요', '오포숲-숲뷰 맛집/넷플릭스/무료주차공간/매일 소독/서현10분', 100714, 15, 11, 2, 2, 2, 'SHARE_HOUSE', 1); | ||
|
||
insert into room_image (image_path, room_id) | ||
values ('https://a0.muscache.com/im/pictures/miso/Hostinvg-22724133/original/8514626f-60c8-4118-b207-b25285305915.jpeg?im_w=960', | ||
1), | ||
('https://a0.muscache.com/im/pictures/miso/Hosting-22724133/original/a98f70e9-a56e-41cd-9363-2656dfccb353.jpeg?im_w=720', | ||
1), | ||
('https://a0.muscache.com/im/pictures/miso/Hosting-22724133/original/551e045b-8e9f-4c78-aa18-b32d6388ab59.jpeg?im_w=720', | ||
1), | ||
('https://a0.muscache.com/im/pictures/5a6d01a9-3ba3-457c-a504-de665e65057d.jpg?im_w=960', 2), | ||
('https://a0.muscache.com/im/pictures/ca4d3ad4-5bec-4643-83f5-785a7e8afc1e.jpg?im_w=720', 2), | ||
('https://a0.muscache.com/im/pictures/d29bb793-e264-422a-9a2b-96f5377f4153.jpg?im_w=720', 2); | ||
|
||
insert into host (name) | ||
values ('meenzino'), | ||
('phil'); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.team11.airbnb.domain; | ||
|
||
import javax.persistence.Embedded; | ||
import javax.persistence.Entity; | ||
import javax.persistence.GeneratedValue; | ||
import javax.persistence.GenerationType; | ||
import javax.persistence.Id; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@Entity | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class District { | ||
|
||
@Id @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
private String name; | ||
private String imagePath; | ||
|
||
@Embedded | ||
private Location location; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.team11.airbnb.domain; | ||
|
||
import javax.persistence.Entity; | ||
import javax.persistence.GeneratedValue; | ||
import javax.persistence.GenerationType; | ||
import javax.persistence.Id; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Entity | ||
@Getter | ||
@NoArgsConstructor | ||
public class Host { | ||
|
||
@Id @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
private String name; | ||
private boolean isSuperHost; | ||
private String profileImagePath; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.team11.airbnb.domain; | ||
|
||
import javax.persistence.Embeddable; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Embeddable | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Getter | ||
public class Location { | ||
|
||
private String latitude; | ||
private String longitude; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.team11.airbnb.domain; | ||
|
||
import javax.persistence.Column; | ||
import javax.persistence.Entity; | ||
import javax.persistence.GeneratedValue; | ||
import javax.persistence.GenerationType; | ||
import javax.persistence.Id; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Entity | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@Getter | ||
public class MainEvent { | ||
|
||
@Id @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
private String title; | ||
private String label; | ||
private String imagePath; | ||
private String buttonText; | ||
|
||
} |
35 changes: 35 additions & 0 deletions
35
BE/src/main/java/com/team11/airbnb/domain/Reservation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.team11.airbnb.domain; | ||
|
||
import javax.persistence.Embedded; | ||
import javax.persistence.Entity; | ||
import javax.persistence.FetchType; | ||
import javax.persistence.GeneratedValue; | ||
import javax.persistence.GenerationType; | ||
import javax.persistence.Id; | ||
import javax.persistence.JoinColumn; | ||
import javax.persistence.ManyToOne; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Entity | ||
@NoArgsConstructor | ||
@Getter | ||
public class Reservation { | ||
|
||
@Id @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "room_id") | ||
private Room room; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "user_id") | ||
private User user; | ||
|
||
@Embedded | ||
private ReservationSchedule reservationSchedule; | ||
|
||
private int fixedPrice; | ||
|
||
} |
19 changes: 19 additions & 0 deletions
19
BE/src/main/java/com/team11/airbnb/domain/ReservationSchedule.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.team11.airbnb.domain; | ||
|
||
import java.time.LocalDateTime; | ||
import javax.persistence.Embeddable; | ||
|
||
@Embeddable | ||
public class ReservationSchedule { | ||
|
||
private LocalDateTime checkInDate; | ||
private LocalDateTime checkOutDate; | ||
|
||
protected ReservationSchedule() { | ||
} | ||
|
||
public ReservationSchedule(LocalDateTime checkInDate, LocalDateTime checkOutDate) { | ||
this.checkInDate = checkInDate; | ||
this.checkOutDate = checkOutDate; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.team11.airbnb.domain; | ||
|
||
import com.fasterxml.jackson.annotation.JsonBackReference; | ||
import javax.persistence.Entity; | ||
import javax.persistence.FetchType; | ||
import javax.persistence.GeneratedValue; | ||
import javax.persistence.GenerationType; | ||
import javax.persistence.Id; | ||
import javax.persistence.JoinColumn; | ||
import javax.persistence.ManyToOne; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Entity | ||
@Getter | ||
@NoArgsConstructor | ||
public class Review { | ||
|
||
@Id @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "room_id") | ||
private Room room; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "user_id") | ||
private User user; | ||
|
||
private int grade; | ||
private String content; | ||
|
||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
한 줄에 하나의 애노테이션만 씁시다!!