fix: objection 2 changes
This commit is contained in:
@@ -331,7 +331,7 @@ module.exports = class User extends Model {
|
||||
|
||||
static async refreshToken(user) {
|
||||
if (_.isSafeInteger(user)) {
|
||||
user = await WIKI.models.users.query().findById(user).eager('groups').modifyEager('groups', builder => {
|
||||
user = await WIKI.models.users.query().findById(user).withGraphFetched('groups').modifyGraph('groups', builder => {
|
||||
builder.select('groups.id', 'permissions')
|
||||
})
|
||||
if (!user) {
|
||||
@@ -339,7 +339,7 @@ module.exports = class User extends Model {
|
||||
throw new WIKI.Error.AuthGenericError()
|
||||
}
|
||||
} else if (_.isNil(user.groups)) {
|
||||
await user.$relatedQuery('groups').select('groups.id', 'permissions')
|
||||
user.groups = await user.$relatedQuery('groups').select('groups.id', 'permissions')
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user