Skip to content
This repository was archived by the owner on Aug 21, 2024. It is now read-only.

Conversation

@MoizAdnan
Copy link
Contributor

@MoizAdnan MoizAdnan commented Oct 11, 2023

Summary

🤖 Generated by Copilot at 040d9b7

This pull request refactors several database services and their resolvers to use the KnexService class and its public methods instead of the KnexAdapter class and its private methods. This improves the query performance, consistency, and maintainability of the code. It also simplifies the service initialization and the access to the app reference. The files affected by this pull request are location.class.ts, location.hooks.ts, bot.resolvers.ts, instance-friends.class.ts, instance.class.ts, instance.resolvers.ts, and location.ts.

References

#8871

Explanation

🤖 Generated by Copilot at 040d9b7

  • Replace private _find and _get methods with public find and get methods in various services and resolvers to avoid using internal API of feathersjs/knex adapter and to use standard service interface instead (link, link, link, link)
  • Remove unused imports and replace KnexAdapter with KnexService in location.class.ts to clean up the code and to use the KnexService class that extends the KnexAdapter class with custom methods (link, link, link)
  • Remove constructor and app property from LocationService class in location.class.ts to simplify the class and to avoid storing the app reference in the service instance (link)
  • Add imports for types and schemas in location.hooks.ts that are used in the new hooks (link)
  • Rename applyLocationSettingSort function to sortByLocationSetting and make it a regular hook instead of a middleware hook in location.hooks.ts to use the KnexService methods to apply the sorting logic to the query instead of the result (link, link)
  • Add hooks to find and create methods of location service in location.hooks.ts to add query parameters, validate and resolve the data, and insert the location data using the KnexService methods (link)
  • Add hooks to patch and remove methods of location service in location.hooks.ts to validate and resolve the data, update the location data using the KnexService methods, and remove the related location setting and location admin data (link)
  • Remove app parameter from LocationService constructor call in location.ts to simplify the service initialization and to avoid storing the app reference in the service instance (link)

🤖 Generated by Copilot at 040d9b7

To make the code more robust and clear
We refactored the services here
We used KnexService and find
And get methods of the same kind
And removed the app parameter

QA Steps

List any additional steps required to QA the changes of this PR, as well as any supplemental images or videos.

Checklist

  • If this PR is still a WIP, convert to a draft
  • When this PR is ready, mark it as "Ready for review"
  • ensure all checks pass
  • Changes have been manually QA'd
  • Changes reviewed by at least 2 approved reviewers

@MoizAdnan MoizAdnan marked this pull request as ready for review October 16, 2023 17:51
@hanzlamateen hanzlamateen merged commit d265eff into dev Oct 26, 2023
@hanzlamateen hanzlamateen deleted the location-hooks branch October 26, 2023 04:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants