Skip to content

Commit

Permalink
Move strict to query params
Browse files Browse the repository at this point in the history
  • Loading branch information
ruscoder committed Nov 26, 2024
1 parent dc3e90b commit 03dc1de
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions ts/server/src/app.controller.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
import { Controller, Post, Body, HttpCode, UseFilters } from '@nestjs/common';
import { Controller, Post, Body, HttpCode, UseFilters, Query } from '@nestjs/common';
import { AppService } from './app.service';
import { Resource } from 'fhir/r4b';
import * as fhirpath_r4_model from 'fhirpath/fhir-context/r4';
import { FPMLValidationErrorFilter } from './app.filters';
class Template {
context: Record<string, Resource> | Resource;
template: object;

// TODO: deprecated in favor of Options
strict?: boolean;
}

class Options {
strict?: boolean;
}

Expand All @@ -22,29 +28,29 @@ export class AppController {

@Post(['parse-template', 'r4/parse-template'])
@HttpCode(200)
resolveTemplateR4(@Body() body: Template): object {
const { context, template, strict = false } = body;
resolveTemplateR4(@Body() body: Template, @Query() query: Options): object {
const { context, template, strict } = body;

return this.appService.resolveTemplate(
containsQuestionnaireResponse(context) ? context.QuestionnaireResponse : context,
template,
context,
fhirpath_r4_model,
strict,
query.strict ?? strict ?? false,
);
}

@Post('aidbox/parse-template')
@HttpCode(200)
resolveTemplateAidbox(@Body() body: Template): object {
const { context, template, strict = false } = body;
resolveTemplateAidbox(@Body() body: Template, @Query() query: Options): object {
const { context, template, strict } = body;

return this.appService.resolveTemplate(
containsQuestionnaireResponse(context) ? context.QuestionnaireResponse : context,
template,
context,
null,
strict,
query.strict ?? strict ?? false,
);
}
}

0 comments on commit 03dc1de

Please sign in to comment.