18 | Swapping to Development environment will display more detailed information about the error that occurred.
19 |
20 |
21 | The Development environment shouldn't be enabled for deployed applications.
22 | It can result in displaying sensitive information from exceptions to end users.
23 | For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development
24 | and restarting the app.
25 |
26 |
--------------------------------------------------------------------------------
/src/Samples/GeekTime.BadSite/Views/Shared/_ValidationScriptsPartial.cshtml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/src/Samples/GeekTime.BadSite/Views/_ViewImports.cshtml:
--------------------------------------------------------------------------------
1 | @using GeekTime.BadSite
2 | @using GeekTime.BadSite.Models
3 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
4 |
--------------------------------------------------------------------------------
/src/Samples/GeekTime.BadSite/Views/_ViewStart.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | Layout = "_Layout";
3 | }
4 |
--------------------------------------------------------------------------------
/src/Samples/GeekTime.BadSite/appsettings.Development.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Information",
5 | "Microsoft": "Warning",
6 | "Microsoft.Hosting.Lifetime": "Information"
7 | }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/src/Samples/GeekTime.BadSite/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Trace",
5 | "Microsoft": "Warning",
6 | "Microsoft.Hosting.Lifetime": "Information"
7 | }
8 | },
9 | "AllowedHosts": "*"
10 | }
11 |
--------------------------------------------------------------------------------
/src/Samples/GeekTime.BadSite/wwwroot/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/witskeeper/geektime/0db78282a8719919b055a077b631150c210d447e/src/Samples/GeekTime.BadSite/wwwroot/favicon.ico
--------------------------------------------------------------------------------
/src/Samples/GeekTime.BadSite/wwwroot/js/site.js:
--------------------------------------------------------------------------------
1 | // Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification
2 | // for details on configuring this project to bundle and minify static web assets.
3 |
4 | // Write your JavaScript code.
5 |
--------------------------------------------------------------------------------
/src/Samples/GeekTime.BadSite/wwwroot/lib/bootstrap/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2011-2018 Twitter, Inc.
4 | Copyright (c) 2011-2018 The Bootstrap Authors
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 |
--------------------------------------------------------------------------------
/src/Samples/GeekTime.BadSite/wwwroot/lib/jquery-validation-unobtrusive/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Copyright (c) .NET Foundation. All rights reserved.
2 |
3 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4 | these files except in compliance with the License. You may obtain a copy of the
5 | License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software distributed
10 | under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
11 | CONDITIONS OF ANY KIND, either express or implied. See the License for the
12 | specific language governing permissions and limitations under the License.
13 |
--------------------------------------------------------------------------------
/src/Samples/GeekTime.BadSite/wwwroot/lib/jquery-validation/LICENSE.md:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 | =====================
3 |
4 | Copyright Jörn Zaefferer
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 |
--------------------------------------------------------------------------------
/src/Samples/GeekTime.GoodSite/GeekTime.GoodSite.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp3.1
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/src/Samples/GeekTime.GoodSite/Models/ErrorViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace GeekTime.GoodSite.Models
4 | {
5 | public class ErrorViewModel
6 | {
7 | public string RequestId { get; set; }
8 |
9 | public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/Samples/GeekTime.GoodSite/Models/OrderModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 |
6 | namespace GeekTime.GoodSite.Models
7 | {
8 | public class OrderModel
9 | {
10 | public long Id { get; set; }
11 |
12 | public DateTime Date { get; set; }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/Samples/GeekTime.GoodSite/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.AspNetCore.Hosting;
6 | using Microsoft.Extensions.Configuration;
7 | using Microsoft.Extensions.Hosting;
8 | using Microsoft.Extensions.Logging;
9 |
10 | namespace GeekTime.GoodSite
11 | {
12 | public class Program
13 | {
14 | public static void Main(string[] args)
15 | {
16 | CreateHostBuilder(args).Build().Run();
17 | }
18 |
19 | public static IHostBuilder CreateHostBuilder(string[] args) =>
20 | Host.CreateDefaultBuilder(args)
21 | .ConfigureWebHostDefaults(webBuilder =>
22 | {
23 | webBuilder.UseStartup();
24 | });
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/Samples/GeekTime.GoodSite/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "iisSettings": {
3 | "windowsAuthentication": false,
4 | "anonymousAuthentication": true,
5 | "iisExpress": {
6 | "applicationUrl": "http://localhost:16401",
7 | "sslPort": 44336
8 | }
9 | },
10 | "profiles": {
11 | "IIS Express": {
12 | "commandName": "IISExpress",
13 | "launchBrowser": true,
14 | "environmentVariables": {
15 | "ASPNETCORE_ENVIRONMENT": "Development"
16 | }
17 | },
18 | "GeekTime.GoodSite": {
19 | "commandName": "Project",
20 | "launchBrowser": true,
21 | "applicationUrl": "https://localhost:5003;http://localhost:5002",
22 | "environmentVariables": {
23 | "ASPNETCORE_ENVIRONMENT": "Development"
24 | }
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/Samples/GeekTime.GoodSite/Startup.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/witskeeper/geektime/0db78282a8719919b055a077b631150c210d447e/src/Samples/GeekTime.GoodSite/Startup.cs
--------------------------------------------------------------------------------
/src/Samples/GeekTime.GoodSite/Views/Home/Index.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewData["Title"] = "Home Page";
3 | }
4 |
5 |
18 | Swapping to Development environment will display more detailed information about the error that occurred.
19 |
20 |
21 | The Development environment shouldn't be enabled for deployed applications.
22 | It can result in displaying sensitive information from exceptions to end users.
23 | For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development
24 | and restarting the app.
25 |
26 |
--------------------------------------------------------------------------------
/src/Samples/GeekTime.GoodSite/Views/Shared/_ValidationScriptsPartial.cshtml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/src/Samples/GeekTime.GoodSite/Views/_ViewImports.cshtml:
--------------------------------------------------------------------------------
1 | @using GeekTime.GoodSite
2 | @using GeekTime.GoodSite.Models
3 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
4 |
--------------------------------------------------------------------------------
/src/Samples/GeekTime.GoodSite/Views/_ViewStart.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | Layout = "_Layout";
3 | }
4 |
--------------------------------------------------------------------------------
/src/Samples/GeekTime.GoodSite/appsettings.Development.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Information",
5 | "Microsoft": "Information",
6 | "Microsoft.Hosting.Lifetime": "Information"
7 | }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/src/Samples/GeekTime.GoodSite/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Information",
5 | "Microsoft": "Warning",
6 | "Microsoft.Hosting.Lifetime": "Information"
7 | }
8 | },
9 | "AllowedHosts": "*",
10 | "RedisCache": {
11 | "Configuration": "localhost:6379",
12 | "InstanceName": "GoodSite"
13 | },
14 | "easycaching": {
15 | "redis": {
16 | "MaxRdSecond": 120,
17 | "EnableLogging": false,
18 | "LockMs": 5000,
19 | "SleepMs": 300,
20 | "dbconfig": {
21 | "Password": null,
22 | "IsSsl": false,
23 | "SslHost": null,
24 | "ConnectionTimeout": 5000,
25 | "AllowAdmin": true,
26 | "Endpoints": [
27 | {
28 | "Host": "localhost",
29 | "Port": 6379
30 | }
31 | ],
32 | "Database": 0
33 | }
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/Samples/GeekTime.GoodSite/wwwroot/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/witskeeper/geektime/0db78282a8719919b055a077b631150c210d447e/src/Samples/GeekTime.GoodSite/wwwroot/favicon.ico
--------------------------------------------------------------------------------
/src/Samples/GeekTime.GoodSite/wwwroot/js/site.js:
--------------------------------------------------------------------------------
1 | // Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification
2 | // for details on configuring this project to bundle and minify static web assets.
3 |
4 | // Write your JavaScript code.
5 |
--------------------------------------------------------------------------------
/src/Samples/GeekTime.GoodSite/wwwroot/lib/bootstrap/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2011-2018 Twitter, Inc.
4 | Copyright (c) 2011-2018 The Bootstrap Authors
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 |
--------------------------------------------------------------------------------
/src/Samples/GeekTime.GoodSite/wwwroot/lib/jquery-validation-unobtrusive/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Copyright (c) .NET Foundation. All rights reserved.
2 |
3 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4 | these files except in compliance with the License. You may obtain a copy of the
5 | License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software distributed
10 | under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
11 | CONDITIONS OF ANY KIND, either express or implied. See the License for the
12 | specific language governing permissions and limitations under the License.
13 |
--------------------------------------------------------------------------------
/src/Samples/GeekTime.GoodSite/wwwroot/lib/jquery-validation/LICENSE.md:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 | =====================
3 |
4 | Copyright Jörn Zaefferer
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 |
--------------------------------------------------------------------------------
/src/Services/Identity/GeekTime.Identity.API/Dockerfile:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/witskeeper/geektime/0db78282a8719919b055a077b631150c210d447e/src/Services/Identity/GeekTime.Identity.API/Dockerfile
--------------------------------------------------------------------------------
/src/Services/Identity/GeekTime.Identity.API/GeekTime.Identity.API.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp3.1
5 | cb6b9c05-a918-4b1e-92d3-02fb2a2645d1
6 | Linux
7 | ..\..\..\..
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/src/Services/Identity/GeekTime.Identity.API/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.AspNetCore.Hosting;
6 | using Microsoft.Extensions.Configuration;
7 | using Microsoft.Extensions.Hosting;
8 | using Microsoft.Extensions.Logging;
9 |
10 | namespace GeekTime.Identity.API
11 | {
12 | public class Program
13 | {
14 | public static void Main(string[] args)
15 | {
16 | CreateHostBuilder(args).Build().Run();
17 | }
18 |
19 | public static IHostBuilder CreateHostBuilder(string[] args) =>
20 | Host.CreateDefaultBuilder(args)
21 | .ConfigureWebHostDefaults(webBuilder =>
22 | {
23 | webBuilder.UseStartup();
24 | });
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/Services/Identity/GeekTime.Identity.API/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "iisSettings": {
3 | "windowsAuthentication": false,
4 | "anonymousAuthentication": true,
5 | "iisExpress": {
6 | "applicationUrl": "http://localhost:38819",
7 | "sslPort": 44333
8 | }
9 | },
10 | "$schema": "http://json.schemastore.org/launchsettings.json",
11 | "profiles": {
12 | "IIS Express": {
13 | "commandName": "IISExpress",
14 | "launchBrowser": true,
15 | "launchUrl": "weatherforecast",
16 | "environmentVariables": {
17 | "ASPNETCORE_ENVIRONMENT": "Development"
18 | }
19 | },
20 | "GeekTime.Identity.API": {
21 | "commandName": "Project",
22 | "launchBrowser": true,
23 | "launchUrl": "weatherforecast",
24 | "environmentVariables": {
25 | "ASPNETCORE_ENVIRONMENT": "Development"
26 | },
27 | "applicationUrl": "https://localhost:5001;http://localhost:5000"
28 | },
29 | "Docker": {
30 | "commandName": "Docker",
31 | "launchBrowser": true,
32 | "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/weatherforecast",
33 | "publishAllPorts": true,
34 | "useSSL": true
35 | }
36 | }
37 | }
--------------------------------------------------------------------------------
/src/Services/Identity/GeekTime.Identity.API/WeatherForecast.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace GeekTime.Identity.API
4 | {
5 | public class WeatherForecast
6 | {
7 | public DateTime Date { get; set; }
8 |
9 | public int TemperatureC { get; set; }
10 |
11 | public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
12 |
13 | public string Summary { get; set; }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/Services/Identity/GeekTime.Identity.API/appsettings.Development.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Information",
5 | "Microsoft": "Warning",
6 | "Microsoft.Hosting.Lifetime": "Information"
7 | }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/src/Services/Identity/GeekTime.Identity.API/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Information",
5 | "Microsoft": "Warning",
6 | "Microsoft.Hosting.Lifetime": "Information"
7 | }
8 | },
9 | "AllowedHosts": "*"
10 | }
11 |
--------------------------------------------------------------------------------
/src/Services/Identity/GeekTime.Identity.API/skyapm.json:
--------------------------------------------------------------------------------
1 | {
2 | "SkyWalking": {
3 | "ServiceName": "identity-api",
4 | "Namespace": "",
5 | "HeaderVersions": [
6 | "sw6"
7 | ],
8 | "Sampling": {
9 | "SamplePer3Secs": -1,
10 | "Percentage": -1.0
11 | },
12 | "Logging": {
13 | "Level": "Information",
14 | "FilePath": "logs\\skyapm-{Date}.log"
15 | },
16 | "Transport": {
17 | "Interval": 3000,
18 | "ProtocolVersion": "v6",
19 | "QueueSize": 30000,
20 | "BatchSize": 3000,
21 | "gRPC": {
22 | "Servers": "localhost:11800",
23 | "Timeout": 10000,
24 | "ConnectTimeout": 10000,
25 | "ReportTimeout": 600000
26 | }
27 | }
28 | }
29 | }
--------------------------------------------------------------------------------
/src/Services/Ordering/GeekTime.Ordering.API/Application/Commands/CreateOrderCommand.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using MediatR;
6 |
7 | namespace GeekTime.Ordering.API.Application.Commands
8 | {
9 | public class CreateOrderCommand : IRequest
10 | {
11 |
12 | //ublic CreateOrderCommand() { }
13 | public CreateOrderCommand(int itemCount)
14 | {
15 | ItemCount = itemCount;
16 | }
17 |
18 | public long ItemCount { get; private set; }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/Services/Ordering/GeekTime.Ordering.API/Application/DomainEventHandlers/OrderCreatedDomainEventHandler.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading;
5 | using System.Threading.Tasks;
6 | using GeekTime.Domain;
7 | using GeekTime.Ordering.Domain.Events;
8 | using DotNetCore.CAP;
9 | using GeekTime.Ordering.API.Application.IntegrationEvents;
10 |
11 | namespace GeekTime.Ordering.API.Application.DomainEventHandlers
12 | {
13 | public class OrderCreatedDomainEventHandler : IDomainEventHandler
14 | {
15 | ICapPublisher _capPublisher;
16 | public OrderCreatedDomainEventHandler(ICapPublisher capPublisher)
17 | {
18 | _capPublisher = capPublisher;
19 | }
20 |
21 | public async Task Handle(OrderCreatedDomainEvent notification, CancellationToken cancellationToken)
22 | {
23 | await _capPublisher.PublishAsync("OrderCreated", new OrderCreatedIntegrationEvent(notification.Order.Id));
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/Services/Ordering/GeekTime.Ordering.API/Application/IntegrationEvents/ISubscriberService.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 |
6 | namespace GeekTime.Ordering.API.Application.IntegrationEvents
7 | {
8 | public interface ISubscriberService
9 | {
10 | void OrderPaymentSucceeded(OrderPaymentSucceededIntegrationEvent @event);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/src/Services/Ordering/GeekTime.Ordering.API/Application/IntegrationEvents/OrderCreatedIntegrationEvent.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 |
6 | namespace GeekTime.Ordering.API.Application.IntegrationEvents
7 | {
8 | public class OrderCreatedIntegrationEvent
9 | {
10 | public OrderCreatedIntegrationEvent(long orderId) => OrderId = orderId;
11 | public long OrderId { get; }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/Services/Ordering/GeekTime.Ordering.API/Application/IntegrationEvents/OrderPaymentSucceededIntegrationEvent.cs:
--------------------------------------------------------------------------------
1 | namespace GeekTime.Ordering.API.Application.IntegrationEvents
2 | {
3 | public class OrderPaymentSucceededIntegrationEvent
4 | {
5 | public OrderPaymentSucceededIntegrationEvent(long orderId) => OrderId = orderId;
6 | public long OrderId { get; }
7 | }
8 |
9 | }
10 |
--------------------------------------------------------------------------------
/src/Services/Ordering/GeekTime.Ordering.API/Application/IntegrationEvents/SubscriberService.cs:
--------------------------------------------------------------------------------
1 | using DotNetCore.CAP;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 | using MediatR;
7 | namespace GeekTime.Ordering.API.Application.IntegrationEvents
8 | {
9 | public class SubscriberService : ISubscriberService, ICapSubscribe
10 | {
11 | IMediator _mediator;
12 | public SubscriberService(IMediator mediator)
13 | {
14 | _mediator = mediator;
15 | }
16 |
17 |
18 | [CapSubscribe("OrderPaymentSucceeded")]
19 | public void OrderPaymentSucceeded(OrderPaymentSucceededIntegrationEvent @event)
20 | {
21 | //Do SomeThing
22 | }
23 |
24 | [CapSubscribe("OrderCreated")]
25 | public void OrderCreated(OrderCreatedIntegrationEvent @event)
26 | {
27 |
28 |
29 |
30 |
31 | //Do SomeThing
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/Services/Ordering/GeekTime.Ordering.API/Application/Queries/MyOrderQuery.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using MediatR;
6 | namespace GeekTime.Ordering.API.Application.Queries
7 | {
8 | public class MyOrderQuery : IRequest>
9 | {
10 | public string UserName { get; set; }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/src/Services/Ordering/GeekTime.Ordering.API/Application/Queries/MyOrderQueryHandler.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading;
5 | using System.Threading.Tasks;
6 | using MediatR;
7 | namespace GeekTime.Ordering.API.Application.Queries
8 | {
9 | public class MyOrderQueryHandler : IRequestHandler>
10 | {
11 | public Task> Handle(MyOrderQuery request, CancellationToken cancellationToken)
12 | {
13 | return Task.FromResult(new List() { DateTime.Now.ToString() });
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/Services/Ordering/GeekTime.Ordering.API/Dockerfile:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/witskeeper/geektime/0db78282a8719919b055a077b631150c210d447e/src/Services/Ordering/GeekTime.Ordering.API/Dockerfile
--------------------------------------------------------------------------------
/src/Services/Ordering/GeekTime.Ordering.API/Extensions/ApplicationBuilderExtensions.cs:
--------------------------------------------------------------------------------
1 | namespace GeekTime.Ordering.API.Extensions
2 | {
3 | public static class ApplicationBuilderExtensions
4 | {
5 |
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/src/Services/Ordering/GeekTime.Ordering.API/Grpc/ordering.proto:
--------------------------------------------------------------------------------
1 | syntax = "proto3";
2 | import "google/protobuf/wrappers.proto";
3 | option csharp_namespace = "GeekTime.Ordering.API.Grpc";
4 |
5 |
6 | service OrderService {
7 |
8 | rpc CreateOrder(CreateOrderCommand) returns (google.protobuf.Int64Value);
9 |
10 | rpc Search(SearchRequest) returns (SearchResponse);
11 | }
12 |
13 |
14 | message CreateOrderCommand{
15 | int32 ItemCount = 1;
16 | }
17 |
18 | message Order {
19 | int64 Id = 1;
20 | int64 UserId = 2;
21 | string UserName = 3;
22 | Address Address = 4;
23 | string ItemCount = 5;
24 | }
25 |
26 | message Address{
27 | string Street = 1;
28 | string City = 2;
29 | string ZipCode = 3;
30 | }
31 |
32 |
33 | message SearchRequest{
34 | string UserName = 1;
35 | }
36 |
37 | message SearchResponse{
38 | repeated string Orders = 1;
39 | }
--------------------------------------------------------------------------------
/src/Services/Ordering/GeekTime.Ordering.API/Startup.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/witskeeper/geektime/0db78282a8719919b055a077b631150c210d447e/src/Services/Ordering/GeekTime.Ordering.API/Startup.cs
--------------------------------------------------------------------------------
/src/Services/Ordering/GeekTime.Ordering.API/appsettings.Development.json:
--------------------------------------------------------------------------------
1 | {
2 | }
3 |
--------------------------------------------------------------------------------
/src/Services/Ordering/GeekTime.Ordering.API/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "Kestrel": {
3 | "Endpoints": {
4 | "Http": {
5 | "Url": "http://+:5000"
6 | },
7 | "Https": {
8 | "Url": "https://+:5001"
9 | },
10 | "Http2": {
11 | "Url": "http://+:5002",
12 | "Protocols": "Http2"
13 | }
14 | }
15 | },
16 | "Logging": {
17 | "LogLevel": {
18 | "Default": "Trace",
19 | "Microsoft": "Trace",
20 | "Microsoft.Hosting.Lifetime": "Trace"
21 | }
22 | },
23 | "Serilog": {
24 | "MinimumLevel": {
25 | "Default": "Error",
26 | "Override": {
27 | "Microsoft": "Error",
28 | "System": "Error"
29 | }
30 | }
31 | },
32 | "exceptionless": {
33 | "ApiKey": "PSaokqmXC8T4xgWal9I0atA8TlYG7Ytz65JvxAL3",
34 | "ServerUrl": "http://localhost:30012"
35 | },
36 | "AllowedHosts": "*",
37 | "Mysql": "server=localhost;port=3306;user id=root;password=123456;database=geektime;charset=utf8mb4;ConnectionReset=false;",
38 | "RabbitMQ": {
39 | "HostName": "localhost",
40 | "UserName": "guest",
41 | "Password": "guest",
42 | "VirtualHost": "/",
43 | "ExchangeName": "geek_queue"
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/Services/Ordering/GeekTime.Ordering.API/skyapm.json:
--------------------------------------------------------------------------------
1 | {
2 | "SkyWalking": {
3 | "ServiceName": "ordering-api",
4 | "Namespace": "",
5 | "HeaderVersions": [
6 | "sw6"
7 | ],
8 | "Sampling": {
9 | "SamplePer3Secs": -1,
10 | "Percentage": -1.0
11 | },
12 | "Logging": {
13 | "Level": "Information",
14 | "FilePath": "logs\\skyapm-{Date}.log"
15 | },
16 | "Transport": {
17 | "Interval": 3000,
18 | "ProtocolVersion": "v6",
19 | "QueueSize": 30000,
20 | "BatchSize": 3000,
21 | "gRPC": {
22 | "Servers": "localhost:11800",
23 | "Timeout": 10000,
24 | "ConnectTimeout": 10000,
25 | "ReportTimeout": 600000
26 | }
27 | }
28 | }
29 | }
--------------------------------------------------------------------------------
/src/Services/Ordering/GeekTime.Ordering.BackgroundTasks/GeekTime.Ordering.BackgroundTasks.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | netcoreapp3.1
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/src/Services/Ordering/GeekTime.Ordering.BackgroundTasks/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace GeekTime.Ordering.BackgroundTasks
4 | {
5 | class Program
6 | {
7 | static void Main(string[] args)
8 | {
9 | Console.WriteLine("Hello World!");
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/src/Services/Ordering/GeekTime.Ordering.Domain/Events/OrderCreatedDomainEvent.cs:
--------------------------------------------------------------------------------
1 | using GeekTime.Domain;
2 | using GeekTime.Ordering.Domain.OrderAggregate;
3 |
4 | namespace GeekTime.Ordering.Domain.Events
5 | {
6 | public class OrderCreatedDomainEvent : IDomainEvent
7 | {
8 | public Order Order { get; private set; }
9 | public OrderCreatedDomainEvent(Order order)
10 | {
11 | this.Order = order;
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/Services/Ordering/GeekTime.Ordering.Domain/GeekTime.Ordering.Domain.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/src/Services/Ordering/GeekTime.Ordering.Domain/OrderAggregate/Address.cs:
--------------------------------------------------------------------------------
1 | using GeekTime.Domain;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Text;
5 |
6 | namespace GeekTime.Ordering.Domain.OrderAggregate
7 | {
8 | public class Address : ValueObject
9 | {
10 | public string Street { get; private set; }
11 | public string City { get; private set; }
12 | public string ZipCode { get; private set; }
13 |
14 | public Address() { }
15 | public Address(string street, string city, string zipcode)
16 | {
17 | Street = street;
18 | City = city;
19 | ZipCode = zipcode;
20 | }
21 |
22 | protected override IEnumerable