mirror of
https://github.com/colanode/colanode.git
synced 2025-12-29 00:25:03 +01:00
Fix attributes parsing for interactions
This commit is contained in:
@@ -92,7 +92,7 @@ interface InteractionTable {
|
||||
user_id: ColumnType<string, string, never>;
|
||||
node_id: ColumnType<string, string, never>;
|
||||
node_type: ColumnType<NodeType, NodeType, never>;
|
||||
attributes: ColumnType<InteractionAttributes, string, string>;
|
||||
attributes: ColumnType<string, string, string>;
|
||||
last_seen_at: ColumnType<string | null, string | null, string | null>;
|
||||
created_at: ColumnType<string, string, never>;
|
||||
updated_at: ColumnType<string | null, string | null, string | null>;
|
||||
|
||||
@@ -60,8 +60,12 @@ class InteractionService {
|
||||
.where('node_id', '=', nodeId)
|
||||
.executeTakeFirst();
|
||||
|
||||
const existingAttributes = interaction?.attributes
|
||||
? JSON.parse(interaction.attributes)
|
||||
: null;
|
||||
|
||||
const attributes = mergeInteractionAttributes(
|
||||
interaction?.attributes,
|
||||
existingAttributes,
|
||||
attribute,
|
||||
value
|
||||
);
|
||||
|
||||
@@ -217,7 +217,7 @@ export const mapInteraction = (row: SelectInteraction): Interaction => {
|
||||
return {
|
||||
nodeId: row.node_id,
|
||||
userId: row.user_id,
|
||||
attributes: row.attributes,
|
||||
attributes: JSON.parse(row.attributes),
|
||||
createdAt: new Date(row.created_at),
|
||||
updatedAt: row.updated_at ? new Date(row.updated_at) : null,
|
||||
serverCreatedAt: row.server_created_at
|
||||
|
||||
Reference in New Issue
Block a user