Merge pull request #187 from Kitzanos/feature/GEPAFINBE-145
GEPAFINBE-145 (Instructor: dashboard stats)
This commit is contained in:
@@ -6,6 +6,7 @@ import io.swagger.v3.oas.annotations.media.Content;
|
||||
import io.swagger.v3.oas.annotations.media.ExampleObject;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import net.gepafin.tendermanagement.model.response.*;
|
||||
import net.gepafin.tendermanagement.model.response.AmendmentWidgetResponseBean;
|
||||
import net.gepafin.tendermanagement.model.response.ApplicationWidgetResponseBean;
|
||||
import net.gepafin.tendermanagement.model.response.AssignedApplicationWidgetResponseBean;
|
||||
@@ -77,18 +78,36 @@ public interface DashboardApi {
|
||||
@PreAuthorize("hasRole('ROLE_SUPER_ADMIN') || hasRole('ROLE_INSTRUCTOR_MANAGER')|| hasRole('ROLE_PRE_INSTRUCTOR')")
|
||||
ResponseEntity<Response<AmendmentWidgetResponseBean>> getAmendmentDetails(HttpServletRequest request);
|
||||
|
||||
|
||||
@Operation(summary = "Api to get Application details for Evaluation",
|
||||
responses = {
|
||||
@ApiResponse(responseCode = "200", description = "OK"),
|
||||
@ApiResponse(responseCode = "200", description = "OK"),
|
||||
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
|
||||
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
|
||||
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||
@GetMapping(value = "/evaluation",
|
||||
|
||||
@GetMapping(value = "/evaluation",
|
||||
produces = { "application/json" })
|
||||
@PreAuthorize("hasRole('ROLE_SUPER_ADMIN') || hasRole('ROLE_INSTRUCTOR_MANAGER')|| hasRole('ROLE_PRE_INSTRUCTOR')")
|
||||
ResponseEntity<Response<AssignedApplicationWidgetResponseBean>> getApplicationDetailsForEvaluation(HttpServletRequest request);
|
||||
|
||||
@Operation(summary = "Api to get dashboard widget for pre instructor",
|
||||
responses = {
|
||||
@ApiResponse(responseCode = "200", description = "OK"),
|
||||
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
|
||||
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
|
||||
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||
|
||||
@GetMapping(value = "/instructor/amendment",
|
||||
produces = { "application/json" })
|
||||
@PreAuthorize("hasRole('ROLE_SUPER_ADMIN') || hasRole('ROLE_INSTRUCTOR_MANAGER')|| hasRole('ROLE_PRE_INSTRUCTOR')")
|
||||
ResponseEntity<Response<PreInstructorWidgetResponseBean>> getDashboardWidgetForPreInstructor(HttpServletRequest request);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||
import net.gepafin.tendermanagement.enums.UserActionContextEnum;
|
||||
import net.gepafin.tendermanagement.enums.UserActionLogsEnum;
|
||||
import net.gepafin.tendermanagement.model.request.UserActionRequest;
|
||||
import net.gepafin.tendermanagement.model.response.*;
|
||||
import net.gepafin.tendermanagement.model.response.AmendmentWidgetResponseBean;
|
||||
import net.gepafin.tendermanagement.model.response.ApplicationWidgetResponseBean;
|
||||
import net.gepafin.tendermanagement.model.response.AssignedApplicationWidgetResponseBean;
|
||||
@@ -74,6 +75,15 @@ public class DashboardApiController implements DashboardApi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<PreInstructorWidgetResponseBean>> getDashboardWidgetForPreInstructor(HttpServletRequest request) {
|
||||
|
||||
/** This code is responsible for creating user action logs for the "Get dashboard stats widget for amendment page" operation. **/
|
||||
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.VIEW).actionContext(UserActionContextEnum.GET_DASHBOARD_WIDGET_FOR_PRE_INSTRUCTOR).build());
|
||||
|
||||
PreInstructorWidgetResponseBean widgetResponseBean= dashboardService.getDashboardWidgetForPreInstructor(request);
|
||||
return ResponseEntity.status(HttpStatus.CREATED)
|
||||
.body(new Response<>(widgetResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.DASHBOARD_WIDGET_FETCHED_SUCCESSFULLY)));
|
||||
}
|
||||
public ResponseEntity<Response<AssignedApplicationWidgetResponseBean>> getApplicationDetailsForEvaluation(HttpServletRequest request) {
|
||||
|
||||
/** This code is responsible for creating user action logs for the "Get Application Details for Evaluation" operation. **/
|
||||
|
||||
Reference in New Issue
Block a user