Fixes bug on fetching multiple instances of the same Organisations.

This commit is contained in:
gkolokythas 2019-09-17 11:45:09 +03:00
parent 26147d0c9e
commit e884153bf2
1 changed files with 2 additions and 4 deletions

View File

@ -26,12 +26,10 @@ import java.util.Map;
@RequestMapping(value = {"/api"})
public class Organisations extends BaseController {
private OrganisationsExternalSourcesModel organisationsExternalSourcesModel;
private OrganisationsManager organisationsManager;
@Autowired
public Organisations(ApiContext apiContext, OrganisationsExternalSourcesModel organisationsExternalSourcesModel, OrganisationsManager organisationsManager) {
public Organisations(ApiContext apiContext, OrganisationsManager organisationsManager) {
super(apiContext);
this.organisationsExternalSourcesModel = organisationsExternalSourcesModel;
this.organisationsManager = organisationsManager;
}
@ -41,7 +39,7 @@ public class Organisations extends BaseController {
@RequestParam(value = "query", required = false) String query, @RequestParam(value = "type", required = false) String type
) throws HugeResultSet, NoURLFound {
List<Map<String, String>> remoteRepos = this.getApiContext().getOperationsContext().getRemoteFetcher().getOrganisations(query, type);
OrganisationsExternalSourcesModel organisationsExternalSourcesModel = this.organisationsExternalSourcesModel.fromExternalItem(remoteRepos);
OrganisationsExternalSourcesModel organisationsExternalSourcesModel = new OrganisationsExternalSourcesModel().fromExternalItem(remoteRepos);
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<OrganisationsExternalSourcesModel>().payload(organisationsExternalSourcesModel).status(ApiMessageCode.NO_MESSAGE));
}