From 8187a034194ed9f296f6f87a2d88dbc8327a7d25 Mon Sep 17 00:00:00 2001 From: Mario Steele Date: Mon, 4 Aug 2025 19:13:17 -0500 Subject: [PATCH] Some updates to Endpoint Logic Ensure that we are adding videos to the playlist database object when we insert them. Updated logic to follow profiles for playlist. Do not search for existing subs when inserting a new sub, the sub's belongs to id will be different. Formatted linq statement to be multi-line, instead of single line, to make it easier to read. Removed check for subscription if we are adding a new one, the profile id is going to be different. Ensure we are deleting subs from the database when they are no longer associated with a profile. --- FreeTubeSync/EndPoints/PlaylistEndpoint.cs | 39 +++++++++++++++------- FreeTubeSync/EndPoints/ProfileEndpoint.cs | 27 +++++++-------- 2 files changed, 39 insertions(+), 27 deletions(-) diff --git a/FreeTubeSync/EndPoints/PlaylistEndpoint.cs b/FreeTubeSync/EndPoints/PlaylistEndpoint.cs index 293792a..4b6c749 100644 --- a/FreeTubeSync/EndPoints/PlaylistEndpoint.cs +++ b/FreeTubeSync/EndPoints/PlaylistEndpoint.cs @@ -33,6 +33,8 @@ public static class PlaylistEndpoint var vid = new Video(); vid.MapFrom(video); await vidRepo.AddAsync(vid, ct, false); + + results.videos.Add(vid); } await repository.AddAsync(results, ct); } @@ -40,24 +42,37 @@ public static class PlaylistEndpoint { results.MapFrom(playlistJson); - var remove = results.videos.Where(video => playlistJson.videos.All(x => x.playlistItemId != video.playlistItemId)).ToList(); - var add = playlistJson.videos.Where(video => results.videos.All(x => x.playlistItemId != video.playlistItemId)).ToList(); - var vids = new List