add frontend frame and service logic
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
import {ColumnDef, EndpointDef, Filter} from "../systemGenService";
|
||||
import {lowercaseFirstLetter} from "./helpers";
|
||||
import {lowercaseFirstLetter} from "../helpers";
|
||||
import {buildMapperFunctionName} from "./mapper-creator";
|
||||
|
||||
|
||||
@ -31,19 +31,21 @@ function buildServiceFunction(view: EndpointDef): string {
|
||||
return func;
|
||||
}
|
||||
|
||||
function getFuncParams(view: EndpointDef): string[] {
|
||||
function getFuncParams(view: EndpointDef, addTypes=false): string[] {
|
||||
let filters = view.filters || [];
|
||||
let columnList: ParamDef[] = view.columns?.filter((column) => {return column.param;}).map((column) => {
|
||||
return {
|
||||
param: column.param,
|
||||
required: column.required
|
||||
required: column.required,
|
||||
type: column.type
|
||||
};
|
||||
});
|
||||
|
||||
let filterList: ParamDef[] = filters.filter((column) => {return column.param;}).map((filter) => {
|
||||
return {
|
||||
param: filter.param,
|
||||
required: filter.required
|
||||
required: filter.required,
|
||||
type: filter.type
|
||||
};
|
||||
});
|
||||
|
||||
@ -62,6 +64,9 @@ function getFuncParams(view: EndpointDef): string[] {
|
||||
});
|
||||
|
||||
return combinedList.map((param) => {
|
||||
if (param.type && addTypes) {
|
||||
return `${param.param}: ${param.type}`;
|
||||
}
|
||||
return param.param || ''; // both lists have already been filtered so the value should never return as an empty string
|
||||
});
|
||||
}
|
||||
@ -77,6 +82,7 @@ function mapperInstance(view: EndpointDef): string {
|
||||
interface ParamDef {
|
||||
param?: string;
|
||||
required?: boolean;
|
||||
type?: string;
|
||||
}
|
||||
|
||||
export {
|
||||
|
Reference in New Issue
Block a user