mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Merge branch 'master' into room-properties
This commit is contained in:
commit
45602119ca
@ -209,9 +209,17 @@ describe('Message', () => {
|
|||||||
mutation: createMessageMutation(),
|
mutation: createMessageMutation(),
|
||||||
variables: {
|
variables: {
|
||||||
roomId,
|
roomId,
|
||||||
content: 'Another nice message to other chatting user',
|
content: 'A nice response message to chatting user',
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
authenticatedUser = await chattingUser.toJson()
|
||||||
|
await mutate({
|
||||||
|
mutation: createMessageMutation(),
|
||||||
|
variables: {
|
||||||
|
roomId,
|
||||||
|
content: 'And another nice message to other chatting user',
|
||||||
|
}
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
it('returns the messages', async () => {
|
it('returns the messages', async () => {
|
||||||
@ -233,11 +241,18 @@ describe('Message', () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: expect.any(String),
|
id: expect.any(String),
|
||||||
content: 'Another nice message to other chatting user',
|
content: 'A nice response message to chatting user',
|
||||||
author: {
|
author: {
|
||||||
id: 'other-chatting-user',
|
id: 'other-chatting-user',
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
id: expect.any(String),
|
||||||
|
content: 'And another nice message to other chatting user',
|
||||||
|
author: {
|
||||||
|
id: 'chatting-user',
|
||||||
|
},
|
||||||
|
}
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
@ -24,11 +24,11 @@ export default {
|
|||||||
const writeTxResultPromise = session.writeTransaction(async (transaction) => {
|
const writeTxResultPromise = session.writeTransaction(async (transaction) => {
|
||||||
const createMessageCypher = `
|
const createMessageCypher = `
|
||||||
MATCH (currentUser:User { id: $currentUserId })-[:CHATS_IN]->(room:Room { id: $roomId })
|
MATCH (currentUser:User { id: $currentUserId })-[:CHATS_IN]->(room:Room { id: $roomId })
|
||||||
MERGE (currentUser)-[:CREATED]->(message:Message)-[:INSIDE]->(room)
|
CREATE (currentUser)-[:CREATED]->(message:Message {
|
||||||
ON CREATE SET
|
createdAt: toString(datetime()),
|
||||||
message.createdAt = toString(datetime()),
|
id: apoc.create.uuid(),
|
||||||
message.id = apoc.create.uuid(),
|
content: $content
|
||||||
message.content = $content
|
})-[:INSIDE]->(room)
|
||||||
RETURN message { .* }
|
RETURN message { .* }
|
||||||
`
|
`
|
||||||
const createMessageTxResponse = await transaction.run(
|
const createMessageTxResponse = await transaction.run(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user