aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/api/resource
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-07-03 13:03:24 -0700
committerAnton Tananaev <anton@traccar.org>2022-07-03 13:03:24 -0700
commit5f88528350f55802d63bfcb0f4902a4a3399634c (patch)
treef0d1dadc7fa20e2019460f301648e10def402cbb /src/main/java/org/traccar/api/resource
parent95ba3446d936213683d604eb545710124b9bf689 (diff)
downloadtrackermap-server-5f88528350f55802d63bfcb0f4902a4a3399634c.tar.gz
trackermap-server-5f88528350f55802d63bfcb0f4902a4a3399634c.tar.bz2
trackermap-server-5f88528350f55802d63bfcb0f4902a4a3399634c.zip
Fix server update
Diffstat (limited to 'src/main/java/org/traccar/api/resource')
-rw-r--r--src/main/java/org/traccar/api/resource/ServerResource.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/api/resource/ServerResource.java b/src/main/java/org/traccar/api/resource/ServerResource.java
index 2ef99c578..071b7ae8e 100644
--- a/src/main/java/org/traccar/api/resource/ServerResource.java
+++ b/src/main/java/org/traccar/api/resource/ServerResource.java
@@ -22,9 +22,10 @@ import org.traccar.helper.Log;
import org.traccar.helper.LogAction;
import org.traccar.model.Server;
import org.traccar.model.User;
-import org.traccar.storage.Storage;
+import org.traccar.session.cache.CacheManager;
import org.traccar.storage.StorageException;
import org.traccar.storage.query.Columns;
+import org.traccar.storage.query.Condition;
import org.traccar.storage.query.Request;
import javax.annotation.Nullable;
@@ -48,7 +49,7 @@ import java.util.TimeZone;
public class ServerResource extends BaseResource {
@Inject
- private Storage storage;
+ private CacheManager cacheManager;
@Inject
private MailManager mailManager;
@@ -72,6 +73,10 @@ public class ServerResource extends BaseResource {
@PUT
public Response update(Server entity) throws StorageException {
permissionsService.checkAdmin(getUserId());
+ storage.updateObject(entity, new Request(
+ new Columns.Exclude("id"),
+ new Condition.Equals("id", "id")));
+ cacheManager.updateOrInvalidate(entity);
LogAction.edit(getUserId(), entity);
return Response.ok(entity).build();
}