1
0
mirror of https://github.com/bitwarden/server.git synced 2025-06-26 21:58:48 -05:00
Thomas Rittson 9021236d61
AC Team code ownership moves: Organization pt. 1 (#3472)
* move Organization.cs files to AC Team code ownership
2023-11-28 17:18:08 -06:00

26 lines
979 B
C#

using AutoMapper;
using Bit.Core.Auth.Models.Data;
using Bit.Infrastructure.EntityFramework.AdminConsole.Models;
using Bit.Infrastructure.EntityFramework.Models;
namespace Bit.Infrastructure.EntityFramework.Auth.Models;
public class AuthRequest : Core.Auth.Entities.AuthRequest
{
public virtual User User { get; set; }
public virtual Device ResponseDevice { get; set; }
public virtual Organization Organization { get; set; }
}
public class AuthRequestMapperProfile : Profile
{
public AuthRequestMapperProfile()
{
CreateMap<Core.Auth.Entities.AuthRequest, AuthRequest>().ReverseMap();
CreateProjection<AuthRequest, OrganizationAdminAuthRequest>()
.ForMember(m => m.Email, opt => opt.MapFrom(t => t.User.Email))
.ForMember(m => m.OrganizationUserId, opt => opt.MapFrom(
t => t.User.OrganizationUsers.FirstOrDefault(ou => ou.OrganizationId == t.OrganizationId && ou.UserId == t.UserId).Id));
}
}