Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
ProjectsStatusManagement
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hasan.bahjat
ProjectsStatusManagement
Commits
0f8a3073
Commit
0f8a3073
authored
Aug 26, 2024
by
hasan khaddour
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix s
parent
a946c6cb
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
2816 additions
and
37 deletions
+2816
-37
AppDbContext.cs
...Infrastructure.Persistence/AppDataContext/AppDbContext.cs
+2
-2
DependencyInjection.cs
...e/DependencyInjectionConfiguration/DependencyInjection.cs
+47
-7
ProjectEntityConfiguration.cs
...tence/EntitiesConfiguration/ProjectEntityConfiguration.cs
+15
-0
20240826084243_AddProjectTypeDetails.Designer.cs
...grations/20240826084243_AddProjectTypeDetails.Designer.cs
+1204
-0
20240826084243_AddProjectTypeDetails.cs
...stence/Migrations/20240826084243_AddProjectTypeDetails.cs
+44
-0
20240826085542_AddParticipationHistory.Designer.cs
...ations/20240826085542_AddParticipationHistory.Designer.cs
+1262
-0
20240826085542_AddParticipationHistory.cs
...ence/Migrations/20240826085542_AddParticipationHistory.cs
+60
-0
AppDbContextModelSnapshot.cs
...cture.Persistence/Migrations/AppDbContextModelSnapshot.cs
+90
-21
ProjectsTypesRepository.cs
...Repositories/ProjectRepository/ProjectsTypesRepository.cs
+1
-1
SeedData.cs
...nt.Infrastructure.Persistence/SeedDataContext/SeedData.cs
+13
-1
UnitOfWork.cs
PSManagement.Infrastructure.Persistence/UoW/UnitOfWork.cs
+35
-2
AuthenticationService.cs
...nt.Infrastructure/Authentication/AuthenticationService.cs
+26
-2
DependencyInjection.cs
...e/DependencyInjectionConfiguration/DependencyInjection.cs
+12
-1
EmployeesSyncJobSettings.cs
...ement.Infrastructure/Settings/EmployeesSyncJobSettings.cs
+1
-0
SyncEmployeesService.cs
PSManagement.Infrastructure/SyncData/SyncEmployeesService.cs
+4
-0
No files found.
PSManagement.Infrastructure.Persistence/AppDataContext/AppDbContext.cs
View file @
0f8a3073
...
...
@@ -19,6 +19,7 @@ namespace PSManagement.Infrastructure.Persistence
}
public
DbSet
<
ParticipationChange
>
ParticipationChanges
{
get
;
set
;
}
public
DbSet
<
User
>
Users
{
get
;
set
;
}
public
DbSet
<
Role
>
Roles
{
get
;
set
;
}
public
DbSet
<
Permission
>
Permission
{
get
;
set
;
}
...
...
@@ -42,8 +43,7 @@ namespace PSManagement.Infrastructure.Persistence
{
modelBuilder
.
ApplyConfigurationsFromAssembly
(
typeof
(
AppDbContext
).
Assembly
);
// modelBuilder.Entity<BaseEntity>().Ignore(e => e.Events);
SeedData
.
SeedAsync
(
modelBuilder
).
Wait
();
base
.
OnModelCreating
(
modelBuilder
);
...
...
PSManagement.Infrastructure.Persistence/DependencyInjectionConfiguration/DependencyInjection.cs
View file @
0f8a3073
...
...
@@ -27,10 +27,39 @@ namespace PSManagement.Infrastructure.Persistence.DI
public
static
IServiceCollection
AddPersistence
(
this
IServiceCollection
services
,
IConfiguration
configuration
)
{
services
.
AddDbContext
<
AppDbContext
>(
options
=>
{
options
.
UseSqlServer
(
configuration
.
GetConnectionString
(
"DefaultConnection"
));
});
services
.
AddBuilders
()
.
AddDataContext
(
configuration
)
.
AddRepositories
()
.
AddUOW
();
return
services
;
}
#
region
Register
Builders
private
static
IServiceCollection
AddBuilders
(
this
IServiceCollection
services
)
{
services
.
AddScoped
<
ProjectBuilder
>();
return
services
;
}
#
endregion
Register
Builders
#
region
Register
UOW
private
static
IServiceCollection
AddUOW
(
this
IServiceCollection
services
)
{
services
.
AddScoped
<
IUnitOfWork
,
UnitOfWork
>();
return
services
;
}
#
endregion
Register
UOW
#
region
Register
Repositories
private
static
IServiceCollection
AddRepositories
(
this
IServiceCollection
services
)
{
services
.
AddScoped
(
typeof
(
IRepository
<>),
typeof
(
BaseRepository
<>));
services
.
AddScoped
<
IUsersRepository
,
UsersRepository
>();
services
.
AddScoped
<
ICustomersRepository
,
CustomersReposiotry
>();
services
.
AddScoped
<
IProjectsRepository
,
ProjectsRepository
>();
...
...
@@ -41,12 +70,23 @@ namespace PSManagement.Infrastructure.Persistence.DI
services
.
AddScoped
<
ITracksRepository
,
TracksRepository
>();
services
.
AddScoped
<
IProjectTypesRepository
,
ProjectsTypesRepository
>();
services
.
AddScoped
<
ProjectBuilder
>();
services
.
AddScoped
(
typeof
(
IRepository
<>),
typeof
(
BaseRepository
<>));
services
.
AddScoped
<
IUnitOfWork
,
UnitOfWork
>();
return
services
;
}
#
endregion
Register
Repositoryies
#
region
Register
Data
context
private
static
IServiceCollection
AddDataContext
(
this
IServiceCollection
services
,
IConfiguration
configuration
)
{
services
.
AddDbContext
<
AppDbContext
>(
options
=>
{
options
.
UseSqlServer
(
configuration
.
GetConnectionString
(
"DefaultConnection"
));
});
return
services
;
}
#
endregion
Register
Data
Context
}
}
PSManagement.Infrastructure.Persistence/EntitiesConfiguration/ProjectEntityConfiguration.cs
View file @
0f8a3073
...
...
@@ -97,6 +97,21 @@ namespace PSManagement.Infrastructure.Persistence.EntitiesConfiguration
;
}
}
public
class
participationChangesConfiguration
:
IEntityTypeConfiguration
<
ParticipationChange
>
{
public
void
Configure
(
EntityTypeBuilder
<
ParticipationChange
>
builder
)
{
builder
.
HasOne
(
e
=>
e
.
Employee
)
.
WithOne
();
builder
.
HasOne
(
e
=>
e
.
Project
)
.
WithOne
()
;
}
}
}
PSManagement.Infrastructure.Persistence/Migrations/20240826084243_AddProjectTypeDetails.Designer.cs
0 → 100644
View file @
0f8a3073
// <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
PSManagement.Infrastructure.Persistence
;
namespace
PSManagement.Infrastructure.Persistence.Migrations
{
[
DbContext
(
typeof
(
AppDbContext
))]
[
Migration
(
"20240826084243_AddProjectTypeDetails"
)]
partial
class
AddProjectTypeDetails
{
protected
override
void
BuildTargetModel
(
ModelBuilder
modelBuilder
)
{
#pragma warning disable 612, 618
modelBuilder
.
HasAnnotation
(
"Relational:Collation"
,
"Arabic_CI_AS"
)
.
HasAnnotation
(
"Relational:MaxIdentifierLength"
,
128
)
.
HasAnnotation
(
"ProductVersion"
,
"5.0.17"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
modelBuilder
.
Entity
(
"PSManagement.Domain.Customers.Entities.ContactInfo"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"ContactType"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"ContactValue"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
?>(
"CustomerId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"CustomerId"
);
b
.
ToTable
(
"ContactInfo"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Customers.Entities.Customer"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"CustomerName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"Email"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Customers"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Employees.Entities.Department"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Name"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Departments"
);
b
.
HasData
(
new
{
Id
=
1
,
Name
=
"قسم المعلوميات"
},
new
{
Id
=
2
,
Name
=
"قسم النظم الإلكترونية"
},
new
{
Id
=
3
,
Name
=
"قسم الميكاترونيكس"
},
new
{
Id
=
4
,
Name
=
"قسم الفيزياء"
},
new
{
Id
=
5
,
Name
=
"مديرية التطوير والخدمات البرمجية"
},
new
{
Id
=
6
,
Name
=
"شؤون الطلاب"
});
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Employees.Entities.Employee"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
>(
"DepartmentId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"HIASTId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"UserId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"DepartmentId"
);
b
.
HasIndex
(
"UserId"
)
.
IsUnique
();
b
.
ToTable
(
"Employees"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.FinancialSpends.Entities.FinancialSpending"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"CostType"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"Description"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
DateTime
>(
"ExpectedSpendingDate"
)
.
HasColumnType
(
"datetime2"
);
b
.
Property
<
int
>(
"LocalPurchase"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"ProjectId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"ProjectId"
);
b
.
ToTable
(
"FinancialSpendings"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Identity.Entities.Permission"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Name"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Permission"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Identity.Entities.Role"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Name"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Roles"
);
b
.
HasData
(
new
{
Id
=
1
,
Name
=
"Admin"
},
new
{
Id
=
2
,
Name
=
"Employee"
},
new
{
Id
=
4
,
Name
=
"Scientific-Deputy"
},
new
{
Id
=
5
,
Name
=
"Planner"
});
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Identity.Entities.User"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Email"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"HashedPassword"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"UserName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Users"
);
b
.
HasData
(
new
{
Id
=
2
,
Email
=
"Admin@Admin"
,
HashedPassword
=
"1234"
,
UserName
=
"Admin"
});
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.Attachment"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"AttachmentDescription"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"AttachmentName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"AttachmentUrl"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
>(
"ProjectId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"ProjectId"
);
b
.
ToTable
(
"Attachment"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.EmployeeParticipate"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
>(
"EmployeeId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"PartialTimeRatio"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"ProjectId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"Role"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"EmployeeId"
);
b
.
HasIndex
(
"ProjectId"
);
b
.
ToTable
(
"EmployeeParticipate"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.Project"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"CurrentState"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"nvarchar(max)"
)
.
HasDefaultValueSql
(
"Proposed"
);
b
.
Property
<
int
?>(
"CustomerId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"ExecuterId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"ProjectManagerId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"ProjectTypeId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
?>(
"ProjectTypeId1"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"ProposerId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"TeamLeaderId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"CustomerId"
);
b
.
HasIndex
(
"ExecuterId"
);
b
.
HasIndex
(
"ProjectManagerId"
);
b
.
HasIndex
(
"ProjectTypeId"
);
b
.
HasIndex
(
"ProjectTypeId1"
);
b
.
HasIndex
(
"ProposerId"
);
b
.
HasIndex
(
"TeamLeaderId"
);
b
.
ToTable
(
"Projects"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.ProjectCompletion"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
DateTime
>(
"CompletionDate"
)
.
HasColumnType
(
"datetime2"
);
b
.
Property
<
string
>(
"CustomerNotes"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
>(
"CustomerRate"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"ProjectId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"ProjectId"
)
.
IsUnique
();
b
.
ToTable
(
"ProjectCompletion"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.Step"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
>(
"CurrentCompletionRatio"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"ProjectId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"Weight"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"ProjectId"
);
b
.
ToTable
(
"Steps"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.ProjectsTypes.Entites.ProjectType"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Description"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
>(
"ExpectedEffort"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"ExpectedNumberOfWorker"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"TypeName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"ProjectType"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.EmployeeTrack"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
>(
"EmployeeId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"Notes"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
>(
"TrackId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"EmployeeId"
);
b
.
HasIndex
(
"TrackId"
);
b
.
ToTable
(
"EmployeeTrack"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Entities.StepTrack"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"ExecutionState"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
>(
"OldExecutionRatio"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"StepId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"TrackExecutionRatio"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"TrackId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"StepId"
);
b
.
HasIndex
(
"TrackId"
);
b
.
ToTable
(
"StepTracks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Track"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Notes"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
>(
"ProjectId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"ProjectId"
);
b
.
ToTable
(
"Tracks"
);
});
modelBuilder
.
Entity
(
"PermissionRole"
,
b
=>
{
b
.
Property
<
int
>(
"PermissionsId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"RolesId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"PermissionsId"
,
"RolesId"
);
b
.
HasIndex
(
"RolesId"
);
b
.
ToTable
(
"PermissionRole"
);
});
modelBuilder
.
Entity
(
"UserRole"
,
b
=>
{
b
.
Property
<
int
>(
"RoleId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"UserId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"RoleId"
,
"UserId"
);
b
.
HasIndex
(
"UserId"
);
b
.
ToTable
(
"UserRole"
);
b
.
HasData
(
new
{
RoleId
=
1
,
UserId
=
1
});
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Customers.Entities.ContactInfo"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Customers.Entities.Customer"
,
null
)
.
WithMany
(
"ContactInfo"
)
.
HasForeignKey
(
"CustomerId"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Customers.Entities.Customer"
,
b
=>
{
b
.
OwnsOne
(
"PSManagement.Domain.Customers.ValueObjects.Address"
,
"Address"
,
b1
=>
{
b1
.
Property
<
int
>(
"CustomerId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
string
>(
"City"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"City"
);
b1
.
Property
<
string
>(
"StreetName"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"StreetName"
);
b1
.
Property
<
int
>(
"StreetNumber"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"StreetNumber"
);
b1
.
HasKey
(
"CustomerId"
);
b1
.
ToTable
(
"Customers"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"CustomerId"
);
});
b
.
Navigation
(
"Address"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Employees.Entities.Employee"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Department"
,
"Department"
)
.
WithMany
()
.
HasForeignKey
(
"DepartmentId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
);
b
.
HasOne
(
"PSManagement.Domain.Identity.Entities.User"
,
"User"
)
.
WithOne
(
"Employee"
)
.
HasForeignKey
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"UserId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
OwnsOne
(
"PSManagement.Domain.Employees.Entities.Availability"
,
"Availability"
,
b1
=>
{
b1
.
Property
<
int
>(
"EmployeeId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
int
>(
"CurrentWorkingHours"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"CurrentWorkingHours"
);
b1
.
Property
<
bool
>(
"IsAvailable"
)
.
HasColumnType
(
"bit"
)
.
HasColumnName
(
"IsAvailable"
);
b1
.
HasKey
(
"EmployeeId"
);
b1
.
ToTable
(
"Employees"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"EmployeeId"
);
});
b
.
OwnsOne
(
"PSManagement.Domain.Employees.Entities.PersonalInfo"
,
"PersonalInfo"
,
b1
=>
{
b1
.
Property
<
int
>(
"EmployeeId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
string
>(
"FirstName"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"FirstName"
);
b1
.
Property
<
string
>(
"LastName"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"LastName"
);
b1
.
HasKey
(
"EmployeeId"
);
b1
.
ToTable
(
"Employees"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"EmployeeId"
);
});
b
.
OwnsOne
(
"PSManagement.Domain.Employees.Entities.WorkInfo"
,
"WorkInfo"
,
b1
=>
{
b1
.
Property
<
int
>(
"EmployeeId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
string
>(
"WorkJob"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"WorkJob"
);
b1
.
Property
<
string
>(
"WorkType"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"WorkType"
);
b1
.
HasKey
(
"EmployeeId"
);
b1
.
ToTable
(
"Employees"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"EmployeeId"
);
});
b
.
Navigation
(
"Availability"
);
b
.
Navigation
(
"Department"
);
b
.
Navigation
(
"PersonalInfo"
);
b
.
Navigation
(
"User"
);
b
.
Navigation
(
"WorkInfo"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.FinancialSpends.Entities.FinancialSpending"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Projects.Entities.Project"
,
null
)
.
WithMany
(
"FinancialSpending"
)
.
HasForeignKey
(
"ProjectId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
OwnsOne
(
"PSManagement.SharedKernel.ValueObjects.Money"
,
"ExternalPurchase"
,
b1
=>
{
b1
.
Property
<
int
>(
"FinancialSpendingId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
int
>(
"Ammount"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"ExternalPurchaseAmmount"
);
b1
.
Property
<
string
>(
"Currency"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"nvarchar(max)"
)
.
HasDefaultValue
(
"USD"
)
.
HasColumnName
(
"ExternalPurchaseCurrency"
);
b1
.
HasKey
(
"FinancialSpendingId"
);
b1
.
ToTable
(
"FinancialSpendings"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"FinancialSpendingId"
);
});
b
.
Navigation
(
"ExternalPurchase"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.Attachment"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Projects.Entities.Project"
,
null
)
.
WithMany
(
"Attachments"
)
.
HasForeignKey
(
"ProjectId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.EmployeeParticipate"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"Employee"
)
.
WithMany
(
"EmployeeParticipates"
)
.
HasForeignKey
(
"EmployeeId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Projects.Entities.Project"
,
"Project"
)
.
WithMany
(
"EmployeeParticipates"
)
.
HasForeignKey
(
"ProjectId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
Navigation
(
"Employee"
);
b
.
Navigation
(
"Project"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.Project"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Customers.Entities.Customer"
,
null
)
.
WithMany
(
"Projects"
)
.
HasForeignKey
(
"CustomerId"
);
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Department"
,
"Executer"
)
.
WithMany
()
.
HasForeignKey
(
"ExecuterId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"ProjectManager"
)
.
WithMany
()
.
HasForeignKey
(
"ProjectManagerId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
);
b
.
HasOne
(
"PSManagement.Domain.ProjectsTypes.Entites.ProjectType"
,
"ProjectType"
)
.
WithMany
()
.
HasForeignKey
(
"ProjectTypeId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.ProjectsTypes.Entites.ProjectType"
,
null
)
.
WithMany
(
"Projects"
)
.
HasForeignKey
(
"ProjectTypeId1"
);
b
.
HasOne
(
"PSManagement.Domain.Customers.Entities.Customer"
,
"Proposer"
)
.
WithMany
()
.
HasForeignKey
(
"ProposerId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"TeamLeader"
)
.
WithMany
()
.
HasForeignKey
(
"TeamLeaderId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
);
b
.
OwnsOne
(
"PSManagement.Domain.Projects.ValueObjects.Aggreement"
,
"ProjectAggreement"
,
b1
=>
{
b1
.
Property
<
int
>(
"ProjectId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
DateTime
>(
"AggreementDate"
)
.
HasColumnType
(
"datetime2"
)
.
HasColumnName
(
"AggreementDate"
);
b1
.
Property
<
int
>(
"AggreementNumber"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"AggreementNumber"
);
b1
.
HasKey
(
"ProjectId"
);
b1
.
ToTable
(
"Projects"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"ProjectId"
);
});
b
.
OwnsOne
(
"PSManagement.Domain.Projects.ValueObjects.FinancialFund"
,
"FinancialFund"
,
b1
=>
{
b1
.
Property
<
int
>(
"ProjectId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
string
>(
"FinancialStatus"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"FinicialStatus"
);
b1
.
Property
<
string
>(
"Source"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"FinicialSource"
);
b1
.
HasKey
(
"ProjectId"
);
b1
.
ToTable
(
"Projects"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"ProjectId"
);
});
b
.
OwnsOne
(
"PSManagement.Domain.Projects.ValueObjects.ProjectClassification"
,
"ProjectClassification"
,
b1
=>
{
b1
.
Property
<
int
>(
"ProjectId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
string
>(
"ProjectNature"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"ProjectNature"
);
b1
.
Property
<
string
>(
"ProjectStatus"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"ProjectStatus"
);
b1
.
HasKey
(
"ProjectId"
);
b1
.
ToTable
(
"Projects"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"ProjectId"
);
});
b
.
OwnsOne
(
"PSManagement.Domain.Projects.ValueObjects.ProjectInfo"
,
"ProjectInfo"
,
b1
=>
{
b1
.
Property
<
int
>(
"ProjectId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
string
>(
"Code"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"Code"
);
b1
.
Property
<
string
>(
"Description"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"Description"
);
b1
.
Property
<
DateTime
>(
"ExpectedEndDate"
)
.
HasColumnType
(
"datetime2"
)
.
HasColumnName
(
"ExpectedEndDate"
);
b1
.
Property
<
string
>(
"Name"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"Name"
);
b1
.
Property
<
DateTime
>(
"StartDate"
)
.
HasColumnType
(
"datetime2"
)
.
HasColumnName
(
"StartDate"
);
b1
.
HasKey
(
"ProjectId"
);
b1
.
ToTable
(
"Projects"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"ProjectId"
);
});
b
.
OwnsOne
(
"PSManagement.Domain.Projects.ValueObjects.ProposalInfo"
,
"ProposalInfo"
,
b1
=>
{
b1
.
Property
<
int
>(
"ProjectId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
DateTime
>(
"ProposingBookDate"
)
.
HasColumnType
(
"datetime2"
)
.
HasColumnName
(
"ProposingBookDate"
);
b1
.
Property
<
int
>(
"ProposingBookNumber"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"ProposingBookNumber"
);
b1
.
HasKey
(
"ProjectId"
);
b1
.
ToTable
(
"Projects"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"ProjectId"
);
});
b
.
Navigation
(
"Executer"
);
b
.
Navigation
(
"FinancialFund"
);
b
.
Navigation
(
"ProjectAggreement"
);
b
.
Navigation
(
"ProjectClassification"
);
b
.
Navigation
(
"ProjectInfo"
);
b
.
Navigation
(
"ProjectManager"
);
b
.
Navigation
(
"ProjectType"
);
b
.
Navigation
(
"ProposalInfo"
);
b
.
Navigation
(
"Proposer"
);
b
.
Navigation
(
"TeamLeader"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.ProjectCompletion"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Projects.Entities.Project"
,
"Project"
)
.
WithOne
(
"ProjectCompletion"
)
.
HasForeignKey
(
"PSManagement.Domain.Projects.Entities.ProjectCompletion"
,
"ProjectId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
Navigation
(
"Project"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.Step"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Projects.Entities.Project"
,
"Project"
)
.
WithMany
(
"Steps"
)
.
HasForeignKey
(
"ProjectId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
OwnsOne
(
"PSManagement.Domain.Projects.ValueObjects.StepInfo"
,
"StepInfo"
,
b1
=>
{
b1
.
Property
<
int
>(
"StepId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
string
>(
"Description"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"Description"
);
b1
.
Property
<
int
>(
"Duration"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"Duration"
);
b1
.
Property
<
int
>(
"NumberOfWorker"
)
.
HasColumnType
(
"int"
);
b1
.
Property
<
DateTime
>(
"StartDate"
)
.
HasColumnType
(
"datetime2"
)
.
HasColumnName
(
"StartDate"
);
b1
.
Property
<
string
>(
"StepName"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"StepName"
);
b1
.
HasKey
(
"StepId"
);
b1
.
ToTable
(
"Steps"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"StepId"
);
});
b
.
Navigation
(
"Project"
);
b
.
Navigation
(
"StepInfo"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.EmployeeTrack"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"Employee"
)
.
WithMany
(
"EmployeeTracks"
)
.
HasForeignKey
(
"EmployeeId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Tracking.Track"
,
"Track"
)
.
WithMany
(
"EmployeeTracks"
)
.
HasForeignKey
(
"TrackId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
OwnsOne
(
"PSManagement.Domain.Tracking.ValueObjects.EmployeeWork"
,
"EmployeeWork"
,
b1
=>
{
b1
.
Property
<
int
>(
"EmployeeTrackId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
int
>(
"AssignedWorkingHours"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"AssignedWorkingHours"
);
b1
.
Property
<
int
>(
"ContributingRatio"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"ContributingRatio"
);
b1
.
Property
<
int
>(
"WorkedHours"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"WorkedHours"
);
b1
.
HasKey
(
"EmployeeTrackId"
);
b1
.
ToTable
(
"EmployeeTrack"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"EmployeeTrackId"
);
});
b
.
OwnsOne
(
"PSManagement.Domain.Tracking.ValueObjects.EmployeeWorkInfo"
,
"EmployeeWorkInfo"
,
b1
=>
{
b1
.
Property
<
int
>(
"EmployeeTrackId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
string
>(
"AssignedWork"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"AssignedWork"
);
b1
.
Property
<
DateTime
>(
"AssignedWorkEnd"
)
.
HasColumnType
(
"datetime2"
)
.
HasColumnName
(
"AssignedWorkEnd"
);
b1
.
Property
<
string
>(
"PerformedWork"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"PerformedWork"
);
b1
.
HasKey
(
"EmployeeTrackId"
);
b1
.
ToTable
(
"EmployeeTrack"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"EmployeeTrackId"
);
});
b
.
Navigation
(
"Employee"
);
b
.
Navigation
(
"EmployeeWork"
);
b
.
Navigation
(
"EmployeeWorkInfo"
);
b
.
Navigation
(
"Track"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Entities.StepTrack"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Projects.Entities.Step"
,
"Step"
)
.
WithMany
(
"StepTracks"
)
.
HasForeignKey
(
"StepId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Tracking.Track"
,
"Track"
)
.
WithMany
(
"StepTracks"
)
.
HasForeignKey
(
"TrackId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
)
.
IsRequired
();
b
.
Navigation
(
"Step"
);
b
.
Navigation
(
"Track"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Track"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Projects.Entities.Project"
,
"Project"
)
.
WithMany
(
"Tracks"
)
.
HasForeignKey
(
"ProjectId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
)
.
IsRequired
();
b
.
OwnsOne
(
"PSManagement.Domain.Tracking.ValueObjects.TrackInfo"
,
"TrackInfo"
,
b1
=>
{
b1
.
Property
<
int
>(
"TrackId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
bool
>(
"IsCompleted"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"bit"
)
.
HasDefaultValue
(
false
)
.
HasColumnName
(
"IsCompleted"
);
b1
.
Property
<
string
>(
"StatusDescription"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"StatusDescription"
);
b1
.
Property
<
DateTime
>(
"TrackDate"
)
.
HasColumnType
(
"datetime2"
)
.
HasColumnName
(
"TrackDate"
);
b1
.
HasKey
(
"TrackId"
);
b1
.
ToTable
(
"Tracks"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"TrackId"
);
});
b
.
Navigation
(
"Project"
);
b
.
Navigation
(
"TrackInfo"
);
});
modelBuilder
.
Entity
(
"PermissionRole"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Identity.Entities.Permission"
,
null
)
.
WithMany
()
.
HasForeignKey
(
"PermissionsId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Identity.Entities.Role"
,
null
)
.
WithMany
()
.
HasForeignKey
(
"RolesId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
});
modelBuilder
.
Entity
(
"UserRole"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Identity.Entities.Role"
,
null
)
.
WithMany
()
.
HasForeignKey
(
"RoleId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Identity.Entities.User"
,
null
)
.
WithMany
()
.
HasForeignKey
(
"UserId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Customers.Entities.Customer"
,
b
=>
{
b
.
Navigation
(
"ContactInfo"
);
b
.
Navigation
(
"Projects"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Employees.Entities.Employee"
,
b
=>
{
b
.
Navigation
(
"EmployeeParticipates"
);
b
.
Navigation
(
"EmployeeTracks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Identity.Entities.User"
,
b
=>
{
b
.
Navigation
(
"Employee"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.Project"
,
b
=>
{
b
.
Navigation
(
"Attachments"
);
b
.
Navigation
(
"EmployeeParticipates"
);
b
.
Navigation
(
"FinancialSpending"
);
b
.
Navigation
(
"ProjectCompletion"
);
b
.
Navigation
(
"Steps"
);
b
.
Navigation
(
"Tracks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.Step"
,
b
=>
{
b
.
Navigation
(
"StepTracks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.ProjectsTypes.Entites.ProjectType"
,
b
=>
{
b
.
Navigation
(
"Projects"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Track"
,
b
=>
{
b
.
Navigation
(
"EmployeeTracks"
);
b
.
Navigation
(
"StepTracks"
);
});
#pragma warning restore 612, 618
}
}
}
PSManagement.Infrastructure.Persistence/Migrations/20240826084243_AddProjectTypeDetails.cs
0 → 100644
View file @
0f8a3073
using
Microsoft.EntityFrameworkCore.Migrations
;
namespace
PSManagement.Infrastructure.Persistence.Migrations
{
public
partial
class
AddProjectTypeDetails
:
Migration
{
protected
override
void
Up
(
MigrationBuilder
migrationBuilder
)
{
migrationBuilder
.
AddColumn
<
int
>(
name
:
"StepInfo_NumberOfWorker"
,
table
:
"Steps"
,
type
:
"int"
,
nullable
:
true
);
migrationBuilder
.
AddColumn
<
int
>(
name
:
"ExpectedNumberOfWorker"
,
table
:
"ProjectType"
,
type
:
"int"
,
nullable
:
false
,
defaultValue
:
0
);
migrationBuilder
.
InsertData
(
table
:
"Roles"
,
columns
:
new
[]
{
"Id"
,
"Name"
},
values
:
new
object
[]
{
5
,
"Planner"
});
}
protected
override
void
Down
(
MigrationBuilder
migrationBuilder
)
{
migrationBuilder
.
DeleteData
(
table
:
"Roles"
,
keyColumn
:
"Id"
,
keyValue
:
5
);
migrationBuilder
.
DropColumn
(
name
:
"StepInfo_NumberOfWorker"
,
table
:
"Steps"
);
migrationBuilder
.
DropColumn
(
name
:
"ExpectedNumberOfWorker"
,
table
:
"ProjectType"
);
}
}
}
PSManagement.Infrastructure.Persistence/Migrations/20240826085542_AddParticipationHistory.Designer.cs
0 → 100644
View file @
0f8a3073
// <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
PSManagement.Infrastructure.Persistence
;
namespace
PSManagement.Infrastructure.Persistence.Migrations
{
[
DbContext
(
typeof
(
AppDbContext
))]
[
Migration
(
"20240826085542_AddParticipationHistory"
)]
partial
class
AddParticipationHistory
{
protected
override
void
BuildTargetModel
(
ModelBuilder
modelBuilder
)
{
#pragma warning disable 612, 618
modelBuilder
.
HasAnnotation
(
"Relational:Collation"
,
"Arabic_CI_AS"
)
.
HasAnnotation
(
"Relational:MaxIdentifierLength"
,
128
)
.
HasAnnotation
(
"ProductVersion"
,
"5.0.17"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
modelBuilder
.
Entity
(
"PSManagement.Domain.Customers.Entities.ContactInfo"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"ContactType"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"ContactValue"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
?>(
"CustomerId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"CustomerId"
);
b
.
ToTable
(
"ContactInfo"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Customers.Entities.Customer"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"CustomerName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"Email"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Customers"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Employees.Entities.Department"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Name"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Departments"
);
b
.
HasData
(
new
{
Id
=
1
,
Name
=
"قسم المعلوميات"
},
new
{
Id
=
2
,
Name
=
"قسم النظم الإلكترونية"
},
new
{
Id
=
3
,
Name
=
"قسم الميكاترونيكس"
},
new
{
Id
=
4
,
Name
=
"قسم الفيزياء"
},
new
{
Id
=
5
,
Name
=
"مديرية التطوير والخدمات البرمجية"
},
new
{
Id
=
6
,
Name
=
"شؤون الطلاب"
});
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Employees.Entities.Employee"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
>(
"DepartmentId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"HIASTId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"UserId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"DepartmentId"
);
b
.
HasIndex
(
"UserId"
)
.
IsUnique
();
b
.
ToTable
(
"Employees"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.FinancialSpends.Entities.FinancialSpending"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"CostType"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"Description"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
DateTime
>(
"ExpectedSpendingDate"
)
.
HasColumnType
(
"datetime2"
);
b
.
Property
<
int
>(
"LocalPurchase"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"ProjectId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"ProjectId"
);
b
.
ToTable
(
"FinancialSpendings"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Identity.Entities.Permission"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Name"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Permission"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Identity.Entities.Role"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Name"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Roles"
);
b
.
HasData
(
new
{
Id
=
1
,
Name
=
"Admin"
},
new
{
Id
=
2
,
Name
=
"Employee"
},
new
{
Id
=
4
,
Name
=
"Scientific-Deputy"
},
new
{
Id
=
5
,
Name
=
"Planner"
});
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Identity.Entities.User"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Email"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"HashedPassword"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"UserName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Users"
);
b
.
HasData
(
new
{
Id
=
2
,
Email
=
"Admin@Admin"
,
HashedPassword
=
"1234"
,
UserName
=
"Admin"
});
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.Attachment"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"AttachmentDescription"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"AttachmentName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"AttachmentUrl"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
>(
"ProjectId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"ProjectId"
);
b
.
ToTable
(
"Attachment"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.EmployeeParticipate"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
>(
"EmployeeId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"PartialTimeRatio"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"ProjectId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"Role"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"EmployeeId"
);
b
.
HasIndex
(
"ProjectId"
);
b
.
ToTable
(
"EmployeeParticipate"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.ParticipationChange"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
DateTime
>(
"ChangeDate"
)
.
HasColumnType
(
"datetime2"
);
b
.
Property
<
int
>(
"EmployeeId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"PartialTimeAfter"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"PartialTimeBefore"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"ProjectId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"RoleAfter"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"RoleBefore"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"EmployeeId"
)
.
IsUnique
();
b
.
HasIndex
(
"ProjectId"
)
.
IsUnique
();
b
.
ToTable
(
"ParticipationChanges"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.Project"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"CurrentState"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"nvarchar(max)"
)
.
HasDefaultValueSql
(
"Proposed"
);
b
.
Property
<
int
?>(
"CustomerId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"ExecuterId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"ProjectManagerId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"ProjectTypeId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
?>(
"ProjectTypeId1"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"ProposerId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"TeamLeaderId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"CustomerId"
);
b
.
HasIndex
(
"ExecuterId"
);
b
.
HasIndex
(
"ProjectManagerId"
);
b
.
HasIndex
(
"ProjectTypeId"
);
b
.
HasIndex
(
"ProjectTypeId1"
);
b
.
HasIndex
(
"ProposerId"
);
b
.
HasIndex
(
"TeamLeaderId"
);
b
.
ToTable
(
"Projects"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.ProjectCompletion"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
DateTime
>(
"CompletionDate"
)
.
HasColumnType
(
"datetime2"
);
b
.
Property
<
string
>(
"CustomerNotes"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
>(
"CustomerRate"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"ProjectId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"ProjectId"
)
.
IsUnique
();
b
.
ToTable
(
"ProjectCompletion"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.Step"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
>(
"CurrentCompletionRatio"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"ProjectId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"Weight"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"ProjectId"
);
b
.
ToTable
(
"Steps"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.ProjectsTypes.Entites.ProjectType"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Description"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
>(
"ExpectedEffort"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"ExpectedNumberOfWorker"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"TypeName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"ProjectType"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.EmployeeTrack"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
>(
"EmployeeId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"Notes"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
>(
"TrackId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"EmployeeId"
);
b
.
HasIndex
(
"TrackId"
);
b
.
ToTable
(
"EmployeeTrack"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Entities.StepTrack"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"ExecutionState"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
>(
"OldExecutionRatio"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"StepId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"TrackExecutionRatio"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"TrackId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"StepId"
);
b
.
HasIndex
(
"TrackId"
);
b
.
ToTable
(
"StepTracks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Track"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Notes"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
>(
"ProjectId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"ProjectId"
);
b
.
ToTable
(
"Tracks"
);
});
modelBuilder
.
Entity
(
"PermissionRole"
,
b
=>
{
b
.
Property
<
int
>(
"PermissionsId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"RolesId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"PermissionsId"
,
"RolesId"
);
b
.
HasIndex
(
"RolesId"
);
b
.
ToTable
(
"PermissionRole"
);
});
modelBuilder
.
Entity
(
"UserRole"
,
b
=>
{
b
.
Property
<
int
>(
"RoleId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"UserId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"RoleId"
,
"UserId"
);
b
.
HasIndex
(
"UserId"
);
b
.
ToTable
(
"UserRole"
);
b
.
HasData
(
new
{
RoleId
=
1
,
UserId
=
1
});
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Customers.Entities.ContactInfo"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Customers.Entities.Customer"
,
null
)
.
WithMany
(
"ContactInfo"
)
.
HasForeignKey
(
"CustomerId"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Customers.Entities.Customer"
,
b
=>
{
b
.
OwnsOne
(
"PSManagement.Domain.Customers.ValueObjects.Address"
,
"Address"
,
b1
=>
{
b1
.
Property
<
int
>(
"CustomerId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
string
>(
"City"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"City"
);
b1
.
Property
<
string
>(
"StreetName"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"StreetName"
);
b1
.
Property
<
int
>(
"StreetNumber"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"StreetNumber"
);
b1
.
HasKey
(
"CustomerId"
);
b1
.
ToTable
(
"Customers"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"CustomerId"
);
});
b
.
Navigation
(
"Address"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Employees.Entities.Employee"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Department"
,
"Department"
)
.
WithMany
()
.
HasForeignKey
(
"DepartmentId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
);
b
.
HasOne
(
"PSManagement.Domain.Identity.Entities.User"
,
"User"
)
.
WithOne
(
"Employee"
)
.
HasForeignKey
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"UserId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
OwnsOne
(
"PSManagement.Domain.Employees.Entities.Availability"
,
"Availability"
,
b1
=>
{
b1
.
Property
<
int
>(
"EmployeeId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
int
>(
"CurrentWorkingHours"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"CurrentWorkingHours"
);
b1
.
Property
<
bool
>(
"IsAvailable"
)
.
HasColumnType
(
"bit"
)
.
HasColumnName
(
"IsAvailable"
);
b1
.
HasKey
(
"EmployeeId"
);
b1
.
ToTable
(
"Employees"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"EmployeeId"
);
});
b
.
OwnsOne
(
"PSManagement.Domain.Employees.Entities.PersonalInfo"
,
"PersonalInfo"
,
b1
=>
{
b1
.
Property
<
int
>(
"EmployeeId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
string
>(
"FirstName"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"FirstName"
);
b1
.
Property
<
string
>(
"LastName"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"LastName"
);
b1
.
HasKey
(
"EmployeeId"
);
b1
.
ToTable
(
"Employees"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"EmployeeId"
);
});
b
.
OwnsOne
(
"PSManagement.Domain.Employees.Entities.WorkInfo"
,
"WorkInfo"
,
b1
=>
{
b1
.
Property
<
int
>(
"EmployeeId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
string
>(
"WorkJob"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"WorkJob"
);
b1
.
Property
<
string
>(
"WorkType"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"WorkType"
);
b1
.
HasKey
(
"EmployeeId"
);
b1
.
ToTable
(
"Employees"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"EmployeeId"
);
});
b
.
Navigation
(
"Availability"
);
b
.
Navigation
(
"Department"
);
b
.
Navigation
(
"PersonalInfo"
);
b
.
Navigation
(
"User"
);
b
.
Navigation
(
"WorkInfo"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.FinancialSpends.Entities.FinancialSpending"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Projects.Entities.Project"
,
null
)
.
WithMany
(
"FinancialSpending"
)
.
HasForeignKey
(
"ProjectId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
OwnsOne
(
"PSManagement.SharedKernel.ValueObjects.Money"
,
"ExternalPurchase"
,
b1
=>
{
b1
.
Property
<
int
>(
"FinancialSpendingId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
int
>(
"Ammount"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"ExternalPurchaseAmmount"
);
b1
.
Property
<
string
>(
"Currency"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"nvarchar(max)"
)
.
HasDefaultValue
(
"USD"
)
.
HasColumnName
(
"ExternalPurchaseCurrency"
);
b1
.
HasKey
(
"FinancialSpendingId"
);
b1
.
ToTable
(
"FinancialSpendings"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"FinancialSpendingId"
);
});
b
.
Navigation
(
"ExternalPurchase"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.Attachment"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Projects.Entities.Project"
,
null
)
.
WithMany
(
"Attachments"
)
.
HasForeignKey
(
"ProjectId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.EmployeeParticipate"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"Employee"
)
.
WithMany
(
"EmployeeParticipates"
)
.
HasForeignKey
(
"EmployeeId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Projects.Entities.Project"
,
"Project"
)
.
WithMany
(
"EmployeeParticipates"
)
.
HasForeignKey
(
"ProjectId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
Navigation
(
"Employee"
);
b
.
Navigation
(
"Project"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.ParticipationChange"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"Employee"
)
.
WithOne
()
.
HasForeignKey
(
"PSManagement.Domain.Projects.Entities.ParticipationChange"
,
"EmployeeId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Projects.Entities.Project"
,
"Project"
)
.
WithOne
()
.
HasForeignKey
(
"PSManagement.Domain.Projects.Entities.ParticipationChange"
,
"ProjectId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
Navigation
(
"Employee"
);
b
.
Navigation
(
"Project"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.Project"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Customers.Entities.Customer"
,
null
)
.
WithMany
(
"Projects"
)
.
HasForeignKey
(
"CustomerId"
);
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Department"
,
"Executer"
)
.
WithMany
()
.
HasForeignKey
(
"ExecuterId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"ProjectManager"
)
.
WithMany
()
.
HasForeignKey
(
"ProjectManagerId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
);
b
.
HasOne
(
"PSManagement.Domain.ProjectsTypes.Entites.ProjectType"
,
"ProjectType"
)
.
WithMany
()
.
HasForeignKey
(
"ProjectTypeId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.ProjectsTypes.Entites.ProjectType"
,
null
)
.
WithMany
(
"Projects"
)
.
HasForeignKey
(
"ProjectTypeId1"
);
b
.
HasOne
(
"PSManagement.Domain.Customers.Entities.Customer"
,
"Proposer"
)
.
WithMany
()
.
HasForeignKey
(
"ProposerId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"TeamLeader"
)
.
WithMany
()
.
HasForeignKey
(
"TeamLeaderId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
);
b
.
OwnsOne
(
"PSManagement.Domain.Projects.ValueObjects.Aggreement"
,
"ProjectAggreement"
,
b1
=>
{
b1
.
Property
<
int
>(
"ProjectId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
DateTime
>(
"AggreementDate"
)
.
HasColumnType
(
"datetime2"
)
.
HasColumnName
(
"AggreementDate"
);
b1
.
Property
<
int
>(
"AggreementNumber"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"AggreementNumber"
);
b1
.
HasKey
(
"ProjectId"
);
b1
.
ToTable
(
"Projects"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"ProjectId"
);
});
b
.
OwnsOne
(
"PSManagement.Domain.Projects.ValueObjects.FinancialFund"
,
"FinancialFund"
,
b1
=>
{
b1
.
Property
<
int
>(
"ProjectId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
string
>(
"FinancialStatus"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"FinicialStatus"
);
b1
.
Property
<
string
>(
"Source"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"FinicialSource"
);
b1
.
HasKey
(
"ProjectId"
);
b1
.
ToTable
(
"Projects"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"ProjectId"
);
});
b
.
OwnsOne
(
"PSManagement.Domain.Projects.ValueObjects.ProjectClassification"
,
"ProjectClassification"
,
b1
=>
{
b1
.
Property
<
int
>(
"ProjectId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
string
>(
"ProjectNature"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"ProjectNature"
);
b1
.
Property
<
string
>(
"ProjectStatus"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"ProjectStatus"
);
b1
.
HasKey
(
"ProjectId"
);
b1
.
ToTable
(
"Projects"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"ProjectId"
);
});
b
.
OwnsOne
(
"PSManagement.Domain.Projects.ValueObjects.ProjectInfo"
,
"ProjectInfo"
,
b1
=>
{
b1
.
Property
<
int
>(
"ProjectId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
string
>(
"Code"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"Code"
);
b1
.
Property
<
string
>(
"Description"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"Description"
);
b1
.
Property
<
DateTime
>(
"ExpectedEndDate"
)
.
HasColumnType
(
"datetime2"
)
.
HasColumnName
(
"ExpectedEndDate"
);
b1
.
Property
<
string
>(
"Name"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"Name"
);
b1
.
Property
<
DateTime
>(
"StartDate"
)
.
HasColumnType
(
"datetime2"
)
.
HasColumnName
(
"StartDate"
);
b1
.
HasKey
(
"ProjectId"
);
b1
.
ToTable
(
"Projects"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"ProjectId"
);
});
b
.
OwnsOne
(
"PSManagement.Domain.Projects.ValueObjects.ProposalInfo"
,
"ProposalInfo"
,
b1
=>
{
b1
.
Property
<
int
>(
"ProjectId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
DateTime
>(
"ProposingBookDate"
)
.
HasColumnType
(
"datetime2"
)
.
HasColumnName
(
"ProposingBookDate"
);
b1
.
Property
<
int
>(
"ProposingBookNumber"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"ProposingBookNumber"
);
b1
.
HasKey
(
"ProjectId"
);
b1
.
ToTable
(
"Projects"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"ProjectId"
);
});
b
.
Navigation
(
"Executer"
);
b
.
Navigation
(
"FinancialFund"
);
b
.
Navigation
(
"ProjectAggreement"
);
b
.
Navigation
(
"ProjectClassification"
);
b
.
Navigation
(
"ProjectInfo"
);
b
.
Navigation
(
"ProjectManager"
);
b
.
Navigation
(
"ProjectType"
);
b
.
Navigation
(
"ProposalInfo"
);
b
.
Navigation
(
"Proposer"
);
b
.
Navigation
(
"TeamLeader"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.ProjectCompletion"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Projects.Entities.Project"
,
"Project"
)
.
WithOne
(
"ProjectCompletion"
)
.
HasForeignKey
(
"PSManagement.Domain.Projects.Entities.ProjectCompletion"
,
"ProjectId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
Navigation
(
"Project"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.Step"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Projects.Entities.Project"
,
"Project"
)
.
WithMany
(
"Steps"
)
.
HasForeignKey
(
"ProjectId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
OwnsOne
(
"PSManagement.Domain.Projects.ValueObjects.StepInfo"
,
"StepInfo"
,
b1
=>
{
b1
.
Property
<
int
>(
"StepId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
string
>(
"Description"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"Description"
);
b1
.
Property
<
int
>(
"Duration"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"Duration"
);
b1
.
Property
<
int
>(
"NumberOfWorker"
)
.
HasColumnType
(
"int"
);
b1
.
Property
<
DateTime
>(
"StartDate"
)
.
HasColumnType
(
"datetime2"
)
.
HasColumnName
(
"StartDate"
);
b1
.
Property
<
string
>(
"StepName"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"StepName"
);
b1
.
HasKey
(
"StepId"
);
b1
.
ToTable
(
"Steps"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"StepId"
);
});
b
.
Navigation
(
"Project"
);
b
.
Navigation
(
"StepInfo"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.EmployeeTrack"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"Employee"
)
.
WithMany
(
"EmployeeTracks"
)
.
HasForeignKey
(
"EmployeeId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Tracking.Track"
,
"Track"
)
.
WithMany
(
"EmployeeTracks"
)
.
HasForeignKey
(
"TrackId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
OwnsOne
(
"PSManagement.Domain.Tracking.ValueObjects.EmployeeWork"
,
"EmployeeWork"
,
b1
=>
{
b1
.
Property
<
int
>(
"EmployeeTrackId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
int
>(
"AssignedWorkingHours"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"AssignedWorkingHours"
);
b1
.
Property
<
int
>(
"ContributingRatio"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"ContributingRatio"
);
b1
.
Property
<
int
>(
"WorkedHours"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"WorkedHours"
);
b1
.
HasKey
(
"EmployeeTrackId"
);
b1
.
ToTable
(
"EmployeeTrack"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"EmployeeTrackId"
);
});
b
.
OwnsOne
(
"PSManagement.Domain.Tracking.ValueObjects.EmployeeWorkInfo"
,
"EmployeeWorkInfo"
,
b1
=>
{
b1
.
Property
<
int
>(
"EmployeeTrackId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
string
>(
"AssignedWork"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"AssignedWork"
);
b1
.
Property
<
DateTime
>(
"AssignedWorkEnd"
)
.
HasColumnType
(
"datetime2"
)
.
HasColumnName
(
"AssignedWorkEnd"
);
b1
.
Property
<
string
>(
"PerformedWork"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"PerformedWork"
);
b1
.
HasKey
(
"EmployeeTrackId"
);
b1
.
ToTable
(
"EmployeeTrack"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"EmployeeTrackId"
);
});
b
.
Navigation
(
"Employee"
);
b
.
Navigation
(
"EmployeeWork"
);
b
.
Navigation
(
"EmployeeWorkInfo"
);
b
.
Navigation
(
"Track"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Entities.StepTrack"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Projects.Entities.Step"
,
"Step"
)
.
WithMany
(
"StepTracks"
)
.
HasForeignKey
(
"StepId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Tracking.Track"
,
"Track"
)
.
WithMany
(
"StepTracks"
)
.
HasForeignKey
(
"TrackId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
)
.
IsRequired
();
b
.
Navigation
(
"Step"
);
b
.
Navigation
(
"Track"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Track"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Projects.Entities.Project"
,
"Project"
)
.
WithMany
(
"Tracks"
)
.
HasForeignKey
(
"ProjectId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
)
.
IsRequired
();
b
.
OwnsOne
(
"PSManagement.Domain.Tracking.ValueObjects.TrackInfo"
,
"TrackInfo"
,
b1
=>
{
b1
.
Property
<
int
>(
"TrackId"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
bool
>(
"IsCompleted"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"bit"
)
.
HasDefaultValue
(
false
)
.
HasColumnName
(
"IsCompleted"
);
b1
.
Property
<
string
>(
"StatusDescription"
)
.
HasColumnType
(
"nvarchar(max)"
)
.
HasColumnName
(
"StatusDescription"
);
b1
.
Property
<
DateTime
>(
"TrackDate"
)
.
HasColumnType
(
"datetime2"
)
.
HasColumnName
(
"TrackDate"
);
b1
.
HasKey
(
"TrackId"
);
b1
.
ToTable
(
"Tracks"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"TrackId"
);
});
b
.
Navigation
(
"Project"
);
b
.
Navigation
(
"TrackInfo"
);
});
modelBuilder
.
Entity
(
"PermissionRole"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Identity.Entities.Permission"
,
null
)
.
WithMany
()
.
HasForeignKey
(
"PermissionsId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Identity.Entities.Role"
,
null
)
.
WithMany
()
.
HasForeignKey
(
"RolesId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
});
modelBuilder
.
Entity
(
"UserRole"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Identity.Entities.Role"
,
null
)
.
WithMany
()
.
HasForeignKey
(
"RoleId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Identity.Entities.User"
,
null
)
.
WithMany
()
.
HasForeignKey
(
"UserId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Customers.Entities.Customer"
,
b
=>
{
b
.
Navigation
(
"ContactInfo"
);
b
.
Navigation
(
"Projects"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Employees.Entities.Employee"
,
b
=>
{
b
.
Navigation
(
"EmployeeParticipates"
);
b
.
Navigation
(
"EmployeeTracks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Identity.Entities.User"
,
b
=>
{
b
.
Navigation
(
"Employee"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.Project"
,
b
=>
{
b
.
Navigation
(
"Attachments"
);
b
.
Navigation
(
"EmployeeParticipates"
);
b
.
Navigation
(
"FinancialSpending"
);
b
.
Navigation
(
"ProjectCompletion"
);
b
.
Navigation
(
"Steps"
);
b
.
Navigation
(
"Tracks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.Step"
,
b
=>
{
b
.
Navigation
(
"StepTracks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.ProjectsTypes.Entites.ProjectType"
,
b
=>
{
b
.
Navigation
(
"Projects"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Track"
,
b
=>
{
b
.
Navigation
(
"EmployeeTracks"
);
b
.
Navigation
(
"StepTracks"
);
});
#pragma warning restore 612, 618
}
}
}
PSManagement.Infrastructure.Persistence/Migrations/20240826085542_AddParticipationHistory.cs
0 → 100644
View file @
0f8a3073
using
System
;
using
Microsoft.EntityFrameworkCore.Migrations
;
namespace
PSManagement.Infrastructure.Persistence.Migrations
{
public
partial
class
AddParticipationHistory
:
Migration
{
protected
override
void
Up
(
MigrationBuilder
migrationBuilder
)
{
migrationBuilder
.
CreateTable
(
name
:
"ParticipationChanges"
,
columns
:
table
=>
new
{
Id
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
)
.
Annotation
(
"SqlServer:Identity"
,
"1, 1"
),
EmployeeId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
),
ProjectId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
),
PartialTimeBefore
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
),
PartialTimeAfter
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
),
RoleBefore
=
table
.
Column
<
string
>(
type
:
"nvarchar(max)"
,
nullable
:
true
),
RoleAfter
=
table
.
Column
<
string
>(
type
:
"nvarchar(max)"
,
nullable
:
true
),
ChangeDate
=
table
.
Column
<
DateTime
>(
type
:
"datetime2"
,
nullable
:
false
)
},
constraints
:
table
=>
{
table
.
PrimaryKey
(
"PK_ParticipationChanges"
,
x
=>
x
.
Id
);
table
.
ForeignKey
(
name
:
"FK_ParticipationChanges_Employees_EmployeeId"
,
column
:
x
=>
x
.
EmployeeId
,
principalTable
:
"Employees"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Cascade
);
table
.
ForeignKey
(
name
:
"FK_ParticipationChanges_Projects_ProjectId"
,
column
:
x
=>
x
.
ProjectId
,
principalTable
:
"Projects"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Cascade
);
});
migrationBuilder
.
CreateIndex
(
name
:
"IX_ParticipationChanges_EmployeeId"
,
table
:
"ParticipationChanges"
,
column
:
"EmployeeId"
,
unique
:
true
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_ParticipationChanges_ProjectId"
,
table
:
"ParticipationChanges"
,
column
:
"ProjectId"
,
unique
:
true
);
}
protected
override
void
Down
(
MigrationBuilder
migrationBuilder
)
{
migrationBuilder
.
DropTable
(
name
:
"ParticipationChanges"
);
}
}
}
PSManagement.Infrastructure.Persistence/Migrations/AppDbContextModelSnapshot.cs
View file @
0f8a3073
...
...
@@ -207,6 +207,11 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
{
Id
=
4
,
Name
=
"Scientific-Deputy"
},
new
{
Id
=
5
,
Name
=
"Planner"
});
});
...
...
@@ -294,6 +299,45 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b
.
ToTable
(
"EmployeeParticipate"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.ParticipationChange"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
DateTime
>(
"ChangeDate"
)
.
HasColumnType
(
"datetime2"
);
b
.
Property
<
int
>(
"EmployeeId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"PartialTimeAfter"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"PartialTimeBefore"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"ProjectId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"RoleAfter"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"RoleBefore"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"EmployeeId"
)
.
IsUnique
();
b
.
HasIndex
(
"ProjectId"
)
.
IsUnique
();
b
.
ToTable
(
"ParticipationChanges"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.Project"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
...
...
@@ -373,48 +417,51 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b
.
ToTable
(
"ProjectCompletion"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.
ProjectType
"
,
b
=>
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.
Step
"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Description
"
)
.
HasColumnType
(
"
nvarchar(max)
"
);
b
.
Property
<
int
>(
"CurrentCompletionRatio
"
)
.
HasColumnType
(
"
int
"
);
b
.
Property
<
int
>(
"
ExpectedEffort
"
)
b
.
Property
<
int
>(
"
ProjectId
"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"TypeName
"
)
.
HasColumnType
(
"
nvarchar(max)
"
);
b
.
Property
<
int
>(
"Weight
"
)
.
HasColumnType
(
"
int
"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"ProjectType"
);
b
.
HasIndex
(
"ProjectId"
);
b
.
ToTable
(
"Steps"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects
.Entities.Step
"
,
b
=>
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects
Types.Entites.ProjectType
"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
>(
"CurrentCompletionRatio
"
)
.
HasColumnType
(
"
int
"
);
b
.
Property
<
string
>(
"Description
"
)
.
HasColumnType
(
"
nvarchar(max)
"
);
b
.
Property
<
int
>(
"
ProjectId
"
)
b
.
Property
<
int
>(
"
ExpectedEffort
"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"
Weight
"
)
b
.
Property
<
int
>(
"
ExpectedNumberOfWorker
"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
Property
<
string
>(
"TypeName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Has
Index
(
"Project
Id"
);
b
.
Has
Key
(
"
Id"
);
b
.
ToTable
(
"
Steps
"
);
b
.
ToTable
(
"
ProjectType
"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.EmployeeTrack"
,
b
=>
...
...
@@ -726,6 +773,25 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b
.
Navigation
(
"Project"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.ParticipationChange"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"Employee"
)
.
WithOne
()
.
HasForeignKey
(
"PSManagement.Domain.Projects.Entities.ParticipationChange"
,
"EmployeeId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Projects.Entities.Project"
,
"Project"
)
.
WithOne
()
.
HasForeignKey
(
"PSManagement.Domain.Projects.Entities.ParticipationChange"
,
"ProjectId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
Navigation
(
"Employee"
);
b
.
Navigation
(
"Project"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.Project"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Customers.Entities.Customer"
,
null
)
...
...
@@ -743,13 +809,13 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
.
HasForeignKey
(
"ProjectManagerId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
);
b
.
HasOne
(
"PSManagement.Domain.Projects
.Entiti
es.ProjectType"
,
"ProjectType"
)
b
.
HasOne
(
"PSManagement.Domain.Projects
Types.Entit
es.ProjectType"
,
"ProjectType"
)
.
WithMany
()
.
HasForeignKey
(
"ProjectTypeId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Projects
.Entiti
es.ProjectType"
,
null
)
b
.
HasOne
(
"PSManagement.Domain.Projects
Types.Entit
es.ProjectType"
,
null
)
.
WithMany
(
"Projects"
)
.
HasForeignKey
(
"ProjectTypeId1"
);
...
...
@@ -946,6 +1012,9 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"Duration"
);
b1
.
Property
<
int
>(
"NumberOfWorker"
)
.
HasColumnType
(
"int"
);
b1
.
Property
<
DateTime
>(
"StartDate"
)
.
HasColumnType
(
"datetime2"
)
.
HasColumnName
(
"StartDate"
);
...
...
@@ -1169,14 +1238,14 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b
.
Navigation
(
"Tracks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.
ProjectType
"
,
b
=>
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.
Step
"
,
b
=>
{
b
.
Navigation
(
"
Project
s"
);
b
.
Navigation
(
"
StepTrack
s"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects
.Entities.Step
"
,
b
=>
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects
Types.Entites.ProjectType
"
,
b
=>
{
b
.
Navigation
(
"
StepTrack
s"
);
b
.
Navigation
(
"
Project
s"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Track"
,
b
=>
...
...
PSManagement.Infrastructure.Persistence/Repositories/ProjectRepository/ProjectsTypesRepository.cs
View file @
0f8a3073
using
Microsoft.EntityFrameworkCore
;
using
PSManagement.Domain.Projects.Entities
;
using
PSManagement.Domain.Projects.Repositories
;
using
PSManagement.Domain.ProjectsTypes.Entites
;
using
PSManagement.Infrastructure.Persistence.Repositories.Base
;
using
PSManagement.SharedKernel.Interfaces
;
using
System.Collections.Generic
;
...
...
PSManagement.Infrastructure.Persistence/SeedDataContext/SeedData.cs
View file @
0f8a3073
...
...
@@ -19,6 +19,8 @@ namespace PSManagement.Infrastructure.Persistence.SeedDataContext
SeedRoles
(
builder
);
return
Task
.
CompletedTask
;
}
#
region
Configure
Departments
public
static
void
SeedDepartments
(
ModelBuilder
builder
)
{
builder
.
Entity
<
Department
>().
HasData
(
...
...
@@ -33,17 +35,25 @@ namespace PSManagement.Infrastructure.Persistence.SeedDataContext
)
;
}
#
endregion
Configure
Departments
#
region
Seed
Roles
public
static
void
SeedRoles
(
ModelBuilder
builder
)
{
builder
.
Entity
<
Role
>().
HasData
(
new
Role
{
Id
=
1
,
Name
=
"Admin"
},
new
Role
{
Id
=
2
,
Name
=
"Employee"
},
new
Role
{
Id
=
4
,
Name
=
"Scientific-Deputy"
}
new
Role
{
Id
=
4
,
Name
=
"Scientific-Deputy"
},
new
Role
{
Id
=
5
,
Name
=
"Planner"
}
);
}
#
endregion
Seed
Roles
#
region
Configure
Admin
public
static
void
SeedAdmin
(
ModelBuilder
builder
)
{
...
...
@@ -56,5 +66,7 @@ namespace PSManagement.Infrastructure.Persistence.SeedDataContext
);
}
#
endregion
Configure
Admin
}
}
PSManagement.Infrastructure.Persistence/UoW/UnitOfWork.cs
View file @
0f8a3073
...
...
@@ -13,54 +13,84 @@ namespace PSManagement.Infrastructure.Persistence.UoW
{
public
class
UnitOfWork
:
IUnitOfWork
{
#
region
Dependencies
private
readonly
AppDbContext
_dbContext
;
private
readonly
IMediator
_mediator
;
#
endregion
Dependencies
#
region
Constructor
public
UnitOfWork
(
AppDbContext
dbContext
,
IMediator
mediator
)
{
_dbContext
=
dbContext
;
_mediator
=
mediator
;
}
#
endregion
Constructor
public
async
Task
SaveChangesAsync
(
CancellationToken
cancellationToken
=
default
)
{
await
DispatchEventsAsync
();
await
_dbContext
.
SaveChangesAsync
(
cancellationToken
);
}
#
region
Process
Events
private
async
Task
DispatchEventsAsync
()
{
// list for the processed event
var
processedDomainEvents
=
new
List
<
IDomainEvent
>();
// list of un processed events
var
unprocessedDomainEvents
=
GetDomainEvents
().
AsEnumerable
();
// this is needed incase another DomainEvent is published from a DomainEventHandler
while
(
unprocessedDomainEvents
.
Any
())
{
// publish domain events
await
DispatchDomainEventsAsync
(
unprocessedDomainEvents
);
// move the un processed to the processed
processedDomainEvents
.
AddRange
(
unprocessedDomainEvents
);
// get the newest un processed events
unprocessedDomainEvents
=
GetDomainEvents
()
.
Where
(
e
=>
!
processedDomainEvents
.
Contains
(
e
))
.
ToList
();
}
// clear the events
ClearDomainEvents
();
}
#
endregion
Process
Events
#
region
Get
Events
private
List
<
IDomainEvent
>
GetDomainEvents
()
{
// change tracker to the base entity
var
aggregateRoots
=
GetTrackedEntites
();
// get the events list
return
aggregateRoots
.
SelectMany
(
x
=>
x
.
Events
)
.
ToList
();
}
#
endregion
Get
Events
#
region
Get
Tracked
private
List
<
BaseEntity
>
GetTrackedEntites
()
{
// change tracker to the base enties that has an events
return
_dbContext
.
ChangeTracker
.
Entries
<
BaseEntity
>()
.
Where
(
x
=>
x
.
Entity
.
Events
!=
null
&&
x
.
Entity
.
Events
.
Any
())
.
Select
(
e
=>
e
.
Entity
)
.
ToList
();
}
#
endregion
Get
Tracked
#
region
Dispatch
Events
private
async
Task
DispatchDomainEventsAsync
(
IEnumerable
<
IDomainEvent
>
domainEvents
)
{
foreach
(
var
domainEvent
in
domainEvents
)
...
...
@@ -69,6 +99,9 @@ namespace PSManagement.Infrastructure.Persistence.UoW
}
}
#
endregion
Dispatch
Events
#
region
Clear
And
Dispose
private
void
ClearDomainEvents
()
{
var
aggregateRoots
=
GetTrackedEntites
();
...
...
@@ -79,6 +112,6 @@ namespace PSManagement.Infrastructure.Persistence.UoW
{
_dbContext
.
Dispose
();
}
#
endregion
Clear
And
Dispose
}
}
PSManagement.Infrastructure/Authentication/AuthenticationService.cs
View file @
0f8a3073
...
...
@@ -20,7 +20,11 @@ namespace PSManagement.Infrastructure.Services.Authentication
private
readonly
IUsersRepository
_userRepository
;
private
readonly
BaseSpecification
<
User
>
_specification
;
private
readonly
IMapper
_mapper
;
public
AuthenticationService
(
IJwtTokenGenerator
jwtTokenGenerator
,
IUsersRepository
userRepository
,
IMapper
mapper
)
public
AuthenticationService
(
IJwtTokenGenerator
jwtTokenGenerator
,
IUsersRepository
userRepository
,
IMapper
mapper
)
{
_jwtTokenGenerator
=
jwtTokenGenerator
;
_userRepository
=
userRepository
;
...
...
@@ -28,15 +32,21 @@ namespace PSManagement.Infrastructure.Services.Authentication
_mapper
=
mapper
;
}
#
region
Login
public
async
Task
<
Result
<
AuthenticationResult
>>
Login
(
String
email
,
String
password
)
{
_specification
.
AddInclude
(
e
=>
e
.
Employee
);
_specification
.
AddInclude
(
e
=>
e
.
Roles
);
User
u
=
await
_userRepository
.
GetByEmail
(
email
,
_specification
);
if
(
u
is
null
||
u
.
HashedPassword
!=
password
)
{
if
(
u
is
null
||
u
.
HashedPassword
!=
hashPassword
(
password
))
{
return
Result
.
Invalid
(
UserErrors
.
InvalidLoginAttempt
);
}
String
token
=
_jwtTokenGenerator
.
GenerateToken
(
u
);
return
new
AuthenticationResult
{
...
...
@@ -47,12 +57,18 @@ namespace PSManagement.Infrastructure.Services.Authentication
Roles
=
_mapper
.
Map
<
ICollection
<
RoleDTO
>>(
u
.
Roles
),
Token
=
token
};
}
#
endregion
Login
#
region
Registeration
public
async
Task
<
Result
<
AuthenticationResult
>>
Register
(
String
email
,
String
userName
,
String
password
)
{
// check if the user exist
var
u
=
await
_userRepository
.
GetByEmail
(
email
);
if
(
u
is
not
null
)
{
return
Result
.
Invalid
(
UserErrors
.
AlreadyUserExist
);
}
var
user
=
await
_userRepository
.
AddAsync
(
new
User
{
Email
=
email
,
...
...
@@ -74,6 +90,14 @@ namespace PSManagement.Infrastructure.Services.Authentication
}
#
endregion
Registeration
#
region
Password
Hasher
private
string
hashPassword
(
string
passsword
)
{
return
passsword
;
}
#
endregion
Password
Hasher
}
...
...
PSManagement.Infrastructure/DependencyInjectionConfiguration/DependencyInjection.cs
View file @
0f8a3073
...
...
@@ -37,6 +37,8 @@ namespace PSManagement.Infrastructure.DI
return
services
;
}
#
region
Add
Servcies
private
static
IServiceCollection
AddServices
(
this
IServiceCollection
services
,
IConfiguration
configuration
)
{
services
.
Configure
<
FileServiceSettings
>(
configuration
.
GetSection
(
FileServiceSettings
.
SectionName
));
...
...
@@ -49,9 +51,13 @@ namespace PSManagement.Infrastructure.DI
services
.
AddScoped
<
IEmailService
,
EmailService
>();
return
services
;
}
#
endregion
Add
Servcies
#
region
Background
jobs
private
static
IServiceCollection
AddBackgroundServices
(
this
IServiceCollection
services
,
IConfiguration
configuration
)
{
services
.
Configure
<
EmployeesSyncJobSettings
>(
configuration
.
GetSection
(
"EmpoyeesSyncJobSettings"
));
services
.
Configure
<
EmployeesSyncJobSettings
>(
configuration
.
GetSection
(
EmployeesSyncJobSettings
.
SectionName
));
services
.
AddSingleton
<
IHttpContextAccessor
,
HttpContextAccessor
>();
services
.
AddScoped
<
ISyncEmployeesService
,
SyncEmployeesService
>();
...
...
@@ -61,7 +67,9 @@ namespace PSManagement.Infrastructure.DI
return
services
;
}
#
endregion
Background
jobs
#
region
Authorization
private
static
IServiceCollection
AddAuthorization
(
this
IServiceCollection
services
)
{
services
.
AddScoped
<
IUserRoleService
,
UserRolesService
>();
...
...
@@ -69,7 +77,9 @@ namespace PSManagement.Infrastructure.DI
return
services
;
}
#
endregion
Authorization
#
region
Authentication
private
static
IServiceCollection
AddAuthentication
(
this
IServiceCollection
services
,
IConfiguration
configuration
)
{
services
.
Configure
<
JwtSetting
>(
configuration
.
GetSection
(
JwtSetting
.
Section
));
...
...
@@ -84,5 +94,6 @@ namespace PSManagement.Infrastructure.DI
return
services
;
}
#
endregion
Authentication
}
}
PSManagement.Infrastructure/Settings/EmployeesSyncJobSettings.cs
View file @
0f8a3073
...
...
@@ -2,6 +2,7 @@
{
public
class
EmployeesSyncJobSettings
{
public
const
string
SectionName
=
"EmpoyeesSyncJobSettings"
;
public
int
SyncIntervalInMinutes
{
get
;
set
;
}
}
}
PSManagement.Infrastructure/SyncData/SyncEmployeesService.cs
View file @
0f8a3073
...
...
@@ -44,11 +44,15 @@ namespace PSManagement.Infrastructure.BackgroundServcies
public
async
Task
<
SyncResponse
>
SyncEmployees
(
IEmployeesProvider
employeesProvider
)
{
IEnumerable
<
Employee
>
NewestEmployees
=
await
_employeesProviders
.
FetchEmployees
();
int
count
=
0
;
foreach
(
Employee
employee
in
NewestEmployees
)
{
_specification
.
Criteria
=
empl
=>
empl
.
HIASTId
==
employee
.
HIASTId
;
Employee
emp
=
_employeesRepository
.
ListAsync
(
_specification
).
Result
.
FirstOrDefault
();
if
(
emp
is
null
)
{
emp
=
await
_employeesRepository
.
AddAsync
(
employee
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment