diff --git a/src/main/java/com/rosetta/im/database/entity/Device.java b/src/main/java/com/rosetta/im/database/entity/Device.java index 53c4648..b8127ee 100644 --- a/src/main/java/com/rosetta/im/database/entity/Device.java +++ b/src/main/java/com/rosetta/im/database/entity/Device.java @@ -7,10 +7,14 @@ import jakarta.persistence.Entity; import jakarta.persistence.GeneratedValue; import jakarta.persistence.GenerationType; import jakarta.persistence.Id; +import jakarta.persistence.Index; import jakarta.persistence.Table; @Entity -@Table(name = "devices") +@Table(name = "devices", indexes = { + @Index(name = "idx_public_key", columnList = "publicKey, deviceId", unique = true) +}) + public class Device extends CreateUpdateEntity { @Id diff --git a/src/main/java/com/rosetta/im/executors/Executor24DeviceResolve.java b/src/main/java/com/rosetta/im/executors/Executor24DeviceResolve.java index 11827a3..93fce90 100644 --- a/src/main/java/com/rosetta/im/executors/Executor24DeviceResolve.java +++ b/src/main/java/com/rosetta/im/executors/Executor24DeviceResolve.java @@ -14,6 +14,7 @@ import com.rosetta.im.packet.Packet0Handshake; import com.rosetta.im.packet.Packet24DeviceResolve; import com.rosetta.im.packet.runtime.DeviceSolution; import com.rosetta.im.packet.runtime.HandshakeStage; +import com.rosetta.im.service.dispatch.DeviceDispatcher; import io.orprotocol.ProtocolException; import io.orprotocol.client.Client; @@ -24,10 +25,12 @@ public class Executor24DeviceResolve extends PacketExecutor tagClass : this.eciTags.keySet()) { + if (this.clientIndexer != null) { + this.clientIndexer.removeTagIndex(this, tagClass); + } + } + this.eciTags.clear(); + } + + /** + * Удаляет данные клиента по указанному ключу. + * @param Тип данных. + * @param tagClass Класс данных для удаления. + */ + public void removeTag(Class tagClass) { + this.addTag(tagClass, null); + } /** * Переиндексирует тег клиента в индексе клиентов.