Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions packages/backend/src/admin/admin.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,16 @@ export class AdminService {
}
const hasDateFilter = Object.keys(dateFilter).length > 0;

// Build included tx types based on params
const includedTxTypes: TxType[] = [TxType.TRANSFER, TxType.BATCH];
if (dto?.includeSignerOps) {
includedTxTypes.push(
TxType.ADD_SIGNER,
TxType.REMOVE_SIGNER,
TxType.SET_THRESHOLD,
);
}

// 1. LOGIN records
if (dto?.includeLogin) {
const loginRecords = await this.prisma.loginHistory.findMany({
Expand Down Expand Up @@ -136,10 +146,11 @@ export class AdminService {
.map((a) => a.signers[0]?.user.commitment)
.filter(Boolean);

// 3. APPROVE votes
// 3. APPROVE votes (filtered by includedTxTypes)
const approveVotes = await this.prisma.vote.findMany({
where: {
voteType: VoteType.APPROVE,
transaction: { type: { in: includedTxTypes } },
...(hasDateFilter ? { createdAt: dateFilter } : {}),
},
include: { transaction: true },
Expand All @@ -151,17 +162,19 @@ export class AdminService {
? await this.prisma.vote.findMany({
where: {
voteType: VoteType.DENY,
transaction: { type: { in: includedTxTypes } },
...(hasDateFilter ? { createdAt: dateFilter } : {}),
},
include: { transaction: true },
orderBy: { createdAt: 'asc' },
})
: [];

// 5. EXECUTE records
// 5. EXECUTE records (filtered by includedTxTypes)
const executedTxs = await this.prisma.transaction.findMany({
where: {
status: TxStatus.EXECUTED,
type: { in: includedTxTypes },
...(hasDateFilter ? { executedAt: dateFilter } : {}),
},
orderBy: { executedAt: 'asc' },
Expand Down
9 changes: 9 additions & 0 deletions packages/backend/src/admin/dto/analytics-report.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,13 @@ export class AnalyticsReportDto {
@IsBoolean()
@Transform(({ value }) => value === 'true' || value === true)
includeClaim?: boolean;

@ApiPropertyOptional({
description: 'Include ADD_SIGNER, REMOVE_SIGNER, UPDATE_THRESHOLD records',
default: false,
})
@IsOptional()
@IsBoolean()
@Transform(({ value }) => value === 'true' || value === true)
includeSignerOps?: boolean;
}
Loading