<commit_before>var Topic = require('../db/dbconfig').Topic;

module.exports = {
  getAllTopics: function (req, res) {
    Topic.findAll({})
    .then(function (topics) {
      res.status(200).json(topics);
    })
    .catch(function (err) {
      console.error(err);
    });
  },
  
  findOrCreateTopic: function (req, res) {
    var topicData = {
      name: req.body.name
    };
    Topic.findOrCreate({where: topicData})
    .then(function (topic) {
      res.status(201).json(topic);
    })<commit_msg>(feat) Force topic name to all uppercase string<commit_after>var Topic = require('../db/dbconfig').Topic;

module.exports = {
  getAllTopics: function (req, res) {
    Topic.findAll({})
    .then(function (topics) {
      res.status(200).json(topics);
    })
    .catch(function (err) {
      console.error(err);
    });
  },
  
  findOrCreateTopic: function (req, res) {
    var topicData = {
      name: req.body.name.toUpperCase()
    };
    Topic.findOrCreate({where: topicData})
    .then(function (topic) {
      res.status(201).json(topic);
    })
{'fraction_non_alphanumeric': 0.16886792452830188, 'fraction_numerical': 0.011320754716981131, 'mean_word_length': 2.8303249097472922, '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': '2749002', 'n_tokens_mistral': 377, 'n_tokens_neox': 364, 'n_words': 63}