Fix owner ID reference in share purchase logic; clean up comments and add sleep in main execution

This commit is contained in:
Lukian 2025-01-18 21:49:34 +01:00
parent 9b0985c33c
commit f351b4c31f
3 changed files with 3 additions and 35 deletions

View file

@ -51,7 +51,7 @@ router.post('/buy', async (req, res) => {
await addTransaction(connection, price, share[0].owner_id, buyer_id, share_id)
await setShareOwner(connection, share_id, buyer_id)
if (share[0].owner != -1) {
if (share[0].owner_id != -1) {
const seller = await getShareholder(connection, share[0].owner_id)
await setShareholderCapital(connection, share[0].owner_id, seller[0].capital + price)
}