2021-10-18 13:08:12 +02:00
|
|
|
const { streamBackup } = require("../../utilities/fileSystem")
|
2022-04-04 16:59:00 +02:00
|
|
|
const { events } = require("@budibase/backend-core")
|
2021-01-27 14:55:46 +01:00
|
|
|
|
2021-05-03 09:31:09 +02:00
|
|
|
exports.exportAppDump = async function (ctx) {
|
2021-02-05 11:55:54 +01:00
|
|
|
const { appId } = ctx.query
|
2021-10-18 13:08:12 +02:00
|
|
|
const appName = decodeURI(ctx.query.appname)
|
|
|
|
const backupIdentifier = `${appName}-export-${new Date().getTime()}.txt`
|
2021-01-29 22:52:45 +01:00
|
|
|
ctx.attachment(backupIdentifier)
|
2021-10-18 13:08:12 +02:00
|
|
|
ctx.body = await streamBackup(appId)
|
2022-04-04 16:59:00 +02:00
|
|
|
events.app.exported()
|
2021-01-27 14:55:46 +01:00
|
|
|
}
|