diff --git a/lib/exceptions/intentExceptionFilter.ts b/lib/exceptions/intentExceptionFilter.ts index 6245c40..d105245 100644 --- a/lib/exceptions/intentExceptionFilter.ts +++ b/lib/exceptions/intentExceptionFilter.ts @@ -30,7 +30,6 @@ export abstract class IntentExceptionFilter extends BaseExceptionFilter { reportToSentry(exception: any): void { const sentryConfig = IntentConfig.get('app.sentry'); - console.log(sentryConfig); if (!sentryConfig?.dsn) return; const exceptionConstructor = exception?.constructor; @@ -39,7 +38,6 @@ export abstract class IntentExceptionFilter extends BaseExceptionFilter { exceptionConstructor && !this.doNotReport().includes(exceptionConstructor) ) { - console.log(exceptionConstructor); sentry.captureException(exception); } } diff --git a/lib/rest/request.ts b/lib/rest/request.ts index 164463e..63f1405 100644 --- a/lib/rest/request.ts +++ b/lib/rest/request.ts @@ -12,12 +12,14 @@ export class Request { private $body: Record; private $dto: any; private id: string; + private $user: Record; constructor(private request: ERequest) { this.$payload = {}; this.$headers = {}; this.initiate(request); this.id = ulid(); + this.$user = null; this.$query = request.query; this.$body = request.body; this.$pathParams = request.params; @@ -88,7 +90,7 @@ export class Request { bearerToken(): string { const authHeader = this.$headers['authorization']; const asArray = authHeader?.split(' '); - return !isEmpty(asArray) && asArray(' ')[1]; + return !isEmpty(asArray) && asArray[1]; } host(): string { @@ -154,6 +156,14 @@ export class Request { .validate({ ...this.all() }); } + setUser(user: any): void { + this.$user = user; + } + + user(): T { + return this.$user as T; + } + only(...keys: string[]): Record { return {}; }