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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EMBCESSMOD-5633 - Api Generation fixed for Responder portal #2416

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions responders/src/API/EMBC.Responders.API/Configuration.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
using System;
using System.Reflection;
using System.Security.Claims;
using System.Threading.Tasks;
using System.Text.Json;
using System.Text.Json.Serialization;
using EMBC.Responders.API.Services;
using EMBC.Utilities.Configuration;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.IdentityModel.Logging;
using Microsoft.IdentityModel.Tokens;
using Microsoft.OpenApi.Models;
Expand All @@ -23,6 +24,12 @@ public void ConfigureServices(ConfigurationServices configurationServices)
{
var services = configurationServices.Services;

services.Configure<JsonOptions>(opts =>
{
opts.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter());
opts.JsonSerializerOptions.PropertyNamingPolicy = JsonNamingPolicy.CamelCase;
});

services.AddAuthentication(options =>
{
options.DefaultScheme = JwtBearerDefaults.AuthenticationScheme;
Expand Down Expand Up @@ -52,7 +59,7 @@ public void ConfigureServices(ConfigurationServices configurationServices)
var userService = c.HttpContext.RequestServices.GetRequiredService<IUserService>();
c.Principal = await userService.GetPrincipal(c.Principal);
}
};
};
options.Validate();
});
services.AddAuthorization(options =>
Expand Down Expand Up @@ -94,7 +101,6 @@ public void ConfigureServices(ConfigurationServices configurationServices)
});
opts.CustomOperationIds(apiDesc => apiDesc.TryGetMethodInfo(out MethodInfo methodInfo) ? $"{apiDesc.ActionDescriptor.RouteValues["controller"]}{methodInfo.Name}" : null);
opts.OperationFilter<ContentTypeOperationFilter>();
opts.UseOneOfForPolymorphism();
opts.UseAllOfForInheritance();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
using EMBC.Utilities.Extensions;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations;

namespace EMBC.Responders.API.Controllers;

Expand Down Expand Up @@ -179,11 +180,13 @@ public async Task<ActionResult<ReferralPrintRequestResponse>> ReprintSupport(str
/// <param name="fileId">evacuation file number</param>
/// <param name="printRequestId">print request id</param>
/// <returns>Blob of the print request results</returns>
[SwaggerResponse((int)HttpStatusCode.OK, "GetPrint", typeof(FileContentResult))]
[HttpGet("files/{fileId}/supports/print/{printRequestId}")]
public async Task<FileContentResult> GetPrint(string fileId, string printRequestId)
{
var result = await messagingClient.Send(new PrintRequestQuery { PrintRequestId = printRequestId, RequestingUserId = currentUserId });
Response.Headers.Append("Content-Disposition", "attachment;filename=" + result.FileName);
Response.Headers.Append("Content-Type", "application/octet-stream");
return new FileContentResult(result.Content, result.ContentType);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.7" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.6.2" />
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="6.6.2" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { StrictHttpResponse } from '../../strict-http-response';
import { RequestBuilder } from '../../request-builder';

import { Code } from '../../models/code';
import { CommunityCode } from '../../models/community-code';

export interface ConfigurationGetCodes$Params {
forEnumType?: string;
Expand All @@ -18,7 +17,7 @@ export function configurationGetCodes(
rootUrl: string,
params?: ConfigurationGetCodes$Params,
context?: HttpContext
): Observable<StrictHttpResponse<Array<Code | CommunityCode>>> {
): Observable<StrictHttpResponse<Array<Code>>> {
const rb = new RequestBuilder(rootUrl, configurationGetCodes.PATH, 'get');
if (params) {
rb.query('forEnumType', params.forEnumType, {});
Expand All @@ -27,7 +26,7 @@ export function configurationGetCodes(
return http.request(rb.build({ responseType: 'json', accept: 'application/json', context })).pipe(
filter((r: any): r is HttpResponse<any> => r instanceof HttpResponse),
map((r: HttpResponse<any>) => {
return r as StrictHttpResponse<Array<Code | CommunityCode>>;
return r as StrictHttpResponse<Array<Code>>;
})
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,7 @@ import { StrictHttpResponse } from '../../strict-http-response';
import { RequestBuilder } from '../../request-builder';

export interface RegistrationsGetPrint$Params {
/**
* evacuation file number
*/
fileId: string;

/**
* print request id
*/
printRequestId: string;
}

Expand All @@ -30,7 +23,7 @@ export function registrationsGetPrint(
rb.path('printRequestId', params.printRequestId, {});
}

return http.request(rb.build({ responseType: 'blob', accept: 'application/octet-stream', context })).pipe(
return http.request(rb.build({ responseType: 'blob', accept: 'application/json', context })).pipe(
filter((r: any): r is HttpResponse<any> => r instanceof HttpResponse),
map((r: HttpResponse<any>) => {
return r as StrictHttpResponse<Blob>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,7 @@ import { filter, map } from 'rxjs/operators';
import { StrictHttpResponse } from '../../strict-http-response';
import { RequestBuilder } from '../../request-builder';

import { ClothingSupport } from '../../models/clothing-support';
import { FoodGroceriesSupport } from '../../models/food-groceries-support';
import { FoodRestaurantSupport } from '../../models/food-restaurant-support';
import { IncidentalsSupport } from '../../models/incidentals-support';
import { LodgingAllowanceSupport } from '../../models/lodging-allowance-support';
import { LodgingBilletingSupport } from '../../models/lodging-billeting-support';
import { LodgingGroupSupport } from '../../models/lodging-group-support';
import { LodgingHotelSupport } from '../../models/lodging-hotel-support';
import { TransportationOtherSupport } from '../../models/transportation-other-support';
import { TransportationTaxiSupport } from '../../models/transportation-taxi-support';
import { Support } from '../../models/support';

export interface RegistrationsSearchSupports$Params {
manualReferralId?: string;
Expand All @@ -27,22 +18,7 @@ export function registrationsSearchSupports(
rootUrl: string,
params?: RegistrationsSearchSupports$Params,
context?: HttpContext
): Observable<
StrictHttpResponse<
Array<
| ClothingSupport
| IncidentalsSupport
| FoodGroceriesSupport
| FoodRestaurantSupport
| LodgingHotelSupport
| LodgingBilletingSupport
| LodgingGroupSupport
| LodgingAllowanceSupport
| TransportationTaxiSupport
| TransportationOtherSupport
>
>
> {
): Observable<StrictHttpResponse<Array<Support>>> {
const rb = new RequestBuilder(rootUrl, registrationsSearchSupports.PATH, 'get');
if (params) {
rb.query('manualReferralId', params.manualReferralId, {});
Expand All @@ -52,20 +28,7 @@ export function registrationsSearchSupports(
return http.request(rb.build({ responseType: 'json', accept: 'application/json', context })).pipe(
filter((r: any): r is HttpResponse<any> => r instanceof HttpResponse),
map((r: HttpResponse<any>) => {
return r as StrictHttpResponse<
Array<
| ClothingSupport
| IncidentalsSupport
| FoodGroceriesSupport
| FoodRestaurantSupport
| LodgingHotelSupport
| LodgingBilletingSupport
| LodgingGroupSupport
| LodgingAllowanceSupport
| TransportationTaxiSupport
| TransportationOtherSupport
>
>;
return r as StrictHttpResponse<Array<Support>>;
})
);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/* tslint:disable */
/* eslint-disable */
import { CommunityCode } from '../models/community-code';
export interface Code {
description?: string | null;
isActive?: boolean;
parentCode?: (Code | CommunityCode) | null;
parentCode?: Code;
type?: string | null;
value?: string | null;
}
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
/* tslint:disable */
/* eslint-disable */
import { Address } from '../models/address';
import { ClothingSupport } from '../models/clothing-support';
import { EvacuationFileHouseholdMember } from '../models/evacuation-file-household-member';
import { EvacuationFileStatus } from '../models/evacuation-file-status';
import { EvacuationFileTask } from '../models/evacuation-file-task';
import { FoodGroceriesSupport } from '../models/food-groceries-support';
import { FoodRestaurantSupport } from '../models/food-restaurant-support';
import { IncidentalsSupport } from '../models/incidentals-support';
import { LodgingAllowanceSupport } from '../models/lodging-allowance-support';
import { LodgingBilletingSupport } from '../models/lodging-billeting-support';
import { LodgingGroupSupport } from '../models/lodging-group-support';
import { LodgingHotelSupport } from '../models/lodging-hotel-support';
import { NeedsAssessment } from '../models/needs-assessment';
import { Note } from '../models/note';
import { TransportationOtherSupport } from '../models/transportation-other-support';
import { TransportationTaxiSupport } from '../models/transportation-taxi-support';
import { Support } from '../models/support';
export interface EvacuationFile {
completedBy?: string | null;
completedOn?: string | null;
Expand All @@ -35,17 +26,6 @@ export interface EvacuationFile {
securityPhrase?: string | null;
securityPhraseEdited?: boolean | null;
status?: EvacuationFileStatus;
supports?: Array<
| ClothingSupport
| IncidentalsSupport
| FoodGroceriesSupport
| FoodRestaurantSupport
| LodgingHotelSupport
| LodgingBilletingSupport
| LodgingGroupSupport
| LodgingAllowanceSupport
| TransportationTaxiSupport
| TransportationOtherSupport
> | null;
supports?: Array<Support> | null;
task: EvacuationFileTask;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
import { Support } from '../models/support';
export interface ProcessDigitalSupportsRequest {
includeSummaryInPrintRequest?: boolean;
supports?: Array<Support>;
supports?: Array<Support> | null;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
/* eslint-disable */
import { Support } from '../models/support';
export interface ProcessPaperReferralsRequest {
referrals?: Array<Support>;
referrals?: Array<Support> | null;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
/* eslint-disable */
export enum SupportSubCategory {
None = 'None',
Lodging_Hotel = 'Lodging_Hotel',
Lodging_Billeting = 'Lodging_Billeting',
Lodging_Group = 'Lodging_Group',
Lodging_Allowance = 'Lodging_Allowance',
Food_Groceries = 'Food_Groceries',
Food_Restaurant = 'Food_Restaurant',
Transportation_Taxi = 'Transportation_Taxi',
Transportation_Other = 'Transportation_Other'
LodgingHotel = 'Lodging_Hotel',
LodgingBilleting = 'Lodging_Billeting',
LodgingGroup = 'Lodging_Group',
LodgingAllowance = 'Lodging_Allowance',
FoodGroceries = 'Food_Groceries',
FoodRestaurant = 'Food_Restaurant',
TransportationTaxi = 'Transportation_Taxi',
TransportationOther = 'Transportation_Other'
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export class ConfigurationService extends BaseService {
configurationGetCodes$Response(
params?: ConfigurationGetCodes$Params,
context?: HttpContext
): Observable<StrictHttpResponse<Array<Code | CommunityCode>>> {
): Observable<StrictHttpResponse<Array<Code>>> {
return configurationGetCodes(this.http, this.rootUrl, params, context);
}

Expand All @@ -89,12 +89,9 @@ export class ConfigurationService extends BaseService {
*
* This method doesn't expect any request body.
*/
configurationGetCodes(
params?: ConfigurationGetCodes$Params,
context?: HttpContext
): Observable<Array<Code | CommunityCode>> {
configurationGetCodes(params?: ConfigurationGetCodes$Params, context?: HttpContext): Observable<Array<Code>> {
return this.configurationGetCodes$Response(params, context).pipe(
map((r: StrictHttpResponse<Array<Code | CommunityCode>>): Array<Code | CommunityCode> => r.body)
map((r: StrictHttpResponse<Array<Code>>): Array<Code> => r.body)
);
}

Expand Down
Loading