From 9eea2f26f64a3026f61f9deb13d1deac00cddcd6 Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Sat, 22 Oct 2016 17:33:12 +0500 Subject: Implement reset total distance API --- src/org/traccar/api/resource/DeviceResource.java | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/org/traccar/api/resource') diff --git a/src/org/traccar/api/resource/DeviceResource.java b/src/org/traccar/api/resource/DeviceResource.java index 56787b7bb..449083cb1 100644 --- a/src/org/traccar/api/resource/DeviceResource.java +++ b/src/org/traccar/api/resource/DeviceResource.java @@ -18,6 +18,7 @@ package org.traccar.api.resource; import org.traccar.Context; import org.traccar.api.BaseResource; import org.traccar.model.Device; +import org.traccar.model.DeviceTotalDistance; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; @@ -92,4 +93,12 @@ public class DeviceResource extends BaseResource { return Response.noContent().build(); } + @Path("{id}/totaldistance") + @PUT + public Response updateTotalDistance(@PathParam("id") long id, DeviceTotalDistance entity) throws SQLException { + Context.getPermissionsManager().checkAdmin(getUserId()); + Context.getDeviceManager().resetTotalDistance(entity); + return Response.noContent().build(); + } + } -- cgit v1.2.3