This commit is contained in:
2023-06-21 17:56:00 +03:00
parent fa8852a32a
commit e9d4053e65
55 changed files with 3883 additions and 262 deletions
@@ -31,7 +31,26 @@ public class SettingsAccountController : BaseApiController
{
var list = _accountService.GetAllCategories(UserId);
return list.Select(x => x.ToModel());
return list.OrderBy(x => x.Name).Select(x => x.ToModel());
}
[HttpGet("~/api/settings/account-categories/{id}")]
public object AccountCategory(string id)
{
var exec = _accountService.GetCategory(UserId, id.AsGuid());
switch (exec.Status)
{
case GeneralExecStatus.not_found:
case GeneralExecStatus.failure:
return ProblemBadRequest("Account category not found.");
case GeneralExecStatus.success:
return exec.Result!.ToModel();
default:
throw new NotSupportedException(exec.Status.ToString());
}
}
[HttpPost("~/api/settings/account-categories")]
@@ -98,7 +117,9 @@ public class SettingsAccountController : BaseApiController
? _accountService.GetByCategory(UserId, category!.AsGuid())
: _accountService.GetAllAccounts(UserId);
return list.Select(x => x.ToModel());
return list
.OrderBy(x => x.Name)
.Select(x => x.ToModel());
}
[HttpPost("~/api/settings/accounts")]