<commit_before>package com.softserveinc.tender.web;

import com.softserveinc.tender.dto.CategoryDto;
import com.softserveinc.tender.dto.ItemDto;
import com.softserveinc.tender.dto.LocationDto;
import com.softserveinc.tender.dto.ProposalDto;
import com.softserveinc.tender.dto.TenderDto;
import com.softserveinc.tender.dto.UnitDto;
import com.softserveinc.tender.repo.TenderFilter;
import com.softserveinc.tender.dto.TenderStatusDto;
import com.softserveinc.tender.repo.TenderFilter;
import com.softserveinc.tender.facade.TenderServiceFacade;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Set;

@Controller
@RequestMapping("/tenders")
public class TenderController {

    @Autowired
    private TenderServiceFacade tenderFacade;

    @RequestMapping(method = RequestMethod.GET)
    public @ResponseBody List<TenderDto> findTenders(
            @RequestParam(value = "minPrice", required = false) BigDecimal minPrice,
            @RequestParam(value = "maxPrice", required = false) BigDecimal maxPrice,
            @RequestParam(value = "items", required = false) List<Integer> items,
            @RequestParam(value = "locations", required = false) List<Integer> locations,
            @RequestParam(value = "categories", required = false) Set<Integer> categories,
            @RequestParam(value = "statuses", required = false) List<Integer> statuses,
            @RequestParam(value = "minDate", required = false) Date createDate,
            @RequestParam(value = "maxDate", required = false) Date endDate) {

        return tenderFacade.findByCustomParams(new TenderFilter(minPrice, maxPrice, categories,
                                                                locations, items, statuses, createDate, endDate));
    }

    @RequestMapping(value = "/statuses", method = RequestMethod.GET)
    public @ResponseBody List<TenderStatusDto> findAllTenderStatuses() {
        return tenderFacade.findTendersStatuses();
    }

    @RequestMapping(value = "/items", method = RequestMethod.GET)
    public @ResponseBody List<ItemDto> findTendersItems(
            @RequestParam(value = "categories", required = false) Set<Integer> categories) {
        return tenderFacade.findTendersItems(new TenderFilter(null, null, categories, null, null, null, null, null));
    }

    @RequestMapping(value = "/locations", method = RequestMethod.GET)
    public @ResponseBody List<LocationDto> findLocation() {
        return tenderFacade.findTendersLocations();
    }

    @RequestMapping(value = "/categories", method = RequestMethod.GET)
    public @ResponseBody List<CategoryDto> findAllCategories() {
        return tenderFacade.findTendersCategories();
    }

    @RequestMapping(value = "/{tenderId}/units", method = RequestMethod.GET)
    public @ResponseBody
    List<UnitDto> mapUnits(@PathVariable("tenderId") Integer tenderId) {
         return tenderFacade.findUnitsByTenderId(tenderId);
    }

    @RequestMapping(value = "/{tenderId}", method = RequestMethod.PUT)
    public @ResponseBody void updateTenderWithStatus(@PathVariable("tenderId") Integer tenderId,
                                                     @RequestParam("statusName") String statusName) {
        tenderFacade.updateTenderWithStatus(tenderId, statusName);
     }

    @RequestMapping(value = "/{id}/proposals", method = RequestMethod.GET)
    public @ResponseBody List<ProposalDto> findTenderProposals(@PathVariable Integer id) {
         return tenderFacade.findTendersProposals(id);
    }
}<commit_msg>fixed bugs<commit_after>package com.softserveinc.tender.web;

import com.softserveinc.tender.dto.CategoryDto;
import com.softserveinc.tender.dto.ItemDto;
import com.softserveinc.tender.dto.LocationDto;
import com.softserveinc.tender.dto.ProposalDto;
import com.softserveinc.tender.dto.TenderDto;
import com.softserveinc.tender.dto.UnitDto;
import com.softserveinc.tender.repo.TenderFilter;
import com.softserveinc.tender.dto.TenderStatusDto;
import com.softserveinc.tender.repo.TenderFilter;
import com.softserveinc.tender.facade.TenderServiceFacade;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Set;

@Controller
@RequestMapping("/tenders")
public class TenderController {

    @Autowired
    private TenderServiceFacade tenderFacade;

    @RequestMapping(method = RequestMethod.GET)
    public @ResponseBody List<TenderDto> findTenders(
            @RequestParam(value = "minPrice", required = false) BigDecimal minPrice,
            @RequestParam(value = "maxPrice", required = false) BigDecimal maxPrice,
            @RequestParam(value = "items", required = false) List<Integer> items,
            @RequestParam(value = "locations", required = false) List<Integer> locations,
            @RequestParam(value = "categories", required = false) Set<Integer> categories,
            @RequestParam(value = "statuses", required = false) List<Integer> statuses,
            @RequestParam(value = "minDate", required = false) Date createDate,
            @RequestParam(value = "maxDate", required = false) Date endDate) {

        return tenderFacade.findByCustomParams(new TenderFilter(minPrice, maxPrice, categories,
                                                                locations, items, statuses, createDate, endDate));
    }

    @RequestMapping(value = "/statuses", method = RequestMethod.GET)
    public @ResponseBody List<TenderStatusDto> findAllTenderStatuses() {
        return tenderFacade.findTendersStatuses();
    }

    @RequestMapping(value = "/items", method = RequestMethod.GET)
    public @ResponseBody List<ItemDto> findTendersItems(
            @RequestParam(value = "categories", required = false) Set<Integer> categories) {
        return tenderFacade.findTendersItems(new TenderFilter(null, null, categories, null, null, null, null, null));
    }

    @RequestMapping(value = "/locations", method = RequestMethod.GET)
    public @ResponseBody List<LocationDto> findLocation() {
        return tenderFacade.findTendersLocations();
    }

    @RequestMapping(value = "/categories", method = RequestMethod.GET)
    public @ResponseBody List<CategoryDto> findAllCategories() {
        return tenderFacade.findTendersCategories();
    }

    @RequestMapping(value = "/{tenderId}/units", method = RequestMethod.GET)
    public @ResponseBody List<UnitDto> mapUnits(@PathVariable("tenderId") Integer tenderId) {
        return tenderFacade.findUnitsByTenderId(tenderId);
    }

    @RequestMapping(value = "/{tenderId}", method = RequestMethod.PUT)
    public @ResponseBody void updateTenderWithStatus(@PathVariable("tenderId") Integer tenderId,
                                                     @RequestParam("statusName") String statusName) {
        tenderFacade.updateTenderWithStatus(tenderId, statusName);
    }

    @RequestMapping(value = "/{id}/proposals", method = RequestMethod.GET)
    public @ResponseBody List<ProposalDto> findTenderProposals(@PathVariable Integer id) {
         return tenderFacade.findTendersProposals(id);
    }
}
{'fraction_non_alphanumeric': 0.10490307867730901, 'fraction_numerical': 0.0, 'mean_word_length': 4.053777208706786, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1087420', 'n_tokens_mistral': 2178, 'n_tokens_neox': 2190, 'n_words': 421}