Skip to content

Commit dce1a83

Browse files
committed
feat: Add LastStateChange to IntegrationJournalData to be able to track _when_ an integration did something to a journal.
ref #37
1 parent c3eab4c commit dce1a83

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

Journal-Limpet.Shared/Models/Journal/IntegrationJournalData.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System.Text.Json.Serialization;
1+
using System;
2+
using System.Text.Json.Serialization;
23

34
namespace Journal_Limpet.Shared.Models.Journal
45
{
@@ -10,5 +11,7 @@ public class IntegrationJournalData
1011
public int LastSentLineNumber { get; set; }
1112
[JsonPropertyName("currentGameState")]
1213
public EDGameState CurrentGameState { get; set; }
14+
[JsonPropertyName("lastStateChange")]
15+
public DateTimeOffset? LastStateChange { get; set; }
1316
}
1417
}

Journal-Limpet/Jobs/SharedCode/GameStateHandler.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ public static IntegrationJournalData GetIntegrationJournalData(UserJournal journ
7272

7373
public async static Task<bool> UpdateJournalIntegrationDataAsync(MSSQLDB db, long journalId, string integrationKey, IntegrationJournalData integrationJournalData)
7474
{
75+
integrationJournalData.LastStateChange = DateTimeOffset.UtcNow;
76+
7577
return (await db.ExecuteNonQueryAsync(
7678
"UPDATE user_journal SET integration_data = JSON_MODIFY(ISNULL(integration_data, JSON_QUERY('{}')), '$.\"" + integrationKey + "\"', JSON_QUERY(@integration_data)) WHERE journal_id = @journal_id",
7779
new SqlParameter("journal_id", journalId),

0 commit comments

Comments
 (0)