Swamy/remove unused using and refactoring entity classes (#1371)
* Removed Unused Usings * Code Refactoring for readbility. Added spaces and moved the classes to separate file
This commit is contained in:
parent
17e838263f
commit
736320b920
@ -1,7 +1,4 @@
|
|||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Config
|
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Config
|
||||||
{
|
{
|
||||||
@ -10,12 +7,14 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Config
|
|||||||
public class CatalogOperations
|
public class CatalogOperations
|
||||||
{
|
{
|
||||||
public static string GetItemById(int id) => $"/api/v1/catalog/items/{id}";
|
public static string GetItemById(int id) => $"/api/v1/catalog/items/{id}";
|
||||||
|
|
||||||
public static string GetItemsById(IEnumerable<int> ids) => $"/api/v1/catalog/items?ids={string.Join(',', ids)}";
|
public static string GetItemsById(IEnumerable<int> ids) => $"/api/v1/catalog/items?ids={string.Join(',', ids)}";
|
||||||
}
|
}
|
||||||
|
|
||||||
public class BasketOperations
|
public class BasketOperations
|
||||||
{
|
{
|
||||||
public static string GetItemById(string id) => $"/api/v1/basket/{id}";
|
public static string GetItemById(string id) => $"/api/v1/basket/{id}";
|
||||||
|
|
||||||
public static string UpdateBasket() => "/api/v1/basket";
|
public static string UpdateBasket() => "/api/v1/basket";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -25,10 +24,15 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
public string Basket { get; set; }
|
public string Basket { get; set; }
|
||||||
|
|
||||||
public string Catalog { get; set; }
|
public string Catalog { get; set; }
|
||||||
|
|
||||||
public string Orders { get; set; }
|
public string Orders { get; set; }
|
||||||
|
|
||||||
public string GrpcBasket { get; set; }
|
public string GrpcBasket { get; set; }
|
||||||
|
|
||||||
public string GrpcCatalog { get; set; }
|
public string GrpcCatalog { get; set; }
|
||||||
|
|
||||||
public string GrpcOrdering { get; set; }
|
public string GrpcOrdering { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,4 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Controllers
|
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Controllers
|
||||||
{
|
{
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Filters
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Microsoft.OpenApi.Models;
|
||||||
|
using Swashbuckle.AspNetCore.SwaggerGen;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Filters
|
||||||
{
|
{
|
||||||
using Microsoft.AspNetCore.Authorization;
|
|
||||||
using Microsoft.OpenApi.Models;
|
|
||||||
using Swashbuckle.AspNetCore.SwaggerGen;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace Basket.API.Infrastructure.Filters
|
namespace Basket.API.Infrastructure.Filters
|
||||||
{
|
{
|
||||||
|
@ -1,13 +1,9 @@
|
|||||||
using System;
|
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models
|
|
||||||
{
|
{
|
||||||
public class AddBasketItemRequest
|
public class AddBasketItemRequest
|
||||||
{
|
{
|
||||||
public int CatalogItemId { get; set; }
|
public int CatalogItemId { get; set; }
|
||||||
|
|
||||||
public string BasketId { get; set; }
|
public string BasketId { get; set; }
|
||||||
|
|
||||||
public int Quantity { get; set; }
|
public int Quantity { get; set; }
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models
|
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models
|
||||||
{
|
{
|
||||||
|
|
||||||
public class BasketData
|
public class BasketData
|
||||||
{
|
{
|
||||||
public string BuyerId { get; set; }
|
public string BuyerId { get; set; }
|
||||||
@ -10,7 +11,6 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models
|
|||||||
|
|
||||||
public BasketData()
|
public BasketData()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public BasketData(string buyerId)
|
public BasketData(string buyerId)
|
||||||
@ -19,15 +19,4 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class BasketDataItem
|
|
||||||
{
|
|
||||||
public string Id { get; set; }
|
|
||||||
public int ProductId { get; set; }
|
|
||||||
public string ProductName { get; set; }
|
|
||||||
public decimal UnitPrice { get; set; }
|
|
||||||
public decimal OldUnitPrice { get; set; }
|
|
||||||
public int Quantity { get; set; }
|
|
||||||
public string PictureUrl { get; set; }
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,21 @@
|
|||||||
|
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models
|
||||||
|
{
|
||||||
|
|
||||||
|
public class BasketDataItem
|
||||||
|
{
|
||||||
|
public string Id { get; set; }
|
||||||
|
|
||||||
|
public int ProductId { get; set; }
|
||||||
|
|
||||||
|
public string ProductName { get; set; }
|
||||||
|
|
||||||
|
public decimal UnitPrice { get; set; }
|
||||||
|
|
||||||
|
public decimal OldUnitPrice { get; set; }
|
||||||
|
|
||||||
|
public int Quantity { get; set; }
|
||||||
|
|
||||||
|
public string PictureUrl { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -3,23 +3,39 @@ using System.Collections.Generic;
|
|||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models
|
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models
|
||||||
{
|
{
|
||||||
|
|
||||||
public class OrderData
|
public class OrderData
|
||||||
{
|
{
|
||||||
public string OrderNumber { get; set; }
|
public string OrderNumber { get; set; }
|
||||||
|
|
||||||
public DateTime Date { get; set; }
|
public DateTime Date { get; set; }
|
||||||
|
|
||||||
public string Status { get; set; }
|
public string Status { get; set; }
|
||||||
|
|
||||||
public decimal Total { get; set; }
|
public decimal Total { get; set; }
|
||||||
|
|
||||||
public string Description { get; set; }
|
public string Description { get; set; }
|
||||||
|
|
||||||
public string City { get; set; }
|
public string City { get; set; }
|
||||||
|
|
||||||
public string Street { get; set; }
|
public string Street { get; set; }
|
||||||
|
|
||||||
public string State { get; set; }
|
public string State { get; set; }
|
||||||
|
|
||||||
public string Country { get; set; }
|
public string Country { get; set; }
|
||||||
|
|
||||||
public string ZipCode { get; set; }
|
public string ZipCode { get; set; }
|
||||||
|
|
||||||
public string CardNumber { get; set; }
|
public string CardNumber { get; set; }
|
||||||
|
|
||||||
public string CardHolderName { get; set; }
|
public string CardHolderName { get; set; }
|
||||||
|
|
||||||
public bool IsDraft { get; set; }
|
public bool IsDraft { get; set; }
|
||||||
|
|
||||||
public DateTime CardExpiration { get; set; }
|
public DateTime CardExpiration { get; set; }
|
||||||
|
|
||||||
public string CardExpirationShort { get; set; }
|
public string CardExpirationShort { get; set; }
|
||||||
|
|
||||||
public string CardSecurityNumber { get; set; }
|
public string CardSecurityNumber { get; set; }
|
||||||
|
|
||||||
public int CardTypeId { get; set; }
|
public int CardTypeId { get; set; }
|
||||||
@ -28,4 +44,5 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models
|
|||||||
|
|
||||||
public List<OrderItemData> OrderItems { get; } = new List<OrderItemData>();
|
public List<OrderItemData> OrderItems { get; } = new List<OrderItemData>();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,19 @@
|
|||||||
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models
|
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models
|
||||||
{
|
{
|
||||||
|
|
||||||
public class OrderItemData
|
public class OrderItemData
|
||||||
{
|
{
|
||||||
public int ProductId { get; set; }
|
public int ProductId { get; set; }
|
||||||
|
|
||||||
public string ProductName { get; set; }
|
public string ProductName { get; set; }
|
||||||
|
|
||||||
public decimal UnitPrice { get; set; }
|
public decimal UnitPrice { get; set; }
|
||||||
|
|
||||||
public decimal Discount { get; set; }
|
public decimal Discount { get; set; }
|
||||||
|
|
||||||
public int Units { get; set; }
|
public int Units { get; set; }
|
||||||
|
|
||||||
public string PictureUrl { get; set; }
|
public string PictureUrl { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,16 @@
|
|||||||
|
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models
|
||||||
|
{
|
||||||
|
|
||||||
|
public class UpdateBasketItemData
|
||||||
|
{
|
||||||
|
public string BasketItemId { get; set; }
|
||||||
|
|
||||||
|
public int NewQty { get; set; }
|
||||||
|
|
||||||
|
public UpdateBasketItemData()
|
||||||
|
{
|
||||||
|
NewQty = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models
|
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models
|
||||||
{
|
{
|
||||||
|
|
||||||
public class UpdateBasketItemsRequest
|
public class UpdateBasketItemsRequest
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -15,14 +16,4 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class UpdateBasketItemData
|
|
||||||
{
|
|
||||||
public string BasketItemId { get; set; }
|
|
||||||
public int NewQty { get; set; }
|
|
||||||
|
|
||||||
public UpdateBasketItemData()
|
|
||||||
{
|
|
||||||
NewQty = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models
|
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models
|
||||||
{
|
{
|
||||||
|
|
||||||
public class UpdateBasketRequest
|
public class UpdateBasketRequest
|
||||||
{
|
{
|
||||||
public string BuyerId { get; set; }
|
public string BuyerId { get; set; }
|
||||||
@ -9,10 +10,4 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models
|
|||||||
public IEnumerable<UpdateBasketRequestItemData> Items { get; set; }
|
public IEnumerable<UpdateBasketRequestItemData> Items { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class UpdateBasketRequestItemData
|
|
||||||
{
|
|
||||||
public string Id { get; set; } // Basket id
|
|
||||||
public int ProductId { get; set; } // Catalog item id
|
|
||||||
public int Quantity { get; set; } // Quantity
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,13 @@
|
|||||||
|
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models
|
||||||
|
{
|
||||||
|
|
||||||
|
public class UpdateBasketRequestItemData
|
||||||
|
{
|
||||||
|
public string Id { get; set; } // Basket id
|
||||||
|
|
||||||
|
public int ProductId { get; set; } // Catalog item id
|
||||||
|
|
||||||
|
public int Quantity { get; set; } // Quantity
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,10 +1,8 @@
|
|||||||
using Microsoft.AspNetCore;
|
using Microsoft.AspNetCore;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.AspNetCore.Server.Kestrel.Core;
|
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Net;
|
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator
|
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator
|
||||||
{
|
{
|
||||||
|
@ -1,14 +1,12 @@
|
|||||||
using Grpc.Net.Client;
|
using Grpc.Net.Client;
|
||||||
|
using GrpcBasket;
|
||||||
using Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Config;
|
using Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Config;
|
||||||
using Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models;
|
using Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
using System;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using GrpcBasket;
|
|
||||||
using Grpc.Core;
|
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Services
|
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Services
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using CatalogApi;
|
using CatalogApi;
|
||||||
using Grpc.Net.Client;
|
|
||||||
using Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Config;
|
using Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Config;
|
||||||
using Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models;
|
using Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
using System.Net.Http;
|
using Grpc.Core;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System;
|
|
||||||
using Grpc.Core;
|
|
||||||
using Serilog;
|
|
||||||
using Grpc.Net.Client;
|
using Grpc.Net.Client;
|
||||||
|
using Serilog;
|
||||||
|
using System;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Services
|
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Services
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
using Grpc.Net.Client;
|
using GrpcOrdering;
|
||||||
using Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Config;
|
using Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Config;
|
||||||
using Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models;
|
using Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
@ -6,7 +6,6 @@ using Microsoft.Extensions.Options;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using GrpcOrdering;
|
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Services
|
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Services
|
||||||
{
|
{
|
||||||
|
@ -1,17 +1,18 @@
|
|||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Config
|
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Config
|
||||||
{
|
{
|
||||||
|
|
||||||
public class UrlsConfig
|
public class UrlsConfig
|
||||||
{
|
{
|
||||||
|
|
||||||
public class CatalogOperations
|
public class CatalogOperations
|
||||||
{
|
{
|
||||||
// grpc call under REST must go trough port 80
|
// grpc call under REST must go trough port 80
|
||||||
public static string GetItemById(int id) => $"/api/v1/catalog/items/{id}";
|
public static string GetItemById(int id) => $"/api/v1/catalog/items/{id}";
|
||||||
|
|
||||||
public static string GetItemById(string ids) => $"/api/v1/catalog/items/ids/{string.Join(',', ids)}";
|
public static string GetItemById(string ids) => $"/api/v1/catalog/items/ids/{string.Join(',', ids)}";
|
||||||
|
|
||||||
// REST call standard must go through port 5000
|
// REST call standard must go through port 5000
|
||||||
public static string GetItemsById(IEnumerable<int> ids) => $":5000/api/v1/catalog/items?ids={string.Join(',', ids)}";
|
public static string GetItemsById(IEnumerable<int> ids) => $":5000/api/v1/catalog/items?ids={string.Join(',', ids)}";
|
||||||
}
|
}
|
||||||
@ -19,6 +20,7 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Config
|
|||||||
public class BasketOperations
|
public class BasketOperations
|
||||||
{
|
{
|
||||||
public static string GetItemById(string id) => $"/api/v1/basket/{id}";
|
public static string GetItemById(string id) => $"/api/v1/basket/{id}";
|
||||||
|
|
||||||
public static string UpdateBasket() => "/api/v1/basket";
|
public static string UpdateBasket() => "/api/v1/basket";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -28,10 +30,16 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
public string Basket { get; set; }
|
public string Basket { get; set; }
|
||||||
|
|
||||||
public string Catalog { get; set; }
|
public string Catalog { get; set; }
|
||||||
|
|
||||||
public string Orders { get; set; }
|
public string Orders { get; set; }
|
||||||
|
|
||||||
public string GrpcBasket { get; set; }
|
public string GrpcBasket { get; set; }
|
||||||
|
|
||||||
public string GrpcCatalog { get; set; }
|
public string GrpcCatalog { get; set; }
|
||||||
|
|
||||||
public string GrpcOrdering { get; set; }
|
public string GrpcOrdering { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,12 +3,9 @@ using Microsoft.AspNetCore.Mvc;
|
|||||||
using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models;
|
using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models;
|
||||||
using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services;
|
using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Serilog;
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Controllers
|
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Controllers
|
||||||
{
|
{
|
||||||
|
@ -1,8 +1,4 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Controllers
|
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Controllers
|
||||||
{
|
{
|
||||||
|
@ -2,9 +2,6 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models;
|
using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models;
|
||||||
using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services;
|
using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Filters
|
using Microsoft.AspNetCore.Authorization;
|
||||||
{
|
using Microsoft.OpenApi.Models;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Swashbuckle.AspNetCore.SwaggerGen;
|
||||||
using Microsoft.OpenApi.Models;
|
using System.Collections.Generic;
|
||||||
using Swashbuckle.AspNetCore.SwaggerGen;
|
using System.Linq;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
|
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Filters
|
||||||
|
{
|
||||||
namespace Basket.API.Infrastructure.Filters
|
namespace Basket.API.Infrastructure.Filters
|
||||||
{
|
{
|
||||||
public class AuthorizeCheckOperationFilter : IOperationFilter
|
public class AuthorizeCheckOperationFilter : IOperationFilter
|
||||||
|
@ -1,13 +1,10 @@
|
|||||||
using System;
|
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models
|
|
||||||
{
|
{
|
||||||
|
|
||||||
public class AddBasketItemRequest
|
public class AddBasketItemRequest
|
||||||
{
|
{
|
||||||
public int CatalogItemId { get; set; }
|
public int CatalogItemId { get; set; }
|
||||||
|
|
||||||
public string BasketId { get; set; }
|
public string BasketId { get; set; }
|
||||||
|
|
||||||
public int Quantity { get; set; }
|
public int Quantity { get; set; }
|
||||||
@ -17,4 +14,5 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models
|
|||||||
Quantity = 1;
|
Quantity = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models
|
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models
|
||||||
{
|
{
|
||||||
|
|
||||||
public class BasketData
|
public class BasketData
|
||||||
{
|
{
|
||||||
public string BuyerId { get; set; }
|
public string BuyerId { get; set; }
|
||||||
@ -10,7 +11,6 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models
|
|||||||
|
|
||||||
public BasketData()
|
public BasketData()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public BasketData(string buyerId)
|
public BasketData(string buyerId)
|
||||||
@ -19,15 +19,4 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class BasketDataItem
|
|
||||||
{
|
|
||||||
public string Id { get; set; }
|
|
||||||
public int ProductId { get; set; }
|
|
||||||
public string ProductName { get; set; }
|
|
||||||
public decimal UnitPrice { get; set; }
|
|
||||||
public decimal OldUnitPrice { get; set; }
|
|
||||||
public int Quantity { get; set; }
|
|
||||||
public string PictureUrl { get; set; }
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,21 @@
|
|||||||
|
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models
|
||||||
|
{
|
||||||
|
|
||||||
|
public class BasketDataItem
|
||||||
|
{
|
||||||
|
public string Id { get; set; }
|
||||||
|
|
||||||
|
public int ProductId { get; set; }
|
||||||
|
|
||||||
|
public string ProductName { get; set; }
|
||||||
|
|
||||||
|
public decimal UnitPrice { get; set; }
|
||||||
|
|
||||||
|
public decimal OldUnitPrice { get; set; }
|
||||||
|
|
||||||
|
public int Quantity { get; set; }
|
||||||
|
|
||||||
|
public string PictureUrl { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,5 +1,6 @@
|
|||||||
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models
|
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models
|
||||||
{
|
{
|
||||||
|
|
||||||
public class CatalogItem
|
public class CatalogItem
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
@ -10,4 +11,5 @@
|
|||||||
|
|
||||||
public string PictureUri { get; set; }
|
public string PictureUri { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,27 +1,41 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models
|
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models
|
||||||
{
|
{
|
||||||
|
|
||||||
public class OrderData
|
public class OrderData
|
||||||
{
|
{
|
||||||
public string OrderNumber { get; set; }
|
public string OrderNumber { get; set; }
|
||||||
|
|
||||||
public DateTime Date { get; set; }
|
public DateTime Date { get; set; }
|
||||||
|
|
||||||
public string Status { get; set; }
|
public string Status { get; set; }
|
||||||
|
|
||||||
public decimal Total { get; set; }
|
public decimal Total { get; set; }
|
||||||
|
|
||||||
public string Description { get; set; }
|
public string Description { get; set; }
|
||||||
|
|
||||||
public string City { get; set; }
|
public string City { get; set; }
|
||||||
|
|
||||||
public string Street { get; set; }
|
public string Street { get; set; }
|
||||||
|
|
||||||
public string State { get; set; }
|
public string State { get; set; }
|
||||||
|
|
||||||
public string Country { get; set; }
|
public string Country { get; set; }
|
||||||
|
|
||||||
public string ZipCode { get; set; }
|
public string ZipCode { get; set; }
|
||||||
|
|
||||||
public string CardNumber { get; set; }
|
public string CardNumber { get; set; }
|
||||||
|
|
||||||
public string CardHolderName { get; set; }
|
public string CardHolderName { get; set; }
|
||||||
|
|
||||||
public bool IsDraft { get; set; }
|
public bool IsDraft { get; set; }
|
||||||
|
|
||||||
public DateTime CardExpiration { get; set; }
|
public DateTime CardExpiration { get; set; }
|
||||||
|
|
||||||
public string CardExpirationShort { get; set; }
|
public string CardExpirationShort { get; set; }
|
||||||
|
|
||||||
public string CardSecurityNumber { get; set; }
|
public string CardSecurityNumber { get; set; }
|
||||||
|
|
||||||
public int CardTypeId { get; set; }
|
public int CardTypeId { get; set; }
|
||||||
@ -30,4 +44,5 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models
|
|||||||
|
|
||||||
public List<OrderItemData> OrderItems { get; } = new List<OrderItemData>();
|
public List<OrderItemData> OrderItems { get; } = new List<OrderItemData>();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,19 @@
|
|||||||
using System;
|
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models
|
|
||||||
{
|
{
|
||||||
|
|
||||||
public class OrderItemData
|
public class OrderItemData
|
||||||
{
|
{
|
||||||
public int ProductId { get; set; }
|
public int ProductId { get; set; }
|
||||||
|
|
||||||
public string ProductName { get; set; }
|
public string ProductName { get; set; }
|
||||||
|
|
||||||
public decimal UnitPrice { get; set; }
|
public decimal UnitPrice { get; set; }
|
||||||
|
|
||||||
public decimal Discount { get; set; }
|
public decimal Discount { get; set; }
|
||||||
|
|
||||||
public int Units { get; set; }
|
public int Units { get; set; }
|
||||||
|
|
||||||
public string PictureUrl { get; set; }
|
public string PictureUrl { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,16 @@
|
|||||||
|
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models
|
||||||
|
{
|
||||||
|
|
||||||
|
public class UpdateBasketItemData
|
||||||
|
{
|
||||||
|
public string BasketItemId { get; set; }
|
||||||
|
|
||||||
|
public int NewQty { get; set; }
|
||||||
|
|
||||||
|
public UpdateBasketItemData()
|
||||||
|
{
|
||||||
|
NewQty = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,13 +1,10 @@
|
|||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models
|
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models
|
||||||
{
|
{
|
||||||
|
|
||||||
public class UpdateBasketItemsRequest
|
public class UpdateBasketItemsRequest
|
||||||
{
|
{
|
||||||
|
|
||||||
public string BasketId { get; set; }
|
public string BasketId { get; set; }
|
||||||
|
|
||||||
public ICollection<UpdateBasketItemData> Updates { get; set; }
|
public ICollection<UpdateBasketItemData> Updates { get; set; }
|
||||||
@ -18,14 +15,4 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class UpdateBasketItemData
|
|
||||||
{
|
|
||||||
public string BasketItemId { get; set; }
|
|
||||||
public int NewQty { get; set; }
|
|
||||||
|
|
||||||
public UpdateBasketItemData()
|
|
||||||
{
|
|
||||||
NewQty = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models
|
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models
|
||||||
{
|
{
|
||||||
|
|
||||||
public class UpdateBasketRequest
|
public class UpdateBasketRequest
|
||||||
{
|
{
|
||||||
public string BuyerId { get; set; }
|
public string BuyerId { get; set; }
|
||||||
@ -12,10 +10,4 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models
|
|||||||
public IEnumerable<UpdateBasketRequestItemData> Items { get; set; }
|
public IEnumerable<UpdateBasketRequestItemData> Items { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class UpdateBasketRequestItemData
|
|
||||||
{
|
|
||||||
public string Id { get; set; } // Basket id
|
|
||||||
public int ProductId { get; set; } // Catalog item id
|
|
||||||
public int Quantity { get; set; } // Quantity
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,11 @@
|
|||||||
|
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models
|
||||||
|
{
|
||||||
|
public class UpdateBasketRequestItemData
|
||||||
|
{
|
||||||
|
public string Id { get; set; } // Basket id
|
||||||
|
|
||||||
|
public int ProductId { get; set; } // Catalog item id
|
||||||
|
|
||||||
|
public int Quantity { get; set; } // Quantity
|
||||||
|
}
|
||||||
|
}
|
@ -1,12 +1,11 @@
|
|||||||
using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Config;
|
using GrpcBasket;
|
||||||
|
using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Config;
|
||||||
using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models;
|
using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Grpc.Net.Client;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using GrpcBasket;
|
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services
|
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services
|
||||||
{
|
{
|
||||||
|
@ -1,15 +1,13 @@
|
|||||||
using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Config;
|
using CatalogApi;
|
||||||
|
using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Config;
|
||||||
using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models;
|
using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using CatalogApi;
|
|
||||||
using Grpc.Net.Client;
|
|
||||||
using System;
|
|
||||||
using static CatalogApi.Catalog;
|
using static CatalogApi.Catalog;
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services
|
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services
|
||||||
{
|
{
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
using System.Threading.Tasks;
|
using Grpc.Core;
|
||||||
using System;
|
|
||||||
using Grpc.Core;
|
|
||||||
using Serilog;
|
|
||||||
using Grpc.Net.Client;
|
using Grpc.Net.Client;
|
||||||
|
using Serilog;
|
||||||
|
using System;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services
|
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services
|
||||||
{
|
{
|
||||||
|
@ -1,14 +1,11 @@
|
|||||||
using Grpc.Net.Client;
|
using GrpcOrdering;
|
||||||
using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Config;
|
using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Config;
|
||||||
using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models;
|
using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
using System;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using GrpcOrdering;
|
|
||||||
using Grpc.Core;
|
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services
|
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services
|
||||||
{
|
{
|
||||||
|
@ -5,7 +5,6 @@ using Microsoft.AspNetCore.Builder;
|
|||||||
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
|
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Config;
|
using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Config;
|
||||||
using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Filters.Basket.API.Infrastructure.Filters;
|
using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Filters.Basket.API.Infrastructure.Filters;
|
||||||
using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Infrastructure;
|
using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Infrastructure;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user