Browse Source

fix IRemoteStreamContent[] issue on generate service

pull/16489/head
Mahmut Gundogdu 3 years ago
parent
commit
98fa8e0641
  1. 13
      npm/ng-packs/packages/schematics/src/utils/service.ts

13
npm/ng-packs/packages/schematics/src/utils/service.ts

@ -104,11 +104,10 @@ export function createActionToSignatureMapper() {
]; ];
signature.parameters = parameters.map(p => { signature.parameters = parameters.map(p => {
const isFormData = isRemoteStreamContent(p.typeSimple); const isFormData = isRemoteStreamContent(p.type);
if (isFormData) { const isFormArray = isRemoteStreamContentArray(p.type);
const formDataParameter = new Property({ name: p.name, type: 'FormData' }); if (isFormData || isFormArray) {
formDataParameter.setOptional(false); return new Property({ name: p.name, type: 'FormData' });
return formDataParameter;
} }
const type = adaptType(p.typeSimple); const type = adaptType(p.typeSimple);
const parameter = new Property({ name: p.name, type }); const parameter = new Property({ name: p.name, type });
@ -126,6 +125,10 @@ export function isRemoteStreamContent(type: string) {
return VOLO_REMOTE_STREAM_CONTENT.some(x => x === type); return VOLO_REMOTE_STREAM_CONTENT.some(x => x === type);
} }
export function isRemoteStreamContentArray(type: string) {
return VOLO_REMOTE_STREAM_CONTENT.map(x => `${x}[]`).some(x => x === type);
}
function getMethodNameFromAction(action: Action): string { function getMethodNameFromAction(action: Action): string {
return action.uniqueName.split('Async')[0]; return action.uniqueName.split('Async')[0];
} }

Loading…
Cancel
Save