Rename old C# backend folder

This commit is contained in:
aronmal 2022-10-26 00:12:48 +02:00
parent f3eb84d812
commit dc685661a7
Signed by: aronmal
GPG key ID: 816B7707426FC612
16 changed files with 0 additions and 0 deletions

View file

@ -0,0 +1,25 @@
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/.idea
**/*.*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

View file

@ -0,0 +1,20 @@
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 ["LeakyShipsAPI/LeakyShipsAPI.csproj", "LeakyShipsAPI/"]
RUN dotnet restore "LeakyShipsAPI/LeakyShipsAPI.csproj"
COPY . .
WORKDIR "/src/LeakyShipsAPI"
RUN dotnet build "LeakyShipsAPI.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "LeakyShipsAPI.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "LeakyShipsAPI.dll"]

View file

@ -0,0 +1,8 @@
using Microsoft.AspNetCore.SignalR;
namespace LeakyShipsAPI.Hubs;
public class GameHub : Hub
{
}

View file

@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="6.4.0" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="6.4.0" />
</ItemGroup>
</Project>

View file

@ -0,0 +1,3 @@
namespace LeakyShipsAPI.Model;
public record Board(Guid Id);

View file

@ -0,0 +1,3 @@
namespace LeakyShipsAPI.Model;
public record Player(Guid Id, string Name);

View file

@ -0,0 +1,3 @@
namespace LeakyShipsAPI.Model;
public record Session(Guid Id, Player PlayerOne, Player PlayerTwo);

View file

@ -0,0 +1,41 @@
using LeakyShipsAPI.Hubs;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddControllers();
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSignalR();
builder.Services.AddSwaggerGen();
builder.Services.AddCors();
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
app.UseCors(policyBuilder => policyBuilder
.AllowAnyHeader()
.AllowAnyMethod()
.AllowAnyOrigin()
.AllowCredentials()
);
}
app.UseHttpsRedirection();
app.UseRouting();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapHub<GameHub>("/hub");
});
app.MapGet("/", () => "Hello World!");
//Websocket functions
//SessionStart name -> sessionId
//SessionJoin sessionCode, name -> sessionId
//StartGame sessionId, settings
//SubmitBoard shipPositions[] ->
//
app.Run();

View file

@ -0,0 +1,28 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:9968",
"sslPort": 44374
}
},
"profiles": {
"LeakyShipsAPI": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:7036;http://localhost:5045",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

View file

@ -0,0 +1,14 @@
using System.Dynamic;
namespace LeakyShipsAPI.Repositories;
public interface IRepository<T>
{
ValueTask<T> GetById(Guid id);
bool Create(T entity);
bool Update(T entity);
bool Delete(T entity);
}

View file

@ -0,0 +1,6 @@
namespace LeakyShipsAPI.Repositories;
public class PlayerRepository
{
}

View file

@ -0,0 +1,26 @@
using LeakyShipsAPI.Model;
namespace LeakyShipsAPI.Repositories;
public class SessionRepository : IRepository<Session>
{
public ValueTask<Session> GetById(Guid id)
{
throw new NotImplementedException();
}
public bool Create(Session entity)
{
throw new NotImplementedException();
}
public bool Update(Session entity)
{
throw new NotImplementedException();
}
public bool Delete(Session entity)
{
throw new NotImplementedException();
}
}

View file

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

View file

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