feat: add portfolio
This commit is contained in:
@@ -4,6 +4,7 @@ import { Environment } from '../config/env.validation';
|
||||
import { PrismaService } from '../prisma/prisma.service';
|
||||
import { TbankClient } from './tbank.client';
|
||||
import { TbankCrypto } from './tbank.crypto';
|
||||
import { PortfolioService } from './portfolio.service';
|
||||
|
||||
@Injectable()
|
||||
export class TbankConnectionService {
|
||||
@@ -13,6 +14,7 @@ export class TbankConnectionService {
|
||||
private readonly prisma: PrismaService,
|
||||
config: ConfigService<Environment, true>,
|
||||
private readonly tbank: TbankClient,
|
||||
private readonly portfolio: PortfolioService,
|
||||
) {
|
||||
this.crypto = TbankCrypto.fromBase64(
|
||||
config.getOrThrow('TOKEN_ENCRYPTION_KEY'),
|
||||
@@ -52,6 +54,7 @@ export class TbankConnectionService {
|
||||
connectedAt: new Date(),
|
||||
},
|
||||
});
|
||||
this.portfolio.invalidate(userId);
|
||||
return {
|
||||
connected: true,
|
||||
connectedAt: connection.connectedAt.toISOString(),
|
||||
@@ -60,5 +63,6 @@ export class TbankConnectionService {
|
||||
|
||||
async delete(userId: string): Promise<void> {
|
||||
await this.prisma.tbankConnection.deleteMany({ where: { userId } });
|
||||
this.portfolio.invalidate(userId);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user