Manual Reference Source Test

src/models/user/Permission.js

/**
 * Model representing a Role Permission.
 */
class PermissionModel {
/**
       * @param {Object}  response                        - JSON formatted response of a user role.
       * @param {Number}  response.id                     - The user role ID value
       * @param {String}  response.enabled                - Is Permission enabled?
       * @param {String}  response.scope_name             - Scope name of Permission
       */
  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 {Boolean} */
    this.enabled = attributes.enabled;

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

export default PermissionModel;