diff --git a/sources/core/Crypto.Compare.Services/Crypto.Compare.Services.csproj b/sources/core/Crypto.Compare.Services/Crypto.Compare.Services.csproj index aa8f946..2bb644a 100644 --- a/sources/core/Crypto.Compare.Services/Crypto.Compare.Services.csproj +++ b/sources/core/Crypto.Compare.Services/Crypto.Compare.Services.csproj @@ -12,7 +12,7 @@ - + diff --git a/sources/core/Crypto.Compare.Services/Handlers/Queries/Symbols/GetSymbolsBestPriceQueryHandler.cs b/sources/core/Crypto.Compare.Services/Handlers/Queries/Symbols/GetSymbolsBestPriceQueryHandler.cs new file mode 100644 index 0000000..b0c701b --- /dev/null +++ b/sources/core/Crypto.Compare.Services/Handlers/Queries/Symbols/GetSymbolsBestPriceQueryHandler.cs @@ -0,0 +1,65 @@ +using Crypto.Compare.DataAccess; +using Crypto.Compare.Services.Queries.Symbols; +using Crypto.Compare.Services.Results.Symbols; +using FluentResults; +using MediatR; +using Microsoft.EntityFrameworkCore; + +namespace Crypto.Compare.Services.Handlers.Queries.Symbols; + +public class GetSymbolsBestPriceQueryHandler : IRequestHandler> +{ + private readonly CryptoCompareContext _cryptoCompareContext; + + public GetSymbolsBestPriceQueryHandler(CryptoCompareContext cryptoCompareContext) + { + _cryptoCompareContext = cryptoCompareContext; + } + + public async Task> Handle(GetSymbolsBestPriceQuery request, CancellationToken cancellationToken) + { + var query = _cryptoCompareContext + .Symbols + .Include(x => x.SymbolProviders) + .AsQueryable() + .AsNoTracking(); + + if (!string.IsNullOrEmpty(request.Ticker)) + { + query = query.Where(x => x.Ticker == request.Ticker); + } + + var symbols = await query + .Select(symbol => new SymbolResult + { + Id = symbol.Id, + Ticker = symbol.Ticker, + Symbol = $"{symbol.BaseSymbol}/{symbol.QuoteSymbol}", + ProviderSellId = symbol.SymbolProviders + .OrderByDescending(sp => sp.PriceSell) + .Select(sp => sp.ProviderId) + .FirstOrDefault(), + PriceSell = symbol.SymbolProviders + .OrderByDescending(sp => sp.PriceSell) + .Select(sp => sp.PriceSell) + .FirstOrDefault(), + ProviderBuyId = symbol.SymbolProviders + .OrderBy(sp => sp.PriceBuy) + .Select(sp => sp.ProviderId) + .FirstOrDefault(), + PriceBuy = symbol.SymbolProviders + .OrderBy(sp => sp.PriceBuy) + .Select(sp => sp.PriceBuy) + .FirstOrDefault(), + UpdatedAt = symbol.UpdatedAt + }) + .Skip((int)request.Skip) + .Take(request.Rows) + .ToListAsync(cancellationToken); + + return new GetSymbolsBestPriceResult + { + Symbols = symbols + }; + } +} \ No newline at end of file diff --git a/sources/core/Crypto.Compare.Services/Handlers/Queries/Symbols/GetSymbolsQueryHandler.cs b/sources/core/Crypto.Compare.Services/Handlers/Queries/Symbols/GetSymbolsQueryHandler.cs index 4d54b67..b3f5568 100644 --- a/sources/core/Crypto.Compare.Services/Handlers/Queries/Symbols/GetSymbolsQueryHandler.cs +++ b/sources/core/Crypto.Compare.Services/Handlers/Queries/Symbols/GetSymbolsQueryHandler.cs @@ -1,13 +1,13 @@ using Crypto.Compare.DataAccess; using Crypto.Compare.Services.Queries.Symbols; -using Crypto.Compare.Services.Results.Symbols; +using Crypto.Compare.Services.Results.SymbolProviders; using FluentResults; using MediatR; using Microsoft.EntityFrameworkCore; namespace Crypto.Compare.Services.Handlers.Queries.Symbols; -public class GetSymbolsQueryHandler : IRequestHandler> +public class GetSymbolsQueryHandler : IRequestHandler> { private readonly CryptoCompareContext _cryptoCompareContext; @@ -16,50 +16,28 @@ public GetSymbolsQueryHandler(CryptoCompareContext cryptoCompareContext) _cryptoCompareContext = cryptoCompareContext; } - public async Task> Handle(GetSymbolsQuery request, CancellationToken cancellationToken) + public async Task> Handle(GetSymbolsQuery request, CancellationToken cancellationToken) { - var query = _cryptoCompareContext - .Symbols - .Include(x=>x.SymbolProviders) - .AsQueryable() - .AsNoTracking(); - - if (!string.IsNullOrEmpty(request.Ticker)) - { - query = query.Where(x => x.Ticker == request.Ticker); - } - - var symbols = await query - .Select(symbol => new SymbolResult - { - Id = symbol.Id, - Ticker = symbol.Ticker, - Symbol = $"{symbol.BaseSymbol}/{symbol.QuoteSymbol}", - ProviderSellId = symbol.SymbolProviders - .OrderByDescending(sp => sp.PriceSell) - .Select(sp => sp.ProviderId) - .FirstOrDefault(), - PriceSell = symbol.SymbolProviders - .OrderByDescending(sp => sp.PriceSell) - .Select(sp => sp.PriceSell) - .FirstOrDefault(), - ProviderBuyId = symbol.SymbolProviders - .OrderBy(sp => sp.PriceBuy) - .Select(sp => sp.ProviderId) - .FirstOrDefault(), - PriceBuy = symbol.SymbolProviders - .OrderBy(sp => sp.PriceBuy) - .Select(sp => sp.PriceBuy) - .FirstOrDefault(), - UpdatedAt = symbol.UpdatedAt - }) - .Skip((int)request.Skip) - .Take(request.Rows) - .ToListAsync(cancellationToken); - - return new GetSymbolsResult - { - Symbols = symbols - }; + return + new GetSymbolProviderResult() + { + Symbols = await _cryptoCompareContext + .SymbolProviders + .AsQueryable() + .AsNoTracking() + .Include(x => x.Symbol) + .Where(x => x.Symbol.Ticker == request.Ticker) + .Select(s => new SymbolProviderResult + { + Id = s.Symbol.Id, + Ticker = s.Ticker, + Symbol = $"{s.Symbol.BaseSymbol}/{s.Symbol.QuoteSymbol}", + ProviderId = s.ProviderId, + PriceSell = s.PriceSell, + PriceBuy = s.PriceBuy, + UpdatedAt = s.UpdatedAt + }) + .ToListAsync(cancellationToken) + }; } } \ No newline at end of file diff --git a/sources/core/Crypto.Compare.Services/Queries/Symbols/GetSymbolsBestPriceQuery.cs b/sources/core/Crypto.Compare.Services/Queries/Symbols/GetSymbolsBestPriceQuery.cs new file mode 100644 index 0000000..51d113c --- /dev/null +++ b/sources/core/Crypto.Compare.Services/Queries/Symbols/GetSymbolsBestPriceQuery.cs @@ -0,0 +1,33 @@ +using Crypto.Compare.Services.Results.Symbols; +using FluentResults; +using MediatR; + +namespace Crypto.Compare.Services.Queries.Symbols; + +public class GetSymbolsBestPriceQuery : IRequest> +{ + private const int MaxRows = 30; + private const int DefaultRows = 10; + + public GetSymbolsBestPriceQuery(string? ticker = null, long? skip = 0, int? rows = DefaultRows) + { + Ticker = ticker?.ToLowerInvariant(); + Skip = skip ?? 0; + Rows = rows is null or < 10 or > MaxRows ? DefaultRows : rows.Value; + } + + /// + /// Ticker symbol + /// + public string? Ticker { get; } + + /// + /// Skip rows + /// + public long Skip { get; } + + /// + /// Get rows + /// + public int Rows { get; } +} \ No newline at end of file diff --git a/sources/core/Crypto.Compare.Services/Queries/Symbols/GetSymbolsQuery.cs b/sources/core/Crypto.Compare.Services/Queries/Symbols/GetSymbolsQuery.cs index cfc3a9f..2cc187a 100644 --- a/sources/core/Crypto.Compare.Services/Queries/Symbols/GetSymbolsQuery.cs +++ b/sources/core/Crypto.Compare.Services/Queries/Symbols/GetSymbolsQuery.cs @@ -1,33 +1,7 @@ -using Crypto.Compare.Services.Results.Symbols; +using Crypto.Compare.Services.Results.SymbolProviders; using FluentResults; using MediatR; namespace Crypto.Compare.Services.Queries.Symbols; -public class GetSymbolsQuery : IRequest> -{ - private const int MaxRows = 30; - private const int DefaultRows = 10; - - public GetSymbolsQuery(string? ticker = null, long? skip = 0, int? rows = DefaultRows) - { - Ticker = ticker?.ToLowerInvariant(); - Skip = skip ?? 0; - Rows = rows is null or < 10 or > MaxRows ? DefaultRows : rows.Value; - } - - /// - /// Ticker symbol - /// - public string? Ticker { get; } - - /// - /// Skip rows - /// - public long Skip { get; } - - /// - /// Get rows - /// - public int Rows { get; } -} \ No newline at end of file +public record GetSymbolsQuery(string Ticker) : IRequest>; diff --git a/sources/core/Crypto.Compare.Services/Results/SymbolProviders/GetSymbolProviderResult.cs b/sources/core/Crypto.Compare.Services/Results/SymbolProviders/GetSymbolProviderResult.cs index 20e1683..5453bb5 100644 --- a/sources/core/Crypto.Compare.Services/Results/SymbolProviders/GetSymbolProviderResult.cs +++ b/sources/core/Crypto.Compare.Services/Results/SymbolProviders/GetSymbolProviderResult.cs @@ -1,6 +1,4 @@ -using Crypto.Compare.Data; - -namespace Crypto.Compare.Services.Results.SymbolProviders; +namespace Crypto.Compare.Services.Results.SymbolProviders; public class GetSymbolProviderResult : IHandlerResult { diff --git a/sources/core/Crypto.Compare.Services/Results/Symbols/GetSymbolsBestPriceResult.cs b/sources/core/Crypto.Compare.Services/Results/Symbols/GetSymbolsBestPriceResult.cs new file mode 100644 index 0000000..cc4c86a --- /dev/null +++ b/sources/core/Crypto.Compare.Services/Results/Symbols/GetSymbolsBestPriceResult.cs @@ -0,0 +1,6 @@ +namespace Crypto.Compare.Services.Results.Symbols; + +public class GetSymbolsBestPriceResult : IHandlerResult +{ + public List Symbols { get; set; } +} \ No newline at end of file diff --git a/sources/core/Crypto.Compare.Services/Results/Symbols/GetSymbolsResult.cs b/sources/core/Crypto.Compare.Services/Results/Symbols/GetSymbolsResult.cs index 9ee52e2..8652331 100644 --- a/sources/core/Crypto.Compare.Services/Results/Symbols/GetSymbolsResult.cs +++ b/sources/core/Crypto.Compare.Services/Results/Symbols/GetSymbolsResult.cs @@ -1,6 +1,8 @@ -namespace Crypto.Compare.Services.Results.Symbols; +using Crypto.Compare.Data; -public class GetSymbolsResult : IHandlerResult +namespace Crypto.Compare.Services.Results.Symbols; + +public class GetSymbolsResult { - public List Symbols { get; set; } -} \ No newline at end of file + public List Symbols { get; set; } +} diff --git a/sources/infrastructure/Crypto.Compare.DataAccess/Crypto.Compare.DataAccess.csproj b/sources/infrastructure/Crypto.Compare.DataAccess/Crypto.Compare.DataAccess.csproj index a40eccd..f1f699e 100644 --- a/sources/infrastructure/Crypto.Compare.DataAccess/Crypto.Compare.DataAccess.csproj +++ b/sources/infrastructure/Crypto.Compare.DataAccess/Crypto.Compare.DataAccess.csproj @@ -7,8 +7,8 @@ - - + + diff --git a/sources/integrations/Crypto.Comapre.Binance/Crypto.Comapre.Binance.csproj b/sources/integrations/Crypto.Comapre.Binance/Crypto.Comapre.Binance.csproj index 91faeb8..ed3797d 100644 --- a/sources/integrations/Crypto.Comapre.Binance/Crypto.Comapre.Binance.csproj +++ b/sources/integrations/Crypto.Comapre.Binance/Crypto.Comapre.Binance.csproj @@ -7,7 +7,7 @@ - + diff --git a/sources/integrations/Crypto.Compare.BingX/Crypto.Compare.BingX.csproj b/sources/integrations/Crypto.Compare.BingX/Crypto.Compare.BingX.csproj index 424ef34..fef50f8 100644 --- a/sources/integrations/Crypto.Compare.BingX/Crypto.Compare.BingX.csproj +++ b/sources/integrations/Crypto.Compare.BingX/Crypto.Compare.BingX.csproj @@ -7,7 +7,7 @@ - + diff --git a/sources/integrations/Crypto.Compare.BitMart/Crypto.Compare.BitMart.csproj b/sources/integrations/Crypto.Compare.BitMart/Crypto.Compare.BitMart.csproj index e3e7a76..cbf2318 100644 --- a/sources/integrations/Crypto.Compare.BitMart/Crypto.Compare.BitMart.csproj +++ b/sources/integrations/Crypto.Compare.BitMart/Crypto.Compare.BitMart.csproj @@ -12,7 +12,7 @@ - + diff --git a/sources/integrations/Crypto.Compare.Bitget/Crypto.Compare.Bitget.csproj b/sources/integrations/Crypto.Compare.Bitget/Crypto.Compare.Bitget.csproj index 652f48a..7ba9ad7 100644 --- a/sources/integrations/Crypto.Compare.Bitget/Crypto.Compare.Bitget.csproj +++ b/sources/integrations/Crypto.Compare.Bitget/Crypto.Compare.Bitget.csproj @@ -7,7 +7,7 @@ - + diff --git a/sources/integrations/Crypto.Compare.ByBit/Crypto.Compare.ByBit.csproj b/sources/integrations/Crypto.Compare.ByBit/Crypto.Compare.ByBit.csproj index a995d8c..0eaa9a3 100644 --- a/sources/integrations/Crypto.Compare.ByBit/Crypto.Compare.ByBit.csproj +++ b/sources/integrations/Crypto.Compare.ByBit/Crypto.Compare.ByBit.csproj @@ -7,7 +7,7 @@ - + diff --git a/sources/integrations/Crypto.Compare.GateIo/Crypto.Compare.GateIo.csproj b/sources/integrations/Crypto.Compare.GateIo/Crypto.Compare.GateIo.csproj index 33d9141..0e3ed04 100644 --- a/sources/integrations/Crypto.Compare.GateIo/Crypto.Compare.GateIo.csproj +++ b/sources/integrations/Crypto.Compare.GateIo/Crypto.Compare.GateIo.csproj @@ -7,7 +7,7 @@ - + diff --git a/sources/integrations/Crypto.Compare.Mexc/Crypto.Compare.Mexc.csproj b/sources/integrations/Crypto.Compare.Mexc/Crypto.Compare.Mexc.csproj index 5baed1e..78328eb 100644 --- a/sources/integrations/Crypto.Compare.Mexc/Crypto.Compare.Mexc.csproj +++ b/sources/integrations/Crypto.Compare.Mexc/Crypto.Compare.Mexc.csproj @@ -11,7 +11,8 @@ - + + diff --git a/sources/integrations/Crypto.Compare.Xtcom/Crypto.Compare.Xtcom.csproj b/sources/integrations/Crypto.Compare.Xtcom/Crypto.Compare.Xtcom.csproj index 1b52b6d..d60dc53 100644 --- a/sources/integrations/Crypto.Compare.Xtcom/Crypto.Compare.Xtcom.csproj +++ b/sources/integrations/Crypto.Compare.Xtcom/Crypto.Compare.Xtcom.csproj @@ -10,7 +10,7 @@ - + diff --git a/sources/presentation/Crypto.Compare.PublicApi/Controllers/SymbolsController.cs b/sources/presentation/Crypto.Compare.PublicApi/Controllers/SymbolsController.cs index 46d6744..d27b7ac 100644 --- a/sources/presentation/Crypto.Compare.PublicApi/Controllers/SymbolsController.cs +++ b/sources/presentation/Crypto.Compare.PublicApi/Controllers/SymbolsController.cs @@ -42,16 +42,16 @@ public SymbolsProvider(IMediator mediator, IResponseMapper responseMapper) [HttpGet("")] [Produces(MediaTypeNames.Application.Json)] [SwaggerResponse(StatusCodes.Status200OK, "Get all list of symbols", typeof(GetSymbolsResponse))] - [SwaggerResponseExample(StatusCodes.Status200OK, typeof(GetSymbolsResponseExample))] + [SwaggerResponseExample(StatusCodes.Status200OK, typeof(GetSymbolsBestResponseExample))] public async Task GetSymbols([FromQuery] int? skip, [FromQuery] int? rows, CancellationToken cancellationToken) { - var command = new GetSymbolsQuery( + var command = new GetSymbolsBestPriceQuery( skip: skip, rows: rows); var result = await _mediator.Send(command, cancellationToken); - return _responseMapper.ToCustomResponse(result); + return _responseMapper.ToCustomResponse(result); } /// @@ -64,7 +64,7 @@ public async Task GetSymbols([FromQuery] int? skip, [FromQuery] i [HttpGet("provider/{providerId}")] [Produces(MediaTypeNames.Application.Json)] [SwaggerResponse(StatusCodes.Status200OK, "Get list of symbols for provider", typeof(GetSymbolsResponse))] - [SwaggerResponseExample(StatusCodes.Status200OK, typeof(GetSymbolsResponseExample))] + [SwaggerResponseExample(StatusCodes.Status200OK, typeof(GetSymbolsBestResponseExample))] public async Task GetSymbolsByProvider([FromRoute] int providerId, [FromQuery] int? skip, [FromQuery] int? rows, CancellationToken cancellationToken) { var command = new GetSymbolProvidersQuery(providerId: providerId, @@ -93,19 +93,36 @@ public async Task GetSymbolsByProvider([FromRoute] long id, Cance } /// - /// Get list of symbols + /// Get list of symbols with best price + /// + /// Ticker of symbols + /// Cancellation token + [HttpGet("ticker/best/{ticker}")] + [Produces(MediaTypeNames.Application.Json)] + [SwaggerResponse(StatusCodes.Status200OK, "Get list of symbols with best price", typeof(GetSymbolsResponse))] + [SwaggerResponseExample(StatusCodes.Status200OK, typeof(GetSymbolsBestResponseExample))] + public async Task GetSymbolsBestByTicker([FromRoute] string ticker, CancellationToken cancellationToken) + { + var command = new GetSymbolsBestPriceQuery(ticker: ticker); + var result = await _mediator.Send(command, cancellationToken); + + return _responseMapper.ToCustomResponse(result); + } + + /// + /// Get list of symbols by ticker /// /// Ticker of symbols /// Cancellation token [HttpGet("ticker/{ticker}")] [Produces(MediaTypeNames.Application.Json)] - [SwaggerResponse(StatusCodes.Status200OK, "Get list of symbols", typeof(GetSymbolsResponse))] + [SwaggerResponse(StatusCodes.Status200OK, "Get list of symbols by ticker", typeof(GetSymbolsResponse))] [SwaggerResponseExample(StatusCodes.Status200OK, typeof(GetSymbolsResponseExample))] public async Task GetSymbolsByTicker([FromRoute] string ticker, CancellationToken cancellationToken) { - var command = new GetSymbolsQuery(ticker: ticker); + var command = new GetSymbolsQuery(ticker); var result = await _mediator.Send(command, cancellationToken); - return _responseMapper.ToCustomResponse(result); + return _responseMapper.ToCustomResponse(result); } } diff --git a/sources/presentation/Crypto.Compare.PublicApi/Crypto.Compare.PublicApi.csproj b/sources/presentation/Crypto.Compare.PublicApi/Crypto.Compare.PublicApi.csproj index 7dfeae4..b6bac22 100644 --- a/sources/presentation/Crypto.Compare.PublicApi/Crypto.Compare.PublicApi.csproj +++ b/sources/presentation/Crypto.Compare.PublicApi/Crypto.Compare.PublicApi.csproj @@ -11,13 +11,13 @@ - + - - - - + + + + diff --git a/sources/presentation/Crypto.Compare.PublicApi/Dtos/SymbolBestDto.cs b/sources/presentation/Crypto.Compare.PublicApi/Dtos/SymbolBestDto.cs new file mode 100644 index 0000000..1bd8d9a --- /dev/null +++ b/sources/presentation/Crypto.Compare.PublicApi/Dtos/SymbolBestDto.cs @@ -0,0 +1,44 @@ +namespace Crypto.Compare.PublicApi.Dtos; + +public class SymbolBestDto +{ + /// + /// Uniq id + /// + public long Id { get; set; } + + /// + /// Ticker name + /// + public string Ticker { get; set; } + + /// + /// symbol or viewed name + /// + public string Symbol { get; set; } + + /// + /// Id provider the best sell price + /// + public int ProviderSellId { get; set; } + + /// + /// Price sell + /// + public decimal PriceSell { get; set; } + + /// + /// Id provider the best buy price + /// + public int ProviderBuyId { get; set; } + + /// + /// Current sell price + /// + public decimal PriceBuy { get; set; } + + /// + /// Last date get quotes + /// + public DateTime UpdatedAt { get; set; } +} \ No newline at end of file diff --git a/sources/presentation/Crypto.Compare.PublicApi/Dtos/SymbolDto.cs b/sources/presentation/Crypto.Compare.PublicApi/Dtos/SymbolDto.cs index 365b478..271ed71 100644 --- a/sources/presentation/Crypto.Compare.PublicApi/Dtos/SymbolDto.cs +++ b/sources/presentation/Crypto.Compare.PublicApi/Dtos/SymbolDto.cs @@ -6,39 +6,34 @@ public class SymbolDto /// Uniq id /// public long Id { get; set; } - + /// /// Ticker name /// public string Ticker { get; set; } - + /// /// symbol or viewed name /// public string Symbol { get; set; } - + /// - /// Id provider the best sell price + /// Id provider /// - public int ProviderSellId { get; set; } - + public int ProviderId { get; set; } + /// /// Price sell /// public decimal PriceSell { get; set; } - /// - /// Id provider the best buy price - /// - public int ProviderBuyId { get; set; } - /// /// Current sell price /// public decimal PriceBuy { get; set; } - + /// /// Last date get quotes /// public DateTime UpdatedAt { get; set; } -} \ No newline at end of file +} diff --git a/sources/presentation/Crypto.Compare.PublicApi/Ioc/ServicesRegistry.cs b/sources/presentation/Crypto.Compare.PublicApi/Ioc/ServicesRegistry.cs index f15bb4a..de3bc20 100644 --- a/sources/presentation/Crypto.Compare.PublicApi/Ioc/ServicesRegistry.cs +++ b/sources/presentation/Crypto.Compare.PublicApi/Ioc/ServicesRegistry.cs @@ -15,6 +15,7 @@ using Crypto.Compare.DataAccess; using Crypto.Compare.GateIo; using Crypto.Compare.Mexc; +using Crypto.Compare.PublicApi.Dtos; using Crypto.Compare.PublicApi.HostedServices; using Crypto.Compare.PublicApi.Mapping; using Crypto.Compare.Services.AdaptersObservable.Impl; @@ -283,11 +284,11 @@ private static IServiceCollection AddMediator(this IServiceCollection services) .AddMediatR(cfg => cfg.RegisterServicesFromAssembly(Assembly.GetCallingAssembly())) .AddScoped>, GetSymbolQueryHandler>() - .AddScoped>, GetSymbolsQueryHandler>() + .AddScoped>, GetSymbolsBestPriceQueryHandler>() .AddScoped>, GetProviderQueryHandler>() .AddScoped>, GetProvidersQueryHandler>() .AddScoped>, GetSymbolProvidersQueryHandler>() - + .AddScoped>, GetSymbolsQueryHandler>() ; } } diff --git a/sources/presentation/Crypto.Compare.PublicApi/Mapping/MapsterProfile.cs b/sources/presentation/Crypto.Compare.PublicApi/Mapping/MapsterProfile.cs index 1c08951..94104e1 100644 --- a/sources/presentation/Crypto.Compare.PublicApi/Mapping/MapsterProfile.cs +++ b/sources/presentation/Crypto.Compare.PublicApi/Mapping/MapsterProfile.cs @@ -16,9 +16,12 @@ public void Register(TypeAdapterConfig config) { // Простые маппинги (аналогичны CreateMap) config.NewConfig(); - config.NewConfig(); config.NewConfig(); + config.NewConfig(); config.NewConfig(); + config.NewConfig(); + config.NewConfig(); + config.NewConfig(); config.NewConfig(); diff --git a/sources/presentation/Crypto.Compare.PublicApi/Responses/v1/Symbols/GetSymbolsBestResponse.cs b/sources/presentation/Crypto.Compare.PublicApi/Responses/v1/Symbols/GetSymbolsBestResponse.cs new file mode 100644 index 0000000..c92a3ae --- /dev/null +++ b/sources/presentation/Crypto.Compare.PublicApi/Responses/v1/Symbols/GetSymbolsBestResponse.cs @@ -0,0 +1,7 @@ +using Crypto.Compare.PublicApi.Dtos; +namespace Crypto.Compare.PublicApi.Responses.v1.Symbols; + +public class GetSymbolsBestResponse : BaseApiResponse +{ + public List Symbols { get; set; } +} \ No newline at end of file diff --git a/sources/presentation/Crypto.Compare.PublicApi/Responses/v1/Symbols/GetSymbolsResponse.cs b/sources/presentation/Crypto.Compare.PublicApi/Responses/v1/Symbols/GetSymbolsResponse.cs index b5a3c00..88d4ef9 100644 --- a/sources/presentation/Crypto.Compare.PublicApi/Responses/v1/Symbols/GetSymbolsResponse.cs +++ b/sources/presentation/Crypto.Compare.PublicApi/Responses/v1/Symbols/GetSymbolsResponse.cs @@ -4,5 +4,5 @@ namespace Crypto.Compare.PublicApi.Responses.v1.Symbols; public class GetSymbolsResponse : BaseApiResponse { - public List Symbols { get; set; } -} \ No newline at end of file + public List Symbols { get; set; } +} diff --git a/sources/presentation/Crypto.Compare.PublicApi/Swaggers/Responses/v1/Symbols/GetSymbolsBestResponseExample.cs b/sources/presentation/Crypto.Compare.PublicApi/Swaggers/Responses/v1/Symbols/GetSymbolsBestResponseExample.cs new file mode 100644 index 0000000..69b8b45 --- /dev/null +++ b/sources/presentation/Crypto.Compare.PublicApi/Swaggers/Responses/v1/Symbols/GetSymbolsBestResponseExample.cs @@ -0,0 +1,34 @@ +using Crypto.Compare.PublicApi.Dtos; +using Crypto.Compare.PublicApi.Responses.v1.Symbols; +using Swashbuckle.AspNetCore.Filters; + +namespace Crypto.Compare.PublicApi.Swaggers.Responses.v1.Symbols; + +public class GetSymbolsBestResponseExample : IExamplesProvider +{ + public GetSymbolsBestResponse GetExamples() + => new() + { + Symbols = new List + { + new() + { + Id = 1, + Symbol = "BTCUSDT", + PriceSell = 82000, + PriceBuy = 79000, + ProviderSellId = 1, + Ticker = "BTCUSDT" + }, + new() + { + Id = 2, + Symbol = "ETHUSDT", + PriceSell = 3200, + PriceBuy = 3100, + ProviderSellId = 1, + Ticker = "ETHUSDT" + } + } + }; +} \ No newline at end of file diff --git a/sources/presentation/Crypto.Compare.PublicApi/Swaggers/Responses/v1/Symbols/GetSymbolsResponseExample.cs b/sources/presentation/Crypto.Compare.PublicApi/Swaggers/Responses/v1/Symbols/GetSymbolsResponseExample.cs index b0e620b..d888181 100644 --- a/sources/presentation/Crypto.Compare.PublicApi/Swaggers/Responses/v1/Symbols/GetSymbolsResponseExample.cs +++ b/sources/presentation/Crypto.Compare.PublicApi/Swaggers/Responses/v1/Symbols/GetSymbolsResponseExample.cs @@ -7,18 +7,18 @@ namespace Crypto.Compare.PublicApi.Swaggers.Responses.v1.Symbols; public class GetSymbolsResponseExample : IExamplesProvider { public GetSymbolsResponse GetExamples() - => new() + => new() + { + Symbols = new List { - Symbols = new List - { - new() + new() { Id = 1, - Symbol = "BTCUSDT", + Symbol = "ETHUSDT", PriceSell = 82000, PriceBuy = 79000, - ProviderSellId = 1, - Ticker = "BTCUSDT" + ProviderId = 1, + Ticker = "ETHUSDT" }, new() { @@ -26,9 +26,9 @@ public GetSymbolsResponse GetExamples() Symbol = "ETHUSDT", PriceSell = 3200, PriceBuy = 3100, - ProviderSellId = 1, + ProviderId = 2, Ticker = "ETHUSDT" } - } - }; + } + }; } \ No newline at end of file diff --git a/tests/Crypto.Compare.PublicApi.Tests/Crypto.Compare.PublicApi.Tests.csproj b/tests/Crypto.Compare.PublicApi.Tests/Crypto.Compare.PublicApi.Tests.csproj index d3f6736..6dc868b 100644 --- a/tests/Crypto.Compare.PublicApi.Tests/Crypto.Compare.PublicApi.Tests.csproj +++ b/tests/Crypto.Compare.PublicApi.Tests/Crypto.Compare.PublicApi.Tests.csproj @@ -10,13 +10,13 @@ - + - - - - - + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/tests/Crypto.Compare.Services.Tests/Crypto.Compare.Services.Tests.csproj b/tests/Crypto.Compare.Services.Tests/Crypto.Compare.Services.Tests.csproj index 4333e04..fe5719b 100644 --- a/tests/Crypto.Compare.Services.Tests/Crypto.Compare.Services.Tests.csproj +++ b/tests/Crypto.Compare.Services.Tests/Crypto.Compare.Services.Tests.csproj @@ -9,9 +9,9 @@ - - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive