Compare commits

..

7 Commits

Author SHA1 Message Date
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
56 changed files with 2452 additions and 4467 deletions

View File

@@ -0,0 +1,64 @@
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: '6.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/net6.0/win-x64/
zip -rj build-linux64.zip ./LaDOSE.Src/LaDOSE.DesktopApp.Avalonia/bin/Release/net6.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: Release
uses: akkuman/gitea-release-action@v1
env:
with:
files: |-
build-winx64.zip
build-linux64.zip

View File

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

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

@@ -15,8 +15,8 @@
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" 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.Extensions.Configuration.Json" Version="3.1.8" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.4" /> <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.4" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="6.0.2" /> <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.11" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@@ -1,28 +1,19 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection; using System.Reflection;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using LaDOSE.Business.Interface; using LaDOSE.Business.Interface;
using LaDOSE.Business.Provider;
using LaDOSE.Business.Service; using LaDOSE.Business.Service;
using LaDOSE.Entity; using LaDOSE.Entity;
using LaDOSE.Entity.Context; using LaDOSE.Entity.Context;
using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
//using Microsoft.AspNetCore.HttpsPolicy;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Microsoft.IdentityModel.Tokens; using Microsoft.IdentityModel.Tokens;
using Pomelo.EntityFrameworkCore.MySql;
using Pomelo.EntityFrameworkCore.MySql.Infrastructure;
using AutoMapper; using AutoMapper;
using LaDOSE.Api.Helpers; using LaDOSE.Api.Helpers;
using LaDOSE.Business.Helper; using LaDOSE.Business.Helper;
@@ -32,6 +23,7 @@ using LaDOSE.Entity.Challonge;
using LaDOSE.Entity.Wordpress; using LaDOSE.Entity.Wordpress;
using Result = LaDOSE.Entity.Challonge.Result; using Result = LaDOSE.Entity.Challonge.Result;
using LaDOSE.Entity.BotEvent; using LaDOSE.Entity.BotEvent;
using Microsoft.EntityFrameworkCore.Storage;
namespace LaDOSE.Api namespace LaDOSE.Api
{ {
@@ -48,11 +40,6 @@ namespace LaDOSE.Api
public void ConfigureServices(IServiceCollection services) public void ConfigureServices(IServiceCollection services)
{ {
//Fix Gentoo Issue. //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"])) if (Convert.ToBoolean(this.Configuration["FixGentoo"]))
{ {
try try
@@ -82,9 +69,7 @@ namespace LaDOSE.Api
// )); // ));
services.AddDbContextPool<LaDOSEDbContext>(options => services.AddDbContextPool<LaDOSEDbContext>(options =>
{ {
options.UseMySql( options.UseNpgsql(Configuration.GetConnectionString("DbContext")).ReplaceService<ISqlGenerationHelper,NpgsqlSqlGenerationLowercaseHelper>();
$"Server={MySqlServer};Database={MySqlDatabase};User={MySqlUser};Password={MySqlPassword};",
new MariaDbServerVersion(new Version(10, 1)));
}); });
var key = Encoding.ASCII.GetBytes(this.Configuration["JWTTokenSecret"]); var key = Encoding.ASCII.GetBytes(this.Configuration["JWTTokenSecret"]);

View File

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

View File

@@ -5,4 +5,8 @@
<Platforms>AnyCPU;x64</Platforms> <Platforms>AnyCPU;x64</Platforms>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
</Project> </Project>

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,33 @@
using Avalonia;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Markup.Xaml;
using LaDOSE.DesktopApp.Avalonia.ViewModels;
using LaDOSE.DesktopApp.Avalonia.Views;
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,42 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
<ApplicationManifest>app.manifest</ApplicationManifest>
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
</PropertyGroup>
<ItemGroup>
<Folder Include="Models\"/>
<AvaloniaResource Include="Assets\**"/>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="11.0.10"/>
<PackageReference Include="Avalonia.Controls.DataGrid" Version="11.0.10" />
<PackageReference Include="Avalonia.Desktop" Version="11.0.10"/>
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.0.10"/>
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.0.10"/>
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.10"/>
<PackageReference Include="Avalonia.ReactiveUI" Version="11.0.10"/>
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0" />
</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,60 @@
using Avalonia;
using Avalonia.ReactiveUI;
using System;
using System.ComponentModel;
using System.IO;
using LaDOSE.REST;
using Microsoft.Extensions.Configuration;
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);
BuildAvaloniaApp()
.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.RegisterLazySingleton<RestService>(()=>
{
var restService = new RestService();
restService.Connect(new Uri(restUrl),restUser,restPassword);
return restService;
});
}
// Avalonia configuration, don't remove; also used by visual designer.
public static AppBuilder BuildAvaloniaApp()
=> AppBuilder
.Configure<App>()
.UsePlatformDetect()
.WithInterFont()
.LogToTrace()
.AfterSetup(_ =>
{
// CefRuntimeLoader.Initialize(new CefSettings()
// {
// WindowlessRenderingEnabled = true,
// NoSandbox = true,
// });
})
.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;
using System.Collections.Generic; using System.Collections.Generic;
namespace LaDOSE.DesktopApp.Utils namespace LaDOSE.DesktopApp.Avalonia.Utils
{ {
public static class CustomListExtension public static class CustomListExtension
{ {

View File

@@ -0,0 +1,86 @@
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 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 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 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.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime)
((IClassicDesktopStyleApplicationLifetime)Application.Current.ApplicationLifetime).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;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Data; using System.Data;
@@ -8,19 +7,19 @@ using System.Linq;
using System.Reflection; using System.Reflection;
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Windows.Controls; using Avalonia.Collections;
using System.Windows.Forms; using Avalonia.Controls;
using LaDOSE.DesktopApp.Utils; using LaDOSE.DesktopApp.Avalonia.Utils;
using LaDOSE.DTO; using LaDOSE.DTO;
using LaDOSE.REST; using LaDOSE.REST;
using SaveFileDialog = Microsoft.Win32.SaveFileDialog; using ReactiveUI;
using Screen = Caliburn.Micro.Screen; 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; //Dictionary<string, Dictionary<int, int>> _computedResult;
@@ -29,12 +28,6 @@ namespace LaDOSE.DesktopApp.ViewModels
private string css = string.Empty; 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
@@ -43,7 +36,7 @@ namespace LaDOSE.DesktopApp.ViewModels
set set
{ {
_selectRegex = value; _selectRegex = value;
NotifyOfPropertyChange(() => SelectRegex); RaisePropertyChanged(nameof(SelectRegex));
} }
} }
@@ -55,7 +48,7 @@ namespace LaDOSE.DesktopApp.ViewModels
set set
{ {
_selectEventRegex = value; _selectEventRegex = value;
NotifyOfPropertyChange(() => SelectEventRegex); RaisePropertyChanged(nameof(SelectEventRegex));
} }
} }
private string _slug; private string _slug;
@@ -65,7 +58,7 @@ namespace LaDOSE.DesktopApp.ViewModels
set set
{ {
_slug = value; _slug = value;
NotifyOfPropertyChange(() => Slug); RaisePropertyChanged(nameof(Slug));
} }
} }
@@ -87,34 +80,34 @@ namespace LaDOSE.DesktopApp.ViewModels
set set
{ {
_htmlContent = value; _htmlContent = value;
NotifyOfPropertyChange(() => HtmlContent); RaisePropertyChanged(nameof(HtmlContent));
NotifyOfPropertyChange(() => Html); RaisePropertyChanged(nameof(Html));
} }
} }
private DateTime _from; private DateTimeOffset _from;
public DateTime From public DateTimeOffset From
{ {
get { return _from; } get { return _from; }
set set
{ {
_from = value; _from = value;
NotifyOfPropertyChange(() => From); RaisePropertyChanged(nameof(From));
} }
} }
private DateTime _to; private DateTimeOffset _to;
public DateTime To public DateTimeOffset To
{ {
get { return _to; } get { return _to; }
set set
{ {
_to = value; _to = value;
NotifyOfPropertyChange(() => To); RaisePropertyChanged(nameof(To));
} }
} }
@@ -130,7 +123,7 @@ namespace LaDOSE.DesktopApp.ViewModels
set set
{ {
_results = value; _results = value;
NotifyOfPropertyChange(() => Results); RaisePropertyChanged(nameof(Results));
} }
} }
@@ -142,7 +135,7 @@ namespace LaDOSE.DesktopApp.ViewModels
set set
{ {
_selectedEvents = value; _selectedEvents = value;
NotifyOfPropertyChange(() => SelectedEvents); RaisePropertyChanged(nameof(SelectedEvents));
} }
} }
@@ -154,7 +147,7 @@ namespace LaDOSE.DesktopApp.ViewModels
set set
{ {
_selectedTournaments = value; _selectedTournaments = value;
NotifyOfPropertyChange(() => SelectedTournaments); RaisePropertyChanged(nameof(SelectedTournaments));
} }
} }
@@ -175,7 +168,7 @@ namespace LaDOSE.DesktopApp.ViewModels
SelectedGameResult = new ObservableCollection<ResultDTO>(resultForGame); SelectedGameResult = new ObservableCollection<ResultDTO>(resultForGame);
} }
NotifyOfPropertyChange(() => SelectedGame); RaisePropertyChanged(nameof(SelectedGame));
} }
} }
@@ -187,12 +180,13 @@ namespace LaDOSE.DesktopApp.ViewModels
set set
{ {
_selectedGameResult = value; _selectedGameResult = value;
NotifyOfPropertyChange(() => SelectedGameResult); RaisePropertyChanged(nameof(SelectedGameResult));
} }
} }
private String _first; private String _first;
private DataTable _gridDataTable; private DataTable _gridDataTable;
private string _error;
public String First public String First
{ {
@@ -200,65 +194,62 @@ namespace LaDOSE.DesktopApp.ViewModels
set set
{ {
_first = value; _first = value;
NotifyOfPropertyChange(() => First); RaisePropertyChanged(nameof(First));
} }
} }
#endregion #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>(); _selectedTournaments = new ObservableCollection<TournamentDTO>();
_selectedEvents = new ObservableCollection<EventDTO>(); _selectedEvents = new ObservableCollection<EventDTO>();
Tournaments = new List<TournamentDTO>(); Tournaments = new List<TournamentDTO>();
Events = new List<EventDTO>(); Events = new List<EventDTO>();
OnInitialize();
} }
protected override void OnInitialize() protected void OnInitialize()
{ {
var manifestResourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("LaDOSE.DesktopApp.Resources.css.css"); // var manifestResourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("LaDOSE.DesktopApp.Resources.css.css");
using (var sr = new StreamReader(manifestResourceStream)) // using (var sr = new StreamReader(manifestResourceStream))
{ // {
this.css = sr.ReadToEnd(); // this.css = sr.ReadToEnd();
} // }
this.To = DateTime.Now; this.To = new DateTimeOffset(DateTime.Now);
this.From = DateTime.Now.AddMonths(-1); this.From = new DateTimeOffset(DateTime.Now.AddMonths(-1));
this.SelectRegex = "Ranking"; this.SelectRegex = "Ranking";
this.SelectEventRegex = @"Ranking #10\d{2}"; this.SelectEventRegex = @"Ranking #10\d{2}";
this.Slug = "ranking-1001"; this.Slug = "ranking-1001";
LoadTournaments(); LoadTournaments();
LoadEvents(); LoadEvents();
base.OnInitialize();
} }
public void LoadTournaments() public void LoadTournaments()
{ {
WpfUtil.Await(() =>
{
var tournamentDtos = this.RestService
.GetTournaments(new TimeRangeDTO() {From = this.From, To = this.To}).ToList();
this.Tournaments = tournamentDtos;
NotifyOfPropertyChange("Tournaments"); // var tournamentDtos = this.RestService
}); // .GetTournaments(new TimeRangeDTO() {From = this.From, To = this.To}).ToList();
// this.Tournaments = tournamentDtos;
RaisePropertyChanged(nameof(Tournaments));
} }
public void LoadEvents() public void LoadEvents()
{ {
WpfUtil.Await(() =>
{
var eventsDtos = this.RestService var eventsDtos = this.RestService
.GetAllEvents().ToList(); .GetAllEvents().ToList();
this.Events = eventsDtos; this.Events = eventsDtos;
NotifyOfPropertyChange("Events"); RaisePropertyChanged(nameof(Events));
});
} }
public DataTable GridDataTable public DataTable GridDataTable
@@ -267,44 +258,61 @@ namespace LaDOSE.DesktopApp.ViewModels
set set
{ {
_gridDataTable = value; _gridDataTable = value;
NotifyOfPropertyChange(() => GridDataTable); RaisePropertyChanged(nameof(GridDataTable));
RaisePropertyChanged(nameof(GridDataTableView));
}
}
public DataView GridDataTableView
{
get
{
DataView gridDataTableView = _gridDataTable?.AsDataView();
return gridDataTableView;
} }
} }
public void Select() public void Select()
{ {
WpfUtil.Await(() =>
{
var tournamentsIds = SelectedEvents.Select(e => e.Id).ToList(); var tournamentsIds = SelectedEvents.Select(e => e.Id).ToList();
var resultsDto = this.RestService.GetResults(tournamentsIds); var resultsDto = this.RestService.GetResults(tournamentsIds);
this.Results = resultsDto; this.Results = resultsDto;
ComputeDataGrid(); ComputeDataGrid();
ComputeHtml(); ComputeHtml();
});
} }
public void GetSmash() public void GetSmash()
{ {
WpfUtil.Await(() =>
{
var resultsDto = this.RestService.ParseSmash(Slug); var resultsDto = this.RestService.ParseSmash(Slug);
if (!resultsDto) 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() public void GetChallonge()
{ {
WpfUtil.Await(() =>
{
var ids = SelectedTournaments.Select(e => e.ChallongeId).ToList(); var ids = SelectedTournaments.Select(e => e.ChallongeId).ToList();
var resultsDto = this.RestService.ParseChallonge(ids); var resultsDto = this.RestService.ParseChallonge(ids);
if (!resultsDto) if (!resultsDto)
{ {
MessageBox.Show("Fail"); Error = "Fail";
} }
});
} }
public void UpdateEvent() public void UpdateEvent()
@@ -329,14 +337,14 @@ namespace LaDOSE.DesktopApp.ViewModels
var selectedTournaments = this.Tournaments.Where(e => Regex.IsMatch(e.Name, this.SelectRegex)).ToList(); var selectedTournaments = this.Tournaments.Where(e => Regex.IsMatch(e.Name, this.SelectRegex)).ToList();
this.SelectedTournaments.Clear(); this.SelectedTournaments.Clear();
if (selectedTournaments.Count > 0) if (selectedTournaments.Count > 0)
selectedTournaments.ForEach(e => this.SelectedTournaments.AddUI(e)); selectedTournaments.ForEach(e => this.SelectedTournaments.Add(e));
} }
public void SelectEvent() public void SelectEvent()
{ {
var selectedEvents = this.Events.Where(e => Regex.IsMatch(e.Name, this.SelectEventRegex)).ToList(); var selectedEvents = this.Events.Where(e => Regex.IsMatch(e.Name, this.SelectEventRegex)).ToList();
this.SelectedEvents.Clear(); this.SelectedEvents.Clear();
if (selectedEvents.Count > 0) 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. //This could be simplified the Dictionary was for a previous usage, but i m too lazy to rewrite it.
private void ComputeDataGrid() private void ComputeDataGrid()
@@ -367,7 +375,7 @@ namespace LaDOSE.DesktopApp.ViewModels
{ {
var resultsGame = Results.Games[j]; var resultsGame = Results.Games[j];
var points = GetPlayerPoint(resultsParticipent, resultsGame.Id); var points = GetPlayerPoint(resultsParticipent, resultsGame.Id);
dataRow[resultsGame.Name.Replace('.', ' ')] = points!=0?(object) points:DBNull.Value; dataRow[resultsGame.Name.Replace('.', ' ')] = points!=0?points:0;
total += points; total += points;
} }
dataRow["Total"] = total; dataRow["Total"] = total;
@@ -389,33 +397,33 @@ namespace LaDOSE.DesktopApp.ViewModels
private void ExportToCSV() private void ExportToCSV()
{ {
if (this.GridDataTable != null) // if (this.GridDataTable != null)
{ // {
var dataTable = this.GridDataTable.DefaultView.ToTable(); // var dataTable = this.GridDataTable.DefaultView.ToTable();
SaveFileDialog sfDialog = new SaveFileDialog() // SaveFileDialog sfDialog = new SaveFileDialog()
{ // {
Filter = "Csv Files (*.csv)|*.csv|All Files (*.*)|*.*", // Filter = "Csv Files (*.csv)|*.csv|All Files (*.*)|*.*",
AddExtension = true // AddExtension = true
}; // };
if (sfDialog.ShowDialog() == true) // if (sfDialog.ShowDialog() == true)
{ // {
StringBuilder sb = new StringBuilder(); // StringBuilder sb = new StringBuilder();
//
IEnumerable<string> columnNames = dataTable.Columns.Cast<DataColumn>() // IEnumerable<string> columnNames = dataTable.Columns.Cast<DataColumn>()
.Select(column => column.ColumnName); // .Select(column => column.ColumnName);
sb.AppendLine(string.Join(";", columnNames)); // sb.AppendLine(string.Join(";", columnNames));
//
foreach (DataRow row in dataTable.Rows) // foreach (DataRow row in dataTable.Rows)
{ // {
//EXCEL IS A BITCH // //EXCEL IS A BITCH
IEnumerable<string> fields = row.ItemArray.Select(field => // IEnumerable<string> fields = row.ItemArray.Select(field =>
string.Concat("\"", field.ToString().Replace("\"", "\"\""), "\"")); // string.Concat("\"", field.ToString().Replace("\"", "\"\""), "\""));
sb.AppendLine(string.Join(";", fields)); // sb.AppendLine(string.Join(";", fields));
} // }
//
File.WriteAllText(sfDialog.FileName, sb.ToString()); // File.WriteAllText(sfDialog.FileName, sb.ToString());
} // }
} // }
} }
private void ComputeHtml() private void ComputeHtml()
@@ -483,7 +491,7 @@ namespace LaDOSE.DesktopApp.ViewModels
} }
public void CopyHtml() public void CopyHtml()
{ {
System.Windows.Clipboard.SetText(this.HtmlContent); // System.Windows.Clipboard.SetText(this.HtmlContent);
} }
private int GetPlayerPoint(string name, int gameid) private int GetPlayerPoint(string name, int gameid)

View File

@@ -0,0 +1,82 @@
<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.GamesView"
xmlns:vm="using:LaDOSE.DesktopApp.Avalonia.ViewModels"
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>
<TextBox Grid.Row="7" Grid.Column="1" Text="{Binding Path=CurrentGame.SmashId,Mode=TwoWay}">
</TextBox>
<Button Grid.Row="9" Grid.ColumnSpan="2" x:Name="Update" Command="{Binding Update}">Update</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" Grid.ColumnSpan="3" 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 @@
{
"REST": {
"Url": "http://localhost:5000",
"User": "user",
"Password": "password"
}
}

View File

@@ -11,7 +11,7 @@
<OutputType>WinExe</OutputType> <OutputType>WinExe</OutputType>
<RootNamespace>LaDOSE.DesktopApp</RootNamespace> <RootNamespace>LaDOSE.DesktopApp</RootNamespace>
<AssemblyName>LaDOSE.DesktopApp</AssemblyName> <AssemblyName>LaDOSE.DesktopApp</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> <TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
@@ -71,27 +71,6 @@
<OutputPath>bin\x64\Release\</OutputPath> <OutputPath>bin\x64\Release\</OutputPath>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <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" />
<Reference Include="System.Configuration" /> <Reference Include="System.Configuration" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />
@@ -101,9 +80,6 @@
<Reference Include="System.Web" /> <Reference Include="System.Web" />
<Reference Include="System.Web.Extensions" /> <Reference Include="System.Web.Extensions" />
<Reference Include="System.Windows.Forms" /> <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="System.Xml" />
<Reference Include="Microsoft.CSharp" /> <Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
@@ -126,8 +102,6 @@
<Compile Include="Behaviors\TextBoxInputRegExBehaviour.cs" /> <Compile Include="Behaviors\TextBoxInputRegExBehaviour.cs" />
<Compile Include="Behaviors\MultiSelectorBehaviours.cs" /> <Compile Include="Behaviors\MultiSelectorBehaviours.cs" />
<Compile Include="Bootstrapper.cs" /> <Compile Include="Bootstrapper.cs" />
<Compile Include="Themes\LeftMarginMultiplierConverter.cs" />
<Compile Include="Themes\TreeViewItemExtensions.cs" />
<Compile Include="Utils\CustomEqualityCompare.cs" /> <Compile Include="Utils\CustomEqualityCompare.cs" />
<Compile Include="Utils\PhpSerialize.cs" /> <Compile Include="Utils\PhpSerialize.cs" />
<Compile Include="UserControls\BookingUserControl.xaml.cs"> <Compile Include="UserControls\BookingUserControl.xaml.cs">
@@ -163,10 +137,6 @@
<DependentUpon>App.xaml</DependentUpon> <DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Page Include="Themes\Styles.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="UserControls\BookingUserControl.xaml"> <Page Include="UserControls\BookingUserControl.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
@@ -214,7 +184,6 @@
<Generator>ResXFileCodeGenerator</Generator> <Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput> <LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource> </EmbeddedResource>
<None Include="packages.config" />
<None Include="Properties\Settings.settings"> <None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator> <Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput> <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

@@ -12,6 +12,7 @@
<PackageReference Include="DSharpPlus.Interactivity" 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" Version="3.1.8" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.1.8" /> <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.1.8" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

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

View File

@@ -40,6 +40,8 @@ namespace LaDOSE.Entity.Context
{ {
} }
protected override void OnModelCreating(ModelBuilder modelBuilder) protected override void OnModelCreating(ModelBuilder modelBuilder)
{ {

View File

@@ -6,6 +6,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="3.1.2" /> <PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="3.1.2" />
</ItemGroup> </ItemGroup>

View File

@@ -6,7 +6,8 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="RestSharp" Version="106.11.4" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="RestSharp" Version="110.2.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

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

View File

@@ -10,6 +10,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="GraphQL.Client" Version="4.0.2" /> <PackageReference Include="GraphQL.Client" Version="4.0.2" />
<PackageReference Include="GraphQL.Client.Serializer.Newtonsoft" Version="4.0.2" /> <PackageReference Include="GraphQL.Client.Serializer.Newtonsoft" Version="4.0.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

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

View File

@@ -96,7 +96,7 @@ namespace LaDOSE.Business.Service
//POKEMON. //POKEMON.
catch (Exception e) catch (Exception e)
{ {
throw new Exception("FUCK !"); throw new Exception($"FUCK ! {e.Message}");
} }
return currentEvent; return currentEvent;
} }

View File

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

View File

@@ -46,7 +46,7 @@ namespace LaDOSE.Business.Service
public bool UpdateBooking() public bool UpdateBooking()
{ {
_context.Database.SetCommandTimeout(60); _context.Database.SetCommandTimeout(60);
_context.Database.ExecuteSqlCommand("call ladoseapi.ImportEvent();"); _context.Database.ExecuteSqlRaw("call ladoseapi.ImportEvent();");
_context.Database.SetCommandTimeout(30); _context.Database.SetCommandTimeout(30);
return true; return true;
} }

View File

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

View File

@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</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

@@ -2,26 +2,22 @@
![Logo](https://www.ladose.net/wp-content/uploads/2016/04/header_small-1.jpg) ![Logo](https://www.ladose.net/wp-content/uploads/2016/04/header_small-1.jpg)
# Dependencies
## Server ## Server
.Net Core 6
.netcore 2 PostgreSQL
AutoMapper
Newtonsoft.Json
Pomelo.EF
## Discord
DSharpPlus
## Desktop ## Desktop
.Net Framework 4.6.1 .Net Framework 4.6.1
Caliburn Micro Caliburn Micro
[Microsoft Visual Studio Installer Projects](https://marketplace.visualstudio.com/items?itemName=VisualStudioClient.MicrosoftVisualStudio2017InstallerProjects#overview)
## Challonge ## Cross Plateform Desktop Client
.Net Core 6
## Challonge Provider is a modified version of this
[ChallongeCSharpDriver](https://github.com/francoislg/ChallongeCSharpDriver) [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
--