Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

Commit

Permalink
pass RequestContext to typeSearch to follow the latest interface
Browse files Browse the repository at this point in the history
  • Loading branch information
carvantes committed May 20, 2021
1 parent ba818e1 commit cd74f47
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/operationDefinitions/USCoreDocRef/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import express from 'express';
import { KeyValueMap, TypeOperation } from 'fhir-works-on-aws-interface';
import { KeyValueMap, RequestContext, TypeOperation } from 'fhir-works-on-aws-interface';
import { OperationDefinitionImplementation } from '../types';
import ResourceHandler from '../../router/handlers/resourceHandler';
import RouteHelper from '../../router/routes/routeHelper';
Expand All @@ -14,9 +14,14 @@ import { convertDocRefParamsToSearchParams } from './convertDocRefParamsToSearch

const searchTypeOperation: TypeOperation = 'search-type';

const docRefImpl = async (resourceHandler: ResourceHandler, userIdentity: KeyValueMap, params: DocRefParams) => {
const docRefImpl = async (
resourceHandler: ResourceHandler,
userIdentity: KeyValueMap,
params: DocRefParams,
requestContext: RequestContext,
) => {
const searchParams = convertDocRefParamsToSearchParams(params);
return resourceHandler.typeSearch('DocumentReference', searchParams, userIdentity);
return resourceHandler.typeSearch('DocumentReference', searchParams, userIdentity, requestContext);
};

export const USCoreDocRef: OperationDefinitionImplementation = {
Expand All @@ -42,6 +47,7 @@ export const USCoreDocRef: OperationDefinitionImplementation = {
resourceHandler,
res.locals.userIdentity,
parseQueryParams(req.query),
res.locals.requestContext,
);
res.send(response);
}),
Expand All @@ -50,7 +56,12 @@ export const USCoreDocRef: OperationDefinitionImplementation = {
router.post(
path,
RouteHelper.wrapAsync(async (req: express.Request, res: express.Response) => {
const response = await docRefImpl(resourceHandler, res.locals.userIdentity, parsePostParams(req.body));
const response = await docRefImpl(
resourceHandler,
res.locals.userIdentity,
parsePostParams(req.body),
res.locals.requestContext,
);
res.send(response);
}),
);
Expand Down

0 comments on commit cd74f47

Please sign in to comment.