Skip to content

Feat/#38 mock jobposting with data#97

Merged
shinae1023 merged 3 commits into
mainfrom
feat/#38-mock-jobposting-with-data
Jun 16, 2026
Merged

Feat/#38 mock jobposting with data#97
shinae1023 merged 3 commits into
mainfrom
feat/#38-mock-jobposting-with-data

Conversation

@shinae1023

@shinae1023 shinae1023 commented Jun 16, 2026

Copy link
Copy Markdown
Member

✨ 어떤 이유로 PR를 하셨나요?

  • feature 병합
  • 버그 수정(아래에 issue #를 남겨주세요)
  • 코드 개선
  • 코드 수정
  • 배포
  • 기타(아래에 자세한 내용 기입해주세요)

📋 세부 내용 - 왜 해당 PR이 필요한지 작업 내용을 자세하게 설명해주세요

작업 내용

  • 관리자용 corpus 엑셀 적재 API에 파일 업로드 방식을 추가했습니다.

  • 기존 경로 입력 방식은 유지하면서, multipart/form-data.xlsx 파일을 직접 업로드해 적재할 수 있도록 확장했습니다.

  • 업로드 파일이 비어 있거나 .xlsx 형식이 아닐 경우 예외 처리되도록 검증을 추가했습니다.

  • 엔티티 공통 생성일자/수정일자 관리를 위해 BaseEntity / CreatedAtEntity를 추가했습니다.

  • JPA Auditing 설정을 적용해 수동 createdAt 설정 로직을 공통화했습니다.

  • User, Analysis, Question, QuestionAnalysis, MockApply, JobPosting, Payment 등 주요 엔티티에 공통 시간 필드를 반영했습니다.

  • AuditLog, CreditTransaction, CustomQuestionCandidate, CorpusClassificationMapping 등은 성격에 맞게 createdAt 중심으로 정리했습니다.

📸 작업 화면 스크린샷

⚠️ PR하기 전에 확인해주세요

  • 로컬테스트를 진행하셨나요?
  • 머지할 브랜치를 확인하셨나요?
  • 관련 label을 선택하셨나요?

🚨 관련 이슈 번호 [ ]

Summary by CodeRabbit

  • New Features

    • Added file upload capability for corpus data imports. Administrators can now upload spreadsheet files directly through the admin interface to streamline data management workflows.
  • Refactor

    • Implemented standardized entity base structures and enhanced audit tracking across the platform for improved consistency, reliability, and maintainability of core data models.

@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@shinae1023, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 47 minutes and 43 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: ff8993f7-8238-4973-bd6f-ef91c408c1b2

📥 Commits

Reviewing files that changed from the base of the PR and between 9b50166 and bde539b.

📒 Files selected for processing (3)
  • src/main/java/com/jobdri/jobdri_api/domain/corpus/controller/CorpusAdminController.java
  • src/main/java/com/jobdri/jobdri_api/domain/corpus/service/CorpusImportService.java
  • src/main/java/com/jobdri/jobdri_api/global/entity/BaseEntity.java
📝 Walkthrough

Walkthrough

Introduces BaseEntity (createdAt + updatedAt) and CreatedAtEntity (createdAt only) as JPA @MappedSuperclass types, activates auditing via JpaAuditingConfig, and migrates all domain entities to inherit from these base classes by removing locally managed createdAt fields and builder assignments. Separately adds a multipart XLSX upload endpoint for corpus import.

Changes

JPA Auditing Infrastructure and Entity Migration

Layer / File(s) Summary
BaseEntity, CreatedAtEntity, and JpaAuditingConfig
src/main/java/com/jobdri/jobdri_api/global/entity/BaseEntity.java, src/main/java/com/jobdri/jobdri_api/global/entity/CreatedAtEntity.java, src/main/java/com/jobdri/jobdri_api/global/config/JpaAuditingConfig.java
BaseEntity declares createdAt/updatedAt via @CreatedDate/@LastModifiedDate; CreatedAtEntity declares only createdAt; JpaAuditingConfig activates @EnableJpaAuditing.
Entity migrations with createdAt field and builder removal
src/.../audit/entity/AuditLog.java, src/.../analysis/entity/CustomQuestionCandidate.java, src/.../corpus/entity/CorpusClassificationMapping.java, src/.../corpus/entity/MockJobPostingCorpus.java, src/.../corpus/entity/MockQuestionCorpus.java, src/.../mockapply/entity/MockApply.java, src/.../payment/entity/CreditTransaction.java, src/.../payment/entity/Payment.java
Entities that previously owned a LocalDateTime createdAt field and set it via LocalDateTime.now() in factory builders now extend BaseEntity or CreatedAtEntity; the local field and explicit builder assignment are removed from each.
Simple class signature updates (extends BaseEntity)
src/.../analysis/entity/Analysis.java, src/.../analysis/entity/Question.java, src/.../analysis/entity/QuestionAnalysis.java, src/.../company/entity/Company.java, src/.../experience/entity/Experience.java, src/.../jobposting/entity/JobPosting.java, src/.../jobposting/entity/MockQuestionCache.java, src/.../mockapply/entity/MockApplySequence.java, src/.../user/entity/User.java
Nine entities with no previous local timestamp field are updated to add extends BaseEntity to their class declarations along with the matching import.

Corpus XLSX Upload Endpoint

Layer / File(s) Summary
CorpusImportService InputStream overload and upload controller endpoint
src/main/java/com/jobdri/jobdri_api/domain/corpus/service/CorpusImportService.java, src/main/java/com/jobdri/jobdri_api/domain/corpus/controller/CorpusAdminController.java
CorpusImportService gains an importFromXlsx(InputStream) overload; CorpusAdminController adds POST /api/admin/corpus/import/upload accepting MultipartFile, validated for presence and .xlsx extension, then delegating to the new service overload.

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant CorpusAdminController
  participant CorpusImportService
  Client->>CorpusAdminController: POST /api/admin/corpus/import/upload (MultipartFile)
  CorpusAdminController->>CorpusAdminController: validateUploadFile(.xlsx check)
  CorpusAdminController->>CorpusImportService: importFromXlsx(InputStream)
  CorpusImportService->>CorpusImportService: new XSSFWorkbook(inputStream)
  CorpusImportService->>CorpusImportService: importWorkbook(workbook)
  CorpusImportService-->>CorpusAdminController: CorpusImportResult
  CorpusAdminController-->>Client: ApiResponse<CorpusImportResult>
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • JobDri-Developer/BackEnd#94: Introduced MockJobPostingCorpus with its own createdAt field and create() builder assignment, which this PR removes by migrating that entity to BaseEntity.
  • JobDri-Developer/BackEnd#76: Introduced the AuditLog entity with a manual createdAt setup, which this PR refactors to extend CreatedAtEntity.
  • JobDri-Developer/BackEnd#70: Introduced CreditTransaction with a persisted createdAt field set in create(...), which this PR removes by migrating to CreatedAtEntity.

Suggested labels

✨ feat

Suggested reviewers

  • whc9999

Poem

🐇 Hopping through the codebase, timestamps fly free,
No more LocalDateTime.now() for you or me!
BaseEntity blooms like a carrot in spring,
@CreatedDate auto-fills — oh, what joy it brings!
The bunny cheers: "One superclass to rule them all!"
And corpus uploads glide right through the hall. 🥕

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'Feat/#38 mock jobposting with data' only partially reflects the actual changes, which include comprehensive entity refactoring and timestamp management centralization. Revise the title to better represent the main scope, such as: 'Refactor entity timestamps with JPA Auditing and add corpus file upload API' to clarify the dual nature of the changes.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/#38-mock-jobposting-with-data

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@src/main/java/com/jobdri/jobdri_api/domain/corpus/controller/CorpusAdminController.java`:
- Around line 56-63: The importCorpusByUpload method throws IOException which is
not handled by the global exception handler for invalid input, causing it to
return a 500 error instead of the appropriate 400 INVALID_PARAMETER error. Wrap
the corpusImportService.importFromXlsx(file.getInputStream()) call in a
try-catch block to catch IOException and convert it to GeneralException with
GeneralErrorCode.INVALID_PARAMETER and the message "파일 형식이 올바르지 않습니다.", then
remove throws IOException from the method signature so the wrapped exception
handling manages all error cases.

In
`@src/main/java/com/jobdri/jobdri_api/domain/corpus/service/CorpusImportService.java`:
- Around line 51-54: The importFromXlsx method accepts an InputStream parameter
that is not being closed, which can cause resource leaks when callers pass in
streams they've opened. Add the inputStream parameter to the try-with-resources
block in the importFromXlsx method (line 51-52) so it is automatically closed
when the method exits. Modify the try statement to manage both the inputStream
and the Workbook as resources, ensuring proper cleanup of all opened resources
regardless of whether the method exits normally or via an exception.

In `@src/main/java/com/jobdri/jobdri_api/global/entity/BaseEntity.java`:
- Around line 18-24: The BaseEntity class now enforces NOT NULL constraints on
createdAt and updatedAt columns, which will cause schema migration failures for
existing production tables that inherit from BaseEntity if those rows lack
values for updatedAt. Before deploying this change, identify all 13 tables
inheriting from BaseEntity and verify whether they already exist in production.
For any existing tables, create an explicit database migration that adds a
DEFAULT CURRENT_TIMESTAMP to the updated_at column before the NOT NULL
constraint is applied via Hibernate ddl-auto, or temporarily remove the
nullable=false constraint from the updatedAt field in BaseEntity until the
migration is safely deployed. Additionally, ensure schema.sql is updated to
reflect these column definitions with appropriate defaults for all newly created
tables.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 1a56f74e-3fe1-4c3b-9d59-aaeb03741f59

📥 Commits

Reviewing files that changed from the base of the PR and between dc5cb9c and 9b50166.

📒 Files selected for processing (22)
  • src/main/java/com/jobdri/jobdri_api/domain/analysis/entity/Analysis.java
  • src/main/java/com/jobdri/jobdri_api/domain/analysis/entity/CustomQuestionCandidate.java
  • src/main/java/com/jobdri/jobdri_api/domain/analysis/entity/Question.java
  • src/main/java/com/jobdri/jobdri_api/domain/analysis/entity/QuestionAnalysis.java
  • src/main/java/com/jobdri/jobdri_api/domain/audit/entity/AuditLog.java
  • src/main/java/com/jobdri/jobdri_api/domain/company/entity/Company.java
  • src/main/java/com/jobdri/jobdri_api/domain/corpus/controller/CorpusAdminController.java
  • src/main/java/com/jobdri/jobdri_api/domain/corpus/entity/CorpusClassificationMapping.java
  • src/main/java/com/jobdri/jobdri_api/domain/corpus/entity/MockJobPostingCorpus.java
  • src/main/java/com/jobdri/jobdri_api/domain/corpus/entity/MockQuestionCorpus.java
  • src/main/java/com/jobdri/jobdri_api/domain/corpus/service/CorpusImportService.java
  • src/main/java/com/jobdri/jobdri_api/domain/experience/entity/Experience.java
  • src/main/java/com/jobdri/jobdri_api/domain/jobposting/entity/JobPosting.java
  • src/main/java/com/jobdri/jobdri_api/domain/jobposting/entity/MockQuestionCache.java
  • src/main/java/com/jobdri/jobdri_api/domain/mockapply/entity/MockApply.java
  • src/main/java/com/jobdri/jobdri_api/domain/mockapply/entity/MockApplySequence.java
  • src/main/java/com/jobdri/jobdri_api/domain/payment/entity/CreditTransaction.java
  • src/main/java/com/jobdri/jobdri_api/domain/payment/entity/Payment.java
  • src/main/java/com/jobdri/jobdri_api/domain/user/entity/User.java
  • src/main/java/com/jobdri/jobdri_api/global/config/JpaAuditingConfig.java
  • src/main/java/com/jobdri/jobdri_api/global/entity/BaseEntity.java
  • src/main/java/com/jobdri/jobdri_api/global/entity/CreatedAtEntity.java

Comment thread src/main/java/com/jobdri/jobdri_api/global/entity/BaseEntity.java
@shinae1023 shinae1023 merged commit 6e50755 into main Jun 16, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant