<commit_before>const roles = require('../models').Role;
/**
 * Roles Class
 *
 * @class
 */
class Roles {
  /**
   * create
   *
   * Creates a role
   *
   * @param {Object} req Request object
   * @param {Object} res Response object
   * @returns {Void} Returns Void
   */
  create(req, res) {
    return roles
    .create(req.body)
    .then((role) => {
      res.status(201).send({
        message: 'Role created succesfully',
        role,
      });
    })
    .catch(error => res.status(400).send(error.errors));
  }

  /**
   * update
   *
   * Updates a role
   *
   * @param {Object} req Request object
   * @param {Object} res Response object
   * @returns {Void} Returns Void
   */
  update(req, res) {
    return roles
    .findById(req.params.id)
    .then((role) => {
      if (!role) {<commit_msg>[feature 143377539] return only necessary response<commit_after>const roles = require('../models').Role;
/**
 * Roles Class
 *
 * @class
 */
class Roles {
  /**
   * create
   *
   * Creates a role
   *
   * @param {Object} req Request object
   * @param {Object} res Response object
   * @returns {Void} Returns Void
   */
  create(req, res) {
    return roles
    .create(req.body)
    .then((role) => {
      res.status(201).send({
        message: 'Role created succesfully',
        name: role.name,
        id: role.id,
      });
    })
    .catch(error => res.status(400).send(error.errors));
  }

  /**
   * update
   *
   * Updates a role
   *
   * @param {Object} req Request object
   * @param {Object} res Response object
   * @returns {Void} Returns Void
   */
  update(req, res) {
    return roles
    .findById(req.params.id)
    .then((role) => {
      if (!role) {
{'fraction_non_alphanumeric': 0.1577082102776137, 'fraction_numerical': 0.012404016538688719, 'mean_word_length': 2.2266666666666666, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '93248', 'n_tokens_mistral': 587, 'n_tokens_neox': 569, 'n_words': 140}