getaccountinfo endpoint renamed
This commit is contained in:
@@ -94,11 +94,11 @@ public class AccountsController(IAccountsControllerService accountsControllerSer
|
|||||||
|
|
||||||
#region Info
|
#region Info
|
||||||
|
|
||||||
[HttpGet("{id}/info")]
|
[HttpGet("{id}")]
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
[ProducesResponseType(typeof(AccountResponse), StatusCodes.Status200OK)]
|
[ProducesResponseType(typeof(AccountResponse), StatusCodes.Status200OK)]
|
||||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||||
public async Task<ActionResult> GetAccountInfo([FromRoute]long id) => await accountsControllerService.GetAccountInfo(id);
|
public async Task<ActionResult> GetAccount([FromRoute]long id) => await accountsControllerService.GetAccount(id);
|
||||||
|
|
||||||
[HttpPut("profile_info")]
|
[HttpPut("profile_info")]
|
||||||
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]
|
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]
|
||||||
|
|||||||
@@ -238,7 +238,7 @@ public class AccountsControllerService(
|
|||||||
|
|
||||||
#region Info
|
#region Info
|
||||||
|
|
||||||
public async Task<RequestResult> GetAccountInfo(long id)
|
public async Task<RequestResult> GetAccount(long id)
|
||||||
{
|
{
|
||||||
Account? account = await database.Accounts.FirstOrDefaultAsync(x => x.Id == id);
|
Account? account = await database.Accounts.FirstOrDefaultAsync(x => x.Id == id);
|
||||||
if (account is null)
|
if (account is null)
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public interface IAccountsControllerService
|
|||||||
Task<RequestResult> GetAccountProfileBackground(long id);
|
Task<RequestResult> GetAccountProfileBackground(long id);
|
||||||
Task<RequestResult> PutAccountProfileBackground(AccountProfileBackgroundRequest data);
|
Task<RequestResult> PutAccountProfileBackground(AccountProfileBackgroundRequest data);
|
||||||
Task<RequestResult> DeleteAccountProfileBackground();
|
Task<RequestResult> DeleteAccountProfileBackground();
|
||||||
Task<RequestResult> GetAccountInfo(long id);
|
Task<RequestResult> GetAccount(long id);
|
||||||
Task<RequestResult> PutAccountProfileInfo(AccountProfileInfoRequest data);
|
Task<RequestResult> PutAccountProfileInfo(AccountProfileInfoRequest data);
|
||||||
Task<RequestResult> PatchAccountUsername(AccountUsernameRequest data);
|
Task<RequestResult> PatchAccountUsername(AccountUsernameRequest data);
|
||||||
Task<RequestResult> PatchAccountEmail(AccountEmailRequest data);
|
Task<RequestResult> PatchAccountEmail(AccountEmailRequest data);
|
||||||
|
|||||||
@@ -150,9 +150,9 @@ public class AccountsClientService(IHttpClientService httpClientService, IConfig
|
|||||||
.ExecuteAction();
|
.ExecuteAction();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task GetAccountInfo(long id, Action<AccountResponse>? successAction = null, Action? notFoundAction = null)
|
public async Task GetAccount(long id, Action<AccountResponse>? successAction = null, Action? notFoundAction = null)
|
||||||
{
|
{
|
||||||
string url = GetUrl(EndpointsConfiguration.Accounts.GetAccountInfo, id);
|
string url = GetUrl(EndpointsConfiguration.Accounts.GetAccount, id);
|
||||||
HttpRequest request = new HttpRequest(HttpMethodType.Get, url);
|
HttpRequest request = new HttpRequest(HttpMethodType.Get, url);
|
||||||
|
|
||||||
HttpResponse response = await httpClientService.SendRequestAsync(request);
|
HttpResponse response = await httpClientService.SendRequestAsync(request);
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ public interface IAccountsClientService
|
|||||||
Task GetAccountProfileBackground(long id, Action<PhotoResponse>? successAction = null, Action<IDictionary<string, string[]>>? badRequestAction = null, Action? notFoundAction = null);
|
Task GetAccountProfileBackground(long id, Action<PhotoResponse>? successAction = null, Action<IDictionary<string, string[]>>? badRequestAction = null, Action? notFoundAction = null);
|
||||||
Task PutAccountProfileBackground(AccountProfileBackgroundRequest data, Action<PhotoResponse>? successAction = null, Action<IDictionary<string, string[]>>? badRequestAction = null, Action? unauthorizedAction = null);
|
Task PutAccountProfileBackground(AccountProfileBackgroundRequest data, Action<PhotoResponse>? successAction = null, Action<IDictionary<string, string[]>>? badRequestAction = null, Action? unauthorizedAction = null);
|
||||||
Task DeleteAccountProfileBackground(Action? successAction = null, Action? unauthorizedAction = null);
|
Task DeleteAccountProfileBackground(Action? successAction = null, Action? unauthorizedAction = null);
|
||||||
Task GetAccountInfo(long id, Action<AccountResponse>? successAction = null, Action? notFoundAction = null);
|
Task GetAccount(long id, Action<AccountResponse>? successAction = null, Action? notFoundAction = null);
|
||||||
Task PutAccountProfileInfo(AccountProfileInfoRequest data, Action? successAction = null, Action<IDictionary<string, string[]>>? badRequestAction = null, Action? unauthorizedAction = null);
|
Task PutAccountProfileInfo(AccountProfileInfoRequest data, Action? successAction = null, Action<IDictionary<string, string[]>>? badRequestAction = null, Action? unauthorizedAction = null);
|
||||||
Task PatchAccountUsername(AccountUsernameRequest data, Action? successAction = null, Action<IDictionary<string, string[]>>? badRequestAction = null, Action? unauthorizedAction = null);
|
Task PatchAccountUsername(AccountUsernameRequest data, Action? successAction = null, Action<IDictionary<string, string[]>>? badRequestAction = null, Action? unauthorizedAction = null);
|
||||||
Task PatchAccountEmail(AccountEmailRequest data, Action? successAction = null, Action<IDictionary<string, string[]>>? badRequestAction = null, Action? unauthorizedAction = null);
|
Task PatchAccountEmail(AccountEmailRequest data, Action? successAction = null, Action<IDictionary<string, string[]>>? badRequestAction = null, Action? unauthorizedAction = null);
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ public class Accounts
|
|||||||
public string GetAccountProfileBackground { get; set; }
|
public string GetAccountProfileBackground { get; set; }
|
||||||
public string PutAccountProfileBackground { get; set; }
|
public string PutAccountProfileBackground { get; set; }
|
||||||
public string DeleteAccountProfileBackground { get; set; }
|
public string DeleteAccountProfileBackground { get; set; }
|
||||||
public string GetAccountInfo { get; set; }
|
public string GetAccount { get; set; }
|
||||||
public string PutAccountProfileInfo { get; set; }
|
public string PutAccountProfileInfo { get; set; }
|
||||||
public string PatchAccountUsername { get; set; }
|
public string PatchAccountUsername { get; set; }
|
||||||
public string PatchAccountEmail { get; set; }
|
public string PatchAccountEmail { get; set; }
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ public partial class MainLayout : LayoutComponentBase
|
|||||||
|
|
||||||
if (_user is not null)
|
if (_user is not null)
|
||||||
{
|
{
|
||||||
await AccountsClientService.GetAccountInfo(_user.Id, data => _accountData = data);
|
await AccountsClientService.GetAccount(_user.Id, data => _accountData = data);
|
||||||
}
|
}
|
||||||
|
|
||||||
_loaded = true;
|
_loaded = true;
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ public partial class UserEditPage : ComponentBase
|
|||||||
|
|
||||||
await Task.WhenAll(
|
await Task.WhenAll(
|
||||||
[
|
[
|
||||||
AccountsClientService.GetAccountInfo(user.Id, data => _accountData = data),
|
AccountsClientService.GetAccount(user.Id, data => _accountData = data),
|
||||||
AccountsClientService.GetAccountProfileBackground(user.Id, data => Layout.BackgroundPhoto = data)
|
AccountsClientService.GetAccountProfileBackground(user.Id, data => Layout.BackgroundPhoto = data)
|
||||||
]);
|
]);
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ public partial class UserPage : ComponentBase
|
|||||||
Id = user.Id;
|
Id = user.Id;
|
||||||
}
|
}
|
||||||
|
|
||||||
await AccountsClientService.GetAccountInfo(Id.Value, data => _accountData = data);
|
await AccountsClientService.GetAccount(Id.Value, data => _accountData = data);
|
||||||
_owner = Id.Value == user?.Id;
|
_owner = Id.Value == user?.Id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
"GetAccountProfileBackground": "/{0}/profile_background",
|
"GetAccountProfileBackground": "/{0}/profile_background",
|
||||||
"PutAccountProfileBackground": "/profile_background",
|
"PutAccountProfileBackground": "/profile_background",
|
||||||
"DeleteAccountProfileBackground": "/profile_background",
|
"DeleteAccountProfileBackground": "/profile_background",
|
||||||
"GetAccountInfo": "/{0}/info",
|
"GetAccount": "/{0}",
|
||||||
"PutAccountProfileInfo": "/profile_info",
|
"PutAccountProfileInfo": "/profile_info",
|
||||||
"PatchAccountUsername": "/username",
|
"PatchAccountUsername": "/username",
|
||||||
"PatchAccountEmail": "/email",
|
"PatchAccountEmail": "/email",
|
||||||
|
|||||||
Reference in New Issue
Block a user