Implemented service bus for marketing.api locations.api graceperiodProcess payment.api
This commit is contained in:
parent
a56f99f684
commit
f993463856
10
.env
10
.env
@ -6,3 +6,13 @@
|
|||||||
|
|
||||||
ESHOP_EXTERNAL_DNS_NAME_OR_IP=localhost
|
ESHOP_EXTERNAL_DNS_NAME_OR_IP=localhost
|
||||||
ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP=10.121.122.92
|
ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP=10.121.122.92
|
||||||
|
|
||||||
|
ESHOP_AZURE_REDIS_BASKET_DB=eshopredisez55a72p6wm62.redis.cache.windows.net:6379,password=RnA4HSjsZY24c+BOVLopWI5lQI5njw1WliiRz3U5Om0=,ssl=False,abortConnect=False
|
||||||
|
ESHOP_AZURE_STORAGE_ACCOUNT=https://catalogez55a72p6wm62.blob.core.windows.net/pics/
|
||||||
|
ESHOP_AZURE_SERVICE_BUS=Endpoint=sb://eshopsbez55a72p6wm62.servicebus.windows.net/;SharedAccessKeyName=Root;SharedAccessKey=Jd6iRe3rzTWgMXDDdyUz/AcL6YxLzb8X9afSNPnq50k=;EntityPath=eshop_event_bus
|
||||||
|
ESHOP_AZURE_COSMOSDB=mongodb://eshop-nosqlez55a72p6wm62:l8jMNoLHFXOijAvaVMjHeCwHK8gAR9SovuK86uCOvwfnMhuhwytPKByOPqrQrlsDz9RPFet2J6SzEbBQXLZokA==@eshop-nosqlez55a72p6wm62.documents.azure.com:10255/?ssl=true&replicaSet=globaldb
|
||||||
|
ESHOP_AZURE_CATALOG_DB=Server=tcp:eshopsql-ez55a72p6wm62.database.windows.net,1433;Initial Catalog=catalogdb;Persist Security Info=False;User ID=eshop;Password=Pass@word!;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;
|
||||||
|
ESHOP_AZURE_IDENTITY_DB=Server=tcp:eshopsql-ez55a72p6wm62.database.windows.net,1433;Initial Catalog=identitydb;Persist Security Info=False;User ID=eshop;Password=Pass@word!;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;
|
||||||
|
ESHOP_AZURE_ORDERING_DB=Server=tcp:eshopsql-ez55a72p6wm62.database.windows.net,1433;Initial Catalog=orderingdb;Persist Security Info=False;User ID=eshop;Password=Pass@word!;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;
|
||||||
|
ESHOP_AZURE_MARKETING_DB=Server=tcp:eshopsql-ez55a72p6wm62.database.windows.net,1433;Initial Catalog=marketingdb;Persist Security Info=False;User ID=eshop;Password=Pass@word!;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;
|
||||||
|
ESHOP_AZUREFUNC_CAMPAIGN_DETAILS_URI=https://marketing-functions.azurewebsites.net/api/MarketingDetailsHttpTrigger?code=LhqDGSKZIHM0vwBwjHHRv6umvcuRqEtB0m8laxPkb1g1IycLyWmW1A==
|
@ -14,6 +14,10 @@
|
|||||||
"BasketSubscriptionName": "Basket",
|
"BasketSubscriptionName": "Basket",
|
||||||
"CatalogSubscriptionName": "Catalog",
|
"CatalogSubscriptionName": "Catalog",
|
||||||
"OrderingSubscriptionName": "Ordering",
|
"OrderingSubscriptionName": "Ordering",
|
||||||
|
"LocationsSubscriptionName": "Locations",
|
||||||
|
"MarketingSubscriptionName": "Marketing",
|
||||||
|
"GracePeriodSubscriptionName": "GracePeriod",
|
||||||
|
"PaymentSubscriptionName": "Payment",
|
||||||
"location": "[resourceGroup().location]",
|
"location": "[resourceGroup().location]",
|
||||||
"sbVersion": "2015-08-01",
|
"sbVersion": "2015-08-01",
|
||||||
"defaultSASKeyName": "Root",
|
"defaultSASKeyName": "Root",
|
||||||
@ -130,6 +134,86 @@
|
|||||||
"autoDeleteOnIdle": "10675199.02:48:05.4775807",
|
"autoDeleteOnIdle": "10675199.02:48:05.4775807",
|
||||||
"entityAvailabilityStatus": "Available"
|
"entityAvailabilityStatus": "Available"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"apiVersion": "[variables('sbVersion')]",
|
||||||
|
"name": "[variables('LocationsSubscriptionName')]",
|
||||||
|
"type": "Subscriptions",
|
||||||
|
"dependsOn": [
|
||||||
|
"[variables('serviceBusTopicName')]"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"lockDuration": "00:00:30",
|
||||||
|
"requiresSession": false,
|
||||||
|
"defaultMessageTimeToLive": "14.00:00:00",
|
||||||
|
"deadLetteringOnMessageExpiration": true,
|
||||||
|
"deadLetteringOnFilterEvaluationExceptions": true,
|
||||||
|
"maxDeliveryCount": 10,
|
||||||
|
"enableBatchedOperations": false,
|
||||||
|
"status": "Active",
|
||||||
|
"autoDeleteOnIdle": "10675199.02:48:05.4775807",
|
||||||
|
"entityAvailabilityStatus": "Available"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"apiVersion": "[variables('sbVersion')]",
|
||||||
|
"name": "[variables('MarketingSubscriptionName')]",
|
||||||
|
"type": "Subscriptions",
|
||||||
|
"dependsOn": [
|
||||||
|
"[variables('serviceBusTopicName')]"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"lockDuration": "00:00:30",
|
||||||
|
"requiresSession": false,
|
||||||
|
"defaultMessageTimeToLive": "14.00:00:00",
|
||||||
|
"deadLetteringOnMessageExpiration": true,
|
||||||
|
"deadLetteringOnFilterEvaluationExceptions": true,
|
||||||
|
"maxDeliveryCount": 10,
|
||||||
|
"enableBatchedOperations": false,
|
||||||
|
"status": "Active",
|
||||||
|
"autoDeleteOnIdle": "10675199.02:48:05.4775807",
|
||||||
|
"entityAvailabilityStatus": "Available"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"apiVersion": "[variables('sbVersion')]",
|
||||||
|
"name": "[variables('GracePeriodSubscriptionName')]",
|
||||||
|
"type": "Subscriptions",
|
||||||
|
"dependsOn": [
|
||||||
|
"[variables('serviceBusTopicName')]"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"lockDuration": "00:00:30",
|
||||||
|
"requiresSession": false,
|
||||||
|
"defaultMessageTimeToLive": "14.00:00:00",
|
||||||
|
"deadLetteringOnMessageExpiration": true,
|
||||||
|
"deadLetteringOnFilterEvaluationExceptions": true,
|
||||||
|
"maxDeliveryCount": 10,
|
||||||
|
"enableBatchedOperations": false,
|
||||||
|
"status": "Active",
|
||||||
|
"autoDeleteOnIdle": "10675199.02:48:05.4775807",
|
||||||
|
"entityAvailabilityStatus": "Available"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"apiVersion": "[variables('sbVersion')]",
|
||||||
|
"name": "[variables('PaymentSubscriptionName')]",
|
||||||
|
"type": "Subscriptions",
|
||||||
|
"dependsOn": [
|
||||||
|
"[variables('serviceBusTopicName')]"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"lockDuration": "00:00:30",
|
||||||
|
"requiresSession": false,
|
||||||
|
"defaultMessageTimeToLive": "14.00:00:00",
|
||||||
|
"deadLetteringOnMessageExpiration": true,
|
||||||
|
"deadLetteringOnFilterEvaluationExceptions": true,
|
||||||
|
"maxDeliveryCount": 10,
|
||||||
|
"enableBatchedOperations": false,
|
||||||
|
"status": "Active",
|
||||||
|
"autoDeleteOnIdle": "10675199.02:48:05.4775807",
|
||||||
|
"entityAvailabilityStatus": "Available"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
<DockerLaunchBrowser>True</DockerLaunchBrowser>
|
<DockerLaunchBrowser>True</DockerLaunchBrowser>
|
||||||
<DockerServiceUrl>http://localhost:5100</DockerServiceUrl>
|
<DockerServiceUrl>http://localhost:5100</DockerServiceUrl>
|
||||||
<DockerServiceName>webmvc</DockerServiceName>
|
<DockerServiceName>webmvc</DockerServiceName>
|
||||||
|
<DockerTargetOS>Linux</DockerTargetOS>
|
||||||
|
<ProjectVersion>2.0</ProjectVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="docker-compose.ci.build.yml" />
|
<None Include="docker-compose.ci.build.yml" />
|
||||||
@ -14,12 +16,6 @@
|
|||||||
<None Include="docker-compose.prod.yml">
|
<None Include="docker-compose.prod.yml">
|
||||||
<DependentUpon>docker-compose.yml</DependentUpon>
|
<DependentUpon>docker-compose.yml</DependentUpon>
|
||||||
</None>
|
</None>
|
||||||
<None Include="docker-compose.vs.debug.yml">
|
|
||||||
<DependentUpon>docker-compose.yml</DependentUpon>
|
|
||||||
</None>
|
|
||||||
<None Include="docker-compose.vs.release.yml">
|
|
||||||
<DependentUpon>docker-compose.yml</DependentUpon>
|
|
||||||
</None>
|
|
||||||
<None Include="docker-compose.yml" />
|
<None Include="docker-compose.yml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
@ -9,14 +9,14 @@ version: '3'
|
|||||||
services:
|
services:
|
||||||
graceperiodmanager:
|
graceperiodmanager:
|
||||||
environment:
|
environment:
|
||||||
- ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word
|
- ConnectionString=${ESHOP_AZURE_ORDERING_DB:-Server=sql.data;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word}
|
||||||
- EventBusConnection=rabbitmq
|
- EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq}
|
||||||
|
|
||||||
basket.api:
|
basket.api:
|
||||||
environment:
|
environment:
|
||||||
- ASPNETCORE_ENVIRONMENT=Development
|
- ASPNETCORE_ENVIRONMENT=Development
|
||||||
- ASPNETCORE_URLS=http://0.0.0.0:80
|
- ASPNETCORE_URLS=http://0.0.0.0:80
|
||||||
- ConnectionString=${ESHOP_AZURE_REDIS:-basket.data}
|
- ConnectionString=${ESHOP_AZURE_REDIS_BASKET_DB:-basket.data}
|
||||||
- identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105.
|
- identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105.
|
||||||
- EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq}
|
- EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq}
|
||||||
ports:
|
ports:
|
||||||
@ -26,7 +26,7 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
- ASPNETCORE_ENVIRONMENT=Development
|
- ASPNETCORE_ENVIRONMENT=Development
|
||||||
- ASPNETCORE_URLS=http://0.0.0.0:80
|
- ASPNETCORE_URLS=http://0.0.0.0:80
|
||||||
- ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word
|
- ConnectionString=${ESHOP_AZURE_CATALOG_DB:-Server=sql.data;Database=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word}
|
||||||
- PicBaseUrl=${ESHOP_AZURE_STORAGE_ACCOUNT:-http://localhost:5101/api/v1/pic/} #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105.
|
- PicBaseUrl=${ESHOP_AZURE_STORAGE_ACCOUNT:-http://localhost:5101/api/v1/pic/} #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105.
|
||||||
- EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq}
|
- EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq}
|
||||||
ports:
|
ports:
|
||||||
@ -38,7 +38,7 @@ services:
|
|||||||
- ASPNETCORE_URLS=http://0.0.0.0:80
|
- ASPNETCORE_URLS=http://0.0.0.0:80
|
||||||
- SpaClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5104
|
- SpaClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5104
|
||||||
- XamarinCallback=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5105/xamarincallback #localhost do not work for UWP login, so we have to use "external" IP always
|
- XamarinCallback=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5105/xamarincallback #localhost do not work for UWP login, so we have to use "external" IP always
|
||||||
- ConnectionStrings__DefaultConnection=Server=sql.data;Database=Microsoft.eShopOnContainers.Service.IdentityDb;User Id=sa;Password=Pass@word
|
- ConnectionStrings__DefaultConnection=${ESHOP_AZURE_IDENTITY_DB:-Server=sql.data;Database=Microsoft.eShopOnContainers.Service.IdentityDb;User Id=sa;Password=Pass@word}
|
||||||
- MvcClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5100 #Local: You need to open your local dev-machine firewall at range 5100-5105.
|
- MvcClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5100 #Local: You need to open your local dev-machine firewall at range 5100-5105.
|
||||||
ports:
|
ports:
|
||||||
- "5105:80"
|
- "5105:80"
|
||||||
@ -47,7 +47,7 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
- ASPNETCORE_ENVIRONMENT=Development
|
- ASPNETCORE_ENVIRONMENT=Development
|
||||||
- ASPNETCORE_URLS=http://0.0.0.0:80
|
- ASPNETCORE_URLS=http://0.0.0.0:80
|
||||||
- ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word
|
- ConnectionString=${ESHOP_AZURE_ORDERING_DB:-Server=sql.data;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word}
|
||||||
- identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105.
|
- identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105.
|
||||||
- EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq}
|
- EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq}
|
||||||
ports:
|
ports:
|
||||||
@ -57,12 +57,13 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
- ASPNETCORE_ENVIRONMENT=Development
|
- ASPNETCORE_ENVIRONMENT=Development
|
||||||
- ASPNETCORE_URLS=http://0.0.0.0:80
|
- ASPNETCORE_URLS=http://0.0.0.0:80
|
||||||
- ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.MarketingDb;User Id=sa;Password=Pass@word
|
- ConnectionString=${ESHOP_AZURE_MARKETING_DB:-Server=sql.data;Database=Microsoft.eShopOnContainers.Services.MarketingDb;User Id=sa;Password=Pass@word}
|
||||||
- MongoConnectionString=mongodb://nosql.data
|
- MongoConnectionString=${ESHOP_AZURE_COSMOSDB:-mongodb://nosql.data}
|
||||||
- MongoDatabase=MarketingDb
|
- MongoDatabase=MarketingDb
|
||||||
- EventBusConnection=rabbitmq
|
- EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq}
|
||||||
- ExternalCatalogBaseUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5110 #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105.
|
- ExternalCatalogBaseUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5110 #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105.
|
||||||
- identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105.
|
- identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105.
|
||||||
|
- CampaignDetailFunctionUri=${ESHOP_AZUREFUNC_CAMPAIGN_DETAILS_URI}
|
||||||
ports:
|
ports:
|
||||||
- "5110:80"
|
- "5110:80"
|
||||||
|
|
||||||
@ -123,7 +124,7 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
- ASPNETCORE_ENVIRONMENT=Development
|
- ASPNETCORE_ENVIRONMENT=Development
|
||||||
- ASPNETCORE_URLS=http://0.0.0.0:5108
|
- ASPNETCORE_URLS=http://0.0.0.0:5108
|
||||||
- EventBusConnection=rabbitmq
|
- EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq}
|
||||||
ports:
|
ports:
|
||||||
- "5108:80"
|
- "5108:80"
|
||||||
|
|
||||||
@ -131,9 +132,9 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
- ASPNETCORE_ENVIRONMENT=Development
|
- ASPNETCORE_ENVIRONMENT=Development
|
||||||
- ASPNETCORE_URLS=http://0.0.0.0:80
|
- ASPNETCORE_URLS=http://0.0.0.0:80
|
||||||
- ConnectionString=mongodb://nosql.data
|
- ConnectionString=${ESHOP_AZURE_COSMOSDB:-mongodb://nosql.data}
|
||||||
- Database=LocationsDb
|
- Database=LocationsDb
|
||||||
- identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105.
|
- identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105.
|
||||||
- EventBusConnection=rabbitmq
|
- EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq}
|
||||||
ports:
|
ports:
|
||||||
- "5109:80"
|
- "5109:80"
|
||||||
|
@ -1,166 +0,0 @@
|
|||||||
version: '3'
|
|
||||||
|
|
||||||
services:
|
|
||||||
basket.api:
|
|
||||||
image: eshop/basket.api:dev
|
|
||||||
build:
|
|
||||||
args:
|
|
||||||
source: ${DOCKER_BUILD_SOURCE}
|
|
||||||
environment:
|
|
||||||
- DOTNET_USE_POLLING_FILE_WATCHER=1
|
|
||||||
volumes:
|
|
||||||
- ./src/Services/Basket/Basket.API:/app
|
|
||||||
- ~/.nuget/packages:/root/.nuget/packages:ro
|
|
||||||
- ~/clrdbg:/clrdbg:ro
|
|
||||||
entrypoint: tail -f /dev/null
|
|
||||||
labels:
|
|
||||||
- "com.microsoft.visualstudio.targetoperatingsystem=linux"
|
|
||||||
|
|
||||||
catalog.api:
|
|
||||||
image: eshop/catalog.api:dev
|
|
||||||
build:
|
|
||||||
args:
|
|
||||||
source: ${DOCKER_BUILD_SOURCE}
|
|
||||||
environment:
|
|
||||||
- DOTNET_USE_POLLING_FILE_WATCHER=1
|
|
||||||
volumes:
|
|
||||||
- ./src/Services/Catalog/Catalog.API:/app
|
|
||||||
- ~/.nuget/packages:/root/.nuget/packages:ro
|
|
||||||
- ~/clrdbg:/clrdbg:ro
|
|
||||||
entrypoint: tail -f /dev/null
|
|
||||||
labels:
|
|
||||||
- "com.microsoft.visualstudio.targetoperatingsystem=linux"
|
|
||||||
|
|
||||||
identity.api:
|
|
||||||
image: eshop/identity.api:dev
|
|
||||||
build:
|
|
||||||
args:
|
|
||||||
source: ${DOCKER_BUILD_SOURCE}
|
|
||||||
environment:
|
|
||||||
- DOTNET_USE_POLLING_FILE_WATCHER=1
|
|
||||||
volumes:
|
|
||||||
- ./src/Services/Identity/Identity.API:/app
|
|
||||||
- ~/.nuget/packages:/root/.nuget/packages:ro
|
|
||||||
- ~/clrdbg:/clrdbg:ro
|
|
||||||
entrypoint: tail -f /dev/null
|
|
||||||
labels:
|
|
||||||
- "com.microsoft.visualstudio.targetoperatingsystem=linux"
|
|
||||||
|
|
||||||
ordering.api:
|
|
||||||
image: eshop/ordering.api:dev
|
|
||||||
build:
|
|
||||||
args:
|
|
||||||
source: ${DOCKER_BUILD_SOURCE}
|
|
||||||
environment:
|
|
||||||
- DOTNET_USE_POLLING_FILE_WATCHER=1
|
|
||||||
volumes:
|
|
||||||
- ./src/Services/Ordering/Ordering.API:/app
|
|
||||||
- ~/.nuget/packages:/root/.nuget/packages:ro
|
|
||||||
- ~/clrdbg:/clrdbg:ro
|
|
||||||
entrypoint: tail -f /dev/null
|
|
||||||
labels:
|
|
||||||
- "com.microsoft.visualstudio.targetoperatingsystem=linux"
|
|
||||||
|
|
||||||
marketing.api:
|
|
||||||
image: eshop/marketing.api:dev
|
|
||||||
build:
|
|
||||||
args:
|
|
||||||
source: ${DOCKER_BUILD_SOURCE}
|
|
||||||
environment:
|
|
||||||
- DOTNET_USE_POLLING_FILE_WATCHER=1
|
|
||||||
volumes:
|
|
||||||
- ./src/Services/Marketing/Marketing.API:/app
|
|
||||||
- ~/.nuget/packages:/root/.nuget/packages:ro
|
|
||||||
- ~/clrdbg:/clrdbg:ro
|
|
||||||
entrypoint: tail -f /dev/null
|
|
||||||
labels:
|
|
||||||
- "com.microsoft.visualstudio.targetoperatingsystem=linux"
|
|
||||||
|
|
||||||
|
|
||||||
webspa:
|
|
||||||
image: eshop/webspa:dev
|
|
||||||
build:
|
|
||||||
args:
|
|
||||||
source: ${DOCKER_BUILD_SOURCE}
|
|
||||||
environment:
|
|
||||||
- DOTNET_USE_POLLING_FILE_WATCHER=1
|
|
||||||
volumes:
|
|
||||||
- ./src/Web/WebSPA:/app
|
|
||||||
- ~/.nuget/packages:/root/.nuget/packages:ro
|
|
||||||
- ~/clrdbg:/clrdbg:ro
|
|
||||||
entrypoint: tail -f /dev/null
|
|
||||||
labels:
|
|
||||||
- "com.microsoft.visualstudio.targetoperatingsystem=linux"
|
|
||||||
|
|
||||||
webmvc:
|
|
||||||
image: eshop/webmvc:dev
|
|
||||||
build:
|
|
||||||
args:
|
|
||||||
source: ${DOCKER_BUILD_SOURCE}
|
|
||||||
environment:
|
|
||||||
- DOTNET_USE_POLLING_FILE_WATCHER=1
|
|
||||||
volumes:
|
|
||||||
- ./src/Web/WebMVC:/app
|
|
||||||
- ~/.nuget/packages:/root/.nuget/packages:ro
|
|
||||||
- ~/clrdbg:/clrdbg:ro
|
|
||||||
entrypoint: tail -f /dev/null
|
|
||||||
labels:
|
|
||||||
- "com.microsoft.visualstudio.targetoperatingsystem=linux"
|
|
||||||
|
|
||||||
webstatus:
|
|
||||||
image: eshop/webstatus:dev
|
|
||||||
build:
|
|
||||||
args:
|
|
||||||
source: ${DOCKER_BUILD_SOURCE}
|
|
||||||
environment:
|
|
||||||
- DOTNET_USE_POLLING_FILE_WATCHER=1
|
|
||||||
volumes:
|
|
||||||
- ./src/Web/WebStatus:/app
|
|
||||||
- ~/.nuget/packages:/root/.nuget/packages:ro
|
|
||||||
- ~/clrdbg:/clrdbg:ro
|
|
||||||
entrypoint: tail -f /dev/null
|
|
||||||
labels:
|
|
||||||
- "com.microsoft.visualstudio.targetoperatingsystem=linux"
|
|
||||||
|
|
||||||
payment.api:
|
|
||||||
image: eshop/payment.api:dev
|
|
||||||
build:
|
|
||||||
args:
|
|
||||||
source: ${DOCKER_BUILD_SOURCE}
|
|
||||||
environment:
|
|
||||||
- DOTNET_USE_POLLING_FILE_WATCHER=1
|
|
||||||
volumes:
|
|
||||||
- ./src/Services/Payment/Payment.API:/app
|
|
||||||
- ~/.nuget/packages:/root/.nuget/packages:ro
|
|
||||||
- ~/clrdbg:/clrdbg:ro
|
|
||||||
entrypoint: tail -f /dev/null
|
|
||||||
labels:
|
|
||||||
- "com.microsoft.visualstudio.targetoperatingsystem=linux"
|
|
||||||
|
|
||||||
graceperiodmanager:
|
|
||||||
image: eshop/graceperiodmanager:dev
|
|
||||||
build:
|
|
||||||
args:
|
|
||||||
source: ${DOCKER_BUILD_SOURCE}
|
|
||||||
volumes:
|
|
||||||
- ./src/Services/GracePeriod/GracePeriodManager:/app
|
|
||||||
- ~/.nuget/packages:/root/.nuget/packages:ro
|
|
||||||
- ~/clrdbg:/clrdbg:ro
|
|
||||||
entrypoint: tail -f /dev/null
|
|
||||||
labels:
|
|
||||||
- "com.microsoft.visualstudio.targetoperatingsystem=linux"
|
|
||||||
|
|
||||||
locations.api:
|
|
||||||
image: eshop/locations.api:dev
|
|
||||||
build:
|
|
||||||
args:
|
|
||||||
source: ${DOCKER_BUILD_SOURCE}
|
|
||||||
environment:
|
|
||||||
- DOTNET_USE_POLLING_FILE_WATCHER=1
|
|
||||||
volumes:
|
|
||||||
- ./src/Services/Location/Locations.API:/app
|
|
||||||
- ~/.nuget/packages:/root/.nuget/packages:ro
|
|
||||||
- ~/clrdbg:/clrdbg:ro
|
|
||||||
entrypoint: tail -f /dev/null
|
|
||||||
labels:
|
|
||||||
- "com.microsoft.visualstudio.targetoperatingsystem=linux"
|
|
@ -1,112 +0,0 @@
|
|||||||
version: '3'
|
|
||||||
|
|
||||||
services:
|
|
||||||
basket.api:
|
|
||||||
build:
|
|
||||||
args:
|
|
||||||
source: ${DOCKER_BUILD_SOURCE}
|
|
||||||
volumes:
|
|
||||||
- ~/clrdbg:/clrdbg:ro
|
|
||||||
entrypoint: tail -f /dev/null
|
|
||||||
labels:
|
|
||||||
- "com.microsoft.visualstudio.targetoperatingsystem=linux"
|
|
||||||
|
|
||||||
catalog.api:
|
|
||||||
build:
|
|
||||||
args:
|
|
||||||
source: ${DOCKER_BUILD_SOURCE}
|
|
||||||
volumes:
|
|
||||||
- ~/clrdbg:/clrdbg:ro
|
|
||||||
entrypoint: tail -f /dev/null
|
|
||||||
labels:
|
|
||||||
- "com.microsoft.visualstudio.targetoperatingsystem=linux"
|
|
||||||
|
|
||||||
identity.api:
|
|
||||||
build:
|
|
||||||
args:
|
|
||||||
source: ${DOCKER_BUILD_SOURCE}
|
|
||||||
volumes:
|
|
||||||
- ~/clrdbg:/clrdbg:ro
|
|
||||||
entrypoint: tail -f /dev/null
|
|
||||||
labels:
|
|
||||||
- "com.microsoft.visualstudio.targetoperatingsystem=linux"
|
|
||||||
|
|
||||||
ordering.api:
|
|
||||||
build:
|
|
||||||
args:
|
|
||||||
source: ${DOCKER_BUILD_SOURCE}
|
|
||||||
volumes:
|
|
||||||
- ~/clrdbg:/clrdbg:ro
|
|
||||||
entrypoint: tail -f /dev/null
|
|
||||||
labels:
|
|
||||||
- "com.microsoft.visualstudio.targetoperatingsystem=linux"
|
|
||||||
|
|
||||||
marketing.api:
|
|
||||||
build:
|
|
||||||
args:
|
|
||||||
source: ${DOCKER_BUILD_SOURCE}
|
|
||||||
volumes:
|
|
||||||
- ~/clrdbg:/clrdbg:ro
|
|
||||||
entrypoint: tail -f /dev/null
|
|
||||||
labels:
|
|
||||||
- "com.microsoft.visualstudio.targetoperatingsystem=linux"
|
|
||||||
|
|
||||||
webspa:
|
|
||||||
build:
|
|
||||||
args:
|
|
||||||
source: ${DOCKER_BUILD_SOURCE}
|
|
||||||
volumes:
|
|
||||||
- ~/clrdbg:/clrdbg:ro
|
|
||||||
entrypoint: tail -f /dev/null
|
|
||||||
labels:
|
|
||||||
- "com.microsoft.visualstudio.targetoperatingsystem=linux"
|
|
||||||
|
|
||||||
webmvc:
|
|
||||||
build:
|
|
||||||
args:
|
|
||||||
source: ${DOCKER_BUILD_SOURCE}
|
|
||||||
volumes:
|
|
||||||
- ~/clrdbg:/clrdbg:ro
|
|
||||||
entrypoint: tail -f /dev/null
|
|
||||||
labels:
|
|
||||||
- "com.microsoft.visualstudio.targetoperatingsystem=linux"
|
|
||||||
|
|
||||||
webstatus:
|
|
||||||
build:
|
|
||||||
args:
|
|
||||||
source: ${DOCKER_BUILD_SOURCE}
|
|
||||||
volumes:
|
|
||||||
- ~/clrdbg:/clrdbg:ro
|
|
||||||
entrypoint: tail -f /dev/null
|
|
||||||
labels:
|
|
||||||
- "com.microsoft.visualstudio.targetoperatingsystem=linux"
|
|
||||||
|
|
||||||
payment.api:
|
|
||||||
build:
|
|
||||||
args:
|
|
||||||
source: ${DOCKER_BUILD_SOURCE}
|
|
||||||
volumes:
|
|
||||||
- ~/clrdbg:/clrdbg:ro
|
|
||||||
entrypoint: tail -f /dev/null
|
|
||||||
labels:
|
|
||||||
- "com.microsoft.visualstudio.targetoperatingsystem=linux"
|
|
||||||
|
|
||||||
graceperiodmanager:
|
|
||||||
build:
|
|
||||||
args:
|
|
||||||
source: ${DOCKER_BUILD_SOURCE}
|
|
||||||
volumes:
|
|
||||||
- ~/clrdbg:/clrdbg:ro
|
|
||||||
entrypoint: tail -f /dev/null
|
|
||||||
labels:
|
|
||||||
- "com.microsoft.visualstudio.targetoperatingsystem=linux"
|
|
||||||
|
|
||||||
locations.api:
|
|
||||||
build:
|
|
||||||
args:
|
|
||||||
source: ${DOCKER_BUILD_SOURCE}
|
|
||||||
volumes:
|
|
||||||
- ~/clrdbg:/clrdbg:ro
|
|
||||||
entrypoint: tail -f /dev/null
|
|
||||||
labels:
|
|
||||||
- "com.microsoft.visualstudio.targetoperatingsystem=linux"
|
|
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio 15
|
# Visual Studio 15
|
||||||
VisualStudioVersion = 15.0.26430.13
|
VisualStudioVersion = 15.0.26608.5
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{932D8224-11F6-4D07-B109-DA28AD288A63}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{932D8224-11F6-4D07-B109-DA28AD288A63}"
|
||||||
EndProject
|
EndProject
|
||||||
@ -98,6 +98,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Marketing.API", "src\Servic
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventBusServiceBus", "src\BuildingBlocks\EventBus\EventBusServiceBus\EventBusServiceBus.csproj", "{69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventBusServiceBus", "src\BuildingBlocks\EventBus\EventBusServiceBus\EventBusServiceBus.csproj", "{69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Infrastructure", "Infrastructure", "{5B1011EC-CEE5-47AA-B336-99381D573679}"
|
||||||
|
EndProject
|
||||||
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AzureFunctions", "AzureFunctions", "{106B787C-2CFF-4484-8C07-D14589859E94}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "marketing-functions", "src\Services\Marketing\Infrastructure\AzureFunctions\marketing-functions.csproj", "{E7F8F7C0-9FE5-4DAB-B510-1F05ADD11E1F}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Ad-Hoc|Any CPU = Ad-Hoc|Any CPU
|
Ad-Hoc|Any CPU = Ad-Hoc|Any CPU
|
||||||
@ -1312,6 +1318,54 @@ Global
|
|||||||
{69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}.Release|x64.Build.0 = Release|Any CPU
|
{69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}.Release|x64.Build.0 = Release|Any CPU
|
||||||
{69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}.Release|x86.ActiveCfg = Release|Any CPU
|
{69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
{69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}.Release|x86.Build.0 = Release|Any CPU
|
{69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8}.Release|x86.Build.0 = Release|Any CPU
|
||||||
|
{E7F8F7C0-9FE5-4DAB-B510-1F05ADD11E1F}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{E7F8F7C0-9FE5-4DAB-B510-1F05ADD11E1F}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{E7F8F7C0-9FE5-4DAB-B510-1F05ADD11E1F}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU
|
||||||
|
{E7F8F7C0-9FE5-4DAB-B510-1F05ADD11E1F}.Ad-Hoc|ARM.Build.0 = Debug|Any CPU
|
||||||
|
{E7F8F7C0-9FE5-4DAB-B510-1F05ADD11E1F}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU
|
||||||
|
{E7F8F7C0-9FE5-4DAB-B510-1F05ADD11E1F}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU
|
||||||
|
{E7F8F7C0-9FE5-4DAB-B510-1F05ADD11E1F}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU
|
||||||
|
{E7F8F7C0-9FE5-4DAB-B510-1F05ADD11E1F}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU
|
||||||
|
{E7F8F7C0-9FE5-4DAB-B510-1F05ADD11E1F}.Ad-Hoc|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{E7F8F7C0-9FE5-4DAB-B510-1F05ADD11E1F}.Ad-Hoc|x64.Build.0 = Debug|Any CPU
|
||||||
|
{E7F8F7C0-9FE5-4DAB-B510-1F05ADD11E1F}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU
|
||||||
|
{E7F8F7C0-9FE5-4DAB-B510-1F05ADD11E1F}.Ad-Hoc|x86.Build.0 = Debug|Any CPU
|
||||||
|
{E7F8F7C0-9FE5-4DAB-B510-1F05ADD11E1F}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{E7F8F7C0-9FE5-4DAB-B510-1F05ADD11E1F}.AppStore|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{E7F8F7C0-9FE5-4DAB-B510-1F05ADD11E1F}.AppStore|ARM.ActiveCfg = Debug|Any CPU
|
||||||
|
{E7F8F7C0-9FE5-4DAB-B510-1F05ADD11E1F}.AppStore|ARM.Build.0 = Debug|Any CPU
|
||||||
|
{E7F8F7C0-9FE5-4DAB-B510-1F05ADD11E1F}.AppStore|iPhone.ActiveCfg = Debug|Any CPU
|
||||||
|
{E7F8F7C0-9FE5-4DAB-B510-1F05ADD11E1F}.AppStore|iPhone.Build.0 = Debug|Any CPU
|
||||||
|
{E7F8F7C0-9FE5-4DAB-B510-1F05ADD11E1F}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU
|
||||||
|
{E7F8F7C0-9FE5-4DAB-B510-1F05ADD11E1F}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU
|
||||||
|
{E7F8F7C0-9FE5-4DAB-B510-1F05ADD11E1F}.AppStore|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{E7F8F7C0-9FE5-4DAB-B510-1F05ADD11E1F}.AppStore|x64.Build.0 = Debug|Any CPU
|
||||||
|
{E7F8F7C0-9FE5-4DAB-B510-1F05ADD11E1F}.AppStore|x86.ActiveCfg = Debug|Any CPU
|
||||||
|
{E7F8F7C0-9FE5-4DAB-B510-1F05ADD11E1F}.AppStore|x86.Build.0 = Debug|Any CPU
|
||||||
|
{E7F8F7C0-9FE5-4DAB-B510-1F05ADD11E1F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{E7F8F7C0-9FE5-4DAB-B510-1F05ADD11E1F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{E7F8F7C0-9FE5-4DAB-B510-1F05ADD11E1F}.Debug|ARM.ActiveCfg = Debug|Any CPU
|
||||||
|
{E7F8F7C0-9FE5-4DAB-B510-1F05ADD11E1F}.Debug|ARM.Build.0 = Debug|Any CPU
|
||||||
|
{E7F8F7C0-9FE5-4DAB-B510-1F05ADD11E1F}.Debug|iPhone.ActiveCfg = Debug|Any CPU
|
||||||
|
{E7F8F7C0-9FE5-4DAB-B510-1F05ADD11E1F}.Debug|iPhone.Build.0 = Debug|Any CPU
|
||||||
|
{E7F8F7C0-9FE5-4DAB-B510-1F05ADD11E1F}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
|
||||||
|
{E7F8F7C0-9FE5-4DAB-B510-1F05ADD11E1F}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
|
||||||
|
{E7F8F7C0-9FE5-4DAB-B510-1F05ADD11E1F}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{E7F8F7C0-9FE5-4DAB-B510-1F05ADD11E1F}.Debug|x64.Build.0 = Debug|Any CPU
|
||||||
|
{E7F8F7C0-9FE5-4DAB-B510-1F05ADD11E1F}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
|
{E7F8F7C0-9FE5-4DAB-B510-1F05ADD11E1F}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
|
{E7F8F7C0-9FE5-4DAB-B510-1F05ADD11E1F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{E7F8F7C0-9FE5-4DAB-B510-1F05ADD11E1F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{E7F8F7C0-9FE5-4DAB-B510-1F05ADD11E1F}.Release|ARM.ActiveCfg = Release|Any CPU
|
||||||
|
{E7F8F7C0-9FE5-4DAB-B510-1F05ADD11E1F}.Release|ARM.Build.0 = Release|Any CPU
|
||||||
|
{E7F8F7C0-9FE5-4DAB-B510-1F05ADD11E1F}.Release|iPhone.ActiveCfg = Release|Any CPU
|
||||||
|
{E7F8F7C0-9FE5-4DAB-B510-1F05ADD11E1F}.Release|iPhone.Build.0 = Release|Any CPU
|
||||||
|
{E7F8F7C0-9FE5-4DAB-B510-1F05ADD11E1F}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
||||||
|
{E7F8F7C0-9FE5-4DAB-B510-1F05ADD11E1F}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
|
||||||
|
{E7F8F7C0-9FE5-4DAB-B510-1F05ADD11E1F}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{E7F8F7C0-9FE5-4DAB-B510-1F05ADD11E1F}.Release|x64.Build.0 = Release|Any CPU
|
||||||
|
{E7F8F7C0-9FE5-4DAB-B510-1F05ADD11E1F}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
|
{E7F8F7C0-9FE5-4DAB-B510-1F05ADD11E1F}.Release|x86.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
@ -1359,5 +1413,8 @@ Global
|
|||||||
{A5260DE0-1FDD-467E-9CC1-A028AB081CEE} = {91CF7717-08AB-4E65-B10E-0B426F01E2E8}
|
{A5260DE0-1FDD-467E-9CC1-A028AB081CEE} = {91CF7717-08AB-4E65-B10E-0B426F01E2E8}
|
||||||
{DF395F85-B010-465D-857A-7EBCC512C0C2} = {A5260DE0-1FDD-467E-9CC1-A028AB081CEE}
|
{DF395F85-B010-465D-857A-7EBCC512C0C2} = {A5260DE0-1FDD-467E-9CC1-A028AB081CEE}
|
||||||
{69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8} = {807BB76E-B2BB-47A2-A57B-3D1B20FF5E7F}
|
{69AF10D3-AA76-4FF7-B187-EC7E8CC5F5B8} = {807BB76E-B2BB-47A2-A57B-3D1B20FF5E7F}
|
||||||
|
{5B1011EC-CEE5-47AA-B336-99381D573679} = {A5260DE0-1FDD-467E-9CC1-A028AB081CEE}
|
||||||
|
{106B787C-2CFF-4484-8C07-D14589859E94} = {5B1011EC-CEE5-47AA-B336-99381D573679}
|
||||||
|
{E7F8F7C0-9FE5-4DAB-B510-1F05ADD11E1F} = {106B787C-2CFF-4484-8C07-D14589859E94}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
@ -82,10 +82,10 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
|
|||||||
{
|
{
|
||||||
services.AddSingleton<IServiceBusPersisterConnection>(sp =>
|
services.AddSingleton<IServiceBusPersisterConnection>(sp =>
|
||||||
{
|
{
|
||||||
var settings = sp.GetRequiredService<IOptions<BasketSettings>>().Value;
|
|
||||||
var logger = sp.GetRequiredService<ILogger<DefaultServiceBusPersisterConnection>>();
|
var logger = sp.GetRequiredService<ILogger<DefaultServiceBusPersisterConnection>>();
|
||||||
|
|
||||||
var serviceBusConnection = new ServiceBusConnectionStringBuilder(settings.EventBusConnection);
|
var serviceBusConnectionString = Configuration["EventBusConnection"];
|
||||||
|
var serviceBusConnection = new ServiceBusConnectionStringBuilder(serviceBusConnectionString);
|
||||||
|
|
||||||
return new DefaultServiceBusPersisterConnection(serviceBusConnection, logger);
|
return new DefaultServiceBusPersisterConnection(serviceBusConnection, logger);
|
||||||
});
|
});
|
||||||
@ -94,17 +94,19 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
|
|||||||
{
|
{
|
||||||
services.AddSingleton<IRabbitMQPersistentConnection>(sp =>
|
services.AddSingleton<IRabbitMQPersistentConnection>(sp =>
|
||||||
{
|
{
|
||||||
var settings = sp.GetRequiredService<IOptions<BasketSettings>>().Value;
|
|
||||||
var logger = sp.GetRequiredService<ILogger<DefaultRabbitMQPersistentConnection>>();
|
var logger = sp.GetRequiredService<ILogger<DefaultRabbitMQPersistentConnection>>();
|
||||||
|
|
||||||
var factory = new ConnectionFactory()
|
var factory = new ConnectionFactory()
|
||||||
{
|
{
|
||||||
HostName = settings.EventBusConnection
|
HostName = Configuration["EventBusConnection"]
|
||||||
};
|
};
|
||||||
|
|
||||||
return new DefaultRabbitMQPersistentConnection(factory, logger);
|
return new DefaultRabbitMQPersistentConnection(factory, logger);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RegisterEventBus(services);
|
||||||
|
|
||||||
|
|
||||||
services.AddSwaggerGen(options =>
|
services.AddSwaggerGen(options =>
|
||||||
{
|
{
|
||||||
@ -130,7 +132,6 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
|
|||||||
services.AddTransient<IBasketRepository, RedisBasketRepository>();
|
services.AddTransient<IBasketRepository, RedisBasketRepository>();
|
||||||
services.AddTransient<IIdentityService, IdentityService>();
|
services.AddTransient<IIdentityService, IdentityService>();
|
||||||
|
|
||||||
RegisterEventBus(services);
|
|
||||||
services.AddOptions();
|
services.AddOptions();
|
||||||
|
|
||||||
var container = new ContainerBuilder();
|
var container = new ContainerBuilder();
|
||||||
|
@ -9,6 +9,6 @@
|
|||||||
},
|
},
|
||||||
"IdentityUrl": "http://localhost:5105",
|
"IdentityUrl": "http://localhost:5105",
|
||||||
"ConnectionString": "127.0.0.1",
|
"ConnectionString": "127.0.0.1",
|
||||||
"AzureServiceBusEnabled": false,
|
"AzureServiceBusEnabled": true,
|
||||||
"SubscriptionClientName": "Basket"
|
"SubscriptionClientName": "Basket"
|
||||||
}
|
}
|
@ -9,7 +9,7 @@
|
|||||||
"Microsoft": "Information"
|
"Microsoft": "Information"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"AzureServiceBusEnabled": false,
|
"AzureServiceBusEnabled": true,
|
||||||
"AzureStorageEnabled": true,
|
"AzureStorageEnabled": true,
|
||||||
"SubscriptionClientName": "Catalog"
|
"SubscriptionClientName": "Catalog"
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\..\BuildingBlocks\EventBus\EventBusRabbitMQ\EventBusRabbitMQ.csproj" />
|
<ProjectReference Include="..\..\..\BuildingBlocks\EventBus\EventBusRabbitMQ\EventBusRabbitMQ.csproj" />
|
||||||
|
<ProjectReference Include="..\..\..\BuildingBlocks\EventBus\EventBusServiceBus\EventBusServiceBus.csproj" />
|
||||||
<ProjectReference Include="..\..\..\BuildingBlocks\EventBus\EventBus\EventBus.csproj" />
|
<ProjectReference Include="..\..\..\BuildingBlocks\EventBus\EventBus\EventBus.csproj" />
|
||||||
<ProjectReference Include="..\..\..\BuildingBlocks\EventBus\IntegrationEventLogEF\IntegrationEventLogEF.csproj" />
|
<ProjectReference Include="..\..\..\BuildingBlocks\EventBus\IntegrationEventLogEF\IntegrationEventLogEF.csproj" />
|
||||||
<ProjectReference Include="..\..\Ordering\Ordering.Infrastructure\Ordering.Infrastructure.csproj" />
|
<ProjectReference Include="..\..\Ordering\Ordering.Infrastructure\Ordering.Infrastructure.csproj" />
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
using RabbitMQ.Client;
|
using RabbitMQ.Client;
|
||||||
using Services;
|
using Services;
|
||||||
|
using Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus;
|
||||||
|
using Microsoft.Azure.ServiceBus;
|
||||||
|
|
||||||
public class Program
|
public class Program
|
||||||
{
|
{
|
||||||
@ -58,18 +60,34 @@
|
|||||||
services.AddLogging()
|
services.AddLogging()
|
||||||
.AddOptions()
|
.AddOptions()
|
||||||
.Configure<ManagerSettings>(Configuration)
|
.Configure<ManagerSettings>(Configuration)
|
||||||
.AddSingleton<IManagerService, ManagerService>()
|
.AddSingleton<IManagerService, ManagerService>();
|
||||||
.AddSingleton<IRabbitMQPersistentConnection>(sp =>
|
|
||||||
|
if (Configuration.GetValue<bool>("AzureServiceBusEnabled"))
|
||||||
|
{
|
||||||
|
services.AddSingleton<IServiceBusPersisterConnection>(sp =>
|
||||||
|
{
|
||||||
|
var logger = sp.GetRequiredService<ILogger<DefaultServiceBusPersisterConnection>>();
|
||||||
|
|
||||||
|
var serviceBusConnectionString = Configuration["EventBusConnection"];
|
||||||
|
var serviceBusConnection = new ServiceBusConnectionStringBuilder(serviceBusConnectionString);
|
||||||
|
|
||||||
|
return new DefaultServiceBusPersisterConnection(serviceBusConnection, logger);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
services.AddSingleton<IRabbitMQPersistentConnection>(sp =>
|
||||||
{
|
{
|
||||||
var settings = sp.GetRequiredService<IOptions<ManagerSettings>>().Value;
|
|
||||||
var logger = sp.GetRequiredService<ILogger<DefaultRabbitMQPersistentConnection>>();
|
var logger = sp.GetRequiredService<ILogger<DefaultRabbitMQPersistentConnection>>();
|
||||||
|
|
||||||
var factory = new ConnectionFactory()
|
var factory = new ConnectionFactory()
|
||||||
{
|
{
|
||||||
HostName = settings.EventBusConnection
|
HostName = Configuration["EventBusConnection"]
|
||||||
};
|
};
|
||||||
|
|
||||||
return new DefaultRabbitMQPersistentConnection(factory, logger);
|
return new DefaultRabbitMQPersistentConnection(factory, logger);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
RegisterEventBus(services);
|
RegisterEventBus(services);
|
||||||
|
|
||||||
@ -86,8 +104,26 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void RegisterEventBus(IServiceCollection services)
|
private static void RegisterEventBus(IServiceCollection services)
|
||||||
|
{
|
||||||
|
if (Configuration.GetValue<bool>("AzureServiceBusEnabled"))
|
||||||
|
{
|
||||||
|
services.AddSingleton<IEventBus, EventBusServiceBus>(sp =>
|
||||||
|
{
|
||||||
|
var serviceBusPersisterConnection = sp.GetRequiredService<IServiceBusPersisterConnection>();
|
||||||
|
var iLifetimeScope = sp.GetRequiredService<ILifetimeScope>();
|
||||||
|
var logger = sp.GetRequiredService<ILogger<EventBusServiceBus>>();
|
||||||
|
var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
|
||||||
|
var subscriptionClientName = Configuration["SubscriptionClientName"];
|
||||||
|
|
||||||
|
return new EventBusServiceBus(serviceBusPersisterConnection, logger,
|
||||||
|
eventBusSubcriptionsManager, subscriptionClientName, iLifetimeScope);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
services.AddSingleton<IEventBus, EventBusRabbitMQ>();
|
services.AddSingleton<IEventBus, EventBusRabbitMQ>();
|
||||||
|
}
|
||||||
|
|
||||||
services.AddSingleton<IEventBusSubscriptionsManager, InMemoryEventBusSubscriptionsManager>();
|
services.AddSingleton<IEventBusSubscriptionsManager, InMemoryEventBusSubscriptionsManager>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,5 +9,7 @@
|
|||||||
},
|
},
|
||||||
"ConnectionString": "Server=tcp:127.0.0.1,5433;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word;",
|
"ConnectionString": "Server=tcp:127.0.0.1,5433;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word;",
|
||||||
"GracePeriodTime": "1",
|
"GracePeriodTime": "1",
|
||||||
"CheckUpdateTime": "30000"
|
"CheckUpdateTime": "30000",
|
||||||
|
"AzureServiceBusEnabled": true,
|
||||||
|
"SubscriptionClientName": "GracePeriod"
|
||||||
}
|
}
|
||||||
|
@ -114,6 +114,21 @@ namespace Identity.API.Configuration
|
|||||||
"locations",
|
"locations",
|
||||||
"marketing"
|
"marketing"
|
||||||
},
|
},
|
||||||
|
},
|
||||||
|
new Client
|
||||||
|
{
|
||||||
|
ClientId = "swaggerui",
|
||||||
|
ClientName = "Swagger UI",
|
||||||
|
AllowedGrantTypes = GrantTypes.Implicit,
|
||||||
|
AllowAccessTokensViaBrowser = true,
|
||||||
|
|
||||||
|
RedirectUris = { "http://localhost:5109/swagger/o2c.html" },
|
||||||
|
PostLogoutRedirectUris = { "http://localhost:5109/swagger/" },
|
||||||
|
|
||||||
|
AllowedScopes =
|
||||||
|
{
|
||||||
|
"locations"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,31 @@
|
|||||||
|
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Swashbuckle.AspNetCore.Swagger;
|
||||||
|
using Swashbuckle.AspNetCore.SwaggerGen;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure.Filters
|
||||||
|
{
|
||||||
|
internal class AuthorizeCheckOperationFilter : IOperationFilter
|
||||||
|
{
|
||||||
|
public void Apply(Operation operation, OperationFilterContext context)
|
||||||
|
{
|
||||||
|
// Check for authorize attribute
|
||||||
|
var hasAuthorize = context.ApiDescription.ControllerAttributes().OfType<AuthorizeAttribute>().Any() ||
|
||||||
|
context.ApiDescription.ActionAttributes().OfType<AuthorizeAttribute>().Any();
|
||||||
|
|
||||||
|
if (hasAuthorize)
|
||||||
|
{
|
||||||
|
operation.Responses.Add("401", new Response { Description = "Unauthorized" });
|
||||||
|
operation.Responses.Add("403", new Response { Description = "Forbidden" });
|
||||||
|
|
||||||
|
operation.Security = new List<IDictionary<string, IEnumerable<string>>>();
|
||||||
|
operation.Security.Add(new Dictionary<string, IEnumerable<string>>
|
||||||
|
{
|
||||||
|
{ "oauth2", new [] { "api1" } }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,15 +1,15 @@
|
|||||||
namespace Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure.Services
|
namespace Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure.Services
|
||||||
{
|
{
|
||||||
using Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure.Repositories;
|
using global::Locations.API.IntegrationEvents.Events;
|
||||||
using Microsoft.eShopOnContainers.Services.Locations.API.ViewModel;
|
using global::Locations.API.Model;
|
||||||
using Microsoft.eShopOnContainers.Services.Locations.API.Model;
|
|
||||||
using System;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Linq;
|
|
||||||
using Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure.Exceptions;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
|
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
|
||||||
using Microsoft.eShopOnContainers.Services.Locations.API.IntegrationEvents.Events;
|
using Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure.Exceptions;
|
||||||
|
using Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure.Repositories;
|
||||||
|
using Microsoft.eShopOnContainers.Services.Locations.API.Model;
|
||||||
|
using Microsoft.eShopOnContainers.Services.Locations.API.ViewModel;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
public class LocationsService : ILocationsService
|
public class LocationsService : ILocationsService
|
||||||
{
|
{
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
namespace Microsoft.eShopOnContainers.Services.Locations.API.IntegrationEvents.Events
|
namespace Locations.API.IntegrationEvents.Events
|
||||||
{
|
{
|
||||||
|
using Locations.API.Model;
|
||||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
|
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
|
||||||
using Microsoft.eShopOnContainers.Services.Locations.API.Model;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
public class UserLocationUpdatedIntegrationEvent : IntegrationEvent
|
public class UserLocationUpdatedIntegrationEvent : IntegrationEvent
|
||||||
{
|
{
|
||||||
public string UserId { get; private set; }
|
public string UserId { get; set; }
|
||||||
public List<UserLocationDetails> LocationList { get; private set; }
|
public List<UserLocationDetails> LocationList { get; set; }
|
||||||
|
|
||||||
public UserLocationUpdatedIntegrationEvent(string userId, List<UserLocationDetails> locationList)
|
public UserLocationUpdatedIntegrationEvent(string userId, List<UserLocationDetails> locationList)
|
||||||
{
|
{
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\..\BuildingBlocks\EventBus\EventBusRabbitMQ\EventBusRabbitMQ.csproj" />
|
<ProjectReference Include="..\..\..\BuildingBlocks\EventBus\EventBusRabbitMQ\EventBusRabbitMQ.csproj" />
|
||||||
|
<ProjectReference Include="..\..\..\BuildingBlocks\EventBus\EventBusServiceBus\EventBusServiceBus.csproj" />
|
||||||
<ProjectReference Include="..\..\..\BuildingBlocks\EventBus\EventBus\EventBus.csproj" />
|
<ProjectReference Include="..\..\..\BuildingBlocks\EventBus\EventBus\EventBus.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Services.Locations.API.Model
|
namespace Locations.API.Model
|
||||||
{
|
{
|
||||||
public class UserLocationDetails
|
public class UserLocationDetails
|
||||||
{
|
{
|
||||||
|
@ -16,6 +16,10 @@ using Microsoft.Extensions.Logging;
|
|||||||
using RabbitMQ.Client;
|
using RabbitMQ.Client;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System;
|
using System;
|
||||||
|
using Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus;
|
||||||
|
using Microsoft.Azure.ServiceBus;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Swashbuckle.AspNetCore.Swagger;
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Services.Locations.API
|
namespace Microsoft.eShopOnContainers.Services.Locations.API
|
||||||
{
|
{
|
||||||
@ -51,6 +55,20 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API
|
|||||||
|
|
||||||
services.Configure<LocationSettings>(Configuration);
|
services.Configure<LocationSettings>(Configuration);
|
||||||
|
|
||||||
|
if (Configuration.GetValue<bool>("AzureServiceBusEnabled"))
|
||||||
|
{
|
||||||
|
services.AddSingleton<IServiceBusPersisterConnection>(sp =>
|
||||||
|
{
|
||||||
|
var logger = sp.GetRequiredService<ILogger<DefaultServiceBusPersisterConnection>>();
|
||||||
|
|
||||||
|
var serviceBusConnectionString = Configuration["EventBusConnection"];
|
||||||
|
var serviceBusConnection = new ServiceBusConnectionStringBuilder(serviceBusConnectionString);
|
||||||
|
|
||||||
|
return new DefaultServiceBusPersisterConnection(serviceBusConnection, logger);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
services.AddSingleton<IRabbitMQPersistentConnection>(sp =>
|
services.AddSingleton<IRabbitMQPersistentConnection>(sp =>
|
||||||
{
|
{
|
||||||
var logger = sp.GetRequiredService<ILogger<DefaultRabbitMQPersistentConnection>>();
|
var logger = sp.GetRequiredService<ILogger<DefaultRabbitMQPersistentConnection>>();
|
||||||
@ -62,8 +80,9 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API
|
|||||||
|
|
||||||
return new DefaultRabbitMQPersistentConnection(factory, logger);
|
return new DefaultRabbitMQPersistentConnection(factory, logger);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
RegisterServiceBus(services);
|
RegisterEventBus(services);
|
||||||
|
|
||||||
// Add framework services.
|
// Add framework services.
|
||||||
services.AddSwaggerGen(options =>
|
services.AddSwaggerGen(options =>
|
||||||
@ -76,6 +95,21 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API
|
|||||||
Description = "The Location Microservice HTTP API. This is a Data-Driven/CRUD microservice sample",
|
Description = "The Location Microservice HTTP API. This is a Data-Driven/CRUD microservice sample",
|
||||||
TermsOfService = "Terms Of Service"
|
TermsOfService = "Terms Of Service"
|
||||||
});
|
});
|
||||||
|
|
||||||
|
options.AddSecurityDefinition("oauth2", new OAuth2Scheme
|
||||||
|
{
|
||||||
|
Type = "oauth2",
|
||||||
|
Flow = "implicit",
|
||||||
|
AuthorizationUrl = "http://localhost:5105/connect/authorize",
|
||||||
|
TokenUrl = "http://localhost:5105/connect/token",
|
||||||
|
Scopes = new Dictionary<string, string>()
|
||||||
|
{
|
||||||
|
{ "locations", "Locations API" }
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
options.OperationFilter<AuthorizeCheckOperationFilter>();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
services.AddCors(options =>
|
services.AddCors(options =>
|
||||||
@ -117,6 +151,7 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API
|
|||||||
.UseSwaggerUI(c =>
|
.UseSwaggerUI(c =>
|
||||||
{
|
{
|
||||||
c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
|
c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
|
||||||
|
c.ConfigureOAuth2("swaggerui", "", "", "Swagger UI");
|
||||||
});
|
});
|
||||||
|
|
||||||
LocationsContextSeed.SeedAsync(app, loggerFactory)
|
LocationsContextSeed.SeedAsync(app, loggerFactory)
|
||||||
@ -134,9 +169,27 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RegisterServiceBus(IServiceCollection services)
|
private void RegisterEventBus(IServiceCollection services)
|
||||||
|
{
|
||||||
|
if (Configuration.GetValue<bool>("AzureServiceBusEnabled"))
|
||||||
|
{
|
||||||
|
services.AddSingleton<IEventBus, EventBusServiceBus>(sp =>
|
||||||
|
{
|
||||||
|
var serviceBusPersisterConnection = sp.GetRequiredService<IServiceBusPersisterConnection>();
|
||||||
|
var iLifetimeScope = sp.GetRequiredService<ILifetimeScope>();
|
||||||
|
var logger = sp.GetRequiredService<ILogger<EventBusServiceBus>>();
|
||||||
|
var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
|
||||||
|
var subscriptionClientName = Configuration["SubscriptionClientName"];
|
||||||
|
|
||||||
|
return new EventBusServiceBus(serviceBusPersisterConnection, logger,
|
||||||
|
eventBusSubcriptionsManager, subscriptionClientName, iLifetimeScope);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
services.AddSingleton<IEventBus, EventBusRabbitMQ>();
|
services.AddSingleton<IEventBus, EventBusRabbitMQ>();
|
||||||
|
}
|
||||||
|
|
||||||
services.AddSingleton<IEventBusSubscriptionsManager, InMemoryEventBusSubscriptionsManager>();
|
services.AddSingleton<IEventBusSubscriptionsManager, InMemoryEventBusSubscriptionsManager>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,5 +9,7 @@
|
|||||||
"System": "Information",
|
"System": "Information",
|
||||||
"Microsoft": "Information"
|
"Microsoft": "Information"
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"AzureServiceBusEnabled": true,
|
||||||
|
"SubscriptionClientName": "Locations"
|
||||||
}
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
{
|
||||||
|
"bindings": [
|
||||||
|
{
|
||||||
|
"authLevel": "function",
|
||||||
|
"name": "req",
|
||||||
|
"type": "httpTrigger",
|
||||||
|
"direction": "in"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "$return",
|
||||||
|
"type": "http",
|
||||||
|
"direction": "out"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "documentDB",
|
||||||
|
"name": "inputDocument",
|
||||||
|
"databaseName": "MarketingDb",
|
||||||
|
"collectionName": "MarketingReadDataModel",
|
||||||
|
"connection": "eshop-nosqlez55a72p6wm62_DOCUMENTDB",
|
||||||
|
"direction": "in"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"disabled": false
|
||||||
|
}
|
@ -0,0 +1,87 @@
|
|||||||
|
using System.Net;
|
||||||
|
using System.Net.Http.Headers;
|
||||||
|
using System.Configuration;
|
||||||
|
using Dapper;
|
||||||
|
using System.Data.SqlClient;
|
||||||
|
|
||||||
|
public static async Task<HttpResponseMessage> Run(HttpRequestMessage req, dynamic inputDocument, TraceWriter log)
|
||||||
|
{
|
||||||
|
log.Info($"Campaign HTTP trigger function processed a request. RequestUri={req.RequestUri}");
|
||||||
|
|
||||||
|
string htmlResponse = string.Empty;
|
||||||
|
|
||||||
|
// parse query parameter
|
||||||
|
string campaignId = req.GetQueryNameValuePairs()
|
||||||
|
.FirstOrDefault(q => string.Compare(q.Key, "campaignId", true) == 0)
|
||||||
|
.Value;
|
||||||
|
|
||||||
|
string userId = req.GetQueryNameValuePairs()
|
||||||
|
.FirstOrDefault(q => string.Compare(q.Key, "userId", true) == 0)
|
||||||
|
.Value;
|
||||||
|
|
||||||
|
var cnnString = ConfigurationManager.ConnectionStrings["SqlConnection"].ConnectionString;
|
||||||
|
|
||||||
|
using (var conn = new SqlConnection(cnnString))
|
||||||
|
{
|
||||||
|
await conn.OpenAsync();
|
||||||
|
var sql = "SELECT * FROM [dbo].[Campaign] WHERE Id = @CampaignId;";
|
||||||
|
var campaign = (await conn.QueryAsync<Campaign>(sql, new { CampaignId = campaignId })).FirstOrDefault();
|
||||||
|
htmlResponse = BuildHtmlResponse(campaign);
|
||||||
|
}
|
||||||
|
|
||||||
|
var response = new HttpResponseMessage(HttpStatusCode.OK);
|
||||||
|
response.Content = new ByteArrayContent(System.Text.Encoding.UTF8.GetBytes(htmlResponse));
|
||||||
|
response.Content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string BuildHtmlResponse(Campaign campaign)
|
||||||
|
{
|
||||||
|
return string.Format(@"
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<link href='https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css' rel='stylesheet'>
|
||||||
|
</head>
|
||||||
|
<header>
|
||||||
|
<title>Campaign Details</title>
|
||||||
|
</header>
|
||||||
|
<body>
|
||||||
|
<div class='container'>
|
||||||
|
</br>
|
||||||
|
<div class='card-deck'>
|
||||||
|
<div class='card'>
|
||||||
|
<img class='card-img-top' src='{0}' alt='Card image cap'>
|
||||||
|
<div class='card-block'>
|
||||||
|
<h4 class='card-title'>{1}</h4>
|
||||||
|
<p class='card-text'>{2}</p>
|
||||||
|
<div class='card-footer'>
|
||||||
|
<small class='text-muted'>From {3} until {4}</small>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>",
|
||||||
|
campaign.PictureUri,
|
||||||
|
campaign.Name,
|
||||||
|
campaign.Description,
|
||||||
|
campaign.From.ToString("MMMM dd, yyyy"),
|
||||||
|
campaign.From.ToString("MMMM dd, yyyy"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Campaign
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
public string Description { get; set; }
|
||||||
|
|
||||||
|
public DateTime From { get; set; }
|
||||||
|
|
||||||
|
public DateTime To { get; set; }
|
||||||
|
|
||||||
|
public string PictureUri { get; set; }
|
||||||
|
}
|
@ -0,0 +1 @@
|
|||||||
|
{}
|
@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"IsEncrypted": false,
|
||||||
|
"Value": {
|
||||||
|
"APPSETTING_eshop-nosqlez55a72p6wm62_DOCUMENTDB": "AccountEndpoint=https://eshop-nosqlez55a72p6wm62.documents.azure.com:443/;AccountKey=l8jMNoLHFXOijAvaVMjHeCwHK8gAR9SovuK86uCOvwfnMhuhwytPKByOPqrQrlsDz9RPFet2J6SzEbBQXLZokA==;",
|
||||||
|
"APPSETTING_FUNCTIONS_EXTENSION_VERSION": "~1",
|
||||||
|
"APPSETTING_ScmType": "None",
|
||||||
|
"APPSETTING_WEBSITE_AUTH_ENABLED": "False",
|
||||||
|
"APPSETTING_AzureWebJobsDashboard": "DefaultEndpointsProtocol=https;AccountName=marketingfuncti9f5e;AccountKey=BAxvLgEs0pEyVSUgsRV8okXZY6MM/0FSikYoXyk80zhLhzPe3gyHxf9QCKDZ1qa6LsgqYdF8yoSotlg3FoDvTw==",
|
||||||
|
"APPSETTING_WEBSITE_NODE_DEFAULT_VERSION": "6.5.0",
|
||||||
|
"APPSETTING_WEBSITE_CONTENTAZUREFILECONNECTIONSTRING": "DefaultEndpointsProtocol=https;AccountName=marketingfuncti9f5e;AccountKey=BAxvLgEs0pEyVSUgsRV8okXZY6MM/0FSikYoXyk80zhLhzPe3gyHxf9QCKDZ1qa6LsgqYdF8yoSotlg3FoDvTw==",
|
||||||
|
"APPSETTING_WEBSITE_CONTENTSHARE": "marketing-functions9f5e",
|
||||||
|
"APPSETTING_WEBSITE_SLOT_NAME": "Production",
|
||||||
|
"APPSETTING_AzureWebJobsStorage": "DefaultEndpointsProtocol=https;AccountName=marketingfuncti9f5e;AccountKey=BAxvLgEs0pEyVSUgsRV8okXZY6MM/0FSikYoXyk80zhLhzPe3gyHxf9QCKDZ1qa6LsgqYdF8yoSotlg3FoDvTw==",
|
||||||
|
"APPSETTING_WEBSITE_SITE_NAME": "marketing-functions"
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net461</TargetFramework>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.Azure.WebJobs" Version="2.1.0-beta1" />
|
||||||
|
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Http" Version="1.0.0-beta1" />
|
||||||
|
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.0-alpha5" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Update="host.json">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Update="MarketingDetailsHttpTrigger/function.json">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Update="MarketingDetailsHttpTrigger/run.csx">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Update="local.settings.json">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
@ -13,6 +13,7 @@
|
|||||||
using AspNetCore.Authorization;
|
using AspNetCore.Authorization;
|
||||||
using Extensions.Options;
|
using Extensions.Options;
|
||||||
using Microsoft.eShopOnContainers.Services.Marketing.API.ViewModel;
|
using Microsoft.eShopOnContainers.Services.Marketing.API.ViewModel;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
|
||||||
[Route("api/v1/[controller]")]
|
[Route("api/v1/[controller]")]
|
||||||
[Authorize]
|
[Authorize]
|
||||||
@ -21,14 +22,16 @@
|
|||||||
private readonly MarketingContext _context;
|
private readonly MarketingContext _context;
|
||||||
private readonly MarketingSettings _settings;
|
private readonly MarketingSettings _settings;
|
||||||
private readonly IMarketingDataRepository _marketingDataRepository;
|
private readonly IMarketingDataRepository _marketingDataRepository;
|
||||||
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
|
|
||||||
public CampaignsController(MarketingContext context,
|
public CampaignsController(MarketingContext context,
|
||||||
IMarketingDataRepository marketingDataRepository,
|
IMarketingDataRepository marketingDataRepository,
|
||||||
IOptionsSnapshot<MarketingSettings> settings)
|
IOptionsSnapshot<MarketingSettings> settings, IHttpContextAccessor httpContextAccessor)
|
||||||
{
|
{
|
||||||
_context = context;
|
_context = context;
|
||||||
_marketingDataRepository = marketingDataRepository;
|
_marketingDataRepository = marketingDataRepository;
|
||||||
_settings = settings.Value;
|
_settings = settings.Value;
|
||||||
|
_httpContextAccessor = httpContextAccessor;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
@ -175,6 +178,7 @@
|
|||||||
|
|
||||||
private CampaignDTO MapCampaignModelToDto(Campaign campaign)
|
private CampaignDTO MapCampaignModelToDto(Campaign campaign)
|
||||||
{
|
{
|
||||||
|
var userId = _httpContextAccessor.HttpContext.User.FindFirst("sub").Value;
|
||||||
return new CampaignDTO
|
return new CampaignDTO
|
||||||
{
|
{
|
||||||
Id = campaign.Id,
|
Id = campaign.Id,
|
||||||
@ -182,7 +186,8 @@
|
|||||||
Description = campaign.Description,
|
Description = campaign.Description,
|
||||||
From = campaign.From,
|
From = campaign.From,
|
||||||
To = campaign.To,
|
To = campaign.To,
|
||||||
PictureUri = GetUriPlaceholder(campaign.PictureUri)
|
PictureUri = GetUriPlaceholder(campaign.PictureUri),
|
||||||
|
DetailsUri = $"{_settings.CampaignDetailFunctionUri}&campaignId={campaign.Id}$userId{userId}"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,5 +15,6 @@
|
|||||||
public DateTime To { get; set; }
|
public DateTime To { get; set; }
|
||||||
|
|
||||||
public string PictureUri { get; set; }
|
public string PictureUri { get; set; }
|
||||||
|
public string DetailsUri { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -38,6 +38,7 @@
|
|||||||
From = DateTime.Now,
|
From = DateTime.Now,
|
||||||
To = DateTime.Now.AddDays(7),
|
To = DateTime.Now.AddDays(7),
|
||||||
PictureUri = "http://externalcatalogbaseurltobereplaced/api/v1/campaigns/1/pic",
|
PictureUri = "http://externalcatalogbaseurltobereplaced/api/v1/campaigns/1/pic",
|
||||||
|
PictureName = "1.png",
|
||||||
Rules = new List<Rule>
|
Rules = new List<Rule>
|
||||||
{
|
{
|
||||||
new UserLocationRule
|
new UserLocationRule
|
||||||
@ -54,6 +55,7 @@
|
|||||||
From = DateTime.Now.AddDays(-7),
|
From = DateTime.Now.AddDays(-7),
|
||||||
To = DateTime.Now.AddDays(14),
|
To = DateTime.Now.AddDays(14),
|
||||||
PictureUri = "http://externalcatalogbaseurltobereplaced/api/v1/campaigns/2/pic",
|
PictureUri = "http://externalcatalogbaseurltobereplaced/api/v1/campaigns/2/pic",
|
||||||
|
PictureName = "2.png",
|
||||||
Rules = new List<Rule>
|
Rules = new List<Rule>
|
||||||
{
|
{
|
||||||
new UserLocationRule
|
new UserLocationRule
|
||||||
|
@ -0,0 +1,121 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.eShopOnContainers.Services.Marketing.API.Infrastructure;
|
||||||
|
|
||||||
|
namespace Microsoft.eShopOnContainers.Services.Marketing.API.Infrastructure.MarketingMigrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(MarketingContext))]
|
||||||
|
[Migration("20170629102516_added-campaign-details")]
|
||||||
|
partial class addedcampaigndetails
|
||||||
|
{
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "1.1.2")
|
||||||
|
.HasAnnotation("SqlServer:Sequence:.campaign_hilo", "'campaign_hilo', '', '1', '10', '', '', 'Int64', 'False'")
|
||||||
|
.HasAnnotation("SqlServer:Sequence:.rule_hilo", "'rule_hilo', '', '1', '10', '', '', 'Int64', 'False'")
|
||||||
|
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Marketing.API.Model.Campaign", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasAnnotation("SqlServer:HiLoSequenceName", "campaign_hilo")
|
||||||
|
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo);
|
||||||
|
|
||||||
|
b.Property<string>("Description")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnName("Description");
|
||||||
|
|
||||||
|
b.Property<string>("DetailsUri");
|
||||||
|
|
||||||
|
b.Property<DateTime>("From")
|
||||||
|
.HasColumnName("From");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnName("Name");
|
||||||
|
|
||||||
|
b.Property<string>("PictureName");
|
||||||
|
|
||||||
|
b.Property<string>("PictureUri")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnName("PictureUri");
|
||||||
|
|
||||||
|
b.Property<DateTime>("To")
|
||||||
|
.HasColumnName("To");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Campaign");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Marketing.API.Model.Rule", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasAnnotation("SqlServer:HiLoSequenceName", "rule_hilo")
|
||||||
|
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo);
|
||||||
|
|
||||||
|
b.Property<int>("CampaignId");
|
||||||
|
|
||||||
|
b.Property<string>("Description")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnName("Description");
|
||||||
|
|
||||||
|
b.Property<int>("RuleTypeId");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("CampaignId");
|
||||||
|
|
||||||
|
b.ToTable("Rule");
|
||||||
|
|
||||||
|
b.HasDiscriminator<int>("RuleTypeId");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Marketing.API.Model.PurchaseHistoryRule", b =>
|
||||||
|
{
|
||||||
|
b.HasBaseType("Microsoft.eShopOnContainers.Services.Marketing.API.Model.Rule");
|
||||||
|
|
||||||
|
|
||||||
|
b.ToTable("PurchaseHistoryRule");
|
||||||
|
|
||||||
|
b.HasDiscriminator().HasValue(2);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Marketing.API.Model.UserLocationRule", b =>
|
||||||
|
{
|
||||||
|
b.HasBaseType("Microsoft.eShopOnContainers.Services.Marketing.API.Model.Rule");
|
||||||
|
|
||||||
|
b.Property<int>("LocationId")
|
||||||
|
.HasColumnName("LocationId");
|
||||||
|
|
||||||
|
b.ToTable("UserLocationRule");
|
||||||
|
|
||||||
|
b.HasDiscriminator().HasValue(3);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Marketing.API.Model.UserProfileRule", b =>
|
||||||
|
{
|
||||||
|
b.HasBaseType("Microsoft.eShopOnContainers.Services.Marketing.API.Model.Rule");
|
||||||
|
|
||||||
|
|
||||||
|
b.ToTable("UserProfileRule");
|
||||||
|
|
||||||
|
b.HasDiscriminator().HasValue(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Marketing.API.Model.Rule", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Microsoft.eShopOnContainers.Services.Marketing.API.Model.Campaign", "Campaign")
|
||||||
|
.WithMany("Rules")
|
||||||
|
.HasForeignKey("CampaignId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
namespace Microsoft.eShopOnContainers.Services.Marketing.API.Infrastructure.MarketingMigrations
|
||||||
|
{
|
||||||
|
public partial class addedcampaigndetails : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "DetailsUri",
|
||||||
|
table: "Campaign",
|
||||||
|
nullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "PictureName",
|
||||||
|
table: "Campaign",
|
||||||
|
nullable: true);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "DetailsUri",
|
||||||
|
table: "Campaign");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "PictureName",
|
||||||
|
table: "Campaign");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -29,6 +29,8 @@ namespace Microsoft.eShopOnContainers.Services.Marketing.API.Infrastructure.Mark
|
|||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnName("Description");
|
.HasColumnName("Description");
|
||||||
|
|
||||||
|
b.Property<string>("DetailsUri");
|
||||||
|
|
||||||
b.Property<DateTime>("From")
|
b.Property<DateTime>("From")
|
||||||
.HasColumnName("From");
|
.HasColumnName("From");
|
||||||
|
|
||||||
@ -36,6 +38,8 @@ namespace Microsoft.eShopOnContainers.Services.Marketing.API.Infrastructure.Mark
|
|||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnName("Name");
|
.HasColumnName("Name");
|
||||||
|
|
||||||
|
b.Property<string>("PictureName");
|
||||||
|
|
||||||
b.Property<string>("PictureUri")
|
b.Property<string>("PictureUri")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnName("PictureUri");
|
.HasColumnName("PictureUri");
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
namespace Microsoft.eShopOnContainers.Services.Marketing.API.IntegrationEvents.Events
|
namespace Marketing.API.IntegrationEvents.Events
|
||||||
{
|
{
|
||||||
using Model;
|
using Marketing.API.Model;
|
||||||
|
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using BuildingBlocks.EventBus.Events;
|
|
||||||
|
|
||||||
public class UserLocationUpdatedIntegrationEvent : IntegrationEvent
|
public class UserLocationUpdatedIntegrationEvent : IntegrationEvent
|
||||||
{
|
{
|
||||||
public string UserId { get; private set; }
|
public string UserId { get; set; }
|
||||||
public List<UserLocationDetails> LocationList { get; private set; }
|
public List<UserLocationDetails> LocationList { get; set; }
|
||||||
|
|
||||||
public UserLocationUpdatedIntegrationEvent(string userId, List<UserLocationDetails> locationList)
|
public UserLocationUpdatedIntegrationEvent(string userId, List<UserLocationDetails> locationList)
|
||||||
{
|
{
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
namespace Microsoft.eShopOnContainers.Services.Marketing.API.IntegrationEvents.Handlers
|
namespace Marketing.API.IntegrationEvents.Handlers
|
||||||
{
|
{
|
||||||
using BuildingBlocks.EventBus.Abstractions;
|
using Marketing.API.IntegrationEvents.Events;
|
||||||
using System.Threading.Tasks;
|
using Marketing.API.Model;
|
||||||
using Events;
|
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
|
||||||
|
using Microsoft.eShopOnContainers.Services.Marketing.API.Infrastructure.Repositories;
|
||||||
|
using Microsoft.eShopOnContainers.Services.Marketing.API.Model;
|
||||||
using System;
|
using System;
|
||||||
using Infrastructure.Repositories;
|
|
||||||
using Model;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
public class UserLocationUpdatedIntegrationEventHandler
|
public class UserLocationUpdatedIntegrationEventHandler
|
||||||
: IIntegrationEventHandler<UserLocationUpdatedIntegrationEvent>
|
: IIntegrationEventHandler<UserLocationUpdatedIntegrationEvent>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<RuntimeFrameworkVersion>1.1.2</RuntimeFrameworkVersion>
|
<RuntimeFrameworkVersion>1.1.2</RuntimeFrameworkVersion>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<DockerComposeProjectPath>..\..\..\..\docker-compose.dcproj</DockerComposeProjectPath>
|
<DockerComposeProjectPath>..\..\..\..\docker-compose.dcproj</DockerComposeProjectPath>
|
||||||
<RootNamespace>Microsoft.eShopOnContainers.Services.Marketing.API</RootNamespace>
|
<RootNamespace>Marketing.API</RootNamespace>
|
||||||
<PackageTargetFallback>portable-net45+win8</PackageTargetFallback>
|
<PackageTargetFallback>portable-net45+win8</PackageTargetFallback>
|
||||||
<UserSecretsId>aspnet-Marketing.API-20161122013619</UserSecretsId>
|
<UserSecretsId>aspnet-Marketing.API-20161122013619</UserSecretsId>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
@ -56,6 +56,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\..\BuildingBlocks\EventBus\EventBusRabbitMQ\EventBusRabbitMQ.csproj" />
|
<ProjectReference Include="..\..\..\BuildingBlocks\EventBus\EventBusRabbitMQ\EventBusRabbitMQ.csproj" />
|
||||||
|
<ProjectReference Include="..\..\..\BuildingBlocks\EventBus\EventBusServiceBus\EventBusServiceBus.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -6,5 +6,6 @@
|
|||||||
public string MongoConnectionString { get; set; }
|
public string MongoConnectionString { get; set; }
|
||||||
public string MongoDatabase { get; set; }
|
public string MongoDatabase { get; set; }
|
||||||
public string ExternalCatalogBaseUrl { get; set; }
|
public string ExternalCatalogBaseUrl { get; set; }
|
||||||
|
public string CampaignDetailFunctionUri { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,8 +15,12 @@
|
|||||||
|
|
||||||
public DateTime To { get; set; }
|
public DateTime To { get; set; }
|
||||||
|
|
||||||
|
public string PictureName { get; set; }
|
||||||
|
|
||||||
public string PictureUri { get; set; }
|
public string PictureUri { get; set; }
|
||||||
|
|
||||||
|
public string DetailsUri { get; set; }
|
||||||
|
|
||||||
public List<Rule> Rules { get; set; }
|
public List<Rule> Rules { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
namespace Microsoft.eShopOnContainers.Services.Marketing.API.Model
|
namespace Marketing.API.Model
|
||||||
{
|
{
|
||||||
public class UserLocationDetails
|
public class UserLocationDetails
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
namespace Microsoft.eShopOnContainers.Services.Marketing.API
|
namespace Marketing.API
|
||||||
{
|
{
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using Microsoft.AspNetCore.Builder;
|
using Microsoft.AspNetCore.Builder;
|
||||||
|
@ -1,28 +1,32 @@
|
|||||||
namespace Microsoft.eShopOnContainers.Services.Marketing.API
|
namespace Marketing.API
|
||||||
{
|
{
|
||||||
|
using Autofac;
|
||||||
|
using Autofac.Extensions.DependencyInjection;
|
||||||
|
using global::Marketing.API.IntegrationEvents.Events;
|
||||||
|
using Marketing.API.IntegrationEvents.Handlers;
|
||||||
using Microsoft.AspNetCore.Builder;
|
using Microsoft.AspNetCore.Builder;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.Azure.ServiceBus;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus;
|
||||||
|
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
|
||||||
|
using Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ;
|
||||||
|
using Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus;
|
||||||
|
using Microsoft.eShopOnContainers.Services.Marketing.API;
|
||||||
using Microsoft.eShopOnContainers.Services.Marketing.API.Infrastructure;
|
using Microsoft.eShopOnContainers.Services.Marketing.API.Infrastructure;
|
||||||
|
using Microsoft.eShopOnContainers.Services.Marketing.API.Infrastructure.Filters;
|
||||||
|
using Microsoft.eShopOnContainers.Services.Marketing.API.Infrastructure.Repositories;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using System.Reflection;
|
|
||||||
using System;
|
|
||||||
using Microsoft.eShopOnContainers.Services.Marketing.API.Infrastructure.Filters;
|
|
||||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ;
|
|
||||||
using RabbitMQ.Client;
|
|
||||||
using BuildingBlocks.EventBus.Abstractions;
|
|
||||||
using BuildingBlocks.EventBus;
|
|
||||||
using IntegrationEvents.Events;
|
|
||||||
using IntegrationEvents.Handlers;
|
|
||||||
using Infrastructure.Repositories;
|
|
||||||
using Autofac;
|
|
||||||
using Autofac.Extensions.DependencyInjection;
|
|
||||||
using Polly;
|
using Polly;
|
||||||
using System.Threading.Tasks;
|
using RabbitMQ.Client;
|
||||||
|
using System;
|
||||||
using System.Data.SqlClient;
|
using System.Data.SqlClient;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
public class Startup
|
public class Startup
|
||||||
{
|
{
|
||||||
@ -73,6 +77,20 @@
|
|||||||
//Check Client vs. Server evaluation: https://docs.microsoft.com/en-us/ef/core/querying/client-eval
|
//Check Client vs. Server evaluation: https://docs.microsoft.com/en-us/ef/core/querying/client-eval
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (Configuration.GetValue<bool>("AzureServiceBusEnabled"))
|
||||||
|
{
|
||||||
|
services.AddSingleton<IServiceBusPersisterConnection>(sp =>
|
||||||
|
{
|
||||||
|
var logger = sp.GetRequiredService<ILogger<DefaultServiceBusPersisterConnection>>();
|
||||||
|
|
||||||
|
var serviceBusConnectionString = Configuration["EventBusConnection"];
|
||||||
|
var serviceBusConnection = new ServiceBusConnectionStringBuilder(serviceBusConnectionString);
|
||||||
|
|
||||||
|
return new DefaultServiceBusPersisterConnection(serviceBusConnection, logger);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
services.AddSingleton<IRabbitMQPersistentConnection>(sp =>
|
services.AddSingleton<IRabbitMQPersistentConnection>(sp =>
|
||||||
{
|
{
|
||||||
var logger = sp.GetRequiredService<ILogger<DefaultRabbitMQPersistentConnection>>();
|
var logger = sp.GetRequiredService<ILogger<DefaultRabbitMQPersistentConnection>>();
|
||||||
@ -84,8 +102,7 @@
|
|||||||
|
|
||||||
return new DefaultRabbitMQPersistentConnection(factory, logger);
|
return new DefaultRabbitMQPersistentConnection(factory, logger);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
RegisterServiceBus(services);
|
|
||||||
|
|
||||||
// Add framework services.
|
// Add framework services.
|
||||||
services.AddSwaggerGen(options =>
|
services.AddSwaggerGen(options =>
|
||||||
@ -109,7 +126,12 @@
|
|||||||
.AllowCredentials());
|
.AllowCredentials());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
RegisterEventBus(services);
|
||||||
|
|
||||||
services.AddTransient<IMarketingDataRepository, MarketingDataRepository>();
|
services.AddTransient<IMarketingDataRepository, MarketingDataRepository>();
|
||||||
|
services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
|
||||||
|
|
||||||
|
services.AddOptions();
|
||||||
|
|
||||||
//configure autofac
|
//configure autofac
|
||||||
var container = new ContainerBuilder();
|
var container = new ContainerBuilder();
|
||||||
@ -155,21 +177,35 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RegisterServiceBus(IServiceCollection services)
|
private void RegisterEventBus(IServiceCollection services)
|
||||||
|
{
|
||||||
|
if (Configuration.GetValue<bool>("AzureServiceBusEnabled"))
|
||||||
|
{
|
||||||
|
services.AddSingleton<IEventBus, EventBusServiceBus>(sp =>
|
||||||
|
{
|
||||||
|
var serviceBusPersisterConnection = sp.GetRequiredService<IServiceBusPersisterConnection>();
|
||||||
|
var iLifetimeScope = sp.GetRequiredService<ILifetimeScope>();
|
||||||
|
var logger = sp.GetRequiredService<ILogger<EventBusServiceBus>>();
|
||||||
|
var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
|
||||||
|
var subscriptionClientName = Configuration["SubscriptionClientName"];
|
||||||
|
|
||||||
|
return new EventBusServiceBus(serviceBusPersisterConnection, logger,
|
||||||
|
eventBusSubcriptionsManager, subscriptionClientName, iLifetimeScope);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
services.AddSingleton<IEventBus, EventBusRabbitMQ>();
|
services.AddSingleton<IEventBus, EventBusRabbitMQ>();
|
||||||
services.AddSingleton<IEventBusSubscriptionsManager,
|
}
|
||||||
InMemoryEventBusSubscriptionsManager>();
|
|
||||||
|
|
||||||
services.AddTransient<IIntegrationEventHandler<UserLocationUpdatedIntegrationEvent>,
|
services.AddSingleton<IEventBusSubscriptionsManager, InMemoryEventBusSubscriptionsManager>();
|
||||||
UserLocationUpdatedIntegrationEventHandler>();
|
services.AddTransient<UserLocationUpdatedIntegrationEventHandler>();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ConfigureEventBus(IApplicationBuilder app)
|
private void ConfigureEventBus(IApplicationBuilder app)
|
||||||
{
|
{
|
||||||
var eventBus = app.ApplicationServices.GetRequiredService<IEventBus>();
|
var eventBus = app.ApplicationServices.GetRequiredService<IEventBus>();
|
||||||
eventBus.Subscribe<UserLocationUpdatedIntegrationEvent,
|
eventBus.Subscribe<UserLocationUpdatedIntegrationEvent, UserLocationUpdatedIntegrationEventHandler>();
|
||||||
IIntegrationEventHandler<UserLocationUpdatedIntegrationEvent>>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task WaitForSqlAvailabilityAsync(MarketingContext ctx, ILoggerFactory loggerFactory, IApplicationBuilder app, int retries = 0)
|
private async Task WaitForSqlAvailabilityAsync(MarketingContext ctx, ILoggerFactory loggerFactory, IApplicationBuilder app, int retries = 0)
|
||||||
|
@ -9,5 +9,7 @@
|
|||||||
"MongoConnectionString": "mongodb://nosql.data",
|
"MongoConnectionString": "mongodb://nosql.data",
|
||||||
"MongoDatabase": "MarketingDb",
|
"MongoDatabase": "MarketingDb",
|
||||||
"IdentityUrl": "http://localhost:5105",
|
"IdentityUrl": "http://localhost:5105",
|
||||||
"ExternalCatalogBaseUrl": "http://localhost:5110"
|
"ExternalCatalogBaseUrl": "http://localhost:5110",
|
||||||
|
"AzureServiceBusEnabled": true,
|
||||||
|
"SubscriptionClientName": "Marketing"
|
||||||
}
|
}
|
||||||
|
@ -4,11 +4,8 @@
|
|||||||
using Autofac;
|
using Autofac;
|
||||||
using Autofac.Extensions.DependencyInjection;
|
using Autofac.Extensions.DependencyInjection;
|
||||||
using global::Ordering.API.Application.IntegrationEvents;
|
using global::Ordering.API.Application.IntegrationEvents;
|
||||||
using global::Ordering.API.Application.IntegrationEvents.EventHandling;
|
|
||||||
using global::Ordering.API.Application.IntegrationEvents.Events;
|
using global::Ordering.API.Application.IntegrationEvents.Events;
|
||||||
using global::Ordering.API.Infrastructure.Middlewares;
|
|
||||||
using Infrastructure;
|
using Infrastructure;
|
||||||
using Infrastructure.Auth;
|
|
||||||
using Infrastructure.AutofacModules;
|
using Infrastructure.AutofacModules;
|
||||||
using Infrastructure.Filters;
|
using Infrastructure.Filters;
|
||||||
using Infrastructure.Services;
|
using Infrastructure.Services;
|
||||||
|
@ -9,6 +9,6 @@
|
|||||||
"Microsoft": "Information"
|
"Microsoft": "Information"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"AzureServiceBusEnabled": false,
|
"AzureServiceBusEnabled": true,
|
||||||
"SubscriptionClientName": "Ordering"
|
"SubscriptionClientName": "Ordering"
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\..\BuildingBlocks\EventBus\EventBusRabbitMQ\EventBusRabbitMQ.csproj" />
|
<ProjectReference Include="..\..\..\BuildingBlocks\EventBus\EventBusRabbitMQ\EventBusRabbitMQ.csproj" />
|
||||||
|
<ProjectReference Include="..\..\..\BuildingBlocks\EventBus\EventBusServiceBus\EventBusServiceBus.csproj" />
|
||||||
<ProjectReference Include="..\..\..\BuildingBlocks\EventBus\EventBus\EventBus.csproj" />
|
<ProjectReference Include="..\..\..\BuildingBlocks\EventBus\EventBus\EventBus.csproj" />
|
||||||
<ProjectReference Include="..\..\..\BuildingBlocks\EventBus\IntegrationEventLogEF\IntegrationEventLogEF.csproj" />
|
<ProjectReference Include="..\..\..\BuildingBlocks\EventBus\IntegrationEventLogEF\IntegrationEventLogEF.csproj" />
|
||||||
<ProjectReference Include="..\..\..\BuildingBlocks\HealthChecks\src\Microsoft.AspNetCore.HealthChecks\Microsoft.AspNetCore.HealthChecks.csproj" />
|
<ProjectReference Include="..\..\..\BuildingBlocks\HealthChecks\src\Microsoft.AspNetCore.HealthChecks\Microsoft.AspNetCore.HealthChecks.csproj" />
|
||||||
|
@ -12,6 +12,8 @@ using RabbitMQ.Client;
|
|||||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus;
|
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus;
|
||||||
using Payment.API.IntegrationEvents.Events;
|
using Payment.API.IntegrationEvents.Events;
|
||||||
using Payment.API.IntegrationEvents.EventHandling;
|
using Payment.API.IntegrationEvents.EventHandling;
|
||||||
|
using Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus;
|
||||||
|
using Microsoft.Azure.ServiceBus;
|
||||||
|
|
||||||
namespace Payment.API
|
namespace Payment.API
|
||||||
{
|
{
|
||||||
@ -35,6 +37,20 @@ namespace Payment.API
|
|||||||
// Add framework services.
|
// Add framework services.
|
||||||
services.AddMvc();
|
services.AddMvc();
|
||||||
services.Configure<PaymentSettings>(Configuration);
|
services.Configure<PaymentSettings>(Configuration);
|
||||||
|
if (Configuration.GetValue<bool>("AzureServiceBusEnabled"))
|
||||||
|
{
|
||||||
|
services.AddSingleton<IServiceBusPersisterConnection>(sp =>
|
||||||
|
{
|
||||||
|
var logger = sp.GetRequiredService<ILogger<DefaultServiceBusPersisterConnection>>();
|
||||||
|
|
||||||
|
var serviceBusConnectionString = Configuration["EventBusConnection"];
|
||||||
|
var serviceBusConnection = new ServiceBusConnectionStringBuilder(serviceBusConnectionString);
|
||||||
|
|
||||||
|
return new DefaultServiceBusPersisterConnection(serviceBusConnection, logger);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
services.AddSingleton<IRabbitMQPersistentConnection>(sp =>
|
services.AddSingleton<IRabbitMQPersistentConnection>(sp =>
|
||||||
{
|
{
|
||||||
var logger = sp.GetRequiredService<ILogger<DefaultRabbitMQPersistentConnection>>();
|
var logger = sp.GetRequiredService<ILogger<DefaultRabbitMQPersistentConnection>>();
|
||||||
@ -46,8 +62,9 @@ namespace Payment.API
|
|||||||
|
|
||||||
return new DefaultRabbitMQPersistentConnection(factory, logger);
|
return new DefaultRabbitMQPersistentConnection(factory, logger);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
RegisterServiceBus(services);
|
RegisterEventBus(services);
|
||||||
|
|
||||||
services.AddSwaggerGen(options =>
|
services.AddSwaggerGen(options =>
|
||||||
{
|
{
|
||||||
@ -84,13 +101,28 @@ namespace Payment.API
|
|||||||
ConfigureEventBus(app);
|
ConfigureEventBus(app);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RegisterServiceBus(IServiceCollection services)
|
private void RegisterEventBus(IServiceCollection services)
|
||||||
|
{
|
||||||
|
if (Configuration.GetValue<bool>("AzureServiceBusEnabled"))
|
||||||
|
{
|
||||||
|
services.AddSingleton<IEventBus, EventBusServiceBus>(sp =>
|
||||||
|
{
|
||||||
|
var serviceBusPersisterConnection = sp.GetRequiredService<IServiceBusPersisterConnection>();
|
||||||
|
var iLifetimeScope = sp.GetRequiredService<ILifetimeScope>();
|
||||||
|
var logger = sp.GetRequiredService<ILogger<EventBusServiceBus>>();
|
||||||
|
var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
|
||||||
|
var subscriptionClientName = Configuration["SubscriptionClientName"];
|
||||||
|
|
||||||
|
return new EventBusServiceBus(serviceBusPersisterConnection, logger,
|
||||||
|
eventBusSubcriptionsManager, subscriptionClientName, iLifetimeScope);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
services.AddSingleton<IEventBus, EventBusRabbitMQ>();
|
services.AddSingleton<IEventBus, EventBusRabbitMQ>();
|
||||||
services.AddSingleton<IEventBusSubscriptionsManager, InMemoryEventBusSubscriptionsManager>();
|
}
|
||||||
|
|
||||||
services.AddTransient<IIntegrationEventHandler<OrderStatusChangedToStockConfirmedIntegrationEvent>,
|
services.AddSingleton<IEventBusSubscriptionsManager, InMemoryEventBusSubscriptionsManager>();
|
||||||
OrderStatusChangedToStockConfirmedIntegrationEventHandler>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ConfigureEventBus(IApplicationBuilder app)
|
private void ConfigureEventBus(IApplicationBuilder app)
|
||||||
|
@ -5,5 +5,7 @@
|
|||||||
"Default": "Warning"
|
"Default": "Warning"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"PaymentSucceded": "true"
|
"PaymentSucceded": "true",
|
||||||
|
"AzureServiceBusEnabled": true,
|
||||||
|
"SubscriptionClientName": "Payment"
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ namespace Microsoft.eShopOnContainers.WebMVC
|
|||||||
public string OrderingUrl { get; set; }
|
public string OrderingUrl { get; set; }
|
||||||
public string BasketUrl { get; set; }
|
public string BasketUrl { get; set; }
|
||||||
public string MarketingUrl { get; set; }
|
public string MarketingUrl { get; set; }
|
||||||
|
public bool ActivateCampaignDetailFunction { get; set; }
|
||||||
public Logging Logging { get; set; }
|
public Logging Logging { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,19 +11,29 @@ namespace Microsoft.eShopOnContainers.WebMVC.Controllers
|
|||||||
using System;
|
using System;
|
||||||
using ViewModels.Pagination;
|
using ViewModels.Pagination;
|
||||||
using global::WebMVC.ViewModels;
|
using global::WebMVC.ViewModels;
|
||||||
|
using Microsoft.Extensions.Options;
|
||||||
|
|
||||||
[Authorize]
|
[Authorize]
|
||||||
public class CampaignsController : Controller
|
public class CampaignsController : Controller
|
||||||
{
|
{
|
||||||
private readonly ICampaignService _campaignService;
|
private readonly ICampaignService _campaignService;
|
||||||
|
private readonly AppSettings _settings;
|
||||||
|
|
||||||
public CampaignsController(ICampaignService campaignService) =>
|
public CampaignsController(ICampaignService campaignService, IOptionsSnapshot<AppSettings> settings)
|
||||||
|
{
|
||||||
_campaignService = campaignService;
|
_campaignService = campaignService;
|
||||||
|
_settings = settings.Value;
|
||||||
|
}
|
||||||
|
|
||||||
public async Task<IActionResult> Index(int page = 0, int pageSize = 10)
|
public async Task<IActionResult> Index(int page = 0, int pageSize = 10)
|
||||||
{
|
{
|
||||||
var campaignList = await _campaignService.GetCampaigns(pageSize, page);
|
var campaignList = await _campaignService.GetCampaigns(pageSize, page);
|
||||||
|
|
||||||
|
if(campaignList is null)
|
||||||
|
{
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
|
||||||
var totalPages = (int) Math.Ceiling((decimal) campaignList.Count / pageSize);
|
var totalPages = (int) Math.Ceiling((decimal) campaignList.Count / pageSize);
|
||||||
|
|
||||||
var vm = new CampaignViewModel
|
var vm = new CampaignViewModel
|
||||||
@ -40,6 +50,8 @@ namespace Microsoft.eShopOnContainers.WebMVC.Controllers
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ViewBag.IsCampaignDetailFunctionActive = _settings.ActivateCampaignDetailFunction;
|
||||||
|
|
||||||
return View(vm);
|
return View(vm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,5 +15,6 @@
|
|||||||
public DateTime To { get; set; }
|
public DateTime To { get; set; }
|
||||||
|
|
||||||
public string PictureUri { get; set; }
|
public string PictureUri { get; set; }
|
||||||
|
public string DetailsUri { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -13,10 +13,8 @@
|
|||||||
new Header() { Controller = "Catalog", Text = "Back to catalog" } })
|
new Header() { Controller = "Catalog", Text = "Back to catalog" } })
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
@if (Model.CampaignItems != null && Model.CampaignItems.Any())
|
@if(Model != null && Model.CampaignItems.Any())
|
||||||
{
|
{
|
||||||
@Html.Partial("_pagination", Model.PaginationInfo)
|
|
||||||
|
|
||||||
<div class="card-group esh-campaigns-items row">
|
<div class="card-group esh-campaigns-items row">
|
||||||
@foreach (var catalogItem in Model.CampaignItems)
|
@foreach (var catalogItem in Model.CampaignItems)
|
||||||
{
|
{
|
||||||
|
@ -1,12 +1,17 @@
|
|||||||
@model CampaignItem
|
@model CampaignItem
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<form asp-controller="Campaigns" asp-action="Details" asp-route-id="@Model.Id">
|
<form asp-controller="Campaigns" asp-action="Details" asp-route-id="@Model.Id">
|
||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
<h4 class="card-title esh-campaigns-name">@Model.Name</h4>
|
<h4 class="card-title esh-campaigns-name">@Model.Name</h4>
|
||||||
<img class="card-img-top esh-campaigns-thumbnail" src="@Model.PictureUri" alt="@Model.Name">
|
<img class="card-img-top esh-campaigns-thumbnail" src="@Model.PictureUri" alt="@Model.Name">
|
||||||
|
@if (ViewBag.IsCampaignDetailFunctionActive == true)
|
||||||
|
{
|
||||||
|
<input type="button" value="More Details" class="btn esh-campaigns-button" onClick="window.open('@Model.DetailsUri')">
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
<input class="esh-campaigns-button" type="submit" value="More details">
|
<input class="esh-campaigns-button" type="submit" value="More details">
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
<div class="card-footer">
|
<div class="card-footer">
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
"CallBackUrl": "http://localhost:5100/",
|
"CallBackUrl": "http://localhost:5100/",
|
||||||
"IsClusterEnv": "False",
|
"IsClusterEnv": "False",
|
||||||
"UseResilientHttp": "True",
|
"UseResilientHttp": "True",
|
||||||
|
"ActivateCampaignDetailFunction": "True",
|
||||||
"Logging": {
|
"Logging": {
|
||||||
"IncludeScopes": false,
|
"IncludeScopes": false,
|
||||||
"LogLevel": {
|
"LogLevel": {
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
var content = new StringContent(JsonConvert.SerializeObject(location),
|
var content = new StringContent(JsonConvert.SerializeObject(location),
|
||||||
Encoding.UTF8, "application/json");
|
Encoding.UTF8, "application/json");
|
||||||
|
|
||||||
var userId = new Guid("4611ce3f-380d-4db5-8d76-87a8689058ed");
|
var userId = new Guid("05a98cc6-0559-4011-9e2d-b5df524004b6");
|
||||||
|
|
||||||
|
|
||||||
// GIVEN a new location of user is created
|
// GIVEN a new location of user is created
|
||||||
@ -52,7 +52,7 @@
|
|||||||
responseBody = await UserLocationCampaignResponse.Content.ReadAsStringAsync();
|
responseBody = await UserLocationCampaignResponse.Content.ReadAsStringAsync();
|
||||||
var userLocationCampaigns = JsonConvert.DeserializeObject<PaginatedItemsViewModel<CampaignDTO>>(responseBody);
|
var userLocationCampaigns = JsonConvert.DeserializeObject<PaginatedItemsViewModel<CampaignDTO>>(responseBody);
|
||||||
|
|
||||||
Assert.True(userLocationCampaigns.Data != null);
|
Assert.True(userLocationCampaigns.Count > 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
{
|
{
|
||||||
"ConnectionString": "Server=tcp:127.0.0.1,5433;Initial Catalog=Microsoft.eShopOnContainers.Services.MarketingDb;User Id=sa;Password=Pass@word",
|
"ConnectionString": "Server=tcp:eshopsql-ez55a72p6wm62.database.windows.net,1433;Initial Catalog=marketingdb;Persist Security Info=False;User ID=eshop;Password=Pass@word!;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;",
|
||||||
"MongoConnectionString": "mongodb://localhost:27017",
|
"MongoConnectionString": "mongodb://eshop-nosqlez55a72p6wm62:l8jMNoLHFXOijAvaVMjHeCwHK8gAR9SovuK86uCOvwfnMhuhwytPKByOPqrQrlsDz9RPFet2J6SzEbBQXLZokA==@eshop-nosqlez55a72p6wm62.documents.azure.com:10255/?ssl=true&replicaSet=globaldb",
|
||||||
"MongoDatabase": "MarketingDb",
|
"MongoDatabase": "MarketingDb",
|
||||||
"IdentityUrl": "http://localhost:5105",
|
"IdentityUrl": "http://localhost:5105",
|
||||||
"isTest": "true",
|
"isTest": "true",
|
||||||
"EventBusConnection": "localhost"
|
"EventBusConnection": "Endpoint=sb://eshopsbez55a72p6wm62.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=Iv+cC7Wgwc8SCrE5AXrguRW6kRMk6vR7crTVBom5nPU=;EntityPath=eshop_event_bus",
|
||||||
|
"AzureServiceBusEnabled": true,
|
||||||
|
"SubscriptionClientName": "Marketing"
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user