Még nem tökéletes, EF javítása

This commit is contained in:
2025-03-03 16:56:11 +01:00
parent d4bad04103
commit 2ad8ba2d51
10 changed files with 857 additions and 73 deletions
@@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Mvc;
using Serilog;
using WorkFlowCheck.BL.Services;
using WorkFlowCheck.BL.Services.Interfaces;
using WorkFlowCheck.Common.DTO;
@@ -16,43 +17,19 @@ namespace WorkFlowCheck.API.Controllers
}
[HttpGet("GetCheckListHeader/{id}")]
public async Task<ApiResponseDTO<CheckListHeaderDTO>> GetCheckListHeader()
public async Task<ApiResponseDTO<CheckListHeaderDTO>> GetCheckListHeader(int id)
{
var retVal = new ApiResponseDTO<List<CheckPointDTO>>()
var retVal = new ApiResponseDTO<CheckListHeaderDTO>()
{
IsSuccess = true,
};
var checkPointListDTO = await _checkListService.GetAllCheckPointAsync();
var checkListHeaderDTO = await _checkListService.GetCheckListHeader(id );
if (checkPointListDTO != null)
if (checkListHeaderDTO != null)
{
retVal.IsSuccess = true;
retVal.Data = checkPointListDTO;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
[HttpGet("GetAllEquipments")]
public async Task<ApiResponseDTO<List<EquipmentDTO>>> GetAllEquipmentsAsync()
{
var retVal = new ApiResponseDTO<List<EquipmentDTO>>()
{
IsSuccess = true,
};
var equipmentListDTO = await _syncService.GetAllEquipmentAsync();
if (equipmentListDTO != null)
{
retVal.IsSuccess = true;
retVal.Data = equipmentListDTO;
retVal.Data = checkListHeaderDTO;
}
else
{
@@ -63,51 +40,23 @@ namespace WorkFlowCheck.API.Controllers
return retVal;
}
[HttpGet("GetAllLocations")]
public async Task<ApiResponseDTO<List<LocationDTO>>> GetAllLocationsAsync()
[HttpPost("StartNew")]
public async Task<ApiResponseDTO<CheckListHeaderDTO>> StartNew([FromBody] ApiRequestDTO<CheckListTemplateHeaderDTO> request)
{
var retVal = new ApiResponseDTO<List<LocationDTO>>()
var retVal = new ApiResponseDTO<CheckListHeaderDTO>()
{
IsSuccess = true,
IsSuccess = true
};
var locationListDTO = await _syncService.GetAllLocationAsync();
if (locationListDTO != null)
try
{
retVal.IsSuccess = true;
retVal.Data = locationListDTO;
var response = await _checkListService.StartNew(request);
}
else
catch (Exception ex)
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
Log.Error(ex.Message);
}
return retVal;
}
[HttpGet("GetAllCheckListTemplateHeader")]
public async Task<ApiResponseDTO<List<CheckListTemplateHeaderDTO>>> GetAllCheckListTemplateHeaderAsync()
{
var retVal = new ApiResponseDTO<List<CheckListTemplateHeaderDTO>>()
{
IsSuccess = true,
};
var response = await _syncService.GetAllCheckListTemplateAsync();
if (response != null)
{
retVal.IsSuccess = true;
retVal.Data = response;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
}
@@ -25,6 +25,8 @@ namespace WorkFlowCheck.BL.Mappings
CreateMap<CheckPoint, CheckPointDTO>();
CreateMap<Location, LocationDTO>();
CreateMap<Equipment, EquipmentDTO>();
CreateMap<CheckListHeader, CheckListHeaderDTO>()
.ForMember(dest => dest.CheckListRowDTO, opt => opt.MapFrom(src => src.CheckListRows));
}
}
}
@@ -1,12 +1,90 @@
using System;
using AutoMapper;
using Microsoft.EntityFrameworkCore;
using Serilog;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WorkFlowCheck.BL.Services.Interfaces;
using WorkFlowCheck.Common.DTO;
using WorkFlowCheck.DL;
using WorkFlowCheck.DL.Entities;
namespace WorkFlowCheck.BL.Services
{
class CheckListService
public class CheckListService : ICheckListService
{
private AppDbContext _dbContext;
private IMapper _mapper;
public CheckListService(AppDbContext dbContext, IMapper mapper)
{
_dbContext = dbContext;
_mapper = mapper;
}
public async Task<CheckListHeaderDTO> GetCheckListHeader(int Id)
{
var retVal = new CheckListHeaderDTO()
{
CheckListRowDTO = new List<CheckListRowDTO>()
};
try
{
var res = await _dbContext.CheckListHeaders
.Where(w => w.Id == Id)
.Include(i => i.CheckListRows)
.AsNoTracking()
.FirstOrDefaultAsync();
if (res != null)
{
retVal = _mapper.Map<CheckListHeaderDTO>(res);
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
public async Task<CheckListHeaderDTO> StartNew(ApiRequestDTO<CheckListTemplateHeaderDTO> request)
{
var retVal = new CheckListHeaderDTO()
{
CheckListRowDTO = new List<CheckListRowDTO>()
};
try
{
var currentDate = DateTime.UtcNow;
CheckListHeader checkListHeader = new CheckListHeader()
{
CheckListTemplateHeaderId = request.Data.Id,
CreatedAt = currentDate,
CreatedBy = request.UserDTO.UserName,
Description = request.Data.Description,
DocumentNumber = "",
GuidNumber = Guid.NewGuid(),
IsDeleted = false,
IsStorno = false,
LastModAt = currentDate,
ShortName = "",
CheckListRows = new List<CheckListRow>()
};
_dbContext.CheckListHeaders.Add(checkListHeader);
await _dbContext.SaveChangesAsync();
retVal = _mapper.Map<CheckListHeaderDTO>(checkListHeader);
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
}
}
@@ -10,5 +10,6 @@ namespace WorkFlowCheck.BL.Services.Interfaces
public interface ICheckListService
{
Task<CheckListHeaderDTO> GetCheckListHeader(int Id);
Task<CheckListHeaderDTO> StartNew(ApiRequestDTO<CheckListTemplateHeaderDTO> request);
}
}
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.Common.DTO
{
public class ApiRequestDTO<T>
{
public UserDTO UserDTO { get; set; }
public T Data { get; set; }
}
}
@@ -14,5 +14,10 @@ namespace WorkFlowCheck.Common.DTO
public string DocumentNumber { get; set; } = null!;
public Guid GuidNumber { get; set; }
public required ICollection<CheckListRowDTO> CheckListRowDTO { get; set; } = new List<CheckListRowDTO>();
public CheckListHeaderDTO()
{
CheckListRowDTO = new List<CheckListRowDTO>();
}
}
}
@@ -10,6 +10,8 @@ namespace WorkFlowCheck.DL.Entities
public class CheckListHeader : IAuditableEntity, ISoftDeletableEntity
{
public int Id { get; set; }
public int CheckListTemplateHeaderId { get; set; }
public virtual CheckListTemplateHeader CheckListTemplateHeader { get; set; }
public string ShortName { get; set; } = null!;
public string Description { get; set; } = null!;
public string DocumentNumber { get; set; } = null!;
@@ -0,0 +1,605 @@
// <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("20250303154744_Extend003")]
partial class Extend003
{
/// <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<DateTime>("CreatedAt")
.HasColumnType("datetime2");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("nvarchar(max)");
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>("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.HasKey("Id");
b.HasIndex("CheckListTemplateHeaderId");
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<byte[]>("Photo")
.IsRequired()
.HasColumnType("varbinary(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<string>("ShortName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
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<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.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.Role", 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<bool>("IsDeleted")
.HasColumnType("bit");
b.Property<DateTime>("LastModAt")
.HasColumnType("datetime2");
b.Property<string>("LastModBy")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("RoleName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
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.User", 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>("Email")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("FirstName")
.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>("LastName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("PasswordHash")
.HasColumnType("nvarchar(max)");
b.Property<string>("UserName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Users", (string)null);
b.HasData(
new
{
Id = 1,
CreatedAt = new DateTime(2025, 3, 3, 15, 47, 43, 353, DateTimeKind.Utc).AddTicks(3654),
CreatedBy = "System",
Email = "admin@nuvolar.hu",
FirstName = "Administrator",
IsDeleted = false,
LastModAt = new DateTime(2025, 3, 3, 15, 47, 43, 353, DateTimeKind.Utc).AddTicks(3659),
LastModBy = "System",
LastName = "System",
PasswordHash = "eGM0NUREZnJ0ISFFRDIxMKE5TYwthDBuUsTUEO1fBnCR3VdSCmdz47ue0RoVvnkY",
UserName = "admin"
},
new
{
Id = 2,
CreatedAt = new DateTime(2025, 3, 3, 15, 47, 43, 364, DateTimeKind.Utc).AddTicks(9120),
CreatedBy = "System",
Email = "user@nuvolar.hu",
FirstName = "User",
IsDeleted = false,
LastModAt = new DateTime(2025, 3, 3, 15, 47, 43, 364, DateTimeKind.Utc).AddTicks(9122),
LastModBy = "System",
LastName = "System",
PasswordHash = "eGM0NUREZnJ0ISFFRDIxMPwM2D9sQSj7zmaSBIsOGe0I9hBFwCGPVbyrYMA5EnKG",
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.Navigation("CheckListTemplateHeader");
});
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.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()
.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.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.UserRole", b =>
{
b.HasOne("WorkFlowCheck.DL.Entities.Role", "Role")
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("WorkFlowCheck.DL.Entities.User", "User")
.WithMany()
.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");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,101 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace WorkFlowCheck.DL.Migrations
{
/// <inheritdoc />
public partial class Extend003 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "GuidNumber",
table: "CheckListRow",
type: "uniqueidentifier",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
migrationBuilder.AddColumn<int>(
name: "CheckListTemplateHeaderId",
table: "CheckListHeader",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<Guid>(
name: "GuidNumber",
table: "CheckListHeader",
type: "uniqueidentifier",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
migrationBuilder.UpdateData(
table: "Users",
keyColumn: "Id",
keyValue: 1,
columns: new[] { "CreatedAt", "LastModAt" },
values: new object[] { new DateTime(2025, 3, 3, 15, 47, 43, 353, DateTimeKind.Utc).AddTicks(3654), new DateTime(2025, 3, 3, 15, 47, 43, 353, DateTimeKind.Utc).AddTicks(3659) });
migrationBuilder.UpdateData(
table: "Users",
keyColumn: "Id",
keyValue: 2,
columns: new[] { "CreatedAt", "LastModAt" },
values: new object[] { new DateTime(2025, 3, 3, 15, 47, 43, 364, DateTimeKind.Utc).AddTicks(9120), new DateTime(2025, 3, 3, 15, 47, 43, 364, DateTimeKind.Utc).AddTicks(9122) });
migrationBuilder.CreateIndex(
name: "IX_CheckListHeader_CheckListTemplateHeaderId",
table: "CheckListHeader",
column: "CheckListTemplateHeaderId");
migrationBuilder.AddForeignKey(
name: "FK_CheckListHeader_CheckListTemplateHeader_CheckListTemplateHeaderId",
table: "CheckListHeader",
column: "CheckListTemplateHeaderId",
principalTable: "CheckListTemplateHeader",
principalColumn: "Id",
onDelete: ReferentialAction.NoAction);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_CheckListHeader_CheckListTemplateHeader_CheckListTemplateHeaderId",
table: "CheckListHeader");
migrationBuilder.DropIndex(
name: "IX_CheckListHeader_CheckListTemplateHeaderId",
table: "CheckListHeader");
migrationBuilder.DropColumn(
name: "GuidNumber",
table: "CheckListRow");
migrationBuilder.DropColumn(
name: "CheckListTemplateHeaderId",
table: "CheckListHeader");
migrationBuilder.DropColumn(
name: "GuidNumber",
table: "CheckListHeader");
migrationBuilder.UpdateData(
table: "Users",
keyColumn: "Id",
keyValue: 1,
columns: new[] { "CreatedAt", "LastModAt" },
values: new object[] { new DateTime(2025, 2, 19, 12, 52, 0, 186, DateTimeKind.Utc).AddTicks(2300), new DateTime(2025, 2, 19, 12, 52, 0, 186, DateTimeKind.Utc).AddTicks(2303) });
migrationBuilder.UpdateData(
table: "Users",
keyColumn: "Id",
keyValue: 2,
columns: new[] { "CreatedAt", "LastModAt" },
values: new object[] { new DateTime(2025, 2, 19, 12, 52, 0, 197, DateTimeKind.Utc).AddTicks(6358), new DateTime(2025, 2, 19, 12, 52, 0, 197, DateTimeKind.Utc).AddTicks(6360) });
}
}
}
@@ -30,6 +30,9 @@ namespace WorkFlowCheck.DL.Migrations
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("CheckListTemplateHeaderId")
.HasColumnType("int");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime2");
@@ -45,6 +48,9 @@ namespace WorkFlowCheck.DL.Migrations
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<Guid>("GuidNumber")
.HasColumnType("uniqueidentifier");
b.Property<bool>("IsDeleted")
.HasColumnType("bit");
@@ -64,6 +70,8 @@ namespace WorkFlowCheck.DL.Migrations
b.HasKey("Id");
b.HasIndex("CheckListTemplateHeaderId");
b.ToTable("CheckListHeader", (string)null);
});
@@ -92,6 +100,9 @@ namespace WorkFlowCheck.DL.Migrations
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<Guid>("GuidNumber")
.HasColumnType("uniqueidentifier");
b.Property<bool>("IsDeleted")
.HasColumnType("bit");
@@ -431,12 +442,12 @@ namespace WorkFlowCheck.DL.Migrations
new
{
Id = 1,
CreatedAt = new DateTime(2025, 2, 19, 12, 52, 0, 186, DateTimeKind.Utc).AddTicks(2300),
CreatedAt = new DateTime(2025, 3, 3, 15, 47, 43, 353, DateTimeKind.Utc).AddTicks(3654),
CreatedBy = "System",
Email = "admin@nuvolar.hu",
FirstName = "Administrator",
IsDeleted = false,
LastModAt = new DateTime(2025, 2, 19, 12, 52, 0, 186, DateTimeKind.Utc).AddTicks(2303),
LastModAt = new DateTime(2025, 3, 3, 15, 47, 43, 353, DateTimeKind.Utc).AddTicks(3659),
LastModBy = "System",
LastName = "System",
PasswordHash = "eGM0NUREZnJ0ISFFRDIxMKE5TYwthDBuUsTUEO1fBnCR3VdSCmdz47ue0RoVvnkY",
@@ -445,12 +456,12 @@ namespace WorkFlowCheck.DL.Migrations
new
{
Id = 2,
CreatedAt = new DateTime(2025, 2, 19, 12, 52, 0, 197, DateTimeKind.Utc).AddTicks(6358),
CreatedAt = new DateTime(2025, 3, 3, 15, 47, 43, 364, DateTimeKind.Utc).AddTicks(9120),
CreatedBy = "System",
Email = "user@nuvolar.hu",
FirstName = "User",
IsDeleted = false,
LastModAt = new DateTime(2025, 2, 19, 12, 52, 0, 197, DateTimeKind.Utc).AddTicks(6360),
LastModAt = new DateTime(2025, 3, 3, 15, 47, 43, 364, DateTimeKind.Utc).AddTicks(9122),
LastModBy = "System",
LastName = "System",
PasswordHash = "eGM0NUREZnJ0ISFFRDIxMPwM2D9sQSj7zmaSBIsOGe0I9hBFwCGPVbyrYMA5EnKG",
@@ -481,6 +492,17 @@ namespace WorkFlowCheck.DL.Migrations
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.Navigation("CheckListTemplateHeader");
});
modelBuilder.Entity("WorkFlowCheck.DL.Entities.CheckListRow", b =>
{
b.HasOne("WorkFlowCheck.DL.Entities.CheckListHeader", "CheckListHeader")
@@ -503,7 +525,7 @@ namespace WorkFlowCheck.DL.Migrations
modelBuilder.Entity("WorkFlowCheck.DL.Entities.CheckListTemplateRow", b =>
{
b.HasOne("WorkFlowCheck.DL.Entities.CheckListTemplateHeader", "CheckListTemplateHeader")
.WithMany()
.WithMany("CheckListTemplateRows")
.HasForeignKey("CheckListTemplateHeaderId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
@@ -569,6 +591,11 @@ namespace WorkFlowCheck.DL.Migrations
{
b.Navigation("CheckListRows");
});
modelBuilder.Entity("WorkFlowCheck.DL.Entities.CheckListTemplateHeader", b =>
{
b.Navigation("CheckListTemplateRows");
});
#pragma warning restore 612, 618
}
}