diff --git a/src/CSharp/EasyMicroservices.ContentsMicroservice.Clients/Connected Services/ContentsGeneratedServices/OpenAPI.cs b/src/CSharp/EasyMicroservices.ContentsMicroservice.Clients/Connected Services/ContentsGeneratedServices/OpenAPI.cs index 5a20696..62c4053 100644 --- a/src/CSharp/EasyMicroservices.ContentsMicroservice.Clients/Connected Services/ContentsGeneratedServices/OpenAPI.cs +++ b/src/CSharp/EasyMicroservices.ContentsMicroservice.Clients/Connected Services/ContentsGeneratedServices/OpenAPI.cs @@ -3187,6 +3187,7 @@ public partial class CategoryContractListMessageContract : System.ComponentModel { private bool _isSuccess; private ErrorContract _error; + private SuccessContract _success; private System.Collections.Generic.ICollection _result; private bool _hasItems; @@ -3220,6 +3221,21 @@ public ErrorContract Error } } + [Newtonsoft.Json.JsonProperty("success", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public SuccessContract Success + { + get { return _success; } + + set + { + if (_success != value) + { + _success = value; + RaisePropertyChanged(); + } + } + } + [Newtonsoft.Json.JsonProperty("result", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.ICollection Result { @@ -3265,6 +3281,7 @@ public partial class CategoryContractMessageContract : System.ComponentModel.INo { private bool _isSuccess; private ErrorContract _error; + private SuccessContract _success; private CategoryContract _result; [Newtonsoft.Json.JsonProperty("isSuccess", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] @@ -3297,6 +3314,21 @@ public ErrorContract Error } } + [Newtonsoft.Json.JsonProperty("success", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public SuccessContract Success + { + get { return _success; } + + set + { + if (_success != value) + { + _success = value; + RaisePropertyChanged(); + } + } + } + [Newtonsoft.Json.JsonProperty("result", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public CategoryContract Result { @@ -3501,6 +3533,7 @@ public partial class ContentContractListMessageContract : System.ComponentModel. { private bool _isSuccess; private ErrorContract _error; + private SuccessContract _success; private System.Collections.Generic.ICollection _result; private bool _hasItems; @@ -3534,6 +3567,21 @@ public ErrorContract Error } } + [Newtonsoft.Json.JsonProperty("success", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public SuccessContract Success + { + get { return _success; } + + set + { + if (_success != value) + { + _success = value; + RaisePropertyChanged(); + } + } + } + [Newtonsoft.Json.JsonProperty("result", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.ICollection Result { @@ -3579,6 +3627,7 @@ public partial class ContentContractMessageContract : System.ComponentModel.INot { private bool _isSuccess; private ErrorContract _error; + private SuccessContract _success; private ContentContract _result; [Newtonsoft.Json.JsonProperty("isSuccess", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] @@ -3611,6 +3660,21 @@ public ErrorContract Error } } + [Newtonsoft.Json.JsonProperty("success", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public SuccessContract Success + { + get { return _success; } + + set + { + if (_success != value) + { + _success = value; + RaisePropertyChanged(); + } + } + } + [Newtonsoft.Json.JsonProperty("result", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public ContentContract Result { @@ -3814,7 +3878,9 @@ public partial class ErrorContract : System.ComponentModel.INotifyPropertyChange private string _message; private string _endUserMessage; private string _details; - private string _stackTrace; + private System.Collections.Generic.ICollection _stackTrace; + private System.Collections.Generic.ICollection _children; + private ServiceDetailsContract _serviceDetails; [Newtonsoft.Json.JsonProperty("validations", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.ICollection Validations @@ -3892,7 +3958,7 @@ public string Details } [Newtonsoft.Json.JsonProperty("stackTrace", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string StackTrace + public System.Collections.Generic.ICollection StackTrace { get { return _stackTrace; } @@ -3906,6 +3972,36 @@ public string StackTrace } } + [Newtonsoft.Json.JsonProperty("children", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection Children + { + get { return _children; } + + set + { + if (_children != value) + { + _children = value; + RaisePropertyChanged(); + } + } + } + + [Newtonsoft.Json.JsonProperty("serviceDetails", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ServiceDetailsContract ServiceDetails + { + get { return _serviceDetails; } + + set + { + if (_serviceDetails != value) + { + _serviceDetails = value; + RaisePropertyChanged(); + } + } + } + public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; protected virtual void RaisePropertyChanged([System.Runtime.CompilerServices.CallerMemberName] string propertyName = null) @@ -3938,7 +4034,7 @@ public enum FailedReasonType InternalError = 8, - Dupplicate = 9, + Duplicate = 9, Empty = 10, @@ -4363,6 +4459,7 @@ public partial class Int64MessageContract : System.ComponentModel.INotifyPropert { private bool _isSuccess; private ErrorContract _error; + private SuccessContract _success; private long _result; [Newtonsoft.Json.JsonProperty("isSuccess", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] @@ -4395,6 +4492,21 @@ public ErrorContract Error } } + [Newtonsoft.Json.JsonProperty("success", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public SuccessContract Success + { + get { return _success; } + + set + { + if (_success != value) + { + _success = value; + RaisePropertyChanged(); + } + } + } + [Newtonsoft.Json.JsonProperty("result", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public long Result { @@ -4627,6 +4739,7 @@ public partial class LanguageContractListMessageContract : System.ComponentModel { private bool _isSuccess; private ErrorContract _error; + private SuccessContract _success; private System.Collections.Generic.ICollection _result; private bool _hasItems; @@ -4660,6 +4773,21 @@ public ErrorContract Error } } + [Newtonsoft.Json.JsonProperty("success", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public SuccessContract Success + { + get { return _success; } + + set + { + if (_success != value) + { + _success = value; + RaisePropertyChanged(); + } + } + } + [Newtonsoft.Json.JsonProperty("result", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.ICollection Result { @@ -4705,6 +4833,7 @@ public partial class LanguageContractMessageContract : System.ComponentModel.INo { private bool _isSuccess; private ErrorContract _error; + private SuccessContract _success; private LanguageContract _result; [Newtonsoft.Json.JsonProperty("isSuccess", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] @@ -4737,6 +4866,21 @@ public ErrorContract Error } } + [Newtonsoft.Json.JsonProperty("success", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public SuccessContract Success + { + get { return _success; } + + set + { + if (_success != value) + { + _success = value; + RaisePropertyChanged(); + } + } + } + [Newtonsoft.Json.JsonProperty("result", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public LanguageContract Result { @@ -4813,6 +4957,7 @@ public partial class MessageContract : System.ComponentModel.INotifyPropertyChan { private bool _isSuccess; private ErrorContract _error; + private SuccessContract _success; [Newtonsoft.Json.JsonProperty("isSuccess", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool IsSuccess @@ -4844,6 +4989,129 @@ public ErrorContract Error } } + [Newtonsoft.Json.JsonProperty("success", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public SuccessContract Success + { + get { return _success; } + + set + { + if (_success != value) + { + _success = value; + RaisePropertyChanged(); + } + } + } + + public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; + + protected virtual void RaisePropertyChanged([System.Runtime.CompilerServices.CallerMemberName] string propertyName = null) + { + var handler = PropertyChanged; + if (handler != null) + handler(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName)); + } + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.3.0))")] + public partial class ServiceDetailsContract : System.ComponentModel.INotifyPropertyChanged + { + private string _servieRouteAddress; + private string _methodName; + private string _path; + private string _porjectName; + + [Newtonsoft.Json.JsonProperty("servieRouteAddress", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string ServieRouteAddress + { + get { return _servieRouteAddress; } + + set + { + if (_servieRouteAddress != value) + { + _servieRouteAddress = value; + RaisePropertyChanged(); + } + } + } + + [Newtonsoft.Json.JsonProperty("methodName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string MethodName + { + get { return _methodName; } + + set + { + if (_methodName != value) + { + _methodName = value; + RaisePropertyChanged(); + } + } + } + + [Newtonsoft.Json.JsonProperty("path", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Path + { + get { return _path; } + + set + { + if (_path != value) + { + _path = value; + RaisePropertyChanged(); + } + } + } + + [Newtonsoft.Json.JsonProperty("porjectName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string PorjectName + { + get { return _porjectName; } + + set + { + if (_porjectName != value) + { + _porjectName = value; + RaisePropertyChanged(); + } + } + } + + public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; + + protected virtual void RaisePropertyChanged([System.Runtime.CompilerServices.CallerMemberName] string propertyName = null) + { + var handler = PropertyChanged; + if (handler != null) + handler(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName)); + } + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.3.0))")] + public partial class SuccessContract : System.ComponentModel.INotifyPropertyChanged + { + private string _endUserMessage; + + [Newtonsoft.Json.JsonProperty("endUserMessage", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string EndUserMessage + { + get { return _endUserMessage; } + + set + { + if (_endUserMessage != value) + { + _endUserMessage = value; + RaisePropertyChanged(); + } + } + } + public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; protected virtual void RaisePropertyChanged([System.Runtime.CompilerServices.CallerMemberName] string propertyName = null) diff --git a/src/CSharp/EasyMicroservices.ContentsMicroservice.Clients/Connected Services/ContentsGeneratedServices/OpenAPI.nswag.json b/src/CSharp/EasyMicroservices.ContentsMicroservice.Clients/Connected Services/ContentsGeneratedServices/OpenAPI.nswag.json index 06a53d4..21647e8 100644 --- a/src/CSharp/EasyMicroservices.ContentsMicroservice.Clients/Connected Services/ContentsGeneratedServices/OpenAPI.nswag.json +++ b/src/CSharp/EasyMicroservices.ContentsMicroservice.Clients/Connected Services/ContentsGeneratedServices/OpenAPI.nswag.json @@ -1642,6 +1642,9 @@ "error": { "$ref": "#/components/schemas/ErrorContract" }, + "success": { + "$ref": "#/components/schemas/SuccessContract" + }, "result": { "title": "List", "type": "array", @@ -1667,6 +1670,9 @@ "error": { "$ref": "#/components/schemas/ErrorContract" }, + "success": { + "$ref": "#/components/schemas/SuccessContract" + }, "result": { "$ref": "#/components/schemas/CategoryContract" } @@ -1731,6 +1737,9 @@ "error": { "$ref": "#/components/schemas/ErrorContract" }, + "success": { + "$ref": "#/components/schemas/SuccessContract" + }, "result": { "title": "List", "type": "array", @@ -1756,6 +1765,9 @@ "error": { "$ref": "#/components/schemas/ErrorContract" }, + "success": { + "$ref": "#/components/schemas/SuccessContract" + }, "result": { "$ref": "#/components/schemas/ContentContract" } @@ -1839,8 +1851,23 @@ "nullable": true }, "stackTrace": { - "type": "string", - "nullable": true + "title": "List", + "type": "array", + "nullable": true, + "items": { + "type": "string" + } + }, + "children": { + "title": "List", + "type": "array", + "nullable": true, + "items": { + "$ref": "#/components/schemas/ErrorContract" + } + }, + "serviceDetails": { + "$ref": "#/components/schemas/ServiceDetailsContract" } } }, @@ -1857,7 +1884,7 @@ "SessionAccessDenied", "AccessDenied", "InternalError", - "Dupplicate", + "Duplicate", "Empty", "NotFound", "ValidationsError", @@ -2033,6 +2060,9 @@ "error": { "$ref": "#/components/schemas/ErrorContract" }, + "success": { + "$ref": "#/components/schemas/SuccessContract" + }, "result": { "type": "integer", "format": "int64" @@ -2111,6 +2141,9 @@ "error": { "$ref": "#/components/schemas/ErrorContract" }, + "success": { + "$ref": "#/components/schemas/SuccessContract" + }, "result": { "title": "List", "type": "array", @@ -2136,6 +2169,9 @@ "error": { "$ref": "#/components/schemas/ErrorContract" }, + "success": { + "$ref": "#/components/schemas/SuccessContract" + }, "result": { "$ref": "#/components/schemas/LanguageContract" } @@ -2164,6 +2200,41 @@ }, "error": { "$ref": "#/components/schemas/ErrorContract" + }, + "success": { + "$ref": "#/components/schemas/SuccessContract" + } + } + }, + "ServiceDetailsContract": { + "type": "object", + "additionalProperties": false, + "properties": { + "servieRouteAddress": { + "type": "string", + "nullable": true + }, + "methodName": { + "type": "string", + "nullable": true + }, + "path": { + "type": "string", + "nullable": true + }, + "porjectName": { + "type": "string", + "nullable": true + } + } + }, + "SuccessContract": { + "type": "object", + "additionalProperties": false, + "properties": { + "endUserMessage": { + "type": "string", + "nullable": true } } }, diff --git a/src/CSharp/EasyMicroservices.ContentsMicroservice.StartUp/DatabaseBuilder.cs b/src/CSharp/EasyMicroservices.ContentsMicroservice.StartUp/DatabaseBuilder.cs index cfae9ed..c2f8088 100644 --- a/src/CSharp/EasyMicroservices.ContentsMicroservice.StartUp/DatabaseBuilder.cs +++ b/src/CSharp/EasyMicroservices.ContentsMicroservice.StartUp/DatabaseBuilder.cs @@ -17,8 +17,8 @@ public class DatabaseBuilder : IDatabaseBuilder public void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { - //optionsBuilder.UseInMemoryDatabase("ContentDatabase"); - optionsBuilder.UseSqlServer(config.GetConnectionString("local")); + optionsBuilder.UseInMemoryDatabase("ContentDatabase"); + //optionsBuilder.UseSqlServer(config.GetConnectionString("local")); } } } diff --git a/src/CSharp/EasyMicroservices.ContentsMicroservice.WebApi/Controllers/ContentController.cs b/src/CSharp/EasyMicroservices.ContentsMicroservice.WebApi/Controllers/ContentController.cs index 816297b..2909c71 100644 --- a/src/CSharp/EasyMicroservices.ContentsMicroservice.WebApi/Controllers/ContentController.cs +++ b/src/CSharp/EasyMicroservices.ContentsMicroservice.WebApi/Controllers/ContentController.cs @@ -77,7 +77,7 @@ public async Task> AddContentWithKey(AddConten var getCategoryResult = await categorylogic.GetBy(x => x.Key == request.Key); if (getCategoryResult.IsSuccess) - return getCategoryResult.ToContract(); + return (FailedReasonType.Duplicate, "Category already exists."); var languages = await languageLogic.GetAll(); var notFoundLanguages = request.LanguageData.Select(x => x.Language).Except(languages.Result.Select(o => o.Name)); diff --git a/src/CSharp/EasyMicroservices.ContentsMicroservice.WebApi/Program.cs b/src/CSharp/EasyMicroservices.ContentsMicroservice.WebApi/Program.cs index adc6569..3eb73f1 100644 --- a/src/CSharp/EasyMicroservices.ContentsMicroservice.WebApi/Program.cs +++ b/src/CSharp/EasyMicroservices.ContentsMicroservice.WebApi/Program.cs @@ -78,7 +78,7 @@ public static async Task Main(string[] args) { using var context = scope.ServiceProvider.GetService(); await context.Database.EnsureCreatedAsync(); - await context.Database.MigrateAsync(); + //await context.Database.MigrateAsync(); await context.DisposeAsync(); var service = scope.ServiceProvider.GetService(); await service.Initialize("Content", config.GetValue("RootAddresses:WhiteLabel"), typeof(ContentContext));