diff --git a/npm/ng-packs/.vscode/settings.json b/npm/ng-packs/.vscode/settings.json index 47b4042ef7..37d9a1e403 100644 --- a/npm/ng-packs/.vscode/settings.json +++ b/npm/ng-packs/.vscode/settings.json @@ -6,6 +6,7 @@ "typescript.tsdk": "../node_modules/typescript/lib", "workbench.colorCustomizations": { "activityBar.background": "#258ecd", + "activityBar.activeBorder": "#f0aed7", "activityBar.foreground": "#e7e7e7", "activityBar.inactiveForeground": "#e7e7e799", "activityBarBadge.background": "#f0aed7", diff --git a/npm/packs/client-generator/src/angular.ts b/npm/packs/client-generator/src/angular.ts index a81ea7961c..9a2a6fd8b8 100644 --- a/npm/packs/client-generator/src/angular.ts +++ b/npm/packs/client-generator/src/angular.ts @@ -8,13 +8,26 @@ export async function angular(data: APIDefination.Response, selectedModules: str const element = data.modules[module]; let contents = [] as string[]; - (Object.keys(element.controllers) || []).forEach(key => { - console.warn(element.controllers[key].controllerName); - contents.push(' '); + const actions = (Object.keys(element.controllers) || []).map(key => element.controllers[key].actions); + + actions.forEach(action => { + const actionKeys = Object.keys(action); + actionKeys.forEach(key => { + const element = action[key]; + console.log(element); + + switch (element.httpMethod) { + case 'GET': + contents.push(ServiceTemplates.getMethodTemplate(element.name, element.url)); + break; + + default: + break; + } + }); }); - const service = ServiceTemplates.classTemplate(element.rootPath, contents); - await fse.writeFile(`${changeCase.kebabCase(element.rootPath + '-service')}.ts`, service); - console.log(service); + const service = ServiceTemplates.classTemplate(element.rootPath, contents.join('\n')); + await fse.writeFile(`dist/${changeCase.kebabCase(element.rootPath)}.service.ts`, service); }); } diff --git a/npm/packs/client-generator/src/utils/axios.ts b/npm/packs/client-generator/src/utils/axios.ts index 781ec93044..2ac4782e08 100644 --- a/npm/packs/client-generator/src/utils/axios.ts +++ b/npm/packs/client-generator/src/utils/axios.ts @@ -2105,5 +2105,5 @@ axiosInstance.get = (...ar) => new Promise(resolve => { } } } as any) - }, 1000); + }, 0); }) \ No newline at end of file