Cache the Challonge results

This commit is contained in:
2019-08-06 01:56:33 +02:00
parent b4f9a0a132
commit a9f3da1b8e
13 changed files with 334 additions and 90 deletions

View File

@@ -0,0 +1,16 @@
using System.Collections.Generic;
namespace LaDOSE.Entity.Challonge
{
public class ChallongeParticipent : Context.Entity
{
public ChallongeTournament ChallongeTournament { get; set; }
public int ChallongeTournamentId { get; set; }
public int ChallongeId { get; set; }
public string Name { get; set; }
public int? Rank { get; set; }
public bool? IsMember { get; set; }
}
}

View File

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
namespace LaDOSE.Entity.Challonge
{
public class ChallongeTournament : Context.Entity
{
public int ChallongeId { get; set; }
public string Name { get; set; }
public Game Game { get; set; }
public List<ChallongeParticipent> Participents { get; set; }
public string Url { get; set; }
public DateTime Sync { get; set; }
}
}

View File

@@ -1,10 +0,0 @@
namespace LaDOSE.Entity.Challonge
{
public class Participent
{
public int Id { get; set; }
public string Name { get; set; }
public int? Rank { get; set; }
public bool? IsMember { get; set; }
}
}

View File

@@ -1,13 +0,0 @@
using System.Collections.Generic;
namespace LaDOSE.Entity.Challonge
{
public class Tournament
{
public int Id { get; set; }
public string Name { get; set; }
public Game Game { get; set; }
public List<Participent> Participents { get; set; }
public string Url { get; set; }
}
}

View File

@@ -5,7 +5,7 @@ namespace LaDOSE.Entity.Challonge
{
public class TournamentsResult
{
public List<Participent> Participents { get; set; }
public List<ChallongeParticipent> Participents { get; set; }
public List<Game> Games{ get; set; }
public List<Result> Results { get; set; }

View File

@@ -1,4 +1,5 @@
using LaDOSE.Entity.Wordpress;
using LaDOSE.Entity.Challonge;
using LaDOSE.Entity.Wordpress;
using Microsoft.EntityFrameworkCore;
namespace LaDOSE.Entity.Context
@@ -20,6 +21,8 @@ namespace LaDOSE.Entity.Context
#endregion
public DbSet<SeasonGame> SeasonGame { get; set; }
public DbSet<EventGame> EventGame { get; set; }
public DbSet<ChallongeParticipent> ChallongeParticipent { get; set; }
public DbSet<ChallongeTournament> ChallongeTournament { get; set; }
public LaDOSEDbContext(DbContextOptions options) : base(options)
{
@@ -87,6 +90,12 @@ namespace LaDOSE.Entity.Context
.HasForeignKey(pt => pt.WPUserId);
#endregion
#region Challonge
modelBuilder.Entity<ChallongeParticipent>()
.HasOne(pt => pt.ChallongeTournament)
.WithMany(p => p.Participents)
.HasForeignKey(pt => pt.ChallongeTournamentId);
#endregion
}
}