diff --git a/IoTSharp.Data/Customer.cs b/IoTSharp.Data/Customer.cs index 8070db901db888188a24a7342045c2f13a4c1143..5d486001d0b129a42c130bdd7a8179042f182104 100644 --- a/IoTSharp.Data/Customer.cs +++ b/IoTSharp.Data/Customer.cs @@ -20,7 +20,6 @@ namespace IoTSharp.Data public string Street { get; set; } public string Address { get; set; } public int ZipCode { get; set; } - public Guid? TenantId { get; set; } [System.Text.Json.Serialization.JsonIgnore] [Newtonsoft.Json.JsonIgnore] diff --git a/IoTSharp.sln b/IoTSharp.sln index 9ab00d945b2617e6d9239cf99f6a6a07eedae932..c4d85059320c7f295fc6361c45365c65210cfc9a 100644 --- a/IoTSharp.sln +++ b/IoTSharp.sln @@ -59,8 +59,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IoTSharp.Interpreter", "IoT EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IoTSharp.Data.InMemory", "IoTSharp.Data.Storage\IoTSharp.Data.InMemory\IoTSharp.Data.InMemory.csproj", "{A57917E3-6F60-4D0E-8F13-36E5088DEFCE}" EndProject -Project("{9092AA53-FB77-4645-B42D-1CCCA6BD08BD}") = "IoTSharp.Docs", "docs\IoTSharp.Docs.njsproj", "{F5644BA6-2A0C-49A5-9C9B-3CECD6DB2D1F}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IoTSharp.Data.Cassandra", "IoTSharp.Data.Storage\IoTSharp.Data.Cassandra\IoTSharp.Data.Cassandra.csproj", "{9C6FA709-3334-4C39-922D-6FF5ADB8C683}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "2.workflows", "2.workflows", "{59A51D63-F292-46F0-A4BF-975C98966DAA}" @@ -161,8 +159,6 @@ Global {A57917E3-6F60-4D0E-8F13-36E5088DEFCE}.Debug|Any CPU.Build.0 = Debug|Any CPU {A57917E3-6F60-4D0E-8F13-36E5088DEFCE}.Release|Any CPU.ActiveCfg = Release|Any CPU {A57917E3-6F60-4D0E-8F13-36E5088DEFCE}.Release|Any CPU.Build.0 = Release|Any CPU - {F5644BA6-2A0C-49A5-9C9B-3CECD6DB2D1F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F5644BA6-2A0C-49A5-9C9B-3CECD6DB2D1F}.Release|Any CPU.ActiveCfg = Release|Any CPU {9C6FA709-3334-4C39-922D-6FF5ADB8C683}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9C6FA709-3334-4C39-922D-6FF5ADB8C683}.Debug|Any CPU.Build.0 = Debug|Any CPU {9C6FA709-3334-4C39-922D-6FF5ADB8C683}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/IoTSharp/Controllers/CustomersController.cs b/IoTSharp/Controllers/CustomersController.cs index 8c41ef682a54c0f82c4c5a87689ff25893245700..1f42df086fe46f21fb02cb97dc4e19c0dc81929c 100644 --- a/IoTSharp/Controllers/CustomersController.cs +++ b/IoTSharp/Controllers/CustomersController.cs @@ -52,7 +52,7 @@ namespace IoTSharp.Controllers /// /// [HttpPost("Tenant")] - [Authorize(Roles = nameof(UserRole.NormalUser))] + [Authorize(Roles = nameof(UserRole.TenantAdmin))] [ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(typeof(ApiResult), StatusCodes.Status404NotFound)] [ProducesDefaultResponseType] @@ -61,15 +61,14 @@ namespace IoTSharp.Controllers var profile = this.GetUserProfile(); if (m.tenantId != Guid.Empty) { - var querym = _context.Customer.Where(c => c.Deleted == false && c.TenantId == m.tenantId); + var querym = _context.Customer.Include(c=>c.Tenant).Where(c => !c.Deleted && c.Tenant.Id==m.tenantId); var data = await m.Query(querym, c => c.Name); return new ApiResult>(ApiCode.Success, "OK", data); } else { - var querym = _context.Customer.Where(c => c.Deleted == false); - var data = await m.Query(querym, c => c.Name); - return new ApiResult>(ApiCode.Success, "OK", data); + + return new ApiResult>(ApiCode.NotFoundCustomer, "没有指定客户ID",new PagedData ()); } }