src/models/agreement/PaperTemplate.js
/**
* Model representing a Paper Template.
*
*/
class PaperTemplate {
/**
* @param {Object} response - JSON formatted response of an agreement
* @param {Number} response.id - The id of the paper template
* @param {String} response.template_name - The paper template name
* @param {String} response.description - The description of the paper template
* @param {String} response.created_at - Date when the paper template was created
* @param {String} response.updated_at - Date when the paper template was last updated
*/
constructor(response = {}) {
const _response = response.data || response; // if json api is passed in directly
const attributes = _response.attributes || _response; // if json api is passed in directly
if (_response.id) {
/** @type {Number} */
this.id = parseInt(_response.id, 10);
}
/** @type {String} */
this.templateName = attributes.template_name;
/** @type {String} */
this.description = attributes.description;
/** @type {String} */
this.documentUrl = attributes.document_url;
/** @type {String} */
this.createdAt = attributes.created_at;
/** @type {String} */
this.updatedAt = attributes.updated_at;
}
}
export default PaperTemplate;