mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-07-28 16:08:38 +00:00
Big merge
This commit is contained in:
commit
f2ac21bed3
33 changed files with 4133 additions and 55 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1,3 +1,4 @@
|
|||
r/ # cdn resources folder
|
||||
bin/
|
||||
obj/
|
||||
/packages/
|
||||
|
@ -10,4 +11,4 @@ riderModule.iml
|
|||
/ProjectLighthouse/r/*
|
||||
/ProjectLighthouse/logs/*
|
||||
/ProjectLighthouse/ProjectLighthouse.csproj.user
|
||||
.vs/
|
||||
.vs/
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace LBPUnion.ProjectLighthouse.Tests
|
|||
[Fact]
|
||||
public async Task ShouldReturnErrorOnNoPostData()
|
||||
{
|
||||
HttpResponseMessage response = await this.Client.PostAsync($"/LITTLEBIGPLANETPS3_XML/login", null!);
|
||||
HttpResponseMessage response = await this.Client.PostAsync("/LITTLEBIGPLANETPS3_XML/login", null!);
|
||||
Assert.False(response.IsSuccessStatusCode);
|
||||
#if NET6_0_OR_GREATER
|
||||
Assert.True(response.StatusCode == HttpStatusCode.BadRequest);
|
||||
|
|
|
@ -89,6 +89,7 @@
|
|||
<s:Boolean x:Key="/Default/UserDictionary/Words/=brun/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=ezoiar/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=farc/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=friendscores/@EntryIndexedValue">True</s:Boolean>
|
||||
<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>
|
||||
|
@ -103,6 +104,7 @@
|
|||
<s:Boolean x:Key="/Default/UserDictionary/Words/=PCKS/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Swingy/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=thumbsup/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=topscores/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=UCAS/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=unfavourite/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Unpublish/@EntryIndexedValue">True</s:Boolean>
|
||||
|
|
|
@ -22,8 +22,10 @@ namespace LBPUnion.ProjectLighthouse.Controllers
|
|||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> Login([FromQuery] string titleId)
|
||||
public async Task<IActionResult> Login([FromQuery] string? titleId)
|
||||
{
|
||||
titleId ??= "";
|
||||
|
||||
string body = await new StreamReader(this.Request.Body).ReadToEndAsync();
|
||||
|
||||
LoginData? loginData;
|
||||
|
|
85
ProjectLighthouse/Controllers/PhotosController.cs
Normal file
85
ProjectLighthouse/Controllers/PhotosController.cs
Normal file
|
@ -0,0 +1,85 @@
|
|||
#nullable enable
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Serialization;
|
||||
using LBPUnion.ProjectLighthouse.Serialization;
|
||||
using LBPUnion.ProjectLighthouse.Types;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace LBPUnion.ProjectLighthouse.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("LITTLEBIGPLANETPS3_XML/")]
|
||||
[Produces("text/xml")]
|
||||
public class PhotosController : ControllerBase
|
||||
{
|
||||
private readonly Database database;
|
||||
|
||||
public PhotosController(Database database)
|
||||
{
|
||||
this.database = database;
|
||||
}
|
||||
|
||||
[HttpPost("uploadPhoto")]
|
||||
public async Task<IActionResult> UploadPhoto()
|
||||
{
|
||||
User? user = await this.database.UserFromRequest(this.Request);
|
||||
if (user == null) return this.StatusCode(403, "");
|
||||
|
||||
this.Request.Body.Position = 0;
|
||||
string bodyString = await new StreamReader(this.Request.Body).ReadToEndAsync();
|
||||
|
||||
XmlSerializer serializer = new(typeof(Photo));
|
||||
Photo? photo = (Photo?)serializer.Deserialize(new StringReader(bodyString));
|
||||
if (photo == null) return this.BadRequest();
|
||||
|
||||
photo.CreatorId = user.UserId;
|
||||
photo.Creator = user;
|
||||
|
||||
foreach (PhotoSubject subject in photo.Subjects)
|
||||
{
|
||||
subject.User = await this.database.Users.FirstOrDefaultAsync(u => u.Username == subject.Username);
|
||||
|
||||
if (subject.User == null) return this.BadRequest();
|
||||
|
||||
subject.UserId = subject.User.UserId;
|
||||
|
||||
this.database.PhotoSubjects.Add(subject);
|
||||
}
|
||||
|
||||
await this.database.SaveChangesAsync();
|
||||
|
||||
photo.PhotoSubjectCollection = photo.Subjects.Aggregate(string.Empty, (s, subject) => s + subject.PhotoSubjectId);
|
||||
// photo.Slot = await this.database.Slots.FirstOrDefaultAsync(s => s.SlotId == photo.SlotId);
|
||||
|
||||
this.database.Photos.Add(photo);
|
||||
|
||||
await this.database.SaveChangesAsync();
|
||||
|
||||
return this.Ok();
|
||||
}
|
||||
|
||||
[HttpGet("photos/user/{id:int}")]
|
||||
public async Task<IActionResult> SlotPhotos(int id)
|
||||
{
|
||||
List<Photo> photos = await this.database.Photos.Take(10).ToListAsync();
|
||||
string response = photos.Aggregate(string.Empty, (s, photo) => s + photo.Serialize(id));
|
||||
return this.Ok(LbpSerializer.StringElement("photos", response));
|
||||
}
|
||||
|
||||
[HttpGet("photos/by")]
|
||||
public async Task<IActionResult> UserPhotos([FromQuery] string user)
|
||||
{
|
||||
User? userFromQuery = await this.database.Users.FirstOrDefaultAsync(u => u.Username == user);
|
||||
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
||||
if (user == null) return this.NotFound();
|
||||
|
||||
List<Photo> photos = await this.database.Photos.Where(p => p.CreatorId == userFromQuery.UserId).Take(10).ToListAsync();
|
||||
string response = photos.Aggregate(string.Empty, (s, photo) => s + photo.Serialize(0));
|
||||
return this.Ok(LbpSerializer.StringElement("photos", response));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -60,7 +60,7 @@ namespace LBPUnion.ProjectLighthouse.Controllers
|
|||
// User user = await this.database.UserFromRequest(this.Request);
|
||||
(User, Token)? userAndToken = await this.database.UserAndTokenFromRequest(this.Request);
|
||||
|
||||
if (userAndToken != null) return this.StatusCode(403, "");
|
||||
if (userAndToken == null) return this.StatusCode(403, "");
|
||||
|
||||
// ReSharper disable once PossibleInvalidOperationException
|
||||
User user = userAndToken.Value.Item1;
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Serialization;
|
||||
using LBPUnion.ProjectLighthouse.Types;
|
||||
using LBPUnion.ProjectLighthouse.Serialization;
|
||||
using LBPUnion.ProjectLighthouse.Types;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace LBPUnion.ProjectLighthouse.Controllers
|
||||
|
@ -29,7 +31,7 @@ namespace LBPUnion.ProjectLighthouse.Controllers
|
|||
string bodyString = await new StreamReader(this.Request.Body).ReadToEndAsync();
|
||||
|
||||
XmlSerializer serializer = new(typeof(Score));
|
||||
Score score = (Score)serializer.Deserialize(new StringReader(bodyString));
|
||||
Score? score = (Score?)serializer.Deserialize(new StringReader(bodyString));
|
||||
if (score == null) return this.BadRequest();
|
||||
|
||||
score.SlotId = id;
|
||||
|
@ -38,7 +40,7 @@ namespace LBPUnion.ProjectLighthouse.Controllers
|
|||
|
||||
if (existingScore.Any())
|
||||
{
|
||||
Score first = existingScore.FirstOrDefault(s => s.SlotId == score.SlotId);
|
||||
Score first = existingScore.First(s => s.SlotId == score.SlotId);
|
||||
score.ScoreId = first.ScoreId;
|
||||
score.Points = Math.Max(first.Points, score.Points);
|
||||
this.database.Entry(first).CurrentValues.SetValues(score);
|
||||
|
@ -57,22 +59,31 @@ namespace LBPUnion.ProjectLighthouse.Controllers
|
|||
=> await TopScores(slotId, type);
|
||||
|
||||
[HttpGet("topscores/user/{slotId:int}/{type:int}")]
|
||||
public async Task<IActionResult> TopScores(int slotId, int type, [FromQuery] int pageStart=-1, [FromQuery] int pageSize=5)
|
||||
[SuppressMessage("ReSharper", "PossibleMultipleEnumeration")]
|
||||
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);
|
||||
User? user = await this.database.UserFromRequest(this.Request);
|
||||
|
||||
if (user == null) return this.StatusCode(403, "");
|
||||
|
||||
// This is hella ugly but it technically assigns the proper rank to a score
|
||||
// var needed for Anonymous type returned from SELECT
|
||||
var rankedScores = this.database.Scores
|
||||
.Where(s => s.SlotId == slotId && s.Type == type)
|
||||
var rankedScores = this.database.Scores.Where(s => s.SlotId == slotId && s.Type == type)
|
||||
.OrderByDescending(s => s.Points)
|
||||
.ToList()
|
||||
.Select((Score s, int rank) => new { Score = s, Rank = rank + 1 });
|
||||
.Select
|
||||
(
|
||||
(s, rank) => new
|
||||
{
|
||||
Score = s,
|
||||
Rank = rank + 1,
|
||||
}
|
||||
);
|
||||
|
||||
// Find your score, since even if you aren't in the top list your score is pinned
|
||||
var myScore = rankedScores
|
||||
.Where(rs => rs.Score.PlayerIdCollection.Contains(user.Username))
|
||||
var myScore = rankedScores.Where
|
||||
(rs => rs.Score.PlayerIdCollection.Contains(user.Username))
|
||||
.OrderByDescending(rs => rs.Score.Points)
|
||||
.FirstOrDefault();
|
||||
|
||||
|
@ -81,23 +92,40 @@ namespace LBPUnion.ProjectLighthouse.Controllers
|
|||
.Skip(pageStart != -1 ? pageStart - 1 : myScore.Rank - 3)
|
||||
.Take(Math.Min(pageSize, 30));
|
||||
|
||||
string serializedScores = Enumerable.Aggregate(pagedScores, string.Empty, (current, rs) => {
|
||||
rs.Score.Rank = rs.Rank;
|
||||
return current + rs.Score.Serialize();
|
||||
});
|
||||
string serializedScores = pagedScores.Aggregate
|
||||
(
|
||||
string.Empty,
|
||||
(current, rs) =>
|
||||
{
|
||||
rs.Score.Rank = rs.Rank;
|
||||
return current + rs.Score.Serialize();
|
||||
}
|
||||
);
|
||||
|
||||
string res;
|
||||
if (myScore == null)
|
||||
{
|
||||
res = LbpSerializer.StringElement("scores", serializedScores);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
res = LbpSerializer.TaggedStringElement("scores", serializedScores, new Dictionary<string, object>() {
|
||||
{"yourScore", myScore.Score.Points},
|
||||
{"yourRank", myScore.Rank }, //This is the numerator of your position globally in the side menu.
|
||||
{"totalNumScores", rankedScores.Count() } // This is the denominator of your position globally in the side menu.
|
||||
});
|
||||
res = LbpSerializer.TaggedStringElement
|
||||
(
|
||||
"scores",
|
||||
serializedScores,
|
||||
new Dictionary<string, object>()
|
||||
{
|
||||
{
|
||||
"yourScore", myScore.Score.Points
|
||||
},
|
||||
{
|
||||
"yourRank", myScore.Rank
|
||||
}, //This is the numerator of your position globally in the side menu.
|
||||
{
|
||||
"totalNumScores", rankedScores.Count()
|
||||
}, // This is the denominator of your position globally in the side menu.
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
return this.Ok(res);
|
||||
|
|
|
@ -42,6 +42,9 @@ namespace LBPUnion.ProjectLighthouse.Controllers
|
|||
return this.Ok(slot.Serialize());
|
||||
}
|
||||
|
||||
[HttpGet("slots/cool")]
|
||||
public IActionResult CoolSlots([FromQuery] int page) => NewestSlots(30 * page, 30);
|
||||
|
||||
[HttpGet("slots")]
|
||||
public IActionResult NewestSlots([FromQuery] int pageStart, [FromQuery] int pageSize)
|
||||
{
|
||||
|
|
|
@ -23,7 +23,8 @@ namespace LBPUnion.ProjectLighthouse
|
|||
public DbSet<Comment> Comments { get; set; }
|
||||
public DbSet<Token> Tokens { get; set; }
|
||||
public DbSet<Score> Scores { get; set; }
|
||||
|
||||
public DbSet<PhotoSubject> PhotoSubjects { get; set; }
|
||||
public DbSet<Photo> Photos { get; set; }
|
||||
public DbSet<LastMatch> LastMatches { get; set; }
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder options)
|
||||
|
@ -106,6 +107,9 @@ namespace LBPUnion.ProjectLighthouse
|
|||
|
||||
return (user, token);
|
||||
}
|
||||
|
||||
public async Task<Photo?> PhotoFromSubject(PhotoSubject subject)
|
||||
=> await this.Photos.FirstOrDefaultAsync(p => p.PhotoSubjectIds.Contains(subject.PhotoSubjectId.ToString()));
|
||||
#nullable disable
|
||||
}
|
||||
}
|
|
@ -22,6 +22,6 @@ Please do not make anything public for now, and keep in mind security isn't as t
|
|||
// ReSharper disable once UnreachableCode
|
||||
public const string PrivateInstanceNoticeOrBlank = ShowPrivateInstanceNotice ? PrivateInstanceNotice : "";
|
||||
|
||||
public const bool ShowPrivateInstanceNotice = true;
|
||||
public const bool ShowPrivateInstanceNotice = false;
|
||||
}
|
||||
}
|
|
@ -8,11 +8,8 @@ namespace LBPUnion.ProjectLighthouse.Helpers.Extensions
|
|||
{
|
||||
char[] invalidPathChars = Path.GetInvalidFileNameChars();
|
||||
string path = text;
|
||||
|
||||
foreach (char c in invalidPathChars)
|
||||
{
|
||||
path = path.Replace(c.ToString(), "");
|
||||
}
|
||||
|
||||
foreach (char c in invalidPathChars) path = path.Replace(c.ToString(), "");
|
||||
|
||||
return path;
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ namespace LBPUnion.ProjectLighthouse.Helpers
|
|||
if (LittleBigPlanet2TitleIds.Contains(titleId)) return GameVersion.LittleBigPlanet2;
|
||||
if (LittleBigPlanet3TitleIds.Contains(titleId)) return GameVersion.LittleBigPlanet3;
|
||||
|
||||
return GameVersion.Unknown;
|
||||
return GameVersion.LittleBigPlanet1;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -9,6 +9,7 @@ namespace LBPUnion.ProjectLighthouse.Logging
|
|||
public class LighthouseFileLogger : LoggerBase
|
||||
{
|
||||
private static readonly string logsDirectory = Path.Combine(Environment.CurrentDirectory, "logs");
|
||||
public override bool AllowMultiple => false;
|
||||
|
||||
public override void Send(LoggerLine line)
|
||||
{
|
||||
|
@ -22,6 +23,5 @@ namespace LBPUnion.ProjectLighthouse.Logging
|
|||
File.AppendAllText(Path.Combine(logsDirectory, line.LoggerLevel.Name.ToFileName() + ".log"), contentFile);
|
||||
File.AppendAllText(Path.Combine(logsDirectory, "all.log"), contentAll);
|
||||
}
|
||||
public override bool AllowMultiple => false;
|
||||
}
|
||||
}
|
537
ProjectLighthouse/Migrations/20211104195812_AddPhotoSupport.Designer.cs
generated
Normal file
537
ProjectLighthouse/Migrations/20211104195812_AddPhotoSupport.Designer.cs
generated
Normal file
|
@ -0,0 +1,537 @@
|
|||
// <auto-generated />
|
||||
using System;
|
||||
using LBPUnion.ProjectLighthouse;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
namespace ProjectLighthouse.Migrations
|
||||
{
|
||||
[DbContext(typeof(Database))]
|
||||
[Migration("20211104195812_AddPhotoSupport")]
|
||||
partial class AddPhotoSupport
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64)
|
||||
.HasAnnotation("ProductVersion", "5.0.11");
|
||||
|
||||
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.Slot", b =>
|
||||
{
|
||||
b.Property<int>("SlotId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("AuthorLabels")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("BackgroundHash")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("CreatorId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<long>("FirstUploaded")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<int>("GameVersion")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("IconHash")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<bool>("InitiallyLocked")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<long>("LastUpdated")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<bool>("Lbp1Only")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
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")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("ResourceCollection")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("RootLevel")
|
||||
.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.Photo", b =>
|
||||
{
|
||||
b.Property<int>("PhotoId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("LargeHash")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("MediumHash")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("PlanHash")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("SlotId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("SmallHash")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<long>("Timestamp")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("PhotoId");
|
||||
|
||||
b.HasIndex("SlotId");
|
||||
|
||||
b.ToTable("Photos");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LBPUnion.ProjectLighthouse.Types.PhotoSubject", b =>
|
||||
{
|
||||
b.Property<int>("PhotoSubjectId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("PhotoId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("PhotoSubjectId");
|
||||
|
||||
b.HasIndex("PhotoId");
|
||||
|
||||
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>("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<string>("BooHash")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("CommentCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<bool>("CommentsEnabled")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<int>("FavouriteSlotCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("FavouriteUserCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Game")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("HeartCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("IconHash")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("Lists")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("LocationId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("LolCatFtwCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PhotosByMeCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PhotosWithMeCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Pins")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("PlanetHash")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("ReviewCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("StaffChallengeBronzeCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("StaffChallengeGoldCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("StaffChallengeSilverCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Username")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("YayHash")
|
||||
.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.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.Photo", b =>
|
||||
{
|
||||
b.HasOne("LBPUnion.ProjectLighthouse.Types.Levels.Slot", "Slot")
|
||||
.WithMany()
|
||||
.HasForeignKey("SlotId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Slot");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LBPUnion.ProjectLighthouse.Types.PhotoSubject", b =>
|
||||
{
|
||||
b.HasOne("LBPUnion.ProjectLighthouse.Types.Photo", null)
|
||||
.WithMany("Subjects")
|
||||
.HasForeignKey("PhotoId");
|
||||
});
|
||||
|
||||
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");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LBPUnion.ProjectLighthouse.Types.Photo", b =>
|
||||
{
|
||||
b.Navigation("Subjects");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,79 @@
|
|||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace ProjectLighthouse.Migrations
|
||||
{
|
||||
public partial class AddPhotoSupport : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Photos",
|
||||
columns: table => new
|
||||
{
|
||||
PhotoId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
Timestamp = table.Column<long>(type: "bigint", nullable: false),
|
||||
SmallHash = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
MediumHash = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
LargeHash = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
PlanHash = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
SlotId = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Photos", x => x.PhotoId);
|
||||
table.ForeignKey(
|
||||
name: "FK_Photos_Slots_SlotId",
|
||||
column: x => x.SlotId,
|
||||
principalTable: "Slots",
|
||||
principalColumn: "SlotId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "PhotoSubjects",
|
||||
columns: table => new
|
||||
{
|
||||
PhotoSubjectId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
PhotoId = table.Column<int>(type: "int", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_PhotoSubjects", x => x.PhotoSubjectId);
|
||||
table.ForeignKey(
|
||||
name: "FK_PhotoSubjects_Photos_PhotoId",
|
||||
column: x => x.PhotoId,
|
||||
principalTable: "Photos",
|
||||
principalColumn: "PhotoId",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Photos_SlotId",
|
||||
table: "Photos",
|
||||
column: "SlotId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PhotoSubjects_PhotoId",
|
||||
table: "PhotoSubjects",
|
||||
column: "PhotoId");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "PhotoSubjects");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Photos");
|
||||
}
|
||||
}
|
||||
}
|
554
ProjectLighthouse/Migrations/20211105205010_UpdatePhotoAndPhotoSubjectToDoStuffWeirdName.Designer.cs
generated
Normal file
554
ProjectLighthouse/Migrations/20211105205010_UpdatePhotoAndPhotoSubjectToDoStuffWeirdName.Designer.cs
generated
Normal file
|
@ -0,0 +1,554 @@
|
|||
// <auto-generated />
|
||||
using LBPUnion.ProjectLighthouse;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
namespace ProjectLighthouse.Migrations
|
||||
{
|
||||
[DbContext(typeof(Database))]
|
||||
[Migration("20211105205010_UpdatePhotoAndPhotoSubjectToDoStuffWeirdName")]
|
||||
partial class UpdatePhotoAndPhotoSubjectToDoStuffWeirdName
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64)
|
||||
.HasAnnotation("ProductVersion", "5.0.11");
|
||||
|
||||
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.Slot", b =>
|
||||
{
|
||||
b.Property<int>("SlotId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("AuthorLabels")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("BackgroundHash")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("CreatorId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<long>("FirstUploaded")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<int>("GameVersion")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("IconHash")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<bool>("InitiallyLocked")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<long>("LastUpdated")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<bool>("Lbp1Only")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
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")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("ResourceCollection")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("RootLevel")
|
||||
.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.Photo", b =>
|
||||
{
|
||||
b.Property<int>("PhotoId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("LargeHash")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("MediumHash")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("PhotoSubjectCollection")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("PlanHash")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("SlotId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("SmallHash")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<long>("Timestamp")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("PhotoId");
|
||||
|
||||
b.HasIndex("SlotId");
|
||||
|
||||
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>("ParentPhotoId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("PhotoSubjectId");
|
||||
|
||||
b.HasIndex("ParentPhotoId");
|
||||
|
||||
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>("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<string>("BooHash")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("CommentCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<bool>("CommentsEnabled")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<int>("FavouriteSlotCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("FavouriteUserCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Game")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("HeartCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("IconHash")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("Lists")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("LocationId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("LolCatFtwCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PhotosByMeCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PhotosWithMeCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Pins")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("PlanetHash")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("ReviewCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("StaffChallengeBronzeCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("StaffChallengeGoldCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("StaffChallengeSilverCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Username")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("YayHash")
|
||||
.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.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.Photo", b =>
|
||||
{
|
||||
b.HasOne("LBPUnion.ProjectLighthouse.Types.Levels.Slot", "Slot")
|
||||
.WithMany()
|
||||
.HasForeignKey("SlotId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Slot");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LBPUnion.ProjectLighthouse.Types.PhotoSubject", b =>
|
||||
{
|
||||
b.HasOne("LBPUnion.ProjectLighthouse.Types.Photo", "ParentPhoto")
|
||||
.WithMany()
|
||||
.HasForeignKey("ParentPhotoId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("LBPUnion.ProjectLighthouse.Types.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("ParentPhoto");
|
||||
|
||||
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,130 @@
|
|||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace ProjectLighthouse.Migrations
|
||||
{
|
||||
public partial class UpdatePhotoAndPhotoSubjectToDoStuffWeirdName : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_PhotoSubjects_Photos_PhotoId",
|
||||
table: "PhotoSubjects");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_PhotoSubjects_PhotoId",
|
||||
table: "PhotoSubjects");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "PhotoId",
|
||||
table: "PhotoSubjects");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "Bounds",
|
||||
table: "PhotoSubjects",
|
||||
type: "longtext",
|
||||
nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "ParentPhotoId",
|
||||
table: "PhotoSubjects",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "UserId",
|
||||
table: "PhotoSubjects",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "PhotoSubjectCollection",
|
||||
table: "Photos",
|
||||
type: "longtext",
|
||||
nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PhotoSubjects_ParentPhotoId",
|
||||
table: "PhotoSubjects",
|
||||
column: "ParentPhotoId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PhotoSubjects_UserId",
|
||||
table: "PhotoSubjects",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_PhotoSubjects_Photos_ParentPhotoId",
|
||||
table: "PhotoSubjects",
|
||||
column: "ParentPhotoId",
|
||||
principalTable: "Photos",
|
||||
principalColumn: "PhotoId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_PhotoSubjects_Users_UserId",
|
||||
table: "PhotoSubjects",
|
||||
column: "UserId",
|
||||
principalTable: "Users",
|
||||
principalColumn: "UserId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_PhotoSubjects_Photos_ParentPhotoId",
|
||||
table: "PhotoSubjects");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_PhotoSubjects_Users_UserId",
|
||||
table: "PhotoSubjects");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_PhotoSubjects_ParentPhotoId",
|
||||
table: "PhotoSubjects");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_PhotoSubjects_UserId",
|
||||
table: "PhotoSubjects");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Bounds",
|
||||
table: "PhotoSubjects");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ParentPhotoId",
|
||||
table: "PhotoSubjects");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "UserId",
|
||||
table: "PhotoSubjects");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "PhotoSubjectCollection",
|
||||
table: "Photos");
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "PhotoId",
|
||||
table: "PhotoSubjects",
|
||||
type: "int",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PhotoSubjects_PhotoId",
|
||||
table: "PhotoSubjects",
|
||||
column: "PhotoId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_PhotoSubjects_Photos_PhotoId",
|
||||
table: "PhotoSubjects",
|
||||
column: "PhotoId",
|
||||
principalTable: "Photos",
|
||||
principalColumn: "PhotoId",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
}
|
||||
}
|
||||
}
|
541
ProjectLighthouse/Migrations/20211105205239_DropPhotoSubjectParentPhoto.Designer.cs
generated
Normal file
541
ProjectLighthouse/Migrations/20211105205239_DropPhotoSubjectParentPhoto.Designer.cs
generated
Normal file
|
@ -0,0 +1,541 @@
|
|||
// <auto-generated />
|
||||
using LBPUnion.ProjectLighthouse;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
namespace ProjectLighthouse.Migrations
|
||||
{
|
||||
[DbContext(typeof(Database))]
|
||||
[Migration("20211105205239_DropPhotoSubjectParentPhoto")]
|
||||
partial class DropPhotoSubjectParentPhoto
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64)
|
||||
.HasAnnotation("ProductVersion", "5.0.11");
|
||||
|
||||
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.Slot", b =>
|
||||
{
|
||||
b.Property<int>("SlotId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("AuthorLabels")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("BackgroundHash")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("CreatorId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<long>("FirstUploaded")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<int>("GameVersion")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("IconHash")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<bool>("InitiallyLocked")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<long>("LastUpdated")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<bool>("Lbp1Only")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
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")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("ResourceCollection")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("RootLevel")
|
||||
.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.Photo", b =>
|
||||
{
|
||||
b.Property<int>("PhotoId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("LargeHash")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("MediumHash")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("PhotoSubjectCollection")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("PlanHash")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("SlotId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("SmallHash")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<long>("Timestamp")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("PhotoId");
|
||||
|
||||
b.HasIndex("SlotId");
|
||||
|
||||
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>("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<string>("BooHash")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("CommentCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<bool>("CommentsEnabled")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<int>("FavouriteSlotCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("FavouriteUserCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Game")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("HeartCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("IconHash")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("Lists")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("LocationId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("LolCatFtwCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PhotosByMeCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PhotosWithMeCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Pins")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("PlanetHash")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("ReviewCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("StaffChallengeBronzeCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("StaffChallengeGoldCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("StaffChallengeSilverCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Username")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("YayHash")
|
||||
.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.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.Photo", b =>
|
||||
{
|
||||
b.HasOne("LBPUnion.ProjectLighthouse.Types.Levels.Slot", "Slot")
|
||||
.WithMany()
|
||||
.HasForeignKey("SlotId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Slot");
|
||||
});
|
||||
|
||||
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,45 @@
|
|||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace ProjectLighthouse.Migrations
|
||||
{
|
||||
public partial class DropPhotoSubjectParentPhoto : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_PhotoSubjects_Photos_ParentPhotoId",
|
||||
table: "PhotoSubjects");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_PhotoSubjects_ParentPhotoId",
|
||||
table: "PhotoSubjects");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ParentPhotoId",
|
||||
table: "PhotoSubjects");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "ParentPhotoId",
|
||||
table: "PhotoSubjects",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PhotoSubjects_ParentPhotoId",
|
||||
table: "PhotoSubjects",
|
||||
column: "ParentPhotoId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_PhotoSubjects_Photos_ParentPhotoId",
|
||||
table: "PhotoSubjects",
|
||||
column: "ParentPhotoId",
|
||||
principalTable: "Photos",
|
||||
principalColumn: "PhotoId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
}
|
||||
}
|
525
ProjectLighthouse/Migrations/20211105205749_DropPhotoSlot.Designer.cs
generated
Normal file
525
ProjectLighthouse/Migrations/20211105205749_DropPhotoSlot.Designer.cs
generated
Normal file
|
@ -0,0 +1,525 @@
|
|||
// <auto-generated />
|
||||
using LBPUnion.ProjectLighthouse;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
namespace ProjectLighthouse.Migrations
|
||||
{
|
||||
[DbContext(typeof(Database))]
|
||||
[Migration("20211105205749_DropPhotoSlot")]
|
||||
partial class DropPhotoSlot
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64)
|
||||
.HasAnnotation("ProductVersion", "5.0.11");
|
||||
|
||||
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.Slot", b =>
|
||||
{
|
||||
b.Property<int>("SlotId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("AuthorLabels")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("BackgroundHash")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("CreatorId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<long>("FirstUploaded")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<int>("GameVersion")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("IconHash")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<bool>("InitiallyLocked")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<long>("LastUpdated")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<bool>("Lbp1Only")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
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")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("ResourceCollection")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("RootLevel")
|
||||
.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.Photo", b =>
|
||||
{
|
||||
b.Property<int>("PhotoId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("LargeHash")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("MediumHash")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("PhotoSubjectCollection")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("PlanHash")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("SmallHash")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<long>("Timestamp")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("PhotoId");
|
||||
|
||||
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>("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<string>("BooHash")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("CommentCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<bool>("CommentsEnabled")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<int>("FavouriteSlotCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("FavouriteUserCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Game")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("HeartCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("IconHash")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("Lists")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("LocationId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("LolCatFtwCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PhotosByMeCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PhotosWithMeCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Pins")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("PlanetHash")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("ReviewCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("StaffChallengeBronzeCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("StaffChallengeGoldCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("StaffChallengeSilverCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Username")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("YayHash")
|
||||
.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.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.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
|
||||
}
|
||||
}
|
||||
}
|
45
ProjectLighthouse/Migrations/20211105205749_DropPhotoSlot.cs
Normal file
45
ProjectLighthouse/Migrations/20211105205749_DropPhotoSlot.cs
Normal file
|
@ -0,0 +1,45 @@
|
|||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace ProjectLighthouse.Migrations
|
||||
{
|
||||
public partial class DropPhotoSlot : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Photos_Slots_SlotId",
|
||||
table: "Photos");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Photos_SlotId",
|
||||
table: "Photos");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "SlotId",
|
||||
table: "Photos");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "SlotId",
|
||||
table: "Photos",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Photos_SlotId",
|
||||
table: "Photos",
|
||||
column: "SlotId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Photos_Slots_SlotId",
|
||||
table: "Photos",
|
||||
column: "SlotId",
|
||||
principalTable: "Slots",
|
||||
principalColumn: "SlotId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
}
|
||||
}
|
541
ProjectLighthouse/Migrations/20211106010424_AddCreatorToPhoto.Designer.cs
generated
Normal file
541
ProjectLighthouse/Migrations/20211106010424_AddCreatorToPhoto.Designer.cs
generated
Normal file
|
@ -0,0 +1,541 @@
|
|||
// <auto-generated />
|
||||
using LBPUnion.ProjectLighthouse;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
namespace ProjectLighthouse.Migrations
|
||||
{
|
||||
[DbContext(typeof(Database))]
|
||||
[Migration("20211106010424_AddCreatorToPhoto")]
|
||||
partial class AddCreatorToPhoto
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64)
|
||||
.HasAnnotation("ProductVersion", "5.0.11");
|
||||
|
||||
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.Slot", b =>
|
||||
{
|
||||
b.Property<int>("SlotId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("AuthorLabels")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("BackgroundHash")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("CreatorId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<long>("FirstUploaded")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<int>("GameVersion")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("IconHash")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<bool>("InitiallyLocked")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<long>("LastUpdated")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<bool>("Lbp1Only")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
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")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("ResourceCollection")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("RootLevel")
|
||||
.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.Photo", b =>
|
||||
{
|
||||
b.Property<int>("PhotoId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("CreatorId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("LargeHash")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("MediumHash")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("PhotoSubjectCollection")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("PlanHash")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("SmallHash")
|
||||
.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>("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<string>("BooHash")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("CommentCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<bool>("CommentsEnabled")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<int>("FavouriteSlotCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("FavouriteUserCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Game")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("HeartCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("IconHash")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("Lists")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("LocationId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("LolCatFtwCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PhotosByMeCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PhotosWithMeCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Pins")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("PlanetHash")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("ReviewCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("StaffChallengeBronzeCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("StaffChallengeGoldCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("StaffChallengeSilverCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Username")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("YayHash")
|
||||
.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.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.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,49 @@
|
|||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace ProjectLighthouse.Migrations
|
||||
{
|
||||
public partial class AddCreatorToPhoto : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
// Conflicts with old data.
|
||||
migrationBuilder.Sql("DELETE FROM Photos;");
|
||||
migrationBuilder.Sql("DELETE FROM PhotoSubjects;"); // Also delete PhotoSubjects while we're at it.
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "CreatorId",
|
||||
table: "Photos",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Photos_CreatorId",
|
||||
table: "Photos",
|
||||
column: "CreatorId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Photos_Users_CreatorId",
|
||||
table: "Photos",
|
||||
column: "CreatorId",
|
||||
principalTable: "Users",
|
||||
principalColumn: "UserId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Photos_Users_CreatorId",
|
||||
table: "Photos");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Photos_CreatorId",
|
||||
table: "Photos");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "CreatorId",
|
||||
table: "Photos");
|
||||
}
|
||||
}
|
||||
}
|
540
ProjectLighthouse/Migrations/20211107023452_NoPhotosByMeOrWithMeInUser.Designer.cs
generated
Normal file
540
ProjectLighthouse/Migrations/20211107023452_NoPhotosByMeOrWithMeInUser.Designer.cs
generated
Normal file
|
@ -0,0 +1,540 @@
|
|||
// <auto-generated />
|
||||
using LBPUnion.ProjectLighthouse;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
namespace ProjectLighthouse.Migrations
|
||||
{
|
||||
[DbContext(typeof(Database))]
|
||||
[Migration("20211107023452_NoPhotosByMeOrWithMeInUser")]
|
||||
partial class NoPhotosByMeOrWithMeInUser
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64)
|
||||
.HasAnnotation("ProductVersion", "5.0.11");
|
||||
|
||||
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.Slot", b =>
|
||||
{
|
||||
b.Property<int>("SlotId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("AuthorLabels")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("BackgroundHash")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("CreatorId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<long>("FirstUploaded")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<int>("GameVersion")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("IconHash")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<bool>("InitiallyLocked")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<long>("LastUpdated")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<bool>("Lbp1Only")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
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")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("ResourceCollection")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("RootLevel")
|
||||
.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.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>("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<string>("BooHash")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("CommentCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<bool>("CommentsEnabled")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<int>("FavouriteSlotCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("FavouriteUserCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Game")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("HeartCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("IconHash")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("Lists")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("LocationId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("LolCatFtwCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Pins")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("PlanetHash")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("ReviewCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("StaffChallengeBronzeCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("StaffChallengeGoldCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("StaffChallengeSilverCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Username")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("YayHash")
|
||||
.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.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.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,145 @@
|
|||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace ProjectLighthouse.Migrations
|
||||
{
|
||||
public partial class NoPhotosByMeOrWithMeInUser : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "PhotosByMeCount",
|
||||
table: "Users");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "PhotosWithMeCount",
|
||||
table: "Users");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "SmallHash",
|
||||
table: "Photos",
|
||||
type: "longtext",
|
||||
nullable: false,
|
||||
defaultValue: "",
|
||||
oldClrType: typeof(string),
|
||||
oldType: "longtext",
|
||||
oldNullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "PlanHash",
|
||||
table: "Photos",
|
||||
type: "longtext",
|
||||
nullable: false,
|
||||
defaultValue: "",
|
||||
oldClrType: typeof(string),
|
||||
oldType: "longtext",
|
||||
oldNullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "PhotoSubjectCollection",
|
||||
table: "Photos",
|
||||
type: "longtext",
|
||||
nullable: false,
|
||||
defaultValue: "",
|
||||
oldClrType: typeof(string),
|
||||
oldType: "longtext",
|
||||
oldNullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "MediumHash",
|
||||
table: "Photos",
|
||||
type: "longtext",
|
||||
nullable: false,
|
||||
defaultValue: "",
|
||||
oldClrType: typeof(string),
|
||||
oldType: "longtext",
|
||||
oldNullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "LargeHash",
|
||||
table: "Photos",
|
||||
type: "longtext",
|
||||
nullable: false,
|
||||
defaultValue: "",
|
||||
oldClrType: typeof(string),
|
||||
oldType: "longtext",
|
||||
oldNullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "PhotosByMeCount",
|
||||
table: "Users",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "PhotosWithMeCount",
|
||||
table: "Users",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "SmallHash",
|
||||
table: "Photos",
|
||||
type: "longtext",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "longtext")
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "PlanHash",
|
||||
table: "Photos",
|
||||
type: "longtext",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "longtext")
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "PhotoSubjectCollection",
|
||||
table: "Photos",
|
||||
type: "longtext",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "longtext")
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "MediumHash",
|
||||
table: "Photos",
|
||||
type: "longtext",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "longtext")
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "LargeHash",
|
||||
table: "Photos",
|
||||
type: "longtext",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "longtext")
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -154,6 +154,64 @@ namespace ProjectLighthouse.Migrations
|
|||
b.ToTable("Slots");
|
||||
});
|
||||
|
||||
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")
|
||||
|
@ -305,12 +363,6 @@ namespace ProjectLighthouse.Migrations
|
|||
b.Property<int>("LolCatFtwCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PhotosByMeCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PhotosWithMeCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Pins")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
|
@ -418,6 +470,28 @@ namespace ProjectLighthouse.Migrations
|
|||
b.Navigation("Location");
|
||||
});
|
||||
|
||||
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")
|
||||
|
|
|
@ -8,19 +8,19 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BCrypt.Net-Next" Version="4.0.2" />
|
||||
<PackageReference Include="Kettu" Version="1.2.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="5.0.11" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.11" />
|
||||
<PackageReference Include="BCrypt.Net-Next" Version="4.0.2"/>
|
||||
<PackageReference Include="Kettu" Version="1.2.0"/>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="5.0.11"/>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.11"/>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.11">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="5.0.2" />
|
||||
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="5.0.2"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="Types\SlotXsd.cs" />
|
||||
<Compile Remove="Types\SlotXsd.cs"/>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -27,9 +27,7 @@ namespace LBPUnion.ProjectLighthouse.Serialization
|
|||
public static string TaggedStringElement(string key, object value, string tagKey, object tagValue) => $"<{key} {tagKey}=\"{tagValue}\">{value}</{key}>";
|
||||
|
||||
public static string TaggedStringElement(string key, object value, Dictionary<string, object> attrKeyValuePairs)
|
||||
=> $"<{key} " +
|
||||
Enumerable.Aggregate(attrKeyValuePairs, string.Empty, (current, kvp) => current + $"{kvp.Key}=\"{kvp.Value}\" ") +
|
||||
$">{value}</{key}>";
|
||||
=> $"<{key} " + attrKeyValuePairs.Aggregate(string.Empty, (current, kvp) => current + $"{kvp.Key}=\"{kvp.Value}\" ") + $">{value}</{key}>";
|
||||
|
||||
public static string Elements
|
||||
(params KeyValuePair<string, object>[] pairs)
|
||||
|
|
104
ProjectLighthouse/Types/Photo.cs
Normal file
104
ProjectLighthouse/Types/Photo.cs
Normal file
|
@ -0,0 +1,104 @@
|
|||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Xml.Serialization;
|
||||
using LBPUnion.ProjectLighthouse.Serialization;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace LBPUnion.ProjectLighthouse.Types
|
||||
{
|
||||
[XmlRoot("photo")]
|
||||
[XmlType("photo")]
|
||||
public class Photo
|
||||
{
|
||||
[Key]
|
||||
public int PhotoId { get; set; }
|
||||
|
||||
// Uses seconds instead of milliseconds for some reason
|
||||
[XmlAttribute("timestamp")]
|
||||
public long Timestamp { get; set; }
|
||||
|
||||
[XmlElement("small")]
|
||||
public string SmallHash { get; set; }
|
||||
|
||||
[XmlElement("medium")]
|
||||
public string MediumHash { get; set; }
|
||||
|
||||
[XmlElement("large")]
|
||||
public string LargeHash { get; set; }
|
||||
|
||||
[XmlElement("plan")]
|
||||
public string PlanHash { get; set; }
|
||||
|
||||
// [XmlIgnore]
|
||||
// public int SlotId { get; set; }
|
||||
//
|
||||
// [XmlIgnore]
|
||||
// [ForeignKey(nameof(SlotId))]
|
||||
// public Slot Slot { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Only use when parsing from XML.
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
[XmlArray("subjects")]
|
||||
[XmlArrayItem("subject")]
|
||||
public List<PhotoSubject> Subjects { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
[XmlIgnore]
|
||||
public string[] PhotoSubjectIds {
|
||||
get => this.PhotoSubjectCollection.Split(",");
|
||||
set => this.PhotoSubjectCollection = string.Join(',', value);
|
||||
}
|
||||
|
||||
public string PhotoSubjectCollection { get; set; }
|
||||
|
||||
public int CreatorId { get; set; }
|
||||
|
||||
[ForeignKey(nameof(CreatorId))]
|
||||
public User Creator { get; set; }
|
||||
|
||||
public List<PhotoSubject> GetSubjects()
|
||||
{
|
||||
List<PhotoSubject> response = new();
|
||||
|
||||
using Database database = new();
|
||||
|
||||
foreach (string idStr in this.PhotoSubjectIds)
|
||||
{
|
||||
if (string.IsNullOrEmpty(idStr)) continue;
|
||||
|
||||
if (!int.TryParse(idStr, out int id)) throw new InvalidCastException(idStr + " is not a valid number.");
|
||||
|
||||
PhotoSubject? photoSubject = database.PhotoSubjects.Include(p => p.User).FirstOrDefault(p => p.PhotoSubjectId == id);
|
||||
if (photoSubject == null) continue;
|
||||
|
||||
response.Add(photoSubject);
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
public string Serialize(int slotId)
|
||||
{
|
||||
string slot = LbpSerializer.TaggedStringElement("slot", LbpSerializer.StringElement("id", slotId), "type", "user");
|
||||
|
||||
string subjects = this.GetSubjects().Aggregate(string.Empty, (s, subject) => s + subject.Serialize());
|
||||
|
||||
string photo = LbpSerializer.StringElement("id", this.PhotoId) +
|
||||
LbpSerializer.StringElement("small", this.SmallHash) +
|
||||
LbpSerializer.StringElement("medium", this.MediumHash) +
|
||||
LbpSerializer.StringElement("large", this.LargeHash) +
|
||||
LbpSerializer.StringElement("plan", this.PlanHash) +
|
||||
LbpSerializer.StringElement("author", this.CreatorId) +
|
||||
LbpSerializer.StringElement("subjects", subjects) +
|
||||
slot;
|
||||
|
||||
return LbpSerializer.TaggedStringElement("photo", photo, "timestamp", Timestamp * 1000);
|
||||
}
|
||||
}
|
||||
}
|
41
ProjectLighthouse/Types/PhotoSubject.cs
Normal file
41
ProjectLighthouse/Types/PhotoSubject.cs
Normal file
|
@ -0,0 +1,41 @@
|
|||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Xml.Serialization;
|
||||
using LBPUnion.ProjectLighthouse.Serialization;
|
||||
|
||||
namespace LBPUnion.ProjectLighthouse.Types
|
||||
{
|
||||
// [XmlRoot("subject")]
|
||||
[XmlType("subject")]
|
||||
[Serializable]
|
||||
public class PhotoSubject
|
||||
{
|
||||
[Key]
|
||||
[XmlIgnore]
|
||||
public int PhotoSubjectId { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
public int UserId { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
[ForeignKey(nameof(UserId))]
|
||||
public User User { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
[XmlElement("npHandle")]
|
||||
public string Username { get; set; }
|
||||
|
||||
[XmlElement("bounds")]
|
||||
public string Bounds { get; set; }
|
||||
|
||||
public string Serialize()
|
||||
{
|
||||
string response = LbpSerializer.StringElement("npHandle", User.Username) +
|
||||
LbpSerializer.StringElement("displayName", User.Username) +
|
||||
LbpSerializer.StringElement("bounds", Bounds);
|
||||
|
||||
return LbpSerializer.StringElement("subject", response);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -29,16 +29,14 @@ namespace LBPUnion.ProjectLighthouse.Types
|
|||
|
||||
[NotMapped]
|
||||
[XmlElement("playerIds")]
|
||||
public string[] PlayerIds
|
||||
{
|
||||
public string[] PlayerIds {
|
||||
get => this.PlayerIdCollection.Split(",");
|
||||
set => this.PlayerIdCollection = string.Join(',', value);
|
||||
}
|
||||
|
||||
[NotMapped]
|
||||
[XmlElement("mainPlayer")]
|
||||
public string MainPlayer
|
||||
{
|
||||
public string MainPlayer {
|
||||
get => this.PlayerIds[0];
|
||||
set => this.PlayerIds[0] = value;
|
||||
}
|
||||
|
|
|
@ -27,8 +27,18 @@ namespace LBPUnion.ProjectLighthouse.Types
|
|||
|
||||
public int ReviewCount { get; set; }
|
||||
public int CommentCount { get; set; }
|
||||
public int PhotosByMeCount { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public int PhotosByMeCount {
|
||||
get {
|
||||
using Database database = new();
|
||||
return database.Photos.Count(p => p.CreatorId == this.UserId);
|
||||
}
|
||||
}
|
||||
|
||||
[NotMapped]
|
||||
public int PhotosWithMeCount { get; set; }
|
||||
|
||||
public bool CommentsEnabled { get; set; }
|
||||
|
||||
public int LocationId { get; set; }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"sdk": {
|
||||
"version": "5.0",
|
||||
"version": "6.0",
|
||||
"rollForward": "latestMajor",
|
||||
"allowPrerelease": true
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue