mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
override user._id with user.id to not expose internal db id
This commit is contained in:
parent
64120a0009
commit
6a6efd5a23
@ -143,11 +143,11 @@ describe('Room', () => {
|
||||
roomId: result.data.Room[0].id,
|
||||
users: expect.arrayContaining([
|
||||
{
|
||||
_id: expect.any(String),
|
||||
_id: 'chatting-user',
|
||||
id: 'chatting-user',
|
||||
},
|
||||
{
|
||||
_id: expect.any(String),
|
||||
_id: 'other-chatting-user',
|
||||
id: 'other-chatting-user',
|
||||
},
|
||||
]),
|
||||
@ -174,11 +174,11 @@ describe('Room', () => {
|
||||
roomId: result.data.Room[0].id,
|
||||
users: expect.arrayContaining([
|
||||
{
|
||||
_id: expect.any(String),
|
||||
_id: 'chatting-user',
|
||||
id: 'chatting-user',
|
||||
},
|
||||
{
|
||||
_id: expect.any(String),
|
||||
_id: 'other-chatting-user',
|
||||
id: 'other-chatting-user',
|
||||
},
|
||||
]),
|
||||
|
||||
@ -9,7 +9,17 @@ export default {
|
||||
params.filter.users_some = {
|
||||
id: context.user.id,
|
||||
}
|
||||
return neo4jgraphql(object, params, context, resolveInfo)
|
||||
const resolved = await neo4jgraphql(object, params, context, resolveInfo)
|
||||
if (resolved) {
|
||||
resolved.forEach((room) => {
|
||||
if (room.users) {
|
||||
room.users.forEach((user) => {
|
||||
user._id = user.id
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
return resolved
|
||||
},
|
||||
},
|
||||
Mutation: {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user