mirror of https://github.com/Squidex/squidex.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
924 B
29 lines
924 B
// ==========================================================================
|
|
// Squidex Headless CMS
|
|
// ==========================================================================
|
|
// Copyright (c) Squidex UG (haftungsbeschraenkt)
|
|
// All rights reserved. Licensed under the MIT license.
|
|
// ==========================================================================
|
|
|
|
using Squidex.Infrastructure;
|
|
using Squidex.Infrastructure.Translations;
|
|
|
|
namespace Squidex.Domain.Apps.Entities.Backup.State;
|
|
|
|
public sealed class BackupState
|
|
{
|
|
public List<BackupJob> Jobs { get; set; } = [];
|
|
|
|
public void EnsureCanStart()
|
|
{
|
|
if (Jobs.Exists(x => x.Status == JobStatus.Started))
|
|
{
|
|
throw new DomainException(T.Get("backups.alreadyRunning"));
|
|
}
|
|
|
|
if (Jobs.Count >= 10)
|
|
{
|
|
throw new DomainException(T.Get("backups.maxReached", new { max = 10 }));
|
|
}
|
|
}
|
|
}
|
|
|