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.
35 lines
1008 B
35 lines
1008 B
// ==========================================================================
|
|
// CreateApp.cs
|
|
// Squidex Headless CMS
|
|
// ==========================================================================
|
|
// Copyright (c) Squidex Group
|
|
// All rights reserved.
|
|
// ==========================================================================
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using Squidex.Infrastructure;
|
|
using Squidex.Infrastructure.CQRS.Commands;
|
|
|
|
namespace Squidex.Write.Apps.Commands
|
|
{
|
|
public sealed class CreateApp : SquidexCommand, IValidatable, IAggregateCommand
|
|
{
|
|
public string Name { get; set; }
|
|
|
|
public Guid AggregateId { get; set; }
|
|
|
|
public CreateApp()
|
|
{
|
|
AggregateId = Guid.NewGuid();
|
|
}
|
|
|
|
public void Validate(IList<ValidationError> errors)
|
|
{
|
|
if (!Name.IsSlug())
|
|
{
|
|
errors.Add(new ValidationError("Name must be a valid slug", nameof(Name)));
|
|
}
|
|
}
|
|
}
|
|
}
|