Upload 2 files
Browse files- models/Investment.js +13 -0
- models/PaymentMethod.js +13 -0
models/Investment.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const pool = require('../config/db');
|
| 2 |
+
|
| 3 |
+
const Investment = {
|
| 4 |
+
create: async (user_id, plan_id, amount) => {
|
| 5 |
+
await pool.query('INSERT INTO investments (user_id, plan_id, amount) VALUES (?, ?, ?)', [user_id, plan_id, amount]);
|
| 6 |
+
},
|
| 7 |
+
findByUser: async (user_id) => {
|
| 8 |
+
const [rows] = await pool.query('SELECT * FROM investments WHERE user_id = ?', [user_id]);
|
| 9 |
+
return rows;
|
| 10 |
+
}
|
| 11 |
+
};
|
| 12 |
+
|
| 13 |
+
module.exports = Investment;
|
models/PaymentMethod.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const pool = require('../config/db');
|
| 2 |
+
|
| 3 |
+
const PaymentMethod = {
|
| 4 |
+
create: async (crypto_name, wallet_address) => {
|
| 5 |
+
await pool.query('INSERT INTO payment_methods (crypto_name, wallet_address) VALUES (?, ?)', [crypto_name, wallet_address]);
|
| 6 |
+
},
|
| 7 |
+
findAll: async () => {
|
| 8 |
+
const [rows] = await pool.query('SELECT * FROM payment_methods');
|
| 9 |
+
return rows;
|
| 10 |
+
}
|
| 11 |
+
};
|
| 12 |
+
|
| 13 |
+
module.exports = PaymentMethod;
|