roomName property

This commit is contained in:
Moriz Wahl 2023-06-16 13:07:10 +02:00
parent cd23b88dd6
commit c68339fedf
4 changed files with 5 additions and 0 deletions

View File

@ -21,6 +21,7 @@ export const roomQuery = () => {
Room {
id
roomId
roomName
users {
_id
id

View File

@ -141,6 +141,7 @@ describe('Room', () => {
{
id: expect.any(String),
roomId: result.data.Room[0].id,
roomName: 'Other Chatting User',
users: expect.arrayContaining([
{
_id: 'chatting-user',
@ -180,6 +181,7 @@ describe('Room', () => {
{
id: expect.any(String),
roomId: result.data.Room[0].id,
roomName: 'Chatting User',
users: expect.arrayContaining([
{
_id: 'chatting-user',

View File

@ -13,6 +13,7 @@ export default {
if (resolved) {
resolved.forEach((room) => {
if (room.users) {
room.roomName = room.users.filter((user) => user.id !== context.user.id)[0].name
room.users.forEach((user) => {
user._id = user.id
})

View File

@ -13,6 +13,7 @@ type Room {
users: [User]! @relation(name: "CHATS_IN", direction: "IN")
roomId: String! @cypher(statement: "RETURN this.id")
roomName: String! ## @cypher(statement: "MATCH (this)<-[:CHATS_IN]-(user:User) WHERE NOT user.id = $cypherParams.currentUserId RETURN user[0].name")
}
type Mutation {