Skip to content

Commit

Permalink
proper fix
Browse files Browse the repository at this point in the history
  • Loading branch information
squi-ddy authored Nov 1, 2024
1 parent ac4252e commit bdb8655
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions backend/src/api/admin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,13 @@ router.post("/addMoney", async (req, res) => {
return res.status(400).json({ message: "Amount must be a string" })
}

if (Number(amount) <= 0) {
const amountToDP = new Decimal(amount).toDP(2)

if (amountToDP.lte(0)) {
return res.status(400).json({ message: "Amount must be positive" })
}

if (!isFinite(Number(amount))) {
if (!amountToDP.isFinite()) {
return res.status(400).json({ message: "No scamming" })
}

Expand All @@ -97,8 +99,6 @@ router.post("/addMoney", async (req, res) => {
return res.status(400).json({ message: "Token ID already used" })
}

const amountToDP = new Decimal(amount).toDP(2)

// update topup data
topupRow.admin_uid = req.user!.uid
topupRow.admin_name = req.user!.name
Expand Down

0 comments on commit bdb8655

Please sign in to comment.