diff --git a/AnalysisData/AnalysisData.sln.DotSettings.user b/AnalysisData/AnalysisData.sln.DotSettings.user index 6420aaa..42093ae 100644 --- a/AnalysisData/AnalysisData.sln.DotSettings.user +++ b/AnalysisData/AnalysisData.sln.DotSettings.user @@ -44,10 +44,22 @@ </TestAncestor> </SessionState> <SessionState ContinuousTestingMode="0" Name="All tests from &lt;TestProject&gt;" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"> - <Project Location="C:\Users\Mahdi\Desktop\New folder (2)\Summer1403-Project-Group03-Backend\AnalysisData\TestProject" Presentation="&lt;TestProject&gt;" /> + <TestAncestor> + <TestId>xUnit::9AEC1F3F-B1B3-47C1-82D4-E432E2D77E0E::net8.0::TestProject.User.Repository.RoleRepository.RoleRepositoryTests</TestId> + </TestAncestor> +</SessionState> + <SessionState ContinuousTestingMode="0" Name="DeleteRole_ShouldRemovesRoleAndReturnsTrue_WhenRoleExists" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"> + <TestAncestor> + <TestId>xUnit::9AEC1F3F-B1B3-47C1-82D4-E432E2D77E0E::net8.0::TestProject.User.Repository.RoleRepository.RoleRepositoryTests</TestId> + </TestAncestor> </SessionState> <SessionState ContinuousTestingMode="0" IsActive="True" Name="All tests from &lt;TestProject&gt; #2" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"> - <Project Location="C:\Users\Mahdi\Desktop\New folder (2)\Summer1403-Project-Group03-Backend\AnalysisData\TestProject" Presentation="&lt;TestProject&gt;" /> + <TestAncestor> + <TestId>xUnit::9AEC1F3F-B1B3-47C1-82D4-E432E2D77E0E::net8.0::TestProject.User.Repository.UserRepository.UserRepositoryTests</TestId> + <TestId>xUnit::9AEC1F3F-B1B3-47C1-82D4-E432E2D77E0E::net8.0::TestProject.User.Repository.RoleRepository.RoleRepositoryTests</TestId> + <TestId>xUnit::9AEC1F3F-B1B3-47C1-82D4-E432E2D77E0E::net8.0::TestProject.User.Services.AdminService.AdminRegisterServiceTests</TestId> + <TestId>xUnit::9AEC1F3F-B1B3-47C1-82D4-E432E2D77E0E::net8.0::TestProject.User.Services.AdminService.AdminServiceTests</TestId> + </TestAncestor> </SessionState> True True diff --git a/AnalysisData/AnalysisData/Data/ApplicationDbContext.cs b/AnalysisData/AnalysisData/Data/ApplicationDbContext.cs index 2f5f1c5..7f85261 100644 --- a/AnalysisData/AnalysisData/Data/ApplicationDbContext.cs +++ b/AnalysisData/AnalysisData/Data/ApplicationDbContext.cs @@ -36,11 +36,12 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) ); modelBuilder.Entity().HasData( + new User { Id = Guid.NewGuid(), Username = "admin", - Password = ("admin"), + Password = "jGl25bVBBBW96Qi9Te4V37Fnqchz/Eu4qB9vKrRIqRg=", PhoneNumber = "09131111111", FirstName = "admin", LastName = "admin", diff --git a/AnalysisData/AnalysisData/Graph/Dto/NodeDto/NodeDto.cs b/AnalysisData/AnalysisData/Graph/Dto/NodeDto/NodeDto.cs index f938f84..4a01c9c 100644 --- a/AnalysisData/AnalysisData/Graph/Dto/NodeDto/NodeDto.cs +++ b/AnalysisData/AnalysisData/Graph/Dto/NodeDto/NodeDto.cs @@ -2,6 +2,6 @@ namespace AnalysisData.EAV.Dto; public class NodeDto { - public string Id { get; set; } + public int Id { get; set; } public string Label { get; set; } } \ No newline at end of file diff --git a/AnalysisData/AnalysisData/Graph/Service/GraphServices/Relationship/GraphRelationService.cs b/AnalysisData/AnalysisData/Graph/Service/GraphServices/Relationship/GraphRelationService.cs index c3173f7..d143ee4 100644 --- a/AnalysisData/AnalysisData/Graph/Service/GraphServices/Relationship/GraphRelationService.cs +++ b/AnalysisData/AnalysisData/Graph/Service/GraphServices/Relationship/GraphRelationService.cs @@ -65,7 +65,7 @@ public GraphRelationService(IEntityNodeRepository entityNodeRepository, IEntityE var edges = await _entityEdgeRepository.FindNodeLoopsAsync(node.Id); var uniqueNodes = edges.SelectMany(x => new[] { x.EntityIDTarget, x.EntityIDSource }).Distinct().ToList(); var nodes = await GetEntityNodesByIdsAsync(uniqueNodes); - var nodeDto = nodes.Select(x => new NodeDto() { Id = x.Id.ToString(), Label = x.Name }); + var nodeDto = nodes.Select(x => new NodeDto() { Id = x.Id, Label = x.Name }); var edgeDto = edges.Select(x => new EdgeDto() { From = x.EntityIDSource, To = x.EntityIDTarget, Id = x.Id }); return (nodeDto, edgeDto); diff --git a/AnalysisData/AnalysisData/Migrations/ApplicationDbContextModelSnapshot.cs b/AnalysisData/AnalysisData/Migrations/ApplicationDbContextModelSnapshot.cs deleted file mode 100644 index a770415..0000000 --- a/AnalysisData/AnalysisData/Migrations/ApplicationDbContextModelSnapshot.cs +++ /dev/null @@ -1,432 +0,0 @@ -// -using System; -using AnalysisData.Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace AnalysisData.Migrations -{ - [DbContext(typeof(ApplicationDbContext))] - partial class ApplicationDbContextModelSnapshot : ModelSnapshot - { - protected override void BuildModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.7") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("AnalysisData.EAV.Model.AttributeEdge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("AttributeEdges"); - }); - - modelBuilder.Entity("AnalysisData.EAV.Model.AttributeNode", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("AttributeNodes"); - }); - - modelBuilder.Entity("AnalysisData.EAV.Model.Category", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Categories"); - }); - - modelBuilder.Entity("AnalysisData.EAV.Model.EntityEdge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("EntityIDSource") - .HasColumnType("integer"); - - b.Property("EntityIDTarget") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.ToTable("EntityEdges"); - }); - - modelBuilder.Entity("AnalysisData.EAV.Model.EntityNode", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NodeFileReferenceId") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("NodeFileReferenceId"); - - b.ToTable("EntityNodes"); - }); - - modelBuilder.Entity("AnalysisData.EAV.Model.FileEntity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("FileName") - .IsRequired() - .HasColumnType("text"); - - b.Property("UploadDate") - .HasColumnType("timestamp with time zone"); - - b.Property("UploaderId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("CategoryId"); - - b.HasIndex("UploaderId"); - - b.ToTable("FileUploadedDb"); - }); - - modelBuilder.Entity("AnalysisData.EAV.Model.UserFile", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("FileId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("FileId"); - - b.HasIndex("UserId"); - - b.ToTable("UserFiles"); - }); - - modelBuilder.Entity("AnalysisData.EAV.Model.ValueEdge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AttributeId") - .HasColumnType("integer"); - - b.Property("EntityId") - .HasColumnType("integer"); - - b.Property("Value") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AttributeId"); - - b.HasIndex("EntityId"); - - b.ToTable("ValueEdges"); - }); - - modelBuilder.Entity("AnalysisData.EAV.Model.ValueNode", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AttributeId") - .HasColumnType("integer"); - - b.Property("EntityId") - .HasColumnType("integer"); - - b.Property("Value") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AttributeId"); - - b.HasIndex("EntityId"); - - b.ToTable("ValueNodes"); - }); - - modelBuilder.Entity("AnalysisData.UserManage.Model.Role", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("RoleName") - .IsRequired() - .HasColumnType("text"); - - b.Property("RolePolicy") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Roles"); - - b.HasData( - new - { - Id = 1, - RoleName = "admin", - RolePolicy = "gold" - }, - new - { - Id = 2, - RoleName = "Data-Analyst", - RolePolicy = "bronze" - }, - new - { - Id = 3, - RoleName = "Data-Manager", - RolePolicy = "silver" - }); - }); - - modelBuilder.Entity("AnalysisData.UserManage.Model.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Email") - .IsRequired() - .HasColumnType("text"); - - b.Property("FirstName") - .IsRequired() - .HasColumnType("text"); - - b.Property("ImageURL") - .HasColumnType("text"); - - b.Property("LastName") - .IsRequired() - .HasColumnType("text"); - - b.Property("Password") - .IsRequired() - .HasColumnType("text"); - - b.Property("PhoneNumber") - .IsRequired() - .HasColumnType("text"); - - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("Username") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("Users"); - - b.HasData( - new - { - Id = new Guid("85906ba5-c7bb-4708-83db-46734d4adf09"), - Email = "admin@gmail.com", - FirstName = "admin", - LastName = "admin", - Password = "admin", - PhoneNumber = "09131111111", - RoleId = 1, - Username = "admin" - }); - }); - - modelBuilder.Entity("AnalysisData.EAV.Model.EntityNode", b => - { - b.HasOne("AnalysisData.EAV.Model.FileEntity", "FileEntity") - .WithMany("EntityNodes") - .HasForeignKey("NodeFileReferenceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FileEntity"); - }); - - modelBuilder.Entity("AnalysisData.EAV.Model.FileEntity", b => - { - b.HasOne("AnalysisData.EAV.Model.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("AnalysisData.UserManage.Model.User", "User") - .WithMany("UploadData") - .HasForeignKey("UploaderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Category"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AnalysisData.EAV.Model.UserFile", b => - { - b.HasOne("AnalysisData.EAV.Model.FileEntity", "FileEntity") - .WithMany() - .HasForeignKey("FileId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("AnalysisData.UserManage.Model.User", "User") - .WithMany("UserFiles") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FileEntity"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("AnalysisData.EAV.Model.ValueEdge", b => - { - b.HasOne("AnalysisData.EAV.Model.AttributeEdge", "Attribute") - .WithMany() - .HasForeignKey("AttributeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("AnalysisData.EAV.Model.EntityEdge", "Entity") - .WithMany() - .HasForeignKey("EntityId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Attribute"); - - b.Navigation("Entity"); - }); - - modelBuilder.Entity("AnalysisData.EAV.Model.ValueNode", b => - { - b.HasOne("AnalysisData.EAV.Model.AttributeNode", "Attribute") - .WithMany() - .HasForeignKey("AttributeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("AnalysisData.EAV.Model.EntityNode", "Entity") - .WithMany() - .HasForeignKey("EntityId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Attribute"); - - b.Navigation("Entity"); - }); - - modelBuilder.Entity("AnalysisData.UserManage.Model.User", b => - { - b.HasOne("AnalysisData.UserManage.Model.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("AnalysisData.EAV.Model.FileEntity", b => - { - b.Navigation("EntityNodes"); - }); - - modelBuilder.Entity("AnalysisData.UserManage.Model.User", b => - { - b.Navigation("UploadData"); - - b.Navigation("UserFiles"); - }); -#pragma warning restore 612, 618 - } - } -}