Skip to content

Abstract application of access:uptime from API endpoint implementation #154

@justinkambic

Description

@justinkambic

Today, when we create a REST API endpoint, we specify a number of options like so:

export const createGetMonitorDurationRoute: UMRestApiRouteFactory = (libs: UMServerLibs) => ({
  method: 'GET',
  path: '/api/uptime/monitor/duration',
  validate: {
    query: schema.object({ ... }),
  },
  options: {
    tags: ['access:uptime'],
  },
  handler: async ({ callES }, _context, request, response): Promise<any> => { ...  },
});

Under options, we specify a tags field with access:uptime as the sole item. We need to specify this for all of our API functions, and it shouldn't be up to the implementer to make sure it gets done, as we already have a wrapper function that abstractions some other parts of the route creation.

We should add this abstraction to our existing wrapper.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions