add one-to-many relationship reblog in Toot

This commit is contained in:
sunxiaojian 2021-02-02 14:49:55 +08:00
parent 03dd6a7329
commit df90f2ee68
4 changed files with 11 additions and 3 deletions

View File

@ -88,7 +88,8 @@
<relationship name="mentions" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="Mention" inverseName="toot" inverseEntity="Mention"/>
<relationship name="mutedBy" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="MastodonUser" inverseName="muted" inverseEntity="MastodonUser"/>
<relationship name="pinnedBy" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="MastodonUser" inverseName="pinnedToot" inverseEntity="MastodonUser"/>
<relationship name="reblog" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="Toot" inverseName="reblog" inverseEntity="Toot"/>
<relationship name="reblog" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="Toot" inverseName="reblogFrom" inverseEntity="Toot"/>
<relationship name="reblogFrom" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="Toot" inverseName="reblog" inverseEntity="Toot"/>
<relationship name="rebloggedBy" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="MastodonUser" inverseName="reblogged" inverseEntity="MastodonUser"/>
<relationship name="tags" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="Tag" inverseName="toot" inverseEntity="Tag"/>
</entity>
@ -99,6 +100,6 @@
<element name="MastodonUser" positionX="0" positionY="0" width="128" height="269"/>
<element name="Mention" positionX="9" positionY="108" width="128" height="134"/>
<element name="Tag" positionX="18" positionY="117" width="128" height="119"/>
<element name="Toot" positionX="0" positionY="0" width="128" height="479"/>
<element name="Toot" positionX="0" positionY="0" width="128" height="494"/>
</elements>
</model>

View File

@ -16,6 +16,9 @@ public final class Tag: NSManagedObject {
@NSManaged public private(set) var name: String
@NSManaged public private(set) var url: String
// many-to-many relationship
@NSManaged public private(set) var toot: Toot
// one-to-many relationship
@NSManaged public private(set) var histories: Set<History>?
}

View File

@ -46,10 +46,14 @@ public final class Toot: NSManagedObject {
@NSManaged public private(set) var updatedAt: Date
@NSManaged public private(set) var deletedAt: Date?
// one-to-many relationship
@NSManaged public private(set) var reblogFrom: Set<Toot>?
// one-to-many relationship
@NSManaged public private(set) var mentions: Set<Mention>?
// one-to-many relationship
@NSManaged public private(set) var emojis: Set<Emoji>?
// one-to-many relationship
@NSManaged public private(set) var tags: Set<Tag>?

View File

@ -36,7 +36,7 @@ extension Mastodon.Entity {
public let avatar: String
public let avatarStatic: String?
public let header: String
public let headerStatic: String
public let headerStatic: String?
public let locked: Bool
public let emojis: [Emoji]?
public let discoverable: Bool?