<commit_before>import base from '../base/service';

class UserService extends base {

  static properties () {
    return [];
  }

  constructor(UserCommunication) {
    'ngInject';
    super();
    this.UserCom=UserCommunication;
  }

  users(search) {
    return this.UserCom.users(search);
  }

  create(user) {
    if(UserService.validate(["email", "password", "display_name"])) {
      return this.UserCom.create(user);
    } else {
      return Promise.reject();
    }
  }

  get(pk) {
    pk=UserService.resolvePrivateKey(pk);
    if(!pk)
      return Promise.reject();

    return this.UserCom.get(pk).then((user) => {
      if(UserService.validate(user)) {
        return Promise.resolve(user);
      } else {
        return Promise.reject();
      }
    }, () => {
      return Promise.reject();
    });
  }

  save(user) {
    if(UserService.validate(["pk"]))
      return this.UserCom.save(user);
    else<commit_msg>save method take id as separate argument<commit_after>import base from '../base/service';

class UserService extends base {

  static properties () {
    return [];
  }

  constructor(UserCommunication) {
    'ngInject';
    super();
    this.UserCom=UserCommunication;
  }

  users(search) {
    return this.UserCom.users(search);
  }

  create(user) {
    if(UserService.validate(["email", "password", "display_name"])) {
      return this.UserCom.create(user);
    } else {
      return Promise.reject();
    }
  }

  get(pk) {
    pk=UserService.resolvePrivateKey(pk);
    if(!pk)
      return Promise.reject();

    return this.UserCom.get(pk).then((user) => {
      if(UserService.validate(user)) {
        return Promise.resolve(user);
      } else {
        return Promise.reject();
      }
    }, () => {
      return Promise.reject();
    });
  }

  save(id, changes) {
    if(UserService.validate(["pk"]))
      return this.UserCom.save(id, changes);
    else
{'fraction_non_alphanumeric': 0.15587151132174829, 'fraction_numerical': 0.0, 'mean_word_length': 2.7037037037037037, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '7305128', 'n_tokens_mistral': 615, 'n_tokens_neox': 596, 'n_words': 101}