Adding an event for when a backup is triggered.
This commit is contained in:
parent
3381b71e27
commit
24d5d2a22c
3 changed files with 22 additions and 1 deletions
|
@ -1,4 +1,9 @@
|
|||
import { AppBackup, AppBackupRestoreEvent, Event } from "@budibase/types"
|
||||
import {
|
||||
AppBackup,
|
||||
AppBackupRestoreEvent,
|
||||
AppBackupTriggeredEvent,
|
||||
Event,
|
||||
} from "@budibase/types"
|
||||
import { publishEvent } from "../events"
|
||||
|
||||
export async function appBackupRestored(backup: AppBackup) {
|
||||
|
@ -10,3 +15,12 @@ export async function appBackupRestored(backup: AppBackup) {
|
|||
|
||||
await publishEvent(Event.APP_BACKUP_RESTORED, properties)
|
||||
}
|
||||
|
||||
export async function appBackupTriggered(appId: string, name?: string) {
|
||||
const properties: AppBackupTriggeredEvent = {
|
||||
appId: appId,
|
||||
backupName: name,
|
||||
backupCreatedAt: new Date().toISOString(),
|
||||
}
|
||||
await publishEvent(Event.APP_BACKUP_TRIGGERED, properties)
|
||||
}
|
||||
|
|
|
@ -5,3 +5,9 @@ export interface AppBackupRestoreEvent extends BaseEvent {
|
|||
backupName: string
|
||||
backupCreatedAt: string
|
||||
}
|
||||
|
||||
export interface AppBackupTriggeredEvent extends BaseEvent {
|
||||
appId: string
|
||||
backupName?: string
|
||||
backupCreatedAt: string
|
||||
}
|
||||
|
|
|
@ -171,6 +171,7 @@ export enum Event {
|
|||
|
||||
// BACKUP
|
||||
APP_BACKUP_RESTORED = "app:backup:restored",
|
||||
APP_BACKUP_TRIGGERED = "app:backup:triggered",
|
||||
}
|
||||
|
||||
// properties added at the final stage of the event pipeline
|
||||
|
|
Loading…
Reference in a new issue