Skip to content

Commit

Permalink
changed EDITED edge
Browse files Browse the repository at this point in the history
  • Loading branch information
cyri113 authored Aug 20, 2024
1 parent e1c80c7 commit e61122d
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 e61122d

Please sign in to comment.