-
Notifications
You must be signed in to change notification settings - Fork 2
MOSU-103 feat: Add Querydsl query types for various entities #120
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
Conversation
…mApplicationId and adjust related constructor; enhance ApplicationRequest with additional documentation for examApplication field
…ved testing setup
…gic and add validation for existing answers; enhance File class to use equals for visibility comparison
WalkthroughThe changes introduce new test dependencies for containerized testing, refactor and clarify code in several service and domain classes, and add two YAML configuration files for test environments. Minor documentation and annotation improvements are made, and a placeholder test method is added to the main test class. Changes
Sequence Diagram(s)sequenceDiagram
participant Test as Test (JUnit/Testcontainers)
participant SpringBoot as Spring Boot App
participant MySQL as MySQL (Testcontainers)
participant Redis as Redis (Testcontainers)
participant AWS as AWS S3 (Mock/Real)
Test->>SpringBoot: Start test with @Test
SpringBoot->>MySQL: Initialize Testcontainers MySQL
SpringBoot->>Redis: Initialize Testcontainers Redis
SpringBoot->>AWS: Connect using test credentials
Test-->>SpringBoot: Run integration tests
SpringBoot-->>Test: Return test results
Estimated code review effort3 (30–60 minutes) Poem
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Summary of Changes
Hello @chominju02, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request primarily focuses on integrating Querydsl to enable type-safe database interactions across various entities. It also significantly enhances the project's testing infrastructure by introducing Testcontainers for MySQL, ensuring a more robust and isolated environment for integration tests. Additionally, several minor code refactorings and dependency updates contribute to overall code quality.
Highlights
- Querydsl Integration: This pull request introduces Querydsl by generating Q-classes for a wide range of existing JPA entities, including Application, Event, Exam, Inquiry, Payment, Profile, User, and various associated attachment and file entities. This enables type-safe and more readable database queries throughout the application.
- Test Infrastructure Enhancement: The testing environment has been significantly upgraded with the addition of Testcontainers for MySQL. This setup, configured in
build.gradleand new test YAML files, provides a consistent, isolated, and ephemeral database instance for integration tests, improving test reliability and development workflow. - Refactoring and Code Cleanup: Minor refactorings and code improvements were applied across several service and domain classes. This includes removing an unused dependency in
ApplicationService, enhancing inquiry answer logic inInquiryAnswerService, and updating enum comparison best practices inFile.java. - Database Schema Adjustment: The
RefundJpaEntitywas updated to rename theapplicationSchoolIdcolumn toexamApplicationId, providing a more accurate and descriptive representation of the relationship in the database schema.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
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.
Code Review
This pull request introduces Querydsl-generated classes and includes several other refactorings and additions. The changes are generally positive, but I've identified a critical bug in InquiryAnswerService related to duplicate-checking logic that must be fixed. I've also provided feedback on improving code clarity and maintainability by removing temporary comments, correcting misplaced documentation, and reducing duplication in test configuration files.
| private void isAnswerAlreadyRegister(Long postId) { | ||
| if (inquiryAnswerJpaRepository.existsById(postId)) { | ||
| throw new CustomRuntimeException(ErrorCode.INQUIRY_ANSWER_ALREADY_EXISTS); | ||
| } | ||
| } |
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.
This method contains a critical bug. It uses inquiryAnswerJpaRepository.existsById(postId), which checks the primary key of InquiryAnswerJpaEntity. However, postId is the ID of the parent InquiryJpaEntity. This will not correctly detect if an answer for the given inquiry already exists and could lead to data integrity issues, such as multiple answers for a single inquiry.
The method name isAnswerAlreadyRegister is also a bit unconventional for a validation method that throws an exception. A name like validateAnswerDoesNotExist would be more descriptive.
| private void isAnswerAlreadyRegister(Long postId) { | |
| if (inquiryAnswerJpaRepository.existsById(postId)) { | |
| throw new CustomRuntimeException(ErrorCode.INQUIRY_ANSWER_ALREADY_EXISTS); | |
| } | |
| } | |
| private void isAnswerAlreadyRegister(Long postId) { | |
| if (inquiryAnswerJpaRepository.findByInquiryId(postId).isPresent()) { | |
| throw new CustomRuntimeException(ErrorCode.INQUIRY_ANSWER_ALREADY_EXISTS); | |
| } | |
| } |
| @Transactional | ||
| public void createInquiryAnswer(Long postId, InquiryAnswerRequest request) { | ||
| InquiryJpaEntity inquiryEntity = getInquiryOrThrow(postId); | ||
| isAnswerAlreadyRegister(postId); |
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.
The call to isAnswerAlreadyRegister is redundant. There is another check for the same condition on lines 36-38 (if (inquiryAnswerJpaRepository.findByInquiryId(postId).isPresent())).
You should only have one check to avoid confusion and unnecessary database queries. Given that the newly added isAnswerAlreadyRegister method contains a bug, I recommend removing this line and the isAnswerAlreadyRegister method entirely, relying on the existing correct check.
| // examId 가 동일 하냐? | ||
| //다른 exam 인데 시간이 같나? | ||
| //exam_id lunch_id 쌍으로 포함된 exam_application 이 존재하냐 |
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.
| /** | ||
| * ExamApplication = exam_id, lunch_id 를 포함하고 있음 | ||
| */ |
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.
| server: | ||
| port: ${SPRING_PORT} | ||
| servlet: | ||
| context-path: ${BASE_PATH} | ||
| session: | ||
| cookie: | ||
| same-site: none | ||
| secure: false | ||
| error: | ||
| include-stacktrace: never | ||
|
|
||
| spring: | ||
| config: | ||
| import: | ||
| - security-config.yml | ||
| datasource: | ||
| url: jdbc:tc:mysql:9.0.0:///; | ||
| driver-class-name: org.testcontainers.jdbc.ContainerDatabaseDriver | ||
| hikari: | ||
| maximum-pool-size: 15 | ||
| minimum-idle: 15 | ||
|
|
||
| servlet: | ||
| multipart: | ||
| max-file-size: ${MAX_FILE_SIZE} | ||
| max-request-size: ${MAX_REQUEST_SIZE} | ||
| jpa: | ||
| open-in-view: false | ||
| show-sql: true | ||
| hibernate: | ||
| ddl-auto: create-drop | ||
| properties: | ||
| hibernate: | ||
| show_sql: true | ||
| format_sql: true | ||
| highlight_sql: true | ||
| use_sql_comments: true | ||
| jdbc: | ||
| time_zone: Asia/Seoul | ||
| dialect: org.hibernate.dialect.MySQLDialect | ||
| data: | ||
| redis: | ||
| host: ${REDIS_HOST} | ||
| port: ${VELKEY_PORT} | ||
| messages: | ||
| basename: messages | ||
| encoding: UTF-8 | ||
| mvc: | ||
| view: | ||
| prefix: /WEB-INF/views/ | ||
| suffix: .jsp | ||
|
|
||
| management: | ||
| endpoints: | ||
| web: | ||
| exposure: | ||
| include: "*" | ||
|
|
||
| aws: | ||
| s3: | ||
| bucket-name: ${AWS_BUCKET_NAME} | ||
| region: ${AWS_REGION} | ||
| access-key: ${AWS_ACCESS_KEY} | ||
| secret-key: ${AWS_SECRET_KEY} | ||
| presigned-url-expiration-minutes: ${S3_PRESIGNED_URL_EXPIRATION_MINUTES} | ||
|
|
||
| logging: | ||
| file: | ||
| path: ./logs | ||
| name: app.log | ||
| level: | ||
| org: | ||
| type: | ||
| descriptor: | ||
| sql: | ||
| BasicBinder: TRACE | ||
|
|
||
| toss: | ||
| secret-key: test_sk_kYG57Eba3GYBMGeobgbLrpWDOxmA | ||
| api: | ||
| base-url: https://api.tosspayments.com/v1/payments | ||
|
|
||
| alimtalk: | ||
| user-id: ${ALIMTALK_USER_ID} | ||
| api-key: ${ALIMTALK_API_KEY} | ||
| api: | ||
| base-url: ${ALIMTALK_URL} | ||
|
|
||
| kakao: | ||
| channel-id: ${KAKAO_CHANNEL_ID} No newline at end of file |
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.
This configuration file is almost an exact duplicate of src/test/resources/application.yml. This level of duplication can lead to maintenance issues, as changes might be made in one file but forgotten in the other.
To improve maintainability, I recommend refactoring to reduce this duplication. You could create a base common-test.yml with shared properties, and then have other test configuration files import it and override only the necessary values.
Additionally, I noticed the MySQL version in this file (9.0.0) is different from the one in application.yml (8.4.4). If this is intentional, it would be beneficial to add a comment explaining why.
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.
Actionable comments posted: 5
🔭 Outside diff range comments (1)
src/main/java/life/mosu/mosuserver/application/inquiry/InquiryAnswerService.java (1)
33-38: Remove redundant duplicate check.The duplicate answer check is performed twice: once by
isAnswerAlreadyRegister(postId)at line 33 and again by the existing logic at lines 36-38. Remove the redundant check to improve code clarity.isAnswerAlreadyRegister(postId); InquiryJpaEntity inquiryEntity = getInquiry(postId); - if (inquiryAnswerJpaRepository.findByInquiryId(postId).isPresent()) { - throw new CustomRuntimeException(ErrorCode.INQUIRY_ANSWER_ALREADY_EXISTS); - } InquiryAnswerJpaEntity answerEntity = inquiryAnswerJpaRepository.save(
🧹 Nitpick comments (4)
src/test/resources/test-security-config.yml (1)
90-90: Add missing newline at end of file.kakao: - channel-id: ${KAKAO_CHANNEL_ID} + channel-id: ${KAKAO_CHANNEL_ID} +src/test/java/life/mosu/mosuserver/MosuServerApplicationTests.java (1)
9-11: Improve the placeholder test method.The empty test method lacks descriptive naming and implementation. Consider either removing it if not needed or implementing actual test logic.
- @Test - void test() { - } + @Test + void contextLoads() { + // This test will pass if the application context loads successfully + }src/main/java/life/mosu/mosuserver/application/application/ApplicationService.java (1)
54-56: Consider using English for code comments.The clarifying comments are helpful but written in Korean. For better code maintainability in international teams, consider using English.
- // examId 가 동일 하냐? - //다른 exam 인데 시간이 같나? - //exam_id lunch_id 쌍으로 포함된 exam_application 이 존재하냐 + // Check if examId is identical + // Check if different exams have the same time + // Check if exam_application exists with exam_id lunch_id pairsrc/test/resources/application.yml (1)
90-90: Add missing newline at end of file.kakao: - channel-id: ${KAKAO_CHANNEL_ID} + channel-id: ${KAKAO_CHANNEL_ID} +
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (33)
src/main/generated/life/mosu/mosuserver/domain/application/QApplicationJpaEntity.javais excluded by!**/generated/**src/main/generated/life/mosu/mosuserver/domain/application/QExamTicketImageJpaEntity.javais excluded by!**/generated/**src/main/generated/life/mosu/mosuserver/domain/base/QBaseTimeEntity.javais excluded by!**/generated/**src/main/generated/life/mosu/mosuserver/domain/event/QDurationJpaVO.javais excluded by!**/generated/**src/main/generated/life/mosu/mosuserver/domain/event/QEventAttachmentJpaEntity.javais excluded by!**/generated/**src/main/generated/life/mosu/mosuserver/domain/event/QEventImage.javais excluded by!**/generated/**src/main/generated/life/mosu/mosuserver/domain/event/QEventJpaEntity.javais excluded by!**/generated/**src/main/generated/life/mosu/mosuserver/domain/exam/QAddressJpaVO.javais excluded by!**/generated/**src/main/generated/life/mosu/mosuserver/domain/exam/QExamJpaEntity.javais excluded by!**/generated/**src/main/generated/life/mosu/mosuserver/domain/examapplication/QExamApplicationJpaEntity.javais excluded by!**/generated/**src/main/generated/life/mosu/mosuserver/domain/examapplication/QExamSubjectJpaEntity.javais excluded by!**/generated/**src/main/generated/life/mosu/mosuserver/domain/faq/QFaqAttachmentJpaEntity.javais excluded by!**/generated/**src/main/generated/life/mosu/mosuserver/domain/faq/QFaqFile.javais excluded by!**/generated/**src/main/generated/life/mosu/mosuserver/domain/faq/QFaqJpaEntity.javais excluded by!**/generated/**src/main/generated/life/mosu/mosuserver/domain/inquiry/QInquiryAttachmentJpaEntity.javais excluded by!**/generated/**src/main/generated/life/mosu/mosuserver/domain/inquiry/QInquiryFile.javais excluded by!**/generated/**src/main/generated/life/mosu/mosuserver/domain/inquiry/QInquiryJpaEntity.javais excluded by!**/generated/**src/main/generated/life/mosu/mosuserver/domain/inquiryAnswer/QInquiryAnswerAttachmentEntity.javais excluded by!**/generated/**src/main/generated/life/mosu/mosuserver/domain/inquiryAnswer/QInquiryAnswerFile.javais excluded by!**/generated/**src/main/generated/life/mosu/mosuserver/domain/inquiryAnswer/QInquiryAnswerJpaEntity.javais excluded by!**/generated/**src/main/generated/life/mosu/mosuserver/domain/lunch/QLunchJpaEntity.javais excluded by!**/generated/**src/main/generated/life/mosu/mosuserver/domain/notice/QNoticeAttachmentJpaEntity.javais excluded by!**/generated/**src/main/generated/life/mosu/mosuserver/domain/notice/QNoticeFile.javais excluded by!**/generated/**src/main/generated/life/mosu/mosuserver/domain/notice/QNoticeJpaEntity.javais excluded by!**/generated/**src/main/generated/life/mosu/mosuserver/domain/payment/QPaymentAmountVO.javais excluded by!**/generated/**src/main/generated/life/mosu/mosuserver/domain/payment/QPaymentJpaEntity.javais excluded by!**/generated/**src/main/generated/life/mosu/mosuserver/domain/profile/QProfileJpaEntity.javais excluded by!**/generated/**src/main/generated/life/mosu/mosuserver/domain/profile/QSchoolInfoJpaVO.javais excluded by!**/generated/**src/main/generated/life/mosu/mosuserver/domain/refund/QRefundJpaEntity.javais excluded by!**/generated/**src/main/generated/life/mosu/mosuserver/domain/user/QUserJpaEntity.javais excluded by!**/generated/**src/main/generated/life/mosu/mosuserver/infra/storage/domain/QAdmissionTicketFileEntity.javais excluded by!**/generated/**src/main/generated/life/mosu/mosuserver/infra/storage/domain/QFile.javais excluded by!**/generated/**src/main/generated/life/mosu/mosuserver/infra/storage/domain/QFileMoveFailLog.javais excluded by!**/generated/**
📒 Files selected for processing (9)
build.gradle(1 hunks)src/main/java/life/mosu/mosuserver/application/application/ApplicationService.java(1 hunks)src/main/java/life/mosu/mosuserver/application/inquiry/InquiryAnswerService.java(4 hunks)src/main/java/life/mosu/mosuserver/domain/refund/RefundJpaEntity.java(3 hunks)src/main/java/life/mosu/mosuserver/infra/storage/domain/File.java(2 hunks)src/main/java/life/mosu/mosuserver/presentation/application/dto/ApplicationRequest.java(1 hunks)src/test/java/life/mosu/mosuserver/MosuServerApplicationTests.java(1 hunks)src/test/resources/application.yml(1 hunks)src/test/resources/test-security-config.yml(1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/main/java/life/mosu/mosuserver/domain/refund/RefundJpaEntity.java (1)
src/main/java/life/mosu/mosuserver/domain/application/ApplicationJpaEntity.java (1)
Entity(15-52)
🪛 Gitleaks (8.27.2)
src/test/resources/application.yml
79-79: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
src/test/resources/test-security-config.yml
79-79: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
🪛 YAMLlint (1.37.1)
src/test/resources/application.yml
[error] 90-90: no new line character at the end of file
(new-line-at-end-of-file)
src/test/resources/test-security-config.yml
[error] 90-90: no new line character at the end of file
(new-line-at-end-of-file)
🔇 Additional comments (12)
src/main/java/life/mosu/mosuserver/infra/storage/domain/File.java (2)
3-6: Excellent improvement to explicit imports.Replacing wildcard imports with explicit JPA imports improves code clarity and makes dependencies more obvious.
33-33: Good practice using .equals() for enum comparison.While
==works for enums due to their singleton nature, using.equals()is more defensive and consistent with general object comparison practices.src/main/java/life/mosu/mosuserver/domain/refund/RefundJpaEntity.java (1)
3-9: Good improvement to explicit imports.Replacing wildcard imports with explicit JPA imports enhances code readability and makes dependencies clear.
src/test/resources/test-security-config.yml (2)
1-90: Well-structured test configuration for containerized testing.The configuration appropriately sets up a comprehensive test environment with Testcontainers MySQL, detailed JPA logging, and proper test-specific settings like
create-dropDDL mode.
1-90: Inconsistent with PR objectives - no Querydsl query types found.The PR title mentions "Add Querydsl query types for various entities" but this file (and the entire PR) doesn't contain any actual Querydsl Q-type classes or query implementations. The changes appear to be infrastructure and code quality improvements instead.
Likely an incorrect or invalid review comment.
src/test/java/life/mosu/mosuserver/MosuServerApplicationTests.java (1)
1-13: Inconsistent with PR objectives: No Querydsl-related changes found.The PR title indicates "Add Querydsl query types for various entities" but this file contains only basic test infrastructure setup. Please verify that the correct files were included in this PR.
Likely an incorrect or invalid review comment.
src/main/java/life/mosu/mosuserver/application/application/ApplicationService.java (1)
1-156: Inconsistent with PR objectives: No Querydsl implementation found.This service class shows no Querydsl query types or related imports despite the PR title indicating "Add Querydsl query types for various entities".
Likely an incorrect or invalid review comment.
src/test/resources/application.yml (3)
1-90: Inconsistent with PR objectives: Test configuration doesn't relate to Querydsl.This YAML configuration file sets up test infrastructure but contains no Querydsl-related configuration despite the PR title indicating "Add Querydsl query types for various entities".
Likely an incorrect or invalid review comment.
79-79: Test API key is acceptable for test configuration.The static analysis tool flagged this as a potential security issue, but this appears to be a legitimate test API key from Toss (indicated by the
test_sk_prefix) which is appropriate for test configurations.
17-18: Testcontainers MySQL 8.4.4 tag is availableMySQL 8.4.4 (including variants
8.4.4,8.4.4-oracle,8.4.4-oraclelinux9) is published on Docker Hub, so the URL insrc/test/resources/application.ymlis valid. No changes to the code are required—just ensure this version matches your application and production requirements.• File: src/test/resources/application.yml
url:jdbc:tc:mysql:8.4.4:///;
driver-class-name:org.testcontainers.jdbc.ContainerDatabaseDriversrc/main/java/life/mosu/mosuserver/application/inquiry/InquiryAnswerService.java (2)
1-104: Inconsistent with PR objectives: No Querydsl implementation found.This service class shows refactoring improvements but no Querydsl query types or related functionality despite the PR title indicating "Add Querydsl query types for various entities".
Likely an incorrect or invalid review comment.
91-94: Method refactoring improves code readability.The rename from
getInquiryOrThrowtogetInquiryis a good simplification while maintaining the same functionality.
| testImplementation 'org.springframework.boot:spring-boot-testcontainers:3.3.5' | ||
| testImplementation 'org.testcontainers:testcontainers:1.19.3' | ||
| testImplementation 'org.testcontainers:junit-jupiter:1.19.3' | ||
| testImplementation 'org.testcontainers:mysql:1.20.0' |
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.
💡 Verification agent
🧩 Analysis chain
Verify Testcontainers version compatibility.
The Testcontainers dependencies use different versions (MySQL 1.20.0 vs core/junit-jupiter 1.19.3) and the Spring Boot Testcontainers starter (3.3.5) might be outdated compared to the Spring Boot version (3.4.5).
🏁 Script executed:
#!/bin/bash
# Check latest available versions for Testcontainers dependencies
echo "Checking latest Testcontainers versions:"
curl -s https://repo1.maven.org/maven2/org/testcontainers/testcontainers/maven-metadata.xml | grep -o '<version>[^<]*</version>' | tail -5
echo -e "\nChecking Spring Boot Testcontainers starter versions:"
curl -s https://repo1.maven.org/maven2/org/springframework/boot/spring-boot-testcontainers/maven-metadata.xml | grep -o '<version>[^<]*</version>' | tail -5Length of output: 768
Align Testcontainers versions and update Spring Boot Testcontainers starter
All Testcontainers modules should share the same version and the Spring Boot Testcontainers starter should match your Spring Boot minor version.
• In build.gradle (around lines 93–96):
– Replace
groovy testImplementation 'org.springframework.boot:spring-boot-testcontainers:3.3.5' testImplementation 'org.testcontainers:testcontainers:1.19.3' testImplementation 'org.testcontainers:junit-jupiter:1.19.3' testImplementation 'org.testcontainers:mysql:1.20.0'
– With (for example, using the latest 3.4.x starter and Testcontainers 1.21.3):
groovy testImplementation 'org.springframework.boot:spring-boot-testcontainers:3.4.7' testImplementation 'org.testcontainers:testcontainers:1.21.3' testImplementation 'org.testcontainers:junit-jupiter:1.21.3' testImplementation 'org.testcontainers:mysql:1.21.3'
• Verify your Spring Boot version (3.4.5) is compatible with the chosen starter (3.4.7).
• Optionally review Maven Central for the exact latest patch releases before finalizing.
🤖 Prompt for AI Agents
In build.gradle around lines 93 to 96, the Testcontainers dependencies use
inconsistent versions and the Spring Boot Testcontainers starter version does
not align with your Spring Boot version. Update all Testcontainers dependencies
to the same version, for example 1.21.3, and update the Spring Boot
Testcontainers starter to a version matching your Spring Boot minor version,
such as 3.4.7. Verify compatibility between your Spring Boot version and the
starter version before finalizing.
| private void isAnswerAlreadyRegister(Long postId) { | ||
| if (inquiryAnswerJpaRepository.existsById(postId)) { | ||
| throw new CustomRuntimeException(ErrorCode.INQUIRY_ANSWER_ALREADY_EXISTS); | ||
| } | ||
| } |
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.
Fix incorrect logic in answer existence check.
The isAnswerAlreadyRegister method incorrectly uses existsById(postId) which checks if an answer exists with the given ID as primary key, but it should check if an answer exists for the given inquiry ID.
- private void isAnswerAlreadyRegister(Long postId) {
- if (inquiryAnswerJpaRepository.existsById(postId)) {
- throw new CustomRuntimeException(ErrorCode.INQUIRY_ANSWER_ALREADY_EXISTS);
- }
- }
+ private void isAnswerAlreadyRegister(Long postId) {
+ if (inquiryAnswerJpaRepository.existsByInquiryId(postId)) {
+ throw new CustomRuntimeException(ErrorCode.INQUIRY_ANSWER_ALREADY_EXISTS);
+ }
+ }📝 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 void isAnswerAlreadyRegister(Long postId) { | |
| if (inquiryAnswerJpaRepository.existsById(postId)) { | |
| throw new CustomRuntimeException(ErrorCode.INQUIRY_ANSWER_ALREADY_EXISTS); | |
| } | |
| } | |
| private void isAnswerAlreadyRegister(Long postId) { | |
| if (inquiryAnswerJpaRepository.existsByInquiryId(postId)) { | |
| throw new CustomRuntimeException(ErrorCode.INQUIRY_ANSWER_ALREADY_EXISTS); | |
| } | |
| } |
🤖 Prompt for AI Agents
In
src/main/java/life/mosu/mosuserver/application/inquiry/InquiryAnswerService.java
around lines 96 to 100, the method isAnswerAlreadyRegister incorrectly checks
existence by using existsById(postId), which checks for an answer with the
primary key equal to postId. Instead, modify the repository method call to check
if an answer exists for the given inquiry ID (postId) by using a method like
existsByInquiryId(postId) or the appropriate query method that checks the
inquiry ID field.
| @Column(name = "exam_application_id") | ||
| private Long examApplicationId; |
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.
💡 Verification agent
🧩 Analysis chain
Verify consistent field renaming across the codebase.
The field rename from applicationSchoolId to examApplicationId makes the domain model more precise. Ensure all references to this field have been updated consistently.
Also applies to: 41-42, 46-46
🏁 Script executed:
#!/bin/bash
# Search for any remaining references to the old field name
echo "Searching for old field name references:"
rg -i "applicationSchoolId|application_school_id" --type java
echo -e "\nSearching for new field name usage:"
rg -i "examApplicationId|exam_application_id" --type javaLength of output: 10784
Inconsistent usage of applicationSchoolId remains—please rename to examApplicationId across the codebase
The following files still reference the old field name applicationSchoolId and should be updated (or confirmed correct if they refer to a different concept):
- src/main/java/life/mosu/mosuserver/presentation/payment/dto/PaymentRequest.java
- src/main/java/life/mosu/mosuserver/domain/admin/ApplicationQueryRepositoryImpl.java
- src/main/java/life/mosu/mosuserver/domain/admin/RefundQueryRepositoryImpl.java
- src/main/java/life/mosu/mosuserver/domain/refund/RefundJpaRepository.java
- src/main/java/life/mosu/mosuserver/domain/payment/PaymentJpaEntity.java
- src/main/generated/life/mosu/mosuserver/domain/payment/QPaymentJpaEntity.java
- src/main/java/life/mosu/mosuserver/infra/respository/BulkRepository.java
- src/main/java/life/mosu/mosuserver/application/payment/PaymentEvent.java
- src/main/java/life/mosu/mosuserver/application/payment/PaymentFailureHandler.java
- src/main/java/life/mosu/mosuserver/application/payment/PaymentService.java
- src/main/java/life/mosu/mosuserver/application/notify/NotifyVariableFactory.java
After renaming, rerun rg -i "applicationSchoolId" to confirm no lingering references.
🤖 Prompt for AI Agents
In src/main/java/life/mosu/mosuserver/domain/refund/RefundJpaEntity.java around
lines 27-28, the field applicationSchoolId has been renamed to
examApplicationId, but other files still reference the old name. Update all
occurrences of applicationSchoolId to examApplicationId in the listed files to
maintain consistency. After making these changes, run rg -i
"applicationSchoolId" to verify no references remain.
| /** | ||
| * ExamApplication = exam_id, lunch_id 를 포함하고 있음 | ||
| */ |
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.
Move the Javadoc comment to the correct field.
The comment describes ExamApplication containing exam_id and lunch_id, but it's placed above the agreement field instead of the examApplication field.
@NotNull
List<ExamApplicationRequest> examApplication,
- /**
- * ExamApplication = exam_id, lunch_id 를 포함하고 있음
- */
@Schema(description = "약관 동의 정보", required = true)
@NotNull
AgreementRequest agreement,And add it above the examApplication field:
@Schema(description = "시험 신청 Id 목록", required = true)
@NotNull
+ /**
+ * ExamApplication = exam_id, lunch_id 를 포함하고 있음
+ */
List<ExamApplicationRequest> examApplication,📝 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.
| /** | |
| * ExamApplication = exam_id, lunch_id 를 포함하고 있음 | |
| */ | |
| /** | |
| * ExamApplication = exam_id, lunch_id 를 포함하고 있음 | |
| */ | |
| @Schema(description = "시험 신청 Id 목록", required = true) | |
| @NotNull | |
| List<ExamApplicationRequest> examApplication, | |
| @Schema(description = "약관 동의 정보", required = true) | |
| @NotNull | |
| AgreementRequest agreement, |
🤖 Prompt for AI Agents
In
src/main/java/life/mosu/mosuserver/presentation/application/dto/ApplicationRequest.java
around lines 28 to 30, the Javadoc comment describing that ExamApplication
contains exam_id and lunch_id is incorrectly placed above the agreement field.
Move this Javadoc comment so that it is directly above the examApplication field
to correctly document it.
| BasicBinder: TRACE | ||
|
|
||
| toss: | ||
| secret-key: test_sk_kYG57Eba3GYBMGeobgbLrpWDOxmA |
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.
Remove hardcoded API key even for testing.
Although this appears to be a test key, hardcoding API keys in configuration files is a security risk and bad practice.
toss:
- secret-key: test_sk_kYG57Eba3GYBMGeobgbLrpWDOxmA
+ secret-key: ${TOSS_SECRET_KEY}
api:
base-url: https://api.tosspayments.com/v1/payments📝 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.
| secret-key: test_sk_kYG57Eba3GYBMGeobgbLrpWDOxmA | |
| toss: | |
| secret-key: ${TOSS_SECRET_KEY} | |
| api: | |
| base-url: https://api.tosspayments.com/v1/payments |
🧰 Tools
🪛 Gitleaks (8.27.2)
79-79: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
🤖 Prompt for AI Agents
In src/test/resources/test-security-config.yml at line 79, remove the hardcoded
secret-key value to avoid security risks. Replace it with a reference to an
environment variable or a placeholder that can be securely injected during
testing, ensuring no sensitive keys are stored directly in the configuration
file.
✨ 구현한 기능
📢 논의하고 싶은 내용
🎸 기타
Summary by CodeRabbit
Refactor
Documentation
Tests