Fix /me-Decoding: is_founder/is_partner kommen als SQLite-Int 0/1, nicht Bool
Das Backend bool-konvertiert nur is_premium explizit; alle anderen 0/1-Spalten gehen unverändert durch FastAPI. Decode-Fehler vorher still verschluckt → jetzt auch geloggt, damit das nicht nochmal passiert.
This commit is contained in:
parent
bfd327bd40
commit
5bac31109d
3 changed files with 11 additions and 4 deletions
|
|
@ -20,13 +20,18 @@ struct UserProfile: Decodable {
|
|||
let realName: String?
|
||||
let rolle: String?
|
||||
let isPremium: Bool?
|
||||
let isFounder: Bool?
|
||||
let isPartner: Bool?
|
||||
// Backend bool-konvertiert nur is_premium; is_founder/is_partner kommen
|
||||
// als SQLite-Int 0/1 zurück — deshalb hier Int? statt Bool?.
|
||||
let isFounder: Int?
|
||||
let isPartner: Int?
|
||||
let founderNumber: Int?
|
||||
let subscriptionTier: String?
|
||||
let avatarUrl: String?
|
||||
let wohnort: String?
|
||||
let bio: String?
|
||||
|
||||
var isFounderFlag: Bool { isFounder == 1 }
|
||||
var isPartnerFlag: Bool { isPartner == 1 }
|
||||
}
|
||||
|
||||
// MARK: - Dogs
|
||||
|
|
|
|||
|
|
@ -62,6 +62,8 @@ final class AuthSession {
|
|||
}
|
||||
} catch {
|
||||
// Profil-Refresh ist non-critical; Settings zeigt sonst nur die Basics.
|
||||
// Loggen ist trotzdem nützlich, damit Decode-Fehler nicht stillschweigend untergehen.
|
||||
print("loadProfile failed: \(error)")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,10 +26,10 @@ struct SettingsView: View {
|
|||
|
||||
Section("Account") {
|
||||
LabeledContent("Rolle", value: rolleLabel)
|
||||
if auth.profile?.isFounder == true {
|
||||
if auth.profile?.isFounderFlag == true {
|
||||
LabeledContent("Founder", value: founderLabel)
|
||||
}
|
||||
if auth.profile?.isPartner == true {
|
||||
if auth.profile?.isPartnerFlag == true {
|
||||
LabeledContent("Partner", value: "Ja")
|
||||
}
|
||||
if let tier = auth.profile?.subscriptionTier, !tier.isEmpty {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue