From 15d949d7e19070eb724d448487636566dc01b938 Mon Sep 17 00:00:00 2001 From: Mario Steele Date: Sat, 19 Jul 2025 12:38:36 -0500 Subject: [PATCH 1/6] Updated DataContext.cs Added Navigation AutoInclude() for Profile subscriptions, and Playlist videos. --- FreeTubeSync/Database/DataContext.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/FreeTubeSync/Database/DataContext.cs b/FreeTubeSync/Database/DataContext.cs index 48ca94d..61b74f9 100644 --- a/FreeTubeSync/Database/DataContext.cs +++ b/FreeTubeSync/Database/DataContext.cs @@ -25,6 +25,20 @@ public class DataContext : DbContext .Property(s => s.ValueJson) .HasColumnName("Value") .IsRequired(); + + modelBuilder.Entity() + .ToTable("Profiles") + .HasKey(s => s._id); + + modelBuilder.Entity() + .Navigation(e => e.subscriptions).AutoInclude(); + + modelBuilder.Entity() + .ToTable("Playlists") + .HasKey(s => s._id); + + modelBuilder.Entity() + .Navigation(e => e.videos).AutoInclude(); } public DbSet Histories { get; set; } From 2e2707844362c95cd048a9eb848da71b616986b8 Mon Sep 17 00:00:00 2001 From: Mario Steele Date: Sat, 19 Jul 2025 12:40:00 -0500 Subject: [PATCH 2/6] Updated SearchHistoryEndpoints.cs Fixed wrong Model for SearchHistory, was using Regular History class, instead of SearchHistory class. --- FreeTubeSync/EndPoints/SearchHistoryEndpoint.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/FreeTubeSync/EndPoints/SearchHistoryEndpoint.cs b/FreeTubeSync/EndPoints/SearchHistoryEndpoint.cs index 38519ed..8908ddc 100644 --- a/FreeTubeSync/EndPoints/SearchHistoryEndpoint.cs +++ b/FreeTubeSync/EndPoints/SearchHistoryEndpoint.cs @@ -8,13 +8,13 @@ public static class SearchHistoryEndpoint { var group = app.MapGroup("searchHistory"); - group.MapGet("/", async (IRepository repository, CancellationToken ct) => + group.MapGet("/", async (IRepository repository, CancellationToken ct) => { var result = await repository.GetAllAsync(ct); return Results.Ok(result); }); - group.MapPost("/", async (IRepository repository, CancellationToken ct, History history) => + group.MapPost("/", async (IRepository repository, CancellationToken ct, SearchHistory history) => { var result = await repository.GetByIdAsync(history._id, ct); if (result != null) @@ -24,7 +24,7 @@ public static class SearchHistoryEndpoint return Results.Ok(); }); - group.MapDelete("/{id}", async (IRepository repository, CancellationToken ct, string id) => + group.MapDelete("/{id}", async (IRepository repository, CancellationToken ct, string id) => { var result = await repository.GetByIdAsync(id, ct); if (result == null) return Results.NotFound(); From a61362e9b5cc273ebf396cb5264e24ec5b99c5da Mon Sep 17 00:00:00 2001 From: Mario Steele Date: Sat, 19 Jul 2025 12:41:50 -0500 Subject: [PATCH 3/6] Updated Playlist, SearchHistory and Video Changed all ints to longs for field datatypes dealing with Unix timestamp. --- FreeTubeSync/Model/Playlist.cs | 4 ++-- FreeTubeSync/Model/SearchHistory.cs | 2 +- FreeTubeSync/Model/Video.cs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/FreeTubeSync/Model/Playlist.cs b/FreeTubeSync/Model/Playlist.cs index b07026d..2d1627e 100644 --- a/FreeTubeSync/Model/Playlist.cs +++ b/FreeTubeSync/Model/Playlist.cs @@ -11,8 +11,8 @@ public class Playlist public string playlistName { get; set; } = string.Empty; public bool @protected { get; set; } public List