Skip to content

Commit

Permalink
Added documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
jb-cc committed Jun 23, 2023
1 parent a576fca commit 406c14e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions app/config/database.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ const mysql = require('mysql');

let config;


const handleDisconnect = () => {

// create connection to database using the credentials in the .env file
config = mysql.createConnection({
host: 'atp.fhstp.ac.at',
port: 8007,
Expand Down
3 changes: 2 additions & 1 deletion app/models/tradeModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,13 @@ let BuyListedItem = (req, res) => {

// Check if buyer has enough balance to make the purchase
if (buyer.balance < price) {
console.log('buyer does not have enough money')

// Rollback transaction if buyer does not have enough money
return db.rollback(function () {
res
.status(400)
.json({message: "Buyer does not have enough money"});
.json({message: "You do not have enough money to buy this skin"});
});
}

Expand Down

0 comments on commit 406c14e

Please sign in to comment.