DeviceMessages-hez backend fejlesztése
This commit is contained in:
@@ -471,6 +471,30 @@ namespace WorkFlowCheck.API.Controllers
|
|||||||
|
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
[HttpGet("DeviceMessageReadUnreadedRole/{roleId}")]
|
||||||
|
public async Task<ApiResponseDTO<List<DeviceMessageDTO>>> DeviceMessageReadUnreadedRole(int roleId)
|
||||||
|
{
|
||||||
|
var retVal = new ApiResponseDTO<List<DeviceMessageDTO>>()
|
||||||
|
{
|
||||||
|
IsSuccess = true,
|
||||||
|
};
|
||||||
|
|
||||||
|
var response = await _syncService.DeviceMessageReadUnreadedRole(roleId);
|
||||||
|
|
||||||
|
if (response != null)
|
||||||
|
{
|
||||||
|
|
||||||
|
retVal.IsSuccess = true;
|
||||||
|
retVal.Data = response;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
retVal.IsSuccess = false;
|
||||||
|
retVal.Errors.Add("No data!");
|
||||||
|
}
|
||||||
|
|
||||||
|
return retVal;
|
||||||
|
}
|
||||||
|
|
||||||
[HttpGet("Download")]
|
[HttpGet("Download")]
|
||||||
public async Task<IActionResult> DownloadAPKFileAsync()
|
public async Task<IActionResult> DownloadAPKFileAsync()
|
||||||
|
|||||||
@@ -32,7 +32,8 @@ namespace WorkFlowCheck.BL.Services.Interfaces
|
|||||||
|
|
||||||
Task<bool> DeviceMessageSend(DeviceMessageDTO deviceMessageDTO);
|
Task<bool> DeviceMessageSend(DeviceMessageDTO deviceMessageDTO);
|
||||||
Task<List<DeviceMessageDTO>> DeviceMessageReadUnreaded(string deviceId);
|
Task<List<DeviceMessageDTO>> DeviceMessageReadUnreaded(string deviceId);
|
||||||
|
Task<List<DeviceMessageDTO>> DeviceMessageReadUnreadedRole(int roleId);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -553,5 +553,31 @@ namespace WorkFlowCheck.BL.Services
|
|||||||
}
|
}
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
public async Task<List<DeviceMessageDTO>> DeviceMessageReadUnreadedRole(int roleId)
|
||||||
|
{
|
||||||
|
var retVal = new List<DeviceMessageDTO>();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var res = await _dbContext.DeviceMessages
|
||||||
|
.Where(w => w.RoleId == roleId && w.IsReaded != true)
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
if (res != null)
|
||||||
|
{
|
||||||
|
retVal = _mapper.Map<List<DeviceMessageDTO>>(res);
|
||||||
|
foreach (var deviceMessage in res)
|
||||||
|
{
|
||||||
|
deviceMessage.IsReaded = true;
|
||||||
|
deviceMessage.ReceiveDate = DateTime.UtcNow;
|
||||||
|
}
|
||||||
|
await _dbContext.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex.Message);
|
||||||
|
}
|
||||||
|
return retVal;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,6 +93,7 @@ namespace WorkFlowCheck.BL.Services
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
Log.ForContext("TAG", "AuditFlow").Information($"Bejelentkezési kísérlet: {userName}");
|
||||||
var user = await _dbContext.Users
|
var user = await _dbContext.Users
|
||||||
.Include(i => i.UserRoles)
|
.Include(i => i.UserRoles)
|
||||||
.ThenInclude(i => i.Role)
|
.ThenInclude(i => i.Role)
|
||||||
@@ -116,9 +117,13 @@ namespace WorkFlowCheck.BL.Services
|
|||||||
}
|
}
|
||||||
user.JwtToken = GenerateJwtToken(userDTO);
|
user.JwtToken = GenerateJwtToken(userDTO);
|
||||||
await _dbContext.SaveChangesAsync();
|
await _dbContext.SaveChangesAsync();
|
||||||
|
Log.ForContext("TAG", "AuditFlow").Information($"Sikeres bejelentkezés: {userName}");
|
||||||
retVal = _mapper.Map<UserDTO>(user);
|
retVal = _mapper.Map<UserDTO>(user);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Log.ForContext("TAG", "AuditFlow").Error($"Sikertelen bejelenkezési kísérlet: {userName}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
@page
|
@page
|
||||||
@model WorkFlowCheck.Web.Pages.BaseStock.Equipments.EquipmentsPageModel
|
@model WorkFlowCheck.Web.Pages.BaseStock.Equipments.EquipmentsPageModel
|
||||||
|
@using WorkFlowCheck.Common.Helper
|
||||||
|
@using WorkFlowCheck.Common.DTO
|
||||||
@{
|
@{
|
||||||
ViewData["Title"] = "Berendezések";
|
ViewData["Title"] = "Berendezések";
|
||||||
}
|
}
|
||||||
@@ -15,16 +17,16 @@
|
|||||||
<thead class="table-primary">
|
<thead class="table-primary">
|
||||||
<tr>
|
<tr>
|
||||||
<th>ID</th>
|
<th>ID</th>
|
||||||
<th>Short Name</th>
|
<th>@DisplayNameHelper.GetDisplayName(nameof(EquipmentDTO.ShortName), typeof(EquipmentDTO))</th>
|
||||||
<th>Equipment Number</th>
|
<th>@DisplayNameHelper.GetDisplayName(nameof(EquipmentDTO.EquipmentNumber), typeof(EquipmentDTO))</th>
|
||||||
<th class="text-center">Action</th>
|
<th class="text-center">Action</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tfoot class="table-light">
|
<tfoot class="table-light">
|
||||||
<tr>
|
<tr>
|
||||||
<th>ID</th>
|
<th>ID</th>
|
||||||
<th>Short Name</th>
|
<th>@DisplayNameHelper.GetDisplayName(nameof(EquipmentDTO.ShortName), typeof(EquipmentDTO))</th>
|
||||||
<th>Equipment Number</th>
|
<th>@DisplayNameHelper.GetDisplayName(nameof(EquipmentDTO.EquipmentNumber), typeof(EquipmentDTO))</th>
|
||||||
<th>Action</th>
|
<th>Action</th>
|
||||||
</tr>
|
</tr>
|
||||||
</tfoot>
|
</tfoot>
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
@page
|
@page
|
||||||
@model WorkFlowCheck.Web.Pages.BaseStock.Locations.LocationsPageModel
|
@model WorkFlowCheck.Web.Pages.BaseStock.Locations.LocationsPageModel
|
||||||
|
@using WorkFlowCheck.Common.Helper
|
||||||
|
@using WorkFlowCheck.Common.DTO
|
||||||
@{
|
@{
|
||||||
ViewData["Title"] = "Lokációk";
|
ViewData["Title"] = "Lokációk";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user