2020-07-29 23:50:30 +00:00
|
|
|
// Copyright © 2020 Metabolist. All rights reserved.
|
|
|
|
|
|
|
|
import Foundation
|
2020-10-14 00:28:27 +00:00
|
|
|
import Mastodon
|
2020-07-29 23:50:30 +00:00
|
|
|
|
2020-10-14 00:28:27 +00:00
|
|
|
final class ContentDatabaseJSONEncoder: JSONEncoder {
|
|
|
|
override init() {
|
2020-07-29 23:50:30 +00:00
|
|
|
super.init()
|
|
|
|
|
|
|
|
keyEncodingStrategy = .convertToSnakeCase
|
|
|
|
outputFormatting = .sortedKeys
|
2021-03-13 02:27:07 +00:00
|
|
|
dateEncodingStrategy = .custom { date, encoder in
|
|
|
|
var container = encoder.singleValueContainer()
|
|
|
|
|
|
|
|
try container.encode(MastodonDecoder.dateFormatter.string(from: date))
|
|
|
|
}
|
2020-07-29 23:50:30 +00:00
|
|
|
}
|
|
|
|
}
|