Adding in required events for app backup system.

This commit is contained in:
mike12345567 2022-10-17 15:26:09 +01:00
parent 5e802ceb10
commit 0cfb1a9f74
5 changed files with 24 additions and 0 deletions

View File

@ -0,0 +1,12 @@
import { AppBackup, AppBackupRevertEvent, Event } from "@budibase/types"
import { publishEvent } from "../events"
export async function appBackupRestored(backup: AppBackup) {
const properties: AppBackupRevertEvent = {
appId: backup.appId,
backupName: backup.name,
backupCreatedAt: backup.createdAt,
}
await publishEvent(Event.APP_BACKUP_RESTORED, properties)
}

View File

@ -19,3 +19,4 @@ export * as installation from "./installation"
export * as backfill from "./backfill"
export * as group from "./group"
export * as plugin from "./plugin"
export * as backup from "./backup"

View File

@ -0,0 +1,7 @@
import { BaseEvent } from "./event"
export interface AppBackupRevertEvent extends BaseEvent {
appId: string
backupName: string
backupCreatedAt: string
}

View File

@ -168,6 +168,9 @@ export enum Event {
PLUGIN_INIT = "plugin:init",
PLUGIN_IMPORTED = "plugin:imported",
PLUGIN_DELETED = "plugin:deleted",
// BACKUP
APP_BACKUP_RESTORED = "app:backup:restored",
}
// properties added at the final stage of the event pipeline

View File

@ -20,3 +20,4 @@ export * from "./backfill"
export * from "./identification"
export * from "./userGroup"
export * from "./plugin"
export * from "./backup"