From 73a557802ad7234a6f03ef8bd2a8d86d8887af41 Mon Sep 17 00:00:00 2001 From: Aaqib Date: Sat, 31 Oct 2020 22:14:50 +0530 Subject: [PATCH] Update Field Client Validation --- Plugins/RawCMS.Plugins.Core/Model/FieldClientValidation.cs | 3 +++ RawCMS.Library/Schema/CollectionSchema.cs | 1 + RawCMS.Library/Service/EntityService.cs | 7 ++++--- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Plugins/RawCMS.Plugins.Core/Model/FieldClientValidation.cs b/Plugins/RawCMS.Plugins.Core/Model/FieldClientValidation.cs index c5df909c..0d464ad9 100644 --- a/Plugins/RawCMS.Plugins.Core/Model/FieldClientValidation.cs +++ b/Plugins/RawCMS.Plugins.Core/Model/FieldClientValidation.cs @@ -6,10 +6,13 @@ // Daniele Fontani, Emanuele Bucarelli, Francesco Mina' // true //****************************************************************************** +using System.ComponentModel.DataAnnotations; + namespace RawCMS.Plugins.Core.Model { public class FieldClientValidation { + [Required] public string Name { get; set; } public string Function { get; set; } } diff --git a/RawCMS.Library/Schema/CollectionSchema.cs b/RawCMS.Library/Schema/CollectionSchema.cs index d5e1b64f..4e065fb5 100644 --- a/RawCMS.Library/Schema/CollectionSchema.cs +++ b/RawCMS.Library/Schema/CollectionSchema.cs @@ -23,6 +23,7 @@ namespace RawCMS.Library.Schema public class CollectionSchema { public string CollectionName { get; set; } + public bool AllowNonMappedFields { get; set; } public List FieldSettings { get; set; } = new List(); diff --git a/RawCMS.Library/Service/EntityService.cs b/RawCMS.Library/Service/EntityService.cs index 001ffee3..c78ba6cb 100644 --- a/RawCMS.Library/Service/EntityService.cs +++ b/RawCMS.Library/Service/EntityService.cs @@ -75,10 +75,11 @@ private CollectionSchema AddIdSchemaField(CollectionSchema schema) { Field field = new Field { - Name = "_id", //BaseType = FieldBaseType.String, - Type = "ObjectId", - Required = true + Name = "_id", + Required = true, + Type = "ObjectId" + }; schema.FieldSettings.Add(field); }