metatext/DB/Sources/DB/Content/NotificationRecord.swift
Justin Mazzocchi 2020c69120
Cleanup
2020-11-12 16:13:09 -08:00

32 lines
880 B
Swift

// Copyright © 2020 Metabolist. All rights reserved.
import Foundation
import GRDB
import Mastodon
struct NotificationRecord: ContentDatabaseRecord, Hashable {
let id: String
let type: MastodonNotification.NotificationType
let accountId: Account.Id
let statusId: Status.Id?
}
extension NotificationRecord {
enum Columns {
static let id = Column(CodingKeys.id)
static let type = Column(CodingKeys.type)
static let accountId = Column(CodingKeys.accountId)
static let statusId = Column(CodingKeys.statusId)
}
static let account = belongsTo(AccountRecord.self)
static let status = belongsTo(StatusRecord.self)
init(notification: MastodonNotification) {
id = notification.id
type = notification.type
accountId = notification.account.id
statusId = notification.status?.id
}
}