Looks like we finally have a solution.

Change logging to just log a message, instead of the exception.
Moved logic to Syncer involvement.  When posting the data, if a 500 is
returned, then it is up to the Syncer to re-submit it.
This commit is contained in:
Mario Steele 2025-08-09 04:09:17 -05:00
parent 73955353cb
commit 004c490dd8
23 changed files with 529 additions and 177 deletions

View file

@ -0,0 +1,17 @@
using System.Collections;
namespace FreeTubeSync.Model;
public class BaseModel
{
public void UpdateFrom(object other)
{
foreach (var prop in other.GetType().GetProperties())
{
if (prop.Name == "_id" || prop.Name == "id" || prop.Name == "Id" || prop.Name == "subscriptions" || prop.Name == "videos")
continue;
var val = prop.GetValue(other);
prop.SetValue(this, val);
}
}
}

View file

@ -1,6 +1,6 @@
namespace FreeTubeSync.Model;
public class ChangeLog
public class ChangeLog : BaseModel
{
public int Id { get; set; }
public string TableName { get; set; } = string.Empty;

View file

@ -2,7 +2,7 @@ using System.ComponentModel.DataAnnotations;
namespace FreeTubeSync.Model;
public class History
public class History : BaseModel
{
[Key]
public string _id { get; set; } = string.Empty;

View file

@ -2,7 +2,7 @@ using System.ComponentModel.DataAnnotations;
namespace FreeTubeSync.Model;
public class Playlist
public class Playlist : BaseModel
{
[Key]
public string _id { get; set; } = string.Empty;

View file

@ -2,7 +2,7 @@ using System.ComponentModel.DataAnnotations;
namespace FreeTubeSync.Model;
public class Profile
public class Profile : BaseModel
{
[Key]
public string _id { get; set; } = string.Empty;

View file

@ -2,7 +2,7 @@ using System.ComponentModel.DataAnnotations;
namespace FreeTubeSync.Model;
public class SearchHistory
public class SearchHistory : BaseModel
{
[Key]
public string _id { get; set; } = string.Empty;

View file

@ -2,7 +2,7 @@ using System.ComponentModel.DataAnnotations;
namespace FreeTubeSync.Model;
public class Setting
public class Setting : BaseModel
{
[Key]
public string _id { get; set; }

View file

@ -3,7 +3,7 @@ using Microsoft.EntityFrameworkCore;
namespace FreeTubeSync.Model;
[Owned]
public class Subscription
public class Subscription : BaseModel
{
public string id { get; set; } = string.Empty;
public string name { get; set; } = string.Empty;

View file

@ -3,7 +3,7 @@ using Microsoft.EntityFrameworkCore;
namespace FreeTubeSync.Model;
[Owned]
public class Video
public class Video : BaseModel
{
public string videoId { get; set; } = string.Empty;
public string title { get; set; } = string.Empty;