mirror of https://github.com/Squidex/squidex.git
41 changed files with 613 additions and 185 deletions
@ -0,0 +1,21 @@ |
|||
// ==========================================================================
|
|||
// AppClientRenamed.cs
|
|||
// Squidex Headless CMS
|
|||
// ==========================================================================
|
|||
// Copyright (c) Squidex Group
|
|||
// All rights reserved.
|
|||
// ==========================================================================
|
|||
|
|||
using Squidex.Infrastructure; |
|||
using Squidex.Infrastructure.CQRS.Events; |
|||
|
|||
namespace Squidex.Events.Apps |
|||
{ |
|||
[TypeName("AppClientRenamedEvent")] |
|||
public sealed class AppClientRenamed : IEvent |
|||
{ |
|||
public string ClientId { get; set; } |
|||
|
|||
public string Name { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,19 @@ |
|||
// ==========================================================================
|
|||
// InfrastructureErrors.cs
|
|||
// Squidex Headless CMS
|
|||
// ==========================================================================
|
|||
// Copyright (c) Squidex Group
|
|||
// All rights reserved.
|
|||
// ==========================================================================
|
|||
|
|||
using Microsoft.Extensions.Logging; |
|||
|
|||
namespace Squidex.Infrastructure |
|||
{ |
|||
public class InfrastructureErrors |
|||
{ |
|||
public static readonly EventId EventHandlingFailed = new EventId(10001, "EventHandlingFailed"); |
|||
|
|||
public static readonly EventId EventDeserializationFailed = new EventId(10002, "EventDeserializationFailed"); |
|||
} |
|||
} |
|||
@ -0,0 +1,33 @@ |
|||
// ==========================================================================
|
|||
// RenameClient.cs
|
|||
// Squidex Headless CMS
|
|||
// ==========================================================================
|
|||
// Copyright (c) Squidex Group
|
|||
// All rights reserved.
|
|||
// ==========================================================================
|
|||
|
|||
using System.Collections.Generic; |
|||
using Squidex.Infrastructure; |
|||
|
|||
namespace Squidex.Write.Apps.Commands |
|||
{ |
|||
public class RenameClient : AppAggregateCommand, IValidatable |
|||
{ |
|||
public string ClientId { get; set; } |
|||
|
|||
public string Name { get; set; } |
|||
|
|||
public void Validate(IList<ValidationError> errors) |
|||
{ |
|||
if (string.IsNullOrWhiteSpace(Name)) |
|||
{ |
|||
errors.Add(new ValidationError("Name cannot be null or empty", nameof(Name))); |
|||
} |
|||
|
|||
if (!ClientId.IsSlug()) |
|||
{ |
|||
errors.Add(new ValidationError("Client id must be a valid slug", nameof(ClientId))); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
// ==========================================================================
|
|||
// RenameClientDto.cs
|
|||
// Squidex Headless CMS
|
|||
// ==========================================================================
|
|||
// Copyright (c) Squidex Group
|
|||
// All rights reserved.
|
|||
// ==========================================================================
|
|||
|
|||
using System.ComponentModel.DataAnnotations; |
|||
|
|||
namespace Squidex.Controllers.Api.Apps.Models |
|||
{ |
|||
public class RenameClientDto |
|||
{ |
|||
/// <summary>
|
|||
/// The new display name of the client.
|
|||
/// </summary>
|
|||
[Required] |
|||
[StringLength(20)] |
|||
public string Name { get; set; } |
|||
} |
|||
} |
|||
Binary file not shown.
|
Before Width: | Height: | Size: 6.5 KiB After Width: | Height: | Size: 6.8 KiB |
Binary file not shown.
Binary file not shown.
Loading…
Reference in new issue