Skip to content
This repository has been archived by the owner on Oct 2, 2024. It is now read-only.

Commit

Permalink
Merge pull request #232 from wrth1337/229-es-sollen-keine-negativen-b…
Browse files Browse the repository at this point in the history
…eträge-eingezahlt-werden-können

229 es sollen keine negativen beträge eingezahlt werden können
  • Loading branch information
marcel951 authored Mar 17, 2024
2 parents a997b7f + a19a4ee commit 26bbcd0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions backend/routes/coins.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,12 @@ router.post('/add', authenticateToken, async function(req, res) {
const id = req.user_id;
const fee = 0.1;
const coinsToAdd = (1-fee) * req.body.coins;

if (coinsToAdd <= 0) {
res.status(400);
res.send({status: 99, error: 'Invalid amount. Must be greater than 0'});
}

const result = await addUserCoins(id, coinsToAdd);
if (result.success) {
res.status(200);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ <h5 class="modal-title" id="addCoinsModalLabel">Einzahlen</h5>
<label for="coinAmount" class="form-label">Hinzufügen von Coins</label>
<p>Diese Funktion befindet sich im Aufbau, in der späteren Anwendung wird hier ein Lastschrifteinzug oder Paypal hinterlegt.</p>
<small>Von allen Einzahlungen werden 10 Prozent Gebühr abgezogen</small>
<input id="coinAmount" class="form-control email-input input-text-field" type="number" name="coinAmount" required [(ngModel)]="coinAmount">
<input id="coinAmount" class="form-control email-input input-text-field" type="number" name="coinAmount" min="1" required [(ngModel)]="coinAmount">
</div>
</form>
</div>
Expand Down

0 comments on commit 26bbcd0

Please sign in to comment.