Removed unused using, Reorganized using, moved the class to separate file, removed commented code in Catalog.API
This commit is contained in:
parent
b8431fa9e2
commit
34241c4306
@ -1,9 +1,9 @@
|
|||||||
using System;
|
using Microsoft.AspNetCore.Builder;
|
||||||
using Microsoft.AspNetCore.Builder;
|
|
||||||
using Microsoft.AspNetCore.Routing;
|
using Microsoft.AspNetCore.Routing;
|
||||||
using Microsoft.eShopOnContainers.Services.Basket.API;
|
using Microsoft.eShopOnContainers.Services.Basket.API;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace Basket.FunctionalTests.Base
|
namespace Basket.FunctionalTests.Base
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
namespace Microsoft.eShopOnContainers.Services.Catalog.API
|
namespace Microsoft.eShopOnContainers.Services.Catalog.API
|
||||||
{
|
{
|
||||||
|
|
||||||
public class CatalogSettings
|
public class CatalogSettings
|
||||||
{
|
{
|
||||||
public string PicBaseUrl { get; set; }
|
public string PicBaseUrl { get; set; }
|
||||||
@ -7,6 +8,8 @@
|
|||||||
public string EventBusConnection { get; set; }
|
public string EventBusConnection { get; set; }
|
||||||
|
|
||||||
public bool UseCustomizationData { get; set; }
|
public bool UseCustomizationData { get; set; }
|
||||||
|
|
||||||
public bool AzureStorageEnabled { get; set; }
|
public bool AzureStorageEnabled { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,4 @@
|
|||||||
using System;
|
namespace Microsoft.eShopOnContainers.Services.Catalog.API.Model
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Services.Catalog.API.Model
|
|
||||||
{
|
{
|
||||||
public static class CatalogItemExtensions
|
public static class CatalogItemExtensions
|
||||||
{
|
{
|
||||||
|
@ -1,13 +1,10 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.Hosting;
|
|
||||||
using System;
|
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using System.Collections.Generic;
|
using Microsoft.Extensions.Hosting;
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Polly;
|
using Polly;
|
||||||
|
using System;
|
||||||
using System.Data.SqlClient;
|
using System.Data.SqlClient;
|
||||||
|
|
||||||
namespace Catalog.API.Extensions
|
namespace Catalog.API.Extensions
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using System;
|
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Polly;
|
using Polly;
|
||||||
|
using System;
|
||||||
using System.Data.SqlClient;
|
using System.Data.SqlClient;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
|
||||||
|
|
||||||
namespace Catalog.API.Extensions
|
namespace Catalog.API.Extensions
|
||||||
{
|
{
|
||||||
|
@ -1,16 +1,15 @@
|
|||||||
using System;
|
using CatalogApi;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using CatalogApi;
|
|
||||||
using Grpc.Core;
|
using Grpc.Core;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.eShopOnContainers.Services.Catalog.API;
|
using Microsoft.eShopOnContainers.Services.Catalog.API;
|
||||||
using Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure;
|
using Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure;
|
||||||
using Microsoft.eShopOnContainers.Services.Catalog.API.Model;
|
using Microsoft.eShopOnContainers.Services.Catalog.API.Model;
|
||||||
using Microsoft.eShopOnContainers.Services.Catalog.API.ViewModel;
|
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using static CatalogApi.Catalog;
|
using static CatalogApi.Catalog;
|
||||||
|
|
||||||
namespace Catalog.API.Grpc
|
namespace Catalog.API.Grpc
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
namespace Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure
|
namespace Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure
|
||||||
{
|
{
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using EntityConfigurations;
|
using EntityConfigurations;
|
||||||
using Model;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Design;
|
using Microsoft.EntityFrameworkCore.Design;
|
||||||
|
using Model;
|
||||||
|
|
||||||
public class CatalogContext : DbContext
|
public class CatalogContext : DbContext
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Storage;
|
|
||||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
|
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
|
||||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
|
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
|
||||||
using Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF.Services;
|
using Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF.Services;
|
||||||
@ -7,7 +6,6 @@ using Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF.Utilities
|
|||||||
using Microsoft.eShopOnContainers.Services.Catalog.API;
|
using Microsoft.eShopOnContainers.Services.Catalog.API;
|
||||||
using Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure;
|
using Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Serilog.Context;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Data.Common;
|
using System.Data.Common;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
namespace Microsoft.eShopOnContainers.Services.Catalog.API.IntegrationEvents.EventHandling
|
namespace Microsoft.eShopOnContainers.Services.Catalog.API.IntegrationEvents.EventHandling
|
||||||
{
|
{
|
||||||
using BuildingBlocks.EventBus.Abstractions;
|
using BuildingBlocks.EventBus.Abstractions;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using BuildingBlocks.EventBus.Events;
|
using BuildingBlocks.EventBus.Events;
|
||||||
|
using global::Catalog.API.IntegrationEvents;
|
||||||
using Infrastructure;
|
using Infrastructure;
|
||||||
|
using IntegrationEvents.Events;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Serilog.Context;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using global::Catalog.API.IntegrationEvents;
|
using System.Threading.Tasks;
|
||||||
using IntegrationEvents.Events;
|
|
||||||
using Serilog.Context;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
|
|
||||||
public class OrderStatusChangedToAwaitingValidationIntegrationEventHandler :
|
public class OrderStatusChangedToAwaitingValidationIntegrationEventHandler :
|
||||||
IIntegrationEventHandler<OrderStatusChangedToAwaitingValidationIntegrationEvent>
|
IIntegrationEventHandler<OrderStatusChangedToAwaitingValidationIntegrationEvent>
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
namespace Microsoft.eShopOnContainers.Services.Catalog.API.IntegrationEvents.EventHandling
|
namespace Microsoft.eShopOnContainers.Services.Catalog.API.IntegrationEvents.EventHandling
|
||||||
{
|
{
|
||||||
using BuildingBlocks.EventBus.Abstractions;
|
using BuildingBlocks.EventBus.Abstractions;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Infrastructure;
|
using Infrastructure;
|
||||||
using Microsoft.eShopOnContainers.Services.Catalog.API.IntegrationEvents.Events;
|
using Microsoft.eShopOnContainers.Services.Catalog.API.IntegrationEvents.Events;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Serilog.Context;
|
using Serilog.Context;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
public class OrderStatusChangedToPaidIntegrationEventHandler :
|
public class OrderStatusChangedToPaidIntegrationEventHandler :
|
||||||
IIntegrationEventHandler<OrderStatusChangedToPaidIntegrationEvent>
|
IIntegrationEventHandler<OrderStatusChangedToPaidIntegrationEvent>
|
||||||
|
@ -16,15 +16,4 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class OrderStockItem
|
|
||||||
{
|
|
||||||
public int ProductId { get; }
|
|
||||||
public int Units { get; }
|
|
||||||
|
|
||||||
public OrderStockItem(int productId, int units)
|
|
||||||
{
|
|
||||||
ProductId = productId;
|
|
||||||
Units = units;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
namespace Microsoft.eShopOnContainers.Services.Catalog.API.IntegrationEvents.Events
|
||||||
|
{
|
||||||
|
public class OrderStockItem
|
||||||
|
{
|
||||||
|
public int ProductId { get; }
|
||||||
|
public int Units { get; }
|
||||||
|
|
||||||
|
public OrderStockItem(int productId, int units)
|
||||||
|
{
|
||||||
|
ProductId = productId;
|
||||||
|
Units = units;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,4 @@
|
|||||||
using Autofac.Extensions.DependencyInjection;
|
using Catalog.API.Extensions;
|
||||||
using Catalog.API.Extensions;
|
|
||||||
using Microsoft.AspNetCore;
|
using Microsoft.AspNetCore;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.AspNetCore.Server.Kestrel.Core;
|
using Microsoft.AspNetCore.Server.Kestrel.Core;
|
||||||
@ -12,9 +11,7 @@ using Microsoft.Extensions.Logging;
|
|||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Services.Catalog.API
|
namespace Microsoft.eShopOnContainers.Services.Catalog.API
|
||||||
|
@ -1,60 +1,69 @@
|
|||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
|
|
||||||
/* >>
|
|
||||||
import "google/api/annotations.proto";
|
|
||||||
<< */
|
|
||||||
|
|
||||||
|
|
||||||
package CatalogApi;
|
package CatalogApi;
|
||||||
|
|
||||||
message CatalogItemRequest {
|
message CatalogItemRequest {
|
||||||
int32 id = 1;
|
int32 id = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
message CatalogItemsRequest {
|
message CatalogItemsRequest {
|
||||||
string ids = 1;
|
string ids = 1;
|
||||||
|
|
||||||
int32 pageSize = 2;
|
int32 pageSize = 2;
|
||||||
|
|
||||||
int32 pageIndex = 3;
|
int32 pageIndex = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
message CatalogItemResponse {
|
message CatalogItemResponse {
|
||||||
int32 id = 1;
|
int32 id = 1;
|
||||||
|
|
||||||
string name = 2;
|
string name = 2;
|
||||||
|
|
||||||
string description=3;
|
string description=3;
|
||||||
|
|
||||||
double price=4;
|
double price=4;
|
||||||
|
|
||||||
string picture_file_name=5;
|
string picture_file_name=5;
|
||||||
|
|
||||||
string picture_uri=6;
|
string picture_uri=6;
|
||||||
|
|
||||||
CatalogType catalog_type=8;
|
CatalogType catalog_type=8;
|
||||||
|
|
||||||
CatalogBrand catalog_brand=10;
|
CatalogBrand catalog_brand=10;
|
||||||
|
|
||||||
int32 available_stock=11;
|
int32 available_stock=11;
|
||||||
|
|
||||||
int32 restock_threshold=12;
|
int32 restock_threshold=12;
|
||||||
|
|
||||||
int32 max_stock_threshold=13;
|
int32 max_stock_threshold=13;
|
||||||
|
|
||||||
bool on_reorder=14;
|
bool on_reorder=14;
|
||||||
}
|
}
|
||||||
|
|
||||||
message CatalogBrand {
|
message CatalogBrand {
|
||||||
int32 id = 1;
|
int32 id = 1;
|
||||||
|
|
||||||
string name = 2;
|
string name = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
message CatalogType {
|
message CatalogType {
|
||||||
int32 id = 1;
|
int32 id = 1;
|
||||||
|
|
||||||
string type = 2;
|
string type = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
message PaginatedItemsResponse {
|
message PaginatedItemsResponse {
|
||||||
int32 pageIndex = 1;
|
int32 pageIndex = 1;
|
||||||
|
|
||||||
int32 pageSize = 2;
|
int32 pageSize = 2;
|
||||||
|
|
||||||
int64 count = 3;
|
int64 count = 3;
|
||||||
|
|
||||||
repeated CatalogItemResponse data = 4;
|
repeated CatalogItemResponse data = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
service Catalog {
|
service Catalog {
|
||||||
rpc GetItemById (CatalogItemRequest) returns (CatalogItemResponse) {
|
rpc GetItemById (CatalogItemRequest) returns (CatalogItemResponse) {}
|
||||||
/* >>
|
|
||||||
option (google.api.http) = {
|
|
||||||
get: "/api/v1/catalog/items/{id}"
|
|
||||||
};
|
|
||||||
<< */
|
|
||||||
}
|
|
||||||
rpc GetItemsByIds (CatalogItemsRequest) returns (PaginatedItemsResponse) {}
|
rpc GetItemsByIds (CatalogItemsRequest) returns (PaginatedItemsResponse) {}
|
||||||
}
|
}
|
@ -11,7 +11,6 @@ using Microsoft.AspNetCore.Http;
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.Azure.ServiceBus;
|
using Microsoft.Azure.ServiceBus;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Diagnostics;
|
|
||||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus;
|
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus;
|
||||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
|
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
|
||||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ;
|
using Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user