Skip to content

Conversation

@cybervoid0
Copy link
Owner

Refactor: Reorganize project structure and consolidate server operations

What

Major refactoring to improve project structure and organization:

  • Renamed lib/ to server/ - Better reflects server-side nature of database operations
  • Consolidated server actions and queries - Moved all database operations to organized server/ directory
  • Removed redundant API routes - Eliminated /api/v2/report and /api/v2/upload/images in favor of Server Actions
  • Streamlined image handling - Simplified image upload and deletion processes
  • Cleaned up dependencies - Removed unused packages and utilities
  • Updated Prisma configuration - Removed deprecated driverAdapters preview feature
  • Improved form validation - Enhanced report handling with better error management

Why

  • Better organization: Server-side code is now clearly separated and logically grouped
  • Reduced complexity: Eliminated duplicate API routes in favor of simpler Server Actions
  • Improved maintainability: Cleaner project structure makes it easier to find and modify code
  • Performance: Removed unused dependencies and simplified data flow
  • Developer experience: More intuitive file organization and clearer separation of concerns

Ticket

Refactoring and code organization improvements


Files changed: 78 files with 670 additions and 933 deletions (net -263 lines)

- Removed obsolete API routes and services related to inaccuracy reports.
- Integrated new report fetching logic using async functions and Zod for validation.
- Updated the ReportList component to utilize the new report fetching method and improved pagination handling.
- Refactored the InaccuracyReport component to enhance form handling with Zod and improved UI components.
- Cleaned up imports and improved overall code organization across several files.
- Removed the export of InaccuracyReportListDTO from api.ts to streamline type definitions and improve code organization.
- Removed unnecessary previewFeatures line from the Prisma schema generator for cleaner configuration.
- Moved image-related functions from services/fetch to lib/images/actions for better structure and maintainability.
- Updated imports across various components to reflect the new location of image handling functions.
- Removed obsolete API routes and types related to image uploads to streamline the codebase.
- Moved various queries and actions from the lib directory to the server directory for improved organization and clarity.
- Updated import paths across multiple components to reflect the new structure.
- Removed obsolete files related to barometers, brands, categories, conditions, and reports to streamline the codebase.
- Removed the obsolete deleteImagesFromStorage function and replaced it with a direct call to deleteImages for improved clarity and maintainability.
- Updated the image fetching logic in deleteBarometer to select only the necessary URL field, enhancing performance and reducing data overhead.
@cybervoid0 cybervoid0 merged commit 4325991 into master Sep 14, 2025
1 check failed
@cybervoid0 cybervoid0 deleted the refactor branch September 14, 2025 05:26
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.

2 participants