<commit_before>var _ = require('lodash');
var Joi = require('joi');

var common = {
  team: Joi.number().integer().min(0),
  userUuid: Joi.string().regex(/^[A-Za-z0-9_-]+$/).min(1, 'utf8').max(128, 'utf8'),
  primaryKeyId: Joi.number().integer().min(0)
};

const schemas = {
  common: common,

  action: {
    user: common.userUuid.required(),
    type: Joi.string().uppercase().required(),
    imageData: Joi.string().when('type', { is: 'IMAGE', then: Joi.required() }),
    text: Joi.string().when('type', { is: 'TEXT', then: Joi.required() }),
    location: Joi.object({
      latitude: Joi.number(),
      longitude: Joi.number()
    }).required()
  },

  user: {
    uuid: common.userUuid.required(),
    name: Joi.string().min(1, 'utf8').max(30, 'utf8').required(),
    team: common.team.required()
  },

  feedParams: {
    beforeId: Joi.number().integer().min(0).optional(),<commit_msg>Allow action without location in validation<commit_after>var _ = require('lodash');
var Joi = require('joi');

var common = {
  team: Joi.number().integer().min(0),
  userUuid: Joi.string().regex(/^[A-Za-z0-9_-]+$/).min(1, 'utf8').max(128, 'utf8'),
  primaryKeyId: Joi.number().integer().min(0)
};

const schemas = {
  common: common,

  action: {
    user: common.userUuid.required(),
    type: Joi.string().uppercase().required(),
    imageData: Joi.string().when('type', { is: 'IMAGE', then: Joi.required() }),
    text: Joi.string().when('type', { is: 'TEXT', then: Joi.required() }),
    location: Joi.object({
      latitude: Joi.number(),
      longitude: Joi.number()
    })
  },

  user: {
    uuid: common.userUuid.required(),
    name: Joi.string().min(1, 'utf8').max(30, 'utf8').required(),
    team: common.team.required()
  },

  feedParams: {
    beforeId: Joi.number().integer().min(0).optional(),
{'fraction_non_alphanumeric': 0.22744881018262314, 'fraction_numerical': 0.01770890979524073, 'mean_word_length': 3.720626631853786, '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': '2230767', 'n_tokens_mistral': 674, 'n_tokens_neox': 657, 'n_words': 113}