Separate player entity from player request

This commit is contained in:
CyberL1 2024-02-23 14:33:12 +01:00
parent c472eff002
commit 9f90a40aee
3 changed files with 16 additions and 2 deletions

View File

@ -2,6 +2,7 @@
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Minecraft_Realms_Emulator.Data; using Minecraft_Realms_Emulator.Data;
using Minecraft_Realms_Emulator.Entities; using Minecraft_Realms_Emulator.Entities;
using Minecraft_Realms_Emulator.Requests;
using Minecraft_Realms_Emulator.Responses; using Minecraft_Realms_Emulator.Responses;
namespace Minecraft_Realms_Emulator.Controllers namespace Minecraft_Realms_Emulator.Controllers
@ -91,7 +92,7 @@ namespace Minecraft_Realms_Emulator.Controllers
} }
[HttpPost("{wId}")] [HttpPost("{wId}")]
public async Task<ActionResult<World>> InvitePlayer(int wId, Player body) public async Task<ActionResult<World>> InvitePlayer(int wId, PlayerRequest body)
{ {
string cookie = Request.Headers.Cookie; string cookie = Request.Headers.Cookie;
string playerName = cookie.Split(";")[1].Split("=")[1]; string playerName = cookie.Split(";")[1].Split("=")[1];

View File

@ -9,6 +9,6 @@
public bool Accepted { get; set; } public bool Accepted { get; set; }
public bool Online { get; set; } public bool Online { get; set; }
public string Permission { get; set; } = "MEMBER"; public string Permission { get; set; } = "MEMBER";
public World? World { get; set; } public World World { get; set; }
} }
} }

View File

@ -0,0 +1,13 @@
namespace Minecraft_Realms_Emulator.Requests
{
public class PlayerRequest
{
public int Id { get; set; }
public string Name { get; set; } = string.Empty;
public string Uuid { get; set; } = string.Empty;
public bool Operator { get; set; }
public bool Accepted { get; set; }
public bool Online { get; set; }
public string Permission { get; set; } = "MEMBER";
}
}