Fix that
This commit is contained in:
parent
048dbef11f
commit
7808c815fe
|
@ -38,10 +38,10 @@ const execute = async (interaction) => {
|
|||
const [existingProduct] = await pool.query('SELECT * FROM products WHERE devProductId = ? AND hubId = ?', [prod.devproduct_id, hub.id]);
|
||||
if (!existingProduct) continue; // No matching product, skip
|
||||
// Product exists, check if theres already a purchase record
|
||||
const [existingPurchase] = await pool.query('SELECT * FROM purchases WHERE userId = ? AND productId = ?', [user.id, existingProduct.id]);
|
||||
const [existingPurchase] = await pool.query('SELECT * FROM purchases WHERE robloxId = ? AND productId = ?', [user.robloxId, existingProduct.id]);
|
||||
if (existingPurchase) continue; // Already have a purchase record, skip
|
||||
// Create purchase record
|
||||
await pool.query('INSERT INTO purchases (userId, productId, hubId) VALUES (?, ?, ?)', [user.id, existingProduct.id, hub.id]);
|
||||
await pool.query('INSERT INTO purchases (robloxId, productId, hubId) VALUES (?, ?, ?)', [user.robloxId, existingProduct.id, hub.id]);
|
||||
console.log(`Imported purchase of product ${prod.name} > ${existingProduct.name} for user ${user.robloxId}`);
|
||||
count++;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue