Skip to content

Commit

Permalink
PricingPlan and PricingUnit models
Browse files Browse the repository at this point in the history
  • Loading branch information
odeimaiz committed Dec 9, 2024
1 parent 72b1e4f commit e43dc57
Show file tree
Hide file tree
Showing 2 changed files with 168 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
/* ************************************************************************
osparc - the simcore frontend
https://osparc.io
Copyright:
2024 IT'IS Foundation, https://itis.swiss
License:
MIT: https://opensource.org/licenses/MIT
Authors:
* Odei Maiz (odeimaiz)
************************************************************************ */

/**
* Class that stores PricingPlan data.
*/

qx.Class.define("osparc.data.model.PricingPlan", {
extend: qx.core.Object,

/**
* @param pricingPlanData {Object} Object containing the serialized PricingPlan Data
*/
construct: function(pricingPlanData) {
this.base(arguments);

this.set({
pricingPlanId: pricingPlanData.pricingPlanId,
pricingPlanKey: pricingPlanData.pricingPlanKey,
pricingUnits: pricingPlanData.pricingUnits,
classification: pricingPlanData.classification,
name: pricingPlanData.displayName,
description: pricingPlanData.description,
isActive: pricingPlanData.isActive,
});
},

properties: {
pricingPlanId: {
check: "Number",
nullable: false,
init: null,
event: "changePricingPlanId"
},

pricingPlanKey: {
check: "String",
nullable: true,
init: null,
event: "changePricingPlanKey"
},

pricingUnits: {
check: "Array",
nullable: true,
init: null,
event: "changePricingunits"
},

classification: {
check: "TIER, ",
nullable: false,
init: null,
event: "changeClassification"
},

name: {
check: "String",
nullable: false,
init: null,
event: "changeName"
},

description: {
check: "String",
nullable: true,
init: null,
event: "changeDescription"
},

isActive: {
check: "Boolean",
nullable: false,
init: false,
event: "changeIsActive"
},
},
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/* ************************************************************************
osparc - the simcore frontend
https://osparc.io
Copyright:
2024 IT'IS Foundation, https://itis.swiss
License:
MIT: https://opensource.org/licenses/MIT
Authors:
* Odei Maiz (odeimaiz)
************************************************************************ */

/**
* Class that stores PricingUnit data.
*/

qx.Class.define("osparc.data.model.PricingUnit", {
extend: qx.core.Object,

/**
* @param pricingUnitData {Object} Object containing the serialized PricingUnit Data
*/
construct: function(pricingUnitData) {
this.base(arguments);

this.set({
pricingUnitId: pricingUnitData.pricingUnitId,
name: pricingUnitData.unitName,
cost: pricingUnitData.currentCostPerUnit,
isDefault: pricingUnitData.default,
extraInfo: pricingUnitData.unitExtraInfo,
});
},

properties: {
pricingUnitId: {
check: "Number",
nullable: true,
init: null,
event: "changePricingUnitId"
},

name: {
check: "String",
nullable: false,
init: null,
event: "changeName"
},

cost: {
check: "Number",
nullable: false,
init: null,
event: "changeCost"
},

isDefault: {
check: "Boolean",
nullable: false,
init: false,
event: "changeIsDefault",
},

extraInfo: {
check: "Object",
nullable: false,
init: null,
event: "changeExtraInfo"
},
},
});

0 comments on commit e43dc57

Please sign in to comment.