mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-07-19 11:41:30 +00:00
Add LBP Vita support for tracking plays
This commit is contained in:
parent
543996c1a6
commit
f95dfb6612
8 changed files with 783 additions and 23 deletions
|
@ -97,6 +97,8 @@
|
|||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Kettu/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=lbpme/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=LBPU/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=LBPV/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=lbpvita/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=leveltype/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=lolcatftw/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=luckydip/@EntryIndexedValue">True</s:Boolean>
|
||||
|
|
|
@ -20,7 +20,6 @@ namespace LBPUnion.ProjectLighthouse.Controllers
|
|||
this.database = database;
|
||||
}
|
||||
|
||||
|
||||
[HttpPost("play/user/{slotId}")]
|
||||
public async Task<IActionResult> PlayLevel(int slotId)
|
||||
{
|
||||
|
@ -47,15 +46,17 @@ namespace LBPUnion.ProjectLighthouse.Controllers
|
|||
case GameVersion.LittleBigPlanet3:
|
||||
slot.PlaysLBP3Unique++;
|
||||
break;
|
||||
default:
|
||||
return this.BadRequest();
|
||||
case GameVersion.LittleBigPlanetVita:
|
||||
slot.PlaysLBPVitaUnique++;
|
||||
break;
|
||||
default: return this.BadRequest();
|
||||
}
|
||||
|
||||
v = new();
|
||||
v.SlotId = slotId;
|
||||
v.UserId = user.UserId;
|
||||
this.database.VisitedLevels.Add(v);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
v = await visited.FirstOrDefaultAsync();
|
||||
|
@ -71,8 +72,11 @@ namespace LBPUnion.ProjectLighthouse.Controllers
|
|||
slot.PlaysLBP3++;
|
||||
v.PlaysLBP3++;
|
||||
break;
|
||||
default:
|
||||
return this.BadRequest();
|
||||
case GameVersion.LittleBigPlanetVita:
|
||||
slot.PlaysLBPVita++;
|
||||
v.PlaysLBPVita++;
|
||||
break;
|
||||
default: return this.BadRequest();
|
||||
}
|
||||
|
||||
await this.database.SaveChangesAsync();
|
||||
|
|
|
@ -28,8 +28,13 @@ namespace LBPUnion.ProjectLighthouse.Controllers
|
|||
[HttpPost("scoreboard/user/{id:int}")]
|
||||
public async Task<IActionResult> SubmitScore(int id, [FromQuery] bool lbp1 = false, [FromQuery] bool lbp2 = false, [FromQuery] bool lbp3 = false)
|
||||
{
|
||||
User? user = await this.database.UserFromRequest(this.Request);
|
||||
if (user == null) return this.StatusCode(403, "");
|
||||
(User, Token)? userAndToken = await this.database.UserAndTokenFromRequest(this.Request);
|
||||
|
||||
if (userAndToken == null) return this.StatusCode(403, "");
|
||||
|
||||
// ReSharper disable once PossibleInvalidOperationException
|
||||
User user = userAndToken.Value.Item1;
|
||||
Token token = userAndToken.Value.Item2;
|
||||
|
||||
this.Request.Body.Position = 0;
|
||||
string bodyString = await new StreamReader(this.Request.Body).ReadToEndAsync();
|
||||
|
@ -42,12 +47,25 @@ namespace LBPUnion.ProjectLighthouse.Controllers
|
|||
|
||||
Slot? slot = this.database.Slots.FirstOrDefault(s => s.SlotId == score.SlotId);
|
||||
if (slot == null) return this.BadRequest();
|
||||
if (lbp1) slot.PlaysLBP1Complete++;
|
||||
if (lbp2) slot.PlaysLBP2Complete++;
|
||||
if (lbp3) slot.PlaysLBP3Complete++;
|
||||
|
||||
switch (token.GameVersion)
|
||||
{
|
||||
case GameVersion.LittleBigPlanet1:
|
||||
slot.PlaysLBP1Complete++;
|
||||
break;
|
||||
case GameVersion.LittleBigPlanet2:
|
||||
slot.PlaysLBP2Complete++;
|
||||
break;
|
||||
case GameVersion.LittleBigPlanet3:
|
||||
slot.PlaysLBP3Complete++;
|
||||
break;
|
||||
case GameVersion.LittleBigPlanetVita:
|
||||
slot.PlaysLBPVitaComplete++;
|
||||
break;
|
||||
}
|
||||
|
||||
IQueryable<Score> existingScore = this.database.Scores.Where(s => s.SlotId == score.SlotId && s.PlayerIdCollection == score.PlayerIdCollection);
|
||||
|
||||
|
||||
if (existingScore.Any())
|
||||
{
|
||||
Score first = existingScore.First(s => s.SlotId == score.SlotId);
|
||||
|
@ -69,16 +87,18 @@ namespace LBPUnion.ProjectLighthouse.Controllers
|
|||
|
||||
[HttpGet("friendscores/user/{slotId:int}/{type:int}")]
|
||||
public IActionResult FriendScores(int slotId, int type)
|
||||
//=> await TopScores(slotId, type);
|
||||
=> this.Ok(LbpSerializer.BlankElement("scores"));
|
||||
//=> await TopScores(slotId, type);
|
||||
=> this.Ok(LbpSerializer.BlankElement("scores"));
|
||||
|
||||
[HttpGet("topscores/user/{slotId:int}/{type:int}")]
|
||||
[SuppressMessage("ReSharper", "PossibleMultipleEnumeration")]
|
||||
public async Task<IActionResult> TopScores(int slotId, int type, [FromQuery] int pageStart = -1, [FromQuery] int pageSize = 5) {
|
||||
public async Task<IActionResult> TopScores(int slotId, int type, [FromQuery] int pageStart = -1, [FromQuery] int pageSize = 5)
|
||||
{
|
||||
// Get username
|
||||
User? user = await this.database.UserFromRequest(this.Request);
|
||||
|
||||
if (user == null) return this.StatusCode(403, "");
|
||||
|
||||
return this.Ok(await GetScores(slotId, type, user, pageStart, pageSize));
|
||||
}
|
||||
|
||||
|
@ -105,9 +125,7 @@ namespace LBPUnion.ProjectLighthouse.Controllers
|
|||
.FirstOrDefault();
|
||||
|
||||
// Paginated viewing: if not requesting pageStart, get results around user
|
||||
var pagedScores = rankedScores
|
||||
.Skip(pageStart != -1 || myScore == null ? pageStart - 1 : myScore.Rank - 3)
|
||||
.Take(Math.Min(pageSize, 30));
|
||||
var pagedScores = rankedScores.Skip(pageStart != -1 || myScore == null ? pageStart - 1 : myScore.Rank - 3).Take(Math.Min(pageSize, 30));
|
||||
|
||||
string serializedScores = pagedScores.Aggregate
|
||||
(
|
||||
|
|
651
ProjectLighthouse/Migrations/20211115052941_SlotAddLbpVitaPlays.Designer.cs
generated
Normal file
651
ProjectLighthouse/Migrations/20211115052941_SlotAddLbpVitaPlays.Designer.cs
generated
Normal file
|
@ -0,0 +1,651 @@
|
|||
// <auto-generated />
|
||||
using LBPUnion.ProjectLighthouse;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace ProjectLighthouse.Migrations
|
||||
{
|
||||
[DbContext(typeof(Database))]
|
||||
[Migration("20211115052941_SlotAddLbpVitaPlays")]
|
||||
partial class SlotAddLbpVitaPlays
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "6.0.0")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64);
|
||||
|
||||
modelBuilder.Entity("LBPUnion.ProjectLighthouse.Types.HeartedProfile", b =>
|
||||
{
|
||||
b.Property<int>("HeartedProfileId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("HeartedUserId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("HeartedProfileId");
|
||||
|
||||
b.HasIndex("HeartedUserId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("HeartedProfiles");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LBPUnion.ProjectLighthouse.Types.Levels.HeartedLevel", b =>
|
||||
{
|
||||
b.Property<int>("HeartedLevelId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("SlotId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("HeartedLevelId");
|
||||
|
||||
b.HasIndex("SlotId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("HeartedLevels");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LBPUnion.ProjectLighthouse.Types.Levels.QueuedLevel", b =>
|
||||
{
|
||||
b.Property<int>("QueuedLevelId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("SlotId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("QueuedLevelId");
|
||||
|
||||
b.HasIndex("SlotId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("QueuedLevels");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LBPUnion.ProjectLighthouse.Types.Levels.RatedLevel", b =>
|
||||
{
|
||||
b.Property<int>("RatedLevelId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Rating")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<double>("RatingLBP1")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<int>("SlotId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("RatedLevelId");
|
||||
|
||||
b.HasIndex("SlotId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("RatedLevels");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LBPUnion.ProjectLighthouse.Types.Levels.Slot", b =>
|
||||
{
|
||||
b.Property<int>("SlotId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("AuthorLabels")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("BackgroundHash")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("CreatorId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<long>("FirstUploaded")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<int>("GameVersion")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("IconHash")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<bool>("InitiallyLocked")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<long>("LastUpdated")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<bool>("Lbp1Only")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("LevelType")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("LocationId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("MaximumPlayers")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("MinimumPlayers")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<bool>("MoveRequired")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("PlaysLBP1")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PlaysLBP1Complete")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PlaysLBP1Unique")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PlaysLBP2")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PlaysLBP2Complete")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PlaysLBP2Unique")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PlaysLBP3")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PlaysLBP3Complete")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PlaysLBP3Unique")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PlaysLBPVita")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PlaysLBPVitaComplete")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PlaysLBPVitaUnique")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ResourceCollection")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("RootLevel")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("Shareable")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<bool>("SubLevel")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<bool>("TeamPick")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.HasKey("SlotId");
|
||||
|
||||
b.HasIndex("CreatorId");
|
||||
|
||||
b.HasIndex("LocationId");
|
||||
|
||||
b.ToTable("Slots");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LBPUnion.ProjectLighthouse.Types.Levels.VisitedLevel", b =>
|
||||
{
|
||||
b.Property<int>("VisitedLevelId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PlaysLBP1")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PlaysLBP2")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PlaysLBP3")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PlaysLBPVita")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("SlotId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("VisitedLevelId");
|
||||
|
||||
b.HasIndex("SlotId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("VisitedLevels");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LBPUnion.ProjectLighthouse.Types.Photo", b =>
|
||||
{
|
||||
b.Property<int>("PhotoId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("CreatorId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("LargeHash")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("MediumHash")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("PhotoSubjectCollection")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("PlanHash")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("SmallHash")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<long>("Timestamp")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("PhotoId");
|
||||
|
||||
b.HasIndex("CreatorId");
|
||||
|
||||
b.ToTable("Photos");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LBPUnion.ProjectLighthouse.Types.PhotoSubject", b =>
|
||||
{
|
||||
b.Property<int>("PhotoSubjectId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Bounds")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("PhotoSubjectId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("PhotoSubjects");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LBPUnion.ProjectLighthouse.Types.Profiles.Comment", b =>
|
||||
{
|
||||
b.Property<int>("CommentId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Message")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("PosterUserId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("TargetUserId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("ThumbsDown")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("ThumbsUp")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<long>("Timestamp")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("CommentId");
|
||||
|
||||
b.HasIndex("PosterUserId");
|
||||
|
||||
b.HasIndex("TargetUserId");
|
||||
|
||||
b.ToTable("Comments");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LBPUnion.ProjectLighthouse.Types.Profiles.LastMatch", b =>
|
||||
{
|
||||
b.Property<int>("UserId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<long>("Timestamp")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("UserId");
|
||||
|
||||
b.ToTable("LastMatches");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LBPUnion.ProjectLighthouse.Types.Profiles.Location", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("X")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Y")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Locations");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LBPUnion.ProjectLighthouse.Types.Score", b =>
|
||||
{
|
||||
b.Property<int>("ScoreId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("PlayerIdCollection")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("Points")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("SlotId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Type")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("ScoreId");
|
||||
|
||||
b.HasIndex("SlotId");
|
||||
|
||||
b.ToTable("Scores");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LBPUnion.ProjectLighthouse.Types.Token", b =>
|
||||
{
|
||||
b.Property<int>("TokenId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("GameVersion")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("UserLocation")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("UserToken")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("TokenId");
|
||||
|
||||
b.ToTable("Tokens");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LBPUnion.ProjectLighthouse.Types.User", b =>
|
||||
{
|
||||
b.Property<int>("UserId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Biography")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("Game")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("IconHash")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("LocationId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Pins")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("PlanetHash")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Username")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("UserId");
|
||||
|
||||
b.HasIndex("LocationId");
|
||||
|
||||
b.ToTable("Users");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LBPUnion.ProjectLighthouse.Types.HeartedProfile", b =>
|
||||
{
|
||||
b.HasOne("LBPUnion.ProjectLighthouse.Types.User", "HeartedUser")
|
||||
.WithMany()
|
||||
.HasForeignKey("HeartedUserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("LBPUnion.ProjectLighthouse.Types.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("HeartedUser");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LBPUnion.ProjectLighthouse.Types.Levels.HeartedLevel", b =>
|
||||
{
|
||||
b.HasOne("LBPUnion.ProjectLighthouse.Types.Levels.Slot", "Slot")
|
||||
.WithMany()
|
||||
.HasForeignKey("SlotId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("LBPUnion.ProjectLighthouse.Types.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Slot");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LBPUnion.ProjectLighthouse.Types.Levels.QueuedLevel", b =>
|
||||
{
|
||||
b.HasOne("LBPUnion.ProjectLighthouse.Types.Levels.Slot", "Slot")
|
||||
.WithMany()
|
||||
.HasForeignKey("SlotId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("LBPUnion.ProjectLighthouse.Types.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Slot");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LBPUnion.ProjectLighthouse.Types.Levels.RatedLevel", b =>
|
||||
{
|
||||
b.HasOne("LBPUnion.ProjectLighthouse.Types.Levels.Slot", "Slot")
|
||||
.WithMany()
|
||||
.HasForeignKey("SlotId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("LBPUnion.ProjectLighthouse.Types.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Slot");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LBPUnion.ProjectLighthouse.Types.Levels.Slot", b =>
|
||||
{
|
||||
b.HasOne("LBPUnion.ProjectLighthouse.Types.User", "Creator")
|
||||
.WithMany()
|
||||
.HasForeignKey("CreatorId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("LBPUnion.ProjectLighthouse.Types.Profiles.Location", "Location")
|
||||
.WithMany()
|
||||
.HasForeignKey("LocationId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Creator");
|
||||
|
||||
b.Navigation("Location");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LBPUnion.ProjectLighthouse.Types.Levels.VisitedLevel", b =>
|
||||
{
|
||||
b.HasOne("LBPUnion.ProjectLighthouse.Types.Levels.Slot", "Slot")
|
||||
.WithMany()
|
||||
.HasForeignKey("SlotId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("LBPUnion.ProjectLighthouse.Types.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Slot");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LBPUnion.ProjectLighthouse.Types.Photo", b =>
|
||||
{
|
||||
b.HasOne("LBPUnion.ProjectLighthouse.Types.User", "Creator")
|
||||
.WithMany()
|
||||
.HasForeignKey("CreatorId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Creator");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LBPUnion.ProjectLighthouse.Types.PhotoSubject", b =>
|
||||
{
|
||||
b.HasOne("LBPUnion.ProjectLighthouse.Types.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LBPUnion.ProjectLighthouse.Types.Profiles.Comment", b =>
|
||||
{
|
||||
b.HasOne("LBPUnion.ProjectLighthouse.Types.User", "Poster")
|
||||
.WithMany()
|
||||
.HasForeignKey("PosterUserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("LBPUnion.ProjectLighthouse.Types.User", "Target")
|
||||
.WithMany()
|
||||
.HasForeignKey("TargetUserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Poster");
|
||||
|
||||
b.Navigation("Target");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LBPUnion.ProjectLighthouse.Types.Score", b =>
|
||||
{
|
||||
b.HasOne("LBPUnion.ProjectLighthouse.Types.Levels.Slot", "Slot")
|
||||
.WithMany()
|
||||
.HasForeignKey("SlotId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Slot");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LBPUnion.ProjectLighthouse.Types.User", b =>
|
||||
{
|
||||
b.HasOne("LBPUnion.ProjectLighthouse.Types.Profiles.Location", "Location")
|
||||
.WithMany()
|
||||
.HasForeignKey("LocationId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Location");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace ProjectLighthouse.Migrations
|
||||
{
|
||||
public partial class SlotAddLbpVitaPlays : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "PlaysLBPVita",
|
||||
table: "VisitedLevels",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "PlaysLBPVita",
|
||||
table: "Slots",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "PlaysLBPVitaComplete",
|
||||
table: "Slots",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "PlaysLBPVitaUnique",
|
||||
table: "Slots",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "PlaysLBPVita",
|
||||
table: "VisitedLevels");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "PlaysLBPVita",
|
||||
table: "Slots");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "PlaysLBPVitaComplete",
|
||||
table: "Slots");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "PlaysLBPVitaUnique",
|
||||
table: "Slots");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -195,6 +195,15 @@ namespace ProjectLighthouse.Migrations
|
|||
b.Property<int>("PlaysLBP3Unique")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PlaysLBPVita")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PlaysLBPVitaComplete")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PlaysLBPVitaUnique")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ResourceCollection")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
@ -236,6 +245,9 @@ namespace ProjectLighthouse.Migrations
|
|||
b.Property<int>("PlaysLBP3")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PlaysLBPVita")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("SlotId")
|
||||
.HasColumnType("int");
|
||||
|
||||
|
|
|
@ -112,19 +112,19 @@ namespace LBPUnion.ProjectLighthouse.Types.Levels
|
|||
[XmlIgnore]
|
||||
[NotMapped]
|
||||
public int Plays {
|
||||
get => this.PlaysLBP1 + this.PlaysLBP2 + this.PlaysLBP3;
|
||||
get => this.PlaysLBP1 + this.PlaysLBP2 + this.PlaysLBP3 + this.PlaysLBPVita;
|
||||
}
|
||||
|
||||
[XmlIgnore]
|
||||
[NotMapped]
|
||||
public int PlaysUnique {
|
||||
get => this.PlaysLBP1Unique + this.PlaysLBP2Unique + this.PlaysLBP3Unique;
|
||||
get => this.PlaysLBP1Unique + this.PlaysLBP2Unique + this.PlaysLBP3Unique + this.PlaysLBPVitaUnique;
|
||||
}
|
||||
|
||||
[XmlIgnore]
|
||||
[NotMapped]
|
||||
public int PlaysComplete {
|
||||
get => this.PlaysLBP1Complete + this.PlaysLBP2Complete + this.PlaysLBP3Complete;
|
||||
get => this.PlaysLBP1Complete + this.PlaysLBP2Complete + this.PlaysLBP3Complete + this.PlaysLBPVitaComplete;
|
||||
}
|
||||
|
||||
[XmlIgnore]
|
||||
|
@ -154,6 +154,15 @@ namespace LBPUnion.ProjectLighthouse.Types.Levels
|
|||
[XmlIgnore]
|
||||
public int PlaysLBP3Unique { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
public int PlaysLBPVita { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
public int PlaysLBPVitaComplete { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
public int PlaysLBPVitaUnique { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
[XmlElement("thumbsup")]
|
||||
public int Thumbsup {
|
||||
|
@ -233,6 +242,9 @@ namespace LBPUnion.ProjectLighthouse.Types.Levels
|
|||
LbpSerializer.StringElement("lbp3PlayCount", this.PlaysLBP3) +
|
||||
LbpSerializer.StringElement("lbp3CompletionCount", this.PlaysLBP3Complete) +
|
||||
LbpSerializer.StringElement("lbp3UniquePlayCount", this.PlaysLBP3Unique) +
|
||||
LbpSerializer.StringElement("lbpvitaPlayCount", this.PlaysLBPVita) +
|
||||
LbpSerializer.StringElement("lbpvitaCompletionCount", this.PlaysLBPVitaComplete) +
|
||||
LbpSerializer.StringElement("lbpvitaUniquePlayCount", this.PlaysLBPVitaUnique) +
|
||||
LbpSerializer.StringElement("thumbsup", this.Thumbsup) +
|
||||
LbpSerializer.StringElement("thumbsdown", this.Thumbsdown) +
|
||||
LbpSerializer.StringElement("averageRating", this.RatingLBP1) +
|
||||
|
@ -241,7 +253,9 @@ namespace LBPUnion.ProjectLighthouse.Types.Levels
|
|||
LbpSerializer.StringElement("yourDPadRating", yourRatingStats?.Rating) +
|
||||
LbpSerializer.StringElement("yourLBP1PlayCount", yourVisitedStats?.PlaysLBP1) +
|
||||
LbpSerializer.StringElement("yourLBP2PlayCount", yourVisitedStats?.PlaysLBP2) +
|
||||
LbpSerializer.StringElement("yourLBP3PlayCount", yourVisitedStats?.PlaysLBP3);
|
||||
LbpSerializer.StringElement("yourLBP3PlayCount", yourVisitedStats?.PlaysLBP3) +
|
||||
LbpSerializer.StringElement
|
||||
("yourLBPVitaPlayCount", yourVisitedStats?.PlaysLBPVita); // i doubt this is the right name but we'll go with it
|
||||
|
||||
return LbpSerializer.TaggedStringElement("slot", slotData, "type", "user");
|
||||
}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
using System.Linq;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
|
@ -23,5 +22,6 @@ namespace LBPUnion.ProjectLighthouse.Types.Levels
|
|||
public int PlaysLBP1 { get; set; }
|
||||
public int PlaysLBP2 { get; set; }
|
||||
public int PlaysLBP3 { get; set; }
|
||||
public int PlaysLBPVita { get; set; }
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue