Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changed EDITED edge #27

Merged
merged 1 commit into from
Aug 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading