2017-09-21 21:59:08 +02:00
|
|
|
|
//
|
|
|
|
|
// DatabaseArticle.swift
|
2019-07-09 07:20:57 +02:00
|
|
|
|
// NetNewsWire
|
2017-09-21 21:59:08 +02:00
|
|
|
|
//
|
|
|
|
|
// Created by Brent Simmons on 9/21/17.
|
|
|
|
|
// Copyright © 2017 Ranchero Software. All rights reserved.
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
import Foundation
|
2018-07-24 03:29:08 +02:00
|
|
|
|
import Articles
|
2017-09-21 21:59:08 +02:00
|
|
|
|
|
|
|
|
|
// Intermediate representation of an Article. Doesn’t include related objects.
|
|
|
|
|
// Used by ArticlesTable as part of fetching articles.
|
|
|
|
|
|
|
|
|
|
struct DatabaseArticle: Hashable {
|
|
|
|
|
|
|
|
|
|
let articleID: String
|
|
|
|
|
let feedID: String
|
|
|
|
|
let uniqueID: String
|
|
|
|
|
let title: String?
|
|
|
|
|
let contentHTML: String?
|
|
|
|
|
let contentText: String?
|
|
|
|
|
let url: String?
|
|
|
|
|
let externalURL: String?
|
|
|
|
|
let summary: String?
|
|
|
|
|
let imageURL: String?
|
|
|
|
|
let bannerImageURL: String?
|
|
|
|
|
let datePublished: Date?
|
|
|
|
|
let dateModified: Date?
|
|
|
|
|
let status: ArticleStatus
|
2019-02-25 00:34:10 +01:00
|
|
|
|
|
|
|
|
|
// MARK: - Hashable
|
|
|
|
|
|
|
|
|
|
public func hash(into hasher: inout Hasher) {
|
|
|
|
|
hasher.combine(articleID)
|
2018-09-02 21:36:46 +02:00
|
|
|
|
}
|
2017-09-21 22:25:14 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
extension Set where Element == DatabaseArticle {
|
|
|
|
|
|
|
|
|
|
func articleIDs() -> Set<String> {
|
|
|
|
|
return Set<String>(map { $0.articleID })
|
2017-09-21 21:59:08 +02:00
|
|
|
|
}
|
|
|
|
|
}
|