Started the Split

Split Json data models coming from REST Api, from the Database models
storing them in a SQLite database.
Work to re-engineer endpoints to use Database objects, and copy/update
data from the json objects.
More work is needed.
This commit is contained in:
Mario Steele 2025-07-22 17:03:33 -05:00
parent 157d46ee2e
commit 4985dc4179
36 changed files with 684 additions and 323 deletions

View file

@ -1,36 +0,0 @@
using System.ComponentModel.DataAnnotations;
using System.Diagnostics.CodeAnalysis;
namespace FreeTubeSync.Model;
[SuppressMessage("ReSharper", "InconsistentNaming")]
public class Profile
{
[Key]
public string _id { get; set; } = string.Empty;
public string name { get; set; } = string.Empty;
public string bgColor { get; set; } = string.Empty;
public string textColor { get; set; } = string.Empty;
public List<Subscription> subscriptions { get; set; } = [];
public void Update(Profile other)
{
if (other.name != name) name = other.name;
if (other.bgColor != bgColor) bgColor = other.bgColor;
if (other.textColor != textColor) textColor = other.textColor;
var remove = new List<Subscription>();
foreach (var sub in subscriptions)
{
if (other.subscriptions.Any(x => x.id == sub.id)) continue;
remove.Add(sub);
}
subscriptions.RemoveAll(x => remove.Contains(x));
remove.Clear();
foreach (var sub in other.subscriptions)
{
if (subscriptions.Any(x => x.id == sub.id)) continue;
remove.Add(sub);
}
subscriptions.AddRange(remove);
}
}