public async Task <IActionResult> PutScripts(string app, string name, [FromBody] SchemaScriptsDto request)
        {
            var command = request.ToCommand();

            var response = await InvokeCommandAsync(command);

            return(Ok(response));
        }
        public async Task <IActionResult> PutSchemaScripts(string app, string name, [FromBody] SchemaScriptsDto request)
        {
            await CommandBus.PublishAsync(request.ToCommand());

            return(NoContent());
        }
Example #3
0
        public static async Task <SchemaDto> CreateSchemaAsync(ISchemasClient schemas, string appName, string name, SchemaScriptsDto scripts = null)
        {
            var schema = await schemas.PostSchemaAsync(appName, new CreateSchemaDto
            {
                Name   = name,
                Fields = new List <UpsertSchemaFieldDto>
                {
                    new UpsertSchemaFieldDto
                    {
                        Name       = TestEntityData.NumberField,
                        Properties = new NumberFieldPropertiesDto
                        {
                            IsRequired = true
                        }
                    },
                    new UpsertSchemaFieldDto
                    {
                        Name       = TestEntityData.StringField,
                        Properties = new StringFieldPropertiesDto
                        {
                            IsRequired = false
                        }
                    },
                    new UpsertSchemaFieldDto
                    {
                        Name       = TestEntityData.GeoField,
                        Properties = new GeolocationFieldPropertiesDto
                        {
                            IsRequired = false
                        }
                    },
                    new UpsertSchemaFieldDto
                    {
                        Name       = TestEntityData.JsonField,
                        Properties = new JsonFieldPropertiesDto
                        {
                            IsRequired = false
                        }
                    },
                    new UpsertSchemaFieldDto
                    {
                        Name         = TestEntityData.LocalizedField,
                        Partitioning = "language",
                        Properties   = new StringFieldPropertiesDto
                        {
                            DefaultValue = "default"
                        }
                    },
                    new UpsertSchemaFieldDto
                    {
                        Name       = TestEntityData.IdField,
                        Properties = new StringFieldPropertiesDto
                        {
                            IsRequired = false
                        }
                    }
                },
                Scripts     = scripts,
                IsPublished = true
            });

            return(schema);
        }