From fcd1f25084b9a1f12b3499d689d5d8f69aa04e5f Mon Sep 17 00:00:00 2001 From: jvyden Date: Tue, 19 Oct 2021 14:58:10 -0400 Subject: [PATCH] Use {get;set;} defaults for User and Slot --- ProjectLighthouse/Controllers/PublishController.cs | 3 +-- ProjectLighthouse/Database.cs | 2 -- ProjectLighthouse/Types/Slot.cs | 6 +++--- ProjectLighthouse/Types/User.cs | 4 ++-- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/ProjectLighthouse/Controllers/PublishController.cs b/ProjectLighthouse/Controllers/PublishController.cs index d0839e30..abb3978f 100644 --- a/ProjectLighthouse/Controllers/PublishController.cs +++ b/ProjectLighthouse/Controllers/PublishController.cs @@ -43,13 +43,12 @@ namespace ProjectLighthouse.Controllers { //TODO: parse location in body Location l = new() { X = 0, - Y = 0 + Y = 0, }; database.Locations.Add(l); await database.SaveChangesAsync(); slot.LocationId = l.Id; slot.CreatorId = user.UserId; - if(slot.BackgroundHash == null) slot.BackgroundHash = ""; database.Slots.Add(slot); await database.SaveChangesAsync(); diff --git a/ProjectLighthouse/Database.cs b/ProjectLighthouse/Database.cs index 2182c8ec..d4adeafc 100644 --- a/ProjectLighthouse/Database.cs +++ b/ProjectLighthouse/Database.cs @@ -28,8 +28,6 @@ namespace ProjectLighthouse { Username = username, LocationId = l.Id, Biography = username + " hasn't introduced themselves yet.", - Pins = "", - PlanetHash = "", }; this.Users.Add(user); diff --git a/ProjectLighthouse/Types/Slot.cs b/ProjectLighthouse/Types/Slot.cs index 64e5c01c..75662fba 100644 --- a/ProjectLighthouse/Types/Slot.cs +++ b/ProjectLighthouse/Types/Slot.cs @@ -65,9 +65,9 @@ namespace ProjectLighthouse.Types { [XmlElement("authorLabels")] public string AuthorLabels { get; set; } - - [XmlElement("background")] - public string BackgroundHash { get; set; } + + [XmlElement("background")] + public string BackgroundHash { get; set; } = ""; [XmlElement("minPlayers")] public int MinimumPlayers { get; set; } diff --git a/ProjectLighthouse/Types/User.cs b/ProjectLighthouse/Types/User.cs index 0badffc0..ac846725 100644 --- a/ProjectLighthouse/Types/User.cs +++ b/ProjectLighthouse/Types/User.cs @@ -34,12 +34,12 @@ namespace ProjectLighthouse.Types { public int FavouriteSlotCount { get; set; } public int FavouriteUserCount { get; set; } public int LolCatFtwCount { get; set; } - public string Pins { get; set; } + public string Pins { get; set; } = ""; public int StaffChallengeGoldCount { get; set; } public int StaffChallengeSilverCount { get; set; } public int StaffChallengeBronzeCount { get; set; } - public string PlanetHash { get; set; } + public string PlanetHash { get; set; } = ""; // [NotMapped] public readonly ClientsConnected ClientsConnected = new();