feat: serve asset from db + editor mobile improvements

This commit is contained in:
Nick
2019-05-18 02:27:30 -04:00
parent d27ffe7ca4
commit 965f0ad2cd
8 changed files with 168 additions and 88 deletions

View File

@@ -12,10 +12,13 @@ module.exports = {
},
AssetQuery: {
async list(obj, args, context) {
const result = await WIKI.models.assets.query().where({
folderId: null,
kind: args.kind.toLowerCase()
})
let cond = {
folderId: null
}
if (args.kind !== 'ALL') {
cond.kind = args.kind.toLowerCase()
}
const result = await WIKI.models.assets.query().where(cond)
return result.map(a => ({
...a,
kind: a.kind.toUpperCase()