Skip to content
This repository has been archived by the owner on Jun 14, 2023. It is now read-only.

feat: add schedules #51

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Arkadia.sln
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Notifications", "sources\No
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cdn", "sources\Cdn\Cdn.csproj", "{F5F8C40C-6CA8-467D-8E39-0CA2CFB268CE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Schedules", "sources\Schedules\Schedules.csproj", "{AEB22862-3DCE-4EC9-A9E6-1779ECC76707}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -78,6 +80,14 @@ Global
{F5F8C40C-6CA8-467D-8E39-0CA2CFB268CE}.Release|Any CPU.Build.0 = Release|Any CPU
{F5F8C40C-6CA8-467D-8E39-0CA2CFB268CE}.Release|x64.ActiveCfg = Release|Any CPU
{F5F8C40C-6CA8-467D-8E39-0CA2CFB268CE}.Release|x64.Build.0 = Release|Any CPU
{AEB22862-3DCE-4EC9-A9E6-1779ECC76707}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AEB22862-3DCE-4EC9-A9E6-1779ECC76707}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AEB22862-3DCE-4EC9-A9E6-1779ECC76707}.Debug|x64.ActiveCfg = Debug|Any CPU
{AEB22862-3DCE-4EC9-A9E6-1779ECC76707}.Debug|x64.Build.0 = Debug|Any CPU
{AEB22862-3DCE-4EC9-A9E6-1779ECC76707}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AEB22862-3DCE-4EC9-A9E6-1779ECC76707}.Release|Any CPU.Build.0 = Release|Any CPU
{AEB22862-3DCE-4EC9-A9E6-1779ECC76707}.Release|x64.ActiveCfg = Release|Any CPU
{AEB22862-3DCE-4EC9-A9E6-1779ECC76707}.Release|x64.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{09F1856B-4098-453B-9378-9DF22D066A7B} = {DC9DF7BF-8063-4E8B-8128-B5292BEE3EAA}
Expand All @@ -86,5 +96,6 @@ Global
{FD59610D-0828-40E5-910E-A86D4A86B5C9} = {DC9DF7BF-8063-4E8B-8128-B5292BEE3EAA}
{07432867-17EB-41B6-83E3-4FD8EDC86997} = {DC9DF7BF-8063-4E8B-8128-B5292BEE3EAA}
{F5F8C40C-6CA8-467D-8E39-0CA2CFB268CE} = {DC9DF7BF-8063-4E8B-8128-B5292BEE3EAA}
{AEB22862-3DCE-4EC9-A9E6-1779ECC76707} = {DC9DF7BF-8063-4E8B-8128-B5292BEE3EAA}
EndGlobalSection
EndGlobal
17 changes: 17 additions & 0 deletions sources/Schedules/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Schedules.Services;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kyranet how do we feel about top level Program.cs? Should I move this over to the older method; as with the rest of the services; or should we move the other services to using top level Program.cs?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do so for all the other services, this is godlike.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

noted, that can be done easily in a seperate PR (:


var builder = WebApplication.CreateBuilder(args);

// Additional configuration is required to successfully run gRPC on macOS.
// For instructions on how to configure Kestrel and gRPC clients on macOS, visit https://go.microsoft.com/fwlink/?linkid=2099682

// Add services to the container.
builder.Services.AddGrpc();

var app = builder.Build();

// Configure the HTTP request pipeline.
app.MapGrpcService<GreeterService>();
app.MapGet("/", () => "Communication with gRPC endpoints must be made through a gRPC client. To learn how to create a client, visit: https://go.microsoft.com/fwlink/?linkid=2086909");

app.Run();
13 changes: 13 additions & 0 deletions sources/Schedules/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"profiles": {
"Schedules": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": false,
"applicationUrl": "http://localhost:5276;https://localhost:7276",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
21 changes: 21 additions & 0 deletions sources/Schedules/Protos/greet.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
syntax = "proto3";

option csharp_namespace = "Schedules";

package greet;

// The greeting service definition.
service Greeter {
// Sends a greeting
rpc SayHello (HelloRequest) returns (HelloReply);
}

// The request message containing the user's name.
message HelloRequest {
string name = 1;
}

// The response message containing the greetings.
message HelloReply {
string message = 1;
}
17 changes: 17 additions & 0 deletions sources/Schedules/Schedules.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<Protobuf Include="Protos\greet.proto" GrpcServices="Server"/>
</ItemGroup>

<ItemGroup>
<PackageReference Include="Grpc.AspNetCore" Version="2.32.0"/>
</ItemGroup>

</Project>
22 changes: 22 additions & 0 deletions sources/Schedules/Services/GreeterService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using Grpc.Core;
using Schedules;

namespace Schedules.Services;

public class GreeterService : Greeter.GreeterBase
{
private readonly ILogger<GreeterService> _logger;

public GreeterService(ILogger<GreeterService> logger)
{
_logger = logger;
}

public override Task<HelloReply> SayHello(HelloRequest request, ServerCallContext context)
{
return Task.FromResult(new HelloReply
{
Message = "Hello " + request.Name
});
}
}
8 changes: 8 additions & 0 deletions sources/Schedules/appsettings.Development.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}
14 changes: 14 additions & 0 deletions sources/Schedules/appsettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*",
"Kestrel": {
"EndpointDefaults": {
"Protocols": "Http2"
}
}
}