Skip to content

Commit 5cc16a7

Browse files
committed
updating create endpoint, after column name change
1 parent 78e3cfe commit 5cc16a7

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/db/transactions.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import db from './config.js';
22

3-
const createTransaction = async (signature, ip_address, wallet_address, github_username, timestamp) => {
3+
const createTransaction = async (signature, ip_address, wallet_address, github_id, timestamp) => {
44
const query = `
5-
INSERT INTO faucet.transactions (signature, ip_address, wallet_address, github_username, timestamp)
5+
INSERT INTO faucet.transactions (signature, ip_address, wallet_address, github_id, timestamp)
66
VALUES ($1, $2, $3, $4, $5)
77
RETURNING *;
88
`;
9-
const values = [signature, ip_address, wallet_address, github_username, timestamp];
9+
const values = [signature, ip_address, wallet_address, github_id, timestamp];
1010
const result = await db.query(query, values);
1111
return result.rows[0];
1212
};

src/routes/transactionsRoute.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ const router = express.Router();
55

66
// POST a new transaction
77
router.post('/transactions', async (req, res, next) => {
8-
const { signature, ip_address, wallet_address, github_username, timestamp } = req.body;
8+
const { signature, ip_address, wallet_address, github_id, timestamp } = req.body;
99

1010
if (!signature || !ip_address || !wallet_address || !timestamp) {
1111
return res.status(400).json({ message: 'Missing required fields (signature, ip_address, wallet_address, timestamp).' });
1212
}
1313

1414
try {
15-
const newTransaction = await transactions.createTransaction(signature, ip_address, wallet_address, github_username ?? '', timestamp);
15+
const newTransaction = await transactions.createTransaction(signature, ip_address, wallet_address, github_id ?? '', timestamp);
1616
res.status(201).json(newTransaction);
1717
} catch (error) {
1818
console.error('Error creating transaction:', error);

0 commit comments

Comments
 (0)