Commit 1d5f4c82 authored by hasan khaddour's avatar hasan khaddour

update infrastucture

parent 17a7a1c9
...@@ -2,8 +2,7 @@ ...@@ -2,8 +2,7 @@
using PSManagement.Domain.Customers.Aggregate; using PSManagement.Domain.Customers.Aggregate;
using PSManagement.Domain.Employees.Entities; using PSManagement.Domain.Employees.Entities;
using PSManagement.Domain.Identity.Entities; using PSManagement.Domain.Identity.Entities;
using PSManagement.Domain.Projects.Aggregate; using PSManagement.Domain.Projects.Entities;
using PSManagement.Domain.Steps.Entities;
using PSManagement.Domain.Tracking; using PSManagement.Domain.Tracking;
using PSManagement.Domain.Tracking.Entities; using PSManagement.Domain.Tracking.Entities;
...@@ -26,9 +25,7 @@ namespace PSManagement.Infrastructure.Persistence ...@@ -26,9 +25,7 @@ namespace PSManagement.Infrastructure.Persistence
public DbSet<Project> Projects { get; set; } public DbSet<Project> Projects { get; set; }
public DbSet<Step> Steps { get; set; } public DbSet<Step> Steps { get; set; }
public DbSet<Item> Items { get; set; }
public DbSet<Track> Tracks { get; set; } public DbSet<Track> Tracks { get; set; }
public DbSet<EmployeeWork> EmployeeWorks { get; set; }
public DbSet<StepTrack> StepTracks { get; set; } public DbSet<StepTrack> StepTracks { get; set; }
......
...@@ -3,7 +3,9 @@ using Microsoft.Extensions.Configuration; ...@@ -3,7 +3,9 @@ using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using PSManagement.Domain.Customers.Repositories; using PSManagement.Domain.Customers.Repositories;
using PSManagement.Domain.Identity.Repositories; using PSManagement.Domain.Identity.Repositories;
using PSManagement.Domain.Projects.Repositories;
using PSManagement.Infrastructure.Persistence.Repositories.CustomerRepository; using PSManagement.Infrastructure.Persistence.Repositories.CustomerRepository;
using PSManagement.Infrastructure.Persistence.Repositories.ProjectRepository;
using PSManagement.Infrastructure.Persistence.Repositories.UserRepository; using PSManagement.Infrastructure.Persistence.Repositories.UserRepository;
namespace PSManagement.Infrastructure.Persistence.DI namespace PSManagement.Infrastructure.Persistence.DI
...@@ -18,6 +20,7 @@ namespace PSManagement.Infrastructure.Persistence.DI ...@@ -18,6 +20,7 @@ namespace PSManagement.Infrastructure.Persistence.DI
}); });
services.AddScoped<IUsersRepository, UsersRepository>(); services.AddScoped<IUsersRepository, UsersRepository>();
services.AddScoped<ICustomersRepository, CustomersReposiotry>(); services.AddScoped<ICustomersRepository, CustomersReposiotry>();
services.AddScoped<IProjectsRepository, ProjectsRepository>();
return services; return services;
......
...@@ -20,6 +20,13 @@ namespace PSManagement.Infrastructure.Persistence.EntitiesConfiguration ...@@ -20,6 +20,13 @@ namespace PSManagement.Infrastructure.Persistence.EntitiesConfiguration
p.Property(e => e.CurrentWorkingHours).HasColumnName("CurrentWorkingHours"); p.Property(e => e.CurrentWorkingHours).HasColumnName("CurrentWorkingHours");
} }
); );
builder.OwnsOne(c => c.WorkInfo,
p => {
p.Property(e => e.WorkJob).HasColumnName("WorkJob");
p.Property(e => e.WorkType).HasColumnName("WorkType");
}
);
builder.OwnsOne(c => c.PersonalInfo, builder.OwnsOne(c => c.PersonalInfo,
p => { p => {
p.Property(e => e.LastName).HasColumnName("LastName"); p.Property(e => e.LastName).HasColumnName("LastName");
......
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using PSManagement.Domain.Projects.Entities;
namespace PSManagement.Infrastructure.Persistence.EntitiesConfiguration
{
public class FinicialSpendingEntityConfiguration :
IEntityTypeConfiguration<FinincialSpending>
{
public void Configure(EntityTypeBuilder<FinincialSpending> builder)
{
builder.OwnsOne(e => e.ExternalPurchase, p =>
{
p.Property(e => e.Ammount).HasColumnName("ExternalPurchaseAmmount");
p.Property(e => e.Currency).HasColumnName("ExternalPurchaseCurrency").HasDefaultValue("USD");
});
builder.OwnsOne(e => e.LocalPurchase, p =>
{
p.Property(e => e.Ammount).HasColumnName("LocalPurchaseAmmount");
p.Property(e => e.Currency).HasColumnName("LocalPurchaseCurrency").HasDefaultValue("SP");
});
}
}
}
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using PSManagement.Domain.Steps.Entities;
namespace PSManagement.Infrastructure.Persistence.EntitiesConfiguration
{
public class ItemEntityConfiguration : IEntityTypeConfiguration<Item>
{
public void Configure(EntityTypeBuilder<Item> builder)
{
builder.OwnsOne(c => c.Price,
p => {
p.Property(e => e.Ammount).HasColumnName("Ammount");
p.Property(e => e.Currency).HasColumnName("Currency");
}
);
}
}
}
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders; using Microsoft.EntityFrameworkCore.Metadata.Builders;
using PSManagement.Domain.Employees.Entities; using PSManagement.Domain.Employees.Entities;
using PSManagement.Domain.Projects.Aggregate;
using PSManagement.Domain.Projects.Entities; using PSManagement.Domain.Projects.Entities;
namespace PSManagement.Infrastructure.Persistence.EntitiesConfiguration namespace PSManagement.Infrastructure.Persistence.EntitiesConfiguration
...@@ -48,7 +47,7 @@ namespace PSManagement.Infrastructure.Persistence.EntitiesConfiguration ...@@ -48,7 +47,7 @@ namespace PSManagement.Infrastructure.Persistence.EntitiesConfiguration
.OnDelete(DeleteBehavior.Restrict) .OnDelete(DeleteBehavior.Restrict)
.IsRequired(false); .IsRequired(false);
builder.HasOne(e => e.Proposer).WithMany().HasForeignKey(e=>e.ProposerId);
builder.OwnsOne(c => c.ProposalInfo, builder.OwnsOne(c => c.ProposalInfo,
p => { p => {
p.Property(e => e.ProposingBookDate).HasColumnName("ProposingBookDate"); p.Property(e => e.ProposingBookDate).HasColumnName("ProposingBookDate");
...@@ -61,7 +60,9 @@ namespace PSManagement.Infrastructure.Persistence.EntitiesConfiguration ...@@ -61,7 +60,9 @@ namespace PSManagement.Infrastructure.Persistence.EntitiesConfiguration
p.Property(e => e.Source).HasColumnName("FinicialSource"); p.Property(e => e.Source).HasColumnName("FinicialSource");
} }
); );
builder.HasOne(e => e.ProjectStatus).WithMany();
builder.HasMany(e => e.FinincialSpending);
builder.HasMany(e => e.Tracks).WithOne(e => e.Project).HasForeignKey(e => e.ProjectId); builder.HasMany(e => e.Tracks).WithOne(e => e.Project).HasForeignKey(e => e.ProjectId);
} }
......
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders; using Microsoft.EntityFrameworkCore.Metadata.Builders;
using PSManagement.Domain.Steps.Entities; using PSManagement.Domain.Projects.Entities;
namespace PSManagement.Infrastructure.Persistence.EntitiesConfiguration namespace PSManagement.Infrastructure.Persistence.EntitiesConfiguration
{ {
......
...@@ -21,6 +21,8 @@ namespace PSManagement.Infrastructure.Persistence.EntitiesConfiguration ...@@ -21,6 +21,8 @@ namespace PSManagement.Infrastructure.Persistence.EntitiesConfiguration
.WithMany(p => p.Tracks) .WithMany(p => p.Tracks)
.HasForeignKey(t => t.ProjectId) .HasForeignKey(t => t.ProjectId)
.OnDelete(DeleteBehavior.Restrict); .OnDelete(DeleteBehavior.Restrict);
builder.Ignore(e => e.TrackedEmployees);
//builder.HasMany(e => e.TrackedEmployees) //builder.HasMany(e => e.TrackedEmployees)
// .WithMany(e => e.trac) // .WithMany(e => e.trac)
// .UsingEntity<EmployeeParticipate>( // .UsingEntity<EmployeeParticipate>(
......
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using PSManagement.Infrastructure.Persistence;
namespace PSManagement.Infrastructure.Persistence.Migrations
{
[DbContext(typeof(AppDbContext))]
[Migration("20240803172417_AddDomains")]
partial class AddDomains
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Relational:Collation", "Arabic_CI_AS")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("ProductVersion", "5.0.17")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("PSManagement.Domain.Customers.Aggregate.Customer", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("CustomerName")
.HasColumnType("nvarchar(max)");
b.Property<string>("Email")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Customers");
});
modelBuilder.Entity("PSManagement.Domain.Employees.Entities.Department", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Departments");
});
modelBuilder.Entity("PSManagement.Domain.Employees.Entities.Employee", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("HIASTId")
.HasColumnType("int");
b.Property<int?>("ProjectId")
.HasColumnType("int");
b.Property<int?>("StepId")
.HasColumnType("int");
b.Property<int>("UserId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ProjectId");
b.HasIndex("StepId");
b.HasIndex("UserId")
.IsUnique();
b.ToTable("Employees");
});
modelBuilder.Entity("PSManagement.Domain.Identity.Entities.Permission", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.Property<int?>("PermissionId")
.HasColumnType("int");
b.Property<int?>("RoleId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("PermissionId");
b.HasIndex("RoleId");
b.ToTable("Permission");
});
modelBuilder.Entity("PSManagement.Domain.Identity.Entities.Role", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Role");
});
modelBuilder.Entity("PSManagement.Domain.Identity.Entities.User", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Email")
.HasColumnType("nvarchar(max)");
b.Property<string>("HashedPassword")
.HasColumnType("nvarchar(max)");
b.Property<string>("UserName")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Users");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Aggregate.Project", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int?>("ExecuterId")
.HasColumnType("int");
b.Property<int?>("ProposerId")
.HasColumnType("int");
b.Property<int?>("TeamLeaderId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ExecuterId");
b.HasIndex("ProposerId");
b.HasIndex("TeamLeaderId");
b.ToTable("Projects");
});
modelBuilder.Entity("PSManagement.Domain.Steps.Entities.Item", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("ItemDescription")
.HasColumnType("nvarchar(max)");
b.Property<string>("ItemName")
.HasColumnType("nvarchar(max)");
b.Property<int?>("StepId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("StepId");
b.ToTable("Items");
});
modelBuilder.Entity("PSManagement.Domain.Steps.Entities.Step", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Description")
.HasColumnType("nvarchar(max)");
b.Property<int>("Duration")
.HasColumnType("int");
b.Property<int>("ProjectId")
.HasColumnType("int");
b.Property<DateTime>("StartDate")
.HasColumnType("datetime2");
b.Property<string>("StepName")
.HasColumnType("nvarchar(max)");
b.Property<int?>("TrackId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ProjectId");
b.HasIndex("TrackId");
b.ToTable("Steps");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.EmployeeWork", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("ContributingRatio")
.HasColumnType("int");
b.Property<int>("EmployeeId")
.HasColumnType("int");
b.Property<int>("EmployeeWorkId")
.HasColumnType("int");
b.Property<int>("HoursWorked")
.HasColumnType("int");
b.Property<string>("Notes")
.HasColumnType("nvarchar(max)");
b.Property<int>("StepTrackId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("EmployeeId");
b.HasIndex("StepTrackId");
b.ToTable("EmployeeWorks");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.StepTrack", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("StepId")
.HasColumnType("int");
b.Property<int>("TrackId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("StepId");
b.HasIndex("TrackId");
b.ToTable("StepTracks");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Track", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("ProjectId")
.HasColumnType("int");
b.Property<DateTime>("TrackDate")
.HasColumnType("datetime2");
b.Property<string>("TrackNote")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.HasIndex("ProjectId");
b.ToTable("Tracks");
});
modelBuilder.Entity("RoleUser", b =>
{
b.Property<int>("RolesId")
.HasColumnType("int");
b.Property<int>("UsersId")
.HasColumnType("int");
b.HasKey("RolesId", "UsersId");
b.HasIndex("UsersId");
b.ToTable("RoleUser");
});
modelBuilder.Entity("PSManagement.Domain.Customers.Aggregate.Customer", b =>
{
b.OwnsMany("PSManagement.Domain.Customers.Entities.ContactInfo", "ContactInfo", b1 =>
{
b1.Property<int>("CustomerId")
.HasColumnType("int");
b1.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<string>("ContactType")
.HasColumnType("nvarchar(max)");
b1.Property<string>("ContactValue")
.HasColumnType("nvarchar(max)");
b1.HasKey("CustomerId", "Id");
b1.ToTable("ContactInfo");
b1.WithOwner()
.HasForeignKey("CustomerId");
});
b.OwnsOne("PSManagement.Domain.Customers.ValueObjects.Address", "Address", b1 =>
{
b1.Property<int>("CustomerId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<string>("City")
.HasColumnType("nvarchar(max)")
.HasColumnName("City");
b1.Property<string>("StreetName")
.HasColumnType("nvarchar(max)")
.HasColumnName("StreetName");
b1.Property<int>("StreetNumber")
.HasColumnType("int")
.HasColumnName("StreetNumber");
b1.Property<int>("ZipCode")
.HasColumnType("int")
.HasColumnName("ZipCode");
b1.HasKey("CustomerId");
b1.ToTable("Customers");
b1.WithOwner()
.HasForeignKey("CustomerId");
});
b.Navigation("Address");
b.Navigation("ContactInfo");
});
modelBuilder.Entity("PSManagement.Domain.Employees.Entities.Employee", b =>
{
b.HasOne("PSManagement.Domain.Projects.Aggregate.Project", null)
.WithMany("Participants")
.HasForeignKey("ProjectId");
b.HasOne("PSManagement.Domain.Steps.Entities.Step", null)
.WithMany("Participants")
.HasForeignKey("StepId");
b.HasOne("PSManagement.Domain.Identity.Entities.User", "User")
.WithOne("Employee")
.HasForeignKey("PSManagement.Domain.Employees.Entities.Employee", "UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.OwnsOne("PSManagement.Domain.Employees.Entities.Availability", "Availability", b1 =>
{
b1.Property<int>("EmployeeId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<int>("CurrentWorkingHours")
.HasColumnType("int")
.HasColumnName("CurrentWorkingHours");
b1.Property<bool>("IsAvailable")
.HasColumnType("bit")
.HasColumnName("IsAvailable");
b1.HasKey("EmployeeId");
b1.ToTable("Employees");
b1.WithOwner()
.HasForeignKey("EmployeeId");
});
b.OwnsOne("PSManagement.Domain.Employees.Entities.PersonalInfo", "PersonalInfo", b1 =>
{
b1.Property<int>("EmployeeId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<string>("FirstName")
.HasColumnType("nvarchar(max)")
.HasColumnName("FirstName");
b1.Property<string>("LastName")
.HasColumnType("nvarchar(max)")
.HasColumnName("LastName");
b1.HasKey("EmployeeId");
b1.ToTable("Employees");
b1.WithOwner()
.HasForeignKey("EmployeeId");
});
b.Navigation("Availability");
b.Navigation("PersonalInfo");
b.Navigation("User");
});
modelBuilder.Entity("PSManagement.Domain.Identity.Entities.Permission", b =>
{
b.HasOne("PSManagement.Domain.Identity.Entities.Permission", null)
.WithMany("Roles")
.HasForeignKey("PermissionId");
b.HasOne("PSManagement.Domain.Identity.Entities.Role", null)
.WithMany("Permissions")
.HasForeignKey("RoleId");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Aggregate.Project", b =>
{
b.HasOne("PSManagement.Domain.Employees.Entities.Department", "Executer")
.WithMany()
.HasForeignKey("ExecuterId");
b.HasOne("PSManagement.Domain.Customers.Aggregate.Customer", "Proposer")
.WithMany("Projects")
.HasForeignKey("ProposerId");
b.HasOne("PSManagement.Domain.Employees.Entities.Employee", "TeamLeader")
.WithMany()
.HasForeignKey("TeamLeaderId");
b.OwnsOne("PSManagement.Domain.Projects.Aggregate.Aggreement", "ProjectAggreement", b1 =>
{
b1.Property<int>("ProjectId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<DateTime>("AggreementDate")
.HasColumnType("datetime2")
.HasColumnName("AggreementDate");
b1.Property<int>("AggreementNumber")
.HasColumnType("int")
.HasColumnName("AggreementNumber");
b1.HasKey("ProjectId");
b1.ToTable("Projects");
b1.WithOwner()
.HasForeignKey("ProjectId");
});
b.OwnsOne("PSManagement.Domain.Projects.Aggregate.ProjectInfo", "ProjectInfo", b1 =>
{
b1.Property<int>("ProjectId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<string>("Code")
.HasColumnType("nvarchar(max)")
.HasColumnName("Code");
b1.Property<string>("Description")
.HasColumnType("nvarchar(max)")
.HasColumnName("Description");
b1.Property<string>("Name")
.HasColumnType("nvarchar(max)")
.HasColumnName("Name");
b1.HasKey("ProjectId");
b1.ToTable("Projects");
b1.WithOwner()
.HasForeignKey("ProjectId");
});
b.OwnsOne("PSManagement.Domain.Projects.Aggregate.ProposalInfo", "ProposalInfo", b1 =>
{
b1.Property<int>("ProjectId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<DateTime>("ProposingBookDate")
.HasColumnType("datetime2")
.HasColumnName("ProposingBookDate");
b1.Property<int>("ProposingBookNumber")
.HasColumnType("int")
.HasColumnName("ProposingBookNumber");
b1.HasKey("ProjectId");
b1.ToTable("Projects");
b1.WithOwner()
.HasForeignKey("ProjectId");
});
b.Navigation("Executer");
b.Navigation("ProjectAggreement");
b.Navigation("ProjectInfo");
b.Navigation("ProposalInfo");
b.Navigation("Proposer");
b.Navigation("TeamLeader");
});
modelBuilder.Entity("PSManagement.Domain.Steps.Entities.Item", b =>
{
b.HasOne("PSManagement.Domain.Steps.Entities.Step", null)
.WithMany("Purchases")
.HasForeignKey("StepId");
b.OwnsOne("PSManagement.SharedKernel.ValueObjects.Money", "Price", b1 =>
{
b1.Property<int>("ItemId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<int>("Ammount")
.HasColumnType("int")
.HasColumnName("Ammount");
b1.Property<string>("Currency")
.HasColumnType("nvarchar(max)")
.HasColumnName("Currency");
b1.HasKey("ItemId");
b1.ToTable("Items");
b1.WithOwner()
.HasForeignKey("ItemId");
});
b.Navigation("Price");
});
modelBuilder.Entity("PSManagement.Domain.Steps.Entities.Step", b =>
{
b.HasOne("PSManagement.Domain.Projects.Aggregate.Project", "Project")
.WithMany("Steps")
.HasForeignKey("ProjectId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PSManagement.Domain.Tracking.Track", null)
.WithMany("Steps")
.HasForeignKey("TrackId");
b.Navigation("Project");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.EmployeeWork", b =>
{
b.HasOne("PSManagement.Domain.Employees.Entities.Employee", "Employee")
.WithMany("EmployeeWorks")
.HasForeignKey("EmployeeId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("PSManagement.Domain.Tracking.Entities.StepTrack", "StepTrack")
.WithMany("EmployeeWorks")
.HasForeignKey("StepTrackId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Employee");
b.Navigation("StepTrack");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.StepTrack", b =>
{
b.HasOne("PSManagement.Domain.Steps.Entities.Step", "Step")
.WithMany("StepTracks")
.HasForeignKey("StepId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("PSManagement.Domain.Tracking.Track", "Track")
.WithMany("StepTracks")
.HasForeignKey("TrackId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Step");
b.Navigation("Track");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Track", b =>
{
b.HasOne("PSManagement.Domain.Projects.Aggregate.Project", "Project")
.WithMany("Tracks")
.HasForeignKey("ProjectId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Project");
});
modelBuilder.Entity("RoleUser", b =>
{
b.HasOne("PSManagement.Domain.Identity.Entities.Role", null)
.WithMany()
.HasForeignKey("RolesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PSManagement.Domain.Identity.Entities.User", null)
.WithMany()
.HasForeignKey("UsersId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("PSManagement.Domain.Customers.Aggregate.Customer", b =>
{
b.Navigation("Projects");
});
modelBuilder.Entity("PSManagement.Domain.Employees.Entities.Employee", b =>
{
b.Navigation("EmployeeWorks");
});
modelBuilder.Entity("PSManagement.Domain.Identity.Entities.Permission", b =>
{
b.Navigation("Roles");
});
modelBuilder.Entity("PSManagement.Domain.Identity.Entities.Role", b =>
{
b.Navigation("Permissions");
});
modelBuilder.Entity("PSManagement.Domain.Identity.Entities.User", b =>
{
b.Navigation("Employee");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Aggregate.Project", b =>
{
b.Navigation("Participants");
b.Navigation("Steps");
b.Navigation("Tracks");
});
modelBuilder.Entity("PSManagement.Domain.Steps.Entities.Step", b =>
{
b.Navigation("Participants");
b.Navigation("Purchases");
b.Navigation("StepTracks");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.StepTrack", b =>
{
b.Navigation("EmployeeWorks");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Track", b =>
{
b.Navigation("Steps");
b.Navigation("StepTracks");
});
#pragma warning restore 612, 618
}
}
}
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using PSManagement.Infrastructure.Persistence;
namespace PSManagement.Infrastructure.Persistence.Migrations
{
[DbContext(typeof(AppDbContext))]
[Migration("20240803172708_AddDomains2")]
partial class AddDomains2
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Relational:Collation", "Arabic_CI_AS")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("ProductVersion", "5.0.17")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("PSManagement.Domain.Customers.Aggregate.Customer", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("CustomerName")
.HasColumnType("nvarchar(max)");
b.Property<string>("Email")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Customers");
});
modelBuilder.Entity("PSManagement.Domain.Employees.Entities.Department", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Departments");
});
modelBuilder.Entity("PSManagement.Domain.Employees.Entities.Employee", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("HIASTId")
.HasColumnType("int");
b.Property<int?>("ProjectId")
.HasColumnType("int");
b.Property<int?>("StepId")
.HasColumnType("int");
b.Property<int>("UserId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ProjectId");
b.HasIndex("StepId");
b.HasIndex("UserId")
.IsUnique();
b.ToTable("Employees");
});
modelBuilder.Entity("PSManagement.Domain.Identity.Entities.Permission", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.Property<int?>("PermissionId")
.HasColumnType("int");
b.Property<int?>("RoleId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("PermissionId");
b.HasIndex("RoleId");
b.ToTable("Permission");
});
modelBuilder.Entity("PSManagement.Domain.Identity.Entities.Role", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Roles");
});
modelBuilder.Entity("PSManagement.Domain.Identity.Entities.User", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Email")
.HasColumnType("nvarchar(max)");
b.Property<string>("HashedPassword")
.HasColumnType("nvarchar(max)");
b.Property<string>("UserName")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Users");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Aggregate.Project", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int?>("ExecuterId")
.HasColumnType("int");
b.Property<int?>("ProposerId")
.HasColumnType("int");
b.Property<int?>("TeamLeaderId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ExecuterId");
b.HasIndex("ProposerId");
b.HasIndex("TeamLeaderId");
b.ToTable("Projects");
});
modelBuilder.Entity("PSManagement.Domain.Steps.Entities.Item", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("ItemDescription")
.HasColumnType("nvarchar(max)");
b.Property<string>("ItemName")
.HasColumnType("nvarchar(max)");
b.Property<int?>("StepId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("StepId");
b.ToTable("Items");
});
modelBuilder.Entity("PSManagement.Domain.Steps.Entities.Step", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Description")
.HasColumnType("nvarchar(max)");
b.Property<int>("Duration")
.HasColumnType("int");
b.Property<int>("ProjectId")
.HasColumnType("int");
b.Property<DateTime>("StartDate")
.HasColumnType("datetime2");
b.Property<string>("StepName")
.HasColumnType("nvarchar(max)");
b.Property<int?>("TrackId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ProjectId");
b.HasIndex("TrackId");
b.ToTable("Steps");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.EmployeeWork", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("ContributingRatio")
.HasColumnType("int");
b.Property<int>("EmployeeId")
.HasColumnType("int");
b.Property<int>("EmployeeWorkId")
.HasColumnType("int");
b.Property<int>("HoursWorked")
.HasColumnType("int");
b.Property<string>("Notes")
.HasColumnType("nvarchar(max)");
b.Property<int>("StepTrackId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("EmployeeId");
b.HasIndex("StepTrackId");
b.ToTable("EmployeeWorks");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.StepTrack", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("StepId")
.HasColumnType("int");
b.Property<int>("TrackId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("StepId");
b.HasIndex("TrackId");
b.ToTable("StepTracks");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Track", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("ProjectId")
.HasColumnType("int");
b.Property<DateTime>("TrackDate")
.HasColumnType("datetime2");
b.Property<string>("TrackNote")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.HasIndex("ProjectId");
b.ToTable("Tracks");
});
modelBuilder.Entity("RoleUser", b =>
{
b.Property<int>("RolesId")
.HasColumnType("int");
b.Property<int>("UsersId")
.HasColumnType("int");
b.HasKey("RolesId", "UsersId");
b.HasIndex("UsersId");
b.ToTable("RoleUser");
});
modelBuilder.Entity("PSManagement.Domain.Customers.Aggregate.Customer", b =>
{
b.OwnsMany("PSManagement.Domain.Customers.Entities.ContactInfo", "ContactInfo", b1 =>
{
b1.Property<int>("CustomerId")
.HasColumnType("int");
b1.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<string>("ContactType")
.HasColumnType("nvarchar(max)");
b1.Property<string>("ContactValue")
.HasColumnType("nvarchar(max)");
b1.HasKey("CustomerId", "Id");
b1.ToTable("ContactInfo");
b1.WithOwner()
.HasForeignKey("CustomerId");
});
b.OwnsOne("PSManagement.Domain.Customers.ValueObjects.Address", "Address", b1 =>
{
b1.Property<int>("CustomerId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<string>("City")
.HasColumnType("nvarchar(max)")
.HasColumnName("City");
b1.Property<string>("StreetName")
.HasColumnType("nvarchar(max)")
.HasColumnName("StreetName");
b1.Property<int>("StreetNumber")
.HasColumnType("int")
.HasColumnName("StreetNumber");
b1.Property<int>("ZipCode")
.HasColumnType("int")
.HasColumnName("ZipCode");
b1.HasKey("CustomerId");
b1.ToTable("Customers");
b1.WithOwner()
.HasForeignKey("CustomerId");
});
b.Navigation("Address");
b.Navigation("ContactInfo");
});
modelBuilder.Entity("PSManagement.Domain.Employees.Entities.Employee", b =>
{
b.HasOne("PSManagement.Domain.Projects.Aggregate.Project", null)
.WithMany("Participants")
.HasForeignKey("ProjectId");
b.HasOne("PSManagement.Domain.Steps.Entities.Step", null)
.WithMany("Participants")
.HasForeignKey("StepId");
b.HasOne("PSManagement.Domain.Identity.Entities.User", "User")
.WithOne("Employee")
.HasForeignKey("PSManagement.Domain.Employees.Entities.Employee", "UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.OwnsOne("PSManagement.Domain.Employees.Entities.Availability", "Availability", b1 =>
{
b1.Property<int>("EmployeeId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<int>("CurrentWorkingHours")
.HasColumnType("int")
.HasColumnName("CurrentWorkingHours");
b1.Property<bool>("IsAvailable")
.HasColumnType("bit")
.HasColumnName("IsAvailable");
b1.HasKey("EmployeeId");
b1.ToTable("Employees");
b1.WithOwner()
.HasForeignKey("EmployeeId");
});
b.OwnsOne("PSManagement.Domain.Employees.Entities.PersonalInfo", "PersonalInfo", b1 =>
{
b1.Property<int>("EmployeeId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<string>("FirstName")
.HasColumnType("nvarchar(max)")
.HasColumnName("FirstName");
b1.Property<string>("LastName")
.HasColumnType("nvarchar(max)")
.HasColumnName("LastName");
b1.HasKey("EmployeeId");
b1.ToTable("Employees");
b1.WithOwner()
.HasForeignKey("EmployeeId");
});
b.Navigation("Availability");
b.Navigation("PersonalInfo");
b.Navigation("User");
});
modelBuilder.Entity("PSManagement.Domain.Identity.Entities.Permission", b =>
{
b.HasOne("PSManagement.Domain.Identity.Entities.Permission", null)
.WithMany("Roles")
.HasForeignKey("PermissionId");
b.HasOne("PSManagement.Domain.Identity.Entities.Role", null)
.WithMany("Permissions")
.HasForeignKey("RoleId");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Aggregate.Project", b =>
{
b.HasOne("PSManagement.Domain.Employees.Entities.Department", "Executer")
.WithMany()
.HasForeignKey("ExecuterId");
b.HasOne("PSManagement.Domain.Customers.Aggregate.Customer", "Proposer")
.WithMany("Projects")
.HasForeignKey("ProposerId");
b.HasOne("PSManagement.Domain.Employees.Entities.Employee", "TeamLeader")
.WithMany()
.HasForeignKey("TeamLeaderId");
b.OwnsOne("PSManagement.Domain.Projects.Aggregate.Aggreement", "ProjectAggreement", b1 =>
{
b1.Property<int>("ProjectId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<DateTime>("AggreementDate")
.HasColumnType("datetime2")
.HasColumnName("AggreementDate");
b1.Property<int>("AggreementNumber")
.HasColumnType("int")
.HasColumnName("AggreementNumber");
b1.HasKey("ProjectId");
b1.ToTable("Projects");
b1.WithOwner()
.HasForeignKey("ProjectId");
});
b.OwnsOne("PSManagement.Domain.Projects.Aggregate.ProjectInfo", "ProjectInfo", b1 =>
{
b1.Property<int>("ProjectId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<string>("Code")
.HasColumnType("nvarchar(max)")
.HasColumnName("Code");
b1.Property<string>("Description")
.HasColumnType("nvarchar(max)")
.HasColumnName("Description");
b1.Property<string>("Name")
.HasColumnType("nvarchar(max)")
.HasColumnName("Name");
b1.HasKey("ProjectId");
b1.ToTable("Projects");
b1.WithOwner()
.HasForeignKey("ProjectId");
});
b.OwnsOne("PSManagement.Domain.Projects.Aggregate.ProposalInfo", "ProposalInfo", b1 =>
{
b1.Property<int>("ProjectId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<DateTime>("ProposingBookDate")
.HasColumnType("datetime2")
.HasColumnName("ProposingBookDate");
b1.Property<int>("ProposingBookNumber")
.HasColumnType("int")
.HasColumnName("ProposingBookNumber");
b1.HasKey("ProjectId");
b1.ToTable("Projects");
b1.WithOwner()
.HasForeignKey("ProjectId");
});
b.Navigation("Executer");
b.Navigation("ProjectAggreement");
b.Navigation("ProjectInfo");
b.Navigation("ProposalInfo");
b.Navigation("Proposer");
b.Navigation("TeamLeader");
});
modelBuilder.Entity("PSManagement.Domain.Steps.Entities.Item", b =>
{
b.HasOne("PSManagement.Domain.Steps.Entities.Step", null)
.WithMany("Purchases")
.HasForeignKey("StepId");
b.OwnsOne("PSManagement.SharedKernel.ValueObjects.Money", "Price", b1 =>
{
b1.Property<int>("ItemId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<int>("Ammount")
.HasColumnType("int")
.HasColumnName("Ammount");
b1.Property<string>("Currency")
.HasColumnType("nvarchar(max)")
.HasColumnName("Currency");
b1.HasKey("ItemId");
b1.ToTable("Items");
b1.WithOwner()
.HasForeignKey("ItemId");
});
b.Navigation("Price");
});
modelBuilder.Entity("PSManagement.Domain.Steps.Entities.Step", b =>
{
b.HasOne("PSManagement.Domain.Projects.Aggregate.Project", "Project")
.WithMany("Steps")
.HasForeignKey("ProjectId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PSManagement.Domain.Tracking.Track", null)
.WithMany("Steps")
.HasForeignKey("TrackId");
b.Navigation("Project");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.EmployeeWork", b =>
{
b.HasOne("PSManagement.Domain.Employees.Entities.Employee", "Employee")
.WithMany("EmployeeWorks")
.HasForeignKey("EmployeeId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("PSManagement.Domain.Tracking.Entities.StepTrack", "StepTrack")
.WithMany("EmployeeWorks")
.HasForeignKey("StepTrackId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Employee");
b.Navigation("StepTrack");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.StepTrack", b =>
{
b.HasOne("PSManagement.Domain.Steps.Entities.Step", "Step")
.WithMany("StepTracks")
.HasForeignKey("StepId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("PSManagement.Domain.Tracking.Track", "Track")
.WithMany("StepTracks")
.HasForeignKey("TrackId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Step");
b.Navigation("Track");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Track", b =>
{
b.HasOne("PSManagement.Domain.Projects.Aggregate.Project", "Project")
.WithMany("Tracks")
.HasForeignKey("ProjectId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Project");
});
modelBuilder.Entity("RoleUser", b =>
{
b.HasOne("PSManagement.Domain.Identity.Entities.Role", null)
.WithMany()
.HasForeignKey("RolesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PSManagement.Domain.Identity.Entities.User", null)
.WithMany()
.HasForeignKey("UsersId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("PSManagement.Domain.Customers.Aggregate.Customer", b =>
{
b.Navigation("Projects");
});
modelBuilder.Entity("PSManagement.Domain.Employees.Entities.Employee", b =>
{
b.Navigation("EmployeeWorks");
});
modelBuilder.Entity("PSManagement.Domain.Identity.Entities.Permission", b =>
{
b.Navigation("Roles");
});
modelBuilder.Entity("PSManagement.Domain.Identity.Entities.Role", b =>
{
b.Navigation("Permissions");
});
modelBuilder.Entity("PSManagement.Domain.Identity.Entities.User", b =>
{
b.Navigation("Employee");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Aggregate.Project", b =>
{
b.Navigation("Participants");
b.Navigation("Steps");
b.Navigation("Tracks");
});
modelBuilder.Entity("PSManagement.Domain.Steps.Entities.Step", b =>
{
b.Navigation("Participants");
b.Navigation("Purchases");
b.Navigation("StepTracks");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.StepTrack", b =>
{
b.Navigation("EmployeeWorks");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Track", b =>
{
b.Navigation("Steps");
b.Navigation("StepTracks");
});
#pragma warning restore 612, 618
}
}
}
using Microsoft.EntityFrameworkCore.Migrations;
namespace PSManagement.Infrastructure.Persistence.Migrations
{
public partial class AddDomains2 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Permission_Role_RoleId",
table: "Permission");
migrationBuilder.DropForeignKey(
name: "FK_RoleUser_Role_RolesId",
table: "RoleUser");
migrationBuilder.DropPrimaryKey(
name: "PK_Role",
table: "Role");
migrationBuilder.RenameTable(
name: "Role",
newName: "Roles");
migrationBuilder.AddPrimaryKey(
name: "PK_Roles",
table: "Roles",
column: "Id");
migrationBuilder.AddForeignKey(
name: "FK_Permission_Roles_RoleId",
table: "Permission",
column: "RoleId",
principalTable: "Roles",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_RoleUser_Roles_RolesId",
table: "RoleUser",
column: "RolesId",
principalTable: "Roles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Permission_Roles_RoleId",
table: "Permission");
migrationBuilder.DropForeignKey(
name: "FK_RoleUser_Roles_RolesId",
table: "RoleUser");
migrationBuilder.DropPrimaryKey(
name: "PK_Roles",
table: "Roles");
migrationBuilder.RenameTable(
name: "Roles",
newName: "Role");
migrationBuilder.AddPrimaryKey(
name: "PK_Role",
table: "Role",
column: "Id");
migrationBuilder.AddForeignKey(
name: "FK_Permission_Role_RoleId",
table: "Permission",
column: "RoleId",
principalTable: "Role",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_RoleUser_Role_RolesId",
table: "RoleUser",
column: "RolesId",
principalTable: "Role",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
}
}
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using PSManagement.Infrastructure.Persistence;
namespace PSManagement.Infrastructure.Persistence.Migrations
{
[DbContext(typeof(AppDbContext))]
[Migration("20240803173142_AddDomains3")]
partial class AddDomains3
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Relational:Collation", "Arabic_CI_AS")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("ProductVersion", "5.0.17")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("PSManagement.Domain.Customers.Aggregate.Customer", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("CustomerName")
.HasColumnType("nvarchar(max)");
b.Property<string>("Email")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Customers");
});
modelBuilder.Entity("PSManagement.Domain.Employees.Entities.Department", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Departments");
});
modelBuilder.Entity("PSManagement.Domain.Employees.Entities.Employee", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("HIASTId")
.HasColumnType("int");
b.Property<int?>("ProjectId")
.HasColumnType("int");
b.Property<int?>("StepId")
.HasColumnType("int");
b.Property<int>("UserId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ProjectId");
b.HasIndex("StepId");
b.HasIndex("UserId")
.IsUnique();
b.ToTable("Employees");
});
modelBuilder.Entity("PSManagement.Domain.Identity.Entities.Permission", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Permission");
});
modelBuilder.Entity("PSManagement.Domain.Identity.Entities.Role", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Roles");
});
modelBuilder.Entity("PSManagement.Domain.Identity.Entities.User", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Email")
.HasColumnType("nvarchar(max)");
b.Property<string>("HashedPassword")
.HasColumnType("nvarchar(max)");
b.Property<string>("UserName")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Users");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Aggregate.Project", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int?>("ExecuterId")
.HasColumnType("int");
b.Property<int?>("ProposerId")
.HasColumnType("int");
b.Property<int?>("TeamLeaderId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ExecuterId");
b.HasIndex("ProposerId");
b.HasIndex("TeamLeaderId");
b.ToTable("Projects");
});
modelBuilder.Entity("PSManagement.Domain.Steps.Entities.Item", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("ItemDescription")
.HasColumnType("nvarchar(max)");
b.Property<string>("ItemName")
.HasColumnType("nvarchar(max)");
b.Property<int?>("StepId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("StepId");
b.ToTable("Items");
});
modelBuilder.Entity("PSManagement.Domain.Steps.Entities.Step", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Description")
.HasColumnType("nvarchar(max)");
b.Property<int>("Duration")
.HasColumnType("int");
b.Property<int>("ProjectId")
.HasColumnType("int");
b.Property<DateTime>("StartDate")
.HasColumnType("datetime2");
b.Property<string>("StepName")
.HasColumnType("nvarchar(max)");
b.Property<int?>("TrackId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ProjectId");
b.HasIndex("TrackId");
b.ToTable("Steps");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.EmployeeWork", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("ContributingRatio")
.HasColumnType("int");
b.Property<int>("EmployeeId")
.HasColumnType("int");
b.Property<int>("EmployeeWorkId")
.HasColumnType("int");
b.Property<int>("HoursWorked")
.HasColumnType("int");
b.Property<string>("Notes")
.HasColumnType("nvarchar(max)");
b.Property<int>("StepTrackId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("EmployeeId");
b.HasIndex("StepTrackId");
b.ToTable("EmployeeWorks");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.StepTrack", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("StepId")
.HasColumnType("int");
b.Property<int>("TrackId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("StepId");
b.HasIndex("TrackId");
b.ToTable("StepTracks");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Track", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("ProjectId")
.HasColumnType("int");
b.Property<DateTime>("TrackDate")
.HasColumnType("datetime2");
b.Property<string>("TrackNote")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.HasIndex("ProjectId");
b.ToTable("Tracks");
});
modelBuilder.Entity("PermissionRole", b =>
{
b.Property<int>("PermissionsId")
.HasColumnType("int");
b.Property<int>("RolesId")
.HasColumnType("int");
b.HasKey("PermissionsId", "RolesId");
b.HasIndex("RolesId");
b.ToTable("PermissionRole");
});
modelBuilder.Entity("RoleUser", b =>
{
b.Property<int>("RolesId")
.HasColumnType("int");
b.Property<int>("UsersId")
.HasColumnType("int");
b.HasKey("RolesId", "UsersId");
b.HasIndex("UsersId");
b.ToTable("RoleUser");
});
modelBuilder.Entity("PSManagement.Domain.Customers.Aggregate.Customer", b =>
{
b.OwnsMany("PSManagement.Domain.Customers.Entities.ContactInfo", "ContactInfo", b1 =>
{
b1.Property<int>("CustomerId")
.HasColumnType("int");
b1.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<string>("ContactType")
.HasColumnType("nvarchar(max)");
b1.Property<string>("ContactValue")
.HasColumnType("nvarchar(max)");
b1.HasKey("CustomerId", "Id");
b1.ToTable("ContactInfo");
b1.WithOwner()
.HasForeignKey("CustomerId");
});
b.OwnsOne("PSManagement.Domain.Customers.ValueObjects.Address", "Address", b1 =>
{
b1.Property<int>("CustomerId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<string>("City")
.HasColumnType("nvarchar(max)")
.HasColumnName("City");
b1.Property<string>("StreetName")
.HasColumnType("nvarchar(max)")
.HasColumnName("StreetName");
b1.Property<int>("StreetNumber")
.HasColumnType("int")
.HasColumnName("StreetNumber");
b1.Property<int>("ZipCode")
.HasColumnType("int")
.HasColumnName("ZipCode");
b1.HasKey("CustomerId");
b1.ToTable("Customers");
b1.WithOwner()
.HasForeignKey("CustomerId");
});
b.Navigation("Address");
b.Navigation("ContactInfo");
});
modelBuilder.Entity("PSManagement.Domain.Employees.Entities.Employee", b =>
{
b.HasOne("PSManagement.Domain.Projects.Aggregate.Project", null)
.WithMany("Participants")
.HasForeignKey("ProjectId");
b.HasOne("PSManagement.Domain.Steps.Entities.Step", null)
.WithMany("Participants")
.HasForeignKey("StepId");
b.HasOne("PSManagement.Domain.Identity.Entities.User", "User")
.WithOne("Employee")
.HasForeignKey("PSManagement.Domain.Employees.Entities.Employee", "UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.OwnsOne("PSManagement.Domain.Employees.Entities.Availability", "Availability", b1 =>
{
b1.Property<int>("EmployeeId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<int>("CurrentWorkingHours")
.HasColumnType("int")
.HasColumnName("CurrentWorkingHours");
b1.Property<bool>("IsAvailable")
.HasColumnType("bit")
.HasColumnName("IsAvailable");
b1.HasKey("EmployeeId");
b1.ToTable("Employees");
b1.WithOwner()
.HasForeignKey("EmployeeId");
});
b.OwnsOne("PSManagement.Domain.Employees.Entities.PersonalInfo", "PersonalInfo", b1 =>
{
b1.Property<int>("EmployeeId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<string>("FirstName")
.HasColumnType("nvarchar(max)")
.HasColumnName("FirstName");
b1.Property<string>("LastName")
.HasColumnType("nvarchar(max)")
.HasColumnName("LastName");
b1.HasKey("EmployeeId");
b1.ToTable("Employees");
b1.WithOwner()
.HasForeignKey("EmployeeId");
});
b.Navigation("Availability");
b.Navigation("PersonalInfo");
b.Navigation("User");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Aggregate.Project", b =>
{
b.HasOne("PSManagement.Domain.Employees.Entities.Department", "Executer")
.WithMany()
.HasForeignKey("ExecuterId");
b.HasOne("PSManagement.Domain.Customers.Aggregate.Customer", "Proposer")
.WithMany("Projects")
.HasForeignKey("ProposerId");
b.HasOne("PSManagement.Domain.Employees.Entities.Employee", "TeamLeader")
.WithMany()
.HasForeignKey("TeamLeaderId");
b.OwnsOne("PSManagement.Domain.Projects.Aggregate.Aggreement", "ProjectAggreement", b1 =>
{
b1.Property<int>("ProjectId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<DateTime>("AggreementDate")
.HasColumnType("datetime2")
.HasColumnName("AggreementDate");
b1.Property<int>("AggreementNumber")
.HasColumnType("int")
.HasColumnName("AggreementNumber");
b1.HasKey("ProjectId");
b1.ToTable("Projects");
b1.WithOwner()
.HasForeignKey("ProjectId");
});
b.OwnsOne("PSManagement.Domain.Projects.Aggregate.ProjectInfo", "ProjectInfo", b1 =>
{
b1.Property<int>("ProjectId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<string>("Code")
.HasColumnType("nvarchar(max)")
.HasColumnName("Code");
b1.Property<string>("Description")
.HasColumnType("nvarchar(max)")
.HasColumnName("Description");
b1.Property<string>("Name")
.HasColumnType("nvarchar(max)")
.HasColumnName("Name");
b1.HasKey("ProjectId");
b1.ToTable("Projects");
b1.WithOwner()
.HasForeignKey("ProjectId");
});
b.OwnsOne("PSManagement.Domain.Projects.Aggregate.ProposalInfo", "ProposalInfo", b1 =>
{
b1.Property<int>("ProjectId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<DateTime>("ProposingBookDate")
.HasColumnType("datetime2")
.HasColumnName("ProposingBookDate");
b1.Property<int>("ProposingBookNumber")
.HasColumnType("int")
.HasColumnName("ProposingBookNumber");
b1.HasKey("ProjectId");
b1.ToTable("Projects");
b1.WithOwner()
.HasForeignKey("ProjectId");
});
b.Navigation("Executer");
b.Navigation("ProjectAggreement");
b.Navigation("ProjectInfo");
b.Navigation("ProposalInfo");
b.Navigation("Proposer");
b.Navigation("TeamLeader");
});
modelBuilder.Entity("PSManagement.Domain.Steps.Entities.Item", b =>
{
b.HasOne("PSManagement.Domain.Steps.Entities.Step", null)
.WithMany("Purchases")
.HasForeignKey("StepId");
b.OwnsOne("PSManagement.SharedKernel.ValueObjects.Money", "Price", b1 =>
{
b1.Property<int>("ItemId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<int>("Ammount")
.HasColumnType("int")
.HasColumnName("Ammount");
b1.Property<string>("Currency")
.HasColumnType("nvarchar(max)")
.HasColumnName("Currency");
b1.HasKey("ItemId");
b1.ToTable("Items");
b1.WithOwner()
.HasForeignKey("ItemId");
});
b.Navigation("Price");
});
modelBuilder.Entity("PSManagement.Domain.Steps.Entities.Step", b =>
{
b.HasOne("PSManagement.Domain.Projects.Aggregate.Project", "Project")
.WithMany("Steps")
.HasForeignKey("ProjectId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PSManagement.Domain.Tracking.Track", null)
.WithMany("Steps")
.HasForeignKey("TrackId");
b.Navigation("Project");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.EmployeeWork", b =>
{
b.HasOne("PSManagement.Domain.Employees.Entities.Employee", "Employee")
.WithMany("EmployeeWorks")
.HasForeignKey("EmployeeId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("PSManagement.Domain.Tracking.Entities.StepTrack", "StepTrack")
.WithMany("EmployeeWorks")
.HasForeignKey("StepTrackId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Employee");
b.Navigation("StepTrack");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.StepTrack", b =>
{
b.HasOne("PSManagement.Domain.Steps.Entities.Step", "Step")
.WithMany("StepTracks")
.HasForeignKey("StepId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("PSManagement.Domain.Tracking.Track", "Track")
.WithMany("StepTracks")
.HasForeignKey("TrackId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Step");
b.Navigation("Track");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Track", b =>
{
b.HasOne("PSManagement.Domain.Projects.Aggregate.Project", "Project")
.WithMany("Tracks")
.HasForeignKey("ProjectId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Project");
});
modelBuilder.Entity("PermissionRole", b =>
{
b.HasOne("PSManagement.Domain.Identity.Entities.Permission", null)
.WithMany()
.HasForeignKey("PermissionsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PSManagement.Domain.Identity.Entities.Role", null)
.WithMany()
.HasForeignKey("RolesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("RoleUser", b =>
{
b.HasOne("PSManagement.Domain.Identity.Entities.Role", null)
.WithMany()
.HasForeignKey("RolesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PSManagement.Domain.Identity.Entities.User", null)
.WithMany()
.HasForeignKey("UsersId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("PSManagement.Domain.Customers.Aggregate.Customer", b =>
{
b.Navigation("Projects");
});
modelBuilder.Entity("PSManagement.Domain.Employees.Entities.Employee", b =>
{
b.Navigation("EmployeeWorks");
});
modelBuilder.Entity("PSManagement.Domain.Identity.Entities.User", b =>
{
b.Navigation("Employee");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Aggregate.Project", b =>
{
b.Navigation("Participants");
b.Navigation("Steps");
b.Navigation("Tracks");
});
modelBuilder.Entity("PSManagement.Domain.Steps.Entities.Step", b =>
{
b.Navigation("Participants");
b.Navigation("Purchases");
b.Navigation("StepTracks");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.StepTrack", b =>
{
b.Navigation("EmployeeWorks");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Track", b =>
{
b.Navigation("Steps");
b.Navigation("StepTracks");
});
#pragma warning restore 612, 618
}
}
}
using Microsoft.EntityFrameworkCore.Migrations;
namespace PSManagement.Infrastructure.Persistence.Migrations
{
public partial class AddDomains3 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Permission_Permission_PermissionId",
table: "Permission");
migrationBuilder.DropForeignKey(
name: "FK_Permission_Roles_RoleId",
table: "Permission");
migrationBuilder.DropIndex(
name: "IX_Permission_PermissionId",
table: "Permission");
migrationBuilder.DropIndex(
name: "IX_Permission_RoleId",
table: "Permission");
migrationBuilder.DropColumn(
name: "PermissionId",
table: "Permission");
migrationBuilder.DropColumn(
name: "RoleId",
table: "Permission");
migrationBuilder.CreateTable(
name: "PermissionRole",
columns: table => new
{
PermissionsId = table.Column<int>(type: "int", nullable: false),
RolesId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_PermissionRole", x => new { x.PermissionsId, x.RolesId });
table.ForeignKey(
name: "FK_PermissionRole_Permission_PermissionsId",
column: x => x.PermissionsId,
principalTable: "Permission",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_PermissionRole_Roles_RolesId",
column: x => x.RolesId,
principalTable: "Roles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_PermissionRole_RolesId",
table: "PermissionRole",
column: "RolesId");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "PermissionRole");
migrationBuilder.AddColumn<int>(
name: "PermissionId",
table: "Permission",
type: "int",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "RoleId",
table: "Permission",
type: "int",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_Permission_PermissionId",
table: "Permission",
column: "PermissionId");
migrationBuilder.CreateIndex(
name: "IX_Permission_RoleId",
table: "Permission",
column: "RoleId");
migrationBuilder.AddForeignKey(
name: "FK_Permission_Permission_PermissionId",
table: "Permission",
column: "PermissionId",
principalTable: "Permission",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Permission_Roles_RoleId",
table: "Permission",
column: "RoleId",
principalTable: "Roles",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
}
}
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using PSManagement.Infrastructure.Persistence;
namespace PSManagement.Infrastructure.Persistence.Migrations
{
[DbContext(typeof(AppDbContext))]
[Migration("20240803180549_AddDomains4")]
partial class AddDomains4
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Relational:Collation", "Arabic_CI_AS")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("ProductVersion", "5.0.17")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("PSManagement.Domain.Customers.Aggregate.Customer", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("CustomerName")
.HasColumnType("nvarchar(max)");
b.Property<string>("Email")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Customers");
});
modelBuilder.Entity("PSManagement.Domain.Employees.Entities.Department", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Departments");
});
modelBuilder.Entity("PSManagement.Domain.Employees.Entities.Employee", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("HIASTId")
.HasColumnType("int");
b.Property<int?>("StepId")
.HasColumnType("int");
b.Property<int>("UserId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("StepId");
b.HasIndex("UserId")
.IsUnique();
b.ToTable("Employees");
});
modelBuilder.Entity("PSManagement.Domain.Identity.Entities.Permission", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Permission");
});
modelBuilder.Entity("PSManagement.Domain.Identity.Entities.Role", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Roles");
});
modelBuilder.Entity("PSManagement.Domain.Identity.Entities.User", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Email")
.HasColumnType("nvarchar(max)");
b.Property<string>("HashedPassword")
.HasColumnType("nvarchar(max)");
b.Property<string>("UserName")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Users");
});
modelBuilder.Entity("PSManagement.Domain.ProjectTypes.Entities.ProjectType", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Description")
.HasColumnType("nvarchar(max)");
b.Property<string>("TypeName")
.HasColumnType("nvarchar(max)");
b.Property<int>("WorkerCount")
.HasColumnType("int");
b.HasKey("Id");
b.ToTable("ProjectType");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Aggregate.Project", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int?>("ExecuterId")
.HasColumnType("int");
b.Property<int?>("ProjectTypeId")
.HasColumnType("int");
b.Property<int?>("ProposerId")
.HasColumnType("int");
b.Property<int?>("TeamLeaderId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ExecuterId");
b.HasIndex("ProjectTypeId");
b.HasIndex("ProposerId");
b.HasIndex("TeamLeaderId");
b.ToTable("Projects");
});
modelBuilder.Entity("PSManagement.Domain.Steps.Entities.Item", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("ItemDescription")
.HasColumnType("nvarchar(max)");
b.Property<string>("ItemName")
.HasColumnType("nvarchar(max)");
b.Property<int?>("StepId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("StepId");
b.ToTable("Items");
});
modelBuilder.Entity("PSManagement.Domain.Steps.Entities.Step", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Description")
.HasColumnType("nvarchar(max)");
b.Property<int>("Duration")
.HasColumnType("int");
b.Property<int>("ProjectId")
.HasColumnType("int");
b.Property<DateTime>("StartDate")
.HasColumnType("datetime2");
b.Property<string>("StepName")
.HasColumnType("nvarchar(max)");
b.Property<int?>("TrackId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ProjectId");
b.HasIndex("TrackId");
b.ToTable("Steps");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.EmployeeWork", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("ContributingRatio")
.HasColumnType("int");
b.Property<int>("EmployeeId")
.HasColumnType("int");
b.Property<int>("EmployeeWorkId")
.HasColumnType("int");
b.Property<int>("HoursWorked")
.HasColumnType("int");
b.Property<string>("Notes")
.HasColumnType("nvarchar(max)");
b.Property<int>("StepTrackId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("EmployeeId");
b.HasIndex("StepTrackId");
b.ToTable("EmployeeWorks");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.StepTrack", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("StepId")
.HasColumnType("int");
b.Property<int>("TrackId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("StepId");
b.HasIndex("TrackId");
b.ToTable("StepTracks");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Track", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("ProjectId")
.HasColumnType("int");
b.Property<DateTime>("TrackDate")
.HasColumnType("datetime2");
b.Property<string>("TrackNote")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.HasIndex("ProjectId");
b.ToTable("Tracks");
});
modelBuilder.Entity("PermissionRole", b =>
{
b.Property<int>("PermissionsId")
.HasColumnType("int");
b.Property<int>("RolesId")
.HasColumnType("int");
b.HasKey("PermissionsId", "RolesId");
b.HasIndex("RolesId");
b.ToTable("PermissionRole");
});
modelBuilder.Entity("RoleUser", b =>
{
b.Property<int>("RolesId")
.HasColumnType("int");
b.Property<int>("UsersId")
.HasColumnType("int");
b.HasKey("RolesId", "UsersId");
b.HasIndex("UsersId");
b.ToTable("RoleUser");
});
modelBuilder.Entity("PSManagement.Domain.Customers.Aggregate.Customer", b =>
{
b.OwnsMany("PSManagement.Domain.Customers.Entities.ContactInfo", "ContactInfo", b1 =>
{
b1.Property<int>("CustomerId")
.HasColumnType("int");
b1.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<string>("ContactType")
.HasColumnType("nvarchar(max)");
b1.Property<string>("ContactValue")
.HasColumnType("nvarchar(max)");
b1.HasKey("CustomerId", "Id");
b1.ToTable("ContactInfo");
b1.WithOwner()
.HasForeignKey("CustomerId");
});
b.OwnsOne("PSManagement.Domain.Customers.ValueObjects.Address", "Address", b1 =>
{
b1.Property<int>("CustomerId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<string>("City")
.HasColumnType("nvarchar(max)")
.HasColumnName("City");
b1.Property<string>("StreetName")
.HasColumnType("nvarchar(max)")
.HasColumnName("StreetName");
b1.Property<int>("StreetNumber")
.HasColumnType("int")
.HasColumnName("StreetNumber");
b1.Property<int>("ZipCode")
.HasColumnType("int")
.HasColumnName("ZipCode");
b1.HasKey("CustomerId");
b1.ToTable("Customers");
b1.WithOwner()
.HasForeignKey("CustomerId");
});
b.Navigation("Address");
b.Navigation("ContactInfo");
});
modelBuilder.Entity("PSManagement.Domain.Employees.Entities.Employee", b =>
{
b.HasOne("PSManagement.Domain.Steps.Entities.Step", null)
.WithMany("Participants")
.HasForeignKey("StepId");
b.HasOne("PSManagement.Domain.Identity.Entities.User", "User")
.WithOne("Employee")
.HasForeignKey("PSManagement.Domain.Employees.Entities.Employee", "UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.OwnsOne("PSManagement.Domain.Employees.Entities.Availability", "Availability", b1 =>
{
b1.Property<int>("EmployeeId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<int>("CurrentWorkingHours")
.HasColumnType("int")
.HasColumnName("CurrentWorkingHours");
b1.Property<bool>("IsAvailable")
.HasColumnType("bit")
.HasColumnName("IsAvailable");
b1.HasKey("EmployeeId");
b1.ToTable("Employees");
b1.WithOwner()
.HasForeignKey("EmployeeId");
});
b.OwnsOne("PSManagement.Domain.Employees.Entities.PersonalInfo", "PersonalInfo", b1 =>
{
b1.Property<int>("EmployeeId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<string>("FirstName")
.HasColumnType("nvarchar(max)")
.HasColumnName("FirstName");
b1.Property<string>("LastName")
.HasColumnType("nvarchar(max)")
.HasColumnName("LastName");
b1.HasKey("EmployeeId");
b1.ToTable("Employees");
b1.WithOwner()
.HasForeignKey("EmployeeId");
});
b.Navigation("Availability");
b.Navigation("PersonalInfo");
b.Navigation("User");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Aggregate.Project", b =>
{
b.HasOne("PSManagement.Domain.Employees.Entities.Department", "Executer")
.WithMany()
.HasForeignKey("ExecuterId");
b.HasOne("PSManagement.Domain.ProjectTypes.Entities.ProjectType", "ProjectType")
.WithMany("Projects")
.HasForeignKey("ProjectTypeId");
b.HasOne("PSManagement.Domain.Customers.Aggregate.Customer", "Proposer")
.WithMany("Projects")
.HasForeignKey("ProposerId");
b.HasOne("PSManagement.Domain.Employees.Entities.Employee", "TeamLeader")
.WithMany()
.HasForeignKey("TeamLeaderId");
b.OwnsOne("PSManagement.Domain.Projects.Aggregate.Aggreement", "ProjectAggreement", b1 =>
{
b1.Property<int>("ProjectId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<DateTime>("AggreementDate")
.HasColumnType("datetime2")
.HasColumnName("AggreementDate");
b1.Property<int>("AggreementNumber")
.HasColumnType("int")
.HasColumnName("AggreementNumber");
b1.HasKey("ProjectId");
b1.ToTable("Projects");
b1.WithOwner()
.HasForeignKey("ProjectId");
});
b.OwnsOne("PSManagement.Domain.Projects.Aggregate.ProjectInfo", "ProjectInfo", b1 =>
{
b1.Property<int>("ProjectId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<string>("Code")
.HasColumnType("nvarchar(max)")
.HasColumnName("Code");
b1.Property<string>("Description")
.HasColumnType("nvarchar(max)")
.HasColumnName("Description");
b1.Property<string>("Name")
.HasColumnType("nvarchar(max)")
.HasColumnName("Name");
b1.HasKey("ProjectId");
b1.ToTable("Projects");
b1.WithOwner()
.HasForeignKey("ProjectId");
});
b.OwnsOne("PSManagement.Domain.Projects.Aggregate.ProposalInfo", "ProposalInfo", b1 =>
{
b1.Property<int>("ProjectId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<DateTime>("ProposingBookDate")
.HasColumnType("datetime2")
.HasColumnName("ProposingBookDate");
b1.Property<int>("ProposingBookNumber")
.HasColumnType("int")
.HasColumnName("ProposingBookNumber");
b1.HasKey("ProjectId");
b1.ToTable("Projects");
b1.WithOwner()
.HasForeignKey("ProjectId");
});
b.Navigation("Executer");
b.Navigation("ProjectAggreement");
b.Navigation("ProjectInfo");
b.Navigation("ProjectType");
b.Navigation("ProposalInfo");
b.Navigation("Proposer");
b.Navigation("TeamLeader");
});
modelBuilder.Entity("PSManagement.Domain.Steps.Entities.Item", b =>
{
b.HasOne("PSManagement.Domain.Steps.Entities.Step", null)
.WithMany("Purchases")
.HasForeignKey("StepId");
b.OwnsOne("PSManagement.SharedKernel.ValueObjects.Money", "Price", b1 =>
{
b1.Property<int>("ItemId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<int>("Ammount")
.HasColumnType("int")
.HasColumnName("Ammount");
b1.Property<string>("Currency")
.HasColumnType("nvarchar(max)")
.HasColumnName("Currency");
b1.HasKey("ItemId");
b1.ToTable("Items");
b1.WithOwner()
.HasForeignKey("ItemId");
});
b.Navigation("Price");
});
modelBuilder.Entity("PSManagement.Domain.Steps.Entities.Step", b =>
{
b.HasOne("PSManagement.Domain.Projects.Aggregate.Project", "Project")
.WithMany("Steps")
.HasForeignKey("ProjectId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PSManagement.Domain.Tracking.Track", null)
.WithMany("Steps")
.HasForeignKey("TrackId");
b.Navigation("Project");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.EmployeeWork", b =>
{
b.HasOne("PSManagement.Domain.Employees.Entities.Employee", "Employee")
.WithMany("EmployeeWorks")
.HasForeignKey("EmployeeId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("PSManagement.Domain.Tracking.Entities.StepTrack", "StepTrack")
.WithMany("EmployeeWorks")
.HasForeignKey("StepTrackId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Employee");
b.Navigation("StepTrack");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.StepTrack", b =>
{
b.HasOne("PSManagement.Domain.Steps.Entities.Step", "Step")
.WithMany("StepTracks")
.HasForeignKey("StepId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("PSManagement.Domain.Tracking.Track", "Track")
.WithMany("StepTracks")
.HasForeignKey("TrackId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Step");
b.Navigation("Track");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Track", b =>
{
b.HasOne("PSManagement.Domain.Projects.Aggregate.Project", "Project")
.WithMany("Tracks")
.HasForeignKey("ProjectId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Project");
});
modelBuilder.Entity("PermissionRole", b =>
{
b.HasOne("PSManagement.Domain.Identity.Entities.Permission", null)
.WithMany()
.HasForeignKey("PermissionsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PSManagement.Domain.Identity.Entities.Role", null)
.WithMany()
.HasForeignKey("RolesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("RoleUser", b =>
{
b.HasOne("PSManagement.Domain.Identity.Entities.Role", null)
.WithMany()
.HasForeignKey("RolesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PSManagement.Domain.Identity.Entities.User", null)
.WithMany()
.HasForeignKey("UsersId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("PSManagement.Domain.Customers.Aggregate.Customer", b =>
{
b.Navigation("Projects");
});
modelBuilder.Entity("PSManagement.Domain.Employees.Entities.Employee", b =>
{
b.Navigation("EmployeeWorks");
});
modelBuilder.Entity("PSManagement.Domain.Identity.Entities.User", b =>
{
b.Navigation("Employee");
});
modelBuilder.Entity("PSManagement.Domain.ProjectTypes.Entities.ProjectType", b =>
{
b.Navigation("Projects");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Aggregate.Project", b =>
{
b.Navigation("Steps");
b.Navigation("Tracks");
});
modelBuilder.Entity("PSManagement.Domain.Steps.Entities.Step", b =>
{
b.Navigation("Participants");
b.Navigation("Purchases");
b.Navigation("StepTracks");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.StepTrack", b =>
{
b.Navigation("EmployeeWorks");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Track", b =>
{
b.Navigation("Steps");
b.Navigation("StepTracks");
});
#pragma warning restore 612, 618
}
}
}
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using PSManagement.Infrastructure.Persistence;
namespace PSManagement.Infrastructure.Persistence.Migrations
{
[DbContext(typeof(AppDbContext))]
[Migration("20240803190751_AddDomains5")]
partial class AddDomains5
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Relational:Collation", "Arabic_CI_AS")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("ProductVersion", "5.0.17")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("PSManagement.Domain.Customers.Aggregate.Customer", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("CustomerName")
.HasColumnType("nvarchar(max)");
b.Property<string>("Email")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Customers");
});
modelBuilder.Entity("PSManagement.Domain.Employees.Entities.Department", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Departments");
});
modelBuilder.Entity("PSManagement.Domain.Employees.Entities.Employee", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("HIASTId")
.HasColumnType("int");
b.Property<int?>("StepId")
.HasColumnType("int");
b.Property<int>("UserId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("StepId");
b.HasIndex("UserId")
.IsUnique();
b.ToTable("Employees");
});
modelBuilder.Entity("PSManagement.Domain.Identity.Entities.Permission", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Permission");
});
modelBuilder.Entity("PSManagement.Domain.Identity.Entities.Role", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Roles");
});
modelBuilder.Entity("PSManagement.Domain.Identity.Entities.User", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Email")
.HasColumnType("nvarchar(max)");
b.Property<string>("HashedPassword")
.HasColumnType("nvarchar(max)");
b.Property<string>("UserName")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Users");
});
modelBuilder.Entity("PSManagement.Domain.ProjectTypes.Entities.ProjectType", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Description")
.HasColumnType("nvarchar(max)");
b.Property<string>("TypeName")
.HasColumnType("nvarchar(max)");
b.Property<int>("WorkerCount")
.HasColumnType("int");
b.HasKey("Id");
b.ToTable("ProjectType");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Aggregate.Project", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int?>("ExecuterId")
.HasColumnType("int");
b.Property<int?>("ProjectStatusId")
.HasColumnType("int");
b.Property<int?>("ProjectTypeId")
.HasColumnType("int");
b.Property<int?>("ProposerId")
.HasColumnType("int");
b.Property<int?>("TeamLeaderId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ExecuterId");
b.HasIndex("ProjectStatusId");
b.HasIndex("ProjectTypeId");
b.HasIndex("ProposerId");
b.HasIndex("TeamLeaderId");
b.ToTable("Projects");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Entities.Attachment", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("AttachmenDescription")
.HasColumnType("nvarchar(max)");
b.Property<string>("AttachmentName")
.HasColumnType("nvarchar(max)");
b.Property<string>("AttachmentUrl")
.HasColumnType("nvarchar(max)");
b.Property<int?>("ProjectId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ProjectId");
b.ToTable("Attachment");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Entities.ProjectStatus", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Code")
.HasColumnType("nvarchar(max)");
b.Property<string>("Details")
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("ProjectStatus");
});
modelBuilder.Entity("PSManagement.Domain.Steps.Entities.Item", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("ItemDescription")
.HasColumnType("nvarchar(max)");
b.Property<string>("ItemName")
.HasColumnType("nvarchar(max)");
b.Property<int?>("StepId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("StepId");
b.ToTable("Items");
});
modelBuilder.Entity("PSManagement.Domain.Steps.Entities.Step", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Description")
.HasColumnType("nvarchar(max)");
b.Property<int>("Duration")
.HasColumnType("int");
b.Property<int>("ProjectId")
.HasColumnType("int");
b.Property<DateTime>("StartDate")
.HasColumnType("datetime2");
b.Property<string>("StepName")
.HasColumnType("nvarchar(max)");
b.Property<int?>("TrackId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ProjectId");
b.HasIndex("TrackId");
b.ToTable("Steps");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.EmployeeWork", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("ContributingRatio")
.HasColumnType("int");
b.Property<int>("EmployeeId")
.HasColumnType("int");
b.Property<int>("EmployeeWorkId")
.HasColumnType("int");
b.Property<int>("HoursWorked")
.HasColumnType("int");
b.Property<string>("Notes")
.HasColumnType("nvarchar(max)");
b.Property<int>("StepTrackId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("EmployeeId");
b.HasIndex("StepTrackId");
b.ToTable("EmployeeWorks");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.StepTrack", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("StepId")
.HasColumnType("int");
b.Property<int>("TrackId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("StepId");
b.HasIndex("TrackId");
b.ToTable("StepTracks");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Track", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("ProjectId")
.HasColumnType("int");
b.Property<DateTime>("TrackDate")
.HasColumnType("datetime2");
b.Property<string>("TrackNote")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.HasIndex("ProjectId");
b.ToTable("Tracks");
});
modelBuilder.Entity("PermissionRole", b =>
{
b.Property<int>("PermissionsId")
.HasColumnType("int");
b.Property<int>("RolesId")
.HasColumnType("int");
b.HasKey("PermissionsId", "RolesId");
b.HasIndex("RolesId");
b.ToTable("PermissionRole");
});
modelBuilder.Entity("RoleUser", b =>
{
b.Property<int>("RolesId")
.HasColumnType("int");
b.Property<int>("UsersId")
.HasColumnType("int");
b.HasKey("RolesId", "UsersId");
b.HasIndex("UsersId");
b.ToTable("RoleUser");
});
modelBuilder.Entity("PSManagement.Domain.Customers.Aggregate.Customer", b =>
{
b.OwnsMany("PSManagement.Domain.Customers.Entities.ContactInfo", "ContactInfo", b1 =>
{
b1.Property<int>("CustomerId")
.HasColumnType("int");
b1.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<string>("ContactType")
.HasColumnType("nvarchar(max)");
b1.Property<string>("ContactValue")
.HasColumnType("nvarchar(max)");
b1.HasKey("CustomerId", "Id");
b1.ToTable("ContactInfo");
b1.WithOwner()
.HasForeignKey("CustomerId");
});
b.OwnsOne("PSManagement.Domain.Customers.ValueObjects.Address", "Address", b1 =>
{
b1.Property<int>("CustomerId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<string>("City")
.HasColumnType("nvarchar(max)")
.HasColumnName("City");
b1.Property<string>("StreetName")
.HasColumnType("nvarchar(max)")
.HasColumnName("StreetName");
b1.Property<int>("StreetNumber")
.HasColumnType("int")
.HasColumnName("StreetNumber");
b1.Property<int>("ZipCode")
.HasColumnType("int")
.HasColumnName("ZipCode");
b1.HasKey("CustomerId");
b1.ToTable("Customers");
b1.WithOwner()
.HasForeignKey("CustomerId");
});
b.Navigation("Address");
b.Navigation("ContactInfo");
});
modelBuilder.Entity("PSManagement.Domain.Employees.Entities.Employee", b =>
{
b.HasOne("PSManagement.Domain.Steps.Entities.Step", null)
.WithMany("Participants")
.HasForeignKey("StepId");
b.HasOne("PSManagement.Domain.Identity.Entities.User", "User")
.WithOne("Employee")
.HasForeignKey("PSManagement.Domain.Employees.Entities.Employee", "UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.OwnsOne("PSManagement.Domain.Employees.Entities.Availability", "Availability", b1 =>
{
b1.Property<int>("EmployeeId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<int>("CurrentWorkingHours")
.HasColumnType("int")
.HasColumnName("CurrentWorkingHours");
b1.Property<bool>("IsAvailable")
.HasColumnType("bit")
.HasColumnName("IsAvailable");
b1.HasKey("EmployeeId");
b1.ToTable("Employees");
b1.WithOwner()
.HasForeignKey("EmployeeId");
});
b.OwnsOne("PSManagement.Domain.Employees.Entities.PersonalInfo", "PersonalInfo", b1 =>
{
b1.Property<int>("EmployeeId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<string>("FirstName")
.HasColumnType("nvarchar(max)")
.HasColumnName("FirstName");
b1.Property<string>("LastName")
.HasColumnType("nvarchar(max)")
.HasColumnName("LastName");
b1.HasKey("EmployeeId");
b1.ToTable("Employees");
b1.WithOwner()
.HasForeignKey("EmployeeId");
});
b.Navigation("Availability");
b.Navigation("PersonalInfo");
b.Navigation("User");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Aggregate.Project", b =>
{
b.HasOne("PSManagement.Domain.Employees.Entities.Department", "Executer")
.WithMany()
.HasForeignKey("ExecuterId");
b.HasOne("PSManagement.Domain.Projects.Entities.ProjectStatus", "ProjectStatus")
.WithMany()
.HasForeignKey("ProjectStatusId");
b.HasOne("PSManagement.Domain.ProjectTypes.Entities.ProjectType", "ProjectType")
.WithMany("Projects")
.HasForeignKey("ProjectTypeId");
b.HasOne("PSManagement.Domain.Customers.Aggregate.Customer", "Proposer")
.WithMany("Projects")
.HasForeignKey("ProposerId");
b.HasOne("PSManagement.Domain.Employees.Entities.Employee", "TeamLeader")
.WithMany()
.HasForeignKey("TeamLeaderId");
b.OwnsOne("PSManagement.Domain.Projects.Aggregate.Aggreement", "ProjectAggreement", b1 =>
{
b1.Property<int>("ProjectId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<DateTime>("AggreementDate")
.HasColumnType("datetime2")
.HasColumnName("AggreementDate");
b1.Property<int>("AggreementNumber")
.HasColumnType("int")
.HasColumnName("AggreementNumber");
b1.HasKey("ProjectId");
b1.ToTable("Projects");
b1.WithOwner()
.HasForeignKey("ProjectId");
});
b.OwnsOne("PSManagement.Domain.Projects.Aggregate.ProjectInfo", "ProjectInfo", b1 =>
{
b1.Property<int>("ProjectId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<string>("Code")
.HasColumnType("nvarchar(max)")
.HasColumnName("Code");
b1.Property<string>("Description")
.HasColumnType("nvarchar(max)")
.HasColumnName("Description");
b1.Property<string>("Name")
.HasColumnType("nvarchar(max)")
.HasColumnName("Name");
b1.HasKey("ProjectId");
b1.ToTable("Projects");
b1.WithOwner()
.HasForeignKey("ProjectId");
});
b.OwnsOne("PSManagement.Domain.Projects.Aggregate.ProposalInfo", "ProposalInfo", b1 =>
{
b1.Property<int>("ProjectId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<DateTime>("ProposingBookDate")
.HasColumnType("datetime2")
.HasColumnName("ProposingBookDate");
b1.Property<int>("ProposingBookNumber")
.HasColumnType("int")
.HasColumnName("ProposingBookNumber");
b1.HasKey("ProjectId");
b1.ToTable("Projects");
b1.WithOwner()
.HasForeignKey("ProjectId");
});
b.Navigation("Executer");
b.Navigation("ProjectAggreement");
b.Navigation("ProjectInfo");
b.Navigation("ProjectStatus");
b.Navigation("ProjectType");
b.Navigation("ProposalInfo");
b.Navigation("Proposer");
b.Navigation("TeamLeader");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Entities.Attachment", b =>
{
b.HasOne("PSManagement.Domain.Projects.Aggregate.Project", null)
.WithMany("Attachments")
.HasForeignKey("ProjectId");
});
modelBuilder.Entity("PSManagement.Domain.Steps.Entities.Item", b =>
{
b.HasOne("PSManagement.Domain.Steps.Entities.Step", null)
.WithMany("Purchases")
.HasForeignKey("StepId");
b.OwnsOne("PSManagement.SharedKernel.ValueObjects.Money", "Price", b1 =>
{
b1.Property<int>("ItemId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<int>("Ammount")
.HasColumnType("int")
.HasColumnName("Ammount");
b1.Property<string>("Currency")
.HasColumnType("nvarchar(max)")
.HasColumnName("Currency");
b1.HasKey("ItemId");
b1.ToTable("Items");
b1.WithOwner()
.HasForeignKey("ItemId");
});
b.Navigation("Price");
});
modelBuilder.Entity("PSManagement.Domain.Steps.Entities.Step", b =>
{
b.HasOne("PSManagement.Domain.Projects.Aggregate.Project", "Project")
.WithMany("Steps")
.HasForeignKey("ProjectId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PSManagement.Domain.Tracking.Track", null)
.WithMany("Steps")
.HasForeignKey("TrackId");
b.Navigation("Project");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.EmployeeWork", b =>
{
b.HasOne("PSManagement.Domain.Employees.Entities.Employee", "Employee")
.WithMany("EmployeeWorks")
.HasForeignKey("EmployeeId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("PSManagement.Domain.Tracking.Entities.StepTrack", "StepTrack")
.WithMany("EmployeeWorks")
.HasForeignKey("StepTrackId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Employee");
b.Navigation("StepTrack");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.StepTrack", b =>
{
b.HasOne("PSManagement.Domain.Steps.Entities.Step", "Step")
.WithMany("StepTracks")
.HasForeignKey("StepId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("PSManagement.Domain.Tracking.Track", "Track")
.WithMany("StepTracks")
.HasForeignKey("TrackId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Step");
b.Navigation("Track");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Track", b =>
{
b.HasOne("PSManagement.Domain.Projects.Aggregate.Project", "Project")
.WithMany("Tracks")
.HasForeignKey("ProjectId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Project");
});
modelBuilder.Entity("PermissionRole", b =>
{
b.HasOne("PSManagement.Domain.Identity.Entities.Permission", null)
.WithMany()
.HasForeignKey("PermissionsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PSManagement.Domain.Identity.Entities.Role", null)
.WithMany()
.HasForeignKey("RolesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("RoleUser", b =>
{
b.HasOne("PSManagement.Domain.Identity.Entities.Role", null)
.WithMany()
.HasForeignKey("RolesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PSManagement.Domain.Identity.Entities.User", null)
.WithMany()
.HasForeignKey("UsersId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("PSManagement.Domain.Customers.Aggregate.Customer", b =>
{
b.Navigation("Projects");
});
modelBuilder.Entity("PSManagement.Domain.Employees.Entities.Employee", b =>
{
b.Navigation("EmployeeWorks");
});
modelBuilder.Entity("PSManagement.Domain.Identity.Entities.User", b =>
{
b.Navigation("Employee");
});
modelBuilder.Entity("PSManagement.Domain.ProjectTypes.Entities.ProjectType", b =>
{
b.Navigation("Projects");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Aggregate.Project", b =>
{
b.Navigation("Attachments");
b.Navigation("Steps");
b.Navigation("Tracks");
});
modelBuilder.Entity("PSManagement.Domain.Steps.Entities.Step", b =>
{
b.Navigation("Participants");
b.Navigation("Purchases");
b.Navigation("StepTracks");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.StepTrack", b =>
{
b.Navigation("EmployeeWorks");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Track", b =>
{
b.Navigation("Steps");
b.Navigation("StepTracks");
});
#pragma warning restore 612, 618
}
}
}
using Microsoft.EntityFrameworkCore.Migrations;
namespace PSManagement.Infrastructure.Persistence.Migrations
{
public partial class AddDomains5 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "ProjectStatusId",
table: "Projects",
type: "int",
nullable: true);
migrationBuilder.CreateTable(
name: "Attachment",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
AttachmentUrl = table.Column<string>(type: "nvarchar(max)", nullable: true),
AttachmentName = table.Column<string>(type: "nvarchar(max)", nullable: true),
AttachmenDescription = table.Column<string>(type: "nvarchar(max)", nullable: true),
ProjectId = table.Column<int>(type: "int", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Attachment", x => x.Id);
table.ForeignKey(
name: "FK_Attachment_Projects_ProjectId",
column: x => x.ProjectId,
principalTable: "Projects",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "ProjectStatus",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Name = table.Column<string>(type: "nvarchar(max)", nullable: true),
Details = table.Column<string>(type: "nvarchar(max)", nullable: true),
Code = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_ProjectStatus", x => x.Id);
});
migrationBuilder.CreateIndex(
name: "IX_Projects_ProjectStatusId",
table: "Projects",
column: "ProjectStatusId");
migrationBuilder.CreateIndex(
name: "IX_Attachment_ProjectId",
table: "Attachment",
column: "ProjectId");
migrationBuilder.AddForeignKey(
name: "FK_Projects_ProjectStatus_ProjectStatusId",
table: "Projects",
column: "ProjectStatusId",
principalTable: "ProjectStatus",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Projects_ProjectStatus_ProjectStatusId",
table: "Projects");
migrationBuilder.DropTable(
name: "Attachment");
migrationBuilder.DropTable(
name: "ProjectStatus");
migrationBuilder.DropIndex(
name: "IX_Projects_ProjectStatusId",
table: "Projects");
migrationBuilder.DropColumn(
name: "ProjectStatusId",
table: "Projects");
}
}
}
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using PSManagement.Infrastructure.Persistence;
namespace PSManagement.Infrastructure.Persistence.Migrations
{
[DbContext(typeof(AppDbContext))]
[Migration("20240803191817_AddDomains6")]
partial class AddDomains6
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Relational:Collation", "Arabic_CI_AS")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("ProductVersion", "5.0.17")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("PSManagement.Domain.Customers.Aggregate.Customer", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("CustomerName")
.HasColumnType("nvarchar(max)");
b.Property<string>("Email")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Customers");
});
modelBuilder.Entity("PSManagement.Domain.Employees.Entities.Department", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Departments");
});
modelBuilder.Entity("PSManagement.Domain.Employees.Entities.Employee", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("HIASTId")
.HasColumnType("int");
b.Property<int?>("StepId")
.HasColumnType("int");
b.Property<int>("UserId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("StepId");
b.HasIndex("UserId")
.IsUnique();
b.ToTable("Employees");
});
modelBuilder.Entity("PSManagement.Domain.Identity.Entities.Permission", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Permission");
});
modelBuilder.Entity("PSManagement.Domain.Identity.Entities.Role", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Roles");
});
modelBuilder.Entity("PSManagement.Domain.Identity.Entities.User", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Email")
.HasColumnType("nvarchar(max)");
b.Property<string>("HashedPassword")
.HasColumnType("nvarchar(max)");
b.Property<string>("UserName")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Users");
});
modelBuilder.Entity("PSManagement.Domain.ProjectTypes.Entities.ProjectType", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Description")
.HasColumnType("nvarchar(max)");
b.Property<string>("TypeName")
.HasColumnType("nvarchar(max)");
b.Property<int>("WorkerCount")
.HasColumnType("int");
b.HasKey("Id");
b.ToTable("ProjectType");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Aggregate.Project", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int?>("ExecuterId")
.HasColumnType("int");
b.Property<int?>("ProjectStatusId")
.HasColumnType("int");
b.Property<int?>("ProjectTypeId")
.HasColumnType("int");
b.Property<int?>("ProposerId")
.HasColumnType("int");
b.Property<int?>("TeamLeaderId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ExecuterId");
b.HasIndex("ProjectStatusId");
b.HasIndex("ProjectTypeId");
b.HasIndex("ProposerId");
b.HasIndex("TeamLeaderId");
b.ToTable("Projects");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Entities.Attachment", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("AttachmenDescription")
.HasColumnType("nvarchar(max)");
b.Property<string>("AttachmentName")
.HasColumnType("nvarchar(max)");
b.Property<string>("AttachmentUrl")
.HasColumnType("nvarchar(max)");
b.Property<int?>("ProjectId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ProjectId");
b.ToTable("Attachment");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Entities.ProjectStatus", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Code")
.HasColumnType("nvarchar(max)");
b.Property<string>("Details")
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("ProjectStatus");
});
modelBuilder.Entity("PSManagement.Domain.Steps.Entities.Item", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("ItemDescription")
.HasColumnType("nvarchar(max)");
b.Property<string>("ItemName")
.HasColumnType("nvarchar(max)");
b.Property<int?>("StepId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("StepId");
b.ToTable("Items");
});
modelBuilder.Entity("PSManagement.Domain.Steps.Entities.Step", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Description")
.HasColumnType("nvarchar(max)");
b.Property<int>("Duration")
.HasColumnType("int");
b.Property<int>("ProjectId")
.HasColumnType("int");
b.Property<DateTime>("StartDate")
.HasColumnType("datetime2");
b.Property<string>("StepName")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.HasIndex("ProjectId");
b.ToTable("Steps");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.EmployeeWork", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("ContributingRatio")
.HasColumnType("int");
b.Property<int>("EmployeeId")
.HasColumnType("int");
b.Property<int>("EmployeeWorkId")
.HasColumnType("int");
b.Property<int>("HoursWorked")
.HasColumnType("int");
b.Property<string>("Notes")
.HasColumnType("nvarchar(max)");
b.Property<int>("StepTrackId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("EmployeeId");
b.HasIndex("StepTrackId");
b.ToTable("EmployeeWorks");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.StepTrack", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("StepId")
.HasColumnType("int");
b.Property<int>("TrackId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("StepId");
b.HasIndex("TrackId");
b.ToTable("StepTracks");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Track", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("ProjectId")
.HasColumnType("int");
b.Property<DateTime>("TrackDate")
.HasColumnType("datetime2");
b.Property<string>("TrackNote")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.HasIndex("ProjectId");
b.ToTable("Tracks");
});
modelBuilder.Entity("PermissionRole", b =>
{
b.Property<int>("PermissionsId")
.HasColumnType("int");
b.Property<int>("RolesId")
.HasColumnType("int");
b.HasKey("PermissionsId", "RolesId");
b.HasIndex("RolesId");
b.ToTable("PermissionRole");
});
modelBuilder.Entity("RoleUser", b =>
{
b.Property<int>("RolesId")
.HasColumnType("int");
b.Property<int>("UsersId")
.HasColumnType("int");
b.HasKey("RolesId", "UsersId");
b.HasIndex("UsersId");
b.ToTable("RoleUser");
});
modelBuilder.Entity("PSManagement.Domain.Customers.Aggregate.Customer", b =>
{
b.OwnsMany("PSManagement.Domain.Customers.Entities.ContactInfo", "ContactInfo", b1 =>
{
b1.Property<int>("CustomerId")
.HasColumnType("int");
b1.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<string>("ContactType")
.HasColumnType("nvarchar(max)");
b1.Property<string>("ContactValue")
.HasColumnType("nvarchar(max)");
b1.HasKey("CustomerId", "Id");
b1.ToTable("ContactInfo");
b1.WithOwner()
.HasForeignKey("CustomerId");
});
b.OwnsOne("PSManagement.Domain.Customers.ValueObjects.Address", "Address", b1 =>
{
b1.Property<int>("CustomerId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<string>("City")
.HasColumnType("nvarchar(max)")
.HasColumnName("City");
b1.Property<string>("StreetName")
.HasColumnType("nvarchar(max)")
.HasColumnName("StreetName");
b1.Property<int>("StreetNumber")
.HasColumnType("int")
.HasColumnName("StreetNumber");
b1.Property<int>("ZipCode")
.HasColumnType("int")
.HasColumnName("ZipCode");
b1.HasKey("CustomerId");
b1.ToTable("Customers");
b1.WithOwner()
.HasForeignKey("CustomerId");
});
b.Navigation("Address");
b.Navigation("ContactInfo");
});
modelBuilder.Entity("PSManagement.Domain.Employees.Entities.Employee", b =>
{
b.HasOne("PSManagement.Domain.Steps.Entities.Step", null)
.WithMany("Participants")
.HasForeignKey("StepId");
b.HasOne("PSManagement.Domain.Identity.Entities.User", "User")
.WithOne("Employee")
.HasForeignKey("PSManagement.Domain.Employees.Entities.Employee", "UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.OwnsOne("PSManagement.Domain.Employees.Entities.Availability", "Availability", b1 =>
{
b1.Property<int>("EmployeeId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<int>("CurrentWorkingHours")
.HasColumnType("int")
.HasColumnName("CurrentWorkingHours");
b1.Property<bool>("IsAvailable")
.HasColumnType("bit")
.HasColumnName("IsAvailable");
b1.HasKey("EmployeeId");
b1.ToTable("Employees");
b1.WithOwner()
.HasForeignKey("EmployeeId");
});
b.OwnsOne("PSManagement.Domain.Employees.Entities.PersonalInfo", "PersonalInfo", b1 =>
{
b1.Property<int>("EmployeeId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<string>("FirstName")
.HasColumnType("nvarchar(max)")
.HasColumnName("FirstName");
b1.Property<string>("LastName")
.HasColumnType("nvarchar(max)")
.HasColumnName("LastName");
b1.HasKey("EmployeeId");
b1.ToTable("Employees");
b1.WithOwner()
.HasForeignKey("EmployeeId");
});
b.Navigation("Availability");
b.Navigation("PersonalInfo");
b.Navigation("User");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Aggregate.Project", b =>
{
b.HasOne("PSManagement.Domain.Employees.Entities.Department", "Executer")
.WithMany()
.HasForeignKey("ExecuterId");
b.HasOne("PSManagement.Domain.Projects.Entities.ProjectStatus", "ProjectStatus")
.WithMany()
.HasForeignKey("ProjectStatusId");
b.HasOne("PSManagement.Domain.ProjectTypes.Entities.ProjectType", "ProjectType")
.WithMany("Projects")
.HasForeignKey("ProjectTypeId");
b.HasOne("PSManagement.Domain.Customers.Aggregate.Customer", "Proposer")
.WithMany("Projects")
.HasForeignKey("ProposerId");
b.HasOne("PSManagement.Domain.Employees.Entities.Employee", "TeamLeader")
.WithMany()
.HasForeignKey("TeamLeaderId");
b.OwnsOne("PSManagement.Domain.Projects.Aggregate.Aggreement", "ProjectAggreement", b1 =>
{
b1.Property<int>("ProjectId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<DateTime>("AggreementDate")
.HasColumnType("datetime2")
.HasColumnName("AggreementDate");
b1.Property<int>("AggreementNumber")
.HasColumnType("int")
.HasColumnName("AggreementNumber");
b1.HasKey("ProjectId");
b1.ToTable("Projects");
b1.WithOwner()
.HasForeignKey("ProjectId");
});
b.OwnsOne("PSManagement.Domain.Projects.Aggregate.ProjectInfo", "ProjectInfo", b1 =>
{
b1.Property<int>("ProjectId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<string>("Code")
.HasColumnType("nvarchar(max)")
.HasColumnName("Code");
b1.Property<string>("Description")
.HasColumnType("nvarchar(max)")
.HasColumnName("Description");
b1.Property<string>("Name")
.HasColumnType("nvarchar(max)")
.HasColumnName("Name");
b1.HasKey("ProjectId");
b1.ToTable("Projects");
b1.WithOwner()
.HasForeignKey("ProjectId");
});
b.OwnsOne("PSManagement.Domain.Projects.Aggregate.ProposalInfo", "ProposalInfo", b1 =>
{
b1.Property<int>("ProjectId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<DateTime>("ProposingBookDate")
.HasColumnType("datetime2")
.HasColumnName("ProposingBookDate");
b1.Property<int>("ProposingBookNumber")
.HasColumnType("int")
.HasColumnName("ProposingBookNumber");
b1.HasKey("ProjectId");
b1.ToTable("Projects");
b1.WithOwner()
.HasForeignKey("ProjectId");
});
b.Navigation("Executer");
b.Navigation("ProjectAggreement");
b.Navigation("ProjectInfo");
b.Navigation("ProjectStatus");
b.Navigation("ProjectType");
b.Navigation("ProposalInfo");
b.Navigation("Proposer");
b.Navigation("TeamLeader");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Entities.Attachment", b =>
{
b.HasOne("PSManagement.Domain.Projects.Aggregate.Project", null)
.WithMany("Attachments")
.HasForeignKey("ProjectId");
});
modelBuilder.Entity("PSManagement.Domain.Steps.Entities.Item", b =>
{
b.HasOne("PSManagement.Domain.Steps.Entities.Step", null)
.WithMany("Purchases")
.HasForeignKey("StepId");
b.OwnsOne("PSManagement.SharedKernel.ValueObjects.Money", "Price", b1 =>
{
b1.Property<int>("ItemId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<int>("Ammount")
.HasColumnType("int")
.HasColumnName("Ammount");
b1.Property<string>("Currency")
.HasColumnType("nvarchar(max)")
.HasColumnName("Currency");
b1.HasKey("ItemId");
b1.ToTable("Items");
b1.WithOwner()
.HasForeignKey("ItemId");
});
b.Navigation("Price");
});
modelBuilder.Entity("PSManagement.Domain.Steps.Entities.Step", b =>
{
b.HasOne("PSManagement.Domain.Projects.Aggregate.Project", "Project")
.WithMany("Steps")
.HasForeignKey("ProjectId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Project");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.EmployeeWork", b =>
{
b.HasOne("PSManagement.Domain.Employees.Entities.Employee", "Employee")
.WithMany("EmployeeWorks")
.HasForeignKey("EmployeeId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("PSManagement.Domain.Tracking.Entities.StepTrack", "StepTrack")
.WithMany("EmployeeWorks")
.HasForeignKey("StepTrackId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Employee");
b.Navigation("StepTrack");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.StepTrack", b =>
{
b.HasOne("PSManagement.Domain.Steps.Entities.Step", "Step")
.WithMany("StepTracks")
.HasForeignKey("StepId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("PSManagement.Domain.Tracking.Track", "Track")
.WithMany("StepTracks")
.HasForeignKey("TrackId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Step");
b.Navigation("Track");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Track", b =>
{
b.HasOne("PSManagement.Domain.Projects.Aggregate.Project", "Project")
.WithMany("Tracks")
.HasForeignKey("ProjectId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Project");
});
modelBuilder.Entity("PermissionRole", b =>
{
b.HasOne("PSManagement.Domain.Identity.Entities.Permission", null)
.WithMany()
.HasForeignKey("PermissionsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PSManagement.Domain.Identity.Entities.Role", null)
.WithMany()
.HasForeignKey("RolesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("RoleUser", b =>
{
b.HasOne("PSManagement.Domain.Identity.Entities.Role", null)
.WithMany()
.HasForeignKey("RolesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PSManagement.Domain.Identity.Entities.User", null)
.WithMany()
.HasForeignKey("UsersId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("PSManagement.Domain.Customers.Aggregate.Customer", b =>
{
b.Navigation("Projects");
});
modelBuilder.Entity("PSManagement.Domain.Employees.Entities.Employee", b =>
{
b.Navigation("EmployeeWorks");
});
modelBuilder.Entity("PSManagement.Domain.Identity.Entities.User", b =>
{
b.Navigation("Employee");
});
modelBuilder.Entity("PSManagement.Domain.ProjectTypes.Entities.ProjectType", b =>
{
b.Navigation("Projects");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Aggregate.Project", b =>
{
b.Navigation("Attachments");
b.Navigation("Steps");
b.Navigation("Tracks");
});
modelBuilder.Entity("PSManagement.Domain.Steps.Entities.Step", b =>
{
b.Navigation("Participants");
b.Navigation("Purchases");
b.Navigation("StepTracks");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.StepTrack", b =>
{
b.Navigation("EmployeeWorks");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Track", b =>
{
b.Navigation("StepTracks");
});
#pragma warning restore 612, 618
}
}
}
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using PSManagement.Infrastructure.Persistence;
namespace PSManagement.Infrastructure.Persistence.Migrations
{
[DbContext(typeof(AppDbContext))]
[Migration("20240803192350_AddDomains7")]
partial class AddDomains7
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Relational:Collation", "Arabic_CI_AS")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("ProductVersion", "5.0.17")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("PSManagement.Domain.Customers.Aggregate.Customer", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("CustomerName")
.HasColumnType("nvarchar(max)");
b.Property<string>("Email")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Customers");
});
modelBuilder.Entity("PSManagement.Domain.Employees.Entities.Department", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Departments");
});
modelBuilder.Entity("PSManagement.Domain.Employees.Entities.Employee", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("HIASTId")
.HasColumnType("int");
b.Property<int?>("StepId")
.HasColumnType("int");
b.Property<int>("UserId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("StepId");
b.HasIndex("UserId")
.IsUnique();
b.ToTable("Employees");
});
modelBuilder.Entity("PSManagement.Domain.Identity.Entities.Permission", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Permission");
});
modelBuilder.Entity("PSManagement.Domain.Identity.Entities.Role", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Roles");
});
modelBuilder.Entity("PSManagement.Domain.Identity.Entities.User", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Email")
.HasColumnType("nvarchar(max)");
b.Property<string>("HashedPassword")
.HasColumnType("nvarchar(max)");
b.Property<string>("UserName")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Users");
});
modelBuilder.Entity("PSManagement.Domain.ProjectTypes.Entities.ProjectType", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Description")
.HasColumnType("nvarchar(max)");
b.Property<string>("TypeName")
.HasColumnType("nvarchar(max)");
b.Property<int>("WorkerCount")
.HasColumnType("int");
b.HasKey("Id");
b.ToTable("ProjectType");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Aggregate.Project", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int?>("ExecuterId")
.HasColumnType("int");
b.Property<int?>("ProjectStatusId")
.HasColumnType("int");
b.Property<int?>("ProjectTypeId")
.HasColumnType("int");
b.Property<int?>("ProposerId")
.HasColumnType("int");
b.Property<int?>("TeamLeaderId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ExecuterId");
b.HasIndex("ProjectStatusId");
b.HasIndex("ProjectTypeId");
b.HasIndex("ProposerId");
b.HasIndex("TeamLeaderId");
b.ToTable("Projects");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Entities.Attachment", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("AttachmenDescription")
.HasColumnType("nvarchar(max)");
b.Property<string>("AttachmentName")
.HasColumnType("nvarchar(max)");
b.Property<string>("AttachmentUrl")
.HasColumnType("nvarchar(max)");
b.Property<int?>("ProjectId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ProjectId");
b.ToTable("Attachment");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Entities.ProjectStatus", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Code")
.HasColumnType("nvarchar(max)");
b.Property<string>("Details")
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("ProjectStatus");
});
modelBuilder.Entity("PSManagement.Domain.Steps.Entities.Item", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("ItemDescription")
.HasColumnType("nvarchar(max)");
b.Property<string>("ItemName")
.HasColumnType("nvarchar(max)");
b.Property<int?>("StepId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("StepId");
b.ToTable("Items");
});
modelBuilder.Entity("PSManagement.Domain.Steps.Entities.Step", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Description")
.HasColumnType("nvarchar(max)");
b.Property<int>("Duration")
.HasColumnType("int");
b.Property<int>("ProjectId")
.HasColumnType("int");
b.Property<DateTime>("StartDate")
.HasColumnType("datetime2");
b.Property<string>("StepName")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.HasIndex("ProjectId");
b.ToTable("Steps");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.EmployeeWork", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("ContributingRatio")
.HasColumnType("int");
b.Property<int>("EmployeeId")
.HasColumnType("int");
b.Property<int>("EmployeeWorkId")
.HasColumnType("int");
b.Property<int>("HoursWorked")
.HasColumnType("int");
b.Property<string>("Notes")
.HasColumnType("nvarchar(max)");
b.Property<int>("StepTrackId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("EmployeeId");
b.HasIndex("StepTrackId");
b.ToTable("EmployeeWorks");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.StepTrack", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("StepId")
.HasColumnType("int");
b.Property<int>("TrackId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("StepId");
b.HasIndex("TrackId");
b.ToTable("StepTracks");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Track", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("ProjectId")
.HasColumnType("int");
b.Property<DateTime>("TrackDate")
.HasColumnType("datetime2");
b.Property<string>("TrackNote")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.HasIndex("ProjectId");
b.ToTable("Tracks");
});
modelBuilder.Entity("PermissionRole", b =>
{
b.Property<int>("PermissionsId")
.HasColumnType("int");
b.Property<int>("RolesId")
.HasColumnType("int");
b.HasKey("PermissionsId", "RolesId");
b.HasIndex("RolesId");
b.ToTable("PermissionRole");
});
modelBuilder.Entity("RoleUser", b =>
{
b.Property<int>("RolesId")
.HasColumnType("int");
b.Property<int>("UsersId")
.HasColumnType("int");
b.HasKey("RolesId", "UsersId");
b.HasIndex("UsersId");
b.ToTable("RoleUser");
});
modelBuilder.Entity("PSManagement.Domain.Customers.Aggregate.Customer", b =>
{
b.OwnsMany("PSManagement.Domain.Customers.Entities.ContactInfo", "ContactInfo", b1 =>
{
b1.Property<int>("CustomerId")
.HasColumnType("int");
b1.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<string>("ContactType")
.HasColumnType("nvarchar(max)");
b1.Property<string>("ContactValue")
.HasColumnType("nvarchar(max)");
b1.HasKey("CustomerId", "Id");
b1.ToTable("ContactInfo");
b1.WithOwner()
.HasForeignKey("CustomerId");
});
b.OwnsOne("PSManagement.Domain.Customers.ValueObjects.Address", "Address", b1 =>
{
b1.Property<int>("CustomerId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<string>("City")
.HasColumnType("nvarchar(max)")
.HasColumnName("City");
b1.Property<string>("StreetName")
.HasColumnType("nvarchar(max)")
.HasColumnName("StreetName");
b1.Property<int>("StreetNumber")
.HasColumnType("int")
.HasColumnName("StreetNumber");
b1.Property<int>("ZipCode")
.HasColumnType("int")
.HasColumnName("ZipCode");
b1.HasKey("CustomerId");
b1.ToTable("Customers");
b1.WithOwner()
.HasForeignKey("CustomerId");
});
b.Navigation("Address");
b.Navigation("ContactInfo");
});
modelBuilder.Entity("PSManagement.Domain.Employees.Entities.Employee", b =>
{
b.HasOne("PSManagement.Domain.Steps.Entities.Step", null)
.WithMany("Participants")
.HasForeignKey("StepId");
b.HasOne("PSManagement.Domain.Identity.Entities.User", "User")
.WithOne("Employee")
.HasForeignKey("PSManagement.Domain.Employees.Entities.Employee", "UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.OwnsOne("PSManagement.Domain.Employees.Entities.Availability", "Availability", b1 =>
{
b1.Property<int>("EmployeeId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<int>("CurrentWorkingHours")
.HasColumnType("int")
.HasColumnName("CurrentWorkingHours");
b1.Property<bool>("IsAvailable")
.HasColumnType("bit")
.HasColumnName("IsAvailable");
b1.HasKey("EmployeeId");
b1.ToTable("Employees");
b1.WithOwner()
.HasForeignKey("EmployeeId");
});
b.OwnsOne("PSManagement.Domain.Employees.Entities.PersonalInfo", "PersonalInfo", b1 =>
{
b1.Property<int>("EmployeeId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<string>("FirstName")
.HasColumnType("nvarchar(max)")
.HasColumnName("FirstName");
b1.Property<string>("LastName")
.HasColumnType("nvarchar(max)")
.HasColumnName("LastName");
b1.HasKey("EmployeeId");
b1.ToTable("Employees");
b1.WithOwner()
.HasForeignKey("EmployeeId");
});
b.Navigation("Availability");
b.Navigation("PersonalInfo");
b.Navigation("User");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Aggregate.Project", b =>
{
b.HasOne("PSManagement.Domain.Employees.Entities.Department", "Executer")
.WithMany()
.HasForeignKey("ExecuterId");
b.HasOne("PSManagement.Domain.Projects.Entities.ProjectStatus", "ProjectStatus")
.WithMany()
.HasForeignKey("ProjectStatusId");
b.HasOne("PSManagement.Domain.ProjectTypes.Entities.ProjectType", "ProjectType")
.WithMany("Projects")
.HasForeignKey("ProjectTypeId");
b.HasOne("PSManagement.Domain.Customers.Aggregate.Customer", "Proposer")
.WithMany("Projects")
.HasForeignKey("ProposerId");
b.HasOne("PSManagement.Domain.Employees.Entities.Employee", "TeamLeader")
.WithMany()
.HasForeignKey("TeamLeaderId");
b.OwnsOne("PSManagement.Domain.Projects.Aggregate.Aggreement", "ProjectAggreement", b1 =>
{
b1.Property<int>("ProjectId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<DateTime>("AggreementDate")
.HasColumnType("datetime2")
.HasColumnName("AggreementDate");
b1.Property<int>("AggreementNumber")
.HasColumnType("int")
.HasColumnName("AggreementNumber");
b1.HasKey("ProjectId");
b1.ToTable("Projects");
b1.WithOwner()
.HasForeignKey("ProjectId");
});
b.OwnsOne("PSManagement.Domain.Projects.Aggregate.ProjectInfo", "ProjectInfo", b1 =>
{
b1.Property<int>("ProjectId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<string>("Code")
.HasColumnType("nvarchar(max)")
.HasColumnName("Code");
b1.Property<string>("Description")
.HasColumnType("nvarchar(max)")
.HasColumnName("Description");
b1.Property<string>("Name")
.HasColumnType("nvarchar(max)")
.HasColumnName("Name");
b1.HasKey("ProjectId");
b1.ToTable("Projects");
b1.WithOwner()
.HasForeignKey("ProjectId");
});
b.OwnsOne("PSManagement.Domain.Projects.Aggregate.ProposalInfo", "ProposalInfo", b1 =>
{
b1.Property<int>("ProjectId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<DateTime>("ProposingBookDate")
.HasColumnType("datetime2")
.HasColumnName("ProposingBookDate");
b1.Property<int>("ProposingBookNumber")
.HasColumnType("int")
.HasColumnName("ProposingBookNumber");
b1.HasKey("ProjectId");
b1.ToTable("Projects");
b1.WithOwner()
.HasForeignKey("ProjectId");
});
b.Navigation("Executer");
b.Navigation("ProjectAggreement");
b.Navigation("ProjectInfo");
b.Navigation("ProjectStatus");
b.Navigation("ProjectType");
b.Navigation("ProposalInfo");
b.Navigation("Proposer");
b.Navigation("TeamLeader");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Entities.Attachment", b =>
{
b.HasOne("PSManagement.Domain.Projects.Aggregate.Project", null)
.WithMany("Attachments")
.HasForeignKey("ProjectId");
});
modelBuilder.Entity("PSManagement.Domain.Steps.Entities.Item", b =>
{
b.HasOne("PSManagement.Domain.Steps.Entities.Step", null)
.WithMany("Purchases")
.HasForeignKey("StepId");
b.OwnsOne("PSManagement.SharedKernel.ValueObjects.Money", "Price", b1 =>
{
b1.Property<int>("ItemId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<int>("Ammount")
.HasColumnType("int")
.HasColumnName("Ammount");
b1.Property<string>("Currency")
.HasColumnType("nvarchar(max)")
.HasColumnName("Currency");
b1.HasKey("ItemId");
b1.ToTable("Items");
b1.WithOwner()
.HasForeignKey("ItemId");
});
b.Navigation("Price");
});
modelBuilder.Entity("PSManagement.Domain.Steps.Entities.Step", b =>
{
b.HasOne("PSManagement.Domain.Projects.Aggregate.Project", "Project")
.WithMany("Steps")
.HasForeignKey("ProjectId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Project");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.EmployeeWork", b =>
{
b.HasOne("PSManagement.Domain.Employees.Entities.Employee", "Employee")
.WithMany("EmployeeWorks")
.HasForeignKey("EmployeeId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("PSManagement.Domain.Tracking.Entities.StepTrack", "StepTrack")
.WithMany("EmployeeWorks")
.HasForeignKey("StepTrackId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Employee");
b.Navigation("StepTrack");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.StepTrack", b =>
{
b.HasOne("PSManagement.Domain.Steps.Entities.Step", "Step")
.WithMany("StepTracks")
.HasForeignKey("StepId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("PSManagement.Domain.Tracking.Track", "Track")
.WithMany("StepTracks")
.HasForeignKey("TrackId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Step");
b.Navigation("Track");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Track", b =>
{
b.HasOne("PSManagement.Domain.Projects.Aggregate.Project", "Project")
.WithMany("Tracks")
.HasForeignKey("ProjectId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Project");
});
modelBuilder.Entity("PermissionRole", b =>
{
b.HasOne("PSManagement.Domain.Identity.Entities.Permission", null)
.WithMany()
.HasForeignKey("PermissionsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PSManagement.Domain.Identity.Entities.Role", null)
.WithMany()
.HasForeignKey("RolesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("RoleUser", b =>
{
b.HasOne("PSManagement.Domain.Identity.Entities.Role", null)
.WithMany()
.HasForeignKey("RolesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PSManagement.Domain.Identity.Entities.User", null)
.WithMany()
.HasForeignKey("UsersId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("PSManagement.Domain.Customers.Aggregate.Customer", b =>
{
b.Navigation("Projects");
});
modelBuilder.Entity("PSManagement.Domain.Employees.Entities.Employee", b =>
{
b.Navigation("EmployeeWorks");
});
modelBuilder.Entity("PSManagement.Domain.Identity.Entities.User", b =>
{
b.Navigation("Employee");
});
modelBuilder.Entity("PSManagement.Domain.ProjectTypes.Entities.ProjectType", b =>
{
b.Navigation("Projects");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Aggregate.Project", b =>
{
b.Navigation("Attachments");
b.Navigation("Steps");
b.Navigation("Tracks");
});
modelBuilder.Entity("PSManagement.Domain.Steps.Entities.Step", b =>
{
b.Navigation("Participants");
b.Navigation("Purchases");
b.Navigation("StepTracks");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.StepTrack", b =>
{
b.Navigation("EmployeeWorks");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Track", b =>
{
b.Navigation("StepTracks");
});
#pragma warning restore 612, 618
}
}
}
using Microsoft.EntityFrameworkCore.Migrations;
namespace PSManagement.Infrastructure.Persistence.Migrations
{
public partial class AddDomains7 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
}
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}
using Microsoft.EntityFrameworkCore.Migrations;
namespace PSManagement.Infrastructure.Persistence.Migrations
{
public partial class AddDomainUpdate : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Employees_Steps_StepId",
table: "Employees");
migrationBuilder.DropForeignKey(
name: "FK_EmployeeWorks_Employees_EmployeeId",
table: "EmployeeWorks");
migrationBuilder.DropForeignKey(
name: "FK_EmployeeWorks_StepTracks_StepTrackId",
table: "EmployeeWorks");
migrationBuilder.DropForeignKey(
name: "FK_Items_Steps_StepId",
table: "Items");
migrationBuilder.DropIndex(
name: "IX_Items_StepId",
table: "Items");
migrationBuilder.DropColumn(
name: "StepId",
table: "Items");
migrationBuilder.RenameColumn(
name: "StepId",
table: "Employees",
newName: "TrackId");
migrationBuilder.RenameIndex(
name: "IX_Employees_StepId",
table: "Employees",
newName: "IX_Employees_TrackId");
migrationBuilder.AddColumn<int>(
name: "ExecutionRatio",
table: "StepTracks",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "CurrentCompletionRatio",
table: "Steps",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "Weight",
table: "Steps",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.CreateTable(
name: "EmployeeParticipate",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
EmployeeId = table.Column<int>(type: "int", nullable: false),
ProjectId = table.Column<int>(type: "int", nullable: false),
PartialTimeRatio = table.Column<int>(type: "int", nullable: false),
Role = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_EmployeeParticipate", x => x.Id);
table.ForeignKey(
name: "FK_EmployeeParticipate_Employees_EmployeeId",
column: x => x.EmployeeId,
principalTable: "Employees",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_EmployeeParticipate_Projects_ProjectId",
column: x => x.ProjectId,
principalTable: "Projects",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "EmployeeTrack",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
EmloyeeId = table.Column<int>(type: "int", nullable: false),
TrackId = table.Column<int>(type: "int", nullable: false),
WorkingHours = table.Column<int>(type: "int", nullable: false),
PerformedWork = table.Column<string>(type: "nvarchar(max)", nullable: true),
AssignedWork = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_EmployeeTrack", x => x.Id);
table.ForeignKey(
name: "FK_EmployeeTrack_Employees_EmloyeeId",
column: x => x.EmloyeeId,
principalTable: "Employees",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_EmployeeTrack_Tracks_TrackId",
column: x => x.TrackId,
principalTable: "Tracks",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_EmployeeParticipate_EmployeeId",
table: "EmployeeParticipate",
column: "EmployeeId");
migrationBuilder.CreateIndex(
name: "IX_EmployeeParticipate_ProjectId",
table: "EmployeeParticipate",
column: "ProjectId");
migrationBuilder.CreateIndex(
name: "IX_EmployeeTrack_EmloyeeId",
table: "EmployeeTrack",
column: "EmloyeeId");
migrationBuilder.CreateIndex(
name: "IX_EmployeeTrack_TrackId",
table: "EmployeeTrack",
column: "TrackId");
migrationBuilder.AddForeignKey(
name: "FK_Employees_Tracks_TrackId",
table: "Employees",
column: "TrackId",
principalTable: "Tracks",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_EmployeeWorks_Employees_EmployeeId",
table: "EmployeeWorks",
column: "EmployeeId",
principalTable: "Employees",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_EmployeeWorks_StepTracks_StepTrackId",
table: "EmployeeWorks",
column: "StepTrackId",
principalTable: "StepTracks",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Employees_Tracks_TrackId",
table: "Employees");
migrationBuilder.DropForeignKey(
name: "FK_EmployeeWorks_Employees_EmployeeId",
table: "EmployeeWorks");
migrationBuilder.DropForeignKey(
name: "FK_EmployeeWorks_StepTracks_StepTrackId",
table: "EmployeeWorks");
migrationBuilder.DropTable(
name: "EmployeeParticipate");
migrationBuilder.DropTable(
name: "EmployeeTrack");
migrationBuilder.DropColumn(
name: "ExecutionRatio",
table: "StepTracks");
migrationBuilder.DropColumn(
name: "CurrentCompletionRatio",
table: "Steps");
migrationBuilder.DropColumn(
name: "Weight",
table: "Steps");
migrationBuilder.RenameColumn(
name: "TrackId",
table: "Employees",
newName: "StepId");
migrationBuilder.RenameIndex(
name: "IX_Employees_TrackId",
table: "Employees",
newName: "IX_Employees_StepId");
migrationBuilder.AddColumn<int>(
name: "StepId",
table: "Items",
type: "int",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_Items_StepId",
table: "Items",
column: "StepId");
migrationBuilder.AddForeignKey(
name: "FK_Employees_Steps_StepId",
table: "Employees",
column: "StepId",
principalTable: "Steps",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_EmployeeWorks_Employees_EmployeeId",
table: "EmployeeWorks",
column: "EmployeeId",
principalTable: "Employees",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_EmployeeWorks_StepTracks_StepTrackId",
table: "EmployeeWorks",
column: "StepTrackId",
principalTable: "StepTracks",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Items_Steps_StepId",
table: "Items",
column: "StepId",
principalTable: "Steps",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
}
}
using Microsoft.EntityFrameworkCore.Migrations;
namespace PSManagement.Infrastructure.Persistence.Migrations
{
public partial class AddDomainUpdate3 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Projects_Employees_ProjectManagerId",
table: "Projects");
migrationBuilder.DropForeignKey(
name: "FK_Projects_Employees_TeamLeaderId",
table: "Projects");
migrationBuilder.AddForeignKey(
name: "FK_Projects_Employees_ProjectManagerId",
table: "Projects",
column: "ProjectManagerId",
principalTable: "Employees",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Projects_Employees_TeamLeaderId",
table: "Projects",
column: "TeamLeaderId",
principalTable: "Employees",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Projects_Employees_ProjectManagerId",
table: "Projects");
migrationBuilder.DropForeignKey(
name: "FK_Projects_Employees_TeamLeaderId",
table: "Projects");
migrationBuilder.AddForeignKey(
name: "FK_Projects_Employees_ProjectManagerId",
table: "Projects",
column: "ProjectManagerId",
principalTable: "Employees",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Projects_Employees_TeamLeaderId",
table: "Projects",
column: "TeamLeaderId",
principalTable: "Employees",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
}
}
using Microsoft.EntityFrameworkCore.Migrations;
namespace PSManagement.Infrastructure.Persistence.Migrations
{
public partial class AddDomainUpdate4 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
}
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}
...@@ -10,8 +10,8 @@ using PSManagement.Infrastructure.Persistence; ...@@ -10,8 +10,8 @@ using PSManagement.Infrastructure.Persistence;
namespace PSManagement.Infrastructure.Persistence.Migrations namespace PSManagement.Infrastructure.Persistence.Migrations
{ {
[DbContext(typeof(AppDbContext))] [DbContext(typeof(AppDbContext))]
[Migration("20240806133359_AddDomainUpdate4")] [Migration("20240807105909_Initial")]
partial class AddDomainUpdate4 partial class Initial
{ {
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)
{ {
......
...@@ -3,7 +3,7 @@ using Microsoft.EntityFrameworkCore.Migrations; ...@@ -3,7 +3,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
namespace PSManagement.Infrastructure.Persistence.Migrations namespace PSManagement.Infrastructure.Persistence.Migrations
{ {
public partial class AddDomains : Migration public partial class Initial : Migration
{ {
protected override void Up(MigrationBuilder migrationBuilder) protected override void Up(MigrationBuilder migrationBuilder)
{ {
...@@ -39,7 +39,23 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -39,7 +39,23 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
}); });
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "Role", name: "Items",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
ItemName = table.Column<string>(type: "nvarchar(max)", nullable: true),
ItemDescription = table.Column<string>(type: "nvarchar(max)", nullable: true),
Ammount = table.Column<int>(type: "int", nullable: true),
Currency = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Items", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Permission",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "int", nullable: false) Id = table.Column<int>(type: "int", nullable: false)
...@@ -48,7 +64,35 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -48,7 +64,35 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
}, },
constraints: table => constraints: table =>
{ {
table.PrimaryKey("PK_Role", x => x.Id); table.PrimaryKey("PK_Permission", x => x.Id);
});
migrationBuilder.CreateTable(
name: "ProjectStatus",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Name = table.Column<string>(type: "nvarchar(max)", nullable: true),
Details = table.Column<string>(type: "nvarchar(max)", nullable: true),
Code = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_ProjectStatus", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Roles",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Name = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Roles", x => x.Id);
}); });
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
...@@ -88,30 +132,27 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -88,30 +132,27 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
}); });
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "Permission", name: "PermissionRole",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "int", nullable: false) PermissionsId = table.Column<int>(type: "int", nullable: false),
.Annotation("SqlServer:Identity", "1, 1"), RolesId = table.Column<int>(type: "int", nullable: false)
Name = table.Column<string>(type: "nvarchar(max)", nullable: true),
PermissionId = table.Column<int>(type: "int", nullable: true),
RoleId = table.Column<int>(type: "int", nullable: true)
}, },
constraints: table => constraints: table =>
{ {
table.PrimaryKey("PK_Permission", x => x.Id); table.PrimaryKey("PK_PermissionRole", x => new { x.PermissionsId, x.RolesId });
table.ForeignKey( table.ForeignKey(
name: "FK_Permission_Permission_PermissionId", name: "FK_PermissionRole_Permission_PermissionsId",
column: x => x.PermissionId, column: x => x.PermissionsId,
principalTable: "Permission", principalTable: "Permission",
principalColumn: "Id", principalColumn: "Id",
onDelete: ReferentialAction.Restrict); onDelete: ReferentialAction.Cascade);
table.ForeignKey( table.ForeignKey(
name: "FK_Permission_Role_RoleId", name: "FK_PermissionRole_Roles_RolesId",
column: x => x.RoleId, column: x => x.RolesId,
principalTable: "Role", principalTable: "Roles",
principalColumn: "Id", principalColumn: "Id",
onDelete: ReferentialAction.Restrict); onDelete: ReferentialAction.Cascade);
}); });
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
...@@ -125,9 +166,9 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -125,9 +166,9 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
{ {
table.PrimaryKey("PK_RoleUser", x => new { x.RolesId, x.UsersId }); table.PrimaryKey("PK_RoleUser", x => new { x.RolesId, x.UsersId });
table.ForeignKey( table.ForeignKey(
name: "FK_RoleUser_Role_RolesId", name: "FK_RoleUser_Roles_RolesId",
column: x => x.RolesId, column: x => x.RolesId,
principalTable: "Role", principalTable: "Roles",
principalColumn: "Id", principalColumn: "Id",
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Cascade);
table.ForeignKey( table.ForeignKey(
...@@ -149,11 +190,15 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -149,11 +190,15 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
Name = table.Column<string>(type: "nvarchar(max)", nullable: true), Name = table.Column<string>(type: "nvarchar(max)", nullable: true),
Code = table.Column<string>(type: "nvarchar(max)", nullable: true), Code = table.Column<string>(type: "nvarchar(max)", nullable: true),
Description = table.Column<string>(type: "nvarchar(max)", nullable: true), Description = table.Column<string>(type: "nvarchar(max)", nullable: true),
ProjectStatusId = table.Column<int>(type: "int", nullable: true),
AggreementNumber = table.Column<int>(type: "int", nullable: true), AggreementNumber = table.Column<int>(type: "int", nullable: true),
AggreementDate = table.Column<DateTime>(type: "datetime2", nullable: true), AggreementDate = table.Column<DateTime>(type: "datetime2", nullable: true),
TeamLeaderId = table.Column<int>(type: "int", nullable: true), TeamLeaderId = table.Column<int>(type: "int", nullable: false),
ProjectManagerId = table.Column<int>(type: "int", nullable: false),
ExecuterId = table.Column<int>(type: "int", nullable: true), ExecuterId = table.Column<int>(type: "int", nullable: true),
ProposerId = table.Column<int>(type: "int", nullable: true) ProposerId = table.Column<int>(type: "int", nullable: true),
FinicialStatus = table.Column<string>(type: "nvarchar(max)", nullable: true),
FinicialSource = table.Column<string>(type: "nvarchar(max)", nullable: true)
}, },
constraints: table => constraints: table =>
{ {
...@@ -170,23 +215,30 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -170,23 +215,30 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
principalTable: "Departments", principalTable: "Departments",
principalColumn: "Id", principalColumn: "Id",
onDelete: ReferentialAction.Restrict); onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_Projects_ProjectStatus_ProjectStatusId",
column: x => x.ProjectStatusId,
principalTable: "ProjectStatus",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}); });
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "Tracks", name: "Attachment",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "int", nullable: false) Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"), .Annotation("SqlServer:Identity", "1, 1"),
TrackDate = table.Column<DateTime>(type: "datetime2", nullable: false), AttachmentUrl = table.Column<string>(type: "nvarchar(max)", nullable: true),
TrackNote = table.Column<string>(type: "nvarchar(max)", nullable: true), AttachmentName = table.Column<string>(type: "nvarchar(max)", nullable: true),
ProjectId = table.Column<int>(type: "int", nullable: false) AttachmenDescription = table.Column<string>(type: "nvarchar(max)", nullable: true),
ProjectId = table.Column<int>(type: "int", nullable: true)
}, },
constraints: table => constraints: table =>
{ {
table.PrimaryKey("PK_Tracks", x => x.Id); table.PrimaryKey("PK_Attachment", x => x.Id);
table.ForeignKey( table.ForeignKey(
name: "FK_Tracks_Projects_ProjectId", name: "FK_Attachment_Projects_ProjectId",
column: x => x.ProjectId, column: x => x.ProjectId,
principalTable: "Projects", principalTable: "Projects",
principalColumn: "Id", principalColumn: "Id",
...@@ -202,9 +254,10 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -202,9 +254,10 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
StepName = table.Column<string>(type: "nvarchar(max)", nullable: true), StepName = table.Column<string>(type: "nvarchar(max)", nullable: true),
Description = table.Column<string>(type: "nvarchar(max)", nullable: true), Description = table.Column<string>(type: "nvarchar(max)", nullable: true),
Duration = table.Column<int>(type: "int", nullable: false), Duration = table.Column<int>(type: "int", nullable: false),
CurrentCompletionRatio = table.Column<int>(type: "int", nullable: false),
Weight = table.Column<int>(type: "int", nullable: false),
StartDate = table.Column<DateTime>(type: "datetime2", nullable: false), StartDate = table.Column<DateTime>(type: "datetime2", nullable: false),
ProjectId = table.Column<int>(type: "int", nullable: false), ProjectId = table.Column<int>(type: "int", nullable: false)
TrackId = table.Column<int>(type: "int", nullable: true)
}, },
constraints: table => constraints: table =>
{ {
...@@ -215,10 +268,25 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -215,10 +268,25 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
principalTable: "Projects", principalTable: "Projects",
principalColumn: "Id", principalColumn: "Id",
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Tracks",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
TrackDate = table.Column<DateTime>(type: "datetime2", nullable: false),
TrackNote = table.Column<string>(type: "nvarchar(max)", nullable: true),
ProjectId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Tracks", x => x.Id);
table.ForeignKey( table.ForeignKey(
name: "FK_Steps_Tracks_TrackId", name: "FK_Tracks_Projects_ProjectId",
column: x => x.TrackId, column: x => x.ProjectId,
principalTable: "Tracks", principalTable: "Projects",
principalColumn: "Id", principalColumn: "Id",
onDelete: ReferentialAction.Restrict); onDelete: ReferentialAction.Restrict);
}); });
...@@ -235,22 +303,15 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -235,22 +303,15 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
LastName = table.Column<string>(type: "nvarchar(max)", nullable: true), LastName = table.Column<string>(type: "nvarchar(max)", nullable: true),
CurrentWorkingHours = table.Column<int>(type: "int", nullable: true), CurrentWorkingHours = table.Column<int>(type: "int", nullable: true),
IsAvailable = table.Column<bool>(type: "bit", nullable: true), IsAvailable = table.Column<bool>(type: "bit", nullable: true),
ProjectId = table.Column<int>(type: "int", nullable: true), TrackId = table.Column<int>(type: "int", nullable: true)
StepId = table.Column<int>(type: "int", nullable: true)
}, },
constraints: table => constraints: table =>
{ {
table.PrimaryKey("PK_Employees", x => x.Id); table.PrimaryKey("PK_Employees", x => x.Id);
table.ForeignKey( table.ForeignKey(
name: "FK_Employees_Projects_ProjectId", name: "FK_Employees_Tracks_TrackId",
column: x => x.ProjectId, column: x => x.TrackId,
principalTable: "Projects", principalTable: "Tracks",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_Employees_Steps_StepId",
column: x => x.StepId,
principalTable: "Steps",
principalColumn: "Id", principalColumn: "Id",
onDelete: ReferentialAction.Restrict); onDelete: ReferentialAction.Restrict);
table.ForeignKey( table.ForeignKey(
...@@ -262,52 +323,87 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -262,52 +323,87 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
}); });
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "Items", name: "StepTracks",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "int", nullable: false) Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"), .Annotation("SqlServer:Identity", "1, 1"),
ItemName = table.Column<string>(type: "nvarchar(max)", nullable: true), StepId = table.Column<int>(type: "int", nullable: false),
ItemDescription = table.Column<string>(type: "nvarchar(max)", nullable: true), TrackId = table.Column<int>(type: "int", nullable: false),
Ammount = table.Column<int>(type: "int", nullable: true), ExecutionRatio = table.Column<int>(type: "int", nullable: false)
Currency = table.Column<string>(type: "nvarchar(max)", nullable: true),
StepId = table.Column<int>(type: "int", nullable: true)
}, },
constraints: table => constraints: table =>
{ {
table.PrimaryKey("PK_Items", x => x.Id); table.PrimaryKey("PK_StepTracks", x => x.Id);
table.ForeignKey( table.ForeignKey(
name: "FK_Items_Steps_StepId", name: "FK_StepTracks_Steps_StepId",
column: x => x.StepId, column: x => x.StepId,
principalTable: "Steps", principalTable: "Steps",
principalColumn: "Id", principalColumn: "Id",
onDelete: ReferentialAction.Restrict); onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_StepTracks_Tracks_TrackId",
column: x => x.TrackId,
principalTable: "Tracks",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}); });
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "StepTracks", name: "EmployeeParticipate",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "int", nullable: false) Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"), .Annotation("SqlServer:Identity", "1, 1"),
StepId = table.Column<int>(type: "int", nullable: false), EmployeeId = table.Column<int>(type: "int", nullable: false),
TrackId = table.Column<int>(type: "int", nullable: false) ProjectId = table.Column<int>(type: "int", nullable: false),
PartialTimeRatio = table.Column<int>(type: "int", nullable: false),
Role = table.Column<string>(type: "nvarchar(max)", nullable: true)
}, },
constraints: table => constraints: table =>
{ {
table.PrimaryKey("PK_StepTracks", x => x.Id); table.PrimaryKey("PK_EmployeeParticipate", x => x.Id);
table.ForeignKey( table.ForeignKey(
name: "FK_StepTracks_Steps_StepId", name: "FK_EmployeeParticipate_Employees_EmployeeId",
column: x => x.StepId, column: x => x.EmployeeId,
principalTable: "Steps", principalTable: "Employees",
principalColumn: "Id", principalColumn: "Id",
onDelete: ReferentialAction.Restrict); onDelete: ReferentialAction.Cascade);
table.ForeignKey( table.ForeignKey(
name: "FK_StepTracks_Tracks_TrackId", name: "FK_EmployeeParticipate_Projects_ProjectId",
column: x => x.ProjectId,
principalTable: "Projects",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "EmployeeTrack",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
EmloyeeId = table.Column<int>(type: "int", nullable: false),
TrackId = table.Column<int>(type: "int", nullable: false),
WorkingHours = table.Column<int>(type: "int", nullable: false),
PerformedWork = table.Column<string>(type: "nvarchar(max)", nullable: true),
AssignedWork = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_EmployeeTrack", x => x.Id);
table.ForeignKey(
name: "FK_EmployeeTrack_Employees_EmloyeeId",
column: x => x.EmloyeeId,
principalTable: "Employees",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_EmployeeTrack_Tracks_TrackId",
column: x => x.TrackId, column: x => x.TrackId,
principalTable: "Tracks", principalTable: "Tracks",
principalColumn: "Id", principalColumn: "Id",
onDelete: ReferentialAction.Restrict); onDelete: ReferentialAction.Cascade);
}); });
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
...@@ -331,24 +427,34 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -331,24 +427,34 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
column: x => x.EmployeeId, column: x => x.EmployeeId,
principalTable: "Employees", principalTable: "Employees",
principalColumn: "Id", principalColumn: "Id",
onDelete: ReferentialAction.Restrict); onDelete: ReferentialAction.Cascade);
table.ForeignKey( table.ForeignKey(
name: "FK_EmployeeWorks_StepTracks_StepTrackId", name: "FK_EmployeeWorks_StepTracks_StepTrackId",
column: x => x.StepTrackId, column: x => x.StepTrackId,
principalTable: "StepTracks", principalTable: "StepTracks",
principalColumn: "Id", principalColumn: "Id",
onDelete: ReferentialAction.Restrict); onDelete: ReferentialAction.Cascade);
}); });
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_Employees_ProjectId", name: "IX_Attachment_ProjectId",
table: "Employees", table: "Attachment",
column: "ProjectId");
migrationBuilder.CreateIndex(
name: "IX_EmployeeParticipate_EmployeeId",
table: "EmployeeParticipate",
column: "EmployeeId");
migrationBuilder.CreateIndex(
name: "IX_EmployeeParticipate_ProjectId",
table: "EmployeeParticipate",
column: "ProjectId"); column: "ProjectId");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_Employees_StepId", name: "IX_Employees_TrackId",
table: "Employees", table: "Employees",
column: "StepId"); column: "TrackId");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_Employees_UserId", name: "IX_Employees_UserId",
...@@ -356,6 +462,16 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -356,6 +462,16 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
column: "UserId", column: "UserId",
unique: true); unique: true);
migrationBuilder.CreateIndex(
name: "IX_EmployeeTrack_EmloyeeId",
table: "EmployeeTrack",
column: "EmloyeeId");
migrationBuilder.CreateIndex(
name: "IX_EmployeeTrack_TrackId",
table: "EmployeeTrack",
column: "TrackId");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_EmployeeWorks_EmployeeId", name: "IX_EmployeeWorks_EmployeeId",
table: "EmployeeWorks", table: "EmployeeWorks",
...@@ -367,24 +483,24 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -367,24 +483,24 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
column: "StepTrackId"); column: "StepTrackId");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_Items_StepId", name: "IX_PermissionRole_RolesId",
table: "Items", table: "PermissionRole",
column: "StepId"); column: "RolesId");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_Permission_PermissionId", name: "IX_Projects_ExecuterId",
table: "Permission", table: "Projects",
column: "PermissionId"); column: "ExecuterId");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_Permission_RoleId", name: "IX_Projects_ProjectManagerId",
table: "Permission", table: "Projects",
column: "RoleId"); column: "ProjectManagerId");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_Projects_ExecuterId", name: "IX_Projects_ProjectStatusId",
table: "Projects", table: "Projects",
column: "ExecuterId"); column: "ProjectStatusId");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_Projects_ProposerId", name: "IX_Projects_ProposerId",
...@@ -406,11 +522,6 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -406,11 +522,6 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
table: "Steps", table: "Steps",
column: "ProjectId"); column: "ProjectId");
migrationBuilder.CreateIndex(
name: "IX_Steps_TrackId",
table: "Steps",
column: "TrackId");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_StepTracks_StepId", name: "IX_StepTracks_StepId",
table: "StepTracks", table: "StepTracks",
...@@ -426,6 +537,14 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -426,6 +537,14 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
table: "Tracks", table: "Tracks",
column: "ProjectId"); column: "ProjectId");
migrationBuilder.AddForeignKey(
name: "FK_Projects_Employees_ProjectManagerId",
table: "Projects",
column: "ProjectManagerId",
principalTable: "Employees",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey( migrationBuilder.AddForeignKey(
name: "FK_Projects_Employees_TeamLeaderId", name: "FK_Projects_Employees_TeamLeaderId",
table: "Projects", table: "Projects",
...@@ -437,25 +556,22 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -437,25 +556,22 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
protected override void Down(MigrationBuilder migrationBuilder) protected override void Down(MigrationBuilder migrationBuilder)
{ {
migrationBuilder.DropForeignKey(
name: "FK_Projects_Customers_ProposerId",
table: "Projects");
migrationBuilder.DropForeignKey(
name: "FK_Employees_Projects_ProjectId",
table: "Employees");
migrationBuilder.DropForeignKey(
name: "FK_Steps_Projects_ProjectId",
table: "Steps");
migrationBuilder.DropForeignKey( migrationBuilder.DropForeignKey(
name: "FK_Tracks_Projects_ProjectId", name: "FK_Tracks_Projects_ProjectId",
table: "Tracks"); table: "Tracks");
migrationBuilder.DropTable(
name: "Attachment");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "ContactInfo"); name: "ContactInfo");
migrationBuilder.DropTable(
name: "EmployeeParticipate");
migrationBuilder.DropTable(
name: "EmployeeTrack");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "EmployeeWorks"); name: "EmployeeWorks");
...@@ -463,7 +579,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -463,7 +579,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
name: "Items"); name: "Items");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "Permission"); name: "PermissionRole");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "RoleUser"); name: "RoleUser");
...@@ -472,14 +588,20 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -472,14 +588,20 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
name: "StepTracks"); name: "StepTracks");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "Role"); name: "Permission");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "Customers"); name: "Roles");
migrationBuilder.DropTable(
name: "Steps");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "Projects"); name: "Projects");
migrationBuilder.DropTable(
name: "Customers");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "Departments"); name: "Departments");
...@@ -487,13 +609,13 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -487,13 +609,13 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
name: "Employees"); name: "Employees");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "Steps"); name: "ProjectStatus");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "Users"); name: "Tracks");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "Tracks"); name: "Users");
} }
} }
} }
...@@ -10,8 +10,8 @@ using PSManagement.Infrastructure.Persistence; ...@@ -10,8 +10,8 @@ using PSManagement.Infrastructure.Persistence;
namespace PSManagement.Infrastructure.Persistence.Migrations namespace PSManagement.Infrastructure.Persistence.Migrations
{ {
[DbContext(typeof(AppDbContext))] [DbContext(typeof(AppDbContext))]
[Migration("20240806125539_AddDomainUpdate2")] [Migration("20240807122646_UpdateDomains")]
partial class AddDomainUpdate2 partial class UpdateDomains
{ {
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)
{ {
...@@ -259,7 +259,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -259,7 +259,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.ToTable("Items"); b.ToTable("Item");
}); });
modelBuilder.Entity("PSManagement.Domain.Steps.Entities.Step", b => modelBuilder.Entity("PSManagement.Domain.Steps.Entities.Step", b =>
...@@ -328,40 +328,6 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -328,40 +328,6 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b.ToTable("EmployeeTrack"); b.ToTable("EmployeeTrack");
}); });
modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.EmployeeWork", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("ContributingRatio")
.HasColumnType("int");
b.Property<int>("EmployeeId")
.HasColumnType("int");
b.Property<int>("EmployeeWorkId")
.HasColumnType("int");
b.Property<int>("HoursWorked")
.HasColumnType("int");
b.Property<string>("Notes")
.HasColumnType("nvarchar(max)");
b.Property<int>("StepTrackId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("EmployeeId");
b.HasIndex("StepTrackId");
b.ToTable("EmployeeWorks");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.StepTrack", b => modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.StepTrack", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
...@@ -576,8 +542,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -576,8 +542,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b.HasOne("PSManagement.Domain.Employees.Entities.Employee", "ProjectManager") b.HasOne("PSManagement.Domain.Employees.Entities.Employee", "ProjectManager")
.WithMany() .WithMany()
.HasForeignKey("ProjectManagerId") .HasForeignKey("ProjectManagerId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Restrict);
.IsRequired();
b.HasOne("PSManagement.Domain.Projects.Entities.ProjectStatus", "ProjectStatus") b.HasOne("PSManagement.Domain.Projects.Entities.ProjectStatus", "ProjectStatus")
.WithMany() .WithMany()
...@@ -590,8 +555,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -590,8 +555,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b.HasOne("PSManagement.Domain.Employees.Entities.Employee", "TeamLeader") b.HasOne("PSManagement.Domain.Employees.Entities.Employee", "TeamLeader")
.WithMany() .WithMany()
.HasForeignKey("TeamLeaderId") .HasForeignKey("TeamLeaderId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Restrict);
.IsRequired();
b.OwnsOne("PSManagement.Domain.Projects.Aggregate.Aggreement", "ProjectAggreement", b1 => b.OwnsOne("PSManagement.Domain.Projects.Aggregate.Aggreement", "ProjectAggreement", b1 =>
{ {
...@@ -753,7 +717,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -753,7 +717,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b1.HasKey("ItemId"); b1.HasKey("ItemId");
b1.ToTable("Items"); b1.ToTable("Item");
b1.WithOwner() b1.WithOwner()
.HasForeignKey("ItemId"); .HasForeignKey("ItemId");
...@@ -792,25 +756,6 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -792,25 +756,6 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b.Navigation("Track"); b.Navigation("Track");
}); });
modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.EmployeeWork", b =>
{
b.HasOne("PSManagement.Domain.Employees.Entities.Employee", "Employee")
.WithMany()
.HasForeignKey("EmployeeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PSManagement.Domain.Tracking.Entities.StepTrack", "StepTrack")
.WithMany()
.HasForeignKey("StepTrackId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Employee");
b.Navigation("StepTrack");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.StepTrack", b => modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.StepTrack", b =>
{ {
b.HasOne("PSManagement.Domain.Steps.Entities.Step", "Step") b.HasOne("PSManagement.Domain.Steps.Entities.Step", "Step")
......
using Microsoft.EntityFrameworkCore.Migrations;
namespace PSManagement.Infrastructure.Persistence.Migrations
{
public partial class UpdateDomains : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "EmployeeWorks");
migrationBuilder.DropPrimaryKey(
name: "PK_Items",
table: "Items");
migrationBuilder.RenameTable(
name: "Items",
newName: "Item");
migrationBuilder.AddPrimaryKey(
name: "PK_Item",
table: "Item",
column: "Id");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropPrimaryKey(
name: "PK_Item",
table: "Item");
migrationBuilder.RenameTable(
name: "Item",
newName: "Items");
migrationBuilder.AddPrimaryKey(
name: "PK_Items",
table: "Items",
column: "Id");
migrationBuilder.CreateTable(
name: "EmployeeWorks",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
ContributingRatio = table.Column<int>(type: "int", nullable: false),
EmployeeId = table.Column<int>(type: "int", nullable: false),
EmployeeWorkId = table.Column<int>(type: "int", nullable: false),
HoursWorked = table.Column<int>(type: "int", nullable: false),
Notes = table.Column<string>(type: "nvarchar(max)", nullable: true),
StepTrackId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_EmployeeWorks", x => x.Id);
table.ForeignKey(
name: "FK_EmployeeWorks_Employees_EmployeeId",
column: x => x.EmployeeId,
principalTable: "Employees",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_EmployeeWorks_StepTracks_StepTrackId",
column: x => x.StepTrackId,
principalTable: "StepTracks",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_EmployeeWorks_EmployeeId",
table: "EmployeeWorks",
column: "EmployeeId");
migrationBuilder.CreateIndex(
name: "IX_EmployeeWorks_StepTrackId",
table: "EmployeeWorks",
column: "StepTrackId");
}
}
}
...@@ -10,8 +10,8 @@ using PSManagement.Infrastructure.Persistence; ...@@ -10,8 +10,8 @@ using PSManagement.Infrastructure.Persistence;
namespace PSManagement.Infrastructure.Persistence.Migrations namespace PSManagement.Infrastructure.Persistence.Migrations
{ {
[DbContext(typeof(AppDbContext))] [DbContext(typeof(AppDbContext))]
[Migration("20240806132941_AddDomainUpdate3")] [Migration("20240807124316_UpdateDomains1")]
partial class AddDomainUpdate3 partial class UpdateDomains1
{ {
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)
{ {
...@@ -65,16 +65,11 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -65,16 +65,11 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b.Property<int>("HIASTId") b.Property<int>("HIASTId")
.HasColumnType("int"); .HasColumnType("int");
b.Property<int?>("TrackId")
.HasColumnType("int");
b.Property<int>("UserId") b.Property<int>("UserId")
.HasColumnType("int"); .HasColumnType("int");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("TrackId");
b.HasIndex("UserId") b.HasIndex("UserId")
.IsUnique(); .IsUnique();
...@@ -259,7 +254,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -259,7 +254,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.ToTable("Items"); b.ToTable("Item");
}); });
modelBuilder.Entity("PSManagement.Domain.Steps.Entities.Step", b => modelBuilder.Entity("PSManagement.Domain.Steps.Entities.Step", b =>
...@@ -328,40 +323,6 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -328,40 +323,6 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b.ToTable("EmployeeTrack"); b.ToTable("EmployeeTrack");
}); });
modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.EmployeeWork", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("ContributingRatio")
.HasColumnType("int");
b.Property<int>("EmployeeId")
.HasColumnType("int");
b.Property<int>("EmployeeWorkId")
.HasColumnType("int");
b.Property<int>("HoursWorked")
.HasColumnType("int");
b.Property<string>("Notes")
.HasColumnType("nvarchar(max)");
b.Property<int>("StepTrackId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("EmployeeId");
b.HasIndex("StepTrackId");
b.ToTable("EmployeeWorks");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.StepTrack", b => modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.StepTrack", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
...@@ -504,10 +465,6 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -504,10 +465,6 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
modelBuilder.Entity("PSManagement.Domain.Employees.Entities.Employee", b => modelBuilder.Entity("PSManagement.Domain.Employees.Entities.Employee", b =>
{ {
b.HasOne("PSManagement.Domain.Tracking.Track", null)
.WithMany("TrackedEmployees")
.HasForeignKey("TrackId");
b.HasOne("PSManagement.Domain.Identity.Entities.User", "User") b.HasOne("PSManagement.Domain.Identity.Entities.User", "User")
.WithOne("Employee") .WithOne("Employee")
.HasForeignKey("PSManagement.Domain.Employees.Entities.Employee", "UserId") .HasForeignKey("PSManagement.Domain.Employees.Entities.Employee", "UserId")
...@@ -576,8 +533,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -576,8 +533,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b.HasOne("PSManagement.Domain.Employees.Entities.Employee", "ProjectManager") b.HasOne("PSManagement.Domain.Employees.Entities.Employee", "ProjectManager")
.WithMany() .WithMany()
.HasForeignKey("ProjectManagerId") .HasForeignKey("ProjectManagerId")
.OnDelete(DeleteBehavior.Restrict) .OnDelete(DeleteBehavior.Restrict);
.IsRequired();
b.HasOne("PSManagement.Domain.Projects.Entities.ProjectStatus", "ProjectStatus") b.HasOne("PSManagement.Domain.Projects.Entities.ProjectStatus", "ProjectStatus")
.WithMany() .WithMany()
...@@ -590,8 +546,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -590,8 +546,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b.HasOne("PSManagement.Domain.Employees.Entities.Employee", "TeamLeader") b.HasOne("PSManagement.Domain.Employees.Entities.Employee", "TeamLeader")
.WithMany() .WithMany()
.HasForeignKey("TeamLeaderId") .HasForeignKey("TeamLeaderId")
.OnDelete(DeleteBehavior.Restrict) .OnDelete(DeleteBehavior.Restrict);
.IsRequired();
b.OwnsOne("PSManagement.Domain.Projects.Aggregate.Aggreement", "ProjectAggreement", b1 => b.OwnsOne("PSManagement.Domain.Projects.Aggregate.Aggreement", "ProjectAggreement", b1 =>
{ {
...@@ -753,7 +708,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -753,7 +708,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b1.HasKey("ItemId"); b1.HasKey("ItemId");
b1.ToTable("Items"); b1.ToTable("Item");
b1.WithOwner() b1.WithOwner()
.HasForeignKey("ItemId"); .HasForeignKey("ItemId");
...@@ -792,25 +747,6 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -792,25 +747,6 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b.Navigation("Track"); b.Navigation("Track");
}); });
modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.EmployeeWork", b =>
{
b.HasOne("PSManagement.Domain.Employees.Entities.Employee", "Employee")
.WithMany()
.HasForeignKey("EmployeeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PSManagement.Domain.Tracking.Entities.StepTrack", "StepTrack")
.WithMany()
.HasForeignKey("StepTrackId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Employee");
b.Navigation("StepTrack");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.StepTrack", b => modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.StepTrack", b =>
{ {
b.HasOne("PSManagement.Domain.Steps.Entities.Step", "Step") b.HasOne("PSManagement.Domain.Steps.Entities.Step", "Step")
...@@ -909,8 +845,6 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -909,8 +845,6 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b.Navigation("EmployeeTracks"); b.Navigation("EmployeeTracks");
b.Navigation("StepTracks"); b.Navigation("StepTracks");
b.Navigation("TrackedEmployees");
}); });
#pragma warning restore 612, 618 #pragma warning restore 612, 618
} }
......
...@@ -2,39 +2,39 @@ ...@@ -2,39 +2,39 @@
namespace PSManagement.Infrastructure.Persistence.Migrations namespace PSManagement.Infrastructure.Persistence.Migrations
{ {
public partial class AddDomains6 : Migration public partial class UpdateDomains1 : Migration
{ {
protected override void Up(MigrationBuilder migrationBuilder) protected override void Up(MigrationBuilder migrationBuilder)
{ {
migrationBuilder.DropForeignKey( migrationBuilder.DropForeignKey(
name: "FK_Steps_Tracks_TrackId", name: "FK_Employees_Tracks_TrackId",
table: "Steps"); table: "Employees");
migrationBuilder.DropIndex( migrationBuilder.DropIndex(
name: "IX_Steps_TrackId", name: "IX_Employees_TrackId",
table: "Steps"); table: "Employees");
migrationBuilder.DropColumn( migrationBuilder.DropColumn(
name: "TrackId", name: "TrackId",
table: "Steps"); table: "Employees");
} }
protected override void Down(MigrationBuilder migrationBuilder) protected override void Down(MigrationBuilder migrationBuilder)
{ {
migrationBuilder.AddColumn<int>( migrationBuilder.AddColumn<int>(
name: "TrackId", name: "TrackId",
table: "Steps", table: "Employees",
type: "int", type: "int",
nullable: true); nullable: true);
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_Steps_TrackId", name: "IX_Employees_TrackId",
table: "Steps", table: "Employees",
column: "TrackId"); column: "TrackId");
migrationBuilder.AddForeignKey( migrationBuilder.AddForeignKey(
name: "FK_Steps_Tracks_TrackId", name: "FK_Employees_Tracks_TrackId",
table: "Steps", table: "Employees",
column: "TrackId", column: "TrackId",
principalTable: "Tracks", principalTable: "Tracks",
principalColumn: "Id", principalColumn: "Id",
......
...@@ -10,8 +10,8 @@ using PSManagement.Infrastructure.Persistence; ...@@ -10,8 +10,8 @@ using PSManagement.Infrastructure.Persistence;
namespace PSManagement.Infrastructure.Persistence.Migrations namespace PSManagement.Infrastructure.Persistence.Migrations
{ {
[DbContext(typeof(AppDbContext))] [DbContext(typeof(AppDbContext))]
[Migration("20240806062155_AddDomainUpdate")] [Migration("20240808142549_AddDomainsUpdate2")]
partial class AddDomainUpdate partial class AddDomainsUpdate2
{ {
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)
{ {
...@@ -65,16 +65,11 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -65,16 +65,11 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b.Property<int>("HIASTId") b.Property<int>("HIASTId")
.HasColumnType("int"); .HasColumnType("int");
b.Property<int?>("TrackId")
.HasColumnType("int");
b.Property<int>("UserId") b.Property<int>("UserId")
.HasColumnType("int"); .HasColumnType("int");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("TrackId");
b.HasIndex("UserId") b.HasIndex("UserId")
.IsUnique(); .IsUnique();
...@@ -132,78 +127,71 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -132,78 +127,71 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b.ToTable("Users"); b.ToTable("Users");
}); });
modelBuilder.Entity("PSManagement.Domain.ProjectTypes.Entities.ProjectType", b => modelBuilder.Entity("PSManagement.Domain.Projects.Entities.Attachment", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int") .HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Description") b.Property<string>("AttachmenDescription")
.HasColumnType("nvarchar(max)");
b.Property<string>("AttachmentName")
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<string>("TypeName") b.Property<string>("AttachmentUrl")
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<int>("WorkerCount") b.Property<int?>("ProjectId")
.HasColumnType("int"); .HasColumnType("int");
b.HasKey("Id"); b.HasKey("Id");
b.ToTable("ProjectType"); b.HasIndex("ProjectId");
b.ToTable("Attachment");
}); });
modelBuilder.Entity("PSManagement.Domain.Projects.Aggregate.Project", b => modelBuilder.Entity("PSManagement.Domain.Projects.Entities.EmployeeParticipate", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int") .HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int?>("ExecuterId") b.Property<int>("EmployeeId")
.HasColumnType("int");
b.Property<int?>("ProjectStatusId")
.HasColumnType("int"); .HasColumnType("int");
b.Property<int?>("ProjectTypeId") b.Property<int>("PartialTimeRatio")
.HasColumnType("int"); .HasColumnType("int");
b.Property<int?>("ProposerId") b.Property<int>("ProjectId")
.HasColumnType("int"); .HasColumnType("int");
b.Property<int?>("TeamLeaderId") b.Property<string>("Role")
.HasColumnType("int"); .HasColumnType("nvarchar(max)");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("ExecuterId"); b.HasIndex("EmployeeId");
b.HasIndex("ProjectStatusId");
b.HasIndex("ProjectTypeId");
b.HasIndex("ProposerId");
b.HasIndex("TeamLeaderId"); b.HasIndex("ProjectId");
b.ToTable("Projects"); b.ToTable("EmployeeParticipate");
}); });
modelBuilder.Entity("PSManagement.Domain.Projects.Entities.Attachment", b => modelBuilder.Entity("PSManagement.Domain.Projects.Entities.FinincialSpending", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int") .HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("AttachmenDescription") b.Property<string>("CostType")
.HasColumnType("nvarchar(max)");
b.Property<string>("AttachmentName")
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<string>("AttachmentUrl") b.Property<string>("Description")
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<int?>("ProjectId") b.Property<int?>("ProjectId")
...@@ -213,38 +201,47 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -213,38 +201,47 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b.HasIndex("ProjectId"); b.HasIndex("ProjectId");
b.ToTable("Attachment"); b.ToTable("FinincialSpending");
}); });
modelBuilder.Entity("PSManagement.Domain.Projects.Entities.EmployeeParticipate", b => modelBuilder.Entity("PSManagement.Domain.Projects.Entities.Project", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int") .HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("EmployeeId") b.Property<int?>("ExecuterId")
.HasColumnType("int"); .HasColumnType("int");
b.Property<int>("PartialTimeRatio") b.Property<int>("ProjectManagerId")
.HasColumnType("int"); .HasColumnType("int");
b.Property<int>("ProjectId") b.Property<int?>("ProjectStatusId")
.HasColumnType("int"); .HasColumnType("int");
b.Property<string>("Role") b.Property<int?>("ProposerId")
.HasColumnType("nvarchar(max)"); .HasColumnType("int");
b.Property<int>("TeamLeaderId")
.HasColumnType("int");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("EmployeeId"); b.HasIndex("ExecuterId");
b.HasIndex("ProjectId"); b.HasIndex("ProjectManagerId");
b.ToTable("EmployeeParticipate"); b.HasIndex("ProjectStatusId");
b.HasIndex("ProposerId");
b.HasIndex("TeamLeaderId");
b.ToTable("Projects");
}); });
modelBuilder.Entity("PSManagement.Domain.Projects.Entities.ProjectStatus", b => modelBuilder.Entity("PSManagement.Domain.ProjectsStatus.Entites.ProjectStatus", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
...@@ -280,7 +277,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -280,7 +277,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.ToTable("Items"); b.ToTable("Item");
}); });
modelBuilder.Entity("PSManagement.Domain.Steps.Entities.Step", b => modelBuilder.Entity("PSManagement.Domain.Steps.Entities.Step", b =>
...@@ -349,40 +346,6 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -349,40 +346,6 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b.ToTable("EmployeeTrack"); b.ToTable("EmployeeTrack");
}); });
modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.EmployeeWork", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("ContributingRatio")
.HasColumnType("int");
b.Property<int>("EmployeeId")
.HasColumnType("int");
b.Property<int>("EmployeeWorkId")
.HasColumnType("int");
b.Property<int>("HoursWorked")
.HasColumnType("int");
b.Property<string>("Notes")
.HasColumnType("nvarchar(max)");
b.Property<int>("StepTrackId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("EmployeeId");
b.HasIndex("StepTrackId");
b.ToTable("EmployeeWorks");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.StepTrack", b => modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.StepTrack", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
...@@ -525,10 +488,6 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -525,10 +488,6 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
modelBuilder.Entity("PSManagement.Domain.Employees.Entities.Employee", b => modelBuilder.Entity("PSManagement.Domain.Employees.Entities.Employee", b =>
{ {
b.HasOne("PSManagement.Domain.Tracking.Track", null)
.WithMany("TrackedEmployees")
.HasForeignKey("TrackId");
b.HasOne("PSManagement.Domain.Identity.Entities.User", "User") b.HasOne("PSManagement.Domain.Identity.Entities.User", "User")
.WithOne("Employee") .WithOne("Employee")
.HasForeignKey("PSManagement.Domain.Employees.Entities.Employee", "UserId") .HasForeignKey("PSManagement.Domain.Employees.Entities.Employee", "UserId")
...@@ -581,26 +540,138 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -581,26 +540,138 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
.HasForeignKey("EmployeeId"); .HasForeignKey("EmployeeId");
}); });
b.OwnsOne("PSManagement.Domain.Employees.Entities.WorkInfo", "WorkInfo", b1 =>
{
b1.Property<int>("EmployeeId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<string>("WorkJob")
.HasColumnType("nvarchar(max)")
.HasColumnName("WorkJob");
b1.Property<string>("WorkType")
.HasColumnType("nvarchar(max)")
.HasColumnName("WorkType");
b1.HasKey("EmployeeId");
b1.ToTable("Employees");
b1.WithOwner()
.HasForeignKey("EmployeeId");
});
b.Navigation("Availability"); b.Navigation("Availability");
b.Navigation("PersonalInfo"); b.Navigation("PersonalInfo");
b.Navigation("User"); b.Navigation("User");
b.Navigation("WorkInfo");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Entities.Attachment", b =>
{
b.HasOne("PSManagement.Domain.Projects.Entities.Project", null)
.WithMany("Attachments")
.HasForeignKey("ProjectId");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Entities.EmployeeParticipate", b =>
{
b.HasOne("PSManagement.Domain.Employees.Entities.Employee", "Employee")
.WithMany("EmployeeParticipates")
.HasForeignKey("EmployeeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PSManagement.Domain.Projects.Entities.Project", "Project")
.WithMany("EmployeeParticipates")
.HasForeignKey("ProjectId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Employee");
b.Navigation("Project");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Entities.FinincialSpending", b =>
{
b.HasOne("PSManagement.Domain.Projects.Entities.Project", null)
.WithMany("FinincialSpending")
.HasForeignKey("ProjectId");
b.OwnsOne("PSManagement.SharedKernel.ValueObjects.Money", "ExternalPurchase", b1 =>
{
b1.Property<int>("FinincialSpendingId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<int>("Ammount")
.HasColumnType("int")
.HasColumnName("ExternalPurchaseAmmount");
b1.Property<string>("Currency")
.HasColumnType("nvarchar(max)")
.HasDefaultValue("USD")
.HasColumnName("ExternalPurchaseCurrency");
b1.HasKey("FinincialSpendingId");
b1.ToTable("FinincialSpending");
b1.WithOwner()
.HasForeignKey("FinincialSpendingId");
}); });
modelBuilder.Entity("PSManagement.Domain.Projects.Aggregate.Project", b => b.OwnsOne("PSManagement.SharedKernel.ValueObjects.Money", "LocalPurchase", b1 =>
{
b1.Property<int>("FinincialSpendingId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<int>("Ammount")
.HasColumnType("int")
.HasColumnName("LocalPurchaseAmmount");
b1.Property<string>("Currency")
.ValueGeneratedOnAdd()
.HasColumnType("nvarchar(max)")
.HasDefaultValue("SP")
.HasColumnName("LocalPurchaseCurrency");
b1.HasKey("FinincialSpendingId");
b1.ToTable("FinincialSpending");
b1.WithOwner()
.HasForeignKey("FinincialSpendingId");
});
b.Navigation("ExternalPurchase");
b.Navigation("LocalPurchase");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Entities.Project", b =>
{ {
b.HasOne("PSManagement.Domain.Employees.Entities.Department", "Executer") b.HasOne("PSManagement.Domain.Employees.Entities.Department", "Executer")
.WithMany() .WithMany()
.HasForeignKey("ExecuterId"); .HasForeignKey("ExecuterId");
b.HasOne("PSManagement.Domain.Projects.Entities.ProjectStatus", "ProjectStatus") b.HasOne("PSManagement.Domain.Employees.Entities.Employee", "ProjectManager")
.WithMany() .WithMany()
.HasForeignKey("ProjectStatusId"); .HasForeignKey("ProjectManagerId")
.OnDelete(DeleteBehavior.Restrict);
b.HasOne("PSManagement.Domain.ProjectTypes.Entities.ProjectType", "ProjectType") b.HasOne("PSManagement.Domain.ProjectsStatus.Entites.ProjectStatus", "ProjectStatus")
.WithMany("Projects") .WithMany()
.HasForeignKey("ProjectTypeId"); .HasForeignKey("ProjectStatusId");
b.HasOne("PSManagement.Domain.Customers.Aggregate.Customer", "Proposer") b.HasOne("PSManagement.Domain.Customers.Aggregate.Customer", "Proposer")
.WithMany("Projects") .WithMany("Projects")
...@@ -608,9 +679,10 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -608,9 +679,10 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b.HasOne("PSManagement.Domain.Employees.Entities.Employee", "TeamLeader") b.HasOne("PSManagement.Domain.Employees.Entities.Employee", "TeamLeader")
.WithMany() .WithMany()
.HasForeignKey("TeamLeaderId"); .HasForeignKey("TeamLeaderId")
.OnDelete(DeleteBehavior.Restrict);
b.OwnsOne("PSManagement.Domain.Projects.Aggregate.Aggreement", "ProjectAggreement", b1 => b.OwnsOne("PSManagement.Domain.Projects.ValueObjects.Aggreement", "ProjectAggreement", b1 =>
{ {
b1.Property<int>("ProjectId") b1.Property<int>("ProjectId")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
...@@ -633,7 +705,30 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -633,7 +705,30 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
.HasForeignKey("ProjectId"); .HasForeignKey("ProjectId");
}); });
b.OwnsOne("PSManagement.Domain.Projects.Aggregate.ProjectInfo", "ProjectInfo", b1 => b.OwnsOne("PSManagement.Domain.Projects.ValueObjects.FinincialFund", "FinincialFund", b1 =>
{
b1.Property<int>("ProjectId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<string>("FinicialStatus")
.HasColumnType("nvarchar(max)")
.HasColumnName("FinicialStatus");
b1.Property<string>("Source")
.HasColumnType("nvarchar(max)")
.HasColumnName("FinicialSource");
b1.HasKey("ProjectId");
b1.ToTable("Projects");
b1.WithOwner()
.HasForeignKey("ProjectId");
});
b.OwnsOne("PSManagement.Domain.Projects.ValueObjects.ProjectInfo", "ProjectInfo", b1 =>
{ {
b1.Property<int>("ProjectId") b1.Property<int>("ProjectId")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
...@@ -660,7 +755,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -660,7 +755,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
.HasForeignKey("ProjectId"); .HasForeignKey("ProjectId");
}); });
b.OwnsOne("PSManagement.Domain.Projects.Aggregate.ProposalInfo", "ProposalInfo", b1 => b.OwnsOne("PSManagement.Domain.Projects.ValueObjects.ProposalInfo", "ProposalInfo", b1 =>
{ {
b1.Property<int>("ProjectId") b1.Property<int>("ProjectId")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
...@@ -685,13 +780,15 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -685,13 +780,15 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b.Navigation("Executer"); b.Navigation("Executer");
b.Navigation("FinincialFund");
b.Navigation("ProjectAggreement"); b.Navigation("ProjectAggreement");
b.Navigation("ProjectInfo"); b.Navigation("ProjectInfo");
b.Navigation("ProjectStatus"); b.Navigation("ProjectManager");
b.Navigation("ProjectType"); b.Navigation("ProjectStatus");
b.Navigation("ProposalInfo"); b.Navigation("ProposalInfo");
...@@ -700,32 +797,6 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -700,32 +797,6 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b.Navigation("TeamLeader"); b.Navigation("TeamLeader");
}); });
modelBuilder.Entity("PSManagement.Domain.Projects.Entities.Attachment", b =>
{
b.HasOne("PSManagement.Domain.Projects.Aggregate.Project", null)
.WithMany("Attachments")
.HasForeignKey("ProjectId");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Entities.EmployeeParticipate", b =>
{
b.HasOne("PSManagement.Domain.Employees.Entities.Employee", "Employee")
.WithMany("EmployeeParticipates")
.HasForeignKey("EmployeeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PSManagement.Domain.Projects.Aggregate.Project", "Project")
.WithMany("EmployeeParticipates")
.HasForeignKey("ProjectId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Employee");
b.Navigation("Project");
});
modelBuilder.Entity("PSManagement.Domain.Steps.Entities.Item", b => modelBuilder.Entity("PSManagement.Domain.Steps.Entities.Item", b =>
{ {
b.OwnsOne("PSManagement.SharedKernel.ValueObjects.Money", "Price", b1 => b.OwnsOne("PSManagement.SharedKernel.ValueObjects.Money", "Price", b1 =>
...@@ -745,7 +816,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -745,7 +816,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b1.HasKey("ItemId"); b1.HasKey("ItemId");
b1.ToTable("Items"); b1.ToTable("Item");
b1.WithOwner() b1.WithOwner()
.HasForeignKey("ItemId"); .HasForeignKey("ItemId");
...@@ -756,7 +827,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -756,7 +827,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
modelBuilder.Entity("PSManagement.Domain.Steps.Entities.Step", b => modelBuilder.Entity("PSManagement.Domain.Steps.Entities.Step", b =>
{ {
b.HasOne("PSManagement.Domain.Projects.Aggregate.Project", "Project") b.HasOne("PSManagement.Domain.Projects.Entities.Project", "Project")
.WithMany("Steps") .WithMany("Steps")
.HasForeignKey("ProjectId") .HasForeignKey("ProjectId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
...@@ -784,25 +855,6 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -784,25 +855,6 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b.Navigation("Track"); b.Navigation("Track");
}); });
modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.EmployeeWork", b =>
{
b.HasOne("PSManagement.Domain.Employees.Entities.Employee", "Employee")
.WithMany()
.HasForeignKey("EmployeeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PSManagement.Domain.Tracking.Entities.StepTrack", "StepTrack")
.WithMany()
.HasForeignKey("StepTrackId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Employee");
b.Navigation("StepTrack");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.StepTrack", b => modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.StepTrack", b =>
{ {
b.HasOne("PSManagement.Domain.Steps.Entities.Step", "Step") b.HasOne("PSManagement.Domain.Steps.Entities.Step", "Step")
...@@ -824,7 +876,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -824,7 +876,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
modelBuilder.Entity("PSManagement.Domain.Tracking.Track", b => modelBuilder.Entity("PSManagement.Domain.Tracking.Track", b =>
{ {
b.HasOne("PSManagement.Domain.Projects.Aggregate.Project", "Project") b.HasOne("PSManagement.Domain.Projects.Entities.Project", "Project")
.WithMany("Tracks") .WithMany("Tracks")
.HasForeignKey("ProjectId") .HasForeignKey("ProjectId")
.OnDelete(DeleteBehavior.Restrict) .OnDelete(DeleteBehavior.Restrict)
...@@ -880,17 +932,14 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -880,17 +932,14 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b.Navigation("Employee"); b.Navigation("Employee");
}); });
modelBuilder.Entity("PSManagement.Domain.ProjectTypes.Entities.ProjectType", b => modelBuilder.Entity("PSManagement.Domain.Projects.Entities.Project", b =>
{
b.Navigation("Projects");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Aggregate.Project", b =>
{ {
b.Navigation("Attachments"); b.Navigation("Attachments");
b.Navigation("EmployeeParticipates"); b.Navigation("EmployeeParticipates");
b.Navigation("FinincialSpending");
b.Navigation("Steps"); b.Navigation("Steps");
b.Navigation("Tracks"); b.Navigation("Tracks");
...@@ -906,8 +955,6 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -906,8 +955,6 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b.Navigation("EmployeeTracks"); b.Navigation("EmployeeTracks");
b.Navigation("StepTracks"); b.Navigation("StepTracks");
b.Navigation("TrackedEmployees");
}); });
#pragma warning restore 612, 618 #pragma warning restore 612, 618
} }
......
...@@ -2,92 +2,65 @@ ...@@ -2,92 +2,65 @@
namespace PSManagement.Infrastructure.Persistence.Migrations namespace PSManagement.Infrastructure.Persistence.Migrations
{ {
public partial class AddDomains4 : Migration public partial class AddDomainsUpdate2 : Migration
{ {
protected override void Up(MigrationBuilder migrationBuilder) protected override void Up(MigrationBuilder migrationBuilder)
{ {
migrationBuilder.DropForeignKey( migrationBuilder.AddColumn<string>(
name: "FK_Employees_Projects_ProjectId", name: "WorkJob",
table: "Employees"); table: "Employees",
type: "nvarchar(max)",
migrationBuilder.DropIndex( nullable: true);
name: "IX_Employees_ProjectId",
table: "Employees");
migrationBuilder.DropColumn(
name: "ProjectId",
table: "Employees");
migrationBuilder.AddColumn<int>( migrationBuilder.AddColumn<string>(
name: "ProjectTypeId", name: "WorkType",
table: "Projects", table: "Employees",
type: "int", type: "nvarchar(max)",
nullable: true); nullable: true);
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "ProjectType", name: "FinincialSpending",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "int", nullable: false) Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"), .Annotation("SqlServer:Identity", "1, 1"),
TypeName = table.Column<string>(type: "nvarchar(max)", nullable: true), CostType = table.Column<string>(type: "nvarchar(max)", nullable: true),
Description = table.Column<string>(type: "nvarchar(max)", nullable: true), Description = table.Column<string>(type: "nvarchar(max)", nullable: true),
WorkerCount = table.Column<int>(type: "int", nullable: false) LocalPurchaseAmmount = table.Column<int>(type: "int", nullable: true),
LocalPurchaseCurrency = table.Column<string>(type: "nvarchar(max)", nullable: true, defaultValue: "SP"),
ExternalPurchaseAmmount = table.Column<int>(type: "int", nullable: true),
ExternalPurchaseCurrency = table.Column<string>(type: "nvarchar(max)", nullable: true, defaultValue: "USD"),
ProjectId = table.Column<int>(type: "int", nullable: true)
}, },
constraints: table => constraints: table =>
{ {
table.PrimaryKey("PK_ProjectType", x => x.Id); table.PrimaryKey("PK_FinincialSpending", x => x.Id);
table.ForeignKey(
name: "FK_FinincialSpending_Projects_ProjectId",
column: x => x.ProjectId,
principalTable: "Projects",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}); });
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_Projects_ProjectTypeId", name: "IX_FinincialSpending_ProjectId",
table: "Projects", table: "FinincialSpending",
column: "ProjectTypeId"); column: "ProjectId");
migrationBuilder.AddForeignKey(
name: "FK_Projects_ProjectType_ProjectTypeId",
table: "Projects",
column: "ProjectTypeId",
principalTable: "ProjectType",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
} }
protected override void Down(MigrationBuilder migrationBuilder) protected override void Down(MigrationBuilder migrationBuilder)
{ {
migrationBuilder.DropForeignKey(
name: "FK_Projects_ProjectType_ProjectTypeId",
table: "Projects");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "ProjectType"); name: "FinincialSpending");
migrationBuilder.DropIndex(
name: "IX_Projects_ProjectTypeId",
table: "Projects");
migrationBuilder.DropColumn( migrationBuilder.DropColumn(
name: "ProjectTypeId", name: "WorkJob",
table: "Projects"); table: "Employees");
migrationBuilder.AddColumn<int>(
name: "ProjectId",
table: "Employees",
type: "int",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_Employees_ProjectId",
table: "Employees",
column: "ProjectId");
migrationBuilder.AddForeignKey( migrationBuilder.DropColumn(
name: "FK_Employees_Projects_ProjectId", name: "WorkType",
table: "Employees", table: "Employees");
column: "ProjectId",
principalTable: "Projects",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
} }
} }
} }
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using PSManagement.Infrastructure.Persistence;
namespace PSManagement.Infrastructure.Persistence.Migrations
{
[DbContext(typeof(AppDbContext))]
[Migration("20240808173901_AddDomainsUpdate3")]
partial class AddDomainsUpdate3
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Relational:Collation", "Arabic_CI_AS")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("ProductVersion", "5.0.17")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("PSManagement.Domain.Customers.Aggregate.Customer", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("CustomerName")
.HasColumnType("nvarchar(max)");
b.Property<string>("Email")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Customers");
});
modelBuilder.Entity("PSManagement.Domain.Employees.Entities.Department", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Departments");
});
modelBuilder.Entity("PSManagement.Domain.Employees.Entities.Employee", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("HIASTId")
.HasColumnType("int");
b.Property<int>("UserId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("UserId")
.IsUnique();
b.ToTable("Employees");
});
modelBuilder.Entity("PSManagement.Domain.Identity.Entities.Permission", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Permission");
});
modelBuilder.Entity("PSManagement.Domain.Identity.Entities.Role", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Roles");
});
modelBuilder.Entity("PSManagement.Domain.Identity.Entities.User", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Email")
.HasColumnType("nvarchar(max)");
b.Property<string>("HashedPassword")
.HasColumnType("nvarchar(max)");
b.Property<string>("UserName")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Users");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Entities.Attachment", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("AttachmenDescription")
.HasColumnType("nvarchar(max)");
b.Property<string>("AttachmentName")
.HasColumnType("nvarchar(max)");
b.Property<string>("AttachmentUrl")
.HasColumnType("nvarchar(max)");
b.Property<int?>("ProjectId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ProjectId");
b.ToTable("Attachment");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Entities.EmployeeParticipate", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("EmployeeId")
.HasColumnType("int");
b.Property<int>("PartialTimeRatio")
.HasColumnType("int");
b.Property<int>("ProjectId")
.HasColumnType("int");
b.Property<string>("Role")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.HasIndex("EmployeeId");
b.HasIndex("ProjectId");
b.ToTable("EmployeeParticipate");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Entities.FinincialSpending", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("CostType")
.HasColumnType("nvarchar(max)");
b.Property<string>("Description")
.HasColumnType("nvarchar(max)");
b.Property<int?>("ProjectId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ProjectId");
b.ToTable("FinincialSpending");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Entities.Project", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int?>("CustomerId")
.HasColumnType("int");
b.Property<int>("ExecuterId")
.HasColumnType("int");
b.Property<int>("ProjectManagerId")
.HasColumnType("int");
b.Property<int?>("ProjectStatusId")
.HasColumnType("int");
b.Property<int>("ProposerId")
.HasColumnType("int");
b.Property<int>("TeamLeaderId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("CustomerId");
b.HasIndex("ExecuterId");
b.HasIndex("ProjectManagerId");
b.HasIndex("ProjectStatusId");
b.HasIndex("ProposerId");
b.HasIndex("TeamLeaderId");
b.ToTable("Projects");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Entities.Step", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("CurrentCompletionRatio")
.HasColumnType("int");
b.Property<string>("Description")
.HasColumnType("nvarchar(max)");
b.Property<int>("Duration")
.HasColumnType("int");
b.Property<int>("ProjectId")
.HasColumnType("int");
b.Property<DateTime>("StartDate")
.HasColumnType("datetime2");
b.Property<string>("StepName")
.HasColumnType("nvarchar(max)");
b.Property<int>("Weight")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ProjectId");
b.ToTable("Steps");
});
modelBuilder.Entity("PSManagement.Domain.ProjectsStatus.Entites.ProjectStatus", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Code")
.HasColumnType("nvarchar(max)");
b.Property<string>("Details")
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("ProjectStatus");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.EmployeeTrack", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("AssignedWork")
.HasColumnType("nvarchar(max)");
b.Property<int>("EmloyeeId")
.HasColumnType("int");
b.Property<string>("PerformedWork")
.HasColumnType("nvarchar(max)");
b.Property<int>("TrackId")
.HasColumnType("int");
b.Property<int>("WorkingHours")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("EmloyeeId");
b.HasIndex("TrackId");
b.ToTable("EmployeeTrack");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.StepTrack", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("ExecutionRatio")
.HasColumnType("int");
b.Property<int>("StepId")
.HasColumnType("int");
b.Property<int>("TrackId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("StepId");
b.HasIndex("TrackId");
b.ToTable("StepTracks");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Track", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("ProjectId")
.HasColumnType("int");
b.Property<DateTime>("TrackDate")
.HasColumnType("datetime2");
b.Property<string>("TrackNote")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.HasIndex("ProjectId");
b.ToTable("Tracks");
});
modelBuilder.Entity("PermissionRole", b =>
{
b.Property<int>("PermissionsId")
.HasColumnType("int");
b.Property<int>("RolesId")
.HasColumnType("int");
b.HasKey("PermissionsId", "RolesId");
b.HasIndex("RolesId");
b.ToTable("PermissionRole");
});
modelBuilder.Entity("RoleUser", b =>
{
b.Property<int>("RolesId")
.HasColumnType("int");
b.Property<int>("UsersId")
.HasColumnType("int");
b.HasKey("RolesId", "UsersId");
b.HasIndex("UsersId");
b.ToTable("RoleUser");
});
modelBuilder.Entity("PSManagement.Domain.Customers.Aggregate.Customer", b =>
{
b.OwnsMany("PSManagement.Domain.Customers.Entities.ContactInfo", "ContactInfo", b1 =>
{
b1.Property<int>("CustomerId")
.HasColumnType("int");
b1.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<string>("ContactType")
.HasColumnType("nvarchar(max)");
b1.Property<string>("ContactValue")
.HasColumnType("nvarchar(max)");
b1.HasKey("CustomerId", "Id");
b1.ToTable("ContactInfo");
b1.WithOwner()
.HasForeignKey("CustomerId");
});
b.OwnsOne("PSManagement.Domain.Customers.ValueObjects.Address", "Address", b1 =>
{
b1.Property<int>("CustomerId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<string>("City")
.HasColumnType("nvarchar(max)")
.HasColumnName("City");
b1.Property<string>("StreetName")
.HasColumnType("nvarchar(max)")
.HasColumnName("StreetName");
b1.Property<int>("StreetNumber")
.HasColumnType("int")
.HasColumnName("StreetNumber");
b1.Property<int>("ZipCode")
.HasColumnType("int")
.HasColumnName("ZipCode");
b1.HasKey("CustomerId");
b1.ToTable("Customers");
b1.WithOwner()
.HasForeignKey("CustomerId");
});
b.Navigation("Address");
b.Navigation("ContactInfo");
});
modelBuilder.Entity("PSManagement.Domain.Employees.Entities.Employee", b =>
{
b.HasOne("PSManagement.Domain.Identity.Entities.User", "User")
.WithOne("Employee")
.HasForeignKey("PSManagement.Domain.Employees.Entities.Employee", "UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.OwnsOne("PSManagement.Domain.Employees.Entities.Availability", "Availability", b1 =>
{
b1.Property<int>("EmployeeId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<int>("CurrentWorkingHours")
.HasColumnType("int")
.HasColumnName("CurrentWorkingHours");
b1.Property<bool>("IsAvailable")
.HasColumnType("bit")
.HasColumnName("IsAvailable");
b1.HasKey("EmployeeId");
b1.ToTable("Employees");
b1.WithOwner()
.HasForeignKey("EmployeeId");
});
b.OwnsOne("PSManagement.Domain.Employees.Entities.PersonalInfo", "PersonalInfo", b1 =>
{
b1.Property<int>("EmployeeId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<string>("FirstName")
.HasColumnType("nvarchar(max)")
.HasColumnName("FirstName");
b1.Property<string>("LastName")
.HasColumnType("nvarchar(max)")
.HasColumnName("LastName");
b1.HasKey("EmployeeId");
b1.ToTable("Employees");
b1.WithOwner()
.HasForeignKey("EmployeeId");
});
b.OwnsOne("PSManagement.Domain.Employees.Entities.WorkInfo", "WorkInfo", b1 =>
{
b1.Property<int>("EmployeeId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<string>("WorkJob")
.HasColumnType("nvarchar(max)")
.HasColumnName("WorkJob");
b1.Property<string>("WorkType")
.HasColumnType("nvarchar(max)")
.HasColumnName("WorkType");
b1.HasKey("EmployeeId");
b1.ToTable("Employees");
b1.WithOwner()
.HasForeignKey("EmployeeId");
});
b.Navigation("Availability");
b.Navigation("PersonalInfo");
b.Navigation("User");
b.Navigation("WorkInfo");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Entities.Attachment", b =>
{
b.HasOne("PSManagement.Domain.Projects.Entities.Project", null)
.WithMany("Attachments")
.HasForeignKey("ProjectId");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Entities.EmployeeParticipate", b =>
{
b.HasOne("PSManagement.Domain.Employees.Entities.Employee", "Employee")
.WithMany("EmployeeParticipates")
.HasForeignKey("EmployeeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PSManagement.Domain.Projects.Entities.Project", "Project")
.WithMany("EmployeeParticipates")
.HasForeignKey("ProjectId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Employee");
b.Navigation("Project");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Entities.FinincialSpending", b =>
{
b.HasOne("PSManagement.Domain.Projects.Entities.Project", null)
.WithMany("FinincialSpending")
.HasForeignKey("ProjectId");
b.OwnsOne("PSManagement.SharedKernel.ValueObjects.Money", "ExternalPurchase", b1 =>
{
b1.Property<int>("FinincialSpendingId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<int>("Ammount")
.HasColumnType("int")
.HasColumnName("ExternalPurchaseAmmount");
b1.Property<string>("Currency")
.HasColumnType("nvarchar(max)")
.HasDefaultValue("USD")
.HasColumnName("ExternalPurchaseCurrency");
b1.HasKey("FinincialSpendingId");
b1.ToTable("FinincialSpending");
b1.WithOwner()
.HasForeignKey("FinincialSpendingId");
});
b.OwnsOne("PSManagement.SharedKernel.ValueObjects.Money", "LocalPurchase", b1 =>
{
b1.Property<int>("FinincialSpendingId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<int>("Ammount")
.HasColumnType("int")
.HasColumnName("LocalPurchaseAmmount");
b1.Property<string>("Currency")
.ValueGeneratedOnAdd()
.HasColumnType("nvarchar(max)")
.HasDefaultValue("SP")
.HasColumnName("LocalPurchaseCurrency");
b1.HasKey("FinincialSpendingId");
b1.ToTable("FinincialSpending");
b1.WithOwner()
.HasForeignKey("FinincialSpendingId");
});
b.Navigation("ExternalPurchase");
b.Navigation("LocalPurchase");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Entities.Project", b =>
{
b.HasOne("PSManagement.Domain.Customers.Aggregate.Customer", null)
.WithMany("Projects")
.HasForeignKey("CustomerId");
b.HasOne("PSManagement.Domain.Employees.Entities.Department", "Executer")
.WithMany()
.HasForeignKey("ExecuterId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PSManagement.Domain.Employees.Entities.Employee", "ProjectManager")
.WithMany()
.HasForeignKey("ProjectManagerId")
.OnDelete(DeleteBehavior.Restrict);
b.HasOne("PSManagement.Domain.ProjectsStatus.Entites.ProjectStatus", "ProjectStatus")
.WithMany()
.HasForeignKey("ProjectStatusId");
b.HasOne("PSManagement.Domain.Customers.Aggregate.Customer", "Proposer")
.WithMany()
.HasForeignKey("ProposerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PSManagement.Domain.Employees.Entities.Employee", "TeamLeader")
.WithMany()
.HasForeignKey("TeamLeaderId")
.OnDelete(DeleteBehavior.Restrict);
b.OwnsOne("PSManagement.Domain.Projects.ValueObjects.Aggreement", "ProjectAggreement", b1 =>
{
b1.Property<int>("ProjectId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<DateTime>("AggreementDate")
.HasColumnType("datetime2")
.HasColumnName("AggreementDate");
b1.Property<int>("AggreementNumber")
.HasColumnType("int")
.HasColumnName("AggreementNumber");
b1.HasKey("ProjectId");
b1.ToTable("Projects");
b1.WithOwner()
.HasForeignKey("ProjectId");
});
b.OwnsOne("PSManagement.Domain.Projects.ValueObjects.FinincialFund", "FinincialFund", b1 =>
{
b1.Property<int>("ProjectId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<string>("FinicialStatus")
.HasColumnType("nvarchar(max)")
.HasColumnName("FinicialStatus");
b1.Property<string>("Source")
.HasColumnType("nvarchar(max)")
.HasColumnName("FinicialSource");
b1.HasKey("ProjectId");
b1.ToTable("Projects");
b1.WithOwner()
.HasForeignKey("ProjectId");
});
b.OwnsOne("PSManagement.Domain.Projects.ValueObjects.ProjectInfo", "ProjectInfo", b1 =>
{
b1.Property<int>("ProjectId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<string>("Code")
.HasColumnType("nvarchar(max)")
.HasColumnName("Code");
b1.Property<string>("Description")
.HasColumnType("nvarchar(max)")
.HasColumnName("Description");
b1.Property<string>("Name")
.HasColumnType("nvarchar(max)")
.HasColumnName("Name");
b1.HasKey("ProjectId");
b1.ToTable("Projects");
b1.WithOwner()
.HasForeignKey("ProjectId");
});
b.OwnsOne("PSManagement.Domain.Projects.ValueObjects.ProposalInfo", "ProposalInfo", b1 =>
{
b1.Property<int>("ProjectId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<DateTime>("ProposingBookDate")
.HasColumnType("datetime2")
.HasColumnName("ProposingBookDate");
b1.Property<int>("ProposingBookNumber")
.HasColumnType("int")
.HasColumnName("ProposingBookNumber");
b1.HasKey("ProjectId");
b1.ToTable("Projects");
b1.WithOwner()
.HasForeignKey("ProjectId");
});
b.Navigation("Executer");
b.Navigation("FinincialFund");
b.Navigation("ProjectAggreement");
b.Navigation("ProjectInfo");
b.Navigation("ProjectManager");
b.Navigation("ProjectStatus");
b.Navigation("ProposalInfo");
b.Navigation("Proposer");
b.Navigation("TeamLeader");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Entities.Step", b =>
{
b.HasOne("PSManagement.Domain.Projects.Entities.Project", "Project")
.WithMany("Steps")
.HasForeignKey("ProjectId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Project");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.EmployeeTrack", b =>
{
b.HasOne("PSManagement.Domain.Employees.Entities.Employee", "Employee")
.WithMany("EmployeeTracks")
.HasForeignKey("EmloyeeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PSManagement.Domain.Tracking.Track", "Track")
.WithMany("EmployeeTracks")
.HasForeignKey("TrackId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Employee");
b.Navigation("Track");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.StepTrack", b =>
{
b.HasOne("PSManagement.Domain.Projects.Entities.Step", "Step")
.WithMany("StepTracks")
.HasForeignKey("StepId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("PSManagement.Domain.Tracking.Track", "Track")
.WithMany("StepTracks")
.HasForeignKey("TrackId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Step");
b.Navigation("Track");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Track", b =>
{
b.HasOne("PSManagement.Domain.Projects.Entities.Project", "Project")
.WithMany("Tracks")
.HasForeignKey("ProjectId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Project");
});
modelBuilder.Entity("PermissionRole", b =>
{
b.HasOne("PSManagement.Domain.Identity.Entities.Permission", null)
.WithMany()
.HasForeignKey("PermissionsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PSManagement.Domain.Identity.Entities.Role", null)
.WithMany()
.HasForeignKey("RolesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("RoleUser", b =>
{
b.HasOne("PSManagement.Domain.Identity.Entities.Role", null)
.WithMany()
.HasForeignKey("RolesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PSManagement.Domain.Identity.Entities.User", null)
.WithMany()
.HasForeignKey("UsersId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("PSManagement.Domain.Customers.Aggregate.Customer", b =>
{
b.Navigation("Projects");
});
modelBuilder.Entity("PSManagement.Domain.Employees.Entities.Employee", b =>
{
b.Navigation("EmployeeParticipates");
b.Navigation("EmployeeTracks");
});
modelBuilder.Entity("PSManagement.Domain.Identity.Entities.User", b =>
{
b.Navigation("Employee");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Entities.Project", b =>
{
b.Navigation("Attachments");
b.Navigation("EmployeeParticipates");
b.Navigation("FinincialSpending");
b.Navigation("Steps");
b.Navigation("Tracks");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Entities.Step", b =>
{
b.Navigation("StepTracks");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Track", b =>
{
b.Navigation("EmployeeTracks");
b.Navigation("StepTracks");
});
#pragma warning restore 612, 618
}
}
}
...@@ -2,31 +2,23 @@ ...@@ -2,31 +2,23 @@
namespace PSManagement.Infrastructure.Persistence.Migrations namespace PSManagement.Infrastructure.Persistence.Migrations
{ {
public partial class AddDomainUpdate2 : Migration public partial class AddDomainsUpdate3 : Migration
{ {
protected override void Up(MigrationBuilder migrationBuilder) protected override void Up(MigrationBuilder migrationBuilder)
{ {
migrationBuilder.DropForeignKey( migrationBuilder.DropForeignKey(
name: "FK_Projects_Employees_TeamLeaderId", name: "FK_Projects_Customers_ProposerId",
table: "Projects"); table: "Projects");
migrationBuilder.DropForeignKey( migrationBuilder.DropForeignKey(
name: "FK_Projects_ProjectType_ProjectTypeId", name: "FK_Projects_Departments_ExecuterId",
table: "Projects"); table: "Projects");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "ProjectType"); name: "Item");
migrationBuilder.DropIndex(
name: "IX_Projects_ProjectTypeId",
table: "Projects");
migrationBuilder.DropColumn(
name: "ProjectTypeId",
table: "Projects");
migrationBuilder.AlterColumn<int>( migrationBuilder.AlterColumn<int>(
name: "TeamLeaderId", name: "ProposerId",
table: "Projects", table: "Projects",
type: "int", type: "int",
nullable: false, nullable: false,
...@@ -35,43 +27,48 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -35,43 +27,48 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
oldType: "int", oldType: "int",
oldNullable: true); oldNullable: true);
migrationBuilder.AddColumn<string>( migrationBuilder.AlterColumn<int>(
name: "FinicialSource", name: "ExecuterId",
table: "Projects",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "FinicialStatus",
table: "Projects", table: "Projects",
type: "nvarchar(max)", type: "int",
nullable: true); nullable: false,
defaultValue: 0,
oldClrType: typeof(int),
oldType: "int",
oldNullable: true);
migrationBuilder.AddColumn<int>( migrationBuilder.AddColumn<int>(
name: "ProjectManagerId", name: "CustomerId",
table: "Projects", table: "Projects",
type: "int", type: "int",
nullable: false, nullable: true);
defaultValue: 0);
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_Projects_ProjectManagerId", name: "IX_Projects_CustomerId",
table: "Projects",
column: "CustomerId");
migrationBuilder.AddForeignKey(
name: "FK_Projects_Customers_CustomerId",
table: "Projects", table: "Projects",
column: "ProjectManagerId"); column: "CustomerId",
principalTable: "Customers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey( migrationBuilder.AddForeignKey(
name: "FK_Projects_Employees_ProjectManagerId", name: "FK_Projects_Customers_ProposerId",
table: "Projects", table: "Projects",
column: "ProjectManagerId", column: "ProposerId",
principalTable: "Employees", principalTable: "Customers",
principalColumn: "Id", principalColumn: "Id",
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey( migrationBuilder.AddForeignKey(
name: "FK_Projects_Employees_TeamLeaderId", name: "FK_Projects_Departments_ExecuterId",
table: "Projects", table: "Projects",
column: "TeamLeaderId", column: "ExecuterId",
principalTable: "Employees", principalTable: "Departments",
principalColumn: "Id", principalColumn: "Id",
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Cascade);
} }
...@@ -79,76 +76,70 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -79,76 +76,70 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
protected override void Down(MigrationBuilder migrationBuilder) protected override void Down(MigrationBuilder migrationBuilder)
{ {
migrationBuilder.DropForeignKey( migrationBuilder.DropForeignKey(
name: "FK_Projects_Employees_ProjectManagerId", name: "FK_Projects_Customers_CustomerId",
table: "Projects"); table: "Projects");
migrationBuilder.DropForeignKey( migrationBuilder.DropForeignKey(
name: "FK_Projects_Employees_TeamLeaderId", name: "FK_Projects_Customers_ProposerId",
table: "Projects");
migrationBuilder.DropIndex(
name: "IX_Projects_ProjectManagerId",
table: "Projects"); table: "Projects");
migrationBuilder.DropColumn( migrationBuilder.DropForeignKey(
name: "FinicialSource", name: "FK_Projects_Departments_ExecuterId",
table: "Projects"); table: "Projects");
migrationBuilder.DropColumn( migrationBuilder.DropIndex(
name: "FinicialStatus", name: "IX_Projects_CustomerId",
table: "Projects"); table: "Projects");
migrationBuilder.DropColumn( migrationBuilder.DropColumn(
name: "ProjectManagerId", name: "CustomerId",
table: "Projects"); table: "Projects");
migrationBuilder.AlterColumn<int>( migrationBuilder.AlterColumn<int>(
name: "TeamLeaderId", name: "ProposerId",
table: "Projects", table: "Projects",
type: "int", type: "int",
nullable: true, nullable: true,
oldClrType: typeof(int), oldClrType: typeof(int),
oldType: "int"); oldType: "int");
migrationBuilder.AddColumn<int>( migrationBuilder.AlterColumn<int>(
name: "ProjectTypeId", name: "ExecuterId",
table: "Projects", table: "Projects",
type: "int", type: "int",
nullable: true); nullable: true,
oldClrType: typeof(int),
oldType: "int");
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "ProjectType", name: "Item",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "int", nullable: false) Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"), .Annotation("SqlServer:Identity", "1, 1"),
Description = table.Column<string>(type: "nvarchar(max)", nullable: true), ItemDescription = table.Column<string>(type: "nvarchar(max)", nullable: true),
TypeName = table.Column<string>(type: "nvarchar(max)", nullable: true), ItemName = table.Column<string>(type: "nvarchar(max)", nullable: true),
WorkerCount = table.Column<int>(type: "int", nullable: false) Ammount = table.Column<int>(type: "int", nullable: true),
Currency = table.Column<string>(type: "nvarchar(max)", nullable: true)
}, },
constraints: table => constraints: table =>
{ {
table.PrimaryKey("PK_ProjectType", x => x.Id); table.PrimaryKey("PK_Item", x => x.Id);
}); });
migrationBuilder.CreateIndex(
name: "IX_Projects_ProjectTypeId",
table: "Projects",
column: "ProjectTypeId");
migrationBuilder.AddForeignKey( migrationBuilder.AddForeignKey(
name: "FK_Projects_Employees_TeamLeaderId", name: "FK_Projects_Customers_ProposerId",
table: "Projects", table: "Projects",
column: "TeamLeaderId", column: "ProposerId",
principalTable: "Employees", principalTable: "Customers",
principalColumn: "Id", principalColumn: "Id",
onDelete: ReferentialAction.Restrict); onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey( migrationBuilder.AddForeignKey(
name: "FK_Projects_ProjectType_ProjectTypeId", name: "FK_Projects_Departments_ExecuterId",
table: "Projects", table: "Projects",
column: "ProjectTypeId", column: "ExecuterId",
principalTable: "ProjectType", principalTable: "Departments",
principalColumn: "Id", principalColumn: "Id",
onDelete: ReferentialAction.Restrict); onDelete: ReferentialAction.Restrict);
} }
......
...@@ -63,16 +63,11 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -63,16 +63,11 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b.Property<int>("HIASTId") b.Property<int>("HIASTId")
.HasColumnType("int"); .HasColumnType("int");
b.Property<int?>("TrackId")
.HasColumnType("int");
b.Property<int>("UserId") b.Property<int>("UserId")
.HasColumnType("int"); .HasColumnType("int");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("TrackId");
b.HasIndex("UserId") b.HasIndex("UserId")
.IsUnique(); .IsUnique();
...@@ -130,43 +125,6 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -130,43 +125,6 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b.ToTable("Users"); b.ToTable("Users");
}); });
modelBuilder.Entity("PSManagement.Domain.Projects.Aggregate.Project", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int?>("ExecuterId")
.HasColumnType("int");
b.Property<int>("ProjectManagerId")
.HasColumnType("int");
b.Property<int?>("ProjectStatusId")
.HasColumnType("int");
b.Property<int?>("ProposerId")
.HasColumnType("int");
b.Property<int>("TeamLeaderId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ExecuterId");
b.HasIndex("ProjectManagerId");
b.HasIndex("ProjectStatusId");
b.HasIndex("ProposerId");
b.HasIndex("TeamLeaderId");
b.ToTable("Projects");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Entities.Attachment", b => modelBuilder.Entity("PSManagement.Domain.Projects.Entities.Attachment", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
...@@ -221,46 +179,72 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -221,46 +179,72 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b.ToTable("EmployeeParticipate"); b.ToTable("EmployeeParticipate");
}); });
modelBuilder.Entity("PSManagement.Domain.Projects.Entities.ProjectStatus", b => modelBuilder.Entity("PSManagement.Domain.Projects.Entities.FinincialSpending", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int") .HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Code") b.Property<string>("CostType")
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<string>("Details") b.Property<string>("Description")
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<string>("Name") b.Property<int?>("ProjectId")
.HasColumnType("nvarchar(max)"); .HasColumnType("int");
b.HasKey("Id"); b.HasKey("Id");
b.ToTable("ProjectStatus"); b.HasIndex("ProjectId");
b.ToTable("FinincialSpending");
}); });
modelBuilder.Entity("PSManagement.Domain.Steps.Entities.Item", b => modelBuilder.Entity("PSManagement.Domain.Projects.Entities.Project", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int") .HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("ItemDescription") b.Property<int?>("CustomerId")
.HasColumnType("nvarchar(max)"); .HasColumnType("int");
b.Property<string>("ItemName") b.Property<int>("ExecuterId")
.HasColumnType("nvarchar(max)"); .HasColumnType("int");
b.Property<int>("ProjectManagerId")
.HasColumnType("int");
b.Property<int?>("ProjectStatusId")
.HasColumnType("int");
b.Property<int>("ProposerId")
.HasColumnType("int");
b.Property<int>("TeamLeaderId")
.HasColumnType("int");
b.HasKey("Id"); b.HasKey("Id");
b.ToTable("Items"); b.HasIndex("CustomerId");
b.HasIndex("ExecuterId");
b.HasIndex("ProjectManagerId");
b.HasIndex("ProjectStatusId");
b.HasIndex("ProposerId");
b.HasIndex("TeamLeaderId");
b.ToTable("Projects");
}); });
modelBuilder.Entity("PSManagement.Domain.Steps.Entities.Step", b => modelBuilder.Entity("PSManagement.Domain.Projects.Entities.Step", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
...@@ -295,69 +279,56 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -295,69 +279,56 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b.ToTable("Steps"); b.ToTable("Steps");
}); });
modelBuilder.Entity("PSManagement.Domain.Tracking.EmployeeTrack", b => modelBuilder.Entity("PSManagement.Domain.ProjectsStatus.Entites.ProjectStatus", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int") .HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("AssignedWork") b.Property<string>("Code")
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<int>("EmloyeeId") b.Property<string>("Details")
.HasColumnType("int");
b.Property<string>("PerformedWork")
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<int>("TrackId") b.Property<string>("Name")
.HasColumnType("int"); .HasColumnType("nvarchar(max)");
b.Property<int>("WorkingHours")
.HasColumnType("int");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("EmloyeeId"); b.ToTable("ProjectStatus");
b.HasIndex("TrackId");
b.ToTable("EmployeeTrack");
}); });
modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.EmployeeWork", b => modelBuilder.Entity("PSManagement.Domain.Tracking.EmployeeTrack", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int") .HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("ContributingRatio") b.Property<string>("AssignedWork")
.HasColumnType("int"); .HasColumnType("nvarchar(max)");
b.Property<int>("EmployeeId") b.Property<int>("EmloyeeId")
.HasColumnType("int"); .HasColumnType("int");
b.Property<int>("EmployeeWorkId") b.Property<string>("PerformedWork")
.HasColumnType("int"); .HasColumnType("nvarchar(max)");
b.Property<int>("HoursWorked") b.Property<int>("TrackId")
.HasColumnType("int"); .HasColumnType("int");
b.Property<string>("Notes") b.Property<int>("WorkingHours")
.HasColumnType("nvarchar(max)");
b.Property<int>("StepTrackId")
.HasColumnType("int"); .HasColumnType("int");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("EmployeeId"); b.HasIndex("EmloyeeId");
b.HasIndex("StepTrackId"); b.HasIndex("TrackId");
b.ToTable("EmployeeWorks"); b.ToTable("EmployeeTrack");
}); });
modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.StepTrack", b => modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.StepTrack", b =>
...@@ -502,10 +473,6 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -502,10 +473,6 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
modelBuilder.Entity("PSManagement.Domain.Employees.Entities.Employee", b => modelBuilder.Entity("PSManagement.Domain.Employees.Entities.Employee", b =>
{ {
b.HasOne("PSManagement.Domain.Tracking.Track", null)
.WithMany("TrackedEmployees")
.HasForeignKey("TrackId");
b.HasOne("PSManagement.Domain.Identity.Entities.User", "User") b.HasOne("PSManagement.Domain.Identity.Entities.User", "User")
.WithOne("Employee") .WithOne("Employee")
.HasForeignKey("PSManagement.Domain.Employees.Entities.Employee", "UserId") .HasForeignKey("PSManagement.Domain.Employees.Entities.Employee", "UserId")
...@@ -558,38 +525,157 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -558,38 +525,157 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
.HasForeignKey("EmployeeId"); .HasForeignKey("EmployeeId");
}); });
b.OwnsOne("PSManagement.Domain.Employees.Entities.WorkInfo", "WorkInfo", b1 =>
{
b1.Property<int>("EmployeeId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<string>("WorkJob")
.HasColumnType("nvarchar(max)")
.HasColumnName("WorkJob");
b1.Property<string>("WorkType")
.HasColumnType("nvarchar(max)")
.HasColumnName("WorkType");
b1.HasKey("EmployeeId");
b1.ToTable("Employees");
b1.WithOwner()
.HasForeignKey("EmployeeId");
});
b.Navigation("Availability"); b.Navigation("Availability");
b.Navigation("PersonalInfo"); b.Navigation("PersonalInfo");
b.Navigation("User"); b.Navigation("User");
b.Navigation("WorkInfo");
}); });
modelBuilder.Entity("PSManagement.Domain.Projects.Aggregate.Project", b => modelBuilder.Entity("PSManagement.Domain.Projects.Entities.Attachment", b =>
{
b.HasOne("PSManagement.Domain.Projects.Entities.Project", null)
.WithMany("Attachments")
.HasForeignKey("ProjectId");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Entities.EmployeeParticipate", b =>
{
b.HasOne("PSManagement.Domain.Employees.Entities.Employee", "Employee")
.WithMany("EmployeeParticipates")
.HasForeignKey("EmployeeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PSManagement.Domain.Projects.Entities.Project", "Project")
.WithMany("EmployeeParticipates")
.HasForeignKey("ProjectId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Employee");
b.Navigation("Project");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Entities.FinincialSpending", b =>
{
b.HasOne("PSManagement.Domain.Projects.Entities.Project", null)
.WithMany("FinincialSpending")
.HasForeignKey("ProjectId");
b.OwnsOne("PSManagement.SharedKernel.ValueObjects.Money", "ExternalPurchase", b1 =>
{
b1.Property<int>("FinincialSpendingId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<int>("Ammount")
.HasColumnType("int")
.HasColumnName("ExternalPurchaseAmmount");
b1.Property<string>("Currency")
.HasColumnType("nvarchar(max)")
.HasDefaultValue("USD")
.HasColumnName("ExternalPurchaseCurrency");
b1.HasKey("FinincialSpendingId");
b1.ToTable("FinincialSpending");
b1.WithOwner()
.HasForeignKey("FinincialSpendingId");
});
b.OwnsOne("PSManagement.SharedKernel.ValueObjects.Money", "LocalPurchase", b1 =>
{ {
b1.Property<int>("FinincialSpendingId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<int>("Ammount")
.HasColumnType("int")
.HasColumnName("LocalPurchaseAmmount");
b1.Property<string>("Currency")
.ValueGeneratedOnAdd()
.HasColumnType("nvarchar(max)")
.HasDefaultValue("SP")
.HasColumnName("LocalPurchaseCurrency");
b1.HasKey("FinincialSpendingId");
b1.ToTable("FinincialSpending");
b1.WithOwner()
.HasForeignKey("FinincialSpendingId");
});
b.Navigation("ExternalPurchase");
b.Navigation("LocalPurchase");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Entities.Project", b =>
{
b.HasOne("PSManagement.Domain.Customers.Aggregate.Customer", null)
.WithMany("Projects")
.HasForeignKey("CustomerId");
b.HasOne("PSManagement.Domain.Employees.Entities.Department", "Executer") b.HasOne("PSManagement.Domain.Employees.Entities.Department", "Executer")
.WithMany() .WithMany()
.HasForeignKey("ExecuterId"); .HasForeignKey("ExecuterId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PSManagement.Domain.Employees.Entities.Employee", "ProjectManager") b.HasOne("PSManagement.Domain.Employees.Entities.Employee", "ProjectManager")
.WithMany() .WithMany()
.HasForeignKey("ProjectManagerId") .HasForeignKey("ProjectManagerId")
.OnDelete(DeleteBehavior.Restrict); .OnDelete(DeleteBehavior.Restrict);
b.HasOne("PSManagement.Domain.Projects.Entities.ProjectStatus", "ProjectStatus") b.HasOne("PSManagement.Domain.ProjectsStatus.Entites.ProjectStatus", "ProjectStatus")
.WithMany() .WithMany()
.HasForeignKey("ProjectStatusId"); .HasForeignKey("ProjectStatusId");
b.HasOne("PSManagement.Domain.Customers.Aggregate.Customer", "Proposer") b.HasOne("PSManagement.Domain.Customers.Aggregate.Customer", "Proposer")
.WithMany("Projects") .WithMany()
.HasForeignKey("ProposerId"); .HasForeignKey("ProposerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PSManagement.Domain.Employees.Entities.Employee", "TeamLeader") b.HasOne("PSManagement.Domain.Employees.Entities.Employee", "TeamLeader")
.WithMany() .WithMany()
.HasForeignKey("TeamLeaderId") .HasForeignKey("TeamLeaderId")
.OnDelete(DeleteBehavior.Restrict); .OnDelete(DeleteBehavior.Restrict);
b.OwnsOne("PSManagement.Domain.Projects.Aggregate.Aggreement", "ProjectAggreement", b1 => b.OwnsOne("PSManagement.Domain.Projects.ValueObjects.Aggreement", "ProjectAggreement", b1 =>
{ {
b1.Property<int>("ProjectId") b1.Property<int>("ProjectId")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
...@@ -612,7 +698,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -612,7 +698,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
.HasForeignKey("ProjectId"); .HasForeignKey("ProjectId");
}); });
b.OwnsOne("PSManagement.Domain.Projects.Aggregate.FinincialFund", "FinincialFund", b1 => b.OwnsOne("PSManagement.Domain.Projects.ValueObjects.FinincialFund", "FinincialFund", b1 =>
{ {
b1.Property<int>("ProjectId") b1.Property<int>("ProjectId")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
...@@ -635,7 +721,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -635,7 +721,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
.HasForeignKey("ProjectId"); .HasForeignKey("ProjectId");
}); });
b.OwnsOne("PSManagement.Domain.Projects.Aggregate.ProjectInfo", "ProjectInfo", b1 => b.OwnsOne("PSManagement.Domain.Projects.ValueObjects.ProjectInfo", "ProjectInfo", b1 =>
{ {
b1.Property<int>("ProjectId") b1.Property<int>("ProjectId")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
...@@ -662,7 +748,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -662,7 +748,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
.HasForeignKey("ProjectId"); .HasForeignKey("ProjectId");
}); });
b.OwnsOne("PSManagement.Domain.Projects.Aggregate.ProposalInfo", "ProposalInfo", b1 => b.OwnsOne("PSManagement.Domain.Projects.ValueObjects.ProposalInfo", "ProposalInfo", b1 =>
{ {
b1.Property<int>("ProjectId") b1.Property<int>("ProjectId")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
...@@ -704,63 +790,9 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -704,63 +790,9 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b.Navigation("TeamLeader"); b.Navigation("TeamLeader");
}); });
modelBuilder.Entity("PSManagement.Domain.Projects.Entities.Attachment", b => modelBuilder.Entity("PSManagement.Domain.Projects.Entities.Step", b =>
{
b.HasOne("PSManagement.Domain.Projects.Aggregate.Project", null)
.WithMany("Attachments")
.HasForeignKey("ProjectId");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Entities.EmployeeParticipate", b =>
{
b.HasOne("PSManagement.Domain.Employees.Entities.Employee", "Employee")
.WithMany("EmployeeParticipates")
.HasForeignKey("EmployeeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PSManagement.Domain.Projects.Aggregate.Project", "Project")
.WithMany("EmployeeParticipates")
.HasForeignKey("ProjectId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Employee");
b.Navigation("Project");
});
modelBuilder.Entity("PSManagement.Domain.Steps.Entities.Item", b =>
{
b.OwnsOne("PSManagement.SharedKernel.ValueObjects.Money", "Price", b1 =>
{
b1.Property<int>("ItemId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b1.Property<int>("Ammount")
.HasColumnType("int")
.HasColumnName("Ammount");
b1.Property<string>("Currency")
.HasColumnType("nvarchar(max)")
.HasColumnName("Currency");
b1.HasKey("ItemId");
b1.ToTable("Items");
b1.WithOwner()
.HasForeignKey("ItemId");
});
b.Navigation("Price");
});
modelBuilder.Entity("PSManagement.Domain.Steps.Entities.Step", b =>
{ {
b.HasOne("PSManagement.Domain.Projects.Aggregate.Project", "Project") b.HasOne("PSManagement.Domain.Projects.Entities.Project", "Project")
.WithMany("Steps") .WithMany("Steps")
.HasForeignKey("ProjectId") .HasForeignKey("ProjectId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
...@@ -788,28 +820,9 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -788,28 +820,9 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b.Navigation("Track"); b.Navigation("Track");
}); });
modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.EmployeeWork", b =>
{
b.HasOne("PSManagement.Domain.Employees.Entities.Employee", "Employee")
.WithMany()
.HasForeignKey("EmployeeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PSManagement.Domain.Tracking.Entities.StepTrack", "StepTrack")
.WithMany()
.HasForeignKey("StepTrackId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Employee");
b.Navigation("StepTrack");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.StepTrack", b => modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.StepTrack", b =>
{ {
b.HasOne("PSManagement.Domain.Steps.Entities.Step", "Step") b.HasOne("PSManagement.Domain.Projects.Entities.Step", "Step")
.WithMany("StepTracks") .WithMany("StepTracks")
.HasForeignKey("StepId") .HasForeignKey("StepId")
.OnDelete(DeleteBehavior.Restrict) .OnDelete(DeleteBehavior.Restrict)
...@@ -828,7 +841,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -828,7 +841,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
modelBuilder.Entity("PSManagement.Domain.Tracking.Track", b => modelBuilder.Entity("PSManagement.Domain.Tracking.Track", b =>
{ {
b.HasOne("PSManagement.Domain.Projects.Aggregate.Project", "Project") b.HasOne("PSManagement.Domain.Projects.Entities.Project", "Project")
.WithMany("Tracks") .WithMany("Tracks")
.HasForeignKey("ProjectId") .HasForeignKey("ProjectId")
.OnDelete(DeleteBehavior.Restrict) .OnDelete(DeleteBehavior.Restrict)
...@@ -884,18 +897,20 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -884,18 +897,20 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b.Navigation("Employee"); b.Navigation("Employee");
}); });
modelBuilder.Entity("PSManagement.Domain.Projects.Aggregate.Project", b => modelBuilder.Entity("PSManagement.Domain.Projects.Entities.Project", b =>
{ {
b.Navigation("Attachments"); b.Navigation("Attachments");
b.Navigation("EmployeeParticipates"); b.Navigation("EmployeeParticipates");
b.Navigation("FinincialSpending");
b.Navigation("Steps"); b.Navigation("Steps");
b.Navigation("Tracks"); b.Navigation("Tracks");
}); });
modelBuilder.Entity("PSManagement.Domain.Steps.Entities.Step", b => modelBuilder.Entity("PSManagement.Domain.Projects.Entities.Step", b =>
{ {
b.Navigation("StepTracks"); b.Navigation("StepTracks");
}); });
...@@ -905,8 +920,6 @@ namespace PSManagement.Infrastructure.Persistence.Migrations ...@@ -905,8 +920,6 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b.Navigation("EmployeeTracks"); b.Navigation("EmployeeTracks");
b.Navigation("StepTracks"); b.Navigation("StepTracks");
b.Navigation("TrackedEmployees");
}); });
#pragma warning restore 612, 618 #pragma warning restore 612, 618
} }
......
using PSManagement.Domain.Projects.Repositories;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PSManagement.Infrastructure.Persistence.Repositories.ProjectRepository
{
public class ProjectsRepository :IProjectsRepository
{
}
}
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using PSManagement.Application.Common.Services;
using PSManagement.Application.Contracts.Authentication; using PSManagement.Application.Contracts.Authentication;
using PSManagement.Application.Contracts.Authorization; using PSManagement.Application.Contracts.Authorization;
using PSManagement.Application.Contracts.Providers;
using PSManagement.Domain.Identity.Repositories; using PSManagement.Domain.Identity.Repositories;
using PSManagement.Infrastructure.Authentication; using PSManagement.Infrastructure.Authentication;
using PSManagement.Infrastructure.Services; using PSManagement.Infrastructure.Services;
......
...@@ -30,7 +30,7 @@ namespace PSManagement.Infrastructure.Services.Authentication ...@@ -30,7 +30,7 @@ namespace PSManagement.Infrastructure.Services.Authentication
return Result.Fail<AuthenticationResult>(UserErrors.InvalidLoginAttempt); return Result.Fail<AuthenticationResult>(UserErrors.InvalidLoginAttempt);
} }
String token = _jwtTokenGenerator.GenerateToken(u.Id,u.UserName,u.UserName,u.Email); String token = _jwtTokenGenerator.GenerateToken(u);
return new AuthenticationResult { return new AuthenticationResult {
Id = u.Id, Id = u.Id,
...@@ -52,14 +52,15 @@ namespace PSManagement.Infrastructure.Services.Authentication ...@@ -52,14 +52,15 @@ namespace PSManagement.Infrastructure.Services.Authentication
HashedPassword=password HashedPassword=password
}); });
// generate token // generate token
String token = _jwtTokenGenerator.GenerateToken(user.Id,userName,"",email); String token = _jwtTokenGenerator.GenerateToken(u);
return Result.Ok<AuthenticationResult>( return Result.Ok<AuthenticationResult>(
new AuthenticationResult new AuthenticationResult
{ {
Id = user.Id, Id = user.Id,
Email = email, Email = email,
FirstName = "", FirstName = user.Employee?.PersonalInfo.FirstName,
LastName = "", LastName = user.Employee?.PersonalInfo.LastName,
Roles=user.Roles,
Token = token Token = token
}); });
......
using FluentResults;
using PSManagement.Application.Contracts.Authorization;
using PSManagement.Domain.Identity.Entities;
using PSManagement.SharedKernel.DomainException;
using PSManagement.SharedKernel.Repositories;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PSManagement.Infrastructure.Services.Authorization
{
public class RoleService : IRoleService
{
private readonly IRepository<Role> _roleRepository;
public RoleService(IRepository<Role> roleRepository)
{
_roleRepository = roleRepository;
}
public async Task<Result> CreateRoleAsync(string roleName)
{
var role_exist =await _roleRepository.ListAsync();
role_exist = role_exist.Where(e => e.Name == roleName);
if (role_exist is null ) // check role exist status
{
var result = await _roleRepository.AddAsync(new Role { Name= roleName});
// check if the role has been added succesfully
if (result is not null )
{
return Result.Ok();
}
else
{
return Result.Fail(new Error("Failed to add the role."));
}
}
return Result.Fail(new Error("Failed to add the role."));
}
public async Task<Result> DeleteRoleAsync(int roleId)
{
var roleDetails = await _roleRepository.GetByIdAsync(roleId);
if (roleDetails == null)
{
return Result.Fail(new Error("The Role Not Found."));
}
if (roleDetails.Name == "Admin")
{
return Result.Fail(new Error("You Cannot Remove the admin role."));
}
await _roleRepository.DeleteAsync(roleDetails);
return Result.Ok() ;
}
public async Task<Result<Role>> GetRoleByIdAsync(int id)
{
var roles =await _roleRepository.GetByIdAsync(id);
if (roles is null) {
return Result.Fail(new Error("The Role not found."));
}
return Result.Ok(roles);
}
public async Task<List<Role>> GetRolesAsync()
{
var result =await _roleRepository.ListAsync();
return result.ToList();
}
public async Task<Result<Role>> UpdateRole(int id, string roleName)
{
var role = await _roleRepository.GetByIdAsync(id);
if (role is null)
{
return Result.Fail(new Error("The Role not found."));
}
role.Name = roleName;
role = await _roleRepository.UpdateAsync(role);
return Result.Ok(role);
}
}
}
using PSManagement.Application.Common.Services; using PSManagement.Application.Contracts.Providers;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
......
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using Microsoft.IdentityModel.Tokens; using Microsoft.IdentityModel.Tokens;
using PSManagement.Application.Common.Services;
using PSManagement.Application.Contracts.Authorization; using PSManagement.Application.Contracts.Authorization;
using PSManagement.Domain.Identity.Entities;
using System; using System;
using System.IdentityModel.Tokens.Jwt; using System.IdentityModel.Tokens.Jwt;
using System.Linq.Expressions;
using System.Linq;
using System.Security.Claims; using System.Security.Claims;
using System.Text; using System.Text;
using System.Collections.Generic;
using PSManagement.Application.Contracts.Providers;
namespace PSManagement.Infrastructure.Authentication namespace PSManagement.Infrastructure.Authentication
{ {
...@@ -19,22 +24,23 @@ namespace PSManagement.Infrastructure.Authentication ...@@ -19,22 +24,23 @@ namespace PSManagement.Infrastructure.Authentication
_jwtSetting = jwtOptions.Value; _jwtSetting = jwtOptions.Value;
} }
public string GenerateToken(int id, string firstName, string lastName, string email) public string GenerateToken(User user)
{ {
var signingCredentials = new SigningCredentials( var signingCredentials = new SigningCredentials(
new SymmetricSecurityKey(Encoding.UTF8.GetBytes(_jwtSetting.Secret)), new SymmetricSecurityKey(Encoding.UTF8.GetBytes(_jwtSetting.Secret)),
SecurityAlgorithms.HmacSha256 SecurityAlgorithms.HmacSha256
); );
var claims = new[] { List<Claim> claims = new List<Claim>{
new Claim(JwtRegisteredClaimNames.Sub,id.ToString()), new Claim(JwtRegisteredClaimNames.Sub, user.Id.ToString()),
new Claim(JwtRegisteredClaimNames.Jti,Guid.NewGuid().ToString()), new Claim(JwtRegisteredClaimNames.Jti, Guid.NewGuid().ToString()),
new Claim(JwtRegisteredClaimNames.Email,email), new Claim(JwtRegisteredClaimNames.Email, user.Email),
new Claim(JwtRegisteredClaimNames.GivenName,firstName), new Claim(JwtRegisteredClaimNames.GivenName, user.Employee?.PersonalInfo.FirstName),
new Claim(JwtRegisteredClaimNames.FamilyName,lastName) new Claim(JwtRegisteredClaimNames.FamilyName, user.Employee?.PersonalInfo.LastName)
}; };
foreach (Role role in user.Roles) {
claims.Add(new Claim(ClaimTypes.Role, role.Name));
}
var securityToken = new JwtSecurityToken( var securityToken = new JwtSecurityToken(
issuer: _jwtSetting.Issuer, issuer: _jwtSetting.Issuer,
audience:_jwtSetting.Audience, audience:_jwtSetting.Audience,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment