├── Order ├── obj │ ├── Debug │ │ └── netcoreapp3.1 │ │ │ ├── Order.Api.csproj.FileListAbsolute.txt │ │ │ ├── staticwebassets │ │ │ ├── Order.StaticWebAssets.Manifest.cache │ │ │ └── Order.StaticWebAssets.xml │ │ │ ├── Order.AssemblyInfoInputs.cache │ │ │ ├── Order.RazorTargetAssemblyInfo.cache │ │ │ ├── apphost.exe │ │ │ ├── Order.Api.exe │ │ │ ├── Order.assets.cache │ │ │ ├── Order.Api.assets.cache │ │ │ ├── Order.csprojAssemblyReference.cache │ │ │ ├── .NETCoreApp,Version=v3.1.AssemblyAttributes.cs │ │ │ ├── Order.csproj.FileListAbsolute.txt │ │ │ └── Order.AssemblyInfo.cs │ ├── Order.csproj.nuget.g.targets │ ├── Order.Api.csproj.nuget.g.targets │ ├── Order.csproj.nuget.g.props │ ├── Order.Api.csproj.nuget.g.props │ ├── Order.csproj.nuget.dgspec.json │ └── Order.Api.csproj.nuget.dgspec.json ├── bin │ └── Debug │ │ └── netcoreapp3.1 │ │ └── Order.Api.StaticWebAssets.xml ├── appsettings.json ├── appsettings.Development.json ├── Properties │ └── launchSettings.json ├── Program.cs ├── Order.Api.csproj.user ├── Dockerfile ├── Order.Api.xml ├── Order.Api.csproj ├── Extensions │ ├── SwaggerExtensions.cs │ └── RegisterIoCExtensions.cs ├── Controllers │ ├── OrderController.cs │ ├── ProductController.cs │ ├── UserController.cs │ └── ClientController.cs └── Startup.cs ├── Order.Domain ├── obj │ ├── Debug │ │ └── netstandard2.0 │ │ │ ├── Order.Domain.csproj.FileListAbsolute.txt │ │ │ ├── Order.Domain.assets.cache │ │ │ └── .NETStandard,Version=v2.0.AssemblyAttributes.cs │ ├── Order.Domain.csproj.nuget.g.targets │ ├── Order.Domain.csproj.nuget.g.props │ ├── Order.Domain.csproj.nuget.dgspec.json │ └── project.assets.json ├── Common │ ├── IGenerators.cs │ ├── ITimeProvider.cs │ ├── Generators.cs │ └── TimeProvider.cs ├── Models │ ├── EntityBase.cs │ ├── UserModel.cs │ ├── ProductModel.cs │ ├── ClientModel.cs │ ├── OrderModel.cs │ └── OrderItemModel.cs ├── Interfaces │ ├── Repositories │ │ ├── DataConnector │ │ │ └── IDbConnector.cs │ │ ├── IUnitOfWork.cs │ │ ├── IClientRepository.cs │ │ ├── IProductRepository.cs │ │ ├── IUserRepository.cs │ │ └── IOrderRepository.cs │ └── Services │ │ ├── ISecurityService.cs │ │ ├── IClientService.cs │ │ ├── IOrderService.cs │ │ ├── IProductService.cs │ │ └── IUserService.cs ├── Order.Domain.csproj ├── Validations │ ├── Base │ │ ├── Report.cs │ │ ├── GetValidations.cs │ │ └── Response.cs │ ├── OrderValidation.cs │ ├── ProductValidation.cs │ ├── UserValidation.cs │ └── ClientValidation.cs └── Services │ ├── SecurityService.cs │ ├── ClientService.cs │ ├── ProductService.cs │ ├── OrderService.cs │ └── UserService.cs ├── Order.Infra ├── obj │ ├── Debug │ │ └── netstandard2.0 │ │ │ ├── Order.Infra.csproj.FileListAbsolute.txt │ │ │ ├── Order.Infra.assets.cache │ │ │ └── .NETStandard,Version=v2.0.AssemblyAttributes.cs │ ├── Order.Infra.csproj.nuget.g.targets │ ├── Order.Infra.csproj.nuget.g.props │ └── Order.Infra.csproj.nuget.dgspec.json ├── Order.Infra.csproj ├── DataConnector │ └── SqlConnector.cs └── Repositories │ ├── UnitOfWork.cs │ ├── ProductRepository.cs │ ├── ClientRepository.cs │ ├── UserRepository.cs │ └── OrderRepository.cs ├── Order.Application ├── obj │ ├── Debug │ │ └── netstandard2.0 │ │ │ ├── Order.Application.csproj.FileListAbsolute.txt │ │ │ ├── Order.Application.assets.cache │ │ │ └── .NETStandard,Version=v2.0.AssemblyAttributes.cs │ ├── Order.Application.csproj.nuget.g.targets │ ├── Order.Application.csproj.nuget.g.props │ └── Order.Application.csproj.nuget.dgspec.json ├── Order.Application.xml ├── Models │ └── AuthSettings.cs ├── DataContract │ ├── Request │ │ ├── User │ │ │ ├── AuthRequest.cs │ │ │ └── CreateUserRequest.cs │ │ ├── Product │ │ │ └── CreateProductRequest.cs │ │ ├── Order │ │ │ ├── CreateOrderItemRequest.cs │ │ │ └── CreateOrderRequest.cs │ │ └── Client │ │ │ ├── CreateClientRequest.cs │ │ │ └── UpdateClientRequest.cs │ └── Response │ │ ├── User │ │ ├── UserResponse.cs │ │ └── AuthResponse.cs │ │ ├── Product │ │ └── ProductResponse.cs │ │ ├── Order │ │ ├── OrderItemResponse.cs │ │ └── OrderResponse.cs │ │ └── Client │ │ └── ClientResponse.cs ├── Interfacds │ ├── Security │ │ └── ITokenManager.cs │ ├── IProductApplication.cs │ ├── IOrderApplication.cs │ ├── IUserApplication.cs │ └── IClientApplication.cs ├── Order.Application.csproj ├── Applications │ ├── ProductApplication.cs │ ├── OrderApplication.cs │ ├── ClientApplication.cs │ └── UserApplication.cs ├── Mapper │ └── Core.cs └── Security │ └── TokenManager.cs ├── .vs └── Order │ ├── v16 │ └── .suo │ └── DesignTimeBuild │ └── .dtbcache.v2 ├── README.md ├── .dockerignore ├── Order.sln ├── scrip order.sql └── .gitignore /Order/obj/Debug/netcoreapp3.1/Order.Api.csproj.FileListAbsolute.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Order.Domain/obj/Debug/netstandard2.0/Order.Domain.csproj.FileListAbsolute.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Order.Infra/obj/Debug/netstandard2.0/Order.Infra.csproj.FileListAbsolute.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Order/obj/Debug/netcoreapp3.1/staticwebassets/Order.StaticWebAssets.Manifest.cache: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Order.Application/obj/Debug/netstandard2.0/Order.Application.csproj.FileListAbsolute.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.vs/Order/v16/.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/programevc/Projeto_Order/HEAD/.vs/Order/v16/.suo -------------------------------------------------------------------------------- /Order/obj/Debug/netcoreapp3.1/Order.AssemblyInfoInputs.cache: -------------------------------------------------------------------------------- 1 | 9b28612f9c7401094aab917992d2dcb618f132b6 2 | -------------------------------------------------------------------------------- /Order/obj/Debug/netcoreapp3.1/staticwebassets/Order.StaticWebAssets.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Order/obj/Debug/netcoreapp3.1/Order.RazorTargetAssemblyInfo.cache: -------------------------------------------------------------------------------- 1 | 0403598e4700d9e93597ef5f08a855e39da1bba2 2 | -------------------------------------------------------------------------------- /.vs/Order/DesignTimeBuild/.dtbcache.v2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/programevc/Projeto_Order/HEAD/.vs/Order/DesignTimeBuild/.dtbcache.v2 -------------------------------------------------------------------------------- /Order/bin/Debug/netcoreapp3.1/Order.Api.StaticWebAssets.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Order/obj/Debug/netcoreapp3.1/apphost.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/programevc/Projeto_Order/HEAD/Order/obj/Debug/netcoreapp3.1/apphost.exe -------------------------------------------------------------------------------- /Order/obj/Debug/netcoreapp3.1/Order.Api.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/programevc/Projeto_Order/HEAD/Order/obj/Debug/netcoreapp3.1/Order.Api.exe -------------------------------------------------------------------------------- /Order/obj/Debug/netcoreapp3.1/Order.assets.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/programevc/Projeto_Order/HEAD/Order/obj/Debug/netcoreapp3.1/Order.assets.cache -------------------------------------------------------------------------------- /Order.Domain/Common/IGenerators.cs: -------------------------------------------------------------------------------- 1 | namespace Order.Domain.Common 2 | { 3 | public interface IGenerators 4 | { 5 | string Generate(); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Order/obj/Debug/netcoreapp3.1/Order.Api.assets.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/programevc/Projeto_Order/HEAD/Order/obj/Debug/netcoreapp3.1/Order.Api.assets.cache -------------------------------------------------------------------------------- /Order.Infra/obj/Debug/netstandard2.0/Order.Infra.assets.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/programevc/Projeto_Order/HEAD/Order.Infra/obj/Debug/netstandard2.0/Order.Infra.assets.cache -------------------------------------------------------------------------------- /Order.Domain/obj/Debug/netstandard2.0/Order.Domain.assets.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/programevc/Projeto_Order/HEAD/Order.Domain/obj/Debug/netstandard2.0/Order.Domain.assets.cache -------------------------------------------------------------------------------- /Order/obj/Debug/netcoreapp3.1/Order.csprojAssemblyReference.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/programevc/Projeto_Order/HEAD/Order/obj/Debug/netcoreapp3.1/Order.csprojAssemblyReference.cache -------------------------------------------------------------------------------- /Order.Application/Order.Application.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Order.Application 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Order.Application/obj/Debug/netstandard2.0/Order.Application.assets.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/programevc/Projeto_Order/HEAD/Order.Application/obj/Debug/netstandard2.0/Order.Application.assets.cache -------------------------------------------------------------------------------- /Order.Domain/Common/ITimeProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Order.Domain.Common 4 | { 5 | public interface ITimeProvider 6 | { 7 | DateTime utcDateTime(); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Order.Application/Models/AuthSettings.cs: -------------------------------------------------------------------------------- 1 | namespace Order.Application.Models 2 | { 3 | public class AuthSettings 4 | { 5 | public string Secret { get; set; } 6 | public int ExpireIn { get; set; } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Order.Domain/Common/Generators.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Order.Domain.Common 4 | { 5 | public class Generators : IGenerators 6 | { 7 | public string Generate() => Guid.NewGuid().ToString("N"); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Order.Domain/Common/TimeProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Order.Domain.Common 4 | { 5 | public class TimeProvider : ITimeProvider 6 | { 7 | public DateTime utcDateTime() => DateTime.UtcNow; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Order.Domain/Models/EntityBase.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Order.Domain.Models 4 | { 5 | public abstract class EntityBase 6 | { 7 | public string Id { get; set; } 8 | public DateTime CreatedAt { get; set; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Order.Application/DataContract/Request/User/AuthRequest.cs: -------------------------------------------------------------------------------- 1 | namespace Order.Application.DataContract.Request.User 2 | { 3 | public class AuthRequest 4 | { 5 | public string Login { get; set; } 6 | public string Password { get; set; } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Order/obj/Debug/netcoreapp3.1/.NETCoreApp,Version=v3.1.AssemblyAttributes.cs: -------------------------------------------------------------------------------- 1 | // 2 | using System; 3 | using System.Reflection; 4 | [assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v3.1", FrameworkDisplayName = "")] 5 | -------------------------------------------------------------------------------- /Order.Domain/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs: -------------------------------------------------------------------------------- 1 | // 2 | using System; 3 | using System.Reflection; 4 | [assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETStandard,Version=v2.0", FrameworkDisplayName = "")] 5 | -------------------------------------------------------------------------------- /Order.Infra/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs: -------------------------------------------------------------------------------- 1 | // 2 | using System; 3 | using System.Reflection; 4 | [assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETStandard,Version=v2.0", FrameworkDisplayName = "")] 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Projeto_Order 2 | Projeto mais avançado, onde uso vários padrões desenvolvimento. 3 | 4 | ## Veremos neste projeot 5 | * Injeção de dependência, 6 | * JWT, 7 | * UnitOfWork, 8 | * AutoMapper, 9 | * Dapper, 10 | * Rest, 11 | * Swagger, 12 | dentre outros. 13 | 14 | -------------------------------------------------------------------------------- /Order.Application/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.cs: -------------------------------------------------------------------------------- 1 | // 2 | using System; 3 | using System.Reflection; 4 | [assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETStandard,Version=v2.0", FrameworkDisplayName = "")] 5 | -------------------------------------------------------------------------------- /Order.Domain/Models/UserModel.cs: -------------------------------------------------------------------------------- 1 | namespace Order.Domain.Models 2 | { 3 | public class UserModel : EntityBase 4 | { 5 | public string Name { get; set; } 6 | public string Login { get; set; } 7 | public string PasswordHash { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Order.Domain/Models/ProductModel.cs: -------------------------------------------------------------------------------- 1 | namespace Order.Domain.Models 2 | { 3 | public class ProductModel :EntityBase 4 | { 5 | public string Description { get; set; } 6 | public decimal SellValue { get; set; } 7 | public int Stock { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Order.Application/DataContract/Response/User/UserResponse.cs: -------------------------------------------------------------------------------- 1 | namespace Order.Application.DataContract.Response.Client 2 | { 3 | public sealed class UserResponse 4 | { 5 | public string Id { get; set; } 6 | public string Name { get; set; } 7 | public string Login { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Order.Application/DataContract/Response/User/AuthResponse.cs: -------------------------------------------------------------------------------- 1 | namespace Order.Application.DataContract.Response.User 2 | { 3 | public sealed class AuthResponse 4 | { 5 | public string Token { get; set; } 6 | public string Type { get; set; } 7 | public int ExpireIn { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Order.Domain/Models/ClientModel.cs: -------------------------------------------------------------------------------- 1 | namespace Order.Domain.Models 2 | { 3 | public class ClientModel : EntityBase 4 | { 5 | public string Name { get; set; } 6 | public string Email { get; set; } 7 | public string PhoneNumber { get; set; } 8 | public string Adress { get; set; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Order.Domain/Models/OrderModel.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Order.Domain.Models 4 | { 5 | public class OrderModel: EntityBase 6 | { 7 | public ClientModel Client { get; set; } 8 | public UserModel User { get; set; } 9 | public List Items { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Order.Application/DataContract/Request/Product/CreateProductRequest.cs: -------------------------------------------------------------------------------- 1 | namespace Order.Application.DataContract.Request.Product 2 | { 3 | public sealed class CreateProductRequest 4 | { 5 | public string Description { get; set; } 6 | public decimal SellValue { get; set; } 7 | public int Stock { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Order.Application/DataContract/Request/Order/CreateOrderItemRequest.cs: -------------------------------------------------------------------------------- 1 | namespace Order.Application.DataContract.Request.Order 2 | { 3 | public sealed class CreateOrderItemRequest 4 | { 5 | public string ProductId { get; set; } 6 | public decimal SellValue { get; set; } 7 | public int Quantity { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Order/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "ConnectionStrings": { 3 | "default": "Server=.\\sqlexpress;Database=PVC;Trusted_Connection=True;" 4 | }, 5 | "Logging": { 6 | "LogLevel": { 7 | "Default": "Information", 8 | "Microsoft": "Warning", 9 | "Microsoft.Hosting.Lifetime": "Information" 10 | } 11 | }, 12 | "AllowedHosts": "*" 13 | } 14 | -------------------------------------------------------------------------------- /Order.Application/Interfacds/Security/ITokenManager.cs: -------------------------------------------------------------------------------- 1 | using Order.Application.DataContract.Response.User; 2 | using Order.Domain.Models; 3 | using System.Threading.Tasks; 4 | 5 | namespace Order.Application.Interfacds.Security 6 | { 7 | public interface ITokenManager 8 | { 9 | Task GenerateTokenAsync(UserModel user); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Order.Application/DataContract/Response/Product/ProductResponse.cs: -------------------------------------------------------------------------------- 1 | namespace Order.Application.DataContract.Response.Product 2 | { 3 | public class ProductResponse 4 | { 5 | public string Id { get; set; } 6 | public string Description { get; set; } 7 | public decimal SellValue { get; set; } 8 | public int Stock { get; set; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Order.Application/DataContract/Request/User/CreateUserRequest.cs: -------------------------------------------------------------------------------- 1 | namespace Order.Application.DataContract.Request.User 2 | { 3 | public class CreateUserRequest 4 | { 5 | public string Name { get; set; } 6 | public string Login { get; set; } 7 | public string Password { get; set; } 8 | public string ConfirmPassword { get; set; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Order.Application/DataContract/Request/Client/CreateClientRequest.cs: -------------------------------------------------------------------------------- 1 | namespace Order.Application.DataContract.Request.Client 2 | { 3 | public sealed class CreateClientRequest 4 | { 5 | public string Name { get; set; } 6 | public string Email { get; set; } 7 | public string PhoneNumber { get; set; } 8 | public string Adress { get; set; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Order.Application/DataContract/Response/Order/OrderItemResponse.cs: -------------------------------------------------------------------------------- 1 | namespace Order.Application.DataContract.Response.Client 2 | { 3 | public sealed class OrderItemResponse 4 | { 5 | public string ProductId { get; set; } 6 | public decimal SellValue { get; set; } 7 | public int Quantity { get; set; } 8 | public decimal TotalAmout { get; set; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Order.Domain/Models/OrderItemModel.cs: -------------------------------------------------------------------------------- 1 | namespace Order.Domain.Models 2 | { 3 | public class OrderItemModel : EntityBase 4 | { 5 | public OrderModel Order { get; set; } 6 | public ProductModel Product { get; set; } 7 | public decimal SellValue { get; set; } 8 | public int Quantity { get; set; } 9 | public decimal TotalAmout { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Order.Application/DataContract/Request/Order/CreateOrderRequest.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Order.Application.DataContract.Request.Order 4 | { 5 | public sealed class CreateOrderRequest 6 | { 7 | public string ClientId { get; set; } 8 | public string UserId { get; set; } 9 | public List Items { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Order.Application/DataContract/Response/Client/ClientResponse.cs: -------------------------------------------------------------------------------- 1 | namespace Order.Application.DataContract.Response.Client 2 | { 3 | public sealed class ClientResponse 4 | { 5 | public string Id { get; set; } 6 | public string Name { get; set; } 7 | public string Email { get; set; } 8 | public string PhoneNumber { get; set; } 9 | public string Adress { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | **/.classpath 2 | **/.dockerignore 3 | **/.env 4 | **/.git 5 | **/.gitignore 6 | **/.project 7 | **/.settings 8 | **/.toolstarget 9 | **/.vs 10 | **/.vscode 11 | **/*.*proj.user 12 | **/*.dbmdl 13 | **/*.jfm 14 | **/azds.yaml 15 | **/bin 16 | **/charts 17 | **/docker-compose* 18 | **/Dockerfile* 19 | **/node_modules 20 | **/npm-debug.log 21 | **/obj 22 | **/secrets.dev.yaml 23 | **/values.dev.yaml 24 | LICENSE 25 | README.md -------------------------------------------------------------------------------- /Order.Application/DataContract/Request/Client/UpdateClientRequest.cs: -------------------------------------------------------------------------------- 1 | namespace Order.Application.DataContract.Request.Client 2 | { 3 | public sealed class UpdateClientRequest 4 | { 5 | public string Id { get; set; } 6 | public string Name { get; set; } 7 | public string Email { get; set; } 8 | public string PhoneNumber { get; set; } 9 | public string Adress { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Order.Application/DataContract/Response/Order/OrderResponse.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Order.Application.DataContract.Response.Client 4 | { 5 | public sealed class OrderResponse 6 | { 7 | public string Id { get; set; } 8 | public string ClientId { get; set; } 9 | public string UserId { get; set; } 10 | public List Items { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Order.Domain/Interfaces/Repositories/DataConnector/IDbConnector.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data; 3 | 4 | namespace Order.Domain.Interfaces.Repositories.DataConnector 5 | { 6 | public interface IDbConnector : IDisposable 7 | { 8 | IDbConnection dbConnection { get; } 9 | IDbTransaction dbTransaction { get; set; } 10 | 11 | IDbTransaction BeginTransaction(IsolationLevel isolation); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Order.Domain/Order.Domain.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Order/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "ConnectionStrings": { 3 | "default": "Server=.\\sqlexpress;Database=PVC;Trusted_Connection=True;" 4 | }, 5 | "Logging": { 6 | "LogLevel": { 7 | "Default": "Information", 8 | "Microsoft": "Warning", 9 | "Microsoft.Hosting.Lifetime": "Information" 10 | } 11 | }, 12 | "AuthSettings": { 13 | "Secret": "NEQTuIy4gM1OiY6N330GAoG7h4DISqlgu31fBpai3QxbptpjmfqmKxksrn1ATdhF", 14 | "ExpireIn": 2 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Order.Domain/Validations/Base/Report.cs: -------------------------------------------------------------------------------- 1 | namespace Order.Domain.Validations.Base 2 | { 3 | public class Report 4 | { 5 | public Report() 6 | { 7 | 8 | } 9 | 10 | public Report(string message) 11 | { 12 | Message = message; 13 | } 14 | 15 | public string Code { get; set; } 16 | public string Message { get; set; } 17 | public static Report Create(string message) => new Report(message); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Order.Domain/Interfaces/Services/ISecurityService.cs: -------------------------------------------------------------------------------- 1 | using Order.Domain.Models; 2 | using Order.Domain.Validations.Base; 3 | using System.Threading.Tasks; 4 | 5 | namespace Order.Domain.Interfaces.Services 6 | { 7 | public interface ISecurityService 8 | { 9 | Task> ComparePassword(string password, string confirmPassword); 10 | Task> VerifyPassword(string password, UserModel user); 11 | Task> EncryptPassword(string password); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Order.Infra/Order.Infra.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | 18da07b8-d8c7-49b0-b6dc-b2a306d5f697 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /Order.Application/Interfacds/IProductApplication.cs: -------------------------------------------------------------------------------- 1 | using Order.Application.DataContract.Request.Product; 2 | using Order.Application.DataContract.Response.Product; 3 | using Order.Domain.Validations.Base; 4 | using System.Collections.Generic; 5 | using System.Threading.Tasks; 6 | 7 | namespace Order.Application.Interfacds 8 | { 9 | public interface IProductApplication 10 | { 11 | Task CreateAsync(CreateProductRequest Product); 12 | Task>> ListByFilterAsync(string productId = null, string description = null); 13 | 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Order/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:20000", 7 | "sslPort": 0 8 | } 9 | }, 10 | "$schema": "http://json.schemastore.org/launchsettings.json", 11 | "profiles": { 12 | "IIS Express": { 13 | "commandName": "IISExpress", 14 | "launchBrowser": true, 15 | "launchUrl": "api/", 16 | "environmentVariables": { 17 | "ASPNETCORE_ENVIRONMENT": "Development" 18 | } 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /Order/Program.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Hosting; 2 | using Microsoft.Extensions.Hosting; 3 | 4 | namespace Order 5 | { 6 | public class Program 7 | { 8 | public static void Main(string[] args) 9 | { 10 | CreateHostBuilder(args).Build().Run(); 11 | } 12 | 13 | public static IHostBuilder CreateHostBuilder(string[] args) => 14 | Host.CreateDefaultBuilder(args) 15 | .ConfigureWebHostDefaults(webBuilder => 16 | { 17 | webBuilder.UseStartup(); 18 | }); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Order.Domain/Validations/OrderValidation.cs: -------------------------------------------------------------------------------- 1 | using FluentValidation; 2 | using Order.Domain.Models; 3 | 4 | namespace Order.Domain.Validations 5 | { 6 | public class OrderValidation : AbstractValidator 7 | { 8 | public OrderValidation() 9 | { 10 | ValidatorOptions.Global.CascadeMode = CascadeMode.Stop; 11 | 12 | RuleFor(x => x.Client) 13 | .NotNull(); 14 | 15 | RuleFor(x => x.Items) 16 | .NotNull(); 17 | 18 | RuleFor(x => x.Items.Count) 19 | .NotEqual(0); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Order.Domain/Interfaces/Repositories/IUnitOfWork.cs: -------------------------------------------------------------------------------- 1 | using Order.Domain.Interfaces.Repositories.DataConnector; 2 | 3 | namespace Order.Domain.Interfaces.Repositories 4 | { 5 | public interface IUnitOfWork 6 | { 7 | IClientRepository ClientRepository { get; } 8 | IOrderRepository OrderRepository { get; } 9 | IProductRepository ProductRepository { get; } 10 | IUserRepository UserRepository { get; } 11 | 12 | IDbConnector dbConnector { get;} 13 | 14 | void BeginTransaction(); 15 | void CommitTransaction(); 16 | void RollbackTransaction(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Order.Domain/Interfaces/Repositories/IClientRepository.cs: -------------------------------------------------------------------------------- 1 | using Order.Domain.Models; 2 | using System.Collections.Generic; 3 | using System.Threading.Tasks; 4 | 5 | namespace Order.Domain.Interfaces.Repositories 6 | { 7 | public interface IClientRepository 8 | { 9 | Task CreateAsync(ClientModel client); 10 | Task UpdateAsync(ClientModel client); 11 | Task DeleteAsync(string clientId); 12 | Task ExistsByIdAsync(string clientId); 13 | Task GetByIdAsync(string clientId); 14 | Task> ListByFilterAsync(string clientId = null, string name = null); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Order.Domain/Validations/ProductValidation.cs: -------------------------------------------------------------------------------- 1 | using FluentValidation; 2 | using Order.Domain.Models; 3 | 4 | namespace Order.Domain.Validations 5 | { 6 | public class ProductValidation : AbstractValidator 7 | { 8 | public ProductValidation() 9 | { 10 | ValidatorOptions.Global.CascadeMode = CascadeMode.Stop; 11 | 12 | RuleFor(x => x.Description) 13 | .NotNull() 14 | .NotEmpty() 15 | .Length(3, 30); 16 | 17 | RuleFor(x => x.SellValue) 18 | .NotEqual(0) 19 | .NotEmpty(); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Order/Order.Api.csproj.user: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | IIS Express 5 | ApiControllerWithActionsScaffolder 6 | root/Controller 7 | 8 | 9 | ProjectDebugger 10 | 11 | -------------------------------------------------------------------------------- /Order.Application/Interfacds/IOrderApplication.cs: -------------------------------------------------------------------------------- 1 | using Order.Application.DataContract.Request.Order; 2 | using Order.Application.DataContract.Response.Client; 3 | using Order.Domain.Validations.Base; 4 | using System.Collections.Generic; 5 | using System.Threading.Tasks; 6 | 7 | namespace Order.Application.Interfacds 8 | { 9 | public interface IOrderApplication 10 | { 11 | Task CreateAsync(CreateOrderRequest Order); 12 | Task>> ListByFilterAsync(string orderId = null, string clientId = null, string userId = null); 13 | Task> GetByIdAsync(string orderId); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Order.Application/Order.Application.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | true 6 | Order.Application.xml 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /Order.Domain/Interfaces/Services/IClientService.cs: -------------------------------------------------------------------------------- 1 | using Order.Domain.Models; 2 | using Order.Domain.Validations.Base; 3 | using System.Collections.Generic; 4 | using System.Threading.Tasks; 5 | 6 | namespace Order.Domain.Interfaces.Services 7 | { 8 | public interface IClientService 9 | { 10 | Task CreateAsync(ClientModel client); 11 | Task UpdateAsync(ClientModel client); 12 | Task DeleteAsync(string clientId); 13 | Task> GetByIdAsync(string clientId); 14 | Task>> ListByFiltersAsync(string clientId = null, string name = null); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Order.Domain/Interfaces/Repositories/IProductRepository.cs: -------------------------------------------------------------------------------- 1 | using Order.Domain.Models; 2 | using System.Collections.Generic; 3 | using System.Threading.Tasks; 4 | 5 | namespace Order.Domain.Interfaces.Repositories 6 | { 7 | public interface IProductRepository 8 | { 9 | Task CreateAsync(ProductModel product); 10 | Task UpdateAsync(ProductModel product); 11 | Task DeleteAsync(string productId); 12 | Task GetByIdAsync(string productId); 13 | Task> ListByFilterAsync(string productId = null, string description = null); 14 | Task ExistsByIdAsync(string productId); 15 | 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Order.Domain/obj/Order.Domain.csproj.nuget.g.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $(MSBuildAllProjects);$(MSBuildThisFileFullPath) 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Order.Infra/obj/Order.Infra.csproj.nuget.g.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $(MSBuildAllProjects);$(MSBuildThisFileFullPath) 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Order.Application/obj/Order.Application.csproj.nuget.g.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $(MSBuildAllProjects);$(MSBuildThisFileFullPath) 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Order.Domain/Interfaces/Services/IOrderService.cs: -------------------------------------------------------------------------------- 1 | using Order.Domain.Models; 2 | using Order.Domain.Validations.Base; 3 | using System.Collections.Generic; 4 | using System.Threading.Tasks; 5 | 6 | namespace Order.Domain.Interfaces.Services 7 | { 8 | public interface IOrderService 9 | { 10 | Task CreateAsync(OrderModel order); 11 | Task UpdateAsync(OrderModel order); 12 | Task DeleteAsync(string orderId); 13 | Task> GetByIdAsync(string orderId); 14 | Task>> ListByFiltersAsync(string orderId = null, string clientId = null, string userId = null); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Order.Application/Interfacds/IUserApplication.cs: -------------------------------------------------------------------------------- 1 | using Order.Application.DataContract.Request.User; 2 | using Order.Application.DataContract.Response.Client; 3 | using Order.Application.DataContract.Response.User; 4 | using Order.Domain.Validations.Base; 5 | using System.Collections.Generic; 6 | using System.Threading.Tasks; 7 | 8 | namespace Order.Application.Interfacds 9 | { 10 | public interface IUserApplication 11 | { 12 | Task> AuthAsync(AuthRequest auth); 13 | Task CreateAsync(CreateUserRequest User); 14 | Task>> ListByFilterAsync(string userId = null, string name = null); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Order.Domain/Interfaces/Services/IProductService.cs: -------------------------------------------------------------------------------- 1 | using Order.Domain.Models; 2 | using Order.Domain.Validations.Base; 3 | using System.Collections.Generic; 4 | using System.Threading.Tasks; 5 | 6 | namespace Order.Domain.Interfaces.Services 7 | { 8 | public interface IProductService 9 | { 10 | Task CreateAsync(ProductModel product); 11 | Task UpdateAsync(ProductModel product); 12 | Task DeleteAsync(string productId); 13 | Task> GetByIdAsync(string productId); 14 | Task>> ListByFilterAsync(string productId = null, string description = null); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Order.Domain/Interfaces/Repositories/IUserRepository.cs: -------------------------------------------------------------------------------- 1 | using Order.Domain.Models; 2 | using System.Collections.Generic; 3 | using System.Threading.Tasks; 4 | 5 | namespace Order.Domain.Interfaces.Repositories 6 | { 7 | public interface IUserRepository 8 | { 9 | Task CreateAsync(UserModel user); 10 | Task UpdateAsync(UserModel user); 11 | Task DeleteAsync(string userId); 12 | Task GetByIdAsync(string userId); 13 | Task GetByLoginAsync(string login); 14 | Task> ListByFilterAsync(string userId = null, string name = null); 15 | Task ExistsByIdAsync(string userId); 16 | Task ExistsByLoginAsync(string login); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Order/Dockerfile: -------------------------------------------------------------------------------- 1 | #See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging. 2 | 3 | FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS base 4 | WORKDIR /app 5 | EXPOSE 80 6 | EXPOSE 443 7 | 8 | FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build 9 | WORKDIR /src 10 | COPY ["Order/Order.csproj", "Order/"] 11 | RUN dotnet restore "Order/Order.csproj" 12 | COPY . . 13 | WORKDIR "/src/Order" 14 | RUN dotnet build "Order.csproj" -c Release -o /app/build 15 | 16 | FROM build AS publish 17 | RUN dotnet publish "Order.csproj" -c Release -o /app/publish 18 | 19 | FROM base AS final 20 | WORKDIR /app 21 | COPY --from=publish /app/publish . 22 | ENTRYPOINT ["dotnet", "Order.dll"] -------------------------------------------------------------------------------- /Order.Application/Interfacds/IClientApplication.cs: -------------------------------------------------------------------------------- 1 | using Order.Application.DataContract.Request.Client; 2 | using Order.Application.DataContract.Response.Client; 3 | using Order.Domain.Validations.Base; 4 | using System.Collections.Generic; 5 | using System.Threading.Tasks; 6 | 7 | namespace Order.Application.Interfacds 8 | { 9 | public interface IClientApplication 10 | { 11 | Task CreateAsync(CreateClientRequest client); 12 | Task>> ListByFilterAsync(string clientId, string name); 13 | Task> GetByIdAsync(string clientId); 14 | Task UpdateAsync(UpdateClientRequest request); 15 | Task DeleteAsync(string clientId); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Order/obj/Order.csproj.nuget.g.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $(MSBuildAllProjects);$(MSBuildThisFileFullPath) 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Order/obj/Order.Api.csproj.nuget.g.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $(MSBuildAllProjects);$(MSBuildThisFileFullPath) 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Order.Domain/Validations/UserValidation.cs: -------------------------------------------------------------------------------- 1 | using FluentValidation; 2 | using Order.Domain.Models; 3 | 4 | namespace Order.Domain.Validations 5 | { 6 | public class UserValidation : AbstractValidator 7 | { 8 | public UserValidation() 9 | { 10 | ValidatorOptions.Global.CascadeMode = CascadeMode.Stop; 11 | 12 | RuleFor(x => x.Name) 13 | .NotNull() 14 | .NotEmpty() 15 | .Length(3, 30); 16 | 17 | RuleFor(x => x.Login) 18 | .NotNull() 19 | .NotEmpty(); 20 | 21 | RuleFor(x => x.PasswordHash) 22 | .NotNull() 23 | .NotEmpty() 24 | .MinimumLength(6); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Order.Domain/Interfaces/Services/IUserService.cs: -------------------------------------------------------------------------------- 1 | using Order.Domain.Models; 2 | using Order.Domain.Validations.Base; 3 | using System.Collections.Generic; 4 | using System.Threading.Tasks; 5 | 6 | namespace Order.Domain.Interfaces.Services 7 | { 8 | public interface IUserService 9 | { 10 | Task> AutheticationAsync(string password, UserModel user); 11 | Task CreateAsync(UserModel user); 12 | Task UpdateAsync(UserModel user); 13 | Task DeleteAsync(string userId); 14 | Task> GetByIdAsync(string userId); 15 | Task> GetByLoginAsync(string login); 16 | Task>> ListByFilterAsync(string userId = null, string name = null); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Order.Domain/Validations/Base/GetValidations.cs: -------------------------------------------------------------------------------- 1 | using FluentValidation.Results; 2 | 3 | namespace Order.Domain.Validations.Base 4 | { 5 | public static class GetValidations 6 | { 7 | public static Response GetErrors(this ValidationResult result) 8 | { 9 | var response = new Response(); 10 | 11 | if (!result.IsValid) 12 | { 13 | foreach (var erro in result.Errors) 14 | { 15 | response.Report.Add(new Report() 16 | { 17 | Code = erro.PropertyName, 18 | Message = erro.ErrorMessage 19 | }); 20 | } 21 | 22 | return response; 23 | } 24 | 25 | return response; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Order.Domain/Interfaces/Repositories/IOrderRepository.cs: -------------------------------------------------------------------------------- 1 | using Order.Domain.Models; 2 | using System.Collections.Generic; 3 | using System.Threading.Tasks; 4 | 5 | namespace Order.Domain.Interfaces.Repositories 6 | { 7 | public interface IOrderRepository 8 | { 9 | Task CreateAsync(OrderModel order); 10 | Task CreateItemAsync(OrderItemModel item); 11 | Task UpdateAsync(OrderModel order); 12 | Task DeleteAsync(string orderId); 13 | Task DeleteItemAsync(string itemId); 14 | Task GetByIdAsync(string orderId); 15 | Task> ListByFilterAsync(string orderId = null, string clientId = null, string userId = null); 16 | Task> ListItemByOrderIdAsync(string orderId); 17 | Task ExistsByIdAsync(string orderId); 18 | 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Order.Domain/Validations/ClientValidation.cs: -------------------------------------------------------------------------------- 1 | using FluentValidation; 2 | using Order.Domain.Models; 3 | 4 | namespace Order.Domain.Validations 5 | { 6 | public class ClientValidation : AbstractValidator 7 | { 8 | public ClientValidation() 9 | { 10 | ValidatorOptions.Global.CascadeMode = CascadeMode.Stop; 11 | 12 | 13 | RuleFor(x => x.Name) 14 | .NotNull() 15 | .NotEmpty() 16 | .Length(3, 30); 17 | RuleFor(x => x.Email) 18 | .NotNull() 19 | .NotEmpty() 20 | .EmailAddress(FluentValidation.Validators.EmailValidationMode.AspNetCoreCompatible); 21 | 22 | RuleFor(x => x.PhoneNumber) 23 | .NotNull() 24 | .NotEmpty(); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Order/Order.Api.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Order.Api 5 | 6 | 7 | 8 | 9 | Get all clients 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | Get all products 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Order/obj/Debug/netcoreapp3.1/Order.csproj.FileListAbsolute.txt: -------------------------------------------------------------------------------- 1 | C:\Users\Wellyngton\source\repos\Order\Order\bin\Debug\netcoreapp3.1\appsettings.Development.json 2 | C:\Users\Wellyngton\source\repos\Order\Order\bin\Debug\netcoreapp3.1\appsettings.json 3 | C:\Users\Wellyngton\source\repos\Order\Order\bin\Debug\netcoreapp3.1\Properties\launchSettings.json 4 | C:\Users\Wellyngton\source\repos\Order\Order\obj\Debug\netcoreapp3.1\Order.csprojAssemblyReference.cache 5 | C:\Users\Wellyngton\source\repos\Order\Order\obj\Debug\netcoreapp3.1\Order.AssemblyInfoInputs.cache 6 | C:\Users\Wellyngton\source\repos\Order\Order\obj\Debug\netcoreapp3.1\Order.AssemblyInfo.cs 7 | C:\Users\Wellyngton\source\repos\Order\Order\obj\Debug\netcoreapp3.1\Order.RazorTargetAssemblyInfo.cache 8 | C:\Users\Wellyngton\source\repos\Order\Order\obj\Debug\netcoreapp3.1\staticwebassets\Order.StaticWebAssets.Manifest.cache 9 | C:\Users\Wellyngton\source\repos\Order\Order\obj\Debug\netcoreapp3.1\staticwebassets\Order.StaticWebAssets.xml 10 | -------------------------------------------------------------------------------- /Order.Domain/Services/SecurityService.cs: -------------------------------------------------------------------------------- 1 | using Order.Domain.Interfaces.Services; 2 | using Order.Domain.Models; 3 | using Order.Domain.Validations.Base; 4 | using System.Threading.Tasks; 5 | 6 | namespace Order.Domain.Services 7 | { 8 | public class SecurityService : ISecurityService 9 | { 10 | public Task> ComparePassword(string password, string confirmPassword) 11 | { 12 | var isEquals = password.Trim().Equals(confirmPassword.Trim()); 13 | 14 | return Task.FromResult(Response.OK(isEquals)); 15 | } 16 | 17 | public Task> EncryptPassword(string password) 18 | { 19 | var passwordHash = BCrypt.Net.BCrypt.HashPassword(password); 20 | 21 | return Task.FromResult(Response.OK(passwordHash)); 22 | } 23 | 24 | public Task> VerifyPassword(string password, UserModel user) 25 | { 26 | bool validPassword = BCrypt.Net.BCrypt.Verify(password, user.PasswordHash); 27 | 28 | return Task.FromResult(Response.OK(validPassword)); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Order/obj/Debug/netcoreapp3.1/Order.AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | using System; 12 | using System.Reflection; 13 | 14 | [assembly: Microsoft.Extensions.Configuration.UserSecrets.UserSecretsIdAttribute("c43881b9-626a-49bf-a942-7c7a3c4b04e7")] 15 | [assembly: System.Reflection.AssemblyCompanyAttribute("Order")] 16 | [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] 17 | [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] 18 | [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")] 19 | [assembly: System.Reflection.AssemblyProductAttribute("Order")] 20 | [assembly: System.Reflection.AssemblyTitleAttribute("Order")] 21 | [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] 22 | 23 | // Generated by the MSBuild WriteCodeFragment class. 24 | 25 | -------------------------------------------------------------------------------- /Order/Order.Api.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp3.1 5 | c43881b9-626a-49bf-a942-7c7a3c4b04e7 6 | Linux 7 | true 8 | Order.Api.xml 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Order.Infra/DataConnector/SqlConnector.cs: -------------------------------------------------------------------------------- 1 | using Order.Domain.Interfaces.Repositories.DataConnector; 2 | using System.Data; 3 | using System.Data.SqlClient; 4 | 5 | namespace Order.Infra.DataConnector 6 | { 7 | public class SqlConnector : IDbConnector 8 | { 9 | public SqlConnector(string connectionString) 10 | { 11 | dbConnection = SqlClientFactory.Instance.CreateConnection(); 12 | dbConnection.ConnectionString = connectionString; 13 | } 14 | 15 | public IDbConnection dbConnection { get; } 16 | 17 | public IDbTransaction dbTransaction { get; set; } 18 | 19 | public IDbTransaction BeginTransaction(IsolationLevel isolation) 20 | { 21 | if (dbTransaction != null) 22 | { 23 | return dbTransaction; 24 | } 25 | 26 | if (dbConnection.State == ConnectionState.Closed) 27 | { 28 | dbConnection.Open(); 29 | } 30 | 31 | return (dbTransaction = dbConnection.BeginTransaction(isolation)); 32 | } 33 | 34 | public void Dispose() 35 | { 36 | dbConnection?.Dispose(); 37 | dbTransaction?.Dispose(); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Order/Extensions/SwaggerExtensions.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.DependencyInjection; 2 | using Microsoft.OpenApi.Models; 3 | using Swashbuckle.AspNetCore.Filters; 4 | using System; 5 | using System.IO; 6 | 7 | namespace Order.Api.Extensions 8 | { 9 | public static class SwaggerExtensions 10 | { 11 | public static void SwaggerConfiguration(this IServiceCollection services) 12 | { 13 | services.AddSwaggerGen(c => 14 | { 15 | c.SwaggerDoc("v1", new OpenApiInfo 16 | { 17 | Version = "v1", 18 | Title = "ProgrameVC", 19 | Description = "API order", 20 | TermsOfService = new Uri("https://example.com/terms") 21 | }); 22 | 23 | c.AddSecurityDefinition("oauth2", new OpenApiSecurityScheme() 24 | { 25 | Description = "Beared token", 26 | In = ParameterLocation.Header, 27 | Name = "Authorization", 28 | Type = SecuritySchemeType.ApiKey 29 | }); 30 | 31 | c.OperationFilter(); 32 | 33 | var xmlApiPath = Path.Combine(AppContext.BaseDirectory, $"{typeof(Startup).Assembly.GetName().Name}.xml"); 34 | 35 | c.IncludeXmlComments(xmlApiPath); 36 | }); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Order.Domain/obj/Order.Domain.csproj.nuget.g.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | True 5 | NuGet 6 | $(MSBuildThisFileDirectory)project.assets.json 7 | $(UserProfile)\.nuget\packages\ 8 | C:\Users\Wellyngton\.nuget\packages\;C:\Program Files\dotnet\sdk\NuGetFallbackFolder 9 | PackageReference 10 | 5.9.0 11 | 12 | 13 | 14 | 15 | 16 | 17 | $(MSBuildAllProjects);$(MSBuildThisFileFullPath) 18 | 19 | -------------------------------------------------------------------------------- /Order.Infra/obj/Order.Infra.csproj.nuget.g.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | True 5 | NuGet 6 | $(MSBuildThisFileDirectory)project.assets.json 7 | $(UserProfile)\.nuget\packages\ 8 | C:\Users\Wellyngton\.nuget\packages\;C:\Program Files\dotnet\sdk\NuGetFallbackFolder 9 | PackageReference 10 | 5.9.0 11 | 12 | 13 | 14 | 15 | 16 | 17 | $(MSBuildAllProjects);$(MSBuildThisFileFullPath) 18 | 19 | -------------------------------------------------------------------------------- /Order.Domain/Validations/Base/Response.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Order.Domain.Validations.Base 6 | { 7 | public class Response 8 | { 9 | public Response() 10 | { 11 | Report = new List(); 12 | } 13 | 14 | public Response(List reports) 15 | { 16 | Report = reports ?? new List(); 17 | } 18 | 19 | public Response(Report report) : this(new List() { report }) 20 | { 21 | 22 | } 23 | 24 | public List Report { get; } 25 | 26 | 27 | public static Response OK(T data) => new Response(data); 28 | public static Response OK() => new Response(); 29 | public static Response Unprocessable(List reports) => new Response(reports); 30 | public static Response Unprocessable(Report report) => new Response(report); 31 | public static Response Unprocessable(List reports) 32 | { 33 | return new Response(reports); 34 | } 35 | } 36 | 37 | public class Response : Response 38 | { 39 | public Response() 40 | { 41 | 42 | } 43 | public Response(List reports) : base(reports) 44 | { 45 | } 46 | public Response(T data, List reports = null) : base(reports) 47 | { 48 | Data = data; 49 | } 50 | 51 | public T Data { get; set; } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Order.Application/obj/Order.Application.csproj.nuget.g.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | True 5 | NuGet 6 | $(MSBuildThisFileDirectory)project.assets.json 7 | $(UserProfile)\.nuget\packages\ 8 | C:\Users\Wellyngton\.nuget\packages\;C:\Program Files\dotnet\sdk\NuGetFallbackFolder 9 | PackageReference 10 | 5.9.0 11 | 12 | 13 | 14 | 15 | 16 | 17 | $(MSBuildAllProjects);$(MSBuildThisFileFullPath) 18 | 19 | 20 | C:\Program Files\dotnet\sdk\NuGetFallbackFolder\newtonsoft.json\10.0.1 21 | 22 | -------------------------------------------------------------------------------- /Order.Infra/Repositories/UnitOfWork.cs: -------------------------------------------------------------------------------- 1 | using Order.Domain.Interfaces.Repositories; 2 | using Order.Domain.Interfaces.Repositories.DataConnector; 3 | 4 | namespace Order.Infra.Repositories 5 | { 6 | public class UnitOfWork : IUnitOfWork 7 | { 8 | private IClientRepository _clientRepository; 9 | private IProductRepository _productRepository; 10 | private IOrderRepository _orderRepository; 11 | private IUserRepository _userRepository; 12 | 13 | public UnitOfWork(IDbConnector dbConnector) 14 | { 15 | this.dbConnector = dbConnector; 16 | } 17 | 18 | public IClientRepository ClientRepository => _clientRepository ?? (_clientRepository = new ClientRepository(dbConnector)); 19 | 20 | public IOrderRepository OrderRepository => _orderRepository ?? (_orderRepository = new OrderRepository(dbConnector)); 21 | 22 | public IProductRepository ProductRepository => _productRepository ?? (_productRepository = new ProductRepository(dbConnector)); 23 | 24 | public IUserRepository UserRepository => _userRepository ?? (_userRepository = new UserRepository(dbConnector)); 25 | 26 | public IDbConnector dbConnector { get; } 27 | 28 | public void BeginTransaction() 29 | { 30 | dbConnector.BeginTransaction(System.Data.IsolationLevel.ReadUncommitted); 31 | } 32 | 33 | public void CommitTransaction() 34 | { 35 | if (dbConnector.dbConnection.State == System.Data.ConnectionState.Open) 36 | { 37 | dbConnector.dbTransaction.Commit(); 38 | } 39 | } 40 | 41 | public void RollbackTransaction() 42 | { 43 | if (dbConnector.dbConnection.State == System.Data.ConnectionState.Open) 44 | { 45 | dbConnector.dbTransaction.Rollback(); 46 | } 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Order/Extensions/RegisterIoCExtensions.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.DependencyInjection; 2 | using Order.Application.Applications; 3 | using Order.Application.Interfacds; 4 | using Order.Application.Interfacds.Security; 5 | using Order.Application.Security; 6 | using Order.Domain.Common; 7 | using Order.Domain.Interfaces.Repositories; 8 | using Order.Domain.Interfaces.Services; 9 | using Order.Domain.Services; 10 | using Order.Infra.Repositories; 11 | 12 | namespace Order.Api.Extensions 13 | { 14 | public static class RegisterIoCExtensions 15 | { 16 | public static void RegisterIoC(this IServiceCollection services) 17 | { 18 | services.AddScoped(); 19 | services.AddScoped(); 20 | services.AddScoped(); 21 | 22 | services.AddScoped(); 23 | services.AddScoped(); 24 | services.AddScoped(); 25 | 26 | services.AddScoped(); 27 | services.AddScoped(); 28 | services.AddScoped(); 29 | 30 | services.AddScoped(); 31 | services.AddScoped(); 32 | services.AddScoped(); 33 | 34 | services.AddScoped(); 35 | services.AddScoped(); 36 | services.AddScoped(); 37 | 38 | services.AddScoped(); 39 | services.AddScoped(); 40 | services.AddScoped(); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Order.Application/Applications/ProductApplication.cs: -------------------------------------------------------------------------------- 1 | using AutoMapper; 2 | using Order.Application.DataContract.Request.Product; 3 | using Order.Application.DataContract.Response.Product; 4 | using Order.Application.Interfacds; 5 | using Order.Domain.Interfaces.Services; 6 | using Order.Domain.Models; 7 | using Order.Domain.Validations.Base; 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Linq; 11 | using System.Threading.Tasks; 12 | 13 | namespace Order.Application.Applications 14 | { 15 | public class ProductApplication : IProductApplication 16 | { 17 | private readonly IProductService _ProductService; 18 | private readonly IMapper _mapper; 19 | 20 | public ProductApplication(IProductService ProductService, IMapper mapper) 21 | { 22 | _ProductService = ProductService; 23 | _mapper = mapper; 24 | } 25 | 26 | public async Task CreateAsync(CreateProductRequest Product) 27 | { 28 | try 29 | { 30 | var ProductModel = _mapper.Map(Product); 31 | 32 | return await _ProductService.CreateAsync(ProductModel); 33 | } 34 | catch (Exception ex) 35 | { 36 | var response = Report.Create(ex.Message); 37 | 38 | return Response.Unprocessable(response); 39 | } 40 | } 41 | 42 | public async Task>> ListByFilterAsync(string productId = null, string description = null) 43 | { 44 | Response> product = await _ProductService.ListByFilterAsync(productId, description); 45 | 46 | if (product.Report.Any()) 47 | return Response.Unprocessable>(product.Report); 48 | 49 | var response = _mapper.Map>(product.Data); 50 | 51 | return Response.OK(response); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Order.Application/Mapper/Core.cs: -------------------------------------------------------------------------------- 1 | using AutoMapper; 2 | using Order.Application.DataContract.Request.Client; 3 | using Order.Application.DataContract.Request.Order; 4 | using Order.Application.DataContract.Request.Product; 5 | using Order.Application.DataContract.Request.User; 6 | using Order.Application.DataContract.Response.Client; 7 | using Order.Application.DataContract.Response.Product; 8 | using Order.Domain.Models; 9 | 10 | namespace Order.Application.Mapper 11 | { 12 | public class Core : Profile 13 | { 14 | public Core() 15 | { 16 | ClientMap(); 17 | } 18 | 19 | private void ClientMap() 20 | { 21 | CreateMap(); 22 | CreateMap(); 23 | 24 | CreateMap(); 25 | 26 | CreateMap() 27 | .ForMember(target => target.PasswordHash, opt => opt.MapFrom(source => source.Password)); 28 | CreateMap(); 29 | 30 | CreateMap() 31 | .ForPath(target => target.Client.Id, opt => opt.MapFrom(source => source.ClientId)) 32 | .ForPath(target => target.User.Id, opt => opt.MapFrom(source => source.UserId)); 33 | 34 | CreateMap() 35 | .ForMember(target => target.ClientId, opt => opt.MapFrom(source => source.Client.Id)) 36 | .ForMember(target => target.UserId, opt => opt.MapFrom(source => source.User.Id)); 37 | 38 | CreateMap() 39 | .ForPath(target => target.Product.Id, opt => opt.MapFrom(source => source.ProductId)); 40 | 41 | CreateMap() 42 | .ForMember(target => target.ProductId, opt => opt.MapFrom(source => source.Product.Id)); 43 | 44 | 45 | 46 | CreateMap(); 47 | CreateMap(); 48 | 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Order.Application/Security/TokenManager.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Authentication.JwtBearer; 2 | using Microsoft.Extensions.Options; 3 | using Microsoft.IdentityModel.Tokens; 4 | using Order.Application.DataContract.Response.User; 5 | using Order.Application.Interfacds.Security; 6 | using Order.Application.Models; 7 | using Order.Domain.Models; 8 | using System; 9 | using System.IdentityModel.Tokens.Jwt; 10 | using System.Security.Claims; 11 | using System.Security.Principal; 12 | using System.Text; 13 | using System.Threading.Tasks; 14 | 15 | namespace Order.Application.Security 16 | { 17 | public class TokenManager : ITokenManager 18 | { 19 | private readonly AuthSettings _authSettings; 20 | 21 | public TokenManager(IOptions authSettings) 22 | { 23 | _authSettings = authSettings.Value; 24 | } 25 | 26 | public Task GenerateTokenAsync(UserModel user) 27 | { 28 | var tokenHandler = new JwtSecurityTokenHandler(); 29 | var date = DateTime.UtcNow; 30 | var expire = date.AddHours(_authSettings.ExpireIn); 31 | var key = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(_authSettings.Secret)); 32 | 33 | var securityToken = tokenHandler.CreateToken(new SecurityTokenDescriptor() 34 | { 35 | Issuer = "programevc", 36 | IssuedAt = date, 37 | NotBefore = date, 38 | Expires = expire, 39 | SigningCredentials = new SigningCredentials(key, SecurityAlgorithms.HmacSha256Signature), 40 | Subject = new ClaimsIdentity(new GenericIdentity(user.Login, JwtBearerDefaults.AuthenticationScheme), new[] 41 | { 42 | new Claim(ClaimTypes.NameIdentifier, user.Id) 43 | }) 44 | }); 45 | 46 | var response = new AuthResponse() 47 | { 48 | Token = tokenHandler.WriteToken(securityToken), 49 | ExpireIn = _authSettings.ExpireIn, 50 | Type = JwtBearerDefaults.AuthenticationScheme 51 | }; 52 | 53 | return Task.FromResult(response); 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /Order/obj/Order.csproj.nuget.g.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | True 5 | NuGet 6 | $(MSBuildThisFileDirectory)project.assets.json 7 | $(UserProfile)\.nuget\packages\ 8 | C:\Users\Wellyngton\.nuget\packages\;C:\Program Files\dotnet\sdk\NuGetFallbackFolder 9 | PackageReference 10 | 5.7.0 11 | 12 | 13 | 14 | 15 | 16 | $(MSBuildAllProjects);$(MSBuildThisFileFullPath) 17 | 18 | 19 | 20 | 21 | 22 | C:\Users\Wellyngton\.nuget\packages\microsoft.visualstudio.azure.containers.tools.targets\1.10.9 23 | 24 | -------------------------------------------------------------------------------- /Order/Controllers/OrderController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using Microsoft.AspNetCore.Authorization; 6 | using Microsoft.AspNetCore.Mvc; 7 | using Order.Application.DataContract.Request.Order; 8 | using Order.Application.Interfacds; 9 | 10 | namespace Order.Api.Controllers 11 | { 12 | [Route("api/order")] 13 | [ApiController] 14 | //[Authorize] 15 | public class OrderController : ControllerBase 16 | { 17 | private readonly IOrderApplication _OrderApplication; 18 | 19 | public OrderController(IOrderApplication OrderApplication) 20 | { 21 | _OrderApplication = OrderApplication; 22 | } 23 | 24 | [HttpGet] 25 | public async Task Get([FromQuery] string orderId, [FromQuery] string clientid, [FromQuery] string userId) 26 | { 27 | var response = await _OrderApplication.ListByFilterAsync(orderId, clientid, userId); 28 | 29 | if (response.Report.Any()) 30 | return UnprocessableEntity(response.Report); 31 | 32 | return Ok(response); 33 | } 34 | 35 | // GET api//5 36 | [HttpGet("{id}")] 37 | public async Task GetById(string id) 38 | { 39 | var response = await _OrderApplication.GetByIdAsync(id); 40 | 41 | if (response.Report.Any()) 42 | return UnprocessableEntity(response.Report); 43 | 44 | return Ok(response); 45 | } 46 | 47 | // POST api/ 48 | [HttpPost] 49 | public async Task Post([FromBody] CreateOrderRequest request) 50 | { 51 | var response = await _OrderApplication.CreateAsync(request); 52 | 53 | if (response.Report.Any()) 54 | return UnprocessableEntity(response.Report); 55 | 56 | return Ok(response); 57 | } 58 | 59 | // PUT api//5 60 | [HttpPut("{id}")] 61 | public void Put(int id, [FromBody] string value) 62 | { 63 | } 64 | 65 | // DELETE api//5 66 | [HttpDelete("{id}")] 67 | public void Delete(int id) 68 | { 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Order/Controllers/ProductController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using Microsoft.AspNetCore.Authorization; 6 | using Microsoft.AspNetCore.Mvc; 7 | using Order.Application.DataContract.Request.Product; 8 | using Order.Application.Interfacds; 9 | 10 | namespace Order.Api.Controllers 11 | { 12 | [Route("api/product")] 13 | [ApiController] 14 | [Authorize] 15 | public class ProductController : ControllerBase 16 | { 17 | private readonly IProductApplication _ProductApplication; 18 | 19 | public ProductController(IProductApplication ProductApplication) 20 | { 21 | _ProductApplication = ProductApplication; 22 | } 23 | 24 | /// 25 | /// Get all products 26 | /// 27 | /// 28 | /// 29 | /// 30 | [HttpGet] 31 | public async Task Get([FromQuery] string productId, [FromQuery] string description) 32 | { 33 | var response = await _ProductApplication.ListByFilterAsync(productId, description); 34 | 35 | if (response.Report.Any()) 36 | return UnprocessableEntity(response.Report); 37 | 38 | return Ok(response); 39 | } 40 | 41 | // GET api//5 42 | [HttpGet("{id}")] 43 | public string Get(int id) 44 | { 45 | return "value"; 46 | } 47 | 48 | // POST api/ 49 | [HttpPost] 50 | public async Task Post([FromBody] CreateProductRequest request) 51 | { 52 | var response = await _ProductApplication.CreateAsync(request); 53 | 54 | if (response.Report.Any()) 55 | return UnprocessableEntity(response.Report); 56 | 57 | return Ok(response); 58 | } 59 | 60 | // PUT api//5 61 | [HttpPut("{id}")] 62 | public void Put(int id, [FromBody] string value) 63 | { 64 | } 65 | 66 | // DELETE api//5 67 | [HttpDelete("{id}")] 68 | public void Delete(int id) 69 | { 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /Order.Application/Applications/OrderApplication.cs: -------------------------------------------------------------------------------- 1 | using AutoMapper; 2 | using Order.Application.DataContract.Request.Order; 3 | using Order.Application.DataContract.Response.Client; 4 | using Order.Application.Interfacds; 5 | using Order.Domain.Interfaces.Services; 6 | using Order.Domain.Models; 7 | using Order.Domain.Validations.Base; 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Linq; 11 | using System.Threading.Tasks; 12 | 13 | namespace Order.Application.Applications 14 | { 15 | public class OrderApplication : IOrderApplication 16 | { 17 | private readonly IOrderService _OrderService; 18 | private readonly IMapper _mapper; 19 | 20 | public OrderApplication(IOrderService OrderService, IMapper mapper) 21 | { 22 | _OrderService = OrderService; 23 | _mapper = mapper; 24 | } 25 | 26 | public async Task CreateAsync(CreateOrderRequest Order) 27 | { 28 | try 29 | { 30 | var OrderModel = _mapper.Map(Order); 31 | 32 | return await _OrderService.CreateAsync(OrderModel); 33 | } 34 | catch (Exception ex) 35 | { 36 | var response = Report.Create(ex.Message); 37 | 38 | return Response.Unprocessable(response); 39 | } 40 | } 41 | 42 | public async Task> GetByIdAsync(string orderId) 43 | { 44 | Response user = await _OrderService.GetByIdAsync(orderId); 45 | 46 | if (user.Report.Any()) 47 | return Response.Unprocessable(user.Report); 48 | 49 | var response = _mapper.Map(user.Data); 50 | 51 | return Response.OK(response); 52 | } 53 | 54 | public async Task>> ListByFilterAsync(string orderId = null, string clientId = null, string userId = null) 55 | { 56 | Response> user = await _OrderService.ListByFiltersAsync(orderId, clientId, userId); 57 | 58 | if (user.Report.Any()) 59 | return Response.Unprocessable>(user.Report); 60 | 61 | var response = _mapper.Map>(user.Data); 62 | 63 | return Response.OK(response); 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /Order/Controllers/UserController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using Microsoft.AspNetCore.Authorization; 6 | using Microsoft.AspNetCore.Mvc; 7 | using Order.Application.DataContract.Request.User; 8 | using Order.Application.Interfacds; 9 | 10 | namespace Order.Api.Controllers 11 | { 12 | [Route("api/user")] 13 | [ApiController] 14 | [Authorize] 15 | public class UserController : ControllerBase 16 | { 17 | private readonly IUserApplication _UserApplication; 18 | 19 | public UserController(IUserApplication UserApplication) 20 | { 21 | _UserApplication = UserApplication; 22 | } 23 | 24 | [HttpGet] 25 | public async Task Get([FromQuery] string userId, [FromQuery] string name) 26 | { 27 | var response = await _UserApplication.ListByFilterAsync(userId, name); 28 | 29 | if (response.Report.Any()) 30 | return UnprocessableEntity(response.Report); 31 | 32 | return Ok(response); 33 | } 34 | 35 | // GET api//5 36 | [HttpGet("{id}")] 37 | public string Get(int id) 38 | { 39 | return "value"; 40 | } 41 | 42 | // POST api/ 43 | [HttpPost] 44 | [AllowAnonymous] 45 | public async Task Post([FromBody] CreateUserRequest request) 46 | { 47 | var response = await _UserApplication.CreateAsync(request); 48 | 49 | if (response.Report.Any()) 50 | return UnprocessableEntity(response.Report); 51 | 52 | return Ok(response); 53 | } 54 | 55 | // PUT api//5 56 | [HttpPut("{id}")] 57 | public void Put(int id, [FromBody] string value) 58 | { 59 | } 60 | 61 | // DELETE api//5 62 | [HttpDelete("{id}")] 63 | public void Delete(int id) 64 | { 65 | } 66 | 67 | // DELETE api//5 68 | [HttpPost("auth")] 69 | [AllowAnonymous] 70 | public async Task Auth([FromBody] AuthRequest request) 71 | { 72 | var response = await _UserApplication.AuthAsync(request); 73 | 74 | if (response.Report.Any()) 75 | return UnprocessableEntity(response.Report); 76 | 77 | return Ok(response); 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /Order/obj/Order.Api.csproj.nuget.g.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | True 5 | NuGet 6 | $(MSBuildThisFileDirectory)project.assets.json 7 | $(UserProfile)\.nuget\packages\ 8 | C:\Users\Wellyngton\.nuget\packages\;C:\Program Files\dotnet\sdk\NuGetFallbackFolder 9 | PackageReference 10 | 5.9.0 11 | 12 | 13 | 14 | 15 | 16 | 17 | $(MSBuildAllProjects);$(MSBuildThisFileFullPath) 18 | 19 | 20 | 21 | 22 | 23 | C:\Users\Wellyngton\.nuget\packages\microsoft.extensions.apidescription.server\3.0.0 24 | C:\Users\Wellyngton\.nuget\packages\microsoft.visualstudio.azure.containers.tools.targets\1.10.9 25 | 26 | -------------------------------------------------------------------------------- /Order.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.30517.126 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Order.Api", "Order\Order.Api.csproj", "{CDBDD651-1398-42E1-B98D-DB76DE9FD9B6}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Order.Domain", "Order.Domain\Order.Domain.csproj", "{1CBDB3D4-71BA-4709-9E62-82C15E767BB6}" 9 | EndProject 10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Order.Application", "Order.Application\Order.Application.csproj", "{7B0D379E-3AA6-4BF9-8B89-0D69E198EF84}" 11 | EndProject 12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Order.Infra", "Order.Infra\Order.Infra.csproj", "{ECD9164B-A6E6-48AF-9A13-4685C9FBF092}" 13 | EndProject 14 | Global 15 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 16 | Debug|Any CPU = Debug|Any CPU 17 | Release|Any CPU = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 20 | {CDBDD651-1398-42E1-B98D-DB76DE9FD9B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {CDBDD651-1398-42E1-B98D-DB76DE9FD9B6}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {CDBDD651-1398-42E1-B98D-DB76DE9FD9B6}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {CDBDD651-1398-42E1-B98D-DB76DE9FD9B6}.Release|Any CPU.Build.0 = Release|Any CPU 24 | {1CBDB3D4-71BA-4709-9E62-82C15E767BB6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 25 | {1CBDB3D4-71BA-4709-9E62-82C15E767BB6}.Debug|Any CPU.Build.0 = Debug|Any CPU 26 | {1CBDB3D4-71BA-4709-9E62-82C15E767BB6}.Release|Any CPU.ActiveCfg = Release|Any CPU 27 | {1CBDB3D4-71BA-4709-9E62-82C15E767BB6}.Release|Any CPU.Build.0 = Release|Any CPU 28 | {7B0D379E-3AA6-4BF9-8B89-0D69E198EF84}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 29 | {7B0D379E-3AA6-4BF9-8B89-0D69E198EF84}.Debug|Any CPU.Build.0 = Debug|Any CPU 30 | {7B0D379E-3AA6-4BF9-8B89-0D69E198EF84}.Release|Any CPU.ActiveCfg = Release|Any CPU 31 | {7B0D379E-3AA6-4BF9-8B89-0D69E198EF84}.Release|Any CPU.Build.0 = Release|Any CPU 32 | {ECD9164B-A6E6-48AF-9A13-4685C9FBF092}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 33 | {ECD9164B-A6E6-48AF-9A13-4685C9FBF092}.Debug|Any CPU.Build.0 = Debug|Any CPU 34 | {ECD9164B-A6E6-48AF-9A13-4685C9FBF092}.Release|Any CPU.ActiveCfg = Release|Any CPU 35 | {ECD9164B-A6E6-48AF-9A13-4685C9FBF092}.Release|Any CPU.Build.0 = Release|Any CPU 36 | EndGlobalSection 37 | GlobalSection(SolutionProperties) = preSolution 38 | HideSolutionNode = FALSE 39 | EndGlobalSection 40 | GlobalSection(ExtensibilityGlobals) = postSolution 41 | SolutionGuid = {48600BAC-B245-49B3-9F7C-06DD62639B67} 42 | EndGlobalSection 43 | EndGlobal 44 | -------------------------------------------------------------------------------- /Order/obj/Order.csproj.nuget.dgspec.json: -------------------------------------------------------------------------------- 1 | { 2 | "format": 1, 3 | "restore": { 4 | "C:\\Users\\Wellyngton\\source\\repos\\Order\\Order\\Order.csproj": {} 5 | }, 6 | "projects": { 7 | "C:\\Users\\Wellyngton\\source\\repos\\Order\\Order\\Order.csproj": { 8 | "version": "1.0.0", 9 | "restore": { 10 | "projectUniqueName": "C:\\Users\\Wellyngton\\source\\repos\\Order\\Order\\Order.csproj", 11 | "projectName": "Order", 12 | "projectPath": "C:\\Users\\Wellyngton\\source\\repos\\Order\\Order\\Order.csproj", 13 | "packagesPath": "C:\\Users\\Wellyngton\\.nuget\\packages\\", 14 | "outputPath": "C:\\Users\\Wellyngton\\source\\repos\\Order\\Order\\obj\\", 15 | "projectStyle": "PackageReference", 16 | "fallbackFolders": [ 17 | "C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder" 18 | ], 19 | "configFilePaths": [ 20 | "C:\\Users\\Wellyngton\\AppData\\Roaming\\NuGet\\NuGet.Config", 21 | "C:\\Program Files (x86)\\NuGet\\Config\\DevExpress 19.1.config", 22 | "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" 23 | ], 24 | "originalTargetFrameworks": [ 25 | "netcoreapp3.1" 26 | ], 27 | "sources": { 28 | "C:\\Program Files (x86)\\DevExpress 19.1\\Components\\System\\Components\\Packages": {}, 29 | "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, 30 | "https://api.nuget.org/v3/index.json": {} 31 | }, 32 | "frameworks": { 33 | "netcoreapp3.1": { 34 | "projectReferences": {} 35 | } 36 | }, 37 | "warningProperties": { 38 | "warnAsError": [ 39 | "NU1605" 40 | ] 41 | } 42 | }, 43 | "frameworks": { 44 | "netcoreapp3.1": { 45 | "dependencies": { 46 | "Microsoft.VisualStudio.Azure.Containers.Tools.Targets": { 47 | "target": "Package", 48 | "version": "[1.10.9, )" 49 | } 50 | }, 51 | "imports": [ 52 | "net461", 53 | "net462", 54 | "net47", 55 | "net471", 56 | "net472", 57 | "net48" 58 | ], 59 | "assetTargetFallback": true, 60 | "warn": true, 61 | "frameworkReferences": { 62 | "Microsoft.AspNetCore.App": { 63 | "privateAssets": "none" 64 | }, 65 | "Microsoft.NETCore.App": { 66 | "privateAssets": "all" 67 | } 68 | }, 69 | "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.402\\RuntimeIdentifierGraph.json" 70 | } 71 | } 72 | } 73 | } 74 | } -------------------------------------------------------------------------------- /Order.Application/Applications/ClientApplication.cs: -------------------------------------------------------------------------------- 1 | using AutoMapper; 2 | using Order.Application.DataContract.Request.Client; 3 | using Order.Application.DataContract.Response.Client; 4 | using Order.Application.Interfacds; 5 | using Order.Domain.Interfaces.Services; 6 | using Order.Domain.Models; 7 | using Order.Domain.Validations.Base; 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Linq; 11 | using System.Threading.Tasks; 12 | 13 | namespace Order.Application.Applications 14 | { 15 | public class ClientApplication : IClientApplication 16 | { 17 | private readonly IClientService _clientService; 18 | private readonly IMapper _mapper; 19 | 20 | public ClientApplication(IClientService clientService, IMapper mapper) 21 | { 22 | _clientService = clientService; 23 | _mapper = mapper; 24 | } 25 | 26 | public async Task CreateAsync(CreateClientRequest client) 27 | { 28 | try 29 | { 30 | var clientModel = _mapper.Map(client); 31 | 32 | return await _clientService.CreateAsync(clientModel); 33 | } 34 | catch (Exception ex) 35 | { 36 | var response = Report.Create(ex.Message); 37 | 38 | return Response.Unprocessable(response); 39 | } 40 | } 41 | 42 | public async Task DeleteAsync(string clientId) 43 | { 44 | return await _clientService.DeleteAsync(clientId); 45 | } 46 | 47 | public async Task> GetByIdAsync(string clientId) 48 | { 49 | Response client = await _clientService.GetByIdAsync(clientId); 50 | 51 | if (client.Report.Any()) 52 | return Response.Unprocessable(client.Report); 53 | 54 | var response = _mapper.Map(client.Data); 55 | 56 | return Response.OK(response); 57 | } 58 | 59 | public async Task>> ListByFilterAsync(string clientId, string name) 60 | { 61 | Response> client = await _clientService.ListByFiltersAsync(clientId, name); 62 | 63 | if (client.Report.Any()) 64 | return Response.Unprocessable>(client.Report); 65 | 66 | var response = _mapper.Map>(client.Data); 67 | 68 | return Response.OK(response); 69 | } 70 | 71 | public async Task UpdateAsync(UpdateClientRequest request) 72 | { 73 | var clientModel = _mapper.Map(request); 74 | 75 | return await _clientService.UpdateAsync(clientModel); 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /Order/Controllers/ClientController.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Authorization; 2 | using Microsoft.AspNetCore.Http; 3 | using Microsoft.AspNetCore.Mvc; 4 | using Order.Application.DataContract.Request.Client; 5 | using Order.Application.Interfacds; 6 | using System.Linq; 7 | using System.Threading.Tasks; 8 | 9 | namespace Order.Api.Controllers 10 | { 11 | [Route("api/client")] 12 | [ApiController] 13 | [Authorize] 14 | public class ClientController : ControllerBase 15 | { 16 | private readonly IClientApplication _clientApplication; 17 | 18 | public ClientController(IClientApplication clientApplication) 19 | { 20 | _clientApplication = clientApplication; 21 | } 22 | 23 | // GET: api/ 24 | /// 25 | /// Get all clients 26 | /// 27 | /// 28 | /// 29 | /// 30 | [HttpGet] 31 | public async Task Get([FromQuery] string clientid, [FromQuery] string name) 32 | { 33 | var response = await _clientApplication.ListByFilterAsync(clientid, name); 34 | 35 | if (response.Report.Any()) 36 | return UnprocessableEntity(response.Report); 37 | 38 | return Ok(response); 39 | } 40 | 41 | // GET api//5 42 | [HttpGet("{id}")] 43 | public async Task Get(string id) 44 | { 45 | var response = await _clientApplication.GetByIdAsync(id); 46 | 47 | if (response.Report.Any()) 48 | return UnprocessableEntity(response.Report); 49 | 50 | return Ok(response); 51 | } 52 | 53 | // POST api/ 54 | [HttpPost] 55 | public async Task Post([FromBody] CreateClientRequest request) 56 | { 57 | var response = await _clientApplication.CreateAsync(request); 58 | 59 | if (response.Report.Any()) 60 | return UnprocessableEntity(response.Report); 61 | 62 | return Ok(response); 63 | } 64 | 65 | // PUT api//5 66 | [HttpPut("{id}")] 67 | public async Task Put(int id, [FromBody] UpdateClientRequest request) 68 | { 69 | var response = await _clientApplication.UpdateAsync(request); 70 | 71 | if (response.Report.Any()) 72 | return UnprocessableEntity(response.Report); 73 | 74 | return Ok(response); 75 | } 76 | 77 | // DELETE api//5 78 | [HttpDelete("{id}")] 79 | public async Task Delete(string id) 80 | { 81 | var response = await _clientApplication.DeleteAsync(id); 82 | 83 | if (response.Report.Any()) 84 | return UnprocessableEntity(response.Report); 85 | 86 | return Ok(response); 87 | } 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /Order.Domain/obj/Order.Domain.csproj.nuget.dgspec.json: -------------------------------------------------------------------------------- 1 | { 2 | "format": 1, 3 | "restore": { 4 | "C:\\Users\\Wellyngton\\source\\repos\\Order\\Order.Domain\\Order.Domain.csproj": {} 5 | }, 6 | "projects": { 7 | "C:\\Users\\Wellyngton\\source\\repos\\Order\\Order.Domain\\Order.Domain.csproj": { 8 | "version": "1.0.0", 9 | "restore": { 10 | "projectUniqueName": "C:\\Users\\Wellyngton\\source\\repos\\Order\\Order.Domain\\Order.Domain.csproj", 11 | "projectName": "Order.Domain", 12 | "projectPath": "C:\\Users\\Wellyngton\\source\\repos\\Order\\Order.Domain\\Order.Domain.csproj", 13 | "packagesPath": "C:\\Users\\Wellyngton\\.nuget\\packages\\", 14 | "outputPath": "C:\\Users\\Wellyngton\\source\\repos\\Order\\Order.Domain\\obj\\", 15 | "projectStyle": "PackageReference", 16 | "fallbackFolders": [ 17 | "C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder" 18 | ], 19 | "configFilePaths": [ 20 | "C:\\Users\\Wellyngton\\AppData\\Roaming\\NuGet\\NuGet.Config", 21 | "C:\\Program Files (x86)\\NuGet\\Config\\DevExpress 19.1.config", 22 | "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" 23 | ], 24 | "originalTargetFrameworks": [ 25 | "netstandard2.0" 26 | ], 27 | "sources": { 28 | "C:\\Program Files (x86)\\DevExpress 19.1\\Components\\System\\Components\\Packages": {}, 29 | "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, 30 | "https://api.nuget.org/v3/index.json": {} 31 | }, 32 | "frameworks": { 33 | "netstandard2.0": { 34 | "targetAlias": "netstandard2.0", 35 | "projectReferences": {} 36 | } 37 | }, 38 | "warningProperties": { 39 | "warnAsError": [ 40 | "NU1605" 41 | ] 42 | } 43 | }, 44 | "frameworks": { 45 | "netstandard2.0": { 46 | "targetAlias": "netstandard2.0", 47 | "dependencies": { 48 | "BCrypt.Net-Core": { 49 | "target": "Package", 50 | "version": "[1.6.0, )" 51 | }, 52 | "FluentValidation": { 53 | "target": "Package", 54 | "version": "[9.2.2, )" 55 | }, 56 | "NETStandard.Library": { 57 | "suppressParent": "All", 58 | "target": "Package", 59 | "version": "[2.0.3, )", 60 | "autoReferenced": true 61 | }, 62 | "System.Threading.Tasks": { 63 | "target": "Package", 64 | "version": "[4.3.0, )" 65 | } 66 | }, 67 | "imports": [ 68 | "net461", 69 | "net462", 70 | "net47", 71 | "net471", 72 | "net472", 73 | "net48" 74 | ], 75 | "assetTargetFallback": true, 76 | "warn": true, 77 | "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\5.0.201\\RuntimeIdentifierGraph.json" 78 | } 79 | } 80 | } 81 | } 82 | } -------------------------------------------------------------------------------- /Order.Application/Applications/UserApplication.cs: -------------------------------------------------------------------------------- 1 | using AutoMapper; 2 | using Order.Application.DataContract.Request.User; 3 | using Order.Application.DataContract.Response.Client; 4 | using Order.Application.DataContract.Response.User; 5 | using Order.Application.Interfacds; 6 | using Order.Application.Interfacds.Security; 7 | using Order.Domain.Interfaces.Services; 8 | using Order.Domain.Models; 9 | using Order.Domain.Validations.Base; 10 | using System; 11 | using System.Collections.Generic; 12 | using System.Linq; 13 | using System.Threading.Tasks; 14 | 15 | namespace Order.Application.Applications 16 | { 17 | public class UserApplication : IUserApplication 18 | { 19 | private readonly IUserService _UserService; 20 | private readonly IMapper _mapper; 21 | private readonly ISecurityService _securityService; 22 | private readonly ITokenManager _tokenManager; 23 | 24 | public UserApplication(IUserService UserService, IMapper mapper, ISecurityService securityService, ITokenManager tokenManager) 25 | { 26 | _UserService = UserService; 27 | _mapper = mapper; 28 | _securityService = securityService; 29 | _tokenManager = tokenManager; 30 | } 31 | 32 | public async Task> AuthAsync(AuthRequest auth) 33 | { 34 | var user = await _UserService.GetByLoginAsync(auth.Login); 35 | 36 | if (user.Report.Any()) 37 | return Response.Unprocessable(user.Report); 38 | 39 | var isAuthenticated = await _UserService.AutheticationAsync(auth.Password, user.Data); 40 | 41 | if (!isAuthenticated.Data) 42 | return Response.Unprocessable(new List() { Report.Create("Invalid password or login") }); 43 | 44 | var token = await _tokenManager.GenerateTokenAsync(user.Data); 45 | 46 | return new Response(token); 47 | } 48 | 49 | public async Task CreateAsync(CreateUserRequest User) 50 | { 51 | try 52 | { 53 | var isEquals = await _securityService.ComparePassword(User.Password, User.ConfirmPassword); 54 | 55 | if (!isEquals.Data) 56 | return Response.Unprocessable(Report.Create("Passwords do not match")); 57 | 58 | var passwordEncripted = await _securityService.EncryptPassword(User.Password); 59 | 60 | User.Password = passwordEncripted.Data; 61 | 62 | var UserModel = _mapper.Map(User); 63 | 64 | return await _UserService.CreateAsync(UserModel); 65 | } 66 | catch (Exception ex) 67 | { 68 | var response = Report.Create(ex.Message); 69 | 70 | return Response.Unprocessable(response); 71 | } 72 | } 73 | 74 | public async Task>> ListByFilterAsync(string userId = null, string name = null) 75 | { 76 | try 77 | { 78 | Response> user = await _UserService.ListByFilterAsync(userId, name); 79 | 80 | if (user.Report.Any()) 81 | return Response.Unprocessable>(user.Report); 82 | 83 | var response = _mapper.Map>(user.Data); 84 | 85 | return Response.OK(response); 86 | } 87 | catch (Exception ex) 88 | { 89 | var response = Report.Create(ex.Message); 90 | 91 | return Response.Unprocessable>(new List() { response }); 92 | } 93 | } 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /scrip order.sql: -------------------------------------------------------------------------------- 1 | USE [PVC] 2 | GO 3 | /****** Object: Table [dbo].[Client] Script Date: 14/10/2020 18:03:22 ******/ 4 | SET ANSI_NULLS ON 5 | GO 6 | SET QUOTED_IDENTIFIER ON 7 | GO 8 | CREATE TABLE [dbo].[Client]( 9 | [Id] [varchar](32) NOT NULL, 10 | [Name] [varchar](100) NOT NULL, 11 | [Email] [varchar](100) NULL, 12 | [PhoneNumber] [varchar](14) NULL, 13 | [Adress] [varchar](200) NULL, 14 | [CreatedAt] [datetime2](7) NULL, 15 | PRIMARY KEY CLUSTERED 16 | ( 17 | [Id] ASC 18 | )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY] 19 | ) ON [PRIMARY] 20 | GO 21 | /****** Object: Table [dbo].[Order] Script Date: 14/10/2020 18:03:22 ******/ 22 | SET ANSI_NULLS ON 23 | GO 24 | SET QUOTED_IDENTIFIER ON 25 | GO 26 | CREATE TABLE [dbo].[Order]( 27 | [Id] [varchar](32) NOT NULL, 28 | [ClientId] [varchar](32) NOT NULL, 29 | [UserId] [varchar](32) NOT NULL, 30 | [CreatedAt] [datetime2](7) NULL, 31 | PRIMARY KEY CLUSTERED 32 | ( 33 | [Id] ASC 34 | )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY] 35 | ) ON [PRIMARY] 36 | GO 37 | /****** Object: Table [dbo].[OrderItem] Script Date: 14/10/2020 18:03:22 ******/ 38 | SET ANSI_NULLS ON 39 | GO 40 | SET QUOTED_IDENTIFIER ON 41 | GO 42 | CREATE TABLE [dbo].[OrderItem]( 43 | [Id] [varchar](32) NOT NULL, 44 | [OrderId] [varchar](32) NOT NULL, 45 | [ProductId] [varchar](32) NOT NULL, 46 | [SellValue] [numeric](8, 2) NULL, 47 | [Quantity] [numeric](18, 0) NULL, 48 | [TotalAmount] [numeric](8, 2) NULL, 49 | [CreatedAt] [datetime2](7) NULL, 50 | PRIMARY KEY CLUSTERED 51 | ( 52 | [Id] ASC 53 | )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY] 54 | ) ON [PRIMARY] 55 | GO 56 | /****** Object: Table [dbo].[Product] Script Date: 14/10/2020 18:03:22 ******/ 57 | SET ANSI_NULLS ON 58 | GO 59 | SET QUOTED_IDENTIFIER ON 60 | GO 61 | CREATE TABLE [dbo].[Product]( 62 | [Id] [varchar](32) NOT NULL, 63 | [Description] [varchar](100) NOT NULL, 64 | [SellValue] [numeric](8, 2) NOT NULL, 65 | [Stock] [varchar](max) NULL, 66 | [CreatedAt] [datetime2](7) NULL, 67 | PRIMARY KEY CLUSTERED 68 | ( 69 | [Id] ASC 70 | )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY] 71 | ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] 72 | GO 73 | /****** Object: Table [dbo].[User] Script Date: 14/10/2020 18:03:22 ******/ 74 | SET ANSI_NULLS ON 75 | GO 76 | SET QUOTED_IDENTIFIER ON 77 | GO 78 | CREATE TABLE [dbo].[User]( 79 | [Id] [varchar](32) NOT NULL, 80 | [Name] [varchar](100) NOT NULL, 81 | [Login] [varchar](20) NOT NULL, 82 | [PasswordHash] [varchar](max) NULL, 83 | [CreatedAt] [datetime2](7) NULL, 84 | PRIMARY KEY CLUSTERED 85 | ( 86 | [Id] ASC 87 | )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY] 88 | ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] 89 | GO 90 | ALTER TABLE [dbo].[Order] WITH CHECK ADD FOREIGN KEY([ClientId]) 91 | REFERENCES [dbo].[Client] ([Id]) 92 | GO 93 | ALTER TABLE [dbo].[Order] WITH CHECK ADD FOREIGN KEY([UserId]) 94 | REFERENCES [dbo].[User] ([Id]) 95 | GO 96 | ALTER TABLE [dbo].[OrderItem] WITH CHECK ADD FOREIGN KEY([OrderId]) 97 | REFERENCES [dbo].[Order] ([Id]) 98 | GO 99 | ALTER TABLE [dbo].[OrderItem] WITH CHECK ADD FOREIGN KEY([ProductId]) 100 | REFERENCES [dbo].[Product] ([Id]) 101 | GO 102 | -------------------------------------------------------------------------------- /Order.Domain/Services/ClientService.cs: -------------------------------------------------------------------------------- 1 | using Order.Domain.Common; 2 | using Order.Domain.Interfaces.Repositories; 3 | using Order.Domain.Interfaces.Services; 4 | using Order.Domain.Models; 5 | using Order.Domain.Validations; 6 | using Order.Domain.Validations.Base; 7 | using System.Collections.Generic; 8 | using System.Threading.Tasks; 9 | 10 | namespace Order.Domain.Services 11 | { 12 | public class ClientService : IClientService 13 | { 14 | private readonly IClientRepository _clientRepository; 15 | private readonly ITimeProvider _timeProvider; 16 | private readonly IGenerators _generators; 17 | public ClientService(IClientRepository clientRepository, 18 | ITimeProvider timeProvider, 19 | IGenerators generators) 20 | { 21 | _clientRepository = clientRepository; 22 | _timeProvider = timeProvider; 23 | _generators = generators; 24 | } 25 | 26 | public async Task CreateAsync(ClientModel client) 27 | { 28 | var response = new Response(); 29 | 30 | var validation = new ClientValidation(); 31 | var errors = validation.Validate(client).GetErrors(); 32 | 33 | if (errors.Report.Count > 0) 34 | return errors; 35 | 36 | client.Id = _generators.Generate(); 37 | client.CreatedAt = _timeProvider.utcDateTime(); 38 | 39 | await _clientRepository.CreateAsync(client); 40 | 41 | return response; 42 | } 43 | 44 | public async Task DeleteAsync(string clientId) 45 | { 46 | var response = new Response(); 47 | 48 | var exists = await _clientRepository.ExistsByIdAsync(clientId); 49 | 50 | if (!exists) 51 | { 52 | response.Report.Add(Report.Create($"Client {clientId} not exists!")); 53 | return response; 54 | } 55 | 56 | await _clientRepository.DeleteAsync(clientId); 57 | 58 | return response; 59 | } 60 | 61 | public async Task> GetByIdAsync(string clientId) 62 | { 63 | var response = new Response(); 64 | 65 | var exists = await _clientRepository.ExistsByIdAsync(clientId); 66 | 67 | if (!exists) 68 | { 69 | response.Report.Add(Report.Create($"Client {clientId} not exists!")); 70 | return response; 71 | } 72 | 73 | var data = await _clientRepository.GetByIdAsync(clientId); 74 | response.Data = data; 75 | return response; 76 | } 77 | 78 | public async Task>> ListByFiltersAsync(string clientId = null, string name = null) 79 | { 80 | var response = new Response>(); 81 | 82 | if (!string.IsNullOrWhiteSpace(clientId)) 83 | { 84 | var exists = await _clientRepository.ExistsByIdAsync(clientId); 85 | 86 | if (!exists) 87 | { 88 | response.Report.Add(Report.Create($"Client {clientId} not exists!")); 89 | return response; 90 | } 91 | } 92 | 93 | var data = await _clientRepository.ListByFilterAsync(clientId, name); 94 | response.Data = data; 95 | 96 | return response; 97 | } 98 | 99 | public async Task UpdateAsync(ClientModel client) 100 | { 101 | var response = new Response(); 102 | 103 | var validation = new ClientValidation(); 104 | var errors = validation.Validate(client).GetErrors(); 105 | 106 | if (errors.Report.Count > 0) 107 | return errors; 108 | 109 | var exists = await _clientRepository.ExistsByIdAsync(client.Id); 110 | 111 | if (!exists) 112 | { 113 | response.Report.Add(Report.Create($"Client {client.Id} not exists!")); 114 | return response; 115 | } 116 | 117 | await _clientRepository.UpdateAsync(client); 118 | 119 | return response; 120 | } 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /Order/Startup.cs: -------------------------------------------------------------------------------- 1 | using AutoMapper; 2 | using Microsoft.AspNetCore.Authentication.JwtBearer; 3 | using Microsoft.AspNetCore.Builder; 4 | using Microsoft.AspNetCore.Hosting; 5 | using Microsoft.Extensions.Configuration; 6 | using Microsoft.Extensions.DependencyInjection; 7 | using Microsoft.Extensions.Hosting; 8 | using Microsoft.IdentityModel.Tokens; 9 | using Order.Api.Extensions; 10 | using Order.Application.Mapper; 11 | using Order.Application.Models; 12 | using Order.Domain.Interfaces.Repositories.DataConnector; 13 | using Order.Infra.DataConnector; 14 | using System.Linq; 15 | using System.Text; 16 | 17 | namespace Order 18 | { 19 | public class Startup 20 | { 21 | public Startup(IConfiguration configuration) 22 | { 23 | Configuration = configuration; 24 | } 25 | 26 | public IConfiguration Configuration { get; } 27 | 28 | // This method gets called by the runtime. Use this method to add services to the container. 29 | public void ConfigureServices(IServiceCollection services) 30 | { 31 | services.AddAutoMapper(typeof(Core)); 32 | services.AddControllers(); 33 | 34 | var authSettingsSection = Configuration.GetSection("AuthSettings"); 35 | services.Configure(authSettingsSection); 36 | 37 | var authSettings = authSettingsSection.Get(); 38 | SymmetricSecurityKey key = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(authSettings.Secret)); 39 | 40 | services.AddAuthentication(x => 41 | { 42 | x.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme; 43 | x.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme; 44 | }).AddPolicyScheme("programevc", "Authorization Bearer or AccessToken", options => 45 | { 46 | options.ForwardDefaultSelector = context => 47 | { 48 | if (context.Request.Headers["Access-Token"].Any()) 49 | { 50 | return "Access-Token"; 51 | } 52 | 53 | return JwtBearerDefaults.AuthenticationScheme; 54 | }; 55 | }).AddJwtBearer(x => 56 | { 57 | x.TokenValidationParameters = new TokenValidationParameters() 58 | { 59 | ValidateIssuer = true, 60 | ValidIssuer = "programevc", 61 | 62 | ValidateAudience = false, 63 | 64 | ValidateIssuerSigningKey = true, 65 | IssuerSigningKey = key, 66 | 67 | // Verify if token is valid 68 | ValidateLifetime = true, 69 | RequireExpirationTime = true, 70 | 71 | }; 72 | 73 | }); 74 | 75 | 76 | string connectionString = Configuration.GetConnectionString("default"); 77 | services.AddScoped(db => new SqlConnector(connectionString)); 78 | 79 | services.RegisterIoC(); 80 | 81 | services.SwaggerConfiguration(); 82 | 83 | } 84 | 85 | // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. 86 | public void Configure(IApplicationBuilder app, IWebHostEnvironment env) 87 | { 88 | app.UseSwagger(); 89 | app.UseSwaggerUI(setup => 90 | { 91 | setup.RoutePrefix = "swagger"; 92 | setup.SwaggerEndpoint("/swagger/v1/swagger.json", "Api Documentation"); 93 | }); 94 | 95 | if (env.IsDevelopment()) 96 | { 97 | app.UseDeveloperExceptionPage(); 98 | } 99 | 100 | app.UseHttpsRedirection(); 101 | 102 | app.UseRouting(); 103 | 104 | app.UseAuthentication(); 105 | app.UseAuthorization(); 106 | 107 | app.UseEndpoints(endpoints => 108 | { 109 | endpoints.MapControllers(); 110 | }); 111 | } 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /Order.Domain/Services/ProductService.cs: -------------------------------------------------------------------------------- 1 | using Order.Domain.Common; 2 | using Order.Domain.Interfaces.Repositories; 3 | using Order.Domain.Interfaces.Services; 4 | using Order.Domain.Models; 5 | using Order.Domain.Validations; 6 | using Order.Domain.Validations.Base; 7 | using System.Collections.Generic; 8 | using System.Threading.Tasks; 9 | 10 | namespace Order.Domain.Services 11 | { 12 | public class ProductService : IProductService 13 | { 14 | private readonly IProductRepository _productRepository; 15 | private readonly ITimeProvider _timeProvider; 16 | private readonly IGenerators _generators; 17 | public ProductService(IProductRepository productRepository, 18 | ITimeProvider timeProvider, 19 | IGenerators generators) 20 | { 21 | _productRepository = productRepository; 22 | _timeProvider = timeProvider; 23 | _generators = generators; 24 | } 25 | public async Task CreateAsync(ProductModel product) 26 | { 27 | var response = new Response(); 28 | 29 | var validation = new ProductValidation(); 30 | var errors = validation.Validate(product).GetErrors(); 31 | 32 | if (errors.Report.Count > 0) 33 | return errors; 34 | 35 | product.Id = _generators.Generate(); 36 | product.CreatedAt = _timeProvider.utcDateTime(); 37 | await _productRepository.CreateAsync(product); 38 | 39 | return response; 40 | } 41 | 42 | public async Task DeleteAsync(string productId) 43 | { 44 | var response = new Response(); 45 | 46 | var exists = await _productRepository.ExistsByIdAsync(productId); 47 | 48 | if (!exists) 49 | { 50 | response.Report.Add(Report.Create($"product {productId} not exists!")); 51 | return response; 52 | } 53 | 54 | await _productRepository.DeleteAsync(productId); 55 | 56 | return response; 57 | } 58 | 59 | public async Task> GetByIdAsync(string productId) 60 | { 61 | var response = new Response(); 62 | 63 | var exists = await _productRepository.ExistsByIdAsync(productId); 64 | 65 | if (!exists) 66 | { 67 | response.Report.Add(Report.Create($"product {productId} not exists!")); 68 | return response; 69 | } 70 | 71 | var data = await _productRepository.GetByIdAsync(productId); 72 | response.Data = data; 73 | return response; 74 | } 75 | 76 | public async Task>> ListByFilterAsync(string productId = null, string description = null) 77 | { 78 | var response = new Response>(); 79 | 80 | if (!string.IsNullOrWhiteSpace(productId)) 81 | { 82 | var exists = await _productRepository.ExistsByIdAsync(productId); 83 | 84 | if (!exists) 85 | { 86 | response.Report.Add(Report.Create($"product {productId} not exists!")); 87 | return response; 88 | } 89 | } 90 | 91 | var data = await _productRepository.ListByFilterAsync(productId, description); 92 | response.Data = data; 93 | 94 | return response; 95 | } 96 | 97 | public async Task UpdateAsync(ProductModel product) 98 | { 99 | var response = new Response(); 100 | 101 | var validation = new ProductValidation(); 102 | var errors = validation.Validate(product).GetErrors(); 103 | 104 | if (errors.Report.Count > 0) 105 | return errors; 106 | 107 | var exists = await _productRepository.ExistsByIdAsync(product.Id); 108 | 109 | if (!exists) 110 | { 111 | response.Report.Add(Report.Create($"product {product.Id} not exists!")); 112 | return response; 113 | } 114 | 115 | await _productRepository.UpdateAsync(product); 116 | 117 | return response; 118 | } 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /Order.Infra/Repositories/ProductRepository.cs: -------------------------------------------------------------------------------- 1 | using Dapper; 2 | using Order.Domain.Interfaces.Repositories; 3 | using Order.Domain.Interfaces.Repositories.DataConnector; 4 | using Order.Domain.Models; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Threading.Tasks; 8 | 9 | namespace Order.Infra.Repositories 10 | { 11 | public class ProductRepository : IProductRepository 12 | { 13 | private readonly IDbConnector _dbConnector; 14 | public ProductRepository(IDbConnector dbConnector) 15 | { 16 | _dbConnector = dbConnector; 17 | } 18 | 19 | const string baseSql = @"SELECT [Id] 20 | ,[Description] 21 | ,[SellValue] 22 | ,[Stock] 23 | ,[CreatedAt] 24 | FROM[dbo].[Product] 25 | WHERE 1 = 1 "; 26 | public async Task CreateAsync(ProductModel Product) 27 | { 28 | string sql = @"INSERT INTO [dbo].[Product] 29 | ([Id] 30 | ,[Description] 31 | ,[SellValue] 32 | ,[Stock] 33 | ,[CreatedAt]) 34 | VALUES 35 | (@Id 36 | ,@Description 37 | ,@SellValue 38 | ,@Stock 39 | ,@CreatedAt)"; 40 | 41 | await _dbConnector.dbConnection.ExecuteAsync(sql, new 42 | { 43 | Id = Product.Id, 44 | Description = Product.Description, 45 | SellValue = Product.SellValue, 46 | Stock = Product.Stock, 47 | CreatedAt = Product.CreatedAt, 48 | }, _dbConnector.dbTransaction); 49 | } 50 | 51 | public async Task DeleteAsync(string ProductId) 52 | { 53 | string sql = $"DELETE FROM [dbo].[Product] WHERE id = @id"; 54 | 55 | await _dbConnector.dbConnection.ExecuteAsync(sql, new { Id = ProductId }, _dbConnector.dbTransaction); 56 | } 57 | 58 | public async Task ExistsByIdAsync(string ProductId) 59 | { 60 | string sql = $"SELECT 1 FROM Product WHERE Id = @Id "; 61 | 62 | var Products = await _dbConnector.dbConnection.QueryAsync(sql, new { Id = ProductId }, _dbConnector.dbTransaction); 63 | 64 | return Products.FirstOrDefault(); 65 | } 66 | 67 | public async Task GetByIdAsync(string ProductId) 68 | { 69 | string sql = $"{baseSql} AND Id = @Id"; 70 | 71 | var Products = await _dbConnector.dbConnection.QueryAsync(sql, new { Id = ProductId}, _dbConnector.dbTransaction); 72 | 73 | return Products.FirstOrDefault(); 74 | } 75 | 76 | public async Task> ListByFilterAsync(string ProductId = null, string name = null) 77 | { 78 | string sql = $"{baseSql} "; 79 | 80 | if (!string.IsNullOrWhiteSpace(ProductId)) 81 | sql += "AND Id = @Id"; 82 | 83 | if (!string.IsNullOrWhiteSpace(name)) 84 | sql += "AND Description like @Name"; 85 | 86 | var Products = await _dbConnector.dbConnection.QueryAsync(sql,new { Id = ProductId, Name = "%" + name + "%" }, _dbConnector.dbTransaction); 87 | 88 | return Products.ToList(); 89 | } 90 | 91 | public async Task UpdateAsync(ProductModel Product) 92 | { 93 | string sql = @"UPDATE [dbo].[Product] 94 | SET [Description] = @Description 95 | ,[SellValue] = @SellValue 96 | ,[Stock] = @Stock 97 | WHERE Id = @Id"; 98 | 99 | await _dbConnector.dbConnection.ExecuteAsync(sql, new 100 | { 101 | Id = Product.Id, 102 | Description = Product.Description, 103 | SellValue = Product.SellValue, 104 | Stock = Product.Stock 105 | }, _dbConnector.dbTransaction); 106 | } 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /Order.Infra/Repositories/ClientRepository.cs: -------------------------------------------------------------------------------- 1 | using Dapper; 2 | using Order.Domain.Interfaces.Repositories; 3 | using Order.Domain.Interfaces.Repositories.DataConnector; 4 | using Order.Domain.Models; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Threading.Tasks; 8 | 9 | namespace Order.Infra.Repositories 10 | { 11 | public class ClientRepository : IClientRepository 12 | { 13 | private readonly IDbConnector _dbConnector; 14 | public ClientRepository(IDbConnector dbConnector) 15 | { 16 | _dbConnector = dbConnector; 17 | } 18 | 19 | const string baseSql = @"SELECT [Id] 20 | ,[Name] 21 | ,[Email] 22 | ,[PhoneNumber] 23 | ,[Adress] 24 | ,[CreatedAt] 25 | FROM [dbo].[Client] 26 | WHERE 1 = 1 "; 27 | public async Task CreateAsync(ClientModel client) 28 | { 29 | string sql = @"INSERT INTO [dbo].[Client] 30 | ([Id] 31 | ,[Name] 32 | ,[Email] 33 | ,[PhoneNumber] 34 | ,[Adress] 35 | ,[CreatedAt]) 36 | VALUES 37 | (@Id 38 | ,@Name 39 | ,@Email 40 | ,@PhoneNumber 41 | ,@Adress 42 | ,@CreatedAt)"; 43 | 44 | await _dbConnector.dbConnection.ExecuteAsync(sql, new 45 | { 46 | Id = client.Id, 47 | Name = client.Name, 48 | Email = client.Email, 49 | PhoneNumber = client.PhoneNumber, 50 | Adress = client.Adress, 51 | CreatedAt = client.CreatedAt 52 | }, _dbConnector.dbTransaction); 53 | 54 | } 55 | public async Task UpdateAsync(ClientModel client) 56 | { 57 | string sql = @"UPDATE [dbo].[Client] 58 | SET [Name] = @Name 59 | ,[Email] = @Email 60 | ,[PhoneNumber] = @PhoneNumber 61 | ,[Adress] = @Adress 62 | WHERE Id = @Id"; 63 | 64 | await _dbConnector.dbConnection.ExecuteAsync(sql, new 65 | { 66 | Id = client.Id, 67 | Name = client.Name, 68 | Email = client.Email, 69 | PhoneNumber = client.PhoneNumber, 70 | Adress = client.Adress, 71 | }, _dbConnector.dbTransaction); 72 | } 73 | public async Task DeleteAsync(string clientId) 74 | { 75 | string sql = $"DELETE FROM [dbo].[Client] WHERE id = @id"; 76 | 77 | await _dbConnector.dbConnection.ExecuteAsync(sql, new { Id = clientId }, _dbConnector.dbTransaction); 78 | } 79 | public async Task ExistsByIdAsync(string clientId) 80 | { 81 | string sql = $"SELECT 1 FROM Client WHERE Id = @Id "; 82 | 83 | var clients = await _dbConnector.dbConnection.QueryAsync(sql, new { Id = clientId }, _dbConnector.dbTransaction); 84 | 85 | return clients.FirstOrDefault(); 86 | } 87 | public async Task GetByIdAsync(string clientId) 88 | { 89 | string sql = $"{baseSql} AND Id = @Id"; 90 | 91 | var clients = await _dbConnector.dbConnection.QueryAsync(sql, new { Id = clientId }, _dbConnector.dbTransaction); 92 | 93 | return clients.FirstOrDefault(); 94 | } 95 | public async Task> ListByFilterAsync(string clientId = null, string name = null) 96 | { 97 | string sql = $"{baseSql} "; 98 | 99 | if (!string.IsNullOrWhiteSpace(clientId)) 100 | sql += "AND Id = @Id"; 101 | 102 | if (!string.IsNullOrWhiteSpace(name)) 103 | sql += "AND Name like @Name"; 104 | 105 | var clients = await _dbConnector.dbConnection.QueryAsync(sql, new { Id = clientId, Name = "%" + name + "%" }, _dbConnector.dbTransaction); 106 | 107 | return clients.ToList(); 108 | } 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /Order.Infra/Repositories/UserRepository.cs: -------------------------------------------------------------------------------- 1 | using Dapper; 2 | using Order.Domain.Interfaces.Repositories; 3 | using Order.Domain.Interfaces.Repositories.DataConnector; 4 | using Order.Domain.Models; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Threading.Tasks; 8 | 9 | namespace Order.Infra.Repositories 10 | { 11 | public class UserRepository : IUserRepository 12 | { 13 | private readonly IDbConnector _dbConnector; 14 | public UserRepository(IDbConnector dbConnector) 15 | { 16 | _dbConnector = dbConnector; 17 | } 18 | 19 | const string baseSql = @"SELECT [Id] 20 | ,[Name] 21 | ,[Login] 22 | ,[PasswordHash] 23 | ,[CreatedAt] 24 | FROM [dbo].[User] 25 | WHERE 1 = 1 "; 26 | 27 | public async Task CreateAsync(UserModel user) 28 | { 29 | string sql = @"INSERT INTO [dbo].[User] 30 | ([Id] 31 | ,[Name] 32 | ,[Login] 33 | ,[PasswordHash] 34 | ,[CreatedAt]) 35 | VALUES 36 | (@Id 37 | ,@Name 38 | ,@Login 39 | ,@PasswordHash 40 | ,@CreatedAt)"; 41 | 42 | await _dbConnector.dbConnection.ExecuteAsync(sql, new 43 | { 44 | Id = user.Id, 45 | Name = user.Name, 46 | Login = user.Login, 47 | PasswordHash = user.PasswordHash, 48 | CreatedAt = user.CreatedAt 49 | }, _dbConnector.dbTransaction); 50 | } 51 | public async Task UpdateAsync(UserModel user) 52 | { 53 | string sql = @"UPDATE [dbo].[User] 54 | SET [Name] = @Name 55 | ,[Login] = @Login 56 | ,[PasswordHash] = @PasswordHash 57 | WHERE id = @Id "; 58 | 59 | await _dbConnector.dbConnection.ExecuteAsync(sql, new 60 | { 61 | Id = user.Id, 62 | Name = user.Name, 63 | Login = user.Login, 64 | PasswordHash = user.PasswordHash 65 | }, _dbConnector.dbTransaction); 66 | } 67 | public async Task DeleteAsync(string userId) 68 | { 69 | string sql = $"DELETE FROM [dbo].[User] WHERE id = @id"; 70 | 71 | await _dbConnector.dbConnection.ExecuteAsync(sql, new { Id = userId }, _dbConnector.dbTransaction); 72 | } 73 | public async Task ExistsByIdAsync(string userId) 74 | { 75 | string sql = $"SELECT 1 FROM User WHERE Id = @Id "; 76 | 77 | var users = await _dbConnector.dbConnection.QueryAsync(sql, new { Id = userId }, _dbConnector.dbTransaction); 78 | 79 | return users.FirstOrDefault(); 80 | } 81 | public async Task ExistsByLoginAsync(string login) 82 | { 83 | string sql = $"SELECT 1 FROM [User] WHERE Login = @Login "; 84 | 85 | var users = await _dbConnector.dbConnection.QueryAsync(sql, new { Login = login }, _dbConnector.dbTransaction); 86 | 87 | return users.FirstOrDefault(); 88 | } 89 | public async Task GetByIdAsync(string userId) 90 | { 91 | string sql = $"{baseSql} AND Id = @Id"; 92 | 93 | var users = await _dbConnector.dbConnection.QueryAsync(sql, new { Id = userId }, _dbConnector.dbTransaction); 94 | 95 | return users.FirstOrDefault(); 96 | } 97 | public async Task> ListByFilterAsync(string login = null, string name = null) 98 | { 99 | string sql = $"{baseSql} "; 100 | 101 | if (!string.IsNullOrWhiteSpace(login)) 102 | sql += "AND login = @Login"; 103 | 104 | if (!string.IsNullOrWhiteSpace(name)) 105 | sql += "AND Name like @Name"; 106 | 107 | var users = await _dbConnector.dbConnection.QueryAsync(sql, new { Login = login, Name = "%" + name + "%" }, _dbConnector.dbTransaction); 108 | 109 | return users.ToList(); 110 | } 111 | 112 | public async Task GetByLoginAsync(string login) 113 | { 114 | string sql = $"{baseSql} AND Login = @Login"; 115 | 116 | var users = await _dbConnector.dbConnection.QueryAsync(sql, new { Login = login }, _dbConnector.dbTransaction); 117 | 118 | return users.FirstOrDefault(); 119 | } 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /Order.Domain/Services/OrderService.cs: -------------------------------------------------------------------------------- 1 | using Order.Domain.Common; 2 | using Order.Domain.Interfaces.Repositories; 3 | using Order.Domain.Interfaces.Services; 4 | using Order.Domain.Models; 5 | using Order.Domain.Validations; 6 | using Order.Domain.Validations.Base; 7 | using System; 8 | using System.Collections.Generic; 9 | using System.Threading.Tasks; 10 | 11 | namespace Order.Domain.Services 12 | { 13 | public class OrderService : IOrderService 14 | { 15 | private readonly IUnitOfWork _unitOfWork; 16 | private readonly ITimeProvider _timeProvider; 17 | private readonly IGenerators _generators; 18 | 19 | public OrderService(ITimeProvider timeProvider, 20 | IGenerators generators, IUnitOfWork unitOfWork) 21 | { 22 | _timeProvider = timeProvider; 23 | _generators = generators; 24 | _unitOfWork = unitOfWork; 25 | } 26 | 27 | public async Task CreateAsync(OrderModel order) 28 | { 29 | var response = new Response(); 30 | 31 | var validation = new OrderValidation(); 32 | var errors = validation.Validate(order).GetErrors(); 33 | 34 | if (errors.Report.Count > 0) 35 | return errors; 36 | 37 | order.Id = _generators.Generate(); 38 | order.CreatedAt = _timeProvider.utcDateTime(); 39 | 40 | foreach (var item in order.Items) 41 | { 42 | item.Order = order; 43 | item.Id = _generators.Generate(); 44 | item.CreatedAt = _timeProvider.utcDateTime(); 45 | } 46 | 47 | await _unitOfWork.OrderRepository.CreateAsync(order); 48 | 49 | return response; 50 | } 51 | 52 | public async Task DeleteAsync(string orderId) 53 | { 54 | var response = new Response(); 55 | 56 | var exists = await _unitOfWork.OrderRepository.ExistsByIdAsync(orderId); 57 | 58 | if (!exists) 59 | { 60 | response.Report.Add(Report.Create($"Order {orderId} not exists!")); 61 | return response; 62 | } 63 | 64 | await _unitOfWork.OrderRepository.DeleteAsync(orderId); 65 | 66 | return response; 67 | } 68 | 69 | public async Task> GetByIdAsync(string orderId) 70 | { 71 | var response = new Response(); 72 | _unitOfWork.BeginTransaction(); 73 | 74 | try 75 | { 76 | var exists = await _unitOfWork.OrderRepository.ExistsByIdAsync(orderId); 77 | 78 | if (!exists) 79 | { 80 | response.Report.Add(Report.Create($"Order {orderId} not exists!")); 81 | return response; 82 | } 83 | 84 | var data = await _unitOfWork.OrderRepository.GetByIdAsync(orderId); 85 | data.Items = await _unitOfWork.OrderRepository.ListItemByOrderIdAsync(orderId); 86 | 87 | _unitOfWork.CommitTransaction(); 88 | 89 | response.Data = data; 90 | return response; 91 | } 92 | catch (Exception ex) 93 | { 94 | _unitOfWork.RollbackTransaction(); 95 | return response; 96 | } 97 | } 98 | 99 | public async Task>> ListByFiltersAsync(string orderId = null, string clientId = null, string userId = null) 100 | { 101 | var response = new Response>(); 102 | 103 | if (!string.IsNullOrWhiteSpace(orderId)) 104 | { 105 | var exists = await _unitOfWork.OrderRepository.ExistsByIdAsync(orderId); 106 | 107 | if (!exists) 108 | { 109 | response.Report.Add(Report.Create($"Order {orderId} not exists!")); 110 | return response; 111 | } 112 | } 113 | 114 | var data = await _unitOfWork.OrderRepository.ListByFilterAsync(orderId, clientId, userId); 115 | response.Data = data; 116 | 117 | return response; 118 | } 119 | 120 | public async Task UpdateAsync(OrderModel order) 121 | { 122 | var response = new Response(); 123 | 124 | var validation = new OrderValidation(); 125 | var errors = validation.Validate(order).GetErrors(); 126 | 127 | if (errors.Report.Count > 0) 128 | return errors; 129 | 130 | var exists = await _unitOfWork.OrderRepository.ExistsByIdAsync(order.Id); 131 | 132 | if (!exists) 133 | { 134 | response.Report.Add(Report.Create($"Order {order.Id} not exists!")); 135 | return response; 136 | } 137 | 138 | await _unitOfWork.OrderRepository.UpdateAsync(order); 139 | 140 | return response; 141 | } 142 | } 143 | } 144 | -------------------------------------------------------------------------------- /Order.Domain/Services/UserService.cs: -------------------------------------------------------------------------------- 1 | using Order.Domain.Common; 2 | using Order.Domain.Interfaces.Repositories; 3 | using Order.Domain.Interfaces.Services; 4 | using Order.Domain.Models; 5 | using Order.Domain.Validations; 6 | using Order.Domain.Validations.Base; 7 | using System; 8 | using System.Collections.Generic; 9 | using System.Threading.Tasks; 10 | 11 | namespace Order.Domain.Services 12 | { 13 | public class UserService : IUserService 14 | { 15 | private readonly IUserRepository _UserRepository; 16 | private readonly ITimeProvider _timeProvider; 17 | private readonly IGenerators _generators; 18 | private readonly ISecurityService _securityService; 19 | 20 | public UserService(IUserRepository UserRepository, 21 | ITimeProvider timeProvider, 22 | IGenerators generators, 23 | ISecurityService securityService) 24 | { 25 | _UserRepository = UserRepository; 26 | _timeProvider = timeProvider; 27 | _generators = generators; 28 | _securityService = securityService; 29 | } 30 | 31 | public async Task> AutheticationAsync(string password, UserModel user) 32 | { 33 | return await _securityService.VerifyPassword(password, user); 34 | } 35 | 36 | public async Task CreateAsync(UserModel user) 37 | { 38 | var response = new Response(); 39 | 40 | var validation = new UserValidation(); 41 | var errors = validation.Validate(user).GetErrors(); 42 | 43 | if (errors.Report.Count > 0) 44 | return errors; 45 | 46 | user.Id = _generators.Generate(); 47 | user.CreatedAt = _timeProvider.utcDateTime(); 48 | 49 | await _UserRepository.CreateAsync(user); 50 | 51 | return response; 52 | } 53 | 54 | public async Task DeleteAsync(string userId) 55 | { 56 | var response = new Response(); 57 | 58 | var exists = await _UserRepository.ExistsByIdAsync(userId); 59 | 60 | if (!exists) 61 | { 62 | response.Report.Add(Report.Create($"User {userId} not exists!")); 63 | return response; 64 | } 65 | 66 | await _UserRepository.DeleteAsync(userId); 67 | 68 | return response; 69 | } 70 | 71 | public async Task> GetByIdAsync(string userId) 72 | { 73 | var response = new Response(); 74 | 75 | var exists = await _UserRepository.ExistsByIdAsync(userId); 76 | 77 | if (!exists) 78 | { 79 | response.Report.Add(Report.Create($"User {userId} not exists!")); 80 | return response; 81 | } 82 | 83 | var data = await _UserRepository.GetByIdAsync(userId); 84 | response.Data = data; 85 | return response; 86 | } 87 | 88 | public async Task> GetByLoginAsync(string login) 89 | { 90 | var response = new Response(); 91 | 92 | var exists = await _UserRepository.ExistsByLoginAsync(login); 93 | 94 | if (!exists) 95 | { 96 | response.Report.Add(Report.Create($"User {login} not exists!")); 97 | return response; 98 | } 99 | 100 | var data = await _UserRepository.GetByLoginAsync(login); 101 | response.Data = data; 102 | return response; 103 | } 104 | 105 | public async Task>> ListByFilterAsync(string userId = null, string name = null) 106 | { 107 | var response = new Response>(); 108 | 109 | if (!string.IsNullOrWhiteSpace(userId)) 110 | { 111 | var exists = await _UserRepository.ExistsByIdAsync(userId); 112 | 113 | if (!exists) 114 | { 115 | response.Report.Add(Report.Create($"User {userId} not exists!")); 116 | return response; 117 | } 118 | } 119 | 120 | var data = await _UserRepository.ListByFilterAsync(userId, name); 121 | response.Data = data; 122 | 123 | return response; 124 | } 125 | 126 | public async Task UpdateAsync(UserModel user) 127 | { 128 | var response = new Response(); 129 | 130 | var validation = new UserValidation(); 131 | var errors = validation.Validate(user).GetErrors(); 132 | 133 | if (errors.Report.Count > 0) 134 | return errors; 135 | 136 | var exists = await _UserRepository.ExistsByIdAsync(user.Id); 137 | 138 | if (!exists) 139 | { 140 | response.Report.Add(Report.Create($"User {user.Id} not exists!")); 141 | return response; 142 | } 143 | 144 | await _UserRepository.UpdateAsync(user); 145 | 146 | return response; 147 | } 148 | } 149 | } 150 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | bld/ 21 | [Bb]in/ 22 | [Oo]bj/ 23 | [Ll]og/ 24 | *.env 25 | .vs/ 26 | 27 | # Visual Studio 2015 cache/options directory 28 | .vs/ 29 | # Uncomment if you have tasks that create the project's static files in wwwroot 30 | #wwwroot/ 31 | 32 | # MSTest test Results 33 | [Tt]est[Rr]esult*/ 34 | [Bb]uild[Ll]og.* 35 | 36 | # NUNIT 37 | *.VisualState.xml 38 | TestResult.xml 39 | 40 | # Build Results of an ATL Project 41 | [Dd]ebugPS/ 42 | [Rr]eleasePS/ 43 | dlldata.c 44 | 45 | # DNX 46 | project.lock.json 47 | project.fragment.lock.json 48 | artifacts/ 49 | 50 | *_i.c 51 | *_p.c 52 | *_i.h 53 | *.ilk 54 | *.meta 55 | *.obj 56 | *.pch 57 | *.pdb 58 | *.pgc 59 | *.pgd 60 | *.rsp 61 | *.sbr 62 | *.tlb 63 | *.tli 64 | *.tlh 65 | *.tmp 66 | *.tmp_proj 67 | *.log 68 | *.vspscc 69 | *.vssscc 70 | .builds 71 | *.pidb 72 | *.svclog 73 | *.scc 74 | 75 | # Chutzpah Test files 76 | _Chutzpah* 77 | 78 | # Visual C++ cache files 79 | ipch/ 80 | *.aps 81 | *.ncb 82 | *.opendb 83 | *.opensdf 84 | *.sdf 85 | *.cachefile 86 | *.VC.db 87 | *.VC.VC.opendb 88 | 89 | # Visual Studio profiler 90 | *.psess 91 | *.vsp 92 | *.vspx 93 | *.sap 94 | 95 | # TFS 2012 Local Workspace 96 | $tf/ 97 | 98 | # Guidance Automation Toolkit 99 | *.gpState 100 | 101 | # ReSharper is a .NET coding add-in 102 | _ReSharper*/ 103 | *.[Rr]e[Ss]harper 104 | *.DotSettings.user 105 | 106 | # JustCode is a .NET coding add-in 107 | .JustCode 108 | 109 | # TeamCity is a build add-in 110 | _TeamCity* 111 | 112 | # DotCover is a Code Coverage Tool 113 | *.dotCover 114 | 115 | # NCrunch 116 | _NCrunch_* 117 | .*crunch*.local.xml 118 | nCrunchTemp_* 119 | 120 | # MightyMoose 121 | *.mm.* 122 | AutoTest.Net/ 123 | 124 | # Web workbench (sass) 125 | .sass-cache/ 126 | 127 | # Installshield output folder 128 | [Ee]xpress/ 129 | 130 | # DocProject is a documentation generator add-in 131 | DocProject/buildhelp/ 132 | DocProject/Help/*.HxT 133 | DocProject/Help/*.HxC 134 | DocProject/Help/*.hhc 135 | DocProject/Help/*.hhk 136 | DocProject/Help/*.hhp 137 | DocProject/Help/Html2 138 | DocProject/Help/html 139 | 140 | # Click-Once directory 141 | publish/ 142 | 143 | # Publish Web Output 144 | *.[Pp]ublish.xml 145 | *.azurePubxml 146 | # TODO: Comment the next line if you want to checkin your web deploy settings 147 | # but database connection strings (with potential passwords) will be unencrypted 148 | #*.pubxml 149 | *.publishproj 150 | 151 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 152 | # checkin your Azure Web App publish settings, but sensitive information contained 153 | # in these scripts will be unencrypted 154 | PublishScripts/ 155 | 156 | # NuGet Packages 157 | *.nupkg 158 | # The packages folder can be ignored because of Package Restore 159 | **/packages/* 160 | # except build/, which is used as an MSBuild target. 161 | !**/packages/build/ 162 | # Uncomment if necessary however generally it will be regenerated when needed 163 | #!**/packages/repositories.config 164 | # NuGet v3's project.json files produces more ignoreable files 165 | *.nuget.props 166 | *.nuget.targets 167 | 168 | # Microsoft Azure Build Output 169 | csx/ 170 | *.build.csdef 171 | 172 | # Microsoft Azure Emulator 173 | ecf/ 174 | rcf/ 175 | 176 | # Windows Store app package directories and files 177 | AppPackages/ 178 | BundleArtifacts/ 179 | Package.StoreAssociation.xml 180 | _pkginfo.txt 181 | 182 | # Visual Studio cache files 183 | # files ending in .cache can be ignored 184 | *.[Cc]ache 185 | # but keep track of directories ending in .cache 186 | !*.[Cc]ache/ 187 | 188 | # Others 189 | ClientBin/ 190 | ~$* 191 | *~ 192 | *.dbmdl 193 | *.dbproj.schemaview 194 | *.jfm 195 | *.pfx 196 | *.publishsettings 197 | node_modules/ 198 | orleans.codegen.cs 199 | 200 | # Since there are multiple workflows, uncomment next line to ignore bower_components 201 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 202 | #bower_components/ 203 | 204 | # RIA/Silverlight projects 205 | Generated_Code/ 206 | 207 | # Backup & report files from converting an old project file 208 | # to a newer Visual Studio version. Backup files are not needed, 209 | # because we have git ;-) 210 | _UpgradeReport_Files/ 211 | Backup*/ 212 | UpgradeLog*.XML 213 | UpgradeLog*.htm 214 | 215 | # SQL Server files 216 | *.mdf 217 | *.ldf 218 | 219 | # Business Intelligence projects 220 | *.rdl.data 221 | *.bim.layout 222 | *.bim_*.settings 223 | 224 | # Microsoft Fakes 225 | FakesAssemblies/ 226 | 227 | # GhostDoc plugin setting file 228 | *.GhostDoc.xml 229 | 230 | # Node.js Tools for Visual Studio 231 | .ntvs_analysis.dat 232 | 233 | # Visual Studio 6 build log 234 | *.plg 235 | 236 | # Visual Studio 6 workspace options file 237 | *.opt 238 | 239 | # Visual Studio LightSwitch build output 240 | **/*.HTMLClient/GeneratedArtifacts 241 | **/*.DesktopClient/GeneratedArtifacts 242 | **/*.DesktopClient/ModelManifest.xml 243 | **/*.Server/GeneratedArtifacts 244 | **/*.Server/ModelManifest.xml 245 | _Pvt_Extensions 246 | 247 | # Paket dependency manager 248 | .paket/paket.exe 249 | paket-files/ 250 | 251 | # FAKE - F# Make 252 | .fake/ 253 | 254 | # JetBrains Rider 255 | .idea/ 256 | *.sln.iml 257 | 258 | # CodeRush 259 | .cr/ 260 | 261 | # Python Tools for Visual Studio (PTVS) 262 | __pycache__/ 263 | *.pyc 264 | 265 | *.refactorlog 266 | -------------------------------------------------------------------------------- /Order.Infra/obj/Order.Infra.csproj.nuget.dgspec.json: -------------------------------------------------------------------------------- 1 | { 2 | "format": 1, 3 | "restore": { 4 | "C:\\Users\\Wellyngton\\source\\repos\\Order\\Order.Infra\\Order.Infra.csproj": {} 5 | }, 6 | "projects": { 7 | "C:\\Users\\Wellyngton\\source\\repos\\Order\\Order.Domain\\Order.Domain.csproj": { 8 | "version": "1.0.0", 9 | "restore": { 10 | "projectUniqueName": "C:\\Users\\Wellyngton\\source\\repos\\Order\\Order.Domain\\Order.Domain.csproj", 11 | "projectName": "Order.Domain", 12 | "projectPath": "C:\\Users\\Wellyngton\\source\\repos\\Order\\Order.Domain\\Order.Domain.csproj", 13 | "packagesPath": "C:\\Users\\Wellyngton\\.nuget\\packages\\", 14 | "outputPath": "C:\\Users\\Wellyngton\\source\\repos\\Order\\Order.Domain\\obj\\", 15 | "projectStyle": "PackageReference", 16 | "fallbackFolders": [ 17 | "C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder" 18 | ], 19 | "configFilePaths": [ 20 | "C:\\Users\\Wellyngton\\AppData\\Roaming\\NuGet\\NuGet.Config", 21 | "C:\\Program Files (x86)\\NuGet\\Config\\DevExpress 19.1.config", 22 | "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" 23 | ], 24 | "originalTargetFrameworks": [ 25 | "netstandard2.0" 26 | ], 27 | "sources": { 28 | "C:\\Program Files (x86)\\DevExpress 19.1\\Components\\System\\Components\\Packages": {}, 29 | "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, 30 | "https://api.nuget.org/v3/index.json": {} 31 | }, 32 | "frameworks": { 33 | "netstandard2.0": { 34 | "targetAlias": "netstandard2.0", 35 | "projectReferences": {} 36 | } 37 | }, 38 | "warningProperties": { 39 | "warnAsError": [ 40 | "NU1605" 41 | ] 42 | } 43 | }, 44 | "frameworks": { 45 | "netstandard2.0": { 46 | "targetAlias": "netstandard2.0", 47 | "dependencies": { 48 | "BCrypt.Net-Core": { 49 | "target": "Package", 50 | "version": "[1.6.0, )" 51 | }, 52 | "FluentValidation": { 53 | "target": "Package", 54 | "version": "[9.2.2, )" 55 | }, 56 | "NETStandard.Library": { 57 | "suppressParent": "All", 58 | "target": "Package", 59 | "version": "[2.0.3, )", 60 | "autoReferenced": true 61 | }, 62 | "System.Threading.Tasks": { 63 | "target": "Package", 64 | "version": "[4.3.0, )" 65 | } 66 | }, 67 | "imports": [ 68 | "net461", 69 | "net462", 70 | "net47", 71 | "net471", 72 | "net472", 73 | "net48" 74 | ], 75 | "assetTargetFallback": true, 76 | "warn": true, 77 | "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\5.0.201\\RuntimeIdentifierGraph.json" 78 | } 79 | } 80 | }, 81 | "C:\\Users\\Wellyngton\\source\\repos\\Order\\Order.Infra\\Order.Infra.csproj": { 82 | "version": "1.0.0", 83 | "restore": { 84 | "projectUniqueName": "C:\\Users\\Wellyngton\\source\\repos\\Order\\Order.Infra\\Order.Infra.csproj", 85 | "projectName": "Order.Infra", 86 | "projectPath": "C:\\Users\\Wellyngton\\source\\repos\\Order\\Order.Infra\\Order.Infra.csproj", 87 | "packagesPath": "C:\\Users\\Wellyngton\\.nuget\\packages\\", 88 | "outputPath": "C:\\Users\\Wellyngton\\source\\repos\\Order\\Order.Infra\\obj\\", 89 | "projectStyle": "PackageReference", 90 | "fallbackFolders": [ 91 | "C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder" 92 | ], 93 | "configFilePaths": [ 94 | "C:\\Users\\Wellyngton\\AppData\\Roaming\\NuGet\\NuGet.Config", 95 | "C:\\Program Files (x86)\\NuGet\\Config\\DevExpress 19.1.config", 96 | "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" 97 | ], 98 | "originalTargetFrameworks": [ 99 | "netstandard2.0" 100 | ], 101 | "sources": { 102 | "C:\\Program Files (x86)\\DevExpress 19.1\\Components\\System\\Components\\Packages": {}, 103 | "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, 104 | "https://api.nuget.org/v3/index.json": {} 105 | }, 106 | "frameworks": { 107 | "netstandard2.0": { 108 | "targetAlias": "netstandard2.0", 109 | "projectReferences": { 110 | "C:\\Users\\Wellyngton\\source\\repos\\Order\\Order.Domain\\Order.Domain.csproj": { 111 | "projectPath": "C:\\Users\\Wellyngton\\source\\repos\\Order\\Order.Domain\\Order.Domain.csproj" 112 | } 113 | } 114 | } 115 | }, 116 | "warningProperties": { 117 | "warnAsError": [ 118 | "NU1605" 119 | ] 120 | } 121 | }, 122 | "frameworks": { 123 | "netstandard2.0": { 124 | "targetAlias": "netstandard2.0", 125 | "dependencies": { 126 | "Dapper.Contrib": { 127 | "target": "Package", 128 | "version": "[2.0.78, )" 129 | }, 130 | "NETStandard.Library": { 131 | "suppressParent": "All", 132 | "target": "Package", 133 | "version": "[2.0.3, )", 134 | "autoReferenced": true 135 | }, 136 | "System.Data.SqlClient": { 137 | "target": "Package", 138 | "version": "[4.8.2, )" 139 | } 140 | }, 141 | "imports": [ 142 | "net461", 143 | "net462", 144 | "net47", 145 | "net471", 146 | "net472", 147 | "net48" 148 | ], 149 | "assetTargetFallback": true, 150 | "warn": true, 151 | "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\5.0.201\\RuntimeIdentifierGraph.json" 152 | } 153 | } 154 | } 155 | } 156 | } -------------------------------------------------------------------------------- /Order.Application/obj/Order.Application.csproj.nuget.dgspec.json: -------------------------------------------------------------------------------- 1 | { 2 | "format": 1, 3 | "restore": { 4 | "C:\\Users\\Wellyngton\\source\\repos\\Order\\Order.Application\\Order.Application.csproj": {} 5 | }, 6 | "projects": { 7 | "C:\\Users\\Wellyngton\\source\\repos\\Order\\Order.Application\\Order.Application.csproj": { 8 | "version": "1.0.0", 9 | "restore": { 10 | "projectUniqueName": "C:\\Users\\Wellyngton\\source\\repos\\Order\\Order.Application\\Order.Application.csproj", 11 | "projectName": "Order.Application", 12 | "projectPath": "C:\\Users\\Wellyngton\\source\\repos\\Order\\Order.Application\\Order.Application.csproj", 13 | "packagesPath": "C:\\Users\\Wellyngton\\.nuget\\packages\\", 14 | "outputPath": "C:\\Users\\Wellyngton\\source\\repos\\Order\\Order.Application\\obj\\", 15 | "projectStyle": "PackageReference", 16 | "fallbackFolders": [ 17 | "C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder" 18 | ], 19 | "configFilePaths": [ 20 | "C:\\Users\\Wellyngton\\AppData\\Roaming\\NuGet\\NuGet.Config", 21 | "C:\\Program Files (x86)\\NuGet\\Config\\DevExpress 19.1.config", 22 | "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" 23 | ], 24 | "originalTargetFrameworks": [ 25 | "netstandard2.0" 26 | ], 27 | "sources": { 28 | "C:\\Program Files (x86)\\DevExpress 19.1\\Components\\System\\Components\\Packages": {}, 29 | "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, 30 | "https://api.nuget.org/v3/index.json": {} 31 | }, 32 | "frameworks": { 33 | "netstandard2.0": { 34 | "targetAlias": "netstandard2.0", 35 | "projectReferences": { 36 | "C:\\Users\\Wellyngton\\source\\repos\\Order\\Order.Domain\\Order.Domain.csproj": { 37 | "projectPath": "C:\\Users\\Wellyngton\\source\\repos\\Order\\Order.Domain\\Order.Domain.csproj" 38 | } 39 | } 40 | } 41 | }, 42 | "warningProperties": { 43 | "warnAsError": [ 44 | "NU1605" 45 | ] 46 | } 47 | }, 48 | "frameworks": { 49 | "netstandard2.0": { 50 | "targetAlias": "netstandard2.0", 51 | "dependencies": { 52 | "AutoMapper": { 53 | "target": "Package", 54 | "version": "[10.1.1, )" 55 | }, 56 | "Microsoft.AspNetCore.Authentication.JwtBearer": { 57 | "target": "Package", 58 | "version": "[2.2.0, )" 59 | }, 60 | "NETStandard.Library": { 61 | "suppressParent": "All", 62 | "target": "Package", 63 | "version": "[2.0.3, )", 64 | "autoReferenced": true 65 | } 66 | }, 67 | "imports": [ 68 | "net461", 69 | "net462", 70 | "net47", 71 | "net471", 72 | "net472", 73 | "net48" 74 | ], 75 | "assetTargetFallback": true, 76 | "warn": true, 77 | "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\5.0.201\\RuntimeIdentifierGraph.json" 78 | } 79 | } 80 | }, 81 | "C:\\Users\\Wellyngton\\source\\repos\\Order\\Order.Domain\\Order.Domain.csproj": { 82 | "version": "1.0.0", 83 | "restore": { 84 | "projectUniqueName": "C:\\Users\\Wellyngton\\source\\repos\\Order\\Order.Domain\\Order.Domain.csproj", 85 | "projectName": "Order.Domain", 86 | "projectPath": "C:\\Users\\Wellyngton\\source\\repos\\Order\\Order.Domain\\Order.Domain.csproj", 87 | "packagesPath": "C:\\Users\\Wellyngton\\.nuget\\packages\\", 88 | "outputPath": "C:\\Users\\Wellyngton\\source\\repos\\Order\\Order.Domain\\obj\\", 89 | "projectStyle": "PackageReference", 90 | "fallbackFolders": [ 91 | "C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder" 92 | ], 93 | "configFilePaths": [ 94 | "C:\\Users\\Wellyngton\\AppData\\Roaming\\NuGet\\NuGet.Config", 95 | "C:\\Program Files (x86)\\NuGet\\Config\\DevExpress 19.1.config", 96 | "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" 97 | ], 98 | "originalTargetFrameworks": [ 99 | "netstandard2.0" 100 | ], 101 | "sources": { 102 | "C:\\Program Files (x86)\\DevExpress 19.1\\Components\\System\\Components\\Packages": {}, 103 | "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, 104 | "https://api.nuget.org/v3/index.json": {} 105 | }, 106 | "frameworks": { 107 | "netstandard2.0": { 108 | "targetAlias": "netstandard2.0", 109 | "projectReferences": {} 110 | } 111 | }, 112 | "warningProperties": { 113 | "warnAsError": [ 114 | "NU1605" 115 | ] 116 | } 117 | }, 118 | "frameworks": { 119 | "netstandard2.0": { 120 | "targetAlias": "netstandard2.0", 121 | "dependencies": { 122 | "BCrypt.Net-Core": { 123 | "target": "Package", 124 | "version": "[1.6.0, )" 125 | }, 126 | "FluentValidation": { 127 | "target": "Package", 128 | "version": "[9.2.2, )" 129 | }, 130 | "NETStandard.Library": { 131 | "suppressParent": "All", 132 | "target": "Package", 133 | "version": "[2.0.3, )", 134 | "autoReferenced": true 135 | }, 136 | "System.Threading.Tasks": { 137 | "target": "Package", 138 | "version": "[4.3.0, )" 139 | } 140 | }, 141 | "imports": [ 142 | "net461", 143 | "net462", 144 | "net47", 145 | "net471", 146 | "net472", 147 | "net48" 148 | ], 149 | "assetTargetFallback": true, 150 | "warn": true, 151 | "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\5.0.201\\RuntimeIdentifierGraph.json" 152 | } 153 | } 154 | } 155 | } 156 | } -------------------------------------------------------------------------------- /Order.Infra/Repositories/OrderRepository.cs: -------------------------------------------------------------------------------- 1 | using Dapper; 2 | using Order.Domain.Interfaces.Repositories; 3 | using Order.Domain.Interfaces.Repositories.DataConnector; 4 | using Order.Domain.Models; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | using System.Threading.Tasks; 9 | 10 | namespace Order.Infra.Repositories 11 | { 12 | public class OrderRepository : IOrderRepository 13 | { 14 | private readonly IDbConnector _dbConnector; 15 | public OrderRepository(IDbConnector dbConnector) 16 | { 17 | _dbConnector = dbConnector; 18 | } 19 | 20 | const string baseSql = @"SELECT o.[Id] 21 | ,o.[CreatedAt] 22 | ,c.Id 23 | ,c.[Name] 24 | ,u.Id 25 | ,u.[Name] 26 | FROM [dbo].[Order] o 27 | JOIN [dbo].[Client] c ON o.ClientId = c.Id 28 | JOIN [dbo].[User] u ON o.UserId = u.Id 29 | WHERE 1 = 1 "; 30 | 31 | public async Task CreateAsync(OrderModel order) 32 | { 33 | string sql = @"INSERT INTO [dbo].[Order] 34 | ([Id] 35 | ,[ClientId] 36 | ,[UserId] 37 | ,[CreatedAt]) 38 | VALUES 39 | (@Id 40 | ,@ClientId 41 | ,@UserId 42 | ,@CreatedAt)"; 43 | 44 | await _dbConnector.dbConnection.ExecuteAsync(sql, new 45 | { 46 | Id = order.Id, 47 | ClientId = order.Client.Id, 48 | UserId = order.User.Id, 49 | CreatedAt = order.CreatedAt 50 | }, _dbConnector.dbTransaction); 51 | 52 | if (order.Items.Any()) 53 | { 54 | foreach (var item in order.Items) 55 | { 56 | await CreateItemAsync(item); 57 | } 58 | } 59 | } 60 | 61 | public async Task CreateItemAsync(OrderItemModel item) 62 | { 63 | string sql = @"INSERT INTO [dbo].[OrderItem] 64 | ([Id] 65 | ,[OrderId] 66 | ,[ProductId] 67 | ,[SellValue] 68 | ,[Quantity] 69 | ,[TotalAmount] 70 | ,[CreatedAt]) 71 | VALUES 72 | (@Id 73 | ,@OrderId 74 | ,@ProductId 75 | ,@SellValue 76 | ,@Quantity 77 | ,@TotalAmount 78 | ,@CreatedAt)"; 79 | 80 | await _dbConnector.dbConnection.ExecuteAsync(sql, new 81 | { 82 | Id = item.Id, 83 | OrderId = item.Order.Id, 84 | ProductId = item.Product.Id, 85 | SellValue = item.SellValue, 86 | Quantity = item.Quantity, 87 | TotalAmount = item.TotalAmout, 88 | CreatedAt = item.CreatedAt 89 | }, _dbConnector.dbTransaction); 90 | } 91 | 92 | public async Task DeleteAsync(string orderId) 93 | { 94 | string sql = $"DELETE FROM [dbo].[Order] WHERE id = @id"; 95 | 96 | await _dbConnector.dbConnection.ExecuteAsync(sql, new { Id = orderId }, _dbConnector.dbTransaction); 97 | } 98 | 99 | public async Task DeleteItemAsync(string itemId) 100 | { 101 | string sql = $"DELETE FROM [dbo].[OrderItem] WHERE id = @id"; 102 | 103 | await _dbConnector.dbConnection.ExecuteAsync(sql, new { Id = itemId }, _dbConnector.dbTransaction); 104 | } 105 | 106 | public async Task ExistsByIdAsync(string orderId) 107 | { 108 | string sql = $"SELECT 1 FROM [Order] WHERE Id = @Id "; 109 | 110 | var order = await _dbConnector.dbConnection.QueryAsync(sql, new { Id = orderId }, _dbConnector.dbTransaction); 111 | 112 | return order.FirstOrDefault(); 113 | } 114 | 115 | public async Task GetByIdAsync(string orderId) 116 | { 117 | string sql = $"{baseSql} AND o.Id = @Id"; 118 | 119 | var order = await _dbConnector.dbConnection.QueryAsync( 120 | sql: sql, 121 | map: (ord, client, user) => 122 | { 123 | ord.Client = client; 124 | ord.User = user; 125 | return ord; 126 | }, 127 | param: new { Id = orderId }, 128 | splitOn: "Id", 129 | transaction: _dbConnector.dbTransaction); 130 | 131 | return order.FirstOrDefault(); 132 | } 133 | 134 | public async Task> ListByFilterAsync(string orderId = null, string clientId = null, string userId = null) 135 | { 136 | string sql = $"{baseSql} "; 137 | 138 | if (!string.IsNullOrWhiteSpace(orderId)) 139 | sql += "AND o.Id = @OrderId"; 140 | 141 | if (!string.IsNullOrWhiteSpace(clientId)) 142 | sql += "AND o.clientId = @ClientId"; 143 | 144 | if (!string.IsNullOrWhiteSpace(userId)) 145 | sql += "AND o.userId = @UserId"; 146 | 147 | var order = await _dbConnector.dbConnection.QueryAsync( 148 | sql: sql, 149 | map: (ord, client, user) => 150 | { 151 | ord.Client = client; 152 | ord.User = user; 153 | return ord; 154 | }, 155 | param: new { OrderId = orderId, ClientId = clientId, UserId = userId }, 156 | splitOn: "Id", 157 | transaction: _dbConnector.dbTransaction); 158 | 159 | return order.ToList(); 160 | } 161 | 162 | public async Task> ListItemByOrderIdAsync(string orderId) 163 | { 164 | string sql = @"SELECT oi.[Id] 165 | ,oi.[SellValue] 166 | ,oi.[Quantity] 167 | ,oi.[TotalAmount] 168 | ,oi.[CreatedAt] 169 | ,oi.[OrderId] as id 170 | ,oi.[ProductId] as id 171 | ,p.[Description] 172 | FROM [dbo].[OrderItem] oi 173 | JOIN [dbo].[Product] p on oi.ProductId = p.id 174 | WHERE oi.OrderId = @OrderId"; 175 | 176 | var itens = await _dbConnector.dbConnection.QueryAsync( 177 | sql: sql, 178 | map: (item, order, prod) => 179 | { 180 | item.Order = order; 181 | item.Product = prod; 182 | return item; 183 | }, 184 | param: new { OrderId = orderId }, 185 | splitOn: "Id", 186 | transaction: _dbConnector.dbTransaction); 187 | 188 | return itens.ToList(); 189 | } 190 | 191 | public async Task UpdateAsync(OrderModel order) 192 | { 193 | string sql = @"UPDATE [dbo].[Order] 194 | SET [ClientId] = @ClientId 195 | ,[UserId] = @UserId 196 | WHERE id = @Id "; 197 | 198 | await _dbConnector.dbConnection.ExecuteAsync(sql, new 199 | { 200 | Id = order.Id, 201 | ClientId = order.Client.Id, 202 | UserId = order.User.Id 203 | }, _dbConnector.dbTransaction); 204 | 205 | if (order.Items.Any()) 206 | { 207 | string deleteItem = $"DELETE FROM [dbo].[OrderItem] WHERE OrderId = @OrderId"; 208 | 209 | await _dbConnector.dbConnection.ExecuteAsync(deleteItem, new { OrderId = order.Id }, _dbConnector.dbTransaction); 210 | 211 | foreach (var item in order.Items) 212 | { 213 | await CreateItemAsync(item); 214 | } 215 | } 216 | } 217 | } 218 | } 219 | -------------------------------------------------------------------------------- /Order/obj/Order.Api.csproj.nuget.dgspec.json: -------------------------------------------------------------------------------- 1 | { 2 | "format": 1, 3 | "restore": { 4 | "C:\\Users\\Wellyngton\\source\\repos\\Order\\Order\\Order.Api.csproj": {} 5 | }, 6 | "projects": { 7 | "C:\\Users\\Wellyngton\\source\\repos\\Order\\Order.Application\\Order.Application.csproj": { 8 | "version": "1.0.0", 9 | "restore": { 10 | "projectUniqueName": "C:\\Users\\Wellyngton\\source\\repos\\Order\\Order.Application\\Order.Application.csproj", 11 | "projectName": "Order.Application", 12 | "projectPath": "C:\\Users\\Wellyngton\\source\\repos\\Order\\Order.Application\\Order.Application.csproj", 13 | "packagesPath": "C:\\Users\\Wellyngton\\.nuget\\packages\\", 14 | "outputPath": "C:\\Users\\Wellyngton\\source\\repos\\Order\\Order.Application\\obj\\", 15 | "projectStyle": "PackageReference", 16 | "fallbackFolders": [ 17 | "C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder" 18 | ], 19 | "configFilePaths": [ 20 | "C:\\Users\\Wellyngton\\AppData\\Roaming\\NuGet\\NuGet.Config", 21 | "C:\\Program Files (x86)\\NuGet\\Config\\DevExpress 19.1.config", 22 | "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" 23 | ], 24 | "originalTargetFrameworks": [ 25 | "netstandard2.0" 26 | ], 27 | "sources": { 28 | "C:\\Program Files (x86)\\DevExpress 19.1\\Components\\System\\Components\\Packages": {}, 29 | "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, 30 | "https://api.nuget.org/v3/index.json": {} 31 | }, 32 | "frameworks": { 33 | "netstandard2.0": { 34 | "targetAlias": "netstandard2.0", 35 | "projectReferences": { 36 | "C:\\Users\\Wellyngton\\source\\repos\\Order\\Order.Domain\\Order.Domain.csproj": { 37 | "projectPath": "C:\\Users\\Wellyngton\\source\\repos\\Order\\Order.Domain\\Order.Domain.csproj" 38 | } 39 | } 40 | } 41 | }, 42 | "warningProperties": { 43 | "warnAsError": [ 44 | "NU1605" 45 | ] 46 | } 47 | }, 48 | "frameworks": { 49 | "netstandard2.0": { 50 | "targetAlias": "netstandard2.0", 51 | "dependencies": { 52 | "AutoMapper": { 53 | "target": "Package", 54 | "version": "[10.1.1, )" 55 | }, 56 | "Microsoft.AspNetCore.Authentication.JwtBearer": { 57 | "target": "Package", 58 | "version": "[2.2.0, )" 59 | }, 60 | "NETStandard.Library": { 61 | "suppressParent": "All", 62 | "target": "Package", 63 | "version": "[2.0.3, )", 64 | "autoReferenced": true 65 | } 66 | }, 67 | "imports": [ 68 | "net461", 69 | "net462", 70 | "net47", 71 | "net471", 72 | "net472", 73 | "net48" 74 | ], 75 | "assetTargetFallback": true, 76 | "warn": true, 77 | "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\5.0.201\\RuntimeIdentifierGraph.json" 78 | } 79 | } 80 | }, 81 | "C:\\Users\\Wellyngton\\source\\repos\\Order\\Order.Domain\\Order.Domain.csproj": { 82 | "version": "1.0.0", 83 | "restore": { 84 | "projectUniqueName": "C:\\Users\\Wellyngton\\source\\repos\\Order\\Order.Domain\\Order.Domain.csproj", 85 | "projectName": "Order.Domain", 86 | "projectPath": "C:\\Users\\Wellyngton\\source\\repos\\Order\\Order.Domain\\Order.Domain.csproj", 87 | "packagesPath": "C:\\Users\\Wellyngton\\.nuget\\packages\\", 88 | "outputPath": "C:\\Users\\Wellyngton\\source\\repos\\Order\\Order.Domain\\obj\\", 89 | "projectStyle": "PackageReference", 90 | "fallbackFolders": [ 91 | "C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder" 92 | ], 93 | "configFilePaths": [ 94 | "C:\\Users\\Wellyngton\\AppData\\Roaming\\NuGet\\NuGet.Config", 95 | "C:\\Program Files (x86)\\NuGet\\Config\\DevExpress 19.1.config", 96 | "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" 97 | ], 98 | "originalTargetFrameworks": [ 99 | "netstandard2.0" 100 | ], 101 | "sources": { 102 | "C:\\Program Files (x86)\\DevExpress 19.1\\Components\\System\\Components\\Packages": {}, 103 | "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, 104 | "https://api.nuget.org/v3/index.json": {} 105 | }, 106 | "frameworks": { 107 | "netstandard2.0": { 108 | "targetAlias": "netstandard2.0", 109 | "projectReferences": {} 110 | } 111 | }, 112 | "warningProperties": { 113 | "warnAsError": [ 114 | "NU1605" 115 | ] 116 | } 117 | }, 118 | "frameworks": { 119 | "netstandard2.0": { 120 | "targetAlias": "netstandard2.0", 121 | "dependencies": { 122 | "BCrypt.Net-Core": { 123 | "target": "Package", 124 | "version": "[1.6.0, )" 125 | }, 126 | "FluentValidation": { 127 | "target": "Package", 128 | "version": "[9.2.2, )" 129 | }, 130 | "NETStandard.Library": { 131 | "suppressParent": "All", 132 | "target": "Package", 133 | "version": "[2.0.3, )", 134 | "autoReferenced": true 135 | }, 136 | "System.Threading.Tasks": { 137 | "target": "Package", 138 | "version": "[4.3.0, )" 139 | } 140 | }, 141 | "imports": [ 142 | "net461", 143 | "net462", 144 | "net47", 145 | "net471", 146 | "net472", 147 | "net48" 148 | ], 149 | "assetTargetFallback": true, 150 | "warn": true, 151 | "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\5.0.201\\RuntimeIdentifierGraph.json" 152 | } 153 | } 154 | }, 155 | "C:\\Users\\Wellyngton\\source\\repos\\Order\\Order.Infra\\Order.Infra.csproj": { 156 | "version": "1.0.0", 157 | "restore": { 158 | "projectUniqueName": "C:\\Users\\Wellyngton\\source\\repos\\Order\\Order.Infra\\Order.Infra.csproj", 159 | "projectName": "Order.Infra", 160 | "projectPath": "C:\\Users\\Wellyngton\\source\\repos\\Order\\Order.Infra\\Order.Infra.csproj", 161 | "packagesPath": "C:\\Users\\Wellyngton\\.nuget\\packages\\", 162 | "outputPath": "C:\\Users\\Wellyngton\\source\\repos\\Order\\Order.Infra\\obj\\", 163 | "projectStyle": "PackageReference", 164 | "fallbackFolders": [ 165 | "C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder" 166 | ], 167 | "configFilePaths": [ 168 | "C:\\Users\\Wellyngton\\AppData\\Roaming\\NuGet\\NuGet.Config", 169 | "C:\\Program Files (x86)\\NuGet\\Config\\DevExpress 19.1.config", 170 | "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" 171 | ], 172 | "originalTargetFrameworks": [ 173 | "netstandard2.0" 174 | ], 175 | "sources": { 176 | "C:\\Program Files (x86)\\DevExpress 19.1\\Components\\System\\Components\\Packages": {}, 177 | "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, 178 | "https://api.nuget.org/v3/index.json": {} 179 | }, 180 | "frameworks": { 181 | "netstandard2.0": { 182 | "targetAlias": "netstandard2.0", 183 | "projectReferences": { 184 | "C:\\Users\\Wellyngton\\source\\repos\\Order\\Order.Domain\\Order.Domain.csproj": { 185 | "projectPath": "C:\\Users\\Wellyngton\\source\\repos\\Order\\Order.Domain\\Order.Domain.csproj" 186 | } 187 | } 188 | } 189 | }, 190 | "warningProperties": { 191 | "warnAsError": [ 192 | "NU1605" 193 | ] 194 | } 195 | }, 196 | "frameworks": { 197 | "netstandard2.0": { 198 | "targetAlias": "netstandard2.0", 199 | "dependencies": { 200 | "Dapper.Contrib": { 201 | "target": "Package", 202 | "version": "[2.0.78, )" 203 | }, 204 | "NETStandard.Library": { 205 | "suppressParent": "All", 206 | "target": "Package", 207 | "version": "[2.0.3, )", 208 | "autoReferenced": true 209 | }, 210 | "System.Data.SqlClient": { 211 | "target": "Package", 212 | "version": "[4.8.2, )" 213 | } 214 | }, 215 | "imports": [ 216 | "net461", 217 | "net462", 218 | "net47", 219 | "net471", 220 | "net472", 221 | "net48" 222 | ], 223 | "assetTargetFallback": true, 224 | "warn": true, 225 | "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\5.0.201\\RuntimeIdentifierGraph.json" 226 | } 227 | } 228 | }, 229 | "C:\\Users\\Wellyngton\\source\\repos\\Order\\Order\\Order.Api.csproj": { 230 | "version": "1.0.0", 231 | "restore": { 232 | "projectUniqueName": "C:\\Users\\Wellyngton\\source\\repos\\Order\\Order\\Order.Api.csproj", 233 | "projectName": "Order.Api", 234 | "projectPath": "C:\\Users\\Wellyngton\\source\\repos\\Order\\Order\\Order.Api.csproj", 235 | "packagesPath": "C:\\Users\\Wellyngton\\.nuget\\packages\\", 236 | "outputPath": "C:\\Users\\Wellyngton\\source\\repos\\Order\\Order\\obj\\", 237 | "projectStyle": "PackageReference", 238 | "fallbackFolders": [ 239 | "C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder" 240 | ], 241 | "configFilePaths": [ 242 | "C:\\Users\\Wellyngton\\AppData\\Roaming\\NuGet\\NuGet.Config", 243 | "C:\\Program Files (x86)\\NuGet\\Config\\DevExpress 19.1.config", 244 | "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" 245 | ], 246 | "originalTargetFrameworks": [ 247 | "netcoreapp3.1" 248 | ], 249 | "sources": { 250 | "C:\\Program Files (x86)\\DevExpress 19.1\\Components\\System\\Components\\Packages": {}, 251 | "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, 252 | "https://api.nuget.org/v3/index.json": {} 253 | }, 254 | "frameworks": { 255 | "netcoreapp3.1": { 256 | "targetAlias": "netcoreapp3.1", 257 | "projectReferences": { 258 | "C:\\Users\\Wellyngton\\source\\repos\\Order\\Order.Application\\Order.Application.csproj": { 259 | "projectPath": "C:\\Users\\Wellyngton\\source\\repos\\Order\\Order.Application\\Order.Application.csproj" 260 | }, 261 | "C:\\Users\\Wellyngton\\source\\repos\\Order\\Order.Domain\\Order.Domain.csproj": { 262 | "projectPath": "C:\\Users\\Wellyngton\\source\\repos\\Order\\Order.Domain\\Order.Domain.csproj" 263 | }, 264 | "C:\\Users\\Wellyngton\\source\\repos\\Order\\Order.Infra\\Order.Infra.csproj": { 265 | "projectPath": "C:\\Users\\Wellyngton\\source\\repos\\Order\\Order.Infra\\Order.Infra.csproj" 266 | } 267 | } 268 | } 269 | }, 270 | "warningProperties": { 271 | "warnAsError": [ 272 | "NU1605" 273 | ] 274 | } 275 | }, 276 | "frameworks": { 277 | "netcoreapp3.1": { 278 | "targetAlias": "netcoreapp3.1", 279 | "dependencies": { 280 | "AutoMapper.Extensions.Microsoft.DependencyInjection": { 281 | "target": "Package", 282 | "version": "[8.1.0, )" 283 | }, 284 | "Microsoft.VisualStudio.Azure.Containers.Tools.Targets": { 285 | "target": "Package", 286 | "version": "[1.10.9, )" 287 | }, 288 | "Swashbuckle.AspNetCore.Filters": { 289 | "target": "Package", 290 | "version": "[6.1.0, )" 291 | }, 292 | "Swashbuckle.AspNetCore.SwaggerGen": { 293 | "target": "Package", 294 | "version": "[5.6.3, )" 295 | }, 296 | "Swashbuckle.AspNetCore.SwaggerUI": { 297 | "target": "Package", 298 | "version": "[5.6.3, )" 299 | } 300 | }, 301 | "imports": [ 302 | "net461", 303 | "net462", 304 | "net47", 305 | "net471", 306 | "net472", 307 | "net48" 308 | ], 309 | "assetTargetFallback": true, 310 | "warn": true, 311 | "frameworkReferences": { 312 | "Microsoft.AspNetCore.App": { 313 | "privateAssets": "none" 314 | }, 315 | "Microsoft.NETCore.App": { 316 | "privateAssets": "all" 317 | } 318 | }, 319 | "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\5.0.201\\RuntimeIdentifierGraph.json" 320 | } 321 | } 322 | } 323 | } 324 | } -------------------------------------------------------------------------------- /Order.Domain/obj/project.assets.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 3, 3 | "targets": { 4 | ".NETStandard,Version=v2.0": { 5 | "BCrypt.Net-Core/1.6.0": { 6 | "type": "package", 7 | "compile": { 8 | "lib/netstandard2.0/BCrypt.Net-Core.dll": {} 9 | }, 10 | "runtime": { 11 | "lib/netstandard2.0/BCrypt.Net-Core.dll": {} 12 | } 13 | }, 14 | "FluentValidation/9.2.2": { 15 | "type": "package", 16 | "compile": { 17 | "lib/netstandard2.0/FluentValidation.dll": {} 18 | }, 19 | "runtime": { 20 | "lib/netstandard2.0/FluentValidation.dll": {} 21 | } 22 | }, 23 | "Microsoft.NETCore.Platforms/1.1.0": { 24 | "type": "package", 25 | "compile": { 26 | "lib/netstandard1.0/_._": {} 27 | }, 28 | "runtime": { 29 | "lib/netstandard1.0/_._": {} 30 | } 31 | }, 32 | "Microsoft.NETCore.Targets/1.1.0": { 33 | "type": "package", 34 | "compile": { 35 | "lib/netstandard1.0/_._": {} 36 | }, 37 | "runtime": { 38 | "lib/netstandard1.0/_._": {} 39 | } 40 | }, 41 | "NETStandard.Library/2.0.3": { 42 | "type": "package", 43 | "dependencies": { 44 | "Microsoft.NETCore.Platforms": "1.1.0" 45 | }, 46 | "compile": { 47 | "lib/netstandard1.0/_._": {} 48 | }, 49 | "runtime": { 50 | "lib/netstandard1.0/_._": {} 51 | }, 52 | "build": { 53 | "build/netstandard2.0/NETStandard.Library.targets": {} 54 | } 55 | }, 56 | "System.Runtime/4.3.0": { 57 | "type": "package", 58 | "dependencies": { 59 | "Microsoft.NETCore.Platforms": "1.1.0", 60 | "Microsoft.NETCore.Targets": "1.1.0" 61 | }, 62 | "compile": { 63 | "ref/netstandard1.5/System.Runtime.dll": {} 64 | } 65 | }, 66 | "System.Threading.Tasks/4.3.0": { 67 | "type": "package", 68 | "dependencies": { 69 | "Microsoft.NETCore.Platforms": "1.1.0", 70 | "Microsoft.NETCore.Targets": "1.1.0", 71 | "System.Runtime": "4.3.0" 72 | }, 73 | "compile": { 74 | "ref/netstandard1.3/System.Threading.Tasks.dll": {} 75 | } 76 | } 77 | } 78 | }, 79 | "libraries": { 80 | "BCrypt.Net-Core/1.6.0": { 81 | "sha512": "hsKiHGjrnlDW05MzuzzlD9gNP8YOW2KbZ+FbvISrilsKJJ76tXKhWey6psZX5sd7DczNpSU2U6ldjPoblk8BLw==", 82 | "type": "package", 83 | "path": "bcrypt.net-core/1.6.0", 84 | "files": [ 85 | ".nupkg.metadata", 86 | ".signature.p7s", 87 | "bcrypt.net-core.1.6.0.nupkg.sha512", 88 | "bcrypt.net-core.nuspec", 89 | "lib/net40/BCrypt.Net-Core.dll", 90 | "lib/net40/BCrypt.Net-Core.pdb", 91 | "lib/net45/BCrypt.Net-Core.dll", 92 | "lib/net45/BCrypt.Net-Core.pdb", 93 | "lib/net451/BCrypt.Net-Core.dll", 94 | "lib/net451/BCrypt.Net-Core.pdb", 95 | "lib/net452/BCrypt.Net-Core.dll", 96 | "lib/net452/BCrypt.Net-Core.pdb", 97 | "lib/netstandard1.3/BCrypt.Net-Core.dll", 98 | "lib/netstandard1.3/BCrypt.Net-Core.pdb", 99 | "lib/netstandard2.0/BCrypt.Net-Core.dll", 100 | "lib/netstandard2.0/BCrypt.Net-Core.pdb" 101 | ] 102 | }, 103 | "FluentValidation/9.2.2": { 104 | "sha512": "Y1TQrSa82i/WWPpXriEkL7uyUyECw3Uvtq66dZ8VC3pwFa9VqnZmeZaJJpz8deKhJQNDgqwU3BSptKTnyjqzuA==", 105 | "type": "package", 106 | "path": "fluentvalidation/9.2.2", 107 | "files": [ 108 | ".nupkg.metadata", 109 | ".signature.p7s", 110 | "fluentvalidation.9.2.2.nupkg.sha512", 111 | "fluentvalidation.nuspec", 112 | "lib/net461/FluentValidation.dll", 113 | "lib/net461/FluentValidation.xml", 114 | "lib/netstandard2.0/FluentValidation.dll", 115 | "lib/netstandard2.0/FluentValidation.xml" 116 | ] 117 | }, 118 | "Microsoft.NETCore.Platforms/1.1.0": { 119 | "sha512": "kz0PEW2lhqygehI/d6XsPCQzD7ff7gUJaVGPVETX611eadGsA3A877GdSlU0LRVMCTH/+P3o2iDTak+S08V2+A==", 120 | "type": "package", 121 | "path": "microsoft.netcore.platforms/1.1.0", 122 | "files": [ 123 | ".nupkg.metadata", 124 | ".signature.p7s", 125 | "ThirdPartyNotices.txt", 126 | "dotnet_library_license.txt", 127 | "lib/netstandard1.0/_._", 128 | "microsoft.netcore.platforms.1.1.0.nupkg.sha512", 129 | "microsoft.netcore.platforms.nuspec", 130 | "runtime.json" 131 | ] 132 | }, 133 | "Microsoft.NETCore.Targets/1.1.0": { 134 | "sha512": "aOZA3BWfz9RXjpzt0sRJJMjAscAUm3Hoa4UWAfceV9UTYxgwZ1lZt5nO2myFf+/jetYQo4uTP7zS8sJY67BBxg==", 135 | "type": "package", 136 | "path": "microsoft.netcore.targets/1.1.0", 137 | "files": [ 138 | ".nupkg.metadata", 139 | ".signature.p7s", 140 | "ThirdPartyNotices.txt", 141 | "dotnet_library_license.txt", 142 | "lib/netstandard1.0/_._", 143 | "microsoft.netcore.targets.1.1.0.nupkg.sha512", 144 | "microsoft.netcore.targets.nuspec", 145 | "runtime.json" 146 | ] 147 | }, 148 | "NETStandard.Library/2.0.3": { 149 | "sha512": "st47PosZSHrjECdjeIzZQbzivYBJFv6P2nv4cj2ypdI204DO+vZ7l5raGMiX4eXMJ53RfOIg+/s4DHVZ54Nu2A==", 150 | "type": "package", 151 | "path": "netstandard.library/2.0.3", 152 | "files": [ 153 | ".nupkg.metadata", 154 | ".signature.p7s", 155 | "LICENSE.TXT", 156 | "THIRD-PARTY-NOTICES.TXT", 157 | "build/netstandard2.0/NETStandard.Library.targets", 158 | "build/netstandard2.0/ref/Microsoft.Win32.Primitives.dll", 159 | "build/netstandard2.0/ref/System.AppContext.dll", 160 | "build/netstandard2.0/ref/System.Collections.Concurrent.dll", 161 | "build/netstandard2.0/ref/System.Collections.NonGeneric.dll", 162 | "build/netstandard2.0/ref/System.Collections.Specialized.dll", 163 | "build/netstandard2.0/ref/System.Collections.dll", 164 | "build/netstandard2.0/ref/System.ComponentModel.Composition.dll", 165 | "build/netstandard2.0/ref/System.ComponentModel.EventBasedAsync.dll", 166 | "build/netstandard2.0/ref/System.ComponentModel.Primitives.dll", 167 | "build/netstandard2.0/ref/System.ComponentModel.TypeConverter.dll", 168 | "build/netstandard2.0/ref/System.ComponentModel.dll", 169 | "build/netstandard2.0/ref/System.Console.dll", 170 | "build/netstandard2.0/ref/System.Core.dll", 171 | "build/netstandard2.0/ref/System.Data.Common.dll", 172 | "build/netstandard2.0/ref/System.Data.dll", 173 | "build/netstandard2.0/ref/System.Diagnostics.Contracts.dll", 174 | "build/netstandard2.0/ref/System.Diagnostics.Debug.dll", 175 | "build/netstandard2.0/ref/System.Diagnostics.FileVersionInfo.dll", 176 | "build/netstandard2.0/ref/System.Diagnostics.Process.dll", 177 | "build/netstandard2.0/ref/System.Diagnostics.StackTrace.dll", 178 | "build/netstandard2.0/ref/System.Diagnostics.TextWriterTraceListener.dll", 179 | "build/netstandard2.0/ref/System.Diagnostics.Tools.dll", 180 | "build/netstandard2.0/ref/System.Diagnostics.TraceSource.dll", 181 | "build/netstandard2.0/ref/System.Diagnostics.Tracing.dll", 182 | "build/netstandard2.0/ref/System.Drawing.Primitives.dll", 183 | "build/netstandard2.0/ref/System.Drawing.dll", 184 | "build/netstandard2.0/ref/System.Dynamic.Runtime.dll", 185 | "build/netstandard2.0/ref/System.Globalization.Calendars.dll", 186 | "build/netstandard2.0/ref/System.Globalization.Extensions.dll", 187 | "build/netstandard2.0/ref/System.Globalization.dll", 188 | "build/netstandard2.0/ref/System.IO.Compression.FileSystem.dll", 189 | "build/netstandard2.0/ref/System.IO.Compression.ZipFile.dll", 190 | "build/netstandard2.0/ref/System.IO.Compression.dll", 191 | "build/netstandard2.0/ref/System.IO.FileSystem.DriveInfo.dll", 192 | "build/netstandard2.0/ref/System.IO.FileSystem.Primitives.dll", 193 | "build/netstandard2.0/ref/System.IO.FileSystem.Watcher.dll", 194 | "build/netstandard2.0/ref/System.IO.FileSystem.dll", 195 | "build/netstandard2.0/ref/System.IO.IsolatedStorage.dll", 196 | "build/netstandard2.0/ref/System.IO.MemoryMappedFiles.dll", 197 | "build/netstandard2.0/ref/System.IO.Pipes.dll", 198 | "build/netstandard2.0/ref/System.IO.UnmanagedMemoryStream.dll", 199 | "build/netstandard2.0/ref/System.IO.dll", 200 | "build/netstandard2.0/ref/System.Linq.Expressions.dll", 201 | "build/netstandard2.0/ref/System.Linq.Parallel.dll", 202 | "build/netstandard2.0/ref/System.Linq.Queryable.dll", 203 | "build/netstandard2.0/ref/System.Linq.dll", 204 | "build/netstandard2.0/ref/System.Net.Http.dll", 205 | "build/netstandard2.0/ref/System.Net.NameResolution.dll", 206 | "build/netstandard2.0/ref/System.Net.NetworkInformation.dll", 207 | "build/netstandard2.0/ref/System.Net.Ping.dll", 208 | "build/netstandard2.0/ref/System.Net.Primitives.dll", 209 | "build/netstandard2.0/ref/System.Net.Requests.dll", 210 | "build/netstandard2.0/ref/System.Net.Security.dll", 211 | "build/netstandard2.0/ref/System.Net.Sockets.dll", 212 | "build/netstandard2.0/ref/System.Net.WebHeaderCollection.dll", 213 | "build/netstandard2.0/ref/System.Net.WebSockets.Client.dll", 214 | "build/netstandard2.0/ref/System.Net.WebSockets.dll", 215 | "build/netstandard2.0/ref/System.Net.dll", 216 | "build/netstandard2.0/ref/System.Numerics.dll", 217 | "build/netstandard2.0/ref/System.ObjectModel.dll", 218 | "build/netstandard2.0/ref/System.Reflection.Extensions.dll", 219 | "build/netstandard2.0/ref/System.Reflection.Primitives.dll", 220 | "build/netstandard2.0/ref/System.Reflection.dll", 221 | "build/netstandard2.0/ref/System.Resources.Reader.dll", 222 | "build/netstandard2.0/ref/System.Resources.ResourceManager.dll", 223 | "build/netstandard2.0/ref/System.Resources.Writer.dll", 224 | "build/netstandard2.0/ref/System.Runtime.CompilerServices.VisualC.dll", 225 | "build/netstandard2.0/ref/System.Runtime.Extensions.dll", 226 | "build/netstandard2.0/ref/System.Runtime.Handles.dll", 227 | "build/netstandard2.0/ref/System.Runtime.InteropServices.RuntimeInformation.dll", 228 | "build/netstandard2.0/ref/System.Runtime.InteropServices.dll", 229 | "build/netstandard2.0/ref/System.Runtime.Numerics.dll", 230 | "build/netstandard2.0/ref/System.Runtime.Serialization.Formatters.dll", 231 | "build/netstandard2.0/ref/System.Runtime.Serialization.Json.dll", 232 | "build/netstandard2.0/ref/System.Runtime.Serialization.Primitives.dll", 233 | "build/netstandard2.0/ref/System.Runtime.Serialization.Xml.dll", 234 | "build/netstandard2.0/ref/System.Runtime.Serialization.dll", 235 | "build/netstandard2.0/ref/System.Runtime.dll", 236 | "build/netstandard2.0/ref/System.Security.Claims.dll", 237 | "build/netstandard2.0/ref/System.Security.Cryptography.Algorithms.dll", 238 | "build/netstandard2.0/ref/System.Security.Cryptography.Csp.dll", 239 | "build/netstandard2.0/ref/System.Security.Cryptography.Encoding.dll", 240 | "build/netstandard2.0/ref/System.Security.Cryptography.Primitives.dll", 241 | "build/netstandard2.0/ref/System.Security.Cryptography.X509Certificates.dll", 242 | "build/netstandard2.0/ref/System.Security.Principal.dll", 243 | "build/netstandard2.0/ref/System.Security.SecureString.dll", 244 | "build/netstandard2.0/ref/System.ServiceModel.Web.dll", 245 | "build/netstandard2.0/ref/System.Text.Encoding.Extensions.dll", 246 | "build/netstandard2.0/ref/System.Text.Encoding.dll", 247 | "build/netstandard2.0/ref/System.Text.RegularExpressions.dll", 248 | "build/netstandard2.0/ref/System.Threading.Overlapped.dll", 249 | "build/netstandard2.0/ref/System.Threading.Tasks.Parallel.dll", 250 | "build/netstandard2.0/ref/System.Threading.Tasks.dll", 251 | "build/netstandard2.0/ref/System.Threading.Thread.dll", 252 | "build/netstandard2.0/ref/System.Threading.ThreadPool.dll", 253 | "build/netstandard2.0/ref/System.Threading.Timer.dll", 254 | "build/netstandard2.0/ref/System.Threading.dll", 255 | "build/netstandard2.0/ref/System.Transactions.dll", 256 | "build/netstandard2.0/ref/System.ValueTuple.dll", 257 | "build/netstandard2.0/ref/System.Web.dll", 258 | "build/netstandard2.0/ref/System.Windows.dll", 259 | "build/netstandard2.0/ref/System.Xml.Linq.dll", 260 | "build/netstandard2.0/ref/System.Xml.ReaderWriter.dll", 261 | "build/netstandard2.0/ref/System.Xml.Serialization.dll", 262 | "build/netstandard2.0/ref/System.Xml.XDocument.dll", 263 | "build/netstandard2.0/ref/System.Xml.XPath.XDocument.dll", 264 | "build/netstandard2.0/ref/System.Xml.XPath.dll", 265 | "build/netstandard2.0/ref/System.Xml.XmlDocument.dll", 266 | "build/netstandard2.0/ref/System.Xml.XmlSerializer.dll", 267 | "build/netstandard2.0/ref/System.Xml.dll", 268 | "build/netstandard2.0/ref/System.dll", 269 | "build/netstandard2.0/ref/mscorlib.dll", 270 | "build/netstandard2.0/ref/netstandard.dll", 271 | "build/netstandard2.0/ref/netstandard.xml", 272 | "lib/netstandard1.0/_._", 273 | "netstandard.library.2.0.3.nupkg.sha512", 274 | "netstandard.library.nuspec" 275 | ] 276 | }, 277 | "System.Runtime/4.3.0": { 278 | "sha512": "JufQi0vPQ0xGnAczR13AUFglDyVYt4Kqnz1AZaiKZ5+GICq0/1MH/mO/eAJHt/mHW1zjKBJd7kV26SrxddAhiw==", 279 | "type": "package", 280 | "path": "system.runtime/4.3.0", 281 | "files": [ 282 | ".nupkg.metadata", 283 | "ThirdPartyNotices.txt", 284 | "dotnet_library_license.txt", 285 | "lib/MonoAndroid10/_._", 286 | "lib/MonoTouch10/_._", 287 | "lib/net45/_._", 288 | "lib/net462/System.Runtime.dll", 289 | "lib/portable-net45+win8+wp80+wpa81/_._", 290 | "lib/win8/_._", 291 | "lib/wp80/_._", 292 | "lib/wpa81/_._", 293 | "lib/xamarinios10/_._", 294 | "lib/xamarinmac20/_._", 295 | "lib/xamarintvos10/_._", 296 | "lib/xamarinwatchos10/_._", 297 | "ref/MonoAndroid10/_._", 298 | "ref/MonoTouch10/_._", 299 | "ref/net45/_._", 300 | "ref/net462/System.Runtime.dll", 301 | "ref/netcore50/System.Runtime.dll", 302 | "ref/netcore50/System.Runtime.xml", 303 | "ref/netcore50/de/System.Runtime.xml", 304 | "ref/netcore50/es/System.Runtime.xml", 305 | "ref/netcore50/fr/System.Runtime.xml", 306 | "ref/netcore50/it/System.Runtime.xml", 307 | "ref/netcore50/ja/System.Runtime.xml", 308 | "ref/netcore50/ko/System.Runtime.xml", 309 | "ref/netcore50/ru/System.Runtime.xml", 310 | "ref/netcore50/zh-hans/System.Runtime.xml", 311 | "ref/netcore50/zh-hant/System.Runtime.xml", 312 | "ref/netstandard1.0/System.Runtime.dll", 313 | "ref/netstandard1.0/System.Runtime.xml", 314 | "ref/netstandard1.0/de/System.Runtime.xml", 315 | "ref/netstandard1.0/es/System.Runtime.xml", 316 | "ref/netstandard1.0/fr/System.Runtime.xml", 317 | "ref/netstandard1.0/it/System.Runtime.xml", 318 | "ref/netstandard1.0/ja/System.Runtime.xml", 319 | "ref/netstandard1.0/ko/System.Runtime.xml", 320 | "ref/netstandard1.0/ru/System.Runtime.xml", 321 | "ref/netstandard1.0/zh-hans/System.Runtime.xml", 322 | "ref/netstandard1.0/zh-hant/System.Runtime.xml", 323 | "ref/netstandard1.2/System.Runtime.dll", 324 | "ref/netstandard1.2/System.Runtime.xml", 325 | "ref/netstandard1.2/de/System.Runtime.xml", 326 | "ref/netstandard1.2/es/System.Runtime.xml", 327 | "ref/netstandard1.2/fr/System.Runtime.xml", 328 | "ref/netstandard1.2/it/System.Runtime.xml", 329 | "ref/netstandard1.2/ja/System.Runtime.xml", 330 | "ref/netstandard1.2/ko/System.Runtime.xml", 331 | "ref/netstandard1.2/ru/System.Runtime.xml", 332 | "ref/netstandard1.2/zh-hans/System.Runtime.xml", 333 | "ref/netstandard1.2/zh-hant/System.Runtime.xml", 334 | "ref/netstandard1.3/System.Runtime.dll", 335 | "ref/netstandard1.3/System.Runtime.xml", 336 | "ref/netstandard1.3/de/System.Runtime.xml", 337 | "ref/netstandard1.3/es/System.Runtime.xml", 338 | "ref/netstandard1.3/fr/System.Runtime.xml", 339 | "ref/netstandard1.3/it/System.Runtime.xml", 340 | "ref/netstandard1.3/ja/System.Runtime.xml", 341 | "ref/netstandard1.3/ko/System.Runtime.xml", 342 | "ref/netstandard1.3/ru/System.Runtime.xml", 343 | "ref/netstandard1.3/zh-hans/System.Runtime.xml", 344 | "ref/netstandard1.3/zh-hant/System.Runtime.xml", 345 | "ref/netstandard1.5/System.Runtime.dll", 346 | "ref/netstandard1.5/System.Runtime.xml", 347 | "ref/netstandard1.5/de/System.Runtime.xml", 348 | "ref/netstandard1.5/es/System.Runtime.xml", 349 | "ref/netstandard1.5/fr/System.Runtime.xml", 350 | "ref/netstandard1.5/it/System.Runtime.xml", 351 | "ref/netstandard1.5/ja/System.Runtime.xml", 352 | "ref/netstandard1.5/ko/System.Runtime.xml", 353 | "ref/netstandard1.5/ru/System.Runtime.xml", 354 | "ref/netstandard1.5/zh-hans/System.Runtime.xml", 355 | "ref/netstandard1.5/zh-hant/System.Runtime.xml", 356 | "ref/portable-net45+win8+wp80+wpa81/_._", 357 | "ref/win8/_._", 358 | "ref/wp80/_._", 359 | "ref/wpa81/_._", 360 | "ref/xamarinios10/_._", 361 | "ref/xamarinmac20/_._", 362 | "ref/xamarintvos10/_._", 363 | "ref/xamarinwatchos10/_._", 364 | "system.runtime.4.3.0.nupkg.sha512", 365 | "system.runtime.nuspec" 366 | ] 367 | }, 368 | "System.Threading.Tasks/4.3.0": { 369 | "sha512": "LbSxKEdOUhVe8BezB/9uOGGppt+nZf6e1VFyw6v3DN6lqitm0OSn2uXMOdtP0M3W4iMcqcivm2J6UgqiwwnXiA==", 370 | "type": "package", 371 | "path": "system.threading.tasks/4.3.0", 372 | "files": [ 373 | ".nupkg.metadata", 374 | "ThirdPartyNotices.txt", 375 | "dotnet_library_license.txt", 376 | "lib/MonoAndroid10/_._", 377 | "lib/MonoTouch10/_._", 378 | "lib/net45/_._", 379 | "lib/portable-net45+win8+wp8+wpa81/_._", 380 | "lib/win8/_._", 381 | "lib/wp80/_._", 382 | "lib/wpa81/_._", 383 | "lib/xamarinios10/_._", 384 | "lib/xamarinmac20/_._", 385 | "lib/xamarintvos10/_._", 386 | "lib/xamarinwatchos10/_._", 387 | "ref/MonoAndroid10/_._", 388 | "ref/MonoTouch10/_._", 389 | "ref/net45/_._", 390 | "ref/netcore50/System.Threading.Tasks.dll", 391 | "ref/netcore50/System.Threading.Tasks.xml", 392 | "ref/netcore50/de/System.Threading.Tasks.xml", 393 | "ref/netcore50/es/System.Threading.Tasks.xml", 394 | "ref/netcore50/fr/System.Threading.Tasks.xml", 395 | "ref/netcore50/it/System.Threading.Tasks.xml", 396 | "ref/netcore50/ja/System.Threading.Tasks.xml", 397 | "ref/netcore50/ko/System.Threading.Tasks.xml", 398 | "ref/netcore50/ru/System.Threading.Tasks.xml", 399 | "ref/netcore50/zh-hans/System.Threading.Tasks.xml", 400 | "ref/netcore50/zh-hant/System.Threading.Tasks.xml", 401 | "ref/netstandard1.0/System.Threading.Tasks.dll", 402 | "ref/netstandard1.0/System.Threading.Tasks.xml", 403 | "ref/netstandard1.0/de/System.Threading.Tasks.xml", 404 | "ref/netstandard1.0/es/System.Threading.Tasks.xml", 405 | "ref/netstandard1.0/fr/System.Threading.Tasks.xml", 406 | "ref/netstandard1.0/it/System.Threading.Tasks.xml", 407 | "ref/netstandard1.0/ja/System.Threading.Tasks.xml", 408 | "ref/netstandard1.0/ko/System.Threading.Tasks.xml", 409 | "ref/netstandard1.0/ru/System.Threading.Tasks.xml", 410 | "ref/netstandard1.0/zh-hans/System.Threading.Tasks.xml", 411 | "ref/netstandard1.0/zh-hant/System.Threading.Tasks.xml", 412 | "ref/netstandard1.3/System.Threading.Tasks.dll", 413 | "ref/netstandard1.3/System.Threading.Tasks.xml", 414 | "ref/netstandard1.3/de/System.Threading.Tasks.xml", 415 | "ref/netstandard1.3/es/System.Threading.Tasks.xml", 416 | "ref/netstandard1.3/fr/System.Threading.Tasks.xml", 417 | "ref/netstandard1.3/it/System.Threading.Tasks.xml", 418 | "ref/netstandard1.3/ja/System.Threading.Tasks.xml", 419 | "ref/netstandard1.3/ko/System.Threading.Tasks.xml", 420 | "ref/netstandard1.3/ru/System.Threading.Tasks.xml", 421 | "ref/netstandard1.3/zh-hans/System.Threading.Tasks.xml", 422 | "ref/netstandard1.3/zh-hant/System.Threading.Tasks.xml", 423 | "ref/portable-net45+win8+wp8+wpa81/_._", 424 | "ref/win8/_._", 425 | "ref/wp80/_._", 426 | "ref/wpa81/_._", 427 | "ref/xamarinios10/_._", 428 | "ref/xamarinmac20/_._", 429 | "ref/xamarintvos10/_._", 430 | "ref/xamarinwatchos10/_._", 431 | "system.threading.tasks.4.3.0.nupkg.sha512", 432 | "system.threading.tasks.nuspec" 433 | ] 434 | } 435 | }, 436 | "projectFileDependencyGroups": { 437 | ".NETStandard,Version=v2.0": [ 438 | "BCrypt.Net-Core >= 1.6.0", 439 | "FluentValidation >= 9.2.2", 440 | "NETStandard.Library >= 2.0.3", 441 | "System.Threading.Tasks >= 4.3.0" 442 | ] 443 | }, 444 | "packageFolders": { 445 | "C:\\Users\\Wellyngton\\.nuget\\packages\\": {}, 446 | "C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder": {} 447 | }, 448 | "project": { 449 | "version": "1.0.0", 450 | "restore": { 451 | "projectUniqueName": "C:\\Users\\Wellyngton\\source\\repos\\Order\\Order.Domain\\Order.Domain.csproj", 452 | "projectName": "Order.Domain", 453 | "projectPath": "C:\\Users\\Wellyngton\\source\\repos\\Order\\Order.Domain\\Order.Domain.csproj", 454 | "packagesPath": "C:\\Users\\Wellyngton\\.nuget\\packages\\", 455 | "outputPath": "C:\\Users\\Wellyngton\\source\\repos\\Order\\Order.Domain\\obj\\", 456 | "projectStyle": "PackageReference", 457 | "fallbackFolders": [ 458 | "C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder" 459 | ], 460 | "configFilePaths": [ 461 | "C:\\Users\\Wellyngton\\AppData\\Roaming\\NuGet\\NuGet.Config", 462 | "C:\\Program Files (x86)\\NuGet\\Config\\DevExpress 19.1.config", 463 | "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" 464 | ], 465 | "originalTargetFrameworks": [ 466 | "netstandard2.0" 467 | ], 468 | "sources": { 469 | "C:\\Program Files (x86)\\DevExpress 19.1\\Components\\System\\Components\\Packages": {}, 470 | "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, 471 | "https://api.nuget.org/v3/index.json": {} 472 | }, 473 | "frameworks": { 474 | "netstandard2.0": { 475 | "targetAlias": "netstandard2.0", 476 | "projectReferences": {} 477 | } 478 | }, 479 | "warningProperties": { 480 | "warnAsError": [ 481 | "NU1605" 482 | ] 483 | } 484 | }, 485 | "frameworks": { 486 | "netstandard2.0": { 487 | "targetAlias": "netstandard2.0", 488 | "dependencies": { 489 | "BCrypt.Net-Core": { 490 | "target": "Package", 491 | "version": "[1.6.0, )" 492 | }, 493 | "FluentValidation": { 494 | "target": "Package", 495 | "version": "[9.2.2, )" 496 | }, 497 | "NETStandard.Library": { 498 | "suppressParent": "All", 499 | "target": "Package", 500 | "version": "[2.0.3, )", 501 | "autoReferenced": true 502 | }, 503 | "System.Threading.Tasks": { 504 | "target": "Package", 505 | "version": "[4.3.0, )" 506 | } 507 | }, 508 | "imports": [ 509 | "net461", 510 | "net462", 511 | "net47", 512 | "net471", 513 | "net472", 514 | "net48" 515 | ], 516 | "assetTargetFallback": true, 517 | "warn": true, 518 | "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\5.0.201\\RuntimeIdentifierGraph.json" 519 | } 520 | } 521 | } 522 | } --------------------------------------------------------------------------------