Manual Reference Source Test

src/models/user/RelatedUser.js

/**
 * Model representing a relatedUser.
 */
class RelatedUserModel {
  /**
     * @param {Object}  response                        - JSON formatted response of a relatedUser.
     * @param {Number}  response.id                     - The RelatedUser ID value
     * @param {String}  response.type                   - The type of the object
     * @param {Date}    response.createdAt              - Date RelatedUser was created
     * @param {Date}    response.updatedAt              - Date RelatedUser was last updated
     * @param {String}  response.relationship           - relationship value of RelatedUser
     */
  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.type = attributes.type;

    /** @type {Date} */
    this.createdAt = attributes.created_at;

    /** @type {Date} */
    this.updatedAt = attributes.updated_at;

    /** @type {String} */
    this.relationship = attributes.relationship;
  }
}

export default RelatedUserModel;