Updated SearchHistory
Added MarshalData() and JsonData() functions.
This commit is contained in:
parent
ae9a1d14bf
commit
25676baca4
1 changed files with 15 additions and 0 deletions
|
|
@ -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<SearchHistory>(data, GlobalJsonOptions.Options);
|
||||
if (tobject == null)
|
||||
return;
|
||||
this._id = tobject._id;
|
||||
this.lastUpdatedAt = tobject.lastUpdatedAt;
|
||||
}
|
||||
|
||||
public string JsonData()
|
||||
{
|
||||
return JsonSerializer.Serialize(this);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue