feat: asset add/rename/remove + dump action for git and disk modules

This commit is contained in:
NGPixel
2019-10-19 17:39:45 -04:00
parent 73aa870abc
commit d987058336
7 changed files with 128 additions and 30 deletions

View File

@@ -123,8 +123,11 @@ module.exports = {
event: 'renamed',
asset: {
...asset,
sourcePath: assetSourcePath,
destinationPath: assetTargetPath
path: assetSourcePath,
destinationPath: assetTargetPath,
moveAuthorId: context.req.user.id,
moveAuthorName: context.req.user.name,
moveAuthorEmail: context.req.user.email
}
})
@@ -146,7 +149,7 @@ module.exports = {
const asset = await WIKI.models.assets.query().findById(args.id)
if (asset) {
// Check permissions
const assetPath = asset.getAssetPath()
const assetPath = await asset.getAssetPath()
if (!WIKI.auth.checkAccess(context.req.user, ['manage:assets'], { path: assetPath })) {
throw new WIKI.Error.AssetDeleteForbidden()
}
@@ -158,7 +161,13 @@ module.exports = {
// Delete from Storage
await WIKI.models.storage.assetEvent({
event: 'deleted',
asset
asset: {
...asset,
path: assetPath,
authorId: context.req.user.id,
authorName: context.req.user.name,
authorEmail: context.req.user.email
}
})
return {