Skip to content

Commit

Permalink
lint: deno fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Sorikairox committed Nov 9, 2022
1 parent c5a15b6 commit 3c0aa4b
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 17 deletions.
2 changes: 1 addition & 1 deletion example/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class FirstController {

@Get('sum')
getSum(
@Query('num', { value: 'array' }) numParams: string | string[],
@Query('num', { value: 'array' }) numParams: string | string[],
) {
const numString = Array.isArray(numParams) ? numParams : [numParams];
return this.sharedService.sum(numString.map((n) => Number(n)));
Expand Down
1 change: 0 additions & 1 deletion spec/auth-guard.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { Module } from '../src/module/decorator.ts';
import { Controller, Get } from '../src/router/controller/decorator.ts';
import { HttpContext } from '../src/router/router.ts';


@Injectable()
class SimpleService {
private a = 0;
Expand Down
2 changes: 0 additions & 2 deletions spec/exception-filter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { Controller, Get } from '../src/router/controller/decorator.ts';
import { HttpContext } from '../src/router/router.ts';
import { Injectable } from '../src/injector/injectable/decorator.ts';


@Injectable()
class SimpleService {
private a = 0;
Expand All @@ -25,7 +24,6 @@ class CustomException extends Error {

@Injectable()
class ErrorFilter implements ExceptionFilter {

constructor(private simpleService: SimpleService) {
}

Expand Down
2 changes: 1 addition & 1 deletion src/deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ export { ApplicationListenEvent } from 'https://deno.land/x/oak@v11.1.0/applicat
export {
Application,
Context,
type Middleware,
Response,
Router,
type Middleware,
} from 'https://deno.land/x/oak@v11.1.0/mod.ts';
export type { Route, State } from 'https://deno.land/x/oak@v11.1.0/mod.ts';
export { getQuery } from 'https://deno.land/x/oak@v11.1.0/helpers.ts';
Expand Down
19 changes: 11 additions & 8 deletions src/exception/filter/executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import { ControllerConstructor } from '../../router/controller/constructor.ts';
import { Callback, HttpContext } from '../../router/router.ts';
import { Constructor } from '../../utils/constructor.ts';
import {
filterCatchTypeMetadataKey, filterExceptionMetadataKey,
filterCatchTypeMetadataKey,
filterExceptionMetadataKey,
} from './decorator.ts';
import { ExceptionFilter } from './interface.ts';
import { Injector } from '../../injector/injector.ts';

export class FilterExecutor {

constructor(private injector: Injector) {
}

Expand Down Expand Up @@ -50,13 +50,16 @@ export class FilterExecutor {
// deno-lint-ignore ban-types
constructor: Constructor | Function,
): Promise<boolean> {
const FilterConstructor: Constructor<ExceptionFilter> = MetadataHelper.getMetadata<Constructor<ExceptionFilter>>(
filterExceptionMetadataKey,
constructor,
);
const FilterConstructor: Constructor<ExceptionFilter> = MetadataHelper
.getMetadata<Constructor<ExceptionFilter>>(
filterExceptionMetadataKey,
constructor,
);
if (FilterConstructor) {
await this.injector.registerInjectables([ FilterConstructor ]);
const filter: ExceptionFilter = this.injector.get<ExceptionFilter>(FilterConstructor);
await this.injector.registerInjectables([FilterConstructor]);
const filter: ExceptionFilter = this.injector.get<ExceptionFilter>(
FilterConstructor,
);
return this.executeFilter(filter, context, error);
}
return false;
Expand Down
10 changes: 7 additions & 3 deletions src/guard/executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,17 @@ export class GuardExecutor {
// deno-lint-ignore ban-types
constructor: Constructor | Function,
) {
const GuardConstructor: Constructor<AuthGuard> = MetadataHelper.getMetadata<Constructor<AuthGuard>>(
const GuardConstructor: Constructor<AuthGuard> = MetadataHelper.getMetadata<
Constructor<AuthGuard>
>(
guardMetadataKey,
constructor,
);
if (GuardConstructor) {
await this.injector.registerInjectables([ GuardConstructor ]);
const guardInstance: AuthGuard = this.injector.get<AuthGuard>(GuardConstructor);
await this.injector.registerInjectables([GuardConstructor]);
const guardInstance: AuthGuard = this.injector.get<AuthGuard>(
GuardConstructor,
);
await this.executeGuard(guardInstance, context);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/router/middleware/mod.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export * from './decorator.ts';
export * from './executor.ts';
export * from './global-container.ts';
export * from './global-container.ts';

0 comments on commit 3c0aa4b

Please sign in to comment.