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
b6741e60
Commit
b6741e60
authored
Aug 12, 2024
by
hasan khaddour
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add State Pattern.
parent
1d47855f
Changes
35
Hide whitespace changes
Inline
Side-by-side
Showing
35 changed files
with
3900 additions
and
53 deletions
+3900
-53
ProjectBuilder.cs
PSManagement.Domain/Projects/Builders/ProjectBuilder.cs
+18
-2
ProjectCreatedEvent.cs
...ement.Domain/Projects/DomainEvents/ProjectCreatedEvent.cs
+4
-1
Attachment.cs
PSManagement.Domain/Projects/Entities/Attachment.cs
+9
-2
Project.cs
PSManagement.Domain/Projects/Entities/Project.cs
+65
-2
ProjectSpecification.cs
...ent.Domain/Projects/Specification/ProjectSpecification.cs
+20
-0
CancledState.cs
PSManagement.Domain/Projects/States/CancledState.cs
+32
-0
CompletedState.cs
PSManagement.Domain/Projects/States/CompletedState.cs
+32
-0
IProjectState.cs
PSManagement.Domain/Projects/States/IProjectState.cs
+13
-0
InPlanState.cs
PSManagement.Domain/Projects/States/InPlanState.cs
+32
-0
InProgressState.cs
PSManagement.Domain/Projects/States/InProgressState.cs
+32
-0
ProposedState.cs
PSManagement.Domain/Projects/States/ProposedState.cs
+33
-0
ProjectStatus.cs
PSManagement.Domain/XProjectsStatus/Entites/ProjectStatus.cs
+0
-0
IProjectStatusRepository.cs
.../XProjectsStatus/Repositories/IProjectStatusRepository.cs
+0
-0
ProjectType.cs
PSManagement.Domain/XProjectsTypes/Entities/ProjectType.cs
+0
-0
IProjectTypesRepository.cs
...in/XProjectsTypes/Repositories/IProjectTypesRepository.cs
+0
-0
DependencyInjection.cs
...ment.Infrastructure.Persistence/DI/DependencyInjection.cs
+4
-0
ProjectEntityConfiguration.cs
...tence/EntitiesConfiguration/ProjectEntityConfiguration.cs
+3
-1
20240812170053_fixSomeEntitiesNames.Designer.cs
...igrations/20240812170053_fixSomeEntitiesNames.Designer.cs
+1130
-0
20240812170053_fixSomeEntitiesNames.cs
...istence/Migrations/20240812170053_fixSomeEntitiesNames.cs
+23
-0
20240812172037_fixSomeEntitiesNames1.Designer.cs
...grations/20240812172037_fixSomeEntitiesNames1.Designer.cs
+1132
-0
20240812172037_fixSomeEntitiesNames1.cs
...stence/Migrations/20240812172037_fixSomeEntitiesNames1.cs
+55
-0
20240812194901_AddStatePattern.Designer.cs
...nce/Migrations/20240812194901_AddStatePattern.Designer.cs
+1105
-0
20240812194901_AddStatePattern.cs
....Persistence/Migrations/20240812194901_AddStatePattern.cs
+73
-0
AppDbContextModelSnapshot.cs
...cture.Persistence/Migrations/AppDbContextModelSnapshot.cs
+10
-35
AuthenticationService.cs
...nt.Infrastructure/Authentication/AuthenticationService.cs
+0
-0
RoleService.cs
PSManagement.Infrastructure/Authorization/RoleService.cs
+0
-0
UserRolesService.cs
...nagement.Infrastructure/Authorization/UserRolesService.cs
+0
-0
BackgroundJobSyncEmployees.cs
...tructure/BackgroundServcies/BackgroundJobSyncEmployees.cs
+4
-1
DependencyInjection.cs
PSManagement.Infrastructure/DI/DependencyInjection.cs
+6
-3
EmailService.cs
PSManagement.Infrastructure/Email/EmailService.cs
+19
-0
PSManagement.Infrastructure.Services.csproj
...nfrastructure/PSManagement.Infrastructure.Services.csproj
+2
-0
DateTimeProvider.cs
PSManagement.Infrastructure/Providers/DateTimeProvider.cs
+0
-0
EmployeesProvider.cs
PSManagement.Infrastructure/Providers/EmployeesProvider.cs
+0
-0
FileService.cs
PSManagement.Infrastructure/Storage/FileService.cs
+38
-0
SyncEmployeesService.cs
PSManagement.Infrastructure/SyncData/SyncEmployeesService.cs
+6
-6
No files found.
PSManagement.Domain/Projects/Builders/ProjectBuilder.cs
View file @
b6741e60
...
@@ -23,7 +23,7 @@ namespace PSManagement.Domain.Projects.Builders
...
@@ -23,7 +23,7 @@ namespace PSManagement.Domain.Projects.Builders
private
int
_projectManagerId
;
private
int
_projectManagerId
;
private
int
_executerId
;
private
int
_executerId
;
private
int
_proposerId
;
private
int
_proposerId
;
private
string
_stateName
;
private
ICollection
<
Step
>
_steps
;
private
ICollection
<
Step
>
_steps
;
private
ICollection
<
EmployeeParticipate
>
_participants
;
private
ICollection
<
EmployeeParticipate
>
_participants
;
private
ICollection
<
Attachment
>
_attachments
;
private
ICollection
<
Attachment
>
_attachments
;
...
@@ -94,10 +94,26 @@ namespace PSManagement.Domain.Projects.Builders
...
@@ -94,10 +94,26 @@ namespace PSManagement.Domain.Projects.Builders
}
}
return
this
;
return
this
;
}
}
public
ProjectBuilder
WithState
(
string
stateName
)
{
_stateName
=
stateName
;
return
this
;
}
public
Project
Build
()
public
Project
Build
()
{
{
Project
project
=
new
(
_proposalInfo
,
_projectInfo
,
_projectAggreement
,
_proposerId
,
_teamLeaderId
,
_projectManagerId
,
_executerId
);
if
(
_stateName
is
null
||
_stateName
==
""
)
{
_stateName
=
"Proposed"
;
}
Project
project
=
new
(
_proposalInfo
,
_projectInfo
,
_projectAggreement
,
_proposerId
,
_teamLeaderId
,
_projectManagerId
,
_executerId
,
_stateName
);
project
.
FinancialFund
=
_financialFund
;
project
.
FinancialFund
=
_financialFund
;
if
(
_attachments
is
not
null
)
{
if
(
_attachments
is
not
null
)
{
...
...
PSManagement.Domain/Projects/DomainEvents/ProjectCreatedEvent.cs
View file @
b6741e60
...
@@ -7,5 +7,8 @@ using System.Threading.Tasks;
...
@@ -7,5 +7,8 @@ using System.Threading.Tasks;
namespace
PSManagement.Domain.Projects.DomainEvents
namespace
PSManagement.Domain.Projects.DomainEvents
{
{
public
record
ProjectCreatedEvent
(
int
projectId
)
:
IDomainEvent
;
public
record
ProjectCreatedEvent
(
int
ProjectId
,
int
TeamLeaderId
,
int
ProjectManagerId
)
:
IDomainEvent
;
}
}
PSManagement.Domain/Projects/Entities/Attachment.cs
View file @
b6741e60
...
@@ -4,10 +4,17 @@ namespace PSManagement.Domain.Projects.Entities
...
@@ -4,10 +4,17 @@ namespace PSManagement.Domain.Projects.Entities
{
{
public
class
Attachment
:
BaseEntity
public
class
Attachment
:
BaseEntity
{
{
public
int
ProjectId
{
get
;
set
;
}
public
string
AttachmentUrl
{
get
;
set
;
}
public
string
AttachmentUrl
{
get
;
set
;
}
public
string
AttachmentName
{
get
;
set
;
}
public
string
AttachmentName
{
get
;
set
;
}
public
string
AttachmenDescription
{
get
;
set
;
}
public
string
AttachmentDescription
{
get
;
set
;
}
public
Attachment
(
string
attachmentUrl
,
string
attachmentName
,
string
attachmentDescription
,
int
projectId
)
{
AttachmentUrl
=
attachmentUrl
;
AttachmentName
=
attachmentName
;
AttachmentDescription
=
attachmentDescription
;
ProjectId
=
projectId
;
}
}
}
}
}
PSManagement.Domain/Projects/Entities/Project.cs
View file @
b6741e60
...
@@ -5,8 +5,10 @@ using PSManagement.Domain.ProjectsStatus.Entites;
...
@@ -5,8 +5,10 @@ using PSManagement.Domain.ProjectsStatus.Entites;
using
PSManagement.Domain.ProjectTypes.Entities
;
using
PSManagement.Domain.ProjectTypes.Entities
;
using
PSManagement.Domain.Tracking
;
using
PSManagement.Domain.Tracking
;
using
PSManagement.SharedKernel.Aggregate
;
using
PSManagement.SharedKernel.Aggregate
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Collections.ObjectModel
;
using
System.Collections.ObjectModel
;
using
System.ComponentModel.DataAnnotations.Schema
;
using
System.Linq
;
using
System.Linq
;
using
System.Text
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
...
@@ -18,8 +20,12 @@ namespace PSManagement.Domain.Projects.Entities
...
@@ -18,8 +20,12 @@ namespace PSManagement.Domain.Projects.Entities
// information about the project itself
// information about the project itself
public
ProposalInfo
ProposalInfo
{
get
;
set
;
}
public
ProposalInfo
ProposalInfo
{
get
;
set
;
}
public
ProjectInfo
ProjectInfo
{
get
;
set
;
}
public
ProjectInfo
ProjectInfo
{
get
;
set
;
}
public
ProjectStatus
ProjectStatus
{
get
;
set
;
}
public
Aggreement
ProjectAggreement
{
get
;
set
;
}
public
Aggreement
ProjectAggreement
{
get
;
set
;
}
// state management
[
NotMapped
]
public
string
CurrentState
{
get
;
private
set
;
}
// Persisted in the database
private
IProjectState
_state
;
// information about who lead and execute the project
// information about who lead and execute the project
public
int
TeamLeaderId
{
get
;
set
;
}
public
int
TeamLeaderId
{
get
;
set
;
}
...
@@ -72,8 +78,10 @@ namespace PSManagement.Domain.Projects.Entities
...
@@ -72,8 +78,10 @@ namespace PSManagement.Domain.Projects.Entities
int
proposerId
,
int
proposerId
,
int
teamLeaderId
,
int
teamLeaderId
,
int
projectManagerId
,
int
projectManagerId
,
int
executerId
)
int
executerId
,
string
stateName
)
{
{
SetStateFromString
(
stateName
);
ProposalInfo
=
proposalInfo
;
ProposalInfo
=
proposalInfo
;
ProjectInfo
=
projectInfo
;
ProjectInfo
=
projectInfo
;
ProjectAggreement
=
projectAggreement
;
ProjectAggreement
=
projectAggreement
;
...
@@ -91,9 +99,64 @@ namespace PSManagement.Domain.Projects.Entities
...
@@ -91,9 +99,64 @@ namespace PSManagement.Domain.Projects.Entities
}
}
public
Project
()
public
Project
()
{
{
_state
=
new
ProposedState
();
CurrentState
=
_state
.
StateName
;
}
public
void
SetState
(
IProjectState
newState
)
{
_state
=
newState
;
CurrentState
=
_state
.
StateName
;
// Update the persisted state
}
public
void
Complete
()
{
_state
.
Complete
(
this
);
}
public
void
Plan
()
{
_state
.
Complete
(
this
);
}
}
public
void
Approve
()
{
_state
.
Complete
(
this
);
}
public
void
Cancle
()
{
_state
.
Complete
(
this
);
}
public
void
Propose
()
{
_state
.
Complete
(
this
);
}
public
void
SetStateFromString
(
string
stateName
)
{
switch
(
stateName
)
{
case
"Proposed"
:
SetState
(
new
ProposedState
());
break
;
case
"InPlan"
:
SetState
(
new
InPlanState
());
break
;
case
"Cancled"
:
SetState
(
new
CancledState
());
break
;
case
"InProgress"
:
SetState
(
new
InProgressState
());
break
;
case
"Completed"
:
SetState
(
new
CompletedState
());
break
;
default
:
throw
new
InvalidOperationException
(
"Unknown state"
);
}
}
}
}
}
}
PSManagement.Domain/Projects/Specification/ProjectSpecification.cs
0 → 100644
View file @
b6741e60
using
PSManagement.Domain.Projects.Entities
;
using
PSManagement.SharedKernel.Specification
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Linq.Expressions
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
PSManagement.Domain.Projects
{
public
class
ProjectSpecification
:
BaseSpecification
<
Project
>
{
public
ProjectSpecification
(
Expression
<
Func
<
Project
,
bool
>>
criteria
=
null
)
:
base
(
criteria
)
{
AddInclude
(
u
=>
u
.
Steps
);
}
}
}
PSManagement.Domain/Projects/States/CancledState.cs
0 → 100644
View file @
b6741e60
namespace
PSManagement.Domain.Projects.Entities
{
public
class
CancledState
:
IProjectState
{
public
string
StateName
=>
"CancledState"
;
public
void
Approve
(
Project
project
)
{
}
public
void
Cancle
(
Project
project
)
{
}
public
void
Complete
(
Project
project
)
{
}
public
void
Plan
(
Project
project
)
{
}
public
void
Propose
(
Project
project
)
{
}
}
}
PSManagement.Domain/Projects/States/CompletedState.cs
0 → 100644
View file @
b6741e60
namespace
PSManagement.Domain.Projects.Entities
{
public
class
CompletedState
:
IProjectState
{
public
string
StateName
=>
"Completed"
;
public
void
Approve
(
Project
project
)
{
}
public
void
Cancle
(
Project
project
)
{
}
public
void
Complete
(
Project
project
)
{
}
public
void
Plan
(
Project
project
)
{
}
public
void
Propose
(
Project
project
)
{
}
}
}
PSManagement.Domain/Projects/States/IProjectState.cs
0 → 100644
View file @
b6741e60
namespace
PSManagement.Domain.Projects.Entities
{
public
interface
IProjectState
{
void
Complete
(
Project
project
);
void
Plan
(
Project
project
);
void
Approve
(
Project
project
);
void
Cancle
(
Project
project
);
void
Propose
(
Project
project
);
string
StateName
{
get
;
}
}
}
PSManagement.Domain/Projects/States/InPlanState.cs
0 → 100644
View file @
b6741e60
namespace
PSManagement.Domain.Projects.Entities
{
public
class
InPlanState
:
IProjectState
{
public
string
StateName
=>
"InPlan"
;
public
void
Approve
(
Project
project
)
{
project
.
SetState
(
new
InProgressState
());
}
public
void
Cancle
(
Project
project
)
{
project
.
SetState
(
new
CancledState
());
}
public
void
Complete
(
Project
project
)
{
project
.
SetState
(
new
CompletedState
());
}
public
void
Plan
(
Project
project
)
{
}
public
void
Propose
(
Project
project
)
{
}
}
}
PSManagement.Domain/Projects/States/InProgressState.cs
0 → 100644
View file @
b6741e60
namespace
PSManagement.Domain.Projects.Entities
{
public
class
InProgressState
:
IProjectState
{
public
string
StateName
=>
"InProgress"
;
public
void
Approve
(
Project
project
)
{
}
public
void
Cancle
(
Project
project
)
{
project
.
SetState
(
new
CancledState
());
}
public
void
Complete
(
Project
project
)
{
project
.
SetState
(
new
CompletedState
());
}
public
void
Plan
(
Project
project
)
{
project
.
SetState
(
new
InPlanState
());
}
public
void
Propose
(
Project
project
)
{
}
}
}
PSManagement.Domain/Projects/States/ProposedState.cs
0 → 100644
View file @
b6741e60
namespace
PSManagement.Domain.Projects.Entities
{
public
class
ProposedState
:
IProjectState
{
public
string
StateName
=>
"Proposed"
;
public
void
Approve
(
Project
project
)
{
project
.
SetState
(
new
InPlanState
());
}
public
void
Cancle
(
Project
project
)
{
}
public
void
Complete
(
Project
project
)
{
}
public
void
Plan
(
Project
project
)
{
}
public
void
Propose
(
Project
project
)
{
}
}
}
PSManagement.Domain/ProjectsStatus/Entites/ProjectStatus.cs
→
PSManagement.Domain/
X
ProjectsStatus/Entites/ProjectStatus.cs
View file @
b6741e60
File moved
PSManagement.Domain/ProjectsStatus/Repositories/IProjectStatusRepository.cs
→
PSManagement.Domain/
X
ProjectsStatus/Repositories/IProjectStatusRepository.cs
View file @
b6741e60
File moved
PSManagement.Domain/ProjectsTypes/Entities/ProjectType.cs
→
PSManagement.Domain/
X
ProjectsTypes/Entities/ProjectType.cs
View file @
b6741e60
File moved
PSManagement.Domain/ProjectsTypes/Repositories/IProjectTypesRepository.cs
→
PSManagement.Domain/
X
ProjectsTypes/Repositories/IProjectTypesRepository.cs
View file @
b6741e60
File moved
PSManagement.Infrastructure.Persistence/DI/DependencyInjection.cs
View file @
b6741e60
...
@@ -6,12 +6,14 @@ using PSManagement.Domain.Employees.Repositories;
...
@@ -6,12 +6,14 @@ using PSManagement.Domain.Employees.Repositories;
using
PSManagement.Domain.Identity.Repositories
;
using
PSManagement.Domain.Identity.Repositories
;
using
PSManagement.Domain.Projects.Builders
;
using
PSManagement.Domain.Projects.Builders
;
using
PSManagement.Domain.Projects.Repositories
;
using
PSManagement.Domain.Projects.Repositories
;
using
PSManagement.Infrastructure.Persistence.Repositories.Base
;
using
PSManagement.Infrastructure.Persistence.Repositories.CustomerRepository
;
using
PSManagement.Infrastructure.Persistence.Repositories.CustomerRepository
;
using
PSManagement.Infrastructure.Persistence.Repositories.EmployeeRepository
;
using
PSManagement.Infrastructure.Persistence.Repositories.EmployeeRepository
;
using
PSManagement.Infrastructure.Persistence.Repositories.ProjectRepository
;
using
PSManagement.Infrastructure.Persistence.Repositories.ProjectRepository
;
using
PSManagement.Infrastructure.Persistence.Repositories.UserRepository
;
using
PSManagement.Infrastructure.Persistence.Repositories.UserRepository
;
using
PSManagement.Infrastructure.Persistence.UoW
;
using
PSManagement.Infrastructure.Persistence.UoW
;
using
PSManagement.SharedKernel.Interfaces
;
using
PSManagement.SharedKernel.Interfaces
;
using
PSManagement.SharedKernel.Repositories
;
namespace
PSManagement.Infrastructure.Persistence.DI
namespace
PSManagement.Infrastructure.Persistence.DI
{
{
...
@@ -23,6 +25,7 @@ namespace PSManagement.Infrastructure.Persistence.DI
...
@@ -23,6 +25,7 @@ namespace PSManagement.Infrastructure.Persistence.DI
services
.
AddDbContext
<
AppDbContext
>(
options
=>
{
services
.
AddDbContext
<
AppDbContext
>(
options
=>
{
options
.
UseSqlServer
(
configuration
.
GetConnectionString
(
"DefaultConnection"
));
options
.
UseSqlServer
(
configuration
.
GetConnectionString
(
"DefaultConnection"
));
});
});
services
.
AddScoped
<
IUsersRepository
,
UsersRepository
>();
services
.
AddScoped
<
IUsersRepository
,
UsersRepository
>();
services
.
AddScoped
<
ICustomersRepository
,
CustomersReposiotry
>();
services
.
AddScoped
<
ICustomersRepository
,
CustomersReposiotry
>();
services
.
AddScoped
<
IProjectsRepository
,
ProjectsRepository
>();
services
.
AddScoped
<
IProjectsRepository
,
ProjectsRepository
>();
...
@@ -31,6 +34,7 @@ namespace PSManagement.Infrastructure.Persistence.DI
...
@@ -31,6 +34,7 @@ namespace PSManagement.Infrastructure.Persistence.DI
services
.
AddScoped
<
ProjectBuilder
>();
services
.
AddScoped
<
ProjectBuilder
>();
services
.
AddScoped
(
typeof
(
IRepository
<>),
typeof
(
BaseRepository
<>));
services
.
AddScoped
<
IUnitOfWork
,
UnitOfWork
>();
services
.
AddScoped
<
IUnitOfWork
,
UnitOfWork
>();
return
services
;
return
services
;
}
}
...
...
PSManagement.Infrastructure.Persistence/EntitiesConfiguration/ProjectEntityConfiguration.cs
View file @
b6741e60
...
@@ -62,8 +62,10 @@ namespace PSManagement.Infrastructure.Persistence.EntitiesConfiguration
...
@@ -62,8 +62,10 @@ namespace PSManagement.Infrastructure.Persistence.EntitiesConfiguration
p
.
Property
(
e
=>
e
.
Source
).
HasColumnName
(
"FinicialSource"
);
p
.
Property
(
e
=>
e
.
Source
).
HasColumnName
(
"FinicialSource"
);
}
}
);
);
builder
.
HasOne
(
e
=>
e
.
ProjectStatus
).
WithMany
();
builder
.
Property
(
p
=>
p
.
CurrentState
).
HasDefaultValue
(
"Proposed"
);
builder
.
HasMany
(
e
=>
e
.
Attachments
).
WithOne
().
HasForeignKey
(
e
=>
e
.
ProjectId
);
builder
.
HasMany
(
e
=>
e
.
FinancialSpending
);
builder
.
HasMany
(
e
=>
e
.
FinancialSpending
);
builder
.
HasMany
(
e
=>
e
.
Tracks
).
WithOne
(
e
=>
e
.
Project
).
HasForeignKey
(
e
=>
e
.
ProjectId
);
builder
.
HasMany
(
e
=>
e
.
Tracks
).
WithOne
(
e
=>
e
.
Project
).
HasForeignKey
(
e
=>
e
.
ProjectId
);
...
...
PSManagement.Infrastructure.Persistence/Migrations/20240812170053_fixSomeEntitiesNames.Designer.cs
0 → 100644
View file @
b6741e60
// <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
(
"20240812170053_fixSomeEntitiesNames"
)]
partial
class
fixSomeEntitiesNames
{
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.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
=
"شؤون الطلاب"
});
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Employees.Entities.Employee"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
>(
"HIASTId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"UserId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"UserId"
)
.
IsUnique
();
b
.
ToTable
(
"Employees"
);
});
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
=
3
,
Name
=
"Scientific-Supervisor"
});
});
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.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
(
"FinancialSpending"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.Project"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
?>(
"CustomerId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"ExecuterId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"ProjectManagerId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
?>(
"ProjectStatusId"
)
.
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
(
"ProjectStatusId"
);
b
.
HasIndex
(
"ProposerId"
);
b
.
HasIndex
(
"TeamLeaderId"
);
b
.
ToTable
(
"Projects"
);
});
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
<
string
>(
"Description"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
>(
"Duration"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"ProjectId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
DateTime
>(
"StartDate"
)
.
HasColumnType
(
"datetime2"
);
b
.
Property
<
string
>(
"StepName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
>(
"Weight"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"ProjectId"
);
b
.
ToTable
(
"Steps"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.ProjectsStatus.Entites.ProjectStatus"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Code"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"Details"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"Name"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"ProjectStatus"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Reports.Entities.Answer"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"AnswerValue"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
?>(
"QuestionId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
?>(
"ReportResultId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"QuestionId"
);
b
.
HasIndex
(
"ReportResultId"
);
b
.
ToTable
(
"Answer"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Reports.Entities.Question"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"QuestionName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Question"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Reports.Entities.Report"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"ReportName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Reports"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Reports.Entities.ReportResult"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
?>(
"ReportId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"ReportId"
);
b
.
ToTable
(
"ReportResults"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Reports.Entities.Section"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
?>(
"ReportId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"SectionName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"ReportId"
);
b
.
ToTable
(
"Section"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.EmployeeTrack"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"AssignedWork"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
>(
"EmloyeeId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"PerformedWork"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
>(
"TrackId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"WorkingHours"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"EmloyeeId"
);
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
<
int
>(
"ExecutionRatio"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"StepId"
)
.
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
<
int
>(
"ProjectId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
DateTime
>(
"TrackDate"
)
.
HasColumnType
(
"datetime2"
);
b
.
Property
<
string
>(
"TrackNote"
)
.
HasColumnType
(
"nvarchar(max)"
);
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
(
"QuestionSection"
,
b
=>
{
b
.
Property
<
int
>(
"QuestionsId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"SectionsId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"QuestionsId"
,
"SectionsId"
);
b
.
HasIndex
(
"SectionsId"
);
b
.
ToTable
(
"QuestionSection"
);
});
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.Customer"
,
b
=>
{
b
.
OwnsMany
(
"PSManagement.Domain.Customers.Entities.ContactInfo"
,
"ContactInfo"
,
b1
=>
{
b1
.
Property
<
int
>(
"CustomerId"
)
.
HasColumnType
(
"int"
);
b1
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
string
>(
"ContactType"
)
.
HasColumnType
(
"nvarchar(max)"
);
b1
.
Property
<
string
>(
"ContactValue"
)
.
HasColumnType
(
"nvarchar(max)"
);
b1
.
HasKey
(
"CustomerId"
,
"Id"
);
b1
.
ToTable
(
"ContactInfo"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"CustomerId"
);
});
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
.
Property
<
int
>(
"ZipCode"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"ZipCode"
);
b1
.
HasKey
(
"CustomerId"
);
b1
.
ToTable
(
"Customers"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"CustomerId"
);
});
b
.
Navigation
(
"Address"
);
b
.
Navigation
(
"ContactInfo"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Employees.Entities.Employee"
,
b
=>
{
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
(
"PersonalInfo"
);
b
.
Navigation
(
"User"
);
b
.
Navigation
(
"WorkInfo"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.Attachment"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Projects.Entities.Project"
,
null
)
.
WithMany
(
"Attachments"
)
.
HasForeignKey
(
"ProjectId"
);
});
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.FinancialSpending"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Projects.Entities.Project"
,
null
)
.
WithMany
(
"FinancialSpending"
)
.
HasForeignKey
(
"ProjectId"
);
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
(
"FinancialSpending"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"FinancialSpendingId"
);
});
b
.
Navigation
(
"ExternalPurchase"
);
});
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.ProjectsStatus.Entites.ProjectStatus"
,
"ProjectStatus"
)
.
WithMany
()
.
HasForeignKey
(
"ProjectStatusId"
);
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.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
(
"ProjectInfo"
);
b
.
Navigation
(
"ProjectManager"
);
b
.
Navigation
(
"ProjectStatus"
);
b
.
Navigation
(
"ProposalInfo"
);
b
.
Navigation
(
"Proposer"
);
b
.
Navigation
(
"TeamLeader"
);
});
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
.
Navigation
(
"Project"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Reports.Entities.Answer"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Reports.Entities.Question"
,
"Question"
)
.
WithMany
()
.
HasForeignKey
(
"QuestionId"
);
b
.
HasOne
(
"PSManagement.Domain.Reports.Entities.ReportResult"
,
null
)
.
WithMany
(
"Answers"
)
.
HasForeignKey
(
"ReportResultId"
);
b
.
Navigation
(
"Question"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Reports.Entities.ReportResult"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Reports.Entities.Report"
,
"Report"
)
.
WithMany
()
.
HasForeignKey
(
"ReportId"
);
b
.
Navigation
(
"Report"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Reports.Entities.Section"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Reports.Entities.Report"
,
"Report"
)
.
WithMany
(
"Sections"
)
.
HasForeignKey
(
"ReportId"
);
b
.
Navigation
(
"Report"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.EmployeeTrack"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"Employee"
)
.
WithMany
(
"EmployeeTracks"
)
.
HasForeignKey
(
"EmloyeeId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Tracking.Track"
,
"Track"
)
.
WithMany
(
"EmployeeTracks"
)
.
HasForeignKey
(
"TrackId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
Navigation
(
"Employee"
);
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
.
Navigation
(
"Project"
);
});
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
(
"QuestionSection"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Reports.Entities.Question"
,
null
)
.
WithMany
()
.
HasForeignKey
(
"QuestionsId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Reports.Entities.Section"
,
null
)
.
WithMany
()
.
HasForeignKey
(
"SectionsId"
)
.
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
(
"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
(
"Steps"
);
b
.
Navigation
(
"Tracks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.Step"
,
b
=>
{
b
.
Navigation
(
"StepTracks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Reports.Entities.Report"
,
b
=>
{
b
.
Navigation
(
"Sections"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Reports.Entities.ReportResult"
,
b
=>
{
b
.
Navigation
(
"Answers"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Track"
,
b
=>
{
b
.
Navigation
(
"EmployeeTracks"
);
b
.
Navigation
(
"StepTracks"
);
});
#pragma warning restore 612, 618
}
}
}
PSManagement.Infrastructure.Persistence/Migrations/20240812170053_fixSomeEntitiesNames.cs
0 → 100644
View file @
b6741e60
using
Microsoft.EntityFrameworkCore.Migrations
;
namespace
PSManagement.Infrastructure.Persistence.Migrations
{
public
partial
class
fixSomeEntitiesNames
:
Migration
{
protected
override
void
Up
(
MigrationBuilder
migrationBuilder
)
{
migrationBuilder
.
RenameColumn
(
name
:
"AttachmenDescription"
,
table
:
"Attachment"
,
newName
:
"AttachmentDescription"
);
}
protected
override
void
Down
(
MigrationBuilder
migrationBuilder
)
{
migrationBuilder
.
RenameColumn
(
name
:
"AttachmentDescription"
,
table
:
"Attachment"
,
newName
:
"AttachmenDescription"
);
}
}
}
PSManagement.Infrastructure.Persistence/Migrations/20240812172037_fixSomeEntitiesNames1.Designer.cs
0 → 100644
View file @
b6741e60
// <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
(
"20240812172037_fixSomeEntitiesNames1"
)]
partial
class
fixSomeEntitiesNames1
{
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.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
=
"شؤون الطلاب"
});
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Employees.Entities.Employee"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
>(
"HIASTId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"UserId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"UserId"
)
.
IsUnique
();
b
.
ToTable
(
"Employees"
);
});
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
=
3
,
Name
=
"Scientific-Supervisor"
});
});
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.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
(
"FinancialSpending"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.Project"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
?>(
"CustomerId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"ExecuterId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"ProjectManagerId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
?>(
"ProjectStatusId"
)
.
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
(
"ProjectStatusId"
);
b
.
HasIndex
(
"ProposerId"
);
b
.
HasIndex
(
"TeamLeaderId"
);
b
.
ToTable
(
"Projects"
);
});
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
<
string
>(
"Description"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
>(
"Duration"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"ProjectId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
DateTime
>(
"StartDate"
)
.
HasColumnType
(
"datetime2"
);
b
.
Property
<
string
>(
"StepName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
>(
"Weight"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"ProjectId"
);
b
.
ToTable
(
"Steps"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.ProjectsStatus.Entites.ProjectStatus"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Code"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"Details"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"Name"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"ProjectStatus"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Reports.Entities.Answer"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"AnswerValue"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
?>(
"QuestionId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
?>(
"ReportResultId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"QuestionId"
);
b
.
HasIndex
(
"ReportResultId"
);
b
.
ToTable
(
"Answer"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Reports.Entities.Question"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"QuestionName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Question"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Reports.Entities.Report"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"ReportName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Reports"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Reports.Entities.ReportResult"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
?>(
"ReportId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"ReportId"
);
b
.
ToTable
(
"ReportResults"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Reports.Entities.Section"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
?>(
"ReportId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"SectionName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"ReportId"
);
b
.
ToTable
(
"Section"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.EmployeeTrack"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"AssignedWork"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
>(
"EmloyeeId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"PerformedWork"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
>(
"TrackId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"WorkingHours"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"EmloyeeId"
);
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
<
int
>(
"ExecutionRatio"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"StepId"
)
.
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
<
int
>(
"ProjectId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
DateTime
>(
"TrackDate"
)
.
HasColumnType
(
"datetime2"
);
b
.
Property
<
string
>(
"TrackNote"
)
.
HasColumnType
(
"nvarchar(max)"
);
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
(
"QuestionSection"
,
b
=>
{
b
.
Property
<
int
>(
"QuestionsId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"SectionsId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"QuestionsId"
,
"SectionsId"
);
b
.
HasIndex
(
"SectionsId"
);
b
.
ToTable
(
"QuestionSection"
);
});
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.Customer"
,
b
=>
{
b
.
OwnsMany
(
"PSManagement.Domain.Customers.Entities.ContactInfo"
,
"ContactInfo"
,
b1
=>
{
b1
.
Property
<
int
>(
"CustomerId"
)
.
HasColumnType
(
"int"
);
b1
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
string
>(
"ContactType"
)
.
HasColumnType
(
"nvarchar(max)"
);
b1
.
Property
<
string
>(
"ContactValue"
)
.
HasColumnType
(
"nvarchar(max)"
);
b1
.
HasKey
(
"CustomerId"
,
"Id"
);
b1
.
ToTable
(
"ContactInfo"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"CustomerId"
);
});
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
.
Property
<
int
>(
"ZipCode"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"ZipCode"
);
b1
.
HasKey
(
"CustomerId"
);
b1
.
ToTable
(
"Customers"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"CustomerId"
);
});
b
.
Navigation
(
"Address"
);
b
.
Navigation
(
"ContactInfo"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Employees.Entities.Employee"
,
b
=>
{
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
(
"PersonalInfo"
);
b
.
Navigation
(
"User"
);
b
.
Navigation
(
"WorkInfo"
);
});
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.FinancialSpending"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Projects.Entities.Project"
,
null
)
.
WithMany
(
"FinancialSpending"
)
.
HasForeignKey
(
"ProjectId"
);
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
(
"FinancialSpending"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"FinancialSpendingId"
);
});
b
.
Navigation
(
"ExternalPurchase"
);
});
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.ProjectsStatus.Entites.ProjectStatus"
,
"ProjectStatus"
)
.
WithMany
()
.
HasForeignKey
(
"ProjectStatusId"
);
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.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
(
"ProjectInfo"
);
b
.
Navigation
(
"ProjectManager"
);
b
.
Navigation
(
"ProjectStatus"
);
b
.
Navigation
(
"ProposalInfo"
);
b
.
Navigation
(
"Proposer"
);
b
.
Navigation
(
"TeamLeader"
);
});
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
.
Navigation
(
"Project"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Reports.Entities.Answer"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Reports.Entities.Question"
,
"Question"
)
.
WithMany
()
.
HasForeignKey
(
"QuestionId"
);
b
.
HasOne
(
"PSManagement.Domain.Reports.Entities.ReportResult"
,
null
)
.
WithMany
(
"Answers"
)
.
HasForeignKey
(
"ReportResultId"
);
b
.
Navigation
(
"Question"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Reports.Entities.ReportResult"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Reports.Entities.Report"
,
"Report"
)
.
WithMany
()
.
HasForeignKey
(
"ReportId"
);
b
.
Navigation
(
"Report"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Reports.Entities.Section"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Reports.Entities.Report"
,
"Report"
)
.
WithMany
(
"Sections"
)
.
HasForeignKey
(
"ReportId"
);
b
.
Navigation
(
"Report"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.EmployeeTrack"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"Employee"
)
.
WithMany
(
"EmployeeTracks"
)
.
HasForeignKey
(
"EmloyeeId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Tracking.Track"
,
"Track"
)
.
WithMany
(
"EmployeeTracks"
)
.
HasForeignKey
(
"TrackId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
Navigation
(
"Employee"
);
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
.
Navigation
(
"Project"
);
});
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
(
"QuestionSection"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Reports.Entities.Question"
,
null
)
.
WithMany
()
.
HasForeignKey
(
"QuestionsId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Reports.Entities.Section"
,
null
)
.
WithMany
()
.
HasForeignKey
(
"SectionsId"
)
.
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
(
"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
(
"Steps"
);
b
.
Navigation
(
"Tracks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.Step"
,
b
=>
{
b
.
Navigation
(
"StepTracks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Reports.Entities.Report"
,
b
=>
{
b
.
Navigation
(
"Sections"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Reports.Entities.ReportResult"
,
b
=>
{
b
.
Navigation
(
"Answers"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Track"
,
b
=>
{
b
.
Navigation
(
"EmployeeTracks"
);
b
.
Navigation
(
"StepTracks"
);
});
#pragma warning restore 612, 618
}
}
}
PSManagement.Infrastructure.Persistence/Migrations/20240812172037_fixSomeEntitiesNames1.cs
0 → 100644
View file @
b6741e60
using
Microsoft.EntityFrameworkCore.Migrations
;
namespace
PSManagement.Infrastructure.Persistence.Migrations
{
public
partial
class
fixSomeEntitiesNames1
:
Migration
{
protected
override
void
Up
(
MigrationBuilder
migrationBuilder
)
{
migrationBuilder
.
DropForeignKey
(
name
:
"FK_Attachment_Projects_ProjectId"
,
table
:
"Attachment"
);
migrationBuilder
.
AlterColumn
<
int
>(
name
:
"ProjectId"
,
table
:
"Attachment"
,
type
:
"int"
,
nullable
:
false
,
defaultValue
:
0
,
oldClrType
:
typeof
(
int
),
oldType
:
"int"
,
oldNullable
:
true
);
migrationBuilder
.
AddForeignKey
(
name
:
"FK_Attachment_Projects_ProjectId"
,
table
:
"Attachment"
,
column
:
"ProjectId"
,
principalTable
:
"Projects"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Cascade
);
}
protected
override
void
Down
(
MigrationBuilder
migrationBuilder
)
{
migrationBuilder
.
DropForeignKey
(
name
:
"FK_Attachment_Projects_ProjectId"
,
table
:
"Attachment"
);
migrationBuilder
.
AlterColumn
<
int
>(
name
:
"ProjectId"
,
table
:
"Attachment"
,
type
:
"int"
,
nullable
:
true
,
oldClrType
:
typeof
(
int
),
oldType
:
"int"
);
migrationBuilder
.
AddForeignKey
(
name
:
"FK_Attachment_Projects_ProjectId"
,
table
:
"Attachment"
,
column
:
"ProjectId"
,
principalTable
:
"Projects"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Restrict
);
}
}
}
PSManagement.Infrastructure.Persistence/Migrations/20240812194901_AddStatePattern.Designer.cs
0 → 100644
View file @
b6741e60
// <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
(
"20240812194901_AddStatePattern"
)]
partial
class
AddStatePattern
{
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.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
=
"شؤون الطلاب"
});
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Employees.Entities.Employee"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
>(
"HIASTId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"UserId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"UserId"
)
.
IsUnique
();
b
.
ToTable
(
"Employees"
);
});
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
=
3
,
Name
=
"Scientific-Supervisor"
});
});
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.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
(
"FinancialSpending"
);
});
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)"
)
.
HasDefaultValue
(
"Proposed"
);
b
.
Property
<
int
?>(
"CustomerId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"ExecuterId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"ProjectManagerId"
)
.
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
(
"ProposerId"
);
b
.
HasIndex
(
"TeamLeaderId"
);
b
.
ToTable
(
"Projects"
);
});
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
<
string
>(
"Description"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
>(
"Duration"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"ProjectId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
DateTime
>(
"StartDate"
)
.
HasColumnType
(
"datetime2"
);
b
.
Property
<
string
>(
"StepName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
>(
"Weight"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"ProjectId"
);
b
.
ToTable
(
"Steps"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Reports.Entities.Answer"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"AnswerValue"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
?>(
"QuestionId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
?>(
"ReportResultId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"QuestionId"
);
b
.
HasIndex
(
"ReportResultId"
);
b
.
ToTable
(
"Answer"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Reports.Entities.Question"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"QuestionName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Question"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Reports.Entities.Report"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"ReportName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Reports"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Reports.Entities.ReportResult"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
?>(
"ReportId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"ReportId"
);
b
.
ToTable
(
"ReportResults"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Reports.Entities.Section"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
int
?>(
"ReportId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"SectionName"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"ReportId"
);
b
.
ToTable
(
"Section"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.EmployeeTrack"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"AssignedWork"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
>(
"EmloyeeId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"PerformedWork"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
>(
"TrackId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"WorkingHours"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"EmloyeeId"
);
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
<
int
>(
"ExecutionRatio"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"StepId"
)
.
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
<
int
>(
"ProjectId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
DateTime
>(
"TrackDate"
)
.
HasColumnType
(
"datetime2"
);
b
.
Property
<
string
>(
"TrackNote"
)
.
HasColumnType
(
"nvarchar(max)"
);
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
(
"QuestionSection"
,
b
=>
{
b
.
Property
<
int
>(
"QuestionsId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"SectionsId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"QuestionsId"
,
"SectionsId"
);
b
.
HasIndex
(
"SectionsId"
);
b
.
ToTable
(
"QuestionSection"
);
});
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.Customer"
,
b
=>
{
b
.
OwnsMany
(
"PSManagement.Domain.Customers.Entities.ContactInfo"
,
"ContactInfo"
,
b1
=>
{
b1
.
Property
<
int
>(
"CustomerId"
)
.
HasColumnType
(
"int"
);
b1
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b1
.
Property
<
string
>(
"ContactType"
)
.
HasColumnType
(
"nvarchar(max)"
);
b1
.
Property
<
string
>(
"ContactValue"
)
.
HasColumnType
(
"nvarchar(max)"
);
b1
.
HasKey
(
"CustomerId"
,
"Id"
);
b1
.
ToTable
(
"ContactInfo"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"CustomerId"
);
});
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
.
Property
<
int
>(
"ZipCode"
)
.
HasColumnType
(
"int"
)
.
HasColumnName
(
"ZipCode"
);
b1
.
HasKey
(
"CustomerId"
);
b1
.
ToTable
(
"Customers"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"CustomerId"
);
});
b
.
Navigation
(
"Address"
);
b
.
Navigation
(
"ContactInfo"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Employees.Entities.Employee"
,
b
=>
{
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
(
"PersonalInfo"
);
b
.
Navigation
(
"User"
);
b
.
Navigation
(
"WorkInfo"
);
});
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.FinancialSpending"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Projects.Entities.Project"
,
null
)
.
WithMany
(
"FinancialSpending"
)
.
HasForeignKey
(
"ProjectId"
);
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
(
"FinancialSpending"
);
b1
.
WithOwner
()
.
HasForeignKey
(
"FinancialSpendingId"
);
});
b
.
Navigation
(
"ExternalPurchase"
);
});
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.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.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
(
"ProjectInfo"
);
b
.
Navigation
(
"ProjectManager"
);
b
.
Navigation
(
"ProposalInfo"
);
b
.
Navigation
(
"Proposer"
);
b
.
Navigation
(
"TeamLeader"
);
});
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
.
Navigation
(
"Project"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Reports.Entities.Answer"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Reports.Entities.Question"
,
"Question"
)
.
WithMany
()
.
HasForeignKey
(
"QuestionId"
);
b
.
HasOne
(
"PSManagement.Domain.Reports.Entities.ReportResult"
,
null
)
.
WithMany
(
"Answers"
)
.
HasForeignKey
(
"ReportResultId"
);
b
.
Navigation
(
"Question"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Reports.Entities.ReportResult"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Reports.Entities.Report"
,
"Report"
)
.
WithMany
()
.
HasForeignKey
(
"ReportId"
);
b
.
Navigation
(
"Report"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Reports.Entities.Section"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Reports.Entities.Report"
,
"Report"
)
.
WithMany
(
"Sections"
)
.
HasForeignKey
(
"ReportId"
);
b
.
Navigation
(
"Report"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.EmployeeTrack"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Employees.Entities.Employee"
,
"Employee"
)
.
WithMany
(
"EmployeeTracks"
)
.
HasForeignKey
(
"EmloyeeId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Tracking.Track"
,
"Track"
)
.
WithMany
(
"EmployeeTracks"
)
.
HasForeignKey
(
"TrackId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
Navigation
(
"Employee"
);
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
.
Navigation
(
"Project"
);
});
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
(
"QuestionSection"
,
b
=>
{
b
.
HasOne
(
"PSManagement.Domain.Reports.Entities.Question"
,
null
)
.
WithMany
()
.
HasForeignKey
(
"QuestionsId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"PSManagement.Domain.Reports.Entities.Section"
,
null
)
.
WithMany
()
.
HasForeignKey
(
"SectionsId"
)
.
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
(
"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
(
"Steps"
);
b
.
Navigation
(
"Tracks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.Step"
,
b
=>
{
b
.
Navigation
(
"StepTracks"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Reports.Entities.Report"
,
b
=>
{
b
.
Navigation
(
"Sections"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Reports.Entities.ReportResult"
,
b
=>
{
b
.
Navigation
(
"Answers"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Tracking.Track"
,
b
=>
{
b
.
Navigation
(
"EmployeeTracks"
);
b
.
Navigation
(
"StepTracks"
);
});
#pragma warning restore 612, 618
}
}
}
PSManagement.Infrastructure.Persistence/Migrations/20240812194901_AddStatePattern.cs
0 → 100644
View file @
b6741e60
using
Microsoft.EntityFrameworkCore.Migrations
;
namespace
PSManagement.Infrastructure.Persistence.Migrations
{
public
partial
class
AddStatePattern
:
Migration
{
protected
override
void
Up
(
MigrationBuilder
migrationBuilder
)
{
migrationBuilder
.
DropForeignKey
(
name
:
"FK_Projects_ProjectStatus_ProjectStatusId"
,
table
:
"Projects"
);
migrationBuilder
.
DropTable
(
name
:
"ProjectStatus"
);
migrationBuilder
.
DropIndex
(
name
:
"IX_Projects_ProjectStatusId"
,
table
:
"Projects"
);
migrationBuilder
.
DropColumn
(
name
:
"ProjectStatusId"
,
table
:
"Projects"
);
migrationBuilder
.
AddColumn
<
string
>(
name
:
"CurrentState"
,
table
:
"Projects"
,
type
:
"nvarchar(max)"
,
nullable
:
true
,
defaultValue
:
"Proposed"
);
}
protected
override
void
Down
(
MigrationBuilder
migrationBuilder
)
{
migrationBuilder
.
DropColumn
(
name
:
"CurrentState"
,
table
:
"Projects"
);
migrationBuilder
.
AddColumn
<
int
>(
name
:
"ProjectStatusId"
,
table
:
"Projects"
,
type
:
"int"
,
nullable
:
true
);
migrationBuilder
.
CreateTable
(
name
:
"ProjectStatus"
,
columns
:
table
=>
new
{
Id
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
)
.
Annotation
(
"SqlServer:Identity"
,
"1, 1"
),
Code
=
table
.
Column
<
string
>(
type
:
"nvarchar(max)"
,
nullable
:
true
),
Details
=
table
.
Column
<
string
>(
type
:
"nvarchar(max)"
,
nullable
:
true
),
Name
=
table
.
Column
<
string
>(
type
:
"nvarchar(max)"
,
nullable
:
true
)
},
constraints
:
table
=>
{
table
.
PrimaryKey
(
"PK_ProjectStatus"
,
x
=>
x
.
Id
);
});
migrationBuilder
.
CreateIndex
(
name
:
"IX_Projects_ProjectStatusId"
,
table
:
"Projects"
,
column
:
"ProjectStatusId"
);
migrationBuilder
.
AddForeignKey
(
name
:
"FK_Projects_ProjectStatus_ProjectStatusId"
,
table
:
"Projects"
,
column
:
"ProjectStatusId"
,
principalTable
:
"ProjectStatus"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Restrict
);
}
}
}
PSManagement.Infrastructure.Persistence/Migrations/AppDbContextModelSnapshot.cs
View file @
b6741e60
...
@@ -175,7 +175,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
...
@@ -175,7 +175,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
.
HasColumnType
(
"int"
)
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"AttachmenDescription"
)
b
.
Property
<
string
>(
"Attachmen
t
Description"
)
.
HasColumnType
(
"nvarchar(max)"
);
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"AttachmentName"
)
b
.
Property
<
string
>(
"AttachmentName"
)
...
@@ -184,7 +184,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
...
@@ -184,7 +184,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b
.
Property
<
string
>(
"AttachmentUrl"
)
b
.
Property
<
string
>(
"AttachmentUrl"
)
.
HasColumnType
(
"nvarchar(max)"
);
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
?
>(
"ProjectId"
)
b
.
Property
<
int
>(
"ProjectId"
)
.
HasColumnType
(
"int"
);
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasKey
(
"Id"
);
...
@@ -258,6 +258,11 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
...
@@ -258,6 +258,11 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
.
HasColumnType
(
"int"
)
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"CurrentState"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"nvarchar(max)"
)
.
HasDefaultValue
(
"Proposed"
);
b
.
Property
<
int
?>(
"CustomerId"
)
b
.
Property
<
int
?>(
"CustomerId"
)
.
HasColumnType
(
"int"
);
.
HasColumnType
(
"int"
);
...
@@ -267,9 +272,6 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
...
@@ -267,9 +272,6 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b
.
Property
<
int
>(
"ProjectManagerId"
)
b
.
Property
<
int
>(
"ProjectManagerId"
)
.
HasColumnType
(
"int"
);
.
HasColumnType
(
"int"
);
b
.
Property
<
int
?>(
"ProjectStatusId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"ProposerId"
)
b
.
Property
<
int
>(
"ProposerId"
)
.
HasColumnType
(
"int"
);
.
HasColumnType
(
"int"
);
...
@@ -284,8 +286,6 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
...
@@ -284,8 +286,6 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b
.
HasIndex
(
"ProjectManagerId"
);
b
.
HasIndex
(
"ProjectManagerId"
);
b
.
HasIndex
(
"ProjectStatusId"
);
b
.
HasIndex
(
"ProposerId"
);
b
.
HasIndex
(
"ProposerId"
);
b
.
HasIndex
(
"TeamLeaderId"
);
b
.
HasIndex
(
"TeamLeaderId"
);
...
@@ -328,27 +328,6 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
...
@@ -328,27 +328,6 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b
.
ToTable
(
"Steps"
);
b
.
ToTable
(
"Steps"
);
});
});
modelBuilder
.
Entity
(
"PSManagement.Domain.ProjectsStatus.Entites.ProjectStatus"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
)
.
HasAnnotation
(
"SqlServer:ValueGenerationStrategy"
,
SqlServerValueGenerationStrategy
.
IdentityColumn
);
b
.
Property
<
string
>(
"Code"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"Details"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
string
>(
"Name"
)
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"ProjectStatus"
);
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Reports.Entities.Answer"
,
b
=>
modelBuilder
.
Entity
(
"PSManagement.Domain.Reports.Entities.Answer"
,
b
=>
{
{
b
.
Property
<
int
>(
"Id"
)
b
.
Property
<
int
>(
"Id"
)
...
@@ -724,7 +703,9 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
...
@@ -724,7 +703,9 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
{
{
b
.
HasOne
(
"PSManagement.Domain.Projects.Entities.Project"
,
null
)
b
.
HasOne
(
"PSManagement.Domain.Projects.Entities.Project"
,
null
)
.
WithMany
(
"Attachments"
)
.
WithMany
(
"Attachments"
)
.
HasForeignKey
(
"ProjectId"
);
.
HasForeignKey
(
"ProjectId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
});
});
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.EmployeeParticipate"
,
b
=>
modelBuilder
.
Entity
(
"PSManagement.Domain.Projects.Entities.EmployeeParticipate"
,
b
=>
...
@@ -797,10 +778,6 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
...
@@ -797,10 +778,6 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
.
HasForeignKey
(
"ProjectManagerId"
)
.
HasForeignKey
(
"ProjectManagerId"
)
.
OnDelete
(
DeleteBehavior
.
Restrict
);
.
OnDelete
(
DeleteBehavior
.
Restrict
);
b
.
HasOne
(
"PSManagement.Domain.ProjectsStatus.Entites.ProjectStatus"
,
"ProjectStatus"
)
.
WithMany
()
.
HasForeignKey
(
"ProjectStatusId"
);
b
.
HasOne
(
"PSManagement.Domain.Customers.Entities.Customer"
,
"Proposer"
)
b
.
HasOne
(
"PSManagement.Domain.Customers.Entities.Customer"
,
"Proposer"
)
.
WithMany
()
.
WithMany
()
.
HasForeignKey
(
"ProposerId"
)
.
HasForeignKey
(
"ProposerId"
)
...
@@ -926,8 +903,6 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
...
@@ -926,8 +903,6 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b
.
Navigation
(
"ProjectManager"
);
b
.
Navigation
(
"ProjectManager"
);
b
.
Navigation
(
"ProjectStatus"
);
b
.
Navigation
(
"ProposalInfo"
);
b
.
Navigation
(
"ProposalInfo"
);
b
.
Navigation
(
"Proposer"
);
b
.
Navigation
(
"Proposer"
);
...
...
PSManagement.Infrastructure/
Services/
Authentication/AuthenticationService.cs
→
PSManagement.Infrastructure/Authentication/AuthenticationService.cs
View file @
b6741e60
File moved
PSManagement.Infrastructure/
Services/
Authorization/RoleService.cs
→
PSManagement.Infrastructure/Authorization/RoleService.cs
View file @
b6741e60
File moved
PSManagement.Infrastructure/
Services/
Authorization/UserRolesService.cs
→
PSManagement.Infrastructure/Authorization/UserRolesService.cs
View file @
b6741e60
File moved
PSManagement.Infrastructure/BackgroundServcies/BackgroundJobSyncEmployees.cs
View file @
b6741e60
...
@@ -42,7 +42,10 @@ namespace PSManagement.Infrastructure.BackgroundServcies
...
@@ -42,7 +42,10 @@ namespace PSManagement.Infrastructure.BackgroundServcies
var
syncService
=
scope
.
ServiceProvider
.
GetRequiredService
<
ISyncEmployeesService
>();
var
syncService
=
scope
.
ServiceProvider
.
GetRequiredService
<
ISyncEmployeesService
>();
// Now you can use the repository to sync employees data
// Now you can use the repository to sync employees data
await
syncService
.
SyncEmployees
(
dataProvider
);
SyncResponse
response
=
await
syncService
.
SyncEmployees
(
dataProvider
);
Console
.
WriteLine
(
"A Data sync for Employees Occured At "
+
response
.
SyncDate
+
"\n The number of new Employees are "
+
response
.
SyncDataCount
);
}
}
}
}
...
...
PSManagement.Infrastructure/DI/DependencyInjection.cs
View file @
b6741e60
...
@@ -4,15 +4,18 @@ using Microsoft.Extensions.Configuration;
...
@@ -4,15 +4,18 @@ using Microsoft.Extensions.Configuration;
using
Microsoft.Extensions.DependencyInjection
;
using
Microsoft.Extensions.DependencyInjection
;
using
PSManagement.Application.Contracts.Authentication
;
using
PSManagement.Application.Contracts.Authentication
;
using
PSManagement.Application.Contracts.Authorization
;
using
PSManagement.Application.Contracts.Authorization
;
using
PSManagement.Application.Contracts.Email
;
using
PSManagement.Application.Contracts.Providers
;
using
PSManagement.Application.Contracts.Providers
;
using
PSManagement.Application.Contracts.Storage
;
using
PSManagement.Application.Contracts.SyncData
;
using
PSManagement.Application.Contracts.SyncData
;
using
PSManagement.Application.Contracts.Tokens
;
using
PSManagement.Application.Contracts.Tokens
;
using
PSManagement.Domain.Identity.Repositories
;
using
PSManagement.Infrastructure.Authentication
;
using
PSManagement.Infrastructure.Authentication
;
using
PSManagement.Infrastructure.BackgroundServcies
;
using
PSManagement.Infrastructure.BackgroundServcies
;
using
PSManagement.Infrastructure.Services.Authentication
;
using
PSManagement.Infrastructure.Services.Authentication
;
using
PSManagement.Infrastructure.Services.Authorization
;
using
PSManagement.Infrastructure.Services.Authorization
;
using
PSManagement.Infrastructure.Services.Email
;
using
PSManagement.Infrastructure.Services.Providers
;
using
PSManagement.Infrastructure.Services.Providers
;
using
PSManagement.Infrastructure.Services.Storage
;
using
PSManagement.Infrastructure.Settings
;
using
PSManagement.Infrastructure.Settings
;
using
PSManagement.Infrastructure.Tokens
;
using
PSManagement.Infrastructure.Tokens
;
...
@@ -35,8 +38,8 @@ namespace PSManagement.Infrastructure.DI
...
@@ -35,8 +38,8 @@ namespace PSManagement.Infrastructure.DI
{
{
services
.
AddSingleton
<
IDateTimeProvider
,
DateTimeProvider
>();
services
.
AddSingleton
<
IDateTimeProvider
,
DateTimeProvider
>();
services
.
AddScoped
<
IEmployeesProvider
,
EmployeesProvider
>();
services
.
AddScoped
<
IEmployeesProvider
,
EmployeesProvider
>();
services
.
AddScoped
<
IFileService
,
FileService
>();
services
.
AddScoped
<
IEmailService
,
EmailService
>();
return
services
;
return
services
;
}
}
private
static
IServiceCollection
AddBackgroundServices
(
this
IServiceCollection
services
,
IConfiguration
configuration
)
private
static
IServiceCollection
AddBackgroundServices
(
this
IServiceCollection
services
,
IConfiguration
configuration
)
...
...
PSManagement.Infrastructure/Email/EmailService.cs
0 → 100644
View file @
b6741e60
using
PSManagement.Application.Contracts.Email
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
PSManagement.Infrastructure.Services.Email
{
public
class
EmailService
:
IEmailService
{
public
Task
SendAsync
(
string
recipient
,
string
subject
,
string
body
)
{
Console
.
WriteLine
(
"a message sended to "
+
recipient
+
"|| body is "
+
body
+
"|| subject is"
+
subject
);
return
Task
.
CompletedTask
;
}
}
}
PSManagement.Infrastructure/PSManagement.Infrastructure.csproj
→
PSManagement.Infrastructure/PSManagement.Infrastructure.
Services.
csproj
View file @
b6741e60
...
@@ -24,6 +24,8 @@
...
@@ -24,6 +24,8 @@
<ProjectReference Include="..\PSManagement.Application\PSManagement.Application.csproj" />
<ProjectReference Include="..\PSManagement.Application\PSManagement.Application.csproj" />
<ProjectReference Include="..\PSManagement.Contracts\PSManagement.Contracts.csproj" />
<ProjectReference Include="..\PSManagement.Contracts\PSManagement.Contracts.csproj" />
<ProjectReference Include="..\PSManagement.Domain\PSManagement.Domain.csproj" />
<ProjectReference Include="..\PSManagement.Domain\PSManagement.Domain.csproj" />
<ProjectReference Include="..\PSManagement.Infrastructure.Persistence\PSManagement.Infrastructure.Persistence.csproj" />
<ProjectReference Include="..\PSManagement.SharedKernel\PSManagement.SharedKernel.csproj" />
</ItemGroup>
</ItemGroup>
</Project>
</Project>
PSManagement.Infrastructure/
Services/
Providers/DateTimeProvider.cs
→
PSManagement.Infrastructure/Providers/DateTimeProvider.cs
View file @
b6741e60
File moved
PSManagement.Infrastructure/
Services/
Providers/EmployeesProvider.cs
→
PSManagement.Infrastructure/Providers/EmployeesProvider.cs
View file @
b6741e60
File moved
PSManagement.Infrastructure/Storage/FileService.cs
0 → 100644
View file @
b6741e60
using
Ardalis.Result
;
using
Microsoft.AspNetCore.Http
;
using
PSManagement.Application.Contracts.Storage
;
using
System
;
using
System.Collections.Generic
;
using
System.IO
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
PSManagement.Infrastructure.Services.Storage
{
public
class
FileService
:
IFileService
{
public
async
Task
<
Result
<
String
>>
StoreFile
(
string
fileName
,
IFormFile
file
)
{
var
allowedExtensions
=
new
string
[]
{
".pdf"
,
".png"
};
if
(
file
is
null
)
{
return
Result
.
Invalid
(
new
ValidationError
(
"File couldn't be empty."
));
}
var
extension
=
Path
.
GetExtension
(
file
.
FileName
);
if
(!
allowedExtensions
.
Contains
(
extension
.
ToLower
()))
{
return
Result
.
Invalid
(
new
ValidationError
(
"File type not allowed."
));
}
fileName
=
fileName
+
"."
+
Path
.
GetExtension
(
file
.
FileName
);
var
filePath
=
Path
.
Combine
(
"wwwroot\\uploads"
,
fileName
);
using
(
var
stream
=
new
FileStream
(
filePath
,
FileMode
.
Create
))
{
await
file
.
CopyToAsync
(
stream
);
}
return
Result
.
Success
(
fileName
);
}
}
}
PSManagement.Infrastructure/S
ervices/S
yncData/SyncEmployeesService.cs
→
PSManagement.Infrastructure/SyncData/SyncEmployeesService.cs
View file @
b6741e60
using
Microsoft.Extensions.Hosting
;
using
Microsoft.Extensions.Hosting
;
using
Microsoft.Extensions.DependencyInjection
;
using
Microsoft.Extensions.DependencyInjection
;
using
PSManagement.Application.Contracts.Providers
;
using
PSManagement.Application.Contracts.SyncData
;
using
PSManagement.Domain.Employees.Entities
;
using
PSManagement.Domain.Employees.Repositories
;
using
PSManagement.Domain.Employees.Specification
;
using
PSManagement.SharedKernel.Specification
;
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Linq
;
...
@@ -14,6 +8,12 @@ using System.Threading;
...
@@ -14,6 +8,12 @@ using System.Threading;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
Microsoft.Extensions.Options
;
using
Microsoft.Extensions.Options
;
using
PSManagement.Infrastructure.Settings
;
using
PSManagement.Infrastructure.Settings
;
using
PSManagement.Application.Contracts.SyncData
;
using
PSManagement.Application.Contracts.Providers
;
using
PSManagement.Domain.Employees.Repositories
;
using
PSManagement.Domain.Employees.Entities
;
using
PSManagement.SharedKernel.Specification
;
using
PSManagement.Domain.Employees.Specification
;
namespace
PSManagement.Infrastructure.BackgroundServcies
namespace
PSManagement.Infrastructure.BackgroundServcies
{
{
...
...
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