Major update

This commit is contained in:
2023-06-01 08:52:05 -05:00
parent d7c0f373f4
commit df84287eb2
264 changed files with 8614 additions and 964 deletions

View File

@@ -0,0 +1,25 @@
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/azds.yaml
**/bin
**/charts
**/docker-compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md

3
communication-hub/.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
.vs/
[Bb]in/
[Oo]bj/

View File

@@ -0,0 +1,11 @@
using System;
using CommunicationHub.Models;
namespace CommunicationHub.Clients
{
public interface ISeasonClient
{
Task ReceiveSeasonMessage(SeasonMessage message);
}
}

View File

@@ -0,0 +1,28 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<DockerComposeProjectPath>docker-compose.dcproj</DockerComposeProjectPath>
<UserSecretsId>e2ffe822-2852-46ab-a3a4-ea30601c3968</UserSecretsId>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
<PackageReference Include="Microsoft.AspNetCore.SignalR" Version="1.1.0" />
</ItemGroup>
<ItemGroup>
<None Remove="Hubs\" />
<None Remove="Models\" />
<None Remove="Clients\" />
<None Remove="Controllers\" />
</ItemGroup>
<ItemGroup>
<Folder Include="Hubs\" />
<Folder Include="Models\" />
<Folder Include="Clients\" />
<Folder Include="Controllers\" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,31 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 25.0.1705.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommunicationHub", "CommunicationHub.csproj", "{26F5E13C-C06A-425F-8C38-BA098E1EBE7D}"
EndProject
Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-compose.dcproj", "{8522C27B-F7DE-4451-8660-AAD89B6E5353}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{26F5E13C-C06A-425F-8C38-BA098E1EBE7D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{26F5E13C-C06A-425F-8C38-BA098E1EBE7D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{26F5E13C-C06A-425F-8C38-BA098E1EBE7D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{26F5E13C-C06A-425F-8C38-BA098E1EBE7D}.Release|Any CPU.Build.0 = Release|Any CPU
{8522C27B-F7DE-4451-8660-AAD89B6E5353}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8522C27B-F7DE-4451-8660-AAD89B6E5353}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8522C27B-F7DE-4451-8660-AAD89B6E5353}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8522C27B-F7DE-4451-8660-AAD89B6E5353}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {59D3F6E7-DC4F-4ADC-ABF7-46DD18371B39}
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,22 @@
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["CommunicationHub.csproj", "."]
RUN dotnet restore "./CommunicationHub.csproj"
COPY . .
WORKDIR "/src/."
RUN dotnet build "CommunicationHub.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "CommunicationHub.csproj" -c Release -o /app/publish /p:UseAppHost=false
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "CommunicationHub.dll"]

View File

@@ -0,0 +1,16 @@
using System;
using CommunicationHub.Clients;
using CommunicationHub.Models;
using Microsoft.AspNetCore.SignalR;
namespace CommunicationHub.Hubs
{
public class SeasonHub : Hub<ISeasonClient>
{
public async Task SendSeasonMessage(SeasonMessage message)
{
await Clients.All.ReceiveSeasonMessage(message);
}
}
}

View File

@@ -0,0 +1,10 @@
using System;
namespace CommunicationHub.Models
{
public class SeasonMessage
{
public int TotalDates { get; set; }
public int DatesCompleted { get; set; }
}
}

View File

@@ -0,0 +1,39 @@
using CommunicationHub.Hubs;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSignalR();
builder.Services.AddCors((options) =>
{
options.AddPolicy("CorsPolicy", policy =>
{
policy.AllowAnyHeader()
.AllowAnyMethod()
.WithOrigins("http://localhost:3000")
.AllowCredentials();
});
});
builder.Services.AddSwaggerGen();
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}
app.UseHttpsRedirection();
app.UseRouting();
app.UseCors("CorsPolicy");
app.MapControllers();
app.MapHub<SeasonHub>("/hubs/season");
app.Run();

View File

@@ -0,0 +1,31 @@
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:58148",
"sslPort": 44318
}
},
"profiles": {
"CommunicationHub": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "http://localhost:5580",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"dotnetRunMessages": true
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

View File

@@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}

View File

@@ -0,0 +1,10 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" Sdk="Microsoft.Docker.Sdk" DefaultTargets="Build">
<PropertyGroup Label="Globals">
<ProjectVersion>2.1</ProjectVersion>
<DockerTargetOS>Linux</DockerTargetOS>
<ProjectGuid>{8522C27B-F7DE-4451-8660-AAD89B6E5353}</ProjectGuid>
<DockerLaunchBrowser>True</DockerLaunchBrowser>
<DockerServiceUrl>{Scheme}://localhost:{ServicePort}/swagger</DockerServiceUrl>
<DockerServiceName>communicationhub</DockerServiceName>
</PropertyGroup>
<ItemGroup>
<None Include="docker-compose.override.yml">
<DependentUpon>docker-compose.yml</DependentUpon>
</None>
<None Include="docker-compose.yml" />
<None Include=".dockerignore" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,13 @@
version: '3.4'
services:
communicationhub:
environment:
- ASPNETCORE_ENVIRONMENT=Development
- ASPNETCORE_URLS=https://+:443;http://+:80
ports:
- "80"
- "443"
volumes:
- ~/.aspnet/https:/root/.aspnet/https:ro
- ~/.microsoft/usersecrets:/root/.microsoft/usersecrets:ro

View File

@@ -0,0 +1,8 @@
version: '3.4'
services:
communicationhub:
image: ${DOCKER_REGISTRY-}communicationhub
build:
context: .
dockerfile: ./Dockerfile