From db935d396b44ffc289bc146a9eba8fcef844d957 Mon Sep 17 00:00:00 2001 From: Mikal Stordal Date: Wed, 1 Jan 2025 02:12:10 +0100 Subject: [PATCH] misc: expose created/updated timestamps for episode/group in APIv3 --- Shoko.Server/API/v3/Models/Shoko/Episode.cs | 14 ++++++++++++++ Shoko.Server/API/v3/Models/Shoko/Group.cs | 16 ++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/Shoko.Server/API/v3/Models/Shoko/Episode.cs b/Shoko.Server/API/v3/Models/Shoko/Episode.cs index 217bfe3b5..6e165754e 100644 --- a/Shoko.Server/API/v3/Models/Shoko/Episode.cs +++ b/Shoko.Server/API/v3/Models/Shoko/Episode.cs @@ -83,6 +83,18 @@ public class Episode : BaseModel /// public Rating? UserRating { get; set; } + /// + /// The time when the episode was created. + /// + [JsonConverter(typeof(IsoDateTimeConverter))] + public DateTime Created { get; set; } + + /// + /// The time when the episode was last updated, + /// + [JsonConverter(typeof(IsoDateTimeConverter))] + public DateTime Updated { get; set; } + #pragma warning disable IDE1006 /// /// The , if is @@ -163,6 +175,8 @@ public Episode(HttpContext context, SVR_AnimeEpisode episode, HashSet public GroupSizes Sizes { get; set; } + /// + /// The time when the group was created. + /// + [JsonConverter(typeof(IsoDateTimeConverter))] + public DateTime Created { get; set; } + + /// + /// The time when the group was last updated + /// + [JsonConverter(typeof(IsoDateTimeConverter))] + public DateTime Updated { get; set; } + #region Constructors public Group(SVR_AnimeGroup group, int userID = 0, bool randomizeImages = false) @@ -86,6 +100,8 @@ public Group(SVR_AnimeGroup group, int userID = 0, bool randomizeImages = false) Description = group.Description; Sizes = ModelHelper.GenerateGroupSizes(allSeries, episodes, subGroupCount, userID); Size = allSeries.Count(series => series.AnimeGroupID == group.AnimeGroupID); + Created = group.DateTimeCreated.ToUniversalTime(); + Updated = group.DateTimeUpdated.ToUniversalTime(); HasCustomName = group.IsManuallyNamed == 1; HasCustomDescription = group.OverrideDescription == 1; Images = mainSeries == null ? new Images() : mainSeries.GetImages().ToDto(preferredImages: true, randomizeImages: randomizeImages);