Skip to content
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

Reorganize Models & Types #211

Open
6 tasks done
mahid797 opened this issue Feb 20, 2025 · 0 comments · May be fixed by #233
Open
6 tasks done

Reorganize Models & Types #211

mahid797 opened this issue Feb 20, 2025 · 0 comments · May be fixed by #233
Assignees
Labels
Cleanup Tasks for removing clutter and improving project structure. 🌱Nice-to-Have Enhancements, Refactors, UI tweaks, or non-critical optimizations
Milestone

Comments

@mahid797
Copy link
Collaborator

mahid797 commented Feb 20, 2025

The current models.ts file is a catch-all for various unrelated types (DocumentType, User, LinkDetail, etc.), which becomes unwieldy as the project grows. To enhance maintainability, this issue focuses on splitting models into domain-focused files and following a clean, scalable structure.


Tasks

  • Split models.ts into domain-specific files:

    • authModels.ts for authentication-related types.
    • documentModels.ts for document-related types.
    • linkModels.ts for link-related types.
    • userModels.ts for user data models.
  • Create an index.ts in the models/ folder to re-export models for cleaner imports.

  • Remove logic from model files:

    • Do not import icons or UI components in models; these should only define data structures.
  • Create a dedicated config file for icons and mappings (e.g., config/fileIcons.ts).

  • Identify and document new models used across the application and add them to the appropriate model files.

    📝 What is a model?
    Models define the structure of data objects (e.g., user data, document details, link information). They are typically used for type definitions, API request/response structures, or database schemas.

  • Review and update all references across the codebase to use the new model structure.


Example Directory Structure

src/shared/
├── models/
│   ├── authModels.ts
│   ├── documentModels.ts
│   ├── linkModels.ts
│   ├── userModels.ts
│   └── index.ts  // Re-exports for clean imports
└── config/
    └── fileIcons.ts  // File type to icon mapping

Guidelines

✅ Keep models purely for data structure definitions.
✅ Use a barrel file index.ts for centralized imports.
✅ Move any icon or file-related mappings into the config/ folder.


Benefits

✅ Easier to find, update, and manage types.
Cleaner imports with centralized re-exports.
✅ Prevents large, cluttered “mega files.”
Scalable as the project grows.

@mahid797 mahid797 added the Cleanup Tasks for removing clutter and improving project structure. label Feb 20, 2025
@mahid797 mahid797 added this to the v0.1 milestone Feb 20, 2025
@mahid797 mahid797 added the 🌱Nice-to-Have Enhancements, Refactors, UI tweaks, or non-critical optimizations label Feb 22, 2025
@SepidehShahbazi SepidehShahbazi linked a pull request Feb 25, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Cleanup Tasks for removing clutter and improving project structure. 🌱Nice-to-Have Enhancements, Refactors, UI tweaks, or non-critical optimizations
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants