fix the transaction UI
This commit is contained in:
@@ -32,14 +32,17 @@ exports.getTransactionsByProduct = async (req, res) => {
|
||||
try {
|
||||
const [transactions] = await db.execute(
|
||||
`SELECT
|
||||
TransactionID,
|
||||
UserID,
|
||||
ProductID,
|
||||
Date,
|
||||
PaymentStatus
|
||||
FROM Transaction
|
||||
WHERE ProductID = ?`,
|
||||
[productID]
|
||||
T.TransactionID,
|
||||
T.UserID,
|
||||
T.ProductID,
|
||||
T.Date,
|
||||
T.PaymentStatus,
|
||||
P.Name AS ProductName,
|
||||
MIN(I.URL) AS Image_URL
|
||||
FROM Transaction T
|
||||
JOIN Product P ON T.ProductID = P.ProductID
|
||||
LEFT JOIN Image_URL I ON P.ProductID = I.ProductID
|
||||
GROUP BY T.TransactionID, T.UserID, T.ProductID, T.Date, T.PaymentStatus, P.Name`
|
||||
);
|
||||
|
||||
res.json({
|
||||
@@ -59,13 +62,18 @@ exports.getTransactionsByUser = async (req, res) => {
|
||||
try {
|
||||
const [transactions] = await db.execute(
|
||||
`SELECT
|
||||
TransactionID,
|
||||
UserID,
|
||||
ProductID,
|
||||
Date,
|
||||
PaymentStatus
|
||||
FROM Transaction
|
||||
WHERE UserID = ?`,
|
||||
T.TransactionID,
|
||||
T.UserID,
|
||||
T.ProductID,
|
||||
T.Date,
|
||||
T.PaymentStatus,
|
||||
P.Name AS ProductName,
|
||||
MIN(I.URL) AS Image_URL
|
||||
FROM Transaction T
|
||||
JOIN Product P ON T.ProductID = P.ProductID
|
||||
LEFT JOIN Image_URL I ON P.ProductID = I.ProductID
|
||||
WHERE T.UserID = ?
|
||||
GROUP BY T.TransactionID, T.UserID, T.ProductID, T.Date, T.PaymentStatus, P.Name`,
|
||||
[userID]
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user