fix: objection.js 2.0 compat fixes
This commit is contained in:
parent
3e991fa590
commit
8f5265622f
@ -61,11 +61,9 @@ module.exports = {
|
||||
'createdAt',
|
||||
'updatedAt'
|
||||
])
|
||||
.eagerAlgorithm(WIKI.models.Objection.Model.JoinEagerAlgorithm)
|
||||
.eager('tags(selectTags)', {
|
||||
selectTags: builder => {
|
||||
builder.select('tag')
|
||||
}
|
||||
.withGraphJoined('tags')
|
||||
.modifyGraph('tags', builder => {
|
||||
builder.select('tag')
|
||||
})
|
||||
.modify(queryBuilder => {
|
||||
if (args.limit) {
|
||||
|
@ -704,11 +704,9 @@ module.exports = class Page extends Model {
|
||||
])
|
||||
.joinRelated('author')
|
||||
.joinRelated('creator')
|
||||
.eagerAlgorithm(Model.JoinEagerAlgorithm)
|
||||
.eager('tags(selectTags)', {
|
||||
selectTags: builder => {
|
||||
builder.select('tag', 'title')
|
||||
}
|
||||
.withGraphJoined('tags')
|
||||
.modifyGraph('tags', builder => {
|
||||
builder.select('tag', 'title')
|
||||
})
|
||||
.where(queryModeID ? {
|
||||
'pages.id': opts
|
||||
|
@ -56,7 +56,7 @@ module.exports = class UserKey extends Model {
|
||||
}
|
||||
|
||||
static async validateToken ({ kind, token }, context) {
|
||||
const res = await WIKI.models.userKeys.query().findOne({ kind, token }).eager('user')
|
||||
const res = await WIKI.models.userKeys.query().findOne({ kind, token }).withGraphJoined('user')
|
||||
if (res) {
|
||||
await WIKI.models.userKeys.query().deleteById(res.id)
|
||||
if (moment.utc().isAfter(moment.utc(res.validUntil))) {
|
||||
|
@ -705,7 +705,7 @@ module.exports = class User extends Model {
|
||||
}
|
||||
|
||||
static async getGuestUser () {
|
||||
const user = await WIKI.models.users.query().findById(2).eager('groups').modifyEager('groups', builder => {
|
||||
const user = await WIKI.models.users.query().findById(2).withGraphJoined('groups').modifyGraph('groups', builder => {
|
||||
builder.select('groups.id', 'permissions')
|
||||
})
|
||||
if (!user) {
|
||||
|
Loading…
Reference in New Issue
Block a user