Răsfoiți Sursa

Backend saves taxes and fees with orders. Created validation for taxes and fees.

Lee Morgan 5 ani în urmă
părinte
comite
e16abb71c5
1 a modificat fișierele cu 8 adăugiri și 0 ștergeri
  1. 8 0
      controllers/validator.js

+ 8 - 0
controllers/validator.js

@@ -105,6 +105,14 @@ module.exports = {
             return "Date cannot be in the future";
         }
 
+        if(this.quantity(order.taxes) !== true){
+            return "TAXES MUST BE A NON NEGATIVE NUMBER";
+        }
+
+        if(this.quantity(order.fees) !== true){
+            return "FEES MUST BE A NON NEGATIVE NUMBER";
+        }
+
         for(let i = 0; i < order.ingredients; i++){
             let quantityCheck = this.quantity(order.ingredients[i].quantity);
             if(quantityCheck !== true){