<commit_before>import connect from '../connection';
import onError from '../util/on-error';

export default onError(async function getPostByUrlString(urlString, db = connect()) {
  const post = await db.one(
    'select * from t_post where urlstring=$1',
    urlString
  );
  post.id = Number(post.id);
  post.created = Number(post.created);
  return post;
});<commit_msg>Actually pull the data<commit_after>import connect from '../connection';
import onError from '../util/on-error';

export default onError(async function getPostByUrlString(urlString, db = connect()) {
  const post = await db.one(
    `select p.*, u.name, u.color
      from t_post p join t_user u on u.id = p.user_id
      where urlstring=$1`,
    urlString
  );
  post.id = Number(post.id);
  post.created = Number(post.created);
  post.user = {
    name: post.name,
    color: post.color,
  };
  delete post.name;
  delete post.color;
  return post;
});
{'fraction_non_alphanumeric': 0.13714902807775378, 'fraction_numerical': 0.0021598272138228943, 'mean_word_length': 3.5441176470588234, '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': '4369212', 'n_tokens_mistral': 298, 'n_tokens_neox': 295, 'n_words': 84}