fix(wallet-service): convert BigInt to string for JSON serialization in getUnprocessedSettlements
The entry.id field is BigInt type from Prisma which cannot be JSON serialized directly. Convert to string for API response and back to BigInt when storing to database. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
599e0ba281
commit
8d97ed2720
|
|
@ -2498,7 +2498,7 @@ export class WalletApplicationService {
|
|||
*/
|
||||
async getUnprocessedSettlements(accountSequence: string): Promise<{
|
||||
entries: Array<{
|
||||
id: bigint;
|
||||
id: string; // BigInt 转换为 string 以支持 JSON 序列化
|
||||
amount: number;
|
||||
createdAt: Date;
|
||||
memo: string | null;
|
||||
|
|
@ -2538,7 +2538,7 @@ export class WalletApplicationService {
|
|||
const payloadJson = entry.payloadJson as Record<string, unknown> | null;
|
||||
const allocationType = payloadJson?.allocationType as string | null;
|
||||
return {
|
||||
id: entry.id,
|
||||
id: entry.id.toString(), // BigInt 需要转为 string 才能 JSON 序列化
|
||||
amount,
|
||||
createdAt: entry.createdAt,
|
||||
memo: entry.memo,
|
||||
|
|
@ -2708,7 +2708,7 @@ export class WalletApplicationService {
|
|||
data: {
|
||||
accountSequence: command.accountSequence,
|
||||
userId: walletRecord.userId,
|
||||
originalLedgerEntryId: entry.id,
|
||||
originalLedgerEntryId: BigInt(entry.id), // 转回 BigInt 用于数据库存储
|
||||
originalAmount: entry.amount,
|
||||
deductedAmount: actualDeduct,
|
||||
deductionLedgerEntryId: ledgerEntry.id,
|
||||
|
|
|
|||
Loading…
Reference in New Issue