Downgrade target frameworks and update dependencies

- Downgraded target frameworks from net9.0 to net8.0 in multiple projects.
- Updated package references to older versions across various projects.
- Added and updated using directives in several files for better dependency management.
- Modified `Student` entity to make `SectionId` nullable and updated related methods.
- Introduced new migration files to reflect schema changes in the database.
- Added new `ValidationException` and `ValidationBehavior` classes for improved validation handling.
- Updated `launchUrl` in `launchSettings.json` to include `/swagger/v1`.
- Reformatted constructor parameters in `Patient.cs` for better readability.
- Removed `Sections` property from `University.cs`.
- Changed `PatientId` and `Patient` properties in `MedicalHistory.cs` to internal.
master
Amir Hossein Khademi 2025-01-12 12:16:24 +03:30
parent 1a813edf6a
commit ab56bf3c20
30 changed files with 5405 additions and 276 deletions

View File

@ -13,7 +13,7 @@
}, },
"SiteSettings": { "SiteSettings": {
"KaveNegarApiKey": "3735494B4143727A794346457461576A2B4B6668414973424E333561505A694B", "KaveNegarApiKey": "3735494B4143727A794346457461576A2B4B6668414973424E333561505A694B",
"BaseUrl": "http://localhost:32769", "BaseUrl": "http://localhost:32780",
"UserSetting": { "UserSetting": {
"Username": "Root", "Username": "Root",
"Email": "info@brizco.io", "Email": "info@brizco.io",

View File

@ -1,4 +1,8 @@
namespace DocuMed.Api.Controllers; using DocuMed.Domain.CommandQueries.Queries;
using DocuMed.Domain.Models;
using MediatR;
namespace DocuMed.Api.Controllers;
public class PatientController : ICarterModule public class PatientController : ICarterModule
{ {

View File

@ -1,112 +1,111 @@
<Project Sdk="Microsoft.NET.Sdk.Web"> <Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net9.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS> <DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerComposeProjectPath>..\docker-compose.dcproj</DockerComposeProjectPath> <DockerComposeProjectPath>..\docker-compose.dcproj</DockerComposeProjectPath>
<AssemblyVersion>1.3.2.1</AssemblyVersion> <AssemblyVersion>1.3.2.1</AssemblyVersion>
<FileVersion>1.3.2.1</FileVersion> <FileVersion>1.3.2.1</FileVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Asp.Versioning.Http" Version="8.1.0" /> <PackageReference Include="Asp.Versioning.Http" Version="8.1.0" />
<PackageReference Include="Ben.BlockingDetector" Version="0.0.4" /> <PackageReference Include="Ben.BlockingDetector" Version="0.0.4" />
<PackageReference Include="Carter" Version="9.0.0" /> <PackageReference Include="Carter" Version="8.2.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="9.0.0" /> <PackageReference Include="MediatR.Extensions.Autofac.DependencyInjection" Version="12.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="9.0.0" /> <PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.0"> <PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="8.0.8" />
<PrivateAssets>all</PrivateAssets> <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.8">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <PrivateAssets>all</PrivateAssets>
</PackageReference> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.0"> </PackageReference>
<PrivateAssets>all</PrivateAssets> <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.8">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <PrivateAssets>all</PrivateAssets>
</PackageReference> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PackageReference Include="Autofac" Version="8.2.0" /> </PackageReference>
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="10.0.0" /> <PackageReference Include="Autofac" Version="8.2.0" />
<PackageReference Include="Elmah.Io.AspNetCore.Serilog" Version="5.1.23" /> <PackageReference Include="Autofac.Extensions.DependencyInjection" Version="10.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="9.0.0" /> <PackageReference Include="Elmah.Io.AspNetCore.Serilog" Version="5.1.23" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.0" /> <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.8" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.21.0" /> <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.2" /> <PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.21.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="9.0.0" /> <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.8" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="9.0.0" /> <PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0" />
<PackageReference Include="Sentry.Serilog" Version="5.0.0" /> <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="8.0.5" />
<PackageReference Include="Serilog" Version="4.2.0" /> <PackageReference Include="Sentry.Serilog" Version="4.11.0" />
<PackageReference Include="Serilog.AspNetCore" Version="9.0.0" /> <PackageReference Include="Serilog" Version="4.0.1" />
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" /> <PackageReference Include="Serilog.AspNetCore" Version="8.0.2" />
<PackageReference Include="Serilog.Sinks.PostgreSQL" Version="2.3.0" /> <PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
<PackageReference Include="Serilog.Sinks.Seq" Version="9.0.0" /> <PackageReference Include="Serilog.Sinks.PostgreSQL" Version="2.3.0" />
<PackageReference Include="Serilog.Sinks.ElmahIo" Version="5.2.50" /> <PackageReference Include="Serilog.Sinks.Seq" Version="8.0.0" />
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" /> <PackageReference Include="Serilog.Sinks.ElmahIo" Version="5.1.43" />
<PackageReference Include="StackExchange.Redis.Extensions.AspNetCore" Version="10.2.0" /> <PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
<PackageReference Include="StackExchange.Redis.Extensions.Core" Version="10.2.0" /> <PackageReference Include="StackExchange.Redis.Extensions.AspNetCore" Version="10.2.0" />
<PackageReference Include="StackExchange.Redis.Extensions.Newtonsoft" Version="10.2.0" /> <PackageReference Include="StackExchange.Redis.Extensions.Core" Version="10.2.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="7.2.0" /> <PackageReference Include="StackExchange.Redis.Extensions.Newtonsoft" Version="10.2.0" />
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="7.2.0" /> <PackageReference Include="Swashbuckle.AspNetCore" Version="6.8.0" />
<PackageReference Include="Swashbuckle.AspNetCore.Filters" Version="8.0.2" /> <PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="6.8.0" />
<PackageReference Include="System.Data.SqlClient" Version="4.9.0" /> <PackageReference Include="Swashbuckle.AspNetCore.Filters" Version="8.0.2" />
<PackageReference Include="System.Drawing.Common" Version="9.0.0" /> <PackageReference Include="System.Data.SqlClient" Version="4.8.6" />
</ItemGroup> <PackageReference Include="System.Drawing.Common" Version="8.0.8" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\DocuMed.Infrastructure\DocuMed.Infrastructure.csproj" /> <ProjectReference Include="..\DocuMed.Infrastructure\DocuMed.Infrastructure.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Using Include="Autofac" /> <Using Include="Autofac" />
<Using Include="Autofac.Extensions.DependencyInjection" /> <Using Include="Autofac.Extensions.DependencyInjection" />
<Using Include="Carter" /> <Using Include="Carter" />
<Using Include="DocuMed.Api.WebFramework.Bases" /> <Using Include="DocuMed.Api.WebFramework.Bases" />
<Using Include="DocuMed.Api.WebFramework.Configurations" /> <Using Include="DocuMed.Api.WebFramework.Configurations" />
<Using Include="DocuMed.Api.WebFramework.Swagger" /> <Using Include="DocuMed.Api.WebFramework.Swagger" />
<Using Include="DocuMed.Common.Extensions" /> <Using Include="DocuMed.Common.Extensions" />
<Using Include="DocuMed.Common.Models" /> <Using Include="DocuMed.Common.Models" />
<Using Include="DocuMed.Common.Models.Api" /> <Using Include="DocuMed.Common.Models.Api" />
<Using Include="DocuMed.Common.Models.Entity" /> <Using Include="DocuMed.Common.Models.Entity" />
<Using Include="DocuMed.Common.Models.Exception" /> <Using Include="DocuMed.Common.Models.Exception" />
<Using Include="DocuMed.Common.Models.Mapper" /> <Using Include="DocuMed.Common.Models.Mapper" />
<Using Include="DocuMed.Core" /> <Using Include="DocuMed.Core" />
<Using Include="DocuMed.Core.CoreServices.Abstracts" /> <Using Include="DocuMed.Core.CoreServices.Abstracts" />
<Using Include="DocuMed.Core.EntityServices.Abstracts" /> <Using Include="DocuMed.Core.EntityServices.Abstracts" />
<Using Include="DocuMed.Core.Models.Api" /> <Using Include="DocuMed.Core.Models.Api" />
<Using Include="DocuMed.Domain" /> <Using Include="DocuMed.Domain" />
<Using Include="DocuMed.Domain.CommandQueries.Queries" /> <Using Include="DocuMed.Domain.Dtos.LargDtos" />
<Using Include="DocuMed.Domain.Dtos.LargDtos" /> <Using Include="DocuMed.Domain.Dtos.RequestDtos" />
<Using Include="DocuMed.Domain.Dtos.RequestDtos" /> <Using Include="DocuMed.Domain.Dtos.SmallDtos" />
<Using Include="DocuMed.Domain.Dtos.SmallDtos" /> <Using Include="DocuMed.Domain.Entities.City" />
<Using Include="DocuMed.Domain.Entities.City" /> <Using Include="DocuMed.Domain.Entities.MedicalHistoryTemplate" />
<Using Include="DocuMed.Domain.Entities.MedicalHistoryTemplate" /> <Using Include="DocuMed.Domain.Entities.User" />
<Using Include="DocuMed.Domain.Entities.User" /> <Using Include="DocuMed.Domain.Enums.QueryFilters" />
<Using Include="DocuMed.Domain.Enums.QueryFilters" /> <Using Include="DocuMed.Domain.Mappers" />
<Using Include="DocuMed.Domain.Mappers" /> <Using Include="DocuMed.Domain.Models.Settings" />
<Using Include="DocuMed.Domain.Models" /> <Using Include="DocuMed.Infrastructure" />
<Using Include="DocuMed.Domain.Models.Settings" /> <Using Include="DocuMed.Infrastructure.Models" />
<Using Include="DocuMed.Infrastructure" /> <Using Include="DocuMed.Repository" />
<Using Include="DocuMed.Infrastructure.Models" /> <Using Include="DocuMed.Repository.Abstracts" />
<Using Include="DocuMed.Repository" /> <Using Include="DocuMed.Repository.Extensions" />
<Using Include="DocuMed.Repository.Abstracts" /> <Using Include="DocuMed.Repository.Models" />
<Using Include="DocuMed.Repository.Extensions" /> <Using Include="DocuMed.Repository.Repositories.Base.Contracts" />
<Using Include="DocuMed.Repository.Models" /> <Using Include="DocuMed.Repository.Repositories.Entities.Abstracts" />
<Using Include="DocuMed.Repository.Repositories.Base.Contracts" /> <Using Include="MediatR.Extensions.Autofac.DependencyInjection" />
<Using Include="DocuMed.Repository.Repositories.Entities.Abstracts" /> <Using Include="Microsoft.AspNetCore.Authentication.JwtBearer" />
<Using Include="MediatR" /> <Using Include="Microsoft.AspNetCore.Identity" />
<Using Include="Microsoft.AspNetCore.Authentication.JwtBearer" /> <Using Include="Microsoft.AspNetCore.Mvc" />
<Using Include="Microsoft.AspNetCore.Identity" /> <Using Include="Microsoft.AspNetCore.Mvc.Filters" />
<Using Include="Microsoft.AspNetCore.Mvc" /> <Using Include="Microsoft.EntityFrameworkCore" />
<Using Include="Microsoft.AspNetCore.Mvc.Filters" /> <Using Include="Microsoft.Extensions.Options" />
<Using Include="Microsoft.EntityFrameworkCore" /> <Using Include="Serilog" />
<Using Include="Microsoft.Extensions.Options" /> <Using Include="Serilog.Events" />
<Using Include="Serilog" /> <Using Include="Serilog.Sinks.SystemConsole.Themes" />
<Using Include="Serilog.Events" /> <Using Include="System.Security.Claims" />
<Using Include="Serilog.Sinks.SystemConsole.Themes" /> </ItemGroup>
<Using Include="System.Security.Claims" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<Folder Include="wwwroot\" /> <Folder Include="wwwroot\" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -1,4 +1,6 @@
using DocuMed.Api.WebFramework.MiddleWares; using DocuMed.Api.WebFramework.MiddleWares;
using DocuMed.Repository.Behaviors;
using MediatR.Extensions.Autofac.DependencyInjection.Builder;
var builder = WebApplication.CreateBuilder(args); var builder = WebApplication.CreateBuilder(args);
builder.Host.UseServiceProviderFactory(new AutofacServiceProviderFactory()); builder.Host.UseServiceProviderFactory(new AutofacServiceProviderFactory());
@ -65,6 +67,24 @@ builder.Host.ConfigureContainer<ContainerBuilder>(builder =>
.AssignableTo<IScopedDependency>() .AssignableTo<IScopedDependency>()
.AsImplementedInterfaces() .AsImplementedInterfaces()
.InstancePerLifetimeScope(); .InstancePerLifetimeScope();
builder.RegisterMediatR(MediatRConfigurationBuilder
.Create(typeof(RepositoryConfig).Assembly)
.WithCustomPipelineBehavior(typeof(ValidationBehavior<,>))
.WithAllOpenGenericHandlerTypesRegistered()
.Build());
builder.RegisterMediatR(MediatRConfigurationBuilder
.Create(typeof(CoreConfig).Assembly)
.WithCustomPipelineBehavior(typeof(ValidationBehavior<,>))
.WithAllOpenGenericHandlerTypesRegistered()
.Build());
builder.RegisterMediatR(MediatRConfigurationBuilder
.Create(typeof(DomainConfig).Assembly)
.WithCustomPipelineBehavior(typeof(ValidationBehavior<,>))
.WithAllOpenGenericHandlerTypesRegistered()
.Build());
}); });
var app = builder.Build(); var app = builder.Build();

View File

@ -20,7 +20,7 @@
"Docker": { "Docker": {
"commandName": "Docker", "commandName": "Docker",
"launchBrowser": true, "launchBrowser": true,
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}", "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger/v1",
"environmentVariables": { "environmentVariables": {
"ASPNETCORE_URLS": "http://+:80" "ASPNETCORE_URLS": "http://+:80"
}, },

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<!--<PropertyGroup> <!--<PropertyGroup>
<TargetFramework>net5.0</TargetFramework> <TargetFramework>net5.0</TargetFramework>
<LangVersion>latest</LangVersion> <LangVersion>10</LangVersion>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup> </PropertyGroup>
@ -13,8 +13,8 @@
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="7.0.3" /> <PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="7.0.3" />
</ItemGroup>--> </ItemGroup>-->
<PropertyGroup> <PropertyGroup>
<TargetFramework>net9.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<LangVersion>10</LangVersion> <LangVersion>10</LangVersion>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup> </PropertyGroup>
@ -24,7 +24,7 @@
<PackageReference Include="MD.PersianDateTime.Standard" Version="2.5.0" /> <PackageReference Include="MD.PersianDateTime.Standard" Version="2.5.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" /> <PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.3.0" /> <PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.1.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@ -33,4 +33,4 @@
<Using Include="System.ComponentModel.DataAnnotations.Schema" /> <Using Include="System.ComponentModel.DataAnnotations.Schema" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -0,0 +1,20 @@
namespace DocuMed.Common.Models.Exception;
public class ValidationException : System.Exception
{
public ValidationException() : base("Validation has been failed")
{
}
public ValidationException(params ValidationError[] validationErrors) : base($"{string.Join(",", validationErrors.Select(v => v.ErrorMessage))}")
{
}
public ValidationException(List<ValidationError> validationErrors) : base($"{string.Join(",", validationErrors.Select(v => v.ErrorMessage))}")
{
}
}
public sealed record ValidationError(string PropertyName, string ErrorMessage);

View File

@ -114,7 +114,9 @@ public class AccountService(
.FirstOrDefaultAsync(f => f.UserId == user.Id, cancellationToken); .FirstOrDefaultAsync(f => f.UserId == user.Id, cancellationToken);
if (student == null) if (student == null)
{ {
student = Student.Create(requestDto.UniversityId,requestDto.SectionId,user.Id); student = Student.Create(requestDto.UniversityId, user.Id);
if (requestDto.SectionId != default)
student.SetSection(requestDto.SectionId);
repositoryWrapper.SetRepository<Student>().Add(student); repositoryWrapper.SetRepository<Student>().Add(student);
await repositoryWrapper.SaveChangesAsync(cancellationToken); await repositoryWrapper.SaveChangesAsync(cancellationToken);
} }
@ -126,7 +128,7 @@ public class AccountService(
return await CompleteLogin(user, cancellationToken); return await CompleteLogin(user, cancellationToken);
} }
private async Task<AccessToken<ApplicationUserSDto>> CompleteLogin(ApplicationUser user, CancellationToken cancellationToken) private async Task<AccessToken<ApplicationUserSDto>> CompleteLogin(ApplicationUser user, CancellationToken cancellationToken)
{ {
var token = await jwtService.Generate<ApplicationUserSDto, ApplicationUser>(user); var token = await jwtService.Generate<ApplicationUserSDto, ApplicationUser>(user);
var student = await repositoryWrapper.SetRepository<Student>().TableNoTracking var student = await repositoryWrapper.SetRepository<Student>().TableNoTracking

View File

@ -1,10 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net9.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
@ -12,47 +12,47 @@
<PackageReference Include="AspNetCoreRateLimit.Redis" Version="2.0.0" /> <PackageReference Include="AspNetCoreRateLimit.Redis" Version="2.0.0" />
<PackageReference Include="Autofac.Extras.Quartz" Version="10.0.0" /> <PackageReference Include="Autofac.Extras.Quartz" Version="10.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.2.5" /> <PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.2.5" />
<PackageReference Include="Quartz" Version="3.13.1" /> <PackageReference Include="Quartz" Version="3.13.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\DocuMed.Repository\DocuMed.Repository.csproj" /> <ProjectReference Include="..\DocuMed.Repository\DocuMed.Repository.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Folder Include="BaseServices\Abstracts\" /> <Folder Include="BaseServices\Abstracts\" />
<Folder Include="CoreServices\Abstracts\" /> <Folder Include="CoreServices\Abstracts\" />
<Folder Include="Models\Api\" /> <Folder Include="Models\Api\" />
<Folder Include="Abstracts\" /> <Folder Include="Abstracts\" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Using Include="DocuMed.Common.Extensions" /> <Using Include="DocuMed.Common.Extensions" />
<Using Include="DocuMed.Common.Models" /> <Using Include="DocuMed.Common.Models" />
<Using Include="DocuMed.Common.Models.Api" /> <Using Include="DocuMed.Common.Models.Api" />
<Using Include="DocuMed.Common.Models.Claims" /> <Using Include="DocuMed.Common.Models.Claims" />
<Using Include="DocuMed.Common.Models.Exception" /> <Using Include="DocuMed.Common.Models.Exception" />
<Using Include="DocuMed.Core.Abstracts" /> <Using Include="DocuMed.Core.Abstracts" />
<Using Include="DocuMed.Core.BaseServices.Abstracts" /> <Using Include="DocuMed.Core.BaseServices.Abstracts" />
<Using Include="DocuMed.Core.CoreServices.Abstracts" /> <Using Include="DocuMed.Core.CoreServices.Abstracts" />
<Using Include="DocuMed.Core.EntityServices.Abstracts" /> <Using Include="DocuMed.Core.EntityServices.Abstracts" />
<Using Include="DocuMed.Domain.Dtos.LargDtos" /> <Using Include="DocuMed.Domain.Dtos.LargDtos" />
<Using Include="DocuMed.Domain.Dtos.RequestDtos" /> <Using Include="DocuMed.Domain.Dtos.RequestDtos" />
<Using Include="DocuMed.Domain.Dtos.SmallDtos" /> <Using Include="DocuMed.Domain.Dtos.SmallDtos" />
<Using Include="DocuMed.Domain.Entities.MedicalHistory" /> <Using Include="DocuMed.Domain.Entities.MedicalHistory" />
<Using Include="DocuMed.Domain.Entities.User" /> <Using Include="DocuMed.Domain.Entities.User" />
<Using Include="DocuMed.Domain.Enums" /> <Using Include="DocuMed.Domain.Enums" />
<Using Include="DocuMed.Domain.Mappers" /> <Using Include="DocuMed.Domain.Mappers" />
<Using Include="DocuMed.Repository.Abstracts" /> <Using Include="DocuMed.Repository.Abstracts" />
<Using Include="DocuMed.Repository.Repositories.Base.Contracts" /> <Using Include="DocuMed.Repository.Repositories.Base.Contracts" />
<Using Include="DocuMed.Repository.Repositories.Entities.Abstracts" /> <Using Include="DocuMed.Repository.Repositories.Entities.Abstracts" />
<Using Include="Mapster" /> <Using Include="Mapster" />
<Using Include="Microsoft.AspNetCore.Identity" /> <Using Include="Microsoft.AspNetCore.Identity" />
<Using Include="Microsoft.AspNetCore.Mvc" /> <Using Include="Microsoft.AspNetCore.Mvc" />
<Using Include="Microsoft.EntityFrameworkCore" /> <Using Include="Microsoft.EntityFrameworkCore" />
<Using Include="Microsoft.IdentityModel.Tokens" /> <Using Include="Microsoft.IdentityModel.Tokens" />
<Using Include="Newtonsoft.Json" /> <Using Include="Newtonsoft.Json" />
<Using Include="System.Security.Claims" /> <Using Include="System.Security.Claims" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -1,22 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net9.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Mapster" Version="7.4.0" /> <PackageReference Include="Mapster" Version="7.4.0" />
<PackageReference Include="Mapster.Core" Version="1.2.1" /> <PackageReference Include="Mapster.Core" Version="1.2.1" />
<PackageReference Include="MediatR" Version="12.4.1" /> <PackageReference Include="MediatR" Version="12.4.1" />
<PackageReference Include="Microsoft.Extensions.Identity.Stores" Version="9.0.0" /> <PackageReference Include="Microsoft.Extensions.Identity.Stores" Version="8.0.8" />
<PackageReference Include="PropertyChanged.Fody" Version="4.1.0" /> <PackageReference Include="PropertyChanged.Fody" Version="4.1.0" />
</ItemGroup> </ItemGroup>
<!--<PropertyGroup> <!--<PropertyGroup>
<TargetFramework>net5.0</TargetFramework> <TargetFramework>net5.0</TargetFramework>
<LangVersion>latest</LangVersion> <LangVersion>10</LangVersion>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>
@ -45,6 +45,7 @@
<Folder Include="Dtos\ResponseDtos\" /> <Folder Include="Dtos\ResponseDtos\" />
<Folder Include="Dtos\RequestDtos\" /> <Folder Include="Dtos\RequestDtos\" />
<Folder Include="Entities\City\" /> <Folder Include="Entities\City\" />
<Folder Include="Entities\Patients\" />
<Folder Include="Entities\User\" /> <Folder Include="Entities\User\" />
</ItemGroup> </ItemGroup>

View File

@ -1,4 +1,6 @@
namespace DocuMed.Domain.Dtos.SmallDtos; using DocuMed.Domain.Entities.Patients;
namespace DocuMed.Domain.Dtos.SmallDtos;
public class PatientSDto : BaseDto<PatientSDto,Patient> public class PatientSDto : BaseDto<PatientSDto,Patient>
{ {

View File

@ -7,7 +7,7 @@ public class StudentSDto : BaseDto<StudentSDto,Student>
public Guid UniversityId { get; set; } public Guid UniversityId { get; set; }
public string UniversityName { get; set; } = string.Empty; public string UniversityName { get; set; } = string.Empty;
public Guid SectionId { get; set; } public Guid? SectionId { get; set; }
public string SectionName { get; set; } = string.Empty; public string SectionName { get; set; } = string.Empty;
public Guid UserId { get; set; } public Guid UserId { get; set; }

View File

@ -21,6 +21,4 @@ public partial class University : ApiEntity
public Guid CityId { get; internal set; } public Guid CityId { get; internal set; }
public City? City { get; internal set; } public City? City { get; internal set; }
public List<Hospitals.Section> Sections { get; internal set; } = new();
} }

View File

@ -84,8 +84,8 @@ public partial class MedicalHistory : ApiEntity
public Guid StudentId { get; internal set; } public Guid StudentId { get; internal set; }
public Student? Student { get; internal set; } public Student? Student { get; internal set; }
public Guid PatientId { get; set; } public Guid PatientId { get; internal set; }
public Patient? Patient { get; set; } public Patient? Patient { get; internal set; }
public List<MedicalHistoryAnswer> Answers { get; internal set; } = new(); public List<MedicalHistoryAnswer> Answers { get; internal set; } = new();
} }

View File

@ -11,7 +11,11 @@ public partial class Patient : ApiEntity
} }
public Patient(string unitNumber, string room, string bed, DateTime admissionAt,Guid sectionId,Guid hospitalId, Guid userId) public Patient(string unitNumber, string room, string bed,
DateTime admissionAt,
Guid sectionId,
Guid hospitalId,
Guid userId)
{ {
UnitNumber = unitNumber; UnitNumber = unitNumber;
Room = room; Room = room;

View File

@ -2,6 +2,9 @@
public partial class Student public partial class Student
{ {
public static Student Create(Guid universityId, Guid sectionId, Guid userId) public static Student Create(Guid universityId, Guid userId)
=> new Student(universityId, sectionId, userId); => new Student(universityId, userId);
public void SetSection(Guid sectionId)
=> SectionId = sectionId;
} }

View File

@ -11,10 +11,9 @@ public partial class Student : ApiEntity
} }
public Student(Guid universityId, Guid sectionId, Guid userId) public Student(Guid universityId, Guid userId)
{ {
UniversityId = universityId; UniversityId = universityId;
SectionId = sectionId;
UserId = userId; UserId = userId;
} }
@ -23,7 +22,7 @@ public partial class Student : ApiEntity
public Guid UniversityId { get; internal set; } public Guid UniversityId { get; internal set; }
public University? University { get; internal set; } public University? University { get; internal set; }
public Guid SectionId { get; internal set; } public Guid? SectionId { get; internal set; }
public Section? Section { get; internal set; } public Section? Section { get; internal set; }
public Guid UserId { get; internal set; } public Guid UserId { get; internal set; }

View File

@ -26,7 +26,7 @@ namespace DocuMed.Domain.Mappers
Section = new Section() Section = new Section()
{ {
Name = p1.SectionName, Name = p1.SectionName,
Id = p1.SectionId Id = p1.SectionId.Value
}, },
UserId = p1.UserId, UserId = p1.UserId,
User = new ApplicationUser() {Id = p1.UserId}, User = new ApplicationUser() {Id = p1.UserId},
@ -65,7 +65,7 @@ namespace DocuMed.Domain.Mappers
Section = new Section() Section = new Section()
{ {
Name = p10.SectionName, Name = p10.SectionName,
Id = p10.SectionId Id = p10.SectionId.Value
}, },
UserId = p10.UserId, UserId = p10.UserId,
User = new ApplicationUser() {Id = p10.UserId}, User = new ApplicationUser() {Id = p10.UserId},
@ -140,7 +140,7 @@ namespace DocuMed.Domain.Mappers
Section result = p7 ?? new Section(); Section result = p7 ?? new Section();
result.Name = p2.SectionName; result.Name = p2.SectionName;
result.Id = p2.SectionId; result.Id = p2.SectionId.Value;
return result; return result;
} }

View File

@ -1,37 +1,37 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net9.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Refit" Version="8.0.0" /> <PackageReference Include="Refit" Version="7.2.1" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\DocuMed.Core\DocuMed.Core.csproj" /> <ProjectReference Include="..\DocuMed.Core\DocuMed.Core.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Folder Include="Models\RestApi\KaveNegar\" /> <Folder Include="Models\RestApi\KaveNegar\" />
<Folder Include="RestServices\" /> <Folder Include="RestServices\" />
<Folder Include="Services\" /> <Folder Include="Services\" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Using Include="DocuMed.Common.Models" /> <Using Include="DocuMed.Common.Models" />
<Using Include="DocuMed.Common.Models.Api" /> <Using Include="DocuMed.Common.Models.Api" />
<Using Include="DocuMed.Common.Models.Exception" /> <Using Include="DocuMed.Common.Models.Exception" />
<Using Include="DocuMed.Core.Abstracts" /> <Using Include="DocuMed.Core.Abstracts" />
<Using Include="DocuMed.Domain.Models.Settings" /> <Using Include="DocuMed.Domain.Models.Settings" />
<Using Include="DocuMed.Infrastructure.Models" /> <Using Include="DocuMed.Infrastructure.Models" />
<Using Include="DocuMed.Infrastructure.Models.RestApi.KaveNegar" /> <Using Include="DocuMed.Infrastructure.Models.RestApi.KaveNegar" />
<Using Include="DocuMed.Infrastructure.RestServices" /> <Using Include="DocuMed.Infrastructure.RestServices" />
<Using Include="Microsoft.Extensions.Logging" /> <Using Include="Microsoft.Extensions.Logging" />
<Using Include="Microsoft.Extensions.Options" /> <Using Include="Microsoft.Extensions.Options" />
<Using Include="Refit" /> <Using Include="Refit" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -1,70 +1,70 @@
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly"> <Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
<Target Name="PostBuild" AfterTargets="PostBuildEvent"> <Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="npm run buildcss" /> <Exec Command="npm run buildcss" />
</Target> </Target>
<PropertyGroup> <PropertyGroup>
<TargetFramework>net9.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<ServiceWorkerAssetsManifest>service-worker-assets.js</ServiceWorkerAssetsManifest> <ServiceWorkerAssetsManifest>service-worker-assets.js</ServiceWorkerAssetsManifest>
<AssemblyVersion>1.3.2.1</AssemblyVersion> <AssemblyVersion>1.3.2.1</AssemblyVersion>
<FileVersion>1.3.2.1</FileVersion> <FileVersion>1.3.2.1</FileVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Blazored.LocalStorage" Version="4.5.0" /> <PackageReference Include="Blazored.LocalStorage" Version="4.5.0" />
<PackageReference Include="Blazorise.LottieAnimation" Version="1.7.1" /> <PackageReference Include="Blazorise.LottieAnimation" Version="1.6.1" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="9.0.0" /> <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.8" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="9.0.0" PrivateAssets="all" /> <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.8" PrivateAssets="all" />
<PackageReference Include="MudBlazor" Version="6.13.0" /> <PackageReference Include="MudBlazor" Version="6.13.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Refit" Version="8.0.0" /> <PackageReference Include="Refit" Version="7.2.1" />
<PackageReference Include="Refit.HttpClientFactory" Version="8.0.0" /> <PackageReference Include="Refit.HttpClientFactory" Version="7.2.1" />
<PackageReference Include="Refit.Newtonsoft.Json" Version="8.0.0" /> <PackageReference Include="Refit.Newtonsoft.Json" Version="7.2.1" />
<PackageReference Include="Toolbelt.Blazor.PWA.Updater" Version="3.0.1" /> <PackageReference Include="Toolbelt.Blazor.PWA.Updater" Version="2.1.0.1" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ServiceWorker Include="wwwroot\service-worker.js" PublishedContent="wwwroot\service-worker.published.js" /> <ServiceWorker Include="wwwroot\service-worker.js" PublishedContent="wwwroot\service-worker.published.js" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Folder Include="Models\ItemModels\" /> <Folder Include="Models\ItemModels\" />
<Folder Include="Helpers\" /> <Folder Include="Helpers\" />
<Folder Include="wwwroot\assets\lotties\" /> <Folder Include="wwwroot\assets\lotties\" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\DocuMed.Domain\DocuMed.Domain.csproj" /> <ProjectReference Include="..\DocuMed.Domain\DocuMed.Domain.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Using Include="Blazored.LocalStorage" /> <Using Include="Blazored.LocalStorage" />
<Using Include="DocuMed.Common.Extensions" /> <Using Include="DocuMed.Common.Extensions" />
<Using Include="DocuMed.Common.Models.Api" /> <Using Include="DocuMed.Common.Models.Api" />
<Using Include="DocuMed.Domain.Dtos.LargDtos" /> <Using Include="DocuMed.Domain.Dtos.LargDtos" />
<Using Include="DocuMed.Domain.Dtos.RequestDtos" /> <Using Include="DocuMed.Domain.Dtos.RequestDtos" />
<Using Include="DocuMed.Domain.Dtos.SmallDtos" /> <Using Include="DocuMed.Domain.Dtos.SmallDtos" />
<Using Include="DocuMed.Domain.Entities.City" /> <Using Include="DocuMed.Domain.Entities.City" />
<Using Include="DocuMed.Domain.Entities.MedicalHistory" /> <Using Include="DocuMed.Domain.Entities.MedicalHistory" />
<Using Include="DocuMed.Domain.Entities.MedicalHistoryTemplate" /> <Using Include="DocuMed.Domain.Entities.MedicalHistoryTemplate" />
<Using Include="DocuMed.Domain.Enums" /> <Using Include="DocuMed.Domain.Enums" />
<Using Include="DocuMed.Domain.Enums.QueryFilters" /> <Using Include="DocuMed.Domain.Enums.QueryFilters" />
<Using Include="DocuMed.Domain.Models" /> <Using Include="DocuMed.Domain.Models" />
<Using Include="DocuMed.PWA" /> <Using Include="DocuMed.PWA" />
<Using Include="DocuMed.PWA.Models" /> <Using Include="DocuMed.PWA.Models" />
<Using Include="DocuMed.PWA.Models.Api" /> <Using Include="DocuMed.PWA.Models.Api" />
<Using Include="DocuMed.PWA.Services.RestServices" /> <Using Include="DocuMed.PWA.Services.RestServices" />
<Using Include="DocuMed.PWA.Utilities" /> <Using Include="DocuMed.PWA.Utilities" />
<Using Include="Microsoft.AspNetCore.Components" /> <Using Include="Microsoft.AspNetCore.Components" />
<Using Include="Microsoft.AspNetCore.Components.Web" /> <Using Include="Microsoft.AspNetCore.Components.Web" />
<Using Include="Microsoft.AspNetCore.Components.WebAssembly.Hosting" /> <Using Include="Microsoft.AspNetCore.Components.WebAssembly.Hosting" />
<Using Include="Microsoft.IdentityModel.Tokens" /> <Using Include="Microsoft.IdentityModel.Tokens" />
<Using Include="MudBlazor" /> <Using Include="MudBlazor" />
<Using Include="MudBlazor.Services" /> <Using Include="MudBlazor.Services" />
<Using Include="Refit" /> <Using Include="Refit" />
<Using Include="System.Reflection" /> <Using Include="System.Reflection" />
<Using Include="Toolbelt.Blazor.Extensions.DependencyInjection" /> <Using Include="Toolbelt.Blazor.Extensions.DependencyInjection" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -0,0 +1,30 @@
using FluentValidation;
using ValidationError = DocuMed.Common.Models.Exception.ValidationError;
namespace DocuMed.Repository.Behaviors;
public class ValidationBehavior<TRequest, TResponse>(IEnumerable<IValidator<TRequest>> validators)
: IPipelineBehavior<TRequest, TResponse>
where TRequest : notnull
{
public async Task<TResponse> Handle(TRequest request, RequestHandlerDelegate<TResponse> next, CancellationToken cancellationToken)
{
var context = new ValidationContext<TRequest>(request);
List<ValidationError> errors = new List<ValidationError>();
foreach (IValidator<TRequest> validator in validators)
{
var result = await validator.ValidateAsync(context, cancellationToken);
if (!result.IsValid)
errors.AddRange(result.Errors.Select(v => new ValidationError(v.PropertyName, v.ErrorMessage)).Distinct());
}
if (errors.Any())
{
throw new Common.Models.Exception.ValidationException(errors);
}
var response = await next();
return response;
}
}

View File

@ -1,26 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net9.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="FluentValidation" Version="11.11.0" />
<PackageReference Include="Microsoft.AspNetCore" Version="2.2.0" /> <PackageReference Include="Microsoft.AspNetCore" Version="2.2.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.0" /> <PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.0"> <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.8">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.0"> <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.8">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="Pluralize.NET" Version="1.0.2" /> <PackageReference Include="Pluralize.NET" Version="1.0.2" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.2" /> <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.8" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="9.0.0" /> <PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.8" />
<PackageReference Include="StackExchange.Redis" Version="2.8.24" /> <PackageReference Include="StackExchange.Redis" Version="2.8.16" />
<PackageReference Include="StackExchange.Redis.Extensions.Core" Version="10.2.0" /> <PackageReference Include="StackExchange.Redis.Extensions.Core" Version="10.2.0" />
</ItemGroup> </ItemGroup>

View File

@ -1,4 +1,5 @@
using MediatR; using DocuMed.Domain.Entities.Staffs;
using MediatR;
namespace DocuMed.Repository.Handlers.MedicalHistories; namespace DocuMed.Repository.Handlers.MedicalHistories;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,758 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace DocuMed.Repository.Migrations
{
/// <inheritdoc />
public partial class Init : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.EnsureSchema(
name: "public");
migrationBuilder.CreateTable(
name: "Cities",
schema: "public",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
Name = table.Column<string>(type: "text", nullable: false),
RemovedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
CreatedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
CreatedBy = table.Column<string>(type: "text", nullable: true),
IsRemoved = table.Column<bool>(type: "boolean", nullable: false),
RemovedBy = table.Column<string>(type: "text", nullable: true),
ModifiedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
ModifiedBy = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Cities", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Roles",
schema: "public",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
Description = table.Column<string>(type: "text", nullable: false),
EnglishName = table.Column<string>(type: "text", nullable: false),
PersianName = table.Column<string>(type: "text", nullable: false),
Name = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
NormalizedName = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
ConcurrencyStamp = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Roles", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Users",
schema: "public",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
FirstName = table.Column<string>(type: "text", nullable: false),
LastName = table.Column<string>(type: "text", nullable: false),
NationalId = table.Column<string>(type: "text", nullable: false),
BirthDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
Gender = table.Column<int>(type: "integer", nullable: false),
SignUpStatus = table.Column<int>(type: "integer", nullable: false),
UserName = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
NormalizedUserName = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
Email = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
NormalizedEmail = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
EmailConfirmed = table.Column<bool>(type: "boolean", nullable: false),
PasswordHash = table.Column<string>(type: "text", nullable: true),
SecurityStamp = table.Column<string>(type: "text", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "text", nullable: true),
PhoneNumber = table.Column<string>(type: "text", nullable: true),
PhoneNumberConfirmed = table.Column<bool>(type: "boolean", nullable: false),
TwoFactorEnabled = table.Column<bool>(type: "boolean", nullable: false),
LockoutEnd = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
LockoutEnabled = table.Column<bool>(type: "boolean", nullable: false),
AccessFailedCount = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Users", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Universities",
schema: "public",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
Name = table.Column<string>(type: "text", nullable: false),
Address = table.Column<string>(type: "text", nullable: false),
CityId = table.Column<Guid>(type: "uuid", nullable: false),
RemovedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
CreatedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
CreatedBy = table.Column<string>(type: "text", nullable: true),
IsRemoved = table.Column<bool>(type: "boolean", nullable: false),
RemovedBy = table.Column<string>(type: "text", nullable: true),
ModifiedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
ModifiedBy = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Universities", x => x.Id);
table.ForeignKey(
name: "FK_Universities_Cities_CityId",
column: x => x.CityId,
principalSchema: "public",
principalTable: "Cities",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "RoleClaims",
schema: "public",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
RoleId = table.Column<Guid>(type: "uuid", nullable: false),
ClaimType = table.Column<string>(type: "text", nullable: true),
ClaimValue = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_RoleClaims", x => x.Id);
table.ForeignKey(
name: "FK_RoleClaims_Roles_RoleId",
column: x => x.RoleId,
principalSchema: "public",
principalTable: "Roles",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "Claims",
schema: "public",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
UserId = table.Column<Guid>(type: "uuid", nullable: false),
ClaimType = table.Column<string>(type: "text", nullable: true),
ClaimValue = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Claims", x => x.Id);
table.ForeignKey(
name: "FK_Claims_Users_UserId",
column: x => x.UserId,
principalSchema: "public",
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "Logins",
schema: "public",
columns: table => new
{
LoginProvider = table.Column<string>(type: "text", nullable: false),
ProviderKey = table.Column<string>(type: "text", nullable: false),
ProviderDisplayName = table.Column<string>(type: "text", nullable: true),
UserId = table.Column<Guid>(type: "uuid", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Logins", x => new { x.LoginProvider, x.ProviderKey });
table.ForeignKey(
name: "FK_Logins_Users_UserId",
column: x => x.UserId,
principalSchema: "public",
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "Tokens",
schema: "public",
columns: table => new
{
UserId = table.Column<Guid>(type: "uuid", nullable: false),
LoginProvider = table.Column<string>(type: "text", nullable: false),
Name = table.Column<string>(type: "text", nullable: false),
Value = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Tokens", x => new { x.UserId, x.LoginProvider, x.Name });
table.ForeignKey(
name: "FK_Tokens_Users_UserId",
column: x => x.UserId,
principalSchema: "public",
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "UserRoles",
schema: "public",
columns: table => new
{
UserId = table.Column<Guid>(type: "uuid", nullable: false),
RoleId = table.Column<Guid>(type: "uuid", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_UserRoles", x => new { x.UserId, x.RoleId });
table.ForeignKey(
name: "FK_UserRoles_Roles_RoleId",
column: x => x.RoleId,
principalSchema: "public",
principalTable: "Roles",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_UserRoles_Users_UserId",
column: x => x.UserId,
principalSchema: "public",
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "Hospitals",
schema: "public",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
Name = table.Column<string>(type: "text", nullable: false),
Detail = table.Column<string>(type: "text", nullable: false),
Address = table.Column<string>(type: "text", nullable: false),
UniversityId = table.Column<Guid>(type: "uuid", nullable: false),
RemovedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
CreatedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
CreatedBy = table.Column<string>(type: "text", nullable: true),
IsRemoved = table.Column<bool>(type: "boolean", nullable: false),
RemovedBy = table.Column<string>(type: "text", nullable: true),
ModifiedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
ModifiedBy = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Hospitals", x => x.Id);
table.ForeignKey(
name: "FK_Hospitals_Universities_UniversityId",
column: x => x.UniversityId,
principalSchema: "public",
principalTable: "Universities",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "Sections",
schema: "public",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
Name = table.Column<string>(type: "text", nullable: false),
Detail = table.Column<string>(type: "text", nullable: false),
HospitalId = table.Column<Guid>(type: "uuid", nullable: false),
UniversityId = table.Column<Guid>(type: "uuid", nullable: true),
RemovedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
CreatedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
CreatedBy = table.Column<string>(type: "text", nullable: true),
IsRemoved = table.Column<bool>(type: "boolean", nullable: false),
RemovedBy = table.Column<string>(type: "text", nullable: true),
ModifiedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
ModifiedBy = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Sections", x => x.Id);
table.ForeignKey(
name: "FK_Sections_Hospitals_HospitalId",
column: x => x.HospitalId,
principalSchema: "public",
principalTable: "Hospitals",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_Sections_Universities_UniversityId",
column: x => x.UniversityId,
principalSchema: "public",
principalTable: "Universities",
principalColumn: "Id");
});
migrationBuilder.CreateTable(
name: "Patients",
schema: "public",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
UnitNumber = table.Column<string>(type: "text", nullable: false),
Room = table.Column<string>(type: "text", nullable: false),
Bed = table.Column<string>(type: "text", nullable: false),
AdmissionAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
SectionId = table.Column<Guid>(type: "uuid", nullable: false),
HospitalId = table.Column<Guid>(type: "uuid", nullable: false),
UserId = table.Column<Guid>(type: "uuid", nullable: false),
RemovedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
CreatedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
CreatedBy = table.Column<string>(type: "text", nullable: true),
IsRemoved = table.Column<bool>(type: "boolean", nullable: false),
RemovedBy = table.Column<string>(type: "text", nullable: true),
ModifiedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
ModifiedBy = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Patients", x => x.Id);
table.ForeignKey(
name: "FK_Patients_Sections_SectionId",
column: x => x.SectionId,
principalSchema: "public",
principalTable: "Sections",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_Patients_Users_UserId",
column: x => x.UserId,
principalSchema: "public",
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "Students",
schema: "public",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
StudentId = table.Column<string>(type: "text", nullable: false),
UniversityId = table.Column<Guid>(type: "uuid", nullable: false),
SectionId = table.Column<Guid>(type: "uuid", nullable: false),
UserId = table.Column<Guid>(type: "uuid", nullable: false),
RemovedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
CreatedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
CreatedBy = table.Column<string>(type: "text", nullable: true),
IsRemoved = table.Column<bool>(type: "boolean", nullable: false),
RemovedBy = table.Column<string>(type: "text", nullable: true),
ModifiedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
ModifiedBy = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Students", x => x.Id);
table.ForeignKey(
name: "FK_Students_Sections_SectionId",
column: x => x.SectionId,
principalSchema: "public",
principalTable: "Sections",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_Students_Universities_UniversityId",
column: x => x.UniversityId,
principalSchema: "public",
principalTable: "Universities",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_Students_Users_UserId",
column: x => x.UserId,
principalSchema: "public",
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "MedicalHistories",
schema: "public",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
ChiefComplaint = table.Column<string>(type: "text", nullable: false),
SectionId = table.Column<Guid>(type: "uuid", nullable: false),
PresentIllnessDetail = table.Column<string>(type: "text", nullable: false),
PastDiseasesHistoryDetail = table.Column<string>(type: "text", nullable: false),
PastSurgeryHistoryDetail = table.Column<string>(type: "text", nullable: false),
FamilyHistoryDetail = table.Column<string>(type: "text", nullable: false),
AllergyDetail = table.Column<string>(type: "text", nullable: false),
DrugHistoryDetail = table.Column<string>(type: "text", nullable: false),
AddictionHistoryDetail = table.Column<string>(type: "text", nullable: false),
SystemReviewDetail = table.Column<string>(type: "text", nullable: false),
VitalSignDetail = table.Column<string>(type: "text", nullable: false),
GeneralAppearanceDetail = table.Column<string>(type: "text", nullable: false),
Code = table.Column<string>(type: "text", nullable: false),
SystolicBloodPressure = table.Column<double>(type: "double precision", nullable: false),
DiastolicBloodPressure = table.Column<double>(type: "double precision", nullable: false),
PulseRate = table.Column<double>(type: "double precision", nullable: false),
SPO2 = table.Column<double>(type: "double precision", nullable: false),
Temperature = table.Column<double>(type: "double precision", nullable: false),
MedicalHistoryTemplateId = table.Column<Guid>(type: "uuid", nullable: false),
StudentId = table.Column<Guid>(type: "uuid", nullable: false),
PatientId = table.Column<Guid>(type: "uuid", nullable: false),
RemovedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
CreatedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
CreatedBy = table.Column<string>(type: "text", nullable: true),
IsRemoved = table.Column<bool>(type: "boolean", nullable: false),
RemovedBy = table.Column<string>(type: "text", nullable: true),
ModifiedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
ModifiedBy = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_MedicalHistories", x => x.Id);
table.ForeignKey(
name: "FK_MedicalHistories_Patients_PatientId",
column: x => x.PatientId,
principalSchema: "public",
principalTable: "Patients",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_MedicalHistories_Sections_SectionId",
column: x => x.SectionId,
principalSchema: "public",
principalTable: "Sections",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_MedicalHistories_Students_StudentId",
column: x => x.StudentId,
principalSchema: "public",
principalTable: "Students",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "MedicalHistoryTemplates",
schema: "public",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
ChiefComplaint = table.Column<string>(type: "text", nullable: false),
SectionId = table.Column<Guid>(type: "uuid", nullable: false),
StudentId = table.Column<Guid>(type: "uuid", nullable: false),
RemovedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
CreatedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
CreatedBy = table.Column<string>(type: "text", nullable: true),
IsRemoved = table.Column<bool>(type: "boolean", nullable: false),
RemovedBy = table.Column<string>(type: "text", nullable: true),
ModifiedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
ModifiedBy = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_MedicalHistoryTemplates", x => x.Id);
table.ForeignKey(
name: "FK_MedicalHistoryTemplates_Sections_SectionId",
column: x => x.SectionId,
principalSchema: "public",
principalTable: "Sections",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_MedicalHistoryTemplates_Students_StudentId",
column: x => x.StudentId,
principalSchema: "public",
principalTable: "Students",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "MedicalHistoryAnswers",
schema: "public",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
Answer = table.Column<string>(type: "text", nullable: false),
Question = table.Column<string>(type: "text", nullable: false),
Part = table.Column<int>(type: "integer", nullable: false),
QuestionType = table.Column<int>(type: "integer", nullable: false),
MedicalHistoryId = table.Column<Guid>(type: "uuid", nullable: false),
RemovedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
CreatedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
CreatedBy = table.Column<string>(type: "text", nullable: true),
IsRemoved = table.Column<bool>(type: "boolean", nullable: false),
RemovedBy = table.Column<string>(type: "text", nullable: true),
ModifiedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
ModifiedBy = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_MedicalHistoryAnswers", x => x.Id);
table.ForeignKey(
name: "FK_MedicalHistoryAnswers_MedicalHistories_MedicalHistoryId",
column: x => x.MedicalHistoryId,
principalSchema: "public",
principalTable: "MedicalHistories",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "MedicalHistoryQuestions",
schema: "public",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
Question = table.Column<string>(type: "text", nullable: false),
Part = table.Column<int>(type: "integer", nullable: false),
QuestionType = table.Column<int>(type: "integer", nullable: false),
BodySystem = table.Column<int>(type: "integer", nullable: false),
IsSign = table.Column<bool>(type: "boolean", nullable: false),
IsSymptom = table.Column<bool>(type: "boolean", nullable: false),
MedicalHistoryTemplateId = table.Column<Guid>(type: "uuid", nullable: false),
RemovedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
CreatedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
CreatedBy = table.Column<string>(type: "text", nullable: true),
IsRemoved = table.Column<bool>(type: "boolean", nullable: false),
RemovedBy = table.Column<string>(type: "text", nullable: true),
ModifiedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
ModifiedBy = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_MedicalHistoryQuestions", x => x.Id);
table.ForeignKey(
name: "FK_MedicalHistoryQuestions_MedicalHistoryTemplates_MedicalHist~",
column: x => x.MedicalHistoryTemplateId,
principalSchema: "public",
principalTable: "MedicalHistoryTemplates",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateIndex(
name: "IX_Claims_UserId",
schema: "public",
table: "Claims",
column: "UserId");
migrationBuilder.CreateIndex(
name: "IX_Hospitals_UniversityId",
schema: "public",
table: "Hospitals",
column: "UniversityId");
migrationBuilder.CreateIndex(
name: "IX_Logins_UserId",
schema: "public",
table: "Logins",
column: "UserId");
migrationBuilder.CreateIndex(
name: "IX_MedicalHistories_PatientId",
schema: "public",
table: "MedicalHistories",
column: "PatientId");
migrationBuilder.CreateIndex(
name: "IX_MedicalHistories_SectionId",
schema: "public",
table: "MedicalHistories",
column: "SectionId");
migrationBuilder.CreateIndex(
name: "IX_MedicalHistories_StudentId",
schema: "public",
table: "MedicalHistories",
column: "StudentId");
migrationBuilder.CreateIndex(
name: "IX_MedicalHistoryAnswers_MedicalHistoryId",
schema: "public",
table: "MedicalHistoryAnswers",
column: "MedicalHistoryId");
migrationBuilder.CreateIndex(
name: "IX_MedicalHistoryQuestions_MedicalHistoryTemplateId",
schema: "public",
table: "MedicalHistoryQuestions",
column: "MedicalHistoryTemplateId");
migrationBuilder.CreateIndex(
name: "IX_MedicalHistoryTemplates_SectionId",
schema: "public",
table: "MedicalHistoryTemplates",
column: "SectionId");
migrationBuilder.CreateIndex(
name: "IX_MedicalHistoryTemplates_StudentId",
schema: "public",
table: "MedicalHistoryTemplates",
column: "StudentId");
migrationBuilder.CreateIndex(
name: "IX_Patients_SectionId",
schema: "public",
table: "Patients",
column: "SectionId");
migrationBuilder.CreateIndex(
name: "IX_Patients_UserId",
schema: "public",
table: "Patients",
column: "UserId");
migrationBuilder.CreateIndex(
name: "IX_RoleClaims_RoleId",
schema: "public",
table: "RoleClaims",
column: "RoleId");
migrationBuilder.CreateIndex(
name: "RoleNameIndex",
schema: "public",
table: "Roles",
column: "NormalizedName",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Sections_HospitalId",
schema: "public",
table: "Sections",
column: "HospitalId");
migrationBuilder.CreateIndex(
name: "IX_Sections_UniversityId",
schema: "public",
table: "Sections",
column: "UniversityId");
migrationBuilder.CreateIndex(
name: "IX_Students_SectionId",
schema: "public",
table: "Students",
column: "SectionId");
migrationBuilder.CreateIndex(
name: "IX_Students_UniversityId",
schema: "public",
table: "Students",
column: "UniversityId");
migrationBuilder.CreateIndex(
name: "IX_Students_UserId",
schema: "public",
table: "Students",
column: "UserId");
migrationBuilder.CreateIndex(
name: "IX_Universities_CityId",
schema: "public",
table: "Universities",
column: "CityId");
migrationBuilder.CreateIndex(
name: "IX_UserRoles_RoleId",
schema: "public",
table: "UserRoles",
column: "RoleId");
migrationBuilder.CreateIndex(
name: "EmailIndex",
schema: "public",
table: "Users",
column: "NormalizedEmail");
migrationBuilder.CreateIndex(
name: "UserNameIndex",
schema: "public",
table: "Users",
column: "NormalizedUserName",
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Claims",
schema: "public");
migrationBuilder.DropTable(
name: "Logins",
schema: "public");
migrationBuilder.DropTable(
name: "MedicalHistoryAnswers",
schema: "public");
migrationBuilder.DropTable(
name: "MedicalHistoryQuestions",
schema: "public");
migrationBuilder.DropTable(
name: "RoleClaims",
schema: "public");
migrationBuilder.DropTable(
name: "Tokens",
schema: "public");
migrationBuilder.DropTable(
name: "UserRoles",
schema: "public");
migrationBuilder.DropTable(
name: "MedicalHistories",
schema: "public");
migrationBuilder.DropTable(
name: "MedicalHistoryTemplates",
schema: "public");
migrationBuilder.DropTable(
name: "Roles",
schema: "public");
migrationBuilder.DropTable(
name: "Patients",
schema: "public");
migrationBuilder.DropTable(
name: "Students",
schema: "public");
migrationBuilder.DropTable(
name: "Sections",
schema: "public");
migrationBuilder.DropTable(
name: "Users",
schema: "public");
migrationBuilder.DropTable(
name: "Hospitals",
schema: "public");
migrationBuilder.DropTable(
name: "Universities",
schema: "public");
migrationBuilder.DropTable(
name: "Cities",
schema: "public");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,68 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace DocuMed.Repository.Migrations
{
/// <inheritdoc />
public partial class UpdateStudentSetSectionIdNull : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Students_Sections_SectionId",
schema: "public",
table: "Students");
migrationBuilder.AlterColumn<Guid>(
name: "SectionId",
schema: "public",
table: "Students",
type: "uuid",
nullable: true,
oldClrType: typeof(Guid),
oldType: "uuid");
migrationBuilder.AddForeignKey(
name: "FK_Students_Sections_SectionId",
schema: "public",
table: "Students",
column: "SectionId",
principalSchema: "public",
principalTable: "Sections",
principalColumn: "Id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Students_Sections_SectionId",
schema: "public",
table: "Students");
migrationBuilder.AlterColumn<Guid>(
name: "SectionId",
schema: "public",
table: "Students",
type: "uuid",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
oldClrType: typeof(Guid),
oldType: "uuid",
oldNullable: true);
migrationBuilder.AddForeignKey(
name: "FK_Students_Sections_SectionId",
schema: "public",
table: "Students",
column: "SectionId",
principalSchema: "public",
principalTable: "Sections",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,56 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace DocuMed.Repository.Migrations
{
/// <inheritdoc />
public partial class EditUniAndSection : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Sections_Universities_UniversityId",
schema: "public",
table: "Sections");
migrationBuilder.DropIndex(
name: "IX_Sections_UniversityId",
schema: "public",
table: "Sections");
migrationBuilder.DropColumn(
name: "UniversityId",
schema: "public",
table: "Sections");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "UniversityId",
schema: "public",
table: "Sections",
type: "uuid",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_Sections_UniversityId",
schema: "public",
table: "Sections",
column: "UniversityId");
migrationBuilder.AddForeignKey(
name: "FK_Sections_Universities_UniversityId",
schema: "public",
table: "Sections",
column: "UniversityId",
principalSchema: "public",
principalTable: "Universities",
principalColumn: "Id");
}
}
}

File diff suppressed because it is too large Load Diff