diff --git a/FreeTubeSyncer/Models/DatabaseModels/SearchHistory.cs b/FreeTubeSyncer/Models/DatabaseModels/SearchHistory.cs index e8bce80..93ddada 100644 --- a/FreeTubeSyncer/Models/DatabaseModels/SearchHistory.cs +++ b/FreeTubeSyncer/Models/DatabaseModels/SearchHistory.cs @@ -1,4 +1,6 @@ using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using FreeTubeSyncer.Library; namespace FreeTubeSyncer.Models.DatabaseModels; @@ -10,4 +12,17 @@ public class SearchHistory : IDataModel public string Id() => _id; public bool EqualId(string oid) => _id == oid; + public void MarshalData(string id, string data) + { + var tobject = JsonSerializer.Deserialize(data, GlobalJsonOptions.Options); + if (tobject == null) + return; + this._id = tobject._id; + this.lastUpdatedAt = tobject.lastUpdatedAt; + } + + public string JsonData() + { + return JsonSerializer.Serialize(this); + } } \ No newline at end of file