<commit_before>const Router = require('koa-router')
const Review = require('../models/Review')
const { geocoder } = require('../utils')

module.exports = new Router({ prefix: '/review' })
  .get('/', async ctx =>
    (ctx.body = await Review.find().sort('-timestamp').exec()))

  .post('/', async ctx => {
    const { location, rating, comment } = ctx.request.body
    const latlng = [location.latitude, location.longitude]

    const review = new Review({
      juso: geocoder.getJusoByD(latlng),
      location: { type: 'Point', coordinates: latlng },

      rating,
      message: comment,
      timestamp: new Date(),
      ip: ctx.request.ip
    })
<commit_msg>Fixed validation error on submitting review<commit_after>const Router = require('koa-router')
const Review = require('../models/Review')
const { geocoder } = require('../utils')

module.exports = new Router({ prefix: '/review' })
  .get('/', async ctx =>
    (ctx.body = await Review.find().sort('-timestamp').exec()))

  .post('/', async ctx => {
    const { location, rating, comment } = ctx.request.body
    const latlng = [location.latitude, location.longitude]

    const review = new Review({
      juso: await geocoder.getJusoByD(latlng),
      location: { type: 'Point', coordinates: latlng },

      rating,
      message: comment,
      timestamp: new Date(),
      ip: ctx.request.ip
    })

{'fraction_non_alphanumeric': 0.16666666666666666, 'fraction_numerical': 0.0, 'mean_word_length': 3.1865443425076454, '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': '5275652', 'n_tokens_mistral': 422, 'n_tokens_neox': 414, 'n_words': 108}