<commit_before>import {Router} from 'express';
import createCRUD from './utils/createCRUD';
import {generateSwagger} from '../../swaggerFromSpec';
const swagger = generateSwagger();

/**
 * Returns group router.
 *
 * @returns {*}
 */
export function group() {

  const map = {
    id: 'id',
    modified_epoch: 'modified_epoch',
    created_epoch: 'created_epoch',
    modified_by: 'modified_by',
    title: 'title',
    body: 'contents',
    owner_id: 'owner_id'
  };

  return createCRUD('entity', 'group', Router(), map, swagger.definitions.Group);
}

/**
 * Returns post router.
 *
 * @returns {*}
 */
export function post() {

  const map = {
    id: 'id',
    modified_epoch: 'modified_epoch',
    created_epoch: 'created_epoch',
    modified_by: 'modified_by',
    title: 'title',
    body: 'contents',
    owner_id: 'owner_id',
    group_id: 'entity_ref'
  };

  return createCRUD('entity', 'post', Router(), map, swagger.definitions.Post);
}

/**
 * Returns comment router.
 *
 * @returns {*}
 */
export function comment() {

  const map = {
    id: 'id',
    modified_epoch: 'modified_epoch',
    created_epoch: 'created_epoch',
    modified_by: 'modified_by',
    title: 'title',
    body: 'contents',
    owner_id: 'owner_id',
    post_id: 'entity_ref'
  };

  return createCRUD('entity', 'comment', Router(), map, swagger.definitions.Comment);
}

/**
 * Returns like router.
 *
 * @returns {*}
 */
export function like() {

  const remap = {
    id: 'id',
    entity_id: 'entity_ref',
    owner_id: 'profile_ref',
    type: 'type'
  };

  const schema = {
    properties: {
      created_epoch: {type: 'number', format: 'integer'},
      modified_epoch: {type: 'number', format: 'integer'},
      modified_by: {type: 'number', format: 'integer'},
      id: {type: 'number', format: 'integer'},
      owner_id: {type: 'number', format: 'integer'},
      entity_id: {type: 'number', format: 'integer'}
    }
  };

  return createCRUD('action', 'like', Router(), remap, schema);
}<commit_msg>add profile ref to like<commit_after>import {Router} from 'express';
import createCRUD from './utils/createCRUD';
import {generateSwagger} from '../../swaggerFromSpec';
const swagger = generateSwagger();

/**
 * Returns group router.
 *
 * @returns {*}
 */
export function group() {

  const map = {
    id: 'id',
    modified_epoch: 'modified_epoch',
    created_epoch: 'created_epoch',
    modified_by: 'modified_by',
    title: 'title',
    body: 'contents',
    owner_id: 'owner_id'
  };

  return createCRUD('entity', 'group', Router(), map, swagger.definitions.Group);
}

/**
 * Returns post router.
 *
 * @returns {*}
 */
export function post() {

  const map = {
    id: 'id',
    modified_epoch: 'modified_epoch',
    created_epoch: 'created_epoch',
    modified_by: 'modified_by',
    title: 'title',
    body: 'contents',
    owner_id: 'owner_id',
    group_id: 'entity_ref'
  };

  return createCRUD('entity', 'post', Router(), map, swagger.definitions.Post);
}

/**
 * Returns comment router.
 *
 * @returns {*}
 */
export function comment() {

  const map = {
    id: 'id',
    modified_epoch: 'modified_epoch',
    created_epoch: 'created_epoch',
    modified_by: 'modified_by',
    title: 'title',
    body: 'contents',
    owner_id: 'owner_id',
    post_id: 'entity_ref'
  };

  return createCRUD('entity', 'comment', Router(), map, swagger.definitions.Comment);
}

/**
 * Returns like router.
 *
 * @returns {*}
 */
export function like() {

  const remap = {
    id: 'id',
    entity_id: 'entity_ref',
    profile_id: 'profile_ref',
    type: 'type'
  };

  const schema = {
    properties: {
      created_epoch: {type: 'number', format: 'integer'},
      modified_epoch: {type: 'number', format: 'integer'},
      modified_by: {type: 'number', format: 'integer'},
      id: {type: 'number', format: 'integer'},
      owner_id: {type: 'number', format: 'integer'},
      entity_id: {type: 'number', format: 'integer'},
      profile_id: {type: 'number', format: 'integer'}
    }
  };

  return createCRUD('action', 'like', Router(), remap, schema);
}
{'fraction_non_alphanumeric': 0.17309108765038056, 'fraction_numerical': 0.0, 'mean_word_length': 3.476923076923077, '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': '235784', 'n_tokens_mistral': 1364, 'n_tokens_neox': 1374, 'n_words': 333}