<commit_before><commit_msg>add SurveyController for posting and get all available survey<commit_after>package org.openmhealth.dsu.controller;

/**
 * Created by changun on 12/17/14.
 */

import org.openmhealth.dsu.domain.DataPoint;
import org.openmhealth.dsu.domain.survey.Survey;
import org.openmhealth.dsu.repository.SurveyDefinitionRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.validation.Valid;
import java.util.List;

/**
 * A controller that manages user accounts.
 *
 * @author <NAME>
 */
@Controller
public class SurveyController {

    @Autowired
    SurveyDefinitionRepository repo;

    @RequestMapping(value="/surveys", method= RequestMethod.POST)
    @ResponseBody
    public Survey post(@RequestBody @Valid Survey s) {
        return repo.save(s);
    }


    @RequestMapping(value="/surveys", method= RequestMethod.GET)
    @ResponseBody
    public Iterable<Survey> get() {
        return repo.findAll();
    }
}


{'fraction_non_alphanumeric': 0.1056782334384858, 'fraction_numerical': 0.00473186119873817, 'mean_word_length': 4.742081447963801, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '2374314', 'n_tokens_mistral': 365, 'n_tokens_neox': 359, 'n_words': 73}