add damus_donation to profile data model and update tests

This commit is contained in:
Bryan Montz
2023-05-26 07:02:14 -05:00
parent ea73c5252d
commit e10dc93233
4 changed files with 9 additions and 3 deletions

View File

@@ -1,8 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="21513" systemVersion="22E261" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier="">
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="21754" systemVersion="22E261" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier="">
<entity name="PersistedProfile" representedClassName="PersistedProfile" syncable="YES">
<attribute name="about" optional="YES" attributeType="String"/>
<attribute name="banner" optional="YES" attributeType="String"/>
<attribute name="damus_donation" optional="YES" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/>
<attribute name="display_name" optional="YES" attributeType="String"/>
<attribute name="id" optional="YES" attributeType="String"/>
<attribute name="last_update" optional="YES" attributeType="Date" usesScalarValueType="NO"/>

View File

@@ -20,6 +20,7 @@ final class PersistedProfile: NSManagedObject {
@NSManaged var lud06: String?
@NSManaged var lud16: String?
@NSManaged var nip05: String?
@NSManaged var damus_donation: Int16
@NSManaged var last_update: Date? // The date that the profile was last updated by the user
@NSManaged var network_pull_date: Date? // The date we got this profile from a relay (for staleness checking)
@@ -33,5 +34,6 @@ final class PersistedProfile: NSManagedObject {
lud06 = profile.lud06
lud16 = profile.lud16
nip05 = profile.nip05
damus_donation = profile.damus_donation != nil ? Int16(profile.damus_donation!) : 0
}
}

View File

@@ -33,7 +33,8 @@ class Profile: Codable {
website: persisted_profile.website,
lud06: persisted_profile.lud06,
lud16: persisted_profile.lud16,
nip05: persisted_profile.nip05)
nip05: persisted_profile.nip05,
damus_donation: Int(persisted_profile.damus_donation))
}
private func str(_ str: String) -> String? {