feat: admin dashboard recent pages + update deps
This commit is contained in:
@@ -41,7 +41,29 @@ module.exports = {
|
||||
'contentType',
|
||||
'createdAt',
|
||||
'updatedAt'
|
||||
])
|
||||
]).modify(queryBuilder => {
|
||||
if (args.limit) {
|
||||
queryBuilder.limit(args.limit)
|
||||
}
|
||||
const orderDir = args.orderByDirection === 'DESC' ? 'desc' : 'asc'
|
||||
switch (args.orderBy) {
|
||||
case 'CREATED':
|
||||
queryBuilder.orderBy('createdAt', orderDir)
|
||||
break
|
||||
case 'PATH':
|
||||
queryBuilder.orderBy('path', orderDir)
|
||||
break
|
||||
case 'TITLE':
|
||||
queryBuilder.orderBy('title', orderDir)
|
||||
break
|
||||
case 'UPDATED':
|
||||
queryBuilder.orderBy('updatedAt', orderDir)
|
||||
break
|
||||
default:
|
||||
queryBuilder.orderBy('id', orderDir)
|
||||
break
|
||||
}
|
||||
})
|
||||
},
|
||||
async single (obj, args, context, info) {
|
||||
let page = await WIKI.models.pages.getPageFromDb(args.id)
|
||||
|
@@ -27,7 +27,11 @@ type PageQuery {
|
||||
locale: String
|
||||
): PageSearchResponse! @auth(requires: ["manage:system", "read:pages"])
|
||||
|
||||
list: [PageListItem!]! @auth(requires: ["manage:system"])
|
||||
list(
|
||||
limit: Int
|
||||
orderBy: PageOrderBy
|
||||
orderByDirection: PageOrderByDirection
|
||||
): [PageListItem!]! @auth(requires: ["manage:system"])
|
||||
|
||||
single(
|
||||
id: Int!
|
||||
@@ -163,3 +167,16 @@ type PageListItem {
|
||||
createdAt: Date!
|
||||
updatedAt: Date!
|
||||
}
|
||||
|
||||
enum PageOrderBy {
|
||||
CREATED
|
||||
ID
|
||||
PATH
|
||||
TITLE
|
||||
UPDATED
|
||||
}
|
||||
|
||||
enum PageOrderByDirection {
|
||||
ASC
|
||||
DESC
|
||||
}
|
||||
|
Reference in New Issue
Block a user