From 867b7be19d26db6509bd10e3de3a29bdbea2b494 Mon Sep 17 00:00:00 2001 From: "Amir.H Khademi" Date: Sun, 22 Oct 2023 15:51:11 +0330 Subject: [PATCH] complete profile and authurize --- DocuMed.Api/Controllers/SectionController.cs | 81 ++ DocuMed.Api/Controllers/UserController.cs | 23 + DocuMed.Api/DocuMed.Api.csproj | 1 + DocuMed.Core/BaseServices/JwtService.cs | 12 +- DocuMed.Core/EntityServices/UserService.cs | 8 +- .../LargDtos/MedicalHistoryTemplateLDto.cs | 1 + .../Dtos/RequestDtos/UserActionRequestDto.cs | 2 + .../Dtos/SmallDtos/ApplicationUserSDto.cs | 7 +- .../SmallDtos/MedicalHistoryTemplateSDto.cs | 1 + DocuMed.Domain/Dtos/SmallDtos/SectionSDto.cs | 8 + .../Entities/City/Aggregate.City.cs | 8 + DocuMed.Domain/Entities/City/Section.cs | 25 + DocuMed.Domain/Entities/City/University.cs | 2 + .../MedicalHistoryTemplate.cs | 2 +- .../Entities/User/ApplicationUser.cs | 5 +- .../Mappers/ApplicationUserMapper.g.cs | 18 +- .../Mappers/MedicalHistoryTemplateMapper.g.cs | 12 + DocuMed.Domain/Mappers/SectionMapper.g.cs | 75 ++ DocuMed.PWA/DocuMed.PWA.csproj | 2 + DocuMed.PWA/Models/Address.cs | 2 + DocuMed.PWA/Models/BaseViewModel.cs | 15 + DocuMed.PWA/Models/LocalStorageKeys.cs | 1 + DocuMed.PWA/Pages/HomePage.razor | 59 +- DocuMed.PWA/Pages/HomePage.razor.cs | 62 ++ DocuMed.PWA/Pages/Index.razor | 14 +- DocuMed.PWA/Pages/Index.razor.cs | 6 + .../MedicalHistoryTemplateActionPage.razor.cs | 6 + .../MedicalHistoryTemplateActionStep2.razor | 16 +- DocuMed.PWA/Pages/ProfilePage.razor | 96 ++- DocuMed.PWA/Pages/ProfilePage.razor.cs | 167 ++++ .../Services/RestServices/IRestWrapper.cs | 2 + .../Services/RestServices/ISectionRestApi.cs | 7 + .../Services/RestServices/IUserRestApi.cs | 9 + .../Services/RestServices/RestWrapper.cs | 2 + DocuMed.PWA/Utilities/IUserUtility.cs | 3 + DocuMed.PWA/Utilities/UserUtility.cs | 3 + DocuMed.PWA/wwwroot/css/app.min.css | 7 + DocuMed.PWA/wwwroot/css/app.output.css | 9 + .../20231021121504_addSections.Designer.cs | 786 +++++++++++++++++ .../Migrations/20231021121504_addSections.cs | 58 ++ .../20231021122606_editUser.Designer.cs | 797 +++++++++++++++++ .../Migrations/20231021122606_editUser.cs | 68 ++ .../20231022121751_editTemplate.Designer.cs | 800 ++++++++++++++++++ .../Migrations/20231022121751_editTemplate.cs | 32 + .../ApplicationContextModelSnapshot.cs | 84 +- 45 files changed, 3313 insertions(+), 91 deletions(-) create mode 100644 DocuMed.Api/Controllers/SectionController.cs create mode 100644 DocuMed.Api/Controllers/UserController.cs create mode 100644 DocuMed.Domain/Dtos/SmallDtos/SectionSDto.cs create mode 100644 DocuMed.Domain/Entities/City/Section.cs create mode 100644 DocuMed.Domain/Mappers/SectionMapper.g.cs create mode 100644 DocuMed.PWA/Models/BaseViewModel.cs create mode 100644 DocuMed.PWA/Pages/HomePage.razor.cs create mode 100644 DocuMed.PWA/Pages/Index.razor.cs create mode 100644 DocuMed.PWA/Pages/MedicalHistoryTemplateActionPage.razor.cs create mode 100644 DocuMed.PWA/Pages/ProfilePage.razor.cs create mode 100644 DocuMed.PWA/Services/RestServices/ISectionRestApi.cs create mode 100644 DocuMed.PWA/Services/RestServices/IUserRestApi.cs create mode 100644 DocuMed.Repository/Migrations/20231021121504_addSections.Designer.cs create mode 100644 DocuMed.Repository/Migrations/20231021121504_addSections.cs create mode 100644 DocuMed.Repository/Migrations/20231021122606_editUser.Designer.cs create mode 100644 DocuMed.Repository/Migrations/20231021122606_editUser.cs create mode 100644 DocuMed.Repository/Migrations/20231022121751_editTemplate.Designer.cs create mode 100644 DocuMed.Repository/Migrations/20231022121751_editTemplate.cs diff --git a/DocuMed.Api/Controllers/SectionController.cs b/DocuMed.Api/Controllers/SectionController.cs new file mode 100644 index 0000000..2e96434 --- /dev/null +++ b/DocuMed.Api/Controllers/SectionController.cs @@ -0,0 +1,81 @@ +using Microsoft.IdentityModel.Tokens; + +namespace DocuMed.Api.Controllers; +public class SectionController : ICarterModule +{ + public virtual void AddRoutes(IEndpointRouteBuilder app) + { + var group = app.NewVersionedApi("Section").MapGroup($"api/section") + .RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser()); + + group.MapGet("", GetAllAsync) + .WithDisplayName("GetAll") + .HasApiVersion(1.0); + + group.MapGet("University/{universityId}", GetAllByUniversityAsync) + .WithDisplayName("GetAllByUniversityId") + .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) + { + return TypedResults.Ok(await repositoryWrapper.SetRepository
().TableNoTracking + .Select(SectionMapper.ProjectToSDto).ToListAsync(cancellationToken)); + } + + // GET:Get All Entity + public virtual async Task GetAllByUniversityAsync(Guid universityId, IRepositoryWrapper repositoryWrapper, ICurrentUserService currentUserService, CancellationToken cancellationToken) + { + return TypedResults.Ok(await repositoryWrapper.SetRepository
().TableNoTracking + .Where(s => s.UniversityId == universityId) + .Select(SectionMapper.ProjectToSDto).ToListAsync(cancellationToken)); + } + + // 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] SectionSDto dto, IRepositoryWrapper repositoryWrapper, CancellationToken cancellationToken) + { + var ent = Section.Create(dto.Name,dto.Detail,dto.UniversityId); + repositoryWrapper.SetRepository
().Add(ent); + await repositoryWrapper.SaveChangesAsync(cancellationToken); + return TypedResults.Ok(ent); + } + + // PUT:Update Entity + public virtual async Task Put([FromBody] SectionSDto dto, IRepositoryWrapper repositoryWrapper, CancellationToken cancellationToken) + { + var ent = Section.Create(dto.Name,dto.Detail, dto.UniversityId); + 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(); + } +} diff --git a/DocuMed.Api/Controllers/UserController.cs b/DocuMed.Api/Controllers/UserController.cs new file mode 100644 index 0000000..25c9393 --- /dev/null +++ b/DocuMed.Api/Controllers/UserController.cs @@ -0,0 +1,23 @@ +namespace DocuMed.Api.Controllers; + +public class UserController : ICarterModule +{ + public void AddRoutes(IEndpointRouteBuilder app) + { + + var group = app.NewVersionedApi("User") + .MapGroup($"api/user") + .RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser()); + + + group.MapPut("", EditUserAsync) + .WithDisplayName("EditUser") + .HasApiVersion(1.0); + } + + public virtual async Task EditUserAsync([FromBody]UserActionRequestDto request,IUserService userService,CancellationToken cancellationToken) + { + await userService.EditUserAsync(request, cancellationToken); + return TypedResults.Ok(); + } +} \ No newline at end of file diff --git a/DocuMed.Api/DocuMed.Api.csproj b/DocuMed.Api/DocuMed.Api.csproj index 2ae1e12..5e11120 100644 --- a/DocuMed.Api/DocuMed.Api.csproj +++ b/DocuMed.Api/DocuMed.Api.csproj @@ -68,6 +68,7 @@ + diff --git a/DocuMed.Core/BaseServices/JwtService.cs b/DocuMed.Core/BaseServices/JwtService.cs index 96df9cb..1662991 100644 --- a/DocuMed.Core/BaseServices/JwtService.cs +++ b/DocuMed.Core/BaseServices/JwtService.cs @@ -1,16 +1,10 @@ -using DocuMed.Core.BaseServices.Abstracts; -using DocuMed.Domain.Models.Settings; -using Mapster; -using Microsoft.AspNetCore.Identity; +using DocuMed.Domain.Models.Settings; using Microsoft.Extensions.Options; -using Microsoft.IdentityModel.Tokens; using System.IdentityModel.Tokens.Jwt; -using System.Security.Claims; using System.Text; namespace DocuMed.Core.BaseServices; - public class JwtService : IJwtService { private readonly SignInManager _signInManager; @@ -95,6 +89,8 @@ public class JwtService : IJwtService claims.Add(new Claim(ClaimTypes.NameIdentifier, baseUser.Id.ToString())); if (baseUser.Email != null) claims.Add(new Claim(ClaimTypes.Email, baseUser.Email)); + if(baseUser.UniversityId != null) + claims.Add(new Claim("UniversityId",baseUser.UniversityId.ToString() ?? string.Empty )); claims.Add(new Claim(ClaimTypes.Gender, baseUser.Gender == 0 ? "Female" : "Mail")); return claims; @@ -110,6 +106,8 @@ public class JwtService : IJwtService claims.Add(new Claim(ClaimTypes.Role, applicationRole.EnglishName)); if (baseUser.Email != null) claims.Add(new Claim(ClaimTypes.Email, baseUser.Email)); + if (baseUser.UniversityId != null) + claims.Add(new Claim("UniversityId", baseUser.UniversityId.ToString() ?? string.Empty)); claims.AddRange(roleClaims); claims.Add(new Claim("JwtID", jwtId)); claims.Add(new Claim(ClaimTypes.Gender, baseUser.Gender == 0 ? "Female" : "Mail")); diff --git a/DocuMed.Core/EntityServices/UserService.cs b/DocuMed.Core/EntityServices/UserService.cs index 4272abf..ec43969 100644 --- a/DocuMed.Core/EntityServices/UserService.cs +++ b/DocuMed.Core/EntityServices/UserService.cs @@ -73,7 +73,7 @@ public class UserService : IUserService var roleResult = await _userManager.AddToRoleAsync(user, RoleNames.Student); if (!roleResult.Succeeded) throw new AppException(string.Join('|', roleResult.Errors)); - + return user; } @@ -89,12 +89,16 @@ public class UserService : IUserService user.FirstName = request.FirstName; user.UserName = request.PhoneNumber; user.PhoneNumber = request.PhoneNumber; + user.StudentId = request.StudentId; user.FirstName = request.FirstName; user.LastName = request.LastName; user.NationalId = request.NationalId; user.BirthDate = request.BirthDate; user.Gender = request.Gender; - user.UniversityId = request.UniversityId; + if (request.UniversityId != Guid.Empty) + user.UniversityId = request.UniversityId; + if (request.SectionId != Guid.Empty) + user.SectionId = request.SectionId; var result = await _userManager.UpdateAsync(user); if (!result.Succeeded) diff --git a/DocuMed.Domain/Dtos/LargDtos/MedicalHistoryTemplateLDto.cs b/DocuMed.Domain/Dtos/LargDtos/MedicalHistoryTemplateLDto.cs index 0dd5903..c2ee3d5 100644 --- a/DocuMed.Domain/Dtos/LargDtos/MedicalHistoryTemplateLDto.cs +++ b/DocuMed.Domain/Dtos/LargDtos/MedicalHistoryTemplateLDto.cs @@ -4,5 +4,6 @@ public class MedicalHistoryTemplateLDto : BaseDto Questions { get; set; } = new(); } \ No newline at end of file diff --git a/DocuMed.Domain/Dtos/RequestDtos/UserActionRequestDto.cs b/DocuMed.Domain/Dtos/RequestDtos/UserActionRequestDto.cs index eed61e3..6a1ac42 100644 --- a/DocuMed.Domain/Dtos/RequestDtos/UserActionRequestDto.cs +++ b/DocuMed.Domain/Dtos/RequestDtos/UserActionRequestDto.cs @@ -7,8 +7,10 @@ public class UserActionRequestDto public DateTime BirthDate { get; set; } public Gender Gender { get; set; } public string NationalId { get; set; } = string.Empty; + public string StudentId { get; set; } = string.Empty; public string Password { get; set; } = string.Empty; public Guid RoleId { get; set; } = new(); public string RoleName { get; set; } = string.Empty; public Guid UniversityId { get; set; } + public Guid SectionId { get; set; } } \ No newline at end of file diff --git a/DocuMed.Domain/Dtos/SmallDtos/ApplicationUserSDto.cs b/DocuMed.Domain/Dtos/SmallDtos/ApplicationUserSDto.cs index a899ea8..99769f2 100644 --- a/DocuMed.Domain/Dtos/SmallDtos/ApplicationUserSDto.cs +++ b/DocuMed.Domain/Dtos/SmallDtos/ApplicationUserSDto.cs @@ -9,9 +9,14 @@ public class ApplicationUserSDto : BaseDto public string PhoneNumber { get; set; } = string.Empty; public bool PhoneNumberConfirmed { get; set; } public string NationalId { get; set; } = string.Empty; - public string Section { get; set; } = string.Empty; + public string StudentId { get; set; } = string.Empty; public DateTime BirthDate { get; set; } public Gender Gender { get; set; } public SignUpStatus SignUpStatus { get; set; } public Guid UniversityId { get; set; } + public Guid SectionId { get; set; } + + public string FullName => FirstName + " " + LastName; + + } \ No newline at end of file diff --git a/DocuMed.Domain/Dtos/SmallDtos/MedicalHistoryTemplateSDto.cs b/DocuMed.Domain/Dtos/SmallDtos/MedicalHistoryTemplateSDto.cs index c83bfcb..e13d2c6 100644 --- a/DocuMed.Domain/Dtos/SmallDtos/MedicalHistoryTemplateSDto.cs +++ b/DocuMed.Domain/Dtos/SmallDtos/MedicalHistoryTemplateSDto.cs @@ -3,4 +3,5 @@ public class MedicalHistoryTemplateSDto : BaseDto { public string ChiefComplaint { get; set; } = string.Empty; + public Guid SectionId { get; set; } } \ No newline at end of file diff --git a/DocuMed.Domain/Dtos/SmallDtos/SectionSDto.cs b/DocuMed.Domain/Dtos/SmallDtos/SectionSDto.cs new file mode 100644 index 0000000..1c14469 --- /dev/null +++ b/DocuMed.Domain/Dtos/SmallDtos/SectionSDto.cs @@ -0,0 +1,8 @@ +namespace DocuMed.Domain.Dtos.SmallDtos; + +public class SectionSDto : BaseDto +{ + public string Name { get; set; } = string.Empty; + public string Detail { get; set; } = string.Empty; + public Guid UniversityId { get; set; } +} \ No newline at end of file diff --git a/DocuMed.Domain/Entities/City/Aggregate.City.cs b/DocuMed.Domain/Entities/City/Aggregate.City.cs index 942dae3..10642b0 100644 --- a/DocuMed.Domain/Entities/City/Aggregate.City.cs +++ b/DocuMed.Domain/Entities/City/Aggregate.City.cs @@ -22,4 +22,12 @@ public partial class University { return new University(name, address, cityId); } +} + +public partial class Section +{ + public static Section Create(string name, string detail, Guid universityId) + { + return new Section(name, detail, universityId); + } } \ No newline at end of file diff --git a/DocuMed.Domain/Entities/City/Section.cs b/DocuMed.Domain/Entities/City/Section.cs new file mode 100644 index 0000000..f75cbda --- /dev/null +++ b/DocuMed.Domain/Entities/City/Section.cs @@ -0,0 +1,25 @@ +namespace DocuMed.Domain.Entities.City; + +[AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)] +[GenerateMapper] +public partial class Section : ApiEntity +{ + + public Section() + { + + } + + public Section(string name, string detail, Guid universityId) + { + Name = name; + Detail = detail; + UniversityId = universityId; + } + + public string Name { get; internal set; } = string.Empty; + public string Detail { get; internal set; } = string.Empty; + + public Guid UniversityId { get; internal set; } + public University? University { get; internal set; } +} \ No newline at end of file diff --git a/DocuMed.Domain/Entities/City/University.cs b/DocuMed.Domain/Entities/City/University.cs index 50f7f10..6192125 100644 --- a/DocuMed.Domain/Entities/City/University.cs +++ b/DocuMed.Domain/Entities/City/University.cs @@ -21,4 +21,6 @@ public partial class University : ApiEntity public Guid CityId { get; internal set; } public City? City { get; internal set; } + + public List
Sections { get; internal set; } = new(); } \ No newline at end of file diff --git a/DocuMed.Domain/Entities/MedicalHistoryTemplate/MedicalHistoryTemplate.cs b/DocuMed.Domain/Entities/MedicalHistoryTemplate/MedicalHistoryTemplate.cs index 9aa3427..6e1cd5e 100644 --- a/DocuMed.Domain/Entities/MedicalHistoryTemplate/MedicalHistoryTemplate.cs +++ b/DocuMed.Domain/Entities/MedicalHistoryTemplate/MedicalHistoryTemplate.cs @@ -18,6 +18,6 @@ public partial class MedicalHistoryTemplate : ApiEntity } public string ChiefComplaint { get; internal set; } = string.Empty; - + public Guid SectionId { get; set; } public List Questions { get; internal set; } = new(); } \ No newline at end of file diff --git a/DocuMed.Domain/Entities/User/ApplicationUser.cs b/DocuMed.Domain/Entities/User/ApplicationUser.cs index 1aab971..ae75da4 100644 --- a/DocuMed.Domain/Entities/User/ApplicationUser.cs +++ b/DocuMed.Domain/Entities/User/ApplicationUser.cs @@ -7,11 +7,14 @@ public class ApplicationUser : IdentityUser public string FirstName { get; set; } = string.Empty; public string LastName { get; set; } = string.Empty; public string NationalId { get; set; } = string.Empty; - public string Section { get; set; } = string.Empty; + public string StudentId { get; set; } = string.Empty; public DateTime BirthDate { get; set; } public Gender Gender { get; set; } public SignUpStatus SignUpStatus { get; set; } public Guid? UniversityId { get; set; } public University? University { get; set; } + + public Guid? SectionId { get; set; } + public Section? Section { get; set; } } diff --git a/DocuMed.Domain/Mappers/ApplicationUserMapper.g.cs b/DocuMed.Domain/Mappers/ApplicationUserMapper.g.cs index dd583bb..6c9f12f 100644 --- a/DocuMed.Domain/Mappers/ApplicationUserMapper.g.cs +++ b/DocuMed.Domain/Mappers/ApplicationUserMapper.g.cs @@ -14,11 +14,12 @@ namespace DocuMed.Domain.Mappers FirstName = p1.FirstName, LastName = p1.LastName, NationalId = p1.NationalId, - Section = p1.Section, + StudentId = p1.StudentId, BirthDate = p1.BirthDate, Gender = p1.Gender, SignUpStatus = p1.SignUpStatus, UniversityId = (Guid?)p1.UniversityId, + SectionId = (Guid?)p1.SectionId, Id = p1.Id, UserName = p1.UserName, Email = p1.Email, @@ -37,11 +38,12 @@ namespace DocuMed.Domain.Mappers result.FirstName = p2.FirstName; result.LastName = p2.LastName; result.NationalId = p2.NationalId; - result.Section = p2.Section; + result.StudentId = p2.StudentId; result.BirthDate = p2.BirthDate; result.Gender = p2.Gender; result.SignUpStatus = p2.SignUpStatus; result.UniversityId = (Guid?)p2.UniversityId; + result.SectionId = (Guid?)p2.SectionId; result.Id = p2.Id; result.UserName = p2.UserName; result.Email = p2.Email; @@ -55,11 +57,12 @@ namespace DocuMed.Domain.Mappers FirstName = p4.FirstName, LastName = p4.LastName, NationalId = p4.NationalId, - Section = p4.Section, + StudentId = p4.StudentId, BirthDate = p4.BirthDate, Gender = p4.Gender, SignUpStatus = p4.SignUpStatus, UniversityId = (Guid?)p4.UniversityId, + SectionId = (Guid?)p4.SectionId, Id = p4.Id, UserName = p4.UserName, Email = p4.Email, @@ -77,11 +80,12 @@ namespace DocuMed.Domain.Mappers PhoneNumber = p5.PhoneNumber, PhoneNumberConfirmed = p5.PhoneNumberConfirmed, NationalId = p5.NationalId, - Section = p5.Section, + StudentId = p5.StudentId, BirthDate = p5.BirthDate, Gender = p5.Gender, SignUpStatus = p5.SignUpStatus, UniversityId = p5.UniversityId == null ? default(Guid) : (Guid)p5.UniversityId, + SectionId = p5.SectionId == null ? default(Guid) : (Guid)p5.SectionId, Id = p5.Id }; } @@ -100,11 +104,12 @@ namespace DocuMed.Domain.Mappers result.PhoneNumber = p6.PhoneNumber; result.PhoneNumberConfirmed = p6.PhoneNumberConfirmed; result.NationalId = p6.NationalId; - result.Section = p6.Section; + result.StudentId = p6.StudentId; result.BirthDate = p6.BirthDate; result.Gender = p6.Gender; result.SignUpStatus = p6.SignUpStatus; result.UniversityId = p6.UniversityId == null ? default(Guid) : (Guid)p6.UniversityId; + result.SectionId = p6.SectionId == null ? default(Guid) : (Guid)p6.SectionId; result.Id = p6.Id; return result; @@ -118,11 +123,12 @@ namespace DocuMed.Domain.Mappers PhoneNumber = p8.PhoneNumber, PhoneNumberConfirmed = p8.PhoneNumberConfirmed, NationalId = p8.NationalId, - Section = p8.Section, + StudentId = p8.StudentId, BirthDate = p8.BirthDate, Gender = p8.Gender, SignUpStatus = p8.SignUpStatus, UniversityId = p8.UniversityId == null ? default(Guid) : (Guid)p8.UniversityId, + SectionId = p8.SectionId == null ? default(Guid) : (Guid)p8.SectionId, Id = p8.Id }; } diff --git a/DocuMed.Domain/Mappers/MedicalHistoryTemplateMapper.g.cs b/DocuMed.Domain/Mappers/MedicalHistoryTemplateMapper.g.cs index 56f5c75..1a2a3bf 100644 --- a/DocuMed.Domain/Mappers/MedicalHistoryTemplateMapper.g.cs +++ b/DocuMed.Domain/Mappers/MedicalHistoryTemplateMapper.g.cs @@ -15,6 +15,7 @@ namespace DocuMed.Domain.Mappers return p1 == null ? null : new MedicalHistoryTemplate() { ChiefComplaint = p1.ChiefComplaint, + SectionId = p1.SectionId, Id = p1.Id }; } @@ -27,6 +28,7 @@ namespace DocuMed.Domain.Mappers MedicalHistoryTemplate result = p3 ?? new MedicalHistoryTemplate(); result.ChiefComplaint = p2.ChiefComplaint; + result.SectionId = p2.SectionId; result.Id = p2.Id; return result; @@ -34,6 +36,7 @@ namespace DocuMed.Domain.Mappers public static Expression> ProjectToMedicalHistoryTemplate => p4 => new MedicalHistoryTemplate() { ChiefComplaint = p4.ChiefComplaint, + SectionId = p4.SectionId, Id = p4.Id }; public static MedicalHistoryTemplateSDto AdaptToSDto(this MedicalHistoryTemplate p5) @@ -41,6 +44,7 @@ namespace DocuMed.Domain.Mappers return p5 == null ? null : new MedicalHistoryTemplateSDto() { ChiefComplaint = p5.ChiefComplaint, + SectionId = p5.SectionId, Id = p5.Id }; } @@ -53,6 +57,7 @@ namespace DocuMed.Domain.Mappers MedicalHistoryTemplateSDto result = p7 ?? new MedicalHistoryTemplateSDto(); result.ChiefComplaint = p6.ChiefComplaint; + result.SectionId = p6.SectionId; result.Id = p6.Id; return result; @@ -60,6 +65,7 @@ namespace DocuMed.Domain.Mappers public static Expression> ProjectToSDto => p8 => new MedicalHistoryTemplateSDto() { ChiefComplaint = p8.ChiefComplaint, + SectionId = p8.SectionId, Id = p8.Id }; public static MedicalHistoryTemplate AdaptToMedicalHistoryTemplate(this MedicalHistoryTemplateLDto p9) @@ -67,6 +73,7 @@ namespace DocuMed.Domain.Mappers return p9 == null ? null : new MedicalHistoryTemplate() { ChiefComplaint = p9.ChiefComplaint, + SectionId = p9.SectionId, Questions = funcMain1(p9.Questions), Id = p9.Id }; @@ -80,6 +87,7 @@ namespace DocuMed.Domain.Mappers MedicalHistoryTemplate result = p12 ?? new MedicalHistoryTemplate(); result.ChiefComplaint = p11.ChiefComplaint; + result.SectionId = p11.SectionId; result.Questions = funcMain2(p11.Questions, result.Questions); result.Id = p11.Id; return result; @@ -88,6 +96,7 @@ namespace DocuMed.Domain.Mappers public static Expression> ProjectLDtoToMedicalHistoryTemplate => p15 => new MedicalHistoryTemplate() { ChiefComplaint = p15.ChiefComplaint, + SectionId = p15.SectionId, Questions = p15.Questions.Select(p16 => new MedicalHistoryQuestion() { Question = p16.Question, @@ -103,6 +112,7 @@ namespace DocuMed.Domain.Mappers return p17 == null ? null : new MedicalHistoryTemplateLDto() { ChiefComplaint = p17.ChiefComplaint, + SectionId = p17.SectionId, Questions = funcMain3(p17.Questions), Id = p17.Id }; @@ -116,6 +126,7 @@ namespace DocuMed.Domain.Mappers MedicalHistoryTemplateLDto result = p20 ?? new MedicalHistoryTemplateLDto(); result.ChiefComplaint = p19.ChiefComplaint; + result.SectionId = p19.SectionId; result.Questions = funcMain4(p19.Questions, result.Questions); result.Id = p19.Id; return result; @@ -124,6 +135,7 @@ namespace DocuMed.Domain.Mappers public static Expression> ProjectToLDto => p23 => new MedicalHistoryTemplateLDto() { ChiefComplaint = p23.ChiefComplaint, + SectionId = p23.SectionId, Questions = p23.Questions.Select(p24 => new MedicalHistoryQuestionSDto() { Question = p24.Question, diff --git a/DocuMed.Domain/Mappers/SectionMapper.g.cs b/DocuMed.Domain/Mappers/SectionMapper.g.cs new file mode 100644 index 0000000..502129d --- /dev/null +++ b/DocuMed.Domain/Mappers/SectionMapper.g.cs @@ -0,0 +1,75 @@ +using System; +using System.Linq.Expressions; +using DocuMed.Domain.Dtos.SmallDtos; +using DocuMed.Domain.Entities.City; + +namespace DocuMed.Domain.Mappers +{ + public static partial class SectionMapper + { + public static Section AdaptToSection(this SectionSDto p1) + { + return p1 == null ? null : new Section() + { + Name = p1.Name, + Detail = p1.Detail, + UniversityId = p1.UniversityId, + Id = p1.Id + }; + } + public static Section AdaptTo(this SectionSDto p2, Section p3) + { + if (p2 == null) + { + return null; + } + Section result = p3 ?? new Section(); + + result.Name = p2.Name; + result.Detail = p2.Detail; + result.UniversityId = p2.UniversityId; + result.Id = p2.Id; + return result; + + } + public static Expression> ProjectToSection => p4 => new Section() + { + Name = p4.Name, + Detail = p4.Detail, + UniversityId = p4.UniversityId, + Id = p4.Id + }; + public static SectionSDto AdaptToSDto(this Section p5) + { + return p5 == null ? null : new SectionSDto() + { + Name = p5.Name, + Detail = p5.Detail, + UniversityId = p5.UniversityId, + Id = p5.Id + }; + } + public static SectionSDto AdaptTo(this Section p6, SectionSDto p7) + { + if (p6 == null) + { + return null; + } + SectionSDto result = p7 ?? new SectionSDto(); + + result.Name = p6.Name; + result.Detail = p6.Detail; + result.UniversityId = p6.UniversityId; + result.Id = p6.Id; + return result; + + } + public static Expression> ProjectToSDto => p8 => new SectionSDto() + { + Name = p8.Name, + Detail = p8.Detail, + UniversityId = p8.UniversityId, + Id = p8.Id + }; + } +} \ No newline at end of file diff --git a/DocuMed.PWA/DocuMed.PWA.csproj b/DocuMed.PWA/DocuMed.PWA.csproj index cff0112..d30084d 100644 --- a/DocuMed.PWA/DocuMed.PWA.csproj +++ b/DocuMed.PWA/DocuMed.PWA.csproj @@ -30,6 +30,7 @@ + @@ -59,6 +60,7 @@ + diff --git a/DocuMed.PWA/Models/Address.cs b/DocuMed.PWA/Models/Address.cs index c064e44..f4ab926 100644 --- a/DocuMed.PWA/Models/Address.cs +++ b/DocuMed.PWA/Models/Address.cs @@ -6,4 +6,6 @@ public static class Address public const string AuthController = $"{BaseAddress}/auth"; public const string CityController = $"{BaseAddress}/city"; public const string UniversityController = $"{BaseAddress}/university"; + public const string SectionController = $"{BaseAddress}/section"; + public const string UserController = $"{BaseAddress}/user"; } \ No newline at end of file diff --git a/DocuMed.PWA/Models/BaseViewModel.cs b/DocuMed.PWA/Models/BaseViewModel.cs new file mode 100644 index 0000000..d245385 --- /dev/null +++ b/DocuMed.PWA/Models/BaseViewModel.cs @@ -0,0 +1,15 @@ +namespace DocuMed.PWA.Models; + +public class BaseViewModel +{ + public bool IsProcessing { get; set; } = false; + + public virtual void Initialize() + { + + } + public virtual Task InitializeAsync() + { + return Task.CompletedTask; + } +} \ No newline at end of file diff --git a/DocuMed.PWA/Models/LocalStorageKeys.cs b/DocuMed.PWA/Models/LocalStorageKeys.cs index 2ac09ec..4335343 100644 --- a/DocuMed.PWA/Models/LocalStorageKeys.cs +++ b/DocuMed.PWA/Models/LocalStorageKeys.cs @@ -3,4 +3,5 @@ public static class LocalStorageKeys { public const string Token = nameof(Token); + public const string UserInfo = nameof(UserInfo); } \ No newline at end of file diff --git a/DocuMed.PWA/Pages/HomePage.razor b/DocuMed.PWA/Pages/HomePage.razor index 5ea3d53..1d1f3ec 100644 --- a/DocuMed.PWA/Pages/HomePage.razor +++ b/DocuMed.PWA/Pages/HomePage.razor @@ -1,6 +1,6 @@ @page "/HomePage" -@using DocuMed.Domain.Dtos.SmallDtos @inject NavigationManager NavigationManager +@inject IUserUtility UserUtility @@ -12,8 +12,8 @@ -

امیرحسین خادمی

-

09214802813

+

@ViewModel?.User.FullName

+

@ViewModel?.User.PhoneNumber

اطفال @@ -29,7 +29,7 @@
- @foreach(var item in _medicalHistories) + @foreach (var item in @ViewModel.MedicalHistories) { } @@ -75,57 +75,22 @@ @code { + + private HomePageViewModel? ViewModel { get; set; } + public void ProfileClicked() => NavigationManager.NavigateTo("ProfilePage"); public void CreateMedicalHistoryClicked() => NavigationManager.NavigateTo("MedicalHistoryActionPage"); public void MedicalHistoryTemplatesClicked() => NavigationManager.NavigateTo("MedicalHistoryTemplatesPage"); + public void MedicalOrdersClicked() => NavigationManager.NavigateTo("MedicalOrdersPage"); - private List _medicalHistories = new List(); - protected override void OnInitialized() + protected override async Task OnInitializedAsync() { - _medicalHistories.Add(new MedicalHistorySDto - { - FirstName = "امیرحسین ", - LastName = "معتمدی", - Age = 35, - ChiefComplaint = "سردرد", - Section = "داخلی", - }); - _medicalHistories.Add(new MedicalHistorySDto - { - FirstName = "امیرحسین ", - LastName = "معتمدی", - Age = 35, - ChiefComplaint = "سردرد", - Section = "داخلی", - }); - _medicalHistories.Add(new MedicalHistorySDto - { - FirstName = "امیرحسین ", - LastName = "معتمدی", - Age = 35, - ChiefComplaint = "سردرد", - Section = "داخلی", - }); - _medicalHistories.Add(new MedicalHistorySDto - { - FirstName = "امیرحسین ", - LastName = "معتمدی", - Age = 35, - ChiefComplaint = "سردرد", - Section = "داخلی", - }); - _medicalHistories.Add(new MedicalHistorySDto - { - FirstName = "امیرحسین ", - LastName = "معتمدی", - Age = 35, - ChiefComplaint = "سردرد", - Section = "داخلی", - }); - base.OnInitialized(); + ViewModel = new HomePageViewModel(UserUtility); + await ViewModel.InitializeAsync(); + await base.OnInitializedAsync(); } } \ No newline at end of file diff --git a/DocuMed.PWA/Pages/HomePage.razor.cs b/DocuMed.PWA/Pages/HomePage.razor.cs new file mode 100644 index 0000000..c297d43 --- /dev/null +++ b/DocuMed.PWA/Pages/HomePage.razor.cs @@ -0,0 +1,62 @@ +namespace DocuMed.PWA.Pages; + +public class HomePageViewModel : BaseViewModel +{ + private readonly IUserUtility _userUtility; + + public HomePageViewModel(IUserUtility userUtility) + { + _userUtility = userUtility; + } + + public List MedicalHistories { get; private set; } = new List(); + public ApplicationUserSDto User { get; private set; } = new ApplicationUserSDto(); + + public override async Task InitializeAsync() + { + User = await _userUtility.GetUserAsync(); + MedicalHistories.Add(new MedicalHistorySDto + { + FirstName = "امیرحسین ", + LastName = "معتمدی", + Age = 35, + ChiefComplaint = "سردرد", + Section = "داخلی", + }); + MedicalHistories.Add(new MedicalHistorySDto + { + FirstName = "امیرحسین ", + LastName = "معتمدی", + Age = 35, + ChiefComplaint = "سردرد", + Section = "داخلی", + }); + MedicalHistories.Add(new MedicalHistorySDto + { + FirstName = "امیرحسین ", + LastName = "معتمدی", + Age = 35, + ChiefComplaint = "سردرد", + Section = "داخلی", + }); + MedicalHistories.Add(new MedicalHistorySDto + { + FirstName = "امیرحسین ", + LastName = "معتمدی", + Age = 35, + ChiefComplaint = "سردرد", + Section = "داخلی", + }); + MedicalHistories.Add(new MedicalHistorySDto + { + FirstName = "امیرحسین ", + LastName = "معتمدی", + Age = 35, + ChiefComplaint = "سردرد", + Section = "داخلی", + }); + + await base.InitializeAsync(); + + } +} \ No newline at end of file diff --git a/DocuMed.PWA/Pages/Index.razor b/DocuMed.PWA/Pages/Index.razor index 3fe05cb..9145c2a 100644 --- a/DocuMed.PWA/Pages/Index.razor +++ b/DocuMed.PWA/Pages/Index.razor @@ -118,7 +118,7 @@ وارد کنید

- - + + @@ -242,13 +247,14 @@ _isProcessing = false; } } - private async Task ConfirmVerifyCode() + private async Task ConfirmVerifyCode() { try { _isProcessing = true; var rest = await RestWrapper.AuthRestApi.LoginWithVerifyCodeAsync(new LoginRequestDto { UserName = _phoneNumber, VerifyCode = _verifyCode }); await UserUtility.SetBearerTokenAsync(rest.BearerToken); + await UserUtility.SetUserAsync(rest.User); if (_signUpStatus == SignUpStatus.SignUpCompleted) NavigationManager.NavigateTo("HomePage"); else @@ -291,6 +297,7 @@ var token = await UserUtility.GetBearerTokenAsync(); var rest = await RestWrapper.AuthRestApi.CompleteSignUpAsync(_signUpRequest, token); await UserUtility.SetBearerTokenAsync(rest.BearerToken); + await UserUtility.SetUserAsync(rest.User); NavigationManager.NavigateTo("HomePage"); } } @@ -339,7 +346,6 @@ } } - private async Task> SearchUniversity(string uni) { try diff --git a/DocuMed.PWA/Pages/Index.razor.cs b/DocuMed.PWA/Pages/Index.razor.cs new file mode 100644 index 0000000..f4fbc7d --- /dev/null +++ b/DocuMed.PWA/Pages/Index.razor.cs @@ -0,0 +1,6 @@ +namespace DocuMed.PWA.Pages; + +public class IndexViewModel +{ + +} \ No newline at end of file diff --git a/DocuMed.PWA/Pages/MedicalHistoryTemplateActionPage.razor.cs b/DocuMed.PWA/Pages/MedicalHistoryTemplateActionPage.razor.cs new file mode 100644 index 0000000..5383710 --- /dev/null +++ b/DocuMed.PWA/Pages/MedicalHistoryTemplateActionPage.razor.cs @@ -0,0 +1,6 @@ +namespace DocuMed.PWA.Pages; + +public class MedicalHistoryTemplateActionPageViewModel : BaseViewModel +{ + +} \ No newline at end of file diff --git a/DocuMed.PWA/Pages/MedicalHistoryTemplateActionParts/MedicalHistoryTemplateActionStep2.razor b/DocuMed.PWA/Pages/MedicalHistoryTemplateActionParts/MedicalHistoryTemplateActionStep2.razor index 96fc91c..ef2a527 100644 --- a/DocuMed.PWA/Pages/MedicalHistoryTemplateActionParts/MedicalHistoryTemplateActionStep2.razor +++ b/DocuMed.PWA/Pages/MedicalHistoryTemplateActionParts/MedicalHistoryTemplateActionStep2.razor @@ -6,21 +6,22 @@ @foreach (var item in Questions) { - + } - + - + Variant="Variant.Outlined" /> - + @* *@ + + + افزودن @@ -30,8 +31,8 @@ @code { private MedicalHistoryQuestionType _questionType; - private string EnumConvertFunc() => string.Empty; private string _questionTitle = string.Empty; + private MedicalHistoryPart _questionPart = MedicalHistoryPart.PresentIllness; public List Questions { get; set; } = new(); @@ -42,5 +43,6 @@ } private void AddQuestion() { + Questions.Add(MedicalHistoryQuestion.Create(_questionTitle,_questionPart,_questionType,Guid.Empty)); } } \ No newline at end of file diff --git a/DocuMed.PWA/Pages/ProfilePage.razor b/DocuMed.PWA/Pages/ProfilePage.razor index 2a732bf..edde295 100644 --- a/DocuMed.PWA/Pages/ProfilePage.razor +++ b/DocuMed.PWA/Pages/ProfilePage.razor @@ -1,30 +1,102 @@ @page "/ProfilePage" -@using System.Reflection +@inject IRestWrapper RestWrapper +@inject ISnackbar Snackbar +@inject IUserUtility UserUtility - - - - - - - + + + + - + + + + +
+ +

منتظر بمانید

+
+
+
+
+ +

@e.Name

+
+
+ + + + + +
+ +

منتظر بمانید

+
+
+
+
+ +

@e.Name

+
+
+ + + + + + +
+ +

منتظر بمانید

+
+
+
+
+ +

@e.Name

+
+
+ +

نسخه برنامه

-

@_version

+

@ViewModel.Version

- + @code { - private readonly string _version = Assembly.GetAssembly(typeof(Program))?.GetName()?.Version?.ToString() ?? string.Empty; + + private ProfilePageViewModel ViewModel { get; set; } + protected override async Task OnInitializedAsync() + { + ViewModel = new ProfilePageViewModel(UserUtility, RestWrapper, Snackbar); + await ViewModel.InitializeAsync(); + await base.OnInitializedAsync(); + + } } \ No newline at end of file diff --git a/DocuMed.PWA/Pages/ProfilePage.razor.cs b/DocuMed.PWA/Pages/ProfilePage.razor.cs new file mode 100644 index 0000000..7586c5a --- /dev/null +++ b/DocuMed.PWA/Pages/ProfilePage.razor.cs @@ -0,0 +1,167 @@ +using DocuMed.Domain.Entities.City; +using Mapster; + +namespace DocuMed.PWA.Pages; + +public class ProfilePageViewModel : BaseViewModel +{ + public IUserUtility UserUtility { get; } + public IRestWrapper RestWrapper { get; } + public ISnackbar Snackbar { get; } + public ApplicationUserSDto User { get; set; } = new(); + + + 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 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) + { + UserUtility = userUtility; + RestWrapper = restWrapper; + Snackbar = snackbar; + } + + public override async Task InitializeAsync() + { + User = await UserUtility.GetUserAsync(); + + var token = await UserUtility.GetBearerTokenAsync(); + Cities = await RestWrapper.CrudDtoApiRest(Address.CityController).ReadAll(0, token); + Universities = await RestWrapper.CrudDtoApiRest(Address.UniversityController).ReadAll(0, token); + + if (User.UniversityId != Guid.Empty) + { + SelectedUni = Universities.FirstOrDefault(u => u.Id == User.UniversityId); + SelectedCity = Cities.FirstOrDefault(c => c.Id == SelectedUni?.CityId); + if (SelectedUni != null) + if (User.SectionId != Guid.Empty) + { + Sections = await RestWrapper.SectionRestApi.GetByUniversityAsync(SelectedUni.Id, token); + SelectedSection = Sections.FirstOrDefault(s => s.Id == User.SectionId); + } + } + + await base.InitializeAsync(); + } + + public async Task SubmitEditAsync() + { + try + { + IsProcessing = true; + var token = await UserUtility.GetBearerTokenAsync(); + var request = User.Adapt(); + if (SelectedUni != null) + { + request.UniversityId = SelectedUni.Id; + User.UniversityId = SelectedUni.Id; + } + if (SelectedSection != null) + { + request.SectionId = SelectedSection.Id; + User.SectionId = SelectedSection.Id; + } + await RestWrapper.UserRestApi.UpdateUserAsync(request, token); + await UserUtility.SetUserAsync(User); + Snackbar.Add("ویرایش حساب کاربری با موفقیت انجام شد", Severity.Success); + } + 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 async Task> SearchCity(string city) + { + try + { + if (Cities.Count == 0) + { + var token = await UserUtility.GetBearerTokenAsync(); + Cities = await RestWrapper.CrudDtoApiRest(Address.CityController).ReadAll(0, token); + } + if (city.IsNullOrEmpty()) + return Cities; + return Cities.Where(c => c.Name.Contains(city)); + } + catch (ApiException ex) + { + var exe = await ex.GetContentAsAsync(); + Snackbar.Add(exe != null ? exe.Message : ex.Content, Severity.Error); + return Cities; + } + catch (Exception e) + { + Snackbar.Add(e.Message, Severity.Error); + return Cities; + } + } + public async Task> SearchSection(string section) + { + try + { + if (SelectedUni != null) + { + var token = await UserUtility.GetBearerTokenAsync(); + Sections = await RestWrapper.SectionRestApi.GetByUniversityAsync(SelectedUni.Id, token); + } + if (section.IsNullOrEmpty()) + return Sections; + return Sections.Where(c => c.Name.Contains(section)); + } + catch (ApiException ex) + { + var exe = await ex.GetContentAsAsync(); + Snackbar.Add(exe != null ? exe.Message : ex.Content, Severity.Error); + return Sections; + } + catch (Exception e) + { + Snackbar.Add(e.Message, Severity.Error); + return Sections; + } + } + public async Task> SearchUniversity(string uni) + { + try + { + if (Universities.Count == 0) + { + var token = await UserUtility.GetBearerTokenAsync(); + Universities = await RestWrapper.CrudDtoApiRest(Address.UniversityController).ReadAll(0, token); + } + if (uni.IsNullOrEmpty()) + return Universities; + return Universities.Where(c => c.Name.Contains(uni)); + } + catch (ApiException ex) + { + var exe = await ex.GetContentAsAsync(); + Snackbar.Add(exe != null ? exe.Message : ex.Content, Severity.Error); + return Universities; + } + catch (Exception e) + { + Snackbar.Add(e.Message, Severity.Error); + return Universities; + } + } +} \ No newline at end of file diff --git a/DocuMed.PWA/Services/RestServices/IRestWrapper.cs b/DocuMed.PWA/Services/RestServices/IRestWrapper.cs index a3778a1..ea9fdaf 100644 --- a/DocuMed.PWA/Services/RestServices/IRestWrapper.cs +++ b/DocuMed.PWA/Services/RestServices/IRestWrapper.cs @@ -7,4 +7,6 @@ public interface IRestWrapper public IAuthRestApi AuthRestApi { get; } + public ISectionRestApi SectionRestApi { get; } + public IUserRestApi UserRestApi { get; } } \ No newline at end of file diff --git a/DocuMed.PWA/Services/RestServices/ISectionRestApi.cs b/DocuMed.PWA/Services/RestServices/ISectionRestApi.cs new file mode 100644 index 0000000..7f47775 --- /dev/null +++ b/DocuMed.PWA/Services/RestServices/ISectionRestApi.cs @@ -0,0 +1,7 @@ +namespace DocuMed.PWA.Services.RestServices; + +public interface ISectionRestApi : ICrudDtoApiRest +{ + [Get("/university/{universityId}")] + Task> GetByUniversityAsync(Guid universityId, [Header("Authorization")] string authorization); +} \ No newline at end of file diff --git a/DocuMed.PWA/Services/RestServices/IUserRestApi.cs b/DocuMed.PWA/Services/RestServices/IUserRestApi.cs new file mode 100644 index 0000000..e9da183 --- /dev/null +++ b/DocuMed.PWA/Services/RestServices/IUserRestApi.cs @@ -0,0 +1,9 @@ +namespace DocuMed.PWA.Services.RestServices; + +public interface IUserRestApi +{ + + + [Put("")] + Task UpdateUserAsync([Body]UserActionRequestDto request, [Header("Authorization")] string authorization); +} \ No newline at end of file diff --git a/DocuMed.PWA/Services/RestServices/RestWrapper.cs b/DocuMed.PWA/Services/RestServices/RestWrapper.cs index 540abaf..76826dd 100644 --- a/DocuMed.PWA/Services/RestServices/RestWrapper.cs +++ b/DocuMed.PWA/Services/RestServices/RestWrapper.cs @@ -21,4 +21,6 @@ public class RestWrapper : IRestWrapper return RestService.For>(address, setting); } public IAuthRestApi AuthRestApi => RestService.For(Address.AuthController, setting); + public ISectionRestApi SectionRestApi => RestService.For(Address.SectionController, setting); + public IUserRestApi UserRestApi => RestService.For(Address.UserController, setting); } \ No newline at end of file diff --git a/DocuMed.PWA/Utilities/IUserUtility.cs b/DocuMed.PWA/Utilities/IUserUtility.cs index 3a2df9f..b7fbf3a 100644 --- a/DocuMed.PWA/Utilities/IUserUtility.cs +++ b/DocuMed.PWA/Utilities/IUserUtility.cs @@ -4,4 +4,7 @@ public interface IUserUtility { public Task GetBearerTokenAsync(); public Task SetBearerTokenAsync(string token); + public Task GetUserAsync(); + public Task SetUserAsync(ApplicationUserSDto user); + } \ No newline at end of file diff --git a/DocuMed.PWA/Utilities/UserUtility.cs b/DocuMed.PWA/Utilities/UserUtility.cs index 206e89a..1485b00 100644 --- a/DocuMed.PWA/Utilities/UserUtility.cs +++ b/DocuMed.PWA/Utilities/UserUtility.cs @@ -14,6 +14,9 @@ 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 GetUserAsync() => await _localStorageService.GetItemAsync(LocalStorageKeys.UserInfo); + public async Task SetUserAsync(ApplicationUserSDto user) => await _localStorageService.SetItemAsync(LocalStorageKeys.UserInfo,user); + //public AccessToken? AccessToken { get; set; } //public List UserClaims => AccessToken == null ? new List() : AccessToken.Permissions; //public bool HasPermissionTo(string permission) => UserClaims.Any(c => c == permission); diff --git a/DocuMed.PWA/wwwroot/css/app.min.css b/DocuMed.PWA/wwwroot/css/app.min.css index 39de4c3..ee062ab 100644 --- a/DocuMed.PWA/wwwroot/css/app.min.css +++ b/DocuMed.PWA/wwwroot/css/app.min.css @@ -504,6 +504,9 @@ video { .left-0 { left: 0px; } +.right-0 { + right: 0px; +} .z-50 { z-index: 50; } @@ -905,6 +908,10 @@ video { padding-top: 0.5rem; padding-bottom: 0.5rem; } +.py-3 { + padding-top: 0.75rem; + padding-bottom: 0.75rem; +} .py-4 { padding-top: 1rem; padding-bottom: 1rem; diff --git a/DocuMed.PWA/wwwroot/css/app.output.css b/DocuMed.PWA/wwwroot/css/app.output.css index 124905d..cd695fc 100644 --- a/DocuMed.PWA/wwwroot/css/app.output.css +++ b/DocuMed.PWA/wwwroot/css/app.output.css @@ -557,6 +557,10 @@ video { left: 0px; } +.right-0 { + right: 0px; +} + .z-50 { z-index: 50; } @@ -1086,6 +1090,11 @@ video { padding-bottom: 1rem; } +.py-3 { + padding-top: 0.75rem; + padding-bottom: 0.75rem; +} + .pb-10 { padding-bottom: 2.5rem; } diff --git a/DocuMed.Repository/Migrations/20231021121504_addSections.Designer.cs b/DocuMed.Repository/Migrations/20231021121504_addSections.Designer.cs new file mode 100644 index 0000000..b300487 --- /dev/null +++ b/DocuMed.Repository/Migrations/20231021121504_addSections.Designer.cs @@ -0,0 +1,786 @@ +// +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 new file mode 100644 index 0000000..fa6ffd2 --- /dev/null +++ b/DocuMed.Repository/Migrations/20231021121504_addSections.cs @@ -0,0 +1,58 @@ +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 new file mode 100644 index 0000000..a8ae463 --- /dev/null +++ b/DocuMed.Repository/Migrations/20231021122606_editUser.Designer.cs @@ -0,0 +1,797 @@ +// +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 new file mode 100644 index 0000000..80d09ee --- /dev/null +++ b/DocuMed.Repository/Migrations/20231021122606_editUser.cs @@ -0,0 +1,68 @@ +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.Designer.cs b/DocuMed.Repository/Migrations/20231022121751_editTemplate.Designer.cs new file mode 100644 index 0000000..4046897 --- /dev/null +++ b/DocuMed.Repository/Migrations/20231022121751_editTemplate.Designer.cs @@ -0,0 +1,800 @@ +// +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("20231022121751_editTemplate")] + partial class editTemplate + { + /// + 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.Property("SectionId") + .HasColumnType("uuid"); + + 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/20231022121751_editTemplate.cs b/DocuMed.Repository/Migrations/20231022121751_editTemplate.cs new file mode 100644 index 0000000..21278c8 --- /dev/null +++ b/DocuMed.Repository/Migrations/20231022121751_editTemplate.cs @@ -0,0 +1,32 @@ +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/ApplicationContextModelSnapshot.cs b/DocuMed.Repository/Migrations/ApplicationContextModelSnapshot.cs index 8cfe567..9e9f557 100644 --- a/DocuMed.Repository/Migrations/ApplicationContextModelSnapshot.cs +++ b/DocuMed.Repository/Migrations/ApplicationContextModelSnapshot.cs @@ -62,6 +62,54 @@ namespace DocuMed.Repository.Migrations 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") @@ -364,6 +412,9 @@ namespace DocuMed.Repository.Migrations .IsRequired() .HasColumnType("text"); + b.Property("SectionId") + .HasColumnType("uuid"); + b.HasKey("Id"); b.ToTable("MedicalHistoryTemplates", "public"); @@ -469,9 +520,8 @@ namespace DocuMed.Repository.Migrations b.Property("PhoneNumberConfirmed") .HasColumnType("boolean"); - b.Property("Section") - .IsRequired() - .HasColumnType("text"); + b.Property("SectionId") + .HasColumnType("uuid"); b.Property("SecurityStamp") .HasColumnType("text"); @@ -479,6 +529,10 @@ namespace DocuMed.Repository.Migrations b.Property("SignUpStatus") .HasColumnType("integer"); + b.Property("StudentId") + .IsRequired() + .HasColumnType("text"); + b.Property("TwoFactorEnabled") .HasColumnType("boolean"); @@ -498,6 +552,8 @@ namespace DocuMed.Repository.Migrations .IsUnique() .HasDatabaseName("UserNameIndex"); + b.HasIndex("SectionId"); + b.HasIndex("UniversityId"); b.ToTable("Users", "public"); @@ -606,6 +662,17 @@ namespace DocuMed.Repository.Migrations 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") @@ -641,10 +708,16 @@ namespace DocuMed.Repository.Migrations 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"); }); @@ -704,6 +777,11 @@ namespace DocuMed.Repository.Migrations 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");