Skip to content

Commit bb3f230

Browse files
authored
Merge pull request #77 from topcoder-platform/PM-1304_fix-audit
PM-1304 - add audit trail when description gets updated
2 parents 9570210 + 2010f0a commit bb3f230

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/api/admin/admin.service.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ export class AdminService {
5252
}
5353
: undefined,
5454
},
55+
include: {
56+
winnings: true,
57+
},
5558
});
5659
}
5760

@@ -119,6 +122,18 @@ export class AdminService {
119122
},
120123
}),
121124
);
125+
126+
if (payment.installment_number === 1) {
127+
transactions.push((tx) =>
128+
this.addAudit(
129+
userId,
130+
winningsId,
131+
`Modified payment description from "${payment.winnings.description}" to "${body.description}"`,
132+
body.auditNote,
133+
tx,
134+
),
135+
);
136+
}
122137
}
123138

124139
let paymentStatus = payment.payment_status as PaymentStatus;
@@ -546,6 +561,7 @@ export class AdminService {
546561
},
547562
},
548563
take: 1000,
564+
orderBy: { created_at: 'desc' },
549565
});
550566

551567
result.data = audits.map((item) => ({

0 commit comments

Comments
 (0)