Переглянути джерело

Update all categories to include an 'active' flag.

Lee Morgan 11 місяців тому
батько
коміт
f8e30526a8
2 змінених файлів з 24 додано та 8 видалено
  1. 12 4
      src/views/js/data/Allowance.js
  2. 12 4
      src/views/js/data/Bill.js

+ 12 - 4
src/views/js/data/Allowance.js

@@ -1,9 +1,10 @@
 export default class Allowance{
-    constructor(id, name, amount, isPercent){
+    constructor(id, name, amount, isPercent, active){
         this._id = id;
         this._name = name;
         this._amount = amount;
         this._isPercent = isPercent;
+        this._active = active;
     }
 
     get id(){
@@ -18,12 +19,17 @@ export default class Allowance{
         return "Allowance";
     }
 
+    get active(){
+        return this._active;
+    }
+
     static create(name, amount, isPercent){
         return new Allowance(
             crypto.randomUUID(),
             name,
             amount,
-            isPercent
+            isPercent,
+            true
         );
     }
 
@@ -32,7 +38,8 @@ export default class Allowance{
             data.id,
             data.name,
             data.amount,
-            data.isPercent
+            data.isPercent,
+            data.active
         );
     }
 
@@ -41,7 +48,8 @@ export default class Allowance{
             id: this._id,
             name: this._name,
             amount: this._amount,
-            isPercent: this._isPercent
+            isPercent: this._isPercent,
+            active: this._active
         };
     }
 }

+ 12 - 4
src/views/js/data/Bill.js

@@ -1,8 +1,9 @@
 export default class Bill{
-    constructor(id, name, amount){
+    constructor(id, name, amount, active){
         this._id = id;
         this._name = name;
         this._amount = amount;
+        this._active = active;
     }
 
     get id(){
@@ -21,11 +22,16 @@ export default class Bill{
         return "Bill";
     }
 
+    get active(){
+        return this._active;
+    }
+
     static create(name, amount){
         return new Bill(
             crypto.randomUUID(),
             name,
-            amount
+            amount,
+            true
         );
     }
 
@@ -33,7 +39,8 @@ export default class Bill{
         return new Bill(
             data.id,
             data.name,
-            data.amount
+            data.amount,
+            data.active
         );
     }
 
@@ -41,7 +48,8 @@ export default class Bill{
         return {
             id: this._id,
             name: this._name,
-            amount: this._amount
+            amount: this._amount,
+            active: this._active
         };
     }
 }