fix
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
namespace MyOffice.Web.Models.Account;
|
||||
|
||||
using Core.Attributes;
|
||||
using Services.Account.Domain;
|
||||
|
||||
[LinkFrom(typeof(AccountAccessInviteDto))]
|
||||
[LinkWith(typeof(AccountViewModelProfile))]
|
||||
public class AccountAccessInviteViewModel
|
||||
{
|
||||
public string? Id { get; set; }
|
||||
public string? Account { get; set; }
|
||||
public bool? AllowWrite { get; set; }
|
||||
}
|
||||
@@ -1,29 +1,16 @@
|
||||
namespace MyOffice.Web.Models.Account
|
||||
namespace MyOffice.Web.Models.Account;
|
||||
|
||||
using MyOffice.Core.Attributes;
|
||||
using MyOffice.Services.Account.Domain;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
[Link(typeof(AccountCategoryDto))]
|
||||
public class AccountCategoryViewModel
|
||||
{
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Core.Extensions;
|
||||
using Data.Models.Accounts;
|
||||
public string? Id { get; set; }
|
||||
|
||||
public class AccountCategoryViewModel
|
||||
{
|
||||
public string? Id { get; set; }
|
||||
|
||||
[Required]
|
||||
public string? Name { get; set; }
|
||||
[Required]
|
||||
public string? Name { get; set; }
|
||||
|
||||
public bool? AllowDelete { get; set; }
|
||||
}
|
||||
|
||||
public static class AccountCategoryViewModelExtensions
|
||||
{
|
||||
public static AccountCategoryViewModel ToModel(this AccountCategory input)
|
||||
{
|
||||
return new AccountCategoryViewModel
|
||||
{
|
||||
Id = input.Id.ToShort(),
|
||||
Name = input.Name,
|
||||
AllowDelete = !input.Accounts?.Any(),
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
public bool? AllowDelete { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace MyOffice.Web.Models.Account;
|
||||
|
||||
public class AccountInviteAcceptRequest
|
||||
{
|
||||
public string Name { get; set; } = null!;
|
||||
}
|
||||
@@ -3,11 +3,7 @@
|
||||
using AutoMapper;
|
||||
using MyOffice.Services.Identity;
|
||||
using Services.Account.Domain;
|
||||
using Services.Mapper;
|
||||
using System.Security.Cryptography;
|
||||
using Core.Extensions;
|
||||
using User;
|
||||
using static MyOffice.Web.Models.Account.AccountAccessViewModel;
|
||||
|
||||
public class CustomResolver : IValueResolver<AccountAccessDto, AccessRightsViewModel, bool>
|
||||
{
|
||||
@@ -61,11 +57,15 @@ public class AccountViewModelProfile : Profile
|
||||
(src, dst) => src.OwnerId == src.UserId))
|
||||
;
|
||||
|
||||
CreateMap<AccountAccessItemViewModel, AccountAccessDto>()
|
||||
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))
|
||||
;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user