fix
This commit is contained in:
@@ -1,35 +0,0 @@
|
|||||||
namespace MyOffice.Core.Attributes;
|
|
||||||
|
|
||||||
using System;
|
|
||||||
|
|
||||||
[AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = true)]
|
|
||||||
public class LinkAttribute : Attribute
|
|
||||||
{
|
|
||||||
public LinkAttribute(Type type)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = true)]
|
|
||||||
public class LinkFromAttribute : Attribute
|
|
||||||
{
|
|
||||||
public LinkFromAttribute(Type type)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = true)]
|
|
||||||
public class LinkToAttribute : Attribute
|
|
||||||
{
|
|
||||||
public LinkToAttribute(Type type)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = true)]
|
|
||||||
public class LinkWithAttribute : Attribute
|
|
||||||
{
|
|
||||||
public LinkWithAttribute(Type type)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
namespace MyOffice.Data.Models.Accounts;
|
namespace MyOffice.Data.Models.Accounts;
|
||||||
|
|
||||||
using Core.Attributes;
|
|
||||||
using Users;
|
using Users;
|
||||||
|
|
||||||
public class AccountAccessInvite
|
public class AccountAccessInvite
|
||||||
|
|||||||
@@ -1,14 +1,9 @@
|
|||||||
namespace MyOffice.Services.Account.Domain;
|
namespace MyOffice.Services.Account.Domain;
|
||||||
|
|
||||||
using AutoMapper;
|
using AutoMapper;
|
||||||
using Core.Attributes;
|
|
||||||
using Data.Models.Accounts;
|
using Data.Models.Accounts;
|
||||||
using Data.Models.Users;
|
|
||||||
using Mapper;
|
|
||||||
using MyOffice.Services.Identity;
|
using MyOffice.Services.Identity;
|
||||||
|
|
||||||
[Link(typeof(AccountAccess))]
|
|
||||||
[Link(typeof(AccountServiceProfile))]
|
|
||||||
public class AccountAccessDto
|
public class AccountAccessDto
|
||||||
{
|
{
|
||||||
public Guid AccountId { get; set; }
|
public Guid AccountId { get; set; }
|
||||||
@@ -33,7 +28,7 @@ public class AccountAccessDto
|
|||||||
public string? Name { get; set; }
|
public string? Name { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class AccountAccessDtoProfile: Profile
|
public class AccountAccessDtoProfile : Profile
|
||||||
{
|
{
|
||||||
public AccountAccessDtoProfile()
|
public AccountAccessDtoProfile()
|
||||||
{
|
{
|
||||||
@@ -43,7 +38,7 @@ public class AccountAccessDtoProfile: Profile
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class AccountAccessDtoMappingAction: IMappingAction<AccountAccess, AccountAccessDto>
|
public class AccountAccessDtoMappingAction : IMappingAction<AccountAccess, AccountAccessDto>
|
||||||
{
|
{
|
||||||
private readonly IContextProvider _contextProvider;
|
private readonly IContextProvider _contextProvider;
|
||||||
public AccountAccessDtoMappingAction(IContextProvider contextProvider)
|
public AccountAccessDtoMappingAction(IContextProvider contextProvider)
|
||||||
|
|||||||
@@ -1,12 +1,22 @@
|
|||||||
namespace MyOffice.Services.Account.Domain;
|
/// <see cref="MyOffice.Data.Models.Accounts.AccountAccessInvite"/>
|
||||||
|
namespace MyOffice.Services.Account.Domain;
|
||||||
|
|
||||||
using Core.Attributes;
|
using AutoMapper;
|
||||||
using Data.Models.Accounts;
|
using Data.Models.Accounts;
|
||||||
|
|
||||||
[Link(typeof(AccountAccessInvite))]
|
|
||||||
public class AccountAccessInviteDto
|
public class AccountAccessInviteDto
|
||||||
{
|
{
|
||||||
public string Id { get; set; } = null!;
|
public string Id { get; set; } = null!;
|
||||||
public string Account { get; set; } = null!;
|
public string Account { get; set; } = null!;
|
||||||
public bool IsAllowWrite { get; set; }
|
public bool IsAllowWrite { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class AccountAccessInviteDtoProfile: Profile
|
||||||
|
{
|
||||||
|
public AccountAccessInviteDtoProfile()
|
||||||
|
{
|
||||||
|
CreateMap<AccountAccessInvite, AccountAccessInviteDto>()
|
||||||
|
.ForMember(x => x.Account, o => o.MapFrom(x => x.Account!.Name))
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,19 @@
|
|||||||
namespace MyOffice.Services.Account.Domain;
|
/// <see cref="MyOffice.Data.Models.Accounts.AccountAccountCategory"/>
|
||||||
|
namespace MyOffice.Services.Account.Domain;
|
||||||
|
|
||||||
|
using AutoMapper;
|
||||||
|
using MyOffice.Data.Models.Accounts;
|
||||||
|
|
||||||
public class AccountAccountCategoryDto
|
public class AccountAccountCategoryDto
|
||||||
{
|
{
|
||||||
public Guid CategoryId { get; set; }
|
public Guid CategoryId { get; set; }
|
||||||
public AccountCategoryDto? Category { get; set; } = null!;
|
public AccountCategoryDto? Category { get; set; } = null!;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class AccountAccountCategoryDtoProfile: Profile
|
||||||
|
{
|
||||||
|
public AccountAccountCategoryDtoProfile()
|
||||||
|
{
|
||||||
|
CreateMap<AccountAccountCategory, AccountAccountCategoryDto>();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,8 @@
|
|||||||
namespace MyOffice.Services.Account.Domain;
|
/// <see cref="MyOffice.Data.Models.Accounts.AccountCategory"/>
|
||||||
|
namespace MyOffice.Services.Account.Domain;
|
||||||
|
|
||||||
|
using AutoMapper;
|
||||||
|
using MyOffice.Data.Models.Accounts;
|
||||||
|
|
||||||
public class AccountCategoryDto
|
public class AccountCategoryDto
|
||||||
{
|
{
|
||||||
@@ -7,3 +11,14 @@ public class AccountCategoryDto
|
|||||||
public string Name { get; set; } = null!;
|
public string Name { get; set; } = null!;
|
||||||
public bool AllowDelete { get; set; }
|
public bool AllowDelete { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class AccountCategoryDtoProfile: Profile
|
||||||
|
{
|
||||||
|
public AccountCategoryDtoProfile()
|
||||||
|
{
|
||||||
|
CreateMap<AccountCategory, AccountCategoryDto>()
|
||||||
|
.ForMember(x => x.Id, o => o.MapFrom(x => x.Id))
|
||||||
|
.ForMember(x => x.AllowDelete, o => o.MapFrom(x => !x.Accounts!.Any()))
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,9 +1,10 @@
|
|||||||
using AutoMapper;
|
/// <see cref="MyOffice.Data.Models.Accounts.Account"/>
|
||||||
|
namespace MyOffice.Services.Account.Domain;
|
||||||
|
|
||||||
|
using AutoMapper;
|
||||||
using MyOffice.Core;
|
using MyOffice.Core;
|
||||||
using MyOffice.Data.Models.Accounts;
|
using MyOffice.Data.Models.Accounts;
|
||||||
|
|
||||||
namespace MyOffice.Services.Account.Domain;
|
|
||||||
|
|
||||||
public class AccountDetailedDto: IDataModelDto<AccountDetailed>
|
public class AccountDetailedDto: IDataModelDto<AccountDetailed>
|
||||||
{
|
{
|
||||||
public AccountDto Account { get; set; } = null!;
|
public AccountDto Account { get; set; } = null!;
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
namespace MyOffice.Services.Account.Domain;
|
/// <see cref="MyOffice.Data.Models.Items.ItemCategory"/>
|
||||||
|
namespace MyOffice.Services.Account.Domain;
|
||||||
|
|
||||||
|
using AutoMapper;
|
||||||
using MyOffice.Data.Models.Items;
|
using MyOffice.Data.Models.Items;
|
||||||
|
|
||||||
public class ItemCategoryDto
|
public class ItemCategoryDto
|
||||||
@@ -11,3 +13,11 @@ public class ItemCategoryDto
|
|||||||
public List<ItemDto> Items { get; set; } = null!;
|
public List<ItemDto> Items { get; set; } = null!;
|
||||||
public bool IsInternal { get; set; }
|
public bool IsInternal { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class ItemCategoryDtoProfile: Profile
|
||||||
|
{
|
||||||
|
public ItemCategoryDtoProfile()
|
||||||
|
{
|
||||||
|
CreateMap<ItemCategory, ItemCategoryDto>();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
namespace MyOffice.Services.Account.Domain;
|
/// <see cref="MyOffice.Data.Models.Items.Item"/>
|
||||||
|
namespace MyOffice.Services.Account.Domain;
|
||||||
|
|
||||||
|
using AutoMapper;
|
||||||
using MyOffice.Data.Models.Items;
|
using MyOffice.Data.Models.Items;
|
||||||
|
|
||||||
public class ItemDto
|
public class ItemDto
|
||||||
@@ -11,3 +13,15 @@ public class ItemDto
|
|||||||
public Guid CategoryId { get; set; }
|
public Guid CategoryId { get; set; }
|
||||||
public ItemCategoryDto? Category { get; set; }
|
public ItemCategoryDto? Category { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class ItemDtoProfile: Profile
|
||||||
|
{
|
||||||
|
public ItemDtoProfile()
|
||||||
|
{
|
||||||
|
CreateMap<Item, ItemDto>()
|
||||||
|
.ForMember(x => x.Id, o => o.MapFrom(x => x.ItemGlobalId))
|
||||||
|
.ForMember(x => x.Name, o => o.MapFrom(x => x.ItemGlobal.Name))
|
||||||
|
.ForMember(x => x.AllowDelete, o => o.MapFrom(x => !x.Motions!.Any()))
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
namespace MyOffice.Services.Account.Domain
|
namespace MyOffice.Services.Account.Domain;
|
||||||
|
|
||||||
|
using AutoMapper;
|
||||||
|
|
||||||
|
public class MotionAddUpdate
|
||||||
{
|
{
|
||||||
public class MotionAddUpdate
|
|
||||||
{
|
|
||||||
public DateTime Date { get; set; }
|
public DateTime Date { get; set; }
|
||||||
public string Item { get; set; } = null!;
|
public string Item { get; set; } = null!;
|
||||||
public string? ItemId { get; set; } = null!;
|
public string? ItemId { get; set; } = null!;
|
||||||
@@ -10,5 +12,11 @@
|
|||||||
public decimal Plus { get; set; }
|
public decimal Plus { get; set; }
|
||||||
public decimal Minus { get; set; }
|
public decimal Minus { get; set; }
|
||||||
public decimal AmountBalancing { get; set; }
|
public decimal AmountBalancing { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class MotionAddUpdateProfile: Profile
|
||||||
|
{
|
||||||
|
public MotionAddUpdateProfile()
|
||||||
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
namespace MyOffice.Services.Account.Domain;
|
/// <see cref="MyOffice.Data.Models.Users.User"/>
|
||||||
|
namespace MyOffice.Services.Account.Domain;
|
||||||
|
|
||||||
|
using AutoMapper;
|
||||||
|
using MyOffice.Data.Models.Users;
|
||||||
using MyOffice.Services.Currency.Domain;
|
using MyOffice.Services.Currency.Domain;
|
||||||
|
|
||||||
public class UserDto
|
public class UserDto
|
||||||
@@ -15,3 +18,11 @@ public class UserDto
|
|||||||
public string CurrencyId { get; set; } = null!;
|
public string CurrencyId { get; set; } = null!;
|
||||||
public CurrencyGlobalDto? Currency { get; set; }
|
public CurrencyGlobalDto? Currency { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class UserDtoProfile : Profile
|
||||||
|
{
|
||||||
|
public UserDtoProfile()
|
||||||
|
{
|
||||||
|
CreateMap<User, UserDto>();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,8 @@
|
|||||||
namespace MyOffice.Services.Currency.Domain;
|
/// <see cref="MyOffice.Data.Models.Currencies.Currency"/>
|
||||||
|
namespace MyOffice.Services.Currency.Domain;
|
||||||
|
|
||||||
|
using AutoMapper;
|
||||||
using MyOffice.Data.Models.Currencies;
|
using MyOffice.Data.Models.Currencies;
|
||||||
using MyOffice.Data.Models.Users;
|
|
||||||
using MyOffice.Services.Account.Domain;
|
using MyOffice.Services.Account.Domain;
|
||||||
|
|
||||||
public class CurrencyDto
|
public class CurrencyDto
|
||||||
@@ -21,3 +22,11 @@ public class CurrencyDto
|
|||||||
|
|
||||||
public bool IsPrimary { get; set; }
|
public bool IsPrimary { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class CurrencyDtoProfile: Profile
|
||||||
|
{
|
||||||
|
public CurrencyDtoProfile()
|
||||||
|
{
|
||||||
|
CreateMap<Currency, CurrencyDto>();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,8 @@
|
|||||||
namespace MyOffice.Services.Currency.Domain;
|
/// <see cref="MyOffice.Data.Models.Currencies.CurrencyGlobal"/>
|
||||||
|
namespace MyOffice.Services.Currency.Domain;
|
||||||
|
|
||||||
|
using AutoMapper;
|
||||||
|
using MyOffice.Data.Models.Currencies;
|
||||||
|
|
||||||
public class CurrencyGlobalDto
|
public class CurrencyGlobalDto
|
||||||
{
|
{
|
||||||
@@ -7,3 +11,11 @@ public class CurrencyGlobalDto
|
|||||||
public string Symbol { get; set; } = null!;
|
public string Symbol { get; set; } = null!;
|
||||||
public int DefaultQuantity { get; set; }
|
public int DefaultQuantity { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class CurrencyGlobalDtoProfile: Profile
|
||||||
|
{
|
||||||
|
public CurrencyGlobalDtoProfile()
|
||||||
|
{
|
||||||
|
CreateMap<CurrencyGlobal, CurrencyGlobalDto>();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,8 @@
|
|||||||
namespace MyOffice.Services.Currency.Domain;
|
/// <see cref="MyOffice.Data.Models.Currencies.CurrencyRate"/>
|
||||||
|
namespace MyOffice.Services.Currency.Domain;
|
||||||
|
|
||||||
|
using AutoMapper;
|
||||||
|
using MyOffice.Data.Models.Currencies;
|
||||||
|
|
||||||
public class CurrencyRateDto
|
public class CurrencyRateDto
|
||||||
{
|
{
|
||||||
@@ -10,3 +14,11 @@ public class CurrencyRateDto
|
|||||||
public decimal Rate { get; set; }
|
public decimal Rate { get; set; }
|
||||||
public List<CurrencyDto>? Currencies { get; set; }
|
public List<CurrencyDto>? Currencies { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class CurrencyRateDtoProfile : Profile
|
||||||
|
{
|
||||||
|
public CurrencyRateDtoProfile()
|
||||||
|
{
|
||||||
|
CreateMap<CurrencyRate, CurrencyRateDto>();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,8 +1,6 @@
|
|||||||
namespace MyOffice.Services.Dashboard.Domain;
|
namespace MyOffice.Services.Dashboard.Domain;
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text.Json.Serialization;
|
|
||||||
using Data.Models.Accounts;
|
|
||||||
|
|
||||||
public class DashboardData
|
public class DashboardData
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,66 +0,0 @@
|
|||||||
namespace MyOffice.Services.Mapper;
|
|
||||||
|
|
||||||
using Account.Domain;
|
|
||||||
using AutoMapper;
|
|
||||||
using Data.Models.Accounts;
|
|
||||||
using Data.Models.Currencies;
|
|
||||||
using Data.Models.Items;
|
|
||||||
using Data.Models.Users;
|
|
||||||
using MyOffice.Services.Currency.Domain;
|
|
||||||
|
|
||||||
public class AccountServiceProfile : Profile
|
|
||||||
{
|
|
||||||
public AccountServiceProfile()
|
|
||||||
{
|
|
||||||
MapUser();
|
|
||||||
|
|
||||||
MapAccount();
|
|
||||||
|
|
||||||
MapCurrency();
|
|
||||||
|
|
||||||
MapItems();
|
|
||||||
|
|
||||||
CreateMap<Motion, MotionDto>();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void MapUser()
|
|
||||||
{
|
|
||||||
CreateMap<User, UserDto>();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void MapAccount()
|
|
||||||
{
|
|
||||||
CreateMap<AccountDetailed, AccountDetailedDto>();
|
|
||||||
|
|
||||||
CreateMap<AccountAccountCategory, AccountAccountCategoryDto>();
|
|
||||||
|
|
||||||
CreateMap<AccountCategory, AccountCategoryDto>()
|
|
||||||
.ForMember(x => x.Id, o => o.MapFrom(x => x.Id))
|
|
||||||
.ForMember(x => x.AllowDelete, o => o.MapFrom(x => !x.Accounts!.Any()))
|
|
||||||
;
|
|
||||||
|
|
||||||
CreateMap<AccountAccessInvite, AccountAccessInviteDto>()
|
|
||||||
.ForMember(x => x.Account, o => o.MapFrom(x => x.Account!.Name))
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void MapCurrency()
|
|
||||||
{
|
|
||||||
CreateMap<CurrencyGlobal, CurrencyGlobalDto>();
|
|
||||||
|
|
||||||
CreateMap<Currency, CurrencyDto>();
|
|
||||||
|
|
||||||
CreateMap<CurrencyRate, CurrencyRateDto>();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void MapItems()
|
|
||||||
{
|
|
||||||
CreateMap<ItemCategory, ItemCategoryDto>();
|
|
||||||
|
|
||||||
CreateMap<Item, ItemDto>()
|
|
||||||
.ForMember(x => x.Id, o => o.MapFrom(x => x.ItemGlobalId))
|
|
||||||
.ForMember(x => x.Name, o => o.MapFrom(x => x.ItemGlobal.Name))
|
|
||||||
.ForMember(x => x.AllowDelete, o => o.MapFrom(x => !x.Motions!.Any()))
|
|
||||||
;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -9,13 +9,13 @@ using Microsoft.Extensions.Logging;
|
|||||||
using Models.Account;
|
using Models.Account;
|
||||||
using Models.Item;
|
using Models.Item;
|
||||||
using Models.Motion;
|
using Models.Motion;
|
||||||
|
using MyOffice.Web.Infrastructure.Attributes;
|
||||||
using Services.Account;
|
using Services.Account;
|
||||||
using Services.Account.Domain;
|
using Services.Account.Domain;
|
||||||
using Services.Item;
|
using Services.Item;
|
||||||
|
|
||||||
[Authorize]
|
[Authorize]
|
||||||
[ApiController]
|
[DefaultFromBody]
|
||||||
[Route("api/[controller]")]
|
|
||||||
public class AccountController : BaseApiController
|
public class AccountController : BaseApiController
|
||||||
{
|
{
|
||||||
private readonly ILogger<AccountController> _logger;
|
private readonly ILogger<AccountController> _logger;
|
||||||
@@ -36,7 +36,6 @@ public class AccountController : BaseApiController
|
|||||||
_itemService = itemService;
|
_itemService = itemService;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("~/api/accounts")]
|
|
||||||
public ObjectResult AccountsGet(string category)
|
public ObjectResult AccountsGet(string category)
|
||||||
{
|
{
|
||||||
var list = _accountService.GetByCategoryDetailed(UserId, category!.AsGuid());
|
var list = _accountService.GetByCategoryDetailed(UserId, category!.AsGuid());
|
||||||
@@ -44,7 +43,6 @@ public class AccountController : BaseApiController
|
|||||||
return OkResponse(_mapper.Map<List<AccountDetailedViewModel>>(list.OrderBy(x => x.Account.Name).ToList()));
|
return OkResponse(_mapper.Map<List<AccountDetailedViewModel>>(list.OrderBy(x => x.Account.Name).ToList()));
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("~/api/accounts/{id}")]
|
|
||||||
public ObjectResult AccountGet(string id)
|
public ObjectResult AccountGet(string id)
|
||||||
{
|
{
|
||||||
var exec = _accountService.GetByIdDetailed(UserId, id!.AsGuid());
|
var exec = _accountService.GetByIdDetailed(UserId, id!.AsGuid());
|
||||||
@@ -63,7 +61,6 @@ public class AccountController : BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("~/api/accounts/{id}/motions")]
|
|
||||||
public ObjectResult MotionsGet(string id, [FromQuery] MotionsGetRequest request)
|
public ObjectResult MotionsGet(string id, [FromQuery] MotionsGetRequest request)
|
||||||
{
|
{
|
||||||
var exec = _accountService.GetMotions(UserId, id!.AsGuid(), request.From.StartOfDay(), request.To.EndOfDay());
|
var exec = _accountService.GetMotions(UserId, id!.AsGuid(), request.From.StartOfDay(), request.To.EndOfDay());
|
||||||
@@ -82,7 +79,6 @@ public class AccountController : BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost("~/api/accounts/{id}/motions")]
|
|
||||||
public object MotionsPost(string id, MotionRequest motion)
|
public object MotionsPost(string id, MotionRequest motion)
|
||||||
{
|
{
|
||||||
var exec = _accountService.MotionAdd(UserId, id.AsGuid(), _mapper.Map<MotionAddUpdate>(motion));
|
var exec = _accountService.MotionAdd(UserId, id.AsGuid(), _mapper.Map<MotionAddUpdate>(motion));
|
||||||
@@ -101,7 +97,6 @@ public class AccountController : BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPut("~/api/accounts/{id}/motions/{motionId}")]
|
|
||||||
public ObjectResult MotionsPut(string id, string motionId, MotionRequest motion)
|
public ObjectResult MotionsPut(string id, string motionId, MotionRequest motion)
|
||||||
{
|
{
|
||||||
var exec = _accountService.MotionUpdate(UserId, id.AsGuid(), motionId.AsGuid(), _mapper.Map<MotionAddUpdate>(motion));
|
var exec = _accountService.MotionUpdate(UserId, id.AsGuid(), motionId.AsGuid(), _mapper.Map<MotionAddUpdate>(motion));
|
||||||
@@ -120,7 +115,6 @@ public class AccountController : BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpDelete("~/api/accounts/{id}/motions/{motionId}")]
|
|
||||||
public ObjectResult MotionsDelete(string id, string motionId)
|
public ObjectResult MotionsDelete(string id, string motionId)
|
||||||
{
|
{
|
||||||
var exec = _accountService.MotionRemove(UserId, id.AsGuid(), motionId.AsGuid());
|
var exec = _accountService.MotionRemove(UserId, id.AsGuid(), motionId.AsGuid());
|
||||||
@@ -139,7 +133,6 @@ public class AccountController : BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("~/api/items")]
|
|
||||||
public ObjectResult FindItems(string term)
|
public ObjectResult FindItems(string term)
|
||||||
{
|
{
|
||||||
var itemsDto = _itemService.FindItems(UserId, term);
|
var itemsDto = _itemService.FindItems(UserId, term);
|
||||||
|
|||||||
@@ -1,51 +1,52 @@
|
|||||||
namespace MyOffice.Web.Controllers;
|
namespace MyOffice.Web.Controllers;
|
||||||
|
|
||||||
|
using AutoMapper;
|
||||||
using Core.Extensions;
|
using Core.Extensions;
|
||||||
using Infrastructure.Attributes;
|
using Infrastructure.Attributes;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using MyOffice.Web.Models.Dashboard;
|
||||||
using Services.Dashboard;
|
using Services.Dashboard;
|
||||||
|
|
||||||
[Authorize]
|
[Authorize]
|
||||||
[ApiController]
|
[DefaultFromBody]
|
||||||
[Route("api/[controller]")]
|
|
||||||
public class DashboardController : BaseApiController
|
public class DashboardController : BaseApiController
|
||||||
{
|
{
|
||||||
private readonly ILogger<DashboardController> _logger;
|
private readonly ILogger<DashboardController> _logger;
|
||||||
private readonly DashboardService _dashboardService;
|
private readonly DashboardService _dashboardService;
|
||||||
|
private readonly IMapper _mapper;
|
||||||
|
|
||||||
public DashboardController(
|
public DashboardController(
|
||||||
ILogger<DashboardController> logger,
|
ILogger<DashboardController> logger,
|
||||||
DashboardService dashboardService
|
DashboardService dashboardService,
|
||||||
|
IMapper mapper
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_dashboardService = dashboardService;
|
_dashboardService = dashboardService;
|
||||||
|
_mapper = mapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[HttpGet("~/api/dashboard")]
|
public ObjectResult Index()
|
||||||
public object Index()
|
|
||||||
{
|
{
|
||||||
var data = _dashboardService.GetDashboardRestData(UserId);
|
var data = _dashboardService.GetDashboardRestData(UserId);
|
||||||
|
|
||||||
return data;
|
return OkResponse(_mapper.Map<DashboardViewModel>(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("~/api/dashboard/income")]
|
public ObjectResult Income(DateTime from, DateTime to, [AsGuid(true)] string? category)
|
||||||
public object Income(DateTime from, DateTime to, [AsGuid(true)] string? category)
|
|
||||||
{
|
{
|
||||||
var data = _dashboardService.GetDashboardIncomeData(UserId, from.StartOfDay(), to.EndOfDay(), category?.AsGuidNull());
|
var data = _dashboardService.GetDashboardIncomeData(UserId, from.StartOfDay(), to.EndOfDay(), category?.AsGuidNull());
|
||||||
|
|
||||||
return data;
|
return OkResponse(_mapper.Map<DashboardIncomeDataViewModel>(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[HttpGet("~/api/dashboard/outcome")]
|
public ObjectResult Outcome(DateTime from, DateTime to, [AsGuid(true)] string? category)
|
||||||
public object Outcome(DateTime from, DateTime to, [AsGuid(true)] string? category)
|
|
||||||
{
|
{
|
||||||
var data = _dashboardService.GetDashboardOutcomeData(UserId, from.StartOfDay(), to.EndOfDay(), category?.AsGuidNull());
|
var data = _dashboardService.GetDashboardOutcomeData(UserId, from.StartOfDay(), to.EndOfDay(), category?.AsGuidNull());
|
||||||
|
|
||||||
return data;
|
return OkResponse(_mapper.Map<DashboardIncomeDataViewModel>(data));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
namespace MyOffice.Web.Controllers;
|
namespace MyOffice.Web.Controllers;
|
||||||
|
|
||||||
using AutoMapper;
|
using AutoMapper;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
|
||||||
using Core;
|
using Core;
|
||||||
@@ -11,10 +10,10 @@ using Services.Account;
|
|||||||
using Services.Account.Domain;
|
using Services.Account.Domain;
|
||||||
using Infrastructure.Attributes;
|
using Infrastructure.Attributes;
|
||||||
using Services.Identity;
|
using Services.Identity;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
[Authorize]
|
[Authorize]
|
||||||
[ApiController]
|
[DefaultFromBody]
|
||||||
[Route("api/[controller]")]
|
|
||||||
public class SettingsAccountCategoryController : BaseApiController
|
public class SettingsAccountCategoryController : BaseApiController
|
||||||
{
|
{
|
||||||
private readonly ILogger<SettingsAccountController> _logger;
|
private readonly ILogger<SettingsAccountController> _logger;
|
||||||
@@ -35,16 +34,14 @@ public class SettingsAccountCategoryController : BaseApiController
|
|||||||
_contextProvider = contextProvider;
|
_contextProvider = contextProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("~/api/settings/account-categories")]
|
public ObjectResult AccountCategories()
|
||||||
public object AccountCategories()
|
|
||||||
{
|
{
|
||||||
var list = _accountService.GetAllCategories(UserId);
|
var list = _accountService.GetAllCategories(UserId);
|
||||||
|
|
||||||
return OkResponse(_mapper.Map<List<AccountCategoryViewModel>>(list).OrderBy(x => x.Name));
|
return OkResponse(_mapper.Map<List<AccountCategoryViewModel>>(list).OrderBy(x => x.Name));
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("~/api/settings/account-categories/{id}")]
|
public ObjectResult AccountCategory([AsGuid] string id)
|
||||||
public object AccountCategory([AsGuid] string id)
|
|
||||||
{
|
{
|
||||||
var exec = _accountService.GetCategory(UserId, id.AsGuid());
|
var exec = _accountService.GetCategory(UserId, id.AsGuid());
|
||||||
|
|
||||||
@@ -55,21 +52,20 @@ public class SettingsAccountCategoryController : BaseApiController
|
|||||||
return ProblemBadResponse("Account category not found.");
|
return ProblemBadResponse("Account category not found.");
|
||||||
|
|
||||||
case GeneralExecStatus.success:
|
case GeneralExecStatus.success:
|
||||||
return _mapper.Map<AccountCategoryViewModel>(exec.Result!);
|
return OkResponse(_mapper.Map<AccountCategoryViewModel>(exec.Result!));
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw new NotSupportedException(exec.Status.ToString());
|
throw new NotSupportedException(exec.Status.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost("~/api/settings/account-categories")]
|
public ObjectResult AccountCategoriesAdd(AccountCategoryViewModel request)
|
||||||
public object AccountCategoriesAdd(AccountCategoryViewModel request)
|
|
||||||
{
|
{
|
||||||
var exec = _accountService.CategoryAdd(UserId, new AccountCategoryDto { Name = request.Name! });
|
var exec = _accountService.CategoryAdd(UserId, new AccountCategoryDto { Name = request.Name! });
|
||||||
switch (exec.Status)
|
switch (exec.Status)
|
||||||
{
|
{
|
||||||
case GeneralExecStatus.success:
|
case GeneralExecStatus.success:
|
||||||
return exec.Result!;
|
return OkResponse(_mapper.Map<AccountCategoryViewModel>(exec.Result!));
|
||||||
|
|
||||||
case GeneralExecStatus.failure:
|
case GeneralExecStatus.failure:
|
||||||
case GeneralExecStatus.not_found:
|
case GeneralExecStatus.not_found:
|
||||||
@@ -80,14 +76,13 @@ public class SettingsAccountCategoryController : BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPut("~/api/settings/account-categories/{id}")]
|
public ObjectResult AccountCategoriesUpdate([AsGuid] string id, AccountCategoryViewModel request)
|
||||||
public object AccountCategoriesEdit([AsGuid] string id, AccountCategoryViewModel request)
|
|
||||||
{
|
{
|
||||||
var exec = _accountService.CategoryUpdate(UserId, id.AsGuid(), new AccountCategoryDto { Name = request.Name! });
|
var exec = _accountService.CategoryUpdate(UserId, id.AsGuid(), new AccountCategoryDto { Name = request.Name! });
|
||||||
switch (exec.Status)
|
switch (exec.Status)
|
||||||
{
|
{
|
||||||
case GeneralExecStatus.success:
|
case GeneralExecStatus.success:
|
||||||
return exec.Result!;
|
return OkResponse(_mapper.Map<AccountCategoryViewModel>(exec.Result!));
|
||||||
|
|
||||||
case GeneralExecStatus.failure:
|
case GeneralExecStatus.failure:
|
||||||
case GeneralExecStatus.not_found:
|
case GeneralExecStatus.not_found:
|
||||||
@@ -98,14 +93,13 @@ public class SettingsAccountCategoryController : BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpDelete("~/api/settings/account-categories/{id}")]
|
public ObjectResult AccountCategoriesDelete([AsGuid] string id)
|
||||||
public object AccountCategoriesDelete([AsGuid] string id)
|
|
||||||
{
|
{
|
||||||
var exec = _accountService.CategoryRemove(UserId, id.AsGuid());
|
var exec = _accountService.CategoryRemove(UserId, id.AsGuid());
|
||||||
switch (exec.Status)
|
switch (exec.Status)
|
||||||
{
|
{
|
||||||
case AccountCategoryRemoveResult.success:
|
case AccountCategoryRemoveResult.success:
|
||||||
return exec.Result!;
|
return OkResponse(_mapper.Map<AccountCategoryViewModel>(exec.Result!));
|
||||||
|
|
||||||
case AccountCategoryRemoveResult.failure:
|
case AccountCategoryRemoveResult.failure:
|
||||||
return ProblemBadResponse("Remove account category failed.");
|
return ProblemBadResponse("Remove account category failed.");
|
||||||
|
|||||||
@@ -13,8 +13,7 @@ using Infrastructure.Attributes;
|
|||||||
using Services.Identity;
|
using Services.Identity;
|
||||||
|
|
||||||
[Authorize]
|
[Authorize]
|
||||||
[ApiController]
|
[DefaultFromBody]
|
||||||
[Route("api/[controller]")]
|
|
||||||
public class SettingsAccountController : BaseApiController
|
public class SettingsAccountController : BaseApiController
|
||||||
{
|
{
|
||||||
private readonly ILogger<SettingsAccountController> _logger;
|
private readonly ILogger<SettingsAccountController> _logger;
|
||||||
@@ -35,17 +34,15 @@ public class SettingsAccountController : BaseApiController
|
|||||||
_contextProvider = contextProvider;
|
_contextProvider = contextProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("~/api/settings/accounts")]
|
|
||||||
public ObjectResult AccountsGet([AsGuid(true)] string? category)
|
public ObjectResult AccountsGet([AsGuid(true)] string? category)
|
||||||
{
|
{
|
||||||
var list = category.IsPresent()
|
var list = category.IsPresent()
|
||||||
? _accountService.GetByCategory(UserId, category!.AsGuid())
|
? _accountService.GetByCategory(UserId, category!.AsGuid())
|
||||||
: _accountService.GetAllAccounts(UserId);
|
: _accountService.GetAllAccounts(UserId);
|
||||||
|
|
||||||
return OkResponse(list.ToViewModel(_mapper));
|
return OkResponse(_mapper.Map<List<AccountViewModel>>(list.OrderBy(x => x.Name)));
|
||||||
}
|
}
|
||||||
|
|
||||||
//[HttpPost("~/api/settings/accounts")]
|
|
||||||
public object AccountsAdd(AccountViewModel request)
|
public object AccountsAdd(AccountViewModel request)
|
||||||
{
|
{
|
||||||
var exec = _accountService.AccountAdd(UserId, new AccountAdd
|
var exec = _accountService.AccountAdd(UserId, new AccountAdd
|
||||||
@@ -73,8 +70,7 @@ public class SettingsAccountController : BaseApiController
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[HttpPut("~/api/settings/accounts/{id}")]
|
public object AccountsUpdate([AsGuid] string id, AccountEditRequestModel request)
|
||||||
public object AccountsAdd([AsGuid] string id, AccountEditRequestModel request)
|
|
||||||
{
|
{
|
||||||
var exec = _accountService.AccountUpdate(UserId, id.AsGuid(), new AccountEdit
|
var exec = _accountService.AccountUpdate(UserId, id.AsGuid(), new AccountEdit
|
||||||
{
|
{
|
||||||
@@ -103,7 +99,6 @@ public class SettingsAccountController : BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpDelete("~/api/settings/accounts/{id}")]
|
|
||||||
public object AccountsDelete([AsGuid] string id)
|
public object AccountsDelete([AsGuid] string id)
|
||||||
{
|
{
|
||||||
var exec = _accountService.AccountDelete(UserId, id);
|
var exec = _accountService.AccountDelete(UserId, id);
|
||||||
@@ -119,8 +114,7 @@ public class SettingsAccountController : BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpDelete("~/api/settings/accounts/{id}/category/{categoryId}")]
|
public object AccountsCategoryDelete([AsGuid] string id, [AsGuid] string categoryId)
|
||||||
public object AccountsCategoryRemove([AsGuid] string id, [AsGuid] string categoryId)
|
|
||||||
{
|
{
|
||||||
var exec = _accountService.AccountCategoryRemove(UserId, id.AsGuid(), categoryId.AsGuid());
|
var exec = _accountService.AccountCategoryRemove(UserId, id.AsGuid(), categoryId.AsGuid());
|
||||||
|
|
||||||
@@ -138,8 +132,7 @@ public class SettingsAccountController : BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost("~/api/settings/accounts/{id}/access")]
|
public object AccountsAccessAdd([AsGuid] string id, AccountAccessViewModel request)
|
||||||
public object AccountsAdd([AsGuid] string id, AccountAccessViewModel request)
|
|
||||||
{
|
{
|
||||||
var model = _mapper.Map<List<AccountAccessDto>>(request.Accesses);
|
var model = _mapper.Map<List<AccountAccessDto>>(request.Accesses);
|
||||||
|
|
||||||
@@ -180,8 +173,7 @@ public class SettingsAccountController : BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpDelete("~/api/settings/accounts/{id}/access/{userId}")]
|
public object AccountsAccessDelete([AsGuid] string id, [AsGuid] string userId)
|
||||||
public object AccountsAdd([AsGuid] string id, [AsGuid] string userId)
|
|
||||||
{
|
{
|
||||||
var exec = _accountService.AccessDelete(UserId, id.AsGuid(), userId.AsGuid());
|
var exec = _accountService.AccessDelete(UserId, id.AsGuid(), userId.AsGuid());
|
||||||
|
|
||||||
@@ -199,7 +191,6 @@ public class SettingsAccountController : BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("~/api/settings/accounts/invites")]
|
|
||||||
public List<AccountAccessInviteViewModel> AccountInvites()
|
public List<AccountAccessInviteViewModel> AccountInvites()
|
||||||
{
|
{
|
||||||
var invites = _accountService.InvitesGet(_contextProvider.User.Email);
|
var invites = _accountService.InvitesGet(_contextProvider.User.Email);
|
||||||
@@ -207,8 +198,7 @@ public class SettingsAccountController : BaseApiController
|
|||||||
return _mapper.Map<List<AccountAccessInviteViewModel>>(invites);
|
return _mapper.Map<List<AccountAccessInviteViewModel>>(invites);
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost("~/api/settings/accounts/invites/{id}/accept")]
|
public object AccountInviteAccept([AsGuid] string id, AccountInviteAcceptRequest request)
|
||||||
public object AccountInviteAccept([AsGuid]string id, AccountInviteAcceptRequest request)
|
|
||||||
{
|
{
|
||||||
var exec = _accountService.InviteAccept(UserId, id.AsGuid(), request.Name);
|
var exec = _accountService.InviteAccept(UserId, id.AsGuid(), request.Name);
|
||||||
|
|
||||||
@@ -228,7 +218,6 @@ public class SettingsAccountController : BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost("~/api/settings/accounts/invites/{id}/reject")]
|
|
||||||
public object AccountInviteReject([AsGuid] string id)
|
public object AccountInviteReject([AsGuid] string id)
|
||||||
{
|
{
|
||||||
var exec = _accountService.InviteReject(id.AsGuid());
|
var exec = _accountService.InviteReject(id.AsGuid());
|
||||||
|
|||||||
+4
-4
@@ -12,15 +12,15 @@ using Services.Currency.Domain;
|
|||||||
|
|
||||||
[Authorize]
|
[Authorize]
|
||||||
[DefaultFromBody]
|
[DefaultFromBody]
|
||||||
public class CurrencyController : BaseApiController
|
public class SettingCurrencyController : BaseApiController
|
||||||
{
|
{
|
||||||
private readonly CurrencyService _currencyService;
|
private readonly CurrencyService _currencyService;
|
||||||
private readonly ILogger<CurrencyController> _logger;
|
private readonly ILogger<SettingCurrencyController> _logger;
|
||||||
private readonly IMapper _mapper;
|
private readonly IMapper _mapper;
|
||||||
|
|
||||||
public CurrencyController(
|
public SettingCurrencyController(
|
||||||
CurrencyService currencyService,
|
CurrencyService currencyService,
|
||||||
ILogger<CurrencyController> logger,
|
ILogger<SettingCurrencyController> logger,
|
||||||
IMapper mapper
|
IMapper mapper
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -12,8 +12,7 @@ using Services.Item;
|
|||||||
using Services.Item.Domain;
|
using Services.Item.Domain;
|
||||||
|
|
||||||
[Authorize]
|
[Authorize]
|
||||||
[ApiController]
|
[DefaultFromBody]
|
||||||
[Route("api/[controller]")]
|
|
||||||
public class SettingsItemController : BaseApiController
|
public class SettingsItemController : BaseApiController
|
||||||
{
|
{
|
||||||
private ILogger<SettingsItemController> _logger;
|
private ILogger<SettingsItemController> _logger;
|
||||||
@@ -31,7 +30,6 @@ public class SettingsItemController : BaseApiController
|
|||||||
_mapper = mapper;
|
_mapper = mapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("~/api/settings/item-categories")]
|
|
||||||
public ObjectResult ItemsCategories()
|
public ObjectResult ItemsCategories()
|
||||||
{
|
{
|
||||||
var list = _itemService.GetAllCategories(UserId);
|
var list = _itemService.GetAllCategories(UserId);
|
||||||
@@ -41,7 +39,6 @@ public class SettingsItemController : BaseApiController
|
|||||||
.ThenBy(x => x.Name));
|
.ThenBy(x => x.Name));
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost("~/api/settings/item-categories")]
|
|
||||||
public ObjectResult ItemCategoriesAdd(ItemCategoryViewModel request)
|
public ObjectResult ItemCategoriesAdd(ItemCategoryViewModel request)
|
||||||
{
|
{
|
||||||
var exec = _itemService.CategoryAdd(UserId, request.FromModel());
|
var exec = _itemService.CategoryAdd(UserId, request.FromModel());
|
||||||
@@ -60,7 +57,6 @@ public class SettingsItemController : BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPut("~/api/settings/item-categories/{id}")]
|
|
||||||
public ObjectResult ItemCategoriesUpdate([AsGuid] string id, ItemCategoryViewModel request)
|
public ObjectResult ItemCategoriesUpdate([AsGuid] string id, ItemCategoryViewModel request)
|
||||||
{
|
{
|
||||||
var exec = _itemService.CategoryUpdate(UserId, id.AsGuid(), request.FromModel());
|
var exec = _itemService.CategoryUpdate(UserId, id.AsGuid(), request.FromModel());
|
||||||
@@ -79,7 +75,6 @@ public class SettingsItemController : BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpDelete("~/api/settings/item-categories/{id}")]
|
|
||||||
public ObjectResult ItemCategoriesDelete([AsGuid] string id)
|
public ObjectResult ItemCategoriesDelete([AsGuid] string id)
|
||||||
{
|
{
|
||||||
var exec = _itemService.CategoryRemove(UserId, id.AsGuid());
|
var exec = _itemService.CategoryRemove(UserId, id.AsGuid());
|
||||||
@@ -100,7 +95,6 @@ public class SettingsItemController : BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("~/api/settings/items")]
|
|
||||||
public ObjectResult Items([AsGuid] string category)
|
public ObjectResult Items([AsGuid] string category)
|
||||||
{
|
{
|
||||||
var categoryId = category.AsGuid();
|
var categoryId = category.AsGuid();
|
||||||
@@ -112,8 +106,7 @@ public class SettingsItemController : BaseApiController
|
|||||||
return Ok(_mapper.Map<List<ItemViewModel>>(list.OrderBy(x => x.Name)));
|
return Ok(_mapper.Map<List<ItemViewModel>>(list.OrderBy(x => x.Name)));
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPut("~/api/settings/items/{id}")]
|
public ObjectResult ItemsUpdate([AsGuid] string id, ItemEditModel request)
|
||||||
public ObjectResult Items([AsGuid] string id, ItemEditModel request)
|
|
||||||
{
|
{
|
||||||
var exec = _itemService.Update(UserId, id.AsGuid(), request.Category.AsGuid());
|
var exec = _itemService.Update(UserId, id.AsGuid(), request.Category.AsGuid());
|
||||||
|
|
||||||
@@ -131,8 +124,7 @@ public class SettingsItemController : BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost("~/api/settings/items")]
|
public ObjectResult ItemsPost(ItemChangeCategoryModel request)
|
||||||
public ObjectResult Items(ItemChangeCategoryModel request)
|
|
||||||
{
|
{
|
||||||
var exec = _itemService.UpdateItemsCategory(UserId, request.category.AsGuid(), request.Items.Select(x => x.AsGuid()).ToList());
|
var exec = _itemService.UpdateItemsCategory(UserId, request.category.AsGuid(), request.Items.Select(x => x.AsGuid()).ToList());
|
||||||
|
|
||||||
|
|||||||
@@ -14,9 +14,9 @@ using Core;
|
|||||||
using Services.Users;
|
using Services.Users;
|
||||||
using Services.Users.Domain;
|
using Services.Users.Domain;
|
||||||
using MyOffice.Data.Models.Currencies;
|
using MyOffice.Data.Models.Currencies;
|
||||||
|
using MyOffice.Web.Infrastructure.Attributes;
|
||||||
|
|
||||||
[ApiController]
|
[DefaultFromBody]
|
||||||
[Route("api/[controller]")]
|
|
||||||
public class UserController : BaseApiController
|
public class UserController : BaseApiController
|
||||||
{
|
{
|
||||||
private readonly UserManager<ApplicationUser<Guid>> _userManager;
|
private readonly UserManager<ApplicationUser<Guid>> _userManager;
|
||||||
@@ -34,7 +34,6 @@ public class UserController : BaseApiController
|
|||||||
_externalProviderValidators = externalProviderValidators;
|
_externalProviderValidators = externalProviderValidators;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost("~/api/user/register")]
|
|
||||||
public async Task<object> Register([FromBody] RegisterModel request)
|
public async Task<object> Register([FromBody] RegisterModel request)
|
||||||
{
|
{
|
||||||
var user = new ApplicationUser<Guid>
|
var user = new ApplicationUser<Guid>
|
||||||
@@ -55,7 +54,6 @@ public class UserController : BaseApiController
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Authorize]
|
[Authorize]
|
||||||
[HttpGet("~/api/user/profile")]
|
|
||||||
public async Task<object> ProfileGet()
|
public async Task<object> ProfileGet()
|
||||||
{
|
{
|
||||||
var user = await _userManager.GetUserAsync(User);
|
var user = await _userManager.GetUserAsync(User);
|
||||||
@@ -64,7 +62,6 @@ public class UserController : BaseApiController
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Authorize]
|
[Authorize]
|
||||||
[HttpPost("~/api/user/profile")]
|
|
||||||
public async Task<object> ProfileUpdate([FromBody] ProfileModel model)
|
public async Task<object> ProfileUpdate([FromBody] ProfileModel model)
|
||||||
{
|
{
|
||||||
var user = await _userManager.GetUserAsync(User);
|
var user = await _userManager.GetUserAsync(User);
|
||||||
@@ -80,7 +77,6 @@ public class UserController : BaseApiController
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Authorize]
|
[Authorize]
|
||||||
[HttpPost("~/api/user/attach")]
|
|
||||||
public async Task<object> AttachProvider([FromBody] AttachModel model)
|
public async Task<object> AttachProvider([FromBody] AttachModel model)
|
||||||
{
|
{
|
||||||
var validator = _externalProviderValidators.FirstOrDefault(x => x.Provider.EqualsIgnoreCase(model.Provider));
|
var validator = _externalProviderValidators.FirstOrDefault(x => x.Provider.EqualsIgnoreCase(model.Provider));
|
||||||
@@ -108,7 +104,6 @@ public class UserController : BaseApiController
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Authorize]
|
[Authorize]
|
||||||
[HttpPost("~/api/user/deattach")]
|
|
||||||
public async Task<object> DeattachProvider([FromBody] DeattachModel model)
|
public async Task<object> DeattachProvider([FromBody] DeattachModel model)
|
||||||
{
|
{
|
||||||
var exec = await _userService.RemoveUserExternal(UserId, model.Provider);
|
var exec = await _userService.RemoveUserExternal(UserId, model.Provider);
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
namespace MyOffice.Web.Infrastructure.Attributes;
|
namespace MyOffice.Web.Infrastructure.Attributes;
|
||||||
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using Microsoft.AspNetCore.Mvc.ApplicationModels;
|
using Microsoft.AspNetCore.Mvc.ApplicationModels;
|
||||||
using Microsoft.AspNetCore.Mvc.Filters;
|
|
||||||
using Microsoft.AspNetCore.Mvc.Infrastructure;
|
|
||||||
using Microsoft.AspNetCore.Mvc.ModelBinding;
|
using Microsoft.AspNetCore.Mvc.ModelBinding;
|
||||||
|
|
||||||
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
|
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
|
||||||
@@ -11,28 +8,6 @@ public sealed class DefaultFromBodyAttribute : Attribute
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public class GlobalModelStateValidatorAttribute : ActionFilterAttribute
|
|
||||||
{
|
|
||||||
private readonly ProblemDetailsFactory _problemDetailsFactory;
|
|
||||||
|
|
||||||
public GlobalModelStateValidatorAttribute(ProblemDetailsFactory problemDetailsFactory)
|
|
||||||
{
|
|
||||||
_problemDetailsFactory = problemDetailsFactory;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void OnActionExecuting(ActionExecutingContext context)
|
|
||||||
{
|
|
||||||
if (!context.ModelState.IsValid)
|
|
||||||
{
|
|
||||||
context.Result = new ObjectResult(_problemDetailsFactory.CreateValidationProblemDetails(context.HttpContext, context.ModelState))
|
|
||||||
{
|
|
||||||
StatusCode = StatusCodes.Status400BadRequest
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
base.OnActionExecuting(context);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public class DefaultFromBodyBindingConvention : IActionModelConvention
|
public class DefaultFromBodyBindingConvention : IActionModelConvention
|
||||||
{
|
{
|
||||||
public void Apply(ActionModel action)
|
public void Apply(ActionModel action)
|
||||||
@@ -50,6 +25,9 @@ public class DefaultFromBodyBindingConvention : IActionModelConvention
|
|||||||
var isSimpleType = paramType.IsPrimitive
|
var isSimpleType = paramType.IsPrimitive
|
||||||
|| paramType.IsEnum
|
|| paramType.IsEnum
|
||||||
|| paramType == typeof(string)
|
|| paramType == typeof(string)
|
||||||
|
|| paramType == typeof(int)
|
||||||
|
|| paramType == typeof(Guid)
|
||||||
|
|| paramType == typeof(DateTime)
|
||||||
|| paramType == typeof(decimal);
|
|| paramType == typeof(decimal);
|
||||||
|
|
||||||
if (!isSimpleType)
|
if (!isSimpleType)
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
namespace MyOffice.Web.Infrastructure.Attributes;
|
||||||
|
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.AspNetCore.Mvc.Filters;
|
||||||
|
using Microsoft.AspNetCore.Mvc.Infrastructure;
|
||||||
|
|
||||||
|
public class GlobalModelStateValidatorAttribute : ActionFilterAttribute
|
||||||
|
{
|
||||||
|
private readonly ProblemDetailsFactory _problemDetailsFactory;
|
||||||
|
|
||||||
|
public GlobalModelStateValidatorAttribute(ProblemDetailsFactory problemDetailsFactory)
|
||||||
|
{
|
||||||
|
_problemDetailsFactory = problemDetailsFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnActionExecuting(ActionExecutingContext context)
|
||||||
|
{
|
||||||
|
if (!context.ModelState.IsValid)
|
||||||
|
{
|
||||||
|
context.Result = new ObjectResult(_problemDetailsFactory.CreateValidationProblemDetails(context.HttpContext, context.ModelState))
|
||||||
|
{
|
||||||
|
StatusCode = StatusCodes.Status400BadRequest
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
base.OnActionExecuting(context);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
namespace MyOffice.Web.Infrastructure.Filters;
|
||||||
|
|
||||||
|
using System.Collections;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.AspNetCore.Mvc.Filters;
|
||||||
|
using MyOffice.Web.Models;
|
||||||
|
|
||||||
|
public class ResponseFilter : IActionFilter
|
||||||
|
{
|
||||||
|
private readonly ILogger<ResponseFilter> _logger;
|
||||||
|
|
||||||
|
public ResponseFilter(ILogger<ResponseFilter> logger)
|
||||||
|
{
|
||||||
|
_logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnActionExecuting(ActionExecutingContext context)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnActionExecuted(ActionExecutedContext context)
|
||||||
|
{
|
||||||
|
if (context.Result == null)
|
||||||
|
throw new NotSupportedException($"Response must be - empty");
|
||||||
|
if (!(context.Result is ObjectResult result))
|
||||||
|
throw new NotSupportedException($"Response must be an ObjectResult - {context.Result?.GetType().Name}");
|
||||||
|
if (result.Value == null)
|
||||||
|
throw new NotSupportedException($"Response must be an ObjectResult - empty");
|
||||||
|
|
||||||
|
if (result.Value is IResponseModel)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var type = result.Value.GetType();
|
||||||
|
if (type.IsGenericType
|
||||||
|
&& result.Value is IEnumerable
|
||||||
|
&& type.GenericTypeArguments.Any(x => x.GetInterfaces().Any(y => y == typeof(IResponseModel))))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new NotSupportedException($"Response must be an ObjectResult with an IResponseModel - {result.Value?.GetType().Name}");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
namespace MyOffice.Web.Models.Account;
|
namespace MyOffice.Web.Models.Account;
|
||||||
|
|
||||||
|
using AutoMapper;
|
||||||
|
using MyOffice.Services.Account.Domain;
|
||||||
|
using MyOffice.Services.Identity;
|
||||||
using User;
|
using User;
|
||||||
|
|
||||||
public class AccessRightsViewModel
|
public class AccessRightsViewModel
|
||||||
@@ -11,3 +14,28 @@ public class AccessRightsViewModel
|
|||||||
public bool AllowDelete { get; set; }
|
public bool AllowDelete { get; set; }
|
||||||
public bool IsOwner { get; set; }
|
public bool IsOwner { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class AccessRightsViewModelProfile : Profile
|
||||||
|
{
|
||||||
|
public AccessRightsViewModelProfile()
|
||||||
|
{
|
||||||
|
CreateMap<AccountAccessDto, AccessRightsViewModel>()
|
||||||
|
.AfterMap<AccessRightsViewModelMappingAction>()
|
||||||
|
;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class AccessRightsViewModelMappingAction : IMappingAction<AccountAccessDto, AccessRightsViewModel>
|
||||||
|
{
|
||||||
|
private readonly IContextProvider _contextProvider;
|
||||||
|
|
||||||
|
public AccessRightsViewModelMappingAction(IContextProvider contextProvider)
|
||||||
|
{
|
||||||
|
_contextProvider = contextProvider;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Process(AccountAccessDto source, AccessRightsViewModel destination, ResolutionContext context)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,13 +1,21 @@
|
|||||||
namespace MyOffice.Web.Models.Account;
|
namespace MyOffice.Web.Models.Account;
|
||||||
|
|
||||||
using Core.Attributes;
|
using AutoMapper;
|
||||||
using Services.Account.Domain;
|
using MyOffice.Services.Account.Domain;
|
||||||
|
|
||||||
[LinkFrom(typeof(AccountAccessInviteDto))]
|
|
||||||
[LinkWith(typeof(AccountViewModelProfile))]
|
|
||||||
public class AccountAccessInviteViewModel
|
public class AccountAccessInviteViewModel
|
||||||
{
|
{
|
||||||
public string? Id { get; set; }
|
public string? Id { get; set; }
|
||||||
public string? Account { get; set; }
|
public string? Account { get; set; }
|
||||||
public bool? AllowWrite { get; set; }
|
public bool? AllowWrite { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class AccountAccessInviteViewModelProfile: Profile
|
||||||
|
{
|
||||||
|
public AccountAccessInviteViewModelProfile()
|
||||||
|
{
|
||||||
|
CreateMap<AccountAccessInviteDto, AccountAccessInviteViewModel>()
|
||||||
|
.ForMember(x => x.AllowWrite, o => o.MapFrom(x => x.IsAllowWrite))
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using MyOffice.Services.Account.Domain;
|
||||||
|
|
||||||
|
namespace MyOffice.Web.Models.Account;
|
||||||
|
|
||||||
|
public class AccountAccessViewModel
|
||||||
|
{
|
||||||
|
public class AccountAccessItemViewModel
|
||||||
|
{
|
||||||
|
public string UserId { get; set; } = null!;
|
||||||
|
public bool AllowWrite { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public string? Email { get; set; }
|
||||||
|
public bool AllowWrite { get; set; }
|
||||||
|
public List<AccountAccessItemViewModel> Accesses { get; set; } = null!;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class AccountAccessItemViewModelProfile : Profile
|
||||||
|
{
|
||||||
|
public AccountAccessItemViewModelProfile()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,10 +1,9 @@
|
|||||||
namespace MyOffice.Web.Models.Account;
|
namespace MyOffice.Web.Models.Account;
|
||||||
|
|
||||||
using MyOffice.Core.Attributes;
|
|
||||||
using MyOffice.Services.Account.Domain;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using AutoMapper;
|
||||||
|
using MyOffice.Services.Account.Domain;
|
||||||
|
|
||||||
[Link(typeof(AccountCategoryDto))]
|
|
||||||
public class AccountCategoryViewModel: IResponseModel
|
public class AccountCategoryViewModel: IResponseModel
|
||||||
{
|
{
|
||||||
public string? Id { get; set; }
|
public string? Id { get; set; }
|
||||||
@@ -14,3 +13,18 @@ public class AccountCategoryViewModel: IResponseModel
|
|||||||
|
|
||||||
public bool? AllowDelete { get; set; }
|
public bool? AllowDelete { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class AccountCategoryViewModelProfile: Profile
|
||||||
|
{
|
||||||
|
public AccountCategoryViewModelProfile()
|
||||||
|
{
|
||||||
|
CreateMap<AccountAccountCategoryDto, AccountCategoryViewModel>()
|
||||||
|
.ForMember(x => x.Id, o => o.MapFrom(x => x.CategoryId))
|
||||||
|
.ForMember(x => x.Name, o => o.MapFrom(x => x.Category!.Name))
|
||||||
|
;
|
||||||
|
CreateMap<AccountCategoryDto, AccountCategoryViewModel>()
|
||||||
|
.ForMember(x => x.Id, o => o.MapFrom(x => x.Id))
|
||||||
|
.ForMember(x => x.Name, o => o.MapFrom(x => x.Name))
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,20 @@
|
|||||||
namespace MyOffice.Web.Models.Account;
|
namespace MyOffice.Web.Models.Account;
|
||||||
|
|
||||||
|
using AutoMapper;
|
||||||
|
using MyOffice.Services.Account.Domain;
|
||||||
|
|
||||||
public class AccountDetailedViewModel: BaseViewModel
|
public class AccountDetailedViewModel: BaseViewModel
|
||||||
{
|
{
|
||||||
public AccountViewModel Account { get; set; } = null!;
|
public AccountViewModel Account { get; set; } = null!;
|
||||||
public decimal Rest { get; set; }
|
public decimal Rest { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class AccountDetailedViewModelProfile: Profile
|
||||||
|
{
|
||||||
|
public AccountDetailedViewModelProfile()
|
||||||
|
{
|
||||||
|
CreateMap<AccountDetailedDto, AccountDetailedViewModel>()
|
||||||
|
.ForMember(x => x.Account, o => o.MapFrom(x => x.Account))
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -34,27 +34,6 @@ public class AccountViewModel: IResponseModel
|
|||||||
#endregion Permissions
|
#endregion Permissions
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class AccountViewModelExtensions
|
|
||||||
{
|
|
||||||
public static List<AccountViewModel> ToViewModel(this List<AccountDto> accounts, IMapper mapper)
|
|
||||||
{
|
|
||||||
return mapper.Map<List<AccountViewModel>>(accounts.OrderBy(x => x.Name));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class AccountAccessViewModel
|
|
||||||
{
|
|
||||||
public class AccountAccessItemViewModel
|
|
||||||
{
|
|
||||||
public string UserId { get; set; } = null!;
|
|
||||||
public bool AllowWrite { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public string? Email { get; set; }
|
|
||||||
public bool AllowWrite { get; set; }
|
|
||||||
public List<AccountAccessItemViewModel> Accesses { get; set; } = null!;
|
|
||||||
}
|
|
||||||
|
|
||||||
public class AccountViewModelProfile : Profile
|
public class AccountViewModelProfile : Profile
|
||||||
{
|
{
|
||||||
public AccountViewModelProfile()
|
public AccountViewModelProfile()
|
||||||
@@ -64,31 +43,19 @@ public class AccountViewModelProfile : Profile
|
|||||||
.ForMember(x => x.CurrencyName, o => o.MapFrom(x => x.Currency!.Name))
|
.ForMember(x => x.CurrencyName, o => o.MapFrom(x => x.Currency!.Name))
|
||||||
.AfterMap<AccountViewModelMappingAction>()
|
.AfterMap<AccountViewModelMappingAction>()
|
||||||
;
|
;
|
||||||
|
|
||||||
CreateMap<AccountAccessDto, AccessRightsViewModel>()
|
|
||||||
.AfterMap<AccessRightsViewModelMappingAction>()
|
|
||||||
;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class AccountViewModelMappingAction : IMappingAction<AccountDto, AccountViewModel>
|
public class AccountViewModelMappingAction : IMappingAction<AccountDto, AccountViewModel>
|
||||||
{
|
|
||||||
public void Process(AccountDto source, AccountViewModel destination, ResolutionContext context)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class AccessRightsViewModelMappingAction : IMappingAction<AccountAccessDto, AccessRightsViewModel>
|
|
||||||
{
|
{
|
||||||
private readonly IContextProvider _contextProvider;
|
private readonly IContextProvider _contextProvider;
|
||||||
|
|
||||||
public AccessRightsViewModelMappingAction(IContextProvider contextProvider)
|
public AccountViewModelMappingAction(IContextProvider contextProvider)
|
||||||
{
|
{
|
||||||
_contextProvider = contextProvider;
|
_contextProvider = contextProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Process(AccountAccessDto source, AccessRightsViewModel destination, ResolutionContext context)
|
public void Process(AccountDto source, AccountViewModel destination, ResolutionContext context)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -30,7 +30,7 @@ using MyOffice.Services.Identity;
|
|||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
public class PublicationSystemResolver : IMemberValueResolver<object, object, string, bool>
|
/*public class PublicationSystemResolver : IMemberValueResolver<object, object, string, bool>
|
||||||
{
|
{
|
||||||
private readonly IContextProvider _contextProvider;
|
private readonly IContextProvider _contextProvider;
|
||||||
|
|
||||||
@@ -45,64 +45,4 @@ public class PublicationSystemResolver : IMemberValueResolver<object, object, st
|
|||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
public class AccountViewModelGeneralProfile : Profile
|
|
||||||
{
|
|
||||||
public AccountViewModelGeneralProfile()
|
|
||||||
{
|
|
||||||
CreateMap<AccountDetailedDto, AccountDetailedViewModel>()
|
|
||||||
.ForMember(x => x.Account, o => o.MapFrom(x => x.Account))
|
|
||||||
;
|
|
||||||
|
|
||||||
CreateMap<UserDto, UserViewModel>();
|
|
||||||
|
|
||||||
CreateMap<MyOffice.Data.Models.Users.User, UserViewModel>();
|
|
||||||
|
|
||||||
CreateMap<AccountAccountCategoryDto, AccountCategoryViewModel>()
|
|
||||||
.ForMember(x => x.Id, o => o.MapFrom(x => x.CategoryId))
|
|
||||||
.ForMember(x => x.Name, o => o.MapFrom(x => x.Category!.Name))
|
|
||||||
;
|
|
||||||
|
|
||||||
CreateMap<AccountAccessViewModel.AccountAccessItemViewModel, AccountAccessDto>()
|
|
||||||
.ForMember(x => x.IsAllowWrite, o => o.MapFrom(x => x.AllowWrite))
|
|
||||||
;
|
|
||||||
|
|
||||||
CreateMap<AccountCategoryDto, AccountCategoryViewModel>()
|
|
||||||
;
|
|
||||||
|
|
||||||
CreateMap<AccountAccessInviteDto, AccountAccessInviteViewModel>()
|
|
||||||
.ForMember(x => x.AllowWrite, o => o.MapFrom(x => x.IsAllowWrite))
|
|
||||||
;
|
|
||||||
|
|
||||||
CreateMap<MotionDto, MotionViewModel>()
|
|
||||||
;
|
|
||||||
|
|
||||||
CreateMap<ItemDto, ItemViewModel>()
|
|
||||||
.ForMember(x => x.Category, o => o.MapFrom(x => x.Category!.Name))
|
|
||||||
;
|
|
||||||
|
|
||||||
CreateMap<ItemCategoryDto, ItemCategoryViewModel>()
|
|
||||||
.ForMember(x => x.Internal, o => o.MapFrom(x => x.IsInternal))
|
|
||||||
.ForMember(x => x.AllowDelete, o => o.MapFrom(x => !x.Items.Any() && x.Id != x.UserId))
|
|
||||||
.ForMember(x => x.SortOrder, o => o.MapFrom(x => x.Id == x.UserId ? 1 : 0))
|
|
||||||
;
|
|
||||||
|
|
||||||
CreateMap<CurrencyGlobalDto, CurrencyGlobalViewModel>();
|
|
||||||
|
|
||||||
CreateMap<CurrencyDto, CurrencyViewModel>();
|
|
||||||
|
|
||||||
CreateMap<CurrencyRateDto, CurrencyRateViewModel>();
|
|
||||||
|
|
||||||
CreateMap<CurrencyWithRateDto, CurrencyViewModel>()
|
|
||||||
.ForMember(x => x.Id, o => o.MapFrom(x => x.Currency.Id))
|
|
||||||
.ForMember(x => x.Code, o => o.MapFrom(x => x.Currency.CurrencyGlobalId))
|
|
||||||
.ForMember(x => x.Name, o => o.MapFrom(x => x.Currency.Name))
|
|
||||||
.ForMember(x => x.ShortName, o => o.MapFrom(x => x.Currency.ShortName))
|
|
||||||
.ForMember(x => x.Rate, o => o.MapFrom(x => x.Rate == null ? (decimal?)null : x.Rate.Rate))
|
|
||||||
.ForMember(x => x.IsPrimary, o => o.MapFrom(x => x.Currency.IsPrimary))
|
|
||||||
.ForMember(x => x.Quantity, o => o.MapFrom(x => x.Rate == null ? (int?)null : x.Rate.Quantity))
|
|
||||||
.ForMember(x => x.RateDate, o => o.MapFrom(x => x.Rate == null ? (DateTime?)null : x.Rate.DateTime))
|
|
||||||
;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,27 +1,22 @@
|
|||||||
namespace MyOffice.Web.Models.Currency
|
/// <see cref="MyOffice.Data.Models.Currencies.CurrencyGlobal"/>
|
||||||
{
|
/// <see cref="MyOffice.Services.Currency.Domain.CurrencyGlobalDto"/>
|
||||||
using Data.Models.Currencies;
|
namespace MyOffice.Web.Models.Currency;
|
||||||
using Microsoft.AspNetCore.Mvc.ModelBinding.Binders;
|
|
||||||
|
|
||||||
public class CurrencyGlobalViewModel
|
using AutoMapper;
|
||||||
{
|
using MyOffice.Services.Currency.Domain;
|
||||||
|
|
||||||
|
public class CurrencyGlobalViewModel
|
||||||
|
{
|
||||||
public string Id { get; set; } = null!;
|
public string Id { get; set; } = null!;
|
||||||
public string Name { get; set; } = null!;
|
public string Name { get; set; } = null!;
|
||||||
public int Quantity { get; set; }
|
public int Quantity { get; set; }
|
||||||
public string Symbol { get; set; } = null!;
|
public string Symbol { get; set; } = null!;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class CurrencyGlobalViewModelExtensions
|
public class CurrencyGlobalViewModelProfile : Profile
|
||||||
|
{
|
||||||
|
public CurrencyGlobalViewModelProfile()
|
||||||
{
|
{
|
||||||
public static CurrencyGlobalViewModel ToModel(this CurrencyGlobal input)
|
CreateMap<CurrencyGlobalDto, CurrencyGlobalViewModel>();
|
||||||
{
|
|
||||||
return new CurrencyGlobalViewModel
|
|
||||||
{
|
|
||||||
Id = input.Id,
|
|
||||||
Name = input.Name,
|
|
||||||
Quantity = input.DefaultQuantity,
|
|
||||||
Symbol = input.Symbol,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
namespace MyOffice.Web.Models.Currency;
|
namespace MyOffice.Web.Models.Currency;
|
||||||
|
|
||||||
|
using AutoMapper;
|
||||||
|
using MyOffice.Services.Currency.Domain;
|
||||||
|
|
||||||
public class CurrencyRateViewModel: BaseViewModel
|
public class CurrencyRateViewModel: BaseViewModel
|
||||||
{
|
{
|
||||||
public string Currency { get; set; } = null!;
|
public string Currency { get; set; } = null!;
|
||||||
@@ -7,3 +10,11 @@ public class CurrencyRateViewModel: BaseViewModel
|
|||||||
public int Quantity { get; set; }
|
public int Quantity { get; set; }
|
||||||
public decimal Rate { get; set; }
|
public decimal Rate { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class CurrencyRateViewModelProfile: Profile
|
||||||
|
{
|
||||||
|
public CurrencyRateViewModelProfile()
|
||||||
|
{
|
||||||
|
CreateMap<CurrencyRateDto, CurrencyRateViewModel>();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
namespace MyOffice.Web.Models.Currency;
|
namespace MyOffice.Web.Models.Currency;
|
||||||
|
|
||||||
|
using AutoMapper;
|
||||||
|
using MyOffice.Services.Currency.Domain;
|
||||||
|
|
||||||
public class CurrencyViewModel: BaseViewModel
|
public class CurrencyViewModel: BaseViewModel
|
||||||
{
|
{
|
||||||
public string Id { get; set; } = null!;
|
public string Id { get; set; } = null!;
|
||||||
@@ -12,3 +15,22 @@ public class CurrencyViewModel: BaseViewModel
|
|||||||
public DateTime? RateDate { get; set; }
|
public DateTime? RateDate { get; set; }
|
||||||
public bool IsPrimary { get; set; }
|
public bool IsPrimary { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class CurrencyViewModelProfile: Profile
|
||||||
|
{
|
||||||
|
public CurrencyViewModelProfile()
|
||||||
|
{
|
||||||
|
CreateMap<CurrencyDto, CurrencyViewModel>();
|
||||||
|
|
||||||
|
CreateMap<CurrencyWithRateDto, CurrencyViewModel>()
|
||||||
|
.ForMember(x => x.Id, o => o.MapFrom(x => x.Currency.Id))
|
||||||
|
.ForMember(x => x.Code, o => o.MapFrom(x => x.Currency.CurrencyGlobalId))
|
||||||
|
.ForMember(x => x.Name, o => o.MapFrom(x => x.Currency.Name))
|
||||||
|
.ForMember(x => x.ShortName, o => o.MapFrom(x => x.Currency.ShortName))
|
||||||
|
.ForMember(x => x.Rate, o => o.MapFrom(x => x.Rate == null ? (decimal?)null : x.Rate.Rate))
|
||||||
|
.ForMember(x => x.IsPrimary, o => o.MapFrom(x => x.Currency.IsPrimary))
|
||||||
|
.ForMember(x => x.Quantity, o => o.MapFrom(x => x.Rate == null ? (int?)null : x.Rate.Quantity))
|
||||||
|
.ForMember(x => x.RateDate, o => o.MapFrom(x => x.Rate == null ? (DateTime?)null : x.Rate.DateTime))
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
namespace MyOffice.Web.Models.Dashboard;
|
||||||
|
|
||||||
|
using AutoMapper;
|
||||||
|
using MyOffice.Services.Dashboard.Domain;
|
||||||
|
|
||||||
|
public class DashboardIncomeDataViewModel : DashboardIncomeData, IResponseModel
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class DashboardIncomeDataViewModelProfile : Profile
|
||||||
|
{
|
||||||
|
public DashboardIncomeDataViewModelProfile()
|
||||||
|
{
|
||||||
|
CreateMap<DashboardIncomeData, DashboardIncomeDataViewModel>();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
namespace MyOffice.Web.Models.Dashboard;
|
||||||
|
|
||||||
|
using AutoMapper;
|
||||||
|
using MyOffice.Services.Dashboard.Domain;
|
||||||
|
|
||||||
|
public class DashboardViewModel : DashboardData, IResponseModel
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class DashboardViewModelProfile : Profile
|
||||||
|
{
|
||||||
|
public DashboardViewModelProfile()
|
||||||
|
{
|
||||||
|
CreateMap<DashboardData, DashboardViewModel>();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,10 +1,11 @@
|
|||||||
namespace MyOffice.Web.Models.Item
|
namespace MyOffice.Web.Models.Item;
|
||||||
{
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
using Services.Account.Domain;
|
|
||||||
|
|
||||||
public class ItemCategoryViewModel
|
using System.ComponentModel.DataAnnotations;
|
||||||
{
|
using AutoMapper;
|
||||||
|
using Services.Account.Domain;
|
||||||
|
|
||||||
|
public class ItemCategoryViewModel
|
||||||
|
{
|
||||||
public string? Id { get; set; }
|
public string? Id { get; set; }
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
@@ -13,10 +14,11 @@
|
|||||||
public bool AllowDelete { get; set; }
|
public bool AllowDelete { get; set; }
|
||||||
public int SortOrder { get; set; }
|
public int SortOrder { get; set; }
|
||||||
public bool Internal { get; set; }
|
public bool Internal { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ItemCategoryViewModelExtensions
|
//TODO: REMOVE
|
||||||
{
|
public static class ItemCategoryViewModelExtensions
|
||||||
|
{
|
||||||
public static ItemCategoryDto FromModel(this ItemCategoryViewModel input)
|
public static ItemCategoryDto FromModel(this ItemCategoryViewModel input)
|
||||||
{
|
{
|
||||||
if (input == null)
|
if (input == null)
|
||||||
@@ -28,5 +30,16 @@
|
|||||||
IsInternal = input.Internal,
|
IsInternal = input.Internal,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ItemCategoryViewModelProfile: Profile
|
||||||
|
{
|
||||||
|
public ItemCategoryViewModelProfile()
|
||||||
|
{
|
||||||
|
CreateMap<ItemCategoryDto, ItemCategoryViewModel>()
|
||||||
|
.ForMember(x => x.Internal, o => o.MapFrom(x => x.IsInternal))
|
||||||
|
.ForMember(x => x.AllowDelete, o => o.MapFrom(x => !x.Items.Any() && x.Id != x.UserId))
|
||||||
|
.ForMember(x => x.SortOrder, o => o.MapFrom(x => x.Id == x.UserId ? 1 : 0))
|
||||||
|
;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
namespace MyOffice.Web.Models.Item;
|
namespace MyOffice.Web.Models.Item;
|
||||||
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using AutoMapper;
|
||||||
|
using MyOffice.Services.Account.Domain;
|
||||||
|
|
||||||
public class ItemViewModel : BaseViewModel
|
public class ItemViewModel : BaseViewModel
|
||||||
{
|
{
|
||||||
@@ -15,3 +17,13 @@ public class ItemViewModel : BaseViewModel
|
|||||||
|
|
||||||
public string? AccountId { get; set; }
|
public string? AccountId { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class ItemViewModelProfile: Profile
|
||||||
|
{
|
||||||
|
public ItemViewModelProfile()
|
||||||
|
{
|
||||||
|
CreateMap<ItemDto, ItemViewModel>()
|
||||||
|
.ForMember(x => x.Category, o => o.MapFrom(x => x.Category!.Name))
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,8 +8,6 @@ public class AccountControllerProfile : Profile
|
|||||||
{
|
{
|
||||||
public AccountControllerProfile()
|
public AccountControllerProfile()
|
||||||
{
|
{
|
||||||
CreateMap<MotionRequest, MotionAddUpdate>();
|
|
||||||
|
|
||||||
CreateMap<Motion, MotionViewModel>()
|
CreateMap<Motion, MotionViewModel>()
|
||||||
.ForMember(x => x.Date, o => o.MapFrom(x => x.DateTime))
|
.ForMember(x => x.Date, o => o.MapFrom(x => x.DateTime))
|
||||||
.ForMember(x => x.Item, o => o.MapFrom(x => x.Item.ItemGlobal.Name))
|
.ForMember(x => x.Item, o => o.MapFrom(x => x.Item.ItemGlobal.Name))
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
namespace MyOffice.Web.Models.Motion;
|
namespace MyOffice.Web.Models.Motion;
|
||||||
|
|
||||||
|
using AutoMapper;
|
||||||
|
using MyOffice.Services.Account.Domain;
|
||||||
|
|
||||||
public class MotionRequest
|
public class MotionRequest
|
||||||
{
|
{
|
||||||
public DateTime Date { get; set; }
|
public DateTime Date { get; set; }
|
||||||
@@ -11,3 +14,11 @@ public class MotionRequest
|
|||||||
public decimal? Minus { get; set; }
|
public decimal? Minus { get; set; }
|
||||||
public decimal? AmountBalancing { get; set; }
|
public decimal? AmountBalancing { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class MotionRequestProfile : Profile
|
||||||
|
{
|
||||||
|
public MotionRequestProfile()
|
||||||
|
{
|
||||||
|
CreateMap<MotionRequest, MotionAddUpdate>();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,10 @@
|
|||||||
namespace MyOffice.Web.Models.Motion
|
namespace MyOffice.Web.Models.Motion;
|
||||||
|
|
||||||
|
using AutoMapper;
|
||||||
|
using MyOffice.Services.Account.Domain;
|
||||||
|
|
||||||
|
public class MotionViewModel : BaseViewModel
|
||||||
{
|
{
|
||||||
public class MotionViewModel: BaseViewModel
|
|
||||||
{
|
|
||||||
public string Id { get; set; } = null!;
|
public string Id { get; set; } = null!;
|
||||||
public DateTime Date { get; set; }
|
public DateTime Date { get; set; }
|
||||||
public string AccountId { get; set; } = null!;
|
public string AccountId { get; set; } = null!;
|
||||||
@@ -9,5 +12,12 @@
|
|||||||
public string? Description { get; set; }
|
public string? Description { get; set; }
|
||||||
public decimal Plus { get; set; }
|
public decimal Plus { get; set; }
|
||||||
public decimal Minus { get; set; }
|
public decimal Minus { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class MotionViewModelProfile : Profile
|
||||||
|
{
|
||||||
|
public MotionViewModelProfile()
|
||||||
|
{
|
||||||
|
CreateMap<MotionDto, MotionViewModel>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
namespace MyOffice.Web.Models.User;
|
namespace MyOffice.Web.Models.User;
|
||||||
|
|
||||||
using Core.Extensions;
|
using AutoMapper;
|
||||||
using MyOffice.Data.Models.Users;
|
using MyOffice.Services.Account.Domain;
|
||||||
|
|
||||||
public class UserViewModel
|
public class UserViewModel
|
||||||
{
|
{
|
||||||
@@ -9,3 +9,11 @@ public class UserViewModel
|
|||||||
public string UserName { get; set; } = null!;
|
public string UserName { get; set; } = null!;
|
||||||
public string Email { get; set; } = null!;
|
public string Email { get; set; } = null!;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class UserViewModelProfile: Profile
|
||||||
|
{
|
||||||
|
public UserViewModelProfile()
|
||||||
|
{
|
||||||
|
CreateMap<UserDto, UserViewModel>();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,11 +7,60 @@ public partial class Program
|
|||||||
MapRoute(app, Routes.GlobalCurrencies, "General", "GetGlobalCurrencies", HttpMethod.Get);
|
MapRoute(app, Routes.GlobalCurrencies, "General", "GetGlobalCurrencies", HttpMethod.Get);
|
||||||
|
|
||||||
// Settings Currency
|
// Settings Currency
|
||||||
MapRoute(app, Routes.SettingsCurrencies, "Currency", "Get", HttpMethod.Get);
|
MapRoute(app, Routes.SettingsCurrencies, "SettingCurrency", "Get", HttpMethod.Get);
|
||||||
MapRoute(app, Routes.SettingsCurrencies, "Currency", "Add", HttpMethod.Post);
|
MapRoute(app, Routes.SettingsCurrencies, "SettingCurrency", "Add", HttpMethod.Post);
|
||||||
MapRoute(app, Routes.SettingsCurrency, "Currency", "Update", HttpMethod.Put);
|
MapRoute(app, Routes.SettingsCurrency, "SettingCurrency", "Update", HttpMethod.Put);
|
||||||
MapRoute(app, Routes.SettingsCurrency, "Currency", "Delete", HttpMethod.Delete);
|
MapRoute(app, Routes.SettingsCurrency, "SettingCurrency", "Delete", HttpMethod.Delete);
|
||||||
MapRoute(app, Routes.SettingsCurrencyRate, "Currency", "AddRate", HttpMethod.Post);
|
MapRoute(app, Routes.SettingsCurrencyRate, "SettingCurrency", "AddRate", HttpMethod.Post);
|
||||||
|
|
||||||
|
// Settings Account Categories
|
||||||
|
MapRoute(app, Routes.SettingsAccountCategories, "SettingsAccountCategory", "AccountCategories", HttpMethod.Get);
|
||||||
|
MapRoute(app, Routes.SettingsAccountCategory, "SettingsAccountCategory", "AccountCategory", HttpMethod.Get);
|
||||||
|
MapRoute(app, Routes.SettingsAccountCategories, "SettingsAccountCategory", "AccountCategoriesAdd", HttpMethod.Post);
|
||||||
|
MapRoute(app, Routes.SettingsAccountCategory, "SettingsAccountCategory", "AccountCategoriesUpdate", HttpMethod.Put);
|
||||||
|
MapRoute(app, Routes.SettingsAccountCategory, "SettingsAccountCategory", "AccountCategoriesDelete", HttpMethod.Delete);
|
||||||
|
|
||||||
|
// Settings Account
|
||||||
|
MapRoute(app, Routes.SettingsAccounts, "SettingsAccount", "AccountsGet", HttpMethod.Get);
|
||||||
|
MapRoute(app, Routes.SettingsAccounts, "SettingsAccount", "AccountsAdd", HttpMethod.Post);
|
||||||
|
MapRoute(app, Routes.SettingsAccount, "SettingsAccount", "AccountsUpdate", HttpMethod.Put);
|
||||||
|
MapRoute(app, Routes.SettingsAccount, "SettingsAccount", "AccountsDelete", HttpMethod.Delete);
|
||||||
|
MapRoute(app, Routes.SettingsAccountAccountCategory, "SettingsAccount", "AccountsCategoryDelete", HttpMethod.Delete);
|
||||||
|
MapRoute(app, Routes.SettingsAccountAccesses, "SettingsAccount", "AccountsAccessAdd", HttpMethod.Post);
|
||||||
|
MapRoute(app, Routes.SettingsAccountAccess, "SettingsAccount", "AccountsAccessDelete", HttpMethod.Delete);
|
||||||
|
MapRoute(app, Routes.SettingsAccountInvites, "SettingsAccount", "AccountInvites", HttpMethod.Get);
|
||||||
|
MapRoute(app, Routes.SettingsAccountInviteAccept, "SettingsAccount", "AccountInviteAccept", HttpMethod.Post);
|
||||||
|
MapRoute(app, Routes.SettingsAccountInviteReject, "SettingsAccount", "AccountInviteReject", HttpMethod.Post);
|
||||||
|
|
||||||
|
// Settings Items
|
||||||
|
MapRoute(app, Routes.SettingsItemCategories, "SettingsItem", "ItemsCategories", HttpMethod.Get);
|
||||||
|
MapRoute(app, Routes.SettingsItemCategories, "SettingsItem", "ItemCategoriesAdd", HttpMethod.Post);
|
||||||
|
MapRoute(app, Routes.SettingsItemCategory, "SettingsItem", "ItemCategoriesUpdate", HttpMethod.Put);
|
||||||
|
MapRoute(app, Routes.SettingsItemCategory, "SettingsItem", "ItemCategoriesDelete", HttpMethod.Delete);
|
||||||
|
MapRoute(app, Routes.SettingsItems, "SettingsItem", "Items", HttpMethod.Get);
|
||||||
|
MapRoute(app, Routes.SettingsItem, "SettingsItem", "ItemsUpdate", HttpMethod.Put);
|
||||||
|
MapRoute(app, Routes.SettingsItems, "SettingsItem", "ItemsPost", HttpMethod.Post);
|
||||||
|
|
||||||
|
// Account
|
||||||
|
MapRoute(app, Routes.Accounts, "Account", "AccountsGet", HttpMethod.Get);
|
||||||
|
MapRoute(app, Routes.Account, "Account", "AccountGet", HttpMethod.Get);
|
||||||
|
MapRoute(app, Routes.AccountMotions, "Account", "MotionsGet", HttpMethod.Get);
|
||||||
|
MapRoute(app, Routes.AccountMotions, "Account", "MotionsPost", HttpMethod.Post);
|
||||||
|
MapRoute(app, Routes.AccountMotion, "Account", "MotionsPut", HttpMethod.Put);
|
||||||
|
MapRoute(app, Routes.AccountMotion, "Account", "MotionsDelete", HttpMethod.Delete);
|
||||||
|
MapRoute(app, Routes.Items, "Account", "FindItems", HttpMethod.Get);
|
||||||
|
|
||||||
|
// Dashboard
|
||||||
|
MapRoute(app, Routes.Dashboard, "Dashboard", "Index", HttpMethod.Get);
|
||||||
|
MapRoute(app, Routes.DashboardIncome, "Dashboard", "Income", HttpMethod.Get);
|
||||||
|
MapRoute(app, Routes.DashboardOutcome, "Dashboard", "Outcome", HttpMethod.Get);
|
||||||
|
|
||||||
|
// User
|
||||||
|
MapRoute(app, Routes.UserRegister, "User", "Register", HttpMethod.Post);
|
||||||
|
MapRoute(app, Routes.UserProfile, "User", "ProfileGet", HttpMethod.Get);
|
||||||
|
MapRoute(app, Routes.UserProfile, "User", "ProfileUpdate", HttpMethod.Post);
|
||||||
|
MapRoute(app, Routes.UserAttach, "User", "AttachProvider", HttpMethod.Post);
|
||||||
|
MapRoute(app, Routes.UserDeattach, "User", "DeattachProvider", HttpMethod.Post);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void MapRoute(
|
private static void MapRoute(
|
||||||
@@ -50,4 +99,37 @@ public static class Routes
|
|||||||
public static readonly string SettingsCurrencies = "api/settings/currencies";
|
public static readonly string SettingsCurrencies = "api/settings/currencies";
|
||||||
public static readonly string SettingsCurrency = "api/settings/currencies/{id}";
|
public static readonly string SettingsCurrency = "api/settings/currencies/{id}";
|
||||||
public static readonly string SettingsCurrencyRate = "api/settings/currencies/{id}/rate";
|
public static readonly string SettingsCurrencyRate = "api/settings/currencies/{id}/rate";
|
||||||
|
|
||||||
|
public static readonly string SettingsAccountCategories = "api/settings/account-categories";
|
||||||
|
public static readonly string SettingsAccountCategory = "api/settings/account-categories/{id}";
|
||||||
|
|
||||||
|
public static readonly string SettingsAccounts = "api/settings/accounts";
|
||||||
|
public static readonly string SettingsAccount = "api/settings/accounts/{id}";
|
||||||
|
public static readonly string SettingsAccountAccountCategory = "api/settings/accounts/{id}/category/{categoryId}";
|
||||||
|
|
||||||
|
public static readonly string SettingsAccountAccesses = "api/settings/accounts/{id}/access";
|
||||||
|
public static readonly string SettingsAccountAccess = "api/settings/accounts/{id}/access/{userId}";
|
||||||
|
public static readonly string SettingsAccountInvites = "api/settings/accounts/invites";
|
||||||
|
public static readonly string SettingsAccountInviteAccept = "api/settings/accounts/invites/{id}/accept";
|
||||||
|
public static readonly string SettingsAccountInviteReject = "api/settings/accounts/invites/{id}/reject";
|
||||||
|
|
||||||
|
public static readonly string SettingsItemCategories = "api/settings/item-categories";
|
||||||
|
public static readonly string SettingsItemCategory = "api/settings/item-categories/{id}";
|
||||||
|
public static readonly string SettingsItems = "api/settings/items";
|
||||||
|
public static readonly string SettingsItem = "api/settings/items/{id}";
|
||||||
|
|
||||||
|
public static readonly string Accounts = "api/accounts";
|
||||||
|
public static readonly string Account = "api/accounts/{id}";
|
||||||
|
public static readonly string AccountMotions = "api/accounts/{id}/motions";
|
||||||
|
public static readonly string AccountMotion = "api/accounts/{id}/motions/{motionId}";
|
||||||
|
public static readonly string Items = "api/items";
|
||||||
|
|
||||||
|
public static readonly string Dashboard = "api/dashboard";
|
||||||
|
public static readonly string DashboardIncome = "api/dashboard/income";
|
||||||
|
public static readonly string DashboardOutcome = "api/dashboard/outcome";
|
||||||
|
|
||||||
|
public static readonly string UserRegister = "api/user/register";
|
||||||
|
public static readonly string UserProfile = "api/user/profile";
|
||||||
|
public static readonly string UserAttach = "api/user/attach";
|
||||||
|
public static readonly string UserDeattach = "api/user/deattach";
|
||||||
}
|
}
|
||||||
@@ -48,6 +48,7 @@ using MyOffice.Web.Infrastructure.Attributes;
|
|||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.Mvc.Infrastructure;
|
using Microsoft.AspNetCore.Mvc.Infrastructure;
|
||||||
|
using MyOffice.Web.Infrastructure.Filters;
|
||||||
|
|
||||||
//TODO: Data.Model only Repository and Service, response <-> mapper <-> web <-> mapper <-> service <-> repository
|
//TODO: Data.Model only Repository and Service, response <-> mapper <-> web <-> mapper <-> service <-> repository
|
||||||
//TODO: Project management
|
//TODO: Project management
|
||||||
@@ -169,6 +170,7 @@ public partial class Program
|
|||||||
{
|
{
|
||||||
options.Conventions.Add(new DefaultFromBodyBindingConvention());
|
options.Conventions.Add(new DefaultFromBodyBindingConvention());
|
||||||
options.Filters.Add(typeof(GlobalModelStateValidatorAttribute));
|
options.Filters.Add(typeof(GlobalModelStateValidatorAttribute));
|
||||||
|
options.Filters.Add(typeof(ResponseFilter));
|
||||||
});
|
});
|
||||||
|
|
||||||
builder.Services.Configure<MvcOptions>(options =>
|
builder.Services.Configure<MvcOptions>(options =>
|
||||||
|
|||||||
Reference in New Issue
Block a user