<commit_before>"use strict";

var _ = require("lodash");
var nconf = require("nconf");
nconf.argv().env().file({ file: 'nconf-env.json' });

var Cryptr = require("cryptr"),
cryptr = new Cryptr(nconf.get("ABIBAO_API_GATEWAY_SERVER_AUTH_JWT_KEY"));

module.exports = function(thinky) {
  
  var type = thinky.type;
  var r = thinky.r;

  var EntityModel = thinky.createModel("entities", {
    // virtuals
    urn: type.virtual().default(function() {
      return _.isUndefined(this.id)  ? null : "urn:abibao:database:entity:"+cryptr.encrypt(this.id);
    }),
    // fields
    name: type.string().required(),
    contact: type.string().email().required(),
    url: type.string().default("").required(),
    type: type.string().enum(["none", "abibao", "charity", "company"]).required(),
    icon: type.string().default("images/icons/default.png"),
    avatar: type.string().default("images/avatars/default.png"),
    picture: type.string().default("images/pictures/default.png"),
    title: type.string().required(),
    hangs: type.string().required(),
    description: type.string().required(),
    usages: type.array().required(),
    // automatic<commit_msg>entity usage change to string<commit_after>"use strict";

var _ = require("lodash");
var nconf = require("nconf");
nconf.argv().env().file({ file: 'nconf-env.json' });

var Cryptr = require("cryptr"),
cryptr = new Cryptr(nconf.get("ABIBAO_API_GATEWAY_SERVER_AUTH_JWT_KEY"));

module.exports = function(thinky) {
  
  var type = thinky.type;
  var r = thinky.r;

  var EntityModel = thinky.createModel("entities", {
    // virtuals
    urn: type.virtual().default(function() {
      return _.isUndefined(this.id)  ? null : "urn:abibao:database:entity:"+cryptr.encrypt(this.id);
    }),
    // fields
    name: type.string().required(),
    contact: type.string().email().required(),
    url: type.string().default("").required(),
    type: type.string().enum(["none", "abibao", "charity", "company"]).required(),
    icon: type.string().default("images/icons/default.png"),
    avatar: type.string().default("images/avatars/default.png"),
    picture: type.string().default("images/pictures/default.png"),
    title: type.string().required(),
    hangs: type.string().required(),
    description: type.string().required(),
    usages: type.string().required(),
    // automatic
{'fraction_non_alphanumeric': 0.19785867237687366, 'fraction_numerical': 0.0, 'mean_word_length': 4.27313769751693, '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': '7567384', 'n_tokens_mistral': 767, 'n_tokens_neox': 754, 'n_words': 125}