mirror of https://github.com/Squidex/squidex.git
28 changed files with 181 additions and 154 deletions
@ -0,0 +1,28 @@ |
|||||
|
// ==========================================================================
|
||||
|
// AddFieldDto.cs
|
||||
|
// Squidex Headless CMS
|
||||
|
// ==========================================================================
|
||||
|
// Copyright (c) Squidex Group
|
||||
|
// All rights reserved.
|
||||
|
// ==========================================================================
|
||||
|
|
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
|
||||
|
namespace Squidex.Controllers.Api.Schemas.Models |
||||
|
{ |
||||
|
public sealed class AddFieldDto |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// The name of the field. Must be unique within the schema.
|
||||
|
/// </summary>
|
||||
|
[Required] |
||||
|
[RegularExpression("^[a-z0-9]+(\\-[a-z0-9]+)*$")]
|
||||
|
public string Name { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// The field properties.
|
||||
|
/// </summary>
|
||||
|
[Required] |
||||
|
public FieldPropertiesDto Properties { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,48 @@ |
|||||
|
// ==========================================================================
|
||||
|
// FieldDto.cs
|
||||
|
// Squidex Headless CMS
|
||||
|
// ==========================================================================
|
||||
|
// Copyright (c) Squidex Group
|
||||
|
// All rights reserved.
|
||||
|
// ==========================================================================
|
||||
|
|
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using System.Runtime.Serialization; |
||||
|
using Newtonsoft.Json; |
||||
|
using NJsonSchema.Converters; |
||||
|
using Squidex.Core.Schemas; |
||||
|
using Dtos = Squidex.Controllers.Api.Schemas.Models.Fields; |
||||
|
|
||||
|
namespace Squidex.Controllers.Api.Schemas.Models |
||||
|
{ |
||||
|
[JsonConverter(typeof(JsonInheritanceConverter), "fieldType")] |
||||
|
[KnownType(typeof(Dtos.NumberField))] |
||||
|
[KnownType(typeof(Dtos.StringField))] |
||||
|
public abstract class FieldPropertiesDto |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// Optional label for the editor.
|
||||
|
/// </summary>
|
||||
|
[StringLength(100)] |
||||
|
public string Label { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Hints to describe the schema.
|
||||
|
/// </summary>
|
||||
|
[StringLength(1000)] |
||||
|
public string Hints { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Placeholder to show when no value has been entered.
|
||||
|
/// </summary>
|
||||
|
[StringLength(100)] |
||||
|
public string Placeholder { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Indicates if the field is required.
|
||||
|
/// </summary>
|
||||
|
public bool IsRequired { get; set; } |
||||
|
|
||||
|
public abstract FieldProperties ToProperties(); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,15 @@ |
|||||
|
// ==========================================================================
|
||||
|
// UpdateFieldDto.cs
|
||||
|
// Squidex Headless CMS
|
||||
|
// ==========================================================================
|
||||
|
// Copyright (c) Squidex Group
|
||||
|
// All rights reserved.
|
||||
|
// ==========================================================================
|
||||
|
|
||||
|
namespace Squidex.Controllers.Api.Schemas.Models |
||||
|
{ |
||||
|
public class UpdateFieldDto |
||||
|
{ |
||||
|
public FieldPropertiesDto Properties { get; set; } |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue