diff --git a/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/Block.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/Block.kt new file mode 100644 index 00000000..b1bde6d5 --- /dev/null +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/Block.kt @@ -0,0 +1,45 @@ +package dev.usbharu.hideout.activitypub.domain.model + +import com.fasterxml.jackson.annotation.JsonProperty +import dev.usbharu.hideout.activitypub.domain.model.objects.Object + +open class Block( + override val actor: String, + override val id: String, + @JsonProperty("object") val apObject: String +) : + Object(listOf("Block")), HasId, HasActor { + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (javaClass != other?.javaClass) return false + if (!super.equals(other)) return false + + other as Block + + if (actor != other.actor) return false + if (id != other.id) return false + if (apObject != other.apObject) return false + + return true + } + + override fun hashCode(): Int { + var result = super.hashCode() + result = 31 * result + actor.hashCode() + result = 31 * result + id.hashCode() + result = 31 * result + apObject.hashCode() + return result + } + + override fun toString(): String { + return "Block(" + + "actor='$actor', " + + "id='$id', " + + "apObject='$apObject'" + + ")" + + " ${super.toString()}" + } + + +} diff --git a/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/objects/ObjectDeserializer.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/objects/ObjectDeserializer.kt index f28070e6..677d3c7d 100644 --- a/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/objects/ObjectDeserializer.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/objects/ObjectDeserializer.kt @@ -44,7 +44,7 @@ class ObjectDeserializer : JsonDeserializer() { ExtendedActivityVocabulary.Add -> TODO() ExtendedActivityVocabulary.Announce -> TODO() ExtendedActivityVocabulary.Arrive -> TODO() - ExtendedActivityVocabulary.Block -> TODO() + ExtendedActivityVocabulary.Block -> p.codec.treeToValue(treeNode, Block::class.java) ExtendedActivityVocabulary.Create -> p.codec.treeToValue(treeNode, Create::class.java) ExtendedActivityVocabulary.Delete -> p.codec.treeToValue(treeNode, Delete::class.java) ExtendedActivityVocabulary.Dislike -> TODO()