Skip to content

Commit

Permalink
Changed: Collection Download no Longer Sets Files Updated Timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
Sewer56 committed Feb 27, 2025
1 parent 722d023 commit 52722d0
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public static EntityId Resolve(this IModFileFragment modFileFragment, IDb db, IT
/// <summary>
/// Resolves the IModFragment to an entity in the database, inserting or updating as necessary.
/// </summary>
public static EntityId Resolve(this IModFragment modFragment, IDb db, ITransaction tx)
public static EntityId Resolve(this IModFragment modFragment, IDb db, ITransaction tx, bool setFilesTimestamp = false)
{
var nexusModResolver = GraphQLResolver.Create(db, tx, NexusModsModPageMetadata.Uid, UidForMod.FromV2Api(modFragment.Uid));
nexusModResolver.Add(NexusModsModPageMetadata.Name, modFragment.Name);
Expand All @@ -80,7 +80,9 @@ public static EntityId Resolve(this IModFragment modFragment, IDb db, ITransacti
if (Uri.TryCreate(modFragment.ThumbnailUrl, UriKind.Absolute, out var thumbnailUri))
nexusModResolver.Add(NexusModsModPageMetadata.ThumbnailUri, thumbnailUri);

nexusModResolver.Add(NexusModsModPageMetadata.DataUpdatedAt, DateTimeOffset.UtcNow);
if (setFilesTimestamp)
nexusModResolver.Add(NexusModsModPageMetadata.DataUpdatedAt, DateTimeOffset.UtcNow);

return nexusModResolver.Id;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ private static ResolvedEntitiesLookup ResolveModFiles(
var uidForMod = UidForMod.FromV2Api(file.Mod.Uid);
if (!modPageIds.TryGetValue(uidForMod, out var modEntityId))
{
modEntityId = file.Mod.Resolve(db, tx);
modEntityId = file.Mod.Resolve(db, tx, setFilesTimestamp: false);
modPageIds[uidForMod] = modEntityId;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public NexusModsLibrary(IServiceProvider serviceProvider)
modInfo.EnsureNoErrors();
EntityId first = default;
foreach (var node in modInfo.Data!.LegacyMods.Nodes)
first = node.Resolve(_connection.Db, tx);
first = node.Resolve(_connection.Db, tx, setFilesTimestamp: true);

await ResolveAllFilesInModPage(uid, tx, first, cancellationToken);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ private static async Task UpdateModPage(IDb db, ITransaction tx, INexusGraphQLCl
var modInfo = await gqlClient.ModInfo.ExecuteAsync((int)uid.GameId.Value, (int)uid.ModId.Value, cancellationToken);
modInfo.EnsureNoErrors();
foreach (var node in modInfo.Data!.LegacyMods.Nodes)
node.Resolve(db, tx);
node.Resolve(db, tx, setFilesTimestamp: true);

// Update Mod Files
var filesByUid = await gqlClient.ModFiles.ExecuteAsync(modIdString, gameIdString, cancellationToken);
Expand Down

0 comments on commit 52722d0

Please sign in to comment.