get all accounts endpoint added
This commit is contained in:
@@ -94,6 +94,11 @@ public class AccountsController(IAccountsControllerService accountsControllerSer
|
||||
|
||||
#region Info
|
||||
|
||||
[HttpGet]
|
||||
[AllowAnonymous]
|
||||
[ProducesResponseType(typeof(IEnumerable<AccountResponse>), StatusCodes.Status200OK)]
|
||||
public async Task<ActionResult> GetAccounts(AccountQueryParameters query) => await accountsControllerService.GetAccounts(query);
|
||||
|
||||
[HttpGet("{id}")]
|
||||
[AllowAnonymous]
|
||||
[ProducesResponseType(typeof(AccountResponse), StatusCodes.Status200OK)]
|
||||
|
||||
@@ -238,6 +238,14 @@ public class AccountsControllerService(
|
||||
|
||||
#region Info
|
||||
|
||||
public async Task<RequestResult> GetAccounts(AccountQueryParameters query)
|
||||
{
|
||||
IEnumerable<Account> accounts = await database.Accounts.ToListAsync();
|
||||
IEnumerable<AccountResponse> accountsData = accounts.Select(x => new AccountResponse(x));
|
||||
accountsData = query.PrepareData(accountsData);
|
||||
return RequestResult.Ok(accountsData);
|
||||
}
|
||||
|
||||
public async Task<RequestResult> GetAccount(long id)
|
||||
{
|
||||
Account? account = await database.Accounts.FirstOrDefaultAsync(x => x.Id == id);
|
||||
|
||||
@@ -19,6 +19,7 @@ public interface IAccountsControllerService
|
||||
Task<RequestResult> GetAccountProfileBackground(long id);
|
||||
Task<RequestResult> PutAccountProfileBackground(AccountProfileBackgroundRequest data);
|
||||
Task<RequestResult> DeleteAccountProfileBackground();
|
||||
Task<RequestResult> GetAccounts(AccountQueryParameters query);
|
||||
Task<RequestResult> GetAccount(long id);
|
||||
Task<RequestResult> PutAccountProfileInfo(AccountProfileInfoRequest data);
|
||||
Task<RequestResult> PatchAccountUsername(AccountUsernameRequest data);
|
||||
|
||||
Reference in New Issue
Block a user