Compare commits
12 Commits
a33789e04e
...
d01a3b955b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d01a3b955b | ||
|
|
3f6fda1ac5 | ||
|
|
777d071bb6 | ||
|
|
7e66c5ddef | ||
|
|
f43020bf45 | ||
|
|
3251d1214a | ||
|
|
7ab24c696b | ||
|
|
fe01e04966 | ||
|
|
9760f6b73f | ||
|
|
b8e48a9f4d | ||
|
|
d0dfd342b8 | ||
|
|
b3c3ae25d4 |
@ -7,6 +7,13 @@
|
||||
<FileVersion>2.3.7.0</FileVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.32">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\HRD.LDAPService\HRD.LDAPService.csproj" />
|
||||
<ProjectReference Include="..\HRD.WebApi\HRD.WebApi.csproj" />
|
||||
|
||||
47
DAL/DIExtensions.cs
Normal file
47
DAL/DIExtensions.cs
Normal file
@ -0,0 +1,47 @@
|
||||
using DAL._Shared.SharedModels;
|
||||
using DAL._Shared.SharedRepositories;
|
||||
using DAL.Repositories;
|
||||
using HRD.WebApi.Repositories;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace DAL
|
||||
{
|
||||
public static class DIExtensions
|
||||
{
|
||||
public static IServiceCollection AddStaffDBRepositories(this IServiceCollection services)
|
||||
{
|
||||
services.AddScoped<AdWebAppToWebAppRoleRepository>();
|
||||
services.AddScoped<CostCentreRepository>();
|
||||
services.AddScoped<DepartmentRepository>();
|
||||
services.AddScoped<DepartmentToWebAppToEmployeeForWindreamRepository>();
|
||||
services.AddScoped<DocumentArtRepository>();
|
||||
services.AddScoped<DocumentArtToDepartmentRepository>();
|
||||
services.AddScoped<EmployeeAttributeRepository>();
|
||||
services.AddScoped<EmployeeRepository>();
|
||||
services.AddScoped<EmployeeStatusRepository>();
|
||||
services.AddScoped<EmployeeToAttributeRepository>();
|
||||
services.AddScoped<EmployeeToDepartmentRepository>();
|
||||
services.AddScoped<EmployeeToWebAppRepository>();
|
||||
services.AddScoped<ProjectRepository>();
|
||||
services.AddScoped<RangRepository>();
|
||||
services.AddScoped<SubsidiaryRepository>();
|
||||
services.AddScoped<WebAppAdditionalRoleRepository>();
|
||||
services.AddScoped<WebAppRepository>();
|
||||
services.AddScoped<WebAppRoleRepository>();
|
||||
services.AddScoped<WebAppToDepartmentRepository>();
|
||||
services.AddScoped<WebAppToWebAppAdditionalRoleRepository>();
|
||||
services.AddScoped<WebAppToWebAppRoleRepository>();
|
||||
services.AddScoped<WindreamColumnsToDepartmentRepository>();
|
||||
services.AddScoped<WindreamIndexRepository>();
|
||||
services.AddScoped<WindreamIndexToWindreamSearchToDepartmentRepository>();
|
||||
services.AddScoped<WindreamInputFolderRepository>();
|
||||
services.AddScoped<WindreamSearchItemRepository>();
|
||||
services.AddScoped<WindreamSearchItemToWindreamSearchToDepartmentRepository>();
|
||||
services.AddScoped<WindreamSearchRepository>();
|
||||
services.AddScoped<WindreamSearchToDepartmentRepository>();
|
||||
services.AddScoped<WebAppEmployeeInfoRepository>();
|
||||
|
||||
return services;
|
||||
}
|
||||
}
|
||||
}
|
||||
1092
DAL/Migrations/20240805093234_InitialCreate.Designer.cs
generated
Normal file
1092
DAL/Migrations/20240805093234_InitialCreate.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
751
DAL/Migrations/20240805093234_InitialCreate.cs
Normal file
751
DAL/Migrations/20240805093234_InitialCreate.cs
Normal file
@ -0,0 +1,751 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace DAL.Migrations
|
||||
{
|
||||
public partial class InitialCreate : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.EnsureSchema(
|
||||
name: "webapi");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AdWebAppToWebAppRole",
|
||||
schema: "webapi",
|
||||
columns: table => new
|
||||
{
|
||||
AdWebAppToWebAppRoleId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
WebAppId = table.Column<int>(type: "int", nullable: false),
|
||||
AdWebAppName = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
AdWebAppRoleName = table.Column<string>(type: "nvarchar(max)", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AdWebAppToWebAppRole", x => x.AdWebAppToWebAppRoleId);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "CostCentre",
|
||||
schema: "webapi",
|
||||
columns: table => new
|
||||
{
|
||||
CostCentreId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
CostCentreName = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
SortOrder = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_CostCentre", x => x.CostCentreId);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Department",
|
||||
schema: "webapi",
|
||||
columns: table => new
|
||||
{
|
||||
DepartmentId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
DepartmentName = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
CostCentreId = table.Column<int>(type: "int", nullable: false),
|
||||
DepartmentTypeId = table.Column<int>(type: "int", nullable: false),
|
||||
HeadofDepartmentId = table.Column<int>(type: "int", nullable: true),
|
||||
ExecutiveDirectorId = table.Column<int>(type: "int", nullable: true),
|
||||
ManagingDirectorId = table.Column<int>(type: "int", nullable: true),
|
||||
DepartmentNameFolder = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
AdGroupDepartmentName = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
ClientId = table.Column<int>(type: "int", nullable: true),
|
||||
IsVirtual = table.Column<bool>(type: "bit", nullable: false),
|
||||
CostCentre = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
HeadofDepartment = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
ExecutiveDirector = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
ManagingDirector = table.Column<string>(type: "nvarchar(max)", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Department", x => x.DepartmentId);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "DepartmentToWebAppToEmployeeForWindream",
|
||||
schema: "webapi",
|
||||
columns: table => new
|
||||
{
|
||||
DepartmentToWebAppToEmployeeForWindreamId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
EmployeeId = table.Column<int>(type: "int", nullable: false),
|
||||
DepartmentId = table.Column<int>(type: "int", nullable: false),
|
||||
DepartmentName = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
ShortName = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
LoginName = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
IsMain = table.Column<int>(type: "int", nullable: false),
|
||||
ClientId = table.Column<int>(type: "int", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_DepartmentToWebAppToEmployeeForWindream", x => x.DepartmentToWebAppToEmployeeForWindreamId);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "DocumentArt",
|
||||
schema: "webapi",
|
||||
columns: table => new
|
||||
{
|
||||
DocumentArtId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
Shortname = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
RootPath = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
Folder = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
Comment = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
ClientId = table.Column<int>(type: "int", nullable: false),
|
||||
DepartmentNamesList = table.Column<string>(type: "nvarchar(max)", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_DocumentArt", x => x.DocumentArtId);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "DocumentArtToDepartment",
|
||||
schema: "webapi",
|
||||
columns: table => new
|
||||
{
|
||||
DocumentArtToDepartmentId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
DepartmentId = table.Column<int>(type: "int", nullable: false),
|
||||
DocumentArtId = table.Column<int>(type: "int", nullable: false),
|
||||
IsActive = table.Column<bool>(type: "bit", nullable: false),
|
||||
UseGlobix = table.Column<bool>(type: "bit", nullable: true),
|
||||
DocumentArtName = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
DocumentArtShortname = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
DocumentArtFolder = table.Column<string>(type: "nvarchar(max)", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_DocumentArtToDepartment", x => x.DocumentArtToDepartmentId);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Employee",
|
||||
schema: "webapi",
|
||||
columns: table => new
|
||||
{
|
||||
EmployeeId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
EmployeeNo = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
Salutation = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
FirstName = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
LastName = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
ShortName = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
Title = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
Position = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
LoginName = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
Email = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
RangId = table.Column<int>(type: "int", nullable: true),
|
||||
ClientId = table.Column<int>(type: "int", nullable: false),
|
||||
IsActive = table.Column<bool>(type: "bit", nullable: true),
|
||||
MandantCode = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
MainDepartmentId = table.Column<int>(type: "int", nullable: true),
|
||||
DepartmentNamesList = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
DepartmentIdList = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
WebappNamesList = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
WebappIdList = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
AttributeNamesList = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
AttributeIdList = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
MobilePhoneNo = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
PhoneNo = table.Column<string>(type: "nvarchar(max)", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Employee", x => x.EmployeeId);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "EmployeeAttribute",
|
||||
schema: "webapi",
|
||||
columns: table => new
|
||||
{
|
||||
EmployeeAttributeId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
Shortname = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
RoleList = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
SeqNo = table.Column<int>(type: "int", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_EmployeeAttribute", x => x.EmployeeAttributeId);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "EmployeeStatus",
|
||||
schema: "webapi",
|
||||
columns: table => new
|
||||
{
|
||||
EmployeeStatusId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
EmployeeStatusName = table.Column<string>(type: "nvarchar(max)", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_EmployeeStatus", x => x.EmployeeStatusId);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "EmployeeToAttribute",
|
||||
schema: "webapi",
|
||||
columns: table => new
|
||||
{
|
||||
EmployeeToAttributeId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
EmployeeId = table.Column<int>(type: "int", nullable: false),
|
||||
EmployeeAttributeId = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_EmployeeToAttribute", x => x.EmployeeToAttributeId);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "EmployeeToDepartment",
|
||||
schema: "webapi",
|
||||
columns: table => new
|
||||
{
|
||||
EmployeeToDepartmentId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
EmployeeId = table.Column<int>(type: "int", nullable: false),
|
||||
DepartmentId = table.Column<int>(type: "int", nullable: false),
|
||||
DepartmentName = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
EmployeeBudget = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
||||
EmployeeStatusId = table.Column<int>(type: "int", nullable: true),
|
||||
RangId = table.Column<int>(type: "int", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_EmployeeToDepartment", x => x.EmployeeToDepartmentId);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "EmployeeToWebApp",
|
||||
schema: "webapi",
|
||||
columns: table => new
|
||||
{
|
||||
EmployeeToWebAppId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
EmployeeId = table.Column<int>(type: "int", nullable: false),
|
||||
WebAppId = table.Column<int>(type: "int", nullable: false),
|
||||
WebAppRoleId = table.Column<int>(type: "int", nullable: false),
|
||||
DepartmentId = table.Column<int>(type: "int", nullable: true),
|
||||
WebAppRoleName = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
WebAppName = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
DepartmentName = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
ExtendedDepartmentNameList = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
ExtendedDepartmentIdList = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
AdditionalRoleNameList = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
AdditionalRoleIdList = table.Column<string>(type: "nvarchar(max)", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_EmployeeToWebApp", x => x.EmployeeToWebAppId);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Project",
|
||||
schema: "webapi",
|
||||
columns: table => new
|
||||
{
|
||||
ProjectId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
ProjectName = table.Column<string>(type: "nvarchar(max)", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Project", x => x.ProjectId);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Rang",
|
||||
schema: "webapi",
|
||||
columns: table => new
|
||||
{
|
||||
RangId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
RangName = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
RangShortname = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
RangOrder = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Rang", x => x.RangId);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Subsidiary",
|
||||
schema: "webapi",
|
||||
columns: table => new
|
||||
{
|
||||
SubsidiaryId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
ClientId = table.Column<int>(type: "int", nullable: true),
|
||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
SubsidiaryCode = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
Comment = table.Column<string>(type: "nvarchar(max)", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Subsidiary", x => x.SubsidiaryId);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "WebApp",
|
||||
schema: "webapi",
|
||||
columns: table => new
|
||||
{
|
||||
WebAppId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
WebAppName = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
WebAppLinkLive = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
WebAppLinkDev = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
IsActive = table.Column<bool>(type: "bit", nullable: false),
|
||||
AdWebAppName = table.Column<string>(type: "nvarchar(max)", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_WebApp", x => x.WebAppId);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "WebAppAdditionalRole",
|
||||
schema: "webapi",
|
||||
columns: table => new
|
||||
{
|
||||
WebAppAdditionalRoleId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
WebAppId = table.Column<int>(type: "int", nullable: false),
|
||||
WebAppAdditionalRoleName = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
AdWebAppAdditionalRoleName = table.Column<string>(type: "nvarchar(max)", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_WebAppAdditionalRole", x => x.WebAppAdditionalRoleId);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "WebAppEmployeeInfo",
|
||||
schema: "webapi",
|
||||
columns: table => new
|
||||
{
|
||||
WebAppEmployeeInfoId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
EmployeeNo = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
Salutation = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
FirstName = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
LastName = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
ShortName = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
Title = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
Position = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
LoginName = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
Email = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
DepartmentId = table.Column<int>(type: "int", nullable: false),
|
||||
ExtendedDepartmentIdList = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
DepartmentName = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
EmployeeId = table.Column<int>(type: "int", nullable: false),
|
||||
CostCentreId = table.Column<int>(type: "int", nullable: false),
|
||||
RangShortname = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
RangName = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
RangOrder = table.Column<int>(type: "int", nullable: false),
|
||||
ClientId = table.Column<int>(type: "int", nullable: false),
|
||||
WebAppId = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_WebAppEmployeeInfo", x => x.WebAppEmployeeInfoId);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "WebAppRole",
|
||||
schema: "webapi",
|
||||
columns: table => new
|
||||
{
|
||||
WebAppRoleId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
WebAppRoleName = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
WebAppRoleHierarchy = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_WebAppRole", x => x.WebAppRoleId);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "WebAppToDepartment",
|
||||
schema: "webapi",
|
||||
columns: table => new
|
||||
{
|
||||
WebAppToDepartmentId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
EmployeeToWebAppId = table.Column<int>(type: "int", nullable: false),
|
||||
DepartmentId = table.Column<int>(type: "int", nullable: false),
|
||||
DepartmentName = table.Column<string>(type: "nvarchar(max)", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_WebAppToDepartment", x => x.WebAppToDepartmentId);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "WebAppToWebAppAdditionalRole",
|
||||
schema: "webapi",
|
||||
columns: table => new
|
||||
{
|
||||
WebAppToWebAppAdditionalRoleId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
WebAppAdditionalRoleId = table.Column<int>(type: "int", nullable: false),
|
||||
EmployeeToWebAppId = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_WebAppToWebAppAdditionalRole", x => x.WebAppToWebAppAdditionalRoleId);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "WebAppToWebAppRole",
|
||||
schema: "webapi",
|
||||
columns: table => new
|
||||
{
|
||||
WebAppToWebAppRoleId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
WebAppId = table.Column<int>(type: "int", nullable: false),
|
||||
WebAppRoleId = table.Column<int>(type: "int", nullable: false),
|
||||
WebAppRoleName = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
WebAppRoleHierarchy = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_WebAppToWebAppRole", x => x.WebAppToWebAppRoleId);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "WebAppUser",
|
||||
schema: "webapi",
|
||||
columns: table => new
|
||||
{
|
||||
WebAppUserId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
ShortName = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
LoginName = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
Password = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
RoleList = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
WebAppRoleList = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
JwtExpiredOn = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||
LastLogin = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||
ClientVersion = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
Language = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
Culture = table.Column<string>(type: "nvarchar(max)", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_WebAppUser", x => x.WebAppUserId);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "WindreamColumnsToDepartment",
|
||||
schema: "webapi",
|
||||
columns: table => new
|
||||
{
|
||||
WindreamColumnsToDepartmentId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
AttributeDwAttrId = table.Column<int>(type: "int", nullable: false),
|
||||
AttributeSzColumnName = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
Comment = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
AttributeDwAttrType = table.Column<int>(type: "int", nullable: false),
|
||||
ComumnLength = table.Column<int>(type: "int", nullable: false),
|
||||
ObjectTypeAttributeSzName = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
ClientId = table.Column<int>(type: "int", nullable: false),
|
||||
ObjectTypeszDocTypeName = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
DepartmentId = table.Column<int>(type: "int", nullable: false),
|
||||
Seq = table.Column<int>(type: "int", nullable: false),
|
||||
WindreamSearchId = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_WindreamColumnsToDepartment", x => x.WindreamColumnsToDepartmentId);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "WindreamIndex",
|
||||
schema: "webapi",
|
||||
columns: table => new
|
||||
{
|
||||
WindreamIndexId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
AttributeDwAttrId = table.Column<int>(type: "int", nullable: false),
|
||||
AttributeSzColumnName = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
Comment = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
ComumnLength = table.Column<int>(type: "int", nullable: true),
|
||||
AttributeDwAttrType = table.Column<int>(type: "int", nullable: true),
|
||||
ClientId = table.Column<int>(type: "int", nullable: false),
|
||||
ObjectTypeAttributeSzName = table.Column<string>(type: "nvarchar(max)", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_WindreamIndex", x => x.WindreamIndexId);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "WindreamIndexToWindreamSearchToDepartment",
|
||||
schema: "webapi",
|
||||
columns: table => new
|
||||
{
|
||||
WindreamIndexToWindreamSearchToDepartmentId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
WindreamSearchToDepartmentId = table.Column<int>(type: "int", nullable: false),
|
||||
WindreamIndexId = table.Column<int>(type: "int", nullable: false),
|
||||
Seq = table.Column<int>(type: "int", nullable: false),
|
||||
AttributeSzColumnName = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
ObjectTypeAttributeSzName = table.Column<string>(type: "nvarchar(max)", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_WindreamIndexToWindreamSearchToDepartment", x => x.WindreamIndexToWindreamSearchToDepartmentId);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "WindreamInputFolder",
|
||||
schema: "webapi",
|
||||
columns: table => new
|
||||
{
|
||||
WindreamInputFolderId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
XMLPath = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
Comment = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
ClientId = table.Column<int>(type: "int", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_WindreamInputFolder", x => x.WindreamInputFolderId);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "WindreamSearch",
|
||||
schema: "webapi",
|
||||
columns: table => new
|
||||
{
|
||||
WindreamSearchId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
XMLPath = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
Comment = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
ClientId = table.Column<int>(type: "int", nullable: false),
|
||||
Color = table.Column<int>(type: "int", nullable: true),
|
||||
SearchIndex = table.Column<int>(type: "int", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_WindreamSearch", x => x.WindreamSearchId);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "WindreamSearchItem",
|
||||
schema: "webapi",
|
||||
columns: table => new
|
||||
{
|
||||
WindreamSearchItemId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
Comment = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
ClientId = table.Column<int>(type: "int", nullable: false),
|
||||
Caption = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
PlaceHolder = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
SearchTemplate = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
ConnectedList = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
AlternativeWindreamSearchItemIdList = table.Column<string>(type: "nvarchar(max)", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_WindreamSearchItem", x => x.WindreamSearchItemId);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "WindreamSearchItemToWindreamSearchToDepartment",
|
||||
schema: "webapi",
|
||||
columns: table => new
|
||||
{
|
||||
WindreamSearchItemToWindreamSearchToDepartmentId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
WindreamSearchToDepartmentId = table.Column<int>(type: "int", nullable: false),
|
||||
Seq = table.Column<int>(type: "int", nullable: false),
|
||||
WindreamSearchItemId = table.Column<int>(type: "int", nullable: false),
|
||||
DepartmentId = table.Column<int>(type: "int", nullable: false),
|
||||
WindreamSearchItemName = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
WindreamSearchItemCaption = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
WindreamSearchItemPlaceHolder = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
WindreamSearchItemSearchTemplate = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
WindreamSearchItemTemplate = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
WindreamSearchItemConnectedList = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
WindreamSearchItemComment = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
WindreamSearchIndexType = table.Column<int>(type: "int", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_WindreamSearchItemToWindreamSearchToDepartment", x => x.WindreamSearchItemToWindreamSearchToDepartmentId);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "WindreamSearchToDepartment",
|
||||
schema: "webapi",
|
||||
columns: table => new
|
||||
{
|
||||
WindreamSearchToDepartmentId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
DepartmentId = table.Column<int>(type: "int", nullable: false),
|
||||
WindreamSearchId = table.Column<int>(type: "int", nullable: false),
|
||||
Seq = table.Column<int>(type: "int", nullable: false),
|
||||
IsActive = table.Column<bool>(type: "bit", nullable: false),
|
||||
DepartmentName = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
WindreamSearchName = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
WindreamSearchXMLPath = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
WindreamSearchComment = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
WindreamSearchColor = table.Column<int>(type: "int", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_WindreamSearchToDepartment", x => x.WindreamSearchToDepartmentId);
|
||||
});
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "AdWebAppToWebAppRole",
|
||||
schema: "webapi");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "CostCentre",
|
||||
schema: "webapi");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Department",
|
||||
schema: "webapi");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "DepartmentToWebAppToEmployeeForWindream",
|
||||
schema: "webapi");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "DocumentArt",
|
||||
schema: "webapi");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "DocumentArtToDepartment",
|
||||
schema: "webapi");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Employee",
|
||||
schema: "webapi");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "EmployeeAttribute",
|
||||
schema: "webapi");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "EmployeeStatus",
|
||||
schema: "webapi");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "EmployeeToAttribute",
|
||||
schema: "webapi");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "EmployeeToDepartment",
|
||||
schema: "webapi");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "EmployeeToWebApp",
|
||||
schema: "webapi");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Project",
|
||||
schema: "webapi");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Rang",
|
||||
schema: "webapi");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Subsidiary",
|
||||
schema: "webapi");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "WebApp",
|
||||
schema: "webapi");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "WebAppAdditionalRole",
|
||||
schema: "webapi");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "WebAppEmployeeInfo",
|
||||
schema: "webapi");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "WebAppRole",
|
||||
schema: "webapi");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "WebAppToDepartment",
|
||||
schema: "webapi");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "WebAppToWebAppAdditionalRole",
|
||||
schema: "webapi");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "WebAppToWebAppRole",
|
||||
schema: "webapi");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "WebAppUser",
|
||||
schema: "webapi");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "WindreamColumnsToDepartment",
|
||||
schema: "webapi");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "WindreamIndex",
|
||||
schema: "webapi");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "WindreamIndexToWindreamSearchToDepartment",
|
||||
schema: "webapi");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "WindreamInputFolder",
|
||||
schema: "webapi");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "WindreamSearch",
|
||||
schema: "webapi");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "WindreamSearchItem",
|
||||
schema: "webapi");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "WindreamSearchItemToWindreamSearchToDepartment",
|
||||
schema: "webapi");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "WindreamSearchToDepartment",
|
||||
schema: "webapi");
|
||||
}
|
||||
}
|
||||
}
|
||||
1090
DAL/Migrations/WebApiContextModelSnapshot.cs
Normal file
1090
DAL/Migrations/WebApiContextModelSnapshot.cs
Normal file
File diff suppressed because it is too large
Load Diff
@ -5,7 +5,7 @@ namespace DAL.Repositories
|
||||
{
|
||||
public class AdWebAppToWebAppRoleRepository : BaseRepository<AdWebAppToWebAppRole>
|
||||
{
|
||||
public AdWebAppToWebAppRoleRepository() : base(new WebApiContext())
|
||||
public AdWebAppToWebAppRoleRepository(WebApiContext context) : base(context)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@ namespace DAL.Repositories
|
||||
{
|
||||
public class CostCentreRepository : BaseRepository<CostCentre>
|
||||
{
|
||||
public CostCentreRepository() : base(new WebApiContext())
|
||||
public CostCentreRepository(WebApiContext context) : base(context)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,7 +10,7 @@ namespace DAL.Repositories
|
||||
{
|
||||
public class DepartmentRepository : BaseRepository<Department>
|
||||
{
|
||||
public DepartmentRepository() : base(new WebApiContext())
|
||||
public DepartmentRepository(WebApiContext context) : base(context)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@ namespace DAL.Repositories
|
||||
{
|
||||
public class DepartmentToWebAppToEmployeeForWindreamRepository : BaseRepository<DepartmentToWebAppToEmployeeForWindream>
|
||||
{
|
||||
public DepartmentToWebAppToEmployeeForWindreamRepository() : base(new WebApiContext())
|
||||
public DepartmentToWebAppToEmployeeForWindreamRepository(WebApiContext context) : base(context)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@ namespace DAL.Repositories
|
||||
{
|
||||
public class DocumentArtRepository : BaseRepository<DocumentArt>
|
||||
{
|
||||
public DocumentArtRepository() : base(new WebApiContext())
|
||||
public DocumentArtRepository(WebApiContext context) : base(context)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,7 +10,7 @@ namespace DAL.Repositories
|
||||
{
|
||||
public class DocumentArtToDepartmentRepository : BaseRepository<DocumentArtToDepartment>
|
||||
{
|
||||
public DocumentArtToDepartmentRepository() : base(new WebApiContext())
|
||||
public DocumentArtToDepartmentRepository(WebApiContext context) : base(context)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@ namespace DAL.Repositories
|
||||
{
|
||||
public class EmployeeAttributeRepository : BaseRepository<EmployeeAttribute>
|
||||
{
|
||||
public EmployeeAttributeRepository() : base(new WebApiContext())
|
||||
public EmployeeAttributeRepository(WebApiContext context) : base(context)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,7 +10,7 @@ namespace DAL.Repositories
|
||||
{
|
||||
public class EmployeeRepository : BaseRepository<Employee>
|
||||
{
|
||||
public EmployeeRepository() : base(new WebApiContext())
|
||||
public EmployeeRepository(WebApiContext context) : base(context)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@ namespace DAL.Repositories
|
||||
{
|
||||
public class EmployeeStatusRepository : BaseRepository<EmployeeStatus>
|
||||
{
|
||||
public EmployeeStatusRepository() : base(new WebApiContext())
|
||||
public EmployeeStatusRepository(WebApiContext context) : base(context)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,7 +10,7 @@ namespace DAL.Repositories
|
||||
{
|
||||
public class EmployeeToAttributeRepository : BaseRepository<EmployeeToAttribute>
|
||||
{
|
||||
public EmployeeToAttributeRepository() : base(new WebApiContext())
|
||||
public EmployeeToAttributeRepository(WebApiContext context) : base(context)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@ namespace DAL.Repositories
|
||||
{
|
||||
public class EmployeeToDepartmentRepository : BaseRepository<EmployeeToDepartment>
|
||||
{
|
||||
public EmployeeToDepartmentRepository() : base(new WebApiContext())
|
||||
public EmployeeToDepartmentRepository(WebApiContext context) : base(context)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ namespace DAL.Repositories
|
||||
{
|
||||
public class EmployeeToWebAppRepository : BaseRepository<EmployeeToWebApp>
|
||||
{
|
||||
public EmployeeToWebAppRepository() : base(new WebApiContext())
|
||||
public EmployeeToWebAppRepository(WebApiContext context) : base(context)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@ namespace DAL.Repositories
|
||||
{
|
||||
public class ProjectRepository : BaseRepository<Project>
|
||||
{
|
||||
public ProjectRepository() : base(new WebApiContext())
|
||||
public ProjectRepository(WebApiContext context) : base(context)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@ namespace DAL.Repositories
|
||||
{
|
||||
public class RangRepository : BaseRepository<Rang>
|
||||
{
|
||||
public RangRepository() : base(new WebApiContext())
|
||||
public RangRepository(WebApiContext context) : base(context)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@ namespace DAL.Repositories
|
||||
{
|
||||
public class SubsidiaryRepository : BaseRepository<Subsidiary>
|
||||
{
|
||||
public SubsidiaryRepository() : base(new WebApiContext())
|
||||
public SubsidiaryRepository(WebApiContext context) : base(context)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,7 +10,7 @@ namespace DAL.Repositories
|
||||
{
|
||||
public class WebAppAdditionalRoleRepository : BaseRepository<WebAppAdditionalRole>
|
||||
{
|
||||
public WebAppAdditionalRoleRepository() : base(new WebApiContext())
|
||||
public WebAppAdditionalRoleRepository(WebApiContext context) : base(context)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@ namespace DAL.Repositories
|
||||
{
|
||||
public class WebAppRepository : BaseRepository<WebApp>
|
||||
{
|
||||
public WebAppRepository() : base(new WebApiContext())
|
||||
public WebAppRepository(WebApiContext context) : base(context)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@ namespace DAL.Repositories
|
||||
{
|
||||
public class WebAppRoleRepository : BaseRepository<WebAppRole>
|
||||
{
|
||||
public WebAppRoleRepository() : base(new WebApiContext())
|
||||
public WebAppRoleRepository(WebApiContext context) : base(context)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,7 +12,7 @@ namespace DAL.Repositories
|
||||
{
|
||||
public class WebAppToDepartmentRepository : BaseRepository<WebAppToDepartment>
|
||||
{
|
||||
public WebAppToDepartmentRepository() : base(new WebApiContext())
|
||||
public WebAppToDepartmentRepository(WebApiContext context) : base(context)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ namespace DAL.Repositories
|
||||
{
|
||||
public class WebAppToWebAppAdditionalRoleRepository : BaseRepository<WebAppToWebAppAdditionalRole>
|
||||
{
|
||||
public WebAppToWebAppAdditionalRoleRepository() : base(new WebApiContext())
|
||||
public WebAppToWebAppAdditionalRoleRepository(WebApiContext context) : base(context)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@ namespace DAL.Repositories
|
||||
{
|
||||
public class WebAppToWebAppRoleRepository : BaseRepository<WebAppToWebAppRole>
|
||||
{
|
||||
public WebAppToWebAppRoleRepository() : base(new WebApiContext())
|
||||
public WebAppToWebAppRoleRepository(WebApiContext context) : base(context)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@ namespace DAL.Repositories
|
||||
{
|
||||
public class WindreamColumnsToDepartmentRepository : BaseRepository<WindreamColumnsToDepartment>
|
||||
{
|
||||
public WindreamColumnsToDepartmentRepository() : base(new WebApiContext())
|
||||
public WindreamColumnsToDepartmentRepository(WebApiContext context) : base(context)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@ namespace DAL.Repositories
|
||||
{
|
||||
public class WindreamIndexRepository : BaseRepository<WindreamIndex>
|
||||
{
|
||||
public WindreamIndexRepository() : base(new WebApiContext())
|
||||
public WindreamIndexRepository(WebApiContext context) : base(context)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@ namespace DAL.Repositories
|
||||
{
|
||||
public class WindreamIndexToWindreamSearchToDepartmentRepository : BaseRepository<WindreamIndexToWindreamSearchToDepartment>
|
||||
{
|
||||
public WindreamIndexToWindreamSearchToDepartmentRepository() : base(new WebApiContext())
|
||||
public WindreamIndexToWindreamSearchToDepartmentRepository(WebApiContext context) : base(context)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@ namespace DAL.Repositories
|
||||
{
|
||||
public class WindreamInputFolderRepository : BaseRepository<WindreamInputFolder>
|
||||
{
|
||||
public WindreamInputFolderRepository() : base(new WebApiContext())
|
||||
public WindreamInputFolderRepository(WebApiContext context) : base(context)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@ namespace DAL.Repositories
|
||||
{
|
||||
public class WindreamSearchItemRepository : BaseRepository<WindreamSearchItem>
|
||||
{
|
||||
public WindreamSearchItemRepository() : base(new WebApiContext())
|
||||
public WindreamSearchItemRepository(WebApiContext context) : base(context)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@ namespace DAL.Repositories
|
||||
{
|
||||
public class WindreamSearchItemToWindreamSearchToDepartmentRepository : BaseRepository<WindreamSearchItemToWindreamSearchToDepartment>
|
||||
{
|
||||
public WindreamSearchItemToWindreamSearchToDepartmentRepository() : base(new WebApiContext())
|
||||
public WindreamSearchItemToWindreamSearchToDepartmentRepository(WebApiContext context) : base(context)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@ namespace DAL.Repositories
|
||||
{
|
||||
public class WindreamSearchRepository : BaseRepository<WindreamSearch>
|
||||
{
|
||||
public WindreamSearchRepository() : base(new WebApiContext())
|
||||
public WindreamSearchRepository(WebApiContext context) : base(context)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@ namespace DAL.Repositories
|
||||
{
|
||||
public class WindreamSearchToDepartmentRepository : BaseRepository<WindreamSearchToDepartment>
|
||||
{
|
||||
public WindreamSearchToDepartmentRepository() : base(new WebApiContext())
|
||||
public WindreamSearchToDepartmentRepository(WebApiContext context) : base(context)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@ -8,11 +8,7 @@ namespace DAL
|
||||
{
|
||||
public partial class WebApiContext : WebApiBaseContext
|
||||
{
|
||||
public WebApiContext() : base()
|
||||
{
|
||||
}
|
||||
|
||||
public WebApiContext(DbContextOptions<DbContext> options) : base(options)
|
||||
public WebApiContext(DbContextOptions<WebApiContext> options) : base(options)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@ -11,7 +11,7 @@ namespace DAL._Shared.SharedRepositories
|
||||
public class WebAppEmployeeInfoRepository : BaseRepository<WebAppEmployeeInfo>
|
||||
|
||||
{
|
||||
public WebAppEmployeeInfoRepository() : base(new WebApiContext())
|
||||
public WebAppEmployeeInfoRepository(WebApiContext context) : base(context)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@ namespace DAL._Shared.SharedRepositories
|
||||
{
|
||||
public class WebAppUserRepository : BaseRepository<WebAppUser>
|
||||
{
|
||||
public WebAppUserRepository() : base(new WebApiContext())
|
||||
public WebAppUserRepository(WebApiContext context) : base(context)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,10 +8,9 @@ namespace HRD.WebApi.DAL
|
||||
{
|
||||
}
|
||||
|
||||
public WebApiBaseContext(DbContextOptions<DbContext> options)
|
||||
public WebApiBaseContext(DbContextOptions options)
|
||||
: base(options)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -11,7 +11,6 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StaffDBServer.Controllers
|
||||
{
|
||||
[JWTAuthorize]
|
||||
public class EmployeeController : BaseController<Employee>
|
||||
{
|
||||
public EmployeeController(IBaseRepository<Employee> repositoryBase) : base(repositoryBase)
|
||||
|
||||
@ -9,39 +9,41 @@ namespace StaffDBServer.Extends
|
||||
{
|
||||
public static class ServiceExtensions4BaseRepository
|
||||
{
|
||||
public static void ConfigureRepositoryWrapper(this IServiceCollection services)
|
||||
public static IServiceCollection ConfigureRepositoryWrapper(this IServiceCollection services)
|
||||
{
|
||||
services.AddScoped(typeof(IBaseRepository<Subsidiary>), typeof(SubsidiaryRepository));
|
||||
services.AddScoped(typeof(IBaseRepository<WindreamInputFolder>), typeof(WindreamInputFolderRepository));
|
||||
services.AddScoped(typeof(IBaseRepository<WindreamSearchToDepartment>), typeof(WindreamSearchToDepartmentRepository));
|
||||
services.AddScoped(typeof(IBaseRepository<WindreamSearchItemToWindreamSearchToDepartment>), typeof(WindreamSearchItemToWindreamSearchToDepartmentRepository));
|
||||
services.AddScoped(typeof(IBaseRepository<WindreamSearchItem>), typeof(WindreamSearchItemRepository));
|
||||
services.AddScoped(typeof(IBaseRepository<WindreamSearch>), typeof(WindreamSearchRepository));
|
||||
services.AddScoped(typeof(IBaseRepository<WindreamIndexToWindreamSearchToDepartment>), typeof(WindreamIndexToWindreamSearchToDepartmentRepository));
|
||||
services.AddScoped(typeof(IBaseRepository<WindreamIndex>), typeof(WindreamIndexRepository));
|
||||
services.AddScoped(typeof(IBaseRepository<WindreamColumnsToDepartment>), typeof(WindreamColumnsToDepartmentRepository));
|
||||
services.AddScoped(typeof(IBaseRepository<WebAppToWebAppRole>), typeof(WebAppToWebAppRoleRepository));
|
||||
services.AddScoped(typeof(IBaseRepository<WebAppToWebAppAdditionalRole>), typeof(WebAppToWebAppAdditionalRoleRepository));
|
||||
services.AddScoped(typeof(IBaseRepository<WebAppToDepartment>), typeof(WebAppToDepartmentRepository));
|
||||
services.AddScoped(typeof(IBaseRepository<WebAppAdditionalRole>), typeof(WebAppAdditionalRoleRepository));
|
||||
services.AddScoped(typeof(IBaseRepository<EmployeeToWebApp>), typeof(EmployeeToWebAppRepository));
|
||||
services.AddScoped(typeof(IBaseRepository<EmployeeToDepartment>), typeof(EmployeeToDepartmentRepository));
|
||||
services.AddScoped(typeof(IBaseRepository<EmployeeToAttribute>), typeof(EmployeeToAttributeRepository));
|
||||
services.AddScoped(typeof(IBaseRepository<Employee>), typeof(EmployeeRepository));
|
||||
services.AddScoped(typeof(IBaseRepository<DocumentArtToDepartment>), typeof(DocumentArtToDepartmentRepository));
|
||||
services.AddScoped(typeof(IBaseRepository<DepartmentToWebAppToEmployeeForWindream>), typeof(DepartmentToWebAppToEmployeeForWindreamRepository));
|
||||
services.AddScoped(typeof(IBaseRepository<WebAppRole>), typeof(WebAppRoleRepository));
|
||||
services.AddScoped(typeof(IBaseRepository<WebApp>), typeof(WebAppRepository));
|
||||
services.AddScoped(typeof(IBaseRepository<Rang>), typeof(RangRepository));
|
||||
services.AddScoped(typeof(IBaseRepository<Project>), typeof(ProjectRepository));
|
||||
services.AddScoped(typeof(IBaseRepository<EmployeeStatus>), typeof(EmployeeStatusRepository));
|
||||
services.AddScoped(typeof(IBaseRepository<EmployeeAttribute>), typeof(EmployeeAttributeRepository));
|
||||
services.AddScoped(typeof(IBaseRepository<DocumentArt>), typeof(DocumentArtRepository));
|
||||
services.AddScoped(typeof(IBaseRepository<Department>), typeof(DepartmentRepository));
|
||||
services.AddScoped(typeof(IBaseRepository<CostCentre>), typeof(CostCentreRepository));
|
||||
services.AddScoped(typeof(IBaseRepository<AdWebAppToWebAppRole>), typeof(AdWebAppToWebAppRoleRepository));
|
||||
services.AddScoped(typeof(IBaseRepository<WebAppUser>), typeof(WebAppUserRepository));
|
||||
services.AddScoped(typeof(IBaseRepository<WebAppEmployeeInfo>), typeof(WebAppEmployeeInfo));
|
||||
services.AddScoped<IBaseRepository<Subsidiary>, SubsidiaryRepository>();
|
||||
services.AddScoped<IBaseRepository<WindreamInputFolder>, WindreamInputFolderRepository>();
|
||||
services.AddScoped<IBaseRepository<WindreamSearchToDepartment>, WindreamSearchToDepartmentRepository>();
|
||||
services.AddScoped<IBaseRepository<WindreamSearchItemToWindreamSearchToDepartment>, WindreamSearchItemToWindreamSearchToDepartmentRepository>();
|
||||
services.AddScoped<IBaseRepository<WindreamSearchItem>, WindreamSearchItemRepository>();
|
||||
services.AddScoped<IBaseRepository<WindreamSearch>, WindreamSearchRepository>();
|
||||
services.AddScoped<IBaseRepository<WindreamIndexToWindreamSearchToDepartment>, WindreamIndexToWindreamSearchToDepartmentRepository>();
|
||||
services.AddScoped<IBaseRepository<WindreamIndex>, WindreamIndexRepository>();
|
||||
services.AddScoped<IBaseRepository<WindreamColumnsToDepartment>, WindreamColumnsToDepartmentRepository>();
|
||||
services.AddScoped<IBaseRepository<WebAppToWebAppRole>, WebAppToWebAppRoleRepository>();
|
||||
services.AddScoped<IBaseRepository<WebAppToWebAppAdditionalRole>, WebAppToWebAppAdditionalRoleRepository>();
|
||||
services.AddScoped<IBaseRepository<WebAppToDepartment>, WebAppToDepartmentRepository>();
|
||||
services.AddScoped<IBaseRepository<WebAppAdditionalRole>, WebAppAdditionalRoleRepository>();
|
||||
services.AddScoped<IBaseRepository<EmployeeToWebApp>, EmployeeToWebAppRepository>();
|
||||
services.AddScoped<IBaseRepository<EmployeeToDepartment>, EmployeeToDepartmentRepository>();
|
||||
services.AddScoped<IBaseRepository<EmployeeToAttribute>, EmployeeToAttributeRepository>();
|
||||
services.AddScoped<IBaseRepository<Employee>, EmployeeRepository>();
|
||||
services.AddScoped<IBaseRepository<DocumentArtToDepartment>, DocumentArtToDepartmentRepository>();
|
||||
services.AddScoped<IBaseRepository<DepartmentToWebAppToEmployeeForWindream>, DepartmentToWebAppToEmployeeForWindreamRepository>();
|
||||
services.AddScoped<IBaseRepository<WebAppRole>, WebAppRoleRepository>();
|
||||
services.AddScoped<IBaseRepository<WebApp>, WebAppRepository>();
|
||||
services.AddScoped<IBaseRepository<Rang>, RangRepository>();
|
||||
services.AddScoped<IBaseRepository<Project>, ProjectRepository>();
|
||||
services.AddScoped<IBaseRepository<EmployeeStatus>, EmployeeStatusRepository>();
|
||||
services.AddScoped<IBaseRepository<EmployeeAttribute>, EmployeeAttributeRepository>();
|
||||
services.AddScoped<IBaseRepository<DocumentArt>, DocumentArtRepository>();
|
||||
services.AddScoped<IBaseRepository<Department>, DepartmentRepository>();
|
||||
services.AddScoped<IBaseRepository<CostCentre>, CostCentreRepository>();
|
||||
services.AddScoped<IBaseRepository<AdWebAppToWebAppRole>, AdWebAppToWebAppRoleRepository>();
|
||||
services.AddScoped<IBaseRepository<WebAppUser>, WebAppUserRepository>();
|
||||
services.AddScoped<IBaseRepository<WebAppEmployeeInfo>, WebAppEmployeeInfoRepository>();
|
||||
|
||||
return services;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<solution>
|
||||
<add key="disableSourceControlIntegration" value="true" />
|
||||
</solution>
|
||||
<packageSources>
|
||||
<clear />
|
||||
<add key="NuGet Official" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
|
||||
<add key="Hensel Packages" value="https://pkgs.dev.azure.com/hensel-recycling/_packaging/HenselFeed/nuget/v3/index.json" protocolVersion="3" />
|
||||
</packageSources>
|
||||
</configuration>
|
||||
@ -1,67 +1,100 @@
|
||||
using HRD.AppLogger;
|
||||
using DAL;
|
||||
using HRD.AppLogger;
|
||||
using HRD.WebApi;
|
||||
using Microsoft.AspNetCore;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using NLog.Web;
|
||||
using StaffDBServer.Extends;
|
||||
using StaffDBServer.SharedExtensions;
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using HRD.LDAPService.JWT;
|
||||
using HRD.WebApi.DAL.Middleware;
|
||||
using HRD.WebApi.Helpers;
|
||||
|
||||
namespace StaffDBServer
|
||||
AppDomain.CurrentDomain.UnhandledException += (object sender, UnhandledExceptionEventArgs unhandledExceptionEventArgs) =>
|
||||
{
|
||||
public class Program
|
||||
ILoggerManager logger = new LoggerManager();
|
||||
logger.LogException((Exception)unhandledExceptionEventArgs.ExceptionObject, "Application closed due to exception.");
|
||||
NLog.LogManager.Flush();
|
||||
};
|
||||
|
||||
IConfiguration configuration = new ConfigurationBuilder().AddJsonFile("appsettings.json", true, true).Build();
|
||||
|
||||
WebApiConfig.Init(configuration, Assembly.GetExecutingAssembly().GetName());
|
||||
|
||||
ILoggerManager logger = new LoggerManager();
|
||||
logger.LogWarn($"[Start WebApi Server] BaseDirectory: {AppDomain.CurrentDomain.BaseDirectory}; TargetFrameworkName: {AppDomain.CurrentDomain.SetupInformation.TargetFrameworkName}");
|
||||
|
||||
try
|
||||
{
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// Configure logging
|
||||
builder.Logging.ClearProviders();
|
||||
builder.Logging.SetMinimumLevel(LogLevel.Warning);
|
||||
builder.Host.UseNLog();
|
||||
|
||||
// Add services to the container
|
||||
builder.Services.ConfigureWebApiExtensionsAtFirst(); // at first
|
||||
builder.Services.ConfigureRepositoryWrapper(); // add repos
|
||||
|
||||
var cnnStr = WebApiConfig.ConnectionString(EN_ConnectionType.SQLServer);
|
||||
|
||||
builder.Services.AddDbContext<WebApiContext>(options =>
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
const int dbTimeoutInMin = 5;
|
||||
options.UseSqlServer(cnnStr,
|
||||
opts => opts.CommandTimeout((int)TimeSpan.FromMinutes(dbTimeoutInMin).TotalSeconds));
|
||||
});
|
||||
|
||||
{
|
||||
AppDomain.CurrentDomain.UnhandledException += CurrentDomainOnUnhandledException;
|
||||
builder.Services.AddStaffDBRepositories();
|
||||
builder.Services.ConfigureWebApiExtensionsEnd(); // should come last
|
||||
|
||||
IConfiguration configuration = new ConfigurationBuilder().AddJsonFile("appsettings.json", true, true).Build();
|
||||
var app = builder.Build();
|
||||
|
||||
WebApiConfig.Init(configuration, Assembly.GetExecutingAssembly().GetName());
|
||||
((IApplicationBuilder)app).ApplicationServices.SetupNLogServiceLocator();
|
||||
|
||||
ILoggerManager logger = new LoggerManager();
|
||||
logger.LogWarn($"[Start WebApi Server] BaseDirectory: {AppDomain.CurrentDomain.BaseDirectory}; TargetFrameworkName: {AppDomain.CurrentDomain.SetupInformation.TargetFrameworkName}");
|
||||
|
||||
try
|
||||
{
|
||||
CreateWebHostBuilder(args)
|
||||
.Build()
|
||||
.Run();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.LogException(ex, "Stopped program because of exception");
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
// Ensure to flush and stop internal timers/threads before application-exit (Avoid segmentation fault on Linux)
|
||||
NLog.LogManager.Flush();
|
||||
NLog.LogManager.Shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
|
||||
|
||||
WebHost.CreateDefaultBuilder(args)
|
||||
|
||||
.ConfigureLogging(options => options.ClearProviders())
|
||||
.UseStartup<Startup>().ConfigureLogging(logging =>
|
||||
{
|
||||
logging.ClearProviders();
|
||||
logging.SetMinimumLevel(LogLevel.Warning);
|
||||
})
|
||||
.UseNLog();
|
||||
|
||||
private static void CurrentDomainOnUnhandledException(object sender, UnhandledExceptionEventArgs unhandledExceptionEventArgs)
|
||||
|
||||
{
|
||||
ILoggerManager logger = new LoggerManager();
|
||||
logger.LogException((Exception)unhandledExceptionEventArgs.ExceptionObject, "Application closed due to exception.");
|
||||
NLog.LogManager.Flush();
|
||||
}
|
||||
// Configure the HTTP request pipeline
|
||||
if (app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseDeveloperExceptionPage();
|
||||
}
|
||||
else
|
||||
{
|
||||
app.UseHsts();
|
||||
}
|
||||
|
||||
app.AddCustomExceptionHandling();
|
||||
app.UseHttpsRedirection();
|
||||
app.UseRouting();
|
||||
app.UseCors("AllowAllOrigins");
|
||||
app.UseDefaultFiles();
|
||||
app.UseStaticFiles();
|
||||
app.UseOpenApi();
|
||||
app.UseDALMiddleware();
|
||||
app.UseJwtMiddleware();
|
||||
app.ConfigureSwagger();
|
||||
|
||||
app.MapControllers();
|
||||
|
||||
app.Run();
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.LogException(ex, "Stopped program because of exception");
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
// Ensure to flush and stop internal timers/threads before application-exit (Avoid segmentation fault on Linux)
|
||||
NLog.LogManager.Flush();
|
||||
NLog.LogManager.Shutdown();
|
||||
}
|
||||
@ -14,6 +14,12 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.32" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.32">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.32" />
|
||||
<PackageReference Include="Microsoft.Extensions.PlatformAbstractions" Version="1.1.0" />
|
||||
<PackageReference Include="NSwag.AspNetCore" Version="14.0.7" />
|
||||
</ItemGroup>
|
||||
@ -26,4 +32,10 @@
|
||||
<ItemGroup>
|
||||
<Folder Include="wwwroot\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="local.db">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@ -22,15 +22,18 @@ namespace StaffDBServer
|
||||
services.ConfigureWebApiExtensionsAtFirst(); //at first
|
||||
|
||||
services.ConfigureRepositoryWrapper(); //add repos
|
||||
|
||||
|
||||
services.AddDbContext<WebApiContext>(options =>
|
||||
{
|
||||
const int dbTimeoutInMin = 5;
|
||||
var cnnStr = WebApiConfig.ConnectionString(EN_ConnectionType.SQLServer);
|
||||
options
|
||||
.UseSqlServer(WebApiConfig.ConnectionString(EN_ConnectionType.SQLServer),
|
||||
.UseSqlServer(cnnStr,
|
||||
opts => opts.CommandTimeout((int)TimeSpan.FromMinutes(dbTimeoutInMin).TotalSeconds));
|
||||
});
|
||||
|
||||
services.AddStaffDBRepositories();
|
||||
|
||||
services.ConfigureWebApiExtensionsEnd(); //should come last
|
||||
}
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@ namespace StaffDBServer.SharedExtensions
|
||||
[ApiController]
|
||||
public class InfoController : InfoBaseController
|
||||
{
|
||||
public InfoController() : base(new WebApiContext())
|
||||
public InfoController(WebApiContext context) : base(context)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,8 +14,13 @@ namespace StaffDBServer.SharedControllers
|
||||
[JWTAuthorizeAttribute]
|
||||
public class WebAppUserController : BaseMiniController
|
||||
{
|
||||
public WebAppUserController() : base(new WebApiContext())
|
||||
private readonly WebAppUserRepository webAppUserRepository;
|
||||
WebAppUserHelper webAppUserHelper;
|
||||
|
||||
public WebAppUserController(WebApiContext context, WebAppUserRepository webAppUserRepository, WebAppUserHelper webAppUserHelper) : base(context)
|
||||
{
|
||||
this.webAppUserRepository = webAppUserRepository;
|
||||
this.webAppUserHelper = webAppUserHelper;
|
||||
}
|
||||
|
||||
[HttpPost("Culture")]
|
||||
@ -23,8 +28,6 @@ namespace StaffDBServer.SharedControllers
|
||||
{
|
||||
try
|
||||
{
|
||||
//User Should by in the DB
|
||||
WebAppUserRepository webAppUserRepository = new WebAppUserRepository();
|
||||
WebAppUser userFromDB = await webAppUserRepository.GetByAsync(u => u.LoginName == userFromClient.LoginName, false);
|
||||
|
||||
if (userFromDB != default) //first login, get User from WebAppEmployeeInfo
|
||||
@ -51,7 +54,7 @@ namespace StaffDBServer.SharedControllers
|
||||
try
|
||||
{
|
||||
var accessToken = Request.Headers[HeaderNames.Authorization];
|
||||
WebAppUserHelper webAppUserHelper = new WebAppUserHelper();
|
||||
|
||||
WebAppUser result = await webAppUserHelper.CheckLoginWithJWTAsync(accessToken, userFromClient.ClientVersion);
|
||||
return new OkObjectResult(result);
|
||||
}
|
||||
@ -67,8 +70,7 @@ namespace StaffDBServer.SharedControllers
|
||||
public async Task<IActionResult> LoginWithNameAndPasswordAsync([FromBody] WebAppUser userFromClient, int webApiId)
|
||||
{
|
||||
try
|
||||
{
|
||||
WebAppUserHelper webAppUserHelper = new WebAppUserHelper();
|
||||
{
|
||||
var result = await webAppUserHelper.CheckLoginWithNameAndPasswordAsync(userFromClient, webApiId);
|
||||
return new OkObjectResult(result);
|
||||
}
|
||||
@ -85,7 +87,6 @@ namespace StaffDBServer.SharedControllers
|
||||
{
|
||||
try
|
||||
{
|
||||
WebAppUserHelper webAppUserHelper = new WebAppUserHelper();
|
||||
var result = await webAppUserHelper.CheckLoginWithNameAndPasswordAsync(userFromClient);
|
||||
return new OkObjectResult(result);
|
||||
}
|
||||
|
||||
@ -14,9 +14,18 @@ namespace StaffDBServer.SharedControllers
|
||||
|
||||
public int GlbWebApiIdStaffDB { get; private set; } = 2;
|
||||
|
||||
public async Task<WebAppUser> CheckLoginWithJWTAsync(StringValues accessToken, string clientVersion)
|
||||
WebAppUserRepository webAppUserRepository;
|
||||
|
||||
WebAppEmployeeInfoRepository webAppEmployeeInfoRepository;
|
||||
|
||||
public WebAppUserHelper(WebAppUserRepository webAppUserRepository, WebAppEmployeeInfoRepository webAppEmployeeInfoRepository)
|
||||
{
|
||||
WebAppUserRepository webAppUserRepository = new WebAppUserRepository();
|
||||
this.webAppUserRepository = webAppUserRepository;
|
||||
this.webAppEmployeeInfoRepository = webAppEmployeeInfoRepository;
|
||||
}
|
||||
|
||||
public async Task<WebAppUser> CheckLoginWithJWTAsync(StringValues accessToken, string clientVersion)
|
||||
{
|
||||
if (!JwtManager.IsValidatJwtTokenSubject(accessToken))
|
||||
{
|
||||
throw new UnauthorizedAccessException($"Not valid JWT");
|
||||
@ -27,8 +36,7 @@ namespace StaffDBServer.SharedControllers
|
||||
{
|
||||
throw new UnauthorizedAccessException($"Unable to decrypt JWT");
|
||||
}
|
||||
|
||||
WebAppEmployeeInfoRepository webAppEmployeeInfoRepository = new WebAppEmployeeInfoRepository();
|
||||
|
||||
WebAppEmployeeInfo webAppEmployeeInfo = await webAppEmployeeInfoRepository.GetByAsync(x => x.LoginName == ldapUser.LoginName);
|
||||
if (webAppEmployeeInfo == default)
|
||||
{
|
||||
@ -63,10 +71,9 @@ namespace StaffDBServer.SharedControllers
|
||||
public async Task<WebAppUser> CheckLoginWithNameAndPasswordAsync(WebAppUser userFromClient, int webAppId)
|
||||
{
|
||||
try
|
||||
{
|
||||
WebAppEmployeeInfoRepository webAppEmployeeInfoRepository = new WebAppEmployeeInfoRepository();
|
||||
{
|
||||
WebAppEmployeeInfo webAppEmployeeInfo = await webAppEmployeeInfoRepository.GetByAsync(x => x.LoginName == userFromClient.LoginName && x.WebAppId == webAppId);
|
||||
WebAppUserRepository webAppUserRepository = new WebAppUserRepository();
|
||||
|
||||
return await DoCheckLoginWithNameAndPasswordAsync(userFromClient, webAppUserRepository, webAppEmployeeInfoRepository);
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -79,9 +86,8 @@ namespace StaffDBServer.SharedControllers
|
||||
{
|
||||
try
|
||||
{
|
||||
WebAppEmployeeInfoRepository webAppEmployeeInfoRepository = new WebAppEmployeeInfoRepository();
|
||||
WebAppEmployeeInfo webAppEmployeeInfo = await webAppEmployeeInfoRepository.GetByAsync(x => x.LoginName == userFromClient.LoginName && x.WebAppId == GlbWebApiIdStaffDB);
|
||||
WebAppUserRepository webAppUserRepository = new WebAppUserRepository();
|
||||
|
||||
return await DoCheckLoginWithNameAndPasswordAsync(userFromClient, webAppUserRepository, webAppEmployeeInfoRepository);
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
@ -4,9 +4,8 @@
|
||||
"Default": "Warning"
|
||||
}
|
||||
},
|
||||
|
||||
"ConnectionStrings": {
|
||||
"sqlConnection": "server=DHDEAB-S883-2\\Dev2; database=DDStaffDB; TrustServerCertificate=True; Encrypt=False; MultipleActiveResultSets=True; User Id=webApiUser; Password=webApiUserPWD!"
|
||||
"sqlConnection": "Data Source=(localdb)\\MSSQLLocalDB;Initial Catalog=dev_db;Integrated Security=True;Connect Timeout=30;Encrypt=False;Trust Server Certificate=False;Application Intent=ReadWrite;Multi Subnet Failover=False"
|
||||
},
|
||||
"AppConfig": {
|
||||
"LDAP_WebAppGroup_Is_Live": "false",
|
||||
|
||||
BIN
StaffDBServer/local.db
Normal file
BIN
StaffDBServer/local.db
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user