Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
H
HIAST-Clinics
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
almohanad.hafez
HIAST-Clinics
Commits
069b3d66
Commit
069b3d66
authored
Aug 24, 2024
by
Almouhannad
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(B) Add holiday, edit domain
parent
ef8c64f8
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
1300 additions
and
46 deletions
+1300
-46
Holiday.cs
Clinics.Backend/Domain/Entities/Visits/Holiday.cs
+48
-0
Visit.cs
Clinics.Backend/Domain/Entities/Visits/Visit.cs
+16
-0
WaitingListRecord.cs
....Backend/Domain/Entities/WaitingList/WaitingListRecord.cs
+1
-20
DomainErrors.cs
Clinics.Backend/Domain/Errors/DomainErrors.cs
+3
-0
HolidayConfiguration.cs
...Persistence/Configurations/Visits/HolidayConfiguration.cs
+16
-0
VisitConfiguration.cs
...d/Persistence/Configurations/Visits/VisitConfiguration.cs
+5
-0
WaitingListRecordConfiguration.cs
...figurations/WaitingList/WaitingListRecordConfiguration.cs
+0
-9
20240823234349_Add_Holiday.Designer.cs
...istence/Migrations/20240823234349_Add_Holiday.Designer.cs
+1086
-0
20240823234349_Add_Holiday.cs
...kend/Persistence/Migrations/20240823234349_Add_Holiday.cs
+89
-0
ClinicsDbContextModelSnapshot.cs
...d/Persistence/Migrations/ClinicsDbContextModelSnapshot.cs
+36
-17
No files found.
Clinics.Backend/Domain/Entities/Visits/Holiday.cs
0 → 100644
View file @
069b3d66
using
Domain.Errors
;
using
Domain.Primitives
;
using
Domain.Shared
;
namespace
Domain.Entities.Visits
;
public
sealed
class
Holiday
:
Entity
{
#
region
Private
ctor
private
Holiday
(
int
id
)
:
base
(
id
)
{
}
private
Holiday
(
int
id
,
int
visitId
,
DateOnly
from
,
int
duration
)
:
base
(
id
)
{
VisitId
=
visitId
;
From
=
from
;
Duration
=
duration
;
}
#
endregion
#
region
Properties
#
region
Visit
public
int
VisitId
{
get
;
private
set
;
}
#
endregion
public
DateOnly
From
{
get
;
private
set
;
}
public
int
Duration
{
get
;
private
set
;
}
#
endregion
#
region
Methods
#
region
Static
factory
public
static
Result
<
Holiday
>
Create
(
int
visitId
,
DateOnly
from
,
int
duration
)
{
if
(
visitId
<=
0
||
duration
<=
0
)
return
Result
.
Failure
<
Holiday
>(
DomainErrors
.
InvalidValuesError
);
if
(
duration
>
5
)
return
Result
.
Failure
<
Holiday
>(
DomainErrors
.
InvalidHolidayDuration
);
return
new
Holiday
(
0
,
visitId
,
from
,
duration
);
}
#
endregion
#
endregion
}
Clinics.Backend/Domain/Entities/Visits/Visit.cs
View file @
069b3d66
...
...
@@ -83,6 +83,10 @@ public sealed class Visit : Entity
#
endregion
#
region
Holiday
public
Holiday
?
Holiday
{
get
;
private
set
;
}
#
endregion
#
endregion
#
region
Methods
...
...
@@ -166,5 +170,17 @@ public sealed class Visit : Entity
}
#
endregion
#
region
Add
holiday
public
Result
AddHoliday
(
DateOnly
from
,
int
duration
)
{
var
holidayResult
=
Holiday
.
Create
(
Id
,
from
,
duration
);
if
(
holidayResult
.
IsFailure
)
return
Result
.
Failure
(
holidayResult
.
Error
);
Holiday
=
holidayResult
.
Value
;
return
Result
.
Success
();
}
#
endregion
#
endregion
}
Clinics.Backend/Domain/Entities/WaitingList/WaitingListRecord.cs
View file @
069b3d66
...
...
@@ -13,7 +13,6 @@ public sealed class WaitingListRecord : Entity
private
WaitingListRecord
(
int
id
,
int
patientId
)
:
base
(
id
)
{
PatientId
=
patientId
;
IsServed
=
false
;
}
#
endregion
...
...
@@ -27,16 +26,9 @@ public sealed class WaitingListRecord : Entity
#
endregion
#
region
Doctor
public
int
?
DoctorId
{
get
;
set
;
}
public
Doctor
?
Doctor
{
get
;
set
;
}
#
endregion
#
region
Additional
public
bool
IsServed
{
get
;
set
;
}
=
false
;
DateTime
ArrivalTime
{
get
;
set
;
}
#
endregion
...
...
@@ -55,16 +47,5 @@ public sealed class WaitingListRecord : Entity
#
endregion
#
region
Link
to
doctor
public
Result
LinkToDoctor
(
int
doctorId
)
{
if
(
doctorId
<=
0
)
return
Result
.
Failure
(
Errors
.
DomainErrors
.
InvalidValuesError
);
DoctorId
=
doctorId
;
return
Result
.
Success
();
}
#
endregion
#
endregion
}
Clinics.Backend/Domain/Errors/DomainErrors.cs
View file @
069b3d66
...
...
@@ -37,4 +37,7 @@ public static class DomainErrors
public
static
Error
VisitAlreadyHasThisMedicalImage
=>
new
(
"Domain.PatientAlreadyHasThisMedicine"
,
"تحتوي هذه الزيارة بالفعل على الصورة التي تحاول اضافتها"
);
public
static
Error
InvalidHolidayDuration
=>
new
(
"Domain.InvalidHolidayDuration"
,
"الحد الأقصى للإجازة المرضية هو خمس أيام"
);
}
Clinics.Backend/Persistence/Configurations/Visits/HolidayConfiguration.cs
0 → 100644
View file @
069b3d66
using
Domain.Entities.Visits
;
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore.Metadata.Builders
;
namespace
Persistence.Configurations.Visits
;
public
class
HolidayConfiguration
:
IEntityTypeConfiguration
<
Holiday
>
{
public
void
Configure
(
EntityTypeBuilder
<
Holiday
>
builder
)
{
builder
.
ToTable
(
nameof
(
Holiday
));
builder
.
Property
(
holiday
=>
holiday
.
From
).
IsRequired
();
builder
.
Property
(
holiday
=>
holiday
.
Duration
).
IsRequired
();
}
}
Clinics.Backend/Persistence/Configurations/Visits/VisitConfiguration.cs
View file @
069b3d66
...
...
@@ -21,5 +21,10 @@ internal class VisitConfiguration : IEntityTypeConfiguration<Visit>
.
WithMany
()
.
HasForeignKey
(
visit
=>
visit
.
HospitalId
)
.
OnDelete
(
DeleteBehavior
.
NoAction
);
builder
.
HasOne
(
visit
=>
visit
.
Holiday
)
.
WithOne
()
.
HasForeignKey
<
Holiday
>(
holiday
=>
holiday
.
VisitId
)
.
OnDelete
(
DeleteBehavior
.
NoAction
);
}
}
\ No newline at end of file
Clinics.Backend/Persistence/Configurations/WaitingList/WaitingListRecordConfiguration.cs
View file @
069b3d66
...
...
@@ -10,18 +10,9 @@ internal class WaitingListRecordConfiguration : IEntityTypeConfiguration<Waiting
{
builder
.
ToTable
(
nameof
(
WaitingListRecord
));
builder
.
Property
(
waitingListRecord
=>
waitingListRecord
.
IsServed
)
.
HasDefaultValue
(
false
)
.
IsRequired
();
builder
.
HasOne
(
waitingListRecord
=>
waitingListRecord
.
Patient
)
.
WithMany
()
.
HasForeignKey
(
waitingListRecord
=>
waitingListRecord
.
PatientId
)
.
OnDelete
(
DeleteBehavior
.
NoAction
);
builder
.
HasOne
(
waitingListRecord
=>
waitingListRecord
.
Doctor
)
.
WithMany
()
.
HasForeignKey
(
waitingListRecord
=>
waitingListRecord
.
DoctorId
)
.
OnDelete
(
DeleteBehavior
.
NoAction
);
}
}
\ No newline at end of file
Clinics.Backend/Persistence/Migrations/20240823234349_Add_Holiday.Designer.cs
0 → 100644
View file @
069b3d66
// <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
Persistence.Context
;
#
nullable
disable
namespace
Persistence.Migrations
{
[
DbContext
(
typeof
(
ClinicsDbContext
))]
[
Migration
(
"20240823234349_Add_Holiday"
)]
partial
class
Add_Holiday
{
/// <inheritdoc />
protected
override
void
BuildTargetModel
(
ModelBuilder
modelBuilder
)
{
#pragma warning disable 612, 618
modelBuilder
.
HasAnnotation
(
"ProductVersion"
,
"8.0.8"
)
.
HasAnnotation
(
"Relational:MaxIdentifierLength"
,
128
);
SqlServerModelBuilderExtensions
.
UseIdentityColumns
(
modelBuilder
);
modelBuilder
.
Entity
(
"Domain.Entities.Identity.UserRoles.Role"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"Name"
)
.
IsRequired
()
.
HasMaxLength
(
50
)
.
HasColumnType
(
"nvarchar(50)"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"Name"
)
.
IsUnique
();
b
.
ToTable
(
"Role"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Identity.Users.DoctorUser"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"DoctorId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"DoctorId"
)
.
IsUnique
();
b
.
ToTable
(
"DoctorUser"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Identity.Users.ReceptionistUser"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"PersonalInfoId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"PersonalInfoId"
)
.
IsUnique
();
b
.
ToTable
(
"ReceptionistUser"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Identity.Users.User"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
SqlServerPropertyBuilderExtensions
.
UseIdentityColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
string
>(
"HashedPassword"
)
.
IsRequired
()
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
>(
"RoleId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"UserName"
)
.
IsRequired
()
.
HasColumnType
(
"nvarchar(450)"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"RoleId"
);
b
.
HasIndex
(
"UserName"
)
.
IsUnique
();
b
.
ToTable
(
"User"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Medicals.Diseases.Disease"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
SqlServerPropertyBuilderExtensions
.
UseIdentityColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
string
>(
"Name"
)
.
IsRequired
()
.
HasMaxLength
(
50
)
.
HasColumnType
(
"nvarchar(50)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Disease"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Medicals.Hospitals.Hospital"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
SqlServerPropertyBuilderExtensions
.
UseIdentityColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
string
>(
"Name"
)
.
IsRequired
()
.
HasMaxLength
(
50
)
.
HasColumnType
(
"nvarchar(50)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Hospital"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Medicals.MedicalImages.MedicalImage"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
SqlServerPropertyBuilderExtensions
.
UseIdentityColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
string
>(
"Description"
)
.
HasMaxLength
(
250
)
.
HasColumnType
(
"nvarchar(250)"
);
b
.
Property
<
string
>(
"Name"
)
.
IsRequired
()
.
HasMaxLength
(
50
)
.
HasColumnType
(
"nvarchar(50)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"MedicalImage"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Medicals.MedicalTests.MedicalTest"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
SqlServerPropertyBuilderExtensions
.
UseIdentityColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
string
>(
"Description"
)
.
HasMaxLength
(
250
)
.
HasColumnType
(
"nvarchar(250)"
);
b
.
Property
<
string
>(
"Name"
)
.
IsRequired
()
.
HasMaxLength
(
50
)
.
HasColumnType
(
"nvarchar(50)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"MedicalTest"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Medicals.Medicines.Medicine"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
SqlServerPropertyBuilderExtensions
.
UseIdentityColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
int
>(
"Amount"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
decimal
>(
"Dosage"
)
.
HasColumnType
(
"numeric(9, 3)"
);
b
.
Property
<
int
>(
"MedicineFormId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"Name"
)
.
IsRequired
()
.
HasColumnType
(
"nvarchar(max)"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"MedicineFormId"
);
b
.
ToTable
(
"Medicine"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Medicals.Medicines.MedicineFormValues.MedicineForm"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"Name"
)
.
IsRequired
()
.
HasMaxLength
(
50
)
.
HasColumnType
(
"nvarchar(50)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"MedicineForm"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Doctors.Doctor"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
SqlServerPropertyBuilderExtensions
.
UseIdentityColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
int
>(
"PersonalInfoId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"StatusId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"PersonalInfoId"
)
.
IsUnique
();
b
.
HasIndex
(
"StatusId"
);
b
.
ToTable
(
"Doctor"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Doctors.Shared.Constants.DoctorStatusValues.DoctorStatus"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"Name"
)
.
IsRequired
()
.
HasMaxLength
(
50
)
.
HasColumnType
(
"nvarchar(50)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"DoctorStatus"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Doctors.Shared.DoctorPhone"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
SqlServerPropertyBuilderExtensions
.
UseIdentityColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
int
?>(
"DoctorId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"Name"
)
.
HasMaxLength
(
50
)
.
HasColumnType
(
"nvarchar(50)"
);
b
.
Property
<
string
>(
"Phone"
)
.
IsRequired
()
.
HasMaxLength
(
20
)
.
HasColumnType
(
"nvarchar(20)"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"DoctorId"
);
b
.
HasIndex
(
"Phone"
)
.
IsUnique
();
b
.
ToTable
(
"DoctorPhone"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Employees.Employee"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
b
.
Property
<
int
?>(
"AdditionalInfoId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"CenterStatus"
)
.
IsRequired
()
.
HasMaxLength
(
50
)
.
HasColumnType
(
"nvarchar(50)"
);
b
.
Property
<
bool
>(
"IsMarried"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"bit"
)
.
HasDefaultValue
(
false
);
b
.
Property
<
string
>(
"SerialNumber"
)
.
IsRequired
()
.
HasMaxLength
(
20
)
.
HasColumnType
(
"nvarchar(20)"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"AdditionalInfoId"
)
.
IsUnique
()
.
HasFilter
(
"[AdditionalInfoId] IS NOT NULL"
);
b
.
ToTable
(
"Employee"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Employees.Relations.EmployeeFamilyMembers.EmployeeFamilyMember"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
SqlServerPropertyBuilderExtensions
.
UseIdentityColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
int
>(
"EmployeeId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"FamilyMemberId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"RoleId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"EmployeeId"
);
b
.
HasIndex
(
"FamilyMemberId"
);
b
.
HasIndex
(
"RoleId"
);
b
.
ToTable
(
"EmployeeFamilyMember"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Employees.Relations.EmployeeFamilyMembers.FamilyRoleValues.FamilyRole"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"Name"
)
.
IsRequired
()
.
HasMaxLength
(
50
)
.
HasColumnType
(
"nvarchar(50)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"FamilyRole"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Employees.Shared.EmployeeAdditionalInfo"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
SqlServerPropertyBuilderExtensions
.
UseIdentityColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
string
>(
"AcademicQualification"
)
.
HasMaxLength
(
50
)
.
HasColumnType
(
"nvarchar(50)"
);
b
.
Property
<
string
>(
"ImageUrl"
)
.
HasMaxLength
(
150
)
.
HasColumnType
(
"nvarchar(150)"
);
b
.
Property
<
string
>(
"JobStatus"
)
.
HasMaxLength
(
50
)
.
HasColumnType
(
"nvarchar(50)"
);
b
.
Property
<
string
>(
"Location"
)
.
HasMaxLength
(
50
)
.
HasColumnType
(
"nvarchar(50)"
);
b
.
Property
<
string
>(
"Specialization"
)
.
HasMaxLength
(
50
)
.
HasColumnType
(
"nvarchar(50)"
);
b
.
Property
<
DateOnly
?>(
"StartDate"
)
.
HasColumnType
(
"date"
);
b
.
Property
<
string
>(
"WorkPhone"
)
.
HasMaxLength
(
20
)
.
HasColumnType
(
"nvarchar(20)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"EmployeeAdditionalInfo"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.FamilyMembers.FamilyMember"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"FamilyMember"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Patients.Patient"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
SqlServerPropertyBuilderExtensions
.
UseIdentityColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
DateOnly
>(
"DateOfBirth"
)
.
HasColumnType
(
"date"
);
b
.
Property
<
int
>(
"GenderId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"PersonalInfoId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"GenderId"
);
b
.
HasIndex
(
"PersonalInfoId"
)
.
IsUnique
();
b
.
ToTable
(
"Patient"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Patients.Relations.PatientDiseases.PatientDisease"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
SqlServerPropertyBuilderExtensions
.
UseIdentityColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
int
>(
"DiseaseId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"PatientId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"DiseaseId"
);
b
.
HasIndex
(
"PatientId"
,
"DiseaseId"
)
.
IsUnique
();
b
.
ToTable
(
"PatientDisease"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Patients.Relations.PatientMedicines.PatientMedicine"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
SqlServerPropertyBuilderExtensions
.
UseIdentityColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
int
>(
"MedicineId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"Number"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"PatientId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"MedicineId"
);
b
.
HasIndex
(
"PatientId"
,
"MedicineId"
)
.
IsUnique
();
b
.
ToTable
(
"PatientMedicine"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Shared.GenderValues.Gender"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"Name"
)
.
IsRequired
()
.
HasMaxLength
(
50
)
.
HasColumnType
(
"nvarchar(50)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Gender"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Shared.PersonalInfo"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
SqlServerPropertyBuilderExtensions
.
UseIdentityColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
string
>(
"FirstName"
)
.
IsRequired
()
.
HasMaxLength
(
50
)
.
HasColumnType
(
"nvarchar(50)"
);
b
.
Property
<
string
>(
"LastName"
)
.
IsRequired
()
.
HasMaxLength
(
50
)
.
HasColumnType
(
"nvarchar(50)"
);
b
.
Property
<
string
>(
"MiddleName"
)
.
IsRequired
()
.
HasMaxLength
(
50
)
.
HasColumnType
(
"nvarchar(50)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"PersonalInfo"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Visits.Holiday"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
SqlServerPropertyBuilderExtensions
.
UseIdentityColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
int
>(
"Duration"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
DateOnly
>(
"From"
)
.
HasColumnType
(
"date"
);
b
.
Property
<
int
>(
"VisitId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"VisitId"
)
.
IsUnique
();
b
.
ToTable
(
"Holiday"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Visits.Relations.VisitMedicalImages.VisitMedicalImage"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
SqlServerPropertyBuilderExtensions
.
UseIdentityColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
int
>(
"MedicalImageId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"Result"
)
.
HasMaxLength
(
250
)
.
HasColumnType
(
"nvarchar(250)"
);
b
.
Property
<
int
>(
"VisitId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"MedicalImageId"
);
b
.
HasIndex
(
"VisitId"
,
"MedicalImageId"
)
.
IsUnique
();
b
.
ToTable
(
"VisitMedicalImage"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Visits.Relations.VisitMedicalTests.VisitMedicalTest"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
SqlServerPropertyBuilderExtensions
.
UseIdentityColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
int
>(
"MedicalTestId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"Result"
)
.
HasMaxLength
(
250
)
.
HasColumnType
(
"nvarchar(250)"
);
b
.
Property
<
int
>(
"VisitId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"MedicalTestId"
);
b
.
HasIndex
(
"VisitId"
,
"MedicalTestId"
)
.
IsUnique
();
b
.
ToTable
(
"VisitMedicalTest"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Visits.Relations.VisitMedicines.VisitMedicine"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
SqlServerPropertyBuilderExtensions
.
UseIdentityColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
int
>(
"MedicineId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"Number"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"VisitId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"MedicineId"
);
b
.
HasIndex
(
"VisitId"
,
"MedicineId"
)
.
IsUnique
();
b
.
ToTable
(
"VisitMedicine"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Visits.Visit"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
SqlServerPropertyBuilderExtensions
.
UseIdentityColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
DateOnly
>(
"Date"
)
.
HasColumnType
(
"date"
);
b
.
Property
<
string
>(
"Diagnosis"
)
.
IsRequired
()
.
HasMaxLength
(
250
)
.
HasColumnType
(
"nvarchar(250)"
);
b
.
Property
<
int
>(
"DoctorId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
?>(
"HospitalId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"PatientId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"DoctorId"
);
b
.
HasIndex
(
"HospitalId"
);
b
.
HasIndex
(
"PatientId"
);
b
.
ToTable
(
"Visit"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.WaitingList.WaitingListRecord"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
SqlServerPropertyBuilderExtensions
.
UseIdentityColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
int
>(
"PatientId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"PatientId"
);
b
.
ToTable
(
"WaitingListRecord"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"EmployeeEmployee"
,
b
=>
{
b
.
Property
<
int
>(
"RelatedEmployeesId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"RelatedToId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"RelatedEmployeesId"
,
"RelatedToId"
);
b
.
HasIndex
(
"RelatedToId"
);
b
.
ToTable
(
"EmployeeEmployee"
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Identity.Users.DoctorUser"
,
b
=>
{
b
.
HasOne
(
"Domain.Entities.People.Doctors.Doctor"
,
"Doctor"
)
.
WithOne
()
.
HasForeignKey
(
"Domain.Entities.Identity.Users.DoctorUser"
,
"DoctorId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
HasOne
(
"Domain.Entities.Identity.Users.User"
,
"User"
)
.
WithOne
()
.
HasForeignKey
(
"Domain.Entities.Identity.Users.DoctorUser"
,
"Id"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
Navigation
(
"Doctor"
);
b
.
Navigation
(
"User"
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Identity.Users.ReceptionistUser"
,
b
=>
{
b
.
HasOne
(
"Domain.Entities.Identity.Users.User"
,
"User"
)
.
WithOne
()
.
HasForeignKey
(
"Domain.Entities.Identity.Users.ReceptionistUser"
,
"Id"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
HasOne
(
"Domain.Entities.People.Shared.PersonalInfo"
,
"PersonalInfo"
)
.
WithOne
()
.
HasForeignKey
(
"Domain.Entities.Identity.Users.ReceptionistUser"
,
"PersonalInfoId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
Navigation
(
"PersonalInfo"
);
b
.
Navigation
(
"User"
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Identity.Users.User"
,
b
=>
{
b
.
HasOne
(
"Domain.Entities.Identity.UserRoles.Role"
,
"Role"
)
.
WithMany
()
.
HasForeignKey
(
"RoleId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
Navigation
(
"Role"
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Medicals.Medicines.Medicine"
,
b
=>
{
b
.
HasOne
(
"Domain.Entities.Medicals.Medicines.MedicineFormValues.MedicineForm"
,
"MedicineForm"
)
.
WithMany
()
.
HasForeignKey
(
"MedicineFormId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
Navigation
(
"MedicineForm"
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Doctors.Doctor"
,
b
=>
{
b
.
HasOne
(
"Domain.Entities.People.Shared.PersonalInfo"
,
"PersonalInfo"
)
.
WithOne
()
.
HasForeignKey
(
"Domain.Entities.People.Doctors.Doctor"
,
"PersonalInfoId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
HasOne
(
"Domain.Entities.People.Doctors.Shared.Constants.DoctorStatusValues.DoctorStatus"
,
"Status"
)
.
WithMany
()
.
HasForeignKey
(
"StatusId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
Navigation
(
"PersonalInfo"
);
b
.
Navigation
(
"Status"
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Doctors.Shared.DoctorPhone"
,
b
=>
{
b
.
HasOne
(
"Domain.Entities.People.Doctors.Doctor"
,
null
)
.
WithMany
(
"Phones"
)
.
HasForeignKey
(
"DoctorId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Employees.Employee"
,
b
=>
{
b
.
HasOne
(
"Domain.Entities.People.Employees.Shared.EmployeeAdditionalInfo"
,
"AdditionalInfo"
)
.
WithOne
()
.
HasForeignKey
(
"Domain.Entities.People.Employees.Employee"
,
"AdditionalInfoId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
);
b
.
HasOne
(
"Domain.Entities.People.Patients.Patient"
,
"Patient"
)
.
WithOne
()
.
HasForeignKey
(
"Domain.Entities.People.Employees.Employee"
,
"Id"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
Navigation
(
"AdditionalInfo"
);
b
.
Navigation
(
"Patient"
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Employees.Relations.EmployeeFamilyMembers.EmployeeFamilyMember"
,
b
=>
{
b
.
HasOne
(
"Domain.Entities.People.Employees.Employee"
,
"Employee"
)
.
WithMany
(
"FamilyMembers"
)
.
HasForeignKey
(
"EmployeeId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
HasOne
(
"Domain.Entities.People.FamilyMembers.FamilyMember"
,
"FamilyMember"
)
.
WithMany
()
.
HasForeignKey
(
"FamilyMemberId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
HasOne
(
"Domain.Entities.People.Employees.Relations.EmployeeFamilyMembers.FamilyRoleValues.FamilyRole"
,
"Role"
)
.
WithMany
()
.
HasForeignKey
(
"RoleId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
Navigation
(
"Employee"
);
b
.
Navigation
(
"FamilyMember"
);
b
.
Navigation
(
"Role"
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.FamilyMembers.FamilyMember"
,
b
=>
{
b
.
HasOne
(
"Domain.Entities.People.Patients.Patient"
,
"Patient"
)
.
WithOne
()
.
HasForeignKey
(
"Domain.Entities.People.FamilyMembers.FamilyMember"
,
"Id"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
Navigation
(
"Patient"
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Patients.Patient"
,
b
=>
{
b
.
HasOne
(
"Domain.Entities.People.Shared.GenderValues.Gender"
,
"Gender"
)
.
WithMany
()
.
HasForeignKey
(
"GenderId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
HasOne
(
"Domain.Entities.People.Shared.PersonalInfo"
,
"PersonalInfo"
)
.
WithOne
()
.
HasForeignKey
(
"Domain.Entities.People.Patients.Patient"
,
"PersonalInfoId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
Navigation
(
"Gender"
);
b
.
Navigation
(
"PersonalInfo"
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Patients.Relations.PatientDiseases.PatientDisease"
,
b
=>
{
b
.
HasOne
(
"Domain.Entities.Medicals.Diseases.Disease"
,
"Disease"
)
.
WithMany
(
"Patients"
)
.
HasForeignKey
(
"DiseaseId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
HasOne
(
"Domain.Entities.People.Patients.Patient"
,
"Patient"
)
.
WithMany
(
"Diseases"
)
.
HasForeignKey
(
"PatientId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
Navigation
(
"Disease"
);
b
.
Navigation
(
"Patient"
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Patients.Relations.PatientMedicines.PatientMedicine"
,
b
=>
{
b
.
HasOne
(
"Domain.Entities.Medicals.Medicines.Medicine"
,
"Medicine"
)
.
WithMany
(
"Patients"
)
.
HasForeignKey
(
"MedicineId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
HasOne
(
"Domain.Entities.People.Patients.Patient"
,
"Patient"
)
.
WithMany
(
"Medicines"
)
.
HasForeignKey
(
"PatientId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
Navigation
(
"Medicine"
);
b
.
Navigation
(
"Patient"
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Visits.Holiday"
,
b
=>
{
b
.
HasOne
(
"Domain.Entities.Visits.Visit"
,
null
)
.
WithOne
(
"Holiday"
)
.
HasForeignKey
(
"Domain.Entities.Visits.Holiday"
,
"VisitId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
});
modelBuilder
.
Entity
(
"Domain.Entities.Visits.Relations.VisitMedicalImages.VisitMedicalImage"
,
b
=>
{
b
.
HasOne
(
"Domain.Entities.Medicals.MedicalImages.MedicalImage"
,
"MedicalImage"
)
.
WithMany
()
.
HasForeignKey
(
"MedicalImageId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
HasOne
(
"Domain.Entities.Visits.Visit"
,
"Visit"
)
.
WithMany
(
"MedicalImages"
)
.
HasForeignKey
(
"VisitId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
Navigation
(
"MedicalImage"
);
b
.
Navigation
(
"Visit"
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Visits.Relations.VisitMedicalTests.VisitMedicalTest"
,
b
=>
{
b
.
HasOne
(
"Domain.Entities.Medicals.MedicalTests.MedicalTest"
,
"MedicalTest"
)
.
WithMany
()
.
HasForeignKey
(
"MedicalTestId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
HasOne
(
"Domain.Entities.Visits.Visit"
,
"Visit"
)
.
WithMany
(
"MedicalTests"
)
.
HasForeignKey
(
"VisitId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
Navigation
(
"MedicalTest"
);
b
.
Navigation
(
"Visit"
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Visits.Relations.VisitMedicines.VisitMedicine"
,
b
=>
{
b
.
HasOne
(
"Domain.Entities.Medicals.Medicines.Medicine"
,
"Medicine"
)
.
WithMany
()
.
HasForeignKey
(
"MedicineId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
HasOne
(
"Domain.Entities.Visits.Visit"
,
"Visit"
)
.
WithMany
(
"Medicines"
)
.
HasForeignKey
(
"VisitId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
Navigation
(
"Medicine"
);
b
.
Navigation
(
"Visit"
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Visits.Visit"
,
b
=>
{
b
.
HasOne
(
"Domain.Entities.People.Doctors.Doctor"
,
"Doctor"
)
.
WithMany
()
.
HasForeignKey
(
"DoctorId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
HasOne
(
"Domain.Entities.Medicals.Hospitals.Hospital"
,
"Hospital"
)
.
WithMany
()
.
HasForeignKey
(
"HospitalId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
);
b
.
HasOne
(
"Domain.Entities.People.Patients.Patient"
,
"Patient"
)
.
WithMany
(
"Visits"
)
.
HasForeignKey
(
"PatientId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
Navigation
(
"Doctor"
);
b
.
Navigation
(
"Hospital"
);
b
.
Navigation
(
"Patient"
);
});
modelBuilder
.
Entity
(
"Domain.Entities.WaitingList.WaitingListRecord"
,
b
=>
{
b
.
HasOne
(
"Domain.Entities.People.Patients.Patient"
,
"Patient"
)
.
WithMany
()
.
HasForeignKey
(
"PatientId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
Navigation
(
"Patient"
);
});
modelBuilder
.
Entity
(
"EmployeeEmployee"
,
b
=>
{
b
.
HasOne
(
"Domain.Entities.People.Employees.Employee"
,
null
)
.
WithMany
()
.
HasForeignKey
(
"RelatedEmployeesId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
HasOne
(
"Domain.Entities.People.Employees.Employee"
,
null
)
.
WithMany
()
.
HasForeignKey
(
"RelatedToId"
)
.
OnDelete
(
DeleteBehavior
.
ClientCascade
)
.
IsRequired
();
});
modelBuilder
.
Entity
(
"Domain.Entities.Medicals.Diseases.Disease"
,
b
=>
{
b
.
Navigation
(
"Patients"
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Medicals.Medicines.Medicine"
,
b
=>
{
b
.
Navigation
(
"Patients"
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Doctors.Doctor"
,
b
=>
{
b
.
Navigation
(
"Phones"
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Employees.Employee"
,
b
=>
{
b
.
Navigation
(
"FamilyMembers"
);
});
modelBuilder
.
Entity
(
"Domain.Entities.People.Patients.Patient"
,
b
=>
{
b
.
Navigation
(
"Diseases"
);
b
.
Navigation
(
"Medicines"
);
b
.
Navigation
(
"Visits"
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Visits.Visit"
,
b
=>
{
b
.
Navigation
(
"Holiday"
);
b
.
Navigation
(
"MedicalImages"
);
b
.
Navigation
(
"MedicalTests"
);
b
.
Navigation
(
"Medicines"
);
});
#pragma warning restore 612, 618
}
}
}
Clinics.Backend/Persistence/Migrations/20240823234349_Add_Holiday.cs
0 → 100644
View file @
069b3d66
using
System
;
using
Microsoft.EntityFrameworkCore.Migrations
;
#
nullable
disable
namespace
Persistence.Migrations
{
/// <inheritdoc />
public
partial
class
Add_Holiday
:
Migration
{
/// <inheritdoc />
protected
override
void
Up
(
MigrationBuilder
migrationBuilder
)
{
migrationBuilder
.
DropForeignKey
(
name
:
"FK_WaitingListRecord_Doctor_DoctorId"
,
table
:
"WaitingListRecord"
);
migrationBuilder
.
DropIndex
(
name
:
"IX_WaitingListRecord_DoctorId"
,
table
:
"WaitingListRecord"
);
migrationBuilder
.
DropColumn
(
name
:
"DoctorId"
,
table
:
"WaitingListRecord"
);
migrationBuilder
.
DropColumn
(
name
:
"IsServed"
,
table
:
"WaitingListRecord"
);
migrationBuilder
.
CreateTable
(
name
:
"Holiday"
,
columns
:
table
=>
new
{
Id
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
)
.
Annotation
(
"SqlServer:Identity"
,
"1, 1"
),
VisitId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
),
From
=
table
.
Column
<
DateOnly
>(
type
:
"date"
,
nullable
:
false
),
Duration
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
)
},
constraints
:
table
=>
{
table
.
PrimaryKey
(
"PK_Holiday"
,
x
=>
x
.
Id
);
table
.
ForeignKey
(
name
:
"FK_Holiday_Visit_VisitId"
,
column
:
x
=>
x
.
VisitId
,
principalTable
:
"Visit"
,
principalColumn
:
"Id"
);
});
migrationBuilder
.
CreateIndex
(
name
:
"IX_Holiday_VisitId"
,
table
:
"Holiday"
,
column
:
"VisitId"
,
unique
:
true
);
}
/// <inheritdoc />
protected
override
void
Down
(
MigrationBuilder
migrationBuilder
)
{
migrationBuilder
.
DropTable
(
name
:
"Holiday"
);
migrationBuilder
.
AddColumn
<
int
>(
name
:
"DoctorId"
,
table
:
"WaitingListRecord"
,
type
:
"int"
,
nullable
:
true
);
migrationBuilder
.
AddColumn
<
bool
>(
name
:
"IsServed"
,
table
:
"WaitingListRecord"
,
type
:
"bit"
,
nullable
:
false
,
defaultValue
:
false
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_WaitingListRecord_DoctorId"
,
table
:
"WaitingListRecord"
,
column
:
"DoctorId"
);
migrationBuilder
.
AddForeignKey
(
name
:
"FK_WaitingListRecord_Doctor_DoctorId"
,
table
:
"WaitingListRecord"
,
column
:
"DoctorId"
,
principalTable
:
"Doctor"
,
principalColumn
:
"Id"
);
}
}
}
Clinics.Backend/Persistence/Migrations/ClinicsDbContextModelSnapshot.cs
View file @
069b3d66
...
...
@@ -543,6 +543,31 @@ namespace Persistence.Migrations
b
.
ToTable
(
"PersonalInfo"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Visits.Holiday"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
SqlServerPropertyBuilderExtensions
.
UseIdentityColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
int
>(
"Duration"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
DateOnly
>(
"From"
)
.
HasColumnType
(
"date"
);
b
.
Property
<
int
>(
"VisitId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"VisitId"
)
.
IsUnique
();
b
.
ToTable
(
"Holiday"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Visits.Relations.VisitMedicalImages.VisitMedicalImage"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
...
...
@@ -670,21 +695,11 @@ namespace Persistence.Migrations
SqlServerPropertyBuilderExtensions
.
UseIdentityColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
int
?>(
"DoctorId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
bool
>(
"IsServed"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"bit"
)
.
HasDefaultValue
(
false
);
b
.
Property
<
int
>(
"PatientId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"DoctorId"
);
b
.
HasIndex
(
"PatientId"
);
b
.
ToTable
(
"WaitingListRecord"
,
(
string
)
null
);
...
...
@@ -905,6 +920,15 @@ namespace Persistence.Migrations
b
.
Navigation
(
"Patient"
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Visits.Holiday"
,
b
=>
{
b
.
HasOne
(
"Domain.Entities.Visits.Visit"
,
null
)
.
WithOne
(
"Holiday"
)
.
HasForeignKey
(
"Domain.Entities.Visits.Holiday"
,
"VisitId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
});
modelBuilder
.
Entity
(
"Domain.Entities.Visits.Relations.VisitMedicalImages.VisitMedicalImage"
,
b
=>
{
b
.
HasOne
(
"Domain.Entities.Medicals.MedicalImages.MedicalImage"
,
"MedicalImage"
)
...
...
@@ -990,19 +1014,12 @@ namespace Persistence.Migrations
modelBuilder
.
Entity
(
"Domain.Entities.WaitingList.WaitingListRecord"
,
b
=>
{
b
.
HasOne
(
"Domain.Entities.People.Doctors.Doctor"
,
"Doctor"
)
.
WithMany
()
.
HasForeignKey
(
"DoctorId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
);
b
.
HasOne
(
"Domain.Entities.People.Patients.Patient"
,
"Patient"
)
.
WithMany
()
.
HasForeignKey
(
"PatientId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
Navigation
(
"Doctor"
);
b
.
Navigation
(
"Patient"
);
});
...
...
@@ -1052,6 +1069,8 @@ namespace Persistence.Migrations
modelBuilder
.
Entity
(
"Domain.Entities.Visits.Visit"
,
b
=>
{
b
.
Navigation
(
"Holiday"
);
b
.
Navigation
(
"MedicalImages"
);
b
.
Navigation
(
"MedicalTests"
);
...
...
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