Skip to content

Commit

Permalink
fix tsoa
Browse files Browse the repository at this point in the history
  • Loading branch information
cnuss committed May 10, 2022
1 parent 2fa47fb commit 562f1ed
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
11 changes: 4 additions & 7 deletions src/controllers/ControllerV1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
Controller,
Delete,
Get,
HttpStatusCodeLiteral,
Post,
Put,
Query,
Expand All @@ -19,8 +18,6 @@ import { StateLockRequest } from '../models/interfaces/StateLockRequest';
import { GithubService } from '../services/GithubService';
import { StateService } from '../services/StateService';

type HeaderType = { [key: string]: string | string[] };

@Route('/v1')
@Tags('v1')
export class ControllerV1 extends Controller {
Expand All @@ -38,7 +35,7 @@ export class ControllerV1 extends Controller {
public async getState(
@Request() request: HttpRequest,
@Res() res: TsoaResponse<200 | 400 | 401 | 404, any>,
): Promise<TsoaResponse<HttpStatusCodeLiteral, any, HeaderType>> {
): Promise<any> {
try {
const identity = await this.githubService.getIdentity(request);
const state = await this.stateService.getState(identity);
Expand All @@ -59,7 +56,7 @@ export class ControllerV1 extends Controller {
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
@Body() state: any,
@Res() res: TsoaResponse<200 | 400 | 401 | 404 | 409, void>,
): Promise<TsoaResponse<HttpStatusCodeLiteral, void, HeaderType>> {
): Promise<void> {
try {
const stateLockRequest = await this.stateService.getRequest(id);
const identity = await this.githubService.getIdentity(request, stateLockRequest);
Expand All @@ -79,7 +76,7 @@ export class ControllerV1 extends Controller {
@Request() request: HttpRequest,
@Body() lockRequest: StateLockRequest,
@Res() res: TsoaResponse<200 | 400 | 401 | 404 | 409, boolean>,
): Promise<TsoaResponse<HttpStatusCodeLiteral, boolean, HeaderType>> {
): Promise<boolean> {
try {
const stateLockRequest = await this.stateService.saveRequest(lockRequest);
const identity = await this.githubService.getIdentity(request, stateLockRequest);
Expand All @@ -99,7 +96,7 @@ export class ControllerV1 extends Controller {
@Request() request: HttpRequest,
@Body() lockRequest: StateLockRequest,
@Res() res: TsoaResponse<200 | 400 | 401 | 404 | 409, boolean>,
): Promise<TsoaResponse<HttpStatusCodeLiteral, boolean, HeaderType>> {
): Promise<boolean> {
try {
const stateLockRequest = await this.stateService.getRequest(lockRequest.ID);
const identity = await this.githubService.getIdentity(request, stateLockRequest);
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export class TerraformError extends Error {
super();
}

respond = (res: TsoaResponse<any, any>): TsoaResponse<any, any> => {
respond = (res: TsoaResponse<any, any>): any => {
if (!this.body) {
return res(this.statusCode, {});
}
Expand Down

0 comments on commit 562f1ed

Please sign in to comment.