begin new and last rework
This commit is contained in:
34
OwnChar.Server/Api/Endpoint/Implementations/CharactersApi.cs
Normal file
34
OwnChar.Server/Api/Endpoint/Implementations/CharactersApi.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
namespace OwnChar.ServerNew.Api.Endpoint.Implementations;
|
||||
|
||||
internal class CharactersApi(IServer server) : IApiEndpoint
|
||||
{
|
||||
public void Initialize(IApiBuilder builder)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private IResult GetCharacter(long characterId)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private IResult CreateGroupCharacter(string name, long groupId)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private IResult CreateUserCharacter(string name, long userId)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private IResult UpdateCharacter(long characterId)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private IResult DeleteCharacter(long characterId)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
48
OwnChar.Server/Api/Endpoint/Implementations/GroupsApi.cs
Normal file
48
OwnChar.Server/Api/Endpoint/Implementations/GroupsApi.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
namespace OwnChar.ServerNew.Api.Endpoint.Implementations;
|
||||
|
||||
internal class GroupsApi(IServer server) : IApiEndpoint
|
||||
{
|
||||
public void Initialize(IApiBuilder builder)
|
||||
{
|
||||
}
|
||||
|
||||
private IResult GetGroups()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private IResult GetGroups(long characterId)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private IResult GetGroup(long groupId)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private IResult CreateGroup(string name)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private IResult UpdateGroup(int groupId, string name)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private IResult DeleteGroup(int groupId)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private IResult AddMember(int groupId, long memberId)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private IResult RemoveMember(int groupId, long memberId)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
31
OwnChar.Server/Api/Endpoint/Implementations/LoginApi.cs
Normal file
31
OwnChar.Server/Api/Endpoint/Implementations/LoginApi.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using OwnChar.Api.Responses;
|
||||
using OwnChar.Model;
|
||||
|
||||
namespace OwnChar.ServerNew.Api.Endpoint.Implementations;
|
||||
|
||||
internal class LoginApi(ServerContext server) : IApiEndpoint
|
||||
{
|
||||
public void Initialize(IApiBuilder builder)
|
||||
{
|
||||
builder.Map("/auth/login/{username}", Login);
|
||||
builder.Map("/auth/logout/{secret}", Logout);
|
||||
}
|
||||
|
||||
private IResult Login(string username, [FromHeader(Name = "X-USER-PASSWORD")] string password)
|
||||
{
|
||||
if (server.Data != null && server.Data.GetAll<UserAccount>()?.FirstOrDefault(n => n.Username == username && n.Password == password) is UserAccount account)
|
||||
return TypedResults.Ok(new LoginResponse
|
||||
{
|
||||
Secret = server.Login(account),
|
||||
UserAccount = account,
|
||||
});
|
||||
return TypedResults.Unauthorized();
|
||||
}
|
||||
|
||||
private IResult Logout([FromHeader(Name = "X-AUTH-SECRET")] string secret)
|
||||
{
|
||||
server.Logout(secret);
|
||||
return TypedResults.Ok();
|
||||
}
|
||||
}
|
||||
44
OwnChar.Server/Api/Endpoint/Implementations/UsersApi.cs
Normal file
44
OwnChar.Server/Api/Endpoint/Implementations/UsersApi.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
namespace OwnChar.ServerNew.Api.Endpoint.Implementations;
|
||||
|
||||
internal class UsersApi(IServer server) : IApiEndpoint
|
||||
{
|
||||
public void Initialize(IApiBuilder builder)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private IResult GetUsers()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private IResult GetUser(long userId)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private IResult GetUserProfile(long userId)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private IResult CreateUser(string username, string password)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private IResult DeleteUser(long userId)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private IResult UpdateUserPassword(long userId, string username, string password)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private IResult UpdateUserProfile(long profileId, string displayName)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user