Skip to content

Commit

Permalink
use route context for notify feature usage route
Browse files Browse the repository at this point in the history
  • Loading branch information
pgayvallet committed Aug 31, 2020
1 parent 49e01e1 commit 8e43d60
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
2 changes: 1 addition & 1 deletion x-pack/plugins/licensing/server/routes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ export function registerRoutes(
registerInfoRoute(router);
registerFeatureUsageRoute(router, getStartServices);
registerRegisterFeatureRoute(router, featureUsageSetup);
registerNotifyFeatureUsageRoute(router, getStartServices);
registerNotifyFeatureUsageRoute(router);
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,9 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { schema } from '@kbn/config-schema';
import { IRouter, StartServicesAccessor } from 'src/core/server';
import { LicensingPluginStart } from '../../types';
import { IRouter } from 'src/core/server';

export function registerNotifyFeatureUsageRoute(
router: IRouter,
getStartServices: StartServicesAccessor<{}, LicensingPluginStart>
) {
export function registerNotifyFeatureUsageRoute(router: IRouter) {
router.post(
{
path: '/internal/licensing/feature_usage/notify',
Expand All @@ -22,10 +18,9 @@ export function registerNotifyFeatureUsageRoute(
},
},
async (context, request, response) => {
const [, , { featureUsage }] = await getStartServices();
const { featureName, lastUsed } = request.body;

featureUsage.notifyUsage(featureName, lastUsed);
context.licensing.featureUsage.notifyUsage(featureName, lastUsed);

return response.ok({
body: {
Expand Down

0 comments on commit 8e43d60

Please sign in to comment.