src/models/import/JobStatus.js
/**
* Model representing a job status.
*/
class JobStatusModel {
/**
* @param {Object} response - JSON formatted response of a single job status
* @param {!String} response.id - The id of the job status on the server
* @param {!String} response.type - The type of this object ('job_status')
* @param {!String} response.status - Status for the job status `pending`
* @param {!Date} [response.started_at] - Time at which the job status was started
* @param {!Date} [response.completed_at] - Time at which the job status was completed
*/
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 {String} */
this.id = _response.id;
}
/** @type {String} */
this.status = attributes.status;
/** @type {Date} */
this.startedAt = attributes.started_at;
/** @type {Date} */
this.completedAt = attributes.completed_at;
}
}
export default JobStatusModel;