This commit is contained in:
tusooa 2022-12-16 14:29:21 -05:00
parent a1b95922c5
commit 070fbb89e1
No known key found for this signature in database
GPG key ID: 7B467EDE43A08224
2 changed files with 10 additions and 6 deletions

View file

@ -65,7 +65,11 @@ defmodule Pleroma.Web.ApiSpec.PleromaBackupOperation do
file_name: %Schema{type: :string},
file_size: %Schema{type: :integer},
processed: %Schema{type: :boolean, description: "whether this backup has succeeded"},
state: %Schema{type: :string, description: "the state of the backup", enum: ["pending", "running", "complete", "failed"]},
state: %Schema{
type: :string,
description: "the state of the backup",
enum: ["pending", "running", "complete", "failed"]
},
processed_number: %Schema{type: :integer, description: "the number of records processed"}
},
example: %{

View file

@ -11,11 +11,11 @@ defmodule Pleroma.Web.PleromaAPI.BackupView do
def render("show.json", %{backup: %Backup{} = backup}) do
# To deal with records before the migration
state =
if backup.state == :invalid do
if backup.processed, do: :complete, else: :failed
else
backup.state
end
if backup.state == :invalid do
if backup.processed, do: :complete, else: :failed
else
backup.state
end
%{
id: backup.id,