From e4b3e01c37d97373f7905b58c6b95f73a36ba26c Mon Sep 17 00:00:00 2001 From: VictoriaPresnyakova Date: Mon, 1 May 2023 15:29:55 +0400 Subject: [PATCH] models --- front/vue-project/src/models/Favor.js | 31 +++++++++++++++++++++++++++ front/vue-project/src/models/Order.js | 26 ++++++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 front/vue-project/src/models/Favor.js create mode 100644 front/vue-project/src/models/Order.js diff --git a/front/vue-project/src/models/Favor.js b/front/vue-project/src/models/Favor.js new file mode 100644 index 0000000..45e221e --- /dev/null +++ b/front/vue-project/src/models/Favor.js @@ -0,0 +1,31 @@ +export default class Favor { + constructor(data) { + this._id = data?.id; + this._price = data?.price; + this._componentIds = data?.componentIds; + this._orderIds = data?.orderIds; + + } + + get id() { + return this._id; + } + + get price() { + return this._price; + } + + set price(value) { + if (typeof value !== 'string' || value === null || value.length == 0) { + throw 'New price value ' + value + ' is not a string or empty'; + } + this._price = value; + } + + get componentIds() { + return this._componentIds; + } + get orderIds() { + return this._orderIds; + } +} \ No newline at end of file diff --git a/front/vue-project/src/models/Order.js b/front/vue-project/src/models/Order.js new file mode 100644 index 0000000..cde0240 --- /dev/null +++ b/front/vue-project/src/models/Order.js @@ -0,0 +1,26 @@ +export default class Cabinet { + constructor(data) { + this._id = data?.id; + this._date = data?.date; + this._favorIds = data?.favorIds; + } + + get id() { + return this._id; + } + + get date() { + return this._date; + } + + set date(value) { + if (typeof value !== 'string' || value === null || value.length == 0) { + throw 'New date value ' + value + ' is not a string or empty'; + } + this._date = value; + } + + get favorIds() { + return this._favorIds; + } +} \ No newline at end of file