1
0
mirror of https://github.com/XFox111/MuiCharts.git synced 2026-04-22 06:51:05 +03:00

Merge pull request #1 from XFox111/backend

Backend
This commit is contained in:
2024-02-22 20:29:11 +03:00
committed by GitHub
42 changed files with 2663 additions and 0 deletions
+42
View File
@@ -0,0 +1,42 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-in-docker
{
"name": "MuiCharts",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/base:bullseye",
// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {
"version": "latest",
"enableNonRootDocker": "true",
"moby": "false"
},
"ghcr.io/devcontainers/features/dotnet:2": {
"version": "latest"
},
"ghcr.io/devcontainers/features/node:1": {
"nodeGypDependencies": true,
"version": "latest",
"nvmVersion": "latest"
}
},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": {
// "workload": "sudo /usr/share/dotnet/dotnet workload update",
"eftool": "/usr/share/dotnet/dotnet tool install --global dotnet-ef",
"system": "sudo apt update && sudo apt upgrade -y",
"backend": "cd backend && /usr/share/dotnet/dotnet restore"
// "frontend": "cd frontend && yarn install"
},
"postStartCommand": "sudo /usr/share/dotnet/dotnet workload update",
// Configure tool-specific properties.
// "customizations": {},
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
+12
View File
@@ -0,0 +1,12 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for more information:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
# https://containers.dev/guide/dependabot
version: 2
updates:
- package-ecosystem: "devcontainers"
directory: "/"
schedule:
interval: weekly
+35
View File
@@ -0,0 +1,35 @@
{
"version": "0.2.0",
"configurations": [
{
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/dotnet/vscode-csharp/blob/main/debugger-launchjson.md.
"name": ".NET Core Launch (web)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/MuiCharts.Api/bin/Debug/net8.0/MuiCharts.Api.dll",
"args": [],
"cwd": "${workspaceFolder}/MuiCharts.Api",
"stopAtEntry": false,
// Enable launching a web browser when ASP.NET Core starts. For more information: https://aka.ms/VSCode-CS-LaunchJson-WebBrowser
"serverReadyAction": {
"action": "openExternally",
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
},
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"sourceFileMap": {
"/Views": "${workspaceFolder}/Views"
}
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach"
}
]
}
+41
View File
@@ -0,0 +1,41 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "backend: build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/MuiCharts.sln",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary;ForceNoAlign"
],
"problemMatcher": "$msCompile"
},
{
"label": "backend: publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/MuiCharts.sln",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary;ForceNoAlign"
],
"problemMatcher": "$msCompile"
},
{
"label": "backend: watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"--project",
"${workspaceFolder}/MuiCharts.sln"
],
"problemMatcher": "$msCompile"
}
]
}
+488
View File
@@ -0,0 +1,488 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from `dotnet new gitignore`
# dotenv files
.env
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Mono auto generated files
mono_crash.*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET
project.lock.json
project.fragment.lock.json
artifacts/
# Tye
.tye/
# ASP.NET Scaffolding
ScaffoldingReadMe.txt
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.tlog
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Coverlet is a free, cross platform Code Coverage Tool
coverage*.json
coverage*.xml
coverage*.info
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# SQLite database files
*.sqlite
*.db
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio 6 auto-generated project file (contains which files were open etc.)
*.vbp
# Visual Studio 6 workspace and project file (working project files containing files to include in project)
*.dsw
*.dsp
# Visual Studio 6 technical files
*.ncb
*.aps
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# Visual Studio History (VSHistory) files
.vshistory/
# BeatPulse healthcheck temp database
healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/
# Fody - auto-generated XML schema
FodyWeavers.xsd
# VS Code files for those working on multiple tools
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace
# Local History for Visual Studio Code
.history/
# Windows Installer files from build outputs
*.cab
*.msi
*.msix
*.msm
*.msp
# JetBrains Rider
*.sln.iml
.idea
##
## Visual studio for Mac
##
# globs
Makefile.in
*.userprefs
*.usertasks
config.make
config.status
aclocal.m4
install-sh
autom4te.cache/
*.tar.gz
tarballs/
test-results/
# Mac bundle stuff
*.dmg
*.app
# content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
# content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore
# Windows thumbnail cache files
Thumbs.db
ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump
# Folder config file
[Dd]esktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp
# Windows shortcuts
*.lnk
# Vim temporary swap files
*.swp
+488
View File
@@ -0,0 +1,488 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from `dotnet new gitignore`
# dotenv files
.env
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Mono auto generated files
mono_crash.*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET
project.lock.json
project.fragment.lock.json
artifacts/
# Tye
.tye/
# ASP.NET Scaffolding
ScaffoldingReadMe.txt
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.tlog
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Coverlet is a free, cross platform Code Coverage Tool
coverage*.json
coverage*.xml
coverage*.info
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# SQLite database files
*.sqlite
*.db
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio 6 auto-generated project file (contains which files were open etc.)
*.vbp
# Visual Studio 6 workspace and project file (working project files containing files to include in project)
*.dsw
*.dsp
# Visual Studio 6 technical files
*.ncb
*.aps
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# Visual Studio History (VSHistory) files
.vshistory/
# BeatPulse healthcheck temp database
healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/
# Fody - auto-generated XML schema
FodyWeavers.xsd
# VS Code files for those working on multiple tools
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace
# Local History for Visual Studio Code
.history/
# Windows Installer files from build outputs
*.cab
*.msi
*.msix
*.msm
*.msp
# JetBrains Rider
*.sln.iml
.idea
##
## Visual studio for Mac
##
# globs
Makefile.in
*.userprefs
*.usertasks
config.make
config.status
aclocal.m4
install-sh
autom4te.cache/
*.tar.gz
tarballs/
test-results/
# Mac bundle stuff
*.dmg
*.app
# content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
# content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore
# Windows thumbnail cache files
Thumbs.db
ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump
# Folder config file
[Dd]esktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp
# Windows shortcuts
*.lnk
# Vim temporary swap files
*.swp
+26
View File
@@ -0,0 +1,26 @@
FROM mcr.microsoft.com/dotnet/sdk:8.0 as build
WORKDIR /app
COPY ./MuiCharts.sln ./
COPY ./MuiCharts.Domain/*.csproj MuiCharts.Domain/
COPY ./MuiCharts.Contracts/*.csproj MuiCharts.Contracts/
COPY ./MuiCharts.Infrastructure/*.csproj MuiCharts.Infrastructure/
COPY ./MuiCharts.Api/*.csproj MuiCharts.Api/
RUN dotnet restore
COPY . ./
RUN dotnet publish --configuration Release -o out MuiCharts.Api/MuiCharts.Api.csproj
FROM mcr.microsoft.com/dotnet/aspnet:8.0 as runtime
WORKDIR /app
COPY --from=build /app/out ./
ENV HTTP_PORTS=80
EXPOSE 80
ENTRYPOINT ["dotnet", "MuiCharts.Api.dll"]
@@ -0,0 +1,57 @@
using ErrorOr;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ModelBinding;
namespace MuiCharts.Api.Controllers;
/// <summary>
/// Base class for API controllers that provides common functionality and error handling.
/// </summary>
/// <typeparam name="T">The type of the derived controller.</typeparam>
[ApiController]
[Route("[controller]")]
public abstract class ApiControllerBase<T>(ILogger<T> logger)
: ControllerBase where T : ApiControllerBase<T>
{
/// <summary>
/// Gets the logger instance used for logging.
/// </summary>
protected ILogger<T> Logger { get; } = logger;
/// <summary>
/// Handles the response for a list of errors.
/// </summary>
/// <param name="errors">The list of errors.</param>
/// <returns>An <see cref="IActionResult"/> representing the response.</returns>
protected IActionResult Problem(List<Error> errors)
{
if (errors.All(error => error.Type == ErrorType.Validation))
{
ModelStateDictionary modelState = new();
foreach (Error error in errors)
modelState.AddModelError(error.Code, error.Description);
return ValidationProblem(modelState);
}
Error firstError = errors[0];
Logger.LogWarning("An error occured during request processing: {Error}", firstError);
int statusCode = firstError.Type switch
{
ErrorType.Validation => StatusCodes.Status400BadRequest,
ErrorType.Unauthorized => StatusCodes.Status401Unauthorized,
ErrorType.Forbidden => StatusCodes.Status403Forbidden,
ErrorType.NotFound => StatusCodes.Status404NotFound,
ErrorType.Conflict => StatusCodes.Status409Conflict,
_ => StatusCodes.Status500InternalServerError
};
return Problem(
statusCode: statusCode,
detail: firstError.Description
);
}
}
@@ -0,0 +1,19 @@
using Microsoft.AspNetCore.Mvc;
namespace MuiCharts.Api;
/// <summary>
/// Controller for handling errors.
/// </summary>
[ApiController]
[Route("[controller]")]
public class ErrorController: ControllerBase
{
/// <summary>
/// Handles the HTTP GET request for the error endpoint.
/// </summary>
/// <returns>An IActionResult representing the error response.</returns>
[HttpGet]
[ProducesResponseType<ProblemDetails>(StatusCodes.Status500InternalServerError)]
public IActionResult Error() => Problem();
}
@@ -0,0 +1,220 @@
using ErrorOr;
using Microsoft.AspNetCore.Mvc;
using MuiCharts.Contracts.Point;
using MuiCharts.Domain.Models;
using MuiCharts.Domain.Repositories;
namespace MuiCharts.Api.Controllers;
/// <summary>
/// Controller for managing points.
/// </summary>
public class PointsController(
ILogger<PointsController> logger,
IPointRepository pointRepository
) : ApiControllerBase<PointsController>(logger)
{
private readonly IPointRepository _repository = pointRepository;
/// <summary>
/// Creates a new point.
/// </summary>
/// <param name="request">The new point model.</param>
/// <returns>An <see cref="IActionResult"/> representing the asynchronous operation result.</returns>
[HttpPost]
[ProducesResponseType<Point>(StatusCodes.Status201Created)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesDefaultResponseType(typeof(ProblemDetails))]
public async Task<IActionResult> CreatePointAsync(UpsertPointRequest request)
{
Logger.LogInformation("Creating point with name {Name} and height {Height}", request.Name, request.Height);
Point point = new()
{
Id = default,
Name = request.Name,
Height = request.Height
};
ErrorOr<Point> createResult = await _repository.AddPointAsync(point);
if (createResult.IsError)
return Problem(createResult.Errors);
Logger.LogInformation("Point created with id {Id}", createResult.Value.Id);
return CreatedAtPointResult(createResult.Value);
}
/// <summary>
/// Retrieves an array of points based on the provided IDs.
/// </summary>
/// <param name="ids">The array of point IDs.</param>
/// <returns>An <see cref="IActionResult"/> representing the asynchronous operation result.</returns>
[HttpPost("Array")]
[ProducesResponseType<Point[]>(StatusCodes.Status200OK)]
[ProducesResponseType<Point[]>(StatusCodes.Status206PartialContent)]
[ProducesResponseType(StatusCodes.Status404NotFound)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesDefaultResponseType(typeof(ProblemDetails))]
public async Task<IActionResult> GetPointsArrayAsync(int[] ids)
{
Logger.LogInformation("Getting points with ids {Ids}", ids);
IQueryable<Point> query = await _repository.GetPointsRangeAsync();
PointResponse[] points = [
.. query
.Where(point => ids.Contains(point.Id))
.Select(point => MapPointResponse(point))
];
if (points.Length == 0)
{
Logger.LogInformation("No points found with ids {Ids}", ids);
return NotFound();
}
if (points.Length != ids.Length)
{
Logger.LogInformation("Not all points found with ids {Ids}", ids);
return StatusCode(StatusCodes.Status206PartialContent, points);
}
Logger.LogInformation("Returning {Count} points", points.Length);
return Ok(points);
}
/// <summary>
/// Retrieves a range of points based on the specified page and count.
/// </summary>
/// <param name="request">The request object containing the page and count parameters.</param>
/// <returns>An <see cref="IActionResult"/> representing the asynchronous operation result.</returns>
[HttpGet]
[ProducesResponseType<GetPointsResponse>(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesDefaultResponseType(typeof(ProblemDetails))]
public async Task<IActionResult> GetPointsAsync([FromQuery] GetPointsRequest request)
{
Logger.LogInformation("Getting points with page {Page} and count {Count}", request.Page, request.Count);
IQueryable<Point> query = await _repository.GetPointsRangeAsync();
PointResponse[] points = [
.. query
.OrderBy(i => i.Id)
.Skip((request.Page - 1) * request.Count)
.Take(request.Count)
.Select(point => MapPointResponse(point))
];
GetPointsResponse response = new(
points,
query.Count(),
points.Length,
request.Page
);
Logger.LogInformation("Returning {Count} points", response.Count);
return Ok(response);
}
/// <summary>
/// Retrieves a point with the specified ID.
/// </summary>
/// <param name="id">The ID of the point to retrieve.</param>
/// <returns>An <see cref="IActionResult"/> representing the asynchronous operation result.</returns>
[HttpGet("{id:int}")]
[ProducesResponseType<Point>(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status404NotFound)]
[ProducesDefaultResponseType(typeof(ProblemDetails))]
public async Task<IActionResult> GetPointAsync(int id)
{
Logger.LogInformation("Getting point with id {Id}", id);
ErrorOr<Point> getResult = await _repository.GetPointAsync(id);
if (getResult.IsError)
return Problem(getResult.Errors);
Logger.LogInformation("Returning point with id {Id}", id);
return Ok(MapPointResponse(getResult.Value));
}
/// <summary>
/// Upserts a point with the specified ID and request data.
/// </summary>
/// <param name="id">The ID of the point.</param>
/// <param name="request">The request data for the point.</param>
/// <returns>An <see cref="IActionResult"/> representing the asynchronous operation result.</returns>
[HttpPut("{id:int}")]
[ProducesResponseType<Point>(StatusCodes.Status201Created)]
[ProducesResponseType(StatusCodes.Status204NoContent)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesDefaultResponseType(typeof(ProblemDetails))]
public async Task<IActionResult> UpsertPointAsync(int id, UpsertPointRequest request)
{
Logger.LogInformation("Upserting point with id {Id}", id);
Point point = new()
{
Id = id,
Name = request.Name,
Height = request.Height
};
ErrorOr<Point?> upsertResult = await _repository.AddOrUpdatePointAsync(point);
if (upsertResult.IsError)
return Problem(upsertResult.Errors);
if (upsertResult.Value is Point value)
{
Logger.LogInformation("Point created with id {Id}", value.Id);
return CreatedAtPointResult(value);
}
Logger.LogInformation("Point updated with id {Id}", id);
return NoContent();
}
/// <summary>
/// Deletes a point with the specified ID.
/// </summary>
/// <param name="id">The ID of the point to delete.</param>
/// <returns>An <see cref="IActionResult"/> representing the asynchronous operation result.</returns>
[HttpDelete("{id:int}")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
[ProducesResponseType(StatusCodes.Status404NotFound)]
[ProducesDefaultResponseType(typeof(ProblemDetails))]
public async Task<IActionResult> DeletePointAsync(int id)
{
Logger.LogInformation("Deleting point with id {Id}", id);
ErrorOr<Deleted> deleteResult = await _repository.DeletePointAsync(id);
if (deleteResult.IsError)
return Problem(deleteResult.Errors);
Logger.LogInformation("Point deleted with id {Id}", id);
return NoContent();
}
private CreatedAtActionResult CreatedAtPointResult(Point point) =>
CreatedAtAction(
actionName: nameof(GetPointAsync),
routeValues: new { id = point.Id },
value: MapPointResponse(point)
);
private static PointResponse MapPointResponse(Point value) =>
new(
value.Id,
value.Name,
value.Height
);
}
@@ -0,0 +1,180 @@
using ErrorOr;
using Microsoft.AspNetCore.Mvc;
using MuiCharts.Contracts.Track;
using MuiCharts.Domain.Models;
using MuiCharts.Domain.Repositories;
namespace MuiCharts.Api.Controllers;
/// <summary>
/// Controller for managing tracks.
/// </summary>
/// <param name="logger">The logger.</param>
/// <param name="trackRepository">The track repository.</param>
public class TracksController(
ILogger<TracksController> logger,
ITrackRepository trackRepository
) : ApiControllerBase<TracksController>(logger)
{
private readonly ITrackRepository _repository = trackRepository;
/// <summary>
/// Creates a new track.
/// </summary>
/// <param name="request">The request containing the track details.</param>
/// <returns>An <see cref="IActionResult"/> representing the asynchronous operation result.</returns>
[HttpPost]
[ProducesResponseType<TrackResponse>(StatusCodes.Status201Created)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status409Conflict)]
[ProducesDefaultResponseType(typeof(ProblemDetails))]
public async Task<IActionResult> CreateTrackAsync(UpsertTrackRequest request)
{
// TODO: Check if points exist
Logger.LogInformation("Creating track with first ID {FirstId} and second ID {SecondId}", request.FirstId, request.SecondId);
if (request.FirstId == request.SecondId)
return Problem([Error.Validation(description: "First ID and second ID cannot be the same.")]);
Track track = new()
{
FirstId = request.FirstId,
SecondId = request.SecondId,
Distance = request.Distance,
Surface = request.Surface,
MaxSpeed = request.MaxSpeed
};
ErrorOr<Track> createResult = await _repository.AddTrackAsync(track);
if (createResult.IsError)
return Problem(createResult.Errors);
Logger.LogInformation("Track created with first ID {FirstId} and second ID {SecondId}", createResult.Value.FirstId, createResult.Value.SecondId);
return CreatedAtTrackResult(createResult.Value);
}
/// <summary>
/// Retrieves a track with the specified first ID and second ID.
/// </summary>
/// <param name="firstId">The first point ID of the track.</param>
/// <param name="secondId">The second point ID of the track.</param>
/// <returns>An <see cref="IActionResult"/> representing the asynchronous operation result.</returns>
[HttpGet("{firstId:int}/{secondId:int}")]
[ProducesResponseType<TrackResponse>(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status404NotFound)]
[ProducesDefaultResponseType(typeof(ProblemDetails))]
public async Task<IActionResult> GetTrackAsync(int firstId, int secondId)
{
Logger.LogInformation("Retrieving track with first ID {FirstId} and second ID {SecondId}", firstId, secondId);
ErrorOr<Track> getResult = await _repository.GetTrackAsync(firstId, secondId);
if (getResult.IsError)
return Problem(getResult.Errors);
Logger.LogInformation("Track retrieved with first ID {FirstId} and second ID {SecondId}", getResult.Value.FirstId, getResult.Value.SecondId);
return Ok(MapTrackResponse(getResult.Value));
}
/// <summary>
/// Retrieves all tracks.
/// </summary>
/// <returns>An <see cref="IActionResult"/> representing the asynchronous operation result.</returns>
[HttpGet]
[ProducesResponseType<IEnumerable<TrackResponse>>(StatusCodes.Status200OK)]
[ProducesDefaultResponseType(typeof(ProblemDetails))]
public async Task<IActionResult> GetAllTracksAsync()
{
Logger.LogInformation("Retrieving all tracks");
IQueryable<Track> tracks = await _repository.GetTracksRangeAsync();
Logger.LogInformation("All tracks retrieved");
return Ok(tracks.Select(MapTrackResponse));
}
/// <summary>
/// Upserts a track with the specified first point ID, second point ID, and request data.
/// </summary>
/// <param name="firstId">The first point ID of the track.</param>
/// <param name="secondId">The second point ID of the track.</param>
/// <param name="request">The request data containing the track details.</param>
/// <returns>An <see cref="IActionResult"/> representing the asynchronous operation result.</returns>
[HttpPut("{firstId:int}/{secondId:int}")]
[ProducesResponseType<TrackResponse>(StatusCodes.Status201Created)]
[ProducesResponseType(StatusCodes.Status204NoContent)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesDefaultResponseType(typeof(ProblemDetails))]
public async Task<IActionResult> UpsertTrackAsync(int firstId, int secondId, UpsertTrackRequest request)
{
// TODO: Check if points exist
Logger.LogInformation("Upserting track with first ID {FirstId} and second ID {SecondId}", firstId, secondId);
Track track = new()
{
FirstId = firstId,
SecondId = secondId,
Distance = request.Distance,
Surface = request.Surface,
MaxSpeed = request.MaxSpeed
};
ErrorOr<Track?> upsertResult = await _repository.AddOrUpdateTrackAsync(track);
if (upsertResult.IsError)
return Problem(upsertResult.Errors);
if (upsertResult.Value is Track value)
{
Logger.LogInformation("Track created with first ID {FirstId} and second ID {SecondId}", value.FirstId, value.SecondId);
return CreatedAtTrackResult(value);
}
Logger.LogInformation("Track updated with first ID {FirstId} and second ID {SecondId}", firstId, secondId);
return NoContent();
}
/// <summary>
/// Deletes a track with the specified first point ID and second point ID.
/// </summary>
/// <param name="firstId">The first point ID of the track to delete.</param>
/// <param name="secondId">The second point ID of the track to delete.</param>
/// <returns>An <see cref="IActionResult"/> representing the asynchronous operation result.</returns>
[HttpDelete("{firstId:int}/{secondId:int}")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
[ProducesResponseType(StatusCodes.Status404NotFound)]
[ProducesDefaultResponseType(typeof(ProblemDetails))]
public async Task<IActionResult> DeleteTrackAsync(int firstId, int secondId)
{
Logger.LogInformation("Deleting track with first ID {FirstId} and second ID {SecondId}", firstId, secondId);
ErrorOr<Deleted> deleteResult = await _repository.DeleteTrackAsync(firstId, secondId);
if (deleteResult.IsError)
return Problem(deleteResult.Errors);
Logger.LogInformation("Track deleted with first ID {FirstId} and second ID {SecondId}", firstId, secondId);
return NoContent();
}
private CreatedAtActionResult CreatedAtTrackResult(Track track) =>
CreatedAtAction(
actionName: nameof(GetTrackAsync),
routeValues: new { firstId = track.FirstId, secondId = track.SecondId },
value: MapTrackResponse(track)
);
private static TrackResponse MapTrackResponse(Track track) =>
new(
track.FirstId,
track.SecondId,
track.Distance,
track.Surface,
track.MaxSpeed
);
}
@@ -0,0 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<InvariantGlobalization>true</InvariantGlobalization>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="LettuceEncrypt" Version="1.3.0" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MuiCharts.Domain\MuiCharts.Domain.csproj" />
<ProjectReference Include="..\MuiCharts.Infrastructure\MuiCharts.Infrastructure.csproj" />
<ProjectReference Include="..\MuiCharts.Contracts\MuiCharts.Contracts.csproj" />
</ItemGroup>
</Project>
+50
View File
@@ -0,0 +1,50 @@
using System.Reflection;
using LettuceEncrypt;
using MuiCharts.Infrastructure;
WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
{
// Add services to the container.
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddLogging(options =>
{
options.AddConfiguration(builder.Configuration.GetSection("Logging"));
options.AddConsole();
options.AddDebug();
options.AddEventSourceLogger();
});
builder.Services.AddControllers(options =>
{
options.SuppressAsyncSuffixInActionNames = false;
});
builder.AddInfrastructure();
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen(options =>
{
string xmlFileName = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
string xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFileName);
options.IncludeXmlComments(xmlPath);
});
if (builder.Configuration.GetSection("LettuceEncrypt").Exists())
builder.Services.AddLettuceEncrypt()
.PersistDataToDirectory(new DirectoryInfo("/persistence"), null);
}
WebApplication app = builder.Build();
{
// Configure the HTTP request pipeline.
app.UseExceptionHandler("/error");
app.UseSwagger();
app.UseSwaggerUI();
if (app.Configuration.GetSection("LettuceEncrypt").Exists())
app.UseHttpsRedirection();
app.MapControllers();
app.Run();
}
@@ -0,0 +1,41 @@
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:34734",
"sslPort": 44380
}
},
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "http://localhost:5152",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "https://localhost:7096;http://localhost:5152",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
@@ -0,0 +1,11 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"ConnectionStrings": {
"DataContext": "Data Source=app.db"
}
}
+12
View File
@@ -0,0 +1,12 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*",
"ConnectionStrings": {
"DataContext": "Data Source=/persistence/data.db"
}
}
@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<ProjectReference Include="..\MuiCharts.Domain\MuiCharts.Domain.csproj" />
</ItemGroup>
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>
@@ -0,0 +1,13 @@
using System.ComponentModel.DataAnnotations;
namespace MuiCharts.Contracts.Point;
/// <summary>
/// Represents a request to get a collection of points.
/// </summary>
public record class GetPointsRequest(
[Range(1, int.MaxValue)]
int Page = 1,
[Range(1, int.MaxValue)]
int Count = 50
);
@@ -0,0 +1,11 @@
namespace MuiCharts.Contracts.Point;
/// <summary>
/// Represents the response object for retrieving points.
/// </summary>
public record class GetPointsResponse(
PointResponse[] Points,
int TotalCount,
int Count,
int Page
);
@@ -0,0 +1,10 @@
namespace MuiCharts.Contracts.Point;
/// <summary>
/// Represents a response object containing information about a point.
/// </summary>
public record PointResponse(
int Id,
string Name,
int Height
);
@@ -0,0 +1,11 @@
using System.ComponentModel.DataAnnotations;
namespace MuiCharts.Contracts.Point;
/// <summary>
/// Represents a request to upsert a point.
/// </summary>
public record UpsertPointRequest(
[MinLength(1)] string Name,
int Height
);
@@ -0,0 +1,14 @@
using MuiCharts.Domain.Enums;
namespace MuiCharts.Contracts.Track;
/// <summary>
/// Represents a response object for a track.
/// </summary>
public record TrackResponse(
int FirstId,
int SecondId,
int Distance,
Surface Surface,
MaxSpeed MaxSpeed
);
@@ -0,0 +1,15 @@
using System.ComponentModel.DataAnnotations;
using MuiCharts.Domain.Enums;
namespace MuiCharts.Contracts.Track;
/// <summary>
/// Represents a request to upsert a track.
/// </summary>
public record UpsertTrackRequest(
[Range(0, int.MaxValue)] int FirstId,
[Range(0, int.MaxValue)] int SecondId,
[Range(1, int.MaxValue)] int Distance,
Surface Surface,
MaxSpeed MaxSpeed
);
@@ -0,0 +1,11 @@
namespace MuiCharts.Domain.Enums;
/// <summary>
/// Represents the maximum speed options.
/// </summary>
public enum MaxSpeed
{
Fast = 0,
Normal = 1,
Slow = 2
}
+11
View File
@@ -0,0 +1,11 @@
namespace MuiCharts.Domain.Enums;
/// <summary>
/// Represents the surface types.
/// </summary>
public enum Surface
{
Sand = 0,
Asphalt = 1,
Ground = 2
}
+25
View File
@@ -0,0 +1,25 @@
using System.ComponentModel.DataAnnotations;
namespace MuiCharts.Domain.Models;
/// <summary>
/// Represents a point with an ID, name, and height.
/// </summary>
public class Point
{
/// <summary>
/// Gets or sets the ID of the point.
/// </summary>
public required int Id { get; init; }
/// <summary>
/// Gets or sets the name of the point.
/// </summary>
[MinLength(1)]
public required string Name { get; init; }
/// <summary>
/// Gets or sets the height of the point.
/// </summary>
public required int Height { get; init; }
}
+36
View File
@@ -0,0 +1,36 @@
using System.ComponentModel.DataAnnotations;
using MuiCharts.Domain.Enums;
namespace MuiCharts.Domain.Models;
/// <summary>
/// Represents a track with information about the first point ID, second point ID, distance, surface, and maximum speed.
/// </summary>
public class Track
{
/// <summary>
/// Gets or sets the first ID.
/// </summary>
public required int FirstId { get; init; }
/// <summary>
/// Gets or sets the second ID.
/// </summary>
public required int SecondId { get; init; }
/// <summary>
/// Gets or sets the distance.
/// </summary>
[Range(1, int.MaxValue)]
public required int Distance { get; init; }
/// <summary>
/// Gets or sets the surface.
/// </summary>
public required Surface Surface { get; init; }
/// <summary>
/// Gets or sets the maximum speed.
/// </summary>
public required MaxSpeed MaxSpeed { get; init; }
}
@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ErrorOr" Version="1.10.0" />
</ItemGroup>
</Project>
@@ -0,0 +1,44 @@
using ErrorOr;
using MuiCharts.Domain.Models;
namespace MuiCharts.Domain.Repositories;
/// <summary>
/// Represents a repository for managing points.
/// </summary>
public interface IPointRepository
{
/// <summary>
/// Adds a new point asynchronously.
/// </summary>
/// <param name="point">The point to add.</param>
/// <returns>A task that represents the asynchronous operation. The task result contains the added point or an error.</returns>
Task<ErrorOr<Point>> AddPointAsync(Point point);
/// <summary>
/// Retrieves a point by its ID asynchronously.
/// </summary>
/// <param name="id">The ID of the point to retrieve.</param>
/// <returns>A task that represents the asynchronous operation. The task result contains the retrieved point or an error.</returns>
Task<ErrorOr<Point>> GetPointAsync(int id);
/// <summary>
/// Retrieves a range of points asynchronously.
/// </summary>
/// <returns>A task that represents the asynchronous operation. The task result contains a queryable collection of points.</returns>
Task<IQueryable<Point>> GetPointsRangeAsync();
/// <summary>
/// Adds or updates a point asynchronously.
/// </summary>
/// <param name="point">The point to add or update.</param>
/// <returns>A task that represents the asynchronous operation. The task result contains the added or updated point or an error.</returns>
Task<ErrorOr<Point?>> AddOrUpdatePointAsync(Point point);
/// <summary>
/// Deletes a point by its ID asynchronously.
/// </summary>
/// <param name="id">The ID of the point to delete.</param>
/// <returns>A task that represents the asynchronous operation. The task result contains a flag indicating if the point was deleted successfully or an error.</returns>
Task<ErrorOr<Deleted>> DeletePointAsync(int id);
}
@@ -0,0 +1,46 @@
using ErrorOr;
using MuiCharts.Domain.Models;
namespace MuiCharts.Domain.Repositories;
/// <summary>
/// Represents a repository for managing tracks.
/// </summary>
public interface ITrackRepository
{
/// <summary>
/// Adds a new track asynchronously.
/// </summary>
/// <param name="track">The track to add.</param>
/// <returns>A task that represents the asynchronous operation. The task result contains the added track if successful, or an error if unsuccessful.</returns>
Task<ErrorOr<Track>> AddTrackAsync(Track track);
/// <summary>
/// Retrieves a track asynchronously based on the specified IDs.
/// </summary>
/// <param name="firstId">The first ID.</param>
/// <param name="secondId">The second ID.</param>
/// <returns>A task that represents the asynchronous operation. The task result contains the retrieved track if successful, or an error if unsuccessful.</returns>
Task<ErrorOr<Track>> GetTrackAsync(int firstId, int secondId);
/// <summary>
/// Retrieves a range of tracks asynchronously.
/// </summary>
/// <returns>A task that represents the asynchronous operation. The task result contains the range of tracks.</returns>
Task<IQueryable<Track>> GetTracksRangeAsync();
/// <summary>
/// Adds or updates a track asynchronously.
/// </summary>
/// <param name="track">The track to add or update.</param>
/// <returns>A task that represents the asynchronous operation. The task result contains the added or updated track if successful, or an error if unsuccessful.</returns>
Task<ErrorOr<Track?>> AddOrUpdateTrackAsync(Track track);
/// <summary>
/// Deletes a track asynchronously based on the specified IDs.
/// </summary>
/// <param name="firstId">The first ID.</param>
/// <param name="secondId">The second ID.</param>
/// <returns>A task that represents the asynchronous operation. The task result contains the deletion status if successful, or an error if unsuccessful.</returns>
Task<ErrorOr<Deleted>> DeleteTrackAsync(int firstId, int secondId);
}
@@ -0,0 +1,19 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using MuiCharts.Domain.Models;
namespace MuiCharts.Infrastructure.Configurations;
/// <summary>
/// Represents the entity type configuration for the <see cref="Point"/> entity.
/// </summary>
public class PointEntityTypeConfiguration : IEntityTypeConfiguration<Point>
{
/// <inheritdoc/>
public void Configure(EntityTypeBuilder<Point> builder)
{
builder.HasKey(p => p.Id);
builder.Property(p => p.Name).IsRequired();
builder.Property(p => p.Height).IsRequired();
}
}
@@ -0,0 +1,19 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace MuiCharts.Domain.Models;
/// <summary>
/// Represents the entity type configuration for the <see cref="Track"/> entity.
/// </summary>
public class TrackEntityTypeConfiguration : IEntityTypeConfiguration<Track>
{
/// <inheritdoc/>
public void Configure(EntityTypeBuilder<Track> builder)
{
builder.HasKey(t => new { t.FirstId, t.SecondId });
builder.Property(t => t.Distance).IsRequired();
builder.Property(t => t.Surface).IsRequired();
builder.Property(t => t.MaxSpeed).IsRequired();
}
}
@@ -0,0 +1,39 @@
using Microsoft.EntityFrameworkCore;
using MuiCharts.Domain.Models;
using MuiCharts.Infrastructure.Configurations;
namespace MuiCharts.Infrastructure;
/// <summary>
/// Represents the database context for MuiCharts application.
/// </summary>
public class DataContext : DbContext
{
/// <summary>
/// <see cref="Point"/> table.
/// </summary>
public DbSet<Point> Points { get; set; }
/// <summary>
/// <see cref="Track"/> table.
/// </summary>
public DbSet<Track> Tracks { get; set; }
/// <summary>
/// Initializes a new instance of <see cref="DataContext"/>.
/// </summary>
/// <param name="options">The options for this context.</param>
public DataContext(DbContextOptions<DataContext> options) : base(options)
{
Database.Migrate();
}
/// <inheritdoc/>
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.ApplyConfiguration(new PointEntityTypeConfiguration());
modelBuilder.ApplyConfiguration(new TrackEntityTypeConfiguration());
}
}
@@ -0,0 +1,32 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using MuiCharts.Domain.Repositories;
using MuiCharts.Infrastructure.Repositories;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Configuration;
namespace MuiCharts.Infrastructure;
/// <summary>
/// Provides extension methods for configuring infrastructure services.
/// </summary>
public static class InfrastructrureExtensions
{
/// <summary>
/// Adds infrastructure services to the specified <see cref="IServiceCollection"/>.
/// </summary>
/// <param name="services">The <see cref="IServiceCollection"/> to add the services to.</param>
/// <returns>The modified <see cref="IServiceCollection"/>.</returns>
public static void AddInfrastructure(this IHostApplicationBuilder builder)
{
builder.Services.AddDbContext<DataContext>(options =>
{
options
.UseSqlite(builder.Configuration.GetConnectionString(nameof(DataContext)))
.EnableSensitiveDataLogging(builder.Environment.IsDevelopment());
});
builder.Services.AddScoped<IPointRepository, PointRepository>();
builder.Services.AddScoped<ITrackRepository, TrackRepository>();
}
}
@@ -0,0 +1,62 @@
// <auto-generated />
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace MuiCharts.Infrastructure.Migrations
{
[DbContext(typeof(DataContext))]
[Migration("20240221200319_InitialCreate")]
partial class InitialCreate
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "8.0.2");
modelBuilder.Entity("MuiCharts.Domain.Models.Point", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("Height")
.HasColumnType("INTEGER");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("Points");
});
modelBuilder.Entity("MuiCharts.Domain.Models.Track", b =>
{
b.Property<int>("FirstId")
.HasColumnType("INTEGER");
b.Property<int>("SecondId")
.HasColumnType("INTEGER");
b.Property<int>("Distance")
.HasColumnType("INTEGER");
b.Property<int>("MaxSpeed")
.HasColumnType("INTEGER");
b.Property<int>("Surface")
.HasColumnType("INTEGER");
b.HasKey("FirstId", "SecondId");
b.ToTable("Tracks");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,53 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace MuiCharts.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class InitialCreate : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Points",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Name = table.Column<string>(type: "TEXT", nullable: false),
Height = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Points", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Tracks",
columns: table => new
{
FirstId = table.Column<int>(type: "INTEGER", nullable: false),
SecondId = table.Column<int>(type: "INTEGER", nullable: false),
Distance = table.Column<int>(type: "INTEGER", nullable: false),
Surface = table.Column<int>(type: "INTEGER", nullable: false),
MaxSpeed = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Tracks", x => new { x.FirstId, x.SecondId });
});
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Points");
migrationBuilder.DropTable(
name: "Tracks");
}
}
}
@@ -0,0 +1,59 @@
// <auto-generated />
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
#nullable disable
namespace MuiCharts.Infrastructure.Migrations
{
[DbContext(typeof(DataContext))]
partial class DataContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "8.0.2");
modelBuilder.Entity("MuiCharts.Domain.Models.Point", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("Height")
.HasColumnType("INTEGER");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("Points");
});
modelBuilder.Entity("MuiCharts.Domain.Models.Track", b =>
{
b.Property<int>("FirstId")
.HasColumnType("INTEGER");
b.Property<int>("SecondId")
.HasColumnType("INTEGER");
b.Property<int>("Distance")
.HasColumnType("INTEGER");
b.Property<int>("MaxSpeed")
.HasColumnType("INTEGER");
b.Property<int>("Surface")
.HasColumnType("INTEGER");
b.HasKey("FirstId", "SecondId");
b.ToTable("Tracks");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MuiCharts.Domain\MuiCharts.Domain.csproj" />
</ItemGroup>
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>
@@ -0,0 +1,122 @@
using ErrorOr;
using Microsoft.EntityFrameworkCore.ChangeTracking;
using Microsoft.Extensions.Logging;
using MuiCharts.Domain.Models;
using MuiCharts.Domain.Repositories;
namespace MuiCharts.Infrastructure.Repositories;
/// <summary>
/// Represents a repository for points.
/// </summary>
/// <param name="context">The data context.</param>
/// <param name="logger">The logger.</param>
public class PointRepository(
DataContext context,
ILogger<PointRepository> logger
) : IPointRepository
{
private readonly DataContext _context = context;
private readonly ILogger<PointRepository> _logger = logger;
/// <inheritdoc/>
public async Task<ErrorOr<Point?>> AddOrUpdatePointAsync(Point point)
{
try
{
_logger.LogInformation("Adding or updating point {point}", point);
bool doesExist = _context.Points.Any(p => p.Id == point.Id);
if (doesExist)
{
_logger.LogInformation("Point {id} exists, updating", point.Id);
_context.Points.Update(point);
await _context.SaveChangesAsync();
return (Point?)null;
}
else
{
_logger.LogInformation("Point {id} does not exist, adding", point.Id);
EntityEntry<Point> result = _context.Points.Add(point);
await _context.SaveChangesAsync();
return result.Entity;
}
}
catch (Exception e)
{
_logger.LogError(e, "Error adding or updating point {point}", point);
return Error.Failure();
}
}
/// <inheritdoc/>
public async Task<ErrorOr<Point>> AddPointAsync(Point point)
{
try
{
_logger.LogInformation("Adding or updating point {point}", point);
EntityEntry<Point> result = await _context.Points.AddAsync(point);
await _context.SaveChangesAsync();
return result.Entity;
}
catch (Exception e)
{
_logger.LogError(e, "Error adding point {point}", point);
return Error.Failure();
}
}
/// <inheritdoc/>
public async Task<ErrorOr<Deleted>> DeletePointAsync(int id)
{
try
{
_logger.LogInformation("Deleting point {id}", id);
Point? point = await _context.Points.FindAsync(id);
if (point == null)
return Error.NotFound();
_context.Points.Remove(point);
await _context.SaveChangesAsync();
return Result.Deleted;
}
catch (Exception e)
{
_logger.LogError(e, "Error deleting point {id}", id);
return Error.Failure();
}
}
/// <inheritdoc/>
public async Task<ErrorOr<Point>> GetPointAsync(int id)
{
try
{
_logger.LogInformation("Getting point {id}", id);
Point? point = await _context.Points.FindAsync(id);
if (point == null)
return Error.NotFound();
return point;
}
catch (Exception e)
{
_logger.LogError(e, "Error getting point {id}", id);
return Error.Failure();
}
}
/// <inheritdoc/>
public Task<IQueryable<Point>> GetPointsRangeAsync()
{
return Task.FromResult(_context.Points.AsQueryable());
}
}
@@ -0,0 +1,153 @@
using ErrorOr;
using Microsoft.EntityFrameworkCore.ChangeTracking;
using Microsoft.Extensions.Logging;
using MuiCharts.Domain.Models;
using MuiCharts.Domain.Repositories;
namespace MuiCharts.Infrastructure.Repositories;
/// <summary>
/// Represents a repository for tracks.
/// </summary>
/// <param name="context">The data context.</param>
/// <param name="logger">The logger.</param>
public class TrackRepository(
DataContext context,
ILogger<TrackRepository> logger
) : ITrackRepository
{
private readonly DataContext _context = context;
private readonly ILogger<TrackRepository> _logger = logger;
/// <inheritdoc />
public async Task<ErrorOr<Track?>> AddOrUpdateTrackAsync(Track track)
{
try
{
_logger.LogInformation("Adding or updating track {track}", track);
if (!IsValidTrack(track))
{
_logger.LogInformation("Points with first ID {FirstId} and second ID {SecondId} do not exist", track.FirstId, track.SecondId);
return Error.Validation(description: "One or both specified points do not exist.");
}
bool doesExist = _context.Tracks.Any(t => t.FirstId == track.FirstId && t.SecondId == track.SecondId);
if (doesExist)
{
_logger.LogInformation("Track with first ID {FirstId} and second ID {SecondId} exists, updating", track.FirstId, track.SecondId);
_context.Tracks.Update(track);
await _context.SaveChangesAsync();
return (Track?)null;
}
else
{
_logger.LogInformation("Track with first ID {FirstId} and second ID {SecondId} does not exist, adding", track.FirstId, track.SecondId);
EntityEntry<Track> result = _context.Tracks.Add(track);
await _context.SaveChangesAsync();
return result.Entity;
}
}
catch (Exception e)
{
_logger.LogError(e, "Error adding or updating track {track}", track);
return Error.Failure();
}
}
/// <inheritdoc />
public async Task<ErrorOr<Track>> AddTrackAsync(Track track)
{
try
{
_logger.LogInformation("Adding track with first ID {FirstId} and second ID {SecondId}", track.FirstId, track.SecondId);
if (!IsValidTrack(track))
{
_logger.LogInformation("Points with first ID {FirstId} and second ID {SecondId} do not exist", track.FirstId, track.SecondId);
return Error.Validation(description: "One or both specified points do not exist.");
}
if (_context.Tracks.Any(t => t.FirstId == track.FirstId && t.SecondId == track.SecondId))
{
_logger.LogInformation("Track with first ID {FirstId} and second ID {SecondId} already exists", track.FirstId, track.SecondId);
return Error.Conflict();
}
EntityEntry<Track> result = _context.Tracks.Add(track);
await _context.SaveChangesAsync();
return result.Entity;
}
catch (Exception e)
{
_logger.LogError(e, "Error adding track with first ID {FirstId} and second ID {SecondId}", track.FirstId, track.SecondId);
return Error.Failure();
}
}
/// <inheritdoc />
public async Task<ErrorOr<Deleted>> DeleteTrackAsync(int firstId, int secondId)
{
try
{
_logger.LogInformation("Deleting track with first ID {FirstId} and second ID {SecondId}", firstId, secondId);
Track? track = await _context.Tracks.FindAsync(firstId, secondId);
if (track is null)
{
_logger.LogInformation("Track with first ID {FirstId} and second ID {SecondId} does not exist", firstId, secondId);
return Error.NotFound();
}
_context.Tracks.Remove(track);
await _context.SaveChangesAsync();
return new Deleted();
}
catch (Exception e)
{
_logger.LogError(e, "Error deleting track with first ID {FirstId} and second ID {SecondId}", firstId, secondId);
return Error.Failure();
}
}
/// <inheritdoc />
public async Task<ErrorOr<Track>> GetTrackAsync(int firstId, int secondId)
{
try
{
_logger.LogInformation("Getting track with first ID {FirstId} and second ID {SecondId}", firstId, secondId);
Track? track = await _context.Tracks.FindAsync(firstId, secondId);
if (track is null)
{
_logger.LogInformation("Track with first ID {FirstId} and second ID {SecondId} does not exist", firstId, secondId);
return Error.NotFound();
}
return track;
}
catch (Exception e)
{
_logger.LogError(e, "Error getting track with first ID {FirstId} and second ID {SecondId}", firstId, secondId);
return Error.Failure();
}
}
/// <inheritdoc />
public Task<IQueryable<Track>> GetTracksRangeAsync()
{
return Task.FromResult(_context.Tracks.AsQueryable());
}
private bool IsValidTrack(Track track)
{
return _context.Points.Any(p => p.Id == track.FirstId) &&
_context.Points.Any(p => p.Id == track.SecondId);
}
}
+43
View File
@@ -0,0 +1,43 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.002.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MuiCharts.Domain", "MuiCharts.Domain\MuiCharts.Domain.csproj", "{46BF0964-24CC-4757-9A10-9F29F6CCA9E7}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MuiCharts.Api", "MuiCharts.Api\MuiCharts.Api.csproj", "{E0B3F765-138A-4784-8349-C45E8F0673E0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MuiCharts.Infrastructure", "MuiCharts.Infrastructure\MuiCharts.Infrastructure.csproj", "{810B3986-E864-4B7F-BFCF-B849FD950C99}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MuiCharts.Contracts", "MuiCharts.Contracts\MuiCharts.Contracts.csproj", "{21E46377-9EF8-4981-8593-CEFEE3A3CBB6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{46BF0964-24CC-4757-9A10-9F29F6CCA9E7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{46BF0964-24CC-4757-9A10-9F29F6CCA9E7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{46BF0964-24CC-4757-9A10-9F29F6CCA9E7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{46BF0964-24CC-4757-9A10-9F29F6CCA9E7}.Release|Any CPU.Build.0 = Release|Any CPU
{E0B3F765-138A-4784-8349-C45E8F0673E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E0B3F765-138A-4784-8349-C45E8F0673E0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E0B3F765-138A-4784-8349-C45E8F0673E0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E0B3F765-138A-4784-8349-C45E8F0673E0}.Release|Any CPU.Build.0 = Release|Any CPU
{810B3986-E864-4B7F-BFCF-B849FD950C99}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{810B3986-E864-4B7F-BFCF-B849FD950C99}.Debug|Any CPU.Build.0 = Debug|Any CPU
{810B3986-E864-4B7F-BFCF-B849FD950C99}.Release|Any CPU.ActiveCfg = Release|Any CPU
{810B3986-E864-4B7F-BFCF-B849FD950C99}.Release|Any CPU.Build.0 = Release|Any CPU
{21E46377-9EF8-4981-8593-CEFEE3A3CBB6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{21E46377-9EF8-4981-8593-CEFEE3A3CBB6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{21E46377-9EF8-4981-8593-CEFEE3A3CBB6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{21E46377-9EF8-4981-8593-CEFEE3A3CBB6}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {2FAC24E8-FCA3-4D28-A826-031825B5A057}
EndGlobalSection
EndGlobal
+17
View File
@@ -0,0 +1,17 @@
version: "3.8"
services:
backend:
image: "muicharts-backend:latest"
build:
context: ./backend
ports:
- "80:80"
- "443:443"
volumes:
- ./persistence:/persistence
environment:
- "HTTPS_PORTS=443"
- "LettuceEncrypt:AcceptTermsOfService=true"
- "LettuceEncrypt:DomainNames:0=containers.xfox111.net"
- "LettuceEncrypt:EmailAddress=eugene@xfox111.net"