Cache the Challonge results
This commit is contained in:
16
LaDOSE.Src/LaDOSE.Entity/Challonge/ChallongeParticipent.cs
Normal file
16
LaDOSE.Src/LaDOSE.Entity/Challonge/ChallongeParticipent.cs
Normal 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; }
|
||||
|
||||
}
|
||||
}
|
||||
16
LaDOSE.Src/LaDOSE.Entity/Challonge/ChallongeTournament.cs
Normal file
16
LaDOSE.Src/LaDOSE.Entity/Challonge/ChallongeTournament.cs
Normal 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; }
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user