109 Commits
Author SHA1 Message Date
ivanszabo b69f9af6f3 NFC csak Androidra javítás ... 2025-03-28 15:37:14 +01:00
ivanszabo 2341b186ef BEMUTATÓRA kész. 2025-03-24 23:26:25 +01:00
ivanszabo ab1de236be Na most jó a beküldéshez a Binding 2025-03-24 20:40:38 +01:00
ivanszabo 3d44804bad Most működik a fénykép 2025-03-24 18:25:12 +01:00
ivanszabo 8f38408646 UI fejlesztése 2025-03-24 16:47:28 +01:00
ivanszabo 29d94c9256 Merge branch 'master' of https://tfs.nuvolar.hu:8443/tfs/AtomERP/_git/WorkFlowCheck 2025-03-24 14:02:29 +01:00
ivanszabo ebe33abf69 Login, NFCWaiter 2025-03-24 14:02:25 +01:00
ivanszabo 50a7eb5521 Egyéb javítások 2025-03-24 14:01:58 +01:00
ivanszabo d55dee91e9 Controller javítása userId-vel 2025-03-22 14:19:00 +01:00
ivanszabo 3a4db4dd14 Van új és folytatható CheckLista 2025-03-22 14:18:25 +01:00
ivanszabo 6d78762275 CheckListHeader lista javítva 2025-03-22 11:19:18 +01:00
ivanszabo 15e6aac88c MAUI belépés OK 2025-03-21 17:28:46 +01:00
ivanszabo 2a5ad1d1c1 CheckListHeader már indul 2025-03-21 17:28:11 +01:00
ivanszabo 3b7fd07dda Elég sok minden... 2025-03-21 16:18:35 +01:00
ivanszabo efecf55dd8 Middleware javítás 2025-03-21 09:57:07 +01:00
ivanszabo 6dcc4989ac Equipment sync javítása 2025-03-20 13:44:24 +01:00
ivanszabo b48b8dbb6c Location is. 2025-03-20 13:20:00 +01:00
ivanszabo ae7ba2342e Equipment is kész. 2025-03-20 13:12:05 +01:00
ivanszabo bd60138a89 Módosítások fejlesztéshez 2025-03-20 09:00:01 +01:00
ivanszabo 7a158ed10d További finomítások 2025-03-19 18:22:45 +01:00
ivanszabo 2e335e7b8a CheckListServices továbbfejlesztése 2025-03-19 18:16:34 +01:00
ivanszabo 63b9beef35 Elég sok minden ... 2025-03-19 14:38:04 +01:00
ivanszabo f74922d01e HU a datatables-hez 2025-03-19 09:59:42 +01:00
ivanszabo 2fd147bb36 UserRole is benn van, de még nem tökéletes. 2025-03-18 13:56:35 +01:00
ivanszabo 9297ff3970 Bootstrap Icon hozzáadása 2025-03-18 13:12:17 +01:00
ivanszabo 8c1966ef4c Role lista hozzáadása 2025-03-18 12:12:12 +01:00
ivanszabo 5097757cfb Web BaseStockService extend 2025-03-18 08:36:55 +01:00
ivanszabo f83765378c User ... DTO extend 2025-03-18 08:36:44 +01:00
ivanszabo b8fcdd5c3d Na most egy validator is beköszönt 2025-03-17 15:01:50 +01:00
ivanszabo 8c1e60889d User továbbgondolása 2025-03-17 12:10:41 +01:00
ivanszabo 0e06382eee Egyéb 2025-03-16 20:31:49 +01:00
ivanszabo 9d113d0b49 IUserService fejlesztése 2025-03-16 20:25:04 +01:00
ivanszabo 8793a1c77c User dolgok javítása 2025-03-15 14:27:08 +01:00
ivanszabo 2d13b0909e Menü kialakítása 2025-03-15 14:18:25 +01:00
ivanszabo 9f1c3df5d6 Equipment, Lokáció de még csak a lista 2025-03-15 14:05:05 +01:00
ivanszabo a72c9b342e MAUI-ba is jól bele lett rakva a Bearer token, ha van. 2025-03-14 12:19:16 +01:00
ivanszabo 50b14e8122 Kis reszelés és jó is lett. 2025-03-14 11:36:42 +01:00
ivanszabo 7f01ca243a Merge branch 'master' of https://tfs.nuvolar.hu:8443/tfs/AtomERP/_git/WorkFlowCheck 2025-03-14 11:34:18 +01:00
ivanszabo 07f617df87 messageModal,confirmModal stb beállítva és működik is. 2025-03-14 11:34:10 +01:00
ivanszabo 52ac278316 JwtMiddleware berakva 2025-03-14 10:25:24 +01:00
ivanszabo 9d0a577c1f Mentés + JwtMiddleware-ből a dolgok berakva 2025-03-14 10:25:08 +01:00
ivanszabo ca789cfbc3 Merge branch 'master' of https://tfs.nuvolar.hu:8443/tfs/AtomERP/_git/WorkFlowCheck 2025-03-14 08:31:55 +01:00
ivanszabo 323af1e600 LogoutModal javítása 2025-03-14 07:55:14 +01:00
ivanszabo e0bca55fc2 Update már Add is ... 2025-03-13 14:41:07 +01:00
ivanszabo d2106514ba POST hogy tudjunk menteni is. 2025-03-13 14:23:19 +01:00
ivanszabo a301a2a168 Na most elvileg jó a saját form postdata cucc 2025-03-13 13:53:16 +01:00
ivanszabo f5a6041a1c Most már ki is tudok jelentkezni 2025-03-12 15:19:03 +01:00
ivanszabo 3091faa94c Most működik alapból 2025-03-12 15:00:37 +01:00
ivanszabo 7c1d89d783 Fontos javítás a bejelentkezéshez 2025-03-12 11:59:03 +01:00
ivanszabo 439d8cafd5 Login fejlesztése 2025-03-12 11:57:16 +01:00
ivanszabo c9ffad0d91 Van normális bejelenkezési ablak 2025-03-12 10:38:30 +01:00
ivanszabo 29e6efc9e0 JwtToken 1.0 2025-03-12 09:48:57 +01:00
ivanszabo da27f7e882 Middleware 1.0 2025-03-11 20:23:14 +01:00
ivanszabo 3071ac7080 API módosítása 2025-03-11 17:01:26 +01:00
ivanszabo 8f9e5df847 WEB most jól működik Datatables-sel. 2025-03-11 16:54:50 +01:00
ivanszabo e5b1649c42 Datatables add 2025-03-11 08:38:14 +01:00
ivanszabo 48b5fb5090 Merge branch 'master' of https://tfs.nuvolar.hu:8443/tfs/AtomERP/_git/WorkFlowCheck 2025-03-11 08:08:35 +01:00
ivanszabo ff33a59e5c Web added to MOBILE 2025-03-11 08:08:29 +01:00
ivanszabo 399ff8f88f lib added to source 2025-03-11 08:07:48 +01:00
ivanszabo cb6e627fea Érték megadása is lehetséges 2025-03-10 15:38:05 +01:00
ivanszabo 3be8a597d0 BUGFIX WhiteSmoke 2025-03-10 15:05:58 +01:00
ivanszabo 1ee1e8fa32 Érték megadása is ! 2025-03-10 15:05:26 +01:00
ivanszabo 762eb19af2 TemplateSelector végre jó! 2025-03-10 13:55:07 +01:00
ivanszabo 943e2a716d Lejönnek a CheckPointhoz tartozó sorok 2025-03-10 09:32:39 +01:00
ivanszabo af607f6079 CheckPoint -y CheckListTemplateRow 2025-03-04 13:26:22 +01:00
ivanszabo 62dee24619 Na most kezd valami kinézni 2025-03-03 19:26:25 +01:00
ivanszabo 1e9fdf7ea5 Még csak lépések vannak ... 2025-03-03 17:03:41 +01:00
ivanszabo 2ad8ba2d51 Még nem tökéletes, EF javítása 2025-03-03 16:56:11 +01:00
ivanszabo d4bad04103 Ez is itt félig kész ... 2025-03-03 13:24:57 +01:00
ivanszabo 499daa0e17 Ez most félig kész ... 2025-03-03 13:24:23 +01:00
ivanszabo dca4f3ba73 MainPage elrendezés beállítva I. 2025-03-03 10:43:25 +01:00
Iván Szabó c7784e7fef Sync-kibővítése 2025-02-27 15:46:07 +01:00
ivanszabo 883ae6b845 ISyncService bővítése 2025-02-27 12:47:58 +01:00
ivanszabo 5512120306 NFC a CheckPoints-hoz 2025-02-27 07:53:26 +01:00
ivanszabo 1ac31d7d76 .NET 8 LTS-ben MediaPicker-rel kép készítése 2025-02-25 16:07:11 +01:00
Iván Szabó 5396fc0dcb Kamera használatához alapok 2025-02-24 13:39:05 +01:00
Iván Szabó f3ef12ccc4 DevExpress test 2025-02-20 10:55:30 +01:00
ivanszabo bf97db26e5 DevExpress MAUI hozzáadása 2025-02-19 18:05:53 +01:00
ivanszabo 5aae8fd067 SyncCheckListTemplates implementálása 2025-02-19 16:23:34 +01:00
ivanszabo 790f92a940 API és endpoint kiegészítése 2025-02-19 15:49:53 +01:00
ivanszabo 2ae985c6e0 DTO javítás 2025-02-19 14:17:52 +01:00
ivanszabo 2f0b9e1452 Kis adatbázis és miegymás 2025-02-19 14:12:39 +01:00
ivanszabo 872e7b3a4f NFC teszt és egyebek javítása, fejlesztése 2025-02-14 16:15:33 +01:00
ivanszabo f400bbf3c8 Ezt még ki kell reszelni rendesen 2025-02-12 23:01:38 +01:00
ivanszabo f57fef804d Alap funkció működés CheckPoints 2025-02-12 20:00:49 +01:00
Iván Szabó ac80a8a9bb Mapper NETMAUI-ba 2025-02-06 16:06:09 +01:00
Iván Szabó b233347a7d SyncService + SyncPage added 2025-02-06 14:46:31 +01:00
ivanszabo b5e5158f1e SyncController API 2025-02-06 14:02:18 +01:00
ivanszabo 7570908177 Entities + Migration 2025-02-05 13:48:19 +01:00
ivanszabo 4570c071a7 SQLLite vol 1. 2025-02-05 13:47:11 +01:00
ivanszabo aaa5862c80 Entities + Configuration base 2025-02-03 16:05:18 +01:00
ivanszabo 8d5bdc2c37 For merge to DEVTEST 2025-02-03 15:28:27 +01:00
ivanszabo 01f16c616a WorkFlowCheck.Web hozzáadása 2025-02-03 15:20:40 +01:00
ivanszabo 9175f1ec76 Merge branch 'master' of https://tfs.nuvolar.hu:8443/tfs/AtomERP/_git/WorkFlowCheck 2025-01-29 16:58:09 +01:00
ivanszabo d5cbeea8f4 API oldaláról sokminden 2025-01-29 16:56:10 +01:00
ivanszabo ad14623749 NFC barmolás 2025-01-28 14:39:52 +01:00
ivanszabo 3669267898 Némi API hozzáadás 2025-01-28 14:38:28 +01:00
ivanszabo e74df61ca0 NFC Test vol 1. 2025-01-24 14:37:21 +01:00
ivanszabo 0d44cd48fb Sikeres POST az eszközről 2025-01-24 11:15:17 +01:00
ivanszabo 862f0a148b POST-os hívás tesztje az authentikációhoz 2025-01-21 16:21:48 +01:00
ivanszabo 177aa668a6 Authenticate is jó a passwordhas-sel 2025-01-21 16:20:55 +01:00
ivanszabo 30d82fc9bf Egy kis authentikáció 2025-01-21 15:52:30 +01:00
ivanszabo 3b11c6adc5 Mobilról működik a hívás https-en :) 2025-01-21 12:50:36 +01:00
ivanszabo 6a46975cfd Na most működig SWAGGER és 5000 porton publishban is ! 2025-01-15 17:26:09 +01:00
ivanszabo a2906cc113 Na most működik az API + adatbázis 2025-01-15 14:01:58 +01:00
Iván Szabó 474dce1aa7 certifikációhoz 2025-01-06 16:39:22 +01:00
Iván Szabó 92801fefb9 Na, majd otthon ... 2025-01-06 12:49:34 +01:00
ivanszabo a80870b5c3 Some other func 2025-01-06 08:58:17 +01:00
ivanszabo 8bbcbfab09 INIT vol 1. 2024-12-17 19:23:15 +01:00
293 changed files with 95687 additions and 91 deletions
+5
View File
@@ -0,0 +1,5 @@
echo off
echo "dotnet ef migrations add InitialCreate --project WorkFlowCheck.DL --startup-project WorkFlowCheck.API"
echo "dotnet ef database update --project WorkFlowCheck.DL --startup-project WorkFlowCheck.API"
echo "dotnet ef migrations remove --project WorkFlowCheck.DL --startup-project WorkFlowCheck.API"
pause
+2 -1
View File
@@ -2,7 +2,8 @@
<PropertyGroup>
<!--Work around so the conditions work below-->
<TargetFrameworks>netstandard1.0;netstandard2.0;Xamarin.iOS10;MonoAndroid10.0;net8.0;net8.0-android;net8.0-ios</TargetFrameworks>
<!--<TargetFrameworks>netstandard1.0;netstandard2.0;Xamarin.iOS10;MonoAndroid10.0;net8.0;net8.0-android;net8.0-ios</TargetFrameworks>-->
<TargetFrameworks>net8.0;net8.0-android;net8.0-ios</TargetFrameworks>
<AssemblyName>Plugin.NFC</AssemblyName>
<RootNamespace>Plugin.NFC</RootNamespace>
+46
View File
@@ -0,0 +1,46 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.12.35527.113
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WorkFlowCheck.API", "WorkFlowCheck.API\WorkFlowCheck.API.csproj", "{2466E04A-CB0C-4421-9074-A928F819926C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WorkFlowCheck.DL", "WorkFlowCheck.DL\WorkFlowCheck.DL.csproj", "{25A8C0E7-18C7-4672-ABE8-29596E7E9B72}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WorkFlowCheck.BL", "WorkFlowCheck.BL\WorkFlowCheck.BL.csproj", "{73049F81-7A5D-4819-ADB8-A9926672365E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WorkFlowCheck.Common", "WorkFlowCheck.Common\WorkFlowCheck.Common.csproj", "{7F94D6CB-3358-4687-88E1-FA46053D6B71}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WorkFlowCheck.Web", "WorkFlowCheck.Web\WorkFlowCheck.Web.csproj", "{B4D9960A-9BCF-41DA-9103-5DABA8D2623F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2466E04A-CB0C-4421-9074-A928F819926C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2466E04A-CB0C-4421-9074-A928F819926C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2466E04A-CB0C-4421-9074-A928F819926C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2466E04A-CB0C-4421-9074-A928F819926C}.Release|Any CPU.Build.0 = Release|Any CPU
{25A8C0E7-18C7-4672-ABE8-29596E7E9B72}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{25A8C0E7-18C7-4672-ABE8-29596E7E9B72}.Debug|Any CPU.Build.0 = Debug|Any CPU
{25A8C0E7-18C7-4672-ABE8-29596E7E9B72}.Release|Any CPU.ActiveCfg = Release|Any CPU
{25A8C0E7-18C7-4672-ABE8-29596E7E9B72}.Release|Any CPU.Build.0 = Release|Any CPU
{73049F81-7A5D-4819-ADB8-A9926672365E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{73049F81-7A5D-4819-ADB8-A9926672365E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{73049F81-7A5D-4819-ADB8-A9926672365E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{73049F81-7A5D-4819-ADB8-A9926672365E}.Release|Any CPU.Build.0 = Release|Any CPU
{7F94D6CB-3358-4687-88E1-FA46053D6B71}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7F94D6CB-3358-4687-88E1-FA46053D6B71}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7F94D6CB-3358-4687-88E1-FA46053D6B71}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7F94D6CB-3358-4687-88E1-FA46053D6B71}.Release|Any CPU.Build.0 = Release|Any CPU
{B4D9960A-9BCF-41DA-9103-5DABA8D2623F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B4D9960A-9BCF-41DA-9103-5DABA8D2623F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B4D9960A-9BCF-41DA-9103-5DABA8D2623F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B4D9960A-9BCF-41DA-9103-5DABA8D2623F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
@@ -0,0 +1,13 @@
{
"version": 1,
"isRoot": true,
"tools": {
"dotnet-ef": {
"version": "9.0.0",
"commands": [
"dotnet-ef"
],
"rollForward": false
}
}
}
@@ -0,0 +1,225 @@
using Microsoft.AspNetCore.Mvc;
using Serilog;
using WorkFlowCheck.BL.Services;
using WorkFlowCheck.BL.Services.Interfaces;
using WorkFlowCheck.Common.DTO;
namespace WorkFlowCheck.API.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class CheckListController : ControllerBase
{
private ICheckListService _checkListService;
public CheckListController(ICheckListService checkListService)
{
_checkListService = checkListService;
}
[HttpGet("GetCheckListHeader/{id}")]
public async Task<ApiResponseDTO<CheckListHeaderDTO>> GetCheckListHeader(int id)
{
var retVal = new ApiResponseDTO<CheckListHeaderDTO>()
{
IsSuccess = true,
};
var checkListHeaderDTO = await _checkListService.GetCheckListHeaderAsync(id);
if (checkListHeaderDTO != null)
{
retVal.IsSuccess = true;
retVal.Data = checkListHeaderDTO;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
[HttpGet("GetAllCheckListHeaders")]
public async Task<ApiResponseDTO<List<CheckListHeaderDTO>>> GetAllCheckListHeadersAsync()
{
var retVal = new ApiResponseDTO<List<CheckListHeaderDTO>>()
{
IsSuccess = true,
};
var checkPointListDTO = await _checkListService.GetAllCheckListHeaderAsync();
if (checkPointListDTO != null)
{
retVal.IsSuccess = true;
retVal.Data = checkPointListDTO;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
[HttpPost("UpdateCheckListHeader")]
public async Task<ApiResponseDTO<CheckListHeaderDTO>> UpdateCheckListHeader([FromBody] CheckListHeaderDTO checkListHeaderDTO)
{
var retVal = new ApiResponseDTO<CheckListHeaderDTO>()
{
IsSuccess = true
};
try
{
var result = await _checkListService.UpdateCheckListHeaderAsync(checkListHeaderDTO);
retVal.Data = result;
}
catch (Exception ex)
{
retVal.IsSuccess = false;
Log.Error(ex.Message);
}
return retVal;
}
[HttpPost("StartNewCheckList")]
public async Task<ApiResponseDTO<CheckListHeaderDTO>> StartNew([FromBody] CheckListHeaderNewDTO checkListHeaderNewDTO)
{
var retVal = new ApiResponseDTO<CheckListHeaderDTO>()
{
IsSuccess = true
};
try
{
var response = await _checkListService.StartNewCheckListAsync(checkListHeaderNewDTO);
if (response != null)
{
retVal.Data = response;
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
[HttpGet("GetCheckListTemplateHeader/{id}")]
public async Task<ApiResponseDTO<CheckListTemplateHeaderDTO>> GetCheckListTemplateHeader(int id)
{
var retVal = new ApiResponseDTO<CheckListTemplateHeaderDTO>()
{
IsSuccess = true,
};
var CheckListTemplateHeaderDTO = await _checkListService.GetCheckListTemplateHeaderAsync(id);
if (CheckListTemplateHeaderDTO != null)
{
retVal.IsSuccess = true;
retVal.Data = CheckListTemplateHeaderDTO;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
[HttpGet("GetAllCheckListTemplateHeaders")]
public async Task<ApiResponseDTO<List<CheckListTemplateHeaderDTO>>> GetAllCheckListTemplateHeadersAsync()
{
var retVal = new ApiResponseDTO<List<CheckListTemplateHeaderDTO>>()
{
IsSuccess = true,
};
var checkPointListDTO = await _checkListService.GetAllCheckListTemplateHeaderAsync();
if (checkPointListDTO != null)
{
retVal.IsSuccess = true;
retVal.Data = checkPointListDTO;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
[HttpPost("UpdateCheckListTemplateHeader")]
public async Task<ApiResponseDTO<CheckListTemplateHeaderDTO>> UpdateCheckListTemplateHeader([FromBody] CheckListTemplateHeaderDTO CheckListTemplateHeaderDTO)
{
var retVal = new ApiResponseDTO<CheckListTemplateHeaderDTO>()
{
IsSuccess = true
};
try
{
var result = await _checkListService.UpdateCheckListTemplateHeaderAsync(CheckListTemplateHeaderDTO);
retVal.Data = result;
}
catch (Exception ex)
{
retVal.IsSuccess = false;
Log.Error(ex.Message);
}
return retVal;
}
[HttpGet("GetCheckListTemplateRow/{id}")]
public async Task<ApiResponseDTO<CheckListTemplateRowDTO>> GetCheckListTemplateRow(int id)
{
var retVal = new ApiResponseDTO<CheckListTemplateRowDTO>()
{
IsSuccess = true,
};
var checkListTemplateRowDTO = await _checkListService.GetCheckListTemplateRowAsync(id);
if (checkListTemplateRowDTO != null)
{
retVal.IsSuccess = true;
retVal.Data = checkListTemplateRowDTO;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
[HttpPost("UpdateCheckListTemplateRow")]
public async Task<ApiResponseDTO<CheckListTemplateRowDTO>> UpdateCheckListTemplateRow([FromBody] CheckListTemplateRowDTO CheckListTemplateRowDTO)
{
var retVal = new ApiResponseDTO<CheckListTemplateRowDTO>()
{
IsSuccess = true
};
try
{
var result = await _checkListService.UpdateCheckListTemplateRowAsync(CheckListTemplateRowDTO);
retVal.Data = result;
}
catch (Exception ex)
{
retVal.IsSuccess = false;
Log.Error(ex.Message);
}
return retVal;
}
}
}
@@ -0,0 +1,302 @@
using Microsoft.AspNetCore.Mvc;
using Serilog;
using WorkFlowCheck.BL.Services;
using WorkFlowCheck.BL.Services.Interfaces;
using WorkFlowCheck.Common.DTO;
using WorkFlowCheck.DL.Entities;
namespace WorkFlowCheck.API.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class SyncController : ControllerBase
{
private ISyncService _syncService;
public SyncController(ISyncService syncService)
{
_syncService = syncService;
}
[HttpGet("GetCheckPoint/{id}")]
public async Task<ApiResponseDTO<CheckPointDTO>> GetCheckpointAsync(int id)
{
var retVal = new ApiResponseDTO<CheckPointDTO>()
{
IsSuccess = true,
};
var checkPointListDTO = await _syncService.GetCheckPointAsync(id);
if (checkPointListDTO != null)
{
retVal.IsSuccess = true;
retVal.Data = checkPointListDTO;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
[HttpGet("GetAllCheckPoints")]
public async Task<ApiResponseDTO<List<CheckPointDTO>>> GetAllCheckpointsAsync()
{
var retVal = new ApiResponseDTO<List<CheckPointDTO>>()
{
IsSuccess = true,
};
var checkPointListDTO = await _syncService.GetAllCheckPointAsync();
if (checkPointListDTO != null)
{
retVal.IsSuccess = true;
retVal.Data = checkPointListDTO;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
[HttpPost("UpdateCheckPoint")]
public async Task<ApiResponseDTO<CheckPointDTO>> UpdateCheckPoint([FromBody] CheckPointDTO checkPointDTO)
{
var retVal = new ApiResponseDTO<CheckPointDTO>()
{
IsSuccess = true
};
try
{
var result = await _syncService.UpdateCheckPointAsync(checkPointDTO);
retVal.Data = result;
}
catch (Exception ex)
{
retVal.IsSuccess = false;
Log.Error(ex.Message);
}
return retVal;
}
[HttpPost("UpdateAllCheckPoint")]
public async Task<ApiResponseDTO<List<CheckPointDTO>>> UpdateAllCheckPoint([FromBody] List<CheckPointDTO> checkPointListDTO)
{
var retVal = new ApiResponseDTO<List<CheckPointDTO>>()
{
IsSuccess = true
};
try
{
var result = await _syncService.UpdateAllCheckPointAsync(checkPointListDTO);
retVal.Data = result;
}
catch (Exception ex)
{
retVal.IsSuccess = false;
Log.Error(ex.Message);
}
return retVal;
}
[HttpGet("GetEquipment/{id}")]
public async Task<ApiResponseDTO<EquipmentDTO>> GetEquipmentAsync(int id)
{
var retVal = new ApiResponseDTO<EquipmentDTO>()
{
IsSuccess = true,
};
var equipmentDTO = await _syncService.GetEquipmentAsync(id);
if (equipmentDTO != null)
{
retVal.IsSuccess = true;
retVal.Data = equipmentDTO;
}
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;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
[HttpPost("UpdateEquipment")]
public async Task<ApiResponseDTO<EquipmentDTO>> UpdateEquipment([FromBody] EquipmentDTO EquipmentDTO)
{
var retVal = new ApiResponseDTO<EquipmentDTO>()
{
IsSuccess = true
};
try
{
var result = await _syncService.UpdateEquipmentAsync(EquipmentDTO);
retVal.Data = result;
}
catch (Exception ex)
{
retVal.IsSuccess = false;
Log.Error(ex.Message);
}
return retVal;
}
[HttpGet("GetLocation/{id}")]
public async Task<ApiResponseDTO<LocationDTO>> GetLocationAsync(int id)
{
var retVal = new ApiResponseDTO<LocationDTO>()
{
IsSuccess = true,
};
var locationDTO = await _syncService.GetLocationAsync(id);
if (locationDTO != null)
{
retVal.IsSuccess = true;
retVal.Data = locationDTO;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
[HttpGet("GetAllLocations")]
public async Task<ApiResponseDTO<List<LocationDTO>>> GetAllLocationsAsync()
{
var retVal = new ApiResponseDTO<List<LocationDTO>>()
{
IsSuccess = true,
};
var locationListDTO = await _syncService.GetAllLocationAsync();
if (locationListDTO != null)
{
retVal.IsSuccess = true;
retVal.Data = locationListDTO;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
[HttpPost("UpdateLocation")]
public async Task<ApiResponseDTO<LocationDTO>> UpdateLocation([FromBody] LocationDTO LocationDTO)
{
var retVal = new ApiResponseDTO<LocationDTO>()
{
IsSuccess = true
};
try
{
var result = await _syncService.UpdateLocationAsync(LocationDTO);
retVal.Data = result;
}
catch (Exception ex)
{
retVal.IsSuccess = false;
Log.Error(ex.Message);
}
return retVal;
}
[HttpGet("GetAllCheckListTemplateHeader/{userId}")]
public async Task<ApiResponseDTO<List<CheckListTemplateHeaderDTO>>> GetAllCheckListTemplateHeaderAsync(int userId)
{
var retVal = new ApiResponseDTO<List<CheckListTemplateHeaderDTO>>()
{
IsSuccess = true,
};
var response = await _syncService.GetAllCheckListTemplateAsync(userId);
if (response != null)
{
retVal.IsSuccess = true;
retVal.Data = response;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
[HttpGet("GetAllCheckListHeader/{userId}")]
public async Task<ApiResponseDTO<List<CheckListHeaderDTO>>> GetAllCheckListHeaderAsync(int userId)
{
var retVal = new ApiResponseDTO<List<CheckListHeaderDTO>>()
{
IsSuccess = true,
};
var response = await _syncService.GetAllCheckListAsync(userId);
if (response != null)
{
retVal.IsSuccess = true;
retVal.Data = response;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
}
}
@@ -0,0 +1,296 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using WorkFlowCheck.Common.DTO;
using WorkFlowCheck.BL.Services.Interfaces;
using Serilog;
using WorkFlowCheck.BL.Services;
namespace WorkFlowCheck.API.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class UserController : ControllerBase
{
private IUserService _userService;
public UserController(IUserService userService)
{
_userService = userService;
}
[HttpGet("GetUser/{id}")]
public async Task<ApiResponseDTO<UserDTO>> GetUser(int id)
{
var retVal = new ApiResponseDTO<UserDTO>()
{
IsSuccess = true,
};
var userDTO = await _userService.GetUserAsync(id);
if (userDTO != null)
{
if (userDTO.Id == 0)
{
retVal.IsSuccess = false;
retVal.Errors.Add("No match!");
retVal.Data = userDTO;
}
else
{
retVal.IsSuccess = true;
retVal.Data = userDTO;
}
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
[HttpGet("GetAllUsers")]
public async Task<ApiResponseDTO<List<UserDTO>>> GetAllUsers()
{
var retVal = new ApiResponseDTO<List<UserDTO>>()
{
IsSuccess = true,
};
var userDTO = await _userService.GetAllUserAsync();
if (userDTO != null)
{
retVal.IsSuccess = true;
retVal.Data = userDTO;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
[HttpPost("UpdateUser")]
public async Task<ApiResponseDTO<UserDTO>> UpdateUser([FromBody] UserDTO userDTO)
{
var retVal = new ApiResponseDTO<UserDTO>()
{
IsSuccess = true
};
try
{
var result = await _userService.UpdateUserAsync(userDTO);
retVal.Data = result;
}
catch (Exception ex)
{
retVal.IsSuccess = false;
Log.Error(ex.Message);
}
return retVal;
}
[HttpPost("Authenticate")]
public async Task<ApiResponseDTO<UserDTO>> Authenticate([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)
{
var retVal = new ApiResponseDTO<RoleDTO>()
{
IsSuccess = true,
};
var RoleDTO = await _userService.GetRoleAsync(id);
if (RoleDTO != null)
{
if (RoleDTO.Id == 0)
{
retVal.IsSuccess = false;
retVal.Errors.Add("No match!");
retVal.Data = RoleDTO;
}
else
{
retVal.IsSuccess = true;
retVal.Data = RoleDTO;
}
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
[HttpGet("GetAllRoles")]
public async Task<ApiResponseDTO<List<RoleDTO>>> GetAllRoles()
{
var retVal = new ApiResponseDTO<List<RoleDTO>>()
{
IsSuccess = true,
};
var RoleDTO = await _userService.GetAllRoleAsync();
if (RoleDTO != null)
{
retVal.IsSuccess = true;
retVal.Data = RoleDTO;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
[HttpPost("UpdateRole")]
public async Task<ApiResponseDTO<RoleDTO>> UpdateRole([FromBody] RoleDTO roleDTO)
{
var retVal = new ApiResponseDTO<RoleDTO>()
{
IsSuccess = true
};
try
{
var result = await _userService.UpdateRoleAsync(roleDTO);
retVal.Data = result;
}
catch (Exception ex)
{
retVal.IsSuccess = false;
Log.Error(ex.Message);
}
return retVal;
}
[HttpGet("GetUserRole/{id}")]
public async Task<ApiResponseDTO<UserRoleDTO>> GetUserRole(int id)
{
var retVal = new ApiResponseDTO<UserRoleDTO>()
{
IsSuccess = true,
};
var RoleDTO = await _userService.GetUserRoleAsync(id);
if (RoleDTO != null)
{
if (RoleDTO.Id == 0)
{
retVal.IsSuccess = false;
retVal.Errors.Add("No match!");
retVal.Data = RoleDTO;
}
else
{
retVal.IsSuccess = true;
retVal.Data = RoleDTO;
}
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
[HttpGet("GetAllUserRoles")]
public async Task<ApiResponseDTO<List<UserRoleDTO>>> GetAllUserRoles()
{
var retVal = new ApiResponseDTO<List<UserRoleDTO>>()
{
IsSuccess = true,
};
var RoleDTO = await _userService.GetAllUserRoleAsync();
if (RoleDTO != null)
{
retVal.IsSuccess = true;
retVal.Data = RoleDTO;
}
else
{
retVal.IsSuccess = false;
retVal.Errors.Add("No data!");
}
return retVal;
}
[HttpPost("UpdateUserRole")]
public async Task<ApiResponseDTO<UserRoleDTO>> UpdateUserRole([FromBody] UserRoleDTO userRoleDTO)
{
var retVal = new ApiResponseDTO<UserRoleDTO>()
{
IsSuccess = true
};
try
{
var result = await _userService.UpdateUserRoleAsync(userRoleDTO);
retVal.Data = result;
}
catch (Exception ex)
{
retVal.IsSuccess = false;
Log.Error(ex.Message);
}
return retVal;
}
}
}
@@ -0,0 +1,42 @@
namespace WorkFlowCheck.API.Middleware
{
public class ApiKeyMiddleware
{
private readonly RequestDelegate _next;
private const string ApiKeyHeaderName = "X-Api-Key";
private readonly ILogger<ApiKeyMiddleware> _logger;
public ApiKeyMiddleware(RequestDelegate next, ILogger<ApiKeyMiddleware> logger)
{
_next = next;
_logger = logger;
}
public async Task InvokeAsync(HttpContext context)
{
if (!context.Request.Headers.TryGetValue(ApiKeyHeaderName, out var extractedApiKey))
{
_logger.LogWarning("API Key is missing.");
context.Response.StatusCode = 401; // Unauthorized
context.Response.ContentType = "text/html; charset=utf-8";
await context.Response.WriteAsync("API Key hiányzik.");
return;
}
var appSettings = context.RequestServices.GetRequiredService<IConfiguration>();
var apiKey = appSettings.GetValue<string>("ApiKey");
if (!apiKey.Equals(extractedApiKey))
{
_logger.LogWarning("Invalid API Key.");
context.Response.StatusCode = 403; // Forbidden
context.Response.ContentType = "text/html; charset=utf-8";
await context.Response.WriteAsync("Helytelen API Key.");
return;
}
await _next(context);
}
}
}
@@ -0,0 +1,55 @@
using Microsoft.IdentityModel.Tokens;
using System.IdentityModel.Tokens.Jwt;
using System.Security.Claims;
using System.Text;
namespace WorkFlowCheck.API.Middleware
{
public class JwtMiddleware
{
private readonly RequestDelegate _next;
public readonly IConfiguration _configuration;
public JwtMiddleware(RequestDelegate next, IConfiguration configuration)
{
_next = next;
_configuration = configuration;
}
public async Task Invoke(HttpContext context)
{
var token = context.Request.Headers["Authorization"].FirstOrDefault()?.Split(" ").Last();
if (!string.IsNullOrEmpty(token) && ValidateToken(token, out var claims))
{
context.User = new ClaimsPrincipal(new ClaimsIdentity(claims, "jwt"));
}
await _next(context);
}
private bool ValidateToken(string token, out Claim[] claims)
{
var jwtSettings = _configuration.GetSection("Jwt");
var secretKey = jwtSettings["SecretKey"];
claims = null;
var tokenHandler = new JwtSecurityTokenHandler();
var key = Encoding.UTF8.GetBytes(secretKey);
try
{
var principal = tokenHandler.ValidateToken(token, new TokenValidationParameters
{
ValidateIssuerSigningKey = true,
IssuerSigningKey = new SymmetricSecurityKey(key),
ValidateIssuer = false,
ValidateAudience = false,
ClockSkew = TimeSpan.Zero
}, out var validatedToken);
claims = principal.Claims.ToArray();
return true;
}
catch
{
return false;
}
}
}
}
+104 -23
View File
@@ -1,36 +1,117 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.OpenApi.Models;
using System.Text.Json;
using System.Text.Json.Serialization;
using WorkFlowCheck.DL;
using Microsoft.AspNetCore.Mvc;
using Serilog;
using WorkFlowCheck.BL.Mappings;
using WorkFlowCheck.BL.Infra;
using WorkFlowCheck.DL.Seed;
using WorkFlowCheck.Common.RequestContext;
using WorkFlowCheck.API.RequestContext;
using WorkFlowCheck.API.Middleware;
var builder = WebApplication.CreateSlimBuilder(args);
var builder = WebApplication.CreateBuilder(args);
builder.Services.ConfigureHttpJsonOptions(options =>
Log.Logger = new LoggerConfiguration()
.ReadFrom.Configuration(builder.Configuration)
.CreateLogger();
builder.Services.AddAutoMapper(typeof(MapperProfile));
builder.Services.AddMemoryCache();
builder.Services.AddHttpContextAccessor();
builder.Services.AddScoped<IRequestContext, HttpRequestContext>();
var connectionString = builder.Configuration.GetConnectionString("DefaultConnection");
builder.Services.AddDbContext<AppDbContext>(options =>
options.UseSqlServer(connectionString, x => x.MigrationsAssembly("WorkFlowCheck.DL")));
//DI
DIConfig.DIInit(builder.Services);
// SWAGGER !!!
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen(c =>
{
options.SerializerOptions.TypeInfoResolverChain.Insert(0, AppJsonSerializerContext.Default);
c.SwaggerDoc("v1", new OpenApiInfo { Title = "WorkFlowCheck API", Version = "v1" });
// API Key Auth definíció
c.AddSecurityDefinition("ApiKey", new OpenApiSecurityScheme
{
Description = "API Key szükséges. Használat: 'ApiKey: {kulcs}'",
Name = "X-Api-Key", // A fejlécek között keresendõ
In = ParameterLocation.Header,
Type = SecuritySchemeType.ApiKey,
Scheme = "ApiKey"
});
c.AddSecurityRequirement(new OpenApiSecurityRequirement
{
{
new OpenApiSecurityScheme
{
Reference = new OpenApiReference
{
Type = ReferenceType.SecurityScheme,
Id = "ApiKey"
},
Scheme = "ApiKey",
Name = "ApiKey",
In = ParameterLocation.Header,
},
Array.Empty<string>()
}
});
});
builder.Host.UseSerilog();
builder.Services.AddControllers()
.AddNewtonsoftJson(options =>
{
// Itt konfigurálhatod az egyedi beállításokat
options.SerializerSettings.NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore;
options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
});
builder.Services.AddCors(options =>
{
options.AddDefaultPolicy(policy =>
{
policy.WithOrigins("*").AllowAnyMethod().AllowAnyHeader();
});
});
var app = builder.Build();
var sampleTodos = new Todo[] {
new(1, "Walk the dog"),
new(2, "Do the dishes", DateOnly.FromDateTime(DateTime.Now)),
new(3, "Do the laundry", DateOnly.FromDateTime(DateTime.Now.AddDays(1))),
new(4, "Clean the bathroom"),
new(5, "Clean the car", DateOnly.FromDateTime(DateTime.Now.AddDays(2)))
};
var todosApi = app.MapGroup("/todos");
todosApi.MapGet("/", () => sampleTodos);
todosApi.MapGet("/{id}", (int id) =>
sampleTodos.FirstOrDefault(a => a.Id == id) is { } todo
? Results.Ok(todo)
: Results.NotFound());
using (var scope = app.Services.CreateScope())
{
var context = scope.ServiceProvider.GetRequiredService<AppDbContext>();
DBInitializer.Seed(context);
}
// Swagger middleware
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "WorkFlowCheck API v1");
});
}
// Routing és endpointok
//app.UseHttpsRedirection();
app.UseRouting();
app.UseMiddleware<ApiKeyMiddleware>();
app.UseMiddleware<JwtMiddleware>();
app.MapControllers();
app.UseAuthorization();
app.UseCors();
app.Run();
public record Todo(int Id, string? Title, DateOnly? DueBy = null, bool IsComplete = false);
[JsonSerializable(typeof(Todo[]))]
internal partial class AppJsonSerializerContext : JsonSerializerContext
{
}
@@ -1,15 +1,31 @@
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "todos",
"applicationUrl": "http://localhost:5069",
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"dotnetRunMessages": true,
"applicationUrl": "https://localhost:5069"
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
},
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:59027/",
"sslPort": 44382
}
}
}
}
@@ -0,0 +1,37 @@
using Microsoft.Extensions.Caching.Memory;
using System.Diagnostics;
using System.Security.Claims;
using WorkFlowCheck.Common.Constants;
using WorkFlowCheck.Common.DTO;
using WorkFlowCheck.Common.RequestContext;
namespace WorkFlowCheck.API.RequestContext
{
public class HttpRequestContext : IRequestContext
{
private readonly IHttpContextAccessor _httpContextAccessor;
private readonly IMemoryCache _memoryCache;
public HttpRequestContext(IHttpContextAccessor httpContextAccessor, IMemoryCache memoryCache)
{
_httpContextAccessor = httpContextAccessor;
_memoryCache = memoryCache;
TraceId = Activity.Current?.Id;
}
public string TraceId { get; }
public int? CurrentUserId => CurrentDbUser?.Id;
public string CurrentUsername => CurrentHttpUser?.Identity.Name;
public string CurrentUserEmail => CurrentHttpUser?.FindFirst(System.Security.Claims.ClaimTypes.Email)?.Value;
public CancellationToken RequestAborted => _httpContextAccessor.HttpContext.RequestAborted;
private UserDTO CurrentDbUser => _memoryCache.Get<UserDTO>(MemoryCacheNames.UsersNamePrefix + CurrentUserEmail);
private ClaimsPrincipal CurrentHttpUser => _httpContextAccessor.HttpContext.User;
}
}
+30 -3
View File
@@ -1,11 +1,38 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<SelfContained>true</SelfContained>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<InvariantGlobalization>true</InvariantGlobalization>
<PublishAot>true</PublishAot>
<InvariantGlobalization>false</InvariantGlobalization>
<PublishAot>false</PublishAot>
<IsTransformWebConfigDisabled>true</IsTransformWebConfigDisabled>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\WorkFlowCheck.BL\WorkFlowCheck.BL.csproj" />
<ProjectReference Include="..\WorkFlowCheck.DL\WorkFlowCheck.DL.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.11" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.12">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Serilog.AspNetCore" Version="8.0.3" />
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="7.2.0" />
</ItemGroup>
<ItemGroup>
<None Update="Certs\SwaggerCert.pfx">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
+26 -1
View File
@@ -1,9 +1,34 @@
{
"ConnectionStrings": {
"DefaultConnection": "Data Source=WS2016DC\\SQLEXPRESS;Initial Catalog=WFCUAT;Integrated Security=True;Connect Timeout=30;Encrypt=False;Trust Server Certificate=False;Application Intent=ReadWrite;Multi Subnet Failover=False"
},
"ApiKey": "RUJeLSpSMzVASUdaRCEzUyYxRSE0VyFISFRSJC0zRzhLM1hCSDU=",
"Jwt": {
"SecretKey": "9aLxV2t7RpM8BfKqZwXy3GehYJDUNTCrHkVZ",
"Issuer": "https://wfcapi.nuvolar.hu/",
"Audience": "wfc-application",
"TokenLifetimeMinutes": 30
},
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
"Microsoft.AspNetCore": "Information"
}
},
"Serilog": {
"MinimumLevel": "Information",
"WriteTo": [
{
"Name": "Console"
},
{
"Name": "File",
"Args": {
"path": "logs/log-.log",
"rollingInterval": "Day"
}
}
]
},
"AllowedHosts": "*"
}
+2
View File
@@ -0,0 +1,2 @@
dotnet publish -c Release -o e:\wfcapi\
pause
+22
View File
@@ -0,0 +1,22 @@
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WorkFlowCheck.BL.Services;
using WorkFlowCheck.BL.Services.Interfaces;
namespace WorkFlowCheck.BL.Infra
{
public static class DIConfig
{
public static void DIInit(IServiceCollection service)
{
service.AddScoped<IUserService, UserService>();
service.AddScoped<ISyncService, SyncService>();
service.AddScoped<ICheckListService, CheckListService>();
service.AddScoped<INumberGeneratorService, NumberGeneratorService>();
}
}
}
@@ -0,0 +1,54 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using AutoMapper;
using AutoMapper.Configuration.Conventions;
using WorkFlowCheck.Common.DTO;
using WorkFlowCheck.DL.Entities;
namespace WorkFlowCheck.BL.Mappings
{
public class MapperProfile : Profile
{
public MapperProfile()
{
CreateMap<User, UserDTO>().ForMember(dest => dest.RoleDTO, opt => opt.MapFrom(src => src.UserRoles.Select(ur => ur.Role)));
CreateMap<Role, RoleDTO>();
CreateMap<UserRole, UserRoleDTO>()
.ForMember(dest => dest.RoleDTO, opt => opt.MapFrom(src => src.Role))
.ForMember(dest => dest.UserDTO, opt => opt.MapFrom(src => src.User));
CreateMap<UserDTO, User>()
.ForMember(dest => dest.PasswordHash, opt => opt.MapFrom<PasswordHashResolver>());
CreateMap<CheckListTemplateHeader, CheckListTemplateHeaderDTO>()
.ForMember(dest => dest.CheckListTemplateRowDTO, opt => opt.MapFrom(src => src.CheckListTemplateRows));
CreateMap<CheckListTemplateRow, CheckListTemplateRowDTO>()
.ForMember(dest => dest.EquipmentDTO, opt => opt.MapFrom(src => src.Equipment))
.ForMember(dest => dest.CheckPointDTO, opt => opt.MapFrom(src => src.CheckPoint));
CreateMap<CheckPoint, CheckPointDTO>().ForMember(dest => dest.CheckListTemplateRowDTO, opt => opt.MapFrom(src => src.CheckListTemplateRows));
CreateMap<CheckPointDTO, CheckPoint>();
CreateMap<Location, LocationDTO>();
CreateMap<LocationDTO, Location>();
CreateMap<Equipment, EquipmentDTO>();
CreateMap<EquipmentDTO, Equipment>();
CreateMap<CheckListHeader, CheckListHeaderDTO>()
.ForMember(dest => dest.UserDTO, opt => opt.MapFrom(src => src.User))
.ForMember(dest => dest.CheckListRowDTO, opt => opt.MapFrom(src => src.CheckListRows));
CreateMap<CheckListRow, CheckListRowDTO>()
.ForMember(dest => dest.CheckListTemplateRowDTO, opt => opt.MapFrom(src => src.CheckListTemplateRow));
}
}
}
@@ -0,0 +1,20 @@
using AutoMapper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WorkFlowCheck.Common.DTO;
using WorkFlowCheck.Common.Security;
using WorkFlowCheck.DL.Entities;
namespace WorkFlowCheck.BL.Mappings
{
public class PasswordHashResolver : IValueResolver<UserDTO, User, string>
{
public string Resolve(UserDTO source, User destination, string destMember, ResolutionContext context)
{
return PasswordHasher.HashPassword(source.Password);
}
}
}
@@ -0,0 +1,352 @@
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
{
public class CheckListService : ICheckListService
{
private AppDbContext _dbContext;
private IMapper _mapper;
private readonly INumberGeneratorService _numberGeneratorService;
public CheckListService(AppDbContext dbContext, IMapper mapper, INumberGeneratorService numberGeneratorService)
{
_dbContext = dbContext;
_mapper = mapper;
_numberGeneratorService = numberGeneratorService;
}
public async Task<CheckListHeaderDTO> GetCheckListHeaderAsync(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<List<CheckListHeaderDTO>> GetAllCheckListHeaderAsync()
{
var retVal = new List<CheckListHeaderDTO>();
try
{
var roles = await _dbContext.CheckListHeaders
.Include(i => i.CheckListRows)
.Include(i => i.User)
.AsNoTracking()
.ToListAsync();
if (roles != null)
{
retVal = _mapper.Map<List<CheckListHeaderDTO>>(roles);
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
public async Task<CheckListHeaderDTO> UpdateCheckListHeaderAsync(CheckListHeaderDTO checkListHeaderDTO)
{
var retVal = new CheckListHeaderDTO() { CheckListRowDTO = new List<CheckListRowDTO>() };
try
{
if (checkListHeaderDTO.Id == 0)
{
var checkListHeader = new CheckListHeader()
{
CheckListTemplateHeaderId = checkListHeaderDTO.CheckListTemplateHeaderDTO.Id,
Description = checkListHeaderDTO.Description,
GuidNumber = Guid.NewGuid(),
};
_dbContext.CheckListHeaders.Add(checkListHeader);
await _dbContext.SaveChangesAsync();
retVal = _mapper.Map<CheckListHeaderDTO>(checkListHeader);
}
else
{
var checkListHeader = await _dbContext.CheckListHeaders
.Include(i => i.CheckListRows)
.Where(w => w.Id == checkListHeaderDTO.Id)
.FirstOrDefaultAsync();
if (checkListHeader != null)
{
checkListHeader.Description = checkListHeaderDTO.Description;
await _dbContext.SaveChangesAsync();
retVal = _mapper.Map<CheckListHeaderDTO>(checkListHeader);
}
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
public async Task<CheckListHeaderDTO> StartNewCheckListAsync(CheckListHeaderNewDTO checkListHeaderNewDTO)
{
var retVal = new CheckListHeaderDTO()
{
CheckListRowDTO = new List<CheckListRowDTO>()
};
using var transaction = await _dbContext.Database.BeginTransactionAsync();
try
{
var checkListTemplateHeader = await _dbContext.CheckListTemplateHeaders
.Where(w => w.Id == checkListHeaderNewDTO.CheckListTemplateHeaderId)
.FirstOrDefaultAsync();
if (checkListTemplateHeader == null)
{
return retVal;
}
var currentDate = DateTime.UtcNow;
var documentNumber = await _numberGeneratorService.GenerateNextNumberAsync(checkListTemplateHeader.NumberGenerator1Id ?? 1, transaction, currentDate);
CheckListHeader checkListHeader = new CheckListHeader()
{
CheckListTemplateHeaderId = checkListHeaderNewDTO.CheckListTemplateHeaderId,
DateExecution = currentDate,
IsEditable = true,
UserId = checkListHeaderNewDTO.UserId,
ShortName = "",
Description = "",
DocumentNumber = documentNumber,
GuidNumber = Guid.NewGuid(),
IsDeleted = false,
IsStorno = false,
CheckListRows = new List<CheckListRow>()
};
_dbContext.CheckListHeaders.Add(checkListHeader);
await _dbContext.SaveChangesAsync();
var checkListTemplateRows = await _dbContext.CheckListTemplateRows
.Where(w => w.CheckListTemplateHeaderId == checkListHeaderNewDTO.CheckListTemplateHeaderId)
.OrderBy(o => o.RowIndex)
.ToListAsync();
foreach (var item in checkListTemplateRows)
{
CheckListRow checkListRow = new CheckListRow()
{
Answer = "",
CheckListHeaderId = checkListHeader.Id,
CheckListTemplateRowId = item.Id,
GuidNumber = Guid.NewGuid(),
IsDeleted = false,
Photo = new byte[0],
};
_dbContext.CheckListRows.Add(checkListRow);
}
await _dbContext.SaveChangesAsync();
await transaction.CommitAsync();
retVal = _mapper.Map<CheckListHeaderDTO>(checkListHeader);
}
catch (Exception ex)
{
await transaction.RollbackAsync();
Log.Error(ex.Message);
}
return retVal;
}
public async Task<CheckListTemplateHeaderDTO> GetCheckListTemplateHeaderAsync(int Id)
{
var retVal = new CheckListTemplateHeaderDTO()
{
CheckListTemplateRowDTO = new List<CheckListTemplateRowDTO>()
};
try
{
var res = await _dbContext.CheckListTemplateHeaders
.Where(w => w.Id == Id)
.Include(i => i.CheckListTemplateRows)
.ThenInclude(i => i.CheckPoint)
.Include(i => i.CheckListTemplateRows)
.ThenInclude(i => i.Equipment)
.AsNoTracking()
.FirstOrDefaultAsync();
if (res != null)
{
retVal = _mapper.Map<CheckListTemplateHeaderDTO>(res);
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
public async Task<List<CheckListTemplateHeaderDTO>> GetAllCheckListTemplateHeaderAsync()
{
var retVal = new List<CheckListTemplateHeaderDTO>();
try
{
var roles = await _dbContext.CheckListTemplateHeaders
.Include(i => i.CheckListTemplateRows)
.AsNoTracking()
.ToListAsync();
if (roles != null)
{
retVal = _mapper.Map<List<CheckListTemplateHeaderDTO>>(roles);
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
public async Task<CheckListTemplateHeaderDTO> UpdateCheckListTemplateHeaderAsync(CheckListTemplateHeaderDTO checkListTemplateHeaderDTO)
{
var retVal = new CheckListTemplateHeaderDTO() { CheckListTemplateRowDTO = new List<CheckListTemplateRowDTO>() };
try
{
if (checkListTemplateHeaderDTO.Id == 0)
{
var checkListTemplateHeader = new CheckListTemplateHeader()
{
Description = checkListTemplateHeaderDTO.Description,
ShortName = checkListTemplateHeaderDTO.ShortName,
IsDeleted = false,
};
_dbContext.CheckListTemplateHeaders.Add(checkListTemplateHeader);
await _dbContext.SaveChangesAsync();
retVal = _mapper.Map<CheckListTemplateHeaderDTO>(checkListTemplateHeader);
}
else
{
var checkListTemplateHeader = await _dbContext.CheckListTemplateHeaders
.Include(i => i.CheckListTemplateRows)
.Where(w => w.Id == checkListTemplateHeaderDTO.Id)
.FirstOrDefaultAsync();
if (checkListTemplateHeader != null)
{
checkListTemplateHeader.Description = checkListTemplateHeaderDTO.Description;
checkListTemplateHeader.ShortName = checkListTemplateHeaderDTO.ShortName;
await _dbContext.SaveChangesAsync();
retVal = _mapper.Map<CheckListTemplateHeaderDTO>(checkListTemplateHeader);
}
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
public async Task<CheckListTemplateRowDTO> GetCheckListTemplateRowAsync(int id)
{
var retVal = new CheckListTemplateRowDTO();
try
{
var res = await _dbContext.CheckListTemplateRows
.Include(i => i.Equipment)
.Include(i => i.CheckPoint)
.Where(w => w.Id == id)
.AsNoTracking()
.FirstOrDefaultAsync();
if (res != null)
{
retVal = _mapper.Map<CheckListTemplateRowDTO>(res);
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
public async Task<CheckListTemplateRowDTO> UpdateCheckListTemplateRowAsync(CheckListTemplateRowDTO checkListTemplateRowDTO)
{
var retVal = new CheckListTemplateRowDTO() { };
try
{
if (checkListTemplateRowDTO.Id == 0)
{
var checkListTemplateRow = new CheckListTemplateRow()
{
CheckListTemplateHeaderId = checkListTemplateRowDTO.CheckListTemplateHeaderId,
CheckPointId = checkListTemplateRowDTO.CheckPointId,
EquipmentId = checkListTemplateRowDTO.EquipmentId,
OperationDescription = checkListTemplateRowDTO.OperationDescription,
AnswerType = checkListTemplateRowDTO.AnswerType,
RowIndex = checkListTemplateRowDTO.RowIndex,
};
_dbContext.CheckListTemplateRows.Add(checkListTemplateRow);
await _dbContext.SaveChangesAsync();
retVal = _mapper.Map<CheckListTemplateRowDTO>(checkListTemplateRow);
}
else
{
var checkListTemplateRow = await _dbContext.CheckListTemplateRows
.Where(w => w.Id == checkListTemplateRowDTO.Id)
.FirstOrDefaultAsync();
if (checkListTemplateRow != null)
{
checkListTemplateRow.CheckListTemplateHeaderId = checkListTemplateRowDTO.CheckListTemplateHeaderId;
checkListTemplateRow.CheckPointId = checkListTemplateRowDTO.CheckPointId;
checkListTemplateRow.EquipmentId = checkListTemplateRowDTO.EquipmentId;
checkListTemplateRow.OperationDescription = checkListTemplateRowDTO.OperationDescription;
checkListTemplateRow.AnswerType = checkListTemplateRowDTO.AnswerType;
checkListTemplateRow.RowIndex = checkListTemplateRowDTO.RowIndex;
await _dbContext.SaveChangesAsync();
retVal = _mapper.Map<CheckListTemplateRowDTO>(checkListTemplateRow);
}
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
}
}
@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WorkFlowCheck.Common.DTO;
namespace WorkFlowCheck.BL.Services.Interfaces
{
public interface ICheckListService
{
Task<CheckListHeaderDTO> GetCheckListHeaderAsync(int Id);
Task<List<CheckListHeaderDTO>> GetAllCheckListHeaderAsync();
Task<CheckListHeaderDTO> UpdateCheckListHeaderAsync(CheckListHeaderDTO checkListHeaderDTO);
Task<CheckListHeaderDTO> StartNewCheckListAsync(CheckListHeaderNewDTO checkListHeaderNewDTO);
Task<CheckListTemplateHeaderDTO> GetCheckListTemplateHeaderAsync(int Id);
Task<List<CheckListTemplateHeaderDTO>> GetAllCheckListTemplateHeaderAsync();
Task<CheckListTemplateHeaderDTO> UpdateCheckListTemplateHeaderAsync(CheckListTemplateHeaderDTO checkListTemplateHeaderDTO);
Task<CheckListTemplateRowDTO> GetCheckListTemplateRowAsync(int id);
Task<CheckListTemplateRowDTO> UpdateCheckListTemplateRowAsync(CheckListTemplateRowDTO checkListTemplateRowDTO);
}
}
@@ -0,0 +1,15 @@
using Microsoft.EntityFrameworkCore.Storage;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.BL.Services.Interfaces
{
public interface INumberGeneratorService
{
Task<string> GenerateNextNumberAsync(int templateId, IDbContextTransaction transaction, DateTime? baseDate = null);
Task<string> GetSampleAsync(int templateId, DateTime? baseDate = null);
}
}
@@ -0,0 +1,27 @@
using WorkFlowCheck.Common.DTO;
namespace WorkFlowCheck.BL.Services.Interfaces
{
public interface ISyncService
{
Task<List<CheckPointDTO>> GetAllCheckPointAsync();
Task<CheckPointDTO> GetCheckPointAsync(int id);
Task<CheckPointDTO> UpdateCheckPointAsync(CheckPointDTO checkPointDTO);
Task<List<CheckPointDTO>> UpdateAllCheckPointAsync(List<CheckPointDTO> checkPointListDTO);
Task<List<LocationDTO>> GetAllLocationAsync();
Task<LocationDTO> GetLocationAsync(int id);
Task<LocationDTO> UpdateLocationAsync(LocationDTO LocationDTO);
Task<List<EquipmentDTO>> GetAllEquipmentAsync();
Task<EquipmentDTO> GetEquipmentAsync(int id);
Task<EquipmentDTO> UpdateEquipmentAsync(EquipmentDTO EquipmentDTO);
Task<List<CheckListTemplateHeaderDTO>> GetAllCheckListTemplateAsync(int userId);
Task<List<CheckListHeaderDTO>> GetAllCheckListAsync(int userId);
}
}
@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WorkFlowCheck.Common.DTO;
namespace WorkFlowCheck.BL.Services.Interfaces
{
public interface IUserService
{
Task<UserDTO> GetUserAsync(int Id);
Task<List<UserDTO>> GetAllUserAsync();
Task<UserDTO> UpdateUserAsync(UserDTO userDTO);
Task<UserDTO> Authenticate(string UserName, string Password);
Task<RoleDTO> GetRoleAsync(int Id);
Task<List<RoleDTO>> GetAllRoleAsync();
Task<RoleDTO> UpdateRoleAsync(RoleDTO roleDTO);
Task<UserRoleDTO> GetUserRoleAsync(int Id);
Task<List<UserRoleDTO>> GetAllUserRoleAsync();
Task<UserRoleDTO> UpdateUserRoleAsync(UserRoleDTO userRoleDTO);
string GenerateJwtToken(UserDTO userDTO);
}
}
@@ -0,0 +1,144 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Storage;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WorkFlowCheck.BL.Services.Interfaces;
using WorkFlowCheck.DL;
using WorkFlowCheck.DL.Entities;
namespace WorkFlowCheck.BL.Services
{
public class NumberGeneratorService : INumberGeneratorService
{
private readonly DbContext _dbContext;
private static readonly Dictionary<int, SemaphoreSlim> _templateLocks = new();
public NumberGeneratorService(AppDbContext dbContext)
{
_dbContext = dbContext;
}
public async Task<string> GenerateNextNumberAsync(int templateId, IDbContextTransaction transaction, DateTime? baseDate = null)
{
var semaphore = GetOrCreateSemaphore(templateId);
await semaphore.WaitAsync();
try
{
var template = await _dbContext.Set<NumberGeneratorTemplate>()
.FirstOrDefaultAsync(t => t.Id == templateId);
if (template == null)
throw new InvalidOperationException($"Template with ID {templateId} not found.");
var now = baseDate ?? DateTime.Now;
var (year, month) = GetKeyDateParts(template, now);
var templateDate = await _dbContext.Set<NumberGeneratorTemplateDate>()
.FirstOrDefaultAsync(td => td.NumberGeneratorTemplateId == templateId && td.Year == year && td.Month == month);
if (templateDate == null)
{
templateDate = new NumberGeneratorTemplateDate
{
NumberGeneratorTemplateId = template.Id,
Year = year,
Month = month,
CurrentNumber = 0
};
_dbContext.Add(templateDate);
}
templateDate.CurrentNumber++;
var formatted = templateDate.CurrentNumber.ToString(template.DigitFormat);
var dynamicSuffix = BuildDynamicSuffix(template, now);
var result = BuildFormattedNumber(template, formatted, dynamicSuffix);
templateDate.LastGeneratedNumber = result;
await _dbContext.SaveChangesAsync();
return result;
}
catch
{
throw;
}
finally
{
semaphore.Release();
}
}
public async Task<string> GetSampleAsync(int templateId, DateTime? baseDate = null)
{
var template = await _dbContext.Set<NumberGeneratorTemplate>()
.AsNoTracking()
.FirstOrDefaultAsync(t => t.Id == templateId);
if (template == null)
throw new InvalidOperationException($"Template with ID {templateId} not found.");
var now = baseDate ?? DateTime.Now;
var formatted = 1.ToString(template.DigitFormat);
var dynamicSuffix = BuildDynamicSuffix(template, now);
return BuildFormattedNumber(template, formatted, dynamicSuffix);
}
private SemaphoreSlim GetOrCreateSemaphore(int templateId)
{
lock (_templateLocks)
{
if (!_templateLocks.ContainsKey(templateId))
_templateLocks[templateId] = new SemaphoreSlim(1, 1);
return _templateLocks[templateId];
}
}
private static (int year, int? month) GetKeyDateParts(NumberGeneratorTemplate template, DateTime date)
{
int year = date.Year;
int? month = template.GenerateType == GenerateType.YearAndMonth ? date.Month : null;
return (year, month);
}
private static string BuildDynamicSuffix(NumberGeneratorTemplate template, DateTime date)
{
return template.GenerateType switch
{
GenerateType.OnlyYear => date.Year.ToString(),
GenerateType.YearAndMonth => $"{date.Year}/{date.Month:D2}",
_ => template.Suffix
};
}
private static string BuildFormattedNumber(NumberGeneratorTemplate template, string formattedNumber, string dynamicSuffix)
{
var sb = new StringBuilder();
if (!string.IsNullOrEmpty(template.Prefix))
sb.Append(template.Prefix);
if (!string.IsNullOrEmpty(template.PrefixSeparator) && !string.IsNullOrEmpty(template.Prefix))
sb.Append(template.PrefixSeparator);
sb.Append(formattedNumber);
if (!string.IsNullOrEmpty(dynamicSuffix))
{
if (!string.IsNullOrEmpty(template.SuffixSeparator))
sb.Append(template.SuffixSeparator);
sb.Append(dynamicSuffix);
}
return sb.ToString();
}
}
}
@@ -0,0 +1,343 @@
using AutoMapper;
using Microsoft.EntityFrameworkCore;
using Serilog;
using System.Collections.Generic;
using WorkFlowCheck.BL.Services.Interfaces;
using WorkFlowCheck.Common.DTO;
using WorkFlowCheck.DL;
using WorkFlowCheck.DL.Entities;
namespace WorkFlowCheck.BL.Services
{
public class SyncService : ISyncService
{
private AppDbContext _dbContext;
private IMapper _mapper;
public SyncService(AppDbContext dbContext, IMapper mapper)
{
_dbContext = dbContext;
_mapper = mapper;
}
public async Task<List<CheckPointDTO>> GetAllCheckPointAsync()
{
var retVal = new List<CheckPointDTO>();
try
{
var res = await _dbContext.CheckPoints
.Include(i => i.CheckListTemplateRows)
.AsNoTracking()
.ToListAsync();
if (res != null)
{
retVal = _mapper.Map<List<CheckPointDTO>>(res);
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
public async Task<CheckPointDTO> GetCheckPointAsync(int id)
{
var retVal = new CheckPointDTO();
try
{
var res = await _dbContext.CheckPoints
.Include(i => i.CheckListTemplateRows)
.Where(w => w.Id == id)
.AsNoTracking()
.FirstOrDefaultAsync();
if (res != null)
{
retVal = _mapper.Map<CheckPointDTO>(res);
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
public async Task<CheckPointDTO> UpdateCheckPointAsync(CheckPointDTO checkPointDTO)
{
var retVal = new CheckPointDTO();
try
{
if (checkPointDTO.Id == 0) //Hozzáadás, ha Id == 0
{
var checkPoint = _mapper.Map<CheckPoint>(checkPointDTO);
_dbContext.CheckPoints.Add(checkPoint);
await _dbContext.SaveChangesAsync();
retVal = _mapper.Map<CheckPointDTO>(checkPoint);
}
else
{
var res = await _dbContext.CheckPoints.Where(w => w.Id == checkPointDTO.Id).FirstOrDefaultAsync();
if (res != null)
{
res.ShortName = checkPointDTO.ShortName;
res.Code = checkPointDTO.Code;
await _dbContext.SaveChangesAsync();
retVal = _mapper.Map<CheckPointDTO>(res);
}
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
public async Task<List<CheckPointDTO>> UpdateAllCheckPointAsync(List<CheckPointDTO> checkPointListDTO)
{
var retVal = new List<CheckPointDTO>();
try
{
var ids = checkPointListDTO.Select(dto => dto.Id).ToList();
var checkPoints = await _dbContext.CheckPoints
.Where(cp => ids.Contains(cp.Id))
.ToListAsync();
foreach (var checkPoint in checkPoints)
{
var dto = checkPointListDTO.FirstOrDefault(d => d.Id == checkPoint.Id);
if (dto != null)
{
checkPoint.Code = dto.Code;
}
}
await _dbContext.SaveChangesAsync();
retVal = _mapper.Map<List<CheckPointDTO>>(checkPoints);
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
public async Task<List<LocationDTO>> GetAllLocationAsync()
{
var retVal = new List<LocationDTO>();
try
{
var res = await _dbContext.Locations.ToListAsync();
if (res != null)
{
retVal = _mapper.Map<List<LocationDTO>>(res);
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
public async Task<LocationDTO> GetLocationAsync(int id)
{
var retVal = new LocationDTO();
try
{
var res = await _dbContext.Locations
.Where(w => w.Id == id)
.AsNoTracking()
.FirstOrDefaultAsync();
if (res != null)
{
retVal = _mapper.Map<LocationDTO>(res);
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
public async Task<LocationDTO> UpdateLocationAsync(LocationDTO LocationDTO)
{
var retVal = new LocationDTO();
try
{
if (LocationDTO.Id == 0) //Hozzáadás, ha Id == 0
{
var Location = _mapper.Map<Location>(LocationDTO);
_dbContext.Locations.Add(Location);
await _dbContext.SaveChangesAsync();
retVal = _mapper.Map<LocationDTO>(Location);
}
else
{
var res = await _dbContext.Locations.Where(w => w.Id == LocationDTO.Id).FirstOrDefaultAsync();
if (res != null)
{
res = _mapper.Map<Location>(LocationDTO);
await _dbContext.SaveChangesAsync();
retVal = _mapper.Map<LocationDTO>(res);
}
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
public async Task<List<EquipmentDTO>> GetAllEquipmentAsync()
{
var retVal = new List<EquipmentDTO>();
try
{
var res = await _dbContext.Equipments.ToListAsync();
if (res != null)
{
retVal = _mapper.Map<List<EquipmentDTO>>(res);
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
public async Task<EquipmentDTO> GetEquipmentAsync(int id)
{
var retVal = new EquipmentDTO();
try
{
var res = await _dbContext.Equipments
.Where(w => w.Id == id)
.AsNoTracking()
.FirstOrDefaultAsync();
if (res != null)
{
retVal = _mapper.Map<EquipmentDTO>(res);
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
public async Task<EquipmentDTO> UpdateEquipmentAsync(EquipmentDTO EquipmentDTO)
{
var retVal = new EquipmentDTO();
try
{
if (EquipmentDTO.Id == 0) //Hozzáadás, ha Id == 0
{
var Equipment = _mapper.Map<Equipment>(EquipmentDTO);
_dbContext.Equipments.Add(Equipment);
await _dbContext.SaveChangesAsync();
retVal = _mapper.Map<EquipmentDTO>(Equipment);
}
else
{
var res = await _dbContext.Equipments.Where(w => w.Id == EquipmentDTO.Id).FirstOrDefaultAsync();
if (res != null)
{
res.ShortName = EquipmentDTO.ShortName;
res.EquipmentNumber = EquipmentDTO.EquipmentNumber;
await _dbContext.SaveChangesAsync();
retVal = _mapper.Map<EquipmentDTO>(res);
}
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
public async Task<List<CheckListTemplateHeaderDTO>> GetAllCheckListTemplateAsync(int userId)
{
var retVal = new List<CheckListTemplateHeaderDTO>();
try
{
var user = _dbContext.Users.Where(w => w.Id == userId).FirstOrDefault();
if (user != null)
{
var res = await (from ur in _dbContext.UserRoles
join rth in _dbContext.RoleCheckListTemplateHeaders on ur.RoleId equals rth.RoleId
join header in _dbContext.CheckListTemplateHeaders on rth.CheckListTemplateHeaderId equals header.Id
where ur.UserId == userId
select header)
.Include(h => h.CheckListTemplateRows)
.Distinct()
.AsNoTracking()
.ToListAsync();
if (res != null)
{
retVal = _mapper.Map<List<CheckListTemplateHeaderDTO>>(res);
}
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
public async Task<List<CheckListHeaderDTO>> GetAllCheckListAsync(int userId)
{
var retVal = new List<CheckListHeaderDTO>();
try
{
var res = await _dbContext.CheckListHeaders
.Where(w => w.IsEditable && w.UserId == userId)
.Include(i => i.CheckListRows)
.AsNoTracking()
.ToListAsync();
if (res != null)
{
retVal = _mapper.Map<List<CheckListHeaderDTO>>(res);
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
}
}
@@ -0,0 +1,344 @@
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.Common.DTO;
using WorkFlowCheck.BL.Services.Interfaces;
using WorkFlowCheck.DL;
using WorkFlowCheck.Common.Security;
using Microsoft.IdentityModel.Tokens;
using System.IdentityModel.Tokens.Jwt;
using System.Security.Claims;
using WorkFlowCheck.DL.Entities;
using Microsoft.Extensions.Configuration;
using Microsoft.AspNetCore.Identity;
namespace WorkFlowCheck.BL.Services
{
public class UserService : IUserService
{
private AppDbContext _dbContext;
private IMapper _mapper;
private IConfiguration _configuration;
public UserService(AppDbContext dbContext, IMapper mapper, IConfiguration configuration)
{
_dbContext = dbContext;
_mapper = mapper;
_configuration = configuration;
}
public async Task<UserDTO> GetUserAsync(int Id)
{
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.Id == Id).FirstOrDefaultAsync();
if (user != null)
{
retVal = _mapper.Map<UserDTO>(user);
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
public async Task<List<UserDTO>> GetAllUserAsync()
{
var retVal = new List<UserDTO>
{
new UserDTO
{
RoleDTO = new List<RoleDTO>()
}
};
try
{
var users = await _dbContext.Users.ToListAsync();
if (users != null)
{
retVal = _mapper.Map<List<UserDTO>>(users);
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
public async Task<UserDTO> Authenticate(string userName, string password)
{
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.UserName == userName)
.FirstOrDefaultAsync();
if (user != null && PasswordHasher.VerifyPassword(user.PasswordHash, password))
{
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");
var secretKey = jwtSettings["SecretKey"];
var issuer = jwtSettings["Issuer"];
var audience = jwtSettings["Audience"];
var tokenLifetime = int.Parse(jwtSettings["TokenLifetimeMinutes"]);
var claims = new List<Claim>
{
new Claim(ClaimTypes.Name, userDTO.UserName),
new Claim(ClaimTypes.NameIdentifier, userDTO.Id.ToString())
};
foreach (var role in userDTO.RoleDTO)
{
claims.Add(new Claim(ClaimTypes.Role, role.RoleName));
}
var key = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(secretKey));
var creds = new SigningCredentials(key, SecurityAlgorithms.HmacSha256);
var token = new JwtSecurityToken(
issuer: issuer,
audience: audience,
claims: claims,
expires: DateTime.UtcNow.AddMinutes(tokenLifetime),
signingCredentials: creds);
return new JwtSecurityTokenHandler().WriteToken(token);
}
public async Task<UserDTO> UpdateUserAsync(UserDTO userDTO)
{
var retVal = new UserDTO() { RoleDTO = new List<RoleDTO>() };
try
{
if (userDTO.Id == 0)
{
var user = new User();
user.UserName = userDTO.UserName;
user.FirstName = userDTO.FirstName;
user.LastName = userDTO.LastName;
user.Email = userDTO.Email;
user.JwtToken = "";
user.PasswordHash = PasswordHasher.HashPassword(userDTO.Password);
_dbContext.Users.Add(user);
await _dbContext.SaveChangesAsync();
retVal = _mapper.Map<UserDTO>(user);
}
else
{
var user = await _dbContext.Users.Where(w => w.Id == userDTO.Id).FirstOrDefaultAsync();
if (user != null)
{
user.UserName = userDTO.UserName;
user.FirstName = userDTO.FirstName;
user.LastName = userDTO.LastName;
user.Email = userDTO.Email;
await _dbContext.SaveChangesAsync();
retVal = _mapper.Map<UserDTO>(user);
}
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
public async Task<RoleDTO> GetRoleAsync(int Id)
{
var retVal = new RoleDTO();
try
{
var user = await _dbContext.Roles.Where(w => w.Id == Id).FirstOrDefaultAsync();
if (user != null)
{
retVal = _mapper.Map<RoleDTO>(user);
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
public async Task<List<RoleDTO>> GetAllRoleAsync()
{
var retVal = new List<RoleDTO>();
try
{
var roles = await _dbContext.Roles.ToListAsync();
if (roles != null)
{
retVal = _mapper.Map<List<RoleDTO>>(roles);
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
public async Task<RoleDTO> UpdateRoleAsync(RoleDTO roleDTO)
{
var retVal = new RoleDTO();
try
{
if (roleDTO.Id == 0)
{
var role = new Role();
role.RoleName = roleDTO.RoleName;
_dbContext.Roles.Add(role);
await _dbContext.SaveChangesAsync();
retVal = _mapper.Map<RoleDTO>(role);
}
else
{
var role = await _dbContext.Roles.Where(w => w.Id == roleDTO.Id).FirstOrDefaultAsync();
if (role != null)
{
role.RoleName += roleDTO.RoleName;
await _dbContext.SaveChangesAsync();
retVal = _mapper.Map<RoleDTO>(role);
}
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
public async Task<UserRoleDTO> GetUserRoleAsync(int Id)
{
var retVal = new UserRoleDTO();
try
{
var userRole = await _dbContext.UserRoles.Where(w => w.Id == Id).FirstOrDefaultAsync();
if (userRole != null)
{
retVal = _mapper.Map<UserRoleDTO>(userRole);
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
public async Task<List<UserRoleDTO>> GetAllUserRoleAsync()
{
var retVal = new List<UserRoleDTO>();
try
{
var userRoles = await _dbContext.UserRoles
.Include(i => i.User)
.Include(i => i.Role)
.AsNoTracking()
.ToListAsync();
if (userRoles != null)
{
retVal = _mapper.Map<List<UserRoleDTO>>(userRoles);
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
public async Task<UserRoleDTO> UpdateUserRoleAsync(UserRoleDTO userRoleDTO)
{
var retVal = new UserRoleDTO();
try
{
if (userRoleDTO.Id == 0)
{
var userRole = new UserRole();
userRole.UserId = userRoleDTO.UserId;
userRole.RoleId = userRoleDTO.RoleId;
_dbContext.UserRoles.Add(userRole);
await _dbContext.SaveChangesAsync();
retVal = _mapper.Map<UserRoleDTO>(userRole);
}
else
{
var userRole = await _dbContext.UserRoles.Where(w => w.Id == userRoleDTO.Id).FirstOrDefaultAsync();
if (userRole != null)
{
userRole.UserId = userRoleDTO.UserId;
userRole.RoleId = userRoleDTO.RoleId;
await _dbContext.SaveChangesAsync();
retVal = _mapper.Map<UserRoleDTO>(userRole);
}
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
}
}
@@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AutoMapper" Version="13.0.1" />
<PackageReference Include="Serilog.AspNetCore" Version="8.0.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\WorkFlowCheck.Common\WorkFlowCheck.Common.csproj" />
<ProjectReference Include="..\WorkFlowCheck.DL\WorkFlowCheck.DL.csproj" />
</ItemGroup>
</Project>
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.Common.Constants
{
public static class MemoryCacheNames
{
public const string UsersNamePrefix = "Users_";
public const string TranslationsNamePrefix = "Translations_";
public const string Languages = "Languages";
}
}
@@ -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; }
}
}
@@ -0,0 +1,43 @@
using System.Text.Json.Serialization;
namespace WorkFlowCheck.Common.DTO
{
public class ApiResponseBaseDTO
{
public ApiResponseBaseDTO()
{
Errors = new List<string>();
}
public bool IsSuccess { get; set; }
public List<string> Errors { get; set; }
public bool HandleError { get; set; }
public string Error
{
get
{
if (Errors == null || Errors.Count() == 0) return string.Empty;
return string.Join(';', Errors);
}
}
}
public class ApiResponseDTO : ApiResponseBaseDTO
{
public object Data { get; set; }
}
public interface IApiResponseDTO<out T>
{
}
public class ApiResponseDTO<T> : ApiResponseBaseDTO, IApiResponseDTO<T>
{
public T Data { get; set; }
}
public class ApiResponseListDTO<T> : ApiResponseBaseDTO
{
public T[] Data { get; set; }
public int Total { get; set; }
}
}
@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.Common.DTO
{
public class CheckListHeaderDTO
{
public int Id { get; set; }
public int CheckListTemplateHeaderId { get; set; }
public CheckListTemplateHeaderDTO CheckListTemplateHeaderDTO { get; set; }
public DateTime DateExecution { get; set; }
public int UserId { get; set; }
public UserDTO UserDTO { get; set; }
public string ShortName { get; set; } = null!;
public string Description { get; set; } = null!;
public string DocumentNumber { get; set; } = null!;
public Guid GuidNumber { get; set; }
public bool IsStorno { get; set; }
public bool IsEditable { get; set; }
public required ICollection<CheckListRowDTO> CheckListRowDTO { get; set; } = new List<CheckListRowDTO>();
public CheckListHeaderDTO()
{
CheckListRowDTO = new List<CheckListRowDTO>();
}
}
}
@@ -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 CheckListHeaderNewDTO
{
public int CheckListTemplateHeaderId { get; set; }
public int UserId { get; set; }
}
}
@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.Common.DTO
{
public class CheckListRowDTO
{
public int Id { get; set; }
public int CheckListHeaderId { get; set; }
public int CheckListTemplateRowId { get; set; }
public CheckListTemplateRowDTO CheckListTemplateRowDTO { get; set; }
public string GroupName => $"AnswerGroup_{CheckListTemplateRowDTO.RowIndex}";
public string Answer { get; set; } = null!;
public bool? AnswerYes { get; set; } = null!;
public bool? AnswerNo { get; set; } = null!;
public byte[] Photo { get; set; } = null!;
public Guid GuidNumber { get; set; }
}
}
@@ -0,0 +1,13 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace WorkFlowCheck.Common.DTO
{
public class CheckListTemplateHeaderDTO
{
public int Id { get; set; }
public string ShortName { get; set; } = null!;
public string Description { get; set; } = null!;
public required ICollection<CheckListTemplateRowDTO> CheckListTemplateRowDTO { get; set; } = new List<CheckListTemplateRowDTO>();
}
}
@@ -0,0 +1,34 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace WorkFlowCheck.Common.DTO
{
public class CheckListTemplateRowDTO
{
public int Id { get; set; }
public int RowIndex { get; set; }
public int CheckListTemplateHeaderId { get; set; }
public int EquipmentId { get; set; }
public EquipmentDTO? EquipmentDTO { get; set; } = null!;
public int CheckPointId { get; set; }
public CheckPointDTO? CheckPointDTO { get; set; } = null!;
public string OperationDescription { get; set; } = null!;
/// <summary>
///
/// I-N (Igen, nem)
/// P (Fénykép készítése)
/// SI-N (Sárga igen,fehér nem)
/// I-SN (Fehér igen, sárga nem)
/// PI-N (Piros igen,fehér nem)
/// I-PN (Fehér igen, piros nem)
/// V (Érték megadása)
///
/// </summary>
public string AnswerType { get; set; } = null!;
}
}
@@ -0,0 +1,11 @@
namespace WorkFlowCheck.Common.DTO
{
public class CheckPointDTO
{
public int Id { get; set; }
public string ShortName { get; set; }
public string Code { get; set; }
public List<CheckListTemplateRowDTO> CheckListTemplateRowDTO { get; set; } = new List<CheckListTemplateRowDTO>();
}
}
@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.Common.DTO
{
public class EquipmentDTO
{
public int Id { get; set; }
public string ShortName { get; set; } = null!;
public string EquipmentNumber { get; set; } = null!;
}
}
@@ -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 LocationDTO
{
public int Id { get; set; }
public string FullName { get; set; } = null!;
}
}
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.Common.DTO
{
public class NumberGeneratorTemplateDTO
{
}
}
+8
View File
@@ -0,0 +1,8 @@
namespace WorkFlowCheck.Common.DTO
{
public class RoleDTO
{
public int Id { get; set; }
public string RoleName { get; set; } = null!;
}
}
@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.Common.DTO
{
public class User2FADTO
{
public int Id { get; set; }
public string UserName { get; set; } = null!;
public string Token2FA { get; set; } = null!;
}
}
+19
View File
@@ -0,0 +1,19 @@
using System.ComponentModel.DataAnnotations;
namespace WorkFlowCheck.Common.DTO
{
public class UserDTO
{
public int Id { get; set; }
public string Email { get; set; } = null!;
[Required(ErrorMessage = "Az utónév kötelező.")]
public string FirstName { get; set; } = null!;
[Required(ErrorMessage = "Az vezetéknév kötelező.")]
public string LastName { get; set; } = null!;
[Required(ErrorMessage = "A felhasználónév kötelező.")]
public string UserName { get;set; } = null!;
public string Password { get; set; }
public string JwtToken { get; set; } = null!;
public required ICollection<RoleDTO> RoleDTO { get; set; } = new List<RoleDTO>();
}
}
@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.Common.DTO
{
public class UserRoleDTO
{
public int Id { get; set; }
public int? RoleId { get; set; } = 0;
public RoleDTO RoleDTO { get; set; }
public int UserId { get; set; }
public UserDTO UserDTO { get; set; }
}
}
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.Common.DTO
{
public class UserSimpleDTO
{
[Required(ErrorMessage = "A felhasználónév kötelező.")]
public string UserName { get; set; } = null!;
[Required(ErrorMessage = "A jelszó megadása kötelező.")]
public string Password { get; set; }
}
}
@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.Common.RequestContext
{
public interface IRequestContext
{
string TraceId { get; }
string CurrentUsername { get; }
string CurrentUserEmail { get; }
int? CurrentUserId { get; }
CancellationToken RequestAborted { get; }
}
}
@@ -0,0 +1,55 @@
using System;
using System.Collections.Generic;
using System.Data.SqlTypes;
using System.Linq;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.Common.Security
{
public static class PasswordHasher
{
// Jelszó hashelése
private const string _saltstring = "xc45DDfrt!!ED210:";
public static string HashPassword(string password)
{
// Generate a random salt
byte[] salt = Encoding.UTF8.GetBytes(_saltstring);
// Hash the password with the salt
using (var rfc2898 = new Rfc2898DeriveBytes(password, salt, 10000, HashAlgorithmName.SHA256))
{
byte[] hash = rfc2898.GetBytes(32); // 256-bit hash
byte[] hashBytes = new byte[48]; // Salt (16 bytes) + Hash (32 bytes)
Array.Copy(salt, 0, hashBytes, 0, 16);
Array.Copy(hash, 0, hashBytes, 16, 32);
return Convert.ToBase64String(hashBytes);
}
}
// Jelszó ellenőrzése
public static bool VerifyPassword(string storedPasswordHash, string inputPassword)
{
byte[] hashBytes = Convert.FromBase64String(storedPasswordHash);
// Extract salt (first 16 bytes) and stored hash (next 32 bytes)
byte[] salt = Encoding.UTF8.GetBytes(_saltstring);
byte[] storedHash = new byte[32];
Array.Copy(hashBytes, 0, salt, 0, 16);
Array.Copy(hashBytes, 16, storedHash, 0, 32);
// Hash the input password with the same salt
using (var rfc2898 = new Rfc2898DeriveBytes(inputPassword, salt, 10000, HashAlgorithmName.SHA256))
{
byte[] inputHash = rfc2898.GetBytes(32);
// Compare the stored hash and the calculated hash
return CryptographicOperations.FixedTimeEquals(storedHash, inputHash);
}
}
}
}
@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>
+194
View File
@@ -0,0 +1,194 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.ChangeTracking;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WorkFlowCheck.Common.RequestContext;
using WorkFlowCheck.Common.Security;
using WorkFlowCheck.DL.Configurations;
using WorkFlowCheck.DL.Entities;
using WorkFlowCheck.DL.Extensions;
using WorkFlowCheck.DL.Interfaces;
namespace WorkFlowCheck.DL
{
public class AppDbContext : DbContext
{
private readonly IRequestContext _requestContext;
public AppDbContext(DbContextOptions<AppDbContext> options, IRequestContext requestContext)
: base(options)
{
_requestContext = requestContext;
}
#if !DEBUG
private dynamic _requestContext;
public AppDbContext(DbContextOptions<AppDbContext> options)
: base(options)
{
_requestContext = new { CurrentUserEmail = "", CurrentUsername = "admin", TraceId = 0 };
}
#endif
#region Entities DbSet
public DbSet<Entities.CheckListHeader> CheckListHeaders { get; set; } = null!;
public DbSet<Entities.CheckListRow> CheckListRows { get; set; } = null!;
public DbSet<Entities.CheckListTemplateHeader> CheckListTemplateHeaders { get; set; } = null!;
public DbSet<Entities.CheckListTemplateRow> CheckListTemplateRows { get; set; } = null!;
public DbSet<Entities.CheckPoint> CheckPoints { get; set; } = null!;
public DbSet<Entities.Equipment> Equipments { get; set; } = null!;
public DbSet<Entities.Location> Locations { get; set; } = null!;
public DbSet<Entities.NumberGeneratorTemplate> NumberGeneratorTemplates { get; set; } = null!;
public DbSet<Entities.NumberGeneratorTemplateDate> NumberGeneratorTemplateDatess { get; set; } = null!;
public DbSet<Entities.Role> Roles { get; set; } = null!;
public DbSet<Entities.User> Users { get; set; } = null!;
public DbSet<Entities.UserRole> UserRoles { get; set; } = null!;
public DbSet<Entities.RoleCheckListTemplateHeader> RoleCheckListTemplateHeaders { get; set; } = null!;
#endregion
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.ApplyConfiguration(new CheckListHeaderTypeConfiguration());
modelBuilder.ApplyConfiguration(new CheckListRowTypeConfiguration());
modelBuilder.ApplyConfiguration(new CheckListTemplateHeaderTypeConfiguration());
modelBuilder.ApplyConfiguration(new CheckListTemplateRowTypeConfiguration());
modelBuilder.ApplyConfiguration(new CheckPointTypeConfiguration());
modelBuilder.ApplyConfiguration(new EquipmentTypeConfiguration());
modelBuilder.ApplyConfiguration(new LocationTypeConfiguration());
modelBuilder.ApplyConfiguration(new NumberGeneratorTypeConfiguration());
modelBuilder.ApplyConfiguration(new NumberGeneratorDateTypeConfiguration());
modelBuilder.ApplyConfiguration(new RoleTypeConfiguration());
modelBuilder.ApplyConfiguration(new RoleCheckListTemplateHeaderTypeConfiguration());
modelBuilder.ApplyConfiguration(new UserTypeConfiguration());
modelBuilder.ApplyConfiguration(new UserRoleTypeConfiguration());
modelBuilder.RegisterSoftDeleteQueryFilters();
SeedInit(modelBuilder);
}
public override async Task<int> SaveChangesAsync(CancellationToken cancellationToken = default)
{
SaveChangesCore();
return await base.SaveChangesAsync(cancellationToken);
}
protected virtual void SaveChangesCore()
{
var utcNow = DateTime.UtcNow;
var deletedEntries = ChangeTracker
.Entries()
.Where(e => e.Entity is ISoftDeletableEntity && e.State == EntityState.Deleted);
UpdateDeletedEntries(deletedEntries);
var modifiedEntries = ChangeTracker
.Entries()
.Where(e => e.Entity is IAuditableEntity && e.State == EntityState.Modified);
UpdateModifiedEntires(modifiedEntries, utcNow);
var addedEntries = ChangeTracker
.Entries()
.Where(e => e.Entity is IAuditableEntity && e.State == EntityState.Added);
UpdateAddedEntries(addedEntries, utcNow);
}
private void UpdateAddedEntries(IEnumerable<EntityEntry> addedEntries, DateTime utcNow)
{
foreach (var entry in addedEntries)
{
((IAuditableEntity)entry.Entity).CreatedAt = utcNow;
((IAuditableEntity)entry.Entity).LastModAt = utcNow;
((IAuditableEntity)entry.Entity).CreatedBy = _requestContext.CurrentUsername ?? "Admin";
((IAuditableEntity)entry.Entity).LastModBy = _requestContext.CurrentUsername ?? "Admin";
}
}
private void UpdateModifiedEntires(IEnumerable<EntityEntry> modifiedEntries, DateTime utcNow)
{
foreach (var entry in modifiedEntries)
{
((IAuditableEntity)entry.Entity).LastModAt = utcNow;
((IAuditableEntity)entry.Entity).LastModBy = _requestContext.CurrentUsername ?? "Admin";
}
}
private void UpdateDeletedEntries(IEnumerable<EntityEntry> deletedEntries)
{
foreach (var entry in deletedEntries)
{
((ISoftDeletableEntity)entry.Entity).IsDeleted = true;
entry.State = EntityState.Modified;
}
}
private void SeedInit(ModelBuilder modelBuilder)
{
modelBuilder.Entity<User>().HasData(
new User
{
Id = 1,
Email = "admin@nuvolar.hu",
FirstName = "Administrator",
LastName = "System",
IsDeleted = false,
UserName = "admin",
PasswordHash = PasswordHasher.HashPassword("111111"),
CreatedAt = DateTime.UtcNow,
CreatedBy = "System",
LastModAt = DateTime.UtcNow,
LastModBy = "System",
JwtToken = "",
Active = true,
Token2FA = ""
},
new User
{
Id = 2,
Email = "user@nuvolar.hu",
FirstName = "User",
LastName = "System",
IsDeleted = false,
UserName = "user",
PasswordHash = PasswordHasher.HashPassword("222222"),
CreatedAt = DateTime.UtcNow,
CreatedBy = "System",
LastModAt = DateTime.UtcNow,
LastModBy = "System",
JwtToken = "",
Active = true,
Token2FA = ""
}
);
modelBuilder.Entity<NumberGeneratorTemplate>().HasData(
new NumberGeneratorTemplate
{
Id = 1,
CurrentNumber = 0,
DigitFormat = "D4",
GenerateType = GenerateType.OnlyYear,
LastGeneratedNumber = "",
Prefix = "CHK",
PrefixSeparator = "-",
ShortName = "Ellenőrzési dokumentum sorszámozása",
Suffix = "",
SuffixSeparator = "-",
}
);
modelBuilder.Entity<NumberGeneratorTemplateDate>().HasData(
new NumberGeneratorTemplateDate
{
Id = 1,
CurrentNumber = 0,
LastGeneratedNumber = "",
Month = 0,
Year = 1,
NumberGeneratorTemplateId = 1,
}
);
}
}
}
@@ -0,0 +1,21 @@
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
{
public class CheckListHeaderTypeConfiguration : IEntityTypeConfiguration<Entities.CheckListHeader>
{
public void Configure(EntityTypeBuilder<Entities.CheckListHeader> builder)
{
builder.ToTable("CheckListHeader");
builder.HasKey(e => e.Id);
builder.Property(e => e.Id).ValueGeneratedOnAdd();
}
}
}
@@ -0,0 +1,21 @@
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
{
public class CheckListRowTypeConfiguration : IEntityTypeConfiguration<Entities.CheckListRow>
{
public void Configure(EntityTypeBuilder<Entities.CheckListRow> builder)
{
builder.ToTable("CheckListRow");
builder.HasKey(e => e.Id);
builder.Property(e => e.Id).ValueGeneratedOnAdd();
}
}
}
@@ -0,0 +1,21 @@
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
{
public class CheckListTemplateHeaderTypeConfiguration : IEntityTypeConfiguration<Entities.CheckListTemplateHeader>
{
public void Configure(EntityTypeBuilder<Entities.CheckListTemplateHeader> builder)
{
builder.ToTable("CheckListTemplateHeader");
builder.HasKey(e => e.Id);
builder.Property(e => e.Id).ValueGeneratedOnAdd();
}
}
}
@@ -0,0 +1,21 @@
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
{
public class CheckListTemplateRowTypeConfiguration : IEntityTypeConfiguration<Entities.CheckListTemplateRow>
{
public void Configure(EntityTypeBuilder<Entities.CheckListTemplateRow> builder)
{
builder.ToTable("CheckListTemplateRow");
builder.HasKey(e => e.Id);
builder.Property(e => e.Id).ValueGeneratedOnAdd();
}
}
}
@@ -0,0 +1,21 @@
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
{
public class CheckPointTypeConfiguration : IEntityTypeConfiguration<Entities.CheckPoint>
{
public void Configure(EntityTypeBuilder<Entities.CheckPoint> builder)
{
builder.ToTable("CheckPoint");
builder.HasKey(e => e.Id);
builder.Property(e => e.Id).ValueGeneratedOnAdd();
}
}
}
@@ -0,0 +1,21 @@
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
{
public class EquipmentTypeConfiguration : IEntityTypeConfiguration<Entities.Equipment>
{
public void Configure(EntityTypeBuilder<Entities.Equipment> builder)
{
builder.ToTable("Equipment");
builder.HasKey(e => e.Id);
builder.Property(e => e.Id).ValueGeneratedOnAdd();
}
}
}
@@ -0,0 +1,21 @@
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
{
public class LocationTypeConfiguration : IEntityTypeConfiguration<Entities.Location>
{
public void Configure(EntityTypeBuilder<Entities.Location> builder)
{
builder.ToTable("Location");
builder.HasKey(e => e.Id);
builder.Property(e => e.Id).ValueGeneratedOnAdd();
}
}
}
@@ -0,0 +1,29 @@
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
{
public class NumberGeneratorTypeConfiguration : IEntityTypeConfiguration<Entities.NumberGeneratorTemplate>
{
public void Configure(EntityTypeBuilder<Entities.NumberGeneratorTemplate> builder)
{
builder.ToTable("NumberGeneratorTemplate");
builder.HasKey(e => e.Id);
builder.Property(e => e.Id).ValueGeneratedOnAdd();
}
}
public class NumberGeneratorDateTypeConfiguration : IEntityTypeConfiguration<Entities.NumberGeneratorTemplateDate>
{
public void Configure(EntityTypeBuilder<Entities.NumberGeneratorTemplateDate> builder)
{
builder.ToTable("NumberGeneratorTemplateDate");
builder.HasKey(e => e.Id);
builder.Property(e => e.Id).ValueGeneratedOnAdd();
}
}
}
@@ -0,0 +1,21 @@
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
{
public class RoleCheckListTemplateHeaderTypeConfiguration : IEntityTypeConfiguration<Entities.RoleCheckListTemplateHeader>
{
public void Configure(EntityTypeBuilder<Entities.RoleCheckListTemplateHeader> builder)
{
builder.ToTable("RoleCheckListTemplateHeader");
builder.HasKey(e => e.Id);
builder.Property(e => e.Id).ValueGeneratedOnAdd();
}
}
}
@@ -0,0 +1,21 @@
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
{
public class RoleTypeConfiguration : IEntityTypeConfiguration<Entities.Role>
{
public void Configure(EntityTypeBuilder<Entities.Role> builder)
{
builder.ToTable("Roles");
builder.HasKey(e => e.Id);
builder.Property(e => e.Id).ValueGeneratedOnAdd();
}
}
}
@@ -0,0 +1,21 @@
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
{
public class UserRoleTypeConfiguration : IEntityTypeConfiguration<Entities.UserRole>
{
public void Configure(EntityTypeBuilder<Entities.UserRole> builder)
{
builder.ToTable("UserRoles");
builder.HasKey(e => e.Id);
builder.Property(e => e.Id).ValueGeneratedOnAdd();
}
}
}
@@ -0,0 +1,21 @@
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
{
public class UserTypeConfiguration : IEntityTypeConfiguration<Entities.User>
{
public void Configure(EntityTypeBuilder<Entities.User> builder)
{
builder.ToTable("Users");
builder.HasKey(e => e.Id);
builder.Property(e => e.Id).ValueGeneratedOnAdd();
}
}
}
@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WorkFlowCheck.DL.Interfaces;
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 DateTime DateExecution { get; set; }
public int UserId { get; set; }
public virtual User User { get; set; }
public string ShortName { get; set; } = null!;
public string Description { get; set; } = null!;
public string DocumentNumber { get; set; } = null!;
public Guid GuidNumber { get; set; }
public bool IsStorno { get; set; }
public bool IsEditable { 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 virtual ICollection<CheckListRow> CheckListRows { get; set; }
}
}
@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WorkFlowCheck.DL.Interfaces;
namespace WorkFlowCheck.DL.Entities
{
public class CheckListRow : ISoftDeletableEntity, IAuditableEntity
{
public int Id { get; set; }
public int CheckListHeaderId { get; set; }
public virtual CheckListHeader CheckListHeader { get; set; } = null!;
public int CheckListTemplateRowId { get; set; }
public virtual CheckListTemplateRow CheckListTemplateRow { get; set; } = null!;
public string Answer { get; set; } = null!;
public byte[] Photo { get; set; } = null!;
public Guid GuidNumber { 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; }
}
}
@@ -0,0 +1,25 @@
using WorkFlowCheck.DL.Interfaces;
namespace WorkFlowCheck.DL.Entities
{
public class CheckListTemplateHeader : ISoftDeletableEntity, IAuditableEntity
{
public int Id { get; set; }
public string ShortName { get; set; } = null!;
public string Description { 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!;
public int? NumberGenerator1Id { get; set; }
public int? NumberGenerator2Id { get; set; }
public NumberGeneratorTemplate NumberGenerator1 { get; set; }
public NumberGeneratorTemplate NumberGenerator2 { get; set; }
public virtual ICollection<CheckListTemplateRow> CheckListTemplateRows { get; set; } = new List<CheckListTemplateRow>();
}
}
@@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WorkFlowCheck.DL.Interfaces;
namespace WorkFlowCheck.DL.Entities
{
public class CheckListTemplateRow : ISoftDeletableEntity, IAuditableEntity
{
public int Id { get; set; }
public int RowIndex { get; set; }
public int CheckListTemplateHeaderId { get; set; }
public virtual CheckListTemplateHeader CheckListTemplateHeader { get; set; }
public int EquipmentId { get; set; }
public virtual Equipment Equipment { get; set; }
public int CheckPointId { get; set; }
public virtual CheckPoint CheckPoint { get; set; }
public string OperationDescription { get; set; } = null!;
/// <summary>
///
/// I-N (Igen, nem)
/// P (Fénykép készítése)
/// SI-N (Sárga igen,fehér nem)
/// I-SN (Fehér igen, sárga nem)
/// PI-N (Piros igen,fehér nem)
/// I-PN (Fehér igen, piros nem)
///
/// </summary>
public string AnswerType { 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,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WorkFlowCheck.DL.Interfaces;
namespace WorkFlowCheck.DL.Entities
{
public class CheckPoint : ISoftDeletableEntity, IAuditableEntity
{
public int Id { get; set; }
public string ShortName { get; set; }
public string Code { get; set; }
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 virtual ICollection<CheckListTemplateRow> CheckListTemplateRows { get; set; } = new List<CheckListTemplateRow>();
}
}
@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WorkFlowCheck.DL.Interfaces;
namespace WorkFlowCheck.DL.Entities
{
public class Equipment :ISoftDeletableEntity,IAuditableEntity
{
public int Id { get; set; }
public string ShortName { get; set; } = null!;
public string EquipmentNumber { 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!;
}
}
+20
View File
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WorkFlowCheck.DL.Interfaces;
namespace WorkFlowCheck.DL.Entities
{
public class Location : ISoftDeletableEntity, IAuditableEntity
{
public int Id { get; set; }
public string FullName { 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,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.DL.Entities
{
public enum GenerateType
{
OnlyYear = 0,
YearAndMonth = 1
}
public class NumberGeneratorTemplate
{
public int Id { get; set; }
public string ShortName { get; set; }
public string Prefix { get; set; }
public string PrefixSeparator { get; set; }
public string DigitFormat { get; set; }
public string SuffixSeparator { get; set; }
public string Suffix { get; set; }
public int CurrentNumber { get; set; }
public string LastGeneratedNumber { get; set; }
public GenerateType GenerateType { get; set; }
public virtual ICollection<NumberGeneratorTemplateDate> NumberGeneratorTemplateDates { get; set; }
}
}
@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.DL.Entities
{
public class NumberGeneratorTemplateDate
{
public int Id { get; set; }
public int NumberGeneratorTemplateId { get; set; }
public virtual NumberGeneratorTemplate NumberGeneratorTemplate { get; set; }
public int Year { get; set; }
public int? Month { get; set; } // csak ha YearAndMonth
public int CurrentNumber { get; set; }
public string LastGeneratedNumber { get; set; }
}
}
+24
View File
@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using WorkFlowCheck.DL.Interfaces;
namespace WorkFlowCheck.DL.Entities
{
public class Role :ISoftDeletableEntity,IAuditableEntity
{
public int Id { get; set; }
public string RoleName { get; set; } = null!;
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!;
}
}
@@ -0,0 +1,14 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace WorkFlowCheck.DL.Entities
{
public class RoleCheckListTemplateHeader
{
public int Id { get; set; }
public int RoleId { get; set; }
public virtual Role Role { get; set; } = null!;
public int CheckListTemplateHeaderId { get; set; }
public virtual CheckListTemplateHeader CheckListTemplateHeader { get; set; } = null!;
public bool Enabled { get; set; } = false;
}
}
+26
View File
@@ -0,0 +1,26 @@
using System.ComponentModel.DataAnnotations.Schema;
using WorkFlowCheck.DL.Interfaces;
namespace WorkFlowCheck.DL.Entities
{
public class User : IAuditableEntity, ISoftDeletableEntity
{
public int Id { get; set; }
public string Email { get; set; } = null!;
public string FirstName { get; set; } = null!;
public string LastName { get; set; } = null!;
public string UserName { get; set; } = null!;
public string? PasswordHash { get; set; } = null;
public string JwtToken { get; set; } = null!;
public string Token2FA { get; set; } = null!;
public bool Active { get; set; }
public virtual ICollection<UserRole> UserRoles { get; set; } = new List<UserRole>();
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; }
}
}
+17
View File
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.DL.Entities
{
public class UserRole
{
public int Id { get; set; }
public int? RoleId { get; set; } = 0;
public virtual Role Role { get; set; } = null!;
public int UserId { get; set; }
public virtual User User { get; set; } = null!;
}
}
@@ -0,0 +1,28 @@
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using WorkFlowCheck.DL.Interfaces;
namespace WorkFlowCheck.DL.Extensions
{
public static class DbContextExtensions
{
public static void RegisterSoftDeleteQueryFilters(this ModelBuilder modelBuilder)
{
foreach (var entityType in modelBuilder.Model.GetEntityTypes().Where(e => typeof(ISoftDeletableEntity).IsAssignableFrom(e.ClrType)))
{
var parameter = Expression.Parameter(entityType.ClrType);
var softDeletableProperty = Expression.Property(parameter, nameof(ISoftDeletableEntity.IsDeleted));
var compareExpression = Expression.MakeBinary(ExpressionType.Equal, softDeletableProperty, Expression.Constant(false));
var lambda = Expression.Lambda(compareExpression, parameter);
modelBuilder.Entity(entityType.ClrType).HasQueryFilter(lambda);
}
}
}
}
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.DL.Interfaces
{
public interface IAuditableEntity
{
public DateTime LastModAt { get; set; }
public string LastModBy { get; set; }
public DateTime CreatedAt { get; set; }
public string CreatedBy { get; set; }
}
}
@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorkFlowCheck.DL.Interfaces
{
public interface ISoftDeletableEntity
{
public bool IsDeleted { get; set; }
}
}
@@ -0,0 +1,516 @@
// <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("20250219111008_InitialCreate")]
partial class InitialCreate
{
/// <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<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<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.ToTable("CheckListHeader", (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<int?>("CheckListHeaderId")
.HasColumnType("int");
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("CheckListHeaderId");
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, 2, 19, 11, 10, 8, 377, DateTimeKind.Utc).AddTicks(26),
CreatedBy = "System",
Email = "admin@nuvolar.hu",
FirstName = "Administrator",
IsDeleted = false,
LastModAt = new DateTime(2025, 2, 19, 11, 10, 8, 377, DateTimeKind.Utc).AddTicks(29),
LastModBy = "System",
LastName = "System",
PasswordHash = "eGM0NUREZnJ0ISFFRDIxMKE5TYwthDBuUsTUEO1fBnCR3VdSCmdz47ue0RoVvnkY",
UserName = "admin"
},
new
{
Id = 2,
CreatedAt = new DateTime(2025, 2, 19, 11, 10, 8, 389, DateTimeKind.Utc).AddTicks(2814),
CreatedBy = "System",
Email = "user@nuvolar.hu",
FirstName = "User",
IsDeleted = false,
LastModAt = new DateTime(2025, 2, 19, 11, 10, 8, 389, DateTimeKind.Utc).AddTicks(2817),
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");
});
modelBuilder.Entity("WorkFlowCheck.DL.Entities.CheckListTemplateRow", b =>
{
b.HasOne("WorkFlowCheck.DL.Entities.CheckListHeader", null)
.WithMany("CheckListTemplateRows")
.HasForeignKey("CheckListHeaderId");
b.HasOne("WorkFlowCheck.DL.Entities.CheckListTemplateHeader", "CheckListTemplateHeader")
.WithMany()
.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("CheckListTemplateRows");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,335 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
namespace WorkFlowCheck.DL.Migrations
{
/// <inheritdoc />
public partial class InitialCreate : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "CheckListHeader",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
ShortName = table.Column<string>(type: "nvarchar(max)", nullable: false),
Description = table.Column<string>(type: "nvarchar(max)", nullable: false),
DocumentNumber = table.Column<string>(type: "nvarchar(max)", nullable: false),
IsStorno = table.Column<bool>(type: "bit", nullable: false),
LastModAt = table.Column<DateTime>(type: "datetime2", nullable: false),
LastModBy = table.Column<string>(type: "nvarchar(max)", nullable: false),
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatedBy = table.Column<string>(type: "nvarchar(max)", nullable: false),
IsDeleted = table.Column<bool>(type: "bit", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CheckListHeader", x => x.Id);
});
migrationBuilder.CreateTable(
name: "CheckListTemplateHeader",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
ShortName = table.Column<string>(type: "nvarchar(max)", nullable: false),
Description = table.Column<string>(type: "nvarchar(max)", nullable: false),
IsDeleted = table.Column<bool>(type: "bit", nullable: false),
LastModAt = table.Column<DateTime>(type: "datetime2", nullable: false),
LastModBy = table.Column<string>(type: "nvarchar(max)", nullable: false),
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatedBy = table.Column<string>(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CheckListTemplateHeader", x => x.Id);
});
migrationBuilder.CreateTable(
name: "CheckPoint",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
ShortName = table.Column<string>(type: "nvarchar(max)", nullable: false),
Code = table.Column<string>(type: "nvarchar(max)", nullable: false),
IsDeleted = table.Column<bool>(type: "bit", nullable: false),
LastModAt = table.Column<DateTime>(type: "datetime2", nullable: false),
LastModBy = table.Column<string>(type: "nvarchar(max)", nullable: false),
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatedBy = table.Column<string>(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CheckPoint", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Equipment",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
ShortName = table.Column<string>(type: "nvarchar(max)", nullable: false),
EquipmentNumber = table.Column<string>(type: "nvarchar(max)", nullable: false),
IsDeleted = table.Column<bool>(type: "bit", nullable: false),
LastModAt = table.Column<DateTime>(type: "datetime2", nullable: false),
LastModBy = table.Column<string>(type: "nvarchar(max)", nullable: false),
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatedBy = table.Column<string>(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Equipment", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Location",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
FullName = table.Column<string>(type: "nvarchar(max)", nullable: false),
IsDeleted = table.Column<bool>(type: "bit", nullable: false),
LastModAt = table.Column<DateTime>(type: "datetime2", nullable: false),
LastModBy = table.Column<string>(type: "nvarchar(max)", nullable: false),
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatedBy = table.Column<string>(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Location", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Roles",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
RoleName = table.Column<string>(type: "nvarchar(max)", nullable: false),
IsDeleted = table.Column<bool>(type: "bit", nullable: false),
LastModAt = table.Column<DateTime>(type: "datetime2", nullable: false),
LastModBy = table.Column<string>(type: "nvarchar(max)", nullable: false),
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatedBy = table.Column<string>(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Roles", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Users",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Email = table.Column<string>(type: "nvarchar(max)", nullable: false),
FirstName = table.Column<string>(type: "nvarchar(max)", nullable: false),
LastName = table.Column<string>(type: "nvarchar(max)", nullable: false),
UserName = table.Column<string>(type: "nvarchar(max)", nullable: false),
PasswordHash = table.Column<string>(type: "nvarchar(max)", nullable: true),
LastModAt = table.Column<DateTime>(type: "datetime2", nullable: false),
LastModBy = table.Column<string>(type: "nvarchar(max)", nullable: false),
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatedBy = table.Column<string>(type: "nvarchar(max)", nullable: false),
IsDeleted = table.Column<bool>(type: "bit", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Users", x => x.Id);
});
migrationBuilder.CreateTable(
name: "CheckListTemplateRow",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
RowIndex = table.Column<int>(type: "int", nullable: false),
CheckListTemplateHeaderId = table.Column<int>(type: "int", nullable: false),
EquipmentId = table.Column<int>(type: "int", nullable: false),
CheckPointId = table.Column<int>(type: "int", nullable: false),
OperationDescription = table.Column<string>(type: "nvarchar(max)", nullable: false),
IsDeleted = table.Column<bool>(type: "bit", nullable: false),
LastModAt = table.Column<DateTime>(type: "datetime2", nullable: false),
LastModBy = table.Column<string>(type: "nvarchar(max)", nullable: false),
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatedBy = table.Column<string>(type: "nvarchar(max)", nullable: false),
CheckListHeaderId = table.Column<int>(type: "int", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_CheckListTemplateRow", x => x.Id);
table.ForeignKey(
name: "FK_CheckListTemplateRow_CheckListHeader_CheckListHeaderId",
column: x => x.CheckListHeaderId,
principalTable: "CheckListHeader",
principalColumn: "Id");
table.ForeignKey(
name: "FK_CheckListTemplateRow_CheckListTemplateHeader_CheckListTemplateHeaderId",
column: x => x.CheckListTemplateHeaderId,
principalTable: "CheckListTemplateHeader",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_CheckListTemplateRow_CheckPoint_CheckPointId",
column: x => x.CheckPointId,
principalTable: "CheckPoint",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_CheckListTemplateRow_Equipment_EquipmentId",
column: x => x.EquipmentId,
principalTable: "Equipment",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "RoleCheckListTemplateHeader",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
RoleId = table.Column<int>(type: "int", nullable: false),
CheckListTemplateHeaderId = table.Column<int>(type: "int", nullable: false),
Enabled = table.Column<bool>(type: "bit", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_RoleCheckListTemplateHeader", x => x.Id);
table.ForeignKey(
name: "FK_RoleCheckListTemplateHeader_CheckListTemplateHeader_CheckListTemplateHeaderId",
column: x => x.CheckListTemplateHeaderId,
principalTable: "CheckListTemplateHeader",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_RoleCheckListTemplateHeader_Roles_RoleId",
column: x => x.RoleId,
principalTable: "Roles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "UserRoles",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
RoleId = table.Column<int>(type: "int", nullable: false),
UserId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_UserRoles", x => x.Id);
table.ForeignKey(
name: "FK_UserRoles_Roles_RoleId",
column: x => x.RoleId,
principalTable: "Roles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_UserRoles_Users_UserId",
column: x => x.UserId,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.InsertData(
table: "Users",
columns: new[] { "Id", "CreatedAt", "CreatedBy", "Email", "FirstName", "IsDeleted", "LastModAt", "LastModBy", "LastName", "PasswordHash", "UserName" },
values: new object[,]
{
{ 1, new DateTime(2025, 2, 19, 11, 10, 8, 377, DateTimeKind.Utc).AddTicks(26), "System", "admin@nuvolar.hu", "Administrator", false, new DateTime(2025, 2, 19, 11, 10, 8, 377, DateTimeKind.Utc).AddTicks(29), "System", "System", "eGM0NUREZnJ0ISFFRDIxMKE5TYwthDBuUsTUEO1fBnCR3VdSCmdz47ue0RoVvnkY", "admin" },
{ 2, new DateTime(2025, 2, 19, 11, 10, 8, 389, DateTimeKind.Utc).AddTicks(2814), "System", "user@nuvolar.hu", "User", false, new DateTime(2025, 2, 19, 11, 10, 8, 389, DateTimeKind.Utc).AddTicks(2817), "System", "System", "eGM0NUREZnJ0ISFFRDIxMPwM2D9sQSj7zmaSBIsOGe0I9hBFwCGPVbyrYMA5EnKG", "user" }
});
migrationBuilder.CreateIndex(
name: "IX_CheckListTemplateRow_CheckListHeaderId",
table: "CheckListTemplateRow",
column: "CheckListHeaderId");
migrationBuilder.CreateIndex(
name: "IX_CheckListTemplateRow_CheckListTemplateHeaderId",
table: "CheckListTemplateRow",
column: "CheckListTemplateHeaderId");
migrationBuilder.CreateIndex(
name: "IX_CheckListTemplateRow_CheckPointId",
table: "CheckListTemplateRow",
column: "CheckPointId");
migrationBuilder.CreateIndex(
name: "IX_CheckListTemplateRow_EquipmentId",
table: "CheckListTemplateRow",
column: "EquipmentId");
migrationBuilder.CreateIndex(
name: "IX_RoleCheckListTemplateHeader_CheckListTemplateHeaderId",
table: "RoleCheckListTemplateHeader",
column: "CheckListTemplateHeaderId");
migrationBuilder.CreateIndex(
name: "IX_RoleCheckListTemplateHeader_RoleId",
table: "RoleCheckListTemplateHeader",
column: "RoleId");
migrationBuilder.CreateIndex(
name: "IX_UserRoles_RoleId",
table: "UserRoles",
column: "RoleId");
migrationBuilder.CreateIndex(
name: "IX_UserRoles_UserId",
table: "UserRoles",
column: "UserId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "CheckListTemplateRow");
migrationBuilder.DropTable(
name: "Location");
migrationBuilder.DropTable(
name: "RoleCheckListTemplateHeader");
migrationBuilder.DropTable(
name: "UserRoles");
migrationBuilder.DropTable(
name: "CheckListHeader");
migrationBuilder.DropTable(
name: "CheckPoint");
migrationBuilder.DropTable(
name: "Equipment");
migrationBuilder.DropTable(
name: "CheckListTemplateHeader");
migrationBuilder.DropTable(
name: "Roles");
migrationBuilder.DropTable(
name: "Users");
}
}
}
@@ -0,0 +1,570 @@
// <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("20250219115948_Extend001")]
partial class Extend001
{
/// <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<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<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.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<bool>("IsDeleted")
.HasColumnType("bit");
b.Property<DateTime>("LastModAt")
.HasColumnType("datetime2");
b.Property<string>("LastModBy")
.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<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<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, 2, 19, 11, 59, 47, 916, DateTimeKind.Utc).AddTicks(948),
CreatedBy = "System",
Email = "admin@nuvolar.hu",
FirstName = "Administrator",
IsDeleted = false,
LastModAt = new DateTime(2025, 2, 19, 11, 59, 47, 916, DateTimeKind.Utc).AddTicks(951),
LastModBy = "System",
LastName = "System",
PasswordHash = "eGM0NUREZnJ0ISFFRDIxMKE5TYwthDBuUsTUEO1fBnCR3VdSCmdz47ue0RoVvnkY",
UserName = "admin"
},
new
{
Id = 2,
CreatedAt = new DateTime(2025, 2, 19, 11, 59, 47, 927, DateTimeKind.Utc).AddTicks(3684),
CreatedBy = "System",
Email = "user@nuvolar.hu",
FirstName = "User",
IsDeleted = false,
LastModAt = new DateTime(2025, 2, 19, 11, 59, 47, 927, DateTimeKind.Utc).AddTicks(3685),
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.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()
.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");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,122 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace WorkFlowCheck.DL.Migrations
{
/// <inheritdoc />
public partial class Extend001 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_CheckListTemplateRow_CheckListHeader_CheckListHeaderId",
table: "CheckListTemplateRow");
migrationBuilder.DropIndex(
name: "IX_CheckListTemplateRow_CheckListHeaderId",
table: "CheckListTemplateRow");
migrationBuilder.DropColumn(
name: "CheckListHeaderId",
table: "CheckListTemplateRow");
migrationBuilder.CreateTable(
name: "CheckListRow",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
CheckListHeaderId = table.Column<int>(type: "int", nullable: false),
CheckListTemplateRowId = table.Column<int>(type: "int", nullable: false),
Answer = table.Column<string>(type: "nvarchar(max)", nullable: false),
LastModAt = table.Column<DateTime>(type: "datetime2", nullable: false),
LastModBy = table.Column<string>(type: "nvarchar(max)", nullable: false),
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatedBy = table.Column<string>(type: "nvarchar(max)", nullable: false),
IsDeleted = table.Column<bool>(type: "bit", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CheckListRow", x => x.Id);
table.ForeignKey(
name: "FK_CheckListRow_CheckListHeader_CheckListHeaderId",
column: x => x.CheckListHeaderId,
principalTable: "CheckListHeader",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_CheckListRow_CheckListTemplateRow_CheckListTemplateRowId",
column: x => x.CheckListTemplateRowId,
principalTable: "CheckListTemplateRow",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.UpdateData(
table: "Users",
keyColumn: "Id",
keyValue: 1,
columns: new[] { "CreatedAt", "LastModAt" },
values: new object[] { new DateTime(2025, 2, 19, 11, 59, 47, 916, DateTimeKind.Utc).AddTicks(948), new DateTime(2025, 2, 19, 11, 59, 47, 916, DateTimeKind.Utc).AddTicks(951) });
migrationBuilder.UpdateData(
table: "Users",
keyColumn: "Id",
keyValue: 2,
columns: new[] { "CreatedAt", "LastModAt" },
values: new object[] { new DateTime(2025, 2, 19, 11, 59, 47, 927, DateTimeKind.Utc).AddTicks(3684), new DateTime(2025, 2, 19, 11, 59, 47, 927, DateTimeKind.Utc).AddTicks(3685) });
migrationBuilder.CreateIndex(
name: "IX_CheckListRow_CheckListHeaderId",
table: "CheckListRow",
column: "CheckListHeaderId");
migrationBuilder.CreateIndex(
name: "IX_CheckListRow_CheckListTemplateRowId",
table: "CheckListRow",
column: "CheckListTemplateRowId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "CheckListRow");
migrationBuilder.AddColumn<int>(
name: "CheckListHeaderId",
table: "CheckListTemplateRow",
type: "int",
nullable: true);
migrationBuilder.UpdateData(
table: "Users",
keyColumn: "Id",
keyValue: 1,
columns: new[] { "CreatedAt", "LastModAt" },
values: new object[] { new DateTime(2025, 2, 19, 11, 10, 8, 377, DateTimeKind.Utc).AddTicks(26), new DateTime(2025, 2, 19, 11, 10, 8, 377, DateTimeKind.Utc).AddTicks(29) });
migrationBuilder.UpdateData(
table: "Users",
keyColumn: "Id",
keyValue: 2,
columns: new[] { "CreatedAt", "LastModAt" },
values: new object[] { new DateTime(2025, 2, 19, 11, 10, 8, 389, DateTimeKind.Utc).AddTicks(2814), new DateTime(2025, 2, 19, 11, 10, 8, 389, DateTimeKind.Utc).AddTicks(2817) });
migrationBuilder.CreateIndex(
name: "IX_CheckListTemplateRow_CheckListHeaderId",
table: "CheckListTemplateRow",
column: "CheckListHeaderId");
migrationBuilder.AddForeignKey(
name: "FK_CheckListTemplateRow_CheckListHeader_CheckListHeaderId",
table: "CheckListTemplateRow",
column: "CheckListHeaderId",
principalTable: "CheckListHeader",
principalColumn: "Id");
}
}
}
@@ -0,0 +1,578 @@
// <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("20250219125200_Extend002")]
partial class Extend002
{
/// <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<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<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.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<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, 2, 19, 12, 52, 0, 186, DateTimeKind.Utc).AddTicks(2300),
CreatedBy = "System",
Email = "admin@nuvolar.hu",
FirstName = "Administrator",
IsDeleted = false,
LastModAt = new DateTime(2025, 2, 19, 12, 52, 0, 186, DateTimeKind.Utc).AddTicks(2303),
LastModBy = "System",
LastName = "System",
PasswordHash = "eGM0NUREZnJ0ISFFRDIxMKE5TYwthDBuUsTUEO1fBnCR3VdSCmdz47ue0RoVvnkY",
UserName = "admin"
},
new
{
Id = 2,
CreatedAt = new DateTime(2025, 2, 19, 12, 52, 0, 197, DateTimeKind.Utc).AddTicks(6358),
CreatedBy = "System",
Email = "user@nuvolar.hu",
FirstName = "User",
IsDeleted = false,
LastModAt = new DateTime(2025, 2, 19, 12, 52, 0, 197, DateTimeKind.Utc).AddTicks(6360),
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.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()
.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");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,69 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace WorkFlowCheck.DL.Migrations
{
/// <inheritdoc />
public partial class Extend002 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "AnswerType",
table: "CheckListTemplateRow",
type: "nvarchar(max)",
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn<byte[]>(
name: "Photo",
table: "CheckListRow",
type: "varbinary(max)",
nullable: false,
defaultValue: new byte[0]);
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) });
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "AnswerType",
table: "CheckListTemplateRow");
migrationBuilder.DropColumn(
name: "Photo",
table: "CheckListRow");
migrationBuilder.UpdateData(
table: "Users",
keyColumn: "Id",
keyValue: 1,
columns: new[] { "CreatedAt", "LastModAt" },
values: new object[] { new DateTime(2025, 2, 19, 11, 59, 47, 916, DateTimeKind.Utc).AddTicks(948), new DateTime(2025, 2, 19, 11, 59, 47, 916, DateTimeKind.Utc).AddTicks(951) });
migrationBuilder.UpdateData(
table: "Users",
keyColumn: "Id",
keyValue: 2,
columns: new[] { "CreatedAt", "LastModAt" },
values: new object[] { new DateTime(2025, 2, 19, 11, 59, 47, 927, DateTimeKind.Utc).AddTicks(3684), new DateTime(2025, 2, 19, 11, 59, 47, 927, DateTimeKind.Utc).AddTicks(3685) });
}
}
}
@@ -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) });
}
}
}
@@ -0,0 +1,624 @@
// <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("20250312080859_UserRoleExtension")]
partial class UserRoleExtension
{
/// <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<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<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, 12, 8, 8, 57, 555, DateTimeKind.Utc).AddTicks(6125),
CreatedBy = "System",
Email = "admin@nuvolar.hu",
FirstName = "Administrator",
IsDeleted = false,
JwtToken = "",
LastModAt = new DateTime(2025, 3, 12, 8, 8, 57, 555, DateTimeKind.Utc).AddTicks(6129),
LastModBy = "System",
LastName = "System",
PasswordHash = "eGM0NUREZnJ0ISFFRDIxMKE5TYwthDBuUsTUEO1fBnCR3VdSCmdz47ue0RoVvnkY",
UserName = "admin"
},
new
{
Id = 2,
CreatedAt = new DateTime(2025, 3, 12, 8, 8, 57, 566, DateTimeKind.Utc).AddTicks(6128),
CreatedBy = "System",
Email = "user@nuvolar.hu",
FirstName = "User",
IsDeleted = false,
JwtToken = "",
LastModAt = new DateTime(2025, 3, 12, 8, 8, 57, 566, DateTimeKind.Utc).AddTicks(6129),
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("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.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("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.Role", b =>
{
b.Navigation("UserRoles");
});
modelBuilder.Entity("WorkFlowCheck.DL.Entities.User", b =>
{
b.Navigation("UserRoles");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,99 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace WorkFlowCheck.DL.Migrations
{
/// <inheritdoc />
public partial class UserRoleExtension : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_UserRoles_Roles_RoleId",
table: "UserRoles");
migrationBuilder.AddColumn<string>(
name: "JwtToken",
table: "Users",
type: "nvarchar(max)",
nullable: false,
defaultValue: "");
migrationBuilder.AlterColumn<int>(
name: "RoleId",
table: "UserRoles",
type: "int",
nullable: true,
oldClrType: typeof(int),
oldType: "int");
migrationBuilder.UpdateData(
table: "Users",
keyColumn: "Id",
keyValue: 1,
columns: new[] { "CreatedAt", "JwtToken", "LastModAt" },
values: new object[] { new DateTime(2025, 3, 12, 8, 8, 57, 555, DateTimeKind.Utc).AddTicks(6125), "", new DateTime(2025, 3, 12, 8, 8, 57, 555, DateTimeKind.Utc).AddTicks(6129) });
migrationBuilder.UpdateData(
table: "Users",
keyColumn: "Id",
keyValue: 2,
columns: new[] { "CreatedAt", "JwtToken", "LastModAt" },
values: new object[] { new DateTime(2025, 3, 12, 8, 8, 57, 566, DateTimeKind.Utc).AddTicks(6128), "", new DateTime(2025, 3, 12, 8, 8, 57, 566, DateTimeKind.Utc).AddTicks(6129) });
migrationBuilder.AddForeignKey(
name: "FK_UserRoles_Roles_RoleId",
table: "UserRoles",
column: "RoleId",
principalTable: "Roles",
principalColumn: "Id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_UserRoles_Roles_RoleId",
table: "UserRoles");
migrationBuilder.DropColumn(
name: "JwtToken",
table: "Users");
migrationBuilder.AlterColumn<int>(
name: "RoleId",
table: "UserRoles",
type: "int",
nullable: false,
defaultValue: 0,
oldClrType: typeof(int),
oldType: "int",
oldNullable: true);
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.AddForeignKey(
name: "FK_UserRoles_Roles_RoleId",
table: "UserRoles",
column: "RoleId",
principalTable: "Roles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
}
}
@@ -0,0 +1,635 @@
// <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("20250318104815_Extend004")]
partial class Extend004
{
/// <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<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<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, 3, 18, 10, 48, 13, 634, DateTimeKind.Utc).AddTicks(7867),
CreatedBy = "System",
Email = "admin@nuvolar.hu",
FirstName = "Administrator",
IsDeleted = false,
JwtToken = "",
LastModAt = new DateTime(2025, 3, 18, 10, 48, 13, 634, DateTimeKind.Utc).AddTicks(7870),
LastModBy = "System",
LastName = "System",
PasswordHash = "eGM0NUREZnJ0ISFFRDIxMKE5TYwthDBuUsTUEO1fBnCR3VdSCmdz47ue0RoVvnkY",
Token2FA = "",
UserName = "admin"
},
new
{
Id = 2,
Active = true,
CreatedAt = new DateTime(2025, 3, 18, 10, 48, 13, 645, DateTimeKind.Utc).AddTicks(9210),
CreatedBy = "System",
Email = "user@nuvolar.hu",
FirstName = "User",
IsDeleted = false,
JwtToken = "",
LastModAt = new DateTime(2025, 3, 18, 10, 48, 13, 645, DateTimeKind.Utc).AddTicks(9212),
LastModBy = "System",
LastName = "System",
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.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("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.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("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.Role", b =>
{
b.Navigation("UserRoles");
});
modelBuilder.Entity("WorkFlowCheck.DL.Entities.User", b =>
{
b.Navigation("UserRoles");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,69 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace WorkFlowCheck.DL.Migrations
{
/// <inheritdoc />
public partial class Extend004 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "Active",
table: "Users",
type: "bit",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<string>(
name: "Token2FA",
table: "Users",
type: "nvarchar(max)",
nullable: false,
defaultValue: "");
migrationBuilder.UpdateData(
table: "Users",
keyColumn: "Id",
keyValue: 1,
columns: new[] { "Active", "CreatedAt", "LastModAt", "Token2FA" },
values: new object[] { true, new DateTime(2025, 3, 18, 10, 48, 13, 634, DateTimeKind.Utc).AddTicks(7867), new DateTime(2025, 3, 18, 10, 48, 13, 634, DateTimeKind.Utc).AddTicks(7870), "" });
migrationBuilder.UpdateData(
table: "Users",
keyColumn: "Id",
keyValue: 2,
columns: new[] { "Active", "CreatedAt", "LastModAt", "Token2FA" },
values: new object[] { true, new DateTime(2025, 3, 18, 10, 48, 13, 645, DateTimeKind.Utc).AddTicks(9210), new DateTime(2025, 3, 18, 10, 48, 13, 645, DateTimeKind.Utc).AddTicks(9212), "" });
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Active",
table: "Users");
migrationBuilder.DropColumn(
name: "Token2FA",
table: "Users");
migrationBuilder.UpdateData(
table: "Users",
keyColumn: "Id",
keyValue: 1,
columns: new[] { "CreatedAt", "LastModAt" },
values: new object[] { new DateTime(2025, 3, 12, 8, 8, 57, 555, DateTimeKind.Utc).AddTicks(6125), new DateTime(2025, 3, 12, 8, 8, 57, 555, DateTimeKind.Utc).AddTicks(6129) });
migrationBuilder.UpdateData(
table: "Users",
keyColumn: "Id",
keyValue: 2,
columns: new[] { "CreatedAt", "LastModAt" },
values: new object[] { new DateTime(2025, 3, 12, 8, 8, 57, 566, DateTimeKind.Utc).AddTicks(6128), new DateTime(2025, 3, 12, 8, 8, 57, 566, DateTimeKind.Utc).AddTicks(6129) });
}
}
}
@@ -0,0 +1,744 @@
// <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("20250319132531_Extend005")]
partial class Extend005
{
/// <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.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");
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");
});
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<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<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, 3, 19, 13, 25, 30, 814, DateTimeKind.Utc).AddTicks(9821),
CreatedBy = "System",
Email = "admin@nuvolar.hu",
FirstName = "Administrator",
IsDeleted = false,
JwtToken = "",
LastModAt = new DateTime(2025, 3, 19, 13, 25, 30, 814, DateTimeKind.Utc).AddTicks(9825),
LastModBy = "System",
LastName = "System",
PasswordHash = "eGM0NUREZnJ0ISFFRDIxMKE5TYwthDBuUsTUEO1fBnCR3VdSCmdz47ue0RoVvnkY",
Token2FA = "",
UserName = "admin"
},
new
{
Id = 2,
Active = true,
CreatedAt = new DateTime(2025, 3, 19, 13, 25, 30, 829, DateTimeKind.Utc).AddTicks(5779),
CreatedBy = "System",
Email = "user@nuvolar.hu",
FirstName = "User",
IsDeleted = false,
JwtToken = "",
LastModAt = new DateTime(2025, 3, 19, 13, 25, 30, 829, DateTimeKind.Utc).AddTicks(5783),
LastModBy = "System",
LastName = "System",
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.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("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.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("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("UserRoles");
});
modelBuilder.Entity("WorkFlowCheck.DL.Entities.User", b =>
{
b.Navigation("UserRoles");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,107 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace WorkFlowCheck.DL.Migrations
{
/// <inheritdoc />
public partial class Extend005 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "NumberGeneratorTemplate",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
ShortName = table.Column<string>(type: "nvarchar(max)", nullable: false),
Prefix = table.Column<string>(type: "nvarchar(max)", nullable: false),
PrefixSeparator = table.Column<string>(type: "nvarchar(max)", nullable: false),
DigitFormat = table.Column<string>(type: "nvarchar(max)", nullable: false),
SuffixSeparator = table.Column<string>(type: "nvarchar(max)", nullable: false),
Suffix = table.Column<string>(type: "nvarchar(max)", nullable: false),
CurrentNumber = table.Column<int>(type: "int", nullable: false),
LastGeneratedNumber = table.Column<string>(type: "nvarchar(max)", nullable: false),
GenerateType = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_NumberGeneratorTemplate", x => x.Id);
});
migrationBuilder.CreateTable(
name: "NumberGeneratorTemplateDate",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
NumberGeneratorTemplateId = table.Column<int>(type: "int", nullable: false),
Year = table.Column<int>(type: "int", nullable: false),
Month = table.Column<int>(type: "int", nullable: true),
CurrentNumber = table.Column<int>(type: "int", nullable: false),
LastGeneratedNumber = table.Column<string>(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_NumberGeneratorTemplateDate", x => x.Id);
table.ForeignKey(
name: "FK_NumberGeneratorTemplateDate_NumberGeneratorTemplate_NumberGeneratorTemplateId",
column: x => x.NumberGeneratorTemplateId,
principalTable: "NumberGeneratorTemplate",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.InsertData(
table: "NumberGeneratorTemplate",
columns: new[] { "Id", "CurrentNumber", "DigitFormat", "GenerateType", "LastGeneratedNumber", "Prefix", "PrefixSeparator", "ShortName", "Suffix", "SuffixSeparator" },
values: new object[] { 1, 0, "D4", 0, "", "CHK", "-", "Ellenőrzési dokumentum sorszámozása", "", "-" });
migrationBuilder.UpdateData(
table: "Users",
keyColumn: "Id",
keyValue: 1,
columns: new[] { "CreatedAt", "LastModAt" },
values: new object[] { new DateTime(2025, 3, 19, 13, 25, 30, 814, DateTimeKind.Utc).AddTicks(9821), new DateTime(2025, 3, 19, 13, 25, 30, 814, DateTimeKind.Utc).AddTicks(9825) });
migrationBuilder.UpdateData(
table: "Users",
keyColumn: "Id",
keyValue: 2,
columns: new[] { "CreatedAt", "LastModAt" },
values: new object[] { new DateTime(2025, 3, 19, 13, 25, 30, 829, DateTimeKind.Utc).AddTicks(5779), new DateTime(2025, 3, 19, 13, 25, 30, 829, DateTimeKind.Utc).AddTicks(5783) });
migrationBuilder.CreateIndex(
name: "IX_NumberGeneratorTemplateDate_NumberGeneratorTemplateId",
table: "NumberGeneratorTemplateDate",
column: "NumberGeneratorTemplateId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "NumberGeneratorTemplateDate");
migrationBuilder.DropTable(
name: "NumberGeneratorTemplate");
migrationBuilder.UpdateData(
table: "Users",
keyColumn: "Id",
keyValue: 1,
columns: new[] { "CreatedAt", "LastModAt" },
values: new object[] { new DateTime(2025, 3, 18, 10, 48, 13, 634, DateTimeKind.Utc).AddTicks(7867), new DateTime(2025, 3, 18, 10, 48, 13, 634, DateTimeKind.Utc).AddTicks(7870) });
migrationBuilder.UpdateData(
table: "Users",
keyColumn: "Id",
keyValue: 2,
columns: new[] { "CreatedAt", "LastModAt" },
values: new object[] { new DateTime(2025, 3, 18, 10, 48, 13, 645, DateTimeKind.Utc).AddTicks(9210), new DateTime(2025, 3, 18, 10, 48, 13, 645, DateTimeKind.Utc).AddTicks(9212) });
}
}
}
@@ -0,0 +1,747 @@
// <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("20250321113941_Extend006")]
partial class Extend006
{
/// <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>("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.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.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");
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");
});
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<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<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, 3, 21, 11, 39, 40, 269, DateTimeKind.Utc).AddTicks(5367),
CreatedBy = "System",
Email = "admin@nuvolar.hu",
FirstName = "Administrator",
IsDeleted = false,
JwtToken = "",
LastModAt = new DateTime(2025, 3, 21, 11, 39, 40, 269, DateTimeKind.Utc).AddTicks(5369),
LastModBy = "System",
LastName = "System",
PasswordHash = "eGM0NUREZnJ0ISFFRDIxMKE5TYwthDBuUsTUEO1fBnCR3VdSCmdz47ue0RoVvnkY",
Token2FA = "",
UserName = "admin"
},
new
{
Id = 2,
Active = true,
CreatedAt = new DateTime(2025, 3, 21, 11, 39, 40, 280, DateTimeKind.Utc).AddTicks(6775),
CreatedBy = "System",
Email = "user@nuvolar.hu",
FirstName = "User",
IsDeleted = false,
JwtToken = "",
LastModAt = new DateTime(2025, 3, 21, 11, 39, 40, 280, DateTimeKind.Utc).AddTicks(6776),
LastModBy = "System",
LastName = "System",
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.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("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.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("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("UserRoles");
});
modelBuilder.Entity("WorkFlowCheck.DL.Entities.User", b =>
{
b.Navigation("UserRoles");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,58 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace WorkFlowCheck.DL.Migrations
{
/// <inheritdoc />
public partial class Extend006 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "IsEditable",
table: "CheckListHeader",
type: "bit",
nullable: false,
defaultValue: false);
migrationBuilder.UpdateData(
table: "Users",
keyColumn: "Id",
keyValue: 1,
columns: new[] { "CreatedAt", "LastModAt" },
values: new object[] { new DateTime(2025, 3, 21, 11, 39, 40, 269, DateTimeKind.Utc).AddTicks(5367), new DateTime(2025, 3, 21, 11, 39, 40, 269, DateTimeKind.Utc).AddTicks(5369) });
migrationBuilder.UpdateData(
table: "Users",
keyColumn: "Id",
keyValue: 2,
columns: new[] { "CreatedAt", "LastModAt" },
values: new object[] { new DateTime(2025, 3, 21, 11, 39, 40, 280, DateTimeKind.Utc).AddTicks(6775), new DateTime(2025, 3, 21, 11, 39, 40, 280, DateTimeKind.Utc).AddTicks(6776) });
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "IsEditable",
table: "CheckListHeader");
migrationBuilder.UpdateData(
table: "Users",
keyColumn: "Id",
keyValue: 1,
columns: new[] { "CreatedAt", "LastModAt" },
values: new object[] { new DateTime(2025, 3, 19, 13, 25, 30, 814, DateTimeKind.Utc).AddTicks(9821), new DateTime(2025, 3, 19, 13, 25, 30, 814, DateTimeKind.Utc).AddTicks(9825) });
migrationBuilder.UpdateData(
table: "Users",
keyColumn: "Id",
keyValue: 2,
columns: new[] { "CreatedAt", "LastModAt" },
values: new object[] { new DateTime(2025, 3, 19, 13, 25, 30, 829, DateTimeKind.Utc).AddTicks(5779), new DateTime(2025, 3, 19, 13, 25, 30, 829, DateTimeKind.Utc).AddTicks(5783) });
}
}
}
@@ -0,0 +1,763 @@
// <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("20250321121413_Extend007")]
partial class Extend007
{
/// <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<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<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.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");
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");
});
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<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<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, 3, 21, 12, 14, 13, 195, DateTimeKind.Utc).AddTicks(5804),
CreatedBy = "System",
Email = "admin@nuvolar.hu",
FirstName = "Administrator",
IsDeleted = false,
JwtToken = "",
LastModAt = new DateTime(2025, 3, 21, 12, 14, 13, 195, DateTimeKind.Utc).AddTicks(5808),
LastModBy = "System",
LastName = "System",
PasswordHash = "eGM0NUREZnJ0ISFFRDIxMKE5TYwthDBuUsTUEO1fBnCR3VdSCmdz47ue0RoVvnkY",
Token2FA = "",
UserName = "admin"
},
new
{
Id = 2,
Active = true,
CreatedAt = new DateTime(2025, 3, 21, 12, 14, 13, 206, DateTimeKind.Utc).AddTicks(9653),
CreatedBy = "System",
Email = "user@nuvolar.hu",
FirstName = "User",
IsDeleted = false,
JwtToken = "",
LastModAt = new DateTime(2025, 3, 21, 12, 14, 13, 206, DateTimeKind.Utc).AddTicks(9657),
LastModBy = "System",
LastName = "System",
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.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.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("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("UserRoles");
});
modelBuilder.Entity("WorkFlowCheck.DL.Entities.User", b =>
{
b.Navigation("UserRoles");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,90 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace WorkFlowCheck.DL.Migrations
{
/// <inheritdoc />
public partial class Extend007 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<DateTime>(
name: "DateExecution",
table: "CheckListHeader",
type: "datetime2",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn<int>(
name: "UserId",
table: "CheckListHeader",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.UpdateData(
table: "Users",
keyColumn: "Id",
keyValue: 1,
columns: new[] { "CreatedAt", "LastModAt" },
values: new object[] { new DateTime(2025, 3, 21, 12, 14, 13, 195, DateTimeKind.Utc).AddTicks(5804), new DateTime(2025, 3, 21, 12, 14, 13, 195, DateTimeKind.Utc).AddTicks(5808) });
migrationBuilder.UpdateData(
table: "Users",
keyColumn: "Id",
keyValue: 2,
columns: new[] { "CreatedAt", "LastModAt" },
values: new object[] { new DateTime(2025, 3, 21, 12, 14, 13, 206, DateTimeKind.Utc).AddTicks(9653), new DateTime(2025, 3, 21, 12, 14, 13, 206, DateTimeKind.Utc).AddTicks(9657) });
migrationBuilder.CreateIndex(
name: "IX_CheckListHeader_UserId",
table: "CheckListHeader",
column: "UserId");
migrationBuilder.AddForeignKey(
name: "FK_CheckListHeader_Users_UserId",
table: "CheckListHeader",
column: "UserId",
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_CheckListHeader_Users_UserId",
table: "CheckListHeader");
migrationBuilder.DropIndex(
name: "IX_CheckListHeader_UserId",
table: "CheckListHeader");
migrationBuilder.DropColumn(
name: "DateExecution",
table: "CheckListHeader");
migrationBuilder.DropColumn(
name: "UserId",
table: "CheckListHeader");
migrationBuilder.UpdateData(
table: "Users",
keyColumn: "Id",
keyValue: 1,
columns: new[] { "CreatedAt", "LastModAt" },
values: new object[] { new DateTime(2025, 3, 21, 11, 39, 40, 269, DateTimeKind.Utc).AddTicks(5367), new DateTime(2025, 3, 21, 11, 39, 40, 269, DateTimeKind.Utc).AddTicks(5369) });
migrationBuilder.UpdateData(
table: "Users",
keyColumn: "Id",
keyValue: 2,
columns: new[] { "CreatedAt", "LastModAt" },
values: new object[] { new DateTime(2025, 3, 21, 11, 39, 40, 280, DateTimeKind.Utc).AddTicks(6775), new DateTime(2025, 3, 21, 11, 39, 40, 280, DateTimeKind.Utc).AddTicks(6776) });
}
}
}
@@ -0,0 +1,799 @@
// <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("20250321151411_Extend008")]
partial class Extend008
{
/// <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<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<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<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<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.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<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<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<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, 3, 21, 15, 14, 11, 73, DateTimeKind.Utc).AddTicks(8912),
CreatedBy = "System",
Email = "admin@nuvolar.hu",
FirstName = "Administrator",
IsDeleted = false,
JwtToken = "",
LastModAt = new DateTime(2025, 3, 21, 15, 14, 11, 73, DateTimeKind.Utc).AddTicks(8916),
LastModBy = "System",
LastName = "System",
PasswordHash = "eGM0NUREZnJ0ISFFRDIxMKE5TYwthDBuUsTUEO1fBnCR3VdSCmdz47ue0RoVvnkY",
Token2FA = "",
UserName = "admin"
},
new
{
Id = 2,
Active = true,
CreatedAt = new DateTime(2025, 3, 21, 15, 14, 11, 84, DateTimeKind.Utc).AddTicks(9869),
CreatedBy = "System",
Email = "user@nuvolar.hu",
FirstName = "User",
IsDeleted = false,
JwtToken = "",
LastModAt = new DateTime(2025, 3, 21, 15, 14, 11, 84, DateTimeKind.Utc).AddTicks(9870),
LastModBy = "System",
LastName = "System",
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.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("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("UserRoles");
});
modelBuilder.Entity("WorkFlowCheck.DL.Entities.User", b =>
{
b.Navigation("UserRoles");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,117 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace WorkFlowCheck.DL.Migrations
{
/// <inheritdoc />
public partial class Extend008 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "NumberGenerator1Id",
table: "CheckListTemplateHeader",
type: "int",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "NumberGenerator2Id",
table: "CheckListTemplateHeader",
type: "int",
nullable: true);
migrationBuilder.InsertData(
table: "NumberGeneratorTemplateDate",
columns: new[] { "Id", "CurrentNumber", "LastGeneratedNumber", "Month", "NumberGeneratorTemplateId", "Year" },
values: new object[] { 1, 0, "", 0, 1, 1 });
migrationBuilder.UpdateData(
table: "Users",
keyColumn: "Id",
keyValue: 1,
columns: new[] { "CreatedAt", "LastModAt" },
values: new object[] { new DateTime(2025, 3, 21, 15, 14, 11, 73, DateTimeKind.Utc).AddTicks(8912), new DateTime(2025, 3, 21, 15, 14, 11, 73, DateTimeKind.Utc).AddTicks(8916) });
migrationBuilder.UpdateData(
table: "Users",
keyColumn: "Id",
keyValue: 2,
columns: new[] { "CreatedAt", "LastModAt" },
values: new object[] { new DateTime(2025, 3, 21, 15, 14, 11, 84, DateTimeKind.Utc).AddTicks(9869), new DateTime(2025, 3, 21, 15, 14, 11, 84, DateTimeKind.Utc).AddTicks(9870) });
migrationBuilder.CreateIndex(
name: "IX_CheckListTemplateHeader_NumberGenerator1Id",
table: "CheckListTemplateHeader",
column: "NumberGenerator1Id");
migrationBuilder.CreateIndex(
name: "IX_CheckListTemplateHeader_NumberGenerator2Id",
table: "CheckListTemplateHeader",
column: "NumberGenerator2Id");
migrationBuilder.AddForeignKey(
name: "FK_CheckListTemplateHeader_NumberGeneratorTemplate_NumberGenerator1Id",
table: "CheckListTemplateHeader",
column: "NumberGenerator1Id",
principalTable: "NumberGeneratorTemplate",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_CheckListTemplateHeader_NumberGeneratorTemplate_NumberGenerator2Id",
table: "CheckListTemplateHeader",
column: "NumberGenerator2Id",
principalTable: "NumberGeneratorTemplate",
principalColumn: "Id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_CheckListTemplateHeader_NumberGeneratorTemplate_NumberGenerator1Id",
table: "CheckListTemplateHeader");
migrationBuilder.DropForeignKey(
name: "FK_CheckListTemplateHeader_NumberGeneratorTemplate_NumberGenerator2Id",
table: "CheckListTemplateHeader");
migrationBuilder.DropIndex(
name: "IX_CheckListTemplateHeader_NumberGenerator1Id",
table: "CheckListTemplateHeader");
migrationBuilder.DropIndex(
name: "IX_CheckListTemplateHeader_NumberGenerator2Id",
table: "CheckListTemplateHeader");
migrationBuilder.DeleteData(
table: "NumberGeneratorTemplateDate",
keyColumn: "Id",
keyValue: 1);
migrationBuilder.DropColumn(
name: "NumberGenerator1Id",
table: "CheckListTemplateHeader");
migrationBuilder.DropColumn(
name: "NumberGenerator2Id",
table: "CheckListTemplateHeader");
migrationBuilder.UpdateData(
table: "Users",
keyColumn: "Id",
keyValue: 1,
columns: new[] { "CreatedAt", "LastModAt" },
values: new object[] { new DateTime(2025, 3, 21, 12, 14, 13, 195, DateTimeKind.Utc).AddTicks(5804), new DateTime(2025, 3, 21, 12, 14, 13, 195, DateTimeKind.Utc).AddTicks(5808) });
migrationBuilder.UpdateData(
table: "Users",
keyColumn: "Id",
keyValue: 2,
columns: new[] { "CreatedAt", "LastModAt" },
values: new object[] { new DateTime(2025, 3, 21, 12, 14, 13, 206, DateTimeKind.Utc).AddTicks(9653), new DateTime(2025, 3, 21, 12, 14, 13, 206, DateTimeKind.Utc).AddTicks(9657) });
}
}
}
@@ -0,0 +1,796 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using WorkFlowCheck.DL;
#nullable disable
namespace WorkFlowCheck.DL.Migrations
{
[DbContext(typeof(AppDbContext))]
partial class AppDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(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<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<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<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<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.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<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<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<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, 3, 21, 15, 14, 11, 73, DateTimeKind.Utc).AddTicks(8912),
CreatedBy = "System",
Email = "admin@nuvolar.hu",
FirstName = "Administrator",
IsDeleted = false,
JwtToken = "",
LastModAt = new DateTime(2025, 3, 21, 15, 14, 11, 73, DateTimeKind.Utc).AddTicks(8916),
LastModBy = "System",
LastName = "System",
PasswordHash = "eGM0NUREZnJ0ISFFRDIxMKE5TYwthDBuUsTUEO1fBnCR3VdSCmdz47ue0RoVvnkY",
Token2FA = "",
UserName = "admin"
},
new
{
Id = 2,
Active = true,
CreatedAt = new DateTime(2025, 3, 21, 15, 14, 11, 84, DateTimeKind.Utc).AddTicks(9869),
CreatedBy = "System",
Email = "user@nuvolar.hu",
FirstName = "User",
IsDeleted = false,
JwtToken = "",
LastModAt = new DateTime(2025, 3, 21, 15, 14, 11, 84, DateTimeKind.Utc).AddTicks(9870),
LastModBy = "System",
LastName = "System",
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.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("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("UserRoles");
});
modelBuilder.Entity("WorkFlowCheck.DL.Entities.User", b =>
{
b.Navigation("UserRoles");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,23 @@
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WorkFlowCheck.Common.Security;
namespace WorkFlowCheck.DL.Seed
{
public static class DBInitializer
{
public static void Seed(AppDbContext dbContext)
{
var user = dbContext.Users.Where(w => w.Email == "info@wfcapi.hu").FirstOrDefault();
if (user != null && user.PasswordHash == null)
{
user.PasswordHash = PasswordHasher.HashPassword("861354");
dbContext.SaveChanges();
}
}
}
}
@@ -0,0 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.12" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.12" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.12">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\WorkFlowCheck.Common\WorkFlowCheck.Common.csproj" />
</ItemGroup>
</Project>

Some files were not shown because too many files have changed in this diff Show More