passbolt-styleguide
Version:
Passbolt styleguide contains common styling assets used by the different sites, plugin, etc.
103 lines (93 loc) • 2.34 kB
JavaScript
/**
* Passbolt ~ Open source password manager for teams
* Copyright (c) Passbolt SA (https://www.passbolt.com)
*
* Licensed under GNU Affero General Public License version 3 of the or any later version.
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Passbolt SA (https://www.passbolt.com)
* @license https://opensource.org/licenses/AGPL-3.0 AGPL License
* @link https://www.passbolt.com Passbolt(tm)
* @since 6.0.0
*/
import EntityV2 from "../abstract/entityV2";
export const ENTITY_NAME = "Subscription";
class SubscriptionEntity extends EntityV2 {
/**
* Get entity schema
* @returns {Object} schema
*/
static getSchema() {
return {
type: "object",
required: ["subscription_id", "users", "expiry", "created", "data"],
properties: {
customer_id: {
type: "string",
},
subscription_id: {
type: "string",
},
users: {
type: "integer",
},
email: {
type: "string",
format: "email",
},
created: {
type: "string",
format: "date-time",
},
expiry: {
type: "string",
format: "date-time",
},
data: {
type: "string",
},
},
};
}
/**
* Get the expiration date.
* @returns {string} Expiration date
*/
get expiry() {
return this._props.expiry;
}
/**
* ==================================================
* Serialization
* ==================================================
*/
/**
* Return a DTO ready to be sent to API or content code
* @returns {object}
*/
toDto() {
const result = Object.assign({}, this._props);
return result;
}
/**
* Customizes JSON stringification behavior
* @returns {*}
*/
toJSON() {
return this.toDto();
}
/**
* ==================================================
* Static properties getters
* ==================================================
*/
/**
* SubscriptionEntity.ENTITY_NAME
* @returns {string}
*/
static get ENTITY_NAME() {
return ENTITY_NAME;
}
}
export default SubscriptionEntity;