-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into fe/design/#50
- Loading branch information
Showing
60 changed files
with
2,976 additions
and
367 deletions.
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
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 |
---|---|---|
|
@@ -40,4 +40,6 @@ out/ | |
### Generated ### | ||
/src/main/generated/ | ||
|
||
.env | ||
backend-secret.env | ||
.env_* | ||
.DS_Store |
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,43 @@ | ||
FROM openjdk:17 | ||
COPY --from=builder build/libs/*.jar app.jar | ||
# builder 이미지에서 build/libs/*.jar 파일을 app.jar로 복사 | ||
|
||
FROM openjdk:17 AS builder | ||
VOLUME /tmp | ||
|
||
COPY ./gradlew . | ||
# gradlew 복사 | ||
COPY ./gradle gradle | ||
# gradle 복사 | ||
COPY ./build.gradle . | ||
# build.gradle 복사 | ||
COPY ./settings.gradle . | ||
# settings.gradle 복사 | ||
COPY ./src src | ||
# 웹 어플리케이션 소스 복사 | ||
RUN chmod +x ./gradlew | ||
# gradlew 실행 권한 부여 | ||
|
||
# 불필요한 패키지 설치 제거 (필요 없으면) | ||
RUN microdnf install findutils | ||
|
||
RUN ./gradlew bootJar | ||
# 실행 가능한 JAR 파일 생성 | ||
|
||
# 최종 이미지 | ||
FROM openjdk:17 | ||
COPY --from=builder build/libs/*.jar app.jar | ||
# 빌더에서 생성된 JAR 파일을 복사 | ||
|
||
# RUN mkdir -p /var/log/spring-boot | ||
# 로그 디렉토리 생성 | ||
|
||
EXPOSE 8080 | ||
# 컨테이너의 8080 포트를 외부로 노출 | ||
|
||
COPY wait-for-it.sh wait-for-it.sh | ||
RUN chmod +x wait-for-it.sh | ||
# wait-for-it.sh 스크립트 복사 및 실행 권한 부여 | ||
|
||
# wait-for-it.sh가 성공한 후 애플리케이션 실행 | ||
ENTRYPOINT ["./wait-for-it.sh", "mysqldb:3306", "-s", "-t", "100", "--", "java", "-Djava.security.egd=file:/dev/./urandom", "-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
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,43 @@ | ||
services: | ||
db: | ||
image: mysql:8.0 | ||
container_name: mysqldb | ||
ports: | ||
- "3306:3306" | ||
environment: | ||
MYSQL_DATABASE: ${MYSQL_DATABASE} | ||
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD} | ||
|
||
|
||
backend: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile-develop | ||
container_name: backend | ||
restart: always | ||
depends_on: | ||
- db | ||
environment: | ||
SPRING_DATASOURCE_URL: ${MYSQL_URL} | ||
SPRING_DATASOURCE_USERNAME: ${MYSQL_USER} | ||
SPRING_DATASOURCE_PASSWORD: ${MYSQL_PASSWORD} | ||
ports: | ||
- "8080:8080" | ||
volumes: | ||
- .:/app | ||
# - ./logs:/var/log/spring-boot | ||
|
||
agent: | ||
container_name: newrelic-infra | ||
build: | ||
context: . | ||
dockerfile: newrelic-infra.dockerfile | ||
cap_add: | ||
- SYS_PTRACE | ||
network_mode: bridge | ||
pid: host | ||
privileged: true | ||
volumes: | ||
- "/:/host:ro" | ||
- "/var/run/docker.sock:/var/run/docker.sock" | ||
restart: unless-stopped |
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 |
---|---|---|
@@ -1,27 +1,26 @@ | ||
services: | ||
# backend: | ||
# build: | ||
# context: . | ||
# container_name: backend | ||
# restart: always | ||
# environment: | ||
# SPRING_DATASOURCE_URL: ${MYSQL_URL} | ||
# SPRING_DATASOURCE_USERNAME: ${MYSQL_USER} | ||
# SPRING_DATASOURCE_PASSWORD: ${MYSQL_PASSWORD} | ||
# SPRING_PROFILES_ACTIVE: prod | ||
# ports: | ||
# - "8080:8080" | ||
# env_file: | ||
# - .env | ||
# volumes: | ||
# - .:/app | ||
# - ./logs:/var/log/spring-boot | ||
|
||
mysqldb: | ||
db: | ||
image: mysql:8.0 | ||
container_name: mysqldb | ||
ports: | ||
- "3306:3306" | ||
environment: | ||
MYSQL_DATABASE: techeer | ||
MYSQL_ROOT_PASSWORD: "1234" | ||
env_file: | ||
- backend-secret.env | ||
|
||
backend: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile-develop | ||
container_name: backend | ||
restart: always | ||
depends_on: | ||
- db | ||
env_file: | ||
- backend-secret.env | ||
ports: | ||
- "8080:8080" | ||
volumes: | ||
- .:/app | ||
# - ./logs:/var/log/spring-boot | ||
|
||
|
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,2 @@ | ||
FROM newrelic/infrastructure:latest | ||
ADD newrelic-infra/newrelic-infra.yml /etc/newrelic-infra.yml |
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 @@ | ||
license_key: ${NEW_RELIC_LICENSE_KEY} |
59 changes: 59 additions & 0 deletions
59
backend/src/main/java/com/techeer/backend/api/feedback/controller/FeedbackController.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,59 @@ | ||
package com.techeer.backend.api.feedback.controller; | ||
|
||
import com.techeer.backend.api.feedback.service.FeedbackService; | ||
import com.techeer.backend.api.feedback.dto.FeedbackCreateRequest; | ||
import com.techeer.backend.api.feedback.dto.FeedbackResponse; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import jakarta.validation.Valid; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
|
||
@Slf4j | ||
@Tag(name = "이력서 피드백 등록 API", description = "Feedback API") | ||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/api/v1/resumes/") // 공통 api | ||
public class FeedbackController { | ||
|
||
private final FeedbackService feedbackService; | ||
|
||
|
||
@Operation(summary = "피드백 등록", description = "원하는 위치에 피드백을 작성합니다.") | ||
@PostMapping("/{resume_id}/feedbacks") | ||
public ResponseEntity<FeedbackResponse> createFeedback( | ||
@PathVariable Long resume_id, | ||
@Valid @RequestBody FeedbackCreateRequest feedbackRequest) { | ||
|
||
log.info("이력서 ID: {} 에 대한 피드백 생성 요청", resume_id); | ||
|
||
// 피드백 생성 후 응답 생성 | ||
FeedbackResponse feedbackResponse = feedbackService.createFeedback( | ||
resume_id, | ||
feedbackRequest.getContent(), | ||
feedbackRequest.getXCoordinate(), | ||
feedbackRequest.getYCoordinate() | ||
); | ||
|
||
log.info("피드백 생성 완료: {}", feedbackResponse); | ||
|
||
return new ResponseEntity<>(feedbackResponse, HttpStatus.CREATED); | ||
} | ||
|
||
@Operation(summary = "피드백 삭제") | ||
@DeleteMapping("/{resume_id}/feedbacks/{feedback_id}") | ||
public ResponseEntity<Void> deleteFeedback( | ||
@PathVariable Long resume_id, | ||
@PathVariable Long feedback_id) { | ||
|
||
log.info("이력서 ID: {}, 피드백 ID: {} 에 대한 삭제 요청", resume_id, feedback_id); | ||
|
||
feedbackService.deleteFeedbackById(resume_id, feedback_id); | ||
|
||
return new ResponseEntity<>(HttpStatus.NO_CONTENT); | ||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
backend/src/main/java/com/techeer/backend/api/feedback/domain/Feedback.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,51 @@ | ||
package com.techeer.backend.api.feedback.domain; | ||
|
||
import com.techeer.backend.api.resume.domain.Resume; | ||
import com.techeer.backend.global.common.BaseEntity; | ||
import jakarta.persistence.*; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
import java.math.BigDecimal; | ||
|
||
@Getter | ||
@Entity | ||
@Table(name = "FEEDBACK") | ||
public class Feedback extends BaseEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
// 한 개의 이력서가 여러 개의 피드백을 가질 수 있음. | ||
@ManyToOne(fetch = FetchType.LAZY, optional = false) | ||
@JoinColumn(name = "resume_id", nullable = false) | ||
private Resume resume; | ||
|
||
@Column(nullable = false, length = 255) | ||
private String content; | ||
|
||
@Column(precision = 10, scale = 6) | ||
private BigDecimal xCoordinate; | ||
|
||
@Column(nullable = false,precision = 10, scale = 6) | ||
private BigDecimal yCoordinate; | ||
|
||
// 기본 생성자 | ||
protected Feedback() { | ||
} | ||
|
||
// 모든 필드를 포함한 생성자 | ||
public Feedback(Resume resume, String content, BigDecimal xCoordinate, BigDecimal yCoordinate) { | ||
this.resume = resume; | ||
this.content = content; | ||
this.xCoordinate = xCoordinate; | ||
this.yCoordinate = yCoordinate; | ||
} | ||
|
||
// Builder 패턴을 사용한 생성자 | ||
@Builder | ||
public static Feedback createFeedback(Resume resume, String content, BigDecimal xCoordinate, BigDecimal yCoordinate) { | ||
return new Feedback(resume, content, xCoordinate, yCoordinate); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
backend/src/main/java/com/techeer/backend/api/feedback/dto/FeedbackCreateRequest.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,27 @@ | ||
package com.techeer.backend.api.feedback.dto; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import jakarta.validation.constraints.NotBlank; | ||
import jakarta.validation.constraints.NotNull; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.ToString; | ||
|
||
import java.math.BigDecimal; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
@ToString | ||
public class FeedbackCreateRequest { | ||
|
||
@NotBlank(message = "content는 필수입니다.") | ||
private String content; | ||
|
||
@NotNull(message = "x 좌표는 필수입니다.") | ||
@JsonProperty("xCoordinate") | ||
private BigDecimal xCoordinate; | ||
|
||
@NotNull(message = "y 좌표는 필수입니다.") | ||
@JsonProperty("yCoordinate") | ||
private BigDecimal yCoordinate; | ||
} |
35 changes: 35 additions & 0 deletions
35
backend/src/main/java/com/techeer/backend/api/feedback/dto/FeedbackResponse.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.techeer.backend.api.feedback.dto; | ||
|
||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
import java.math.BigDecimal; | ||
|
||
@Getter | ||
public class FeedbackResponse { | ||
|
||
private final Long feedbackId; | ||
private final Long resumeId; | ||
private final String content; | ||
private final BigDecimal xCoordinate; | ||
private final BigDecimal yCoordinate; | ||
|
||
@Builder | ||
private FeedbackResponse(Long feedbackId, Long resumeId, String content, BigDecimal xCoordinate, BigDecimal yCoordinate) { | ||
this.feedbackId = feedbackId; | ||
this.resumeId = resumeId; | ||
this.content = content; | ||
this.xCoordinate = xCoordinate; | ||
this.yCoordinate = yCoordinate; | ||
} | ||
|
||
public static FeedbackResponse of(Long feedbackId, Long resumeId, String content, BigDecimal xCoordinate, BigDecimal yCoordinate) { | ||
return FeedbackResponse.builder() | ||
.feedbackId(feedbackId) | ||
.resumeId(resumeId) | ||
.content(content) | ||
.xCoordinate(xCoordinate) | ||
.yCoordinate(yCoordinate) | ||
.build(); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
backend/src/main/java/com/techeer/backend/api/feedback/repository/FeedbackRepository.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,14 @@ | ||
package com.techeer.backend.api.feedback.repository; | ||
|
||
import com.techeer.backend.api.feedback.domain.Feedback; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
@Repository | ||
public interface FeedbackRepository extends JpaRepository<Feedback, Long> { | ||
Optional<Feedback> findByIdAndResumeId(Long id, Long resumeId); | ||
List<Feedback> findAllByResumeId(Long resumeId); | ||
} |
Oops, something went wrong.