Headless CMS and Content Managment Hub
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.
 
 
 
 
 

35 lines
1.1 KiB

// ==========================================================================
// RenameClient.cs
// Squidex Headless CMS
// ==========================================================================
// Copyright (c) Squidex Group
// All rights reserved.
// ==========================================================================
using System.Collections.Generic;
using Squidex.Infrastructure;
namespace Squidex.Domain.Apps.Write.Apps.Commands
{
public class UpdateClient : AppAggregateCommand, IValidatable
{
public string Id { get; set; }
public string Name { get; set; }
public bool? IsReader { get; set; }
public void Validate(IList<ValidationError> errors)
{
if (!Id.IsSlug())
{
errors.Add(new ValidationError("Client id must be a valid slug", nameof(Id)));
}
if (string.IsNullOrWhiteSpace(Name) && IsReader == null)
{
errors.Add(new ValidationError("Either name or IsReader must be defined.", nameof(Name), nameof(IsReader)));
}
}
}
}