feat: allow specify if notification is success or error

This commit is contained in:
Methapon2001 2025-04-01 11:20:46 +07:00
parent 386c18a1bc
commit f5b5f3751e

View file

@ -473,11 +473,21 @@ export class BackupController extends Controller {
@Post("notify")
async notifyBackup(
@Body() payload: { message: string; userId?: string | string[]; roles?: string | string[] },
@Body()
payload: {
message: string;
userId?: string | string[];
roles?: string | string[];
error?: boolean;
},
) {
sendWebSocket("backup-notification", payload.message, {
roles: payload.roles || [],
userId: payload.userId || [],
});
sendWebSocket(
"backup-notification",
{ success: !payload.error, message: payload.message },
{
roles: payload.roles || [],
userId: payload.userId || [],
},
);
}
}