<commit_before>// Group.js
//
// @description :: A Group of Users
// @docs        :: http://sailsjs.org/#!documentation/models

module.exports = {

  schema: true,

  attributes: {

    // The Group name
    // e.g 'Friends Bet Group'
    name: {
      type: 'text',
      notEmpty: true,
      required: true,
      unique: true,
    },

    // The cumulative score of this Group
    // Updated at the end of a Match
    // e.g 1024
    score: {
      type: 'integer',
      defaultsTo: 0
    },

    // Everything you need to know about this group
    // e.g 'The group of Friends Bet developers'
    description: {
      type: 'text'
    },

    // The first admin of the Group
    // It's a reference to a User
    admin: {
      model: 'user',
      required: true
    },

    // The list of members
    // References to Membership objects
    memberships: {
      collection: 'membership',
      via: 'group'
    }

  },

  afterDestroy: function (req, res) {

  }
};<commit_msg>feat(groupmodel): add the after destroy callback<commit_after>// Group.js
//
// @description :: A Group of Users
// @docs        :: http://sailsjs.org/#!documentation/models

module.exports = {

  schema: true,

  attributes: {

    // The Group name
    // e.g 'Friends Bet Group'
    name: {
      type: 'text',
      notEmpty: true,
      required: true,
      unique: true,
    },

    // The cumulative score of this Group
    // Updated at the end of a Match
    // e.g 1024
    score: {
      type: 'integer',
      defaultsTo: 0
    },

    // Everything you need to know about this group
    // e.g 'The group of Friends Bet developers'
    description: {
      type: 'text'
    },

    // The first admin of the Group
    // It's a reference to a User
    admin: {
      model: 'user',
      required: true
    },

    // The list of members
    // References to Membership objects
    memberships: {
      collection: 'membership',
      via: 'group'
    }

  },

  // Remove group's memberships
  afterDestroy: function destroyAssociations(values, cb) {
    Membership
      .destroy({ group: values.id })
      .exec(function (err) {
        return cb((err)? err: null);
    });
  }
};
{'fraction_non_alphanumeric': 0.12459917544663307, 'fraction_numerical': 0.004580852038479157, 'mean_word_length': 1.8774703557312253, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6300718', 'n_tokens_mistral': 692, 'n_tokens_neox': 653, 'n_words': 220}