Project

General

Profile

1
package eu.dnetlib.repo.manager.controllers;
2

    
3
import eu.dnetlib.repo.manager.domain.RepositorySummaryInfo;
4
import eu.dnetlib.repo.manager.service.DashboardService;
5
import io.swagger.annotations.Api;
6
import org.json.JSONException;
7
import org.springframework.beans.factory.annotation.Autowired;
8
import org.springframework.http.MediaType;
9
import org.springframework.security.access.prepost.PreAuthorize;
10
import org.springframework.web.bind.annotation.*;
11

    
12
import java.util.List;
13

    
14
@RestController
15
@RequestMapping(value = "/dashboard")
16
@Api(description = "Dashboard API",  tags = {"dashboard"})
17
public class DashboardController {
18

    
19
    @Autowired
20
    DashboardService dashboardService;
21

    
22
    @RequestMapping(value = "/getRepositoriesSummary/{userEmail}/{page}/{size}" , method = RequestMethod.GET,
23
            produces = MediaType.APPLICATION_JSON_VALUE)
24
    @ResponseBody
25
    @PreAuthorize("hasRole('ROLE_USER')")
26
    public List<RepositorySummaryInfo> getRepositoriesSummaryInfo(@PathVariable("userEmail") String userEmail,
27
                                                                  @PathVariable("page") String page,
28
                                                                  @PathVariable("size") String size) throws JSONException {
29
        return dashboardService.getRepositoriesSummaryInfo(userEmail, page, size);
30
    }
31
}
(2-2/11)