mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
message query is working
This commit is contained in:
parent
610d538ca9
commit
90bf1881f7
@ -183,8 +183,7 @@ describe('Message', () => {
|
||||
})
|
||||
|
||||
describe('room exists with authenticated user chatting', () => {
|
||||
it('returns null', async () => {
|
||||
console.log(roomId)
|
||||
it('returns the messages', async () => {
|
||||
await expect(query({
|
||||
query: messageQuery(),
|
||||
variables: {
|
||||
@ -203,7 +202,27 @@ describe('Message', () => {
|
||||
},
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('room exists, authenticated user not in room', () => {
|
||||
beforeAll(async () => {
|
||||
authenticatedUser = await notChattingUser.toJson()
|
||||
})
|
||||
|
||||
it('returns null', async () => {
|
||||
await expect(query({
|
||||
query: messageQuery(),
|
||||
variables: {
|
||||
roomId,
|
||||
},
|
||||
})).resolves.toMatchObject({
|
||||
errors: undefined,
|
||||
data: {
|
||||
Message: [],
|
||||
},
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@ -5,18 +5,15 @@ import Resolver from './helpers/Resolver'
|
||||
export default {
|
||||
Query: {
|
||||
Message: async (object, params, context, resolveInfo) => {
|
||||
console.log('message query', params)
|
||||
const { roomId } = params
|
||||
// if (!params.filter) params.filter = {}
|
||||
/*
|
||||
delete params.roomId
|
||||
if (!params.filter) params.filter = {}
|
||||
params.filter.room = {
|
||||
id_in: [roomId],
|
||||
id: roomId,
|
||||
users_some: {
|
||||
id: context.user.id,
|
||||
},
|
||||
}
|
||||
*/
|
||||
console.log(params.filter)
|
||||
return neo4jgraphql(object, params, context, resolveInfo)
|
||||
},
|
||||
},
|
||||
|
||||
@ -2,7 +2,6 @@ input _RoomFilter {
|
||||
AND: [_RoomFilter!]
|
||||
OR: [_RoomFilter!]
|
||||
id: ID
|
||||
id_in: [ID!]
|
||||
users_some: _UserFilter
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user