Skip to content
Snippets Groups Projects

Rodn search unige contributors

Merged Nicolas.Rod requested to merge rodn-search-unige-contributors into master
All threads resolved!
Files
7
package ch.unige.aou.controller.admin;
import java.util.List;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import ch.unige.aou.controller.AdminController;
import ch.unige.aou.model.rest.UnigePersonDTO;
import ch.unige.aou.rest.UrlPath;
import ch.unige.aou.service.rest.UnigePersonSearch;
import ch.unige.solidify.rest.ActionName;
import ch.unige.solidify.security.UserPermissions;
@UserPermissions
@RestController
@ConditionalOnBean(AdminController.class)
@RequestMapping(UrlPath.ADMIN_CONTRIBUTORS)
public class ContributorsController {
UnigePersonSearch unigePersonSearch;
public ContributorsController(UnigePersonSearch unigePersonSearch) {
this.unigePersonSearch = unigePersonSearch;
}
@GetMapping(ActionName.SEARCH)
public HttpEntity<List<UnigePersonDTO>> search(
@RequestParam(value = "firstname") String firstname,
@RequestParam(value = "lastname") String lastname) {
List<UnigePersonDTO> people = this.unigePersonSearch.search(firstname, lastname);
return new ResponseEntity<>(people, HttpStatus.OK);
}
}
Loading