Merge pull request #16489 from abpframework/issue/15919

fix IRemoteStreamContent issue on generate service
pull/16568/head
Masum ULU 2 years ago committed by GitHub
commit eec5c34760
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,2 +1,5 @@
export const VOLO_REGEX = /^Volo\.Abp\.(Application\.Dtos|ObjectExtending)/;
export const VOLO_REMOTE_STREAM_CONTENT = 'Volo.Abp.Content.IRemoteStreamContent'
export const VOLO_REMOTE_STREAM_CONTENT = [
'Volo.Abp.Content.IRemoteStreamContent',
'Volo.Abp.Content.RemoteStreamContent',
];

@ -3,4 +3,5 @@ export enum eBindingSourceId {
Model = 'ModelBinding',
Path = 'Path',
Query = 'Query',
FormFile = 'FormFile',
}

@ -59,6 +59,7 @@ export class Body {
case eBindingSourceId.Query:
this.params.push(paramName === value ? value : `${getParamName(paramName)}: ${value}`);
break;
case eBindingSourceId.FormFile:
case eBindingSourceId.Body:
this.body = value;
break;
@ -78,7 +79,7 @@ export class Body {
}
isBlobMethod() {
return this.responseTypeWithNamespace === VOLO_REMOTE_STREAM_CONTENT;
return VOLO_REMOTE_STREAM_CONTENT.some(x => x === this.responseTypeWithNamespace);
}
private setUrlQuotes() {

@ -55,9 +55,12 @@ export function createControllerToServiceMapper({
function getTypesWithoutIRemoteStreamContent(types: Record<string, Type>) {
const newType = { ...types };
delete newType[VOLO_REMOTE_STREAM_CONTENT];
VOLO_REMOTE_STREAM_CONTENT.forEach(fileType => {
delete newType[fileType];
});
return newType;
}
function sortMethods(methods: Method[]) {
methods.sort((a, b) => (a.signature.name > b.signature.name ? 1 : -1));
}
@ -99,7 +102,13 @@ export function createActionToSignatureMapper() {
...action.parametersOnMethod,
...(versionParameter ? [versionParameter] : []),
];
signature.parameters = parameters.map(p => {
const isFormData = isRemoteStreamContent(p.type);
const isFormArray = isRemoteStreamContentArray(p.type);
if (isFormData || isFormArray) {
return new Property({ name: p.name, type: 'FormData' });
}
const type = adaptType(p.typeSimple);
const parameter = new Property({ name: p.name, type });
parameter.setDefault(p.defaultValue);
@ -112,6 +121,14 @@ export function createActionToSignatureMapper() {
};
}
export function isRemoteStreamContent(type: string) {
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 {
return action.uniqueName.split('Async')[0];
}

Loading…
Cancel
Save