Skip to content

Commit

Permalink
Merge pull request #27 from TogetherCrew/fix-edited-message
Browse files Browse the repository at this point in the history
changed EDITED edge
  • Loading branch information
cyri113 authored Aug 20, 2024
2 parents e1c80c7 + e61122d commit 6da2cfa
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions apps/graph-store/src/message/message.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ RETURN message
const UPDATE_MESSAGE = `
MATCH (user:TGUser { id: $user.id })
MATCH (chat:TGChat { id: $chat.id })
MATCH (latest:TGMessage { id: $message.message_id })-[:SENT_IN]->(chat)
WHERE NOT EXISTS (()-[:EDITED]->(latest))
MATCH (previous:TGMessage { id: $message.message_id })-[:SENT_IN]->(chat)
WHERE NOT EXISTS ((previous)-[:EDITED]->())
MERGE (user)-[:CREATED_MESSAGE]->(message:TGMessage { id: $message.message_id, edit_date: $message.edit_date })-[:SENT_IN]->(chat)
ON CREATE
SET message = apoc.map.merge(message, apoc.map.clean($message, ['id'], [null])),
message.created_at = timestamp(),
message.updated_at = timestamp()
MERGE (message)-[:EDITED]->(latest)
MERGE (previous)-[:EDITED]->(message)
RETURN message
`;

Expand Down

0 comments on commit 6da2cfa

Please sign in to comment.