From 288477a5b3d6442860faa1a6edea35486ab144af Mon Sep 17 00:00:00 2001 From: Hampus Date: Wed, 7 Jan 2026 15:16:28 +0100 Subject: [PATCH] fix(api): correct timestamp usage (#67) --- fluxer_api/src/models/CallInfo.ts | 2 +- fluxer_api/src/models/Embed.ts | 2 +- fluxer_api/src/models/MessageSnapshot.ts | 4 ++-- ...0260107131535_add_edited_timestamp_to_message_snapshot.cql | 1 + 4 files changed, 5 insertions(+), 4 deletions(-) create mode 100644 fluxer_devops/cassandra/migrations/20260107131535_add_edited_timestamp_to_message_snapshot.cql diff --git a/fluxer_api/src/models/CallInfo.ts b/fluxer_api/src/models/CallInfo.ts index ae33b12c..b9b0f3a6 100644 --- a/fluxer_api/src/models/CallInfo.ts +++ b/fluxer_api/src/models/CallInfo.ts @@ -26,7 +26,7 @@ export class CallInfo { constructor(call: MessageCall) { this.participantIds = call.participant_ids ?? new Set(); - this.endedTimestamp = call.ended_timestamp ?? null; + this.endedTimestamp = call.ended_timestamp ? new Date(call.ended_timestamp) : null; } toMessageCall(): MessageCall { diff --git a/fluxer_api/src/models/Embed.ts b/fluxer_api/src/models/Embed.ts index a5a9a98b..ed7e595b 100644 --- a/fluxer_api/src/models/Embed.ts +++ b/fluxer_api/src/models/Embed.ts @@ -45,7 +45,7 @@ export class Embed { this.title = embed.title ?? null; this.description = embed.description ?? null; this.url = embed.url ?? null; - this.timestamp = embed.timestamp ?? null; + this.timestamp = embed.timestamp ? new Date(embed.timestamp) : null; this.color = embed.color ?? null; this.author = embed.author ? new EmbedAuthor(embed.author) : null; this.provider = embed.provider ? new EmbedProvider(embed.provider) : null; diff --git a/fluxer_api/src/models/MessageSnapshot.ts b/fluxer_api/src/models/MessageSnapshot.ts index 07e61a23..df90c6ad 100644 --- a/fluxer_api/src/models/MessageSnapshot.ts +++ b/fluxer_api/src/models/MessageSnapshot.ts @@ -38,8 +38,8 @@ export class MessageSnapshot { constructor(snapshot: CassandraMessageSnapshot) { this.content = snapshot.content ?? null; - this.timestamp = snapshot.timestamp; - this.editedTimestamp = snapshot.edited_timestamp ?? null; + this.timestamp = new Date(snapshot.timestamp); + this.editedTimestamp = snapshot.edited_timestamp ? new Date(snapshot.edited_timestamp) : null; this.mentionedUserIds = snapshot.mention_users ?? new Set(); this.mentionedRoleIds = snapshot.mention_roles ?? new Set(); this.mentionedChannelIds = snapshot.mention_channels ?? new Set(); diff --git a/fluxer_devops/cassandra/migrations/20260107131535_add_edited_timestamp_to_message_snapshot.cql b/fluxer_devops/cassandra/migrations/20260107131535_add_edited_timestamp_to_message_snapshot.cql new file mode 100644 index 00000000..edd91398 --- /dev/null +++ b/fluxer_devops/cassandra/migrations/20260107131535_add_edited_timestamp_to_message_snapshot.cql @@ -0,0 +1 @@ +ALTER TYPE fluxer.message_snapshot ADD edited_timestamp timestamp;