aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2023-01-27 14:23:56 -0800
committerAnton Tananaev <anton@traccar.org>2023-01-27 14:23:56 -0800
commit5a46718d48e2886d7bd37acd8c52f20c5c9e18bd (patch)
treef56c7a048b73f241f3500c7ca461df2c54c821cf
parentd66d04b400654169e3aab6803311b39dc0f788f4 (diff)
downloadtrackermap-server-5a46718d48e2886d7bd37acd8c52f20c5c9e18bd.tar.gz
trackermap-server-5a46718d48e2886d7bd37acd8c52f20c5c9e18bd.tar.bz2
trackermap-server-5a46718d48e2886d7bd37acd8c52f20c5c9e18bd.zip
Scheduled reports API
-rw-r--r--src/main/java/org/traccar/api/resource/ReportResource.java13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/main/java/org/traccar/api/resource/ReportResource.java b/src/main/java/org/traccar/api/resource/ReportResource.java
index 6944de9cb..b85e9a857 100644
--- a/src/main/java/org/traccar/api/resource/ReportResource.java
+++ b/src/main/java/org/traccar/api/resource/ReportResource.java
@@ -16,12 +16,11 @@
*/
package org.traccar.api.resource;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.traccar.api.BaseResource;
+import org.traccar.api.SimpleObjectResource;
import org.traccar.helper.LogAction;
import org.traccar.model.Event;
import org.traccar.model.Position;
+import org.traccar.model.Report;
import org.traccar.model.UserRestrictions;
import org.traccar.reports.EventsReportProvider;
import org.traccar.reports.RouteReportProvider;
@@ -54,9 +53,7 @@ import java.util.List;
@Path("reports")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
-public class ReportResource extends BaseResource {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(ReportResource.class);
+public class ReportResource extends SimpleObjectResource<Report> {
private static final String EXCEL = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
@@ -78,6 +75,10 @@ public class ReportResource extends BaseResource {
@Inject
private ReportMailer reportMailer;
+ public ReportResource() {
+ super(Report.class);
+ }
+
private Response executeReport(long userId, boolean mail, ReportExecutor executor) {
if (mail) {
reportMailer.sendAsync(userId, executor);