From b0f2eabed49ac256b94fcd1a2ecc4b636d29de50 Mon Sep 17 00:00:00 2001 From: Simon Schulze Date: Mon, 15 Aug 2022 20:48:49 +0200 Subject: [PATCH] =?UTF-8?q?Projektdateien=20hinzuf=C3=BCgen.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitattributes | 63 +++ .gitignore | 363 ++++++++++++++++++ iRLeagueApiCore.Common.sln | 25 ++ .../Converters/JsonTimeSpanConverter.cs | 35 ++ .../Enums/AccumulateByOption.cs | 11 + .../Enums/AccumulateResultsOption.cs | 15 + iRLeagueApiCore.Common/Enums/AdminRights.cs | 40 ++ .../Enums/ComparatorType.cs | 13 + .../Enums/ConnectionStatus.cs | 34 ++ .../Enums/DatabaseStatus.cs | 33 ++ .../Enums/DropRacesOption.cs | 30 ++ iRLeagueApiCore.Common/Enums/EventType.cs | 17 + iRLeagueApiCore.Common/Enums/GetBestOption.cs | 8 + iRLeagueApiCore.Common/Enums/RaceStatus.cs | 32 ++ .../Enums/ResultSortOption.cs | 16 + iRLeagueApiCore.Common/Enums/SaveSelect.cs | 38 ++ iRLeagueApiCore.Common/Enums/ScoringKind.cs | 31 ++ .../Enums/ScoringSessionSelection.cs | 11 + iRLeagueApiCore.Common/Enums/SessionType.cs | 38 ++ .../Enums/SimSessionType.cs | 11 + iRLeagueApiCore.Common/Enums/StewardVote.cs | 34 ++ .../Enums/StewardVoteState.cs | 35 ++ .../Enums/TimingComponents.cs | 36 ++ iRLeagueApiCore.Common/Enums/UpdateKind.cs | 31 ++ iRLeagueApiCore.Common/Enums/WeekDaysFlag.cs | 38 ++ .../Models/GetAdminUserModel.cs | 13 + .../Models/IVersionModel.cs | 39 ++ .../Models/Leagues/LeagueModel.cs | 57 +++ .../Models/Leagues/PostLeagueModel.cs | 19 + .../Models/Leagues/PutLeagueModel.cs | 22 ++ iRLeagueApiCore.Common/Models/ResultModel.cs | 74 ++++ .../Models/ResultRowModel.cs | 201 ++++++++++ .../Models/Schedules/PostScheduleModel.cs | 12 + .../Models/Schedules/PutScheduleModel.cs | 11 + .../Models/Schedules/ScheduleModel.cs | 52 +++ .../Models/Scorings/PostScoringModel.cs | 154 ++++++++ .../Models/Scorings/PutScoringModel.cs | 15 + .../Models/Scorings/ScoringModel.cs | 68 ++++ .../Models/Seasons/PostSeasonModel.cs | 14 + .../Models/Seasons/PutSeasonModel.cs | 17 + .../Models/Seasons/SeasonModel.cs | 54 +++ .../Models/Sessions/PostSessionModel.cs | 12 + .../Models/Sessions/PutSessionModel.cs | 50 +++ .../Sessions/PutSessionSubSessionModel.cs | 61 +++ .../Models/Sessions/SessionModel.cs | 77 ++++ .../Models/Sessions/SubSessionModel.cs | 17 + .../Models/SimSessionDetails.cs | 253 ++++++++++++ .../Models/UserRoleModel.cs | 17 + .../Responses/BadRequestResponse.cs | 14 + .../Responses/ValidationError.cs | 15 + .../iRLeagueApiCore.Common.csproj | 29 ++ 51 files changed, 2405 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 iRLeagueApiCore.Common.sln create mode 100644 iRLeagueApiCore.Common/Converters/JsonTimeSpanConverter.cs create mode 100644 iRLeagueApiCore.Common/Enums/AccumulateByOption.cs create mode 100644 iRLeagueApiCore.Common/Enums/AccumulateResultsOption.cs create mode 100644 iRLeagueApiCore.Common/Enums/AdminRights.cs create mode 100644 iRLeagueApiCore.Common/Enums/ComparatorType.cs create mode 100644 iRLeagueApiCore.Common/Enums/ConnectionStatus.cs create mode 100644 iRLeagueApiCore.Common/Enums/DatabaseStatus.cs create mode 100644 iRLeagueApiCore.Common/Enums/DropRacesOption.cs create mode 100644 iRLeagueApiCore.Common/Enums/EventType.cs create mode 100644 iRLeagueApiCore.Common/Enums/GetBestOption.cs create mode 100644 iRLeagueApiCore.Common/Enums/RaceStatus.cs create mode 100644 iRLeagueApiCore.Common/Enums/ResultSortOption.cs create mode 100644 iRLeagueApiCore.Common/Enums/SaveSelect.cs create mode 100644 iRLeagueApiCore.Common/Enums/ScoringKind.cs create mode 100644 iRLeagueApiCore.Common/Enums/ScoringSessionSelection.cs create mode 100644 iRLeagueApiCore.Common/Enums/SessionType.cs create mode 100644 iRLeagueApiCore.Common/Enums/SimSessionType.cs create mode 100644 iRLeagueApiCore.Common/Enums/StewardVote.cs create mode 100644 iRLeagueApiCore.Common/Enums/StewardVoteState.cs create mode 100644 iRLeagueApiCore.Common/Enums/TimingComponents.cs create mode 100644 iRLeagueApiCore.Common/Enums/UpdateKind.cs create mode 100644 iRLeagueApiCore.Common/Enums/WeekDaysFlag.cs create mode 100644 iRLeagueApiCore.Common/Models/GetAdminUserModel.cs create mode 100644 iRLeagueApiCore.Common/Models/IVersionModel.cs create mode 100644 iRLeagueApiCore.Common/Models/Leagues/LeagueModel.cs create mode 100644 iRLeagueApiCore.Common/Models/Leagues/PostLeagueModel.cs create mode 100644 iRLeagueApiCore.Common/Models/Leagues/PutLeagueModel.cs create mode 100644 iRLeagueApiCore.Common/Models/ResultModel.cs create mode 100644 iRLeagueApiCore.Common/Models/ResultRowModel.cs create mode 100644 iRLeagueApiCore.Common/Models/Schedules/PostScheduleModel.cs create mode 100644 iRLeagueApiCore.Common/Models/Schedules/PutScheduleModel.cs create mode 100644 iRLeagueApiCore.Common/Models/Schedules/ScheduleModel.cs create mode 100644 iRLeagueApiCore.Common/Models/Scorings/PostScoringModel.cs create mode 100644 iRLeagueApiCore.Common/Models/Scorings/PutScoringModel.cs create mode 100644 iRLeagueApiCore.Common/Models/Scorings/ScoringModel.cs create mode 100644 iRLeagueApiCore.Common/Models/Seasons/PostSeasonModel.cs create mode 100644 iRLeagueApiCore.Common/Models/Seasons/PutSeasonModel.cs create mode 100644 iRLeagueApiCore.Common/Models/Seasons/SeasonModel.cs create mode 100644 iRLeagueApiCore.Common/Models/Sessions/PostSessionModel.cs create mode 100644 iRLeagueApiCore.Common/Models/Sessions/PutSessionModel.cs create mode 100644 iRLeagueApiCore.Common/Models/Sessions/PutSessionSubSessionModel.cs create mode 100644 iRLeagueApiCore.Common/Models/Sessions/SessionModel.cs create mode 100644 iRLeagueApiCore.Common/Models/Sessions/SubSessionModel.cs create mode 100644 iRLeagueApiCore.Common/Models/SimSessionDetails.cs create mode 100644 iRLeagueApiCore.Common/Models/UserRoleModel.cs create mode 100644 iRLeagueApiCore.Common/Responses/BadRequestResponse.cs create mode 100644 iRLeagueApiCore.Common/Responses/ValidationError.cs create mode 100644 iRLeagueApiCore.Common/iRLeagueApiCore.Common.csproj diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..1ff0c42 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,63 @@ +############################################################################### +# Set default behavior to automatically normalize line endings. +############################################################################### +* text=auto + +############################################################################### +# Set default behavior for command prompt diff. +# +# This is need for earlier builds of msysgit that does not have it on by +# default for csharp files. +# Note: This is only used by command line +############################################################################### +#*.cs diff=csharp + +############################################################################### +# Set the merge driver for project and solution files +# +# Merging from the command prompt will add diff markers to the files if there +# are conflicts (Merging from VS is not affected by the settings below, in VS +# the diff markers are never inserted). Diff markers may cause the following +# file extensions to fail to load in VS. An alternative would be to treat +# these files as binary and thus will always conflict and require user +# intervention with every merge. To do so, just uncomment the entries below +############################################################################### +#*.sln merge=binary +#*.csproj merge=binary +#*.vbproj merge=binary +#*.vcxproj merge=binary +#*.vcproj merge=binary +#*.dbproj merge=binary +#*.fsproj merge=binary +#*.lsproj merge=binary +#*.wixproj merge=binary +#*.modelproj merge=binary +#*.sqlproj merge=binary +#*.wwaproj merge=binary + +############################################################################### +# behavior for image files +# +# image files are treated as binary by default. +############################################################################### +#*.jpg binary +#*.png binary +#*.gif binary + +############################################################################### +# diff behavior for common document formats +# +# Convert binary document formats to text before diffing them. This feature +# is only available from the command line. Turn it on by uncommenting the +# entries below. +############################################################################### +#*.doc diff=astextplain +#*.DOC diff=astextplain +#*.docx diff=astextplain +#*.DOCX diff=astextplain +#*.dot diff=astextplain +#*.DOT diff=astextplain +#*.pdf diff=astextplain +#*.PDF diff=astextplain +#*.rtf diff=astextplain +#*.RTF diff=astextplain diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9491a2f --- /dev/null +++ b/.gitignore @@ -0,0 +1,363 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# 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/ +[Oo]ut/ +[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 Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# 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 +*.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 + +# 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 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/ + +# 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 \ No newline at end of file diff --git a/iRLeagueApiCore.Common.sln b/iRLeagueApiCore.Common.sln new file mode 100644 index 0000000..9cd7fb0 --- /dev/null +++ b/iRLeagueApiCore.Common.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.31912.275 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "iRLeagueApiCore.Common", "iRLeagueApiCore.Common\iRLeagueApiCore.Common.csproj", "{50D4C91B-F279-4227-B738-7609CC1EF612}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {50D4C91B-F279-4227-B738-7609CC1EF612}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {50D4C91B-F279-4227-B738-7609CC1EF612}.Debug|Any CPU.Build.0 = Debug|Any CPU + {50D4C91B-F279-4227-B738-7609CC1EF612}.Release|Any CPU.ActiveCfg = Release|Any CPU + {50D4C91B-F279-4227-B738-7609CC1EF612}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {9A22D47A-3038-4120-AC6A-448699FF33A8} + EndGlobalSection +EndGlobal diff --git a/iRLeagueApiCore.Common/Converters/JsonTimeSpanConverter.cs b/iRLeagueApiCore.Common/Converters/JsonTimeSpanConverter.cs new file mode 100644 index 0000000..1d61d3a --- /dev/null +++ b/iRLeagueApiCore.Common/Converters/JsonTimeSpanConverter.cs @@ -0,0 +1,35 @@ +#if NETCOREAPP +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Threading.Tasks; +using System.Xml; + +namespace iRLeagueApiCore.Common.Converters +{ + public class JsonTimeSpanConverter : JsonConverter + { + public override TimeSpan Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if (typeof(long).IsAssignableFrom(typeToConvert)) + { + var longValue = reader.GetInt64(); + return new TimeSpan(longValue); + } + else + { + var timeSpanString = reader.GetString(); + return TimeSpan.ParseExact(timeSpanString, @"hh\:mm\:ss\.fffff", null); + } + } + + public override void Write(Utf8JsonWriter writer, TimeSpan value, JsonSerializerOptions options) + { + writer.WriteStringValue(value.ToString(@"hh\:mm\:ss\.fffff")); + } + } +} +#endif diff --git a/iRLeagueApiCore.Common/Enums/AccumulateByOption.cs b/iRLeagueApiCore.Common/Enums/AccumulateByOption.cs new file mode 100644 index 0000000..6cf6f97 --- /dev/null +++ b/iRLeagueApiCore.Common/Enums/AccumulateByOption.cs @@ -0,0 +1,11 @@ +namespace iRLeagueApiCore.Common.Enums +{ + /// + /// Select the column for identifying rows that belong together + /// + public enum AccumulateByOption + { + Member, + Team + } +} diff --git a/iRLeagueApiCore.Common/Enums/AccumulateResultsOption.cs b/iRLeagueApiCore.Common/Enums/AccumulateResultsOption.cs new file mode 100644 index 0000000..1ae28d3 --- /dev/null +++ b/iRLeagueApiCore.Common/Enums/AccumulateResultsOption.cs @@ -0,0 +1,15 @@ +namespace iRLeagueApiCore.Common.Enums +{ + /// + /// Select the method to accumulate scorings + /// + public enum AccumulateResultsOption + { + None = 0, + Sum, + Best, + Worst, + Average, + WeightedAverage + } +} diff --git a/iRLeagueApiCore.Common/Enums/AdminRights.cs b/iRLeagueApiCore.Common/Enums/AdminRights.cs new file mode 100644 index 0000000..e64bc80 --- /dev/null +++ b/iRLeagueApiCore.Common/Enums/AdminRights.cs @@ -0,0 +1,40 @@ +// MIT License + +// Copyright (c) 2020 Simon Schulze + +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: + +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. + +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +using System; + +namespace iRLeagueApiCore.Common.Enums +{ + [Flags] + public enum AdminRights + { + Member = 0b00000000, + EditMemberData = 0b00000001, + EditLeagueData = 0b00000010, + DeleteMemberData = 0b00000100, + DeleteLeagueData = 0b00001000, + EditDeleteMemberData = 0b00000101, + EditDeleteLeagueData = 0b00001010, + RightManager = 0b00010001, + Owner = 0b11111111 + } +} diff --git a/iRLeagueApiCore.Common/Enums/ComparatorType.cs b/iRLeagueApiCore.Common/Enums/ComparatorType.cs new file mode 100644 index 0000000..9dea08f --- /dev/null +++ b/iRLeagueApiCore.Common/Enums/ComparatorType.cs @@ -0,0 +1,13 @@ +namespace iRLeagueApiCore.Common.Enums +{ + public enum ComparatorType + { + IsSmaller, + IsSmallerOrEqual, + IsEqual, + IsBiggerOrEqual, + IsBigger, + NotEqual, + InList + } +} diff --git a/iRLeagueApiCore.Common/Enums/ConnectionStatus.cs b/iRLeagueApiCore.Common/Enums/ConnectionStatus.cs new file mode 100644 index 0000000..63850b5 --- /dev/null +++ b/iRLeagueApiCore.Common/Enums/ConnectionStatus.cs @@ -0,0 +1,34 @@ +// MIT License + +// Copyright (c) 2020 Simon Schulze + +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: + +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. + +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +namespace iRLeagueApiCore.Common.Enums +{ + public enum ConnectionStatus + { + Disconnected = 0, + Connected = 1, + Connecting = 2, + DatabaseUnavailable = 3, + NoConnection = 4, + ConnectionError = 99 + } +} diff --git a/iRLeagueApiCore.Common/Enums/DatabaseStatus.cs b/iRLeagueApiCore.Common/Enums/DatabaseStatus.cs new file mode 100644 index 0000000..b43f9a9 --- /dev/null +++ b/iRLeagueApiCore.Common/Enums/DatabaseStatus.cs @@ -0,0 +1,33 @@ +// MIT License + +// Copyright (c) 2020 Simon Schulze + +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: + +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. + +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +namespace iRLeagueApiCore.Common.Enums +{ + public enum DatabaseStatus + { + Idle = 0, + Loading = 1, + Saving = 2, + Updating = 3, + Error = 99 + } +} diff --git a/iRLeagueApiCore.Common/Enums/DropRacesOption.cs b/iRLeagueApiCore.Common/Enums/DropRacesOption.cs new file mode 100644 index 0000000..d4ba3bd --- /dev/null +++ b/iRLeagueApiCore.Common/Enums/DropRacesOption.cs @@ -0,0 +1,30 @@ +// MIT License + +// Copyright (c) 2020 Simon Schulze + +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: + +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. + +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +namespace iRLeagueApiCore.Common.Enums +{ + public enum DropRacesOption + { + PerTeamResults = 0, + PerDriverResults = 1 + } +} diff --git a/iRLeagueApiCore.Common/Enums/EventType.cs b/iRLeagueApiCore.Common/Enums/EventType.cs new file mode 100644 index 0000000..c35bd8b --- /dev/null +++ b/iRLeagueApiCore.Common/Enums/EventType.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace iRLeagueApiCore.Common.Enums +{ + public enum EventType + { + Undefined, + Practice, + Qualifying, + SingleRace, + MultiRace + } +} diff --git a/iRLeagueApiCore.Common/Enums/GetBestOption.cs b/iRLeagueApiCore.Common/Enums/GetBestOption.cs new file mode 100644 index 0000000..9afb8f5 --- /dev/null +++ b/iRLeagueApiCore.Common/Enums/GetBestOption.cs @@ -0,0 +1,8 @@ +namespace iRLeagueApiCore.Common.Enums +{ + public enum GetBestOption + { + MaxValue, + MinValue + } +} diff --git a/iRLeagueApiCore.Common/Enums/RaceStatus.cs b/iRLeagueApiCore.Common/Enums/RaceStatus.cs new file mode 100644 index 0000000..3512788 --- /dev/null +++ b/iRLeagueApiCore.Common/Enums/RaceStatus.cs @@ -0,0 +1,32 @@ +// MIT License + +// Copyright (c) 2020 Simon Schulze + +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: + +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. + +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +namespace iRLeagueApiCore.Common.Enums +{ + public enum RaceStatus + { + Running, + Disconnected, + Disqualified, + Unknown + } +} diff --git a/iRLeagueApiCore.Common/Enums/ResultSortOption.cs b/iRLeagueApiCore.Common/Enums/ResultSortOption.cs new file mode 100644 index 0000000..f73718c --- /dev/null +++ b/iRLeagueApiCore.Common/Enums/ResultSortOption.cs @@ -0,0 +1,16 @@ +namespace iRLeagueDatabase.Enums +{ + public enum ResultSortOption + { + None = 0, + FinishPosition, + StartPosition, + FastestLap, + AverageLap, + Interval, + RacePoints, + BonusPoints, + PenaltyPoints, + TotalPoints + } +} diff --git a/iRLeagueApiCore.Common/Enums/SaveSelect.cs b/iRLeagueApiCore.Common/Enums/SaveSelect.cs new file mode 100644 index 0000000..cb2731d --- /dev/null +++ b/iRLeagueApiCore.Common/Enums/SaveSelect.cs @@ -0,0 +1,38 @@ +// MIT License + +// Copyright (c) 2020 Simon Schulze + +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: + +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. + +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +using System; + +namespace iRLeagueApiCore.Common.Enums +{ + [Flags] + public enum SaveSelect + { + LeagueMembers = 0b00000001, + Admins = 0b00000010, + Results = 0b00000100, + Scorings = 0b00001000, + Schedules = 0b00010000, + Seasons = 0b00100000, + Teams = 0b01000000 + } +} diff --git a/iRLeagueApiCore.Common/Enums/ScoringKind.cs b/iRLeagueApiCore.Common/Enums/ScoringKind.cs new file mode 100644 index 0000000..2fe74d8 --- /dev/null +++ b/iRLeagueApiCore.Common/Enums/ScoringKind.cs @@ -0,0 +1,31 @@ +// MIT License + +// Copyright (c) 2020 Simon Schulze + +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: + +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. + +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +namespace iRLeagueApiCore.Common.Enums +{ + public enum ScoringKind + { + Member = 0, + Team = 1, + Custom = 3 + } +} diff --git a/iRLeagueApiCore.Common/Enums/ScoringSessionSelection.cs b/iRLeagueApiCore.Common/Enums/ScoringSessionSelection.cs new file mode 100644 index 0000000..087b121 --- /dev/null +++ b/iRLeagueApiCore.Common/Enums/ScoringSessionSelection.cs @@ -0,0 +1,11 @@ +namespace iRLeagueApiCore.Common.Enums +{ + /// + /// Defines how the sessions for this scoring are selected + /// + public enum ScoringSessionSelectionType + { + SelectSchedule, + SelectSessions + } +} diff --git a/iRLeagueApiCore.Common/Enums/SessionType.cs b/iRLeagueApiCore.Common/Enums/SessionType.cs new file mode 100644 index 0000000..12b1620 --- /dev/null +++ b/iRLeagueApiCore.Common/Enums/SessionType.cs @@ -0,0 +1,38 @@ +// MIT License + +// Copyright (c) 2020 Simon Schulze + +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: + +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. + +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +namespace iRLeagueApiCore.Common.Enums +{ + /// + /// Selected session type + /// + public enum SessionType + { + Undefined, + Practice, + Qualifying, + Race, + HeatEvent, + Heat, + Warmup + } +} diff --git a/iRLeagueApiCore.Common/Enums/SimSessionType.cs b/iRLeagueApiCore.Common/Enums/SimSessionType.cs new file mode 100644 index 0000000..4ec70ce --- /dev/null +++ b/iRLeagueApiCore.Common/Enums/SimSessionType.cs @@ -0,0 +1,11 @@ +namespace iRLeagueApiCore.Common.Enums +{ + public enum SimSessionType + { + Unknown, + OpenPractice = 3, + LoneQualifying = 4, + OpenQualifying = 5, + Race = 6 + } +} diff --git a/iRLeagueApiCore.Common/Enums/StewardVote.cs b/iRLeagueApiCore.Common/Enums/StewardVote.cs new file mode 100644 index 0000000..bc20854 --- /dev/null +++ b/iRLeagueApiCore.Common/Enums/StewardVote.cs @@ -0,0 +1,34 @@ +// MIT License + +// Copyright (c) 2020 Simon Schulze + +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: + +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. + +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +namespace iRLeagueApiCore.Common.Enums +{ + public enum StewardVote + { + NoVote, + Kat0, + Kat1, + Kat2, + Kat3, + Indecisive + } +} diff --git a/iRLeagueApiCore.Common/Enums/StewardVoteState.cs b/iRLeagueApiCore.Common/Enums/StewardVoteState.cs new file mode 100644 index 0000000..6703ad8 --- /dev/null +++ b/iRLeagueApiCore.Common/Enums/StewardVoteState.cs @@ -0,0 +1,35 @@ +// MIT License + +// Copyright (c) 2020 Simon Schulze + +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: + +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. + +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +namespace iRLeagueApiCore.Common.Enums +{ + public enum StewardVoteState + { + NoVote, + Open, + VotesNeeded, + Conflict, + MajorityVote, + Agreed, + Closed + } +} diff --git a/iRLeagueApiCore.Common/Enums/TimingComponents.cs b/iRLeagueApiCore.Common/Enums/TimingComponents.cs new file mode 100644 index 0000000..5e0de3f --- /dev/null +++ b/iRLeagueApiCore.Common/Enums/TimingComponents.cs @@ -0,0 +1,36 @@ +// MIT License + +// Copyright (c) 2020 Simon Schulze + +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: + +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. + +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +using System; + +namespace iRLeagueApiCore.Common.Enums +{ + [Flags] + public enum TimingComponents + { + Milliseconds = 0b00000001, + Seconds = 0b00000010, + Minutes = 0b00000100, + Hours = 0b00001000, + Days = 0b00010000 + } +} diff --git a/iRLeagueApiCore.Common/Enums/UpdateKind.cs b/iRLeagueApiCore.Common/Enums/UpdateKind.cs new file mode 100644 index 0000000..8f064df --- /dev/null +++ b/iRLeagueApiCore.Common/Enums/UpdateKind.cs @@ -0,0 +1,31 @@ +// MIT License + +// Copyright (c) 2020 Simon Schulze + +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: + +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. + +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +namespace iRLeagueApiCore.Common.Enums +{ + public enum UpdateKind + { + Loading, + Saving, + Updating + } +} diff --git a/iRLeagueApiCore.Common/Enums/WeekDaysFlag.cs b/iRLeagueApiCore.Common/Enums/WeekDaysFlag.cs new file mode 100644 index 0000000..f02b80b --- /dev/null +++ b/iRLeagueApiCore.Common/Enums/WeekDaysFlag.cs @@ -0,0 +1,38 @@ +// MIT License + +// Copyright (c) 2020 Simon Schulze + +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: + +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. + +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +using System; + +namespace iRLeagueApiCore.Common.Enums +{ + [Flags] + public enum WeekDaysFlag + { + Sunday = 1 << DayOfWeek.Sunday, + Monday = 1 << DayOfWeek.Monday, + Tuesday = 1 << DayOfWeek.Tuesday, + Wednesday = 1 << DayOfWeek.Wednesday, + Thursday = 1 << DayOfWeek.Thursday, + Friday = 1 << DayOfWeek.Friday, + Saturday = 1 << DayOfWeek.Saturday + } +} diff --git a/iRLeagueApiCore.Common/Models/GetAdminUserModel.cs b/iRLeagueApiCore.Common/Models/GetAdminUserModel.cs new file mode 100644 index 0000000..6232d57 --- /dev/null +++ b/iRLeagueApiCore.Common/Models/GetAdminUserModel.cs @@ -0,0 +1,13 @@ +using System.Collections.Generic; + +namespace iRLeagueApiCore.Common.Models +{ + public class GetAdminUserModel + { + public string UserName { get; set; } + public string Firsname { get; set; } + public string Lastname { get; set; } + public string Email { get; set; } + public IEnumerable Roles { get; set; } + } +} diff --git a/iRLeagueApiCore.Common/Models/IVersionModel.cs b/iRLeagueApiCore.Common/Models/IVersionModel.cs new file mode 100644 index 0000000..ab8a4d6 --- /dev/null +++ b/iRLeagueApiCore.Common/Models/IVersionModel.cs @@ -0,0 +1,39 @@ +using System; +using System.Runtime.Serialization; + +namespace iRLeagueApiCore.Common.Models +{ + public interface IVersionModel + { + /// + /// Date of creation + /// + [DataMember] + DateTime? CreatedOn { get; set; } + /// + /// Date of last modification + /// + [DataMember] + DateTime? LastModifiedOn { get; set; } + /// + /// User id that created the entry + /// + [DataMember] + string CreatedByUserId { get; set; } + /// + /// User id that last modified the entry + /// + [DataMember] + string LastModifiedByUserId { get; set; } + /// + /// User name that created the entry + /// + [DataMember] + string CreatedByUserName { get; set; } + /// + /// User name that last modified the entry + /// + [DataMember] + string LastModifiedByUserName { get; set; } + } +} diff --git a/iRLeagueApiCore.Common/Models/Leagues/LeagueModel.cs b/iRLeagueApiCore.Common/Models/Leagues/LeagueModel.cs new file mode 100644 index 0000000..0d52cc1 --- /dev/null +++ b/iRLeagueApiCore.Common/Models/Leagues/LeagueModel.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using System.Runtime.Serialization; + +namespace iRLeagueApiCore.Common.Models +{ + /// + /// Schema for fetching an existing league + /// + [DataContract] + public class LeagueModel : PostLeagueModel, IVersionModel + { + /// + /// Unique league id + /// + [DataMember] + public long Id { get; set; } + /// + /// Ids of seasons in this league + /// + [DataMember] + public IEnumerable SeasonIds { get; set; } + + #region version + /// + /// Date of creation + /// + [DataMember] + public DateTime? CreatedOn { get; set; } + /// + /// Date of last modification + /// + [DataMember] + public DateTime? LastModifiedOn { get; set; } + /// + /// User id that created the entry + /// + [DataMember] + public string CreatedByUserId { get; set; } + /// + /// User id that last modified the entry + /// + [DataMember] + public string LastModifiedByUserId { get; set; } + /// + /// User name that created the entry + /// + [DataMember] + public string CreatedByUserName { get; set; } + /// + /// User name that last modified the entry + /// + [DataMember] + public string LastModifiedByUserName { get; set; } + #endregion + } +} diff --git a/iRLeagueApiCore.Common/Models/Leagues/PostLeagueModel.cs b/iRLeagueApiCore.Common/Models/Leagues/PostLeagueModel.cs new file mode 100644 index 0000000..efb0814 --- /dev/null +++ b/iRLeagueApiCore.Common/Models/Leagues/PostLeagueModel.cs @@ -0,0 +1,19 @@ +using System.Runtime.Serialization; + +namespace iRLeagueApiCore.Common.Models +{ + /// + /// Schema for updating an existing league + /// + [DataContract] + public class PostLeagueModel : PutLeagueModel + { + /// + /// Short name of the league + /// Used to identify the league in queries + /// Cannot contain spaces and only use characters: a-z A-Z 0-1 _ - + /// + [DataMember] + public string Name { get; set; } + } +} diff --git a/iRLeagueApiCore.Common/Models/Leagues/PutLeagueModel.cs b/iRLeagueApiCore.Common/Models/Leagues/PutLeagueModel.cs new file mode 100644 index 0000000..14ea42c --- /dev/null +++ b/iRLeagueApiCore.Common/Models/Leagues/PutLeagueModel.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; +using System.Threading.Tasks; + +namespace iRLeagueApiCore.Common.Models +{ + /// + /// Schema for posting a new league + /// + [DataContract] + public class PutLeagueModel + { + /// + /// Full name of the league can contain any UTF-8 characters + /// + [DataMember] + public string NameFull { get; set; } + } +} diff --git a/iRLeagueApiCore.Common/Models/ResultModel.cs b/iRLeagueApiCore.Common/Models/ResultModel.cs new file mode 100644 index 0000000..cfeee45 --- /dev/null +++ b/iRLeagueApiCore.Common/Models/ResultModel.cs @@ -0,0 +1,74 @@ +using System; +using System.Collections.Generic; +using System.Runtime.Serialization; + +namespace iRLeagueApiCore.Common.Models +{ + /// + /// Get a complete scored result from the database + /// + public class ResultModel + { + /// + /// Id of the league + /// + public long LeagueId { get; set; } + /// + /// Id of the season the result belongs to + /// + public long SeasonId { get; set; } + /// + /// Name of the season the result belongs to + /// + [DataMember] + public string SeasonName { get; set; } + /// + /// Id of the schedule the result belongs to + /// + [DataMember] + public long ScheduleId { get; set; } + /// + /// Name of the schedule the result belongs to + /// + [DataMember] + public string ScheduleName { get; set; } + /// + /// Id of the session the result belongs to + /// + [DataMember] + public long SessionId { get; set; } + /// + /// Name of the session the result belongs to + /// + [DataMember] + public string SessionName { get; set; } + /// + /// Id of the scoring for this result + /// + [DataMember] + public long ScoringId { get; set; } + /// + /// Name of the scoring for this result + /// + [DataMember] + public string ScoringName { get; set; } + /// + /// List of entries + /// + [DataMember(IsRequired = true)] + public IEnumerable ResultRows { get; set; } + + #region version + /// + /// Date of creation + /// + [DataMember] + public DateTime? CreatedOn { get; set; } + /// + /// Date of last modification + /// + [DataMember] + public DateTime? LastModifiedOn { get; set; } + #endregion + } +} diff --git a/iRLeagueApiCore.Common/Models/ResultRowModel.cs b/iRLeagueApiCore.Common/Models/ResultRowModel.cs new file mode 100644 index 0000000..7eba8e7 --- /dev/null +++ b/iRLeagueApiCore.Common/Models/ResultRowModel.cs @@ -0,0 +1,201 @@ +using System; +using System.Runtime.Serialization; + +namespace iRLeagueApiCore.Common.Models +{ + /// + /// Get a scored result row from the database + /// + public class ResultRowModel + { + /// + /// First name of the driver + /// + public string Firstname { get; set; } + /// + /// Last name of the driver + /// + public string Lastname { get; set; } + /// + /// Team name of the drivers team (or team result) + /// + public string TeamName { get; set; } + /// + /// Posiion at start of race session (equal to qually result when using attached qualifying) + /// + [DataMember] + public double StartPosition { get; set; } + /// + /// Finish position in the race results (iracing penalties are applied - league penalties are not) + /// + [DataMember] + public double FinishPosition { get; set; } + /// + /// Iracing id of the member + /// + [DataMember] + public long MemberId { get; set; } + /// + /// Car number in the session + /// + [DataMember] + public int CarNumber { get; set; } + /// + /// Class id in the session (in multiclass sessions) + /// + [DataMember] + public int ClassId { get; set; } + /// + /// Name of the car (e.g: "Skip Barber RT200") + /// + [DataMember] + public string Car { get; set; } + /// + /// Name of the car class (in multiclass sessions) + /// + [DataMember] + public string CarClass { get; set; } + /// + /// Number of completed laps in the main session (only includes laps from one session type e.g: race) + /// + [DataMember] + public double CompletedLaps { get; set; } + /// + /// Number of laps lead by this driver (only race) + /// + [DataMember] + public double LeadLaps { get; set; } + /// + /// Number of the fastest laps of this driver (applicable to all session types) + /// + [DataMember] + public int FastLapNr { get; set; } + /// + /// Number of incidents in the session (only main session) + /// + [DataMember] + public double Incidents { get; set; } + /// + /// Driver status at the end of the race (checkered flag) + /// + [DataMember] + public int Status { get; set; } + /// + /// Time set in qualifying (only available with attached qualy) + /// + [DataMember] + public TimeSpan QualifyingTime { get; set; } + /// + /// Interval to the leading driver + /// + [DataMember] + public TimeSpan Interval { get; set; } + /// + /// Average lap time in the main session + /// + [DataMember] + public TimeSpan AvgLapTime { get; set; } + /// + /// Fastest lap time in the main session + /// + [DataMember] + public TimeSpan FastestLapTime { get; set; } + /// + /// Position change StartPos -> FinPos during the main session + /// + [DataMember] + public double PositionChange { get; set; } + /// + /// Irating before the event + /// + [DataMember] + public int OldIrating { get; set; } + /// + /// Irating after completing the event + /// + [DataMember] + public int NewIrating { get; set; } + /// + /// Irating at the start of the season + /// + [DataMember] + public int SeasonStartIrating { get; set; } + /// + /// License class of the driver + /// + [DataMember] + public string License { get; set; } + /// + /// Driver safety rating before the event + /// + [DataMember] + public double OldSafetyRating { get; set; } + /// + /// Driver safety rating after completing the event + /// + [DataMember] + public double NewSafetyRating { get; set; } + /// + /// Driver/Team car id + /// + [DataMember] + public int CarId { get; set; } + /// + /// Completed race distance + /// When omited the value is calculated based on driver-laps/session-laps + /// + [DataMember] + public double? CompletedPct { get; set; } + /// + /// Iracing division of the driver + /// + [DataMember] + public int Division { get; set; } + /// + /// Driver License level before the event + /// + [DataMember] + public int OldLicenseLevel { get; set; } + /// + /// Driver license level after completing the event + /// + [DataMember] + public int NewLicenseLevel { get; set; } + /// + /// [optional] Id of the team the driver was part in this event + /// omit for no team + /// + [DataMember] + public long? TeamId { get; set; } + /// + /// Points gained from result in the race + /// + [DataMember] + public double RacePoints { get; set; } + /// + /// Points gained from bonus condition (will be added to race points) + /// + [DataMember] + public double BonusPoints { get; set; } + /// + /// Points deducted as penalty (Value is positive but points will be deducted from race points) + /// + [DataMember] + public double PenaltyPoints { get; set; } + /// + /// Total scored points -> sum of: (RacePoints + BonusPoints - PenaltyPoints) + /// + [DataMember] + public double TotalPoints { get; set; } + /// + /// Final position after all scoring rules and penalties are applied + /// + [DataMember] + public int FinalPosition { get; set; } + /// + /// Position change StartPosition -> FinalPosition + /// + [DataMember] + public double FinalPositionChange { get; set; } + } +} diff --git a/iRLeagueApiCore.Common/Models/Schedules/PostScheduleModel.cs b/iRLeagueApiCore.Common/Models/Schedules/PostScheduleModel.cs new file mode 100644 index 0000000..51bce23 --- /dev/null +++ b/iRLeagueApiCore.Common/Models/Schedules/PostScheduleModel.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace iRLeagueApiCore.Common.Models +{ + public class PostScheduleModel : PutScheduleModel + { + } +} diff --git a/iRLeagueApiCore.Common/Models/Schedules/PutScheduleModel.cs b/iRLeagueApiCore.Common/Models/Schedules/PutScheduleModel.cs new file mode 100644 index 0000000..3d90a09 --- /dev/null +++ b/iRLeagueApiCore.Common/Models/Schedules/PutScheduleModel.cs @@ -0,0 +1,11 @@ +using System.Runtime.Serialization; + +namespace iRLeagueApiCore.Common.Models +{ + [DataContract] + public class PutScheduleModel + { + [DataMember] + public string Name { get; set; } + } +} diff --git a/iRLeagueApiCore.Common/Models/Schedules/ScheduleModel.cs b/iRLeagueApiCore.Common/Models/Schedules/ScheduleModel.cs new file mode 100644 index 0000000..9f57161 --- /dev/null +++ b/iRLeagueApiCore.Common/Models/Schedules/ScheduleModel.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using System.Runtime.Serialization; + +namespace iRLeagueApiCore.Common.Models +{ + [DataContract] + public class ScheduleModel : PutScheduleModel, IVersionModel + { + [DataMember] + public long LeagueId { get; set; } + [DataMember] + public long ScheduleId { get; set; } + [DataMember] + public long SeasonId { get; set; } + [DataMember] + public IEnumerable SessionIds { get; set; } + + #region version + /// + /// Date of creation + /// + [DataMember] + public DateTime? CreatedOn { get; set; } + /// + /// Date of last modification + /// + [DataMember] + public DateTime? LastModifiedOn { get; set; } + /// + /// User id that created the entry + /// + [DataMember] + public string CreatedByUserId { get; set; } + /// + /// User id that last modified the entry + /// + [DataMember] + public string LastModifiedByUserId { get; set; } + /// + /// User name that created the entry + /// + [DataMember] + public string CreatedByUserName { get; set; } + /// + /// User name that last modified the entry + /// + [DataMember] + public string LastModifiedByUserName { get; set; } + #endregion + } +} diff --git a/iRLeagueApiCore.Common/Models/Scorings/PostScoringModel.cs b/iRLeagueApiCore.Common/Models/Scorings/PostScoringModel.cs new file mode 100644 index 0000000..dfc8aee --- /dev/null +++ b/iRLeagueApiCore.Common/Models/Scorings/PostScoringModel.cs @@ -0,0 +1,154 @@ +using iRLeagueApiCore.Common.Enums; +using System; +using System.Collections.Generic; +using System.Runtime.Serialization; +#if NETCOREAPP +using System.ComponentModel.DataAnnotations; +using System.Text.Json.Serialization; +#endif + +namespace iRLeagueApiCore.Common.Models +{ + /// + /// Schema for creating a new scoring + /// + [DataContract] + public class PostScoringModel + { + /// + /// Kind of scoring + /// + [DataMember] +#if NETCOREAPP + [EnumDataType(typeof(ScoringKind))] + [JsonConverter(typeof(JsonStringEnumConverter))] +#endif + public ScoringKind ScoringKind { get; set; } + /// + /// Name of the scoring - shown in results + /// + [DataMember] + public string Name { get; set; } + /// + /// Maximum number of results to use for calculating scorin group (e.g: Team scoring) + /// + [DataMember] + public int MaxResultsPerGroup { get; set; } + /// + /// Take average of result in group. If false take sum + /// + [DataMember] + public bool TakeGroupAverage { get; set; } + /// + /// External source for results if TakeResultsFromExtSource is true + /// + [DataMember] + public long? ExtScoringSourceId { get; set; } + /// + /// Re-use calculated results from a different scoring (e.g: team scoring when individual results are already available) + /// + [DataMember] + public bool TakeResultsFromExtSource { get; set; } + /// + /// Array of points awarded to each place - starting with [1st, 2nd, 3rd, ...] + /// Points can have decimal values e.g.: 0.5 + /// + [DataMember] + public IEnumerable BasePoints { get; set; } + /// + /// Array of key:value pairs as strings to award bonus points + /// Syntax is always "key:points" for each entry + /// Available keys: + /// p{nr} - finish position {nr} in race - example: winner gets 5 points, = ["p1:5"] + /// q{nr} - position in qualifying - example: polesetter gets 1 point = ["q1:1"] + /// Both examples combined = ["p1:5","q1:1"] + /// + [DataMember] + public IEnumerable BonusPoints { get; set; } + /// + /// Id of the connected schedule when sessions are autofilled from schedule + /// Not required when selecting sessions individually + /// + [DataMember(IsRequired = false)] + public long? ConnectedScheduleId { get; set; } + /// + /// Use teams information available from uploaded result set + /// + [DataMember] + public bool UseResultSetTeam { get; set; } + /// + /// Update teams information on recalculation - this will overwrite the previous team in a scored row when a recalculation is triggered + /// If you do not want the team to change after the result has been uploaded first (e.g.: team change during the runnin season) set to false + /// + [DataMember] + public bool UpdateTeamOnRecalculation { get; set; } + /// + /// Options to use for sorting the result rows before issuing race and bonus points (should be enum actually) + /// + [DataMember] + public string PointsSortOptions { get; set; } + /// + /// Options to use for sorting the result after points are calculated for the final order + /// + [DataMember] + public string FinalSortOptions { get; set; } + /// + /// Show this result on the result page + /// If false the results calculated from this scoring wont be + /// + [DataMember] + public bool ShowResults { get; set; } + /// + /// Long text description + /// + [DataMember] + public string Description { get; set; } + + /// + /// Type of session that this scoring can be applied to + /// + [DataMember] +#if NETCOREAPP + [EnumDataType(typeof(SessionType))] + [JsonConverter(typeof(JsonStringEnumConverter))] +#endif + public SessionType ScoringSessionType { get; set; } + /// + /// Defines how the sessions for this scoring are selected + /// + [DataMember] +#if NETCOREAPP + [EnumDataType(typeof(ScoringSessionSelectionType))] + [JsonConverter(typeof(JsonStringEnumConverter))] +#endif + public ScoringSessionSelectionType SessionSelectType { get; set; } + /// + /// List of weights for each accumulated scoring separated by ',' - only for accumlated scorings + /// + [DataMember] + public string ScoringWeightValues { get; set; } + /// + /// Select the column for identifying rows that belong together + /// + [DataMember] +#if NETCOREAPP + [EnumDataType(typeof(AccumulateByOption))] + [JsonConverter(typeof(JsonStringEnumConverter))] +#endif + public AccumulateByOption AccumulateBy { get; set; } + /// + /// Select the method to accumulate scorings + /// + [DataMember] +#if NETCOREAPP + [EnumDataType(typeof(AccumulateResultsOption))] + [JsonConverter(typeof(JsonStringEnumConverter))] +#endif + public AccumulateResultsOption AccumulateResultsOption { get; set; } + /// + /// Number of average races when using + /// + [DataMember] + public int AverageRaceNr { get; set; } + } +} diff --git a/iRLeagueApiCore.Common/Models/Scorings/PutScoringModel.cs b/iRLeagueApiCore.Common/Models/Scorings/PutScoringModel.cs new file mode 100644 index 0000000..13bb219 --- /dev/null +++ b/iRLeagueApiCore.Common/Models/Scorings/PutScoringModel.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace iRLeagueApiCore.Common.Models +{ + /// + /// Schema for updating an existing scoring + /// + public class PutScoringModel : PostScoringModel + { + } +} diff --git a/iRLeagueApiCore.Common/Models/Scorings/ScoringModel.cs b/iRLeagueApiCore.Common/Models/Scorings/ScoringModel.cs new file mode 100644 index 0000000..9c52d71 --- /dev/null +++ b/iRLeagueApiCore.Common/Models/Scorings/ScoringModel.cs @@ -0,0 +1,68 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; +using System.Threading.Tasks; + +namespace iRLeagueApiCore.Common.Models +{ + /// + /// Schema for fetching an existing scoring + /// + public class ScoringModel : PutScoringModel, IVersionModel + { + /// + /// Id of the scoring + /// + [DataMember] + public long Id { get; set; } + /// + /// Id of the league the scoring belongs to + /// + [DataMember] + public long LeagueId { get; set; } + /// + /// Id of the season the scoring belongs to + /// + [DataMember] + public long SeasonId { get; set; } + /// + /// Ids of session connected to the scoring + /// + [DataMember] + public IEnumerable SessionIds { get; set; } + #region version + /// + /// Date of creation + /// + [DataMember] + public DateTime? CreatedOn { get; set; } + /// + /// Date of last modification + /// + [DataMember] + public DateTime? LastModifiedOn { get; set; } + /// + /// User id that created the entry + /// + [DataMember] + public string CreatedByUserId { get; set; } + /// + /// User id that last modified the entry + /// + [DataMember] + public string LastModifiedByUserId { get; set; } + /// + /// User name that created the entry + /// + [DataMember] + public string CreatedByUserName { get; set; } + /// + /// User name that last modified the entry + /// + [DataMember] + public string LastModifiedByUserName { get; set; } + #endregion + } +} diff --git a/iRLeagueApiCore.Common/Models/Seasons/PostSeasonModel.cs b/iRLeagueApiCore.Common/Models/Seasons/PostSeasonModel.cs new file mode 100644 index 0000000..810bfed --- /dev/null +++ b/iRLeagueApiCore.Common/Models/Seasons/PostSeasonModel.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; +using System.Threading.Tasks; + +namespace iRLeagueApiCore.Common.Models +{ + [DataContract] + public class PostSeasonModel : PutSeasonModel + { + } +} diff --git a/iRLeagueApiCore.Common/Models/Seasons/PutSeasonModel.cs b/iRLeagueApiCore.Common/Models/Seasons/PutSeasonModel.cs new file mode 100644 index 0000000..93f0402 --- /dev/null +++ b/iRLeagueApiCore.Common/Models/Seasons/PutSeasonModel.cs @@ -0,0 +1,17 @@ +using System.Runtime.Serialization; + +namespace iRLeagueApiCore.Common.Models +{ + [DataContract] + public class PutSeasonModel + { + [DataMember] + public string SeasonName { get; set; } + [DataMember] + public long? MainScoringId { get; set; } + [DataMember] + public bool HideComments { get; set; } + [DataMember] + public bool Finished { get; set; } + } +} diff --git a/iRLeagueApiCore.Common/Models/Seasons/SeasonModel.cs b/iRLeagueApiCore.Common/Models/Seasons/SeasonModel.cs new file mode 100644 index 0000000..86a6c9d --- /dev/null +++ b/iRLeagueApiCore.Common/Models/Seasons/SeasonModel.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using System.Runtime.Serialization; + +namespace iRLeagueApiCore.Common.Models +{ + [DataContract] + public class SeasonModel : PutSeasonModel, IVersionModel + { + [DataMember] + public long SeasonId { get; set; } + [DataMember] + public long LeagueId { get; set; } + [DataMember] + public DateTime? SeasonStart { get; set; } + [DataMember] + public DateTime? SeasonEnd { get; set; } + [DataMember] + public IEnumerable ScheduleIds { get; set; } + + #region version + /// + /// Date of creation + /// + [DataMember] + public DateTime? CreatedOn { get; set; } + /// + /// Date of last modification + /// + [DataMember] + public DateTime? LastModifiedOn { get; set; } + /// + /// User id that created the entry + /// + [DataMember] + public string CreatedByUserId { get; set; } + /// + /// User id that last modified the entry + /// + [DataMember] + public string LastModifiedByUserId { get; set; } + /// + /// User name that created the entry + /// + [DataMember] + public string CreatedByUserName { get; set; } + /// + /// User name that last modified the entry + /// + [DataMember] + public string LastModifiedByUserName { get; set; } + #endregion + } +} diff --git a/iRLeagueApiCore.Common/Models/Sessions/PostSessionModel.cs b/iRLeagueApiCore.Common/Models/Sessions/PostSessionModel.cs new file mode 100644 index 0000000..4d646ee --- /dev/null +++ b/iRLeagueApiCore.Common/Models/Sessions/PostSessionModel.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace iRLeagueApiCore.Common.Models +{ + public class PostSessionModel : PutSessionModel + { + } +} diff --git a/iRLeagueApiCore.Common/Models/Sessions/PutSessionModel.cs b/iRLeagueApiCore.Common/Models/Sessions/PutSessionModel.cs new file mode 100644 index 0000000..b291327 --- /dev/null +++ b/iRLeagueApiCore.Common/Models/Sessions/PutSessionModel.cs @@ -0,0 +1,50 @@ +using System; +using System.Runtime.Serialization; +using iRLeagueApiCore.Common.Enums; +using System.Collections.Generic; +#if NETCOREAPP +using System.ComponentModel.DataAnnotations; +using System.Text.Json.Serialization; +#endif + +namespace iRLeagueApiCore.Common.Models +{ + /// + /// Scheme for creating and updating a session entry + /// + [DataContract] + public class PutSessionModel + { + /// + /// Name of the session + /// + [DataMember] + public string Name { get; set; } + /// + /// Session type specifier - 0 = Undefined, 1 = Practice, 2 = Qualifying, 3 = Race, 4 = HeatEvent, 5 = Heat, 6 = Warmup + /// + [DataMember] +#if NETCOREAPP + [EnumDataType(typeof(SessionType))] + [JsonConverter(typeof(JsonStringEnumConverter))] +#endif + public SessionType SessionType { get; set; } + /// + /// Day and time of session start + /// + [DataMember] + public DateTime? Date { get; set; } + /// + /// Track id of the location + /// + [DataMember] + public long? TrackId { get; set; } + /// + /// Total duration of the session including all Subsessions and events + /// + [DataMember] + public TimeSpan Duration { get; set; } + [DataMember] + public IEnumerable SubSessions { get; set; } + } +} diff --git a/iRLeagueApiCore.Common/Models/Sessions/PutSessionSubSessionModel.cs b/iRLeagueApiCore.Common/Models/Sessions/PutSessionSubSessionModel.cs new file mode 100644 index 0000000..4a07520 --- /dev/null +++ b/iRLeagueApiCore.Common/Models/Sessions/PutSessionSubSessionModel.cs @@ -0,0 +1,61 @@ +using iRLeagueApiCore.Common.Enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; +using System.Threading.Tasks; +#if NETCOREAPP +using System.ComponentModel.DataAnnotations; +using System.Text.Json.Serialization; +#endif + +namespace iRLeagueApiCore.Common.Models +{ + /// + /// Scheme for subsession data when putting to a session entity + /// + [DataContract] + public class PutSessionSubSessionModel + { + /// + /// Identifier + /// + [DataMember] + public long SubSessionId { get; set; } + /// + /// Number that decides order of subsessions + /// + [DataMember] + public int SubSessionNr { get; set; } + /// + /// Optional name + /// + [DataMember] + public string Name { get; set; } + /// + /// Type of the subsession + /// + [DataMember] +#if NETCOREAPP + [EnumDataType(typeof(SimSessionType))] + [JsonConverter(typeof(JsonStringEnumConverter))] +#endif + public SimSessionType SessionType { get; set; } + /// + /// Offset start time from the start of the parent session + /// + [DataMember] + public TimeSpan StartOffset { get; set; } + /// + /// Duration (max.) of this subsession + /// + [DataMember] + public TimeSpan Duration { get; set; } + /// + /// Number of laps (max.) in this subsession + /// + [DataMember] + public int Laps { get; set; } + } +} diff --git a/iRLeagueApiCore.Common/Models/Sessions/SessionModel.cs b/iRLeagueApiCore.Common/Models/Sessions/SessionModel.cs new file mode 100644 index 0000000..6008350 --- /dev/null +++ b/iRLeagueApiCore.Common/Models/Sessions/SessionModel.cs @@ -0,0 +1,77 @@ +using System; +using System.Collections.Generic; +using System.Runtime.Serialization; + +namespace iRLeagueApiCore.Common.Models +{ + /// + /// Scheme for fetching a session entry + /// + [DataContract] + public class SessionModel : PutSessionModel, IVersionModel + { + /// + /// Unique identifier + /// + [DataMember] + public long SessionId { get; set; } + /// + /// Id of the league this session belongs to + /// + [DataMember] + public long LeagueId { get; set; } + /// + /// Id of the schedule this session belongs to + /// + [DataMember] + public long? ScheduleId { get; set; } + /// + /// If session is subsession provide the id of the parent session here. If not leave at default (null) + /// + [DataMember(IsRequired = false)] + public long? ParentSessionId { get; set; } + /// + /// Flag shows if result is available + /// + [DataMember] + public bool HasResult { get; set; } + /// + /// List of subsessions + /// + [DataMember] + public new IEnumerable SubSessions { get; set; } + + #region version + /// + /// Date of creation + /// + [DataMember] + public DateTime? CreatedOn { get; set; } + /// + /// Date of last modification + /// + [DataMember] + public DateTime? LastModifiedOn { get; set; } + /// + /// User id that created the entry + /// + [DataMember] + public string CreatedByUserId { get; set; } + /// + /// User id that last modified the entry + /// + [DataMember] + public string LastModifiedByUserId { get; set; } + /// + /// User name that created the entry + /// + [DataMember] + public string CreatedByUserName { get; set; } + /// + /// User name that last modified the entry + /// + [DataMember] + public string LastModifiedByUserName { get; set; } + #endregion + } +} diff --git a/iRLeagueApiCore.Common/Models/Sessions/SubSessionModel.cs b/iRLeagueApiCore.Common/Models/Sessions/SubSessionModel.cs new file mode 100644 index 0000000..0762adc --- /dev/null +++ b/iRLeagueApiCore.Common/Models/Sessions/SubSessionModel.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; +using System.Threading.Tasks; + +namespace iRLeagueApiCore.Common.Models +{ + /// + /// Scheme for fetching a subsession entry + /// + [DataContract] + public class SubSessionModel : PutSessionSubSessionModel + { + } +} diff --git a/iRLeagueApiCore.Common/Models/SimSessionDetails.cs b/iRLeagueApiCore.Common/Models/SimSessionDetails.cs new file mode 100644 index 0000000..8e33715 --- /dev/null +++ b/iRLeagueApiCore.Common/Models/SimSessionDetails.cs @@ -0,0 +1,253 @@ +using System; +using System.Runtime.Serialization; + +namespace iRLeagueApiCore.Common.Models +{ + /// + /// Extended session information about the iracing subsession + /// + [DataContract] + public class SimSessionDetails + { + /// + /// Id of the iracing subsession + /// + [DataMember] + public long IRSubsessionId { get; set; } + /// + /// Id of the iracing season + /// + [DataMember] + public long IRSeasonId { get; set; } + /// + /// Name of the iracing season + /// + [DataMember] + public string IRSeasonName { get; set; } + /// + /// Year of the iracing season + /// + [DataMember] + public int IRSeasonYear { get; set; } + /// + /// Quarter of the iracing season + /// + [DataMember] + public int IRSeasonQuarter { get; set; } + /// + /// Race week in the iracing season + /// + [DataMember] + public int IRRaceWeek { get; set; } + /// + /// Id of the iracing session + /// + [DataMember] + public long IRSessionId { get; set; } + /// + /// License category of the iracing session + /// + [DataMember] + public int LicenseCategory { get; set; } + /// + /// Name of the iracing session + /// + [DataMember] + public string SessionName { get; set; } + /// + /// Start time of the iracing session (timezone??) + /// + [DataMember] + public DateTime? StartTime { get; set; } + /// + /// End time of the iracing session (timezone??) + /// + [DataMember] + public DateTime? EndTime { get; set; } + /// + /// Corners per lap on the selected track configuration + /// + [DataMember] + public int CornersPerLap { get; set; } + /// + /// Distance per lap on the selected track configuration + /// + [DataMember] + public double KmDistPerLap { get; set; } + /// + /// Maximum number of weeks in the iracing session + /// + [DataMember] + public int MaxWeeks { get; set; } + /// + /// SOF of the field in this event + /// + [DataMember] + public int EventStrengthOfField { get; set; } + /// + /// Average number of laps in this event + /// + [DataMember] + public long EventAverageLap { get; set; } + /// + /// Number of laps completed in this event + /// + [DataMember] + public int EventLapsComplete { get; set; } + /// + /// Number of cautions in this event + /// + [DataMember] + public int NumCautions { get; set; } + /// + /// Number of laps under caution in this event + /// + [DataMember] + public int NumCautionLaps { get; set; } + /// + /// Number of lead changes in this event + /// + [DataMember] + public int NumLeadChanges { get; set; } + /// + /// Time of day setting in the iracing session + /// + [DataMember] + public int TimeOfDay { get; set; } + /// + /// Damage model setting in the iracing session + /// + [DataMember] + public int DamageModel { get; set; } + /// + /// Track id of the selected track configuration + /// + [DataMember] + public int IRTrackId { get; set; } + /// + /// Name of the selected track (without config) + /// + [DataMember] + public string TrackName { get; set; } + /// + /// Name of the selected track configuration + /// + [DataMember] + public string ConfigName { get; set; } + /// + /// Category id of the selected track configuration + /// + [DataMember] + public int TrackCategoryId { get; set; } + /// + /// Category name of the selected track configuration + /// + [DataMember] + public string Category { get; set; } + /// + /// Weather type in the iracing session + /// + [DataMember] + public int WeatherType { get; set; } + /// + /// Selected temp unit + /// + [DataMember] + public int TempUnits { get; set; } + /// + /// Environment temperate in the iracing session + /// + [DataMember] + public int TempValue { get; set; } + /// + /// Relative humidity in the iracing session + /// + [DataMember] + public int RelHumidity { get; set; } + /// + /// Fog level in the iracing session + /// + [DataMember] + public int Fog { get; set; } + /// + /// Wind direction in the iracing session + /// + [DataMember] + public int WindDir { get; set; } + /// + /// Selected wind units + /// + [DataMember] + public int WindUnits { get; set; } + /// + /// Skies setting in the iracing session + /// + [DataMember] + public int Skies { get; set; } + /// + /// ??? + /// + [DataMember] + public int WeatherVarInitial { get; set; } + /// + /// ??? + /// + [DataMember] + public int WeatherVarOngoing { get; set; } + /// + /// Start time of the simulation in UTC + /// + [DataMember] + public DateTime? SimStartUtcTime { get; set; } + /// + /// UTC offset to local time + /// + [DataMember] + public long SimStartUtcOffset { get; set; } + /// + /// Leave marbles between session transition setting + /// + [DataMember] + public bool LeaveMarbles { get; set; } + /// + /// Setting for rubber in practice session + /// + [DataMember] + public int PracticeRubber { get; set; } + /// + /// Setting for rubber in qualy session + /// + [DataMember] + public int QualifyRubber { get; set; } + /// + /// Setting for rubber in warmub session + /// + [DataMember] + public int WarmupRubber { get; set; } + /// + /// Setting for rubber in race session + /// + [DataMember] + public int RaceRubber { get; set; } + /// + /// Compound setting in practice session + /// + [DataMember] + public int PracticeGripCompound { get; set; } + /// + /// Compound setting in qualy session + /// + [DataMember] + public int QualifyGripCompund { get; set; } + /// + /// Compound setting in warmup session + /// + [DataMember] + public int WarmupGripCompound { get; set; } + /// + /// Compound setting in race session + /// + [DataMember] + public int RaceGripCompound { get; set; } + } +} \ No newline at end of file diff --git a/iRLeagueApiCore.Common/Models/UserRoleModel.cs b/iRLeagueApiCore.Common/Models/UserRoleModel.cs new file mode 100644 index 0000000..da41d2f --- /dev/null +++ b/iRLeagueApiCore.Common/Models/UserRoleModel.cs @@ -0,0 +1,17 @@ +namespace iRLeagueApiCore.Common.Models +{ + /// + /// Schema to use for permission control over a single role for a user + /// + public class UserRoleModel + { + /// + /// Name of the user to change permission + /// + public string UserName { get; set; } + /// + /// Name of the role to give/revoke + /// + public string RoleName { get; set; } + } +} diff --git a/iRLeagueApiCore.Common/Responses/BadRequestResponse.cs b/iRLeagueApiCore.Common/Responses/BadRequestResponse.cs new file mode 100644 index 0000000..e906b83 --- /dev/null +++ b/iRLeagueApiCore.Common/Responses/BadRequestResponse.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace iRLeagueApiCore.Common.Responses +{ + public struct BadRequestResponse + { + public string Status { get; set; } + public IEnumerable Errors { get; set; } + } +} diff --git a/iRLeagueApiCore.Common/Responses/ValidationError.cs b/iRLeagueApiCore.Common/Responses/ValidationError.cs new file mode 100644 index 0000000..72fafba --- /dev/null +++ b/iRLeagueApiCore.Common/Responses/ValidationError.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace iRLeagueApiCore.Common.Responses +{ + public struct ValidationError + { + public string Property { get; set; } + public string Error { get; set; } + public object Value { get; set; } + } +} diff --git a/iRLeagueApiCore.Common/iRLeagueApiCore.Common.csproj b/iRLeagueApiCore.Common/iRLeagueApiCore.Common.csproj new file mode 100644 index 0000000..5000613 --- /dev/null +++ b/iRLeagueApiCore.Common/iRLeagueApiCore.Common.csproj @@ -0,0 +1,29 @@ + + + + + + true + + + + 1701;1702;1591 + + + + 1701;1702;1591 + + + + Library + net5.0;netstandard2.0 + iRLeagueApiCore.Communication + 0.2.0 + Simon Schulze + Simon Schulze + This package contains shared objects for all members of the iRLeagueDatabase-iRLeagueApi stack + https://github.com/SSchulze1989/iRLeagueApiCore + true + + +