Skip to content

Commit

Permalink
Merge pull request #157 from thiagobustamante/master
Browse files Browse the repository at this point in the history
update lint
  • Loading branch information
thiagobustamante authored Jul 13, 2018
2 parents 931adb8 + 5d05025 commit eb0f96f
Show file tree
Hide file tree
Showing 102 changed files with 1,092 additions and 1,210 deletions.
70 changes: 15 additions & 55 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"build": "npm run clean && tsc && npm run swagger && copyfiles -u 1 src/*.yaml dist",
"clean": "rimraf dist",
"lint": "tslint ./src/**/*.ts ./test/**/*.ts",
"format": "tsfmt -r",
"lint:fix": "tslint --fix ./src/**/*.ts ./test/**/*.ts -t verbose",
"postversion": "git push origin master",
"pretest": "cross-env NODE_ENV=test npm run build && npm run lint",
"swagger": "swaggerGen -c ./swagger.config.json",
Expand Down Expand Up @@ -153,9 +153,9 @@
"source-map-support": "^0.4.14",
"tough-cookie": "^2.3.4",
"ts-node": "^3.3.0",
"tslint": "^5.9.1",
"typescript": "2.7.1",
"typescript-formatter": "^5.2.0"
"tslint": "^5.10.0",
"tslint-config-prettier": "^1.13.0",
"typescript": "2.7.1"
},
"repository": {
"type": "git",
Expand All @@ -176,4 +176,4 @@
"node": ">=8.0.0"
},
"engineStrict": true
}
}
4 changes: 2 additions & 2 deletions src/admin/api/admin-api.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
'use strict';

import { MiddlewareRest } from './middleware';
import { APIRest } from './api';
import { ConfigPackageRest } from './config-package';
import { GatewayRest } from './gateway';
import { HealthCheck } from './health-check';
import { MiddlewareRest } from './middleware';
import { UsersRest } from './users';
import { GatewayRest } from './gateway';

export default [MiddlewareRest, APIRest, ConfigPackageRest, HealthCheck, UsersRest, GatewayRest];
16 changes: 8 additions & 8 deletions src/admin/api/api.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
'use strict';

import { Path, GET, POST, DELETE, PUT, PathParam, QueryParam, Return } from 'typescript-rest';
import { ApiConfig, validateApiConfig } from '../../config/api';
import { ApiService } from '../../service/api';
import { Inject } from 'typescript-ioc';
import { DELETE, GET, Path, PathParam, POST, PUT, QueryParam, Return } from 'typescript-rest';
import * as swagger from 'typescript-rest-swagger';
import { ApiConfig, validateApiConfig } from '../../config/api';
import { Configuration } from '../../configuration';
import { ApiService } from '../../service/api';

@Path('apis')
@swagger.Tags('APIs')
Expand All @@ -15,23 +15,23 @@ export class APIRest {
@Inject private config: Configuration;

@GET
list( @QueryParam('name') name?: string,
public list(@QueryParam('name') name?: string,
@QueryParam('version') version?: string,
@QueryParam('description') description?: string,
@QueryParam('path') path?: string): Promise<Array<ApiConfig>> {
return this.service.list(name, version, description, path);
}

@POST
async addApi(api: ApiConfig): Promise<Return.NewResource<void>> {
public async addApi(api: ApiConfig): Promise<Return.NewResource<void>> {
await validateApiConfig(api, this.config.gateway.disableApiIdValidation);
const apiId = await this.service.create(api);
return (new Return.NewResource<void>(`apis/${apiId}`));
}

@PUT
@Path('/:id')
async updateApi( @PathParam('id') id: string, api: ApiConfig): Promise<void> {
public async updateApi(@PathParam('id') id: string, api: ApiConfig): Promise<void> {
api.id = id;

await validateApiConfig(api, this.config.gateway.disableApiIdValidation);
Expand All @@ -40,13 +40,13 @@ export class APIRest {

@DELETE
@Path('/:id')
async removeApi( @PathParam('id') id: string): Promise<void> {
public async removeApi(@PathParam('id') id: string): Promise<void> {
await this.service.remove(id);
}

@GET
@Path('/:id')
async getApi( @PathParam('id') id: string): Promise<ApiConfig> {
public async getApi(@PathParam('id') id: string): Promise<ApiConfig> {
return await this.service.get(id);
}
}
10 changes: 5 additions & 5 deletions src/admin/api/config-package.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
'use strict';

import { Path, GET, POST } from 'typescript-rest';
import { ConfigPackage, validateConfigPackage } from '../../config/config-package';
import { ConfigPackageService } from '../../service/config-package';
import { Inject } from 'typescript-ioc';
import { GET, Path, POST } from 'typescript-rest';
import * as swagger from 'typescript-rest-swagger';
import { ConfigPackage, validateConfigPackage } from '../../config/config-package';
import { ConfigPackageService } from '../../service/config-package';

@Path('config')
@swagger.Tags('Config')
Expand All @@ -13,13 +13,13 @@ export class ConfigPackageRest {
@Inject private service: ConfigPackageService;

@POST
async set(config: ConfigPackage): Promise<void> {
public async set(config: ConfigPackage): Promise<void> {
await validateConfigPackage(config);
await this.service.set(config);
}

@GET
async get(): Promise<ConfigPackage> {
public async get(): Promise<ConfigPackage> {
return await this.service.get();
}
}
12 changes: 6 additions & 6 deletions src/admin/api/gateway.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
'use strict';

import { Path, GET, DELETE, PUT } from 'typescript-rest';
import { GatewayConfig, validateGatewayConfig } from '../../config/gateway';
import { GatewayService } from '../../service/gateway';
import { Inject } from 'typescript-ioc';
import { DELETE, GET, Path, PUT } from 'typescript-rest';
import * as swagger from 'typescript-rest-swagger';
import { GatewayConfig, validateGatewayConfig } from '../../config/gateway';
import { GatewayService } from '../../service/gateway';

@Path('gateway')
@swagger.Tags('Gateway')
Expand All @@ -13,18 +13,18 @@ export class GatewayRest {
@Inject private service: GatewayService;

@PUT
async updateConfig(config: GatewayConfig): Promise<void> {
public async updateConfig(config: GatewayConfig): Promise<void> {
await validateGatewayConfig(config);
await this.service.save(config);
}

@DELETE
async removeConfig(): Promise<void> {
public async removeConfig(): Promise<void> {
await this.service.remove();
}

@GET
async getConfig(): Promise<GatewayConfig> {
public async getConfig(): Promise<GatewayConfig> {
return await this.service.read();
}
}
6 changes: 3 additions & 3 deletions src/admin/api/health-check.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
'use strict';

import { Path, GET, Errors } from 'typescript-rest';
import { Inject } from 'typescript-ioc';
import { Database } from '../../database';
import { Errors, GET, Path } from 'typescript-rest';
import * as swagger from 'typescript-rest-swagger';
import { Database } from '../../database';

@Path('healthcheck')
@swagger.Tags('Miscellaneous')
export class HealthCheck {
@Inject private database: Database;

@GET
async check(): Promise<string> {
public async check(): Promise<string> {
try {
await this.database.redisClient.ping();
return 'OK';
Expand Down
Loading

0 comments on commit eb0f96f

Please sign in to comment.