Skip to content

Commit

Permalink
Merge branch 'main' into feature/#69
Browse files Browse the repository at this point in the history
  • Loading branch information
JeongSangByuk authored Aug 26, 2024
2 parents 5407b29 + c53aad2 commit 62345c9
Show file tree
Hide file tree
Showing 28 changed files with 297 additions and 49 deletions.
17 changes: 13 additions & 4 deletions .github/workflows/CD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SERVER_HOST }}
port: ${{ secrets.SERVER_PORT }}
username: ${{ secrets.SERVER_USERNAME }}
key: ${{ secrets.SERVER_KEY }}
script: |
Expand All @@ -38,9 +39,17 @@ jobs:
git commit -m "temp commit"
git fetch origin main
git merge origin/main
if [ $? -ne 0 ]; then # 병합 명령어의 종료 상태를 확인합니다.
echo "Merge conflict detected. Resolving by applying remote changes."
git checkout --theirs $(git diff --name-only --diff-filter=U) # 충돌이 발생한 파일에 원격 변경 사항을 적용합니다.
git add . # 충돌이 해결된 파일을 스테이징합니다.
git commit -m "Resolved merge conflicts by applying remote changes." # 커밋 메시지를 작성하여 충돌 해결을 커밋합니다.
else
echo "Merge successful, no conflicts detected."
fi
./gradlew clean build
./gradlew openapi3
docker rm bbo-gak-server_back_1 --force
docker rmi bbo-gak-server_back
./gradlew clean build
./gradlew openapi3
docker rm bbo-gak-server-back-1 --force
docker rmi bbo-gak-server-back
docker-compose -f docker-compose-dev.yml up --build -d
3 changes: 3 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ dependencies {
implementation 'com.h2database:h2'
testImplementation 'com.h2database:h2'

//sentry
implementation 'io.sentry:sentry-spring-boot-starter-jakarta:7.14.0'

// Test
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
Expand Down
39 changes: 36 additions & 3 deletions docker-compose-dev.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3.8'

services:
back:
build:
Expand Down Expand Up @@ -29,8 +27,38 @@ services:
- GOOGLE_LOGIN_CLIENT_ID=${GOOGLE_LOGIN_CLIENT_ID}
- GOOGLE_LOGIN_CLIENT_SECRET=${GOOGLE_LOGIN_CLIENT_SECRET}
- GOOGLE_LOGIN_REDIRECT_URI=${GOOGLE_LOGIN_REDIRECT_URI}
- SENTRY_DSN=${SENTRY_DSN}
depends_on:
- mysql
networks:
- bbogak

nginx:
image: nginx:latest
container_name: nginx
volumes:
- /etc/nginx/:/etc/nginx/
- ./data/certbot/conf:/etc/letsencrypt
- ./data/certbot/www:/var/www/certbot
ports:
- "80:80"
- "443:443"
depends_on:
- back
networks:
- bbogak
command: "/bin/sh -c 'while :; do sleep 6h & wait $${!}; nginx -s reload; done & nginx -g \"daemon off;\"'"

certbot:
container_name: certbot
image: certbot/certbot
restart: unless-stopped
volumes:
- ./data/certbot/conf:/etc/letsencrypt
- ./data/certbot/www:/var/www/certbot
entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'"
networks:
- bbogak

mysql:
image: mysql:8.0
Expand All @@ -44,6 +72,11 @@ services:
- "3306:3306"
volumes:
- mysql_data:/var/lib/mysql

networks:
- bbogak
volumes:
mysql_data:

networks:
bbogak:
driver: bridge
3 changes: 3 additions & 0 deletions nginx/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM nginx:latest
RUN rm /etc/nginx/conf.d/default.conf
COPY nginx.conf /etc/nginx/conf.d
41 changes: 41 additions & 0 deletions nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
events {
worker_connections 1024;
}

https {
upstream was {
server backend:8080; #서비스명
}

server {
listen 80;
server_name dev.anifriends.site; # 발급한 도메인 주소
server_tokens off;

location /.well-known/acme-challenge/ {
root /var/www/certbot; # Certbot을 통해 Let's Encrypt 인증서를 발급받을 때 사용하는 경로
}

location / {
return 301 https://$host$request_uri; # 모든 HTTP 요청을 HTTPS로 리다이렉션
}
}

server {
listen 443 ssl;
server_name dev.anifriends.site;
server_tokens off;

ssl_certificate /etc/letsencrypt/live/dev.anifriends.site/fullchain.pem; # SSL/TLS 인증서 경로
ssl_certificate_key /etc/letsencrypt/live/dev.anifriends.site/privkey.pem; # SSL/TLS 개인 키 경로
include /etc/letsencrypt/options-ssl-nginx.conf; # Let's Encrypt에서 제공하는 Nginx SSL 옵션
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;

location / {
proxy_pass http://was;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,13 @@
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.SQLRestriction;

@Getter
@Entity
@SQLRestriction("deleted = false")
@SQLDelete(sql = "UPDATE card_copy_info SET deleted = true WHERE card_copy_info_id = ?")
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class CardCopyInfo extends BaseEntity {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.server.bbo_gak.domain.card.entity;

import com.server.bbo_gak.global.common.BaseEntity;
import com.server.bbo_gak.global.constant.FileExtension;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
Expand All @@ -15,11 +16,15 @@
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.SQLRestriction;

@Getter
@Entity
@SQLRestriction("deleted = false")
@SQLDelete(sql = "UPDATE card_image SET deleted = true WHERE card_image_id = ?")
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class CardImage {
public class CardImage extends BaseEntity {

private final String TYPE = "card_content";
@Id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.SQLRestriction;

@Getter
@Entity
@SQLRestriction("deleted = false")
@SQLDelete(sql = "UPDATE card_memo SET deleted = true WHERE card_memo_id = ?")
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class CardMemo extends BaseEntity {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.SQLRestriction;

@Getter
@Entity
@SQLRestriction("deleted = false")
@SQLDelete(sql = "UPDATE card_tag SET deleted = true WHERE card_tag_id = ?")
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class CardTag extends BaseEntity {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,13 @@
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.SQLRestriction;

@Getter
@Entity
@SQLRestriction("deleted = false")
@SQLDelete(sql = "UPDATE card_type SET deleted = true WHERE card_type_id = ?")
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class CardType extends BaseEntity {

Expand Down
8 changes: 7 additions & 1 deletion src/main/java/com/server/bbo_gak/domain/card/entity/Tag.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.server.bbo_gak.domain.card.entity;

import com.server.bbo_gak.domain.user.entity.Job;
import com.server.bbo_gak.global.common.BaseEntity;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.EnumType;
Expand All @@ -11,11 +13,15 @@
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.SQLRestriction;

@Getter
@Entity
@SQLRestriction("deleted = false")
@SQLDelete(sql = "UPDATE tag SET deleted = true WHERE tag_id = ?")
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class Tag {
public class Tag extends BaseEntity {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,13 @@
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.SQLRestriction;

@Getter
@Entity
@SQLRestriction("deleted = false")
@SQLDelete(sql = "UPDATE notification SET deleted = true WHERE notification_id = ?")
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class Notification extends BaseEntity {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.server.bbo_gak.domain.recruit.dto.request.RecruitUpdateSiteUrlRequest;
import com.server.bbo_gak.domain.recruit.dto.request.RecruitUpdateStatusRequest;
import com.server.bbo_gak.domain.recruit.dto.request.RecruitUpdateTitleRequest;
import com.server.bbo_gak.domain.recruit.dto.response.RecruitGetInnerResponse;
import com.server.bbo_gak.domain.recruit.dto.response.RecruitGetResponse;
import com.server.bbo_gak.domain.recruit.service.RecruitService;
import com.server.bbo_gak.domain.user.entity.User;
Expand Down Expand Up @@ -36,6 +37,14 @@ public ResponseEntity<List<RecruitGetResponse>> getTotalRecruitList(
return ResponseEntity.ok(recruitService.getTotalRecruitList(user));
}

@GetMapping("{id}")
public ResponseEntity<RecruitGetInnerResponse> getRecruitInnerInfo(
@AuthUser User user,
@PathVariable("id") Long id
) {
return ResponseEntity.ok(recruitService.getRecruit(user, id));
}


@GetMapping("/bySeason")
public ResponseEntity<List<RecruitGetResponse>> getRecruitListBySeason(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.server.bbo_gak.domain.recruit.dto.response;

import com.server.bbo_gak.domain.recruit.entity.Recruit;
import lombok.Builder;

@Builder
public record RecruitGetInnerResponse(
Long id,
String title,
String season,
String siteUrl,
String recruitStatus
) {

public static RecruitGetInnerResponse from(Recruit recruit) {

return RecruitGetInnerResponse.builder()
.id(recruit.getId())
.title(recruit.getTitle())
.season(recruit.getSeason().getName())
.siteUrl(recruit.getSiteUrl())
.recruitStatus(recruit.getRecruitStatus().getValue())
.build();
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.server.bbo_gak.domain.recruit.entity;

import com.server.bbo_gak.global.common.BaseEntity;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.EnumType;
Expand All @@ -15,11 +16,15 @@
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.SQLRestriction;

@Getter
@Entity
@SQLRestriction("deleted = false")
@SQLDelete(sql = "UPDATE recruit_schedule SET deleted = true WHERE recruit_schedule_id = ?")
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class RecruitSchedule {
public class RecruitSchedule extends BaseEntity {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.server.bbo_gak.domain.recruit.entity;

import com.server.bbo_gak.domain.user.entity.User;
import com.server.bbo_gak.global.common.BaseEntity;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
Expand All @@ -13,12 +14,16 @@
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.SQLRestriction;

@Getter
@Entity
@Table(name = "recruit_season")
@SQLRestriction("deleted = false")
@SQLDelete(sql = "UPDATE recruit_season SET deleted = true WHERE recruit_season_id = ?")
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class Season {
public class Season extends BaseEntity {

String name;
@Id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.server.bbo_gak.domain.recruit.dao.RecruitRepository;
import com.server.bbo_gak.domain.recruit.dto.request.RecruitCreateRequest;
import com.server.bbo_gak.domain.recruit.dto.response.RecruitGetInnerResponse;
import com.server.bbo_gak.domain.recruit.dto.response.RecruitGetResponse;
import com.server.bbo_gak.domain.recruit.entity.Recruit;
import com.server.bbo_gak.domain.recruit.entity.RecruitSchedule;
Expand Down Expand Up @@ -89,6 +90,11 @@ private boolean isNeedsScheduleUpdate(Recruit recruit) {
.allMatch(schedule -> schedule.getDeadLine().isBefore(LocalDate.now()));
}

public RecruitGetInnerResponse getRecruit(User user, Long recruitId) {
Recruit recruit = findRecruitByUserAndId(user, recruitId);
return RecruitGetInnerResponse.from(recruit);
}

@Transactional
public RecruitGetResponse createRecruit(User user, RecruitCreateRequest request) {

Expand Down
Loading

0 comments on commit 62345c9

Please sign in to comment.