Merge pull request #13 from LBPUnion/level-uploading

Level uploading
This commit is contained in:
jvyden 2021-10-17 17:06:43 -04:00 committed by GitHub
commit e8e79657e6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View file

@ -25,7 +25,9 @@ namespace ProjectLighthouse.Controllers {
Slot slot = await this.GetSlotFromBody();
if(slot == null) return this.BadRequest(); // if the level cant be parsed then it obviously cant be uploaded
return this.Ok(LbpSerializer.TaggedStringElement("slot", "", "type", "user"));
string resource = LbpSerializer.StringElement("resource", slot.Resource);
return this.Ok(LbpSerializer.TaggedStringElement("slot", resource, "type", "user"));
}
/// <summary>
@ -56,7 +58,9 @@ namespace ProjectLighthouse.Controllers {
[HttpPost("unpublish/{id:int}")]
public async Task<IActionResult> Unpublish(int id) {
Slot slot = await database.Slots.FirstOrDefaultAsync(s => s.SlotId == id);
Slot slot = await database.Slots
.Include(s => s.Location)
.FirstOrDefaultAsync(s => s.SlotId == id);
database.Locations.Remove(slot.Location);
database.Slots.Remove(slot);

View file

@ -85,6 +85,7 @@ namespace ProjectLighthouse.Types {
LbpSerializer.StringElement("npHandle", Creator.Username) +
LbpSerializer.StringElement("description", Description) +
LbpSerializer.StringElement("icon", IconHash) +
LbpSerializer.StringElement("rootLevel", RootLevel) +
LbpSerializer.StringElement("resource", Resource) +
LbpSerializer.StringElement("location", Location.Serialize()) +
LbpSerializer.StringElement("initiallyLocked", InitiallyLocked) +