17 Commits

Author SHA1 Message Date
e10663c8c0 Update Readme
All checks were successful
Build App / Build (push) Successful in 1m31s
2025-03-08 01:17:53 +01:00
cd03b39c20 Fix Discord Intents
All checks were successful
Build App / Build (push) Successful in 2m14s
2025-03-07 15:14:38 +01:00
9d8a7b3100 Fix DiscordBot
All checks were successful
Build App / Build (push) Successful in 1m41s
2025-03-07 14:55:00 +01:00
e99479d8fb Fix Tags
All checks were successful
Build App / Build (push) Successful in 2m2s
2025-03-07 13:15:11 +01:00
a9150ff58c URL Api Smash + Slug in HTML
All checks were successful
Build App / Build (push) Successful in 1m36s
2025-03-07 10:56:24 +01:00
fba822a0af Build
All checks were successful
Build App / Build (push) Successful in 1m40s
2025-02-09 22:39:17 +01:00
73407e5867 Dot net 8
Some checks failed
Build App / Build (push) Failing after 43s
2025-02-09 22:30:00 +01:00
91664406c4 Test Update Avalonia
All checks were successful
Build App / Build (push) Successful in 1m42s
2025-01-28 22:22:03 +01:00
bc95ef157d Wait 2025-01-28 22:01:30 +01:00
454c12a5a9 Modification get smash
All checks were successful
Build App / Build (push) Successful in 1m53s
2024-03-22 23:58:43 +01:00
88fb4935b5 Config for the desktop app
All checks were successful
Build App / Build (push) Successful in 1m28s
2024-03-16 14:14:17 +01:00
ede8ff088c Postgres Dump
Remove old Db dump
2024-03-16 14:14:13 +01:00
f466bb9174 Fix Warnings
Test Rlz
2024-03-16 14:14:08 +01:00
b7f65a5a98 Windows and linux artifacts 2024-03-16 14:14:08 +01:00
212527bfc9 Gitea Action now build windows and linux image for the client 2024-03-16 14:14:08 +01:00
4d1df14fe5 Avalonia Start 2024-03-16 14:14:08 +01:00
99257c3422 Fix Restsharp / Move to Postgresql 2024-03-16 14:14:02 +01:00
73 changed files with 2769 additions and 4705 deletions

View File

@@ -0,0 +1,69 @@
name: Build App
run-name: ${{ gitea.actor }} is building
on: [push]
jobs:
Build:
runs-on: ubuntu-latest-real
steps:
- name: Update
run: |
sudo apt-get update -y -qq
sudo apt-get install zip
sudo sh -c "echo '192.168.1.253 descartes.local' >> /etc/hosts"
sudo sh -c "echo '192.168.1.253 build.ladose.net' >> /etc/hosts"
- name: GetDNS
run: |
cat /etc/resolv.conf
- name: Setup .NET 6.x
uses: actions/setup-dotnet@v3
with:
# Semantic version range syntax or exact version of a dotnet version
dotnet-version: '8.x'
- run: echo "Build."
- name: Check out repository code
uses: actions/checkout@v3
- name: Restore Deps
run : |
cd LaDOSE.Src/
dotnet restore LaDOSE.linux.sln
- name: Build
run: |
cd LaDOSE.Src/
dotnet build --configuration Release --os linux LaDOSE.DesktopApp.Avalonia
dotnet build --configuration Release --os win LaDOSE.DesktopApp.Avalonia
- name: Zip file
run: |
zip -rj build-winx64.zip ./LaDOSE.Src/LaDOSE.DesktopApp.Avalonia/bin/Release/net8.0/win-x64/
zip -rj build-linux64.zip ./LaDOSE.Src/LaDOSE.DesktopApp.Avalonia/bin/Release/net8.0/linux-x64/
- name: Upload Artifact Windows
uses: actions/upload-artifact@v3
with:
path: build-linux64.zip
name: build-linux64.zip
retention-days: 30
overwrite: true
- name: Upload Artifact Linux
uses: actions/upload-artifact@v3
with:
path: build-winx64.zip
name: build-winx64.zip
retention-days: 30
overwrite: true
- name: Get current date
id: date
run: echo "date=$(echo $(date +'%Y-%m-%d'))" >> $GITHUB_OUTPUT
- name: Release
if: github.ref_name == 'master'
uses: akkuman/gitea-release-action@v1
env:
with:
tag_name: release-${{ steps.date.outputs.date }}
files: |-
build-winx64.zip
build-linux64.zip

View File

@@ -17,8 +17,17 @@ namespace LaDOSE.Api.Controllers
[Produces("application/json")]
public class GameController : GenericControllerDTO<IGameService, Game, GameDTO>
{
public GameController(IMapper mapper,IGameService service) : base(mapper,service)
private IExternalProviderService provider;
public GameController(IMapper mapper,IGameService service, IExternalProviderService service2) : base(mapper,service)
{
provider = service2;
}
[HttpGet("smash/{name}")]
public async Task<List<GameDTO>> GetIdFromSmash(string name)
{
var smashGame = await provider.GetSmashGame(name);
return _mapper.Map<List<GameDTO>>(smashGame);;
}
}
}

View File

@@ -19,7 +19,7 @@ namespace LaDOSE.Api.Controllers
private IMapper _mapper;
// GET
// GETawa
public TournamentController(IMapper mapper, IExternalProviderService service)
{
_mapper = mapper;

View File

@@ -71,7 +71,7 @@ namespace LaDOSE.Api.Controllers
});
}
//[AllowAnonymous]
[AllowAnonymous]
[HttpPost("register")]
public IActionResult Register([FromBody]ApplicationUser userDto)
{

View File

@@ -77,7 +77,7 @@ namespace LaDOSE.Api.Controllers
[HttpGet("UpdateDb")]
public bool UpdateDb()
{
return _service.UpdateBooking();
return false;
}
[HttpGet("CreateChallonge/{gameId:int}/{wpEventId:int}")]

View File

@@ -0,0 +1,20 @@
using System.Text;
using Microsoft.EntityFrameworkCore.Storage;
using Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal;
namespace LaDOSE.Api;
#pragma warning disable EF1001
public class NpgsqlSqlGenerationLowercaseHelper : NpgsqlSqlGenerationHelper
{
static string ToLowerCase(string input) => input.ToLower();
public NpgsqlSqlGenerationLowercaseHelper(RelationalSqlGenerationHelperDependencies dependencies)
: base(dependencies) { }
public override string DelimitIdentifier(string identifier)
=> base.DelimitIdentifier(ToLowerCase(identifier));
public override void DelimitIdentifier(StringBuilder builder, string identifier)
=> base.DelimitIdentifier(builder, ToLowerCase(identifier));
}
#pragma warning restore EF1001

View File

@@ -1,8 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Platforms>AnyCPU;x64</Platforms>
<LangVersion>12</LangVersion>
</PropertyGroup>
<ItemGroup>
@@ -10,13 +11,13 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="AutoMapper" Version="10.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="3.1.8" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.8" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.1.8" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.4" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="6.0.2" />
<PackageReference Include="AutoMapper" Version="13.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.12" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.12" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.1" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="8.0.7" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.11" />
</ItemGroup>
<ItemGroup>

View File

@@ -1,28 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using LaDOSE.Business.Interface;
using LaDOSE.Business.Provider;
using LaDOSE.Business.Service;
using LaDOSE.Entity;
using LaDOSE.Entity.Context;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
//using Microsoft.AspNetCore.HttpsPolicy;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Microsoft.IdentityModel.Tokens;
using Pomelo.EntityFrameworkCore.MySql;
using Pomelo.EntityFrameworkCore.MySql.Infrastructure;
using AutoMapper;
using LaDOSE.Api.Helpers;
using LaDOSE.Business.Helper;
@@ -32,6 +23,8 @@ using LaDOSE.Entity.Challonge;
using LaDOSE.Entity.Wordpress;
using Result = LaDOSE.Entity.Challonge.Result;
using LaDOSE.Entity.BotEvent;
using Microsoft.EntityFrameworkCore.Storage;
using Microsoft.Extensions.Hosting;
namespace LaDOSE.Api
{
@@ -48,11 +41,6 @@ namespace LaDOSE.Api
public void ConfigureServices(IServiceCollection services)
{
//Fix Gentoo Issue.
var MySqlServer = this.Configuration["MySql:Server"];
var MySqlDatabase = this.Configuration["MySql:Database"];
var MySqlUser = this.Configuration["MySql:User"];
var MySqlPassword = this.Configuration["MySql:Password"];
if (Convert.ToBoolean(this.Configuration["FixGentoo"]))
{
try
@@ -82,9 +70,7 @@ namespace LaDOSE.Api
// ));
services.AddDbContextPool<LaDOSEDbContext>(options =>
{
options.UseMySql(
$"Server={MySqlServer};Database={MySqlDatabase};User={MySqlUser};Password={MySqlPassword};",
new MariaDbServerVersion(new Version(10, 1)));
options.UseNpgsql(Configuration.GetConnectionString("DbContext")).ReplaceService<ISqlGenerationHelper,NpgsqlSqlGenerationLowercaseHelper>();
});
var key = Encoding.ASCII.GetBytes(this.Configuration["JWTTokenSecret"]);
@@ -178,7 +164,7 @@ namespace LaDOSE.Api
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
public void Configure(IApplicationBuilder app, IHostEnvironment env, ILoggerFactory loggerFactory)
{
//loggerFactory.AddConsole(Configuration.GetSection("Logging"));
//loggerFactory.AddDebug();

View File

@@ -4,20 +4,24 @@
"Default": "Warning"
}
},
"ConnectionStrings": {
"DbContext":"Host=descartes.local;Username=tom;Password=tom;Database=ladoseapi"
},
"CertificateSettings": {
"fileName": "localhost.pfx",
"password": "YourSecurePassword"
},
"MySql": {
"Server": "host",
"Database": "database",
"User": "User",
"Password": "Password"
"Server": "localhost",
"Database": "ladoseapi",
"User": "dev",
"Password": "dev"
},
"ApiKey": {
"ChallongeApiKey": "Challonge ApiKey"
"ChallongeApiKey": "Challonge ApiKey",
"SmashApiKey": "Smash"
},
"AllowedHosts": "*",
"AllowedHosts": "0.0.0.0",
"Port": 5000,
"JWTTokenSecret": "here goes the custom Secret key for authnetication"
}

View File

@@ -1,7 +1,7 @@
namespace LaDOSE.DTO
{
public class GameDTO
{
{
public int Id { get; set; }
public string Name { get; set; }
public string LongName { get; set; }

View File

@@ -1,8 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Platforms>AnyCPU;x64</Platforms>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
</Project>

View File

@@ -27,6 +27,8 @@ namespace LaDOSE.DTO
public List<GameDTO> Games { get; set; }
public List<ResultDTO> Results { get; set; }
public string Slug { get; set; }
}
public class ResultDTO
{

View File

@@ -0,0 +1,11 @@
<Application xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="LaDOSE.DesktopApp.Avalonia.App"
xmlns:local="using:LaDOSE.DesktopApp.Avalonia"
RequestedThemeVariant="Dark">
<!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. -->
<Application.Styles>
<FluentTheme />
<StyleInclude Source="avares://Avalonia.Controls.DataGrid/Themes/Fluent.xaml"/>
</Application.Styles>
</Application>

View File

@@ -0,0 +1,39 @@
using Avalonia;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Markup.Xaml;
using LaDOSE.DesktopApp.Avalonia.ViewModels;
using LaDOSE.DesktopApp.Avalonia.Views;
using LaDOSE.REST;
using MsBox.Avalonia;
using ReactiveUI;
using Splat;
namespace LaDOSE.DesktopApp.Avalonia;
public partial class App : Application
{
public override void Initialize()
{
AvaloniaXamlLoader.Load(this);
Locator.CurrentMutable.Register(() => new GamesView(), typeof(IViewFor<GamesViewModel>));
Locator.CurrentMutable.Register(() => new InfoView(), typeof(IViewFor<InfoViewModel>));
Locator.CurrentMutable.Register(() => new TournamentResultView(), typeof(IViewFor<TournamentResultViewModel>));
}
public override void OnFrameworkInitializationCompleted()
{
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
{
desktop.MainWindow = new MainWindow
{
DataContext = new MainWindowViewModel(),
};
}
base.OnFrameworkInitializationCompleted();
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 KiB

View File

@@ -0,0 +1,44 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
<ApplicationManifest>app.manifest</ApplicationManifest>
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
<LangVersion>12</LangVersion>
</PropertyGroup>
<ItemGroup>
<Folder Include="Models\"/>
<AvaloniaResource Include="Assets\**"/>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="11.2.3" />
<PackageReference Include="Avalonia.Controls.DataGrid" Version="11.2.3" />
<PackageReference Include="Avalonia.Desktop" Version="11.2.3" />
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.2.3" />
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.2.3" />
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.2.3" />
<PackageReference Include="Avalonia.ReactiveUI" Version="11.2.3" />
<PackageReference Include="MessageBox.Avalonia" Version="3.2.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\LaDOSE.DTO\LaDOSE.DTO.csproj" />
<ProjectReference Include="..\LaDOSE.REST\LaDOSE.REST.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="settings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,67 @@
using Avalonia;
using Avalonia.ReactiveUI;
using System;
using System.ComponentModel;
using System.IO;
using LaDOSE.REST;
using Microsoft.Extensions.Configuration;
using MsBox.Avalonia;
using MsBox.Avalonia.Enums;
using Splat;
// using Xilium.CefGlue;
// using Xilium.CefGlue.Common;
// using Avalonia.Visuals;
namespace LaDOSE.DesktopApp.Avalonia;
sealed class Program
{
// Initialization code. Don't use any Avalonia, third-party APIs or any
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
// yet and stuff might break.
[STAThread]
public static void Main(string[] args)
{
RegisterDependencies(Locator.CurrentMutable, Locator.Current);
var app = BuildAvaloniaApp();
app.StartWithClassicDesktopLifetime(args);
}
private static void RegisterDependencies(IMutableDependencyResolver currentMutable, IReadonlyDependencyResolver current)
{
var builder = new ConfigurationBuilder()
.AddJsonFile("settings.json", optional: true, reloadOnChange: true).Build();
var restUrl = builder["REST:Url"].ToString();
var restUser = builder["REST:User"].ToString();
var restPassword = builder["REST:Password"].ToString();
currentMutable.Register<RestService>(() =>
{
var restService = new RestService(new Uri(restUrl), restUser, restPassword);
try
{
restService.Connect(new Uri(restUrl), restUser, restPassword);
}
catch (Exception e)
{
Console.WriteLine(e);
}
return restService;
});
}
// Avalonia configuration, don't remove; also used by visual designer.
public static AppBuilder BuildAvaloniaApp()
=> AppBuilder
.Configure<App>()
.UsePlatformDetect()
.WithInterFont()
.LogToTrace()
.UseReactiveUI();
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

View File

@@ -0,0 +1,343 @@
body {
color: #efefef;
background-color: #141415;
}
:root {
--breakpoint-xs: 0;
--breakpoint-sm: 576px;
--breakpoint-md: 768px;
--breakpoint-lg: 992px;
--breakpoint-xl: 1200px;
}
.table {
width: 100%;
margin-bottom: 1rem;
background-color: transparent;
}
.table th,
.table td {
padding: 0.75rem;
vertical-align: top;
border-top: 1px solid #dee2e6;
}
.table thead th {
vertical-align: bottom;
border-bottom: 2px solid #dee2e6;
}
.table tbody + tbody {
border-top: 2px solid #dee2e6;
}
.table .table {
background-color: #fff;
}
.table-sm th,
.table-sm td {
padding: 0.3rem;
}
.table-bordered {
border: 1px solid #dee2e6;
}
.table-bordered th,
.table-bordered td {
border: 1px solid #dee2e6;
}
.table-bordered thead th,
.table-bordered thead td {
border-bottom-width: 2px;
}
.table-borderless th,
.table-borderless td,
.table-borderless thead th,
.table-borderless tbody + tbody {
border: 0;
}
.table-striped tbody tr:nth-of-type(odd) {
background-color: rgba(0, 0, 0, 0.05);
}
.table-hover tbody tr:hover {
background-color: rgba(0, 0, 0, 0.075);
}
.table-primary,
.table-primary > th,
.table-primary > td {
background-color: #b8daff;
}
.table-hover .table-primary:hover {
background-color: #9fcdff;
}
.table-hover .table-primary:hover > td,
.table-hover .table-primary:hover > th {
background-color: #9fcdff;
}
.table-secondary,
.table-secondary > th,
.table-secondary > td {
background-color: #d6d8db;
}
.table-hover .table-secondary:hover {
background-color: #c8cbcf;
}
.table-hover .table-secondary:hover > td,
.table-hover .table-secondary:hover > th {
background-color: #c8cbcf;
}
.table-success,
.table-success > th,
.table-success > td {
background-color: #c3e6cb;
}
.table-hover .table-success:hover {
background-color: #b1dfbb;
}
.table-hover .table-success:hover > td,
.table-hover .table-success:hover > th {
background-color: #b1dfbb;
}
.table-info,
.table-info > th,
.table-info > td {
background-color: #bee5eb;
}
.table-hover .table-info:hover {
background-color: #abdde5;
}
.table-hover .table-info:hover > td,
.table-hover .table-info:hover > th {
background-color: #abdde5;
}
.table-warning,
.table-warning > th,
.table-warning > td {
background-color: #ffeeba;
}
.table-hover .table-warning:hover {
background-color: #ffe8a1;
}
.table-hover .table-warning:hover > td,
.table-hover .table-warning:hover > th {
background-color: #ffe8a1;
}
.table-danger,
.table-danger > th,
.table-danger > td {
background-color: #f5c6cb;
}
.table-hover .table-danger:hover {
background-color: #f1b0b7;
}
.table-hover .table-danger:hover > td,
.table-hover .table-danger:hover > th {
background-color: #f1b0b7;
}
.table-light,
.table-light > th,
.table-light > td {
background-color: #fdfdfe;
}
.table-hover .table-light:hover {
background-color: #ececf6;
}
.table-hover .table-light:hover > td,
.table-hover .table-light:hover > th {
background-color: #ececf6;
}
.table-dark,
.table-dark > th,
.table-dark > td {
background-color: #c6c8ca;
}
.table-hover .table-dark:hover {
background-color: #b9bbbe;
}
.table-hover .table-dark:hover > td,
.table-hover .table-dark:hover > th {
background-color: #b9bbbe;
}
.table-active,
.table-active > th,
.table-active > td {
background-color: rgba(0, 0, 0, 0.075);
}
.table-hover .table-active:hover {
background-color: rgba(0, 0, 0, 0.075);
}
.table-hover .table-active:hover > td,
.table-hover .table-active:hover > th {
background-color: rgba(0, 0, 0, 0.075);
}
.table .thead-dark th {
color: #fff;
background-color: #212529;
border-color: #32383e;
}
.table .thead-light th {
color: #495057;
background-color: #e9ecef;
border-color: #dee2e6;
}
.table-dark {
color: #fff;
background-color: #212529;
}
.table-dark th,
.table-dark td,
.table-dark thead th {
border-color: #32383e;
}
.table-dark.table-bordered {
border: 0;
}
.table-dark.table-striped tbody tr:nth-of-type(odd) {
background-color: rgba(255, 255, 255, 0.05);
}
.table-dark.table-hover tbody tr:hover {
background-color: rgba(255, 255, 255, 0.075);
}
@media (max-width: 575.98px) {
.table-responsive-sm {
display: block;
width: 100%;
overflow-x: auto;
-webkit-overflow-scrolling: touch;
-ms-overflow-style: -ms-autohiding-scrollbar;
}
.table-responsive-sm > .table-bordered {
border: 0;
}
}
@media (max-width: 767.98px) {
.table-responsive-md {
display: block;
width: 100%;
overflow-x: auto;
-webkit-overflow-scrolling: touch;
-ms-overflow-style: -ms-autohiding-scrollbar;
}
.table-responsive-md > .table-bordered {
border: 0;
}
}
@media (max-width: 991.98px) {
.table-responsive-lg {
display: block;
width: 100%;
overflow-x: auto;
-webkit-overflow-scrolling: touch;
-ms-overflow-style: -ms-autohiding-scrollbar;
}
.table-responsive-lg > .table-bordered {
border: 0;
}
}
@media (max-width: 1199.98px) {
.table-responsive-xl {
display: block;
width: 100%;
overflow-x: auto;
-webkit-overflow-scrolling: touch;
-ms-overflow-style: -ms-autohiding-scrollbar;
}
.table-responsive-xl > .table-bordered {
border: 0;
}
}
.table-responsive {
display: block;
width: 100%;
overflow-x: auto;
-webkit-overflow-scrolling: touch;
-ms-overflow-style: -ms-autohiding-scrollbar;
}
.table-responsive > .table-bordered {
border: 0;
}
.table {
border-collapse: collapse !important;
}
.table td,
.table th {
/*background-color: #fff !important;*/
}
.table-bordered th,
.table-bordered td {
border: 1px solid #dee2e6 !important;
}
.table-dark {
color: #fff;
background-color: #212529
}
.table-dark th,
.table-dark td,
.table-dark thead th,
.table-dark tbody + tbody {
border-color: #dee2e6;
}
.table .thead-dark th {
color: inherit;
border-color: #dee2e6;
}

View File

@@ -0,0 +1,24 @@
using System.ComponentModel;
using System.Runtime.CompilerServices;
using ReactiveUI;
namespace LaDOSE.DesktopApp.Avalonia.Utils;
public abstract class BaseViewModel : ReactiveObject, IRoutableViewModel,INotifyPropertyChanged
{
public event PropertyChangedEventHandler? PropertyChanged;
protected void RaisePropertyChanged([CallerMemberName] string? propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
protected BaseViewModel(IScreen hostScreen, string? urlPathSegment)
{
UrlPathSegment = urlPathSegment;
HostScreen = hostScreen;
}
public string? UrlPathSegment { get; }
public IScreen HostScreen { get; }
}

View File

@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
namespace LaDOSE.DesktopApp.Utils
namespace LaDOSE.DesktopApp.Avalonia.Utils
{
public static class CustomListExtension
{
@@ -14,14 +14,14 @@ namespace LaDOSE.DesktopApp.Utils
_compare = c;
}
public bool Equals(T x, T y)
public bool Equals(T? x, T? y)
{
return _compare(x, y);
}
public int GetHashCode(T obj)
{
return 0;
return obj.GetHashCode();
}
}
}

View File

@@ -0,0 +1,101 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using LaDOSE.DesktopApp.Avalonia.Utils;
using LaDOSE.DesktopApp.Avalonia.ViewModels;
using LaDOSE.DTO;
using LaDOSE.REST;
using ReactiveUI;
using Splat;
namespace LaDOSE.DesktopApp.Avalonia.ViewModels
{
public class GamesViewModel : BaseViewModel
{
public string DisplayName => "Games";
private GameDTO _currentGame;
private List<GameDTO> _games;
private List<GameDTO> _Searchgames;
private RestService RestService { get; set; }
public GamesViewModel(IScreen screen): base(screen,"Games")
{
this.RestService = Locator.Current.GetService<RestService>();
this.Games=new List<GameDTO>();
OnInitialize();
}
void OnInitialize()
{
LoadGames();
this.CurrentGame = Games.First();
}
public void LoadGames()
{
var gameDtos = this.RestService.GetGames().OrderBy(e=>e.Order).ToList();
this.Games = gameDtos;
RaisePropertyChanged(nameof(this.Games));
}
public List<GameDTO> Games
{
get => _games;
set
{
_games = value;
RaisePropertyChanged(nameof(this.Games));
}
}
public List<GameDTO> SearchGame
{
get => _Searchgames;
set
{
_Searchgames = value;
RaisePropertyChanged(nameof(this.SearchGame));
}
}
public GameDTO CurrentGame
{
get => _currentGame;
set
{
_currentGame = value;
RaisePropertyChanged(nameof(this.CurrentGame));
}
}
public void Update()
{
this.RestService.UpdateGame(this.CurrentGame);
LoadGames();
}
public void AddGame()
{
var item = new GameDTO();
this.RestService.UpdateGame(item);
LoadGames();
}
public void DeleteGame()
{
this.RestService.DeleteGame(this.CurrentGame.Id);
LoadGames();
}
public void GetGame()
{
SearchGame = this.RestService.GetSmashGames(this.CurrentGame.LongName);
}
public bool CanDeleteGame => CurrentGame != null;
}
}

View File

@@ -0,0 +1,16 @@
using System.ComponentModel;
using ReactiveUI;
namespace LaDOSE.DesktopApp.Avalonia.ViewModels;
public class InfoViewModel: ReactiveObject, IRoutableViewModel,INotifyPropertyChanged
{
public InfoViewModel(IScreen screen)
{
HostScreen = screen;
}
public string? UrlPathSegment => "Info";
public IScreen HostScreen { get; }
}

View File

@@ -0,0 +1,16 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.ApplicationLifetimes;
namespace LaDOSE.DesktopApp.Avalonia.ViewModels;
public class MainWindowViewModel : Window
{
public RoutedViewHostViewModel RoutedViewViewHost { get; } = new();
public void CloseApp()
{
if (Application.Current != null && Application.Current.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime)
((Application.Current.ApplicationLifetime as IClassicDesktopStyleApplicationLifetime)!).Shutdown();
}
}

View File

@@ -0,0 +1,61 @@
using System.ComponentModel;
using System.Runtime.CompilerServices;
using LaDOSE.DesktopApp.Avalonia.Utils;
using ReactiveUI;
namespace LaDOSE.DesktopApp.Avalonia.ViewModels;
public class RoutedViewHostViewModel : ReactiveObject, IScreen, INotifyPropertyChanged
{
public event PropertyChangedEventHandler? PropertyChanged;
protected void RaisePropertyChanged([CallerMemberName] string? propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
private string _current;
public RoutedViewHostViewModel()
{
Games = new GamesViewModel(this);
Info = new InfoViewModel(this);
Tournament = new TournamentResultViewModel(this);
Router.Navigate.Execute(Tournament);
Current = "Tournament";
}
public string Current
{
get => _current;
set
{
_current = value;
RaisePropertyChanged(nameof(Current));
}
}
public RoutingState Router { get; } = new();
public GamesViewModel Games { get; }
public InfoViewModel Info { get; }
public TournamentResultViewModel Tournament { get; }
public void ShowGames()
{
Router.Navigate.Execute(Games);
Current = "Games";
}
public void ShowInfo()
{
Router.Navigate.Execute(Info);
Current = "Info";
}
public void ShowTournament()
{
Router.Navigate.Execute(Tournament);
Current = "Tournament";
}
}

View File

@@ -1,5 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Data;
@@ -8,70 +7,64 @@ using System.Linq;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
using System.Windows.Controls;
using System.Windows.Forms;
using LaDOSE.DesktopApp.Utils;
using Avalonia.Collections;
using Avalonia.Controls;
using LaDOSE.DesktopApp.Avalonia.Utils;
using LaDOSE.DTO;
using LaDOSE.REST;
using SaveFileDialog = Microsoft.Win32.SaveFileDialog;
using Screen = Caliburn.Micro.Screen;
using ReactiveUI;
using Splat;
namespace LaDOSE.DesktopApp.ViewModels
namespace LaDOSE.DesktopApp.Avalonia.ViewModels
{
public class TournamentResultViewModel : Screen
public class TournamentResultViewModel : BaseViewModel
{
public override string DisplayName => "Tournament Result";
public string DisplayName => "Tournament Result";
private RestService RestService { get; set; }
private RestService? RestService { get; set; }
//Dictionary<string, Dictionary<int, int>> _computedResult;
#region Properties
private string css = string.Empty;
//"strong { font-weight: 700;} ". +
// "a { color: #ff9024;}"+
// "body { color: #efefef;background-color: #141415; }" +
// ""+
// "a:hover, .entry-meta span a:hover, .comments-link a:hover, body.coldisplay2 #front-columns a:active {color: #cb5920;}"+
// "tr td { border: 1px dashed #3D3D3D;} ";
private String _selectRegex;
private string? _selectRegex;
public String SelectRegex
public string? SelectRegex
{
get { return _selectRegex; }
set
{
_selectRegex = value;
NotifyOfPropertyChange(() => SelectRegex);
RaisePropertyChanged(nameof(SelectRegex));
}
}
private String _selectEventRegex;
private string? _selectEventRegex;
public String SelectEventRegex
public string? SelectEventRegex
{
get { return _selectEventRegex; }
set
{
_selectEventRegex = value;
NotifyOfPropertyChange(() => SelectEventRegex);
RaisePropertyChanged(nameof(SelectEventRegex));
}
}
private string _slug;
public String Slug
private string? _slug;
public string? Slug
{
get { return _slug; }
set
{
_slug = value;
NotifyOfPropertyChange(() => Slug);
RaisePropertyChanged(nameof(Slug));
}
}
private String _html;
private string? _html;
public String Html
public string? Html
{
get { return $"<html><head><style>{this.css}</style></head><body>{HtmlContent}</body></html>"; }
set
@@ -79,58 +72,58 @@ namespace LaDOSE.DesktopApp.ViewModels
_html = value;
}
}
private String _htmlContent;
private string? _htmlContent;
public String HtmlContent
public string? HtmlContent
{
get { return _htmlContent; }
set
{
_htmlContent = value;
NotifyOfPropertyChange(() => HtmlContent);
NotifyOfPropertyChange(() => Html);
RaisePropertyChanged(nameof(HtmlContent));
RaisePropertyChanged(nameof(Html));
}
}
private DateTime _from;
private DateTimeOffset _from;
public DateTime From
public DateTimeOffset From
{
get { return _from; }
set
{
_from = value;
NotifyOfPropertyChange(() => From);
RaisePropertyChanged(nameof(From));
}
}
private DateTime _to;
private DateTimeOffset _to;
public DateTime To
public DateTimeOffset To
{
get { return _to; }
set
{
_to = value;
NotifyOfPropertyChange(() => To);
RaisePropertyChanged(nameof(To));
}
}
private TournamentsResultDTO _results;
private TournamentsResultDTO? _results;
public List<TournamentDTO> Tournaments { get; set; }
public List<EventDTO> Events { get; set; }
public TournamentsResultDTO Results
public TournamentsResultDTO? Results
{
get => _results;
set
{
_results = value;
NotifyOfPropertyChange(() => Results);
RaisePropertyChanged(nameof(Results));
}
}
@@ -142,7 +135,7 @@ namespace LaDOSE.DesktopApp.ViewModels
set
{
_selectedEvents = value;
NotifyOfPropertyChange(() => SelectedEvents);
RaisePropertyChanged(nameof(SelectedEvents));
}
}
@@ -154,14 +147,14 @@ namespace LaDOSE.DesktopApp.ViewModels
set
{
_selectedTournaments = value;
NotifyOfPropertyChange(() => SelectedTournaments);
RaisePropertyChanged(nameof(SelectedTournaments));
}
}
private GameDTO _selectedGame;
private GameDTO? _selectedGame;
public GameDTO SelectedGame
public GameDTO? SelectedGame
{
get { return _selectedGame; }
set
@@ -175,136 +168,151 @@ namespace LaDOSE.DesktopApp.ViewModels
SelectedGameResult = new ObservableCollection<ResultDTO>(resultForGame);
}
NotifyOfPropertyChange(() => SelectedGame);
RaisePropertyChanged(nameof(SelectedGame));
}
}
private ObservableCollection<ResultDTO> _selectedGameResult;
private ObservableCollection<ResultDTO>? _selectedGameResult;
public ObservableCollection<ResultDTO> SelectedGameResult
public ObservableCollection<ResultDTO>? SelectedGameResult
{
get { return _selectedGameResult; }
set
{
_selectedGameResult = value;
NotifyOfPropertyChange(() => SelectedGameResult);
RaisePropertyChanged(nameof(SelectedGameResult));
}
}
private String _first;
private DataTable _gridDataTable;
private string? _first;
private DataTable? _gridDataTable;
private string? _error;
public String First
public string? First
{
get { return _first; }
set
{
_first = value;
NotifyOfPropertyChange(() => First);
RaisePropertyChanged(nameof(First));
}
}
#endregion
public TournamentResultViewModel(RestService restService)
public TournamentResultViewModel(IScreen hostScreen):base(hostScreen,"Tournament")
{
this.RestService = restService;
this.RestService = Locator.Current.GetService<RestService>();;
_selectedTournaments = new ObservableCollection<TournamentDTO>();
_selectedEvents = new ObservableCollection<EventDTO>();
Tournaments = new List<TournamentDTO>();
Events = new List<EventDTO>();
OnInitialize();
}
protected override void OnInitialize()
protected void OnInitialize()
{
var manifestResourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("LaDOSE.DesktopApp.Resources.css.css");
using (var sr = new StreamReader(manifestResourceStream))
{
this.css = sr.ReadToEnd();
}
// var manifestResourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("LaDOSE.DesktopApp.Resources.css.css");
// using (var sr = new StreamReader(manifestResourceStream))
// {
// this.css = sr.ReadToEnd();
// }
this.To = DateTime.Now;
this.From = DateTime.Now.AddMonths(-1);
this.To = new DateTimeOffset(DateTime.Now);
this.From = new DateTimeOffset(DateTime.Now.AddMonths(-1));
this.SelectRegex = "Ranking";
this.SelectEventRegex = @"Ranking #10\d{2}";
this.Slug = "ranking-1001";
this.SelectEventRegex = @"Ranking #13\d{2}";
this.Slug = "ranking-130";
LoadTournaments();
LoadEvents();
base.OnInitialize();
}
public void LoadTournaments()
{
WpfUtil.Await(() =>
{
var tournamentDtos = this.RestService
.GetTournaments(new TimeRangeDTO() {From = this.From, To = this.To}).ToList();
this.Tournaments = tournamentDtos;
// var tournamentDtos = this.RestService
// .GetTournaments(new TimeRangeDTO() {From = this.From, To = this.To}).ToList();
// this.Tournaments = tournamentDtos;
NotifyOfPropertyChange("Tournaments");
});
RaisePropertyChanged(nameof(Tournaments));
}
public void LoadEvents()
{
WpfUtil.Await(() =>
{
var eventsDtos = this.RestService
List<EventDTO> eventsDtos = this.RestService
.GetAllEvents().ToList();
this.Events = eventsDtos;
NotifyOfPropertyChange("Events");
});
RaisePropertyChanged(nameof(Events));
}
public DataTable GridDataTable
public DataTable? GridDataTable
{
get => _gridDataTable;
set
{
_gridDataTable = value;
NotifyOfPropertyChange(() => GridDataTable);
RaisePropertyChanged(nameof(GridDataTable));
RaisePropertyChanged(nameof(GridDataTableView));
}
}
public DataView? GridDataTableView
{
get
{
DataView gridDataTableView = _gridDataTable?.AsDataView();
return gridDataTableView;
}
}
public void Select()
{
WpfUtil.Await(() =>
{
var tournamentsIds = SelectedEvents.Select(e => e.Id).ToList();
var resultsDto = this.RestService.GetResults(tournamentsIds);
List<int> tournamentsIds = SelectedEvents.Select(e => e.Id).ToList();
TournamentsResultDTO? resultsDto = this.RestService.GetResults(tournamentsIds);
this.Results = resultsDto;
ComputeDataGrid();
ComputeHtml();
});
}
public void GetSmash()
{
WpfUtil.Await(() =>
{
var resultsDto = this.RestService.ParseSmash(Slug);
bool resultsDto = this.RestService.ParseSmash(Slug);
if (!resultsDto)
{
MessageBox.Show("Fail");
Error = "Error getting Smash";
}
});
}
public string? Error
{
get => _error;
set
{
if (value == _error) return;
_error = value;
RaisePropertyChanged();
}
}
public void GetChallonge()
{
WpfUtil.Await(() =>
{
var ids = SelectedTournaments.Select(e => e.ChallongeId).ToList();
var resultsDto = this.RestService.ParseChallonge(ids);
List<int> ids = SelectedTournaments.Select(e => e.ChallongeId).ToList();
bool resultsDto = this.RestService.ParseChallonge(ids);
if (!resultsDto)
{
MessageBox.Show("Fail");
Error = "Fail";
}
});
}
public void UpdateEvent()
@@ -326,30 +334,30 @@ namespace LaDOSE.DesktopApp.ViewModels
public void SelectRegexp()
{
var selectedTournaments = this.Tournaments.Where(e => Regex.IsMatch(e.Name, this.SelectRegex)).ToList();
List<TournamentDTO> selectedTournaments = this.Tournaments.Where(e => Regex.IsMatch(e.Name, this.SelectRegex)).ToList();
this.SelectedTournaments.Clear();
if (selectedTournaments.Count > 0)
selectedTournaments.ForEach(e => this.SelectedTournaments.AddUI(e));
selectedTournaments.ForEach(e => this.SelectedTournaments.Add(e));
}
public void SelectEvent()
{
var selectedEvents = this.Events.Where(e => Regex.IsMatch(e.Name, this.SelectEventRegex)).ToList();
List<EventDTO> selectedEvents = this.Events.Where(e => Regex.IsMatch(e.Name, this.SelectEventRegex)).ToList();
this.SelectedEvents.Clear();
if (selectedEvents.Count > 0)
selectedEvents.ForEach(e => this.SelectedEvents.AddUI(e));
selectedEvents.ForEach(e => this.SelectedEvents.Add(e));
}
//This could be simplified the Dictionary was for a previous usage, but i m too lazy to rewrite it.
private void ComputeDataGrid()
{
var resultsParticipents = this.Results.Participents.Select(e=>e.Name).Distinct(new CustomListExtension.EqualityComparer<String>((a, b) => a.ToUpperInvariant()== b.ToUpperInvariant())).OrderBy(e=>e).ToList();
List<string> resultsParticipents = this.Results.Participents.Select(e=>e.Name).Distinct(new CustomListExtension.EqualityComparer<String>((a, b) => a.ToUpperInvariant()== b.ToUpperInvariant())).OrderBy(e=>e).ToList();
//At start the dictionnary was for some fancy dataviz things, but since the point are inside
//i m to lazy to rewrite this functions (this is so ugly...)
//_computedResult = ResultsToDataDictionary(resultsParticipents);
StringBuilder sb = new StringBuilder();
DataTable grid = new DataTable();
var games = Results.Games.Distinct().OrderBy(e => e.Order).ToList();
DataTable? grid = new DataTable();
List<GameDTO> games = Results.Games.Distinct().OrderBy(e => e.Order).ToList();
grid.Columns.Add("Players");
games.ForEach(e => grid.Columns.Add(e.Name.Replace('.', ' '),typeof(Int32)));
grid.Columns.Add("Total").DataType = typeof(Int32);
@@ -357,17 +365,18 @@ namespace LaDOSE.DesktopApp.ViewModels
for (int i = 0; i < resultsParticipents.Count; i++)
{
var dataRow = grid.Rows.Add();
var resultsParticipent = resultsParticipents[i];
DataRow dataRow = grid.Rows.Add();
string resultsParticipent = resultsParticipents[i];
int total = 0;
dataRow["Players"] = resultsParticipent;
for (int j = 0; j < games.Count; j++)
{
var resultsGame = Results.Games[j];
var points = GetPlayerPoint(resultsParticipent, resultsGame.Id);
dataRow[resultsGame.Name.Replace('.', ' ')] = points!=0?(object) points:DBNull.Value;
GameDTO? resultsGame = Results.Games[j];
int points = GetPlayerPoint(resultsParticipent, resultsGame.Id);
var o = dataRow[resultsGame.Name.Replace('.', ' ')];
dataRow[resultsGame.Name.Replace('.', ' ')] = points!=0?points:0;
total += points;
}
dataRow["Total"] = total;
@@ -389,33 +398,33 @@ namespace LaDOSE.DesktopApp.ViewModels
private void ExportToCSV()
{
if (this.GridDataTable != null)
{
var dataTable = this.GridDataTable.DefaultView.ToTable();
SaveFileDialog sfDialog = new SaveFileDialog()
{
Filter = "Csv Files (*.csv)|*.csv|All Files (*.*)|*.*",
AddExtension = true
};
if (sfDialog.ShowDialog() == true)
{
StringBuilder sb = new StringBuilder();
IEnumerable<string> columnNames = dataTable.Columns.Cast<DataColumn>()
.Select(column => column.ColumnName);
sb.AppendLine(string.Join(";", columnNames));
foreach (DataRow row in dataTable.Rows)
{
//EXCEL IS A BITCH
IEnumerable<string> fields = row.ItemArray.Select(field =>
string.Concat("\"", field.ToString().Replace("\"", "\"\""), "\""));
sb.AppendLine(string.Join(";", fields));
}
File.WriteAllText(sfDialog.FileName, sb.ToString());
}
}
// if (this.GridDataTable != null)
// {
// var dataTable = this.GridDataTable.DefaultView.ToTable();
// SaveFileDialog sfDialog = new SaveFileDialog()
// {
// Filter = "Csv Files (*.csv)|*.csv|All Files (*.*)|*.*",
// AddExtension = true
// };
// if (sfDialog.ShowDialog() == true)
// {
// StringBuilder sb = new StringBuilder();
//
// IEnumerable<string> columnNames = dataTable.Columns.Cast<DataColumn>()
// .Select(column => column.ColumnName);
// sb.AppendLine(string.Join(";", columnNames));
//
// foreach (DataRow row in dataTable.Rows)
// {
// //EXCEL IS A BITCH
// IEnumerable<string> fields = row.ItemArray.Select(field =>
// string.Concat("\"", field.ToString().Replace("\"", "\"\""), "\""));
// sb.AppendLine(string.Join(";", fields));
// }
//
// File.WriteAllText(sfDialog.FileName, sb.ToString());
// }
// }
}
private void ComputeHtml()
@@ -426,10 +435,10 @@ namespace LaDOSE.DesktopApp.ViewModels
int columns = 0;
var distinct = Results.Results.Select(e => e.GameId).Distinct();
IEnumerable<int> distinct = Results.Results.Select(e => e.GameId).Distinct();
var gamePlayed = Results.Games.Where(e=> distinct.Contains(e.Id)).OrderBy(e=>e.Order);
foreach (var game in gamePlayed)
IOrderedEnumerable<GameDTO> gamePlayed = Results.Games.Where(e=> distinct.Contains(e.Id)).OrderBy(e=>e.Order);
foreach (GameDTO game in gamePlayed)
{
List<ResultDTO> enumerable = Results.Results.Where(r => r.GameId == game.Id).ToList();
List<string> top3 = enumerable.OrderBy(e => e.Rank).Take(3).Select(e => e.Player).ToList();
@@ -443,7 +452,7 @@ namespace LaDOSE.DesktopApp.ViewModels
sb.Append("<tr>");
}
columns++;
var span = 1;
int span = 1;
if (columns == gamePlayed.Count())
{
if (columns % 2 != 0)
@@ -460,10 +469,10 @@ namespace LaDOSE.DesktopApp.ViewModels
{
sb.AppendLine($"<br> 1/ {top3[0]}<br> 2/ {top3[1]}<br> 3/ {top3[2]} <br>");
//<a href=\"https://challonge.com/fr/{enumerable.First().TournamentUrl}\" target=\"_blank\">https://challonge.com/fr/{enumerable.First().TournamentUrl}</a>
var url = enumerable.FirstOrDefault().TournamentUrl;
string url = enumerable.FirstOrDefault()?.TournamentUrl;
url = url.Replace(" ", "-");
url = url.Replace(".", "-");
sb.AppendLine($"<a href=\"https://smash.gg/tournament/ranking-1002/event/{url}\" target=\"_blank\">Voir le Bracket</p></td>");
sb.AppendLine($"<a href=\"https://start.gg/tournament/{Results.Slug}/event/{url}\" target=\"_blank\">Voir le Bracket</p></td>");
}
@@ -483,7 +492,7 @@ namespace LaDOSE.DesktopApp.ViewModels
}
public void CopyHtml()
{
System.Windows.Clipboard.SetText(this.HtmlContent);
// System.Windows.Clipboard.SetText(this.HtmlContent);
}
private int GetPlayerPoint(string name, int gameid)

View File

@@ -0,0 +1,92 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="650"
x:Class="LaDOSE.DesktopApp.Avalonia.Views.GamesView"
xmlns:vm="using:LaDOSE.DesktopApp.Avalonia.ViewModels"
xmlns:dto="clr-namespace:LaDOSE.DTO;assembly=LaDOSE.DTO"
x:DataType="vm:GamesViewModel"
>
<Grid Row="4" Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
</Grid.RowDefinitions>
<Button Grid.Row="0" x:Name="LoadGames" Command="{Binding LoadGames}" >Load Games</Button>
<ListBox Grid.Row="1" ItemsSource="{Binding Games}" x:Name="GamesListView" SelectedItem="{Binding CurrentGame}">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Label Content="{Binding Order}"></Label>
<Label> - </Label>
<Label Content="{Binding Name}"></Label>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<Grid Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
</Grid.RowDefinitions>
<Button Grid.Row="0" Grid.Column="0" x:Name="AddGame" Command="{Binding AddGame}">Add Game</Button>
<Button Grid.Row="0" Grid.Column="1" x:Name="DeleteGame" Command="{Binding DeleteGame}">Delete Game</Button>
<Label Grid.Row="1" Grid.Column="0">Id</Label>
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding Path=CurrentGame.Id,Mode=TwoWay}" IsReadOnly="True"></TextBox>
<Label Grid.Row="2" Grid.Column="0">Name</Label>
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding Path=CurrentGame.Name,Mode=TwoWay}" ></TextBox>
<Label Grid.Row="3" Grid.Column="0">Order</Label>
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding Path=CurrentGame.Order,Mode=TwoWay}">
<!-- <i:Interaction.Behaviors> -->
<!-- <behaviors:TextBoxInputRegExBehaviour RegularExpression="^\d+$" MaxLength="9" EmptyValue="0"> -->
<!-- -->
<!-- </behaviors:TextBoxInputRegExBehaviour> -->
<!-- </i:Interaction.Behaviors> -->
</TextBox>
<Label Grid.Row="4" Grid.Column="0">LongName</Label>
<TextBox Grid.Row="4" Grid.Column="1" Text="{Binding Path=CurrentGame.LongName,Mode=TwoWay}" ></TextBox>
<Label Grid.Row="5" Grid.Column="0">WpTag</Label>
<TextBox Grid.Row="5" Grid.Column="1" Text="{Binding Path=CurrentGame.WordPressTag,Mode=TwoWay}" ></TextBox>
<Label Grid.Row="6" Grid.Column="0">WpTagOs</Label>
<TextBox Grid.Row="6" Grid.Column="1" Text="{Binding Path=CurrentGame.WordPressTagOs,Mode=TwoWay}" ></TextBox>
<Label Grid.Row="7" Grid.Column="0">SmashId</Label>
<AutoCompleteBox Grid.Row="7" Grid.Column="1" Text="{Binding Path=CurrentGame.SmashId,Mode=TwoWay}" ItemsSource="{Binding Path=SearchGame}">
<AutoCompleteBox.ItemTemplate>
<DataTemplate>
<DockPanel LastChildFill="True" Margin="2" x:DataType="dto:GameDTO">
<TextBox Text="{Binding Id}"></TextBox>
<TextBlock Text="{Binding Name}" DockPanel.Dock="Left"/>
</DockPanel>
</DataTemplate>
</AutoCompleteBox.ItemTemplate>
</AutoCompleteBox>
<Button Grid.Row="9" x:Name="Update" Command="{Binding Update}">Update</Button>
<Button Grid.Row="9" Grid.Column="1" x:Name="SmashGame" Command="{Binding GetGame}">Get Game From Smash</Button>
</Grid>
</Grid>
</UserControl>

View File

@@ -0,0 +1,23 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using LaDOSE.DesktopApp.Avalonia.ViewModels;
using ReactiveUI;
namespace LaDOSE.DesktopApp.Avalonia.Views;
public partial class GamesView : UserControl,IViewFor<GamesViewModel>
{
public GamesView()
{
InitializeComponent();
}
object? IViewFor.ViewModel
{
get => ViewModel;
set => ViewModel = (GamesViewModel?)value;
}
public GamesViewModel? ViewModel { get; set; }
}

View File

@@ -0,0 +1,8 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="LaDOSE.DesktopApp.Avalonia.Views.InfoView">
<Decorator x:Name="browserWrapper"/>
</UserControl>

View File

@@ -0,0 +1,24 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using LaDOSE.DesktopApp.Avalonia.ViewModels;
using ReactiveUI;
namespace LaDOSE.DesktopApp.Avalonia.Views;
public partial class InfoView : UserControl, IViewFor<InfoViewModel>
{
// private AvaloniaCefBrowser browser;
public InfoView()
{
InitializeComponent();
}
object? IViewFor.ViewModel
{
get => ViewModel;
set => ViewModel = (InfoViewModel?)value;
}
public InfoViewModel? ViewModel { get; set; }
}

View File

@@ -0,0 +1,52 @@
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="using:LaDOSE.DesktopApp.Avalonia.ViewModels"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:reactiveUi="http://reactiveui.net"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="LaDOSE.DesktopApp.Avalonia.Views.MainWindow"
x:DataType="vm:MainWindowViewModel"
Icon="/Assets/avalonia-logo.ico"
Title="LaDOSE.DesktopApp.Avalonia">
<Design.DataContext>
<!-- This only sets the DataContext for the previewer in an IDE,
to set the actual DataContext for runtime, set the DataContext property in code (look at App.axaml.cs) -->
<vm:MainWindowViewModel/>
</Design.DataContext>
<Grid Row="4" Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
</Grid.RowDefinitions>
<Menu Grid.Row="0" DockPanel.Dock="Top">
<MenuItem Header="_File">
<MenuItem Header="_Events" Command="{Binding RoutedViewViewHost.ShowTournament}">
</MenuItem>
<MenuItem Header="_Games" Command="{Binding RoutedViewViewHost.ShowGames}" >
</MenuItem>
<MenuItem Header="_Tournaments">
</MenuItem>
<MenuItem Header="_EventPlayers">
</MenuItem>
<MenuItem Header="_Info" Command="{Binding RoutedViewViewHost.ShowInfo}" />
<MenuItem Header="_Close" Command="{Binding CloseApp}" />
</MenuItem>
</Menu>
<TabControl Grid.Row="1" TabStripPlacement="Left">
<TabItem Header="{Binding Path=RoutedViewViewHost.Current}">
<DockPanel DataContext="{Binding RoutedViewViewHost}">
<reactiveUi:RoutedViewHost Router="{Binding Router}"/>
</DockPanel>
</TabItem>
</TabControl>
<StackPanel Grid.Row="2" Orientation="Horizontal">
<TextBlock> User : </TextBlock>
<TextBlock Margin="5,0,0,0"></TextBlock>
</StackPanel>
</Grid>
</Window>

View File

@@ -0,0 +1,12 @@
using Avalonia.Controls;
namespace LaDOSE.DesktopApp.Avalonia.Views;
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
}

View File

@@ -0,0 +1,212 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="LaDOSE.DesktopApp.Avalonia.Views.TournamentResultView"
xmlns:vm="using:LaDOSE.DesktopApp.Avalonia.ViewModels"
x:DataType="vm:TournamentResultViewModel"
>
<Grid Row="2" Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="2*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid Row="0" Column="0">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid Row="0" Column="0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<StackPanel Grid.Row="0" Orientation="Vertical" Margin="0,0,0,5">
<Label>Date :</Label>
<StackPanel Orientation="Vertical" VerticalAlignment="Stretch">
<StackPanel Orientation="Horizontal" VerticalAlignment="Stretch">
<DatePicker SelectedDate="{Binding From}" Margin="5,0,5,0" MonthFormat="MMMM" YearFormat="yyyy" DayVisible="False">
</DatePicker>
<Button Padding="5,0,5,0" Margin="5,0,5,0" x:Name="SelectMonth" HorizontalContentAlignment="Center" Command="{Binding SelectMonth}" Width="60">Month</Button>
</StackPanel>
<StackPanel Orientation="Horizontal" VerticalAlignment="Stretch">
<DatePicker SelectedDate="{Binding To}" Margin="5,0,5,0" MonthFormat="MMMM" YearFormat="yyyy" DayVisible="False">
</DatePicker>
<Button Padding="5,0,5,0" Margin="5,0,5,0" x:Name="SelectYear" HorizontalContentAlignment="Center" Width="60" Command="{Binding SelectYear}">Year</Button>
</StackPanel>
</StackPanel>
</StackPanel>
<Button Grid.Row="1" x:Name="LoadTournaments" Command="{Binding LoadTournaments}">Update</Button>
<ListBox Grid.Row="2" ItemsSource="{Binding Tournaments}" x:Name="TournamentList" Margin="0,0,0,5"
IsTextSearchEnabled="True" TextSearch.Text="Name"
SelectedItems="{Binding SelectedTournaments}"
SelectionMode="Multiple">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Margin="5,0,0,0" Text="{Binding Name}" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<DockPanel Grid.Row="3" Dock="Left">
<Label>Select :</Label>
<TextBox Width="200" Text="{Binding SelectRegex}"></TextBox>
<Button Padding="5,0,5,0" Margin="5,0,5,0" x:Name="SelectRegexp" Command="{Binding SelectRegexp}">Select</Button>
<Button Padding="5,0,5,0" Margin="5,0,5,0" x:Name="GetChallonge" Command="{Binding GetChallonge}">Import</Button>
</DockPanel>
</Grid>
<Grid Row="0" Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<StackPanel Grid.Row="0" Grid.Column="0" Orientation="Horizontal" Margin="0,0,0,6">
<Label> Smash Slug :</Label>
<TextBox Width="200" Text="{Binding Slug}"></TextBox>
<Button Margin="5,0,5,0" x:Name="GetSmash" Command="{Binding GetSmash}" >Import Smash Event</Button>
</StackPanel>
<Button Grid.Row="1" x:Name="UpdateEvent" Command="{Binding UpdateEvent}">Update Event</Button>
<ListBox Grid.Row="2" ItemsSource="{Binding Events}" Margin="0,0,0,5"
IsTextSearchEnabled="True" TextSearch.Text="Name" SelectionMode="Multiple"
SelectedItems="{Binding SelectedEvents}">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Id}" />
<TextBlock Margin="5,0,0,0" Text="{Binding Name}" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<DockPanel Grid.Row="3" Dock="Left">
<Label>Select :</Label>
<TextBox Width="200" Text="{Binding SelectEventRegex}"></TextBox>
<Button Padding="5,0,5,0" Margin="5,0,5,0" x:Name="SelectEvent" Command="{Binding SelectEvent}">Select</Button>
</DockPanel>
</Grid>
</Grid>
<Grid Row="3">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="2*" />
</Grid.ColumnDefinitions>
<!--<DockPanel Grid.Row="0" Grid.ColumnSpan="3" Dock="Left">
<Label>Select :</Label>
<TextBox Width="200" Text="{Binding SelectRegex}"></TextBox>
<Button Padding="5,0,5,0" Margin="5,0,5,0" x:Name="SelectRegexp">Select</Button>
<Button x:Name="Select" >Get Tournaments Result</Button>
</DockPanel>-->
<Button x:Name="Select" Grid.ColumnSpan="3" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" Command="{Binding Select}">Get Tournaments Result</Button>
<StackPanel Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="3" Orientation="Horizontal">
<TextBlock> Game :</TextBlock>
<TextBlock Margin="5,0,0,0" Text="{Binding Results.Games.Count}" />
</StackPanel>
<ListBox Grid.Column="0" Grid.Row="2" ItemsSource="{Binding Results.Games}" Margin="5,5,5,5"
IsTextSearchEnabled="True" TextSearch.Text="Name"
SelectedItem="{Binding SelectedGame}">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Id}" />
<TextBlock Margin="5,0,0,0" Text="{Binding Name}" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<StackPanel Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2" Orientation="Horizontal">
<TextBlock> Participents :</TextBlock>
<TextBlock Margin="5,0,0,0" Text="{Binding Results.Participents.Count}" />
</StackPanel>
<ListBox Grid.Row="2" Grid.Column="1" ItemsSource="{Binding Results.Participents}" Margin="5,5,5,5"
IsTextSearchEnabled="True" TextSearch.Text="Name">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Margin="5,0,0,0" Text="{Binding Name}" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<TabControl Grid.Row="2" Grid.Column="2">
<TabItem Header="Result">
<DataGrid x:Name="DataGrid" PropertyChanged="DataGrid_OnPropertyChanged" ItemsSource="{Binding GridDataTableView}" CanUserSortColumns="True" BorderThickness="1" BorderBrush="Gray"/>
</TabItem>
<TabItem Header="By Game">
<DockPanel>
<StackPanel Orientation="Horizontal" DockPanel.Dock="Top">
<TextBlock> Total :</TextBlock>
<TextBlock Text="{Binding SelectedGameResult.Count}" />
</StackPanel>
<ListBox ItemsSource="{Binding SelectedGameResult}" Margin="5,5,5,5"
IsTextSearchEnabled="True" TextSearch.Text="Name" DockPanel.Dock="Top">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Margin="5,0,0,0" Text="{Binding Player}" />
<TextBlock Margin="5,0,0,0" Text="{Binding Point}" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</DockPanel>
</TabItem>
<TabItem Header="HTML">
<DockPanel>
<Button x:Name="CopyHtml" DockPanel.Dock="Top" Command="{Binding CopyHtml}">Copy HTML to clipboard</Button>
<TextBox Text="{Binding Html}" />
</DockPanel>
</TabItem>
</TabControl>
</Grid>
<Button Grid.Column="0" Grid.Row="4" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" x:Name="Export" Command="{Binding Export}">Export</Button>
</Grid>
</UserControl>

View File

@@ -0,0 +1,56 @@

using System.Data;
using System.Diagnostics;
using System.Linq;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Data;
using LaDOSE.DesktopApp.Avalonia.ViewModels;
using ReactiveUI;
namespace LaDOSE.DesktopApp.Avalonia.Views
{
/// <summary>
/// Interaction logic for ShellView.xaml
/// </summary>
public partial class TournamentResultView : UserControl, IViewFor<TournamentResultViewModel>
{
public TournamentResultView()
{
InitializeComponent();
}
object? IViewFor.ViewModel
{
get => ViewModel;
set => ViewModel = (TournamentResultViewModel)value!;
}
public TournamentResultViewModel? ViewModel { get; set; }
private void DataGrid_OnPropertyChanged(object? sender, AvaloniaPropertyChangedEventArgs e)
{
if (e.Property.Name == "ItemsSource")
{
Trace.WriteLine("Changed Binding");
var grid = (sender as DataGrid);
grid.Columns.Clear();
var data = ViewModel.GridDataTable;
foreach (DataColumn? view in data.Columns)
{
grid.Columns.Add(new DataGridTextColumn()
{
Header = view.ColumnName,
CanUserSort = true,
Binding = new Binding($"Row.ItemArray[{view.Ordinal}]")
});
}
}
return;
}
}
}

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<!-- This manifest is used on Windows only.
Don't remove it as it might cause problems with window transparency and embedded controls.
For more details visit https://learn.microsoft.com/en-us/windows/win32/sbscs/application-manifests -->
<assemblyIdentity version="1.0.0.0" name="LaDOSE.DesktopApp.Avalonia.Desktop"/>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- A list of the Windows versions that this application has been tested on
and is designed to work with. Uncomment the appropriate elements
and Windows will automatically select the most compatible environment. -->
<!-- Windows 10 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
</application>
</compatibility>
</assembly>

View File

@@ -0,0 +1,7 @@
#!/usr/bin/env sh
export ANDROID_HOME=/home/tom/src/android/
export PATH=$PATH:$ANDROID_HOME/build-tools/34.0.0:$ANDROID_HOME/platforms/android-34
dotnet build LaDOSE.DesktopApp.Avalonia.csproj -p:TargetFramework=net6.0-android -p:AndroidSdkDirectory=$ANDROID_HOME/build-tools/34.0.0

View File

@@ -0,0 +1,7 @@
{
"REST": {
"Url": "http://localhost:5000",
"User": "user",
"Password": "password"
}
}

View File

@@ -11,7 +11,7 @@
<OutputType>WinExe</OutputType>
<RootNamespace>LaDOSE.DesktopApp</RootNamespace>
<AssemblyName>LaDOSE.DesktopApp</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
@@ -71,27 +71,6 @@
<OutputPath>bin\x64\Release\</OutputPath>
</PropertyGroup>
<ItemGroup>
<Reference Include="Caliburn.Micro, Version=3.2.0.0, Culture=neutral, PublicKeyToken=8e5891231f2ed21f, processorArchitecture=MSIL">
<HintPath>..\packages\Caliburn.Micro.Core.3.2.0\lib\net45\Caliburn.Micro.dll</HintPath>
</Reference>
<Reference Include="Caliburn.Micro.Platform, Version=3.2.0.0, Culture=neutral, PublicKeyToken=8e5891231f2ed21f, processorArchitecture=MSIL">
<HintPath>..\packages\Caliburn.Micro.3.2.0\lib\net45\Caliburn.Micro.Platform.dll</HintPath>
</Reference>
<Reference Include="Caliburn.Micro.Platform.Core, Version=3.2.0.0, Culture=neutral, PublicKeyToken=8e5891231f2ed21f, processorArchitecture=MSIL">
<HintPath>..\packages\Caliburn.Micro.3.2.0\lib\net45\Caliburn.Micro.Platform.Core.dll</HintPath>
</Reference>
<Reference Include="CefSharp, Version=103.0.120.0, Culture=neutral, PublicKeyToken=40c4b6fc221f4138, processorArchitecture=MSIL">
<HintPath>..\packages\CefSharp.Common.103.0.120\lib\net452\CefSharp.dll</HintPath>
</Reference>
<Reference Include="CefSharp.Core, Version=103.0.120.0, Culture=neutral, PublicKeyToken=40c4b6fc221f4138, processorArchitecture=MSIL">
<HintPath>..\packages\CefSharp.Common.103.0.120\lib\net452\CefSharp.Core.dll</HintPath>
</Reference>
<Reference Include="CefSharp.Wpf, Version=103.0.120.0, Culture=neutral, PublicKeyToken=40c4b6fc221f4138, processorArchitecture=MSIL">
<HintPath>..\packages\CefSharp.Wpf.103.0.120\lib\net452\CefSharp.Wpf.dll</HintPath>
</Reference>
<Reference Include="RestSharp, Version=106.11.4.0, Culture=neutral, PublicKeyToken=598062e77f915f75, processorArchitecture=MSIL">
<HintPath>..\packages\RestSharp.106.11.4\lib\net452\RestSharp.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Data" />
@@ -101,9 +80,6 @@
<Reference Include="System.Web" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Caliburn.Micro.3.2.0\lib\net45\System.Windows.Interactivity.dll</HintPath>
</Reference>
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
@@ -126,8 +102,6 @@
<Compile Include="Behaviors\TextBoxInputRegExBehaviour.cs" />
<Compile Include="Behaviors\MultiSelectorBehaviours.cs" />
<Compile Include="Bootstrapper.cs" />
<Compile Include="Themes\LeftMarginMultiplierConverter.cs" />
<Compile Include="Themes\TreeViewItemExtensions.cs" />
<Compile Include="Utils\CustomEqualityCompare.cs" />
<Compile Include="Utils\PhpSerialize.cs" />
<Compile Include="UserControls\BookingUserControl.xaml.cs">
@@ -163,10 +137,6 @@
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Page Include="Themes\Styles.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="UserControls\BookingUserControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -214,7 +184,6 @@
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>

View File

@@ -1,31 +0,0 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
namespace DarkBlendTheme
{
public class LeftMarginMultiplierConverter : IValueConverter
{
public double Length { get; set; }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var item = value as TreeViewItem;
if (item == null)
return new Thickness(0);
return new Thickness(Length * item.GetDepth(), 0, 0, 0);
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new System.NotImplementedException();
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,38 +0,0 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Media;
namespace DarkBlendTheme
{
public static class TreeViewItemExtensions
{
public static int GetDepth(this TreeViewItem item)
{
TreeViewItem parent;
while ((parent = GetParent(item)) != null)
{
return GetDepth(parent) + 1;
}
return 0;
}
private static TreeViewItem GetParent(TreeViewItem item)
{
var parent = VisualTreeHelper.GetParent(item);
while (!(parent is TreeViewItem || parent is TreeView))
{
if (parent == null) return null;
parent = VisualTreeHelper.GetParent(parent);
}
return parent as TreeViewItem;
}
}
}

View File

@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Caliburn.Micro" version="3.2.0" targetFramework="net461" />
<package id="Caliburn.Micro.Core" version="3.2.0" targetFramework="net461" />
<package id="cef.redist.x64" version="103.0.12" targetFramework="net461" />
<package id="cef.redist.x86" version="103.0.12" targetFramework="net461" />
<package id="CefSharp.Common" version="103.0.120" targetFramework="net461" />
<package id="CefSharp.Wpf" version="103.0.120" targetFramework="net461" />
<package id="RestSharp" version="106.11.4" targetFramework="net461" />
<package id="WPFThemes.DarkBlend" version="1.0.8" targetFramework="net461" />
</packages>

View File

@@ -1,58 +1,55 @@
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DSharpPlus.CommandsNext;
using DSharpPlus.CommandsNext.Attributes;
using LaDOSE.DiscordBot.Service;
using LaDOSE.DTO;
namespace LaDOSE.DiscordBot.Command
{
public class BotEvent : BaseCommandModule
{
private WebService dep;
public BotEvent(WebService d)
{
dep = d;
}
[RequireRolesAttribute(RoleCheckMode.Any, "Staff")]
[Command("newevent")]
public async Task NewEventAsync(CommandContext ctx, string command)
{
await ctx.RespondAsync(dep.RestService.CreateBotEvent(command).ToString());
}
[RequireRolesAttribute(RoleCheckMode.Any,"Staff")]
[Command("staffs")]
public async Task StaffAsync(CommandContext ctx)
{
BotEventDTO currentEvent = dep.RestService.GetLastBotEvent();
StringBuilder stringBuilder = new StringBuilder();
var present = currentEvent.Results.Where(x => x.Result).ToList();
var absent = currentEvent.Results.Where(x => !x.Result).ToList();
stringBuilder.AppendLine($"Pour {currentEvent.Name} : ");
present.ForEach(x => stringBuilder.AppendLine($":white_check_mark: {x.Name}"));
absent.ForEach(x => stringBuilder.AppendLine($":x: {x.Name}"));
await ctx.RespondAsync(stringBuilder.ToString());
}
[RequireRolesAttribute(RoleCheckMode.Any, "Staff")]
[Command("present")]
public async Task PresentAsync(CommandContext ctx)
{
await ctx.RespondAsync(dep.RestService.ResultBotEvent(new DTO.BotEventSendDTO() { DiscordId = ctx.Member.Id.ToString(), DiscordName = ctx.Member.DisplayName, Present = true }).ToString());
}
[RequireRolesAttribute(RoleCheckMode.Any, "Staff")]
[Command("absent")]
public async Task AbsentAsync(CommandContext ctx)
{
await ctx.RespondAsync(dep.RestService.ResultBotEvent(new DTO.BotEventSendDTO() { DiscordId = ctx.Member.Id.ToString(), DiscordName = ctx.Member.DisplayName, Present = false }).ToString());
}
}
// public class BotEvent : BaseCommandModule
// {
// private WebService dep;
// public BotEvent(WebService d)
// {
// dep = d;
// }
//
// [Command("newevent")]
// public async Task NewEventAsync(CommandContext ctx, string command)
// {
//
// await ctx.RespondAsync(dep.RestService.CreateBotEvent(command).ToString());
// }
// [RequireRolesAttribute(RoleCheckMode.Any,"Staff")]
// [Command("staffs")]
// public async Task StaffAsync(CommandContext ctx)
// {
// BotEventDTO currentEvent = dep.RestService.GetLastBotEvent();
// StringBuilder stringBuilder = new StringBuilder();
//
// var present = currentEvent.Results.Where(x => x.Result).ToList();
// var absent = currentEvent.Results.Where(x => !x.Result).ToList();
//
// stringBuilder.AppendLine($"Pour {currentEvent.Name} : ");
// present.ForEach(x => stringBuilder.AppendLine($":white_check_mark: {x.Name}"));
// absent.ForEach(x => stringBuilder.AppendLine($":x: {x.Name}"));
//
// await ctx.RespondAsync(stringBuilder.ToString());
//
// }
// [RequireRolesAttribute(RoleCheckMode.Any, "Staff")]
// [Command("present")]
// public async Task PresentAsync(CommandContext ctx)
// {
// await ctx.RespondAsync(dep.RestService.ResultBotEvent(new DTO.BotEventSendDTO() { DiscordId = ctx.Member.Id.ToString(), DiscordName = ctx.Member.DisplayName, Present = true }).ToString());
//
//
// }
// [RequireRolesAttribute(RoleCheckMode.Any, "Staff")]
// [Command("absent")]
// public async Task AbsentAsync(CommandContext ctx)
// {
// await ctx.RespondAsync(dep.RestService.ResultBotEvent(new DTO.BotEventSendDTO() { DiscordId = ctx.Member.Id.ToString(), DiscordName = ctx.Member.DisplayName, Present = false }).ToString());
// }
// }
}

View File

@@ -2,14 +2,15 @@
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using DSharpPlus.CommandsNext;
using DSharpPlus.CommandsNext.Attributes;
using DSharpPlus.Commands;
using DSharpPlus.Commands.ArgumentModifiers;
using DSharpPlus.Commands.Processors.TextCommands;
using DSharpPlus.Entities;
namespace LaDOSE.DiscordBot.Command
{
public class Hokuto : BaseCommandModule
public class Hokuto
{
private static List<string> Games = new List<string> { "2X", "3.3", "Karnov" };
@@ -21,14 +22,21 @@ namespace LaDOSE.DiscordBot.Command
[Command("hokuto")]
public async Task HokutoUserAsync(CommandContext ctx, params DiscordMember[] user)
public async ValueTask HokutoUserAsync(TextCommandContext ctx)
{
var i = r.Next(0, 3);
if (user!=null && user.Length>0)
if (ctx.Message.MentionedUsers is { Count: 1 } )
{
await ctx.RespondAsync(ctx.User?.Mention + " vs " + user[0].Mention + " : " + Games[i].ToString());
foreach (var arg in ctx.Message.MentionedUsers)
{
if (arg is DiscordUser member)
{
await ctx.RespondAsync(ctx.User?.Mention + " vs " + member.Mention + " : " + Games[i].ToString());
return;
}
}
}
else
{

View File

@@ -4,12 +4,11 @@ using System.Globalization;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using DSharpPlus.CommandsNext;
using DSharpPlus.CommandsNext.Attributes;
using DSharpPlus.Commands;
namespace LaDOSE.DiscordBot.Command
{
public class Public : BaseCommandModule
public class Public
{
private static List<string> Quotes { get; set; }

View File

@@ -2,16 +2,18 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Platforms>AnyCPU;x64</Platforms>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="DSharpPlus" Version="4.2.0" />
<PackageReference Include="DSharpPlus.CommandsNext" Version="4.2.0" />
<PackageReference Include="DSharpPlus.Interactivity" Version="4.2.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="3.1.8" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.1.8" />
<PackageReference Include="DSharpPlus" Version="5.0.0-alpha.5" />
<PackageReference Include="DSharpPlus.Commands" Version="5.0.0-alpha.5" />
<PackageReference Include="DSharpPlus.Interactivity" Version="5.0.0-alpha.5" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
<ItemGroup>

View File

@@ -4,8 +4,12 @@ using System.IO;
using System.Threading;
using System.Threading.Tasks;
using DSharpPlus;
using DSharpPlus.Commands;
using DSharpPlus.Commands.Processors.SlashCommands;
using DSharpPlus.Commands.Processors.TextCommands;
using DSharpPlus.Commands.Processors.TextCommands.Parsing;
using DSharpPlus.Entities;
using DSharpPlus.Interactivity;
using DSharpPlus.CommandsNext;
using DSharpPlus.EventArgs;
using DSharpPlus.Interactivity.Extensions;
//using DSharpPlus.SlashCommands;
@@ -20,7 +24,6 @@ namespace LaDOSE.DiscordBot
{
class Program
{
static DiscordClient discord;
//static InteractivityModule Interactivity { get; set; }
static void Main(string[] args)
@@ -42,107 +45,37 @@ namespace LaDOSE.DiscordBot
var restUrl = builder["REST:Url"].ToString();
var restUser = builder["REST:User"].ToString();
var restPassword = builder["REST:Password"].ToString();
var service = new ServiceCollection()
.AddSingleton(typeof(WebService), new WebService(new Uri(restUrl), restUser, restPassword))
.BuildServiceProvider();
Console.WriteLine($"LaDOSE.Net Discord Bot");
discord = new DiscordClient(new DiscordConfiguration
{
Token = discordToken,
TokenType = TokenType.Bot,
//AutoReconnect = true,
//MinimumLogLevel = LogLevel.Debug,
//MessageCacheSize = 0,
});
discord.UseInteractivity(new InteractivityConfiguration
{
// default pagination behaviour to just ignore the reactions
//PaginationBehaviour = TimeoutBehaviour.Ignore,
// default pagination timeout to 5 minutes
//PaginationTimeout = TimeSpan.FromMinutes(5),
// default timeout for other actions to 2 minutes
Timeout = TimeSpan.FromMinutes(2)
});
DiscordClientBuilder builder2 =
DiscordClientBuilder.CreateDefault(discordToken, DiscordIntents.AllUnprivileged | DiscordIntents.MessageContents | DiscordIntents.GuildMessages| TextCommandProcessor.RequiredIntents | SlashCommandProcessor.RequiredIntents);
var cts = new CancellationTokenSource();
var _cnext = discord.UseCommandsNext(new CommandsNextConfiguration()
// Setup the commands extension
builder2.UseCommands((IServiceProvider serviceProvider, CommandsExtension extension) =>
{
//CaseSensitive = false,
//EnableDefaultHelp = true,
//EnableDms = false,
//EnableMentionPrefix = true,
StringPrefixes = new List<string>() { "/", "!" },
//IgnoreExtraArguments = true,
Services = service
extension.AddCommands([typeof(Hokuto), typeof(Public)]);
TextCommandProcessor textCommandProcessor = new();
extension.AddProcessor(textCommandProcessor);
}, new CommandsConfiguration()
{
// The default value is true, however it's shown here for clarity
RegisterDefaultCommandProcessors = true,
UseDefaultCommandErrorHandler = false
// DebugGuildId = Environment.GetEnvironmentVariable("DEBUG_GUILD_ID") ?? 0,
});
DiscordClient client = builder2.Build();
//var slashCommands = discord.UseSlashCommands(new SlashCommandsConfiguration() {Services = service});
//slashCommands.RegisterCommands<SlashCommand>(guildId:null);
//_cnext.RegisterCommands<Result>();
_cnext.RegisterCommands<Public>();
//_cnext.RegisterCommands<Shutdown>();
//_cnext.RegisterCommands<Todo>();
_cnext.RegisterCommands<Hokuto>();
_cnext.RegisterCommands<BotEvent>();
foreach (var registeredCommandsKey in discord.GetCommandsNext().RegisteredCommands.Keys)
{
Console.WriteLine(registeredCommandsKey);
}
discord.Ready += (sender, eventArgs) =>
{
Console.WriteLine($"Bot READY.");
return Task.CompletedTask;
};
discord.GuildAvailable += (sender, eventArgs) =>
{
Console.WriteLine($"Joined Guild " + eventArgs.Guild.Name);
return Task.CompletedTask;
};
await discord.ConnectAsync();
// We can specify a status for our bot. Let's set it to "playing" and set the activity to "with fire".
DiscordActivity status = new("Street Fighter", DiscordActivityType.Playing);
await client.ConnectAsync(status,DiscordUserStatus.Online);
await Task.Delay(Timeout.Infinite);
//while (!cts.IsCancellationRequested)
//{
// await Task.Delay(200);
// //if(discord.GetConnectionsAsync().Result.Count)
//}
}
}
//internal class SlashCommand : ApplicationCommandModule
//{
// [SlashCommand("test", "A slash command made to test the DSharpPlusSlashCommands library!")]
// public async Task TestCommand(InteractionContext ctx)
// {
// await ctx.CreateResponseAsync("Lol");
// }
//}
}

View File

@@ -34,13 +34,6 @@ namespace LaDOSE.DiscordBot.Service
}
private void CheckToken()
{
}
public String GetInscrits()
{

View File

@@ -9,6 +9,7 @@ namespace LaDOSE.Entity.Challonge
public List<Game> Games{ get; set; }
public List<Result> Results { get; set; }
public string Slug { get; set; }
}
public class Result

View File

@@ -39,6 +39,8 @@ namespace LaDOSE.Entity.Context
public LaDOSEDbContext(DbContextOptions options) : base(options)
{
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{

View File

@@ -2,11 +2,18 @@
<PropertyGroup>
<Platforms>AnyCPU;x64</Platforms>
<TargetFrameworks>net6.0;netcoreapp3.1</TargetFrameworks>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="3.1.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.12" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
<ItemGroup>
<Reference Include="Microsoft.EntityFrameworkCore">
<HintPath>..\..\..\..\.nuget\packages\microsoft.entityframeworkcore\8.0.11\lib\net8.0\Microsoft.EntityFrameworkCore.dll</HintPath>
</Reference>
</ItemGroup>
</Project>

View File

@@ -1,12 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Platforms>AnyCPU;x64</Platforms>
<LangVersion>12</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="RestSharp" Version="106.11.4" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="RestSharp" Version="112.1.0" />
</ItemGroup>
<ItemGroup>

View File

@@ -2,9 +2,10 @@
using System.Collections.Generic;
using LaDOSE.DTO;
using LaDOSE.REST.Event;
using Newtonsoft.Json;
using RestSharp;
using RestSharp.Authenticators;
using RestSharp.Serialization.Json;
namespace LaDOSE.REST
{
@@ -23,39 +24,54 @@ namespace LaDOSE.REST
public event EventHandler<UpdatedJwtEventHandler> UpdatedJwtEvent;
public RestService() { }
public RestService()
{
}
public RestService(Uri url, string user, string password)
{
Client = new RestClient(url);
this.username = user;
this.password = password;
}
public void Connect(Uri url, string user, string password)
{
Client = new RestClient(url);
// Client = new RestClient(url);
// this.username = user;
// this.password = password;
string token;
try
{
token = GetToken(user, password);
}
catch (Exception)
{
return;
}
Client = new RestClient(url, options =>
{
#if DEBUG
Client.Timeout = 999*1000;
options.MaxTimeout = Int32.MaxValue;
#endif
this.username = user;
this.password = password;
GetToken(user, password);
options.Authenticator = new JwtAuthenticator(token);
});
}
private void GetToken(string user, string password)
private string GetToken(string user, string password)
{
var restRequest = new RestRequest("users/auth", Method.POST);
var restRequest = new RestRequest("users/auth", Method.Post);
restRequest.AddJsonBody(new {username = user, password = password});
var response = Client.Post(restRequest);
if (response.IsSuccessful)
{
JsonDeserializer d = new JsonDeserializer();
var applicationUser = d.Deserialize<ApplicationUserDTO>(response);
this.Auth = applicationUser;
Client.Authenticator = new JwtAuthenticator($"{applicationUser.Token}");
RaiseUpdatedJwtEvent(new UpdatedJwtEventHandler(this.Auth));
}
else
{
throw new Exception("unable to contact services");
}
var response = Client.Post<ApplicationUserDTO>(restRequest);
//var applicationUser = JsonConvert.DeserializeObject<ApplicationUserDTO>(response.Content);
this.Auth = response;
return response.Token;
}
private void RaiseUpdatedJwtEvent(UpdatedJwtEventHandler auth)
@@ -69,126 +85,128 @@ namespace LaDOSE.REST
private void CheckToken()
{
if (this.Auth == null || this.Auth.Expire <= DateTime.Now)
if (this.Auth == null || this.Auth.Expire.ToUniversalTime() <= DateTime.Now.ToUniversalTime())
{
GetToken(this.username,this.password);
}
}
#region PostFix
private T Post<T>(string resource,T entity)
{
var json = new RestSharp.Serialization.Json.JsonSerializer();
var jsonD = new RestSharp.Serialization.Json.JsonDeserializer();
var request = new RestRequest();
request.Method = Method.POST;
request.Resource = resource;
request.AddHeader("Accept", "application/json");
request.AddHeader("Content-type", "application/json");
request.Parameters.Clear();
request.AddParameter("application/json; charset=utf-8", json.Serialize(entity), ParameterType.RequestBody);
request.AddObject(entity);
var response = Client.Execute(request);
//var content = response.Content; // raw content as string
try
{
return jsonD.Deserialize<T>(response);
}
catch (Exception)
{
return default(T);
}
}
private R Post<P,R>(string resource, P entity)
{
var json = new RestSharp.Serialization.Json.JsonSerializer();
var jsonD = new RestSharp.Serialization.Json.JsonDeserializer();
var request = new RestRequest();
request.Method = Method.POST;
request.Resource = resource;
request.AddHeader("Accept", "application/json");
request.AddHeader("Content-type", "application/json");
request.Parameters.Clear();
request.AddParameter("application/json; charset=utf-8", json.Serialize(entity), ParameterType.RequestBody);
//request.AddObject(entity);
var response = Client.Execute(request);
//var content = response.Content; // raw content as string
try
{
return jsonD.Deserialize<R>(response);
}
catch (Exception)
{
return default(R);
}
}
#endregion
// #region PostFix
//
// private T Post<T>(string resource,T entity)
// {
// var json = new RestSharp.Serialization.Json.JsonSerializer();
// var jsonD = new RestSharp.Serialization.Json.JsonDeserializer();
// var request = new RestRequest();
// request.Method = Method.Post;
// request.Resource = resource;
// request.AddHeader("Accept", "application/json");
// request.AddHeader("Content-type", "application/json");
// request.Parameters.Clear();
// request.AddParameter("application/json; charset=utf-8", json.Serialize(entity), ParameterType.RequestBody);
// request.AddObject(entity);
// var response = Client.Execute(request);
// //var content = response.Content; // raw content as string
// try
// {
// return jsonD.Deserialize<T>(response);
// }
// catch (Exception)
// {
// return default(T);
// }
//
//
// }
// private R Post<P,R>(string resource, P entity)
// {
// var json = new RestSharp.Serialization.Json.JsonSerializer();
// var jsonD = new RestSharp.Serialization.Json.JsonDeserializer();
// var request = new RestRequest();
// request.Method = Method.Post;
// request.Resource = resource;
// request.AddHeader("Accept", "application/json");
// request.AddHeader("Content-type", "application/json");
// request.Parameters.Clear();
// request.AddParameter("application/json; charset=utf-8", json.Serialize(entity), ParameterType.RequestBody);
// //request.AddObject(entity);
// var response = Client.Execute(request);
// //var content = response.Content; // raw content as string
// try
// {
// return jsonD.Deserialize<R>(response);
// }
// catch (Exception)
// {
// return default(R);
// }
//
//
// }
//
// #endregion
#region WordPress
public List<WPEventDTO> GetEvents()
{
CheckToken();
var restRequest = new RestRequest("/api/wordpress/WPEvent", Method.GET);
var restRequest = new RestRequest("/api/wordpress/WPEvent", Method.Get);
var restResponse = Client.Get<List<WPEventDTO>>(restRequest);
return restResponse.Data;
return restResponse;
}
public WPEventDTO GetNextEvent()
{
CheckToken();
var restRequest = new RestRequest("/api/wordpress/NextEvent", Method.GET);
var restRequest = new RestRequest("/api/wordpress/NextEvent", Method.Get);
var restResponse = Client.Get<WPEventDTO>(restRequest);
return restResponse.Data;
return restResponse;
}
public string GetLastChallonge()
{
CheckToken();
var restRequest = new RestRequest($"/api/wordpress/GetLastChallonge/", Method.GET);
var restRequest = new RestRequest($"/api/wordpress/GetLastChallonge/", Method.Get);
var restResponse = Client.Get(restRequest);
return restResponse.Content;
}
public string CreateChallonge(int gameId, int eventId)
{
CheckToken();
var restRequest = new RestRequest($"/api/wordpress/CreateChallonge/{gameId}/{eventId}", Method.GET);
var restRequest = new RestRequest($"/api/wordpress/CreateChallonge/{gameId}/{eventId}", Method.Get);
var restResponse = Client.Get(restRequest);
return restResponse.Content;
}
public string CreateChallonge2(int gameId, int eventId, List<WPUserDTO> optionalPlayers)
{
CheckToken();
var restResponse = Post<List<WPUserDTO>,string>($"/api/wordpress/CreateChallonge/{gameId}/{eventId}",optionalPlayers);
RestRequest r =
new RestRequest($"/api/wordpress/CreateChallonge/{gameId}/{eventId}").AddJsonBody(optionalPlayers);
var restResponse = Client.Post<string>(r);
return restResponse;
}
public bool RefreshDb()
{
CheckToken();
var restRequest = new RestRequest("/api/Wordpress/UpdateDb", Method.GET);
var restRequest = new RestRequest("/api/Wordpress/UpdateDb", Method.Get);
var restResponse = Client.Get<bool>(restRequest);
return restResponse.Data;
return restResponse;
}
public List<WPUserDTO> GetUsers(int wpEventId, int gameId)
{
CheckToken();
var restRequest = new RestRequest($"/api/Wordpress/GetUsers/{wpEventId}/{gameId}", Method.GET);
var restRequest = new RestRequest($"/api/Wordpress/GetUsers/{wpEventId}/{gameId}", Method.Get);
var restResponse = Client.Get<List<WPUserDTO>>(restRequest);
return restResponse.Data;
return restResponse;
}
public List<WPUserDTO> GetUsersOptions(int wpEventId, int gameId)
{
CheckToken();
var restRequest = new RestRequest($"/api/Wordpress/GetUsersOptions/{wpEventId}/{gameId}", Method.GET);
var restRequest = new RestRequest($"/api/Wordpress/GetUsersOptions/{wpEventId}/{gameId}", Method.Get);
var restResponse = Client.Get<List<WPUserDTO>>(restRequest);
return restResponse.Data;
return restResponse;
}
@@ -198,20 +216,29 @@ namespace LaDOSE.REST
public List<GameDTO> GetGames()
{
CheckToken();
var restRequest = new RestRequest("/api/Game", Method.GET);
var restRequest = new RestRequest("/api/Game", Method.Get);
var restResponse = Client.Get<List<GameDTO>>(restRequest);
return restResponse.Data;
return restResponse;
}
public List<GameDTO> GetSmashGames(string name)
{
CheckToken();
var restRequest = new RestRequest($"/api/Game/Smash/{name}", Method.Get);
var restResponse = Client.Get<List<GameDTO>>(restRequest);
return restResponse;
}
public GameDTO UpdateGame(GameDTO game)
{
CheckToken();
return Post("Api/Game", game);
RestRequest r = new RestRequest("Api/Game").AddJsonBody(game);
return Client.Post<GameDTO>(r);
}
public bool DeleteGame(int gameId)
{
CheckToken();
var restRequest = new RestRequest($"/api/Game/{gameId}", Method.DELETE);
var restRequest = new RestRequest($"/api/Game/{gameId}", Method.Delete);
var restResponse = Client.Execute(restRequest);
return restResponse.IsSuccessful;
}
@@ -227,26 +254,27 @@ namespace LaDOSE.REST
public List<TodoDTO> GetTodos()
{
CheckToken();
var restRequest = new RestRequest("/api/Todo", Method.GET);
var restRequest = new RestRequest("/api/Todo", Method.Get);
var restResponse = Client.Get<List<TodoDTO>>(restRequest);
return restResponse.Data;
return restResponse;
}
public TodoDTO GetTodoById(int id)
{
CheckToken();
var restRequest = new RestRequest($"/api/Todo/{id}", Method.GET);
var restRequest = new RestRequest($"/api/Todo/{id}", Method.Get);
var restResponse = Client.Get<TodoDTO>(restRequest);
return restResponse.Data;
return restResponse;
}
public TodoDTO UpdateTodo(TodoDTO Todo)
{
CheckToken();
return Post("Api/Todo", Todo);
var restRequest = new RestRequest($"/api/Todo/", Method.Post).AddJsonBody(Todo);
return Client.Post<TodoDTO>(restRequest);
}
public bool DeleteTodo(int todoId)
{
CheckToken();
var restRequest = new RestRequest($"/api/Todo/{todoId}", Method.DELETE);
var restRequest = new RestRequest($"/api/Todo/{todoId}", Method.Delete);
var restResponse = Client.Execute(restRequest);
return restResponse.IsSuccessful;
}
@@ -258,9 +286,9 @@ namespace LaDOSE.REST
public TournamentsResultDTO Test(string test)
{
CheckToken();
var restRequest = new RestRequest($"Api/Test/Test/{test}", Method.GET);
var restRequest = new RestRequest($"Api/Test/Test/{test}", Method.Get);
var restResponse = Client.Get<TournamentsResultDTO>(restRequest);
return restResponse.Data;
return restResponse;
}
@@ -270,14 +298,17 @@ namespace LaDOSE.REST
public List<TournamentDTO> GetTournaments(TimeRangeDTO timeRange)
{
CheckToken();
List<TournamentDTO> tournamentDtos = Post<TimeRangeDTO, List<TournamentDTO>>("/api/Tournament/GetTournaments",timeRange);
RestRequest r = new RestRequest("/api/Tournament/GetTournaments").AddJsonBody(timeRange);
List<TournamentDTO> tournamentDtos = Client.Post<List<TournamentDTO>>(r);
return tournamentDtos;
}
public TournamentsResultDTO GetResults(List<int> ids)
{
CheckToken();
return Post<List<int>,TournamentsResultDTO>("Api/Tournament/GetResults", ids);
var restRequest = new RestRequest("Api/Tournament/GetResults", Method.Post).AddJsonBody(ids);
return Client.Post<TournamentsResultDTO>(restRequest);
}
@@ -285,33 +316,34 @@ namespace LaDOSE.REST
public bool ParseSmash(string slug)
{
CheckToken();
var restRequest = new RestRequest($"Api/Tournament/ParseSmash/{slug}", Method.GET);
var restRequest = new RestRequest($"Api/Tournament/ParseSmash/{slug}", Method.Get);
var restResponse = Client.Get<bool>(restRequest);
return restResponse.Data;
return restResponse;
}
public bool ParseChallonge(List<int> ids)
{
CheckToken();
return Post<List<int>, bool>("Api/Tournament/ParseChallonge", ids);
var restRequest = new RestRequest("Api/Tournament/ParseChallonge", Method.Post).AddJsonBody(ids);
return Client.Post<bool>(restRequest);
}
#endregion
#region Tournamenet Event / Player
public List<EventDTO> GetAllEvents()
{
CheckToken();
var restRequest = new RestRequest("/api/Event", Method.GET);
var restRequest = new RestRequest("/api/Event", Method.Get);
var restResponse = Client.Get<List<EventDTO>>(restRequest);
return restResponse.Data;
return restResponse;
}
public List<string> GetPlayers(string slug)
{
CheckToken();
var restRequest = new RestRequest($"/api/Tournament/GetPLayers/{slug}", Method.GET);
var restRequest = new RestRequest($"/api/Tournament/GetPLayers/{slug}", Method.Get);
var restResponse = Client.Get<List<string>>(restRequest);
return restResponse.Data;
return restResponse;
}
#endregion
@@ -321,23 +353,24 @@ namespace LaDOSE.REST
public bool CreateBotEvent(string eventName)
{
CheckToken();
var restRequest = new RestRequest($"/api/BotEvent/CreateBotEvent/{eventName}", Method.GET);
var restRequest = new RestRequest($"/api/BotEvent/CreateBotEvent/{eventName}", Method.Get);
var restResponse = Client.Get<bool>(restRequest);
return restResponse.Data;
return restResponse;
}
public BotEventDTO GetLastBotEvent()
{
CheckToken();
var restRequest = new RestRequest($"/api/BotEvent/GetLastBotEvent/", Method.GET);
var restRequest = new RestRequest($"/api/BotEvent/GetLastBotEvent/", Method.Get);
var restResponse = Client.Post<BotEventDTO>(restRequest);
return restResponse.Data;
return restResponse;
}
public bool ResultBotEvent(BotEventSendDTO result)
{
CheckToken();
return Post<BotEventSendDTO,bool>("/api/BotEvent/ResultBotEvent", result);
var restRequest = new RestRequest("/api/BotEvent/ResultBotEvent", Method.Post).AddJsonBody(result);
return Client.Post<bool>(restRequest);
}
#endregion

View File

@@ -10,6 +10,9 @@ namespace LaDOSE.Business.Interface
{
Task<List<ChallongeTournament>> GetTournaments(DateTime? start, DateTime? end);
Task<Event> ParseSmash(string tournamentSlug);
Task<List<Game>> GetSmashGame(string name);
//Task<List<Event>> ParseChallonge(List<int> ids);
//Task<TournamentsResult> GetChallongeTournamentsResult(List<int> ids);

View File

@@ -18,6 +18,7 @@ namespace LaDOSE.Business.Interface
Task<TournamentResponse> GetNames(string slug);
Task<List<Game>> GetGames(string name);
}
}

View File

@@ -11,7 +11,6 @@ namespace LaDOSE.Business.Interface
List<WPEvent> GetWpEvent();
List<WPUser> GetBooking(int wpEventId, Game game);
List<WPUser> GetBookingOptions(int wpEventId, Game game);
bool UpdateBooking();
string CreateChallonge(int gameId, int wpEventId, IList<WPUser> additionPlayers);
Task<string> GetLastChallonge();

View File

@@ -1,15 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<AssemblyName>LaDOSE.Business</AssemblyName>
<RootNamespace>LaDOSE.Business</RootNamespace>
<Platforms>AnyCPU;x64</Platforms>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="GraphQL.Client" Version="4.0.2" />
<PackageReference Include="GraphQL.Client.Serializer.Newtonsoft" Version="4.0.2" />
<PackageReference Include="GraphQL.Client" Version="6.1.0" />
<PackageReference Include="GraphQL.Client.Serializer.Newtonsoft" Version="6.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.12" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
<ItemGroup>

View File

@@ -15,6 +15,7 @@ namespace LaDOSE.Business.Provider.SmashProvider
{
public class SmashProvider : ISmashProvider
{
private static string API_FQDN = "api.start.gg";
public string ApiKey { get; set; }
//public SmashProvider(string apiKey)
//{
@@ -34,7 +35,7 @@ namespace LaDOSE.Business.Provider.SmashProvider
private async Task<T> QuerySmash<T>(GraphQLRequest req)
{
var graphQLClient = new GraphQLHttpClient("https://api.smash.gg/gql/alpha", new NewtonsoftJsonSerializer());
var graphQLClient = new GraphQLHttpClient($"https://{API_FQDN}/gql/alpha", new NewtonsoftJsonSerializer());
graphQLClient.HttpClient.DefaultRequestHeaders.Add("Authorization", $"Bearer {ApiKey}");
var graphQLResponse = await graphQLClient.SendQueryAsync<T>(req);
@@ -47,6 +48,37 @@ namespace LaDOSE.Business.Provider.SmashProvider
return graphQLResponse.Data;
}
public async Task<List<Game>> GetGames(string game)
{
var query = new GraphQLRequest()
{
Query = @"
query VideogameQuery($name:String) {
videogames(query: { filter: { name: $name }, perPage: 5 }) {
nodes {
id
name
displayName
}
}
}
",
OperationName = "VideogameQuery",
Variables = new
{
name = game,
}
};
VideoGamesResponse querySmash = await QuerySmash<VideoGamesResponse>(query);
if (querySmash.videogames != null)
{
return querySmash.videogames.nodes.Select(e => new Game() { Id = e.id, Name = e.Name }).ToList();
}
return new List<Game>();
}
public async Task<Event> GetEvent(string slug)
{
@@ -315,7 +347,7 @@ namespace LaDOSE.Business.Provider.SmashProvider
public async Task<TournamentResponse> GetNames(string slug)
{
var graphQLClient = new GraphQLHttpClient("https://api.smash.gg/gql/alpha", new NewtonsoftJsonSerializer());
var graphQLClient = new GraphQLHttpClient($"https://{API_FQDN}/gql/alpha", new NewtonsoftJsonSerializer());
graphQLClient.HttpClient.DefaultRequestHeaders.Add("Authorization", $"Bearer {ApiKey}");
var Event = new GraphQLRequest
{
@@ -381,7 +413,7 @@ namespace LaDOSE.Business.Provider.SmashProvider
public async Task<TournamentResponse> GetTournament(string slug)
{
var graphQLClient = new GraphQLHttpClient("https://api.smash.gg/gql/alpha", new NewtonsoftJsonSerializer());
var graphQLClient = new GraphQLHttpClient($"https://{API_FQDN}/gql/alpha", new NewtonsoftJsonSerializer());
graphQLClient.HttpClient.DefaultRequestHeaders.Add("Authorization", $"Bearer {ApiKey}");
var Event = new GraphQLRequest
{

View File

@@ -1,4 +1,5 @@
using System;
#nullable enable
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
@@ -11,62 +12,62 @@ namespace LaDOSE.Business.Provider.SmashProvider
public int totalPages { get; set; }
public int page { get; set; }
public int perPage { get; set; }
public string sortBy { get; set; }
public string filter { get; set; }
public string? sortBy { get; set; }
public string? filter { get; set; }
}
public class TournamentType
{
public int id { get; set; }
public string Name { get; set; }
public string? Name { get; set; }
[JsonConverter(typeof(UnixDateTimeConverter))]
public DateTime startAt { get; set; }
public List<EventType> Events { get; set; }
public List<EventType>? Events { get; set; }
}
public class VideoGameType
{
public int id { get; set; }
public string Name { get; set; }
public string? Name { get; set; }
}
public class ScoreType
{
public string label { get; set; }
public string? label { get; set; }
public int? value { get; set; }
public string displayValue { get; set; }
public string? displayValue { get; set; }
}
public class StatType
{
public ScoreType score { get; set; }
public ScoreType? score { get; set; }
}
public class StandingType
{
public string id { get; set; }
public string? id { get; set; }
public int placement { get; set; }
public ParticipantType player { get; set; }
public ParticipantType? player { get; set; }
public StatType stats { get; set; }
public StatType? stats { get; set; }
public EntrantType entrant { get; set; }
public EntrantType? entrant { get; set; }
}
public class ParticipantType
{
public int id { get; set; }
public string gamerTag { get; set; }
public string? gamerTag { get; set; }
public UserType? user { get; set; }
}
public class UserType
{
public int id { get; set; }
public string name { get; set; }
public string? name { get; set; }
}
@@ -74,68 +75,71 @@ namespace LaDOSE.Business.Provider.SmashProvider
{
public int id { get; set; }
public string name { get; set; }
public string state { get; set; }
public string? name { get; set; }
public string? state { get; set; }
public VideoGameType videogame { get; set; }
public Node<StandingType> standings { get; set; }
public Node<SetType> sets { get; set; }
public VideoGameType? videogame { get; set; }
public Node<StandingType>? standings { get; set; }
public Node<SetType>? sets { get; set; }
public Node<EntrantType> entrants { get; set; }
public Node<EntrantType>? entrants { get; set; }
}
public class EntrantType
{
public int id { get; set; }
public string name { get; set; }
public string? name { get; set; }
public bool? isDisqualified { get; set; }
public List<ParticipantType> participants { get; set; }
public List<ParticipantType>? participants { get; set; }
}
public class SlotType
{
public string id { get; set; }
public string? id { get; set; }
public int slotIndex { get; set; }
public StandingType standing { get; set; }
public StandingType? standing { get; set; }
public EntrantType entrant { get; set; }
public EntrantType? entrant { get; set; }
}
public class SetType
{
public string id { get; set; }
public string? id { get; set; }
public int? lPlacement { get; set; }
public int? wPlacement { get; set; }
public int? round { get; set; }
public List<SlotType> slots { get; set; }
public string identifier { get; set; }
public List<SlotType>? slots { get; set; }
public string? identifier { get; set; }
}
public class Node<T>
{
public PageInfoType pageInfo { get; set; }
public List<T> nodes { get; set; }
public PageInfoType? pageInfo { get; set; }
public List<T>? nodes { get; set; }
}
public class VideoGamesResponse
{
public Node<VideoGameType>? videogames {get; set; }
}
public class TournamentResponse
{
public TournamentType Tournament { get; set; }
public TournamentType? Tournament { get; set; }
}
public class EventResponse
{
public EventType Event { get; set; }
public EventType? Event { get; set; }
}
public class SetsResponse
{
public EventType Event { get; set; }
public EventType? Event { get; set; }
}

View File

@@ -6,6 +6,7 @@ using LaDOSE.Entity.BotEvent;
using LaDOSE.Entity.Context;
using Microsoft.EntityFrameworkCore;
namespace LaDOSE.Business.Service
{
public class BotEventService : BaseService<BotEvent>, IBotEventService

View File

@@ -78,6 +78,10 @@ namespace LaDOSE.Business.Service
//}
}
public async Task<List<Game>> GetSmashGames(string name)
{
return await _smashProvider.GetGames(name);
}
public async Task<Event> ParseSmash(string tournamentSlug)
{
Event eventExist = GetBySlug(tournamentSlug);
@@ -96,7 +100,7 @@ namespace LaDOSE.Business.Service
//POKEMON.
catch (Exception e)
{
throw new Exception("FUCK !");
throw new Exception($"FUCK ! {e.Message}");
}
return currentEvent;
}
@@ -109,6 +113,11 @@ namespace LaDOSE.Business.Service
}
public Task<List<Game>> GetSmashGame(string name)
{
return _smashProvider.GetGames(name);
}
private Event GetBySlug(string tournamentSlug)
{
return _context.Event.FirstOrDefault(e => e.SmashSlug == tournamentSlug);
@@ -139,10 +148,14 @@ namespace LaDOSE.Business.Service
players = players.Concat(e.Tournaments.SelectMany(e => e.Results.Select(e => e.Player)).Distinct().ToList()).ToList();
cevent.Tournaments = cevent.Tournaments.Concat(e.Tournaments).ToList();
}
var games = _context.Game.ToList();
TournamentsResult result = new TournamentsResult();
if (id.Count == 1)
{
result.Slug = _context.Event.Where(e=> e.Id == id.First()).First().SmashSlug;
}
result.Results = new List<Result>();
result.Games = new List<Game>();
result.Participents = new List<ChallongeParticipent>();

View File

@@ -20,6 +20,7 @@ namespace LaDOSE.Business.Service
{
if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password))
return null;
var p = _context.ApplicationUser.ToList();
var user = _context.ApplicationUser.SingleOrDefault(x => x.Username == username);
// check if username exists

View File

@@ -42,14 +42,7 @@ namespace LaDOSE.Business.Service
.Include(e => e.WPBookings).ThenInclude(e => e.WPUser).FirstOrDefault(e => Enumerable.Count<WPBooking>(e.WPBookings) != 0);
return wpEvents;
}
public bool UpdateBooking()
{
_context.Database.SetCommandTimeout(60);
_context.Database.ExecuteSqlCommand("call ladoseapi.ImportEvent();");
_context.Database.SetCommandTimeout(30);
return true;
}
public List<WPUser> GetBooking(int wpEventId, Game game)
{
var selectedGameWpId = game.WordPressTag.Split(';');

View File

@@ -21,6 +21,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Utils", "Utils", "{2A0E1491
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LaDOSE.REST", "LaDOSE.REST\LaDOSE.REST.csproj", "{692C2A72-AB7E-4502-BED8-AA2AFA1761CB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LinuxTest", "LinuxTest\LinuxTest.csproj", "{0EFA533F-9657-40CE-A3A5-F4E3C6E649B1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LaDOSE.DesktopApp.Avalonia", "LaDOSE.DesktopApp.Avalonia\LaDOSE.DesktopApp.Avalonia.csproj", "{1A3C654A-2730-42DA-B714-187169965A31}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -51,6 +55,14 @@ Global
{692C2A72-AB7E-4502-BED8-AA2AFA1761CB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{692C2A72-AB7E-4502-BED8-AA2AFA1761CB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{692C2A72-AB7E-4502-BED8-AA2AFA1761CB}.Release|Any CPU.Build.0 = Release|Any CPU
{0EFA533F-9657-40CE-A3A5-F4E3C6E649B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0EFA533F-9657-40CE-A3A5-F4E3C6E649B1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0EFA533F-9657-40CE-A3A5-F4E3C6E649B1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0EFA533F-9657-40CE-A3A5-F4E3C6E649B1}.Release|Any CPU.Build.0 = Release|Any CPU
{1A3C654A-2730-42DA-B714-187169965A31}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1A3C654A-2730-42DA-B714-187169965A31}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1A3C654A-2730-42DA-B714-187169965A31}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1A3C654A-2730-42DA-B714-187169965A31}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -62,6 +74,7 @@ Global
{952DE665-70B5-492B-BE91-D0111E3BD907} = {6FC9438E-D93E-4E63-9342-F8A966EE2D06}
{61201DA6-1BC9-4BA1-AC45-70104D391ECD} = {6FC9438E-D93E-4E63-9342-F8A966EE2D06}
{692C2A72-AB7E-4502-BED8-AA2AFA1761CB} = {2A0E1491-8E15-4062-ABE7-C04AE9655515}
{0EFA533F-9657-40CE-A3A5-F4E3C6E649B1} = {2A0E1491-8E15-4062-ABE7-C04AE9655515}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {D47DEDD0-C906-439D-81E4-D86BBE723B8C}

View File

@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>12</LangVersion>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\LaDOSE.REST\LaDOSE.REST.csproj" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,19 @@
using LaDOSE.REST;
internal class Program
{
public static void Main(string[] args)
{
// Console.WriteLine("Rest Test");
// var p = new LaDOSE.REST.RestService();
// Console.WriteLine("[+] Connect");
//
// p.Connect(new Uri("http://localhost:5000/"),"dev","dev");
// Console.WriteLine("[+] Test");
// var games = p.GetGames();
// foreach (var ga in games)
// {
// Console.WriteLine(ga.Name);
// }
}
}

View File

@@ -1,6 +1,6 @@
{
"sdk": {
"version": "6.0.0",
"version": "8.0.0",
"rollForward": "latestMajor",
"allowPrerelease": true
}

View File

@@ -2,26 +2,18 @@
![Logo](https://www.ladose.net/wp-content/uploads/2016/04/header_small-1.jpg)
# Dependencies
## Server
.netcore 2
AutoMapper
Newtonsoft.Json
Pomelo.EF
## Discord
DSharpPlus
.Net Core 8
PostgreSQL
## Desktop
.Net Framework 4.6.1
Caliburn Micro
[Microsoft Visual Studio Installer Projects](https://marketplace.visualstudio.com/items?itemName=VisualStudioClient.MicrosoftVisualStudio2017InstallerProjects#overview)
.Net Core 8
Avalonia
## Challonge
## Challonge Provider is a modified version of this
[ChallongeCSharpDriver](https://github.com/francoislg/ChallongeCSharpDriver)
Modified to work with .net core
Modified to work with .net core

View File

@@ -1,237 +0,0 @@
-- MySQL dump 10.13 Distrib 5.7.12, for Win64 (x86_64)
--
-- Host: localhost Database: ladoseapi
-- ------------------------------------------------------
-- Server version 5.6.40-log
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `ApplicationUser`
--
DROP TABLE IF EXISTS `ApplicationUser`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ApplicationUser` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`FirstName` varchar(45) DEFAULT NULL,
`LastName` varchar(45) DEFAULT NULL,
`UserName` varchar(45) DEFAULT NULL,
`PasswordHash` blob,
`PasswordSalt` blob,
PRIMARY KEY (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `Event`
--
DROP TABLE IF EXISTS `Event`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Event` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`Name` varchar(255) NOT NULL,
`Date` datetime NOT NULL,
`SeasonId` int(11) NOT NULL,
`Ranking` tinyint(4) DEFAULT NULL,
PRIMARY KEY (`Id`),
KEY `SeasonPK_idx` (`SeasonId`),
CONSTRAINT `SeasonsPK` FOREIGN KEY (`SeasonId`) REFERENCES `Season` (`Id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `EventGame`
--
DROP TABLE IF EXISTS `EventGame`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `EventGame` (
`EventId` int(11) NOT NULL,
`GameId` int(11) NOT NULL,
`ChallongeId` int(11) DEFAULT NULL,
`ChallongeUrl` varchar(250) DEFAULT NULL,
PRIMARY KEY (`EventId`,`GameId`),
KEY `GamePK_idx` (`GameId`),
CONSTRAINT `EventGame_EventPK` FOREIGN KEY (`EventId`) REFERENCES `Event` (`Id`),
CONSTRAINT `EventGame_GamePk` FOREIGN KEY (`GameId`) REFERENCES `Game` (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `Game`
--
DROP TABLE IF EXISTS `Game`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Game` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`Name` varchar(45) CHARACTER SET utf8 DEFAULT NULL,
`ImgUrl` varchar(255) CHARACTER SET utf8 DEFAULT NULL,
`WordPressTag` varchar(255) DEFAULT NULL,
`WordPressTagOs` varchar(255) DEFAULT NULL,
`Order` int(11) NOT NULL DEFAULT '0',
`Gamecol` varchar(45) DEFAULT NULL,
PRIMARY KEY (`Id`),
UNIQUE KEY `name_UNIQUE` (`Name`)
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `Season`
--
DROP TABLE IF EXISTS `Season`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Season` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`Name` varchar(45) DEFAULT NULL,
`StartDate` datetime DEFAULT NULL,
`EndDate` datetime DEFAULT NULL,
PRIMARY KEY (`Id`),
UNIQUE KEY `Name_UNIQUE` (`Name`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `SeasonGame`
--
DROP TABLE IF EXISTS `SeasonGame`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `SeasonGame` (
`SeasonId` int(11) NOT NULL,
`GameId` int(11) NOT NULL,
PRIMARY KEY (`SeasonId`,`GameId`),
KEY `GamePK_idx` (`GameId`),
CONSTRAINT `GamePK` FOREIGN KEY (`GameId`) REFERENCES `Game` (`Id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `SeasonPK` FOREIGN KEY (`SeasonId`) REFERENCES `Season` (`Id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `Todo`
--
DROP TABLE IF EXISTS `Todo`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Todo` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`User` varchar(45) NOT NULL,
`Task` mediumtext,
`Done` tinyint(4) NOT NULL DEFAULT '0',
`Created` datetime NOT NULL,
`Deleted` datetime DEFAULT NULL,
PRIMARY KEY (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `WPBooking`
--
DROP TABLE IF EXISTS `WPBooking`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `WPBooking` (
`WPEventId` int(11) DEFAULT NULL,
`WPUserId` int(11) DEFAULT NULL,
`Message` varchar(5000) DEFAULT NULL,
`Meta` varchar(5000) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `WPEvent`
--
DROP TABLE IF EXISTS `WPEvent`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `WPEvent` (
`Id` int(11) NOT NULL,
`Name` varchar(255) DEFAULT NULL,
`Slug` varchar(255) DEFAULT NULL,
`Date` date DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `WPUser`
--
DROP TABLE IF EXISTS `WPUser`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `WPUser` (
`Id` int(11) NOT NULL,
`Name` varchar(45) DEFAULT NULL,
`WPUserLogin` varchar(45) DEFAULT NULL,
`WPMail` varchar(45) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping events for database 'ladoseapi'
--
--
-- Dumping routines for database 'ladoseapi'
--
/*!50003 DROP PROCEDURE IF EXISTS `ImportEvent` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8 */ ;
/*!50003 SET character_set_results = utf8 */ ;
/*!50003 SET collation_connection = utf8_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`ladoseapi`@`%` PROCEDURE `ImportEvent`()
BEGIN
INSERT INTO WPEvent (Id, Name,Slug,Date )
select event_id, event_name,event_slug, event_start_date from ladose.wp_em_events
where event_id not in (select Id from WPEvent);
INSERT INTO WPUser (Id, Name, WPUSerLogin, WPMail)
select ID, display_name, user_login , user_email from ladose.wp_users
where ID not in (select Id from WPUser);
INSERT INTO WPBooking (WPEventId, WPUserId, Message, Meta)
select event_id, person_id, booking_comment , booking_meta from ladose.wp_em_bookings
where (event_id , person_id) not in (select WPEventId,WPUserId from WPBooking);
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2019-03-27 0:38:33

View File

@@ -1,190 +0,0 @@
-- --------------------------------------------------------
-- Hôte : api.ladose.net
-- Version du serveur: 5.7.25-log - Gentoo Linux mysql-5.7.25
-- SE du serveur: Linux
-- HeidiSQL Version: 10.2.0.5599
-- --------------------------------------------------------
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET NAMES utf8 */;
/*!50503 SET NAMES utf8mb4 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
-- Listage de la structure de la base pour ladoseapi
CREATE DATABASE IF NOT EXISTS `ladoseapi` /*!40100 DEFAULT CHARACTER SET utf8 */;
USE `ladoseapi`;
-- Listage de la structure de la table ladoseapi. ApplicationUser
CREATE TABLE IF NOT EXISTS `ApplicationUser` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`FirstName` varchar(45) DEFAULT NULL,
`LastName` varchar(45) DEFAULT NULL,
`UserName` varchar(45) DEFAULT NULL,
`PasswordHash` blob,
`PasswordSalt` blob,
PRIMARY KEY (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4;
-- Les données exportées n'étaient pas sélectionnées.
-- Listage de la structure de la table ladoseapi. ChallongeParticipent
CREATE TABLE IF NOT EXISTS `ChallongeParticipent` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`ChallongeId` int(11) NOT NULL DEFAULT '0',
`ChallongeTournamentId` int(11) NOT NULL DEFAULT '0',
`Name` varchar(500) NOT NULL DEFAULT '0',
`Rank` int(11) DEFAULT '0',
`IsMember` bit(1) DEFAULT NULL,
PRIMARY KEY (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=687 DEFAULT CHARSET=utf8;
-- Les données exportées n'étaient pas sélectionnées.
-- Listage de la structure de la table ladoseapi. ChallongeTournament
CREATE TABLE IF NOT EXISTS `ChallongeTournament` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`ChallongeId` int(11) NOT NULL DEFAULT '0',
`Name` varchar(500) DEFAULT NULL,
`GameId` int(11) DEFAULT NULL,
`Url` varchar(255) DEFAULT NULL,
`Sync` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`Id`),
KEY `ChallongeTournament_GameIdPK` (`GameId`),
CONSTRAINT `ChallongeTournament_GameIdPK` FOREIGN KEY (`GameId`) REFERENCES `Game` (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=48 DEFAULT CHARSET=utf8;
-- Les données exportées n'étaient pas sélectionnées.
-- Listage de la structure de la table ladoseapi. Event
CREATE TABLE IF NOT EXISTS `Event` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`Name` varchar(255) NOT NULL,
`Date` datetime NOT NULL,
`SeasonId` int(11) NOT NULL,
`Ranking` tinyint(4) DEFAULT NULL,
PRIMARY KEY (`Id`),
KEY `SeasonPK_idx` (`SeasonId`),
CONSTRAINT `SeasonsPK` FOREIGN KEY (`SeasonId`) REFERENCES `Season` (`Id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
-- Les données exportées n'étaient pas sélectionnées.
-- Listage de la structure de la table ladoseapi. EventGame
CREATE TABLE IF NOT EXISTS `EventGame` (
`EventId` int(11) NOT NULL,
`GameId` int(11) NOT NULL,
`ChallongeId` int(11) DEFAULT NULL,
`ChallongeUrl` varchar(250) DEFAULT NULL,
PRIMARY KEY (`EventId`,`GameId`),
KEY `GamePK_idx` (`GameId`),
CONSTRAINT `EventGame_EventPK` FOREIGN KEY (`EventId`) REFERENCES `Event` (`Id`),
CONSTRAINT `EventGame_GamePk` FOREIGN KEY (`GameId`) REFERENCES `Game` (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Les données exportées n'étaient pas sélectionnées.
-- Listage de la structure de la table ladoseapi. Game
CREATE TABLE IF NOT EXISTS `Game` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`Name` varchar(45) CHARACTER SET utf8 DEFAULT NULL,
`ImgUrl` varchar(255) CHARACTER SET utf8 DEFAULT NULL,
`WordPressTag` varchar(255) DEFAULT NULL,
`WordPressTagOs` varchar(255) DEFAULT NULL,
`Order` int(11) NOT NULL DEFAULT '0',
`LongName` varchar(255) DEFAULT NULL,
PRIMARY KEY (`Id`),
UNIQUE KEY `name_UNIQUE` (`Name`)
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8mb4;
-- Les données exportées n'étaient pas sélectionnées.
-- Listage de la structure de la procédure ladoseapi. ImportEvent
DELIMITER //
CREATE DEFINER=`ladoseapi`@`%` PROCEDURE `ImportEvent`()
BEGIN
INSERT INTO WPEvent (Id, Name,Slug,Date )
select event_id, event_name,event_slug, event_start_date from ladose.wp_em_events
where event_id not in (select Id from WPEvent);
INSERT INTO WPUser (Id, Name, WPUSerLogin, WPMail)
select ID, display_name, user_login , user_email from ladose.wp_users
where ID not in (select Id from WPUser);
INSERT INTO WPBooking (WPEventId, WPUserId, Message, Meta)
select event_id, person_id, booking_comment , booking_meta from ladose.wp_em_bookings
where (event_id , person_id) not in (select WPEventId,WPUserId from WPBooking);
END//
DELIMITER ;
-- Listage de la structure de la table ladoseapi. Season
CREATE TABLE IF NOT EXISTS `Season` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`Name` varchar(45) DEFAULT NULL,
`StartDate` datetime DEFAULT NULL,
`EndDate` datetime DEFAULT NULL,
PRIMARY KEY (`Id`),
UNIQUE KEY `Name_UNIQUE` (`Name`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
-- Les données exportées n'étaient pas sélectionnées.
-- Listage de la structure de la table ladoseapi. SeasonGame
CREATE TABLE IF NOT EXISTS `SeasonGame` (
`SeasonId` int(11) NOT NULL,
`GameId` int(11) NOT NULL,
PRIMARY KEY (`SeasonId`,`GameId`),
KEY `GamePK_idx` (`GameId`),
CONSTRAINT `GamePK` FOREIGN KEY (`GameId`) REFERENCES `Game` (`Id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `SeasonPK` FOREIGN KEY (`SeasonId`) REFERENCES `Season` (`Id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Les données exportées n'étaient pas sélectionnées.
-- Listage de la structure de la table ladoseapi. Todo
CREATE TABLE IF NOT EXISTS `Todo` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`User` varchar(45) NOT NULL,
`Task` mediumtext,
`Done` tinyint(4) NOT NULL DEFAULT '0',
`Created` datetime NOT NULL,
`Deleted` datetime DEFAULT NULL,
PRIMARY KEY (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8;
-- Les données exportées n'étaient pas sélectionnées.
-- Listage de la structure de la table ladoseapi. WPBooking
CREATE TABLE IF NOT EXISTS `WPBooking` (
`WPEventId` int(11) DEFAULT NULL,
`WPUserId` int(11) DEFAULT NULL,
`Message` varchar(5000) DEFAULT NULL,
`Meta` varchar(5000) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Les données exportées n'étaient pas sélectionnées.
-- Listage de la structure de la table ladoseapi. WPEvent
CREATE TABLE IF NOT EXISTS `WPEvent` (
`Id` int(11) NOT NULL,
`Name` varchar(255) DEFAULT NULL,
`Slug` varchar(255) DEFAULT NULL,
`Date` date DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Les données exportées n'étaient pas sélectionnées.
-- Listage de la structure de la table ladoseapi. WPUser
CREATE TABLE IF NOT EXISTS `WPUser` (
`Id` int(11) NOT NULL,
`Name` varchar(45) DEFAULT NULL,
`WPUserLogin` varchar(45) DEFAULT NULL,
`WPMail` varchar(45) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Les données exportées n'étaient pas sélectionnées.
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
/*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;

View File

@@ -1,264 +0,0 @@
-- --------------------------------------------------------
-- Host: 192.168.20.36
-- Server version: 10.7.3-MariaDB - Arch Linux
-- Server OS: Linux
-- HeidiSQL Version: 10.2.0.5599
-- --------------------------------------------------------
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET NAMES utf8 */;
/*!50503 SET NAMES utf8mb4 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
-- Dumping database structure for ladoseapi
CREATE DATABASE IF NOT EXISTS `ladoseapi` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci */;
USE `ladoseapi`;
-- Dumping structure for table ladoseapi.ApplicationRole
DROP TABLE IF EXISTS `ApplicationRole`;
CREATE TABLE IF NOT EXISTS `ApplicationRole` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`Name` varchar(50) NOT NULL,
PRIMARY KEY (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb3;
-- Data exporting was unselected.
-- Dumping structure for table ladoseapi.ApplicationUser
DROP TABLE IF EXISTS `ApplicationUser`;
CREATE TABLE IF NOT EXISTS `ApplicationUser` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`FirstName` varchar(45) DEFAULT NULL,
`LastName` varchar(45) DEFAULT NULL,
`UserName` varchar(45) DEFAULT NULL,
`PasswordHash` blob DEFAULT NULL,
`PasswordSalt` blob DEFAULT NULL,
PRIMARY KEY (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4;
-- Data exporting was unselected.
-- Dumping structure for table ladoseapi.ApplicationUserRole
DROP TABLE IF EXISTS `ApplicationUserRole`;
CREATE TABLE IF NOT EXISTS `ApplicationUserRole` (
`UserId` int(11) NOT NULL,
`RoleId` int(11) NOT NULL,
UNIQUE KEY `UserId_RoleId` (`UserId`,`RoleId`),
KEY `FK_ApplicationUserRole_ApplicationRole` (`RoleId`),
CONSTRAINT `FK_ApplicationUserRole_ApplicationRole` FOREIGN KEY (`RoleId`) REFERENCES `ApplicationRole` (`Id`),
CONSTRAINT `FK_ApplicationUserRole_ApplicationUser` FOREIGN KEY (`UserId`) REFERENCES `ApplicationUser` (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
-- Data exporting was unselected.
-- Dumping structure for table ladoseapi.ChallongeParticipent
DROP TABLE IF EXISTS `ChallongeParticipent`;
CREATE TABLE IF NOT EXISTS `ChallongeParticipent` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`ChallongeId` int(11) NOT NULL DEFAULT 0,
`ChallongeTournamentId` int(11) NOT NULL DEFAULT 0,
`Name` varchar(500) NOT NULL DEFAULT '0',
`Rank` int(11) DEFAULT 0,
`IsMember` bit(1) DEFAULT NULL,
PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
-- Data exporting was unselected.
-- Dumping structure for table ladoseapi.ChallongeTournament
DROP TABLE IF EXISTS `ChallongeTournament`;
CREATE TABLE IF NOT EXISTS `ChallongeTournament` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`ChallongeId` int(11) NOT NULL DEFAULT 0,
`Name` varchar(500) DEFAULT NULL,
`GameId` int(11) DEFAULT NULL,
`Url` varchar(255) DEFAULT NULL,
`Sync` datetime NOT NULL DEFAULT current_timestamp(),
PRIMARY KEY (`Id`),
KEY `ChallongeTournament_GameIdPK` (`GameId`),
CONSTRAINT `ChallongeTournament_GameIdPK` FOREIGN KEY (`GameId`) REFERENCES `Game` (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
-- Data exporting was unselected.
-- Dumping structure for table ladoseapi.Event
DROP TABLE IF EXISTS `Event`;
CREATE TABLE IF NOT EXISTS `Event` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`Name` varchar(255) NOT NULL,
`Date` datetime NOT NULL,
`SmashId` int(11) DEFAULT NULL,
`SmashSlug` varchar(255) DEFAULT NULL,
PRIMARY KEY (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb3;
-- Data exporting was unselected.
-- Dumping structure for table ladoseapi.Game
DROP TABLE IF EXISTS `Game`;
CREATE TABLE IF NOT EXISTS `Game` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`Name` varchar(45) CHARACTER SET utf8mb3 DEFAULT NULL,
`ImgUrl` varchar(255) CHARACTER SET utf8mb3 DEFAULT NULL,
`WordPressTag` varchar(255) DEFAULT NULL,
`WordPressTagOs` varchar(255) DEFAULT NULL,
`Order` int(11) NOT NULL DEFAULT 0,
`LongName` varchar(255) DEFAULT NULL,
`SmashId` int(11) DEFAULT NULL,
PRIMARY KEY (`Id`),
UNIQUE KEY `name_UNIQUE` (`Name`)
) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=utf8mb4;
-- Data exporting was unselected.
-- Dumping structure for procedure ladoseapi.ImportEvent
DROP PROCEDURE IF EXISTS `ImportEvent`;
DELIMITER //
CREATE DEFINER=`ladoseapi`@`%` PROCEDURE `ImportEvent`()
BEGIN
INSERT INTO WPEvent (Id, Name,Slug,Date )
select event_id, event_name,event_slug, event_start_date from ladose.wp_em_events
where event_id not in (select Id from WPEvent);
INSERT INTO WPUser (Id, Name, WPUSerLogin, WPMail)
select ID, display_name, user_login , user_email from ladose.wp_users
where ID not in (select Id from WPUser);
DELETE a from WPBooking a
INNER JOIN ladose.wp_em_bookings b ON b.event_id = a.WPEventId AND b.person_id = a.WPUserId
WHERE b.booking_status = 3;
INSERT INTO WPBooking (WPEventId, WPUserId, Message, Meta)
select event_id, person_id, booking_comment , booking_meta from ladose.wp_em_bookings b
where (event_id , person_id) not in (select WPEventId,WPUserId from WPBooking) and b.booking_status = 1;
-- Supression des joueurs qui ont un event annulé.
-- Maj des nom d'utilisateur
-- UPDATE WPUser a
-- INNER JOIN ladose.wp_users b ON a.Id = b.ID
-- SET a.Name = b.display_name
-- WHERE b.display_name != a.Name;
END//
DELIMITER ;
-- Dumping structure for table ladoseapi.Player
DROP TABLE IF EXISTS `Player`;
CREATE TABLE IF NOT EXISTS `Player` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`Name` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
`ChallongeId` int(11) DEFAULT NULL,
`SmashId` int(11) DEFAULT NULL,
`Gamertag` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
KEY `Id` (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=151 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Data exporting was unselected.
-- Dumping structure for table ladoseapi.Result
DROP TABLE IF EXISTS `Result`;
CREATE TABLE IF NOT EXISTS `Result` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`PlayerId` int(11) NOT NULL DEFAULT 0,
`TournamentId` int(11) NOT NULL DEFAULT 0,
`Point` int(11) NOT NULL DEFAULT 0,
`Rank` int(11) NOT NULL DEFAULT 0,
PRIMARY KEY (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=546 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Data exporting was unselected.
-- Dumping structure for table ladoseapi.Set
DROP TABLE IF EXISTS `Set`;
CREATE TABLE IF NOT EXISTS `Set` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`TournamentId` int(11) NOT NULL,
`Player1Id` int(11) NOT NULL,
`Player2Id` int(11) NOT NULL,
`Player1Score` int(11) DEFAULT NULL,
`Player2Score` int(11) DEFAULT NULL,
`Round` int(11) NOT NULL,
PRIMARY KEY (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=551 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Data exporting was unselected.
-- Dumping structure for table ladoseapi.SmashParticipent
DROP TABLE IF EXISTS `SmashParticipent`;
CREATE TABLE IF NOT EXISTS `SmashParticipent` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`Name` varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`Tag` varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`SmashId` int(11) NOT NULL DEFAULT 0,
PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Data exporting was unselected.
-- Dumping structure for table ladoseapi.Todo
DROP TABLE IF EXISTS `Todo`;
CREATE TABLE IF NOT EXISTS `Todo` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`User` varchar(45) NOT NULL,
`Task` mediumtext DEFAULT NULL,
`Done` tinyint(4) NOT NULL DEFAULT 0,
`Created` datetime NOT NULL,
`Deleted` datetime DEFAULT NULL,
PRIMARY KEY (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8mb3;
-- Data exporting was unselected.
-- Dumping structure for table ladoseapi.Tournament
DROP TABLE IF EXISTS `Tournament`;
CREATE TABLE IF NOT EXISTS `Tournament` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`Name` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
`SmashId` int(11) DEFAULT NULL,
`ChallongeId` int(11) DEFAULT NULL,
`EventId` int(11) DEFAULT NULL,
`GameId` int(11) DEFAULT NULL,
`Finish` bit(1) NOT NULL,
PRIMARY KEY (`Id`),
UNIQUE KEY `UNIQ_SmashId` (`SmashId`)
) ENGINE=InnoDB AUTO_INCREMENT=41 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Data exporting was unselected.
-- Dumping structure for table ladoseapi.WPBooking
DROP TABLE IF EXISTS `WPBooking`;
CREATE TABLE IF NOT EXISTS `WPBooking` (
`WPEventId` int(11) DEFAULT NULL,
`WPUserId` int(11) DEFAULT NULL,
`Message` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`Meta` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
-- Data exporting was unselected.
-- Dumping structure for table ladoseapi.WPEvent
DROP TABLE IF EXISTS `WPEvent`;
CREATE TABLE IF NOT EXISTS `WPEvent` (
`Id` int(11) NOT NULL,
`Name` varchar(255) DEFAULT NULL,
`Slug` varchar(255) DEFAULT NULL,
`Date` date DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
-- Data exporting was unselected.
-- Dumping structure for table ladoseapi.WPUser
DROP TABLE IF EXISTS `WPUser`;
CREATE TABLE IF NOT EXISTS `WPUser` (
`Id` int(11) NOT NULL,
`Name` varchar(45) DEFAULT NULL,
`WPUserLogin` varchar(45) DEFAULT NULL,
`WPMail` varchar(45) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
-- Data exporting was unselected.
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
/*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;

View File

@@ -1,271 +0,0 @@
-- --------------------------------------------------------
-- Host: 192.168.20.36
-- Server version: 10.7.3-MariaDB - Arch Linux
-- Server OS: Linux
-- HeidiSQL Version: 10.2.0.5599
-- --------------------------------------------------------
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET NAMES utf8 */;
/*!50503 SET NAMES utf8mb4 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
-- Dumping database structure for ladoseapi
CREATE DATABASE IF NOT EXISTS `ladoseapi` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci */;
USE `ladoseapi`;
-- Dumping structure for table ladoseapi.ApplicationRole
CREATE TABLE IF NOT EXISTS `ApplicationRole` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`Name` varchar(50) NOT NULL,
PRIMARY KEY (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb3;
-- Data exporting was unselected.
-- Dumping structure for table ladoseapi.ApplicationUser
CREATE TABLE IF NOT EXISTS `ApplicationUser` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`FirstName` varchar(45) DEFAULT NULL,
`LastName` varchar(45) DEFAULT NULL,
`UserName` varchar(45) DEFAULT NULL,
`PasswordHash` blob DEFAULT NULL,
`PasswordSalt` blob DEFAULT NULL,
PRIMARY KEY (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4;
-- Data exporting was unselected.
-- Dumping structure for table ladoseapi.ApplicationUserRole
CREATE TABLE IF NOT EXISTS `ApplicationUserRole` (
`UserId` int(11) NOT NULL,
`RoleId` int(11) NOT NULL,
UNIQUE KEY `UserId_RoleId` (`UserId`,`RoleId`),
KEY `FK_ApplicationUserRole_ApplicationRole` (`RoleId`),
CONSTRAINT `FK_ApplicationUserRole_ApplicationRole` FOREIGN KEY (`RoleId`) REFERENCES `ApplicationRole` (`Id`),
CONSTRAINT `FK_ApplicationUserRole_ApplicationUser` FOREIGN KEY (`UserId`) REFERENCES `ApplicationUser` (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
-- Data exporting was unselected.
-- Dumping structure for table ladoseapi.BotEvent
CREATE TABLE IF NOT EXISTS `BotEvent` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`Name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`Date` date NOT NULL DEFAULT current_timestamp(),
PRIMARY KEY (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Data exporting was unselected.
-- Dumping structure for table ladoseapi.BotEventResult
CREATE TABLE IF NOT EXISTS `BotEventResult` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`BotEventId` int(11) NOT NULL,
`Name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`DiscordId` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`Result` bit(1) NOT NULL DEFAULT b'0',
PRIMARY KEY (`Id`),
KEY `FK_BotEvent_BotEvent` (`BotEventId`),
CONSTRAINT `FK_BotEvent_BotEvent` FOREIGN KEY (`BotEventId`) REFERENCES `BotEvent` (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Data exporting was unselected.
-- Dumping structure for table ladoseapi.ChallongeParticipent
CREATE TABLE IF NOT EXISTS `ChallongeParticipent` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`ChallongeId` int(11) NOT NULL DEFAULT 0,
`ChallongeTournamentId` int(11) NOT NULL DEFAULT 0,
`Name` varchar(500) NOT NULL DEFAULT '0',
`Rank` int(11) DEFAULT 0,
`IsMember` bit(1) DEFAULT NULL,
PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
-- Data exporting was unselected.
-- Dumping structure for table ladoseapi.ChallongeTournament
CREATE TABLE IF NOT EXISTS `ChallongeTournament` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`ChallongeId` int(11) NOT NULL DEFAULT 0,
`Name` varchar(500) DEFAULT NULL,
`GameId` int(11) DEFAULT NULL,
`Url` varchar(255) DEFAULT NULL,
`Sync` datetime NOT NULL DEFAULT current_timestamp(),
PRIMARY KEY (`Id`),
KEY `ChallongeTournament_GameIdPK` (`GameId`),
CONSTRAINT `ChallongeTournament_GameIdPK` FOREIGN KEY (`GameId`) REFERENCES `Game` (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
-- Data exporting was unselected.
-- Dumping structure for table ladoseapi.Event
CREATE TABLE IF NOT EXISTS `Event` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`Name` varchar(255) NOT NULL,
`Date` datetime NOT NULL,
`SmashId` int(11) DEFAULT NULL,
`SmashSlug` varchar(255) DEFAULT NULL,
PRIMARY KEY (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8mb3;
-- Data exporting was unselected.
-- Dumping structure for table ladoseapi.Game
CREATE TABLE IF NOT EXISTS `Game` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`Name` varchar(45) CHARACTER SET utf8mb3 DEFAULT NULL,
`ImgUrl` varchar(255) CHARACTER SET utf8mb3 DEFAULT NULL,
`WordPressTag` varchar(255) DEFAULT NULL,
`WordPressTagOs` varchar(255) DEFAULT NULL,
`Order` int(11) NOT NULL DEFAULT 0,
`LongName` varchar(255) DEFAULT NULL,
`SmashId` int(11) DEFAULT NULL,
PRIMARY KEY (`Id`),
UNIQUE KEY `name_UNIQUE` (`Name`)
) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=utf8mb4;
-- Data exporting was unselected.
-- Dumping structure for procedure ladoseapi.ImportEvent
DELIMITER //
CREATE DEFINER=`ladoseapi`@`%` PROCEDURE `ImportEvent`()
BEGIN
INSERT INTO WPEvent (Id, Name,Slug,Date )
select event_id, event_name,event_slug, event_start_date from ladose.wp_em_events
where event_id not in (select Id from WPEvent);
INSERT INTO WPUser (Id, Name, WPUSerLogin, WPMail)
select ID, display_name, user_login , user_email from ladose.wp_users
where ID not in (select Id from WPUser);
DELETE a from WPBooking a
INNER JOIN ladose.wp_em_bookings b ON b.event_id = a.WPEventId AND b.person_id = a.WPUserId
WHERE b.booking_status = 3;
INSERT INTO WPBooking (WPEventId, WPUserId, Message, Meta)
select event_id, person_id, booking_comment , booking_meta from ladose.wp_em_bookings b
where (event_id , person_id) not in (select WPEventId,WPUserId from WPBooking) and b.booking_status = 1;
-- Supression des joueurs qui ont un event annulé.
-- Maj des nom d'utilisateur
-- UPDATE WPUser a
-- INNER JOIN ladose.wp_users b ON a.Id = b.ID
-- SET a.Name = b.display_name
-- WHERE b.display_name != a.Name;
END//
DELIMITER ;
-- Dumping structure for table ladoseapi.Player
CREATE TABLE IF NOT EXISTS `Player` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`Name` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
`ChallongeId` int(11) DEFAULT NULL,
`SmashId` int(11) DEFAULT NULL,
`Gamertag` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
KEY `Id` (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=176 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Data exporting was unselected.
-- Dumping structure for table ladoseapi.Result
CREATE TABLE IF NOT EXISTS `Result` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`PlayerId` int(11) NOT NULL DEFAULT 0,
`TournamentId` int(11) NOT NULL DEFAULT 0,
`Point` int(11) NOT NULL DEFAULT 0,
`Rank` int(11) NOT NULL DEFAULT 0,
PRIMARY KEY (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=1207 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Data exporting was unselected.
-- Dumping structure for table ladoseapi.Set
CREATE TABLE IF NOT EXISTS `Set` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`TournamentId` int(11) NOT NULL,
`Player1Id` int(11) NOT NULL,
`Player2Id` int(11) NOT NULL,
`Player1Score` int(11) DEFAULT NULL,
`Player2Score` int(11) DEFAULT NULL,
`Round` int(11) NOT NULL,
PRIMARY KEY (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=1870 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Data exporting was unselected.
-- Dumping structure for table ladoseapi.SmashParticipent
CREATE TABLE IF NOT EXISTS `SmashParticipent` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`Name` varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`Tag` varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`SmashId` int(11) NOT NULL DEFAULT 0,
PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Data exporting was unselected.
-- Dumping structure for table ladoseapi.Todo
CREATE TABLE IF NOT EXISTS `Todo` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`User` varchar(45) NOT NULL,
`Task` mediumtext DEFAULT NULL,
`Done` tinyint(4) NOT NULL DEFAULT 0,
`Created` datetime NOT NULL,
`Deleted` datetime DEFAULT NULL,
PRIMARY KEY (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8mb3;
-- Data exporting was unselected.
-- Dumping structure for table ladoseapi.Tournament
CREATE TABLE IF NOT EXISTS `Tournament` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`Name` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
`SmashId` int(11) DEFAULT NULL,
`ChallongeId` int(11) DEFAULT NULL,
`EventId` int(11) DEFAULT NULL,
`GameId` int(11) DEFAULT NULL,
`Finish` bit(1) NOT NULL,
PRIMARY KEY (`Id`),
UNIQUE KEY `UNIQ_SmashId` (`SmashId`)
) ENGINE=InnoDB AUTO_INCREMENT=87 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Data exporting was unselected.
-- Dumping structure for table ladoseapi.WPBooking
CREATE TABLE IF NOT EXISTS `WPBooking` (
`WPEventId` int(11) DEFAULT NULL,
`WPUserId` int(11) DEFAULT NULL,
`Message` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`Meta` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
-- Data exporting was unselected.
-- Dumping structure for table ladoseapi.WPEvent
CREATE TABLE IF NOT EXISTS `WPEvent` (
`Id` int(11) NOT NULL,
`Name` varchar(255) DEFAULT NULL,
`Slug` varchar(255) DEFAULT NULL,
`Date` date DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
-- Data exporting was unselected.
-- Dumping structure for table ladoseapi.WPUser
CREATE TABLE IF NOT EXISTS `WPUser` (
`Id` int(11) NOT NULL,
`Name` varchar(45) DEFAULT NULL,
`WPUserLogin` varchar(45) DEFAULT NULL,
`WPMail` varchar(45) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
-- Data exporting was unselected.
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
/*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;

831
Sql/dump_20240316.sql Normal file
View File

@@ -0,0 +1,831 @@
--
-- PostgreSQL database dump
--
-- Dumped from database version 16.1
-- Dumped by pg_dump version 16.2
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;
--
-- Name: ladoseapi; Type: SCHEMA; Schema: -; Owner: tom
--
CREATE SCHEMA ladoseapi;
ALTER SCHEMA ladoseapi OWNER TO tom;
SET default_tablespace = '';
SET default_table_access_method = heap;
--
-- Name: applicationrole; Type: TABLE; Schema: ladoseapi; Owner: tom
--
CREATE TABLE ladoseapi.applicationrole (
id bigint NOT NULL,
name character varying(50) NOT NULL
);
ALTER TABLE ladoseapi.applicationrole OWNER TO tom;
--
-- Name: applicationrole_id_seq; Type: SEQUENCE; Schema: ladoseapi; Owner: tom
--
CREATE SEQUENCE ladoseapi.applicationrole_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE ladoseapi.applicationrole_id_seq OWNER TO tom;
--
-- Name: applicationrole_id_seq; Type: SEQUENCE OWNED BY; Schema: ladoseapi; Owner: tom
--
ALTER SEQUENCE ladoseapi.applicationrole_id_seq OWNED BY ladoseapi.applicationrole.id;
--
-- Name: applicationuser; Type: TABLE; Schema: ladoseapi; Owner: tom
--
CREATE TABLE ladoseapi.applicationuser (
id bigint NOT NULL,
firstname character varying(45) DEFAULT NULL::character varying,
lastname character varying(45) DEFAULT NULL::character varying,
username character varying(45) DEFAULT NULL::character varying,
passwordhash bytea,
passwordsalt bytea
);
ALTER TABLE ladoseapi.applicationuser OWNER TO tom;
--
-- Name: applicationuser_id_seq; Type: SEQUENCE; Schema: ladoseapi; Owner: tom
--
CREATE SEQUENCE ladoseapi.applicationuser_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE ladoseapi.applicationuser_id_seq OWNER TO tom;
--
-- Name: applicationuser_id_seq; Type: SEQUENCE OWNED BY; Schema: ladoseapi; Owner: tom
--
ALTER SEQUENCE ladoseapi.applicationuser_id_seq OWNED BY ladoseapi.applicationuser.id;
--
-- Name: applicationuserrole; Type: TABLE; Schema: ladoseapi; Owner: tom
--
CREATE TABLE ladoseapi.applicationuserrole (
userid bigint NOT NULL,
roleid bigint NOT NULL
);
ALTER TABLE ladoseapi.applicationuserrole OWNER TO tom;
--
-- Name: botevent; Type: TABLE; Schema: ladoseapi; Owner: tom
--
CREATE TABLE ladoseapi.botevent (
id bigint NOT NULL,
name character varying(50) NOT NULL,
date date DEFAULT CURRENT_TIMESTAMP NOT NULL
);
ALTER TABLE ladoseapi.botevent OWNER TO tom;
--
-- Name: botevent_id_seq; Type: SEQUENCE; Schema: ladoseapi; Owner: tom
--
CREATE SEQUENCE ladoseapi.botevent_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE ladoseapi.botevent_id_seq OWNER TO tom;
--
-- Name: botevent_id_seq; Type: SEQUENCE OWNED BY; Schema: ladoseapi; Owner: tom
--
ALTER SEQUENCE ladoseapi.botevent_id_seq OWNED BY ladoseapi.botevent.id;
--
-- Name: boteventresult; Type: TABLE; Schema: ladoseapi; Owner: tom
--
CREATE TABLE ladoseapi.boteventresult (
id bigint NOT NULL,
boteventid bigint NOT NULL,
name character varying(50) NOT NULL,
discordid character varying(50) NOT NULL,
result boolean NOT NULL
);
ALTER TABLE ladoseapi.boteventresult OWNER TO tom;
--
-- Name: boteventresult_id_seq; Type: SEQUENCE; Schema: ladoseapi; Owner: tom
--
CREATE SEQUENCE ladoseapi.boteventresult_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE ladoseapi.boteventresult_id_seq OWNER TO tom;
--
-- Name: boteventresult_id_seq; Type: SEQUENCE OWNED BY; Schema: ladoseapi; Owner: tom
--
ALTER SEQUENCE ladoseapi.boteventresult_id_seq OWNED BY ladoseapi.boteventresult.id;
--
-- Name: challongeparticipent; Type: TABLE; Schema: ladoseapi; Owner: tom
--
CREATE TABLE ladoseapi.challongeparticipent (
id bigint NOT NULL,
challongeid bigint DEFAULT '0'::bigint NOT NULL,
challongetournamentid bigint DEFAULT '0'::bigint NOT NULL,
name character varying(500) DEFAULT '0'::character varying NOT NULL,
rank bigint DEFAULT '0'::bigint,
ismember boolean
);
ALTER TABLE ladoseapi.challongeparticipent OWNER TO tom;
--
-- Name: challongeparticipent_id_seq; Type: SEQUENCE; Schema: ladoseapi; Owner: tom
--
CREATE SEQUENCE ladoseapi.challongeparticipent_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE ladoseapi.challongeparticipent_id_seq OWNER TO tom;
--
-- Name: challongeparticipent_id_seq; Type: SEQUENCE OWNED BY; Schema: ladoseapi; Owner: tom
--
ALTER SEQUENCE ladoseapi.challongeparticipent_id_seq OWNED BY ladoseapi.challongeparticipent.id;
--
-- Name: challongetournament; Type: TABLE; Schema: ladoseapi; Owner: tom
--
CREATE TABLE ladoseapi.challongetournament (
id bigint NOT NULL,
challongeid bigint DEFAULT '0'::bigint NOT NULL,
name character varying(500) DEFAULT NULL::character varying,
gameid bigint,
url character varying(255) DEFAULT NULL::character varying,
sync timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL
);
ALTER TABLE ladoseapi.challongetournament OWNER TO tom;
--
-- Name: challongetournament_id_seq; Type: SEQUENCE; Schema: ladoseapi; Owner: tom
--
CREATE SEQUENCE ladoseapi.challongetournament_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE ladoseapi.challongetournament_id_seq OWNER TO tom;
--
-- Name: challongetournament_id_seq; Type: SEQUENCE OWNED BY; Schema: ladoseapi; Owner: tom
--
ALTER SEQUENCE ladoseapi.challongetournament_id_seq OWNED BY ladoseapi.challongetournament.id;
--
-- Name: event; Type: TABLE; Schema: ladoseapi; Owner: tom
--
CREATE TABLE ladoseapi.event (
id bigint NOT NULL,
name character varying(255) NOT NULL,
date timestamp with time zone NOT NULL,
smashid bigint,
smashslug character varying(255) DEFAULT NULL::character varying
);
ALTER TABLE ladoseapi.event OWNER TO tom;
--
-- Name: event_id_seq; Type: SEQUENCE; Schema: ladoseapi; Owner: tom
--
CREATE SEQUENCE ladoseapi.event_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE ladoseapi.event_id_seq OWNER TO tom;
--
-- Name: event_id_seq; Type: SEQUENCE OWNED BY; Schema: ladoseapi; Owner: tom
--
ALTER SEQUENCE ladoseapi.event_id_seq OWNED BY ladoseapi.event.id;
--
-- Name: game; Type: TABLE; Schema: ladoseapi; Owner: tom
--
CREATE TABLE ladoseapi.game (
id bigint NOT NULL,
name character varying(45) DEFAULT NULL::character varying,
imgurl character varying(255) DEFAULT NULL::character varying,
wordpresstag character varying(255) DEFAULT NULL::character varying,
wordpresstagos character varying(255) DEFAULT NULL::character varying,
"order" bigint DEFAULT '0'::bigint NOT NULL,
longname character varying(255) DEFAULT NULL::character varying,
smashid bigint
);
ALTER TABLE ladoseapi.game OWNER TO tom;
--
-- Name: game_id_seq; Type: SEQUENCE; Schema: ladoseapi; Owner: tom
--
CREATE SEQUENCE ladoseapi.game_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE ladoseapi.game_id_seq OWNER TO tom;
--
-- Name: game_id_seq; Type: SEQUENCE OWNED BY; Schema: ladoseapi; Owner: tom
--
ALTER SEQUENCE ladoseapi.game_id_seq OWNED BY ladoseapi.game.id;
--
-- Name: player; Type: TABLE; Schema: ladoseapi; Owner: tom
--
CREATE TABLE ladoseapi.player (
id bigint NOT NULL,
name character varying(150) NOT NULL,
challongeid bigint,
smashid bigint,
gamertag character varying(150) DEFAULT NULL::character varying
);
ALTER TABLE ladoseapi.player OWNER TO tom;
--
-- Name: player_id_seq; Type: SEQUENCE; Schema: ladoseapi; Owner: tom
--
CREATE SEQUENCE ladoseapi.player_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE ladoseapi.player_id_seq OWNER TO tom;
--
-- Name: player_id_seq; Type: SEQUENCE OWNED BY; Schema: ladoseapi; Owner: tom
--
ALTER SEQUENCE ladoseapi.player_id_seq OWNED BY ladoseapi.player.id;
--
-- Name: result; Type: TABLE; Schema: ladoseapi; Owner: tom
--
CREATE TABLE ladoseapi.result (
id bigint NOT NULL,
playerid bigint DEFAULT '0'::bigint NOT NULL,
tournamentid bigint DEFAULT '0'::bigint NOT NULL,
point bigint DEFAULT '0'::bigint NOT NULL,
rank bigint DEFAULT '0'::bigint NOT NULL
);
ALTER TABLE ladoseapi.result OWNER TO tom;
--
-- Name: result_id_seq; Type: SEQUENCE; Schema: ladoseapi; Owner: tom
--
CREATE SEQUENCE ladoseapi.result_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE ladoseapi.result_id_seq OWNER TO tom;
--
-- Name: result_id_seq; Type: SEQUENCE OWNED BY; Schema: ladoseapi; Owner: tom
--
ALTER SEQUENCE ladoseapi.result_id_seq OWNED BY ladoseapi.result.id;
--
-- Name: set; Type: TABLE; Schema: ladoseapi; Owner: tom
--
CREATE TABLE ladoseapi.set (
id bigint NOT NULL,
tournamentid bigint NOT NULL,
player1id bigint NOT NULL,
player2id bigint NOT NULL,
player1score bigint,
player2score bigint,
round bigint NOT NULL
);
ALTER TABLE ladoseapi.set OWNER TO tom;
--
-- Name: set_id_seq; Type: SEQUENCE; Schema: ladoseapi; Owner: tom
--
CREATE SEQUENCE ladoseapi.set_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE ladoseapi.set_id_seq OWNER TO tom;
--
-- Name: set_id_seq; Type: SEQUENCE OWNED BY; Schema: ladoseapi; Owner: tom
--
ALTER SEQUENCE ladoseapi.set_id_seq OWNED BY ladoseapi.set.id;
--
-- Name: todo; Type: TABLE; Schema: ladoseapi; Owner: tom
--
CREATE TABLE ladoseapi.todo (
id bigint NOT NULL,
"user" character varying(45) NOT NULL,
task text,
done smallint DEFAULT '0'::smallint NOT NULL,
created timestamp with time zone NOT NULL,
deleted timestamp with time zone
);
ALTER TABLE ladoseapi.todo OWNER TO tom;
--
-- Name: todo_id_seq; Type: SEQUENCE; Schema: ladoseapi; Owner: tom
--
CREATE SEQUENCE ladoseapi.todo_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE ladoseapi.todo_id_seq OWNER TO tom;
--
-- Name: todo_id_seq; Type: SEQUENCE OWNED BY; Schema: ladoseapi; Owner: tom
--
ALTER SEQUENCE ladoseapi.todo_id_seq OWNED BY ladoseapi.todo.id;
--
-- Name: tournament; Type: TABLE; Schema: ladoseapi; Owner: tom
--
CREATE TABLE ladoseapi.tournament (
id bigint NOT NULL,
name character varying(150) NOT NULL,
smashid bigint,
challongeid bigint,
eventid bigint,
gameid bigint,
finish boolean NOT NULL
);
ALTER TABLE ladoseapi.tournament OWNER TO tom;
--
-- Name: tournament_id_seq; Type: SEQUENCE; Schema: ladoseapi; Owner: tom
--
CREATE SEQUENCE ladoseapi.tournament_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE ladoseapi.tournament_id_seq OWNER TO tom;
--
-- Name: tournament_id_seq; Type: SEQUENCE OWNED BY; Schema: ladoseapi; Owner: tom
--
ALTER SEQUENCE ladoseapi.tournament_id_seq OWNED BY ladoseapi.tournament.id;
--
-- Name: wpbooking; Type: TABLE; Schema: ladoseapi; Owner: tom
--
CREATE TABLE ladoseapi.wpbooking (
wpeventid bigint,
wpuserid bigint,
message text,
meta text
);
ALTER TABLE ladoseapi.wpbooking OWNER TO tom;
--
-- Name: wpevent; Type: TABLE; Schema: ladoseapi; Owner: tom
--
CREATE TABLE ladoseapi.wpevent (
id bigint NOT NULL,
name character varying(255) DEFAULT NULL::character varying,
slug character varying(255) DEFAULT NULL::character varying,
date date
);
ALTER TABLE ladoseapi.wpevent OWNER TO tom;
--
-- Name: wpuser; Type: TABLE; Schema: ladoseapi; Owner: tom
--
CREATE TABLE ladoseapi.wpuser (
id bigint NOT NULL,
name character varying(45) DEFAULT NULL::character varying,
wpuserlogin character varying(45) DEFAULT NULL::character varying,
wpmail character varying(45) DEFAULT NULL::character varying
);
ALTER TABLE ladoseapi.wpuser OWNER TO tom;
--
-- Name: applicationrole id; Type: DEFAULT; Schema: ladoseapi; Owner: tom
--
ALTER TABLE ONLY ladoseapi.applicationrole ALTER COLUMN id SET DEFAULT nextval('ladoseapi.applicationrole_id_seq'::regclass);
--
-- Name: applicationuser id; Type: DEFAULT; Schema: ladoseapi; Owner: tom
--
ALTER TABLE ONLY ladoseapi.applicationuser ALTER COLUMN id SET DEFAULT nextval('ladoseapi.applicationuser_id_seq'::regclass);
--
-- Name: botevent id; Type: DEFAULT; Schema: ladoseapi; Owner: tom
--
ALTER TABLE ONLY ladoseapi.botevent ALTER COLUMN id SET DEFAULT nextval('ladoseapi.botevent_id_seq'::regclass);
--
-- Name: boteventresult id; Type: DEFAULT; Schema: ladoseapi; Owner: tom
--
ALTER TABLE ONLY ladoseapi.boteventresult ALTER COLUMN id SET DEFAULT nextval('ladoseapi.boteventresult_id_seq'::regclass);
--
-- Name: challongeparticipent id; Type: DEFAULT; Schema: ladoseapi; Owner: tom
--
ALTER TABLE ONLY ladoseapi.challongeparticipent ALTER COLUMN id SET DEFAULT nextval('ladoseapi.challongeparticipent_id_seq'::regclass);
--
-- Name: challongetournament id; Type: DEFAULT; Schema: ladoseapi; Owner: tom
--
ALTER TABLE ONLY ladoseapi.challongetournament ALTER COLUMN id SET DEFAULT nextval('ladoseapi.challongetournament_id_seq'::regclass);
--
-- Name: event id; Type: DEFAULT; Schema: ladoseapi; Owner: tom
--
ALTER TABLE ONLY ladoseapi.event ALTER COLUMN id SET DEFAULT nextval('ladoseapi.event_id_seq'::regclass);
--
-- Name: game id; Type: DEFAULT; Schema: ladoseapi; Owner: tom
--
ALTER TABLE ONLY ladoseapi.game ALTER COLUMN id SET DEFAULT nextval('ladoseapi.game_id_seq'::regclass);
--
-- Name: player id; Type: DEFAULT; Schema: ladoseapi; Owner: tom
--
ALTER TABLE ONLY ladoseapi.player ALTER COLUMN id SET DEFAULT nextval('ladoseapi.player_id_seq'::regclass);
--
-- Name: result id; Type: DEFAULT; Schema: ladoseapi; Owner: tom
--
ALTER TABLE ONLY ladoseapi.result ALTER COLUMN id SET DEFAULT nextval('ladoseapi.result_id_seq'::regclass);
--
-- Name: set id; Type: DEFAULT; Schema: ladoseapi; Owner: tom
--
ALTER TABLE ONLY ladoseapi.set ALTER COLUMN id SET DEFAULT nextval('ladoseapi.set_id_seq'::regclass);
--
-- Name: todo id; Type: DEFAULT; Schema: ladoseapi; Owner: tom
--
ALTER TABLE ONLY ladoseapi.todo ALTER COLUMN id SET DEFAULT nextval('ladoseapi.todo_id_seq'::regclass);
--
-- Name: tournament id; Type: DEFAULT; Schema: ladoseapi; Owner: tom
--
ALTER TABLE ONLY ladoseapi.tournament ALTER COLUMN id SET DEFAULT nextval('ladoseapi.tournament_id_seq'::regclass);
--
-- Name: applicationrole idx_17720_primary; Type: CONSTRAINT; Schema: ladoseapi; Owner: tom
--
ALTER TABLE ONLY ladoseapi.applicationrole
ADD CONSTRAINT idx_17720_primary PRIMARY KEY (id);
--
-- Name: applicationuser idx_17725_primary; Type: CONSTRAINT; Schema: ladoseapi; Owner: tom
--
ALTER TABLE ONLY ladoseapi.applicationuser
ADD CONSTRAINT idx_17725_primary PRIMARY KEY (id);
--
-- Name: botevent idx_17738_primary; Type: CONSTRAINT; Schema: ladoseapi; Owner: tom
--
ALTER TABLE ONLY ladoseapi.botevent
ADD CONSTRAINT idx_17738_primary PRIMARY KEY (id);
--
-- Name: boteventresult idx_17744_primary; Type: CONSTRAINT; Schema: ladoseapi; Owner: tom
--
ALTER TABLE ONLY ladoseapi.boteventresult
ADD CONSTRAINT idx_17744_primary PRIMARY KEY (id);
--
-- Name: challongeparticipent idx_17749_primary; Type: CONSTRAINT; Schema: ladoseapi; Owner: tom
--
ALTER TABLE ONLY ladoseapi.challongeparticipent
ADD CONSTRAINT idx_17749_primary PRIMARY KEY (id);
--
-- Name: challongetournament idx_17760_primary; Type: CONSTRAINT; Schema: ladoseapi; Owner: tom
--
ALTER TABLE ONLY ladoseapi.challongetournament
ADD CONSTRAINT idx_17760_primary PRIMARY KEY (id);
--
-- Name: event idx_17771_primary; Type: CONSTRAINT; Schema: ladoseapi; Owner: tom
--
ALTER TABLE ONLY ladoseapi.event
ADD CONSTRAINT idx_17771_primary PRIMARY KEY (id);
--
-- Name: game idx_17779_primary; Type: CONSTRAINT; Schema: ladoseapi; Owner: tom
--
ALTER TABLE ONLY ladoseapi.game
ADD CONSTRAINT idx_17779_primary PRIMARY KEY (id);
--
-- Name: result idx_17798_primary; Type: CONSTRAINT; Schema: ladoseapi; Owner: tom
--
ALTER TABLE ONLY ladoseapi.result
ADD CONSTRAINT idx_17798_primary PRIMARY KEY (id);
--
-- Name: set idx_17807_primary; Type: CONSTRAINT; Schema: ladoseapi; Owner: tom
--
ALTER TABLE ONLY ladoseapi.set
ADD CONSTRAINT idx_17807_primary PRIMARY KEY (id);
--
-- Name: todo idx_17812_primary; Type: CONSTRAINT; Schema: ladoseapi; Owner: tom
--
ALTER TABLE ONLY ladoseapi.todo
ADD CONSTRAINT idx_17812_primary PRIMARY KEY (id);
--
-- Name: tournament idx_17820_primary; Type: CONSTRAINT; Schema: ladoseapi; Owner: tom
--
ALTER TABLE ONLY ladoseapi.tournament
ADD CONSTRAINT idx_17820_primary PRIMARY KEY (id);
--
-- Name: idx_17734_fk_applicationuserrole_applicationrole; Type: INDEX; Schema: ladoseapi; Owner: tom
--
CREATE INDEX idx_17734_fk_applicationuserrole_applicationrole ON ladoseapi.applicationuserrole USING btree (roleid);
--
-- Name: idx_17734_userid_roleid; Type: INDEX; Schema: ladoseapi; Owner: tom
--
CREATE UNIQUE INDEX idx_17734_userid_roleid ON ladoseapi.applicationuserrole USING btree (userid, roleid);
--
-- Name: idx_17744_fk_botevent_botevent; Type: INDEX; Schema: ladoseapi; Owner: tom
--
CREATE INDEX idx_17744_fk_botevent_botevent ON ladoseapi.boteventresult USING btree (boteventid);
--
-- Name: idx_17760_challongetournament_gameidpk; Type: INDEX; Schema: ladoseapi; Owner: tom
--
CREATE INDEX idx_17760_challongetournament_gameidpk ON ladoseapi.challongetournament USING btree (gameid);
--
-- Name: idx_17779_name_unique; Type: INDEX; Schema: ladoseapi; Owner: tom
--
CREATE UNIQUE INDEX idx_17779_name_unique ON ladoseapi.game USING btree (name);
--
-- Name: idx_17792_id; Type: INDEX; Schema: ladoseapi; Owner: tom
--
CREATE INDEX idx_17792_id ON ladoseapi.player USING btree (id);
--
-- Name: idx_17820_uniq_smashid; Type: INDEX; Schema: ladoseapi; Owner: tom
--
CREATE UNIQUE INDEX idx_17820_uniq_smashid ON ladoseapi.tournament USING btree (smashid);
--
-- Name: challongetournament challongetournament_gameidpk; Type: FK CONSTRAINT; Schema: ladoseapi; Owner: tom
--
ALTER TABLE ONLY ladoseapi.challongetournament
ADD CONSTRAINT challongetournament_gameidpk FOREIGN KEY (gameid) REFERENCES ladoseapi.game(id) ON UPDATE RESTRICT ON DELETE RESTRICT;
--
-- Name: applicationuserrole fk_applicationuserrole_applicationrole; Type: FK CONSTRAINT; Schema: ladoseapi; Owner: tom
--
ALTER TABLE ONLY ladoseapi.applicationuserrole
ADD CONSTRAINT fk_applicationuserrole_applicationrole FOREIGN KEY (roleid) REFERENCES ladoseapi.applicationrole(id) ON UPDATE RESTRICT ON DELETE RESTRICT;
--
-- Name: applicationuserrole fk_applicationuserrole_applicationuser; Type: FK CONSTRAINT; Schema: ladoseapi; Owner: tom
--
ALTER TABLE ONLY ladoseapi.applicationuserrole
ADD CONSTRAINT fk_applicationuserrole_applicationuser FOREIGN KEY (userid) REFERENCES ladoseapi.applicationuser(id) ON UPDATE RESTRICT ON DELETE RESTRICT;
--
-- Name: boteventresult fk_botevent_botevent; Type: FK CONSTRAINT; Schema: ladoseapi; Owner: tom
--
ALTER TABLE ONLY ladoseapi.boteventresult
ADD CONSTRAINT fk_botevent_botevent FOREIGN KEY (boteventid) REFERENCES ladoseapi.botevent(id) ON UPDATE RESTRICT ON DELETE RESTRICT;
--
-- PostgreSQL database dump complete
--