Skip to content

Commit

Permalink
avniproject/avni-product#1334 | adding analytics_user in ReportContro…
Browse files Browse the repository at this point in the history
…ller

Signed-off-by: ak2502 <akanksha.feb25@gmail.com>
  • Loading branch information
ak2502 committed Aug 21, 2023
1 parent 9446189 commit 724ca9a
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.avniproject.etl.service.ReportService;
import org.avniproject.etl.util.ReportUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;
Expand All @@ -25,6 +26,7 @@ public ReportController(ReportService reportService, ReportRepository reportRepo
this.reportUtil = reportUtil;
}

@PreAuthorize("hasAnyAuthority('analytics_user')")
@RequestMapping(value = "report/hr/userActivity", method = RequestMethod.GET)
public List<UserActivityDTO> getUserActivity(@RequestParam(value = "startDate", required = false) String startDate,
@RequestParam(value = "endDate", required = false) String endDate,
Expand All @@ -38,6 +40,7 @@ public List<UserActivityDTO> getUserActivity(@RequestParam(value = "startDate",
);
}

@PreAuthorize("hasAnyAuthority('analytics_user')")
@RequestMapping(value = "/report/hr/syncFailures",method = RequestMethod.GET)
public List<UserActivityDTO> getUserWiseSyncFailures(@RequestParam(value = "startDate", required = false) String startDate,
@RequestParam(value = "endDate", required = false) String endDate,
Expand All @@ -49,6 +52,7 @@ public List<UserActivityDTO> getUserWiseSyncFailures(@RequestParam(value = "star
);
}

@PreAuthorize("hasAnyAuthority('analytics_user')")
@RequestMapping(value = "/report/hr/deviceModels", method = RequestMethod.GET)
public List<AggregateReportResult> getUserWiseDeviceModels(@RequestParam(value = "userIds", required = false, defaultValue = "") List<Long> userIds) {

Expand All @@ -57,6 +61,7 @@ public List<AggregateReportResult> getUserWiseDeviceModels(@RequestParam(value =
reportUtil.getDynamicUserWhere(userIds, "u.id"));
}

@PreAuthorize("hasAnyAuthority('analytics_user')")
@RequestMapping(value = "/report/hr/appVersions", method = RequestMethod.GET)
public List<AggregateReportResult> getUserWiseAppVersions(@RequestParam(value = "userIds", required = false, defaultValue = "") List<Long> userIds) {

Expand All @@ -65,6 +70,7 @@ public List<AggregateReportResult> getUserWiseAppVersions(@RequestParam(value =
reportUtil.getDynamicUserWhere(userIds, "u.id"));
}

@PreAuthorize("hasAnyAuthority('analytics_user')")
@RequestMapping(value = "/report/hr/userDetails", method = RequestMethod.GET)
public List<UserActivityDTO> getUserDetails(@RequestParam(value = "userIds", required = false, defaultValue = "") List<Long> userIds) {

Expand All @@ -73,6 +79,7 @@ public List<UserActivityDTO> getUserDetails(@RequestParam(value = "userIds", req
reportUtil.getDynamicUserWhere(userIds, "u.id"));
}

@PreAuthorize("hasAnyAuthority('analytics_user')")
@RequestMapping(value = "/report/hr/championUsers", method = RequestMethod.GET)
public List<AggregateReportResult> getChampionUsers(@RequestParam(value = "startDate", required = false) String startDate,
@RequestParam(value = "endDate", required = false) String endDate,
Expand All @@ -84,6 +91,7 @@ public List<AggregateReportResult> getChampionUsers(@RequestParam(value = "start
reportUtil.getDynamicUserWhere(userIds, "u.id"));
}

@PreAuthorize("hasAnyAuthority('analytics_user')")
@RequestMapping(value = "/report/hr/nonPerformingUsers", method = RequestMethod.GET)
public List<AggregateReportResult> getNonPerformingUsers(@RequestParam(value = "startDate", required = false) String startDate,
@RequestParam(value = "endDate", required = false) String endDate,
Expand All @@ -96,6 +104,7 @@ public List<AggregateReportResult> getNonPerformingUsers(@RequestParam(value = "
);
}

@PreAuthorize("hasAnyAuthority('analytics_user')")
@RequestMapping(value = "/report/hr/mostCancelled", method = RequestMethod.GET)
public List<AggregateReportResult> getUsersCancellingMostVisits(@RequestParam(value = "startDate", required = false) String startDate,
@RequestParam(value = "endDate", required = false) String endDate,
Expand Down

0 comments on commit 724ca9a

Please sign in to comment.