From 24b92acd4be61667809d0d15e1ee9a88b2558e7d Mon Sep 17 00:00:00 2001 From: "Amir.H Khademi" Date: Tue, 24 Oct 2023 10:43:48 +0330 Subject: [PATCH] complete create medical history template --- DocuMed.Api/Controllers/CityController.cs | 3 +- .../MedicalHistoryTemplateController.cs | 86 ++ DocuMed.Api/Controllers/SectionController.cs | 3 +- .../Controllers/UniversityController.cs | 3 +- DocuMed.Api/DocuMed.Api.csproj | 1 + .../Dtos/LargDtos/MedicalHistoryLDto.cs | 1 + .../LargDtos/MedicalHistoryTemplateLDto.cs | 1 + .../Dtos/SmallDtos/MedicalHistorySDto.cs | 1 + .../SmallDtos/MedicalHistoryTemplateSDto.cs | 1 + .../MedicalHistory.Aggregate.cs | 5 +- .../Entities/MedicalHistory/MedicalHistory.cs | 7 +- .../MedicalHistoryTemplate.Aggregate.cs | 4 +- .../MedicalHistoryTemplate.cs | 6 +- .../Enums/MedicalHistoryQuestionType.cs | 4 +- DocuMed.Domain/Mappers/CityMapper.g.cs | 4 +- .../Mappers/MedicalHistoryMapper.g.cs | 12 + .../Mappers/MedicalHistoryTemplateMapper.g.cs | 12 + DocuMed.PWA/DocuMed.PWA.csproj | 2 + DocuMed.PWA/Models/Address.cs | 1 + DocuMed.PWA/Models/BaseViewModel.cs | 18 + DocuMed.PWA/Pages/Index.razor | 41 +- .../MedicalHistoryTemplateActionPage.razor | 88 +- .../MedicalHistoryTemplateActionPage.razor.cs | 114 ++- .../MedicalHistoryTemplateActionStep1.razor | 65 +- .../MedicalHistoryTemplateActionStep2.razor | 18 +- .../MedicalHistoryTemplateActionStep3.razor | 77 +- .../MedicalHistoryTemplateActionStep4.razor | 60 +- .../MedicalHistoryTemplateActionStep5.razor | 28 +- .../Pages/MedicalHistoryTemplatesPage.razor | 43 +- .../MedicalHistoryTemplatesPage.razor.cs | 49 ++ DocuMed.PWA/Pages/ProfilePage.razor | 6 +- DocuMed.PWA/Pages/ProfilePage.razor.cs | 12 +- ...lHistoryQuestionTemplateItemTemplate.razor | 4 +- DocuMed.PWA/Utilities/IUserUtility.cs | 1 + DocuMed.PWA/Utilities/UserUtility.cs | 9 +- DocuMed.PWA/wwwroot/css/app.min.css | 24 + DocuMed.PWA/wwwroot/css/app.output.css | 41 +- .../20231019180057_init.Designer.cs | 722 ---------------- .../20231021121504_addSections.Designer.cs | 786 ----------------- .../Migrations/20231021121504_addSections.cs | 58 -- .../20231021122606_editUser.Designer.cs | 797 ------------------ .../Migrations/20231021122606_editUser.cs | 68 -- .../Migrations/20231022121751_editTemplate.cs | 32 - ...ner.cs => 20231022193344_init.Designer.cs} | 36 +- ...9180057_init.cs => 20231022193344_init.cs} | 517 +++++++----- .../ApplicationContextModelSnapshot.cs | 32 + 46 files changed, 1045 insertions(+), 2858 deletions(-) create mode 100644 DocuMed.Api/Controllers/MedicalHistoryTemplateController.cs create mode 100644 DocuMed.PWA/Pages/MedicalHistoryTemplatesPage.razor.cs delete mode 100644 DocuMed.Repository/Migrations/20231019180057_init.Designer.cs delete mode 100644 DocuMed.Repository/Migrations/20231021121504_addSections.Designer.cs delete mode 100644 DocuMed.Repository/Migrations/20231021121504_addSections.cs delete mode 100644 DocuMed.Repository/Migrations/20231021122606_editUser.Designer.cs delete mode 100644 DocuMed.Repository/Migrations/20231021122606_editUser.cs delete mode 100644 DocuMed.Repository/Migrations/20231022121751_editTemplate.cs rename DocuMed.Repository/Migrations/{20231022121751_editTemplate.Designer.cs => 20231022193344_init.Designer.cs} (95%) rename DocuMed.Repository/Migrations/{20231019180057_init.cs => 20231022193344_init.cs} (85%) diff --git a/DocuMed.Api/Controllers/CityController.cs b/DocuMed.Api/Controllers/CityController.cs index 7e3baf8..87cf33e 100644 --- a/DocuMed.Api/Controllers/CityController.cs +++ b/DocuMed.Api/Controllers/CityController.cs @@ -4,8 +4,7 @@ public class CityController : ICarterModule public virtual void AddRoutes(IEndpointRouteBuilder app) { - var group = app.NewVersionedApi("City").MapGroup($"api/city") - .RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser()); + var group = app.NewVersionedApi("City").MapGroup($"api/city"); group.MapGet("", GetAllAsync) .WithDisplayName("GetAll") diff --git a/DocuMed.Api/Controllers/MedicalHistoryTemplateController.cs b/DocuMed.Api/Controllers/MedicalHistoryTemplateController.cs new file mode 100644 index 0000000..a075b5e --- /dev/null +++ b/DocuMed.Api/Controllers/MedicalHistoryTemplateController.cs @@ -0,0 +1,86 @@ +using DocuMed.Api.Services; +using DocuMed.Domain.Dtos.LargDtos; + +namespace DocuMed.Api.Controllers; + +public class MedicalHistoryTemplateController : ICarterModule +{ + public virtual void AddRoutes(IEndpointRouteBuilder app) + { + var group = app.NewVersionedApi("MedicalHistoryTemplate").MapGroup($"api/medicalhistory/template") + .RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser()); + + group.MapGet("", GetAllAsync) + .WithDisplayName("GetAll") + .HasApiVersion(1.0); + + group.MapGet("{id}", GetAsync) + .WithDisplayName("GetOne") + .HasApiVersion(1.0); + + group.MapPost("", Post) + .HasApiVersion(1.0); + + group.MapPut("", Put) + .HasApiVersion(1.0); + + group.MapDelete("", Delete) + .HasApiVersion(1.0); + } + + + // GET:Get All Entity + public virtual async Task GetAllAsync([FromQuery] int page, IRepositoryWrapper repositoryWrapper,ICurrentUserService currentUserService, CancellationToken cancellationToken) + { + if (!Guid.TryParse(currentUserService.UserId, out Guid userId)) + throw new AppException("توکن غیرمجاز", ApiResultStatusCode.UnAuthorized); + var list = await repositoryWrapper.SetRepository().TableNoTracking + .Where(t=>t.ApplicationUserId== userId) + .OrderByDescending(t=>t.CreatedAt) + .Skip(page*15) + .Take(15) + .Select(MedicalHistoryTemplateMapper.ProjectToSDto) + .ToListAsync(cancellationToken); + return TypedResults.Ok(list); + } + + // GET:Get An Entity By Id + public async Task GetAsync(Guid id, IRepositoryWrapper repositoryWrapper, + CancellationToken cancellationToken) + => TypedResults.Ok(await repositoryWrapper.SetRepository() + .GetByIdAsync(cancellationToken, id)); + + // POST:Add New Entity + public virtual async Task Post([FromBody] MedicalHistoryTemplateLDto dto, IRepositoryWrapper repositoryWrapper,ICurrentUserService currentUserService, CancellationToken cancellationToken) + { + if (!Guid.TryParse(currentUserService.UserId, out Guid userId)) + throw new AppException("توکن غیرمجاز", ApiResultStatusCode.UnAuthorized); + var ent = MedicalHistoryTemplate.Create(dto.ChiefComplaint,dto.SectionId, userId); + foreach (var question in dto.Questions) + ent.AddQuestion(question.Question, question.Part, question.QuestionType); + repositoryWrapper.SetRepository().Add(ent); + await repositoryWrapper.SaveChangesAsync(cancellationToken); + return TypedResults.Ok(); + } + + // PUT:Update Entity + public virtual async Task Put([FromBody] MedicalHistoryTemplateLDto dto, IRepositoryWrapper repositoryWrapper,ICurrentUserService currentUserService, CancellationToken cancellationToken) + { + if (!Guid.TryParse(currentUserService.UserId, out Guid userId)) + throw new AppException("توکن غیرمجاز", ApiResultStatusCode.UnAuthorized); + var ent = MedicalHistoryTemplate.Create(dto.ChiefComplaint, dto.SectionId, userId); + ent.Id = dto.Id; + repositoryWrapper.SetRepository().Update(ent); + await repositoryWrapper.SaveChangesAsync(cancellationToken); + return TypedResults.Ok(); + } + + // DELETE:Delete Entity + public virtual async Task Delete(int id, IRepositoryWrapper repositoryWrapper, CancellationToken cancellationToken) + { + var ent = await repositoryWrapper.SetRepository().GetByIdAsync(cancellationToken, id); + repositoryWrapper.SetRepository().Delete(ent); + await repositoryWrapper.SaveChangesAsync(cancellationToken); + return TypedResults.Ok(); + } +} \ No newline at end of file diff --git a/DocuMed.Api/Controllers/SectionController.cs b/DocuMed.Api/Controllers/SectionController.cs index 2e96434..dcad33d 100644 --- a/DocuMed.Api/Controllers/SectionController.cs +++ b/DocuMed.Api/Controllers/SectionController.cs @@ -5,8 +5,7 @@ public class SectionController : ICarterModule { public virtual void AddRoutes(IEndpointRouteBuilder app) { - var group = app.NewVersionedApi("Section").MapGroup($"api/section") - .RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser()); + var group = app.NewVersionedApi("Section").MapGroup($"api/section"); group.MapGet("", GetAllAsync) .WithDisplayName("GetAll") diff --git a/DocuMed.Api/Controllers/UniversityController.cs b/DocuMed.Api/Controllers/UniversityController.cs index 6fca9f0..38381eb 100644 --- a/DocuMed.Api/Controllers/UniversityController.cs +++ b/DocuMed.Api/Controllers/UniversityController.cs @@ -6,8 +6,7 @@ public class UniversityController : ICarterModule public virtual void AddRoutes(IEndpointRouteBuilder app) { var group = app.NewVersionedApi("University") - .MapGroup($"api/university") - .RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser()); + .MapGroup($"api/university"); group.MapGet("", GetAllAsync) .WithDisplayName("GetAll") diff --git a/DocuMed.Api/DocuMed.Api.csproj b/DocuMed.Api/DocuMed.Api.csproj index 5e11120..3f7fe52 100644 --- a/DocuMed.Api/DocuMed.Api.csproj +++ b/DocuMed.Api/DocuMed.Api.csproj @@ -74,6 +74,7 @@ + diff --git a/DocuMed.Domain/Dtos/LargDtos/MedicalHistoryLDto.cs b/DocuMed.Domain/Dtos/LargDtos/MedicalHistoryLDto.cs index be9f5d6..85bd693 100644 --- a/DocuMed.Domain/Dtos/LargDtos/MedicalHistoryLDto.cs +++ b/DocuMed.Domain/Dtos/LargDtos/MedicalHistoryLDto.cs @@ -28,6 +28,7 @@ public class MedicalHistoryLDto : BaseDto public int PulseRate { get; set; } public int SPO2 { get; set; } public int Temperature { get; set; } + public Guid ApplicationUserId { get; set; } public List Answers { get; set; } = new(); } \ No newline at end of file diff --git a/DocuMed.Domain/Dtos/LargDtos/MedicalHistoryTemplateLDto.cs b/DocuMed.Domain/Dtos/LargDtos/MedicalHistoryTemplateLDto.cs index c2ee3d5..2e313f7 100644 --- a/DocuMed.Domain/Dtos/LargDtos/MedicalHistoryTemplateLDto.cs +++ b/DocuMed.Domain/Dtos/LargDtos/MedicalHistoryTemplateLDto.cs @@ -5,5 +5,6 @@ public class MedicalHistoryTemplateLDto : BaseDto Questions { get; set; } = new(); } \ No newline at end of file diff --git a/DocuMed.Domain/Dtos/SmallDtos/MedicalHistorySDto.cs b/DocuMed.Domain/Dtos/SmallDtos/MedicalHistorySDto.cs index 578daf1..01a4cdd 100644 --- a/DocuMed.Domain/Dtos/SmallDtos/MedicalHistorySDto.cs +++ b/DocuMed.Domain/Dtos/SmallDtos/MedicalHistorySDto.cs @@ -29,4 +29,5 @@ public class MedicalHistorySDto : BaseDto public int SPO2 { get; set; } public int Temperature { get; set; } public string FullName => FirstName + " " + LastName; + public Guid ApplicationUserId { get; set; } } \ No newline at end of file diff --git a/DocuMed.Domain/Dtos/SmallDtos/MedicalHistoryTemplateSDto.cs b/DocuMed.Domain/Dtos/SmallDtos/MedicalHistoryTemplateSDto.cs index e13d2c6..e57ddab 100644 --- a/DocuMed.Domain/Dtos/SmallDtos/MedicalHistoryTemplateSDto.cs +++ b/DocuMed.Domain/Dtos/SmallDtos/MedicalHistoryTemplateSDto.cs @@ -4,4 +4,5 @@ public class MedicalHistoryTemplateSDto : BaseDto Answers { get; internal set; } = new(); } \ No newline at end of file diff --git a/DocuMed.Domain/Entities/MedicalHistoryTemplate/MedicalHistoryTemplate.Aggregate.cs b/DocuMed.Domain/Entities/MedicalHistoryTemplate/MedicalHistoryTemplate.Aggregate.cs index afff216..5d2b41c 100644 --- a/DocuMed.Domain/Entities/MedicalHistoryTemplate/MedicalHistoryTemplate.Aggregate.cs +++ b/DocuMed.Domain/Entities/MedicalHistoryTemplate/MedicalHistoryTemplate.Aggregate.cs @@ -24,8 +24,8 @@ public partial class MedicalHistoryTemplate return mhQuestion; } - public static MedicalHistoryTemplate Create(string chiefComplaint) + public static MedicalHistoryTemplate Create(string chiefComplaint,Guid sectionId,Guid applicationUserId) { - return new MedicalHistoryTemplate(chiefComplaint); + return new MedicalHistoryTemplate(chiefComplaint, sectionId, applicationUserId); } } \ No newline at end of file diff --git a/DocuMed.Domain/Entities/MedicalHistoryTemplate/MedicalHistoryTemplate.cs b/DocuMed.Domain/Entities/MedicalHistoryTemplate/MedicalHistoryTemplate.cs index 6e1cd5e..4fc31c8 100644 --- a/DocuMed.Domain/Entities/MedicalHistoryTemplate/MedicalHistoryTemplate.cs +++ b/DocuMed.Domain/Entities/MedicalHistoryTemplate/MedicalHistoryTemplate.cs @@ -12,12 +12,16 @@ public partial class MedicalHistoryTemplate : ApiEntity { } - public MedicalHistoryTemplate(string chiefComplaint) + public MedicalHistoryTemplate(string chiefComplaint,Guid sectionId,Guid applicationUserId) { ChiefComplaint = chiefComplaint; + SectionId = sectionId; + ApplicationUserId = applicationUserId; } public string ChiefComplaint { get; internal set; } = string.Empty; public Guid SectionId { get; set; } + public Guid ApplicationUserId { get; internal set; } + public ApplicationUser? ApplicationUser { get; set; } public List Questions { get; internal set; } = new(); } \ No newline at end of file diff --git a/DocuMed.Domain/Enums/MedicalHistoryQuestionType.cs b/DocuMed.Domain/Enums/MedicalHistoryQuestionType.cs index 10eb424..abe61b9 100644 --- a/DocuMed.Domain/Enums/MedicalHistoryQuestionType.cs +++ b/DocuMed.Domain/Enums/MedicalHistoryQuestionType.cs @@ -7,5 +7,7 @@ public enum MedicalHistoryQuestionType [Display(Name = "پرسش و پاسخ")] Interrogatively, [Display(Name = "بله و خیر")] - YesOrNo + YesOrNo, + [Display(Name = "انتخابی")] + Selective } \ No newline at end of file diff --git a/DocuMed.Domain/Mappers/CityMapper.g.cs b/DocuMed.Domain/Mappers/CityMapper.g.cs index 9003355..2f705c9 100644 --- a/DocuMed.Domain/Mappers/CityMapper.g.cs +++ b/DocuMed.Domain/Mappers/CityMapper.g.cs @@ -31,7 +31,7 @@ namespace DocuMed.Domain.Mappers return result; } - public static Expression> ProjectToCity => p4 => new City() + public static Expression> ProjectLDtoToCity => p4 => new City() { Name = p4.Name, Id = p4.Id @@ -85,7 +85,7 @@ namespace DocuMed.Domain.Mappers return result; } - public static Expression> ProjectLDtoToCity => p15 => new City() + public static Expression> ProjectToCity => p15 => new City() { Name = p15.Name, Universities = p15.Universities.Select(p16 => new University() diff --git a/DocuMed.Domain/Mappers/MedicalHistoryMapper.g.cs b/DocuMed.Domain/Mappers/MedicalHistoryMapper.g.cs index 2f98f28..df9f6bb 100644 --- a/DocuMed.Domain/Mappers/MedicalHistoryMapper.g.cs +++ b/DocuMed.Domain/Mappers/MedicalHistoryMapper.g.cs @@ -36,6 +36,7 @@ namespace DocuMed.Domain.Mappers PulseRate = p1.PulseRate, SPO2 = p1.SPO2, Temperature = p1.Temperature, + ApplicationUserId = p1.ApplicationUserId, Id = p1.Id }; } @@ -69,6 +70,7 @@ namespace DocuMed.Domain.Mappers result.PulseRate = p2.PulseRate; result.SPO2 = p2.SPO2; result.Temperature = p2.Temperature; + result.ApplicationUserId = p2.ApplicationUserId; result.Id = p2.Id; return result; @@ -97,6 +99,7 @@ namespace DocuMed.Domain.Mappers PulseRate = p4.PulseRate, SPO2 = p4.SPO2, Temperature = p4.Temperature, + ApplicationUserId = p4.ApplicationUserId, Id = p4.Id }; public static MedicalHistorySDto AdaptToSDto(this MedicalHistory p5) @@ -125,6 +128,7 @@ namespace DocuMed.Domain.Mappers PulseRate = p5.PulseRate, SPO2 = p5.SPO2, Temperature = p5.Temperature, + ApplicationUserId = p5.ApplicationUserId, Id = p5.Id }; } @@ -158,6 +162,7 @@ namespace DocuMed.Domain.Mappers result.PulseRate = p6.PulseRate; result.SPO2 = p6.SPO2; result.Temperature = p6.Temperature; + result.ApplicationUserId = p6.ApplicationUserId; result.Id = p6.Id; return result; @@ -186,6 +191,7 @@ namespace DocuMed.Domain.Mappers PulseRate = p8.PulseRate, SPO2 = p8.SPO2, Temperature = p8.Temperature, + ApplicationUserId = p8.ApplicationUserId, Id = p8.Id }; public static MedicalHistory AdaptToMedicalHistory(this MedicalHistoryLDto p9) @@ -214,6 +220,7 @@ namespace DocuMed.Domain.Mappers PulseRate = p9.PulseRate, SPO2 = p9.SPO2, Temperature = p9.Temperature, + ApplicationUserId = p9.ApplicationUserId, Answers = funcMain1(p9.Answers), Id = p9.Id }; @@ -248,6 +255,7 @@ namespace DocuMed.Domain.Mappers result.PulseRate = p11.PulseRate; result.SPO2 = p11.SPO2; result.Temperature = p11.Temperature; + result.ApplicationUserId = p11.ApplicationUserId; result.Answers = funcMain2(p11.Answers, result.Answers); result.Id = p11.Id; return result; @@ -277,6 +285,7 @@ namespace DocuMed.Domain.Mappers PulseRate = p15.PulseRate, SPO2 = p15.SPO2, Temperature = p15.Temperature, + ApplicationUserId = p15.ApplicationUserId, Answers = p15.Answers.Select(p16 => new MedicalHistoryAnswer() { Answer = p16.Answer, @@ -314,6 +323,7 @@ namespace DocuMed.Domain.Mappers PulseRate = p17.PulseRate, SPO2 = p17.SPO2, Temperature = p17.Temperature, + ApplicationUserId = p17.ApplicationUserId, Answers = funcMain3(p17.Answers), Id = p17.Id }; @@ -348,6 +358,7 @@ namespace DocuMed.Domain.Mappers result.PulseRate = p19.PulseRate; result.SPO2 = p19.SPO2; result.Temperature = p19.Temperature; + result.ApplicationUserId = p19.ApplicationUserId; result.Answers = funcMain4(p19.Answers, result.Answers); result.Id = p19.Id; return result; @@ -377,6 +388,7 @@ namespace DocuMed.Domain.Mappers PulseRate = p23.PulseRate, SPO2 = p23.SPO2, Temperature = p23.Temperature, + ApplicationUserId = p23.ApplicationUserId, Answers = p23.Answers.Select(p24 => new MedicalHistoryAnswerSDto() { Answer = p24.Answer, diff --git a/DocuMed.Domain/Mappers/MedicalHistoryTemplateMapper.g.cs b/DocuMed.Domain/Mappers/MedicalHistoryTemplateMapper.g.cs index 1a2a3bf..ed7044f 100644 --- a/DocuMed.Domain/Mappers/MedicalHistoryTemplateMapper.g.cs +++ b/DocuMed.Domain/Mappers/MedicalHistoryTemplateMapper.g.cs @@ -16,6 +16,7 @@ namespace DocuMed.Domain.Mappers { ChiefComplaint = p1.ChiefComplaint, SectionId = p1.SectionId, + ApplicationUserId = p1.ApplicationUserId, Id = p1.Id }; } @@ -29,6 +30,7 @@ namespace DocuMed.Domain.Mappers result.ChiefComplaint = p2.ChiefComplaint; result.SectionId = p2.SectionId; + result.ApplicationUserId = p2.ApplicationUserId; result.Id = p2.Id; return result; @@ -37,6 +39,7 @@ namespace DocuMed.Domain.Mappers { ChiefComplaint = p4.ChiefComplaint, SectionId = p4.SectionId, + ApplicationUserId = p4.ApplicationUserId, Id = p4.Id }; public static MedicalHistoryTemplateSDto AdaptToSDto(this MedicalHistoryTemplate p5) @@ -45,6 +48,7 @@ namespace DocuMed.Domain.Mappers { ChiefComplaint = p5.ChiefComplaint, SectionId = p5.SectionId, + ApplicationUserId = p5.ApplicationUserId, Id = p5.Id }; } @@ -58,6 +62,7 @@ namespace DocuMed.Domain.Mappers result.ChiefComplaint = p6.ChiefComplaint; result.SectionId = p6.SectionId; + result.ApplicationUserId = p6.ApplicationUserId; result.Id = p6.Id; return result; @@ -66,6 +71,7 @@ namespace DocuMed.Domain.Mappers { ChiefComplaint = p8.ChiefComplaint, SectionId = p8.SectionId, + ApplicationUserId = p8.ApplicationUserId, Id = p8.Id }; public static MedicalHistoryTemplate AdaptToMedicalHistoryTemplate(this MedicalHistoryTemplateLDto p9) @@ -74,6 +80,7 @@ namespace DocuMed.Domain.Mappers { ChiefComplaint = p9.ChiefComplaint, SectionId = p9.SectionId, + ApplicationUserId = p9.ApplicationUserId, Questions = funcMain1(p9.Questions), Id = p9.Id }; @@ -88,6 +95,7 @@ namespace DocuMed.Domain.Mappers result.ChiefComplaint = p11.ChiefComplaint; result.SectionId = p11.SectionId; + result.ApplicationUserId = p11.ApplicationUserId; result.Questions = funcMain2(p11.Questions, result.Questions); result.Id = p11.Id; return result; @@ -97,6 +105,7 @@ namespace DocuMed.Domain.Mappers { ChiefComplaint = p15.ChiefComplaint, SectionId = p15.SectionId, + ApplicationUserId = p15.ApplicationUserId, Questions = p15.Questions.Select(p16 => new MedicalHistoryQuestion() { Question = p16.Question, @@ -113,6 +122,7 @@ namespace DocuMed.Domain.Mappers { ChiefComplaint = p17.ChiefComplaint, SectionId = p17.SectionId, + ApplicationUserId = p17.ApplicationUserId, Questions = funcMain3(p17.Questions), Id = p17.Id }; @@ -127,6 +137,7 @@ namespace DocuMed.Domain.Mappers result.ChiefComplaint = p19.ChiefComplaint; result.SectionId = p19.SectionId; + result.ApplicationUserId = p19.ApplicationUserId; result.Questions = funcMain4(p19.Questions, result.Questions); result.Id = p19.Id; return result; @@ -136,6 +147,7 @@ namespace DocuMed.Domain.Mappers { ChiefComplaint = p23.ChiefComplaint, SectionId = p23.SectionId, + ApplicationUserId = p23.ApplicationUserId, Questions = p23.Questions.Select(p24 => new MedicalHistoryQuestionSDto() { Question = p24.Question, diff --git a/DocuMed.PWA/DocuMed.PWA.csproj b/DocuMed.PWA/DocuMed.PWA.csproj index d30084d..da101f5 100644 --- a/DocuMed.PWA/DocuMed.PWA.csproj +++ b/DocuMed.PWA/DocuMed.PWA.csproj @@ -42,6 +42,7 @@ + @@ -54,6 +55,7 @@ + diff --git a/DocuMed.PWA/Models/Address.cs b/DocuMed.PWA/Models/Address.cs index f4ab926..eb3eaae 100644 --- a/DocuMed.PWA/Models/Address.cs +++ b/DocuMed.PWA/Models/Address.cs @@ -8,4 +8,5 @@ public static class Address public const string UniversityController = $"{BaseAddress}/university"; public const string SectionController = $"{BaseAddress}/section"; public const string UserController = $"{BaseAddress}/user"; + public const string MedicalHistoryTemplateController = $"{BaseAddress}/medicalhistory/template"; } \ No newline at end of file diff --git a/DocuMed.PWA/Models/BaseViewModel.cs b/DocuMed.PWA/Models/BaseViewModel.cs index d245385..7f8eb55 100644 --- a/DocuMed.PWA/Models/BaseViewModel.cs +++ b/DocuMed.PWA/Models/BaseViewModel.cs @@ -7,6 +7,24 @@ public class BaseViewModel public virtual void Initialize() { + } + public virtual Task InitializeAsync() + { + return Task.CompletedTask; + } +} + +public class BaseViewModel +{ + public bool IsProcessing { get; set; } = false; + public TPageDto PageDto { get; set; } + public BaseViewModel() + { + PageDto = Activator.CreateInstance(); + } + public virtual void Initialize() + { + } public virtual Task InitializeAsync() { diff --git a/DocuMed.PWA/Pages/Index.razor b/DocuMed.PWA/Pages/Index.razor index 9145c2a..281df96 100644 --- a/DocuMed.PWA/Pages/Index.razor +++ b/DocuMed.PWA/Pages/Index.razor @@ -11,9 +11,9 @@ } /* .secondary-border>.mud-input-control-input-container>.mud-input.mud-input-outlined>input:focus~.mud-input-outlined-border { - border-color: #FD5523; - color: white; - } */ + border-color: #FD5523; + color: white; + } */
@@ -150,12 +150,12 @@

- - - + + - - + @@ -218,13 +218,30 @@ private bool _isProcessing = false; private SignUpStatus _signUpStatus; + protected override async Task OnInitializedAsync() + { + var token = await UserUtility.GetBearerTokenAsync(); + if (!token.IsNullOrEmpty()) + { + var user = await UserUtility.GetUserAsync(); + if (user.SignUpStatus == SignUpStatus.SignUpCompleted) + NavigationManager.NavigateTo("HomePage"); + if(user.SignUpStatus==SignUpStatus.PhoneNumberVerified) + { + _phoneNumber = user.PhoneNumber; + _currentSignOnStep = 2; + _carousel?.MoveTo(_currentSignOnStep); + } + } + await base.OnInitializedAsync(); + } private async Task ConfirmPhoneNumber() { try { _confirmPhoneNumberForm?.Validate(); - if (_confirmPhoneNumberForm is {IsValid: true }) + if (_confirmPhoneNumberForm is { IsValid: true }) { _isProcessing = true; _signUpStatus = await RestWrapper.AuthRestApi.GetVerifyCodeAsync(_phoneNumber); @@ -247,7 +264,7 @@ _isProcessing = false; } } - private async Task ConfirmVerifyCode() + private async Task ConfirmVerifyCode() { try { @@ -281,14 +298,13 @@ { _carousel?.MoveTo(--_currentSignOnStep); } - private async Task ConfirmSignUp() { try { _confirmSignUpForm?.Validate(); - if (_confirmSignUpForm is {IsValid:true}) + if (_confirmSignUpForm is { IsValid: true }) { _isProcessing = true; _signUpRequest.CityId = _selectedCity.Id; @@ -345,7 +361,6 @@ return _cities; } } - private async Task> SearchUniversity(string uni) { try diff --git a/DocuMed.PWA/Pages/MedicalHistoryTemplateActionPage.razor b/DocuMed.PWA/Pages/MedicalHistoryTemplateActionPage.razor index 21fc452..f185ac4 100644 --- a/DocuMed.PWA/Pages/MedicalHistoryTemplateActionPage.razor +++ b/DocuMed.PWA/Pages/MedicalHistoryTemplateActionPage.razor @@ -1,88 +1,96 @@ @page "/MedicalHistoryTemplateActionPage" +@page "/MedicalHistoryTemplateActionPage/{TemplateId:string}" @inject NavigationManager NavigationManager +@inject IRestWrapper RestWrapper +@inject IUserUtility UserUtility +@inject ISnackbar Snackbar
- +
- +
- +
- +
- +
- +
- +
- @if(!medicalHistorySubmited){ - - - @if (_currentStep == 4) + @if (!@ViewModel.MedicalHistorySubmitted) + { + if (@ViewModel.IsProcessing) { - تـــکمیل + + +
+ +

منتظر بمانید

+
+ +
} else { - - مرحله بعد - - } + -

@_stepCounter

- مرحله قبل -
+ @if (@ViewModel.CurrentStep == 4) + { + تـــکمیل + } + else + { + + مرحله بعد + + } + +

@ViewModel.StepCounter

+ مرحله قبل +
+ } }
@code { - private MudCarousel? _carousel; - private int _currentStep = 0; - private string _stepCounter = "1 / 5"; - private bool medicalHistorySubmited = false; - private void CompleteStepClicked() + [Parameter] + public string TemplateId { get; set; } + public MedicalHistoryTemplateActionPageViewModel ViewModel { get; set; } + protected override async Task OnInitializedAsync() { - _carousel?.MoveTo(++_currentStep); - _stepCounter = string.Format("{0} / 5", _currentStep + 1); - if (_currentStep == 5) - medicalHistorySubmited = true; - } - private void RollBackStepClicked() - { - _carousel?.MoveTo(--_currentStep); - _stepCounter = string.Format("{0} / 5", _currentStep + 1); + ViewModel = new MedicalHistoryTemplateActionPageViewModel(NavigationManager,Snackbar,RestWrapper,UserUtility); + await ViewModel.InitializeAsync(); + await base.OnInitializedAsync(); } - private void CompleteCreateMedicalHistory() - { - NavigationManager.NavigateTo("HomePage"); - } } \ No newline at end of file diff --git a/DocuMed.PWA/Pages/MedicalHistoryTemplateActionPage.razor.cs b/DocuMed.PWA/Pages/MedicalHistoryTemplateActionPage.razor.cs index 5383710..3f01866 100644 --- a/DocuMed.PWA/Pages/MedicalHistoryTemplateActionPage.razor.cs +++ b/DocuMed.PWA/Pages/MedicalHistoryTemplateActionPage.razor.cs @@ -1,6 +1,118 @@ namespace DocuMed.PWA.Pages; -public class MedicalHistoryTemplateActionPageViewModel : BaseViewModel +public class MedicalHistoryTemplateActionPageViewModel : BaseViewModel { + private readonly NavigationManager _navigationManager; + private readonly ISnackbar _snackbar; + private readonly IRestWrapper _restWrapper; + private readonly IUserUtility _userUtility; + private readonly Guid _templateId; + public MudCarousel? Carousel { get; set; } + public bool MedicalHistorySubmitted { get; set; } + public int CurrentStep { get; set; } = 0; + public string StepCounter { get; set; } = "1 / 5"; + public bool IsEditing { get; set; } = false; + + public List PiQuestions { get; set; } = new(); + public List PdhQuestions { get; set; } = new(); + public List PshQuestions { get; set; } = new(); + public List FhQuestions { get; set; } = new(); + public List DhQuestions { get; set; } = new(); + public List AhQuestions { get; set; } = new(); + public List VsQuestions { get; set; } = new(); + public SectionSDto? SelectedSelection { get; set; } + + + + public MedicalHistoryTemplateActionPageViewModel( + NavigationManager navigationManager, + ISnackbar snackbar, + IRestWrapper restWrapper, + IUserUtility userUtility) + { + _navigationManager = navigationManager; + _snackbar = snackbar; + _restWrapper = restWrapper; + _userUtility = userUtility; + } + + public MedicalHistoryTemplateActionPageViewModel( + NavigationManager navigationManager, + ISnackbar snackbar, + IRestWrapper restWrapper, + IUserUtility userUtility, + Guid templateId) + { + _navigationManager = navigationManager; + _snackbar = snackbar; + _restWrapper = restWrapper; + _userUtility = userUtility; + _templateId = templateId; + IsEditing = true; + } + + public override Task InitializeAsync() + { + return base.InitializeAsync(); + } + + public async Task CompleteStepClicked() + { + Carousel?.MoveTo(++CurrentStep); + StepCounter = $"{CurrentStep + 1} / 5"; + if (CurrentStep == 5) + { + MedicalHistorySubmitted = true; + await SubmitTemplateAsync(); + } + } + + public async Task SubmitTemplateAsync() + { + try + { + IsProcessing = true; + if (SelectedSelection == null) + throw new Exception("لطفا بخش مورد نظر را انتخاب نمایید"); + PageDto.SectionId = SelectedSelection.Id; + var token = await _userUtility.GetBearerTokenAsync(); + PageDto.SectionId = SelectedSelection.Id; + PageDto.Questions.AddRange(PiQuestions); + PageDto.Questions.AddRange(PdhQuestions); + PageDto.Questions.AddRange(PiQuestions); + PageDto.Questions.AddRange(PshQuestions); + PageDto.Questions.AddRange(FhQuestions); + PageDto.Questions.AddRange(DhQuestions); + PageDto.Questions.AddRange(AhQuestions); + PageDto.Questions.AddRange(VsQuestions); + await _restWrapper.CrudDtoApiRest(Address.MedicalHistoryTemplateController) + .Create(PageDto, token); + + } + catch (ApiException ex) + { + var exe = await ex.GetContentAsAsync(); + _snackbar.Add(exe != null ? exe.Message : ex.Content, Severity.Error); + } + catch (Exception e) + { + _snackbar.Add(e.Message, Severity.Error); + } + finally + { + + IsProcessing = false; + } + } + public void RollBackStepClicked() + { + Carousel?.MoveTo(--CurrentStep); + StepCounter = $"{CurrentStep + 1} / 5"; + } + + public void SubmitCreateTemplateAsync() + { + _navigationManager.NavigateTo("HomePage"); + } } \ No newline at end of file diff --git a/DocuMed.PWA/Pages/MedicalHistoryTemplateActionParts/MedicalHistoryTemplateActionStep1.razor b/DocuMed.PWA/Pages/MedicalHistoryTemplateActionParts/MedicalHistoryTemplateActionStep1.razor index c0ed2e0..7871958 100644 --- a/DocuMed.PWA/Pages/MedicalHistoryTemplateActionParts/MedicalHistoryTemplateActionStep1.razor +++ b/DocuMed.PWA/Pages/MedicalHistoryTemplateActionParts/MedicalHistoryTemplateActionStep1.razor @@ -1,13 +1,70 @@ +@inject IRestWrapper RestWrapper +@inject IUserUtility UserUtility

افزودن پیش نویس شرح حال جدید

-

لورم ایپسوم متن ساختگی با تولید سادگی نامفهوم از صنعت چاپ و با استفاده از +

+ لورم ایپسوم متن ساختگی با تولید سادگی نامفهوم از صنعت چاپ و با استفاده از طراحان گرافیک است چاپگرها و متون بلکه روزنامه و مجله در ستون و سطرآنچنان که لازم است و برای شرایط فعلی تکنولوژی - مورد ده

+ مورد ده +

- - + + + + + + +
+ +

منتظر بمانید

+
+
+
+
+ +

@e.Name

+
+
@code { + [Parameter] + public string ChiefComplaint { get; set; } = string.Empty; + [Parameter] + public EventCallback ChiefComplaintChanged { get; set; } + + [Parameter] + public SectionSDto SelectedSection { get; set; } = new(); + [Parameter] + public EventCallback SelectedSectionChanged { get; set; } + + public List Sections { get; private set; } = new List(); + + public async Task> SearchSection(string section) + { + try + { + var token = await UserUtility.GetBearerTokenAsync(); + var user = await UserUtility.GetUserAsync(); + Sections = await RestWrapper.SectionRestApi.GetByUniversityAsync(user.UniversityId, token); + + if (section.IsNullOrEmpty()) + return Sections; + return Sections.Where(c => c.Name.Contains(section)); + } + catch (ApiException ex) + { + var exe = await ex.GetContentAsAsync(); + return Sections; + } + catch (Exception e) + { + return Sections; + } + } + } \ No newline at end of file diff --git a/DocuMed.PWA/Pages/MedicalHistoryTemplateActionParts/MedicalHistoryTemplateActionStep2.razor b/DocuMed.PWA/Pages/MedicalHistoryTemplateActionParts/MedicalHistoryTemplateActionStep2.razor index ef2a527..e62078e 100644 --- a/DocuMed.PWA/Pages/MedicalHistoryTemplateActionParts/MedicalHistoryTemplateActionStep2.razor +++ b/DocuMed.PWA/Pages/MedicalHistoryTemplateActionParts/MedicalHistoryTemplateActionStep2.razor @@ -4,7 +4,7 @@ شما میتوانید سوال های هر بخش ها را به صورت کامل تنظیم نمایید - @foreach (var item in Questions) + @foreach (var item in PiQuestions) { } @@ -34,15 +34,21 @@ private string _questionTitle = string.Empty; private MedicalHistoryPart _questionPart = MedicalHistoryPart.PresentIllness; + [Parameter] + public List PiQuestions { get; set; } = new(); - public List Questions { get; set; } = new(); - - private void RemoveQuestion(MedicalHistoryQuestion question) + private void RemoveQuestion(MedicalHistoryQuestionSDto question) { - Questions.Remove(question); + PiQuestions.Remove(question); } private void AddQuestion() { - Questions.Add(MedicalHistoryQuestion.Create(_questionTitle,_questionPart,_questionType,Guid.Empty)); + PiQuestions.Add(new MedicalHistoryQuestionSDto + { + Part = _questionPart, + Question = _questionTitle, + QuestionType = _questionType + }); + _questionTitle = string.Empty; } } \ No newline at end of file diff --git a/DocuMed.PWA/Pages/MedicalHistoryTemplateActionParts/MedicalHistoryTemplateActionStep3.razor b/DocuMed.PWA/Pages/MedicalHistoryTemplateActionParts/MedicalHistoryTemplateActionStep3.razor index cf83bf8..08e0f8a 100644 --- a/DocuMed.PWA/Pages/MedicalHistoryTemplateActionParts/MedicalHistoryTemplateActionStep3.razor +++ b/DocuMed.PWA/Pages/MedicalHistoryTemplateActionParts/MedicalHistoryTemplateActionStep3.razor @@ -3,48 +3,49 @@ - @foreach (var item in PIQuestions) + @foreach (var item in PdhQuestions) { - + } - + - - + افزودن - @foreach (var item in PIQuestions) + @foreach (var item in PshQuestions) { - + } - - - + افزودن @@ -54,37 +55,45 @@ @code { - private string _piQuestionTitle = string.Empty; - private MedicalHistoryQuestionType _piQuestionType; + [Parameter] + public List PdhQuestions { get; set; } = new(); + [Parameter] + public List PshQuestions { get; set; } = new(); + + + private string _pdhQuestionTitle = string.Empty; + private MedicalHistoryQuestionType _pdhQuestionType; private string _pshQuestionTitle = string.Empty; private MedicalHistoryQuestionType _pshQuestionType; - public List PIQuestions { get; set; } = new(); - public List PSHQuestions { get; set; } = new(); - private void RemovePIQuestion(MedicalHistoryQuestion question) + private void RemovePiQuestion(MedicalHistoryQuestionSDto question) { - PIQuestions.Remove(question); + PdhQuestions.Remove(question); } - private void AddPIQuestion() + private void AddPiQuestion() { - // PIQuestions.Add(new MedicalHistoryQuestion - // { - // Title = _piQuestionTitle, - // Type = _piQuestionType - // }); + PdhQuestions.Add(new MedicalHistoryQuestionSDto + { + QuestionType = _pdhQuestionType, + Part = MedicalHistoryPart.PastDiseasesHistory, + Question = _pdhQuestionTitle + }); + _pdhQuestionTitle = string.Empty; } - private void RemovePSHQuestion(MedicalHistoryQuestion question) + private void RemovePshQuestion(MedicalHistoryQuestionSDto question) { - PSHQuestions.Remove(question); + PshQuestions.Remove(question); } - private void AddPSHQuestion() + private void AddPshQuestion() { - // PSHQuestions.Add(new MedicalHistoryQuestion - // { - // Title = _pshQuestionTitle, - // Type = _pshQuestionType - // }); + PshQuestions.Add(new MedicalHistoryQuestionSDto + { + Part = MedicalHistoryPart.PastSurgeryHistory, + QuestionType = _pshQuestionType, + Question = _pshQuestionTitle + }); + _pshQuestionTitle = string.Empty; } } \ No newline at end of file diff --git a/DocuMed.PWA/Pages/MedicalHistoryTemplateActionParts/MedicalHistoryTemplateActionStep4.razor b/DocuMed.PWA/Pages/MedicalHistoryTemplateActionParts/MedicalHistoryTemplateActionStep4.razor index e287cb6..1db9548 100644 --- a/DocuMed.PWA/Pages/MedicalHistoryTemplateActionParts/MedicalHistoryTemplateActionStep4.razor +++ b/DocuMed.PWA/Pages/MedicalHistoryTemplateActionParts/MedicalHistoryTemplateActionStep4.razor @@ -7,7 +7,8 @@ } - + @@ -29,7 +30,7 @@ { -

@item

+

@item.Question

} @@ -46,11 +47,11 @@
- @foreach (var item in HHMedicines) + @foreach (var item in AhMedicines) { - + -

@item

+

@item.Question

} @@ -59,7 +60,7 @@
- + +
@@ -70,45 +71,58 @@ @code { private string _familyHistoryQuestionTitle = string.Empty; private MedicalHistoryQuestionType _familyHistoryQuestionType; - - public List FamilyHistories { get; set; } = new(); - - private void RemoveFamilyHistory(MedicalHistoryQuestion question) + [Parameter] + public List FamilyHistories { get; set; } = new(); + private void RemoveFamilyHistory(MedicalHistoryQuestionSDto question) { FamilyHistories.Remove(question); } private void AddFamilyHistory() { - // FamilyHistories.Add(new MedicalHistoryQuestion - // { - // Title = _familyHistoryQuestionTitle, - // Type = _familyHistoryQuestionType - // }); + FamilyHistories.Add(new MedicalHistoryQuestionSDto + { + Question = _familyHistoryQuestionTitle, + QuestionType = _familyHistoryQuestionType, + Part = MedicalHistoryPart.FamilyHistory + }); + _familyHistoryQuestionTitle = String.Empty; } private string _drugHistoryName = string.Empty; - public List DrugHistories { get; set; } = new(); - private void RemoveDrugHistory(string medicine) + [Parameter] + public List DrugHistories { get; set; } = new(); + private void RemoveDrugHistory(MedicalHistoryQuestionSDto medicine) { DrugHistories.Remove(medicine); } private void AddDrugHistory() { - DrugHistories.Add(_drugHistoryName); + DrugHistories.Add(new MedicalHistoryQuestionSDto + { + Question = _drugHistoryName, + QuestionType = MedicalHistoryQuestionType.Selective, + Part = MedicalHistoryPart.DrugHistory + }); _drugHistoryName = string.Empty; } private string _hhName = string.Empty; - public List HHMedicines { get; set; } = new(); - private void RemoveHHMedicine(string medicine) + [Parameter] + public List AhMedicines { get; set; } = new(); + private void RemoveHhMedicine(MedicalHistoryQuestionSDto medicine) { - HHMedicines.Remove(medicine); + AhMedicines.Remove(medicine); } - private void AddHHMedicine() + private void AddHhMedicine() { - HHMedicines.Add(_hhName); + AhMedicines.Add(new MedicalHistoryQuestionSDto + { + Part = MedicalHistoryPart.AddictionHistory, + Question = _hhName, + QuestionType = MedicalHistoryQuestionType.Selective + }); _hhName = string.Empty; } } \ No newline at end of file diff --git a/DocuMed.PWA/Pages/MedicalHistoryTemplateActionParts/MedicalHistoryTemplateActionStep5.razor b/DocuMed.PWA/Pages/MedicalHistoryTemplateActionParts/MedicalHistoryTemplateActionStep5.razor index a40ce00..4c5df70 100644 --- a/DocuMed.PWA/Pages/MedicalHistoryTemplateActionParts/MedicalHistoryTemplateActionStep5.razor +++ b/DocuMed.PWA/Pages/MedicalHistoryTemplateActionParts/MedicalHistoryTemplateActionStep5.razor @@ -1,18 +1,18 @@
- @foreach (var item in GeneralAppearances) + @foreach (var item in VitalSigns) { -

@item

+

@item.Question

}
- + + @@ -71,24 +71,30 @@ @code { - private string _generalAppearance = string.Empty; - public List GeneralAppearances { get; set; } = new(); - private void RemoveGeneralAppearance(string medicine) + private string _vitalSign = string.Empty; + [Parameter] + public List VitalSigns { get; set; } = new(); + private void RemoveGeneralAppearance(MedicalHistoryQuestionSDto generalAppearance) { - GeneralAppearances.Remove(medicine); + VitalSigns.Remove(generalAppearance); } private void AddGeneralAppearance() { - GeneralAppearances.Add(_generalAppearance); - _generalAppearance = string.Empty; + VitalSigns.Add(new MedicalHistoryQuestionSDto + { + Question = _vitalSign, + QuestionType = MedicalHistoryQuestionType.Selective, + Part = MedicalHistoryPart.VitalSign + }); + _vitalSign = string.Empty; } private string _reviewOfSystemTitle = string.Empty; private string _reviewOfSystemSystem = string.Empty; private bool _reviewOfSystemIsSign; private bool _reviewOfSystemIsSymptom; - public List ReviewOfSystems { get; set; } = new(); - private void RemoveReviewOfSystems(MedicalHistoryQuestion review) + public List ReviewOfSystems { get; set; } = new(); + private void RemoveReviewOfSystems(MedicalHistoryQuestionSDto review) { ReviewOfSystems.Remove(review); } diff --git a/DocuMed.PWA/Pages/MedicalHistoryTemplatesPage.razor b/DocuMed.PWA/Pages/MedicalHistoryTemplatesPage.razor index 202b987..d845910 100644 --- a/DocuMed.PWA/Pages/MedicalHistoryTemplatesPage.razor +++ b/DocuMed.PWA/Pages/MedicalHistoryTemplatesPage.razor @@ -1,37 +1,50 @@ @page "/MedicalHistoryTemplatesPage" @inject NavigationManager NavigationManager +@inject ISnackbar Snackbar +@inject IRestWrapper RestWrapper +@inject IUserUtility UserUtility - +

تمامی پیش نویس های شما

شما میتوانید پیش نویس جدید اضافه کنید

- + افزودن + + افزودن
-
- - @foreach (var item in _medicalHistoryTemplates) +
+ @if (@ViewModel.IsProcessing) { - + @for (int i = 0; i < 4; i++) + { + + + + + } } + else + { + + @foreach (var item in ViewModel.PageDto) + { + + } + } +
@code { - private void CreateMedicalHistoryTemplateClicked() => NavigationManager.NavigateTo("MedicalHistoryTemplateActionPage"); - private void MedicalHistoryTemplateClicked() => NavigationManager.NavigateTo("MedicalHistoryTemplateActionPage"); - private List _medicalHistoryTemplates = new(); - protected override void OnInitialized() + public MedicalHistoryTemplatesPageViewModel ViewModel { get; set; } + protected override async Task OnInitializedAsync() { - _medicalHistoryTemplates.Add(new MedicalHistoryTemplateSDto() - { - ChiefComplaint = "سردرد", - }); - base.OnInitialized(); + ViewModel = new MedicalHistoryTemplatesPageViewModel(NavigationManager, UserUtility, RestWrapper, Snackbar); + await ViewModel.InitializeAsync(); + await base.OnInitializedAsync(); } } diff --git a/DocuMed.PWA/Pages/MedicalHistoryTemplatesPage.razor.cs b/DocuMed.PWA/Pages/MedicalHistoryTemplatesPage.razor.cs new file mode 100644 index 0000000..003ab1f --- /dev/null +++ b/DocuMed.PWA/Pages/MedicalHistoryTemplatesPage.razor.cs @@ -0,0 +1,49 @@ +namespace DocuMed.PWA.Pages; + +public class MedicalHistoryTemplatesPageViewModel : BaseViewModel> +{ + private readonly NavigationManager _navigationManager; + private readonly IUserUtility _userUtility; + private readonly IRestWrapper _restWrapper; + private readonly ISnackbar _snackbar; + + public MedicalHistoryTemplatesPageViewModel(NavigationManager navigationManager,IUserUtility userUtility , IRestWrapper restWrapper,ISnackbar snackbar) + { + _navigationManager = navigationManager; + _userUtility = userUtility; + _restWrapper = restWrapper; + _snackbar = snackbar; + } + public void CreateMedicalHistoryTemplateClicked() => _navigationManager.NavigateTo("MedicalHistoryTemplateActionPage"); + public void MedicalHistoryTemplateClicked(MedicalHistoryTemplateSDto template) => _navigationManager.NavigateTo($"MedicalHistoryTemplateActionPage/{template.Id.ToString()}"); + + public override async Task InitializeAsync() + { + try + { + IsProcessing = true; + await Task.Delay(500); + var token = await _userUtility.GetBearerTokenAsync(); + var list = await _restWrapper + .CrudDtoApiRest( Address.MedicalHistoryTemplateController) + .ReadAll(0, token); + PageDto = list; + + } + catch (ApiException ex) + { + var exe = await ex.GetContentAsAsync(); + _snackbar.Add(exe != null ? exe.Message : ex.Content, Severity.Error); + } + catch (Exception e) + { + _snackbar.Add(e.Message, Severity.Error); + } + finally + { + + IsProcessing = false; + } + await base.InitializeAsync(); + } +} \ No newline at end of file diff --git a/DocuMed.PWA/Pages/ProfilePage.razor b/DocuMed.PWA/Pages/ProfilePage.razor index edde295..4582b95 100644 --- a/DocuMed.PWA/Pages/ProfilePage.razor +++ b/DocuMed.PWA/Pages/ProfilePage.razor @@ -2,6 +2,7 @@ @inject IRestWrapper RestWrapper @inject ISnackbar Snackbar @inject IUserUtility UserUtility +@inject NavigationManager NavigationManager @@ -78,7 +79,8 @@ Variant="Variant.Filled" Color="Color.Primary" /> - +
@@ -93,7 +95,7 @@ protected override async Task OnInitializedAsync() { - ViewModel = new ProfilePageViewModel(UserUtility, RestWrapper, Snackbar); + ViewModel = new ProfilePageViewModel(UserUtility, RestWrapper, Snackbar, NavigationManager); await ViewModel.InitializeAsync(); await base.OnInitializedAsync(); diff --git a/DocuMed.PWA/Pages/ProfilePage.razor.cs b/DocuMed.PWA/Pages/ProfilePage.razor.cs index 7586c5a..4ccdadd 100644 --- a/DocuMed.PWA/Pages/ProfilePage.razor.cs +++ b/DocuMed.PWA/Pages/ProfilePage.razor.cs @@ -5,6 +5,7 @@ namespace DocuMed.PWA.Pages; public class ProfilePageViewModel : BaseViewModel { + private readonly NavigationManager _navigationManager; public IUserUtility UserUtility { get; } public IRestWrapper RestWrapper { get; } public ISnackbar Snackbar { get; } @@ -14,14 +15,15 @@ public class ProfilePageViewModel : BaseViewModel public List Cities { get; private set; } = new List(); public List Universities { get; private set; } = new List(); public List Sections { get; private set; } = new List(); + public SectionSDto? SelectedSection { get; set; } public CitySDto? SelectedCity { get; set; } public UniversitySDto? SelectedUni { get; set; } - public SectionSDto? SelectedSection { get; set; } public readonly string Version = Assembly.GetAssembly(typeof(Program))?.GetName()?.Version?.ToString() ?? string.Empty; - public ProfilePageViewModel(IUserUtility userUtility, IRestWrapper restWrapper, ISnackbar snackbar) + public ProfilePageViewModel(IUserUtility userUtility, IRestWrapper restWrapper, ISnackbar snackbar,NavigationManager navigationManager) { + _navigationManager = navigationManager; UserUtility = userUtility; RestWrapper = restWrapper; Snackbar = snackbar; @@ -87,6 +89,12 @@ public class ProfilePageViewModel : BaseViewModel } } + public async Task LogoutAsync() + { + await UserUtility.LogoutAsync(); + _navigationManager.NavigateTo(""); + } + public async Task> SearchCity(string city) diff --git a/DocuMed.PWA/Shared/ItemTemplates/MedicalHistoryQuestionTemplateItemTemplate.razor b/DocuMed.PWA/Shared/ItemTemplates/MedicalHistoryQuestionTemplateItemTemplate.razor index 040447b..643c9fb 100644 --- a/DocuMed.PWA/Shared/ItemTemplates/MedicalHistoryQuestionTemplateItemTemplate.razor +++ b/DocuMed.PWA/Shared/ItemTemplates/MedicalHistoryQuestionTemplateItemTemplate.razor @@ -15,9 +15,9 @@ @code { [Parameter] - public MedicalHistoryQuestion Question { get; set; } = new MedicalHistoryQuestion(); + public MedicalHistoryQuestionSDto Question { get; set; } = new MedicalHistoryQuestionSDto(); [Parameter] - public EventCallback QuestionRemoved { get; set; } + public EventCallback QuestionRemoved { get; set; } } diff --git a/DocuMed.PWA/Utilities/IUserUtility.cs b/DocuMed.PWA/Utilities/IUserUtility.cs index b7fbf3a..4aaf91b 100644 --- a/DocuMed.PWA/Utilities/IUserUtility.cs +++ b/DocuMed.PWA/Utilities/IUserUtility.cs @@ -6,5 +6,6 @@ public interface IUserUtility public Task SetBearerTokenAsync(string token); public Task GetUserAsync(); public Task SetUserAsync(ApplicationUserSDto user); + public Task LogoutAsync(); } \ No newline at end of file diff --git a/DocuMed.PWA/Utilities/UserUtility.cs b/DocuMed.PWA/Utilities/UserUtility.cs index 1485b00..46b16ff 100644 --- a/DocuMed.PWA/Utilities/UserUtility.cs +++ b/DocuMed.PWA/Utilities/UserUtility.cs @@ -12,10 +12,15 @@ public class UserUtility : IUserUtility } public async Task GetBearerTokenAsync() => await _localStorageService.GetItemAsStringAsync(LocalStorageKeys.Token); - public async Task SetBearerTokenAsync(string token) => await _localStorageService.SetItemAsStringAsync(LocalStorageKeys.Token,token); + public async Task SetBearerTokenAsync(string token) => await _localStorageService.SetItemAsStringAsync(LocalStorageKeys.Token, token); public async Task GetUserAsync() => await _localStorageService.GetItemAsync(LocalStorageKeys.UserInfo); - public async Task SetUserAsync(ApplicationUserSDto user) => await _localStorageService.SetItemAsync(LocalStorageKeys.UserInfo,user); + public async Task SetUserAsync(ApplicationUserSDto user) => await _localStorageService.SetItemAsync(LocalStorageKeys.UserInfo, user); + public async Task LogoutAsync() + { + await _localStorageService.RemoveItemAsync(LocalStorageKeys.Token); + await _localStorageService.RemoveItemAsync(LocalStorageKeys.UserInfo); + } //public AccessToken? AccessToken { get; set; } //public List UserClaims => AccessToken == null ? new List() : AccessToken.Permissions; diff --git a/DocuMed.PWA/wwwroot/css/app.min.css b/DocuMed.PWA/wwwroot/css/app.min.css index ee062ab..2b9576d 100644 --- a/DocuMed.PWA/wwwroot/css/app.min.css +++ b/DocuMed.PWA/wwwroot/css/app.min.css @@ -517,6 +517,10 @@ video { margin-left: 0.25rem; margin-right: 0.25rem; } +.mx-10 { + margin-left: 2.5rem; + margin-right: 2.5rem; +} .mx-2 { margin-left: 0.5rem; margin-right: 0.5rem; @@ -541,6 +545,10 @@ video { margin-left: auto; margin-right: auto; } +.my-0 { + margin-top: 0px; + margin-bottom: 0px; +} .my-1 { margin-top: 0.25rem; margin-bottom: 0.25rem; @@ -553,6 +561,10 @@ video { margin-top: 1rem; margin-bottom: 1rem; } +.my-5 { + margin-top: 1.25rem; + margin-bottom: 1.25rem; +} .my-auto { margin-top: auto; margin-bottom: auto; @@ -605,6 +617,9 @@ video { .mb-3 { margin-bottom: 0.75rem; } +.mb-4 { + margin-bottom: 1rem; +} .mb-8 { margin-bottom: 2rem; } @@ -632,6 +647,9 @@ video { .mr-5 { margin-right: 1.25rem; } +.mr-7 { + margin-right: 1.75rem; +} .mr-auto { margin-right: auto; } @@ -867,6 +885,9 @@ video { --tw-bg-opacity: 1; background-color: rgb(55 65 81 / var(--tw-bg-opacity)); } +.bg-transparent { + background-color: transparent; +} .bg-white { --tw-bg-opacity: 1; background-color: rgb(255 255 255 / var(--tw-bg-opacity)); @@ -877,6 +898,9 @@ video { .bg-opacity-70 { --tw-bg-opacity: 0.7; } +.p-4 { + padding: 1rem; +} .p-5 { padding: 1.25rem; } diff --git a/DocuMed.PWA/wwwroot/css/app.output.css b/DocuMed.PWA/wwwroot/css/app.output.css index cd695fc..b877766 100644 --- a/DocuMed.PWA/wwwroot/css/app.output.css +++ b/DocuMed.PWA/wwwroot/css/app.output.css @@ -574,6 +574,11 @@ video { margin-right: 0.25rem; } +.mx-10 { + margin-left: 2.5rem; + margin-right: 2.5rem; +} + .mx-2 { margin-left: 0.5rem; margin-right: 0.5rem; @@ -604,6 +609,11 @@ video { margin-right: auto; } +.my-0 { + margin-top: 0px; + margin-bottom: 0px; +} + .my-1 { margin-top: 0.25rem; margin-bottom: 0.25rem; @@ -619,6 +629,11 @@ video { margin-bottom: 1rem; } +.my-5 { + margin-top: 1.25rem; + margin-bottom: 1.25rem; +} + .my-auto { margin-top: auto; margin-bottom: auto; @@ -688,6 +703,10 @@ video { margin-bottom: 0.75rem; } +.mb-4 { + margin-bottom: 1rem; +} + .mb-8 { margin-bottom: 2rem; } @@ -724,6 +743,10 @@ video { margin-right: 1.25rem; } +.mr-7 { + margin-right: 1.75rem; +} + .mr-auto { margin-right: auto; } @@ -1033,6 +1056,10 @@ video { background-color: rgb(55 65 81 / var(--tw-bg-opacity)); } +.bg-transparent { + background-color: transparent; +} + .bg-white { --tw-bg-opacity: 1; background-color: rgb(255 255 255 / var(--tw-bg-opacity)); @@ -1046,6 +1073,10 @@ video { --tw-bg-opacity: 0.7; } +.p-4 { + padding: 1rem; +} + .p-5 { padding: 1.25rem; } @@ -1085,16 +1116,16 @@ video { padding-bottom: 0.5rem; } -.py-4 { - padding-top: 1rem; - padding-bottom: 1rem; -} - .py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; } +.py-4 { + padding-top: 1rem; + padding-bottom: 1rem; +} + .pb-10 { padding-bottom: 2.5rem; } diff --git a/DocuMed.Repository/Migrations/20231019180057_init.Designer.cs b/DocuMed.Repository/Migrations/20231019180057_init.Designer.cs deleted file mode 100644 index c599dc6..0000000 --- a/DocuMed.Repository/Migrations/20231019180057_init.Designer.cs +++ /dev/null @@ -1,722 +0,0 @@ -// -using System; -using DocuMed.Repository.Models; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace DocuMed.Repository.Migrations -{ - [DbContext(typeof(ApplicationContext))] - [Migration("20231019180057_init")] - partial class init - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasDefaultSchema("public") - .HasAnnotation("ProductVersion", "7.0.11") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("DocuMed.Domain.Entities.City.City", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ModifiedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("RemovedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RemovedBy") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Cities", "public"); - }); - - modelBuilder.Entity("DocuMed.Domain.Entities.City.University", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Address") - .IsRequired() - .HasColumnType("text"); - - b.Property("CityId") - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ModifiedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("RemovedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RemovedBy") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CityId"); - - b.ToTable("Universities", "public"); - }); - - modelBuilder.Entity("DocuMed.Domain.Entities.MedicalHistory.MedicalHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("AddictionHistoryDetail") - .IsRequired() - .HasColumnType("text"); - - b.Property("Age") - .HasColumnType("integer"); - - b.Property("AllergyDetail") - .IsRequired() - .HasColumnType("text"); - - b.Property("BirthDate") - .HasColumnType("timestamp without time zone"); - - b.Property("ChiefComplaint") - .IsRequired() - .HasColumnType("text"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("DiastolicBloodPressure") - .HasColumnType("integer"); - - b.Property("DrugHistoryDetail") - .IsRequired() - .HasColumnType("text"); - - b.Property("FamilyHistoryDetail") - .IsRequired() - .HasColumnType("text"); - - b.Property("FatherName") - .IsRequired() - .HasColumnType("text"); - - b.Property("FirstName") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("LastName") - .IsRequired() - .HasColumnType("text"); - - b.Property("ModifiedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ModifiedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("NationalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("PastDiseasesHistoryDetail") - .IsRequired() - .HasColumnType("text"); - - b.Property("PastSurgeryHistoryDetail") - .IsRequired() - .HasColumnType("text"); - - b.Property("PresentIllnessDetail") - .IsRequired() - .HasColumnType("text"); - - b.Property("PulseRate") - .HasColumnType("integer"); - - b.Property("RemovedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RemovedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("SPO2") - .HasColumnType("integer"); - - b.Property("Section") - .IsRequired() - .HasColumnType("text"); - - b.Property("SystemReviewDetail") - .IsRequired() - .HasColumnType("text"); - - b.Property("SystolicBloodPressure") - .HasColumnType("integer"); - - b.Property("Temperature") - .HasColumnType("integer"); - - b.Property("VitalSignDetail") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("MedicalHistories", "public"); - }); - - modelBuilder.Entity("DocuMed.Domain.Entities.MedicalHistory.MedicalHistoryAnswer", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Answer") - .IsRequired() - .HasColumnType("text"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("MedicalHistoryId") - .HasColumnType("uuid"); - - b.Property("ModifiedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ModifiedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("Part") - .HasColumnType("integer"); - - b.Property("Question") - .IsRequired() - .HasColumnType("text"); - - b.Property("QuestionType") - .HasColumnType("integer"); - - b.Property("RemovedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RemovedBy") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("MedicalHistoryId"); - - b.ToTable("MedicalHistoryAnswers", "public"); - }); - - modelBuilder.Entity("DocuMed.Domain.Entities.MedicalHistoryTemplate.MedicalHistoryQuestion", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("MedicalHistoryTemplateId") - .HasColumnType("uuid"); - - b.Property("ModifiedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ModifiedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("Part") - .HasColumnType("integer"); - - b.Property("Question") - .IsRequired() - .HasColumnType("text"); - - b.Property("QuestionType") - .HasColumnType("integer"); - - b.Property("RemovedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RemovedBy") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("MedicalHistoryTemplateId"); - - b.ToTable("MedicalHistoryQuestions", "public"); - }); - - modelBuilder.Entity("DocuMed.Domain.Entities.MedicalHistoryTemplate.MedicalHistoryTemplate", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("ChiefComplaint") - .IsRequired() - .HasColumnType("text"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ModifiedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("RemovedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RemovedBy") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("MedicalHistoryTemplates", "public"); - }); - - modelBuilder.Entity("DocuMed.Domain.Entities.User.ApplicationRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("text"); - - b.Property("Description") - .IsRequired() - .HasColumnType("text"); - - b.Property("EnglishName") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("PersianName") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("Roles", "public"); - }); - - modelBuilder.Entity("DocuMed.Domain.Entities.User.ApplicationUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("AccessFailedCount") - .HasColumnType("integer"); - - b.Property("BirthDate") - .HasColumnType("timestamp without time zone"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("text"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("EmailConfirmed") - .HasColumnType("boolean"); - - b.Property("FirstName") - .IsRequired() - .HasColumnType("text"); - - b.Property("Gender") - .HasColumnType("integer"); - - b.Property("LastName") - .IsRequired() - .HasColumnType("text"); - - b.Property("LockoutEnabled") - .HasColumnType("boolean"); - - b.Property("LockoutEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("NationalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("PasswordHash") - .HasColumnType("text"); - - b.Property("PhoneNumber") - .HasColumnType("text"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("boolean"); - - b.Property("Section") - .IsRequired() - .HasColumnType("text"); - - b.Property("SecurityStamp") - .HasColumnType("text"); - - b.Property("SignUpStatus") - .HasColumnType("integer"); - - b.Property("TwoFactorEnabled") - .HasColumnType("boolean"); - - b.Property("UniversityId") - .HasColumnType("uuid"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.HasIndex("UniversityId"); - - b.ToTable("Users", "public"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("text"); - - b.Property("ClaimValue") - .HasColumnType("text"); - - b.Property("RoleId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("RoleClaims", "public"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("text"); - - b.Property("ClaimValue") - .HasColumnType("text"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Claims", "public"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("text"); - - b.Property("ProviderKey") - .HasColumnType("text"); - - b.Property("ProviderDisplayName") - .HasColumnType("text"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("Logins", "public"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("uuid"); - - b.Property("RoleId") - .HasColumnType("uuid"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("UserRoles", "public"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("uuid"); - - b.Property("LoginProvider") - .HasColumnType("text"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("Value") - .HasColumnType("text"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("Tokens", "public"); - }); - - modelBuilder.Entity("DocuMed.Domain.Entities.City.University", b => - { - b.HasOne("DocuMed.Domain.Entities.City.City", "City") - .WithMany("Universities") - .HasForeignKey("CityId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("City"); - }); - - modelBuilder.Entity("DocuMed.Domain.Entities.MedicalHistory.MedicalHistoryAnswer", b => - { - b.HasOne("DocuMed.Domain.Entities.MedicalHistory.MedicalHistory", "MedicalHistory") - .WithMany("Answers") - .HasForeignKey("MedicalHistoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("MedicalHistory"); - }); - - modelBuilder.Entity("DocuMed.Domain.Entities.MedicalHistoryTemplate.MedicalHistoryQuestion", b => - { - b.HasOne("DocuMed.Domain.Entities.MedicalHistoryTemplate.MedicalHistoryTemplate", "MedicalHistoryTemplate") - .WithMany("Questions") - .HasForeignKey("MedicalHistoryTemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("MedicalHistoryTemplate"); - }); - - modelBuilder.Entity("DocuMed.Domain.Entities.User.ApplicationUser", b => - { - b.HasOne("DocuMed.Domain.Entities.City.University", "University") - .WithMany() - .HasForeignKey("UniversityId"); - - b.Navigation("University"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("DocuMed.Domain.Entities.User.ApplicationRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("DocuMed.Domain.Entities.User.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("DocuMed.Domain.Entities.User.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("DocuMed.Domain.Entities.User.ApplicationRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("DocuMed.Domain.Entities.User.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("DocuMed.Domain.Entities.User.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("DocuMed.Domain.Entities.City.City", b => - { - b.Navigation("Universities"); - }); - - modelBuilder.Entity("DocuMed.Domain.Entities.MedicalHistory.MedicalHistory", b => - { - b.Navigation("Answers"); - }); - - modelBuilder.Entity("DocuMed.Domain.Entities.MedicalHistoryTemplate.MedicalHistoryTemplate", b => - { - b.Navigation("Questions"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/DocuMed.Repository/Migrations/20231021121504_addSections.Designer.cs b/DocuMed.Repository/Migrations/20231021121504_addSections.Designer.cs deleted file mode 100644 index b300487..0000000 --- a/DocuMed.Repository/Migrations/20231021121504_addSections.Designer.cs +++ /dev/null @@ -1,786 +0,0 @@ -// -using System; -using DocuMed.Repository.Models; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace DocuMed.Repository.Migrations -{ - [DbContext(typeof(ApplicationContext))] - [Migration("20231021121504_addSections")] - partial class addSections - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasDefaultSchema("public") - .HasAnnotation("ProductVersion", "7.0.11") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("DocuMed.Domain.Entities.City.City", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ModifiedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("RemovedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RemovedBy") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Cities", "public"); - }); - - modelBuilder.Entity("DocuMed.Domain.Entities.City.Section", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("Detail") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ModifiedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("RemovedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RemovedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("UniversityId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("UniversityId"); - - b.ToTable("Sections", "public"); - }); - - modelBuilder.Entity("DocuMed.Domain.Entities.City.University", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Address") - .IsRequired() - .HasColumnType("text"); - - b.Property("CityId") - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ModifiedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("RemovedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RemovedBy") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CityId"); - - b.ToTable("Universities", "public"); - }); - - modelBuilder.Entity("DocuMed.Domain.Entities.MedicalHistory.MedicalHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("AddictionHistoryDetail") - .IsRequired() - .HasColumnType("text"); - - b.Property("Age") - .HasColumnType("integer"); - - b.Property("AllergyDetail") - .IsRequired() - .HasColumnType("text"); - - b.Property("BirthDate") - .HasColumnType("timestamp without time zone"); - - b.Property("ChiefComplaint") - .IsRequired() - .HasColumnType("text"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("DiastolicBloodPressure") - .HasColumnType("integer"); - - b.Property("DrugHistoryDetail") - .IsRequired() - .HasColumnType("text"); - - b.Property("FamilyHistoryDetail") - .IsRequired() - .HasColumnType("text"); - - b.Property("FatherName") - .IsRequired() - .HasColumnType("text"); - - b.Property("FirstName") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("LastName") - .IsRequired() - .HasColumnType("text"); - - b.Property("ModifiedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ModifiedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("NationalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("PastDiseasesHistoryDetail") - .IsRequired() - .HasColumnType("text"); - - b.Property("PastSurgeryHistoryDetail") - .IsRequired() - .HasColumnType("text"); - - b.Property("PresentIllnessDetail") - .IsRequired() - .HasColumnType("text"); - - b.Property("PulseRate") - .HasColumnType("integer"); - - b.Property("RemovedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RemovedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("SPO2") - .HasColumnType("integer"); - - b.Property("Section") - .IsRequired() - .HasColumnType("text"); - - b.Property("SystemReviewDetail") - .IsRequired() - .HasColumnType("text"); - - b.Property("SystolicBloodPressure") - .HasColumnType("integer"); - - b.Property("Temperature") - .HasColumnType("integer"); - - b.Property("VitalSignDetail") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("MedicalHistories", "public"); - }); - - modelBuilder.Entity("DocuMed.Domain.Entities.MedicalHistory.MedicalHistoryAnswer", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Answer") - .IsRequired() - .HasColumnType("text"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("MedicalHistoryId") - .HasColumnType("uuid"); - - b.Property("ModifiedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ModifiedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("Part") - .HasColumnType("integer"); - - b.Property("Question") - .IsRequired() - .HasColumnType("text"); - - b.Property("QuestionType") - .HasColumnType("integer"); - - b.Property("RemovedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RemovedBy") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("MedicalHistoryId"); - - b.ToTable("MedicalHistoryAnswers", "public"); - }); - - modelBuilder.Entity("DocuMed.Domain.Entities.MedicalHistoryTemplate.MedicalHistoryQuestion", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("MedicalHistoryTemplateId") - .HasColumnType("uuid"); - - b.Property("ModifiedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ModifiedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("Part") - .HasColumnType("integer"); - - b.Property("Question") - .IsRequired() - .HasColumnType("text"); - - b.Property("QuestionType") - .HasColumnType("integer"); - - b.Property("RemovedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RemovedBy") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("MedicalHistoryTemplateId"); - - b.ToTable("MedicalHistoryQuestions", "public"); - }); - - modelBuilder.Entity("DocuMed.Domain.Entities.MedicalHistoryTemplate.MedicalHistoryTemplate", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("ChiefComplaint") - .IsRequired() - .HasColumnType("text"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ModifiedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("RemovedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RemovedBy") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("MedicalHistoryTemplates", "public"); - }); - - modelBuilder.Entity("DocuMed.Domain.Entities.User.ApplicationRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("text"); - - b.Property("Description") - .IsRequired() - .HasColumnType("text"); - - b.Property("EnglishName") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("PersianName") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("Roles", "public"); - }); - - modelBuilder.Entity("DocuMed.Domain.Entities.User.ApplicationUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("AccessFailedCount") - .HasColumnType("integer"); - - b.Property("BirthDate") - .HasColumnType("timestamp without time zone"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("text"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("EmailConfirmed") - .HasColumnType("boolean"); - - b.Property("FirstName") - .IsRequired() - .HasColumnType("text"); - - b.Property("Gender") - .HasColumnType("integer"); - - b.Property("LastName") - .IsRequired() - .HasColumnType("text"); - - b.Property("LockoutEnabled") - .HasColumnType("boolean"); - - b.Property("LockoutEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("NationalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("PasswordHash") - .HasColumnType("text"); - - b.Property("PhoneNumber") - .HasColumnType("text"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("boolean"); - - b.Property("Section") - .IsRequired() - .HasColumnType("text"); - - b.Property("SecurityStamp") - .HasColumnType("text"); - - b.Property("SignUpStatus") - .HasColumnType("integer"); - - b.Property("TwoFactorEnabled") - .HasColumnType("boolean"); - - b.Property("UniversityId") - .HasColumnType("uuid"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.HasIndex("UniversityId"); - - b.ToTable("Users", "public"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("text"); - - b.Property("ClaimValue") - .HasColumnType("text"); - - b.Property("RoleId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("RoleClaims", "public"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("text"); - - b.Property("ClaimValue") - .HasColumnType("text"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Claims", "public"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("text"); - - b.Property("ProviderKey") - .HasColumnType("text"); - - b.Property("ProviderDisplayName") - .HasColumnType("text"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("Logins", "public"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("uuid"); - - b.Property("RoleId") - .HasColumnType("uuid"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("UserRoles", "public"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("uuid"); - - b.Property("LoginProvider") - .HasColumnType("text"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("Value") - .HasColumnType("text"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("Tokens", "public"); - }); - - modelBuilder.Entity("DocuMed.Domain.Entities.City.Section", b => - { - b.HasOne("DocuMed.Domain.Entities.City.University", "University") - .WithMany("Sections") - .HasForeignKey("UniversityId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("University"); - }); - - modelBuilder.Entity("DocuMed.Domain.Entities.City.University", b => - { - b.HasOne("DocuMed.Domain.Entities.City.City", "City") - .WithMany("Universities") - .HasForeignKey("CityId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("City"); - }); - - modelBuilder.Entity("DocuMed.Domain.Entities.MedicalHistory.MedicalHistoryAnswer", b => - { - b.HasOne("DocuMed.Domain.Entities.MedicalHistory.MedicalHistory", "MedicalHistory") - .WithMany("Answers") - .HasForeignKey("MedicalHistoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("MedicalHistory"); - }); - - modelBuilder.Entity("DocuMed.Domain.Entities.MedicalHistoryTemplate.MedicalHistoryQuestion", b => - { - b.HasOne("DocuMed.Domain.Entities.MedicalHistoryTemplate.MedicalHistoryTemplate", "MedicalHistoryTemplate") - .WithMany("Questions") - .HasForeignKey("MedicalHistoryTemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("MedicalHistoryTemplate"); - }); - - modelBuilder.Entity("DocuMed.Domain.Entities.User.ApplicationUser", b => - { - b.HasOne("DocuMed.Domain.Entities.City.University", "University") - .WithMany() - .HasForeignKey("UniversityId"); - - b.Navigation("University"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("DocuMed.Domain.Entities.User.ApplicationRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("DocuMed.Domain.Entities.User.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("DocuMed.Domain.Entities.User.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("DocuMed.Domain.Entities.User.ApplicationRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("DocuMed.Domain.Entities.User.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("DocuMed.Domain.Entities.User.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("DocuMed.Domain.Entities.City.City", b => - { - b.Navigation("Universities"); - }); - - modelBuilder.Entity("DocuMed.Domain.Entities.City.University", b => - { - b.Navigation("Sections"); - }); - - modelBuilder.Entity("DocuMed.Domain.Entities.MedicalHistory.MedicalHistory", b => - { - b.Navigation("Answers"); - }); - - modelBuilder.Entity("DocuMed.Domain.Entities.MedicalHistoryTemplate.MedicalHistoryTemplate", b => - { - b.Navigation("Questions"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/DocuMed.Repository/Migrations/20231021121504_addSections.cs b/DocuMed.Repository/Migrations/20231021121504_addSections.cs deleted file mode 100644 index fa6ffd2..0000000 --- a/DocuMed.Repository/Migrations/20231021121504_addSections.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace DocuMed.Repository.Migrations -{ - /// - public partial class addSections : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "Sections", - schema: "public", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - Name = table.Column(type: "text", nullable: false), - Detail = table.Column(type: "text", nullable: false), - UniversityId = table.Column(type: "uuid", nullable: false), - RemovedAt = table.Column(type: "timestamp without time zone", nullable: false), - CreatedAt = table.Column(type: "timestamp without time zone", nullable: false), - CreatedBy = table.Column(type: "text", nullable: false), - IsRemoved = table.Column(type: "boolean", nullable: false), - RemovedBy = table.Column(type: "text", nullable: false), - ModifiedAt = table.Column(type: "timestamp without time zone", nullable: false), - ModifiedBy = table.Column(type: "text", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Sections", x => x.Id); - table.ForeignKey( - name: "FK_Sections_Universities_UniversityId", - column: x => x.UniversityId, - principalSchema: "public", - principalTable: "Universities", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateIndex( - name: "IX_Sections_UniversityId", - schema: "public", - table: "Sections", - column: "UniversityId"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "Sections", - schema: "public"); - } - } -} diff --git a/DocuMed.Repository/Migrations/20231021122606_editUser.Designer.cs b/DocuMed.Repository/Migrations/20231021122606_editUser.Designer.cs deleted file mode 100644 index a8ae463..0000000 --- a/DocuMed.Repository/Migrations/20231021122606_editUser.Designer.cs +++ /dev/null @@ -1,797 +0,0 @@ -// -using System; -using DocuMed.Repository.Models; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace DocuMed.Repository.Migrations -{ - [DbContext(typeof(ApplicationContext))] - [Migration("20231021122606_editUser")] - partial class editUser - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasDefaultSchema("public") - .HasAnnotation("ProductVersion", "7.0.11") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("DocuMed.Domain.Entities.City.City", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ModifiedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("RemovedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RemovedBy") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Cities", "public"); - }); - - modelBuilder.Entity("DocuMed.Domain.Entities.City.Section", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("Detail") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ModifiedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("RemovedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RemovedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("UniversityId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("UniversityId"); - - b.ToTable("Sections", "public"); - }); - - modelBuilder.Entity("DocuMed.Domain.Entities.City.University", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Address") - .IsRequired() - .HasColumnType("text"); - - b.Property("CityId") - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ModifiedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("RemovedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RemovedBy") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CityId"); - - b.ToTable("Universities", "public"); - }); - - modelBuilder.Entity("DocuMed.Domain.Entities.MedicalHistory.MedicalHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("AddictionHistoryDetail") - .IsRequired() - .HasColumnType("text"); - - b.Property("Age") - .HasColumnType("integer"); - - b.Property("AllergyDetail") - .IsRequired() - .HasColumnType("text"); - - b.Property("BirthDate") - .HasColumnType("timestamp without time zone"); - - b.Property("ChiefComplaint") - .IsRequired() - .HasColumnType("text"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("DiastolicBloodPressure") - .HasColumnType("integer"); - - b.Property("DrugHistoryDetail") - .IsRequired() - .HasColumnType("text"); - - b.Property("FamilyHistoryDetail") - .IsRequired() - .HasColumnType("text"); - - b.Property("FatherName") - .IsRequired() - .HasColumnType("text"); - - b.Property("FirstName") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("LastName") - .IsRequired() - .HasColumnType("text"); - - b.Property("ModifiedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ModifiedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("NationalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("PastDiseasesHistoryDetail") - .IsRequired() - .HasColumnType("text"); - - b.Property("PastSurgeryHistoryDetail") - .IsRequired() - .HasColumnType("text"); - - b.Property("PresentIllnessDetail") - .IsRequired() - .HasColumnType("text"); - - b.Property("PulseRate") - .HasColumnType("integer"); - - b.Property("RemovedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RemovedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("SPO2") - .HasColumnType("integer"); - - b.Property("Section") - .IsRequired() - .HasColumnType("text"); - - b.Property("SystemReviewDetail") - .IsRequired() - .HasColumnType("text"); - - b.Property("SystolicBloodPressure") - .HasColumnType("integer"); - - b.Property("Temperature") - .HasColumnType("integer"); - - b.Property("VitalSignDetail") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("MedicalHistories", "public"); - }); - - modelBuilder.Entity("DocuMed.Domain.Entities.MedicalHistory.MedicalHistoryAnswer", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Answer") - .IsRequired() - .HasColumnType("text"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("MedicalHistoryId") - .HasColumnType("uuid"); - - b.Property("ModifiedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ModifiedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("Part") - .HasColumnType("integer"); - - b.Property("Question") - .IsRequired() - .HasColumnType("text"); - - b.Property("QuestionType") - .HasColumnType("integer"); - - b.Property("RemovedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RemovedBy") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("MedicalHistoryId"); - - b.ToTable("MedicalHistoryAnswers", "public"); - }); - - modelBuilder.Entity("DocuMed.Domain.Entities.MedicalHistoryTemplate.MedicalHistoryQuestion", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("MedicalHistoryTemplateId") - .HasColumnType("uuid"); - - b.Property("ModifiedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ModifiedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("Part") - .HasColumnType("integer"); - - b.Property("Question") - .IsRequired() - .HasColumnType("text"); - - b.Property("QuestionType") - .HasColumnType("integer"); - - b.Property("RemovedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RemovedBy") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("MedicalHistoryTemplateId"); - - b.ToTable("MedicalHistoryQuestions", "public"); - }); - - modelBuilder.Entity("DocuMed.Domain.Entities.MedicalHistoryTemplate.MedicalHistoryTemplate", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("ChiefComplaint") - .IsRequired() - .HasColumnType("text"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ModifiedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("RemovedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RemovedBy") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("MedicalHistoryTemplates", "public"); - }); - - modelBuilder.Entity("DocuMed.Domain.Entities.User.ApplicationRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("text"); - - b.Property("Description") - .IsRequired() - .HasColumnType("text"); - - b.Property("EnglishName") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("PersianName") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("Roles", "public"); - }); - - modelBuilder.Entity("DocuMed.Domain.Entities.User.ApplicationUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("AccessFailedCount") - .HasColumnType("integer"); - - b.Property("BirthDate") - .HasColumnType("timestamp without time zone"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("text"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("EmailConfirmed") - .HasColumnType("boolean"); - - b.Property("FirstName") - .IsRequired() - .HasColumnType("text"); - - b.Property("Gender") - .HasColumnType("integer"); - - b.Property("LastName") - .IsRequired() - .HasColumnType("text"); - - b.Property("LockoutEnabled") - .HasColumnType("boolean"); - - b.Property("LockoutEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("NationalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("PasswordHash") - .HasColumnType("text"); - - b.Property("PhoneNumber") - .HasColumnType("text"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("boolean"); - - b.Property("SectionId") - .HasColumnType("uuid"); - - b.Property("SecurityStamp") - .HasColumnType("text"); - - b.Property("SignUpStatus") - .HasColumnType("integer"); - - b.Property("StudentId") - .IsRequired() - .HasColumnType("text"); - - b.Property("TwoFactorEnabled") - .HasColumnType("boolean"); - - b.Property("UniversityId") - .HasColumnType("uuid"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.HasIndex("SectionId"); - - b.HasIndex("UniversityId"); - - b.ToTable("Users", "public"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("text"); - - b.Property("ClaimValue") - .HasColumnType("text"); - - b.Property("RoleId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("RoleClaims", "public"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("text"); - - b.Property("ClaimValue") - .HasColumnType("text"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Claims", "public"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("text"); - - b.Property("ProviderKey") - .HasColumnType("text"); - - b.Property("ProviderDisplayName") - .HasColumnType("text"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("Logins", "public"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("uuid"); - - b.Property("RoleId") - .HasColumnType("uuid"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("UserRoles", "public"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("uuid"); - - b.Property("LoginProvider") - .HasColumnType("text"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("Value") - .HasColumnType("text"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("Tokens", "public"); - }); - - modelBuilder.Entity("DocuMed.Domain.Entities.City.Section", b => - { - b.HasOne("DocuMed.Domain.Entities.City.University", "University") - .WithMany("Sections") - .HasForeignKey("UniversityId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("University"); - }); - - modelBuilder.Entity("DocuMed.Domain.Entities.City.University", b => - { - b.HasOne("DocuMed.Domain.Entities.City.City", "City") - .WithMany("Universities") - .HasForeignKey("CityId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("City"); - }); - - modelBuilder.Entity("DocuMed.Domain.Entities.MedicalHistory.MedicalHistoryAnswer", b => - { - b.HasOne("DocuMed.Domain.Entities.MedicalHistory.MedicalHistory", "MedicalHistory") - .WithMany("Answers") - .HasForeignKey("MedicalHistoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("MedicalHistory"); - }); - - modelBuilder.Entity("DocuMed.Domain.Entities.MedicalHistoryTemplate.MedicalHistoryQuestion", b => - { - b.HasOne("DocuMed.Domain.Entities.MedicalHistoryTemplate.MedicalHistoryTemplate", "MedicalHistoryTemplate") - .WithMany("Questions") - .HasForeignKey("MedicalHistoryTemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("MedicalHistoryTemplate"); - }); - - modelBuilder.Entity("DocuMed.Domain.Entities.User.ApplicationUser", b => - { - b.HasOne("DocuMed.Domain.Entities.City.Section", "Section") - .WithMany() - .HasForeignKey("SectionId"); - - b.HasOne("DocuMed.Domain.Entities.City.University", "University") - .WithMany() - .HasForeignKey("UniversityId"); - - b.Navigation("Section"); - - b.Navigation("University"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("DocuMed.Domain.Entities.User.ApplicationRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("DocuMed.Domain.Entities.User.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("DocuMed.Domain.Entities.User.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("DocuMed.Domain.Entities.User.ApplicationRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("DocuMed.Domain.Entities.User.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("DocuMed.Domain.Entities.User.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("DocuMed.Domain.Entities.City.City", b => - { - b.Navigation("Universities"); - }); - - modelBuilder.Entity("DocuMed.Domain.Entities.City.University", b => - { - b.Navigation("Sections"); - }); - - modelBuilder.Entity("DocuMed.Domain.Entities.MedicalHistory.MedicalHistory", b => - { - b.Navigation("Answers"); - }); - - modelBuilder.Entity("DocuMed.Domain.Entities.MedicalHistoryTemplate.MedicalHistoryTemplate", b => - { - b.Navigation("Questions"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/DocuMed.Repository/Migrations/20231021122606_editUser.cs b/DocuMed.Repository/Migrations/20231021122606_editUser.cs deleted file mode 100644 index 80d09ee..0000000 --- a/DocuMed.Repository/Migrations/20231021122606_editUser.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace DocuMed.Repository.Migrations -{ - /// - public partial class editUser : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.RenameColumn( - name: "Section", - schema: "public", - table: "Users", - newName: "StudentId"); - - migrationBuilder.AddColumn( - name: "SectionId", - schema: "public", - table: "Users", - type: "uuid", - nullable: true); - - migrationBuilder.CreateIndex( - name: "IX_Users_SectionId", - schema: "public", - table: "Users", - column: "SectionId"); - - migrationBuilder.AddForeignKey( - name: "FK_Users_Sections_SectionId", - schema: "public", - table: "Users", - column: "SectionId", - principalSchema: "public", - principalTable: "Sections", - principalColumn: "Id"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_Users_Sections_SectionId", - schema: "public", - table: "Users"); - - migrationBuilder.DropIndex( - name: "IX_Users_SectionId", - schema: "public", - table: "Users"); - - migrationBuilder.DropColumn( - name: "SectionId", - schema: "public", - table: "Users"); - - migrationBuilder.RenameColumn( - name: "StudentId", - schema: "public", - table: "Users", - newName: "Section"); - } - } -} diff --git a/DocuMed.Repository/Migrations/20231022121751_editTemplate.cs b/DocuMed.Repository/Migrations/20231022121751_editTemplate.cs deleted file mode 100644 index 21278c8..0000000 --- a/DocuMed.Repository/Migrations/20231022121751_editTemplate.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace DocuMed.Repository.Migrations -{ - /// - public partial class editTemplate : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "SectionId", - schema: "public", - table: "MedicalHistoryTemplates", - type: "uuid", - nullable: false, - defaultValue: new Guid("00000000-0000-0000-0000-000000000000")); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "SectionId", - schema: "public", - table: "MedicalHistoryTemplates"); - } - } -} diff --git a/DocuMed.Repository/Migrations/20231022121751_editTemplate.Designer.cs b/DocuMed.Repository/Migrations/20231022193344_init.Designer.cs similarity index 95% rename from DocuMed.Repository/Migrations/20231022121751_editTemplate.Designer.cs rename to DocuMed.Repository/Migrations/20231022193344_init.Designer.cs index 4046897..11de129 100644 --- a/DocuMed.Repository/Migrations/20231022121751_editTemplate.Designer.cs +++ b/DocuMed.Repository/Migrations/20231022193344_init.Designer.cs @@ -12,8 +12,8 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace DocuMed.Repository.Migrations { [DbContext(typeof(ApplicationContext))] - [Migration("20231022121751_editTemplate")] - partial class editTemplate + [Migration("20231022193344_init")] + partial class init { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -178,6 +178,9 @@ namespace DocuMed.Repository.Migrations .IsRequired() .HasColumnType("text"); + b.Property("ApplicationUserId") + .HasColumnType("uuid"); + b.Property("BirthDate") .HasColumnType("timestamp without time zone"); @@ -274,6 +277,8 @@ namespace DocuMed.Repository.Migrations b.HasKey("Id"); + b.HasIndex("ApplicationUserId"); + b.ToTable("MedicalHistories", "public"); }); @@ -387,6 +392,9 @@ namespace DocuMed.Repository.Migrations .ValueGeneratedOnAdd() .HasColumnType("uuid"); + b.Property("ApplicationUserId") + .HasColumnType("uuid"); + b.Property("ChiefComplaint") .IsRequired() .HasColumnType("text"); @@ -420,6 +428,8 @@ namespace DocuMed.Repository.Migrations b.HasKey("Id"); + b.HasIndex("ApplicationUserId"); + b.ToTable("MedicalHistoryTemplates", "public"); }); @@ -687,6 +697,17 @@ namespace DocuMed.Repository.Migrations b.Navigation("City"); }); + modelBuilder.Entity("DocuMed.Domain.Entities.MedicalHistory.MedicalHistory", b => + { + b.HasOne("DocuMed.Domain.Entities.User.ApplicationUser", "ApplicationUser") + .WithMany() + .HasForeignKey("ApplicationUserId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("ApplicationUser"); + }); + modelBuilder.Entity("DocuMed.Domain.Entities.MedicalHistory.MedicalHistoryAnswer", b => { b.HasOne("DocuMed.Domain.Entities.MedicalHistory.MedicalHistory", "MedicalHistory") @@ -709,6 +730,17 @@ namespace DocuMed.Repository.Migrations b.Navigation("MedicalHistoryTemplate"); }); + modelBuilder.Entity("DocuMed.Domain.Entities.MedicalHistoryTemplate.MedicalHistoryTemplate", b => + { + b.HasOne("DocuMed.Domain.Entities.User.ApplicationUser", "ApplicationUser") + .WithMany() + .HasForeignKey("ApplicationUserId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("ApplicationUser"); + }); + modelBuilder.Entity("DocuMed.Domain.Entities.User.ApplicationUser", b => { b.HasOne("DocuMed.Domain.Entities.City.Section", "Section") diff --git a/DocuMed.Repository/Migrations/20231019180057_init.cs b/DocuMed.Repository/Migrations/20231022193344_init.cs similarity index 85% rename from DocuMed.Repository/Migrations/20231019180057_init.cs rename to DocuMed.Repository/Migrations/20231022193344_init.cs index 8d5ece8..c01e7a1 100644 --- a/DocuMed.Repository/Migrations/20231019180057_init.cs +++ b/DocuMed.Repository/Migrations/20231022193344_init.cs @@ -35,67 +35,6 @@ namespace DocuMed.Repository.Migrations table.PrimaryKey("PK_Cities", x => x.Id); }); - migrationBuilder.CreateTable( - name: "MedicalHistories", - schema: "public", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - ChiefComplaint = table.Column(type: "text", nullable: false), - Section = table.Column(type: "text", nullable: false), - FirstName = table.Column(type: "text", nullable: false), - LastName = table.Column(type: "text", nullable: false), - FatherName = table.Column(type: "text", nullable: false), - NationalId = table.Column(type: "text", nullable: false), - Age = table.Column(type: "integer", nullable: false), - BirthDate = table.Column(type: "timestamp without time zone", nullable: false), - PresentIllnessDetail = table.Column(type: "text", nullable: false), - PastDiseasesHistoryDetail = table.Column(type: "text", nullable: false), - PastSurgeryHistoryDetail = table.Column(type: "text", nullable: false), - FamilyHistoryDetail = table.Column(type: "text", nullable: false), - AllergyDetail = table.Column(type: "text", nullable: false), - DrugHistoryDetail = table.Column(type: "text", nullable: false), - AddictionHistoryDetail = table.Column(type: "text", nullable: false), - SystemReviewDetail = table.Column(type: "text", nullable: false), - VitalSignDetail = table.Column(type: "text", nullable: false), - SystolicBloodPressure = table.Column(type: "integer", nullable: false), - DiastolicBloodPressure = table.Column(type: "integer", nullable: false), - PulseRate = table.Column(type: "integer", nullable: false), - SPO2 = table.Column(type: "integer", nullable: false), - Temperature = table.Column(type: "integer", nullable: false), - RemovedAt = table.Column(type: "timestamp without time zone", nullable: false), - CreatedAt = table.Column(type: "timestamp without time zone", nullable: false), - CreatedBy = table.Column(type: "text", nullable: false), - IsRemoved = table.Column(type: "boolean", nullable: false), - RemovedBy = table.Column(type: "text", nullable: false), - ModifiedAt = table.Column(type: "timestamp without time zone", nullable: false), - ModifiedBy = table.Column(type: "text", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_MedicalHistories", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "MedicalHistoryTemplates", - schema: "public", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - ChiefComplaint = table.Column(type: "text", nullable: false), - RemovedAt = table.Column(type: "timestamp without time zone", nullable: false), - CreatedAt = table.Column(type: "timestamp without time zone", nullable: false), - CreatedBy = table.Column(type: "text", nullable: false), - IsRemoved = table.Column(type: "boolean", nullable: false), - RemovedBy = table.Column(type: "text", nullable: false), - ModifiedAt = table.Column(type: "timestamp without time zone", nullable: false), - ModifiedBy = table.Column(type: "text", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_MedicalHistoryTemplates", x => x.Id); - }); - migrationBuilder.CreateTable( name: "Roles", schema: "public", @@ -143,6 +82,277 @@ namespace DocuMed.Repository.Migrations onDelete: ReferentialAction.Restrict); }); + migrationBuilder.CreateTable( + name: "RoleClaims", + schema: "public", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + RoleId = table.Column(type: "uuid", nullable: false), + ClaimType = table.Column(type: "text", nullable: true), + ClaimValue = table.Column(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: "Sections", + schema: "public", + columns: table => new + { + Id = table.Column(type: "uuid", nullable: false), + Name = table.Column(type: "text", nullable: false), + Detail = table.Column(type: "text", nullable: false), + UniversityId = table.Column(type: "uuid", nullable: false), + RemovedAt = table.Column(type: "timestamp without time zone", nullable: false), + CreatedAt = table.Column(type: "timestamp without time zone", nullable: false), + CreatedBy = table.Column(type: "text", nullable: false), + IsRemoved = table.Column(type: "boolean", nullable: false), + RemovedBy = table.Column(type: "text", nullable: false), + ModifiedAt = table.Column(type: "timestamp without time zone", nullable: false), + ModifiedBy = table.Column(type: "text", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Sections", x => x.Id); + table.ForeignKey( + name: "FK_Sections_Universities_UniversityId", + column: x => x.UniversityId, + principalSchema: "public", + principalTable: "Universities", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "Users", + schema: "public", + columns: table => new + { + Id = table.Column(type: "uuid", nullable: false), + FirstName = table.Column(type: "text", nullable: false), + LastName = table.Column(type: "text", nullable: false), + NationalId = table.Column(type: "text", nullable: false), + StudentId = table.Column(type: "text", nullable: false), + BirthDate = table.Column(type: "timestamp without time zone", nullable: false), + Gender = table.Column(type: "integer", nullable: false), + SignUpStatus = table.Column(type: "integer", nullable: false), + UniversityId = table.Column(type: "uuid", nullable: true), + SectionId = table.Column(type: "uuid", nullable: true), + UserName = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), + NormalizedUserName = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), + Email = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), + NormalizedEmail = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), + EmailConfirmed = table.Column(type: "boolean", nullable: false), + PasswordHash = table.Column(type: "text", nullable: true), + SecurityStamp = table.Column(type: "text", nullable: true), + ConcurrencyStamp = table.Column(type: "text", nullable: true), + PhoneNumber = table.Column(type: "text", nullable: true), + PhoneNumberConfirmed = table.Column(type: "boolean", nullable: false), + TwoFactorEnabled = table.Column(type: "boolean", nullable: false), + LockoutEnd = table.Column(type: "timestamp with time zone", nullable: true), + LockoutEnabled = table.Column(type: "boolean", nullable: false), + AccessFailedCount = table.Column(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Users", x => x.Id); + table.ForeignKey( + name: "FK_Users_Sections_SectionId", + column: x => x.SectionId, + principalSchema: "public", + principalTable: "Sections", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_Users_Universities_UniversityId", + column: x => x.UniversityId, + principalSchema: "public", + principalTable: "Universities", + principalColumn: "Id"); + }); + + migrationBuilder.CreateTable( + name: "Claims", + schema: "public", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + UserId = table.Column(type: "uuid", nullable: false), + ClaimType = table.Column(type: "text", nullable: true), + ClaimValue = table.Column(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(type: "text", nullable: false), + ProviderKey = table.Column(type: "text", nullable: false), + ProviderDisplayName = table.Column(type: "text", nullable: true), + UserId = table.Column(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: "MedicalHistories", + schema: "public", + columns: table => new + { + Id = table.Column(type: "uuid", nullable: false), + ChiefComplaint = table.Column(type: "text", nullable: false), + Section = table.Column(type: "text", nullable: false), + FirstName = table.Column(type: "text", nullable: false), + LastName = table.Column(type: "text", nullable: false), + FatherName = table.Column(type: "text", nullable: false), + NationalId = table.Column(type: "text", nullable: false), + Age = table.Column(type: "integer", nullable: false), + BirthDate = table.Column(type: "timestamp without time zone", nullable: false), + PresentIllnessDetail = table.Column(type: "text", nullable: false), + PastDiseasesHistoryDetail = table.Column(type: "text", nullable: false), + PastSurgeryHistoryDetail = table.Column(type: "text", nullable: false), + FamilyHistoryDetail = table.Column(type: "text", nullable: false), + AllergyDetail = table.Column(type: "text", nullable: false), + DrugHistoryDetail = table.Column(type: "text", nullable: false), + AddictionHistoryDetail = table.Column(type: "text", nullable: false), + SystemReviewDetail = table.Column(type: "text", nullable: false), + VitalSignDetail = table.Column(type: "text", nullable: false), + SystolicBloodPressure = table.Column(type: "integer", nullable: false), + DiastolicBloodPressure = table.Column(type: "integer", nullable: false), + PulseRate = table.Column(type: "integer", nullable: false), + SPO2 = table.Column(type: "integer", nullable: false), + Temperature = table.Column(type: "integer", nullable: false), + ApplicationUserId = table.Column(type: "uuid", nullable: false), + RemovedAt = table.Column(type: "timestamp without time zone", nullable: false), + CreatedAt = table.Column(type: "timestamp without time zone", nullable: false), + CreatedBy = table.Column(type: "text", nullable: false), + IsRemoved = table.Column(type: "boolean", nullable: false), + RemovedBy = table.Column(type: "text", nullable: false), + ModifiedAt = table.Column(type: "timestamp without time zone", nullable: false), + ModifiedBy = table.Column(type: "text", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_MedicalHistories", x => x.Id); + table.ForeignKey( + name: "FK_MedicalHistories_Users_ApplicationUserId", + column: x => x.ApplicationUserId, + principalSchema: "public", + principalTable: "Users", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "MedicalHistoryTemplates", + schema: "public", + columns: table => new + { + Id = table.Column(type: "uuid", nullable: false), + ChiefComplaint = table.Column(type: "text", nullable: false), + SectionId = table.Column(type: "uuid", nullable: false), + ApplicationUserId = table.Column(type: "uuid", nullable: false), + RemovedAt = table.Column(type: "timestamp without time zone", nullable: false), + CreatedAt = table.Column(type: "timestamp without time zone", nullable: false), + CreatedBy = table.Column(type: "text", nullable: false), + IsRemoved = table.Column(type: "boolean", nullable: false), + RemovedBy = table.Column(type: "text", nullable: false), + ModifiedAt = table.Column(type: "timestamp without time zone", nullable: false), + ModifiedBy = table.Column(type: "text", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_MedicalHistoryTemplates", x => x.Id); + table.ForeignKey( + name: "FK_MedicalHistoryTemplates_Users_ApplicationUserId", + column: x => x.ApplicationUserId, + principalSchema: "public", + principalTable: "Users", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "Tokens", + schema: "public", + columns: table => new + { + UserId = table.Column(type: "uuid", nullable: false), + LoginProvider = table.Column(type: "text", nullable: false), + Name = table.Column(type: "text", nullable: false), + Value = table.Column(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(type: "uuid", nullable: false), + RoleId = table.Column(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: "MedicalHistoryAnswers", schema: "public", @@ -204,163 +414,6 @@ namespace DocuMed.Repository.Migrations onDelete: ReferentialAction.Restrict); }); - migrationBuilder.CreateTable( - name: "RoleClaims", - schema: "public", - columns: table => new - { - Id = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - RoleId = table.Column(type: "uuid", nullable: false), - ClaimType = table.Column(type: "text", nullable: true), - ClaimValue = table.Column(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: "Users", - schema: "public", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - FirstName = table.Column(type: "text", nullable: false), - LastName = table.Column(type: "text", nullable: false), - NationalId = table.Column(type: "text", nullable: false), - Section = table.Column(type: "text", nullable: false), - BirthDate = table.Column(type: "timestamp without time zone", nullable: false), - Gender = table.Column(type: "integer", nullable: false), - SignUpStatus = table.Column(type: "integer", nullable: false), - UniversityId = table.Column(type: "uuid", nullable: true), - UserName = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), - NormalizedUserName = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), - Email = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), - NormalizedEmail = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), - EmailConfirmed = table.Column(type: "boolean", nullable: false), - PasswordHash = table.Column(type: "text", nullable: true), - SecurityStamp = table.Column(type: "text", nullable: true), - ConcurrencyStamp = table.Column(type: "text", nullable: true), - PhoneNumber = table.Column(type: "text", nullable: true), - PhoneNumberConfirmed = table.Column(type: "boolean", nullable: false), - TwoFactorEnabled = table.Column(type: "boolean", nullable: false), - LockoutEnd = table.Column(type: "timestamp with time zone", nullable: true), - LockoutEnabled = table.Column(type: "boolean", nullable: false), - AccessFailedCount = table.Column(type: "integer", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Users", x => x.Id); - table.ForeignKey( - name: "FK_Users_Universities_UniversityId", - column: x => x.UniversityId, - principalSchema: "public", - principalTable: "Universities", - principalColumn: "Id"); - }); - - migrationBuilder.CreateTable( - name: "Claims", - schema: "public", - columns: table => new - { - Id = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - UserId = table.Column(type: "uuid", nullable: false), - ClaimType = table.Column(type: "text", nullable: true), - ClaimValue = table.Column(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(type: "text", nullable: false), - ProviderKey = table.Column(type: "text", nullable: false), - ProviderDisplayName = table.Column(type: "text", nullable: true), - UserId = table.Column(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(type: "uuid", nullable: false), - LoginProvider = table.Column(type: "text", nullable: false), - Name = table.Column(type: "text", nullable: false), - Value = table.Column(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(type: "uuid", nullable: false), - RoleId = table.Column(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.CreateIndex( name: "IX_Claims_UserId", schema: "public", @@ -373,6 +426,12 @@ namespace DocuMed.Repository.Migrations table: "Logins", column: "UserId"); + migrationBuilder.CreateIndex( + name: "IX_MedicalHistories_ApplicationUserId", + schema: "public", + table: "MedicalHistories", + column: "ApplicationUserId"); + migrationBuilder.CreateIndex( name: "IX_MedicalHistoryAnswers_MedicalHistoryId", schema: "public", @@ -385,6 +444,12 @@ namespace DocuMed.Repository.Migrations table: "MedicalHistoryQuestions", column: "MedicalHistoryTemplateId"); + migrationBuilder.CreateIndex( + name: "IX_MedicalHistoryTemplates_ApplicationUserId", + schema: "public", + table: "MedicalHistoryTemplates", + column: "ApplicationUserId"); + migrationBuilder.CreateIndex( name: "IX_RoleClaims_RoleId", schema: "public", @@ -398,6 +463,12 @@ namespace DocuMed.Repository.Migrations column: "NormalizedName", unique: true); + migrationBuilder.CreateIndex( + name: "IX_Sections_UniversityId", + schema: "public", + table: "Sections", + column: "UniversityId"); + migrationBuilder.CreateIndex( name: "IX_Universities_CityId", schema: "public", @@ -416,6 +487,12 @@ namespace DocuMed.Repository.Migrations table: "Users", column: "NormalizedEmail"); + migrationBuilder.CreateIndex( + name: "IX_Users_SectionId", + schema: "public", + table: "Users", + column: "SectionId"); + migrationBuilder.CreateIndex( name: "IX_Users_UniversityId", schema: "public", @@ -477,6 +554,10 @@ namespace DocuMed.Repository.Migrations name: "Users", schema: "public"); + migrationBuilder.DropTable( + name: "Sections", + schema: "public"); + migrationBuilder.DropTable( name: "Universities", schema: "public"); diff --git a/DocuMed.Repository/Migrations/ApplicationContextModelSnapshot.cs b/DocuMed.Repository/Migrations/ApplicationContextModelSnapshot.cs index 9e9f557..75715ec 100644 --- a/DocuMed.Repository/Migrations/ApplicationContextModelSnapshot.cs +++ b/DocuMed.Repository/Migrations/ApplicationContextModelSnapshot.cs @@ -175,6 +175,9 @@ namespace DocuMed.Repository.Migrations .IsRequired() .HasColumnType("text"); + b.Property("ApplicationUserId") + .HasColumnType("uuid"); + b.Property("BirthDate") .HasColumnType("timestamp without time zone"); @@ -271,6 +274,8 @@ namespace DocuMed.Repository.Migrations b.HasKey("Id"); + b.HasIndex("ApplicationUserId"); + b.ToTable("MedicalHistories", "public"); }); @@ -384,6 +389,9 @@ namespace DocuMed.Repository.Migrations .ValueGeneratedOnAdd() .HasColumnType("uuid"); + b.Property("ApplicationUserId") + .HasColumnType("uuid"); + b.Property("ChiefComplaint") .IsRequired() .HasColumnType("text"); @@ -417,6 +425,8 @@ namespace DocuMed.Repository.Migrations b.HasKey("Id"); + b.HasIndex("ApplicationUserId"); + b.ToTable("MedicalHistoryTemplates", "public"); }); @@ -684,6 +694,17 @@ namespace DocuMed.Repository.Migrations b.Navigation("City"); }); + modelBuilder.Entity("DocuMed.Domain.Entities.MedicalHistory.MedicalHistory", b => + { + b.HasOne("DocuMed.Domain.Entities.User.ApplicationUser", "ApplicationUser") + .WithMany() + .HasForeignKey("ApplicationUserId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("ApplicationUser"); + }); + modelBuilder.Entity("DocuMed.Domain.Entities.MedicalHistory.MedicalHistoryAnswer", b => { b.HasOne("DocuMed.Domain.Entities.MedicalHistory.MedicalHistory", "MedicalHistory") @@ -706,6 +727,17 @@ namespace DocuMed.Repository.Migrations b.Navigation("MedicalHistoryTemplate"); }); + modelBuilder.Entity("DocuMed.Domain.Entities.MedicalHistoryTemplate.MedicalHistoryTemplate", b => + { + b.HasOne("DocuMed.Domain.Entities.User.ApplicationUser", "ApplicationUser") + .WithMany() + .HasForeignKey("ApplicationUserId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("ApplicationUser"); + }); + modelBuilder.Entity("DocuMed.Domain.Entities.User.ApplicationUser", b => { b.HasOne("DocuMed.Domain.Entities.City.Section", "Section")