Skip to content

Commit 9bf5670

Browse files
committed
Created Marketing read data model
1 parent 4be61ab commit 9bf5670

32 files changed

Lines changed: 430 additions & 39 deletions

docker-compose-windows.override.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,16 @@ services:
9595
- identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105.
9696
- EventBusConnection=rabbitmq
9797
ports:
98-
- "5109:80"
98+
- "5109:80"
99+
100+
marketing.api:
101+
environment:
102+
- ASPNETCORE_ENVIRONMENT=Development
103+
- ASPNETCORE_URLS=http://0.0.0.0:80
104+
- ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.MarketingDb;User Id=sa;Password=Pass@word
105+
- EventBusConnection=rabbitmq
106+
- MongoConnectionString=mongodb://nosql.data
107+
- MongoDatabase=MarketingDb
108+
- identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105.
109+
ports:
110+
- "5110:80"

docker-compose-windows.prod.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,19 @@ services:
7575
- BasketUrl=http://basket.api
7676
ports:
7777
- "5100:80"
78-
78+
79+
marketing.api:
80+
environment:
81+
- ASPNETCORE_ENVIRONMENT=Production
82+
- ASPNETCORE_URLS=http://0.0.0.0:80
83+
- ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.MarketingDb;User Id=sa;Password=Pass@word
84+
- EventBusConnection=rabbitmq
85+
- MongoConnectionString=mongodb://nosql.data
86+
- MongoDatabase=MarketingDb
87+
- identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105.
88+
ports:
89+
- "5110:80"
90+
7991
sql.data:
8092
environment:
8193
- SA_PASSWORD=Pass@word

docker-compose-windows.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,19 @@ services:
6161
dockerfile: Dockerfile
6262
depends_on:
6363
- nosql.data
64-
64+
- rabbitmq
65+
66+
marketing.api:
67+
image: eshop/marketing.api
68+
build:
69+
context: ./src/Services/Marketing/Marketing.API
70+
dockerfile: Dockerfile
71+
depends_on:
72+
- sql.data
73+
- nosql.data
74+
- identity.api
75+
- rabbitmq
76+
6577
sql.data:
6678
image: microsoft/mssql-server-windows
6779

docker-compose.override.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ services:
5858
- ASPNETCORE_ENVIRONMENT=Development
5959
- ASPNETCORE_URLS=http://0.0.0.0:80
6060
- ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.MarketingDb;User Id=sa;Password=Pass@word
61+
- MongoConnectionString=mongodb://nosql.data
62+
- MongoDatabase=MarketingDb
63+
- EventBusConnection=rabbitmq
6164
- identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105.
6265
ports:
6366
- "5110:80"

docker-compose.prod.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ services:
5959
- ASPNETCORE_ENVIRONMENT=Production
6060
- ASPNETCORE_URLS=http://0.0.0.0:80
6161
- ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.MarketingDb;User Id=sa;Password=Pass@word
62+
- MongoConnectionString=mongodb://nosql.data
63+
- MongoDatabase=MarketingDb
64+
- EventBusConnection=rabbitmq
6265
- identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105.
6366
ports:
6467
- "5110:80"

docker-compose.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ services:
5353
dockerfile: Dockerfile
5454
depends_on:
5555
- sql.data
56+
- nosql.data
5657
- identity.api
58+
- rabbitmq
5759

5860
webspa:
5961
image: eshop/webspa
@@ -112,3 +114,4 @@ services:
112114
dockerfile: Dockerfile
113115
depends_on:
114116
- nosql.data
117+
- rabbitmq

src/Services/Location/Locations.API/Controllers/LocationsController.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ public LocationsController(ILocationsService locationsService, IIdentityService
2121
}
2222

2323
//GET api/v1/[controller]/user/1
24-
[Route("user/{userId:int}")]
24+
[Route("user/{userId:guid}")]
2525
[HttpGet]
26-
public async Task<IActionResult> GetUserLocation(int userId)
26+
public async Task<IActionResult> GetUserLocation(Guid userId)
2727
{
28-
var userLocation = await _locationsService.GetUserLocation(userId);
28+
var userLocation = await _locationsService.GetUserLocation(userId.ToString());
2929
return Ok(userLocation);
3030
}
3131

@@ -54,6 +54,7 @@ public async Task<IActionResult> CreateOrUpdateUserLocation([FromBody]LocationRe
5454
{
5555
var userId = _identityService.GetUserIdentity();
5656
var result = await _locationsService.AddOrUpdateUserLocation(userId, newLocReq);
57+
5758
return result ?
5859
(IActionResult)Ok() :
5960
(IActionResult)BadRequest();

src/Services/Location/Locations.API/Infrastructure/Repositories/ILocationsRepository.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public interface ILocationsRepository
1111

1212
Task<List<Locations>> GetLocationListAsync();
1313

14-
Task<UserLocation> GetUserLocationAsync(int userId);
14+
Task<UserLocation> GetUserLocationAsync(string userId);
1515

1616
Task<List<Locations>> GetCurrentUserRegionsListAsync(LocationRequest currentPosition);
1717

src/Services/Location/Locations.API/Infrastructure/Repositories/LocationsRepository.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public async Task<Locations> GetAsync(string locationId)
2828
.FirstOrDefaultAsync();
2929
}
3030

31-
public async Task<UserLocation> GetUserLocationAsync(int userId)
31+
public async Task<UserLocation> GetUserLocationAsync(string userId)
3232
{
3333
var filter = Builders<UserLocation>.Filter.Eq("UserId", userId);
3434
return await _context.UserLocation

src/Services/Location/Locations.API/Infrastructure/Services/ILocationsService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public interface ILocationsService
99
{
1010
Task<Locations> GetLocation(string locationId);
1111

12-
Task<UserLocation> GetUserLocation(int id);
12+
Task<UserLocation> GetUserLocation(string id);
1313

1414
Task<List<Locations>> GetAllLocation();
1515

0 commit comments

Comments
 (0)