Open-source and local-first Slack and Notion alternative that puts you in control of your data
TypeScript chatchat-applicationcrdteditorelectronknowledge-baselocal-firstnotionnotion-alternativerealtime-collaborationself-hostedslacksqliteteam-collaborationwikiyjs
Fix attributes parsing for interactions
Hakan Shehu7e11694c656b
diff --git a/apps/desktop/src/main/data/workspace/schema.ts b/apps/desktop/src/main/data/workspace/schema.tsindex f46e31d5..0ca6f212 100644--- a/apps/desktop/src/main/data/workspace/schema.ts+++ b/apps/desktop/src/main/data/workspace/schema.ts@@ -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>;diff --git a/apps/desktop/src/main/services/interaction-service.ts b/apps/desktop/src/main/services/interaction-service.tsindex 883ef42f..d3ff1e81 100644--- a/apps/desktop/src/main/services/interaction-service.ts+++ b/apps/desktop/src/main/services/interaction-service.ts@@ -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);diff --git a/apps/desktop/src/main/utils.ts b/apps/desktop/src/main/utils.tsindex 9d593c34..ff669ed3 100644--- a/apps/desktop/src/main/utils.ts+++ b/apps/desktop/src/main/utils.ts@@ -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