Skip to content

Commit 98aaf59

Browse files
committed
fix: resolve merge regressions and Prisma type gaps in transactions/auth services (#891)
- Restore two try blocks left without catch handlers after merging main (transactions.service.ts: recordOnBlockchain, verifyOnBlockchain) - Remove duplicate/conflicting 'updated' declaration in update() - Restore transaction-not-found check dropped from update() during the merge - Restore nextCursor/previousCursor pagination fields dropped from findAll() during the merge - Fix TypeScript errors from Prisma client not re-exporting model types and enums under the Prisma namespace in this generator version (Transaction, TransactionTaxStrategy, TransactionType, TransactionStatus in transactions.service.ts; BlacklistedToken, Document, ApiKey, PasswordHistory in auth.service.ts) - Add explicit guard rejecting TransactionStatusDto.FAILED, which has no corresponding value in the Prisma schema's TransactionStatus enum - Use existing this.toNumber() helper for Decimal conversion instead of calling .toNumber() directly, matching the pattern already used in getAnalytics() - Normalize nullable Prisma fields (blockchainHash, contractAddress, notes) to undefined to match TransactionResponseDto's optional fields - Remove remaining 'as any' cast in findAll()'s cursor construction - Fix misplaced docstring on updateEscrow() and restore its unused-param lint suppression
1 parent 13b6d46 commit 98aaf59

2 files changed

Lines changed: 132 additions & 109 deletions

File tree

src/auth/auth.service.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
UnauthorizedException,
88
} from '@nestjs/common';
99
import { ConfigService } from '@nestjs/config';
10-
import { Prisma } from '@prisma/client';
10+
import { Prisma, BlacklistedToken, Document, ApiKey, PasswordHistory } from '@prisma/client';
1111
import { randomUUID } from 'crypto';
1212
import * as jwt from 'jsonwebtoken';
1313
import { PrismaService } from '../database/prisma.service';
@@ -515,7 +515,7 @@ export class AuthService {
515515
* Handle token reuse detection - invalidate entire token family
516516
*/
517517
private async handleTokenReuse(
518-
blacklistedToken: Prisma.BlacklistedToken,
518+
blacklistedToken: BlacklistedToken,
519519
reusedJti: string,
520520
ipAddress?: string,
521521
userAgent?: string,
@@ -796,7 +796,7 @@ export class AuthService {
796796
const recentActivity = [
797797
...this.transactionsToActivityItems(buyerTransactions, 'purchase'),
798798
...this.transactionsToActivityItems(sellerTransactions, 'sale'),
799-
...documents.map((doc: Prisma.Document) => ({
799+
...documents.map((doc: Document) => ({
800800
type: 'document' as const,
801801
id: doc.id,
802802
title: doc.fileName,
@@ -1081,7 +1081,7 @@ export class AuthService {
10811081
orderBy: { createdAt: 'desc' },
10821082
});
10831083

1084-
return apiKeys.map((apiKey: Prisma.ApiKey) => this.toApiKeyResponse(apiKey));
1084+
return apiKeys.map((apiKey: ApiKey) => this.toApiKeyResponse(apiKey));
10851085
}
10861086

10871087
async rotateApiKey(user: AuthUserPayload, apiKeyId: string) {
@@ -1451,7 +1451,7 @@ export class AuthService {
14511451
return `pc_${randomToken(24)}`;
14521452
}
14531453

1454-
private toApiKeyResponse(apiKey: Prisma.ApiKey) {
1454+
private toApiKeyResponse(apiKey: ApiKey) {
14551455
return {
14561456
id: apiKey.id,
14571457
name: apiKey.name,
@@ -1595,7 +1595,7 @@ export class AuthService {
15951595
if (historyEntries.length > 0) {
15961596
await tx.passwordHistory.deleteMany({
15971597
where: {
1598-
id: { in: historyEntries.map((entry: Prisma.PasswordHistory) => entry.id) },
1598+
id: { in: historyEntries.map((entry: PasswordHistory) => entry.id) },
15991599
},
16001600
});
16011601
}

0 commit comments

Comments
 (0)