diff --git a/.gitignore b/.gitignore index 95b3136..90a3256 100644 --- a/.gitignore +++ b/.gitignore @@ -342,3 +342,4 @@ healthchecksdb /src/WorkFlowCheck.API/Images *.pdf /src/WorkFlowCheck.API/Pdf/c86f3a6a-c646-4627-823c-7e24134b7725.docx +/src/WorkFlowCheck.API/Downloads/APK/com.nuvolar.wfcapp-Signed.apk diff --git a/src/WorkFlowCheck.API/Downloads/APK/com.nuvolar.wfcapp-Signed.apk b/src/WorkFlowCheck.API/Downloads/APK/com.nuvolar.wfcapp-Signed.apk deleted file mode 100644 index c4ae6ff..0000000 Binary files a/src/WorkFlowCheck.API/Downloads/APK/com.nuvolar.wfcapp-Signed.apk and /dev/null differ diff --git a/src/WorkFlowCheck.BL/Services/CheckListService.cs b/src/WorkFlowCheck.BL/Services/CheckListService.cs index d6ed01b..3e810c0 100644 --- a/src/WorkFlowCheck.BL/Services/CheckListService.cs +++ b/src/WorkFlowCheck.BL/Services/CheckListService.cs @@ -170,7 +170,7 @@ namespace WorkFlowCheck.BL.Services IsEditable = true, UserId = checkListHeaderNewDTO.UserId, ShortName = "", - Description = "", + Description = checkListTemplateHeader.Description ?? "", DocumentNumber = documentNumber, GuidNumber = Guid.NewGuid(), IsDeleted = false, @@ -227,7 +227,10 @@ namespace WorkFlowCheck.BL.Services checkListHeader.CheckStatus = CheckStatus.Signed; checkListHeader.IsEditable = false; checkListHeader.AcceptUserId = userid; - Log.ForContext("TAG", "BusinessFlow").Warning($"Ellenőrzési lap státuszváltozása, jóváhasyás: Ellenőrzés:{id}, Felhasználó:{userid}"); + + checkListHeader.DateExecution = DateTime.Now; + + Log.ForContext("TAG", "BusinessFlow").Warning($"Ellenőrzési lap státuszváltozása, jóváhagyás: Ellenőrzés:{checkListHeader.DocumentNumber}, Felhasználó: {checkListHeader.AcceptUser.LastName} {checkListHeader.AcceptUser.FirstName}"); await _dbContext.SaveChangesAsync(); var pdf = await CreateCheckListHeaderPDFAsync(id); diff --git a/src/WorkFlowCheck.BL/Services/SyncService.cs b/src/WorkFlowCheck.BL/Services/SyncService.cs index 85c8744..0bd085d 100644 --- a/src/WorkFlowCheck.BL/Services/SyncService.cs +++ b/src/WorkFlowCheck.BL/Services/SyncService.cs @@ -212,8 +212,7 @@ namespace WorkFlowCheck.BL.Services var res = await _dbContext.Locations.Where(w => w.Id == LocationDTO.Id).FirstOrDefaultAsync(); if (res != null) { - res = _mapper.Map(LocationDTO); - + res.FullName = LocationDTO.FullName; await _dbContext.SaveChangesAsync(); retVal = _mapper.Map(res); @@ -349,9 +348,10 @@ namespace WorkFlowCheck.BL.Services try { var res = await _dbContext.CheckListHeaders - .Where(w => (w.IsEditable && - w.IsDeleted != true) || (w.CheckStatus == CheckStatus.Blocked) - ) + .Where(w => w.CheckStatus == CheckStatus.Open || + w.CheckStatus == CheckStatus.InProgress || + w.CheckStatus == CheckStatus.Blocked || + w.CheckStatus == CheckStatus.Sent) .Include(i => i.CheckListRows) //.ThenInclude(i => i.CheckListTemplateRow) .AsNoTracking() @@ -385,43 +385,6 @@ namespace WorkFlowCheck.BL.Services if (res != null && (res.CheckStatus == CheckStatus.Open || res.CheckStatus == CheckStatus.InProgress)) { - if (NeedBlocking(checkListHeaderDTO)) - { - /// TODO: blokkolás miatt - res.CheckStatus = CheckStatus.Blocked; - await _dbContext.SaveChangesAsync(); - - Log.ForContext("TAG", "BusinessFlow").Warning($"Ellenőrzési lap blokkolva: Ellenőrzés:{checkListHeaderDTO.Id}, Felhasználó:{_requestContext.CurrentUsername}"); - - var user = await _userService.GetUserAsync(_requestContext.CurrentUserId ?? 1); - - foreach (var item in user.RoleDTO) - { - var deviceMessageDTO = new DeviceMessageDTO() - { - IsReaded = false, - Message = $"Ellenőrző lap blokkolva! [{checkListHeaderDTO.DocumentNumber}]", - SendDate = DateTime.UtcNow, - ExtraDataJSON = "", - RoleId = item.ParentId, - DeviceIdFrom = "", - DeviceIdTo = "", - }; - - await this.DeviceMessageSend(deviceMessageDTO); - - var fCMMessageDTO = new FCMMessageDTO - { - Body = deviceMessageDTO.Message, - Title = "Blokkolási értesítés", - UserId = user.Id, - }; - await _messageService.SendFCMMessageToLastToken(fCMMessageDTO); - } - return retVal; - } - - res.CheckStatus = CheckStatus.InProgress; var ids = checkListHeaderDTO.CheckListRowDTO?.Select(r => r.Id).ToList(); if (ids != null && ids.Count > 0) { @@ -448,6 +411,47 @@ namespace WorkFlowCheck.BL.Services } } } + await _dbContext.SaveChangesAsync(); + retVal = _mapper.Map(res); + + if (NeedBlocking(checkListHeaderDTO)) + { + /// TODO: blokkolás miatt + res.CheckStatus = CheckStatus.Blocked; + await _dbContext.SaveChangesAsync(); + + Log.ForContext("TAG", "BusinessFlow").Warning($"Ellenőrzési lap blokkolva: Ellenőrzés:{checkListHeaderDTO.Id}, Felhasználó:{_requestContext.CurrentUsername}"); + + var user = await _userService.GetUserAsync(_requestContext.CurrentUserId ?? 1); + + foreach (var item in user.RoleDTO) + { + var deviceMessageDTO = new DeviceMessageDTO() + { + IsReaded = false, + Message = $"Ellenőrző lap blokkolva! [{checkListHeaderDTO.DocumentNumber}]", + SendDate = DateTime.UtcNow, + ExtraDataJSON = "", + RoleId = item.ParentId, + DeviceIdFrom = "", + DeviceIdTo = "", + }; + + await this.DeviceMessageSend(deviceMessageDTO); + + var fCMMessageDTO = new FCMMessageDTO + { + Body = deviceMessageDTO.Message, + Title = "Blokkolási értesítés", + UserId = user.Id, + }; + await _messageService.SendFCMMessageToLastToken(fCMMessageDTO); + } + return retVal; + } + + res.CheckStatus = CheckStatus.InProgress; + if (CheckIfLastReached(checkListHeaderDTO)) { /// TODO: most kell a CheckStatust állítani és menjen üzenet ! diff --git a/src/WorkFlowCheck.Common/DTO/EquipmentDTO.cs b/src/WorkFlowCheck.Common/DTO/EquipmentDTO.cs index c738bc6..d9d737f 100644 --- a/src/WorkFlowCheck.Common/DTO/EquipmentDTO.cs +++ b/src/WorkFlowCheck.Common/DTO/EquipmentDTO.cs @@ -1,5 +1,7 @@ using System; using System.Collections.Generic; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -9,7 +11,13 @@ namespace WorkFlowCheck.Common.DTO public class EquipmentDTO { public int Id { get; set; } + + [Required(ErrorMessage = "A megnevezést megadása kötelező.")] + [DisplayName("Megnevezés")] public string ShortName { get; set; } = null!; + + [Required(ErrorMessage = "Az azonosító megadása kötelező.")] + [DisplayName("Azonosító")] public string EquipmentNumber { get; set; } = null!; } } diff --git a/src/WorkFlowCheck.Common/DTO/LocationDTO.cs b/src/WorkFlowCheck.Common/DTO/LocationDTO.cs index 6f4e74b..7237f7a 100644 --- a/src/WorkFlowCheck.Common/DTO/LocationDTO.cs +++ b/src/WorkFlowCheck.Common/DTO/LocationDTO.cs @@ -1,5 +1,7 @@ using System; using System.Collections.Generic; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -9,6 +11,9 @@ namespace WorkFlowCheck.Common.DTO public class LocationDTO { public int Id { get; set; } + + [Required(ErrorMessage = "A megnevezést megadása kötelező.")] + [DisplayName("Megnevezés")] public string FullName { get; set; } = null!; } } diff --git a/src/WorkFlowCheck.Common/DTO/RoleCheckListTemplateHeaderDTO.cs b/src/WorkFlowCheck.Common/DTO/RoleCheckListTemplateHeaderDTO.cs index a7f8f43..e8eafe5 100644 --- a/src/WorkFlowCheck.Common/DTO/RoleCheckListTemplateHeaderDTO.cs +++ b/src/WorkFlowCheck.Common/DTO/RoleCheckListTemplateHeaderDTO.cs @@ -1,5 +1,7 @@ using System; using System.Collections.Generic; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; using System.Data; using System.Linq; using System.Text; @@ -10,10 +12,19 @@ namespace WorkFlowCheck.Common.DTO public class RoleCheckListTemplateHeaderDTO { public int Id { get; set; } + + [Required(ErrorMessage = "A szabály megnevezésének megadása kötelező.")] + [DisplayName("Szabály")] public int RoleId { get; set; } public RoleDTO? RoleDTO { get; set; } = null!; + + [Required(ErrorMessage = "Az ellenőrzési sablon megadása kötelező.")] + [DisplayName("Ellenőrzési sablon")] public int CheckListTemplateHeaderId { get; set; } public CheckListTemplateHeaderDTO? CheckListTemplateHeaderDTO { get; set; } = null!; + + + [DisplayName("Engedélyezve?")] public bool Enabled { get; set; } = false; } } diff --git a/src/WorkFlowCheck.Common/DTO/RoleCheckPointDTO.cs b/src/WorkFlowCheck.Common/DTO/RoleCheckPointDTO.cs index f12040b..d07b23b 100644 --- a/src/WorkFlowCheck.Common/DTO/RoleCheckPointDTO.cs +++ b/src/WorkFlowCheck.Common/DTO/RoleCheckPointDTO.cs @@ -1,5 +1,7 @@ using System; using System.Collections.Generic; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; using System.Data; using System.Linq; using System.Text; @@ -10,10 +12,18 @@ namespace WorkFlowCheck.Common.DTO public class RoleCheckPointDTO { public int Id { get; set; } + + [Required(ErrorMessage = "A szabály megadása kötelező.")] + [DisplayName("Szabály")] public int RoleId { get; set; } public RoleDTO? RoleDTO { get; set; } = null!; + + [Required(ErrorMessage = "Az ellenőrzési pont megadása kötelező.")] + [DisplayName("Ellenőrzési pont")] public int CheckPointId { get; set; } public CheckPointDTO? CheckPointDTO { get; set; } = null!; + + [DisplayName("Engedélyezve?")] public bool Enabled { get; set; } = false; } } diff --git a/src/WorkFlowCheck.Common/DTO/UserChangePassword2FADTO.cs b/src/WorkFlowCheck.Common/DTO/UserChangePassword2FADTO.cs index d4f7cd9..f6522fe 100644 --- a/src/WorkFlowCheck.Common/DTO/UserChangePassword2FADTO.cs +++ b/src/WorkFlowCheck.Common/DTO/UserChangePassword2FADTO.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -16,9 +17,13 @@ namespace WorkFlowCheck.Common.DTO [DisplayName("Régi jelszó")] public string OldPassword { get; set; } = null!; + [Required(ErrorMessage = "A jelszó kötelező.")] + [RegularExpression(@"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[\W_]).{6,}$", ErrorMessage = "Az új jelszónak legalább 6 karakter hosszúnak kell lennie, és tartalmaznia kell kis- és nagybetűt, számot és speciális karaktert.")] [DisplayName("Új jelszó")] public string NewPassword1 { get; set; } = null!; + [Required(ErrorMessage = "A jelszó kötelező.")] + [RegularExpression(@"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[\W_]).{6,}$", ErrorMessage = "Az új jelszónak legalább 6 karakter hosszúnak kell lennie, és tartalmaznia kell kis- és nagybetűt, számot és speciális karaktert.")] [DisplayName("Jelszó megerősítése")] public string NewPassword2 { get; set; } = null!; diff --git a/src/WorkFlowCheck.Common/DTO/UserDTO.cs b/src/WorkFlowCheck.Common/DTO/UserDTO.cs index 705245b..3230ddf 100644 --- a/src/WorkFlowCheck.Common/DTO/UserDTO.cs +++ b/src/WorkFlowCheck.Common/DTO/UserDTO.cs @@ -25,9 +25,12 @@ namespace WorkFlowCheck.Common.DTO [DisplayName("Felhasználó neve")] public string UserName { get;set; } = null!; + [Required(ErrorMessage = "A jelszó kötelező.")] + [RegularExpression(@"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[\W_]).{6,}$", ErrorMessage = "A jelszónak legalább 6 karakter hosszúnak kell lennie, és tartalmaznia kell kis- és nagybetűt, számot és speciális karaktert.")] [DisplayName("Jelszó")] - public string Password { get; set; } - + public string Password { get; set; } = null!; + + public string JwtToken { get; set; } = null!; [DisplayName("Aktív")] diff --git a/src/WorkFlowCheck.MAUI/Helper/SystemHelper.cs b/src/WorkFlowCheck.MAUI/Helper/SystemHelper.cs index a07517b..b1d1405 100644 --- a/src/WorkFlowCheck.MAUI/Helper/SystemHelper.cs +++ b/src/WorkFlowCheck.MAUI/Helper/SystemHelper.cs @@ -19,7 +19,7 @@ namespace WorkFlowCheck.MAUI.Helper public static string DatabaseName = ""; public static bool Syncronised = false; public static UserDTO SystemUserDTO; - public static string ProgramVersion = "v1.1.027"; + public static string ProgramVersion = "v1.1.030"; #if DEBUG public static string ApiBaseUrl = $"https://dev.wfcapi.nuvolar.hu/"; diff --git a/src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListPage.xaml b/src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListPage.xaml index 1ceea00..9d8b944 100644 --- a/src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListPage.xaml +++ b/src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListPage.xaml @@ -38,7 +38,7 @@ - + - - -