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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(analytics): use hooks and resolvers #9028

Merged
merged 3 commits into from Oct 17, 2023

Conversation

aditya-mitra
Copy link
Collaborator

@aditya-mitra aditya-mitra commented Oct 10, 2023

Summary

馃 Generated by Copilot at edd0b45

The pull request migrates the analytics service to use the new KnexService class and the latest version of @feathersjs/knex, which simplifies the service logic and removes unnecessary dependencies. It also adds custom hooks for querying and returning analytics data for dailyUsers and dailyNewUsers metrics. The affected files are analytics.class.ts, analytics.hooks.ts, and analytics.ts in the packages/server-core/src/analytics/analytics directory.

References

closes part of #8871

Explanation

馃 Generated by Copilot at edd0b45

  • Migrate to the latest version of @feathersjs/knex and simplify the AnalyticsService class (link, link, link)
  • Move the custom logic for handling the dailyUsers and dailyNewUsers queries from the service class to the hook functions (link, link, link, link)
  • Use the discardQuery hook to remove the action query parameter after it is processed by the custom hooks (link, link)
  • Use the iff hook to conditionally apply the custom hooks based on the query parameter action (link)
  • Use the knexClient and the constants instanceAttendancePath and userPath to perform the database queries for the custom hooks (link)
  • Use the AnalyticsType and AnalyticsService types to type the hook context and the service instance (link)

馃 Generated by Copilot at edd0b45

AnalyticsService
Updated with KnexService
Simpler and faster

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

@hanzlamateen hanzlamateen merged commit f17abac into dev Oct 17, 2023
13 checks passed
@hanzlamateen hanzlamateen deleted the refactor/analytics-service-hooks branch October 17, 2023 05:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants