<commit_before>import { Meteor } from 'meteor/meteor';
import { Collections } from '../../common/collections.js';
import { check, Match } from 'meteor/check';
import PermissionsHelper from '../../common/permissionsHelper.js';

let Requirement = function() {};

Requirement.prototype.add = function(projectName) {

  PermissionsHelper.checkIfLogged();
  PermissionsHelper.verify(Meteor.userId(), projectName, 'pa');

  check(requirement, {
    id: Integer,
    description: String,
    priority : Integer
  });

 /* if(Collections.Requirements.findOne({id: requirements.id}))
    throw new Meteor.Error('id already taken');*/

  Collections.Projects.insert({
    id: requirement.id,
    description: requirement.description,
    priority : requirement.priority
  });

   return 'Requirement created';
};

Requirement.prototype.delete = function(projectName){

  PermissionsHelper.checkIfLogged();

  PermissionsHelper.verify(Meteor.userId(), projectName, 'pa');

  Collections.Requirements.remove({
    id: 0
  });

   return 'Requirement deleted';
};

export default new Requirement();
<commit_msg>feat(addRequirement): method to add requirements<commit_after>import { Meteor } from 'meteor/meteor';
import { Collections } from '../../common/collections.js';
import { check, Match } from 'meteor/check';
import PermissionsHelper from '../../common/permissionsHelper.js';

let Requirement = function() {};

Requirement.prototype.add = function(description, priority, categorie, projectName) {
  let requirement = Collections.Requirements.find({project : projectName});
  PermissionsHelper.checkIfLogged();
  PermissionsHelper.verify(Meteor.userId(), projectName, 'pa');
 

  Collections.Requirements.insert({
    description,
    priority,
    categorie 
  });

   return 'Requirement created';
};

Requirement.prototype.delete = function(projectName){
  PermissionsHelper.checkIfLogged();
  PermissionsHelper.verify(Meteor.userId(), projectName, 'pa');

  Collections.Requirements.remove({
    id: 0
  });

   return 'Requirement deleted';
};

export default new Requirement();

{'fraction_non_alphanumeric': 0.13859480269489893, 'fraction_numerical': 0.0009624639076034649, 'mean_word_length': 4.7430939226519335, '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': '4544924', 'n_tokens_mistral': 600, 'n_tokens_neox': 578, 'n_words': 126}