Merge branch 'master' of https://tfs.nuvolar.hu:8443/tfs/AtomERP/_git/WorkFlowCheck
This commit is contained in:
@@ -462,5 +462,32 @@ namespace WorkFlowCheck.API.Controllers
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
[HttpGet("Download")]
|
||||
public async Task<IActionResult> DownloadAPKFileAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
string fileName = "com.nuvolar.wfcapp-Signed.apk";
|
||||
string downloadFolder = Path.Combine(Directory.GetCurrentDirectory(), "Downloads", "APK");
|
||||
string filePath = Path.Combine(downloadFolder, fileName);
|
||||
|
||||
if (!System.IO.File.Exists(filePath))
|
||||
{
|
||||
return NotFound("File not found.");
|
||||
}
|
||||
|
||||
var fileBytes = await System.IO.File.ReadAllBytesAsync(filePath);
|
||||
var fileType = "application/octet-stream";
|
||||
|
||||
Response.Headers.Add("Content-Length", fileBytes.Length.ToString());
|
||||
|
||||
return File(fileBytes, fileType, fileName);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Error: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,6 +139,53 @@ namespace WorkFlowCheck.API.Controllers
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
[HttpPost("AuthenticateNFC")]
|
||||
public async Task<ApiResponseDTO<UserDTO>> AuthenticateNFC([FromBody] UserSimpleDTO userSimpleDTO)
|
||||
{
|
||||
var retVal = new ApiResponseDTO<UserDTO>()
|
||||
{
|
||||
IsSuccess = true
|
||||
};
|
||||
if (string.IsNullOrEmpty(userSimpleDTO.UserName) || string.IsNullOrEmpty(userSimpleDTO.Password))
|
||||
{
|
||||
retVal.IsSuccess = false;
|
||||
retVal.Errors.Add("Nem megfelelo felhasználói név vagy jelszó");
|
||||
return retVal;
|
||||
}
|
||||
try
|
||||
{
|
||||
var userDTO_Response = await _userService.Authenticate(userSimpleDTO.UserName, userSimpleDTO.Password);
|
||||
if (userDTO_Response != null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(userDTO_Response.UserName) == false && userDTO_Response.UserName == userSimpleDTO.UserName)
|
||||
{
|
||||
retVal.IsSuccess = true;
|
||||
retVal.Data = userDTO_Response;
|
||||
Log.Information($"Sikeres azonosítás! {userSimpleDTO.UserName}");
|
||||
}
|
||||
else
|
||||
{
|
||||
var error = $"Nem megfelelo felhasználó vagy jelszó! {userSimpleDTO.UserName}";
|
||||
retVal.IsSuccess = false;
|
||||
retVal.Errors.Add(error);
|
||||
Log.Information(error);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var error = $"Nem megfelelo felhasználó vagy jelszó! {userSimpleDTO.UserName}";
|
||||
retVal.IsSuccess = false;
|
||||
retVal.Errors.Add(error);
|
||||
Log.Information(error);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
Log.Error(ex.Message);
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
[HttpGet("GetRole/{id}")]
|
||||
public async Task<ApiResponseDTO<RoleDTO>> GetRole(int id)
|
||||
|
||||
Binary file not shown.
@@ -97,6 +97,16 @@ if (!Directory.Exists(pdfDirectory))
|
||||
{
|
||||
Directory.CreateDirectory(pdfDirectory);
|
||||
}
|
||||
string downloadDirectory = Path.Combine(Directory.GetCurrentDirectory(), "Downloads");
|
||||
if (!Directory.Exists(downloadDirectory))
|
||||
{
|
||||
Directory.CreateDirectory(downloadDirectory);
|
||||
}
|
||||
string downloadAPKDirectory = Path.Combine(Directory.GetCurrentDirectory(), "Downloads","APK");
|
||||
if (!Directory.Exists(downloadAPKDirectory))
|
||||
{
|
||||
Directory.CreateDirectory(downloadAPKDirectory);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
@@ -16,7 +16,9 @@ namespace WorkFlowCheck.BL.Mappings
|
||||
{
|
||||
CreateMap<User, UserDTO>().ForMember(dest => dest.RoleDTO, opt => opt.MapFrom(src => src.UserRoles.Select(ur => ur.Role)));
|
||||
|
||||
CreateMap<Role, RoleDTO>();
|
||||
CreateMap<Role, RoleDTO>()
|
||||
.ForMember(dest => dest.ParentId, opt => opt.MapFrom(src => src.ParentId))
|
||||
.ForMember(dest => dest.ParentRoleName, opt => opt.MapFrom(src => src.Parent != null ? src.Parent.RoleName : null));
|
||||
|
||||
CreateMap<UserRole, UserRoleDTO>()
|
||||
.ForMember(dest => dest.RoleDTO, opt => opt.MapFrom(src => src.Role))
|
||||
|
||||
@@ -13,6 +13,7 @@ namespace WorkFlowCheck.BL.Services.Interfaces
|
||||
Task<List<UserDTO>> GetAllUserAsync();
|
||||
Task<UserDTO> UpdateUserAsync(UserDTO userDTO);
|
||||
Task<UserDTO> Authenticate(string UserName, string Password);
|
||||
Task<UserDTO> AuthenticateNFC(string NFCCode);
|
||||
|
||||
Task<RoleDTO> GetRoleAsync(int Id);
|
||||
Task<List<RoleDTO>> GetAllRoleAsync();
|
||||
|
||||
@@ -116,6 +116,46 @@ namespace WorkFlowCheck.BL.Services
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
public async Task<UserDTO> AuthenticateNFC(string NFCCode)
|
||||
{
|
||||
var retVal = new UserDTO() { RoleDTO = new List<RoleDTO>() };
|
||||
|
||||
try
|
||||
{
|
||||
var user = await _dbContext.Users
|
||||
.Include(i => i.UserRoles)
|
||||
.ThenInclude(i => i.Role)
|
||||
.Where(w => w.NFCCode == NFCCode && w.NFCActive == true)
|
||||
.FirstOrDefaultAsync();
|
||||
if (user != null)
|
||||
{
|
||||
|
||||
var userDTO = new UserDTO()
|
||||
{
|
||||
Id = user.Id,
|
||||
UserName = user.UserName,
|
||||
RoleDTO = new List<RoleDTO>(),
|
||||
};
|
||||
foreach (var item in user.UserRoles)
|
||||
{
|
||||
userDTO.RoleDTO.Add(new RoleDTO()
|
||||
{
|
||||
Id = item.Role.Id,
|
||||
RoleName = item.Role.RoleName,
|
||||
});
|
||||
}
|
||||
user.JwtToken = GenerateJwtToken(userDTO);
|
||||
await _dbContext.SaveChangesAsync();
|
||||
|
||||
retVal = _mapper.Map<UserDTO>(user);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error(ex.Message);
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
public string GenerateJwtToken(UserDTO userDTO)
|
||||
{
|
||||
var jwtSettings = _configuration.GetSection("Jwt");
|
||||
@@ -236,7 +276,13 @@ namespace WorkFlowCheck.BL.Services
|
||||
{
|
||||
var role = new Role();
|
||||
role.RoleName = roleDTO.RoleName;
|
||||
|
||||
if (roleDTO.ParentId > 0)
|
||||
{
|
||||
role.ParentId = roleDTO.ParentId;
|
||||
}
|
||||
role.IsAdmin = roleDTO.IsAdmin;
|
||||
role.CanDownloadAPK = roleDTO.CanDownloadAPK;
|
||||
role.CanEnableBlocked = roleDTO.CanEnableBlocked;
|
||||
_dbContext.Roles.Add(role);
|
||||
await _dbContext.SaveChangesAsync();
|
||||
|
||||
@@ -248,7 +294,14 @@ namespace WorkFlowCheck.BL.Services
|
||||
|
||||
if (role != null)
|
||||
{
|
||||
role.RoleName += roleDTO.RoleName;
|
||||
role.RoleName = roleDTO.RoleName;
|
||||
if (roleDTO.ParentId > 0)
|
||||
{
|
||||
role.ParentId = roleDTO.ParentId;
|
||||
}
|
||||
role.IsAdmin = roleDTO.IsAdmin;
|
||||
role.CanDownloadAPK = roleDTO.CanDownloadAPK;
|
||||
role.CanEnableBlocked = roleDTO.CanEnableBlocked;
|
||||
await _dbContext.SaveChangesAsync();
|
||||
|
||||
retVal = _mapper.Map<RoleDTO>(role);
|
||||
|
||||
@@ -10,5 +10,16 @@ namespace WorkFlowCheck.Common.DTO
|
||||
[Required(ErrorMessage = "A szabály megnevezésének megadása kötelező.")]
|
||||
[DisplayName("Megnevezés")]
|
||||
public string RoleName { get; set; } = null!;
|
||||
|
||||
public int? ParentId { get; set; }
|
||||
|
||||
[DisplayName("Szülő szerepkör neve")]
|
||||
public string? ParentRoleName { get; set; }
|
||||
[DisplayName("Adminisztrátor?")]
|
||||
public bool IsAdmin { get; set; }
|
||||
[DisplayName("Új program letöltés?")]
|
||||
public bool CanDownloadAPK { get; set; }
|
||||
[DisplayName("Folyamat blokk/engedélyez?")]
|
||||
public bool CanEnableBlocked { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,10 @@ namespace WorkFlowCheck.DL.Configurations
|
||||
builder.ToTable("Roles");
|
||||
builder.HasKey(e => e.Id);
|
||||
builder.Property(e => e.Id).ValueGeneratedOnAdd();
|
||||
builder.HasOne(r => r.Parent)
|
||||
.WithMany(r => r.Children)
|
||||
.HasForeignKey(r => r.ParentId)
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace WorkFlowCheck.DL.Configurations
|
||||
{
|
||||
|
||||
@@ -8,17 +8,22 @@ using WorkFlowCheck.DL.Interfaces;
|
||||
|
||||
namespace WorkFlowCheck.DL.Entities
|
||||
{
|
||||
public class Role :ISoftDeletableEntity,IAuditableEntity
|
||||
public class Role : ISoftDeletableEntity, IAuditableEntity
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string RoleName { get; set; } = null!;
|
||||
|
||||
public int? ParentId { get; set; }
|
||||
public virtual Role? Parent { get; set; }
|
||||
public bool IsAdmin { get; set; }
|
||||
public bool CanDownloadAPK { get; set; }
|
||||
public bool CanEnableBlocked { get; set; }
|
||||
public virtual ICollection<Role> Children { get; set; } = new List<Role>();
|
||||
public virtual ICollection<UserRole> UserRoles { get; set; } = new List<UserRole>();
|
||||
|
||||
public bool IsDeleted { get ; set ; }
|
||||
public DateTime LastModAt { get ; set ; }
|
||||
public string LastModBy { get ; set ; } = null!;
|
||||
public DateTime CreatedAt { get ; set ; }
|
||||
public string CreatedBy { get ; set ; } = null!;
|
||||
public bool IsDeleted { get; set; }
|
||||
public DateTime LastModAt { get; set; }
|
||||
public string LastModBy { get; set; } = null!;
|
||||
public DateTime CreatedAt { get; set; }
|
||||
public string CreatedBy { get; set; } = null!;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,928 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using WorkFlowCheck.DL;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace WorkFlowCheck.DL.Migrations
|
||||
{
|
||||
[DbContext(typeof(AppDbContext))]
|
||||
[Migration("20250406112447_Extend015")]
|
||||
partial class Extend015
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.12")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("WorkFlowCheck.DL.Entities.CheckListHeader", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CheckListTemplateHeaderId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("CheckStatus")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("DateExecution")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("DocumentNumber")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<Guid>("GuidNumber")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<bool>("IsDeleted")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("IsEditable")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("IsStorno")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<DateTime>("LastModAt")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("LastModBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ShortName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CheckListTemplateHeaderId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("CheckListHeader", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WorkFlowCheck.DL.Entities.CheckListRow", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Answer")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("CheckListHeaderId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("CheckListTemplateRowId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<Guid>("GuidNumber")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<bool>("IsDeleted")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<DateTime>("LastModAt")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("LastModBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("PhotoFileName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CheckListHeaderId");
|
||||
|
||||
b.HasIndex("CheckListTemplateRowId");
|
||||
|
||||
b.ToTable("CheckListRow", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WorkFlowCheck.DL.Entities.CheckListTemplateHeader", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<bool>("IsDeleted")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<DateTime>("LastModAt")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("LastModBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("NumberGenerator1Id")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("NumberGenerator2Id")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ShortName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("NumberGenerator1Id");
|
||||
|
||||
b.HasIndex("NumberGenerator2Id");
|
||||
|
||||
b.ToTable("CheckListTemplateHeader", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WorkFlowCheck.DL.Entities.CheckListTemplateRow", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("AnswerType")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("CheckListTemplateHeaderId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("CheckPointId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("EquipmentId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<bool>("IsDeleted")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<DateTime>("LastModAt")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("LastModBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("OperationDescription")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("RowIndex")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CheckListTemplateHeaderId");
|
||||
|
||||
b.HasIndex("CheckPointId");
|
||||
|
||||
b.HasIndex("EquipmentId");
|
||||
|
||||
b.ToTable("CheckListTemplateRow", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WorkFlowCheck.DL.Entities.CheckPoint", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<bool>("IsDeleted")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("IsEnabled")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<DateTime>("LastModAt")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("LastModBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ShortName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("CheckPoint", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WorkFlowCheck.DL.Entities.DeviceMessage", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("DeviceIdFrom")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("DeviceIdTo")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<string>("ExtraDataJSON")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<bool>("IsReaded")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<string>("Message")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime?>("ReceiveDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime>("SendDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("DeviceIdTo")
|
||||
.HasDatabaseName("IX_DeviceMessage_DeviceIdTo");
|
||||
|
||||
b.ToTable("DeviceMessage", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WorkFlowCheck.DL.Entities.Equipment", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("EquipmentNumber")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<bool>("IsDeleted")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<DateTime>("LastModAt")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("LastModBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ShortName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Equipment", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WorkFlowCheck.DL.Entities.Location", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("FullName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<bool>("IsDeleted")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<DateTime>("LastModAt")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("LastModBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Location", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WorkFlowCheck.DL.Entities.NumberGeneratorTemplate", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CurrentNumber")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("DigitFormat")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("GenerateType")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("LastGeneratedNumber")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Prefix")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("PrefixSeparator")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ShortName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Suffix")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("SuffixSeparator")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("NumberGeneratorTemplate", (string)null);
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
CurrentNumber = 0,
|
||||
DigitFormat = "D4",
|
||||
GenerateType = 0,
|
||||
LastGeneratedNumber = "",
|
||||
Prefix = "CHK",
|
||||
PrefixSeparator = "-",
|
||||
ShortName = "Ellenőrzési dokumentum sorszámozása",
|
||||
Suffix = "",
|
||||
SuffixSeparator = "-"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WorkFlowCheck.DL.Entities.NumberGeneratorTemplateDate", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CurrentNumber")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("LastGeneratedNumber")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("Month")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("NumberGeneratorTemplateId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Year")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("NumberGeneratorTemplateId");
|
||||
|
||||
b.ToTable("NumberGeneratorTemplateDate", (string)null);
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
CurrentNumber = 0,
|
||||
LastGeneratedNumber = "",
|
||||
Month = 0,
|
||||
NumberGeneratorTemplateId = 1,
|
||||
Year = 1
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WorkFlowCheck.DL.Entities.Role", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<bool>("CanDownloadAPK")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("CanEnableBlocked")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<bool>("IsAdmin")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("IsDeleted")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<DateTime>("LastModAt")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("LastModBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("ParentId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RoleName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ParentId");
|
||||
|
||||
b.ToTable("Roles", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WorkFlowCheck.DL.Entities.RoleCheckListTemplateHeader", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CheckListTemplateHeaderId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<bool>("Enabled")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<int>("RoleId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CheckListTemplateHeaderId");
|
||||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.ToTable("RoleCheckListTemplateHeader", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WorkFlowCheck.DL.Entities.RoleCheckPoint", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CheckPointId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<bool>("Enabled")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<int>("RoleId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CheckPointId");
|
||||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.ToTable("RoleCheckPoint", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WorkFlowCheck.DL.Entities.User", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<bool>("Active")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("FirstName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<bool>("IsDeleted")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<string>("JwtToken")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("LastModAt")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("LastModBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("LastName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<bool>("NFCActive")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<string>("NFCCode")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("PasswordHash")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Token2FA")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("UserName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Users", (string)null);
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1,
|
||||
Active = true,
|
||||
CreatedAt = new DateTime(2025, 4, 6, 11, 24, 45, 650, DateTimeKind.Utc).AddTicks(7691),
|
||||
CreatedBy = "System",
|
||||
Email = "admin@nuvolar.hu",
|
||||
FirstName = "Administrator",
|
||||
IsDeleted = false,
|
||||
JwtToken = "",
|
||||
LastModAt = new DateTime(2025, 4, 6, 11, 24, 45, 650, DateTimeKind.Utc).AddTicks(7694),
|
||||
LastModBy = "System",
|
||||
LastName = "System",
|
||||
NFCActive = true,
|
||||
NFCCode = "00000000",
|
||||
PasswordHash = "eGM0NUREZnJ0ISFFRDIxMKE5TYwthDBuUsTUEO1fBnCR3VdSCmdz47ue0RoVvnkY",
|
||||
Token2FA = "",
|
||||
UserName = "admin"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
Active = true,
|
||||
CreatedAt = new DateTime(2025, 4, 6, 11, 24, 45, 661, DateTimeKind.Utc).AddTicks(5371),
|
||||
CreatedBy = "System",
|
||||
Email = "user@nuvolar.hu",
|
||||
FirstName = "User",
|
||||
IsDeleted = false,
|
||||
JwtToken = "",
|
||||
LastModAt = new DateTime(2025, 4, 6, 11, 24, 45, 661, DateTimeKind.Utc).AddTicks(5373),
|
||||
LastModBy = "System",
|
||||
LastName = "System",
|
||||
NFCActive = true,
|
||||
NFCCode = "00000000",
|
||||
PasswordHash = "eGM0NUREZnJ0ISFFRDIxMPwM2D9sQSj7zmaSBIsOGe0I9hBFwCGPVbyrYMA5EnKG",
|
||||
Token2FA = "",
|
||||
UserName = "user"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WorkFlowCheck.DL.Entities.UserRole", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int?>("RoleId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("UserRoles", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WorkFlowCheck.DL.Entities.CheckListHeader", b =>
|
||||
{
|
||||
b.HasOne("WorkFlowCheck.DL.Entities.CheckListTemplateHeader", "CheckListTemplateHeader")
|
||||
.WithMany()
|
||||
.HasForeignKey("CheckListTemplateHeaderId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("WorkFlowCheck.DL.Entities.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("CheckListTemplateHeader");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WorkFlowCheck.DL.Entities.CheckListRow", b =>
|
||||
{
|
||||
b.HasOne("WorkFlowCheck.DL.Entities.CheckListHeader", "CheckListHeader")
|
||||
.WithMany("CheckListRows")
|
||||
.HasForeignKey("CheckListHeaderId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("WorkFlowCheck.DL.Entities.CheckListTemplateRow", "CheckListTemplateRow")
|
||||
.WithMany()
|
||||
.HasForeignKey("CheckListTemplateRowId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("CheckListHeader");
|
||||
|
||||
b.Navigation("CheckListTemplateRow");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WorkFlowCheck.DL.Entities.CheckListTemplateHeader", b =>
|
||||
{
|
||||
b.HasOne("WorkFlowCheck.DL.Entities.NumberGeneratorTemplate", "NumberGenerator1")
|
||||
.WithMany()
|
||||
.HasForeignKey("NumberGenerator1Id");
|
||||
|
||||
b.HasOne("WorkFlowCheck.DL.Entities.NumberGeneratorTemplate", "NumberGenerator2")
|
||||
.WithMany()
|
||||
.HasForeignKey("NumberGenerator2Id");
|
||||
|
||||
b.Navigation("NumberGenerator1");
|
||||
|
||||
b.Navigation("NumberGenerator2");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WorkFlowCheck.DL.Entities.CheckListTemplateRow", b =>
|
||||
{
|
||||
b.HasOne("WorkFlowCheck.DL.Entities.CheckListTemplateHeader", "CheckListTemplateHeader")
|
||||
.WithMany("CheckListTemplateRows")
|
||||
.HasForeignKey("CheckListTemplateHeaderId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("WorkFlowCheck.DL.Entities.CheckPoint", "CheckPoint")
|
||||
.WithMany("CheckListTemplateRows")
|
||||
.HasForeignKey("CheckPointId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("WorkFlowCheck.DL.Entities.Equipment", "Equipment")
|
||||
.WithMany()
|
||||
.HasForeignKey("EquipmentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("CheckListTemplateHeader");
|
||||
|
||||
b.Navigation("CheckPoint");
|
||||
|
||||
b.Navigation("Equipment");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WorkFlowCheck.DL.Entities.NumberGeneratorTemplateDate", b =>
|
||||
{
|
||||
b.HasOne("WorkFlowCheck.DL.Entities.NumberGeneratorTemplate", "NumberGeneratorTemplate")
|
||||
.WithMany("NumberGeneratorTemplateDates")
|
||||
.HasForeignKey("NumberGeneratorTemplateId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("NumberGeneratorTemplate");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WorkFlowCheck.DL.Entities.Role", b =>
|
||||
{
|
||||
b.HasOne("WorkFlowCheck.DL.Entities.Role", "Parent")
|
||||
.WithMany("Children")
|
||||
.HasForeignKey("ParentId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.Navigation("Parent");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WorkFlowCheck.DL.Entities.RoleCheckListTemplateHeader", b =>
|
||||
{
|
||||
b.HasOne("WorkFlowCheck.DL.Entities.CheckListTemplateHeader", "CheckListTemplateHeader")
|
||||
.WithMany()
|
||||
.HasForeignKey("CheckListTemplateHeaderId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("WorkFlowCheck.DL.Entities.Role", "Role")
|
||||
.WithMany()
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("CheckListTemplateHeader");
|
||||
|
||||
b.Navigation("Role");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WorkFlowCheck.DL.Entities.RoleCheckPoint", b =>
|
||||
{
|
||||
b.HasOne("WorkFlowCheck.DL.Entities.CheckPoint", "CheckPoint")
|
||||
.WithMany()
|
||||
.HasForeignKey("CheckPointId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("WorkFlowCheck.DL.Entities.Role", "Role")
|
||||
.WithMany()
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("CheckPoint");
|
||||
|
||||
b.Navigation("Role");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WorkFlowCheck.DL.Entities.UserRole", b =>
|
||||
{
|
||||
b.HasOne("WorkFlowCheck.DL.Entities.Role", "Role")
|
||||
.WithMany("UserRoles")
|
||||
.HasForeignKey("RoleId");
|
||||
|
||||
b.HasOne("WorkFlowCheck.DL.Entities.User", "User")
|
||||
.WithMany("UserRoles")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Role");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WorkFlowCheck.DL.Entities.CheckListHeader", b =>
|
||||
{
|
||||
b.Navigation("CheckListRows");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WorkFlowCheck.DL.Entities.CheckListTemplateHeader", b =>
|
||||
{
|
||||
b.Navigation("CheckListTemplateRows");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WorkFlowCheck.DL.Entities.CheckPoint", b =>
|
||||
{
|
||||
b.Navigation("CheckListTemplateRows");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WorkFlowCheck.DL.Entities.NumberGeneratorTemplate", b =>
|
||||
{
|
||||
b.Navigation("NumberGeneratorTemplateDates");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WorkFlowCheck.DL.Entities.Role", b =>
|
||||
{
|
||||
b.Navigation("Children");
|
||||
|
||||
b.Navigation("UserRoles");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WorkFlowCheck.DL.Entities.User", b =>
|
||||
{
|
||||
b.Navigation("UserRoles");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace WorkFlowCheck.DL.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Extend015 : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "CanDownloadAPK",
|
||||
table: "Roles",
|
||||
type: "bit",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "CanEnableBlocked",
|
||||
table: "Roles",
|
||||
type: "bit",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "IsAdmin",
|
||||
table: "Roles",
|
||||
type: "bit",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "ParentId",
|
||||
table: "Roles",
|
||||
type: "int",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Users",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
columns: new[] { "CreatedAt", "LastModAt" },
|
||||
values: new object[] { new DateTime(2025, 4, 6, 11, 24, 45, 650, DateTimeKind.Utc).AddTicks(7691), new DateTime(2025, 4, 6, 11, 24, 45, 650, DateTimeKind.Utc).AddTicks(7694) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Users",
|
||||
keyColumn: "Id",
|
||||
keyValue: 2,
|
||||
columns: new[] { "CreatedAt", "LastModAt" },
|
||||
values: new object[] { new DateTime(2025, 4, 6, 11, 24, 45, 661, DateTimeKind.Utc).AddTicks(5371), new DateTime(2025, 4, 6, 11, 24, 45, 661, DateTimeKind.Utc).AddTicks(5373) });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Roles_ParentId",
|
||||
table: "Roles",
|
||||
column: "ParentId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Roles_Roles_ParentId",
|
||||
table: "Roles",
|
||||
column: "ParentId",
|
||||
principalTable: "Roles",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Roles_Roles_ParentId",
|
||||
table: "Roles");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Roles_ParentId",
|
||||
table: "Roles");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "CanDownloadAPK",
|
||||
table: "Roles");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "CanEnableBlocked",
|
||||
table: "Roles");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "IsAdmin",
|
||||
table: "Roles");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ParentId",
|
||||
table: "Roles");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Users",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
columns: new[] { "CreatedAt", "LastModAt" },
|
||||
values: new object[] { new DateTime(2025, 4, 5, 12, 18, 54, 939, DateTimeKind.Utc).AddTicks(1707), new DateTime(2025, 4, 5, 12, 18, 54, 939, DateTimeKind.Utc).AddTicks(1709) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Users",
|
||||
keyColumn: "Id",
|
||||
keyValue: 2,
|
||||
columns: new[] { "CreatedAt", "LastModAt" },
|
||||
values: new object[] { new DateTime(2025, 4, 5, 12, 18, 54, 949, DateTimeKind.Utc).AddTicks(6682), new DateTime(2025, 4, 5, 12, 18, 54, 949, DateTimeKind.Utc).AddTicks(6683) });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -510,6 +510,12 @@ namespace WorkFlowCheck.DL.Migrations
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<bool>("CanDownloadAPK")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("CanEnableBlocked")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
@@ -517,6 +523,9 @@ namespace WorkFlowCheck.DL.Migrations
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<bool>("IsAdmin")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("IsDeleted")
|
||||
.HasColumnType("bit");
|
||||
|
||||
@@ -527,12 +536,17 @@ namespace WorkFlowCheck.DL.Migrations
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("ParentId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RoleName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ParentId");
|
||||
|
||||
b.ToTable("Roles", (string)null);
|
||||
});
|
||||
|
||||
@@ -659,13 +673,13 @@ namespace WorkFlowCheck.DL.Migrations
|
||||
{
|
||||
Id = 1,
|
||||
Active = true,
|
||||
CreatedAt = new DateTime(2025, 4, 5, 12, 18, 54, 939, DateTimeKind.Utc).AddTicks(1707),
|
||||
CreatedAt = new DateTime(2025, 4, 6, 11, 24, 45, 650, DateTimeKind.Utc).AddTicks(7691),
|
||||
CreatedBy = "System",
|
||||
Email = "admin@nuvolar.hu",
|
||||
FirstName = "Administrator",
|
||||
IsDeleted = false,
|
||||
JwtToken = "",
|
||||
LastModAt = new DateTime(2025, 4, 5, 12, 18, 54, 939, DateTimeKind.Utc).AddTicks(1709),
|
||||
LastModAt = new DateTime(2025, 4, 6, 11, 24, 45, 650, DateTimeKind.Utc).AddTicks(7694),
|
||||
LastModBy = "System",
|
||||
LastName = "System",
|
||||
NFCActive = true,
|
||||
@@ -678,13 +692,13 @@ namespace WorkFlowCheck.DL.Migrations
|
||||
{
|
||||
Id = 2,
|
||||
Active = true,
|
||||
CreatedAt = new DateTime(2025, 4, 5, 12, 18, 54, 949, DateTimeKind.Utc).AddTicks(6682),
|
||||
CreatedAt = new DateTime(2025, 4, 6, 11, 24, 45, 661, DateTimeKind.Utc).AddTicks(5371),
|
||||
CreatedBy = "System",
|
||||
Email = "user@nuvolar.hu",
|
||||
FirstName = "User",
|
||||
IsDeleted = false,
|
||||
JwtToken = "",
|
||||
LastModAt = new DateTime(2025, 4, 5, 12, 18, 54, 949, DateTimeKind.Utc).AddTicks(6683),
|
||||
LastModAt = new DateTime(2025, 4, 6, 11, 24, 45, 661, DateTimeKind.Utc).AddTicks(5373),
|
||||
LastModBy = "System",
|
||||
LastName = "System",
|
||||
NFCActive = true,
|
||||
@@ -809,6 +823,16 @@ namespace WorkFlowCheck.DL.Migrations
|
||||
b.Navigation("NumberGeneratorTemplate");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WorkFlowCheck.DL.Entities.Role", b =>
|
||||
{
|
||||
b.HasOne("WorkFlowCheck.DL.Entities.Role", "Parent")
|
||||
.WithMany("Children")
|
||||
.HasForeignKey("ParentId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.Navigation("Parent");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WorkFlowCheck.DL.Entities.RoleCheckListTemplateHeader", b =>
|
||||
{
|
||||
b.HasOne("WorkFlowCheck.DL.Entities.CheckListTemplateHeader", "CheckListTemplateHeader")
|
||||
@@ -886,6 +910,8 @@ namespace WorkFlowCheck.DL.Migrations
|
||||
|
||||
modelBuilder.Entity("WorkFlowCheck.DL.Entities.Role", b =>
|
||||
{
|
||||
b.Navigation("Children");
|
||||
|
||||
b.Navigation("UserRoles");
|
||||
});
|
||||
|
||||
|
||||
@@ -15,11 +15,39 @@
|
||||
<form method="post" id="RoleForm">
|
||||
<meta name="csrf-token" content="@Antiforgery.GetAndStoreTokens(HttpContext).RequestToken" />
|
||||
<input type="hidden" asp-for="RoleDTO.Id" />
|
||||
<div class="col-md-3">
|
||||
<label asp-for="RoleDTO.ParentId"></label>
|
||||
<select asp-for="RoleDTO.ParentId" class="form-control" asp-items="Model.Parents"></select>
|
||||
<span asp-validation-for="RoleDTO.ParentId" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label asp-for="RoleDTO.RoleName"></label>
|
||||
<input asp-for="RoleDTO.RoleName" class="form-control" />
|
||||
<span asp-validation-for="RoleDTO.RoleName" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<div class="mb-3">
|
||||
<label asp-for="RoleDTO.IsAdmin"></label>
|
||||
<input type="checkbox" asp-for="RoleDTO.IsAdmin" class="form-check-input" />
|
||||
<span asp-validation-for="RoleDTO.IsAdmin" class="text-danger"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="mb-3">
|
||||
<label asp-for="RoleDTO.CanDownloadAPK"></label>
|
||||
<input type="checkbox" asp-for="RoleDTO.CanDownloadAPK" class="form-check-input" />
|
||||
<span asp-validation-for="RoleDTO.CanDownloadAPK" class="text-danger"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="mb-3">
|
||||
<label asp-for="RoleDTO.CanEnableBlocked"></label>
|
||||
<input type="checkbox" asp-for="RoleDTO.CanEnableBlocked" class="form-check-input" />
|
||||
<span asp-validation-for="RoleDTO.CanEnableBlocked" class="text-danger"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-3 d-flex justify-content-between">
|
||||
<button type="button" id="saveRole" class="btn btn-primary">Mentés</button>
|
||||
<button type="button" class="btn btn-secondary" onclick="history.back()">Mégsem</button>
|
||||
@@ -34,47 +62,13 @@
|
||||
const csrfToken = document.querySelector('meta[name="csrf-token"]').getAttribute('content');
|
||||
var formData = getFormAsNestedObject('#RoleForm');
|
||||
const $form = $('#RoleForm');
|
||||
|
||||
|
||||
formData.RoleDTO.IsAdmin = $('#RoleForm input[name="RoleDTO.IsAdmin"]').is(':checked');
|
||||
formData.RoleDTO.CanDownloadAPK = $('#RoleForm input[name="RoleDTO.CanDownloadAPK"]').is(':checked');
|
||||
formData.RoleDTO.CanEnableBlocked = $('#RoleForm input[name="RoleDTO.CanEnableBlocked"]').is(':checked');
|
||||
|
||||
if ($form.valid())
|
||||
{
|
||||
$.ajax({
|
||||
url: $('#RoleEditPostUrl').val(),
|
||||
type: 'POST',
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': csrfToken,
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
data: JSON.stringify(formData.RoleDTO),
|
||||
success: function (response) {
|
||||
if (response.success)
|
||||
{
|
||||
showMessageModal({
|
||||
title: 'Figyelmem!',
|
||||
message: 'Sikeres mentés.',
|
||||
okText: 'Értettem'
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
showMessageModal({
|
||||
title: 'Figyelmem, HIBA!',
|
||||
message: 'Sikertelen mentés.',
|
||||
okText: 'Értettem'
|
||||
});
|
||||
}
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
// Hiba esetén
|
||||
console.error("Hiba: ", error);
|
||||
showMessageModal({
|
||||
title: 'Hiba!',
|
||||
message: 'A mentés NEM sikerült!',
|
||||
okText: 'Értettem'
|
||||
});
|
||||
}
|
||||
});
|
||||
saveEntity(csrfToken, formData.RoleDTO, $('#RoleEditPostUrl').val());
|
||||
} else
|
||||
{
|
||||
$form[0].reportValidity();
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||
using Serilog;
|
||||
using WorkFlowCheck.Common.DTO;
|
||||
using WorkFlowCheck.Web.Services;
|
||||
using WorkFlowCheck.Web.Services.Interfaces;
|
||||
|
||||
namespace WorkFlowCheck.Web.Pages.UserAndRole
|
||||
@@ -14,6 +16,9 @@ namespace WorkFlowCheck.Web.Pages.UserAndRole
|
||||
[BindProperty]
|
||||
public RoleDTO RoleDTO { get; set; }
|
||||
|
||||
[BindProperty]
|
||||
public List<SelectListItem> Parents { get; set; }
|
||||
|
||||
public RoleEditPageModel(ILogger<IndexModel> logger, IUserService userService)
|
||||
{
|
||||
_userService = userService;
|
||||
@@ -22,6 +27,7 @@ namespace WorkFlowCheck.Web.Pages.UserAndRole
|
||||
|
||||
public async Task OnGet(int id)
|
||||
{
|
||||
await InitSelectItems();
|
||||
RoleDTO = await _userService.GetRole(id);
|
||||
}
|
||||
public async Task<IActionResult> OnPostSave([FromBody] RoleDTO roleDTO)
|
||||
@@ -45,5 +51,15 @@ namespace WorkFlowCheck.Web.Pages.UserAndRole
|
||||
|
||||
return new JsonResult(new { success = false });
|
||||
}
|
||||
private async Task InitSelectItems()
|
||||
{
|
||||
var roles = await _userService.GetAllRoles();
|
||||
this.Parents = new List<SelectListItem>();
|
||||
Parents.Add(new SelectListItem() { Value = "-1", Text = "NINCS" });
|
||||
foreach (var role in roles)
|
||||
{
|
||||
Parents.Add(new SelectListItem() { Value = role.Id.ToString(), Text = role.RoleName });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,14 +18,22 @@
|
||||
<thead class="table-primary">
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>@DisplayNameHelper.GetDisplayName("RoleName", typeof(RoleDTO))</th>
|
||||
<th>@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.RoleName), typeof(RoleDTO))</th>
|
||||
<th>@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.ParentRoleName), typeof(RoleDTO))</th>
|
||||
<th>@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.IsAdmin), typeof(RoleDTO))</th>
|
||||
<th>@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.CanEnableBlocked), typeof(RoleDTO))</th>
|
||||
<th>@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.CanDownloadAPK), typeof(RoleDTO))</th>
|
||||
<th class="text-center">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot class="table-light">
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>@DisplayNameHelper.GetDisplayName("RoleName", typeof(RoleDTO))</th>
|
||||
<th>@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.RoleName), typeof(RoleDTO))</th>
|
||||
<th>@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.ParentRoleName), typeof(RoleDTO))</th>
|
||||
<th>@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.IsAdmin), typeof(RoleDTO))</th>
|
||||
<th>@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.CanEnableBlocked), typeof(RoleDTO))</th>
|
||||
<th>@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.CanDownloadAPK), typeof(RoleDTO))</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
@@ -43,6 +51,37 @@
|
||||
columns: [
|
||||
{ data: "id" },
|
||||
{ data: "roleName" },
|
||||
{ data: "parentRoleName" },
|
||||
{
|
||||
data: "isAdmin",
|
||||
searchable: false,
|
||||
sortable: false,
|
||||
className: "text-center",
|
||||
render: function ( data, type, row ) {
|
||||
return renderCheckBox(data);
|
||||
}
|
||||
|
||||
},
|
||||
{
|
||||
data: "canEnableBlocked",
|
||||
searchable: false,
|
||||
sortable: false,
|
||||
className: "text-center",
|
||||
render: function ( data, type, row ) {
|
||||
return renderCheckBox(data);
|
||||
}
|
||||
|
||||
},
|
||||
{
|
||||
data: "canDownloadAPK",
|
||||
searchable: false,
|
||||
sortable: false,
|
||||
className: "text-center",
|
||||
render: function ( data, type, row ) {
|
||||
return renderCheckBox(data);
|
||||
}
|
||||
|
||||
},
|
||||
{ data: null, render: function (data, type, row) {
|
||||
return renderActionButtons(row.id);
|
||||
}}
|
||||
@@ -53,7 +92,7 @@
|
||||
"visible": false
|
||||
},
|
||||
{
|
||||
"targets": 2,
|
||||
"targets": 6,
|
||||
"className": "text-center",
|
||||
"width": "10%"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user