Keep financial ownership, atomic publication and refresh CAS. Failed refresh leaves cookies untouched; logout still clears them. Remove full-history candle prefetch and special metadata retries. Use native Pino request context instead of parallel middleware. BREAKING CHANGE: remove investment stateVersion, queued sync state, and tbank-sync status progress/resources. Consumers must observe resources through sync=observe with the updated frontend contract.
24 lines
694 B
TypeScript
24 lines
694 B
TypeScript
import { ExecutionContext, Injectable } from '@nestjs/common';
|
|
import { AuthGuard } from '@nestjs/passport';
|
|
import { PinoLogger } from 'nestjs-pino';
|
|
|
|
import { AccessPayload } from '../application/auth.types';
|
|
|
|
@Injectable()
|
|
export class JwtAuthGuard extends AuthGuard('jwt') {
|
|
constructor(private readonly logger: PinoLogger) {
|
|
super();
|
|
}
|
|
|
|
async canActivate(context: ExecutionContext): Promise<boolean> {
|
|
const allowed = await super.canActivate(context);
|
|
const request = context
|
|
.switchToHttp()
|
|
.getRequest<{ user?: AccessPayload }>();
|
|
if (request.user?.sub) {
|
|
this.logger.assign({ userId: request.user.sub });
|
|
}
|
|
return Boolean(allowed);
|
|
}
|
|
}
|