Commit c1f5afe1 authored by hasan khaddour's avatar hasan khaddour

fix s.

parent c6a1b9ab
......@@ -41,8 +41,7 @@ namespace PSManagement.Api.Controllers.Authentication
Result<AuthenticationResult> result = await _authenticationService.Register(
registerRequest.Email,
registerRequest.FirstName,
registerRequest.LastName,
registerRequest.Email,
registerRequest.Password);
if (result.IsSuccess)
......
......@@ -8,7 +8,7 @@ namespace PSManagement.Application.Contracts.Authentication
public interface IAuthenticationService
{
public Task<Result<AuthenticationResult>> Login(String email , String password);
public Task<Result<AuthenticationResult>> Register(String email,String firstName ,String lastName, String password);
public Task<Result<AuthenticationResult>> Register(String email,String userName , String password);
}
......
using PSManagement.Domain.Customers.DomainEvents;
using PSManagement.Domain.Customers.Entities;
using PSManagement.Domain.Customers.ValueObjects;
using PSManagement.Domain.Projects.Aggregate;
using PSManagement.SharedKernel.Aggregate;
using System;
using System.Collections.Generic;
......@@ -15,6 +16,7 @@ namespace PSManagement.Domain.Customers.Aggregate
public Address Address { get; set; }
public String Email { get; set; }
public ICollection<ContactInfo> ContactInfo { get; private set; }
public ICollection<Project> Projects { get; private set; }
public Customer()
{
......
using PSManagement.Domain.Employees.Aggregate;
using PSManagement.SharedKernel.Aggregate;
using PSManagement.SharedKernel.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PSManagement.Domain.Departments.Aggregate
namespace PSManagement.Domain.Employees.Entities
{
public class Department :IAggregateRoot
public class Department : BaseEntity
{
public String Name { get; set; }
public string Name { get; set; }
public Department(string name)
{
Name = name;
......
using PSManagement.SharedKernel.Aggregate;
using PSManagement.Domain.Identity.Entities;
using PSManagement.Domain.Projects.Aggregate;
using PSManagement.Domain.Tracking.Entities;
using PSManagement.SharedKernel.Aggregate;
using PSManagement.SharedKernel.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PSManagement.Domain.Employees.Aggregate
namespace PSManagement.Domain.Employees.Entities
{
public class Employee :IAggregateRoot
public class Employee : BaseEntity
{
public int HIASTId{ get; set; }
public int HIASTId { get; set; }
public int UserId { get; set; }
public User User { get; set; }
public PersonalInfo PersonalInfo { get; set; }
//public ICollection<Project> Projects { get; set; }
public Availability Availability { get; set; }
public ICollection<EmployeeWork> EmployeeWorks { get; set; }
public Employee()
{
......@@ -25,14 +32,4 @@ namespace PSManagement.Domain.Employees.Aggregate
}
}
public record PersonalInfo(
String FirstName ,
String LastName
);
public record Availability (
int WorkingHours ,
Boolean IsAvailable
);
}
using PSManagement.SharedKernel.Aggregate;
using PSManagement.Domain.Employees.Entities;
using PSManagement.SharedKernel.Repositories;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PSManagement.Domain.ProjectTypes.Aggregate
namespace PSManagement.Domain.Employees.Repositories
{
public class ProjectType : IAggregateRoot
public interface IEmployeesRepository : IRepository<Employee>
{
public String TypeName { get; set; }
public String Description { get; set; }
public int WorkerCount { get; set; }
}
}
namespace PSManagement.Domain.Employees.Entities
{
public record Availability(
int CurrentWorkingHours,
bool IsAvailable
);
}
namespace PSManagement.Domain.Employees.Entities
{
public record PersonalInfo(
string FirstName,
string LastName
);
}
using PSManagement.SharedKernel.Aggregate;
using PSManagement.SharedKernel.Entities;
using System;
namespace PSManagement.Domain.Identity.Aggregate
{
public class User : IAggregateRoot
{
public string Email { get; set; }
public string LastName { get; set; }
public string FirstName { get; set; }
public string HashedPassword { get; set; }
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace PSManagement.Domain.Identity.Entities
{
public class Permission
{
[Key]
public int Id { get; set; }
public String Name { get; set; }
public ICollection<Role> Roles { get; set; }
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace PSManagement.Domain.Identity.Entities
{
public class Role {
[Key]
public int Id { get; set; }
public String Name { get; set; }
public ICollection<Permission> Permissions { get; set; }
public ICollection<User> Users { get; set; }
}
}
\ No newline at end of file
using PSManagement.Domain.Employees.Entities;
using PSManagement.SharedKernel.Aggregate;
using PSManagement.SharedKernel.Entities;
using System.Collections.Generic;
namespace PSManagement.Domain.Identity.Entities
{
public class User : BaseEntity
{
public string Email { get; set; }
public string UserName { get; set; }
public Employee Employee { get; set; }
public string HashedPassword { get; set; }
public ICollection<Role> Roles { get; set; }
}
}
\ No newline at end of file
using PSManagement.Domain.Identity.Aggregate;
using PSManagement.Domain.Identity.Entities;
using PSManagement.SharedKernel.Interfaces;
using PSManagement.SharedKernel.Repositories;
using System;
......
......@@ -5,10 +5,8 @@
</PropertyGroup>
<ItemGroup>
<Folder Include="Identity\Entities\" />
<Folder Include="Identity\ValueObjects\" />
<Folder Include="Projects\DomainErrors\" />
<Folder Include="Projects\Entities\" />
</ItemGroup>
<ItemGroup>
......
using PSManagement.Domain.Projects.Aggregate;
using PSManagement.SharedKernel.Aggregate;
using PSManagement.SharedKernel.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PSManagement.Domain.ProjectTypes.Entities
{
public class ProjectType : BaseEntity
{
public string TypeName { get; set; }
public string Description { get; set; }
public int WorkerCount { get; set; }
public ICollection<Project> Projects { get; set; }
}
}
using PSManagement.Domain.ProjectTypes.Entities;
using PSManagement.SharedKernel.Repositories;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PSManagement.Domain.ProjectTypes.Repositories
{
public interface IProjectTypesRepository : IRepository<ProjectType>
{
}
}
using PSManagement.Domain.Departments.Aggregate;
using PSManagement.Domain.Employees.Aggregate;
using PSManagement.Domain.Steps.Aggregate;
using PSManagement.Domain.Customers.Aggregate;
using PSManagement.Domain.Employees.Entities;
using PSManagement.Domain.Projects.Entities;
using PSManagement.Domain.ProjectTypes.Entities;
using PSManagement.Domain.Steps.Entities;
using PSManagement.Domain.Tracking;
using PSManagement.SharedKernel.Aggregate;
using System.Collections.Generic;
using System.Linq;
......@@ -13,17 +16,21 @@ namespace PSManagement.Domain.Projects.Aggregate
{
public ProposalInfo ProposalInfo { get; set; }
public ProjectInfo ProjectInfo { get; set; }
public ProjectType ProjectType { get; set; }
public ProjectStatus ProjectStatus { get; set; }
public Aggreement ProjectAggreement { get; set; }
public ICollection<Employee> Participants { get; set; }
public ICollection<Step> Steps { get; set; }
public Employee TeamLeader { get; set; }
public Department Executer { get; set; }
public Employee Proposer { get; set; }
public Customer Proposer { get; set; }
public ICollection<Employee> Participants { get; set; }
public ICollection<Step> Steps { get; set; }
public ICollection<Track> Tracks { get; set; }
public ICollection<Attachment> Attachments { get; set; }
public Project()
{
}
}
}
using PSManagement.SharedKernel.Entities;
namespace PSManagement.Domain.Projects.Entities
{
public class Attachment : BaseEntity
{
public string AttachmentUrl { get; set; }
public string AttachmentName { get; set; }
public string AttachmenDescription { get; set; }
}
}
using PSManagement.SharedKernel.Entities;
namespace PSManagement.Domain.Projects.Entities
{
public class ProjectStatus : BaseEntity
{
public string Name { get; set; }
public string Details { get; set; }
public string Code { get; set; }
}
}
using PSManagement.Domain.Projects.Entities;
using PSManagement.SharedKernel.Repositories;
namespace PSManagement.Domain.Projects.Repositories
{
public interface IProjectStatusRepository : IRepository<ProjectStatus>
{
}
}
......@@ -6,7 +6,9 @@ using System.Threading.Tasks;
namespace PSManagement.Domain.Projects.Repositories
{
public interface IProjectRepository
public interface IProjectsRepository
{
}
}
using PSManagement.Domain.Steps.Entities;
using PSManagement.Domain.Employees.Entities;
using PSManagement.Domain.Projects.Aggregate;
using PSManagement.Domain.Tracking;
using PSManagement.Domain.Tracking.Entities;
using PSManagement.SharedKernel.Aggregate;
using PSManagement.SharedKernel.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PSManagement.Domain.Steps.Aggregate
namespace PSManagement.Domain.Steps.Entities
{
public class Step :IAggregateRoot
public class Step : BaseEntity
{
public String StepName { get; set; }
public String Description { get; set; }
public string StepName { get; set; }
public string Description { get; set; }
public int Duration { get; set; }
public DateTime StartDate { get; set; }
public int ProjectId { get; set; }
public Project Project { get; set; }
public ICollection<Item> Purchases { get; set; }
public ICollection<Employee> Participants { get; set; }
public ICollection<StepTrack> StepTracks { get; set; }
public Step()
{
......
using PSManagement.Domain.Steps.Entities;
using PSManagement.SharedKernel.Repositories;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PSManagement.Domain.Steps.Repositories
{
public interface IStepsRepository : IRepository<Step>
{
}
}
using PSManagement.Domain.Employees.Aggregate;
using PSManagement.SharedKernel.Entities;
namespace PSManagement.Domain.Tracking.Entities
{
public class EmployeeTrack : BaseEntity
{
public Employee Employee { get; set; }
public int WorkingHour { get; set; }
public EmployeeTrack()
{
}
}
}
using PSManagement.Domain.Employees.Entities;
using PSManagement.SharedKernel.Entities;
namespace PSManagement.Domain.Tracking.Entities
{
public class EmployeeWork : BaseEntity
{
public int EmployeeWorkId { get; set; }
public int StepTrackId { get; set; }
public StepTrack StepTrack { get; set; }
public int EmployeeId { get; set; }
public Employee Employee { get; set; }
public int HoursWorked { get; set; }
public string Notes { get; set; }
public int ContributingRatio { get; set; }
}
}
using PSManagement.Domain.Steps.Aggregate;
using PSManagement.Domain.Steps.Entities;
using PSManagement.SharedKernel.Entities;
using System.Collections.Generic;
......@@ -6,8 +6,11 @@ namespace PSManagement.Domain.Tracking.Entities
{
public class StepTrack : BaseEntity
{
public int StepId { get; set; }
public Step Step { get; set; }
public IEnumerable<EmployeeTrack> EmployeeTracks { get; set; }
public int TrackId { get; set; }
public Track Track { get; set; }
public ICollection<EmployeeWork> EmployeeWorks { get; set; }
public StepTrack()
{
......
using PSManagement.Domain.Projects.Aggregate;
using PSManagement.Domain.Steps.Entities;
using PSManagement.Domain.Tracking.Entities;
using PSManagement.SharedKernel.Aggregate;
using PSManagement.SharedKernel.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
......@@ -9,12 +11,14 @@ using System.Threading.Tasks;
namespace PSManagement.Domain.Tracking
{
public class Track : IAggregateRoot
public class Track : BaseEntity
{
public DateTime TrackDate { get; set; }
public String TrackNote { get; set; }
public int ProjectId { get; set; }
public Project Project { get; set; }
public ICollection<StepTrack> StepsTracks { get; set; }
public ICollection<StepTrack> StepTracks { get; set; }
public Track()
{
......
using PSManagement.Domain.Tracking;
using PSManagement.SharedKernel.Repositories;
namespace PSManagement.Domain.Steps.Repositories
{
public interface ITracksRepository : IRepository<Track>
{
}
}
using Microsoft.EntityFrameworkCore;
using PSManagement.Domain.Customers.Aggregate;
using PSManagement.Domain.Departments.Aggregate;
using PSManagement.Domain.Employees.Aggregate;
using PSManagement.Domain.Identity.Aggregate;
using PSManagement.Domain.Employees.Entities;
using PSManagement.Domain.Identity.Entities;
using PSManagement.Domain.Projects.Aggregate;
using PSManagement.Domain.Steps.Aggregate;
using PSManagement.Domain.Steps.Entities;
using PSManagement.Domain.Tracking;
using PSManagement.Domain.Tracking.Entities;
......@@ -20,6 +18,8 @@ namespace PSManagement.Infrastructure.Persistence
}
public DbSet<User> Users { get; set; }
public DbSet<Role> Roles { get; set; }
public DbSet<Permission> Permission { get; set; }
public DbSet<Customer> Customers { get; set; }
public DbSet<Employee> Employees { get; set; }
public DbSet<Department> Departments { get; set; }
......@@ -28,7 +28,7 @@ namespace PSManagement.Infrastructure.Persistence
public DbSet<Item> Items { get; set; }
public DbSet<Track> Tracks { get; set; }
public DbSet<EmployeeTrack> EmployeeTraks { get; set; }
public DbSet<EmployeeWork> EmployeeWorks { get; set; }
public DbSet<StepTrack> StepTracks { get; set; }
......
......@@ -25,7 +25,7 @@ namespace PSManagement.Infrastructure.Persistence.EntitiesConfiguration
builder.HasMany(e => e.Projects).WithOne(e => e.Proposer);
builder.OwnsMany(c => c.ContactInfo);
}
......
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using PSManagement.Domain.Employees.Aggregate;
using PSManagement.Domain.Employees.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
......@@ -17,7 +17,7 @@ namespace PSManagement.Infrastructure.Persistence.EntitiesConfiguration
builder.OwnsOne(c => c.Availability,
p => {
p.Property(e => e.IsAvailable).HasColumnName("IsAvailable");
p.Property(e => e.WorkingHours).HasColumnName("WorkingHours");
p.Property(e => e.CurrentWorkingHours).HasColumnName("CurrentWorkingHours");
}
);
builder.OwnsOne(c => c.PersonalInfo,
......@@ -27,6 +27,12 @@ namespace PSManagement.Infrastructure.Persistence.EntitiesConfiguration
}
);
builder.HasOne(e => e.User)
.WithOne(e=> e.Employee)
.HasForeignKey<Employee>(e => e.UserId); ;
}
}
}
......@@ -24,14 +24,16 @@ namespace PSManagement.Infrastructure.Persistence.EntitiesConfiguration
}
);
builder.Property(e => e.Participants);
builder.OwnsOne(c => c.ProposalInfo,
p => {
p.Property(e => e.ProposingBookDate).HasColumnName("ProposingBookDate");
p.Property(e => e.ProposingBookNumber).HasColumnName("ProposingBookNumber");
}
);
builder.HasMany(e => e.Tracks).WithOne(e => e.Project).HasForeignKey(e => e.ProjectId);
builder.HasOne(e => e.ProjectType).WithMany(r => r.Projects);
builder.Ignore(e => e.Participants);
}
}
}
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using PSManagement.Domain.Steps.Aggregate;
using PSManagement.Domain.Steps.Entities;
namespace PSManagement.Infrastructure.Persistence.EntitiesConfiguration
{
......@@ -8,8 +8,12 @@ namespace PSManagement.Infrastructure.Persistence.EntitiesConfiguration
{
public void Configure(EntityTypeBuilder<Step> builder)
{
builder.HasOne(s => s.Project)
.WithMany(p => p.Steps)
.HasForeignKey(s => s.ProjectId);
builder.HasMany(e => e.StepTracks);
}
}
}
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using PSManagement.Domain.Tracking;
using PSManagement.Domain.Tracking.Entities;
namespace PSManagement.Infrastructure.Persistence.EntitiesConfiguration
{
public class TrackEntityConfiguration :
IEntityTypeConfiguration<Track> ,
IEntityTypeConfiguration<StepTrack>,
IEntityTypeConfiguration<EmployeeWork>
{
public void Configure(EntityTypeBuilder<Track> builder)
{
builder.HasOne(t => t.Project)
.WithMany(p => p.Tracks)
.HasForeignKey(t => t.ProjectId)
.OnDelete(DeleteBehavior.Restrict);
}
public void Configure(EntityTypeBuilder<StepTrack> builder)
{
builder.HasOne(st => st.Step)
.WithMany(s => s.StepTracks)
.HasForeignKey(st => st.StepId)
.OnDelete(DeleteBehavior.Restrict); ;
builder.HasOne(st => st.Track)
.WithMany(t => t.StepTracks)
.HasForeignKey(st => st.TrackId)
.OnDelete(DeleteBehavior.Restrict); ;
}
public void Configure(EntityTypeBuilder<EmployeeWork> builder)
{
builder.HasOne(ew => ew.StepTrack)
.WithMany(st => st.EmployeeWorks)
.HasForeignKey(ew => ew.StepTrackId)
.OnDelete(DeleteBehavior.Restrict); ;
builder.HasOne(ew => ew.Employee)
.WithMany(e => e.EmployeeWorks)
.HasForeignKey(ew => ew.EmployeeId)
.OnDelete(DeleteBehavior.Restrict); ;
}
}
}
// <auto-generated />
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using PSManagement.Infrastructure.Persistence;
namespace PSManagement.Infrastructure.Persistence.Migrations
{
[DbContext(typeof(AppDbContext))]
[Migration("20240718153846_initialMigration")]
partial class initialMigration
{
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.Application.Contracts.Authentication.User", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Email")
.HasColumnType("nvarchar(max)");
b.Property<string>("FirstName")
.HasColumnType("nvarchar(max)");
b.Property<string>("LastName")
.HasColumnType("nvarchar(max)");
b.Property<string>("Password")
.HasColumnType("nvarchar(max)");
b.Property<string>("Token")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Users");
});
#pragma warning restore 612, 618
}
}
}
using Microsoft.EntityFrameworkCore.Migrations;
namespace PSManagement.Infrastructure.Persistence.Migrations
{
public partial class initialMigration : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Users",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Email = table.Column<string>(type: "nvarchar(max)", nullable: true),
LastName = table.Column<string>(type: "nvarchar(max)", nullable: true),
FirstName = table.Column<string>(type: "nvarchar(max)", nullable: true),
Password = table.Column<string>(type: "nvarchar(max)", nullable: true),
Token = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Users", x => x.Id);
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Users");
}
}
}
// <auto-generated />
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
namespace PSManagement.Infrastructure.Persistence.Migrations
{
[DbContext(typeof(AppDbContext))]
[Migration("20240721081511_IdetnityMigration")]
partial class IdetnityMigration
{
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.Identity.Aggregate.User", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Email")
.HasColumnType("nvarchar(max)");
b.Property<string>("FirstName")
.HasColumnType("nvarchar(max)");
b.Property<string>("HashedPassword")
.HasColumnType("nvarchar(max)");
b.Property<string>("LastName")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Users");
});
#pragma warning restore 612, 618
}
}
}
using Microsoft.EntityFrameworkCore.Migrations;
namespace PSManagement.Infrastructure.Persistence.Migrations
{
public partial class IdetnityMigration : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Password",
table: "Users");
migrationBuilder.RenameColumn(
name: "Token",
table: "Users",
newName: "HashedPassword");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "HashedPassword",
table: "Users",
newName: "Token");
migrationBuilder.AddColumn<string>(
name: "Password",
table: "Users",
type: "nvarchar(max)",
nullable: true);
}
}
}
// <auto-generated />
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("20240726102138_AddCustomers")]
partial class AddCustomers
{
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.HasKey("Id");
b.ToTable("Customers");
});
modelBuilder.Entity("PSManagement.Domain.Identity.Aggregate.User", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Email")
.HasColumnType("nvarchar(max)");
b.Property<string>("FirstName")
.HasColumnType("nvarchar(max)");
b.Property<string>("HashedPassword")
.HasColumnType("nvarchar(max)");
b.Property<string>("LastName")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Users");
});
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>("Email")
.HasColumnType("nvarchar(max)");
b1.HasKey("CustomerId", "Id");
b1.ToTable("ContactInfo");
b1.WithOwner()
.HasForeignKey("CustomerId");
b1.OwnsOne("PSManagement.Domain.Customers.ValueObjects.ContactNumber", "MobileNumber", b2 =>
{
b2.Property<int>("ContactInfoCustomerId")
.HasColumnType("int");
b2.Property<int>("ContactInfoId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b2.Property<int>("Number")
.HasColumnType("int");
b2.HasKey("ContactInfoCustomerId", "ContactInfoId");
b2.ToTable("ContactInfo");
b2.WithOwner()
.HasForeignKey("ContactInfoCustomerId", "ContactInfoId");
});
b1.OwnsOne("PSManagement.Domain.Customers.ValueObjects.ContactNumber", "PhoneNumber", b2 =>
{
b2.Property<int>("ContactInfoCustomerId")
.HasColumnType("int");
b2.Property<int>("ContactInfoId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b2.Property<int>("Number")
.HasColumnType("int");
b2.HasKey("ContactInfoCustomerId", "ContactInfoId");
b2.ToTable("ContactInfo");
b2.WithOwner()
.HasForeignKey("ContactInfoCustomerId", "ContactInfoId");
});
b1.Navigation("MobileNumber");
b1.Navigation("PhoneNumber");
});
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)");
b1.Property<string>("StreetName")
.HasColumnType("nvarchar(max)");
b1.Property<int>("StreetNumber")
.HasColumnType("int");
b1.Property<int>("ZipCode")
.HasColumnType("int");
b1.HasKey("CustomerId");
b1.ToTable("Customers");
b1.WithOwner()
.HasForeignKey("CustomerId");
});
b.Navigation("Address");
b.Navigation("ContactInfo");
});
#pragma warning restore 612, 618
}
}
}
// <auto-generated />
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("20240728124023_AddCustomer2")]
partial class AddCustomer2
{
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.HasKey("Id");
b.ToTable("Customers");
});
modelBuilder.Entity("PSManagement.Domain.Identity.Aggregate.User", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Email")
.HasColumnType("nvarchar(max)");
b.Property<string>("FirstName")
.HasColumnType("nvarchar(max)");
b.Property<string>("HashedPassword")
.HasColumnType("nvarchar(max)");
b.Property<string>("LastName")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Users");
});
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>("Email")
.HasColumnType("nvarchar(max)");
b1.HasKey("CustomerId", "Id");
b1.ToTable("ContactInfo");
b1.WithOwner()
.HasForeignKey("CustomerId");
b1.OwnsOne("PSManagement.Domain.Customers.ValueObjects.ContactNumber", "MobileNumber", b2 =>
{
b2.Property<int>("ContactInfoCustomerId")
.HasColumnType("int");
b2.Property<int>("ContactInfoId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b2.Property<int>("Number")
.HasColumnType("int")
.HasColumnName("MobileNumber");
b2.HasKey("ContactInfoCustomerId", "ContactInfoId");
b2.ToTable("ContactInfo");
b2.WithOwner()
.HasForeignKey("ContactInfoCustomerId", "ContactInfoId");
});
b1.OwnsOne("PSManagement.Domain.Customers.ValueObjects.ContactNumber", "PhoneNumber", b2 =>
{
b2.Property<int>("ContactInfoCustomerId")
.HasColumnType("int");
b2.Property<int>("ContactInfoId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b2.Property<int>("Number")
.HasColumnType("int")
.HasColumnName("PhoneNumber");
b2.HasKey("ContactInfoCustomerId", "ContactInfoId");
b2.ToTable("ContactInfo");
b2.WithOwner()
.HasForeignKey("ContactInfoCustomerId", "ContactInfoId");
});
b1.Navigation("MobileNumber");
b1.Navigation("PhoneNumber");
});
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");
});
#pragma warning restore 612, 618
}
}
}
using Microsoft.EntityFrameworkCore.Migrations;
namespace PSManagement.Infrastructure.Persistence.Migrations
{
public partial class AddCustomer2 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "Address_ZipCode",
table: "Customers",
newName: "ZipCode");
migrationBuilder.RenameColumn(
name: "Address_StreetNumber",
table: "Customers",
newName: "StreetNumber");
migrationBuilder.RenameColumn(
name: "Address_StreetName",
table: "Customers",
newName: "StreetName");
migrationBuilder.RenameColumn(
name: "Address_City",
table: "Customers",
newName: "City");
migrationBuilder.RenameColumn(
name: "PhoneNumber_Number",
table: "ContactInfo",
newName: "PhoneNumber");
migrationBuilder.RenameColumn(
name: "MobileNumber_Number",
table: "ContactInfo",
newName: "MobileNumber");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "ZipCode",
table: "Customers",
newName: "Address_ZipCode");
migrationBuilder.RenameColumn(
name: "StreetNumber",
table: "Customers",
newName: "Address_StreetNumber");
migrationBuilder.RenameColumn(
name: "StreetName",
table: "Customers",
newName: "Address_StreetName");
migrationBuilder.RenameColumn(
name: "City",
table: "Customers",
newName: "Address_City");
migrationBuilder.RenameColumn(
name: "PhoneNumber",
table: "ContactInfo",
newName: "PhoneNumber_Number");
migrationBuilder.RenameColumn(
name: "MobileNumber",
table: "ContactInfo",
newName: "MobileNumber_Number");
}
}
}
// <auto-generated />
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("20240728142935_AddCustomer3")]
partial class AddCustomer3
{
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.Identity.Aggregate.User", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Email")
.HasColumnType("nvarchar(max)");
b.Property<string>("FirstName")
.HasColumnType("nvarchar(max)");
b.Property<string>("HashedPassword")
.HasColumnType("nvarchar(max)");
b.Property<string>("LastName")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Users");
});
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>("ConatctValue")
.HasColumnType("nvarchar(max)");
b1.Property<string>("ContactType")
.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");
});
#pragma warning restore 612, 618
}
}
}
using Microsoft.EntityFrameworkCore.Migrations;
namespace PSManagement.Infrastructure.Persistence.Migrations
{
public partial class AddCustomer3 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "MobileNumber",
table: "ContactInfo");
migrationBuilder.DropColumn(
name: "PhoneNumber",
table: "ContactInfo");
migrationBuilder.RenameColumn(
name: "Email",
table: "ContactInfo",
newName: "ContactType");
migrationBuilder.AddColumn<string>(
name: "Email",
table: "Customers",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "ConatctValue",
table: "ContactInfo",
type: "nvarchar(max)",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Email",
table: "Customers");
migrationBuilder.DropColumn(
name: "ConatctValue",
table: "ContactInfo");
migrationBuilder.RenameColumn(
name: "ContactType",
table: "ContactInfo",
newName: "Email");
migrationBuilder.AddColumn<int>(
name: "MobileNumber",
table: "ContactInfo",
type: "int",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "PhoneNumber",
table: "ContactInfo",
type: "int",
nullable: true);
}
}
}
// <auto-generated />
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("20240731070622_addCustomer4")]
partial class addCustomer4
{
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.Identity.Aggregate.User", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Email")
.HasColumnType("nvarchar(max)");
b.Property<string>("FirstName")
.HasColumnType("nvarchar(max)");
b.Property<string>("HashedPassword")
.HasColumnType("nvarchar(max)");
b.Property<string>("LastName")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Users");
});
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");
});
#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("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
}
}
}
......@@ -7,6 +7,23 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Customers",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
CustomerName = table.Column<string>(type: "nvarchar(max)", nullable: true),
StreetNumber = table.Column<int>(type: "int", nullable: true),
ZipCode = table.Column<int>(type: "int", nullable: true),
StreetName = table.Column<string>(type: "nvarchar(max)", nullable: true),
City = table.Column<string>(type: "nvarchar(max)", nullable: true),
Email = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Customers", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Departments",
......@@ -21,6 +38,105 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
table.PrimaryKey("PK_Departments", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Role",
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_Role", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Users",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Email = table.Column<string>(type: "nvarchar(max)", nullable: true),
UserName = table.Column<string>(type: "nvarchar(max)", nullable: true),
HashedPassword = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Users", x => x.Id);
});
migrationBuilder.CreateTable(
name: "ContactInfo",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
CustomerId = table.Column<int>(type: "int", nullable: false),
ContactType = table.Column<string>(type: "nvarchar(max)", nullable: true),
ContactValue = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_ContactInfo", x => new { x.CustomerId, x.Id });
table.ForeignKey(
name: "FK_ContactInfo_Customers_CustomerId",
column: x => x.CustomerId,
principalTable: "Customers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Permission",
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),
PermissionId = table.Column<int>(type: "int", nullable: true),
RoleId = table.Column<int>(type: "int", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Permission", x => x.Id);
table.ForeignKey(
name: "FK_Permission_Permission_PermissionId",
column: x => x.PermissionId,
principalTable: "Permission",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_Permission_Role_RoleId",
column: x => x.RoleId,
principalTable: "Role",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "RoleUser",
columns: table => new
{
RolesId = table.Column<int>(type: "int", nullable: false),
UsersId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_RoleUser", x => new { x.RolesId, x.UsersId });
table.ForeignKey(
name: "FK_RoleUser_Role_RolesId",
column: x => x.RolesId,
principalTable: "Role",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_RoleUser_Users_UsersId",
column: x => x.UsersId,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Projects",
......@@ -42,6 +158,12 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
constraints: table =>
{
table.PrimaryKey("PK_Projects", x => x.Id);
table.ForeignKey(
name: "FK_Projects_Customers_ProposerId",
column: x => x.ProposerId,
principalTable: "Customers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_Projects_Departments_ExecuterId",
column: x => x.ExecuterId,
......@@ -51,23 +173,20 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
});
migrationBuilder.CreateTable(
name: "Employees",
name: "Tracks",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
HIASTId = table.Column<int>(type: "int", nullable: false),
FirstName = table.Column<string>(type: "nvarchar(max)", nullable: true),
LastName = table.Column<string>(type: "nvarchar(max)", nullable: true),
WorkingHours = table.Column<int>(type: "int", nullable: true),
IsAvailable = table.Column<bool>(type: "bit", nullable: true),
ProjectId = table.Column<int>(type: "int", nullable: true)
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_Employees", x => x.Id);
table.PrimaryKey("PK_Tracks", x => x.Id);
table.ForeignKey(
name: "FK_Employees_Projects_ProjectId",
name: "FK_Tracks_Projects_ProjectId",
column: x => x.ProjectId,
principalTable: "Projects",
principalColumn: "Id",
......@@ -84,7 +203,8 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
Description = table.Column<string>(type: "nvarchar(max)", nullable: true),
Duration = table.Column<int>(type: "int", nullable: false),
StartDate = table.Column<DateTime>(type: "datetime2", nullable: false),
ProjectId = table.Column<int>(type: "int", nullable: true)
ProjectId = table.Column<int>(type: "int", nullable: false),
TrackId = table.Column<int>(type: "int", nullable: true)
},
constraints: table =>
{
......@@ -94,28 +214,51 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
column: x => x.ProjectId,
principalTable: "Projects",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Steps_Tracks_TrackId",
column: x => x.TrackId,
principalTable: "Tracks",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "Tracks",
name: "Employees",
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: true)
HIASTId = table.Column<int>(type: "int", nullable: false),
UserId = table.Column<int>(type: "int", nullable: false),
FirstName = 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),
IsAvailable = table.Column<bool>(type: "bit", nullable: true),
ProjectId = table.Column<int>(type: "int", nullable: true),
StepId = table.Column<int>(type: "int", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Tracks", x => x.Id);
table.PrimaryKey("PK_Employees", x => x.Id);
table.ForeignKey(
name: "FK_Tracks_Projects_ProjectId",
name: "FK_Employees_Projects_ProjectId",
column: x => x.ProjectId,
principalTable: "Projects",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_Employees_Steps_StepId",
column: x => x.StepId,
principalTable: "Steps",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_Employees_Users_UserId",
column: x => x.UserId,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
......@@ -147,8 +290,8 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
StepId = table.Column<int>(type: "int", nullable: true),
TrackId = table.Column<int>(type: "int", nullable: true)
StepId = table.Column<int>(type: "int", nullable: false),
TrackId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
......@@ -168,26 +311,29 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
});
migrationBuilder.CreateTable(
name: "EmployeeTraks",
name: "EmployeeWorks",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
EmployeeId = table.Column<int>(type: "int", nullable: true),
WorkingHour = table.Column<int>(type: "int", nullable: false),
StepTrackId = table.Column<int>(type: "int", nullable: true)
EmployeeWorkId = table.Column<int>(type: "int", nullable: false),
StepTrackId = table.Column<int>(type: "int", nullable: false),
EmployeeId = table.Column<int>(type: "int", nullable: false),
HoursWorked = table.Column<int>(type: "int", nullable: false),
Notes = table.Column<string>(type: "nvarchar(max)", nullable: true),
ContributingRatio = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_EmployeeTraks", x => x.Id);
table.PrimaryKey("PK_EmployeeWorks", x => x.Id);
table.ForeignKey(
name: "FK_EmployeeTraks_Employees_EmployeeId",
name: "FK_EmployeeWorks_Employees_EmployeeId",
column: x => x.EmployeeId,
principalTable: "Employees",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_EmployeeTraks_StepTracks_StepTrackId",
name: "FK_EmployeeWorks_StepTracks_StepTrackId",
column: x => x.StepTrackId,
principalTable: "StepTracks",
principalColumn: "Id",
......@@ -200,13 +346,24 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
column: "ProjectId");
migrationBuilder.CreateIndex(
name: "IX_EmployeeTraks_EmployeeId",
table: "EmployeeTraks",
name: "IX_Employees_StepId",
table: "Employees",
column: "StepId");
migrationBuilder.CreateIndex(
name: "IX_Employees_UserId",
table: "Employees",
column: "UserId",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_EmployeeWorks_EmployeeId",
table: "EmployeeWorks",
column: "EmployeeId");
migrationBuilder.CreateIndex(
name: "IX_EmployeeTraks_StepTrackId",
table: "EmployeeTraks",
name: "IX_EmployeeWorks_StepTrackId",
table: "EmployeeWorks",
column: "StepTrackId");
migrationBuilder.CreateIndex(
......@@ -214,6 +371,16 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
table: "Items",
column: "StepId");
migrationBuilder.CreateIndex(
name: "IX_Permission_PermissionId",
table: "Permission",
column: "PermissionId");
migrationBuilder.CreateIndex(
name: "IX_Permission_RoleId",
table: "Permission",
column: "RoleId");
migrationBuilder.CreateIndex(
name: "IX_Projects_ExecuterId",
table: "Projects",
......@@ -229,11 +396,21 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
table: "Projects",
column: "TeamLeaderId");
migrationBuilder.CreateIndex(
name: "IX_RoleUser_UsersId",
table: "RoleUser",
column: "UsersId");
migrationBuilder.CreateIndex(
name: "IX_Steps_ProjectId",
table: "Steps",
column: "ProjectId");
migrationBuilder.CreateIndex(
name: "IX_Steps_TrackId",
table: "Steps",
column: "TrackId");
migrationBuilder.CreateIndex(
name: "IX_StepTracks_StepId",
table: "StepTracks",
......@@ -249,14 +426,6 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
table: "Tracks",
column: "ProjectId");
migrationBuilder.AddForeignKey(
name: "FK_Projects_Employees_ProposerId",
table: "Projects",
column: "ProposerId",
principalTable: "Employees",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Projects_Employees_TeamLeaderId",
table: "Projects",
......@@ -268,33 +437,45 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
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(
name: "FK_Tracks_Projects_ProjectId",
table: "Tracks");
migrationBuilder.DropTable(
name: "ContactInfo");
migrationBuilder.DropTable(
name: "EmployeeTraks");
name: "EmployeeWorks");
migrationBuilder.DropTable(
name: "Items");
migrationBuilder.DropTable(
name: "Users");
name: "Permission");
migrationBuilder.DropTable(
name: "Customers");
name: "RoleUser");
migrationBuilder.DropTable(
name: "StepTracks");
migrationBuilder.DropTable(
name: "Steps");
name: "Role");
migrationBuilder.DropTable(
name: "Tracks");
name: "Customers");
migrationBuilder.DropTable(
name: "Projects");
......@@ -304,6 +485,15 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
migrationBuilder.DropTable(
name: "Employees");
migrationBuilder.DropTable(
name: "Steps");
migrationBuilder.DropTable(
name: "Users");
migrationBuilder.DropTable(
name: "Tracks");
}
}
}
// <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);
}
}
}
......@@ -10,8 +10,8 @@ using PSManagement.Infrastructure.Persistence;
namespace PSManagement.Infrastructure.Persistence.Migrations
{
[DbContext(typeof(AppDbContext))]
[Migration("20240801155515_AddDomains")]
partial class AddDomains
[Migration("20240803173142_AddDomains3")]
partial class AddDomains3
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
......@@ -40,7 +40,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b.ToTable("Customers");
});
modelBuilder.Entity("PSManagement.Domain.Departments.Aggregate.Department", b =>
modelBuilder.Entity("PSManagement.Domain.Employees.Entities.Department", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
......@@ -55,7 +55,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b.ToTable("Departments");
});
modelBuilder.Entity("PSManagement.Domain.Employees.Aggregate.Employee", b =>
modelBuilder.Entity("PSManagement.Domain.Employees.Entities.Employee", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
......@@ -68,30 +68,68 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
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.Aggregate.User", b =>
modelBuilder.Entity("PSManagement.Domain.Identity.Entities.Permission", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Email")
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.Property<string>("FirstName")
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>("LastName")
b.Property<string>("UserName")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
......@@ -126,72 +164,86 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b.ToTable("Projects");
});
modelBuilder.Entity("PSManagement.Domain.Steps.Aggregate.Step", b =>
modelBuilder.Entity("PSManagement.Domain.Steps.Entities.Item", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Description")
b.Property<string>("ItemDescription")
.HasColumnType("nvarchar(max)");
b.Property<int>("Duration")
.HasColumnType("int");
b.Property<string>("ItemName")
.HasColumnType("nvarchar(max)");
b.Property<int?>("ProjectId")
b.Property<int?>("StepId")
.HasColumnType("int");
b.Property<DateTime>("StartDate")
.HasColumnType("datetime2");
b.Property<string>("StepName")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.HasIndex("ProjectId");
b.HasIndex("StepId");
b.ToTable("Steps");
b.ToTable("Items");
});
modelBuilder.Entity("PSManagement.Domain.Steps.Entities.Item", b =>
modelBuilder.Entity("PSManagement.Domain.Steps.Entities.Step", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("ItemDescription")
b.Property<string>("Description")
.HasColumnType("nvarchar(max)");
b.Property<string>("ItemName")
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?>("StepId")
b.Property<int?>("TrackId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("StepId");
b.HasIndex("ProjectId");
b.ToTable("Items");
b.HasIndex("TrackId");
b.ToTable("Steps");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.EmployeeTrack", b =>
modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.EmployeeWork", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int?>("EmployeeId")
b.Property<int>("ContributingRatio")
.HasColumnType("int");
b.Property<int?>("StepTrackId")
b.Property<int>("EmployeeId")
.HasColumnType("int");
b.Property<int>("WorkingHour")
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");
......@@ -200,7 +252,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b.HasIndex("StepTrackId");
b.ToTable("EmployeeTraks");
b.ToTable("EmployeeWorks");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.StepTrack", b =>
......@@ -210,10 +262,10 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int?>("StepId")
b.Property<int>("StepId")
.HasColumnType("int");
b.Property<int?>("TrackId")
b.Property<int>("TrackId")
.HasColumnType("int");
b.HasKey("Id");
......@@ -232,7 +284,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int?>("ProjectId")
b.Property<int>("ProjectId")
.HasColumnType("int");
b.Property<DateTime>("TrackDate")
......@@ -248,6 +300,36 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
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 =>
......@@ -310,27 +392,37 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b.Navigation("ContactInfo");
});
modelBuilder.Entity("PSManagement.Domain.Employees.Aggregate.Employee", b =>
modelBuilder.Entity("PSManagement.Domain.Employees.Entities.Employee", b =>
{
b.HasOne("PSManagement.Domain.Projects.Aggregate.Project", null)
.WithMany("Participants")
.HasForeignKey("ProjectId");
b.OwnsOne("PSManagement.Domain.Employees.Aggregate.Availability", "Availability", b1 =>
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.Property<int>("WorkingHours")
.HasColumnType("int")
.HasColumnName("WorkingHours");
b1.HasKey("EmployeeId");
b1.ToTable("Employees");
......@@ -339,7 +431,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
.HasForeignKey("EmployeeId");
});
b.OwnsOne("PSManagement.Domain.Employees.Aggregate.PersonalInfo", "PersonalInfo", b1 =>
b.OwnsOne("PSManagement.Domain.Employees.Entities.PersonalInfo", "PersonalInfo", b1 =>
{
b1.Property<int>("EmployeeId")
.ValueGeneratedOnAdd()
......@@ -365,19 +457,21 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b.Navigation("Availability");
b.Navigation("PersonalInfo");
b.Navigation("User");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Aggregate.Project", b =>
{
b.HasOne("PSManagement.Domain.Departments.Aggregate.Department", "Executer")
b.HasOne("PSManagement.Domain.Employees.Entities.Department", "Executer")
.WithMany()
.HasForeignKey("ExecuterId");
b.HasOne("PSManagement.Domain.Employees.Aggregate.Employee", "Proposer")
.WithMany()
b.HasOne("PSManagement.Domain.Customers.Aggregate.Customer", "Proposer")
.WithMany("Projects")
.HasForeignKey("ProposerId");
b.HasOne("PSManagement.Domain.Employees.Aggregate.Employee", "TeamLeader")
b.HasOne("PSManagement.Domain.Employees.Entities.Employee", "TeamLeader")
.WithMany()
.HasForeignKey("TeamLeaderId");
......@@ -467,16 +561,9 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b.Navigation("TeamLeader");
});
modelBuilder.Entity("PSManagement.Domain.Steps.Aggregate.Step", b =>
{
b.HasOne("PSManagement.Domain.Projects.Aggregate.Project", null)
.WithMany("Steps")
.HasForeignKey("ProjectId");
});
modelBuilder.Entity("PSManagement.Domain.Steps.Entities.Item", b =>
{
b.HasOne("PSManagement.Domain.Steps.Aggregate.Step", null)
b.HasOne("PSManagement.Domain.Steps.Entities.Step", null)
.WithMany("Purchases")
.HasForeignKey("StepId");
......@@ -506,61 +593,143 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b.Navigation("Price");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.EmployeeTrack", b =>
modelBuilder.Entity("PSManagement.Domain.Steps.Entities.Step", b =>
{
b.HasOne("PSManagement.Domain.Employees.Aggregate.Employee", "Employee")
.WithMany()
.HasForeignKey("EmployeeId");
b.HasOne("PSManagement.Domain.Projects.Aggregate.Project", "Project")
.WithMany("Steps")
.HasForeignKey("ProjectId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PSManagement.Domain.Tracking.Entities.StepTrack", null)
.WithMany("EmployeeTracks")
.HasForeignKey("StepTrackId");
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.Aggregate.Step", "Step")
.WithMany()
.HasForeignKey("StepId");
b.HasOne("PSManagement.Domain.Steps.Entities.Step", "Step")
.WithMany("StepTracks")
.HasForeignKey("StepId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("PSManagement.Domain.Tracking.Track", null)
.WithMany("StepsTracks")
.HasForeignKey("TrackId");
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()
.HasForeignKey("ProjectId");
.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.Aggregate.Step", b =>
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("EmployeeTracks");
b.Navigation("EmployeeWorks");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Track", b =>
{
b.Navigation("StepsTracks");
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
}
}
}
using Microsoft.EntityFrameworkCore.Migrations;
namespace PSManagement.Infrastructure.Persistence.Migrations
{
public partial class AddDomains4 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Employees_Projects_ProjectId",
table: "Employees");
migrationBuilder.DropIndex(
name: "IX_Employees_ProjectId",
table: "Employees");
migrationBuilder.DropColumn(
name: "ProjectId",
table: "Employees");
migrationBuilder.AddColumn<int>(
name: "ProjectTypeId",
table: "Projects",
type: "int",
nullable: true);
migrationBuilder.CreateTable(
name: "ProjectType",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
TypeName = 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)
},
constraints: table =>
{
table.PrimaryKey("PK_ProjectType", x => x.Id);
});
migrationBuilder.CreateIndex(
name: "IX_Projects_ProjectTypeId",
table: "Projects",
column: "ProjectTypeId");
migrationBuilder.AddForeignKey(
name: "FK_Projects_ProjectType_ProjectTypeId",
table: "Projects",
column: "ProjectTypeId",
principalTable: "ProjectType",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Projects_ProjectType_ProjectTypeId",
table: "Projects");
migrationBuilder.DropTable(
name: "ProjectType");
migrationBuilder.DropIndex(
name: "IX_Projects_ProjectTypeId",
table: "Projects");
migrationBuilder.DropColumn(
name: "ProjectTypeId",
table: "Projects");
migrationBuilder.AddColumn<int>(
name: "ProjectId",
table: "Employees",
type: "int",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_Employees_ProjectId",
table: "Employees",
column: "ProjectId");
migrationBuilder.AddForeignKey(
name: "FK_Employees_Projects_ProjectId",
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("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
}
}
}
......@@ -2,57 +2,91 @@
namespace PSManagement.Infrastructure.Persistence.Migrations
{
public partial class AddCustomers : Migration
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: "Customers",
name: "Attachment",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
CustomerName = table.Column<string>(type: "nvarchar(max)", nullable: true),
Address_StreetNumber = table.Column<int>(type: "int", nullable: true),
Address_ZipCode = table.Column<int>(type: "int", nullable: true),
Address_StreetName = table.Column<string>(type: "nvarchar(max)", nullable: true),
Address_City = table.Column<string>(type: "nvarchar(max)", nullable: true)
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_Customers", x => x.Id);
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: "ContactInfo",
name: "ProjectStatus",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
CustomerId = table.Column<int>(type: "int", nullable: false),
PhoneNumber_Number = table.Column<int>(type: "int", nullable: true),
MobileNumber_Number = table.Column<int>(type: "int", nullable: true),
Email = table.Column<string>(type: "nvarchar(max)", nullable: true)
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_ContactInfo", x => new { x.CustomerId, x.Id });
table.ForeignKey(
name: "FK_ContactInfo_Customers_CustomerId",
column: x => x.CustomerId,
principalTable: "Customers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
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: "ContactInfo");
name: "Attachment");
migrationBuilder.DropTable(
name: "Customers");
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
}
}
}
using Microsoft.EntityFrameworkCore.Migrations;
namespace PSManagement.Infrastructure.Persistence.Migrations
{
public partial class AddDomains6 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Steps_Tracks_TrackId",
table: "Steps");
migrationBuilder.DropIndex(
name: "IX_Steps_TrackId",
table: "Steps");
migrationBuilder.DropColumn(
name: "TrackId",
table: "Steps");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "TrackId",
table: "Steps",
type: "int",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_Steps_TrackId",
table: "Steps",
column: "TrackId");
migrationBuilder.AddForeignKey(
name: "FK_Steps_Tracks_TrackId",
table: "Steps",
column: "TrackId",
principalTable: "Tracks",
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("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
}
}
}
......@@ -2,22 +2,16 @@
namespace PSManagement.Infrastructure.Persistence.Migrations
{
public partial class addCustomer4 : Migration
public partial class AddDomains7 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "ConatctValue",
table: "ContactInfo",
newName: "ContactValue");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "ContactValue",
table: "ContactInfo",
newName: "ConatctValue");
}
}
}
......@@ -38,7 +38,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b.ToTable("Customers");
});
modelBuilder.Entity("PSManagement.Domain.Departments.Aggregate.Department", b =>
modelBuilder.Entity("PSManagement.Domain.Employees.Entities.Department", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
......@@ -53,7 +53,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b.ToTable("Departments");
});
modelBuilder.Entity("PSManagement.Domain.Employees.Aggregate.Employee", b =>
modelBuilder.Entity("PSManagement.Domain.Employees.Entities.Employee", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
......@@ -63,33 +63,66 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b.Property<int>("HIASTId")
.HasColumnType("int");
b.Property<int?>("ProjectId")
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.Aggregate.User", b =>
modelBuilder.Entity("PSManagement.Domain.Identity.Entities.Permission", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Email")
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.Property<string>("FirstName")
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>("LastName")
b.Property<string>("UserName")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
......@@ -97,6 +130,27 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
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")
......@@ -107,6 +161,12 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b.Property<int?>("ExecuterId")
.HasColumnType("int");
b.Property<int?>("ProjectStatusId")
.HasColumnType("int");
b.Property<int?>("ProjectTypeId")
.HasColumnType("int");
b.Property<int?>("ProposerId")
.HasColumnType("int");
......@@ -117,6 +177,10 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b.HasIndex("ExecuterId");
b.HasIndex("ProjectStatusId");
b.HasIndex("ProjectTypeId");
b.HasIndex("ProposerId");
b.HasIndex("TeamLeaderId");
......@@ -124,33 +188,51 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b.ToTable("Projects");
});
modelBuilder.Entity("PSManagement.Domain.Steps.Aggregate.Step", b =>
modelBuilder.Entity("PSManagement.Domain.Projects.Entities.Attachment", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Description")
b.Property<string>("AttachmenDescription")
.HasColumnType("nvarchar(max)");
b.Property<int>("Duration")
.HasColumnType("int");
b.Property<string>("AttachmentName")
.HasColumnType("nvarchar(max)");
b.Property<string>("AttachmentUrl")
.HasColumnType("nvarchar(max)");
b.Property<int?>("ProjectId")
.HasColumnType("int");
b.Property<DateTime>("StartDate")
.HasColumnType("datetime2");
b.HasKey("Id");
b.Property<string>("StepName")
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.HasKey("Id");
b.Property<string>("Details")
.HasColumnType("nvarchar(max)");
b.HasIndex("ProjectId");
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.ToTable("Steps");
b.HasKey("Id");
b.ToTable("ProjectStatus");
});
modelBuilder.Entity("PSManagement.Domain.Steps.Entities.Item", b =>
......@@ -176,20 +258,58 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b.ToTable("Items");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.EmployeeTrack", b =>
modelBuilder.Entity("PSManagement.Domain.Steps.Entities.Step", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int?>("EmployeeId")
b.Property<string>("Description")
.HasColumnType("nvarchar(max)");
b.Property<int>("Duration")
.HasColumnType("int");
b.Property<int?>("StepTrackId")
b.Property<int>("ProjectId")
.HasColumnType("int");
b.Property<int>("WorkingHour")
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");
......@@ -198,7 +318,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b.HasIndex("StepTrackId");
b.ToTable("EmployeeTraks");
b.ToTable("EmployeeWorks");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.StepTrack", b =>
......@@ -208,10 +328,10 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int?>("StepId")
b.Property<int>("StepId")
.HasColumnType("int");
b.Property<int?>("TrackId")
b.Property<int>("TrackId")
.HasColumnType("int");
b.HasKey("Id");
......@@ -230,7 +350,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int?>("ProjectId")
b.Property<int>("ProjectId")
.HasColumnType("int");
b.Property<DateTime>("TrackDate")
......@@ -246,6 +366,36 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
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 =>
......@@ -308,27 +458,33 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b.Navigation("ContactInfo");
});
modelBuilder.Entity("PSManagement.Domain.Employees.Aggregate.Employee", b =>
modelBuilder.Entity("PSManagement.Domain.Employees.Entities.Employee", b =>
{
b.HasOne("PSManagement.Domain.Projects.Aggregate.Project", null)
b.HasOne("PSManagement.Domain.Steps.Entities.Step", null)
.WithMany("Participants")
.HasForeignKey("ProjectId");
.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.Aggregate.Availability", "Availability", b1 =>
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.Property<int>("WorkingHours")
.HasColumnType("int")
.HasColumnName("WorkingHours");
b1.HasKey("EmployeeId");
b1.ToTable("Employees");
......@@ -337,7 +493,7 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
.HasForeignKey("EmployeeId");
});
b.OwnsOne("PSManagement.Domain.Employees.Aggregate.PersonalInfo", "PersonalInfo", b1 =>
b.OwnsOne("PSManagement.Domain.Employees.Entities.PersonalInfo", "PersonalInfo", b1 =>
{
b1.Property<int>("EmployeeId")
.ValueGeneratedOnAdd()
......@@ -363,19 +519,29 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b.Navigation("Availability");
b.Navigation("PersonalInfo");
b.Navigation("User");
});
modelBuilder.Entity("PSManagement.Domain.Projects.Aggregate.Project", b =>
{
b.HasOne("PSManagement.Domain.Departments.Aggregate.Department", "Executer")
b.HasOne("PSManagement.Domain.Employees.Entities.Department", "Executer")
.WithMany()
.HasForeignKey("ExecuterId");
b.HasOne("PSManagement.Domain.Employees.Aggregate.Employee", "Proposer")
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.Aggregate.Employee", "TeamLeader")
b.HasOne("PSManagement.Domain.Employees.Entities.Employee", "TeamLeader")
.WithMany()
.HasForeignKey("TeamLeaderId");
......@@ -458,6 +624,10 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b.Navigation("ProjectInfo");
b.Navigation("ProjectStatus");
b.Navigation("ProjectType");
b.Navigation("ProposalInfo");
b.Navigation("Proposer");
......@@ -465,16 +635,16 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b.Navigation("TeamLeader");
});
modelBuilder.Entity("PSManagement.Domain.Steps.Aggregate.Step", b =>
modelBuilder.Entity("PSManagement.Domain.Projects.Entities.Attachment", b =>
{
b.HasOne("PSManagement.Domain.Projects.Aggregate.Project", null)
.WithMany("Steps")
.WithMany("Attachments")
.HasForeignKey("ProjectId");
});
modelBuilder.Entity("PSManagement.Domain.Steps.Entities.Item", b =>
{
b.HasOne("PSManagement.Domain.Steps.Aggregate.Step", null)
b.HasOne("PSManagement.Domain.Steps.Entities.Step", null)
.WithMany("Purchases")
.HasForeignKey("StepId");
......@@ -504,61 +674,142 @@ namespace PSManagement.Infrastructure.Persistence.Migrations
b.Navigation("Price");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Entities.EmployeeTrack", b =>
modelBuilder.Entity("PSManagement.Domain.Steps.Entities.Step", b =>
{
b.HasOne("PSManagement.Domain.Employees.Aggregate.Employee", "Employee")
.WithMany()
.HasForeignKey("EmployeeId");
b.HasOne("PSManagement.Domain.Projects.Aggregate.Project", "Project")
.WithMany("Steps")
.HasForeignKey("ProjectId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PSManagement.Domain.Tracking.Entities.StepTrack", null)
.WithMany("EmployeeTracks")
.HasForeignKey("StepTrackId");
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.Aggregate.Step", "Step")
.WithMany()
.HasForeignKey("StepId");
b.HasOne("PSManagement.Domain.Steps.Entities.Step", "Step")
.WithMany("StepTracks")
.HasForeignKey("StepId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("PSManagement.Domain.Tracking.Track", null)
.WithMany("StepsTracks")
.HasForeignKey("TrackId");
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()
.HasForeignKey("ProjectId");
.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("Participants");
b.Navigation("Attachments");
b.Navigation("Steps");
b.Navigation("Tracks");
});
modelBuilder.Entity("PSManagement.Domain.Steps.Aggregate.Step", b =>
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("EmployeeTracks");
b.Navigation("EmployeeWorks");
});
modelBuilder.Entity("PSManagement.Domain.Tracking.Track", b =>
{
b.Navigation("StepsTracks");
b.Navigation("StepTracks");
});
#pragma warning restore 612, 618
}
......
using Microsoft.EntityFrameworkCore;
using PSManagement.Domain.Identity.Aggregate;
using PSManagement.Domain.Identity.Entities;
using PSManagement.Domain.Identity.Repositories;
using PSManagement.Infrastructure.Persistence.Repositories.Base;
using PSManagement.SharedKernel.Interfaces;
......
......@@ -3,8 +3,8 @@ using FluentResults;
using PSManagement.Application.Contracts.Authentication;
using PSManagement.Application.Contracts.Authorization;
using PSManagement.Domain.Customers.DomainErrors;
using PSManagement.Domain.Identity.Aggregate;
using PSManagement.Domain.Identity.DomainErrors;
using PSManagement.Domain.Identity.Entities;
using PSManagement.Domain.Identity.Repositories;
using System;
......@@ -30,16 +30,16 @@ namespace PSManagement.Infrastructure.Services.Authentication
return Result.Fail<AuthenticationResult>(UserErrors.InvalidLoginAttempt);
}
String token = _jwtTokenGenerator.GenerateToken(u.Id,u.FirstName,u.LastName,u.Email);
String token = _jwtTokenGenerator.GenerateToken(u.Id,u.UserName,u.UserName,u.Email);
return new AuthenticationResult {
Id = u.Id,
Email=u.Email,
FirstName=u.FirstName,
LastName =u.LastName,
FirstName="",
LastName ="",
Token=token};
}
public async Task<Result<AuthenticationResult>> Register(String email, String firstName, String lastName, String password) {
public async Task<Result<AuthenticationResult>> Register(String email, String userName, String password) {
// check if the user exist
var u = await _userRepository.GetByEmail(email);
if (u is not null) {
......@@ -48,19 +48,18 @@ namespace PSManagement.Infrastructure.Services.Authentication
var user = await _userRepository.AddAsync(
new User{
Email=email ,
FirstName=firstName,
LastName=lastName,
UserName=userName,
HashedPassword=password
});
// generate token
String token = _jwtTokenGenerator.GenerateToken(user.Id,firstName,lastName,email);
String token = _jwtTokenGenerator.GenerateToken(user.Id,userName,"",email);
return Result.Ok<AuthenticationResult>(
new AuthenticationResult
{
Id = user.Id,
Email = email,
FirstName = firstName,
LastName = lastName,
FirstName = "",
LastName = "",
Token = token
});
......
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