PR comments.

This commit is contained in:
Michael Drury 2022-11-17 19:38:47 +00:00
parent 575a64d32a
commit 027eda2231
2 changed files with 9 additions and 3 deletions

View File

@ -2,6 +2,7 @@ import {
AppBackup, AppBackup,
AppBackupRestoreEvent, AppBackupRestoreEvent,
AppBackupTriggeredEvent, AppBackupTriggeredEvent,
AppBackupTrigger,
Event, Event,
} from "@budibase/types" } from "@budibase/types"
import { publishEvent } from "../events" import { publishEvent } from "../events"
@ -16,11 +17,15 @@ export async function appBackupRestored(backup: AppBackup) {
await publishEvent(Event.APP_BACKUP_RESTORED, properties) await publishEvent(Event.APP_BACKUP_RESTORED, properties)
} }
export async function appBackupTriggered(appId: string, name?: string) { export async function appBackupTriggered(
appId: string,
trigger: AppBackupTrigger,
name?: string
) {
const properties: AppBackupTriggeredEvent = { const properties: AppBackupTriggeredEvent = {
appId: appId, appId: appId,
backupName: name, backupName: name,
backupCreatedAt: new Date().toISOString(), trigger,
} }
await publishEvent(Event.APP_BACKUP_TRIGGERED, properties) await publishEvent(Event.APP_BACKUP_TRIGGERED, properties)
} }

View File

@ -1,4 +1,5 @@
import { BaseEvent } from "./event" import { BaseEvent } from "./event"
import { AppBackupTrigger } from "../../documents/app"
export interface AppBackupRestoreEvent extends BaseEvent { export interface AppBackupRestoreEvent extends BaseEvent {
appId: string appId: string
@ -8,6 +9,6 @@ export interface AppBackupRestoreEvent extends BaseEvent {
export interface AppBackupTriggeredEvent extends BaseEvent { export interface AppBackupTriggeredEvent extends BaseEvent {
appId: string appId: string
trigger: AppBackupTrigger
backupName?: string backupName?: string
backupCreatedAt: string
} }