From 5f88528350f55802d63bfcb0f4902a4a3399634c Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 3 Jul 2022 13:03:24 -0700 Subject: Fix server update --- src/main/java/org/traccar/api/resource/ServerResource.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/main/java/org/traccar') 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(); } -- cgit v1.2.3