merge
This commit is contained in:
commit
fd002486cb
|
|
@ -217,7 +217,7 @@ namespace TIAM.Database.DataLayers.Admins
|
|||
public string GetUsersJson() => Session(ctx => ctx.Users.ToJson());
|
||||
|
||||
public Task<bool> AddUserAsync(User user) => TransactionAsync(ctx => ctx.AddUser(user));
|
||||
public Task<User?> UpdateUserAsync(User user) => UpdateSafeAsync(user);
|
||||
public Task<User?> UpdateUserAsync(User? user) => UpdateSafeAsync(user);
|
||||
public Task<bool> RemoveUserAsync(Guid userId) => TransactionAsync(ctx => ctx.RemoveUser(userId));
|
||||
|
||||
#region Product
|
||||
|
|
@ -322,6 +322,14 @@ namespace TIAM.Database.DataLayers.Admins
|
|||
public Task<List<EmailMessage>> GetEmailMessagesAsync(Guid contextId, Guid userId, Guid userProductMappingId) => SessionAsync(ctx => ctx.GetEmailMessages<EmailMessage, EmailRecipient>(contextId, userId, userProductMappingId).OrderByDescending(x => x.Created).ToList());
|
||||
public Task<List<EmailMessage>> GetAllEmailMessagesAsync() => SessionAsync(ctx => ctx.GetAllEmailMessages<EmailMessage, EmailRecipient>().OrderByDescending(x => x.Created).ToList());
|
||||
|
||||
public Task<List<EmailMessage>> GetEmailMessagesByUserId(Guid userId)
|
||||
{
|
||||
return SessionAsync(ctx =>
|
||||
{
|
||||
return ctx.GetEmailMessagesByIds<EmailMessage, EmailRecipient>(ctx.GetUserProductMappingsByUserId(userId).Select(x => x.Id).Concat([userId])).ToList();
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
|
|
@ -329,7 +337,7 @@ namespace TIAM.Database.DataLayers.Admins
|
|||
/// <returns></returns>
|
||||
public Task<List<EmailMessage>> GetTransfersMessagesByDriverIdAsync(Guid driverId) => SessionAsync(ctx =>
|
||||
{
|
||||
//TODO: Az upm.UserId elvben nem kell, csak amíg ne fix a db! semmilyen gondot nem okoz... - J.
|
||||
//TODO: Az upm.UserId elvben nem kell, csak amíg nem fix a db! semmilyen gondot nem okoz... - J.
|
||||
var upm = ctx.GetUserProductMappingById(driverId);
|
||||
if (upm == null) return [];
|
||||
|
||||
|
|
|
|||
|
|
@ -79,9 +79,10 @@ public class SignalRTags : AcSignalRTags
|
|||
/// UserPropductMappingId
|
||||
/// </summary>
|
||||
public const int GetTransfersMessagesByDriverId = 62;
|
||||
public const int CreateMessage = 63;
|
||||
public const int UpdateMessage = 64;
|
||||
public const int DeleteMessage = 65;
|
||||
public const int GetMessagesByUserId = 63;
|
||||
public const int CreateMessage = 64;
|
||||
public const int UpdateMessage = 65;
|
||||
public const int DeleteMessage = 66;
|
||||
|
||||
public const int GetProductById = 70;
|
||||
public const int GetProductsByOwnerId = 71; //for now until we can send multiple parameters
|
||||
|
|
|
|||
|
|
@ -71,8 +71,6 @@
|
|||
<div class="row">
|
||||
<div class=" col-12">
|
||||
|
||||
|
||||
|
||||
<DxTabs>
|
||||
<DxTabPage Text="Upcoming">
|
||||
<DxAccordion ExpandMode="ExpandMode"
|
||||
|
|
@ -163,7 +161,6 @@
|
|||
|
||||
<DxTabPage Text="Messages">
|
||||
<div class="d-flex flex-column mb-4 pb-2">
|
||||
@* TODO: Megírni az GetMessagesByDriverId() endpoint-ot! - J. *@
|
||||
<MessageDetailGridComponent ContextId="driverId" GetAllMessageTag="SignalRTags.GetTransfersMessagesByDriverId" IsSenderEmailVisible="false" IsMessageTextVisible="false"></MessageDetailGridComponent>
|
||||
</div>
|
||||
</DxTabPage>
|
||||
|
|
|
|||
|
|
@ -1,16 +1,50 @@
|
|||
@page "/user/messages/{userId:guid}"
|
||||
@page "/user/messages/{UserId:guid}"
|
||||
@using AyCode.Core.Extensions
|
||||
@using TIAM.Models.Dtos.Users
|
||||
@using TIAM.Services
|
||||
@using TIAMSharedUI.Pages.User.SysAdmins
|
||||
@using TIAMWebApp.Shared.Application.Interfaces
|
||||
@using TIAMWebApp.Shared.Application.Services
|
||||
@inject ISessionService sessionService;
|
||||
@inject AdminSignalRClient AdminSignalRClient;
|
||||
@* @inject JSRuntime jsRuntime
|
||||
|
||||
<script>
|
||||
function isDevice() {
|
||||
return /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini|mobile/i.test(navigator.userAgent);
|
||||
}
|
||||
</script>
|
||||
*@
|
||||
|
||||
<div class="text-center m-5">
|
||||
<h1>Messages</h1>
|
||||
<h2 style="font-size:small">Manage messages here!</h2>
|
||||
</div>
|
||||
|
||||
<div class="card-body card-admin-body py-2 px-4">
|
||||
<div class="d-flex flex-column mb-4 pb-2">
|
||||
|
||||
<p>@userId.ToString()</p>
|
||||
|
||||
<MessageDetailGridComponent ContextId="UserId" GetAllMessageTag="SignalRTags.GetMessagesByUserId" IsSenderEmailVisible="false" IsMessageTextVisible="!_isMobile"></MessageDetailGridComponent>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@code {
|
||||
[Parameter] public Guid? userId { get; set; }
|
||||
[Parameter] public Guid? UserId { get; set; }
|
||||
|
||||
//private List<object> _contextParams = [];
|
||||
private bool _isMobile = false;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
//if (userId.IsNullOrEmpty() || sessionService.User == null) return;
|
||||
|
||||
// _contextParams.Add(userId);
|
||||
|
||||
// var upmId = sessionService.User.UserModelDto.UserProductMappings.Select(x => x.Id).FirstOrDefault();
|
||||
// if(!upmId.IsNullOrEmpty()) _contextParams.Add(upmId);
|
||||
|
||||
//_isMobile = await jsRuntime.InvokeAsync<bool>("isDevice");
|
||||
|
||||
await base.OnInitializedAsync();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,20 +29,21 @@
|
|||
GetAllMessageTag="GetAllMessageTag"
|
||||
ContextIds="@(ContextId.IsNullOrEmpty() ? throw new InvalidDataException($"ContextId.IsNullOrEmpty(); ContextId: {ContextId}") : [ContextId.Value])"
|
||||
CustomizeElement="CustomizeElement">
|
||||
|
||||
<Columns>
|
||||
<DxGridCommandColumn Width="135" MinWidth="135" Visible="AcDomain.IsDeveloperVersion" DeleteButtonVisible="AcDomain.IsDeveloperVersion" EditButtonVisible="AcDomain.IsDeveloperVersion" FixedPosition="GridColumnFixedPosition.Left" />
|
||||
<DxGridDataColumn FieldName="Id" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" />
|
||||
<DxGridDataColumn FieldName="ContextId" Width="80px" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" />
|
||||
<DxGridDataColumn FieldName="Id" Width="150" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" />
|
||||
<DxGridDataColumn FieldName="ContextId" Width="150px" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" />
|
||||
<DxGridDataColumn FieldName="SenderId" Width="150px" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" />
|
||||
<DxGridDataColumn FieldName="Created" Caption="Received" DisplayFormat="g" Width="130" SortIndex="0" SortOrder="GridColumnSortOrder.Descending" CaptionAlignment="GridTextAlignment.Center" TextAlignment="GridTextAlignment.Center" />
|
||||
<DxGridDataColumn FieldName="EmailAddress" Caption="Sender" Width="200px" Visible="@IsSenderEmailVisible" />
|
||||
<DxGridDataColumn FieldName="ContextType" Caption="Category" Width="75" />
|
||||
<DxGridDataColumn FieldName="EmailAddress" Caption="Sender" Width="200px" Visible="IsSenderEmailVisible || AcDomain.IsDeveloperVersion" />
|
||||
<DxGridDataColumn FieldName="Subject" />
|
||||
<DxGridDataColumn FieldName="Text" Visible="@IsMessageTextVisible">
|
||||
<CellDisplayTemplate Context="displayTextContext">
|
||||
<text>@System.Text.RegularExpressions.Regex.Replace((displayTextContext.Value as string)!, "<(.|\n)*?>", string.Empty)</text>
|
||||
</CellDisplayTemplate>
|
||||
</DxGridDataColumn>
|
||||
<DxGridDataColumn FieldName="IsReaded" Caption="Readed" Visible="@IsSenderEmailVisible" Width="70" CaptionAlignment="GridTextAlignment.Center" TextAlignment="GridTextAlignment.Center" />
|
||||
<DxGridDataColumn FieldName="IsReaded" Caption="Readed" Visible="@IsMessageTextVisible" Width="70" CaptionAlignment="GridTextAlignment.Center" TextAlignment="GridTextAlignment.Center" />
|
||||
|
||||
</Columns>
|
||||
<DetailRowTemplate>
|
||||
|
|
|
|||
|
|
@ -88,6 +88,16 @@ namespace TIAMWebApp.Server.Controllers
|
|||
return await _adminDal.GetTransfersMessagesByDriverIdAsync(driverId);
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
[SignalR(SignalRTags.GetMessagesByUserId)]
|
||||
public async Task<List<EmailMessage>> GetMessagesByUserId(Guid userId)
|
||||
{
|
||||
_logger.Info($@"GetMessagesByUserId called with userId: {userId}");
|
||||
|
||||
return await _adminDal.GetEmailMessagesByUserId(userId);
|
||||
}
|
||||
|
||||
[AllowAnonymous]
|
||||
[HttpGet]
|
||||
[Route(APIUrls.GetMessagesByContextIdRouteName + "/{contextId}")]
|
||||
|
|
|
|||
|
|
@ -449,9 +449,9 @@ namespace TIAMWebApp.Server.Controllers
|
|||
[Route(APIUrls.SendForgottenPasswordMailRouteName)]
|
||||
public async Task<bool> SendForgottenPasswordMail([FromBody] string email)
|
||||
{
|
||||
User user;
|
||||
_logger.Info($"SendForgottenPasswordMail called with id: {email}");
|
||||
user = await userDal.GetUserByEmailAsync(email, false);
|
||||
|
||||
var user = await userDal.GetUserByEmailAsync(email, false);
|
||||
if (user == null)
|
||||
{
|
||||
return false;
|
||||
|
|
@ -554,7 +554,7 @@ namespace TIAMWebApp.Server.Controllers
|
|||
}
|
||||
|
||||
[NonAction]
|
||||
private async Task<bool> SetEmailConfirmedMethod(User user)
|
||||
private async Task<bool> SetEmailConfirmedMethod(User? user)
|
||||
{
|
||||
user.EmailConfirmed = true;
|
||||
var result = await adminDal.UpdateUserAsync(user);
|
||||
|
|
|
|||
Loading…
Reference in New Issue