Skip to content

[Refactor]: Migrate apps/web/app/services to Typed OOP Classes in apps/web/core/services #3785

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

CREDO23
Copy link
Contributor

@CREDO23 CREDO23 commented May 1, 2025

Description

  • Migrate apps/web/core/service/client to new API service structure
  • Remove all (API) redundant suffixes on methods

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented on my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

@CREDO23 CREDO23 added enhancement New feature or request WEB Web app Improvement Improvement Ever Teams labels May 1, 2025
@CREDO23 CREDO23 self-assigned this May 1, 2025
Copy link
Contributor

coderabbitai bot commented May 1, 2025

Important

Review skipped

More than 25% of the files skipped due to max files limit. The review is being skipped to prevent a low-quality review.

67 files out of 174 files are above the max files limit of 100. Please upgrade to Pro plan to get higher limits.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@CREDO23 CREDO23 requested a review from NdekoCode May 1, 2025 16:17
@CREDO23 CREDO23 moved this to 👀 In review in Ever Teams Platform May 4, 2025
@CREDO23 CREDO23 marked this pull request as ready for review May 4, 2025 08:57
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This PR implements a significant architectural change, migrating the API service layer to a typed OOP class structure for better organization and type safety.

Key changes:

  • Created new APIService base class with standardized HTTP methods and error handling
  • Migrated all API functions to service classes (e.g. AuthService, TimerService) that extend APIService
  • Implemented proper TypeScript interfaces and removed redundant 'API' suffixes from method names
  • Added conditional endpoint handling based on GAUZY_API_BASE_SERVER_URL configuration
  • Consolidated related API methods into cohesive service classes with consistent patterns

Potential issues:

  • Several services have inconsistent error handling approaches
  • Some services use 'any' types instead of proper interfaces
  • The RequestToJoinTeam service has a typo in filename ('joi' vs 'join')
  • The TimeLogsService has swapped startDate/endDate parameters that could cause incorrect queries

170 file(s) reviewed, 94 comment(s)
Edit PR Review Bot Settings | Greptile

@NdekoCode NdekoCode marked this pull request as draft May 4, 2025 14:37
@CREDO23 CREDO23 marked this pull request as ready for review May 5, 2025 08:57
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

(updates since last review)

Based on the recent changes and previous review, I'll focus on the most important new or modified aspects not covered in the last summary:

Significant security and type safety improvements have been implemented across the authentication and API service layer.

  • Replaced Math.random() with crypto.randomBytes() in generate-token.ts for cryptographically secure token generation
  • Fixed critical Promise.reject handling in APIService request interceptor for proper error propagation
  • Corrected parameter mapping in TimeLogsService where startDate/todayStart were previously swapped
  • Fixed inconsistent null checks between HTTP methods in APIService base class
  • Added proper tenant and organization ID handling in request headers across all service classes

The changes demonstrate a focus on security and reliability while maintaining the architectural improvements from the previous review. These modifications address some of the potential issues mentioned earlier while introducing important security enhancements.

32 file(s) reviewed, 19 comment(s)
Edit PR Review Bot Settings | Greptile

@NdekoCode NdekoCode requested review from Innocent-Akim and evereq May 5, 2025 09:04
@NdekoCode
Copy link
Collaborator

NdekoCode commented May 5, 2025

@CREDO23 could you please fix bots suggestions and git conflicts ?

@CREDO23 CREDO23 force-pushed the 3773-task-migrate-appswebappservices-to-typed-oop-classes-in-appswebcoreservices branch from 570b9cf to e2409fd Compare May 5, 2025 09:23
@CREDO23 CREDO23 marked this pull request as draft May 5, 2025 10:10
@CREDO23 CREDO23 marked this pull request as ready for review May 5, 2025 10:14
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

Based on the recent changes and previous reviews, I'll focus on the most significant new modifications not covered in earlier summaries:

Fixed several critical typos and inconsistencies across the codebase to improve reliability and maintainability.

  • Fixed typo in task-linked-issue.ts by renaming createTaskLinkedIsssue to createTaskLinkedIssue
  • Added missing words 'Blandit', 'lobortis', and 'neque' to .cspell.json dictionary
  • Corrected duplicate 'I' prefix in IIInviteRequest interface name in IEmployee.ts
  • Fixed incorrect import path in request-to-join-team/index.ts ('joi' to 'join')

The changes focus on code quality improvements and bug fixes while maintaining the architectural improvements from previous reviews. These modifications help ensure consistent naming and proper spell checking across the codebase.

174 file(s) reviewed, 36 comment(s)
Edit PR Review Bot Settings | Greptile

@evereq evereq merged commit 851e713 into develop May 5, 2025
17 of 18 checks passed
@github-project-automation github-project-automation bot moved this from 👀 In review to ✅ Done in Ever Teams Platform May 5, 2025
@evereq evereq deleted the 3773-task-migrate-appswebappservices-to-typed-oop-classes-in-appswebcoreservices branch May 5, 2025 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Ever Teams Improvement Improvement WEB Web app
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[Task] Migrate apps/web/app/services to Typed OOP Classes in apps/web/core/services
3 participants