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,
|
pricePerCoin: transaction.pricePerCoin,
|
||||||
totalBaseCurrencyAmount: transaction.totalBaseCurrencyAmount,
|
totalBaseCurrencyAmount: transaction.totalBaseCurrencyAmount,
|
||||||
timestamp: transaction.timestamp,
|
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)
|
.from(transaction)
|
||||||
.innerJoin(coin, eq(transaction.coinId, coin.id))
|
.innerJoin(coin, eq(transaction.coinId, coin.id))
|
||||||
|
|
|
||||||
|
|
@ -248,7 +248,6 @@
|
||||||
label: 'Sender',
|
label: 'Sender',
|
||||||
class: 'w-[12%] min-w-[70px] md:w-[10%]',
|
class: 'w-[12%] min-w-[70px] md:w-[10%]',
|
||||||
render: (value: any, row: any) => {
|
render: (value: any, row: any) => {
|
||||||
// Handle transactions API format
|
|
||||||
if (row.isTransfer) {
|
if (row.isTransfer) {
|
||||||
return {
|
return {
|
||||||
component: 'text',
|
component: 'text',
|
||||||
|
|
@ -256,12 +255,11 @@
|
||||||
class: row.sender && row.sender !== 'Unknown' ? 'font-medium' : 'text-muted-foreground'
|
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') {
|
if (row.type === 'TRANSFER_IN' || row.type === 'TRANSFER_OUT') {
|
||||||
return {
|
return {
|
||||||
component: 'text',
|
component: 'text',
|
||||||
text: 'Unknown',
|
text: row.senderUsername || 'Unknown',
|
||||||
class: 'text-muted-foreground'
|
class: row.senderUsername ? 'font-medium' : 'text-muted-foreground'
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
|
|
@ -287,8 +285,8 @@
|
||||||
if (row.type === 'TRANSFER_IN' || row.type === 'TRANSFER_OUT') {
|
if (row.type === 'TRANSFER_IN' || row.type === 'TRANSFER_OUT') {
|
||||||
return {
|
return {
|
||||||
component: 'text',
|
component: 'text',
|
||||||
text: 'Unknown',
|
text: row.recipientUsername || 'Unknown',
|
||||||
class: 'text-muted-foreground'
|
class: row.recipientUsername ? 'font-medium' : 'text-muted-foreground'
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
Reference in a new issue