Skip to content

Refactor employment-related DTOs and services: rename packages for be… - #74

Merged
codebyNorthsteep merged 2 commits into
mainfrom
enhancement/cleanupForms
Apr 20, 2026
Merged

Refactor employment-related DTOs and services: rename packages for be…#74
codebyNorthsteep merged 2 commits into
mainfrom
enhancement/cleanupForms

Conversation

@codebyNorthsteep

@codebyNorthsteep codebyNorthsteep commented Apr 20, 2026

Copy link
Copy Markdown
Contributor

This pull request removes the ReportForm and Attachment entities and all related DTOs, repositories, and services from the codebase. It also refactors the employment form feature to move DTOs to a new dto package and updates all relevant imports accordingly. These changes reflect a simplification of the form module by eliminating unused or deprecated entities and improving code organization.

Removal of ReportForm and Attachment functionality:

  • Deleted the ReportForm and Attachment entity classes, their DTOs, and associated repository and service classes, removing all code and database tables related to these features. [1] [2] [3] [4] [5] [6]

Refactor of EmploymentForm DTOs and Mappers:

  • Renamed and moved CreateEmploymentDTO, EmploymentFormDTO, and UpdateEmploymentDTO from the model package to a new dto package, updating all imports in controllers, services, mappers, and tests to use the new locations. [1] [2] [3] [4] F2c126edL1, [5] [6]

General code cleanup:

  • Removed now-unused imports of ReportForm, EmploymentForm, and related classes from the Staff model.…tter organization, update imports, and remove unused entities to enhance code maintainability.

Summary by CodeRabbit

Release Notes

  • Refactor

    • Internal code structure reorganization and cleanup
    • Removed unused code components
  • Chores

    • Added database migration for maintenance cleanup

…tter organization, update imports, and remove unused entities to enhance code maintainability.
@coderabbitai

coderabbitai Bot commented Apr 20, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@codebyNorthsteep has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 49 minutes and 50 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 49 minutes and 50 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, 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 have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f1fe3f1e-1ec2-495a-ab11-93547c57131f

📥 Commits

Reviewing files that changed from the base of the PR and between b3c5be7 and d55f095.

📒 Files selected for processing (1)
  • src/main/resources/db/migration/V9__remove_unused_entities.sql
📝 Walkthrough

Walkthrough

This PR restructures the form feature by relocating DTO classes to a dedicated dto package, removing unused report-related entities and infrastructure (ReportForm, Attachment, related DTOs, repository, and service), and adding a database migration to drop corresponding tables. Import statements are updated across affected files to reflect these changes.

Changes

Cohort / File(s) Summary
DTO Package Migration
src/main/java/org/example/cyberwatch/features/form/dto/CreateEmploymentDTO.java, src/main/java/org/example/cyberwatch/features/form/dto/EmploymentFormDTO.java, src/main/java/org/example/cyberwatch/features/form/dto/UpdateEmploymentDTO.java
Moved from model to dto package; package declarations updated for fully-qualified name changes.
Import Updates
src/main/java/org/example/cyberwatch/features/form/controller/EmploymentFormController.java, src/main/java/org/example/cyberwatch/features/form/service/EmploymentFormService.java, src/test/java/org/example/cyberwatch/features/form/service/EmploymentFormServiceTest.java
Updated imports to reference DTOs and mapper from new packages; replaced wildcard imports with explicit imports.
Mapper Reorganization
src/main/java/org/example/cyberwatch/features/form/mapper/EmploymentMapper.java
Package changed from model to mapper; added explicit imports for DTO and entity types.
Report Feature Removal
src/main/java/org/example/cyberwatch/features/form/model/ReportForm.java, src/main/java/org/example/cyberwatch/features/form/model/ReportFormDTO.java, src/main/java/org/example/cyberwatch/features/form/model/Attachment.java, src/main/java/org/example/cyberwatch/features/form/model/AttachmentDTO.java
Entirely removed JPA entities and DTOs for report forms and attachments including all fields, validation constraints, and Lombok annotations.
Repository & Service Cleanup
src/main/java/org/example/cyberwatch/features/form/repository/ReportFormRepository.java, src/main/java/org/example/cyberwatch/features/form/service/ReportFormService.java
Removed repository interface and service class for report form persistence and operations.
Database Migration
src/main/resources/db/migration/V9__remove_unused_entitys.sql
Added migration script to drop attachment and report_form tables with CASCADE.
Dependency Cleanup
src/main/java/org/example/cyberwatch/features/staff/model/Staff.java
Removed unused imports for EmploymentForm, ReportForm, Ticket, HashSet, and Set.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Suggested reviewers

  • Ericthilen
  • alicewersen-rgb
  • gitnes94

Poem

🐰 Hops through packages with glee,
Moving DTOs where they should be!
Unused reports hop away,
The codebase is cleaner today!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is partially related to the changeset. It mentions refactoring employment-related DTOs and renaming packages, which accurately describes the DTO reorganization aspect. However, it omits the significant removals of ReportForm, Attachment entities, and related classes—which constitute a substantial portion of the changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ 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 enhancement/cleanupForms

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: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/main/resources/db/migration/V9__remove_unused_entitys.sql`:
- Around line 1-2: The migration file V9__remove_unused_entitys.sql attempts to
drop the attachment table but the entity and code using it
(TicketAttachment.java, TicketService.java and usages of
ticketAttachmentRepository) still exist; remove all references and the
TicketAttachment entity (and related imports/usages in TicketService.java and
anywhere ticketAttachmentRepository is used) from the codebase before running
this migration, then rename the migration file to V9__remove_unused_entities.sql
and update the SQL to use uppercase keywords (DROP TABLE IF EXISTS attachment
CASCADE; DROP TABLE IF EXISTS report_form CASCADE;) to follow convention.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 55d8dff9-b09e-4196-a9ee-864704000002

📥 Commits

Reviewing files that changed from the base of the PR and between 5689417 and b3c5be7.

📒 Files selected for processing (15)
  • src/main/java/org/example/cyberwatch/features/form/controller/EmploymentFormController.java
  • src/main/java/org/example/cyberwatch/features/form/dto/CreateEmploymentDTO.java
  • src/main/java/org/example/cyberwatch/features/form/dto/EmploymentFormDTO.java
  • src/main/java/org/example/cyberwatch/features/form/dto/UpdateEmploymentDTO.java
  • src/main/java/org/example/cyberwatch/features/form/mapper/EmploymentMapper.java
  • src/main/java/org/example/cyberwatch/features/form/model/Attachment.java
  • src/main/java/org/example/cyberwatch/features/form/model/AttachmentDTO.java
  • src/main/java/org/example/cyberwatch/features/form/model/ReportForm.java
  • src/main/java/org/example/cyberwatch/features/form/model/ReportFormDTO.java
  • src/main/java/org/example/cyberwatch/features/form/repository/ReportFormRepository.java
  • src/main/java/org/example/cyberwatch/features/form/service/EmploymentFormService.java
  • src/main/java/org/example/cyberwatch/features/form/service/ReportFormService.java
  • src/main/java/org/example/cyberwatch/features/staff/model/Staff.java
  • src/main/resources/db/migration/V9__remove_unused_entitys.sql
  • src/test/java/org/example/cyberwatch/features/form/service/EmploymentFormServiceTest.java
💤 Files with no reviewable changes (7)
  • src/main/java/org/example/cyberwatch/features/staff/model/Staff.java
  • src/main/java/org/example/cyberwatch/features/form/repository/ReportFormRepository.java
  • src/main/java/org/example/cyberwatch/features/form/model/ReportFormDTO.java
  • src/main/java/org/example/cyberwatch/features/form/service/ReportFormService.java
  • src/main/java/org/example/cyberwatch/features/form/model/Attachment.java
  • src/main/java/org/example/cyberwatch/features/form/model/AttachmentDTO.java
  • src/main/java/org/example/cyberwatch/features/form/model/ReportForm.java

Comment thread src/main/resources/db/migration/V9__remove_unused_entitys.sql Outdated
@codebyNorthsteep
codebyNorthsteep merged commit 6b38b76 into main Apr 20, 2026
2 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request Apr 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant