mirror of
https://github.com/BtbN/ClanServer.git
synced 2026-04-25 08:08:03 -05:00
Fixup schema
This commit is contained in:
parent
b938f2016a
commit
9961c36925
|
|
@ -49,17 +49,5 @@ namespace ClanServer
|
|||
public DbSet<JubeatClanProfileData> JubeatClanProfileData { get; set; }
|
||||
public DbSet<JubeatProfile> JubeatProfiles { get; set; }
|
||||
public DbSet<JubeatScore> JubeatScores { get; set; }
|
||||
|
||||
public async Task<Card> FindCardAsync(Expression<Func<Card, bool>> selector)
|
||||
{
|
||||
Card card = await Cards.SingleOrDefaultAsync(selector);
|
||||
|
||||
if (card != null)
|
||||
{
|
||||
await Entry(card).Reference(c => c.Player).LoadAsync();
|
||||
}
|
||||
|
||||
return card;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,7 +62,9 @@ namespace ClanServer.Controllers.Core
|
|||
string pass = cardmng.Attribute("pass").Value;
|
||||
byte[] refId = cardmng.Attribute("refid").Value.ToBytesFromHex();
|
||||
|
||||
var card = await ctx.FindCardAsync(c => c.RefId.SequenceEqual(refId));
|
||||
Card card = await ctx.Cards
|
||||
.Include(c => c.Player)
|
||||
.SingleOrDefaultAsync(c => c.RefId.SequenceEqual(refId));
|
||||
|
||||
int status;
|
||||
if (card != null && card.Player != null && card.Player.Passwd == pass)
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ using System.Linq;
|
|||
using System.Threading.Tasks;
|
||||
using System.Xml.Linq;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
using eAmuseCore.KBinXML;
|
||||
|
||||
|
|
@ -33,7 +34,10 @@ namespace ClanServer.Controllers.L44
|
|||
|
||||
byte[] refId = playerE.Element("refid").Value.ToBytesFromHex();
|
||||
|
||||
Card card = await ctx.FindCardAsync(c => c.RefId.SequenceEqual(refId));
|
||||
Card card = await ctx.Cards
|
||||
.Include(c => c.Player.JubeatProfile)
|
||||
.SingleOrDefaultAsync(c => c.RefId.SequenceEqual(refId));
|
||||
|
||||
if (card == null)
|
||||
return NotFound();
|
||||
|
||||
|
|
|
|||
|
|
@ -32,13 +32,14 @@ namespace ClanServer.Controllers.L44
|
|||
byte[] refId = player.Element("refid").Value.ToBytesFromHex();
|
||||
string name = player.Element("name").Value;
|
||||
|
||||
Card card = await ctx.FindCardAsync(c => c.RefId.SequenceEqual(refId));
|
||||
Card card = await ctx.Cards
|
||||
.Include(c => c.Player.JubeatProfile.ClanData)
|
||||
.Include(c => c.Player.JubeatProfile.ClanSettings)
|
||||
.SingleOrDefaultAsync(c => c.RefId.SequenceEqual(refId));
|
||||
|
||||
if (card == null || card.Player == null)
|
||||
return NotFound();
|
||||
|
||||
await ctx.Entry(card.Player).Reference(p => p.JubeatProfile).LoadAsync();
|
||||
|
||||
if (card.Player.JubeatProfile == null)
|
||||
card.Player.JubeatProfile = new JubeatProfile();
|
||||
|
||||
|
|
@ -65,14 +66,12 @@ namespace ClanServer.Controllers.L44
|
|||
|
||||
byte[] refId = player.Element("refid").Value.ToBytesFromHex();
|
||||
|
||||
Card card = await ctx.FindCardAsync(c => c.RefId.SequenceEqual(refId));
|
||||
Card card = await ctx.Cards
|
||||
.Include(c => c.Player.JubeatProfile.ClanData)
|
||||
.Include(c => c.Player.JubeatProfile.ClanSettings)
|
||||
.SingleOrDefaultAsync(c => c.RefId.SequenceEqual(refId));
|
||||
|
||||
if (card == null || card.Player == null)
|
||||
return NotFound();
|
||||
|
||||
await ctx.Entry(card.Player).Reference(p => p.JubeatProfile).LoadAsync();
|
||||
|
||||
if (card.Player.JubeatProfile == null)
|
||||
if (card == null || card.Player == null || card.Player.JubeatProfile == null)
|
||||
return NotFound();
|
||||
|
||||
data.Document = new XDocument(new XElement("response", new XElement("gametop",
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ namespace ClanServer.Models
|
|||
{
|
||||
public int ID { get; set; }
|
||||
|
||||
[Required]
|
||||
public Player Player { get; set; }
|
||||
public int PlayerID { get; set; }
|
||||
|
||||
[Required]
|
||||
[MaxLength(8), MinLength(8)]
|
||||
|
|
|
|||
|
|
@ -9,8 +9,10 @@ namespace ClanServer.Models
|
|||
{
|
||||
public int ID { get; set; }
|
||||
|
||||
public JubeatProfile Profile { get; set; }
|
||||
public int ProfileID { get; set; }
|
||||
|
||||
[Range(0, 4)]
|
||||
[Range(1, 4)]
|
||||
public byte Team { get; set; }
|
||||
|
||||
public int Street { get; set; }
|
||||
|
|
|
|||
|
|
@ -9,6 +9,9 @@ namespace ClanServer.Models
|
|||
{
|
||||
public int ID { get; set; }
|
||||
|
||||
public JubeatProfile Profile { get; set; }
|
||||
public int ProfileID { get; set; }
|
||||
|
||||
public sbyte ExpertOption { get; set; }
|
||||
|
||||
public sbyte Sort { get; set; }
|
||||
|
|
|
|||
|
|
@ -9,6 +9,9 @@ namespace ClanServer.Models
|
|||
{
|
||||
public int ID { get; set; }
|
||||
|
||||
public Player Player { get; set; }
|
||||
public int PlayerID { get; set; }
|
||||
|
||||
[Required]
|
||||
public int JID { get; set; }
|
||||
|
||||
|
|
@ -18,5 +21,7 @@ namespace ClanServer.Models
|
|||
public JubeatClanProfileData ClanData { get; set; }
|
||||
|
||||
public JubeatClanSettings ClanSettings { get; set; }
|
||||
|
||||
public ICollection<JubeatScore> Scores { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ namespace ClanServer.Models
|
|||
public int ID { get; set; }
|
||||
|
||||
[Required]
|
||||
public JubeatProfile Profile { get; set; }
|
||||
public int ProfileID { get; set; }
|
||||
|
||||
public long Timestamp { get; set; }
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user