fix unknown senders / receivers on profiles
This commit is contained in:
parent
1a45c82712
commit
e4ba0c71ca
2 changed files with 8 additions and 6 deletions
|
|
@ -84,6 +84,10 @@ export async function GET({ params }) {
|
|||
pricePerCoin: transaction.pricePerCoin,
|
||||
totalBaseCurrencyAmount: transaction.totalBaseCurrencyAmount,
|
||||
timestamp: transaction.timestamp,
|
||||
senderUsername: sql<string>`(SELECT username FROM ${user} WHERE id = ${transaction.senderUserId})`,
|
||||
recipientUsername: sql<string>`(SELECT username FROM ${user} WHERE id = ${transaction.recipientUserId})`,
|
||||
senderUserId: transaction.senderUserId,
|
||||
recipientUserId: transaction.recipientUserId,
|
||||
})
|
||||
.from(transaction)
|
||||
.innerJoin(coin, eq(transaction.coinId, coin.id))
|
||||
|
|
|
|||
|
|
@ -248,7 +248,6 @@
|
|||
label: 'Sender',
|
||||
class: 'w-[12%] min-w-[70px] md:w-[10%]',
|
||||
render: (value: any, row: any) => {
|
||||
// Handle transactions API format
|
||||
if (row.isTransfer) {
|
||||
return {
|
||||
component: 'text',
|
||||
|
|
@ -256,12 +255,11 @@
|
|||
class: row.sender && row.sender !== 'Unknown' ? 'font-medium' : 'text-muted-foreground'
|
||||
};
|
||||
}
|
||||
// Handle user profile API format (no sender/recipient data available)
|
||||
if (row.type === 'TRANSFER_IN' || row.type === 'TRANSFER_OUT') {
|
||||
return {
|
||||
component: 'text',
|
||||
text: 'Unknown',
|
||||
class: 'text-muted-foreground'
|
||||
text: row.senderUsername || 'Unknown',
|
||||
class: row.senderUsername ? 'font-medium' : 'text-muted-foreground'
|
||||
};
|
||||
}
|
||||
return {
|
||||
|
|
@ -287,8 +285,8 @@
|
|||
if (row.type === 'TRANSFER_IN' || row.type === 'TRANSFER_OUT') {
|
||||
return {
|
||||
component: 'text',
|
||||
text: 'Unknown',
|
||||
class: 'text-muted-foreground'
|
||||
text: row.recipientUsername || 'Unknown',
|
||||
class: row.recipientUsername ? 'font-medium' : 'text-muted-foreground'
|
||||
};
|
||||
}
|
||||
return {
|
||||
|
|
|
|||
Reference in a new issue