-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Swagger 설정 및 모집글 API 문서화 완료 #50
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
Changes from 1 commit
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,14 @@ | ||
| package com.example.recruitment.controller; | ||
|
|
||
| import org.springframework.web.bind.annotation.GetMapping; | ||
| import org.springframework.web.bind.annotation.RequestMapping; | ||
| import org.springframework.web.bind.annotation.RestController; | ||
|
|
||
| @RestController | ||
| @RequestMapping("/swagger-test") | ||
| public class SwaggerTestController { | ||
| @GetMapping | ||
| public String test() { | ||
| return "Swagger works!"; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| package com.example.recruitment.entity; | ||
|
|
||
| import jakarta.persistence.Embeddable; | ||
| import lombok.*; | ||
|
|
||
| @Embeddable | ||
| @Getter @Setter | ||
| @NoArgsConstructor | ||
| @AllArgsConstructor | ||
| public class MenuItem { | ||
|
|
||
| private String name; | ||
| private int price; | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,29 @@ | ||||||||||||||||
| package com.example.recruitment.entity; | ||||||||||||||||
|
|
||||||||||||||||
| import jakarta.persistence.*; | ||||||||||||||||
| import lombok.*; | ||||||||||||||||
|
|
||||||||||||||||
| import java.util.List; | ||||||||||||||||
|
|
||||||||||||||||
| @Entity | ||||||||||||||||
| @Table(name = "orders") | ||||||||||||||||
| @Getter @Setter | ||||||||||||||||
| @NoArgsConstructor | ||||||||||||||||
| @AllArgsConstructor | ||||||||||||||||
| public class Order { | ||||||||||||||||
|
|
||||||||||||||||
| @Id @GeneratedValue | ||||||||||||||||
| private Long id; | ||||||||||||||||
|
||||||||||||||||
| @Id @GeneratedValue | |
| private Long id; | |
| @Id @GeneratedValue(strategy = GenerationType.IDENTITY) | |
| private Long id; |
🤖 Prompt for AI Agents
In recruitment-service/src/main/java/com/example/recruitment/entity/Order.java
around lines 15 to 16, the @GeneratedValue annotation on the id field lacks an
explicit generation strategy. Specify the generation strategy explicitly by
adding the strategy attribute to @GeneratedValue, such as
GenerationType.IDENTITY or GenerationType.AUTO, to ensure consistent ID
generation behavior across different JPA implementations.
Outdated
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.
🛠️ Refactor suggestion
관계 매핑에 fetch 타입과 cascade 설정을 추가해주세요.
@ManyToOne 관계에서 fetch 타입과 cascade 옵션을 명시적으로 설정하면 성능과 데이터 일관성을 보장할 수 있습니다.
- @ManyToOne
+ @ManyToOne(fetch = FetchType.LAZY)
+ @JoinColumn(name = "recruitment_id", nullable = false)
private Recruitment recruitment; // 어떤 모집글에 대한 주문인지
- @ManyToOne
+ @ManyToOne(fetch = FetchType.LAZY)
+ @JoinColumn(name = "user_id", nullable = false)
private User user; // 누가 주문했는지Committable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents
In recruitment-service/src/main/java/com/example/recruitment/entity/Order.java
around lines 18 to 22, the @ManyToOne annotations for recruitment and user
fields lack explicit fetch type and cascade settings. To improve performance and
data consistency, add fetch=FetchType.LAZY and appropriate cascade options
(e.g., CascadeType.PERSIST or CascadeType.MERGE) to both @ManyToOne annotations.
Outdated
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.
🛠️ Refactor suggestion
통화 처리를 위해 BigDecimal 사용을 고려해주세요.
int 타입은 통화 계산에서 정밀도 문제를 일으킬 수 있습니다. 금융 관련 계산에는 BigDecimal을 사용하는 것이 권장됩니다.
+import java.math.BigDecimal;
+
- private int totalPrice; // 총 가격
+ private BigDecimal totalPrice; // 총 가격📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| private int totalPrice; // 총 가격 | |
| // at the top of the file, alongside the other imports | |
| import java.math.BigDecimal; | |
| // inside the Order entity | |
| - private int totalPrice; // 총 가격 | |
| + private BigDecimal totalPrice; // 총 가격 |
🤖 Prompt for AI Agents
In recruitment-service/src/main/java/com/example/recruitment/entity/Order.java
at line 28, the totalPrice field is currently an int, which can cause precision
issues in currency calculations. Change the type of totalPrice from int to
BigDecimal to ensure accurate financial computations. Also, update any related
code that sets or gets this field to handle BigDecimal properly.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,9 +24,14 @@ public class Recruitment { | |
| @OneToMany(mappedBy = "recruitment", cascade = CascadeType.ALL, orphanRemoval = true) | ||
| private List<RecruitmentParticipant> participants; | ||
|
|
||
|
|
||
| private String title; | ||
| private String description; | ||
|
|
||
| private String status; // RECRUITING, CONFIRMED 등 | ||
|
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. 🛠️ Refactor suggestion 상태 필드에 열거형(Enum) 사용을 권장합니다. 문자열 대신 열거형을 사용하여 타입 안전성을 향상시키고 유효하지 않은 상태 값 입력을 방지할 수 있습니다. 다음과 같이 열거형을 정의하고 사용하는 것을 권장합니다: +@Enumerated(EnumType.STRING)
+private RecruitmentStatus status; // RECRUITING, CONFIRMED 등
-private String status; // RECRUITING, CONFIRMED 등별도의 enum 클래스를 생성하세요: public enum RecruitmentStatus {
RECRUITING, CONFIRMED, CLOSED
}🤖 Prompt for AI Agents |
||
|
|
||
| private LocalDateTime deadlineTime; | ||
|
|
||
| //카테고리 추가가 | ||
| @Column(nullable = false) | ||
| private String category; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| package com.example.recruitment.repository; | ||
|
|
||
| import com.example.recruitment.entity.Order; | ||
| import org.springframework.data.jpa.repository.JpaRepository; | ||
|
|
||
| public interface OrderRepository extends JpaRepository<Order, Long> { | ||
| } |
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.
🛠️ Refactor suggestion
검증 어노테이션과 감사 필드 추가를 고려해주세요.
엔티티에 데이터 검증과 생성/수정 시간 추적을 위한 필드가 없습니다.
📝 Committable suggestion
🤖 Prompt for AI Agents