From f44fe10cd805a53756df7135437c56620045e72a Mon Sep 17 00:00:00 2001 From: NKSurprise Date: Fri, 17 Oct 2025 21:10:40 +0300 Subject: [PATCH 1/3] Add UserAssignmentTask entity and update task assignment logic Introduces the UserAssignmentTask entity and its configuration to support tracking task completion per user. Updates AssignmentTask and UserProjectAssignment configurations to establish relationships with UserAssignmentTask. Removes obsolete migration files and refactors related code to support the new structure. --- src/SkillBridge/Data/AppDbContext.cs | 3 + .../AssignmentTaskConfiguration.cs | 12 +- .../UserAssignmentTaskConfiguration.cs | 50 ++ .../UserProjectAssignmentConfiguration.cs | 18 + ...0250515124827_InitialMigration.Designer.cs | 206 -------- .../20250515124827_InitialMigration.cs | 140 ------ .../20250521161718_updatecompany.Designer.cs | 277 ---------- .../20250521161718_updatecompany.cs | 197 -------- .../20250716104712_TasksAdded.Designer.cs | 339 ------------- .../Migrations/20250716104712_TasksAdded.cs | 61 --- ...717085122_AssignmentProperties.Designer.cs | 363 -------------- .../20250717085122_AssignmentProperties.cs | 74 --- .../20250727080305_UserProfile.Designer.cs | 382 -------------- .../Migrations/20250727080305_UserProfile.cs | 35 -- ...27082715_UserProjectAssignment.Designer.cs | 439 ---------------- .../20250727082715_UserProjectAssignment.cs | 59 --- .../20250831100534_fixcompany.Designer.cs | 459 ----------------- .../Migrations/20250831100534_fixcompany.cs | 233 --------- ...0900_UserProfileAddedFileLinks.Designer.cs | 471 ----------------- ...0250901110900_UserProfileAddedFileLinks.cs | 51 -- ...pdatedUserProfileConfiguration.Designer.cs | 474 ------------------ ...3105216_UpdatedUserProfileConfiguration.cs | 48 -- ...161908_UpdateUserProfileEntity.Designer.cs | 471 ----------------- .../20250904161908_UpdateUserProfileEntity.cs | 72 --- .../20250905084435_DescrChange.Designer.cs | 471 ----------------- .../Migrations/20250905084435_DescrChange.cs | 40 -- ...250905085120_DescriptionChange.Designer.cs | 471 ----------------- .../20250905085120_DescriptionChange.cs | 40 -- ...50905090219_DescriptionChange2.Designer.cs | 467 ----------------- .../20250905090219_DescriptionChange2.cs | 72 --- ...03152817_AddDeadlineAndChangeToDuration.cs | 90 ---- ...20251016125626_InitialRebuild.Designer.cs} | 85 +++- .../20251016125626_InitialRebuild.cs | 307 ++++++++++++ .../Migrations/AppDbContextModelSnapshot.cs | 82 ++- .../Models/Entities/AssignmentTask.cs | 10 +- .../Models/Entities/UserAssignmentTask.cs | 18 + .../Models/Entities/UserProjectAssignment.cs | 9 + .../Models/Response/AssignmentTaskResponse.cs | 3 + .../ProjectAssignmentService.cs | 67 ++- src/SkillBridge/SkillBridge.csproj | 4 + 40 files changed, 622 insertions(+), 6548 deletions(-) create mode 100644 src/SkillBridge/Data/Configurations/UserAssignmentTaskConfiguration.cs delete mode 100644 src/SkillBridge/Data/Migrations/20250515124827_InitialMigration.Designer.cs delete mode 100644 src/SkillBridge/Data/Migrations/20250515124827_InitialMigration.cs delete mode 100644 src/SkillBridge/Data/Migrations/20250521161718_updatecompany.Designer.cs delete mode 100644 src/SkillBridge/Data/Migrations/20250521161718_updatecompany.cs delete mode 100644 src/SkillBridge/Data/Migrations/20250716104712_TasksAdded.Designer.cs delete mode 100644 src/SkillBridge/Data/Migrations/20250716104712_TasksAdded.cs delete mode 100644 src/SkillBridge/Data/Migrations/20250717085122_AssignmentProperties.Designer.cs delete mode 100644 src/SkillBridge/Data/Migrations/20250717085122_AssignmentProperties.cs delete mode 100644 src/SkillBridge/Data/Migrations/20250727080305_UserProfile.Designer.cs delete mode 100644 src/SkillBridge/Data/Migrations/20250727080305_UserProfile.cs delete mode 100644 src/SkillBridge/Data/Migrations/20250727082715_UserProjectAssignment.Designer.cs delete mode 100644 src/SkillBridge/Data/Migrations/20250727082715_UserProjectAssignment.cs delete mode 100644 src/SkillBridge/Data/Migrations/20250831100534_fixcompany.Designer.cs delete mode 100644 src/SkillBridge/Data/Migrations/20250831100534_fixcompany.cs delete mode 100644 src/SkillBridge/Data/Migrations/20250901110900_UserProfileAddedFileLinks.Designer.cs delete mode 100644 src/SkillBridge/Data/Migrations/20250901110900_UserProfileAddedFileLinks.cs delete mode 100644 src/SkillBridge/Data/Migrations/20250903105216_UpdatedUserProfileConfiguration.Designer.cs delete mode 100644 src/SkillBridge/Data/Migrations/20250903105216_UpdatedUserProfileConfiguration.cs delete mode 100644 src/SkillBridge/Data/Migrations/20250904161908_UpdateUserProfileEntity.Designer.cs delete mode 100644 src/SkillBridge/Data/Migrations/20250904161908_UpdateUserProfileEntity.cs delete mode 100644 src/SkillBridge/Data/Migrations/20250905084435_DescrChange.Designer.cs delete mode 100644 src/SkillBridge/Data/Migrations/20250905084435_DescrChange.cs delete mode 100644 src/SkillBridge/Data/Migrations/20250905085120_DescriptionChange.Designer.cs delete mode 100644 src/SkillBridge/Data/Migrations/20250905085120_DescriptionChange.cs delete mode 100644 src/SkillBridge/Data/Migrations/20250905090219_DescriptionChange2.Designer.cs delete mode 100644 src/SkillBridge/Data/Migrations/20250905090219_DescriptionChange2.cs delete mode 100644 src/SkillBridge/Data/Migrations/20251003152817_AddDeadlineAndChangeToDuration.cs rename src/SkillBridge/{Data/Migrations/20251003152817_AddDeadlineAndChangeToDuration.Designer.cs => Migrations/20251016125626_InitialRebuild.Designer.cs} (85%) create mode 100644 src/SkillBridge/Migrations/20251016125626_InitialRebuild.cs rename src/SkillBridge/{Data => }/Migrations/AppDbContextModelSnapshot.cs (86%) create mode 100644 src/SkillBridge/Models/Entities/UserAssignmentTask.cs diff --git a/src/SkillBridge/Data/AppDbContext.cs b/src/SkillBridge/Data/AppDbContext.cs index fba5913..e4e6445 100644 --- a/src/SkillBridge/Data/AppDbContext.cs +++ b/src/SkillBridge/Data/AppDbContext.cs @@ -44,6 +44,9 @@ public class AppDbContext : DbContext /// public DbSet UserProjectAssignments { get; set; } = null!; + + public DbSet UserAssignmentTasks { get; set; } = null!; + /// /// Initializes a new instance of the class. /// diff --git a/src/SkillBridge/Data/Configurations/AssignmentTaskConfiguration.cs b/src/SkillBridge/Data/Configurations/AssignmentTaskConfiguration.cs index fae6980..e344a41 100644 --- a/src/SkillBridge/Data/Configurations/AssignmentTaskConfiguration.cs +++ b/src/SkillBridge/Data/Configurations/AssignmentTaskConfiguration.cs @@ -32,10 +32,6 @@ public void Configure(EntityTypeBuilder builder) .HasColumnName("description") .HasMaxLength(ValidationConstants.AssignmentTask.DescriptionMaxLength); - builder.Property(e => e.IsCompleted) - .HasColumnName("is_completed") - .IsRequired(); - builder.Property(e => e.Sequence) .HasColumnName("sequence") .IsRequired(); @@ -56,10 +52,14 @@ public void Configure(EntityTypeBuilder builder) .WithMany(p => p.Tasks) .HasForeignKey(e => e.ProjectAssignmentId) .OnDelete(DeleteBehavior.Cascade); - + + builder.HasMany(e => e.UserAssignmentTasks) + .WithOne(uat => uat.AssignmentTask) + .HasForeignKey(uat => uat.AssignmentTaskId) + .OnDelete(DeleteBehavior.Cascade); + // Create indexes for common queries builder.HasIndex(e => e.ProjectAssignmentId); builder.HasIndex(e => e.Sequence); - builder.HasIndex(e => e.IsCompleted); } } \ No newline at end of file diff --git a/src/SkillBridge/Data/Configurations/UserAssignmentTaskConfiguration.cs b/src/SkillBridge/Data/Configurations/UserAssignmentTaskConfiguration.cs new file mode 100644 index 0000000..8bacdb3 --- /dev/null +++ b/src/SkillBridge/Data/Configurations/UserAssignmentTaskConfiguration.cs @@ -0,0 +1,50 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using SkillBridge.Models.Entities; + +namespace SkillBridge.Data.Configurations +{ + public class UserAssignmentTaskConfiguration : IEntityTypeConfiguration + { + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("user_assignment_tasks"); + + // Composite PK: (user_profile_id, project_assignment_id, assignment_task_id) + builder.HasKey(e => new { e.UserProfileId, e.ProjectAssignmentId, e.AssignmentTaskId }); + + // Columns + builder.Property(e => e.UserProfileId) + .HasColumnName("user_profile_id"); + + builder.Property(e => e.ProjectAssignmentId) + .HasColumnName("project_assignment_id"); + + builder.Property(e => e.AssignmentTaskId) + .HasColumnName("assignment_task_id"); + + builder.Property(e => e.IsCompleted) + .HasColumnName("is_completed") + .HasDefaultValue(false); + + // Relationships + builder.HasOne(e => e.UserProjectAssignment) + .WithMany(upa => upa.UserAssignmentTasks) + .HasForeignKey(e => new { e.UserProfileId, e.ProjectAssignmentId }) + .HasPrincipalKey(upa => new { upa.UserProfileId, upa.ProjectAssignmentId }) + .OnDelete(DeleteBehavior.Cascade); + + builder.HasOne(e => e.AssignmentTask) + .WithMany(t => t.UserAssignmentTasks) + .HasForeignKey(e => e.AssignmentTaskId) + .OnDelete(DeleteBehavior.Cascade); + + // Optional helpful indexes (keep if your queries use them) + builder.HasIndex(e => e.AssignmentTaskId) + .HasDatabaseName("ix_user_assignment_tasks_assignment_task_id"); + + builder.HasIndex(e => new { e.UserProfileId, e.ProjectAssignmentId }) + .HasDatabaseName("ix_user_assignment_tasks_user_project"); + } + } +} diff --git a/src/SkillBridge/Data/Configurations/UserProjectAssignmentConfiguration.cs b/src/SkillBridge/Data/Configurations/UserProjectAssignmentConfiguration.cs index a37231e..b3d5ea6 100644 --- a/src/SkillBridge/Data/Configurations/UserProjectAssignmentConfiguration.cs +++ b/src/SkillBridge/Data/Configurations/UserProjectAssignmentConfiguration.cs @@ -52,6 +52,24 @@ public void Configure(EntityTypeBuilder builder) builder.Property(e => e.CompletedAt) .HasColumnName("completed_at"); + builder.Property(e => e.Deadline) + .HasColumnName("deadline") + .IsRequired(); + + builder.Property(e => e.TotalTasks) + .HasColumnName("total_tasks") + .IsRequired(); + + builder.Property(e => e.CompletedTasks) + .HasColumnName("completed_tasks") + .IsRequired(); + + builder.HasMany(e => e.UserAssignmentTasks) + .WithOne(uat => uat.UserProjectAssignment) + .HasForeignKey(uat => new { uat.UserProfileId, uat.ProjectAssignmentId }) + .HasPrincipalKey(e => new { e.UserProfileId, e.ProjectAssignmentId }) + .OnDelete(DeleteBehavior.Cascade); + // Indexes builder.HasIndex(e => e.UserProfileId); builder.HasIndex(e => e.ProjectAssignmentId); diff --git a/src/SkillBridge/Data/Migrations/20250515124827_InitialMigration.Designer.cs b/src/SkillBridge/Data/Migrations/20250515124827_InitialMigration.Designer.cs deleted file mode 100644 index 3e4e39d..0000000 --- a/src/SkillBridge/Data/Migrations/20250515124827_InitialMigration.Designer.cs +++ /dev/null @@ -1,206 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace SkillBridge.Data.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20250515124827_InitialMigration")] - partial class InitialMigration - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("Endorsify.Models.Entities.Company", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Auth0UserId") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)") - .HasColumnName("auth0_user_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("description"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasColumnName("name"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id"); - - b.HasIndex("Auth0UserId") - .IsUnique(); - - b.ToTable("companies", (string)null); - }); - - modelBuilder.Entity("Endorsify.Models.Entities.ProjectAssignment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CompanyId") - .HasColumnType("uuid") - .HasColumnName("company_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Deadline") - .HasColumnType("timestamp with time zone") - .HasColumnName("deadline"); - - b.Property("Description") - .HasMaxLength(2000) - .HasColumnType("character varying(2000)") - .HasColumnName("description"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)") - .HasColumnName("title"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id"); - - b.HasIndex("CompanyId"); - - b.HasIndex("Deadline"); - - b.HasIndex("Status"); - - b.ToTable("project_assignments", (string)null); - }); - - modelBuilder.Entity("Endorsify.Models.Entities.ProjectSkill", b => - { - b.Property("ProjectAssignmentId") - .HasColumnType("uuid") - .HasColumnName("project_assignment_id"); - - b.Property("SkillId") - .HasColumnType("uuid") - .HasColumnName("skill_id"); - - b.HasKey("ProjectAssignmentId", "SkillId"); - - b.HasIndex("SkillId"); - - b.ToTable("project_skills", (string)null); - }); - - modelBuilder.Entity("Endorsify.Models.Entities.Skill", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("description"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasColumnName("name"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("skills", (string)null); - }); - - modelBuilder.Entity("Endorsify.Models.Entities.ProjectAssignment", b => - { - b.HasOne("Endorsify.Models.Entities.Company", "Company") - .WithMany("ProjectAssignments") - .HasForeignKey("CompanyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Company"); - }); - - modelBuilder.Entity("Endorsify.Models.Entities.ProjectSkill", b => - { - b.HasOne("Endorsify.Models.Entities.ProjectAssignment", "ProjectAssignment") - .WithMany("ProjectSkills") - .HasForeignKey("ProjectAssignmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Endorsify.Models.Entities.Skill", "Skill") - .WithMany("ProjectSkills") - .HasForeignKey("SkillId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ProjectAssignment"); - - b.Navigation("Skill"); - }); - - modelBuilder.Entity("Endorsify.Models.Entities.Company", b => - { - b.Navigation("ProjectAssignments"); - }); - - modelBuilder.Entity("Endorsify.Models.Entities.ProjectAssignment", b => - { - b.Navigation("ProjectSkills"); - }); - - modelBuilder.Entity("Endorsify.Models.Entities.Skill", b => - { - b.Navigation("ProjectSkills"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/SkillBridge/Data/Migrations/20250515124827_InitialMigration.cs b/src/SkillBridge/Data/Migrations/20250515124827_InitialMigration.cs deleted file mode 100644 index eb38562..0000000 --- a/src/SkillBridge/Data/Migrations/20250515124827_InitialMigration.cs +++ /dev/null @@ -1,140 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace SkillBridge.Data.Migrations -{ - /// - public partial class InitialMigration : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "companies", - columns: table => new - { - id = table.Column(type: "uuid", nullable: false), - name = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), - description = table.Column(type: "character varying(500)", maxLength: 500, nullable: true), - auth0_user_id = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), - created_at = table.Column(type: "timestamp with time zone", nullable: false), - updated_at = table.Column(type: "timestamp with time zone", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_companies", x => x.id); - }); - - migrationBuilder.CreateTable( - name: "skills", - columns: table => new - { - id = table.Column(type: "uuid", nullable: false), - name = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), - description = table.Column(type: "character varying(500)", maxLength: 500, nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_skills", x => x.id); - }); - - migrationBuilder.CreateTable( - name: "project_assignments", - columns: table => new - { - id = table.Column(type: "uuid", nullable: false), - title = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), - description = table.Column(type: "character varying(2000)", maxLength: 2000, nullable: true), - deadline = table.Column(type: "timestamp with time zone", nullable: false), - status = table.Column(type: "integer", nullable: false), - company_id = table.Column(type: "uuid", nullable: false), - created_at = table.Column(type: "timestamp with time zone", nullable: false), - updated_at = table.Column(type: "timestamp with time zone", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_project_assignments", x => x.id); - table.ForeignKey( - name: "FK_project_assignments_companies_company_id", - column: x => x.company_id, - principalTable: "companies", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "project_skills", - columns: table => new - { - project_assignment_id = table.Column(type: "uuid", nullable: false), - skill_id = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_project_skills", x => new { x.project_assignment_id, x.skill_id }); - table.ForeignKey( - name: "FK_project_skills_project_assignments_project_assignment_id", - column: x => x.project_assignment_id, - principalTable: "project_assignments", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_project_skills_skills_skill_id", - column: x => x.skill_id, - principalTable: "skills", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_companies_auth0_user_id", - table: "companies", - column: "auth0_user_id", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_project_assignments_company_id", - table: "project_assignments", - column: "company_id"); - - migrationBuilder.CreateIndex( - name: "IX_project_assignments_deadline", - table: "project_assignments", - column: "deadline"); - - migrationBuilder.CreateIndex( - name: "IX_project_assignments_status", - table: "project_assignments", - column: "status"); - - migrationBuilder.CreateIndex( - name: "IX_project_skills_skill_id", - table: "project_skills", - column: "skill_id"); - - migrationBuilder.CreateIndex( - name: "IX_skills_name", - table: "skills", - column: "name", - unique: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "project_skills"); - - migrationBuilder.DropTable( - name: "project_assignments"); - - migrationBuilder.DropTable( - name: "skills"); - - migrationBuilder.DropTable( - name: "companies"); - } - } -} diff --git a/src/SkillBridge/Data/Migrations/20250521161718_updatecompany.Designer.cs b/src/SkillBridge/Data/Migrations/20250521161718_updatecompany.Designer.cs deleted file mode 100644 index 690de0d..0000000 --- a/src/SkillBridge/Data/Migrations/20250521161718_updatecompany.Designer.cs +++ /dev/null @@ -1,277 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using SkillBridge.Data; - -#nullable disable - -namespace SkillBridge.Data.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20250521161718_updatecompany")] - partial class updatecompany - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.16") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("SkillBridge.Models.Entities.Company", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("About") - .HasMaxLength(2000) - .HasColumnType("character varying(2000)") - .HasColumnName("about"); - - b.Property("Activities") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("activities"); - - b.Property("Auth0UserId") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)") - .HasColumnName("auth0_user_id"); - - b.Property("BannerUrl") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("banner_url"); - - b.Property("BulgarianOfficeLocations") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("bulgarian_office_locations"); - - b.Property("ContactInfo") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)") - .HasColumnName("contact_info"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("EmployeesInBulgaria") - .HasColumnType("integer") - .HasColumnName("employees_in_bulgaria"); - - b.Property("EmployeesWorldwide") - .HasColumnType("integer") - .HasColumnName("employees_worldwide"); - - b.Property("HasOfficesInBulgaria") - .HasColumnType("boolean") - .HasColumnName("has_offices_in_bulgaria"); - - b.Property("HeadOfficeLocation") - .HasMaxLength(200) - .HasColumnType("character varying(200)") - .HasColumnName("head_office_location"); - - b.Property("LogoUrl") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("logo_url"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasColumnName("name"); - - b.Property("Sector") - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasColumnName("sector"); - - b.Property("Technologies") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)") - .HasColumnName("technologies"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("WebsiteUrl") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("website_url"); - - b.Property("WhyWorkWithUs") - .HasMaxLength(2000) - .HasColumnType("character varying(2000)") - .HasColumnName("why_work_with_us"); - - b.Property("YearEstablished") - .HasColumnType("integer") - .HasColumnName("year_established"); - - b.HasKey("Id"); - - b.HasIndex("Auth0UserId") - .IsUnique(); - - b.HasIndex("Name"); - - b.HasIndex("Sector"); - - b.ToTable("companies", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.ProjectAssignment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CompanyId") - .HasColumnType("uuid") - .HasColumnName("company_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Deadline") - .HasColumnType("timestamp with time zone") - .HasColumnName("deadline"); - - b.Property("Description") - .HasMaxLength(2000) - .HasColumnType("character varying(2000)") - .HasColumnName("description"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)") - .HasColumnName("title"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id"); - - b.HasIndex("CompanyId"); - - b.HasIndex("Deadline"); - - b.HasIndex("Status"); - - b.ToTable("project_assignments", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.ProjectSkill", b => - { - b.Property("ProjectAssignmentId") - .HasColumnType("uuid") - .HasColumnName("project_assignment_id"); - - b.Property("SkillId") - .HasColumnType("uuid") - .HasColumnName("skill_id"); - - b.HasKey("ProjectAssignmentId", "SkillId"); - - b.HasIndex("SkillId"); - - b.ToTable("project_skills", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.Skill", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("description"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasColumnName("name"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("skills", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.ProjectAssignment", b => - { - b.HasOne("SkillBridge.Models.Entities.Company", "Company") - .WithMany("ProjectAssignments") - .HasForeignKey("CompanyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Company"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.ProjectSkill", b => - { - b.HasOne("SkillBridge.Models.Entities.ProjectAssignment", "ProjectAssignment") - .WithMany("ProjectSkills") - .HasForeignKey("ProjectAssignmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("SkillBridge.Models.Entities.Skill", "Skill") - .WithMany("ProjectSkills") - .HasForeignKey("SkillId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ProjectAssignment"); - - b.Navigation("Skill"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.Company", b => - { - b.Navigation("ProjectAssignments"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.ProjectAssignment", b => - { - b.Navigation("ProjectSkills"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.Skill", b => - { - b.Navigation("ProjectSkills"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/SkillBridge/Data/Migrations/20250521161718_updatecompany.cs b/src/SkillBridge/Data/Migrations/20250521161718_updatecompany.cs deleted file mode 100644 index 8076e17..0000000 --- a/src/SkillBridge/Data/Migrations/20250521161718_updatecompany.cs +++ /dev/null @@ -1,197 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace SkillBridge.Data.Migrations -{ - /// - public partial class updatecompany : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.RenameColumn( - name: "description", - table: "companies", - newName: "website_url"); - - migrationBuilder.AddColumn( - name: "about", - table: "companies", - type: "character varying(2000)", - maxLength: 2000, - nullable: true); - - migrationBuilder.AddColumn( - name: "activities", - table: "companies", - type: "character varying(500)", - maxLength: 500, - nullable: true); - - migrationBuilder.AddColumn( - name: "banner_url", - table: "companies", - type: "character varying(500)", - maxLength: 500, - nullable: true); - - migrationBuilder.AddColumn( - name: "bulgarian_office_locations", - table: "companies", - type: "character varying(500)", - maxLength: 500, - nullable: true); - - migrationBuilder.AddColumn( - name: "contact_info", - table: "companies", - type: "character varying(1000)", - maxLength: 1000, - nullable: true); - - migrationBuilder.AddColumn( - name: "employees_in_bulgaria", - table: "companies", - type: "integer", - nullable: true); - - migrationBuilder.AddColumn( - name: "employees_worldwide", - table: "companies", - type: "integer", - nullable: true); - - migrationBuilder.AddColumn( - name: "has_offices_in_bulgaria", - table: "companies", - type: "boolean", - nullable: false, - defaultValue: false); - - migrationBuilder.AddColumn( - name: "head_office_location", - table: "companies", - type: "character varying(200)", - maxLength: 200, - nullable: true); - - migrationBuilder.AddColumn( - name: "logo_url", - table: "companies", - type: "character varying(500)", - maxLength: 500, - nullable: true); - - migrationBuilder.AddColumn( - name: "sector", - table: "companies", - type: "character varying(100)", - maxLength: 100, - nullable: true); - - migrationBuilder.AddColumn( - name: "technologies", - table: "companies", - type: "character varying(1000)", - maxLength: 1000, - nullable: true); - - migrationBuilder.AddColumn( - name: "why_work_with_us", - table: "companies", - type: "character varying(2000)", - maxLength: 2000, - nullable: true); - - migrationBuilder.AddColumn( - name: "year_established", - table: "companies", - type: "integer", - nullable: true); - - migrationBuilder.CreateIndex( - name: "IX_companies_name", - table: "companies", - column: "name"); - - migrationBuilder.CreateIndex( - name: "IX_companies_sector", - table: "companies", - column: "sector"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropIndex( - name: "IX_companies_name", - table: "companies"); - - migrationBuilder.DropIndex( - name: "IX_companies_sector", - table: "companies"); - - migrationBuilder.DropColumn( - name: "about", - table: "companies"); - - migrationBuilder.DropColumn( - name: "activities", - table: "companies"); - - migrationBuilder.DropColumn( - name: "banner_url", - table: "companies"); - - migrationBuilder.DropColumn( - name: "bulgarian_office_locations", - table: "companies"); - - migrationBuilder.DropColumn( - name: "contact_info", - table: "companies"); - - migrationBuilder.DropColumn( - name: "employees_in_bulgaria", - table: "companies"); - - migrationBuilder.DropColumn( - name: "employees_worldwide", - table: "companies"); - - migrationBuilder.DropColumn( - name: "has_offices_in_bulgaria", - table: "companies"); - - migrationBuilder.DropColumn( - name: "head_office_location", - table: "companies"); - - migrationBuilder.DropColumn( - name: "logo_url", - table: "companies"); - - migrationBuilder.DropColumn( - name: "sector", - table: "companies"); - - migrationBuilder.DropColumn( - name: "technologies", - table: "companies"); - - migrationBuilder.DropColumn( - name: "why_work_with_us", - table: "companies"); - - migrationBuilder.DropColumn( - name: "year_established", - table: "companies"); - - migrationBuilder.RenameColumn( - name: "website_url", - table: "companies", - newName: "description"); - } - } -} diff --git a/src/SkillBridge/Data/Migrations/20250716104712_TasksAdded.Designer.cs b/src/SkillBridge/Data/Migrations/20250716104712_TasksAdded.Designer.cs deleted file mode 100644 index 6e4b71b..0000000 --- a/src/SkillBridge/Data/Migrations/20250716104712_TasksAdded.Designer.cs +++ /dev/null @@ -1,339 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using SkillBridge.Data; - -#nullable disable - -namespace SkillBridge.Data.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20250716104712_TasksAdded")] - partial class TasksAdded - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.16") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("SkillBridge.Models.Entities.AssignmentTask", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Description") - .HasMaxLength(2000) - .HasColumnType("character varying(2000)") - .HasColumnName("description"); - - b.Property("IsCompleted") - .HasColumnType("boolean") - .HasColumnName("is_completed"); - - b.Property("ProjectAssignmentId") - .HasColumnType("uuid") - .HasColumnName("project_assignment_id"); - - b.Property("Sequence") - .HasColumnType("integer") - .HasColumnName("sequence"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)") - .HasColumnName("title"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id"); - - b.HasIndex("IsCompleted"); - - b.HasIndex("ProjectAssignmentId"); - - b.HasIndex("Sequence"); - - b.ToTable("assignment_tasks", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.Company", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("About") - .HasMaxLength(2000) - .HasColumnType("character varying(2000)") - .HasColumnName("about"); - - b.Property("Activities") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("activities"); - - b.Property("Auth0UserId") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)") - .HasColumnName("auth0_user_id"); - - b.Property("BannerUrl") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("banner_url"); - - b.Property("BulgarianOfficeLocations") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("bulgarian_office_locations"); - - b.Property("ContactInfo") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)") - .HasColumnName("contact_info"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("EmployeesInBulgaria") - .HasColumnType("integer") - .HasColumnName("employees_in_bulgaria"); - - b.Property("EmployeesWorldwide") - .HasColumnType("integer") - .HasColumnName("employees_worldwide"); - - b.Property("HasOfficesInBulgaria") - .HasColumnType("boolean") - .HasColumnName("has_offices_in_bulgaria"); - - b.Property("HeadOfficeLocation") - .HasMaxLength(200) - .HasColumnType("character varying(200)") - .HasColumnName("head_office_location"); - - b.Property("LogoUrl") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("logo_url"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasColumnName("name"); - - b.Property("Sector") - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasColumnName("sector"); - - b.Property("Technologies") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)") - .HasColumnName("technologies"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("WebsiteUrl") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("website_url"); - - b.Property("WhyWorkWithUs") - .HasMaxLength(2000) - .HasColumnType("character varying(2000)") - .HasColumnName("why_work_with_us"); - - b.Property("YearEstablished") - .HasColumnType("integer") - .HasColumnName("year_established"); - - b.HasKey("Id"); - - b.HasIndex("Auth0UserId") - .IsUnique(); - - b.HasIndex("Name"); - - b.HasIndex("Sector"); - - b.ToTable("companies", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.ProjectAssignment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CompanyId") - .HasColumnType("uuid") - .HasColumnName("company_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Deadline") - .HasColumnType("timestamp with time zone") - .HasColumnName("deadline"); - - b.Property("Description") - .HasMaxLength(2000) - .HasColumnType("character varying(2000)") - .HasColumnName("description"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)") - .HasColumnName("title"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id"); - - b.HasIndex("CompanyId"); - - b.HasIndex("Deadline"); - - b.HasIndex("Status"); - - b.ToTable("project_assignments", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.ProjectSkill", b => - { - b.Property("ProjectAssignmentId") - .HasColumnType("uuid") - .HasColumnName("project_assignment_id"); - - b.Property("SkillId") - .HasColumnType("uuid") - .HasColumnName("skill_id"); - - b.HasKey("ProjectAssignmentId", "SkillId"); - - b.HasIndex("SkillId"); - - b.ToTable("project_skills", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.Skill", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("description"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasColumnName("name"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("skills", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.AssignmentTask", b => - { - b.HasOne("SkillBridge.Models.Entities.ProjectAssignment", "ProjectAssignment") - .WithMany("Tasks") - .HasForeignKey("ProjectAssignmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ProjectAssignment"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.ProjectAssignment", b => - { - b.HasOne("SkillBridge.Models.Entities.Company", "Company") - .WithMany("ProjectAssignments") - .HasForeignKey("CompanyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Company"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.ProjectSkill", b => - { - b.HasOne("SkillBridge.Models.Entities.ProjectAssignment", "ProjectAssignment") - .WithMany("ProjectSkills") - .HasForeignKey("ProjectAssignmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("SkillBridge.Models.Entities.Skill", "Skill") - .WithMany("ProjectSkills") - .HasForeignKey("SkillId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ProjectAssignment"); - - b.Navigation("Skill"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.Company", b => - { - b.Navigation("ProjectAssignments"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.ProjectAssignment", b => - { - b.Navigation("ProjectSkills"); - - b.Navigation("Tasks"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.Skill", b => - { - b.Navigation("ProjectSkills"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/SkillBridge/Data/Migrations/20250716104712_TasksAdded.cs b/src/SkillBridge/Data/Migrations/20250716104712_TasksAdded.cs deleted file mode 100644 index 40e1f9a..0000000 --- a/src/SkillBridge/Data/Migrations/20250716104712_TasksAdded.cs +++ /dev/null @@ -1,61 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace SkillBridge.Data.Migrations -{ - /// - public partial class TasksAdded : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "assignment_tasks", - columns: table => new - { - id = table.Column(type: "uuid", nullable: false), - title = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), - description = table.Column(type: "character varying(2000)", maxLength: 2000, nullable: true), - is_completed = table.Column(type: "boolean", nullable: false), - sequence = table.Column(type: "integer", nullable: false), - project_assignment_id = table.Column(type: "uuid", nullable: false), - created_at = table.Column(type: "timestamp with time zone", nullable: false), - updated_at = table.Column(type: "timestamp with time zone", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_assignment_tasks", x => x.id); - table.ForeignKey( - name: "FK_assignment_tasks_project_assignments_project_assignment_id", - column: x => x.project_assignment_id, - principalTable: "project_assignments", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_assignment_tasks_is_completed", - table: "assignment_tasks", - column: "is_completed"); - - migrationBuilder.CreateIndex( - name: "IX_assignment_tasks_project_assignment_id", - table: "assignment_tasks", - column: "project_assignment_id"); - - migrationBuilder.CreateIndex( - name: "IX_assignment_tasks_sequence", - table: "assignment_tasks", - column: "sequence"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "assignment_tasks"); - } - } -} diff --git a/src/SkillBridge/Data/Migrations/20250717085122_AssignmentProperties.Designer.cs b/src/SkillBridge/Data/Migrations/20250717085122_AssignmentProperties.Designer.cs deleted file mode 100644 index 86e8d86..0000000 --- a/src/SkillBridge/Data/Migrations/20250717085122_AssignmentProperties.Designer.cs +++ /dev/null @@ -1,363 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using SkillBridge.Data; - -#nullable disable - -namespace SkillBridge.Data.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20250717085122_AssignmentProperties")] - partial class AssignmentProperties - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.16") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("SkillBridge.Models.Entities.AssignmentTask", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Description") - .HasMaxLength(2000) - .HasColumnType("character varying(2000)") - .HasColumnName("description"); - - b.Property("IsCompleted") - .HasColumnType("boolean") - .HasColumnName("is_completed"); - - b.Property("ProjectAssignmentId") - .HasColumnType("uuid") - .HasColumnName("project_assignment_id"); - - b.Property("Sequence") - .HasColumnType("integer") - .HasColumnName("sequence"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)") - .HasColumnName("title"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id"); - - b.HasIndex("IsCompleted"); - - b.HasIndex("ProjectAssignmentId"); - - b.HasIndex("Sequence"); - - b.ToTable("assignment_tasks", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.Company", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("About") - .HasMaxLength(2000) - .HasColumnType("character varying(2000)") - .HasColumnName("about"); - - b.Property("Activities") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("activities"); - - b.Property("Auth0UserId") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)") - .HasColumnName("auth0_user_id"); - - b.Property("BannerUrl") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("banner_url"); - - b.Property("BulgarianOfficeLocations") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("bulgarian_office_locations"); - - b.Property("ContactInfo") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)") - .HasColumnName("contact_info"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("EmployeesInBulgaria") - .HasColumnType("integer") - .HasColumnName("employees_in_bulgaria"); - - b.Property("EmployeesWorldwide") - .HasColumnType("integer") - .HasColumnName("employees_worldwide"); - - b.Property("HasOfficesInBulgaria") - .HasColumnType("boolean") - .HasColumnName("has_offices_in_bulgaria"); - - b.Property("HeadOfficeLocation") - .HasMaxLength(200) - .HasColumnType("character varying(200)") - .HasColumnName("head_office_location"); - - b.Property("LogoUrl") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("logo_url"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasColumnName("name"); - - b.Property("Sector") - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasColumnName("sector"); - - b.Property("Technologies") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)") - .HasColumnName("technologies"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("WebsiteUrl") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("website_url"); - - b.Property("WhyWorkWithUs") - .HasMaxLength(2000) - .HasColumnType("character varying(2000)") - .HasColumnName("why_work_with_us"); - - b.Property("YearEstablished") - .HasColumnType("integer") - .HasColumnName("year_established"); - - b.HasKey("Id"); - - b.HasIndex("Auth0UserId") - .IsUnique(); - - b.HasIndex("Name"); - - b.HasIndex("Sector"); - - b.ToTable("companies", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.ProjectAssignment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CompanyId") - .HasColumnType("uuid") - .HasColumnName("company_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Deadline") - .HasColumnType("timestamp with time zone") - .HasColumnName("deadline"); - - b.Property("Description") - .HasMaxLength(2000) - .HasColumnType("character varying(2000)") - .HasColumnName("description"); - - b.Property("LearningBenefits") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)") - .HasColumnName("learning_benefits"); - - b.Property("Level") - .HasColumnType("integer") - .HasColumnName("level"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("SuggestedApproach") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)") - .HasColumnName("suggested_approach"); - - b.Property("Summary") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("summary"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)") - .HasColumnName("title"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id"); - - b.HasIndex("CompanyId"); - - b.HasIndex("Deadline"); - - b.HasIndex("Level"); - - b.HasIndex("Status"); - - b.ToTable("project_assignments", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.ProjectSkill", b => - { - b.Property("ProjectAssignmentId") - .HasColumnType("uuid") - .HasColumnName("project_assignment_id"); - - b.Property("SkillId") - .HasColumnType("uuid") - .HasColumnName("skill_id"); - - b.HasKey("ProjectAssignmentId", "SkillId"); - - b.HasIndex("SkillId"); - - b.ToTable("project_skills", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.Skill", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("description"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasColumnName("name"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("skills", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.AssignmentTask", b => - { - b.HasOne("SkillBridge.Models.Entities.ProjectAssignment", "ProjectAssignment") - .WithMany("Tasks") - .HasForeignKey("ProjectAssignmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ProjectAssignment"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.ProjectAssignment", b => - { - b.HasOne("SkillBridge.Models.Entities.Company", "Company") - .WithMany("ProjectAssignments") - .HasForeignKey("CompanyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Company"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.ProjectSkill", b => - { - b.HasOne("SkillBridge.Models.Entities.ProjectAssignment", "ProjectAssignment") - .WithMany("ProjectSkills") - .HasForeignKey("ProjectAssignmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("SkillBridge.Models.Entities.Skill", "Skill") - .WithMany("ProjectSkills") - .HasForeignKey("SkillId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ProjectAssignment"); - - b.Navigation("Skill"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.Company", b => - { - b.Navigation("ProjectAssignments"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.ProjectAssignment", b => - { - b.Navigation("ProjectSkills"); - - b.Navigation("Tasks"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.Skill", b => - { - b.Navigation("ProjectSkills"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/SkillBridge/Data/Migrations/20250717085122_AssignmentProperties.cs b/src/SkillBridge/Data/Migrations/20250717085122_AssignmentProperties.cs deleted file mode 100644 index 8479397..0000000 --- a/src/SkillBridge/Data/Migrations/20250717085122_AssignmentProperties.cs +++ /dev/null @@ -1,74 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace SkillBridge.Data.Migrations -{ - /// - public partial class AssignmentProperties : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "learning_benefits", - table: "project_assignments", - type: "character varying(1000)", - maxLength: 1000, - nullable: false, - defaultValue: ""); - - migrationBuilder.AddColumn( - name: "level", - table: "project_assignments", - type: "integer", - nullable: false, - defaultValue: 0); - - migrationBuilder.AddColumn( - name: "suggested_approach", - table: "project_assignments", - type: "character varying(1000)", - maxLength: 1000, - nullable: false, - defaultValue: ""); - - migrationBuilder.AddColumn( - name: "summary", - table: "project_assignments", - type: "character varying(500)", - maxLength: 500, - nullable: false, - defaultValue: ""); - - migrationBuilder.CreateIndex( - name: "IX_project_assignments_level", - table: "project_assignments", - column: "level"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropIndex( - name: "IX_project_assignments_level", - table: "project_assignments"); - - migrationBuilder.DropColumn( - name: "learning_benefits", - table: "project_assignments"); - - migrationBuilder.DropColumn( - name: "level", - table: "project_assignments"); - - migrationBuilder.DropColumn( - name: "suggested_approach", - table: "project_assignments"); - - migrationBuilder.DropColumn( - name: "summary", - table: "project_assignments"); - } - } -} diff --git a/src/SkillBridge/Data/Migrations/20250727080305_UserProfile.Designer.cs b/src/SkillBridge/Data/Migrations/20250727080305_UserProfile.Designer.cs deleted file mode 100644 index 335b618..0000000 --- a/src/SkillBridge/Data/Migrations/20250727080305_UserProfile.Designer.cs +++ /dev/null @@ -1,382 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using SkillBridge.Data; - -#nullable disable - -namespace SkillBridge.Data.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20250727080305_UserProfile")] - partial class UserProfile - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.16") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("SkillBridge.Models.Entities.AssignmentTask", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Description") - .HasMaxLength(2000) - .HasColumnType("character varying(2000)") - .HasColumnName("description"); - - b.Property("IsCompleted") - .HasColumnType("boolean") - .HasColumnName("is_completed"); - - b.Property("ProjectAssignmentId") - .HasColumnType("uuid") - .HasColumnName("project_assignment_id"); - - b.Property("Sequence") - .HasColumnType("integer") - .HasColumnName("sequence"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)") - .HasColumnName("title"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id"); - - b.HasIndex("IsCompleted"); - - b.HasIndex("ProjectAssignmentId"); - - b.HasIndex("Sequence"); - - b.ToTable("assignment_tasks", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.Company", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("About") - .HasMaxLength(2000) - .HasColumnType("character varying(2000)") - .HasColumnName("about"); - - b.Property("Activities") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("activities"); - - b.Property("Auth0UserId") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)") - .HasColumnName("auth0_user_id"); - - b.Property("BannerUrl") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("banner_url"); - - b.Property("BulgarianOfficeLocations") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("bulgarian_office_locations"); - - b.Property("ContactInfo") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)") - .HasColumnName("contact_info"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("EmployeesInBulgaria") - .HasColumnType("integer") - .HasColumnName("employees_in_bulgaria"); - - b.Property("EmployeesWorldwide") - .HasColumnType("integer") - .HasColumnName("employees_worldwide"); - - b.Property("HasOfficesInBulgaria") - .HasColumnType("boolean") - .HasColumnName("has_offices_in_bulgaria"); - - b.Property("HeadOfficeLocation") - .HasMaxLength(200) - .HasColumnType("character varying(200)") - .HasColumnName("head_office_location"); - - b.Property("LogoUrl") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("logo_url"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasColumnName("name"); - - b.Property("Sector") - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasColumnName("sector"); - - b.Property("Technologies") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)") - .HasColumnName("technologies"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("WebsiteUrl") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("website_url"); - - b.Property("WhyWorkWithUs") - .HasMaxLength(2000) - .HasColumnType("character varying(2000)") - .HasColumnName("why_work_with_us"); - - b.Property("YearEstablished") - .HasColumnType("integer") - .HasColumnName("year_established"); - - b.HasKey("Id"); - - b.HasIndex("Auth0UserId") - .IsUnique(); - - b.HasIndex("Name"); - - b.HasIndex("Sector"); - - b.ToTable("companies", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.ProjectAssignment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CompanyId") - .HasColumnType("uuid") - .HasColumnName("company_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Deadline") - .HasColumnType("timestamp with time zone") - .HasColumnName("deadline"); - - b.Property("Description") - .HasMaxLength(2000) - .HasColumnType("character varying(2000)") - .HasColumnName("description"); - - b.Property("LearningBenefits") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)") - .HasColumnName("learning_benefits"); - - b.Property("Level") - .HasColumnType("integer") - .HasColumnName("level"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("SuggestedApproach") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)") - .HasColumnName("suggested_approach"); - - b.Property("Summary") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("summary"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)") - .HasColumnName("title"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id"); - - b.HasIndex("CompanyId"); - - b.HasIndex("Deadline"); - - b.HasIndex("Level"); - - b.HasIndex("Status"); - - b.ToTable("project_assignments", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.ProjectSkill", b => - { - b.Property("ProjectAssignmentId") - .HasColumnType("uuid") - .HasColumnName("project_assignment_id"); - - b.Property("SkillId") - .HasColumnType("uuid") - .HasColumnName("skill_id"); - - b.HasKey("ProjectAssignmentId", "SkillId"); - - b.HasIndex("SkillId"); - - b.ToTable("project_skills", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.Skill", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("description"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasColumnName("name"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("skills", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.UserProfile", b => - { - b.Property("Id") - .HasColumnType("text") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id"); - - b.ToTable("user_profiles", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.AssignmentTask", b => - { - b.HasOne("SkillBridge.Models.Entities.ProjectAssignment", "ProjectAssignment") - .WithMany("Tasks") - .HasForeignKey("ProjectAssignmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ProjectAssignment"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.ProjectAssignment", b => - { - b.HasOne("SkillBridge.Models.Entities.Company", "Company") - .WithMany("ProjectAssignments") - .HasForeignKey("CompanyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Company"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.ProjectSkill", b => - { - b.HasOne("SkillBridge.Models.Entities.ProjectAssignment", "ProjectAssignment") - .WithMany("ProjectSkills") - .HasForeignKey("ProjectAssignmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("SkillBridge.Models.Entities.Skill", "Skill") - .WithMany("ProjectSkills") - .HasForeignKey("SkillId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ProjectAssignment"); - - b.Navigation("Skill"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.Company", b => - { - b.Navigation("ProjectAssignments"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.ProjectAssignment", b => - { - b.Navigation("ProjectSkills"); - - b.Navigation("Tasks"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.Skill", b => - { - b.Navigation("ProjectSkills"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/SkillBridge/Data/Migrations/20250727080305_UserProfile.cs b/src/SkillBridge/Data/Migrations/20250727080305_UserProfile.cs deleted file mode 100644 index 30cc0b0..0000000 --- a/src/SkillBridge/Data/Migrations/20250727080305_UserProfile.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace SkillBridge.Data.Migrations -{ - /// - public partial class UserProfile : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "user_profiles", - columns: table => new - { - id = table.Column(type: "text", nullable: false), - created_at = table.Column(type: "timestamp with time zone", nullable: false), - updated_at = table.Column(type: "timestamp with time zone", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_user_profiles", x => x.id); - }); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "user_profiles"); - } - } -} diff --git a/src/SkillBridge/Data/Migrations/20250727082715_UserProjectAssignment.Designer.cs b/src/SkillBridge/Data/Migrations/20250727082715_UserProjectAssignment.Designer.cs deleted file mode 100644 index 83ba496..0000000 --- a/src/SkillBridge/Data/Migrations/20250727082715_UserProjectAssignment.Designer.cs +++ /dev/null @@ -1,439 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using SkillBridge.Data; - -#nullable disable - -namespace SkillBridge.Data.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20250727082715_UserProjectAssignment")] - partial class UserProjectAssignment - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.16") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("SkillBridge.Models.Entities.AssignmentTask", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Description") - .HasMaxLength(2000) - .HasColumnType("character varying(2000)") - .HasColumnName("description"); - - b.Property("IsCompleted") - .HasColumnType("boolean") - .HasColumnName("is_completed"); - - b.Property("ProjectAssignmentId") - .HasColumnType("uuid") - .HasColumnName("project_assignment_id"); - - b.Property("Sequence") - .HasColumnType("integer") - .HasColumnName("sequence"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)") - .HasColumnName("title"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id"); - - b.HasIndex("IsCompleted"); - - b.HasIndex("ProjectAssignmentId"); - - b.HasIndex("Sequence"); - - b.ToTable("assignment_tasks", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.Company", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("About") - .HasMaxLength(2000) - .HasColumnType("character varying(2000)") - .HasColumnName("about"); - - b.Property("Activities") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("activities"); - - b.Property("Auth0UserId") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)") - .HasColumnName("auth0_user_id"); - - b.Property("BannerUrl") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("banner_url"); - - b.Property("BulgarianOfficeLocations") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("bulgarian_office_locations"); - - b.Property("ContactInfo") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)") - .HasColumnName("contact_info"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("EmployeesInBulgaria") - .HasColumnType("integer") - .HasColumnName("employees_in_bulgaria"); - - b.Property("EmployeesWorldwide") - .HasColumnType("integer") - .HasColumnName("employees_worldwide"); - - b.Property("HasOfficesInBulgaria") - .HasColumnType("boolean") - .HasColumnName("has_offices_in_bulgaria"); - - b.Property("HeadOfficeLocation") - .HasMaxLength(200) - .HasColumnType("character varying(200)") - .HasColumnName("head_office_location"); - - b.Property("LogoUrl") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("logo_url"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasColumnName("name"); - - b.Property("Sector") - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasColumnName("sector"); - - b.Property("Technologies") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)") - .HasColumnName("technologies"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("WebsiteUrl") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("website_url"); - - b.Property("WhyWorkWithUs") - .HasMaxLength(2000) - .HasColumnType("character varying(2000)") - .HasColumnName("why_work_with_us"); - - b.Property("YearEstablished") - .HasColumnType("integer") - .HasColumnName("year_established"); - - b.HasKey("Id"); - - b.HasIndex("Auth0UserId") - .IsUnique(); - - b.HasIndex("Name"); - - b.HasIndex("Sector"); - - b.ToTable("companies", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.ProjectAssignment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CompanyId") - .HasColumnType("uuid") - .HasColumnName("company_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Deadline") - .HasColumnType("timestamp with time zone") - .HasColumnName("deadline"); - - b.Property("Description") - .HasMaxLength(2000) - .HasColumnType("character varying(2000)") - .HasColumnName("description"); - - b.Property("LearningBenefits") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)") - .HasColumnName("learning_benefits"); - - b.Property("Level") - .HasColumnType("integer") - .HasColumnName("level"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("SuggestedApproach") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)") - .HasColumnName("suggested_approach"); - - b.Property("Summary") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("summary"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)") - .HasColumnName("title"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id"); - - b.HasIndex("CompanyId"); - - b.HasIndex("Deadline"); - - b.HasIndex("Level"); - - b.HasIndex("Status"); - - b.ToTable("project_assignments", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.ProjectSkill", b => - { - b.Property("ProjectAssignmentId") - .HasColumnType("uuid") - .HasColumnName("project_assignment_id"); - - b.Property("SkillId") - .HasColumnType("uuid") - .HasColumnName("skill_id"); - - b.HasKey("ProjectAssignmentId", "SkillId"); - - b.HasIndex("SkillId"); - - b.ToTable("project_skills", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.Skill", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("description"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasColumnName("name"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("skills", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.UserProfile", b => - { - b.Property("Id") - .HasColumnType("text") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id"); - - b.ToTable("user_profiles", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.UserProjectAssignment", b => - { - b.Property("UserProfileId") - .HasColumnType("text") - .HasColumnName("user_profile_id"); - - b.Property("ProjectAssignmentId") - .HasColumnType("uuid") - .HasColumnName("project_assignment_id"); - - b.Property("ClaimedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("claimed_at"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("completed_at"); - - b.Property("IsCompleted") - .HasColumnType("boolean") - .HasColumnName("is_completed"); - - b.HasKey("UserProfileId", "ProjectAssignmentId"); - - b.HasIndex("ProjectAssignmentId"); - - b.HasIndex("UserProfileId"); - - b.ToTable("user_project_assignments", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.AssignmentTask", b => - { - b.HasOne("SkillBridge.Models.Entities.ProjectAssignment", "ProjectAssignment") - .WithMany("Tasks") - .HasForeignKey("ProjectAssignmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ProjectAssignment"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.ProjectAssignment", b => - { - b.HasOne("SkillBridge.Models.Entities.Company", "Company") - .WithMany("ProjectAssignments") - .HasForeignKey("CompanyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Company"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.ProjectSkill", b => - { - b.HasOne("SkillBridge.Models.Entities.ProjectAssignment", "ProjectAssignment") - .WithMany("ProjectSkills") - .HasForeignKey("ProjectAssignmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("SkillBridge.Models.Entities.Skill", "Skill") - .WithMany("ProjectSkills") - .HasForeignKey("SkillId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ProjectAssignment"); - - b.Navigation("Skill"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.UserProjectAssignment", b => - { - b.HasOne("SkillBridge.Models.Entities.ProjectAssignment", "ProjectAssignment") - .WithMany("UserProjectAssignments") - .HasForeignKey("ProjectAssignmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("SkillBridge.Models.Entities.UserProfile", "UserProfile") - .WithMany("UserProjectAssignments") - .HasForeignKey("UserProfileId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ProjectAssignment"); - - b.Navigation("UserProfile"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.Company", b => - { - b.Navigation("ProjectAssignments"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.ProjectAssignment", b => - { - b.Navigation("ProjectSkills"); - - b.Navigation("Tasks"); - - b.Navigation("UserProjectAssignments"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.Skill", b => - { - b.Navigation("ProjectSkills"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.UserProfile", b => - { - b.Navigation("UserProjectAssignments"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/SkillBridge/Data/Migrations/20250727082715_UserProjectAssignment.cs b/src/SkillBridge/Data/Migrations/20250727082715_UserProjectAssignment.cs deleted file mode 100644 index d3c8582..0000000 --- a/src/SkillBridge/Data/Migrations/20250727082715_UserProjectAssignment.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace SkillBridge.Data.Migrations -{ - /// - public partial class UserProjectAssignment : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "user_project_assignments", - columns: table => new - { - user_profile_id = table.Column(type: "text", nullable: false), - project_assignment_id = table.Column(type: "uuid", nullable: false), - claimed_at = table.Column(type: "timestamp with time zone", nullable: false), - is_completed = table.Column(type: "boolean", nullable: false), - completed_at = table.Column(type: "timestamp with time zone", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_user_project_assignments", x => new { x.user_profile_id, x.project_assignment_id }); - table.ForeignKey( - name: "FK_user_project_assignments_project_assignments_project_assign~", - column: x => x.project_assignment_id, - principalTable: "project_assignments", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_user_project_assignments_user_profiles_user_profile_id", - column: x => x.user_profile_id, - principalTable: "user_profiles", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_user_project_assignments_project_assignment_id", - table: "user_project_assignments", - column: "project_assignment_id"); - - migrationBuilder.CreateIndex( - name: "IX_user_project_assignments_user_profile_id", - table: "user_project_assignments", - column: "user_profile_id"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "user_project_assignments"); - } - } -} diff --git a/src/SkillBridge/Data/Migrations/20250831100534_fixcompany.Designer.cs b/src/SkillBridge/Data/Migrations/20250831100534_fixcompany.Designer.cs deleted file mode 100644 index c918c61..0000000 --- a/src/SkillBridge/Data/Migrations/20250831100534_fixcompany.Designer.cs +++ /dev/null @@ -1,459 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using SkillBridge.Data; - -#nullable disable - -namespace SkillBridge.Data.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20250831100534_fixcompany")] - partial class fixcompany - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.16") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("SkillBridge.Models.Entities.AssignmentTask", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Description") - .HasMaxLength(2000) - .HasColumnType("character varying(2000)") - .HasColumnName("description"); - - b.Property("IsCompleted") - .HasColumnType("boolean") - .HasColumnName("is_completed"); - - b.Property("ProjectAssignmentId") - .HasColumnType("uuid") - .HasColumnName("project_assignment_id"); - - b.Property("Sequence") - .HasColumnType("integer") - .HasColumnName("sequence"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)") - .HasColumnName("title"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id"); - - b.HasIndex("IsCompleted"); - - b.HasIndex("ProjectAssignmentId"); - - b.HasIndex("Sequence"); - - b.ToTable("assignment_tasks", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.Company", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("About") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("character varying(2000)") - .HasColumnName("about"); - - b.Property("Activities") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("activities"); - - b.Property("Auth0UserId") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)") - .HasColumnName("auth0_user_id"); - - b.Property("BannerUrl") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("banner_url"); - - b.Property("BulgarianOfficeLocations") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("bulgarian_office_locations"); - - b.Property("ContactEmail") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("contact_email"); - - b.Property("ContactName") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasColumnName("contact_name"); - - b.Property("ContactPhone") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasColumnName("contact_phone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("EmployeesInBulgaria") - .HasColumnType("integer") - .HasColumnName("employees_in_bulgaria"); - - b.Property("EmployeesWorldwide") - .HasColumnType("integer") - .HasColumnName("employees_worldwide"); - - b.Property("HasOfficesInBulgaria") - .HasColumnType("boolean") - .HasColumnName("has_offices_in_bulgaria"); - - b.Property("HeadOfficeLocation") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)") - .HasColumnName("head_office_location"); - - b.Property("LogoUrl") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("logo_url"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasColumnName("name"); - - b.Property("Sector") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasColumnName("sector"); - - b.Property("Technologies") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)") - .HasColumnName("technologies"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("WebsiteUrl") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("website_url"); - - b.Property("WhyWorkWithUs") - .HasMaxLength(2000) - .HasColumnType("character varying(2000)") - .HasColumnName("why_work_with_us"); - - b.Property("YearEstablished") - .IsRequired() - .HasColumnType("integer") - .HasColumnName("year_established"); - - b.HasKey("Id"); - - b.HasIndex("Auth0UserId") - .IsUnique(); - - b.HasIndex("Name"); - - b.HasIndex("Sector"); - - b.ToTable("companies", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.ProjectAssignment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CompanyId") - .HasColumnType("uuid") - .HasColumnName("company_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Deadline") - .HasColumnType("timestamp with time zone") - .HasColumnName("deadline"); - - b.Property("Description") - .HasMaxLength(2000) - .HasColumnType("character varying(2000)") - .HasColumnName("description"); - - b.Property("LearningBenefits") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)") - .HasColumnName("learning_benefits"); - - b.Property("Level") - .HasColumnType("integer") - .HasColumnName("level"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("SuggestedApproach") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)") - .HasColumnName("suggested_approach"); - - b.Property("Summary") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("summary"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)") - .HasColumnName("title"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id"); - - b.HasIndex("CompanyId"); - - b.HasIndex("Deadline"); - - b.HasIndex("Level"); - - b.HasIndex("Status"); - - b.ToTable("project_assignments", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.ProjectSkill", b => - { - b.Property("ProjectAssignmentId") - .HasColumnType("uuid") - .HasColumnName("project_assignment_id"); - - b.Property("SkillId") - .HasColumnType("uuid") - .HasColumnName("skill_id"); - - b.HasKey("ProjectAssignmentId", "SkillId"); - - b.HasIndex("SkillId"); - - b.ToTable("project_skills", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.Skill", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("description"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasColumnName("name"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("skills", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.UserProfile", b => - { - b.Property("Id") - .HasColumnType("text") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id"); - - b.ToTable("user_profiles", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.UserProjectAssignment", b => - { - b.Property("UserProfileId") - .HasColumnType("text") - .HasColumnName("user_profile_id"); - - b.Property("ProjectAssignmentId") - .HasColumnType("uuid") - .HasColumnName("project_assignment_id"); - - b.Property("ClaimedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("claimed_at"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("completed_at"); - - b.Property("IsCompleted") - .HasColumnType("boolean") - .HasColumnName("is_completed"); - - b.HasKey("UserProfileId", "ProjectAssignmentId"); - - b.HasIndex("ProjectAssignmentId"); - - b.HasIndex("UserProfileId"); - - b.ToTable("user_project_assignments", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.AssignmentTask", b => - { - b.HasOne("SkillBridge.Models.Entities.ProjectAssignment", "ProjectAssignment") - .WithMany("Tasks") - .HasForeignKey("ProjectAssignmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ProjectAssignment"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.ProjectAssignment", b => - { - b.HasOne("SkillBridge.Models.Entities.Company", "Company") - .WithMany("ProjectAssignments") - .HasForeignKey("CompanyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Company"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.ProjectSkill", b => - { - b.HasOne("SkillBridge.Models.Entities.ProjectAssignment", "ProjectAssignment") - .WithMany("ProjectSkills") - .HasForeignKey("ProjectAssignmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("SkillBridge.Models.Entities.Skill", "Skill") - .WithMany("ProjectSkills") - .HasForeignKey("SkillId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ProjectAssignment"); - - b.Navigation("Skill"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.UserProjectAssignment", b => - { - b.HasOne("SkillBridge.Models.Entities.ProjectAssignment", "ProjectAssignment") - .WithMany("UserProjectAssignments") - .HasForeignKey("ProjectAssignmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("SkillBridge.Models.Entities.UserProfile", "UserProfile") - .WithMany("UserProjectAssignments") - .HasForeignKey("UserProfileId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ProjectAssignment"); - - b.Navigation("UserProfile"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.Company", b => - { - b.Navigation("ProjectAssignments"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.ProjectAssignment", b => - { - b.Navigation("ProjectSkills"); - - b.Navigation("Tasks"); - - b.Navigation("UserProjectAssignments"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.Skill", b => - { - b.Navigation("ProjectSkills"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.UserProfile", b => - { - b.Navigation("UserProjectAssignments"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/SkillBridge/Data/Migrations/20250831100534_fixcompany.cs b/src/SkillBridge/Data/Migrations/20250831100534_fixcompany.cs deleted file mode 100644 index 69ed1db..0000000 --- a/src/SkillBridge/Data/Migrations/20250831100534_fixcompany.cs +++ /dev/null @@ -1,233 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace SkillBridge.Data.Migrations -{ - /// - public partial class fixcompany : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "contact_info", - table: "companies"); - - migrationBuilder.AlterColumn( - name: "year_established", - table: "companies", - type: "integer", - nullable: false, - defaultValue: 0, - oldClrType: typeof(int), - oldType: "integer", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "website_url", - table: "companies", - type: "character varying(500)", - maxLength: 500, - nullable: false, - defaultValue: "", - oldClrType: typeof(string), - oldType: "character varying(500)", - oldMaxLength: 500, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "technologies", - table: "companies", - type: "character varying(1000)", - maxLength: 1000, - nullable: false, - defaultValue: "", - oldClrType: typeof(string), - oldType: "character varying(1000)", - oldMaxLength: 1000, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "sector", - table: "companies", - type: "character varying(100)", - maxLength: 100, - nullable: false, - defaultValue: "", - oldClrType: typeof(string), - oldType: "character varying(100)", - oldMaxLength: 100, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "head_office_location", - table: "companies", - type: "character varying(200)", - maxLength: 200, - nullable: false, - defaultValue: "", - oldClrType: typeof(string), - oldType: "character varying(200)", - oldMaxLength: 200, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "employees_worldwide", - table: "companies", - type: "integer", - nullable: false, - defaultValue: 0, - oldClrType: typeof(int), - oldType: "integer", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "activities", - table: "companies", - type: "character varying(500)", - maxLength: 500, - nullable: false, - defaultValue: "", - oldClrType: typeof(string), - oldType: "character varying(500)", - oldMaxLength: 500, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "about", - table: "companies", - type: "character varying(2000)", - maxLength: 2000, - nullable: false, - defaultValue: "", - oldClrType: typeof(string), - oldType: "character varying(2000)", - oldMaxLength: 2000, - oldNullable: true); - - migrationBuilder.AddColumn( - name: "contact_email", - table: "companies", - type: "character varying(255)", - maxLength: 255, - nullable: false, - defaultValue: ""); - - migrationBuilder.AddColumn( - name: "contact_name", - table: "companies", - type: "character varying(100)", - maxLength: 100, - nullable: false, - defaultValue: ""); - - migrationBuilder.AddColumn( - name: "contact_phone", - table: "companies", - type: "character varying(20)", - maxLength: 20, - nullable: false, - defaultValue: ""); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "contact_email", - table: "companies"); - - migrationBuilder.DropColumn( - name: "contact_name", - table: "companies"); - - migrationBuilder.DropColumn( - name: "contact_phone", - table: "companies"); - - migrationBuilder.AlterColumn( - name: "year_established", - table: "companies", - type: "integer", - nullable: true, - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "website_url", - table: "companies", - type: "character varying(500)", - maxLength: 500, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(500)", - oldMaxLength: 500); - - migrationBuilder.AlterColumn( - name: "technologies", - table: "companies", - type: "character varying(1000)", - maxLength: 1000, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(1000)", - oldMaxLength: 1000); - - migrationBuilder.AlterColumn( - name: "sector", - table: "companies", - type: "character varying(100)", - maxLength: 100, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(100)", - oldMaxLength: 100); - - migrationBuilder.AlterColumn( - name: "head_office_location", - table: "companies", - type: "character varying(200)", - maxLength: 200, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(200)", - oldMaxLength: 200); - - migrationBuilder.AlterColumn( - name: "employees_worldwide", - table: "companies", - type: "integer", - nullable: true, - oldClrType: typeof(int), - oldType: "integer"); - - migrationBuilder.AlterColumn( - name: "activities", - table: "companies", - type: "character varying(500)", - maxLength: 500, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(500)", - oldMaxLength: 500); - - migrationBuilder.AlterColumn( - name: "about", - table: "companies", - type: "character varying(2000)", - maxLength: 2000, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(2000)", - oldMaxLength: 2000); - - migrationBuilder.AddColumn( - name: "contact_info", - table: "companies", - type: "character varying(1000)", - maxLength: 1000, - nullable: true); - } - } -} diff --git a/src/SkillBridge/Data/Migrations/20250901110900_UserProfileAddedFileLinks.Designer.cs b/src/SkillBridge/Data/Migrations/20250901110900_UserProfileAddedFileLinks.Designer.cs deleted file mode 100644 index 7b1a5d9..0000000 --- a/src/SkillBridge/Data/Migrations/20250901110900_UserProfileAddedFileLinks.Designer.cs +++ /dev/null @@ -1,471 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using SkillBridge.Data; - -#nullable disable - -namespace SkillBridge.Data.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20250901110900_UserProfileAddedFileLinks")] - partial class UserProfileAddedFileLinks - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.16") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("SkillBridge.Models.Entities.AssignmentTask", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Description") - .HasMaxLength(2000) - .HasColumnType("character varying(2000)") - .HasColumnName("description"); - - b.Property("IsCompleted") - .HasColumnType("boolean") - .HasColumnName("is_completed"); - - b.Property("ProjectAssignmentId") - .HasColumnType("uuid") - .HasColumnName("project_assignment_id"); - - b.Property("Sequence") - .HasColumnType("integer") - .HasColumnName("sequence"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)") - .HasColumnName("title"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id"); - - b.HasIndex("IsCompleted"); - - b.HasIndex("ProjectAssignmentId"); - - b.HasIndex("Sequence"); - - b.ToTable("assignment_tasks", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.Company", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("About") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("character varying(2000)") - .HasColumnName("about"); - - b.Property("Activities") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("activities"); - - b.Property("Auth0UserId") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)") - .HasColumnName("auth0_user_id"); - - b.Property("BannerUrl") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("banner_url"); - - b.Property("BulgarianOfficeLocations") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("bulgarian_office_locations"); - - b.Property("ContactEmail") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("contact_email"); - - b.Property("ContactName") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasColumnName("contact_name"); - - b.Property("ContactPhone") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasColumnName("contact_phone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("EmployeesInBulgaria") - .HasColumnType("integer") - .HasColumnName("employees_in_bulgaria"); - - b.Property("EmployeesWorldwide") - .HasColumnType("integer") - .HasColumnName("employees_worldwide"); - - b.Property("HasOfficesInBulgaria") - .HasColumnType("boolean") - .HasColumnName("has_offices_in_bulgaria"); - - b.Property("HeadOfficeLocation") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)") - .HasColumnName("head_office_location"); - - b.Property("LogoUrl") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("logo_url"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasColumnName("name"); - - b.Property("Sector") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasColumnName("sector"); - - b.Property("Technologies") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)") - .HasColumnName("technologies"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("WebsiteUrl") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("website_url"); - - b.Property("WhyWorkWithUs") - .HasMaxLength(2000) - .HasColumnType("character varying(2000)") - .HasColumnName("why_work_with_us"); - - b.Property("YearEstablished") - .IsRequired() - .HasColumnType("integer") - .HasColumnName("year_established"); - - b.HasKey("Id"); - - b.HasIndex("Auth0UserId") - .IsUnique(); - - b.HasIndex("Name"); - - b.HasIndex("Sector"); - - b.ToTable("companies", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.ProjectAssignment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CompanyId") - .HasColumnType("uuid") - .HasColumnName("company_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Deadline") - .HasColumnType("timestamp with time zone") - .HasColumnName("deadline"); - - b.Property("Description") - .HasMaxLength(2000) - .HasColumnType("character varying(2000)") - .HasColumnName("description"); - - b.Property("LearningBenefits") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)") - .HasColumnName("learning_benefits"); - - b.Property("Level") - .HasColumnType("integer") - .HasColumnName("level"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("SuggestedApproach") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)") - .HasColumnName("suggested_approach"); - - b.Property("Summary") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("summary"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)") - .HasColumnName("title"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id"); - - b.HasIndex("CompanyId"); - - b.HasIndex("Deadline"); - - b.HasIndex("Level"); - - b.HasIndex("Status"); - - b.ToTable("project_assignments", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.ProjectSkill", b => - { - b.Property("ProjectAssignmentId") - .HasColumnType("uuid") - .HasColumnName("project_assignment_id"); - - b.Property("SkillId") - .HasColumnType("uuid") - .HasColumnName("skill_id"); - - b.HasKey("ProjectAssignmentId", "SkillId"); - - b.HasIndex("SkillId"); - - b.ToTable("project_skills", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.Skill", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("description"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasColumnName("name"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("skills", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.UserProfile", b => - { - b.Property("Id") - .HasColumnType("text") - .HasColumnName("id"); - - b.Property("CVUpload") - .IsRequired() - .HasColumnType("text"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("GitHubConnection") - .IsRequired() - .HasColumnType("text"); - - b.Property("ProfilePicture") - .IsRequired() - .HasColumnType("text"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id"); - - b.ToTable("user_profiles", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.UserProjectAssignment", b => - { - b.Property("UserProfileId") - .HasColumnType("text") - .HasColumnName("user_profile_id"); - - b.Property("ProjectAssignmentId") - .HasColumnType("uuid") - .HasColumnName("project_assignment_id"); - - b.Property("ClaimedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("claimed_at"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("completed_at"); - - b.Property("IsCompleted") - .HasColumnType("boolean") - .HasColumnName("is_completed"); - - b.HasKey("UserProfileId", "ProjectAssignmentId"); - - b.HasIndex("ProjectAssignmentId"); - - b.HasIndex("UserProfileId"); - - b.ToTable("user_project_assignments", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.AssignmentTask", b => - { - b.HasOne("SkillBridge.Models.Entities.ProjectAssignment", "ProjectAssignment") - .WithMany("Tasks") - .HasForeignKey("ProjectAssignmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ProjectAssignment"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.ProjectAssignment", b => - { - b.HasOne("SkillBridge.Models.Entities.Company", "Company") - .WithMany("ProjectAssignments") - .HasForeignKey("CompanyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Company"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.ProjectSkill", b => - { - b.HasOne("SkillBridge.Models.Entities.ProjectAssignment", "ProjectAssignment") - .WithMany("ProjectSkills") - .HasForeignKey("ProjectAssignmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("SkillBridge.Models.Entities.Skill", "Skill") - .WithMany("ProjectSkills") - .HasForeignKey("SkillId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ProjectAssignment"); - - b.Navigation("Skill"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.UserProjectAssignment", b => - { - b.HasOne("SkillBridge.Models.Entities.ProjectAssignment", "ProjectAssignment") - .WithMany("UserProjectAssignments") - .HasForeignKey("ProjectAssignmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("SkillBridge.Models.Entities.UserProfile", "UserProfile") - .WithMany("UserProjectAssignments") - .HasForeignKey("UserProfileId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ProjectAssignment"); - - b.Navigation("UserProfile"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.Company", b => - { - b.Navigation("ProjectAssignments"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.ProjectAssignment", b => - { - b.Navigation("ProjectSkills"); - - b.Navigation("Tasks"); - - b.Navigation("UserProjectAssignments"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.Skill", b => - { - b.Navigation("ProjectSkills"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.UserProfile", b => - { - b.Navigation("UserProjectAssignments"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/SkillBridge/Data/Migrations/20250901110900_UserProfileAddedFileLinks.cs b/src/SkillBridge/Data/Migrations/20250901110900_UserProfileAddedFileLinks.cs deleted file mode 100644 index ba342c4..0000000 --- a/src/SkillBridge/Data/Migrations/20250901110900_UserProfileAddedFileLinks.cs +++ /dev/null @@ -1,51 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace SkillBridge.Data.Migrations -{ - /// - public partial class UserProfileAddedFileLinks : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "CVUpload", - table: "user_profiles", - type: "text", - nullable: false, - defaultValue: ""); - - migrationBuilder.AddColumn( - name: "GitHubConnection", - table: "user_profiles", - type: "text", - nullable: false, - defaultValue: ""); - - migrationBuilder.AddColumn( - name: "ProfilePicture", - table: "user_profiles", - type: "text", - nullable: false, - defaultValue: ""); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "CVUpload", - table: "user_profiles"); - - migrationBuilder.DropColumn( - name: "GitHubConnection", - table: "user_profiles"); - - migrationBuilder.DropColumn( - name: "ProfilePicture", - table: "user_profiles"); - } - } -} diff --git a/src/SkillBridge/Data/Migrations/20250903105216_UpdatedUserProfileConfiguration.Designer.cs b/src/SkillBridge/Data/Migrations/20250903105216_UpdatedUserProfileConfiguration.Designer.cs deleted file mode 100644 index ffd318e..0000000 --- a/src/SkillBridge/Data/Migrations/20250903105216_UpdatedUserProfileConfiguration.Designer.cs +++ /dev/null @@ -1,474 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using SkillBridge.Data; - -#nullable disable - -namespace SkillBridge.Data.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20250903105216_UpdatedUserProfileConfiguration")] - partial class UpdatedUserProfileConfiguration - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.16") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("SkillBridge.Models.Entities.AssignmentTask", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Description") - .HasMaxLength(2000) - .HasColumnType("character varying(2000)") - .HasColumnName("description"); - - b.Property("IsCompleted") - .HasColumnType("boolean") - .HasColumnName("is_completed"); - - b.Property("ProjectAssignmentId") - .HasColumnType("uuid") - .HasColumnName("project_assignment_id"); - - b.Property("Sequence") - .HasColumnType("integer") - .HasColumnName("sequence"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)") - .HasColumnName("title"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id"); - - b.HasIndex("IsCompleted"); - - b.HasIndex("ProjectAssignmentId"); - - b.HasIndex("Sequence"); - - b.ToTable("assignment_tasks", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.Company", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("About") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("character varying(2000)") - .HasColumnName("about"); - - b.Property("Activities") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("activities"); - - b.Property("Auth0UserId") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)") - .HasColumnName("auth0_user_id"); - - b.Property("BannerUrl") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("banner_url"); - - b.Property("BulgarianOfficeLocations") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("bulgarian_office_locations"); - - b.Property("ContactEmail") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("contact_email"); - - b.Property("ContactName") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasColumnName("contact_name"); - - b.Property("ContactPhone") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasColumnName("contact_phone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("EmployeesInBulgaria") - .HasColumnType("integer") - .HasColumnName("employees_in_bulgaria"); - - b.Property("EmployeesWorldwide") - .HasColumnType("integer") - .HasColumnName("employees_worldwide"); - - b.Property("HasOfficesInBulgaria") - .HasColumnType("boolean") - .HasColumnName("has_offices_in_bulgaria"); - - b.Property("HeadOfficeLocation") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)") - .HasColumnName("head_office_location"); - - b.Property("LogoUrl") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("logo_url"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasColumnName("name"); - - b.Property("Sector") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasColumnName("sector"); - - b.Property("Technologies") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)") - .HasColumnName("technologies"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("WebsiteUrl") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("website_url"); - - b.Property("WhyWorkWithUs") - .HasMaxLength(2000) - .HasColumnType("character varying(2000)") - .HasColumnName("why_work_with_us"); - - b.Property("YearEstablished") - .IsRequired() - .HasColumnType("integer") - .HasColumnName("year_established"); - - b.HasKey("Id"); - - b.HasIndex("Auth0UserId") - .IsUnique(); - - b.HasIndex("Name"); - - b.HasIndex("Sector"); - - b.ToTable("companies", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.ProjectAssignment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CompanyId") - .HasColumnType("uuid") - .HasColumnName("company_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Deadline") - .HasColumnType("timestamp with time zone") - .HasColumnName("deadline"); - - b.Property("Description") - .HasMaxLength(2000) - .HasColumnType("character varying(2000)") - .HasColumnName("description"); - - b.Property("LearningBenefits") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)") - .HasColumnName("learning_benefits"); - - b.Property("Level") - .HasColumnType("integer") - .HasColumnName("level"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("SuggestedApproach") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)") - .HasColumnName("suggested_approach"); - - b.Property("Summary") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("summary"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)") - .HasColumnName("title"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id"); - - b.HasIndex("CompanyId"); - - b.HasIndex("Deadline"); - - b.HasIndex("Level"); - - b.HasIndex("Status"); - - b.ToTable("project_assignments", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.ProjectSkill", b => - { - b.Property("ProjectAssignmentId") - .HasColumnType("uuid") - .HasColumnName("project_assignment_id"); - - b.Property("SkillId") - .HasColumnType("uuid") - .HasColumnName("skill_id"); - - b.HasKey("ProjectAssignmentId", "SkillId"); - - b.HasIndex("SkillId"); - - b.ToTable("project_skills", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.Skill", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("description"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasColumnName("name"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("skills", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.UserProfile", b => - { - b.Property("Id") - .HasColumnType("text") - .HasColumnName("id"); - - b.Property("CVUpload") - .IsRequired() - .HasColumnType("text") - .HasColumnName("cv_upload"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("GitHubConnection") - .IsRequired() - .HasColumnType("text") - .HasColumnName("github_connection"); - - b.Property("ProfilePicture") - .IsRequired() - .HasColumnType("text") - .HasColumnName("profile_picture"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id"); - - b.ToTable("user_profiles", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.UserProjectAssignment", b => - { - b.Property("UserProfileId") - .HasColumnType("text") - .HasColumnName("user_profile_id"); - - b.Property("ProjectAssignmentId") - .HasColumnType("uuid") - .HasColumnName("project_assignment_id"); - - b.Property("ClaimedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("claimed_at"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("completed_at"); - - b.Property("IsCompleted") - .HasColumnType("boolean") - .HasColumnName("is_completed"); - - b.HasKey("UserProfileId", "ProjectAssignmentId"); - - b.HasIndex("ProjectAssignmentId"); - - b.HasIndex("UserProfileId"); - - b.ToTable("user_project_assignments", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.AssignmentTask", b => - { - b.HasOne("SkillBridge.Models.Entities.ProjectAssignment", "ProjectAssignment") - .WithMany("Tasks") - .HasForeignKey("ProjectAssignmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ProjectAssignment"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.ProjectAssignment", b => - { - b.HasOne("SkillBridge.Models.Entities.Company", "Company") - .WithMany("ProjectAssignments") - .HasForeignKey("CompanyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Company"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.ProjectSkill", b => - { - b.HasOne("SkillBridge.Models.Entities.ProjectAssignment", "ProjectAssignment") - .WithMany("ProjectSkills") - .HasForeignKey("ProjectAssignmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("SkillBridge.Models.Entities.Skill", "Skill") - .WithMany("ProjectSkills") - .HasForeignKey("SkillId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ProjectAssignment"); - - b.Navigation("Skill"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.UserProjectAssignment", b => - { - b.HasOne("SkillBridge.Models.Entities.ProjectAssignment", "ProjectAssignment") - .WithMany("UserProjectAssignments") - .HasForeignKey("ProjectAssignmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("SkillBridge.Models.Entities.UserProfile", "UserProfile") - .WithMany("UserProjectAssignments") - .HasForeignKey("UserProfileId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ProjectAssignment"); - - b.Navigation("UserProfile"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.Company", b => - { - b.Navigation("ProjectAssignments"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.ProjectAssignment", b => - { - b.Navigation("ProjectSkills"); - - b.Navigation("Tasks"); - - b.Navigation("UserProjectAssignments"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.Skill", b => - { - b.Navigation("ProjectSkills"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.UserProfile", b => - { - b.Navigation("UserProjectAssignments"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/SkillBridge/Data/Migrations/20250903105216_UpdatedUserProfileConfiguration.cs b/src/SkillBridge/Data/Migrations/20250903105216_UpdatedUserProfileConfiguration.cs deleted file mode 100644 index 41a9e6a..0000000 --- a/src/SkillBridge/Data/Migrations/20250903105216_UpdatedUserProfileConfiguration.cs +++ /dev/null @@ -1,48 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace SkillBridge.Data.Migrations -{ - /// - public partial class UpdatedUserProfileConfiguration : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.RenameColumn( - name: "ProfilePicture", - table: "user_profiles", - newName: "profile_picture"); - - migrationBuilder.RenameColumn( - name: "GitHubConnection", - table: "user_profiles", - newName: "github_connection"); - - migrationBuilder.RenameColumn( - name: "CVUpload", - table: "user_profiles", - newName: "cv_upload"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.RenameColumn( - name: "profile_picture", - table: "user_profiles", - newName: "ProfilePicture"); - - migrationBuilder.RenameColumn( - name: "github_connection", - table: "user_profiles", - newName: "GitHubConnection"); - - migrationBuilder.RenameColumn( - name: "cv_upload", - table: "user_profiles", - newName: "CVUpload"); - } - } -} diff --git a/src/SkillBridge/Data/Migrations/20250904161908_UpdateUserProfileEntity.Designer.cs b/src/SkillBridge/Data/Migrations/20250904161908_UpdateUserProfileEntity.Designer.cs deleted file mode 100644 index b29ae71..0000000 --- a/src/SkillBridge/Data/Migrations/20250904161908_UpdateUserProfileEntity.Designer.cs +++ /dev/null @@ -1,471 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using SkillBridge.Data; - -#nullable disable - -namespace SkillBridge.Data.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20250904161908_UpdateUserProfileEntity")] - partial class UpdateUserProfileEntity - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.16") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("SkillBridge.Models.Entities.AssignmentTask", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Description") - .HasMaxLength(2000) - .HasColumnType("character varying(2000)") - .HasColumnName("description"); - - b.Property("IsCompleted") - .HasColumnType("boolean") - .HasColumnName("is_completed"); - - b.Property("ProjectAssignmentId") - .HasColumnType("uuid") - .HasColumnName("project_assignment_id"); - - b.Property("Sequence") - .HasColumnType("integer") - .HasColumnName("sequence"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)") - .HasColumnName("title"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id"); - - b.HasIndex("IsCompleted"); - - b.HasIndex("ProjectAssignmentId"); - - b.HasIndex("Sequence"); - - b.ToTable("assignment_tasks", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.Company", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("About") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("character varying(2000)") - .HasColumnName("about"); - - b.Property("Activities") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("activities"); - - b.Property("Auth0UserId") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)") - .HasColumnName("auth0_user_id"); - - b.Property("BannerUrl") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("banner_url"); - - b.Property("BulgarianOfficeLocations") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("bulgarian_office_locations"); - - b.Property("ContactEmail") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("contact_email"); - - b.Property("ContactName") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasColumnName("contact_name"); - - b.Property("ContactPhone") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasColumnName("contact_phone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("EmployeesInBulgaria") - .HasColumnType("integer") - .HasColumnName("employees_in_bulgaria"); - - b.Property("EmployeesWorldwide") - .HasColumnType("integer") - .HasColumnName("employees_worldwide"); - - b.Property("HasOfficesInBulgaria") - .HasColumnType("boolean") - .HasColumnName("has_offices_in_bulgaria"); - - b.Property("HeadOfficeLocation") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)") - .HasColumnName("head_office_location"); - - b.Property("LogoUrl") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("logo_url"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasColumnName("name"); - - b.Property("Sector") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasColumnName("sector"); - - b.Property("Technologies") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)") - .HasColumnName("technologies"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("WebsiteUrl") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("website_url"); - - b.Property("WhyWorkWithUs") - .HasMaxLength(2000) - .HasColumnType("character varying(2000)") - .HasColumnName("why_work_with_us"); - - b.Property("YearEstablished") - .IsRequired() - .HasColumnType("integer") - .HasColumnName("year_established"); - - b.HasKey("Id"); - - b.HasIndex("Auth0UserId") - .IsUnique(); - - b.HasIndex("Name"); - - b.HasIndex("Sector"); - - b.ToTable("companies", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.ProjectAssignment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CompanyId") - .HasColumnType("uuid") - .HasColumnName("company_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Deadline") - .HasColumnType("timestamp with time zone") - .HasColumnName("deadline"); - - b.Property("Description") - .HasMaxLength(2000) - .HasColumnType("character varying(2000)") - .HasColumnName("description"); - - b.Property("LearningBenefits") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)") - .HasColumnName("learning_benefits"); - - b.Property("Level") - .HasColumnType("integer") - .HasColumnName("level"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("SuggestedApproach") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)") - .HasColumnName("suggested_approach"); - - b.Property("Summary") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("summary"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)") - .HasColumnName("title"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id"); - - b.HasIndex("CompanyId"); - - b.HasIndex("Deadline"); - - b.HasIndex("Level"); - - b.HasIndex("Status"); - - b.ToTable("project_assignments", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.ProjectSkill", b => - { - b.Property("ProjectAssignmentId") - .HasColumnType("uuid") - .HasColumnName("project_assignment_id"); - - b.Property("SkillId") - .HasColumnType("uuid") - .HasColumnName("skill_id"); - - b.HasKey("ProjectAssignmentId", "SkillId"); - - b.HasIndex("SkillId"); - - b.ToTable("project_skills", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.Skill", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("description"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasColumnName("name"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("skills", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.UserProfile", b => - { - b.Property("Id") - .HasColumnType("text") - .HasColumnName("id"); - - b.Property("CVUpload") - .HasColumnType("text") - .HasColumnName("cv_upload"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("GitHubConnection") - .HasColumnType("text") - .HasColumnName("github_connection"); - - b.Property("ProfilePicture") - .HasColumnType("text") - .HasColumnName("profile_picture"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id"); - - b.ToTable("user_profiles", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.UserProjectAssignment", b => - { - b.Property("UserProfileId") - .HasColumnType("text") - .HasColumnName("user_profile_id"); - - b.Property("ProjectAssignmentId") - .HasColumnType("uuid") - .HasColumnName("project_assignment_id"); - - b.Property("ClaimedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("claimed_at"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("completed_at"); - - b.Property("IsCompleted") - .HasColumnType("boolean") - .HasColumnName("is_completed"); - - b.HasKey("UserProfileId", "ProjectAssignmentId"); - - b.HasIndex("ProjectAssignmentId"); - - b.HasIndex("UserProfileId"); - - b.ToTable("user_project_assignments", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.AssignmentTask", b => - { - b.HasOne("SkillBridge.Models.Entities.ProjectAssignment", "ProjectAssignment") - .WithMany("Tasks") - .HasForeignKey("ProjectAssignmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ProjectAssignment"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.ProjectAssignment", b => - { - b.HasOne("SkillBridge.Models.Entities.Company", "Company") - .WithMany("ProjectAssignments") - .HasForeignKey("CompanyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Company"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.ProjectSkill", b => - { - b.HasOne("SkillBridge.Models.Entities.ProjectAssignment", "ProjectAssignment") - .WithMany("ProjectSkills") - .HasForeignKey("ProjectAssignmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("SkillBridge.Models.Entities.Skill", "Skill") - .WithMany("ProjectSkills") - .HasForeignKey("SkillId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ProjectAssignment"); - - b.Navigation("Skill"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.UserProjectAssignment", b => - { - b.HasOne("SkillBridge.Models.Entities.ProjectAssignment", "ProjectAssignment") - .WithMany("UserProjectAssignments") - .HasForeignKey("ProjectAssignmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("SkillBridge.Models.Entities.UserProfile", "UserProfile") - .WithMany("UserProjectAssignments") - .HasForeignKey("UserProfileId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ProjectAssignment"); - - b.Navigation("UserProfile"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.Company", b => - { - b.Navigation("ProjectAssignments"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.ProjectAssignment", b => - { - b.Navigation("ProjectSkills"); - - b.Navigation("Tasks"); - - b.Navigation("UserProjectAssignments"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.Skill", b => - { - b.Navigation("ProjectSkills"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.UserProfile", b => - { - b.Navigation("UserProjectAssignments"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/SkillBridge/Data/Migrations/20250904161908_UpdateUserProfileEntity.cs b/src/SkillBridge/Data/Migrations/20250904161908_UpdateUserProfileEntity.cs deleted file mode 100644 index 3cb9e6f..0000000 --- a/src/SkillBridge/Data/Migrations/20250904161908_UpdateUserProfileEntity.cs +++ /dev/null @@ -1,72 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace SkillBridge.Data.Migrations -{ - /// - public partial class UpdateUserProfileEntity : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "profile_picture", - table: "user_profiles", - type: "text", - nullable: true, - oldClrType: typeof(string), - oldType: "text"); - - migrationBuilder.AlterColumn( - name: "github_connection", - table: "user_profiles", - type: "text", - nullable: true, - oldClrType: typeof(string), - oldType: "text"); - - migrationBuilder.AlterColumn( - name: "cv_upload", - table: "user_profiles", - type: "text", - nullable: true, - oldClrType: typeof(string), - oldType: "text"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "profile_picture", - table: "user_profiles", - type: "text", - nullable: false, - defaultValue: "", - oldClrType: typeof(string), - oldType: "text", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "github_connection", - table: "user_profiles", - type: "text", - nullable: false, - defaultValue: "", - oldClrType: typeof(string), - oldType: "text", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "cv_upload", - table: "user_profiles", - type: "text", - nullable: false, - defaultValue: "", - oldClrType: typeof(string), - oldType: "text", - oldNullable: true); - } - } -} diff --git a/src/SkillBridge/Data/Migrations/20250905084435_DescrChange.Designer.cs b/src/SkillBridge/Data/Migrations/20250905084435_DescrChange.Designer.cs deleted file mode 100644 index 634e9c0..0000000 --- a/src/SkillBridge/Data/Migrations/20250905084435_DescrChange.Designer.cs +++ /dev/null @@ -1,471 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using SkillBridge.Data; - -#nullable disable - -namespace SkillBridge.Data.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20250905084435_DescrChange")] - partial class DescrChange - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.16") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("SkillBridge.Models.Entities.AssignmentTask", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Description") - .HasMaxLength(2000) - .HasColumnType("character varying(2000)") - .HasColumnName("description"); - - b.Property("IsCompleted") - .HasColumnType("boolean") - .HasColumnName("is_completed"); - - b.Property("ProjectAssignmentId") - .HasColumnType("uuid") - .HasColumnName("project_assignment_id"); - - b.Property("Sequence") - .HasColumnType("integer") - .HasColumnName("sequence"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)") - .HasColumnName("title"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id"); - - b.HasIndex("IsCompleted"); - - b.HasIndex("ProjectAssignmentId"); - - b.HasIndex("Sequence"); - - b.ToTable("assignment_tasks", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.Company", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("About") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("character varying(2000)") - .HasColumnName("about"); - - b.Property("Activities") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("activities"); - - b.Property("Auth0UserId") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)") - .HasColumnName("auth0_user_id"); - - b.Property("BannerUrl") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("banner_url"); - - b.Property("BulgarianOfficeLocations") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("bulgarian_office_locations"); - - b.Property("ContactEmail") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("contact_email"); - - b.Property("ContactName") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasColumnName("contact_name"); - - b.Property("ContactPhone") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasColumnName("contact_phone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("EmployeesInBulgaria") - .HasColumnType("integer") - .HasColumnName("employees_in_bulgaria"); - - b.Property("EmployeesWorldwide") - .HasColumnType("integer") - .HasColumnName("employees_worldwide"); - - b.Property("HasOfficesInBulgaria") - .HasColumnType("boolean") - .HasColumnName("has_offices_in_bulgaria"); - - b.Property("HeadOfficeLocation") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)") - .HasColumnName("head_office_location"); - - b.Property("LogoUrl") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("logo_url"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasColumnName("name"); - - b.Property("Sector") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasColumnName("sector"); - - b.Property("Technologies") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)") - .HasColumnName("technologies"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("WebsiteUrl") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("website_url"); - - b.Property("WhyWorkWithUs") - .HasMaxLength(2000) - .HasColumnType("character varying(2000)") - .HasColumnName("why_work_with_us"); - - b.Property("YearEstablished") - .IsRequired() - .HasColumnType("integer") - .HasColumnName("year_established"); - - b.HasKey("Id"); - - b.HasIndex("Auth0UserId") - .IsUnique(); - - b.HasIndex("Name"); - - b.HasIndex("Sector"); - - b.ToTable("companies", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.ProjectAssignment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CompanyId") - .HasColumnType("uuid") - .HasColumnName("company_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Deadline") - .HasColumnType("timestamp with time zone") - .HasColumnName("deadline"); - - b.Property("Description") - .HasMaxLength(20000) - .HasColumnType("character varying(20000)") - .HasColumnName("description"); - - b.Property("LearningBenefits") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)") - .HasColumnName("learning_benefits"); - - b.Property("Level") - .HasColumnType("integer") - .HasColumnName("level"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("SuggestedApproach") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)") - .HasColumnName("suggested_approach"); - - b.Property("Summary") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("summary"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)") - .HasColumnName("title"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id"); - - b.HasIndex("CompanyId"); - - b.HasIndex("Deadline"); - - b.HasIndex("Level"); - - b.HasIndex("Status"); - - b.ToTable("project_assignments", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.ProjectSkill", b => - { - b.Property("ProjectAssignmentId") - .HasColumnType("uuid") - .HasColumnName("project_assignment_id"); - - b.Property("SkillId") - .HasColumnType("uuid") - .HasColumnName("skill_id"); - - b.HasKey("ProjectAssignmentId", "SkillId"); - - b.HasIndex("SkillId"); - - b.ToTable("project_skills", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.Skill", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("description"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasColumnName("name"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("skills", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.UserProfile", b => - { - b.Property("Id") - .HasColumnType("text") - .HasColumnName("id"); - - b.Property("CVUpload") - .HasColumnType("text") - .HasColumnName("cv_upload"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("GitHubConnection") - .HasColumnType("text") - .HasColumnName("github_connection"); - - b.Property("ProfilePicture") - .HasColumnType("text") - .HasColumnName("profile_picture"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id"); - - b.ToTable("user_profiles", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.UserProjectAssignment", b => - { - b.Property("UserProfileId") - .HasColumnType("text") - .HasColumnName("user_profile_id"); - - b.Property("ProjectAssignmentId") - .HasColumnType("uuid") - .HasColumnName("project_assignment_id"); - - b.Property("ClaimedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("claimed_at"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("completed_at"); - - b.Property("IsCompleted") - .HasColumnType("boolean") - .HasColumnName("is_completed"); - - b.HasKey("UserProfileId", "ProjectAssignmentId"); - - b.HasIndex("ProjectAssignmentId"); - - b.HasIndex("UserProfileId"); - - b.ToTable("user_project_assignments", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.AssignmentTask", b => - { - b.HasOne("SkillBridge.Models.Entities.ProjectAssignment", "ProjectAssignment") - .WithMany("Tasks") - .HasForeignKey("ProjectAssignmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ProjectAssignment"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.ProjectAssignment", b => - { - b.HasOne("SkillBridge.Models.Entities.Company", "Company") - .WithMany("ProjectAssignments") - .HasForeignKey("CompanyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Company"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.ProjectSkill", b => - { - b.HasOne("SkillBridge.Models.Entities.ProjectAssignment", "ProjectAssignment") - .WithMany("ProjectSkills") - .HasForeignKey("ProjectAssignmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("SkillBridge.Models.Entities.Skill", "Skill") - .WithMany("ProjectSkills") - .HasForeignKey("SkillId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ProjectAssignment"); - - b.Navigation("Skill"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.UserProjectAssignment", b => - { - b.HasOne("SkillBridge.Models.Entities.ProjectAssignment", "ProjectAssignment") - .WithMany("UserProjectAssignments") - .HasForeignKey("ProjectAssignmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("SkillBridge.Models.Entities.UserProfile", "UserProfile") - .WithMany("UserProjectAssignments") - .HasForeignKey("UserProfileId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ProjectAssignment"); - - b.Navigation("UserProfile"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.Company", b => - { - b.Navigation("ProjectAssignments"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.ProjectAssignment", b => - { - b.Navigation("ProjectSkills"); - - b.Navigation("Tasks"); - - b.Navigation("UserProjectAssignments"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.Skill", b => - { - b.Navigation("ProjectSkills"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.UserProfile", b => - { - b.Navigation("UserProjectAssignments"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/SkillBridge/Data/Migrations/20250905084435_DescrChange.cs b/src/SkillBridge/Data/Migrations/20250905084435_DescrChange.cs deleted file mode 100644 index 8b43cd8..0000000 --- a/src/SkillBridge/Data/Migrations/20250905084435_DescrChange.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace SkillBridge.Data.Migrations -{ - /// - public partial class DescrChange : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "description", - table: "project_assignments", - type: "character varying(20000)", - maxLength: 20000, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(2000)", - oldMaxLength: 2000, - oldNullable: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "description", - table: "project_assignments", - type: "character varying(2000)", - maxLength: 2000, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(20000)", - oldMaxLength: 20000, - oldNullable: true); - } - } -} diff --git a/src/SkillBridge/Data/Migrations/20250905085120_DescriptionChange.Designer.cs b/src/SkillBridge/Data/Migrations/20250905085120_DescriptionChange.Designer.cs deleted file mode 100644 index 055608f..0000000 --- a/src/SkillBridge/Data/Migrations/20250905085120_DescriptionChange.Designer.cs +++ /dev/null @@ -1,471 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using SkillBridge.Data; - -#nullable disable - -namespace SkillBridge.Data.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20250905085120_DescriptionChange")] - partial class DescriptionChange - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.16") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("SkillBridge.Models.Entities.AssignmentTask", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Description") - .HasMaxLength(2000) - .HasColumnType("character varying(2000)") - .HasColumnName("description"); - - b.Property("IsCompleted") - .HasColumnType("boolean") - .HasColumnName("is_completed"); - - b.Property("ProjectAssignmentId") - .HasColumnType("uuid") - .HasColumnName("project_assignment_id"); - - b.Property("Sequence") - .HasColumnType("integer") - .HasColumnName("sequence"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)") - .HasColumnName("title"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id"); - - b.HasIndex("IsCompleted"); - - b.HasIndex("ProjectAssignmentId"); - - b.HasIndex("Sequence"); - - b.ToTable("assignment_tasks", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.Company", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("About") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("character varying(2000)") - .HasColumnName("about"); - - b.Property("Activities") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("activities"); - - b.Property("Auth0UserId") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)") - .HasColumnName("auth0_user_id"); - - b.Property("BannerUrl") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("banner_url"); - - b.Property("BulgarianOfficeLocations") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("bulgarian_office_locations"); - - b.Property("ContactEmail") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("contact_email"); - - b.Property("ContactName") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasColumnName("contact_name"); - - b.Property("ContactPhone") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasColumnName("contact_phone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("EmployeesInBulgaria") - .HasColumnType("integer") - .HasColumnName("employees_in_bulgaria"); - - b.Property("EmployeesWorldwide") - .HasColumnType("integer") - .HasColumnName("employees_worldwide"); - - b.Property("HasOfficesInBulgaria") - .HasColumnType("boolean") - .HasColumnName("has_offices_in_bulgaria"); - - b.Property("HeadOfficeLocation") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)") - .HasColumnName("head_office_location"); - - b.Property("LogoUrl") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("logo_url"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasColumnName("name"); - - b.Property("Sector") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasColumnName("sector"); - - b.Property("Technologies") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)") - .HasColumnName("technologies"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("WebsiteUrl") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("website_url"); - - b.Property("WhyWorkWithUs") - .HasMaxLength(2000) - .HasColumnType("character varying(2000)") - .HasColumnName("why_work_with_us"); - - b.Property("YearEstablished") - .IsRequired() - .HasColumnType("integer") - .HasColumnName("year_established"); - - b.HasKey("Id"); - - b.HasIndex("Auth0UserId") - .IsUnique(); - - b.HasIndex("Name"); - - b.HasIndex("Sector"); - - b.ToTable("companies", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.ProjectAssignment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CompanyId") - .HasColumnType("uuid") - .HasColumnName("company_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Deadline") - .HasColumnType("timestamp with time zone") - .HasColumnName("deadline"); - - b.Property("Description") - .HasMaxLength(20000) - .HasColumnType("text") - .HasColumnName("description"); - - b.Property("LearningBenefits") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)") - .HasColumnName("learning_benefits"); - - b.Property("Level") - .HasColumnType("integer") - .HasColumnName("level"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("SuggestedApproach") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)") - .HasColumnName("suggested_approach"); - - b.Property("Summary") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("summary"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)") - .HasColumnName("title"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id"); - - b.HasIndex("CompanyId"); - - b.HasIndex("Deadline"); - - b.HasIndex("Level"); - - b.HasIndex("Status"); - - b.ToTable("project_assignments", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.ProjectSkill", b => - { - b.Property("ProjectAssignmentId") - .HasColumnType("uuid") - .HasColumnName("project_assignment_id"); - - b.Property("SkillId") - .HasColumnType("uuid") - .HasColumnName("skill_id"); - - b.HasKey("ProjectAssignmentId", "SkillId"); - - b.HasIndex("SkillId"); - - b.ToTable("project_skills", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.Skill", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("description"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasColumnName("name"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("skills", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.UserProfile", b => - { - b.Property("Id") - .HasColumnType("text") - .HasColumnName("id"); - - b.Property("CVUpload") - .HasColumnType("text") - .HasColumnName("cv_upload"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("GitHubConnection") - .HasColumnType("text") - .HasColumnName("github_connection"); - - b.Property("ProfilePicture") - .HasColumnType("text") - .HasColumnName("profile_picture"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id"); - - b.ToTable("user_profiles", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.UserProjectAssignment", b => - { - b.Property("UserProfileId") - .HasColumnType("text") - .HasColumnName("user_profile_id"); - - b.Property("ProjectAssignmentId") - .HasColumnType("uuid") - .HasColumnName("project_assignment_id"); - - b.Property("ClaimedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("claimed_at"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("completed_at"); - - b.Property("IsCompleted") - .HasColumnType("boolean") - .HasColumnName("is_completed"); - - b.HasKey("UserProfileId", "ProjectAssignmentId"); - - b.HasIndex("ProjectAssignmentId"); - - b.HasIndex("UserProfileId"); - - b.ToTable("user_project_assignments", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.AssignmentTask", b => - { - b.HasOne("SkillBridge.Models.Entities.ProjectAssignment", "ProjectAssignment") - .WithMany("Tasks") - .HasForeignKey("ProjectAssignmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ProjectAssignment"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.ProjectAssignment", b => - { - b.HasOne("SkillBridge.Models.Entities.Company", "Company") - .WithMany("ProjectAssignments") - .HasForeignKey("CompanyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Company"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.ProjectSkill", b => - { - b.HasOne("SkillBridge.Models.Entities.ProjectAssignment", "ProjectAssignment") - .WithMany("ProjectSkills") - .HasForeignKey("ProjectAssignmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("SkillBridge.Models.Entities.Skill", "Skill") - .WithMany("ProjectSkills") - .HasForeignKey("SkillId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ProjectAssignment"); - - b.Navigation("Skill"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.UserProjectAssignment", b => - { - b.HasOne("SkillBridge.Models.Entities.ProjectAssignment", "ProjectAssignment") - .WithMany("UserProjectAssignments") - .HasForeignKey("ProjectAssignmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("SkillBridge.Models.Entities.UserProfile", "UserProfile") - .WithMany("UserProjectAssignments") - .HasForeignKey("UserProfileId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ProjectAssignment"); - - b.Navigation("UserProfile"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.Company", b => - { - b.Navigation("ProjectAssignments"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.ProjectAssignment", b => - { - b.Navigation("ProjectSkills"); - - b.Navigation("Tasks"); - - b.Navigation("UserProjectAssignments"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.Skill", b => - { - b.Navigation("ProjectSkills"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.UserProfile", b => - { - b.Navigation("UserProjectAssignments"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/SkillBridge/Data/Migrations/20250905085120_DescriptionChange.cs b/src/SkillBridge/Data/Migrations/20250905085120_DescriptionChange.cs deleted file mode 100644 index fc8ea82..0000000 --- a/src/SkillBridge/Data/Migrations/20250905085120_DescriptionChange.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace SkillBridge.Data.Migrations -{ - /// - public partial class DescriptionChange : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "description", - table: "project_assignments", - type: "text", - maxLength: 20000, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(20000)", - oldMaxLength: 20000, - oldNullable: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "description", - table: "project_assignments", - type: "character varying(20000)", - maxLength: 20000, - nullable: true, - oldClrType: typeof(string), - oldType: "text", - oldMaxLength: 20000, - oldNullable: true); - } - } -} diff --git a/src/SkillBridge/Data/Migrations/20250905090219_DescriptionChange2.Designer.cs b/src/SkillBridge/Data/Migrations/20250905090219_DescriptionChange2.Designer.cs deleted file mode 100644 index 96a36cb..0000000 --- a/src/SkillBridge/Data/Migrations/20250905090219_DescriptionChange2.Designer.cs +++ /dev/null @@ -1,467 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using SkillBridge.Data; - -#nullable disable - -namespace SkillBridge.Data.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20250905090219_DescriptionChange2")] - partial class DescriptionChange2 - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.16") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("SkillBridge.Models.Entities.AssignmentTask", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Description") - .HasMaxLength(2000) - .HasColumnType("character varying(2000)") - .HasColumnName("description"); - - b.Property("IsCompleted") - .HasColumnType("boolean") - .HasColumnName("is_completed"); - - b.Property("ProjectAssignmentId") - .HasColumnType("uuid") - .HasColumnName("project_assignment_id"); - - b.Property("Sequence") - .HasColumnType("integer") - .HasColumnName("sequence"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)") - .HasColumnName("title"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id"); - - b.HasIndex("IsCompleted"); - - b.HasIndex("ProjectAssignmentId"); - - b.HasIndex("Sequence"); - - b.ToTable("assignment_tasks", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.Company", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("About") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("character varying(2000)") - .HasColumnName("about"); - - b.Property("Activities") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("activities"); - - b.Property("Auth0UserId") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)") - .HasColumnName("auth0_user_id"); - - b.Property("BannerUrl") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("banner_url"); - - b.Property("BulgarianOfficeLocations") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("bulgarian_office_locations"); - - b.Property("ContactEmail") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)") - .HasColumnName("contact_email"); - - b.Property("ContactName") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasColumnName("contact_name"); - - b.Property("ContactPhone") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasColumnName("contact_phone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("EmployeesInBulgaria") - .HasColumnType("integer") - .HasColumnName("employees_in_bulgaria"); - - b.Property("EmployeesWorldwide") - .HasColumnType("integer") - .HasColumnName("employees_worldwide"); - - b.Property("HasOfficesInBulgaria") - .HasColumnType("boolean") - .HasColumnName("has_offices_in_bulgaria"); - - b.Property("HeadOfficeLocation") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)") - .HasColumnName("head_office_location"); - - b.Property("LogoUrl") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("logo_url"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasColumnName("name"); - - b.Property("Sector") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasColumnName("sector"); - - b.Property("Technologies") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)") - .HasColumnName("technologies"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.Property("WebsiteUrl") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("website_url"); - - b.Property("WhyWorkWithUs") - .HasMaxLength(2000) - .HasColumnType("character varying(2000)") - .HasColumnName("why_work_with_us"); - - b.Property("YearEstablished") - .IsRequired() - .HasColumnType("integer") - .HasColumnName("year_established"); - - b.HasKey("Id"); - - b.HasIndex("Auth0UserId") - .IsUnique(); - - b.HasIndex("Name"); - - b.HasIndex("Sector"); - - b.ToTable("companies", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.ProjectAssignment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("CompanyId") - .HasColumnType("uuid") - .HasColumnName("company_id"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("Deadline") - .HasColumnType("timestamp with time zone") - .HasColumnName("deadline"); - - b.Property("Description") - .HasColumnType("text") - .HasColumnName("description"); - - b.Property("LearningBenefits") - .IsRequired() - .HasColumnType("text") - .HasColumnName("learning_benefits"); - - b.Property("Level") - .HasColumnType("integer") - .HasColumnName("level"); - - b.Property("Status") - .HasColumnType("integer") - .HasColumnName("status"); - - b.Property("SuggestedApproach") - .IsRequired() - .HasColumnType("text") - .HasColumnName("suggested_approach"); - - b.Property("Summary") - .IsRequired() - .HasColumnType("text") - .HasColumnName("summary"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)") - .HasColumnName("title"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id"); - - b.HasIndex("CompanyId"); - - b.HasIndex("Deadline"); - - b.HasIndex("Level"); - - b.HasIndex("Status"); - - b.ToTable("project_assignments", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.ProjectSkill", b => - { - b.Property("ProjectAssignmentId") - .HasColumnType("uuid") - .HasColumnName("project_assignment_id"); - - b.Property("SkillId") - .HasColumnType("uuid") - .HasColumnName("skill_id"); - - b.HasKey("ProjectAssignmentId", "SkillId"); - - b.HasIndex("SkillId"); - - b.ToTable("project_skills", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.Skill", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasColumnName("id"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasColumnName("description"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasColumnName("name"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("skills", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.UserProfile", b => - { - b.Property("Id") - .HasColumnType("text") - .HasColumnName("id"); - - b.Property("CVUpload") - .HasColumnType("text") - .HasColumnName("cv_upload"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("created_at"); - - b.Property("GitHubConnection") - .HasColumnType("text") - .HasColumnName("github_connection"); - - b.Property("ProfilePicture") - .HasColumnType("text") - .HasColumnName("profile_picture"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("updated_at"); - - b.HasKey("Id"); - - b.ToTable("user_profiles", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.UserProjectAssignment", b => - { - b.Property("UserProfileId") - .HasColumnType("text") - .HasColumnName("user_profile_id"); - - b.Property("ProjectAssignmentId") - .HasColumnType("uuid") - .HasColumnName("project_assignment_id"); - - b.Property("ClaimedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("claimed_at"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone") - .HasColumnName("completed_at"); - - b.Property("IsCompleted") - .HasColumnType("boolean") - .HasColumnName("is_completed"); - - b.HasKey("UserProfileId", "ProjectAssignmentId"); - - b.HasIndex("ProjectAssignmentId"); - - b.HasIndex("UserProfileId"); - - b.ToTable("user_project_assignments", (string)null); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.AssignmentTask", b => - { - b.HasOne("SkillBridge.Models.Entities.ProjectAssignment", "ProjectAssignment") - .WithMany("Tasks") - .HasForeignKey("ProjectAssignmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ProjectAssignment"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.ProjectAssignment", b => - { - b.HasOne("SkillBridge.Models.Entities.Company", "Company") - .WithMany("ProjectAssignments") - .HasForeignKey("CompanyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Company"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.ProjectSkill", b => - { - b.HasOne("SkillBridge.Models.Entities.ProjectAssignment", "ProjectAssignment") - .WithMany("ProjectSkills") - .HasForeignKey("ProjectAssignmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("SkillBridge.Models.Entities.Skill", "Skill") - .WithMany("ProjectSkills") - .HasForeignKey("SkillId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ProjectAssignment"); - - b.Navigation("Skill"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.UserProjectAssignment", b => - { - b.HasOne("SkillBridge.Models.Entities.ProjectAssignment", "ProjectAssignment") - .WithMany("UserProjectAssignments") - .HasForeignKey("ProjectAssignmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("SkillBridge.Models.Entities.UserProfile", "UserProfile") - .WithMany("UserProjectAssignments") - .HasForeignKey("UserProfileId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ProjectAssignment"); - - b.Navigation("UserProfile"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.Company", b => - { - b.Navigation("ProjectAssignments"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.ProjectAssignment", b => - { - b.Navigation("ProjectSkills"); - - b.Navigation("Tasks"); - - b.Navigation("UserProjectAssignments"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.Skill", b => - { - b.Navigation("ProjectSkills"); - }); - - modelBuilder.Entity("SkillBridge.Models.Entities.UserProfile", b => - { - b.Navigation("UserProjectAssignments"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/SkillBridge/Data/Migrations/20250905090219_DescriptionChange2.cs b/src/SkillBridge/Data/Migrations/20250905090219_DescriptionChange2.cs deleted file mode 100644 index 7e02e86..0000000 --- a/src/SkillBridge/Data/Migrations/20250905090219_DescriptionChange2.cs +++ /dev/null @@ -1,72 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace SkillBridge.Data.Migrations -{ - /// - public partial class DescriptionChange2 : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "summary", - table: "project_assignments", - type: "text", - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(500)", - oldMaxLength: 500); - - migrationBuilder.AlterColumn( - name: "suggested_approach", - table: "project_assignments", - type: "text", - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(1000)", - oldMaxLength: 1000); - - migrationBuilder.AlterColumn( - name: "learning_benefits", - table: "project_assignments", - type: "text", - nullable: false, - oldClrType: typeof(string), - oldType: "character varying(1000)", - oldMaxLength: 1000); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "summary", - table: "project_assignments", - type: "character varying(500)", - maxLength: 500, - nullable: false, - oldClrType: typeof(string), - oldType: "text"); - - migrationBuilder.AlterColumn( - name: "suggested_approach", - table: "project_assignments", - type: "character varying(1000)", - maxLength: 1000, - nullable: false, - oldClrType: typeof(string), - oldType: "text"); - - migrationBuilder.AlterColumn( - name: "learning_benefits", - table: "project_assignments", - type: "character varying(1000)", - maxLength: 1000, - nullable: false, - oldClrType: typeof(string), - oldType: "text"); - } - } -} diff --git a/src/SkillBridge/Data/Migrations/20251003152817_AddDeadlineAndChangeToDuration.cs b/src/SkillBridge/Data/Migrations/20251003152817_AddDeadlineAndChangeToDuration.cs deleted file mode 100644 index 1d0bb8b..0000000 --- a/src/SkillBridge/Data/Migrations/20251003152817_AddDeadlineAndChangeToDuration.cs +++ /dev/null @@ -1,90 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace SkillBridge.Data.Migrations -{ - /// - public partial class AddDeadlineAndChangeToDuration : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropIndex( - name: "IX_project_assignments_deadline", - table: "project_assignments"); - - migrationBuilder.DropColumn( - name: "deadline", - table: "project_assignments"); - - migrationBuilder.AddColumn( - name: "Deadline", - table: "user_project_assignments", - type: "timestamp with time zone", - nullable: false, - defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); - - migrationBuilder.AddColumn( - name: "duration", - table: "project_assignments", - type: "interval", - nullable: false, - defaultValue: new TimeSpan(0, 0, 0, 0, 0)); - - migrationBuilder.AlterColumn( - name: "logo_url", - table: "companies", - type: "text", - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(500)", - oldMaxLength: 500, - oldNullable: true); - - migrationBuilder.CreateIndex( - name: "IX_project_assignments_duration", - table: "project_assignments", - column: "duration"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropIndex( - name: "IX_project_assignments_duration", - table: "project_assignments"); - - migrationBuilder.DropColumn( - name: "Deadline", - table: "user_project_assignments"); - - migrationBuilder.DropColumn( - name: "duration", - table: "project_assignments"); - - migrationBuilder.AddColumn( - name: "deadline", - table: "project_assignments", - type: "timestamp with time zone", - nullable: false, - defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); - - migrationBuilder.AlterColumn( - name: "logo_url", - table: "companies", - type: "character varying(500)", - maxLength: 500, - nullable: true, - oldClrType: typeof(string), - oldType: "text", - oldNullable: true); - - migrationBuilder.CreateIndex( - name: "IX_project_assignments_deadline", - table: "project_assignments", - column: "deadline"); - } - } -} diff --git a/src/SkillBridge/Data/Migrations/20251003152817_AddDeadlineAndChangeToDuration.Designer.cs b/src/SkillBridge/Migrations/20251016125626_InitialRebuild.Designer.cs similarity index 85% rename from src/SkillBridge/Data/Migrations/20251003152817_AddDeadlineAndChangeToDuration.Designer.cs rename to src/SkillBridge/Migrations/20251016125626_InitialRebuild.Designer.cs index 985b17d..b17721b 100644 --- a/src/SkillBridge/Data/Migrations/20251003152817_AddDeadlineAndChangeToDuration.Designer.cs +++ b/src/SkillBridge/Migrations/20251016125626_InitialRebuild.Designer.cs @@ -9,11 +9,11 @@ #nullable disable -namespace SkillBridge.Data.Migrations +namespace SkillBridge.Migrations { [DbContext(typeof(AppDbContext))] - [Migration("20251003152817_AddDeadlineAndChangeToDuration")] - partial class AddDeadlineAndChangeToDuration + [Migration("20251016125626_InitialRebuild")] + partial class InitialRebuild { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -41,10 +41,6 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("character varying(2000)") .HasColumnName("description"); - b.Property("IsCompleted") - .HasColumnType("boolean") - .HasColumnName("is_completed"); - b.Property("ProjectAssignmentId") .HasColumnType("uuid") .HasColumnName("project_assignment_id"); @@ -65,8 +61,6 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id"); - b.HasIndex("IsCompleted"); - b.HasIndex("ProjectAssignmentId"); b.HasIndex("Sequence"); @@ -263,8 +257,6 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasIndex("CompanyId"); - b.HasIndex("Duration"); - b.HasIndex("Level"); b.HasIndex("Status"); @@ -315,6 +307,37 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.ToTable("skills", (string)null); }); + modelBuilder.Entity("SkillBridge.Models.Entities.UserAssignmentTask", b => + { + b.Property("UserProfileId") + .HasColumnType("text") + .HasColumnName("user_profile_id"); + + b.Property("ProjectAssignmentId") + .HasColumnType("uuid") + .HasColumnName("project_assignment_id"); + + b.Property("AssignmentTaskId") + .HasColumnType("uuid") + .HasColumnName("assignment_task_id"); + + b.Property("IsCompleted") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false) + .HasColumnName("is_completed"); + + b.HasKey("UserProfileId", "ProjectAssignmentId", "AssignmentTaskId"); + + b.HasIndex("AssignmentTaskId") + .HasDatabaseName("ix_user_assignment_tasks_assignment_task_id"); + + b.HasIndex("UserProfileId", "ProjectAssignmentId") + .HasDatabaseName("ix_user_assignment_tasks_user_project"); + + b.ToTable("user_assignment_tasks", (string)null); + }); + modelBuilder.Entity("SkillBridge.Models.Entities.UserProfile", b => { b.Property("Id") @@ -364,13 +387,22 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("timestamp with time zone") .HasColumnName("completed_at"); + b.Property("CompletedTasks") + .HasColumnType("integer") + .HasColumnName("completed_tasks"); + b.Property("Deadline") - .HasColumnType("timestamp with time zone"); + .HasColumnType("timestamp with time zone") + .HasColumnName("deadline"); b.Property("IsCompleted") .HasColumnType("boolean") .HasColumnName("is_completed"); + b.Property("TotalTasks") + .HasColumnType("integer") + .HasColumnName("total_tasks"); + b.HasKey("UserProfileId", "ProjectAssignmentId"); b.HasIndex("ProjectAssignmentId"); @@ -421,6 +453,25 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Navigation("Skill"); }); + modelBuilder.Entity("SkillBridge.Models.Entities.UserAssignmentTask", b => + { + b.HasOne("SkillBridge.Models.Entities.AssignmentTask", "AssignmentTask") + .WithMany("UserAssignmentTasks") + .HasForeignKey("AssignmentTaskId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SkillBridge.Models.Entities.UserProjectAssignment", "UserProjectAssignment") + .WithMany("UserAssignmentTasks") + .HasForeignKey("UserProfileId", "ProjectAssignmentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("AssignmentTask"); + + b.Navigation("UserProjectAssignment"); + }); + modelBuilder.Entity("SkillBridge.Models.Entities.UserProjectAssignment", b => { b.HasOne("SkillBridge.Models.Entities.ProjectAssignment", "ProjectAssignment") @@ -440,6 +491,11 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Navigation("UserProfile"); }); + modelBuilder.Entity("SkillBridge.Models.Entities.AssignmentTask", b => + { + b.Navigation("UserAssignmentTasks"); + }); + modelBuilder.Entity("SkillBridge.Models.Entities.Company", b => { b.Navigation("ProjectAssignments"); @@ -463,6 +519,11 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) { b.Navigation("UserProjectAssignments"); }); + + modelBuilder.Entity("SkillBridge.Models.Entities.UserProjectAssignment", b => + { + b.Navigation("UserAssignmentTasks"); + }); #pragma warning restore 612, 618 } } diff --git a/src/SkillBridge/Migrations/20251016125626_InitialRebuild.cs b/src/SkillBridge/Migrations/20251016125626_InitialRebuild.cs new file mode 100644 index 0000000..6c10ee3 --- /dev/null +++ b/src/SkillBridge/Migrations/20251016125626_InitialRebuild.cs @@ -0,0 +1,307 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace SkillBridge.Migrations +{ + /// + public partial class InitialRebuild : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "companies", + columns: table => new + { + id = table.Column(type: "uuid", nullable: false), + name = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), + about = table.Column(type: "character varying(2000)", maxLength: 2000, nullable: false), + logo_url = table.Column(type: "text", nullable: true), + banner_url = table.Column(type: "character varying(500)", maxLength: 500, nullable: true), + activities = table.Column(type: "character varying(500)", maxLength: 500, nullable: false), + sector = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), + head_office_location = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), + technologies = table.Column(type: "character varying(1000)", maxLength: 1000, nullable: false), + year_established = table.Column(type: "integer", nullable: false), + has_offices_in_bulgaria = table.Column(type: "boolean", nullable: false), + bulgarian_office_locations = table.Column(type: "character varying(500)", maxLength: 500, nullable: true), + employees_in_bulgaria = table.Column(type: "integer", nullable: true), + employees_worldwide = table.Column(type: "integer", nullable: false), + why_work_with_us = table.Column(type: "character varying(2000)", maxLength: 2000, nullable: true), + website_url = table.Column(type: "character varying(500)", maxLength: 500, nullable: false), + contact_name = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), + contact_email = table.Column(type: "character varying(255)", maxLength: 255, nullable: false), + contact_phone = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), + auth0_user_id = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), + created_at = table.Column(type: "timestamp with time zone", nullable: false), + updated_at = table.Column(type: "timestamp with time zone", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_companies", x => x.id); + }); + + migrationBuilder.CreateTable( + name: "skills", + columns: table => new + { + id = table.Column(type: "uuid", nullable: false), + name = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), + description = table.Column(type: "character varying(500)", maxLength: 500, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_skills", x => x.id); + }); + + migrationBuilder.CreateTable( + name: "user_profiles", + columns: table => new + { + id = table.Column(type: "text", nullable: false), + created_at = table.Column(type: "timestamp with time zone", nullable: false), + updated_at = table.Column(type: "timestamp with time zone", nullable: true), + profile_picture = table.Column(type: "text", nullable: true), + cv_upload = table.Column(type: "text", nullable: true), + github_connection = table.Column(type: "text", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_user_profiles", x => x.id); + }); + + migrationBuilder.CreateTable( + name: "project_assignments", + columns: table => new + { + id = table.Column(type: "uuid", nullable: false), + title = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), + description = table.Column(type: "text", nullable: true), + summary = table.Column(type: "text", nullable: false), + learning_benefits = table.Column(type: "text", nullable: false), + suggested_approach = table.Column(type: "text", nullable: false), + level = table.Column(type: "integer", nullable: false), + duration = table.Column(type: "interval", nullable: false), + status = table.Column(type: "integer", nullable: false), + company_id = table.Column(type: "uuid", nullable: false), + created_at = table.Column(type: "timestamp with time zone", nullable: false), + updated_at = table.Column(type: "timestamp with time zone", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_project_assignments", x => x.id); + table.ForeignKey( + name: "FK_project_assignments_companies_company_id", + column: x => x.company_id, + principalTable: "companies", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "assignment_tasks", + columns: table => new + { + id = table.Column(type: "uuid", nullable: false), + title = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), + description = table.Column(type: "character varying(2000)", maxLength: 2000, nullable: true), + sequence = table.Column(type: "integer", nullable: false), + project_assignment_id = table.Column(type: "uuid", nullable: false), + created_at = table.Column(type: "timestamp with time zone", nullable: false), + updated_at = table.Column(type: "timestamp with time zone", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_assignment_tasks", x => x.id); + table.ForeignKey( + name: "FK_assignment_tasks_project_assignments_project_assignment_id", + column: x => x.project_assignment_id, + principalTable: "project_assignments", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "project_skills", + columns: table => new + { + project_assignment_id = table.Column(type: "uuid", nullable: false), + skill_id = table.Column(type: "uuid", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_project_skills", x => new { x.project_assignment_id, x.skill_id }); + table.ForeignKey( + name: "FK_project_skills_project_assignments_project_assignment_id", + column: x => x.project_assignment_id, + principalTable: "project_assignments", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_project_skills_skills_skill_id", + column: x => x.skill_id, + principalTable: "skills", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "user_project_assignments", + columns: table => new + { + user_profile_id = table.Column(type: "text", nullable: false), + project_assignment_id = table.Column(type: "uuid", nullable: false), + claimed_at = table.Column(type: "timestamp with time zone", nullable: false), + is_completed = table.Column(type: "boolean", nullable: false), + completed_at = table.Column(type: "timestamp with time zone", nullable: true), + deadline = table.Column(type: "timestamp with time zone", nullable: false), + total_tasks = table.Column(type: "integer", nullable: false), + completed_tasks = table.Column(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_user_project_assignments", x => new { x.user_profile_id, x.project_assignment_id }); + table.ForeignKey( + name: "FK_user_project_assignments_project_assignments_project_assign~", + column: x => x.project_assignment_id, + principalTable: "project_assignments", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_user_project_assignments_user_profiles_user_profile_id", + column: x => x.user_profile_id, + principalTable: "user_profiles", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "user_assignment_tasks", + columns: table => new + { + assignment_task_id = table.Column(type: "uuid", nullable: false), + project_assignment_id = table.Column(type: "uuid", nullable: false), + user_profile_id = table.Column(type: "text", nullable: false), + is_completed = table.Column(type: "boolean", nullable: false, defaultValue: false) + }, + constraints: table => + { + table.PrimaryKey("PK_user_assignment_tasks", x => new { x.user_profile_id, x.project_assignment_id, x.assignment_task_id }); + table.ForeignKey( + name: "FK_user_assignment_tasks_assignment_tasks_assignment_task_id", + column: x => x.assignment_task_id, + principalTable: "assignment_tasks", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_user_assignment_tasks_user_project_assignments_user_profile~", + columns: x => new { x.user_profile_id, x.project_assignment_id }, + principalTable: "user_project_assignments", + principalColumns: new[] { "user_profile_id", "project_assignment_id" }, + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_assignment_tasks_project_assignment_id", + table: "assignment_tasks", + column: "project_assignment_id"); + + migrationBuilder.CreateIndex( + name: "IX_assignment_tasks_sequence", + table: "assignment_tasks", + column: "sequence"); + + migrationBuilder.CreateIndex( + name: "IX_companies_auth0_user_id", + table: "companies", + column: "auth0_user_id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_companies_name", + table: "companies", + column: "name"); + + migrationBuilder.CreateIndex( + name: "IX_companies_sector", + table: "companies", + column: "sector"); + + migrationBuilder.CreateIndex( + name: "IX_project_assignments_company_id", + table: "project_assignments", + column: "company_id"); + + migrationBuilder.CreateIndex( + name: "IX_project_assignments_level", + table: "project_assignments", + column: "level"); + + migrationBuilder.CreateIndex( + name: "IX_project_assignments_status", + table: "project_assignments", + column: "status"); + + migrationBuilder.CreateIndex( + name: "IX_project_skills_skill_id", + table: "project_skills", + column: "skill_id"); + + migrationBuilder.CreateIndex( + name: "IX_skills_name", + table: "skills", + column: "name", + unique: true); + + migrationBuilder.CreateIndex( + name: "ix_user_assignment_tasks_assignment_task_id", + table: "user_assignment_tasks", + column: "assignment_task_id"); + + migrationBuilder.CreateIndex( + name: "ix_user_assignment_tasks_user_project", + table: "user_assignment_tasks", + columns: new[] { "user_profile_id", "project_assignment_id" }); + + migrationBuilder.CreateIndex( + name: "IX_user_project_assignments_project_assignment_id", + table: "user_project_assignments", + column: "project_assignment_id"); + + migrationBuilder.CreateIndex( + name: "IX_user_project_assignments_user_profile_id", + table: "user_project_assignments", + column: "user_profile_id"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "project_skills"); + + migrationBuilder.DropTable( + name: "user_assignment_tasks"); + + migrationBuilder.DropTable( + name: "skills"); + + migrationBuilder.DropTable( + name: "assignment_tasks"); + + migrationBuilder.DropTable( + name: "user_project_assignments"); + + migrationBuilder.DropTable( + name: "project_assignments"); + + migrationBuilder.DropTable( + name: "user_profiles"); + + migrationBuilder.DropTable( + name: "companies"); + } + } +} diff --git a/src/SkillBridge/Data/Migrations/AppDbContextModelSnapshot.cs b/src/SkillBridge/Migrations/AppDbContextModelSnapshot.cs similarity index 86% rename from src/SkillBridge/Data/Migrations/AppDbContextModelSnapshot.cs rename to src/SkillBridge/Migrations/AppDbContextModelSnapshot.cs index 938a64a..a88fe69 100644 --- a/src/SkillBridge/Data/Migrations/AppDbContextModelSnapshot.cs +++ b/src/SkillBridge/Migrations/AppDbContextModelSnapshot.cs @@ -4,11 +4,11 @@ using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - +using SkillBridge.Data; #nullable disable -namespace SkillBridge.Data.Migrations +namespace SkillBridge.Migrations { [DbContext(typeof(AppDbContext))] partial class AppDbContextModelSnapshot : ModelSnapshot @@ -38,10 +38,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("character varying(2000)") .HasColumnName("description"); - b.Property("IsCompleted") - .HasColumnType("boolean") - .HasColumnName("is_completed"); - b.Property("ProjectAssignmentId") .HasColumnType("uuid") .HasColumnName("project_assignment_id"); @@ -62,8 +58,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasKey("Id"); - b.HasIndex("IsCompleted"); - b.HasIndex("ProjectAssignmentId"); b.HasIndex("Sequence"); @@ -221,7 +215,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("Duration") .HasColumnType("interval") - .HasColumnName("Duration"); + .HasColumnName("duration"); b.Property("LearningBenefits") .IsRequired() @@ -260,8 +254,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("CompanyId"); - b.HasIndex("Duration"); - b.HasIndex("Level"); b.HasIndex("Status"); @@ -312,6 +304,37 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("skills", (string)null); }); + modelBuilder.Entity("SkillBridge.Models.Entities.UserAssignmentTask", b => + { + b.Property("UserProfileId") + .HasColumnType("text") + .HasColumnName("user_profile_id"); + + b.Property("ProjectAssignmentId") + .HasColumnType("uuid") + .HasColumnName("project_assignment_id"); + + b.Property("AssignmentTaskId") + .HasColumnType("uuid") + .HasColumnName("assignment_task_id"); + + b.Property("IsCompleted") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false) + .HasColumnName("is_completed"); + + b.HasKey("UserProfileId", "ProjectAssignmentId", "AssignmentTaskId"); + + b.HasIndex("AssignmentTaskId") + .HasDatabaseName("ix_user_assignment_tasks_assignment_task_id"); + + b.HasIndex("UserProfileId", "ProjectAssignmentId") + .HasDatabaseName("ix_user_assignment_tasks_user_project"); + + b.ToTable("user_assignment_tasks", (string)null); + }); + modelBuilder.Entity("SkillBridge.Models.Entities.UserProfile", b => { b.Property("Id") @@ -361,6 +384,10 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("timestamp with time zone") .HasColumnName("completed_at"); + b.Property("CompletedTasks") + .HasColumnType("integer") + .HasColumnName("completed_tasks"); + b.Property("Deadline") .HasColumnType("timestamp with time zone") .HasColumnName("deadline"); @@ -369,6 +396,10 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("boolean") .HasColumnName("is_completed"); + b.Property("TotalTasks") + .HasColumnType("integer") + .HasColumnName("total_tasks"); + b.HasKey("UserProfileId", "ProjectAssignmentId"); b.HasIndex("ProjectAssignmentId"); @@ -419,6 +450,25 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("Skill"); }); + modelBuilder.Entity("SkillBridge.Models.Entities.UserAssignmentTask", b => + { + b.HasOne("SkillBridge.Models.Entities.AssignmentTask", "AssignmentTask") + .WithMany("UserAssignmentTasks") + .HasForeignKey("AssignmentTaskId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SkillBridge.Models.Entities.UserProjectAssignment", "UserProjectAssignment") + .WithMany("UserAssignmentTasks") + .HasForeignKey("UserProfileId", "ProjectAssignmentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("AssignmentTask"); + + b.Navigation("UserProjectAssignment"); + }); + modelBuilder.Entity("SkillBridge.Models.Entities.UserProjectAssignment", b => { b.HasOne("SkillBridge.Models.Entities.ProjectAssignment", "ProjectAssignment") @@ -438,6 +488,11 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("UserProfile"); }); + modelBuilder.Entity("SkillBridge.Models.Entities.AssignmentTask", b => + { + b.Navigation("UserAssignmentTasks"); + }); + modelBuilder.Entity("SkillBridge.Models.Entities.Company", b => { b.Navigation("ProjectAssignments"); @@ -461,6 +516,11 @@ protected override void BuildModel(ModelBuilder modelBuilder) { b.Navigation("UserProjectAssignments"); }); + + modelBuilder.Entity("SkillBridge.Models.Entities.UserProjectAssignment", b => + { + b.Navigation("UserAssignmentTasks"); + }); #pragma warning restore 612, 618 } } diff --git a/src/SkillBridge/Models/Entities/AssignmentTask.cs b/src/SkillBridge/Models/Entities/AssignmentTask.cs index c08034a..60ed979 100644 --- a/src/SkillBridge/Models/Entities/AssignmentTask.cs +++ b/src/SkillBridge/Models/Entities/AssignmentTask.cs @@ -24,10 +24,7 @@ public class AssignmentTask /// public string? Description { get; set; } - /// - /// Gets or sets whether the task is completed - /// - public bool IsCompleted { get; set; } = false; + /// /// Gets or sets the sequence number of the task (for ordering) @@ -57,5 +54,10 @@ public class AssignmentTask /// [JsonSchemaIgnore] public DateTime? UpdatedAt { get; set; } + + /// + /// Gets or sets the collection of tasks belonging to this project assignment + /// + public ICollection UserAssignmentTasks { get; set; } = new List(); } } \ No newline at end of file diff --git a/src/SkillBridge/Models/Entities/UserAssignmentTask.cs b/src/SkillBridge/Models/Entities/UserAssignmentTask.cs new file mode 100644 index 0000000..66c225b --- /dev/null +++ b/src/SkillBridge/Models/Entities/UserAssignmentTask.cs @@ -0,0 +1,18 @@ +using NJsonSchema.Annotations; + +namespace SkillBridge.Models.Entities +{ + public class UserAssignmentTask + { + [JsonSchemaIgnore] public Guid AssignmentTaskId { get; set; } + [JsonSchemaIgnore] public AssignmentTask? AssignmentTask { get; set; } + + [JsonSchemaIgnore] public Guid ProjectAssignmentId { get; set; } + [JsonSchemaIgnore] public string UserProfileId { get; set; } = default!; + + // principal: the row in user_project_assignments + [JsonSchemaIgnore] public UserProjectAssignment? UserProjectAssignment { get; set; } + + public bool IsCompleted { get; set; } = false; + } +} diff --git a/src/SkillBridge/Models/Entities/UserProjectAssignment.cs b/src/SkillBridge/Models/Entities/UserProjectAssignment.cs index 4f8ac31..b9bdc92 100644 --- a/src/SkillBridge/Models/Entities/UserProjectAssignment.cs +++ b/src/SkillBridge/Models/Entities/UserProjectAssignment.cs @@ -48,4 +48,13 @@ public class UserProjectAssignment public DateTime? CompletedAt { get; set; } public DateTime Deadline { get; set; } + + public int TotalTasks { get; set; } + + public int CompletedTasks { get; set; } + + /// + /// Gets or sets the collection of tasks belonging to this project assignment + /// + public ICollection UserAssignmentTasks { get; set; } = new List(); } \ No newline at end of file diff --git a/src/SkillBridge/Models/Response/AssignmentTaskResponse.cs b/src/SkillBridge/Models/Response/AssignmentTaskResponse.cs index 2dc82f0..9da2b0e 100644 --- a/src/SkillBridge/Models/Response/AssignmentTaskResponse.cs +++ b/src/SkillBridge/Models/Response/AssignmentTaskResponse.cs @@ -1,3 +1,5 @@ +using SkillBridge.Models.Entities; + namespace SkillBridge.Models.Response; /// @@ -24,6 +26,7 @@ public class AssignmentTaskResponse /// Gets or sets whether the task is completed /// public bool IsCompleted { get; set; } + /// /// Gets or sets the sequence number of the task (for ordering) diff --git a/src/SkillBridge/Services/ProjectAssignment/ProjectAssignmentService.cs b/src/SkillBridge/Services/ProjectAssignment/ProjectAssignmentService.cs index 1a8711a..780922c 100644 --- a/src/SkillBridge/Services/ProjectAssignment/ProjectAssignmentService.cs +++ b/src/SkillBridge/Services/ProjectAssignment/ProjectAssignmentService.cs @@ -9,7 +9,9 @@ using SkillBridge.Models.Request; using SkillBridge.Models.Response; using SkillBridge.Models.Specifications; +using SkillBridge.Services.CurrentUser; using SkillBridge.Services.Skill; +using static SkillBridge.Infrastructure.Validation.ValidationConstants; namespace SkillBridge.Services.ProjectAssignment; @@ -22,6 +24,7 @@ public class ProjectAssignmentService : IProjectAssignmentService private readonly IMapper _mapper; private readonly ILogger _logger; private readonly ISkillService _skillService; + private readonly ICurrentUser _currentUser; /// /// Initializes a new instance of the class. @@ -30,12 +33,14 @@ public ProjectAssignmentService( AppDbContext dbContext, IMapper mapper, ILogger logger, - ISkillService skillService) + ISkillService skillService, + ICurrentUser current) { _dbContext = dbContext; _mapper = mapper; _logger = logger; _skillService = skillService; + _currentUser = current; } /// @@ -52,7 +57,7 @@ public async Task CreateAsync(Guid companyId, CreateP _logger.LogWarning("Company with ID {CompanyId} not found", companyId); throw new EntityNotFoundException("Company", companyId); } - + // Get or create skills by names using SkillService List skillIds = new(); if (request.Skills.Any()) @@ -67,7 +72,7 @@ public async Task CreateAsync(Guid companyId, CreateP // Prepare project skills if any skills are specified if (skillIds.Any()) { - projectAssignment.ProjectSkills = skillIds.Select(skillId => new ProjectSkill + projectAssignment.ProjectSkills = skillIds.Select(skillId => new Models.Entities.ProjectSkill { SkillId = skillId }).ToList(); @@ -80,7 +85,7 @@ public async Task CreateAsync(Guid companyId, CreateP projectAssignment.Tasks = request.Tasks.Select(taskRequest => { - var task = _mapper.Map(taskRequest); + var task = _mapper.Map(taskRequest); // No need to set ProjectAssignmentId as EF Core will handle this return task; }).ToList(); @@ -199,7 +204,7 @@ public async Task UpdateAsync(Guid id, UpdateProjectA // Update basic properties _mapper.Map(request, projectAssignment); projectAssignment.UpdatedAt = DateTime.UtcNow; - + // Get or create skills by names using SkillService List skillIds = new(); if (request.Skills.Any()) @@ -209,10 +214,10 @@ public async Task UpdateAsync(Guid id, UpdateProjectA // Update skills - remove existing and add new ones _dbContext.ProjectSkills.RemoveRange(projectAssignment.ProjectSkills); - + if (skillIds.Any()) { - var projectSkills = skillIds.Select(skillId => new ProjectSkill + var projectSkills = skillIds.Select(skillId => new Models.Entities.ProjectSkill { ProjectAssignmentId = projectAssignment.Id, SkillId = skillId @@ -274,7 +279,7 @@ public async Task CreateTaskAsync(Guid projectId, Create } // Create the task - var task = _mapper.Map(request); + var task = _mapper.Map(request); task.ProjectAssignmentId = projectId; // Save the task @@ -439,14 +444,47 @@ public async Task CompleteTaskAsync(Guid projectId, Guid throw new EntityNotFoundException("AssignmentTask", taskId); } - if (task.IsCompleted == false) + var auth0UserId = _currentUser.GetUserId(); + _logger.LogInformation("Updating profile with ID: {UserProfileId}", auth0UserId); + + var userAssignmentTask = await _dbContext.UserAssignmentTasks + .FirstOrDefaultAsync(uat => uat.ProjectAssignmentId == projectId + && uat.AssignmentTaskId == taskId + && uat.UserProfileId == auth0UserId); + + + + //if (userAssignmentTask.IsCompleted == false) + //{ + // userAssignmentTask.IsCompleted = true; + //} + //else if (userAssignmentTask.IsCompleted == true) + //{ + // userAssignmentTask.IsCompleted = false; + //} + + if (userAssignmentTask is null) { - task.IsCompleted = true; + // Optional: verify the user is assigned to this project before creating the row + var isAssigned = await _dbContext.UserProjectAssignments + .AnyAsync(a => a.UserProfileId == auth0UserId && a.ProjectAssignmentId == projectId); + if (!isAssigned) + throw new InvalidOperationException("User is not assigned to this project."); + + userAssignmentTask = new UserAssignmentTask + { + UserProfileId = auth0UserId, + ProjectAssignmentId = projectId, + AssignmentTaskId = taskId, + IsCompleted = true // first toggle sets it completed + }; + _dbContext.UserAssignmentTasks.Add(userAssignmentTask); } - else if (task.IsCompleted == true) + else { - task.IsCompleted = false; + userAssignmentTask.IsCompleted = !userAssignmentTask.IsCompleted; // toggle } + task.UpdatedAt = DateTime.UtcNow; _dbContext.AssignmentTasks.Update(task); @@ -455,7 +493,10 @@ public async Task CompleteTaskAsync(Guid projectId, Guid _logger.LogInformation("Task updated successfully with ID: {TaskId} for project assignment ID: {ProjectAssignmentId}", taskId, projectId); - return _mapper.Map(task); + var response = _mapper.Map(task); + response.IsCompleted = userAssignmentTask.IsCompleted; + + return response; } /// diff --git a/src/SkillBridge/SkillBridge.csproj b/src/SkillBridge/SkillBridge.csproj index c8f6291..62d7f15 100644 --- a/src/SkillBridge/SkillBridge.csproj +++ b/src/SkillBridge/SkillBridge.csproj @@ -35,4 +35,8 @@ + + + + From 7f04b2fbe131758ff84f0f02b1d017860b478204 Mon Sep 17 00:00:00 2001 From: NKSurprise Date: Sat, 18 Oct 2025 15:55:24 +0300 Subject: [PATCH 2/3] Rename UserAssignmentTask to UserProjectAssignmentTask Refactored entity, configuration, and related references from UserAssignmentTask to UserProjectAssignmentTask for clarity and consistency. Updated response model to include task completion statistics. --- src/SkillBridge/Data/AppDbContext.cs | 2 +- .../UserAssignmentTaskConfiguration.cs | 4 ++-- src/SkillBridge/Models/Entities/AssignmentTask.cs | 2 +- .../Models/Entities/UserProjectAssignment.cs | 2 +- ...ssignmentTask.cs => UserProjectAssignmentTask.cs} | 2 +- .../Models/Response/UserProjectAssignmentResponse.cs | 7 +++++++ .../ProjectAssignment/ProjectAssignmentService.cs | 12 ++---------- .../UserProjectAssignmentService.cs | 3 +++ 8 files changed, 18 insertions(+), 16 deletions(-) rename src/SkillBridge/Models/Entities/{UserAssignmentTask.cs => UserProjectAssignmentTask.cs} (93%) diff --git a/src/SkillBridge/Data/AppDbContext.cs b/src/SkillBridge/Data/AppDbContext.cs index e4e6445..6431dea 100644 --- a/src/SkillBridge/Data/AppDbContext.cs +++ b/src/SkillBridge/Data/AppDbContext.cs @@ -45,7 +45,7 @@ public class AppDbContext : DbContext public DbSet UserProjectAssignments { get; set; } = null!; - public DbSet UserAssignmentTasks { get; set; } = null!; + public DbSet UserAssignmentTasks { get; set; } = null!; /// /// Initializes a new instance of the class. diff --git a/src/SkillBridge/Data/Configurations/UserAssignmentTaskConfiguration.cs b/src/SkillBridge/Data/Configurations/UserAssignmentTaskConfiguration.cs index 8bacdb3..12451d4 100644 --- a/src/SkillBridge/Data/Configurations/UserAssignmentTaskConfiguration.cs +++ b/src/SkillBridge/Data/Configurations/UserAssignmentTaskConfiguration.cs @@ -4,9 +4,9 @@ namespace SkillBridge.Data.Configurations { - public class UserAssignmentTaskConfiguration : IEntityTypeConfiguration + public class UserAssignmentTaskConfiguration : IEntityTypeConfiguration { - public void Configure(EntityTypeBuilder builder) + public void Configure(EntityTypeBuilder builder) { builder.ToTable("user_assignment_tasks"); diff --git a/src/SkillBridge/Models/Entities/AssignmentTask.cs b/src/SkillBridge/Models/Entities/AssignmentTask.cs index 60ed979..c1fbc5d 100644 --- a/src/SkillBridge/Models/Entities/AssignmentTask.cs +++ b/src/SkillBridge/Models/Entities/AssignmentTask.cs @@ -58,6 +58,6 @@ public class AssignmentTask /// /// Gets or sets the collection of tasks belonging to this project assignment /// - public ICollection UserAssignmentTasks { get; set; } = new List(); + public ICollection UserAssignmentTasks { get; set; } = new List(); } } \ No newline at end of file diff --git a/src/SkillBridge/Models/Entities/UserProjectAssignment.cs b/src/SkillBridge/Models/Entities/UserProjectAssignment.cs index b9bdc92..7c3325d 100644 --- a/src/SkillBridge/Models/Entities/UserProjectAssignment.cs +++ b/src/SkillBridge/Models/Entities/UserProjectAssignment.cs @@ -56,5 +56,5 @@ public class UserProjectAssignment /// /// Gets or sets the collection of tasks belonging to this project assignment /// - public ICollection UserAssignmentTasks { get; set; } = new List(); + public ICollection UserAssignmentTasks { get; set; } = new List(); } \ No newline at end of file diff --git a/src/SkillBridge/Models/Entities/UserAssignmentTask.cs b/src/SkillBridge/Models/Entities/UserProjectAssignmentTask.cs similarity index 93% rename from src/SkillBridge/Models/Entities/UserAssignmentTask.cs rename to src/SkillBridge/Models/Entities/UserProjectAssignmentTask.cs index 66c225b..c5b6f9b 100644 --- a/src/SkillBridge/Models/Entities/UserAssignmentTask.cs +++ b/src/SkillBridge/Models/Entities/UserProjectAssignmentTask.cs @@ -2,7 +2,7 @@ namespace SkillBridge.Models.Entities { - public class UserAssignmentTask + public class UserProjectAssignmentTask { [JsonSchemaIgnore] public Guid AssignmentTaskId { get; set; } [JsonSchemaIgnore] public AssignmentTask? AssignmentTask { get; set; } diff --git a/src/SkillBridge/Models/Response/UserProjectAssignmentResponse.cs b/src/SkillBridge/Models/Response/UserProjectAssignmentResponse.cs index 8c267c1..e3d8626 100644 --- a/src/SkillBridge/Models/Response/UserProjectAssignmentResponse.cs +++ b/src/SkillBridge/Models/Response/UserProjectAssignmentResponse.cs @@ -29,4 +29,11 @@ public class UserProjectAssignmentResponse public DateTime? CompletedAt { get; set; } public DateTime Deadline { get; set; } + + public int TotalTasks { get; set; } + + public int CompletedTasks { get; set; } + + public double CompletionPercentage + => TotalTasks == 0 ? 0 : (double)CompletedTasks / TotalTasks * 100; } \ No newline at end of file diff --git a/src/SkillBridge/Services/ProjectAssignment/ProjectAssignmentService.cs b/src/SkillBridge/Services/ProjectAssignment/ProjectAssignmentService.cs index 780922c..f38237c 100644 --- a/src/SkillBridge/Services/ProjectAssignment/ProjectAssignmentService.cs +++ b/src/SkillBridge/Services/ProjectAssignment/ProjectAssignmentService.cs @@ -454,15 +454,6 @@ public async Task CompleteTaskAsync(Guid projectId, Guid - //if (userAssignmentTask.IsCompleted == false) - //{ - // userAssignmentTask.IsCompleted = true; - //} - //else if (userAssignmentTask.IsCompleted == true) - //{ - // userAssignmentTask.IsCompleted = false; - //} - if (userAssignmentTask is null) { // Optional: verify the user is assigned to this project before creating the row @@ -471,7 +462,7 @@ public async Task CompleteTaskAsync(Guid projectId, Guid if (!isAssigned) throw new InvalidOperationException("User is not assigned to this project."); - userAssignmentTask = new UserAssignmentTask + userAssignmentTask = new UserProjectAssignmentTask { UserProfileId = auth0UserId, ProjectAssignmentId = projectId, @@ -483,6 +474,7 @@ public async Task CompleteTaskAsync(Guid projectId, Guid else { userAssignmentTask.IsCompleted = !userAssignmentTask.IsCompleted; // toggle + } task.UpdatedAt = DateTime.UtcNow; diff --git a/src/SkillBridge/Services/UserProjectAssignment/UserProjectAssignmentService.cs b/src/SkillBridge/Services/UserProjectAssignment/UserProjectAssignmentService.cs index 36c794e..22c9814 100644 --- a/src/SkillBridge/Services/UserProjectAssignment/UserProjectAssignmentService.cs +++ b/src/SkillBridge/Services/UserProjectAssignment/UserProjectAssignmentService.cs @@ -80,6 +80,9 @@ public async Task ClaimProjectAsync(string userId ClaimedAt = DateTime.UtcNow, IsCompleted = false, Deadline = DateTime.UtcNow + projectAssignment.Duration, + TotalTasks = projectAssignment.Tasks.Count, + CompletedTasks = 0 + }; // Save to database From ea7ba3ec2bf05cebd6ce42c2e746875f7f1925bf Mon Sep 17 00:00:00 2001 From: NKSurprise Date: Sun, 19 Oct 2025 03:15:21 +0300 Subject: [PATCH 3/3] Refactor UserProjectAssignment task tracking and cleanup Renamed UserAssignmentTasks to UserProjectAssignmentTasks throughout the codebase for clarity and consistency. Removed TotalTasks and CompletedTasks properties from UserProjectAssignment entity and database schema, updating related migration and snapshot files. Adjusted service and response logic to compute task completion dynamically based on related UserProjectAssignmentTasks. --- .../AssignmentTaskConfiguration.cs | 2 +- .../UserAssignmentTaskConfiguration.cs | 4 +- .../UserProjectAssignmentConfiguration.cs | 10 +- ...keOffTotalTaskAndCompletedTask.Designer.cs | 522 ++++++++++++++++++ ...130551_TakeOffTotalTaskAndCompletedTask.cs | 40 ++ .../Migrations/AppDbContextModelSnapshot.cs | 106 ++-- .../Models/Entities/AssignmentTask.cs | 2 +- .../Models/Entities/UserProjectAssignment.cs | 8 +- .../Models/Response/AssignmentTaskResponse.cs | 14 +- .../Response/UserProjectAssignmentResponse.cs | 6 +- .../UserProjectAssignmentService.cs | 63 ++- 11 files changed, 658 insertions(+), 119 deletions(-) create mode 100644 src/SkillBridge/Migrations/20251018130551_TakeOffTotalTaskAndCompletedTask.Designer.cs create mode 100644 src/SkillBridge/Migrations/20251018130551_TakeOffTotalTaskAndCompletedTask.cs diff --git a/src/SkillBridge/Data/Configurations/AssignmentTaskConfiguration.cs b/src/SkillBridge/Data/Configurations/AssignmentTaskConfiguration.cs index e344a41..81cf1a8 100644 --- a/src/SkillBridge/Data/Configurations/AssignmentTaskConfiguration.cs +++ b/src/SkillBridge/Data/Configurations/AssignmentTaskConfiguration.cs @@ -53,7 +53,7 @@ public void Configure(EntityTypeBuilder builder) .HasForeignKey(e => e.ProjectAssignmentId) .OnDelete(DeleteBehavior.Cascade); - builder.HasMany(e => e.UserAssignmentTasks) + builder.HasMany(e => e.UserProjectAssignmentTasks) .WithOne(uat => uat.AssignmentTask) .HasForeignKey(uat => uat.AssignmentTaskId) .OnDelete(DeleteBehavior.Cascade); diff --git a/src/SkillBridge/Data/Configurations/UserAssignmentTaskConfiguration.cs b/src/SkillBridge/Data/Configurations/UserAssignmentTaskConfiguration.cs index 12451d4..b45ce30 100644 --- a/src/SkillBridge/Data/Configurations/UserAssignmentTaskConfiguration.cs +++ b/src/SkillBridge/Data/Configurations/UserAssignmentTaskConfiguration.cs @@ -29,13 +29,13 @@ public void Configure(EntityTypeBuilder builder) // Relationships builder.HasOne(e => e.UserProjectAssignment) - .WithMany(upa => upa.UserAssignmentTasks) + .WithMany(upa => upa.UserProjectAssignmentTasks) .HasForeignKey(e => new { e.UserProfileId, e.ProjectAssignmentId }) .HasPrincipalKey(upa => new { upa.UserProfileId, upa.ProjectAssignmentId }) .OnDelete(DeleteBehavior.Cascade); builder.HasOne(e => e.AssignmentTask) - .WithMany(t => t.UserAssignmentTasks) + .WithMany(t => t.UserProjectAssignmentTasks) .HasForeignKey(e => e.AssignmentTaskId) .OnDelete(DeleteBehavior.Cascade); diff --git a/src/SkillBridge/Data/Configurations/UserProjectAssignmentConfiguration.cs b/src/SkillBridge/Data/Configurations/UserProjectAssignmentConfiguration.cs index b3d5ea6..9430d44 100644 --- a/src/SkillBridge/Data/Configurations/UserProjectAssignmentConfiguration.cs +++ b/src/SkillBridge/Data/Configurations/UserProjectAssignmentConfiguration.cs @@ -56,15 +56,7 @@ public void Configure(EntityTypeBuilder builder) .HasColumnName("deadline") .IsRequired(); - builder.Property(e => e.TotalTasks) - .HasColumnName("total_tasks") - .IsRequired(); - - builder.Property(e => e.CompletedTasks) - .HasColumnName("completed_tasks") - .IsRequired(); - - builder.HasMany(e => e.UserAssignmentTasks) + builder.HasMany(e => e.UserProjectAssignmentTasks) .WithOne(uat => uat.UserProjectAssignment) .HasForeignKey(uat => new { uat.UserProfileId, uat.ProjectAssignmentId }) .HasPrincipalKey(e => new { e.UserProfileId, e.ProjectAssignmentId }) diff --git a/src/SkillBridge/Migrations/20251018130551_TakeOffTotalTaskAndCompletedTask.Designer.cs b/src/SkillBridge/Migrations/20251018130551_TakeOffTotalTaskAndCompletedTask.Designer.cs new file mode 100644 index 0000000..818d81d --- /dev/null +++ b/src/SkillBridge/Migrations/20251018130551_TakeOffTotalTaskAndCompletedTask.Designer.cs @@ -0,0 +1,522 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using SkillBridge.Data; + +#nullable disable + +namespace SkillBridge.Migrations +{ + [DbContext(typeof(AppDbContext))] + [Migration("20251018130551_TakeOffTotalTaskAndCompletedTask")] + partial class TakeOffTotalTaskAndCompletedTask + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.16") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("SkillBridge.Models.Entities.AssignmentTask", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("Description") + .HasMaxLength(2000) + .HasColumnType("character varying(2000)") + .HasColumnName("description"); + + b.Property("ProjectAssignmentId") + .HasColumnType("uuid") + .HasColumnName("project_assignment_id"); + + b.Property("Sequence") + .HasColumnType("integer") + .HasColumnName("sequence"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("character varying(200)") + .HasColumnName("title"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id"); + + b.HasIndex("ProjectAssignmentId"); + + b.HasIndex("Sequence"); + + b.ToTable("assignment_tasks", (string)null); + }); + + modelBuilder.Entity("SkillBridge.Models.Entities.Company", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("About") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("character varying(2000)") + .HasColumnName("about"); + + b.Property("Activities") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("character varying(500)") + .HasColumnName("activities"); + + b.Property("Auth0UserId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasColumnName("auth0_user_id"); + + b.Property("BannerUrl") + .HasMaxLength(500) + .HasColumnType("character varying(500)") + .HasColumnName("banner_url"); + + b.Property("BulgarianOfficeLocations") + .HasMaxLength(500) + .HasColumnType("character varying(500)") + .HasColumnName("bulgarian_office_locations"); + + b.Property("ContactEmail") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("contact_email"); + + b.Property("ContactName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("character varying(100)") + .HasColumnName("contact_name"); + + b.Property("ContactPhone") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("character varying(20)") + .HasColumnName("contact_phone"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("EmployeesInBulgaria") + .HasColumnType("integer") + .HasColumnName("employees_in_bulgaria"); + + b.Property("EmployeesWorldwide") + .HasColumnType("integer") + .HasColumnName("employees_worldwide"); + + b.Property("HasOfficesInBulgaria") + .HasColumnType("boolean") + .HasColumnName("has_offices_in_bulgaria"); + + b.Property("HeadOfficeLocation") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("character varying(200)") + .HasColumnName("head_office_location"); + + b.Property("LogoUrl") + .HasColumnType("text") + .HasColumnName("logo_url"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("character varying(100)") + .HasColumnName("name"); + + b.Property("Sector") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("character varying(100)") + .HasColumnName("sector"); + + b.Property("Technologies") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("character varying(1000)") + .HasColumnName("technologies"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("updated_at"); + + b.Property("WebsiteUrl") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("character varying(500)") + .HasColumnName("website_url"); + + b.Property("WhyWorkWithUs") + .HasMaxLength(2000) + .HasColumnType("character varying(2000)") + .HasColumnName("why_work_with_us"); + + b.Property("YearEstablished") + .IsRequired() + .HasColumnType("integer") + .HasColumnName("year_established"); + + b.HasKey("Id"); + + b.HasIndex("Auth0UserId") + .IsUnique(); + + b.HasIndex("Name"); + + b.HasIndex("Sector"); + + b.ToTable("companies", (string)null); + }); + + modelBuilder.Entity("SkillBridge.Models.Entities.ProjectAssignment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("CompanyId") + .HasColumnType("uuid") + .HasColumnName("company_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("Description") + .HasColumnType("text") + .HasColumnName("description"); + + b.Property("Duration") + .HasColumnType("interval") + .HasColumnName("duration"); + + b.Property("LearningBenefits") + .IsRequired() + .HasColumnType("text") + .HasColumnName("learning_benefits"); + + b.Property("Level") + .HasColumnType("integer") + .HasColumnName("level"); + + b.Property("Status") + .HasColumnType("integer") + .HasColumnName("status"); + + b.Property("SuggestedApproach") + .IsRequired() + .HasColumnType("text") + .HasColumnName("suggested_approach"); + + b.Property("Summary") + .IsRequired() + .HasColumnType("text") + .HasColumnName("summary"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("character varying(200)") + .HasColumnName("title"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id"); + + b.HasIndex("CompanyId"); + + b.HasIndex("Level"); + + b.HasIndex("Status"); + + b.ToTable("project_assignments", (string)null); + }); + + modelBuilder.Entity("SkillBridge.Models.Entities.ProjectSkill", b => + { + b.Property("ProjectAssignmentId") + .HasColumnType("uuid") + .HasColumnName("project_assignment_id"); + + b.Property("SkillId") + .HasColumnType("uuid") + .HasColumnName("skill_id"); + + b.HasKey("ProjectAssignmentId", "SkillId"); + + b.HasIndex("SkillId"); + + b.ToTable("project_skills", (string)null); + }); + + modelBuilder.Entity("SkillBridge.Models.Entities.Skill", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("id"); + + b.Property("Description") + .HasMaxLength(500) + .HasColumnType("character varying(500)") + .HasColumnName("description"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("character varying(100)") + .HasColumnName("name"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("skills", (string)null); + }); + + modelBuilder.Entity("SkillBridge.Models.Entities.UserProfile", b => + { + b.Property("Id") + .HasColumnType("text") + .HasColumnName("id"); + + b.Property("CVUpload") + .HasColumnType("text") + .HasColumnName("cv_upload"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("GitHubConnection") + .HasColumnType("text") + .HasColumnName("github_connection"); + + b.Property("ProfilePicture") + .HasColumnType("text") + .HasColumnName("profile_picture"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("updated_at"); + + b.HasKey("Id"); + + b.ToTable("user_profiles", (string)null); + }); + + modelBuilder.Entity("SkillBridge.Models.Entities.UserProjectAssignment", b => + { + b.Property("UserProfileId") + .HasColumnType("text") + .HasColumnName("user_profile_id"); + + b.Property("ProjectAssignmentId") + .HasColumnType("uuid") + .HasColumnName("project_assignment_id"); + + b.Property("ClaimedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("claimed_at"); + + b.Property("CompletedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("completed_at"); + + b.Property("Deadline") + .HasColumnType("timestamp with time zone") + .HasColumnName("deadline"); + + b.Property("IsCompleted") + .HasColumnType("boolean") + .HasColumnName("is_completed"); + + b.HasKey("UserProfileId", "ProjectAssignmentId"); + + b.HasIndex("ProjectAssignmentId"); + + b.HasIndex("UserProfileId"); + + b.ToTable("user_project_assignments", (string)null); + }); + + modelBuilder.Entity("SkillBridge.Models.Entities.UserProjectAssignmentTask", b => + { + b.Property("UserProfileId") + .HasColumnType("text") + .HasColumnName("user_profile_id"); + + b.Property("ProjectAssignmentId") + .HasColumnType("uuid") + .HasColumnName("project_assignment_id"); + + b.Property("AssignmentTaskId") + .HasColumnType("uuid") + .HasColumnName("assignment_task_id"); + + b.Property("IsCompleted") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false) + .HasColumnName("is_completed"); + + b.HasKey("UserProfileId", "ProjectAssignmentId", "AssignmentTaskId"); + + b.HasIndex("AssignmentTaskId") + .HasDatabaseName("ix_user_assignment_tasks_assignment_task_id"); + + b.HasIndex("UserProfileId", "ProjectAssignmentId") + .HasDatabaseName("ix_user_assignment_tasks_user_project"); + + b.ToTable("user_assignment_tasks", (string)null); + }); + + modelBuilder.Entity("SkillBridge.Models.Entities.AssignmentTask", b => + { + b.HasOne("SkillBridge.Models.Entities.ProjectAssignment", "ProjectAssignment") + .WithMany("Tasks") + .HasForeignKey("ProjectAssignmentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProjectAssignment"); + }); + + modelBuilder.Entity("SkillBridge.Models.Entities.ProjectAssignment", b => + { + b.HasOne("SkillBridge.Models.Entities.Company", "Company") + .WithMany("ProjectAssignments") + .HasForeignKey("CompanyId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Company"); + }); + + modelBuilder.Entity("SkillBridge.Models.Entities.ProjectSkill", b => + { + b.HasOne("SkillBridge.Models.Entities.ProjectAssignment", "ProjectAssignment") + .WithMany("ProjectSkills") + .HasForeignKey("ProjectAssignmentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SkillBridge.Models.Entities.Skill", "Skill") + .WithMany("ProjectSkills") + .HasForeignKey("SkillId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProjectAssignment"); + + b.Navigation("Skill"); + }); + + modelBuilder.Entity("SkillBridge.Models.Entities.UserProjectAssignment", b => + { + b.HasOne("SkillBridge.Models.Entities.ProjectAssignment", "ProjectAssignment") + .WithMany("UserProjectAssignments") + .HasForeignKey("ProjectAssignmentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SkillBridge.Models.Entities.UserProfile", "UserProfile") + .WithMany("UserProjectAssignments") + .HasForeignKey("UserProfileId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProjectAssignment"); + + b.Navigation("UserProfile"); + }); + + modelBuilder.Entity("SkillBridge.Models.Entities.UserProjectAssignmentTask", b => + { + b.HasOne("SkillBridge.Models.Entities.AssignmentTask", "AssignmentTask") + .WithMany("UserAssignmentTasks") + .HasForeignKey("AssignmentTaskId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SkillBridge.Models.Entities.UserProjectAssignment", "UserProjectAssignment") + .WithMany("UserAssignmentTasks") + .HasForeignKey("UserProfileId", "ProjectAssignmentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("AssignmentTask"); + + b.Navigation("UserProjectAssignment"); + }); + + modelBuilder.Entity("SkillBridge.Models.Entities.AssignmentTask", b => + { + b.Navigation("UserAssignmentTasks"); + }); + + modelBuilder.Entity("SkillBridge.Models.Entities.Company", b => + { + b.Navigation("ProjectAssignments"); + }); + + modelBuilder.Entity("SkillBridge.Models.Entities.ProjectAssignment", b => + { + b.Navigation("ProjectSkills"); + + b.Navigation("Tasks"); + + b.Navigation("UserProjectAssignments"); + }); + + modelBuilder.Entity("SkillBridge.Models.Entities.Skill", b => + { + b.Navigation("ProjectSkills"); + }); + + modelBuilder.Entity("SkillBridge.Models.Entities.UserProfile", b => + { + b.Navigation("UserProjectAssignments"); + }); + + modelBuilder.Entity("SkillBridge.Models.Entities.UserProjectAssignment", b => + { + b.Navigation("UserAssignmentTasks"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/SkillBridge/Migrations/20251018130551_TakeOffTotalTaskAndCompletedTask.cs b/src/SkillBridge/Migrations/20251018130551_TakeOffTotalTaskAndCompletedTask.cs new file mode 100644 index 0000000..70fa148 --- /dev/null +++ b/src/SkillBridge/Migrations/20251018130551_TakeOffTotalTaskAndCompletedTask.cs @@ -0,0 +1,40 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace SkillBridge.Migrations +{ + /// + public partial class TakeOffTotalTaskAndCompletedTask : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "completed_tasks", + table: "user_project_assignments"); + + migrationBuilder.DropColumn( + name: "total_tasks", + table: "user_project_assignments"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "completed_tasks", + table: "user_project_assignments", + type: "integer", + nullable: false, + defaultValue: 0); + + migrationBuilder.AddColumn( + name: "total_tasks", + table: "user_project_assignments", + type: "integer", + nullable: false, + defaultValue: 0); + } + } +} diff --git a/src/SkillBridge/Migrations/AppDbContextModelSnapshot.cs b/src/SkillBridge/Migrations/AppDbContextModelSnapshot.cs index a88fe69..3e699fa 100644 --- a/src/SkillBridge/Migrations/AppDbContextModelSnapshot.cs +++ b/src/SkillBridge/Migrations/AppDbContextModelSnapshot.cs @@ -304,37 +304,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("skills", (string)null); }); - modelBuilder.Entity("SkillBridge.Models.Entities.UserAssignmentTask", b => - { - b.Property("UserProfileId") - .HasColumnType("text") - .HasColumnName("user_profile_id"); - - b.Property("ProjectAssignmentId") - .HasColumnType("uuid") - .HasColumnName("project_assignment_id"); - - b.Property("AssignmentTaskId") - .HasColumnType("uuid") - .HasColumnName("assignment_task_id"); - - b.Property("IsCompleted") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false) - .HasColumnName("is_completed"); - - b.HasKey("UserProfileId", "ProjectAssignmentId", "AssignmentTaskId"); - - b.HasIndex("AssignmentTaskId") - .HasDatabaseName("ix_user_assignment_tasks_assignment_task_id"); - - b.HasIndex("UserProfileId", "ProjectAssignmentId") - .HasDatabaseName("ix_user_assignment_tasks_user_project"); - - b.ToTable("user_assignment_tasks", (string)null); - }); - modelBuilder.Entity("SkillBridge.Models.Entities.UserProfile", b => { b.Property("Id") @@ -384,10 +353,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("timestamp with time zone") .HasColumnName("completed_at"); - b.Property("CompletedTasks") - .HasColumnType("integer") - .HasColumnName("completed_tasks"); - b.Property("Deadline") .HasColumnType("timestamp with time zone") .HasColumnName("deadline"); @@ -396,10 +361,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("boolean") .HasColumnName("is_completed"); - b.Property("TotalTasks") - .HasColumnType("integer") - .HasColumnName("total_tasks"); - b.HasKey("UserProfileId", "ProjectAssignmentId"); b.HasIndex("ProjectAssignmentId"); @@ -409,6 +370,37 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("user_project_assignments", (string)null); }); + modelBuilder.Entity("SkillBridge.Models.Entities.UserProjectAssignmentTask", b => + { + b.Property("UserProfileId") + .HasColumnType("text") + .HasColumnName("user_profile_id"); + + b.Property("ProjectAssignmentId") + .HasColumnType("uuid") + .HasColumnName("project_assignment_id"); + + b.Property("AssignmentTaskId") + .HasColumnType("uuid") + .HasColumnName("assignment_task_id"); + + b.Property("IsCompleted") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false) + .HasColumnName("is_completed"); + + b.HasKey("UserProfileId", "ProjectAssignmentId", "AssignmentTaskId"); + + b.HasIndex("AssignmentTaskId") + .HasDatabaseName("ix_user_assignment_tasks_assignment_task_id"); + + b.HasIndex("UserProfileId", "ProjectAssignmentId") + .HasDatabaseName("ix_user_assignment_tasks_user_project"); + + b.ToTable("user_assignment_tasks", (string)null); + }); + modelBuilder.Entity("SkillBridge.Models.Entities.AssignmentTask", b => { b.HasOne("SkillBridge.Models.Entities.ProjectAssignment", "ProjectAssignment") @@ -450,42 +442,42 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("Skill"); }); - modelBuilder.Entity("SkillBridge.Models.Entities.UserAssignmentTask", b => + modelBuilder.Entity("SkillBridge.Models.Entities.UserProjectAssignment", b => { - b.HasOne("SkillBridge.Models.Entities.AssignmentTask", "AssignmentTask") - .WithMany("UserAssignmentTasks") - .HasForeignKey("AssignmentTaskId") + b.HasOne("SkillBridge.Models.Entities.ProjectAssignment", "ProjectAssignment") + .WithMany("UserProjectAssignments") + .HasForeignKey("ProjectAssignmentId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); - b.HasOne("SkillBridge.Models.Entities.UserProjectAssignment", "UserProjectAssignment") - .WithMany("UserAssignmentTasks") - .HasForeignKey("UserProfileId", "ProjectAssignmentId") + b.HasOne("SkillBridge.Models.Entities.UserProfile", "UserProfile") + .WithMany("UserProjectAssignments") + .HasForeignKey("UserProfileId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); - b.Navigation("AssignmentTask"); + b.Navigation("ProjectAssignment"); - b.Navigation("UserProjectAssignment"); + b.Navigation("UserProfile"); }); - modelBuilder.Entity("SkillBridge.Models.Entities.UserProjectAssignment", b => + modelBuilder.Entity("SkillBridge.Models.Entities.UserProjectAssignmentTask", b => { - b.HasOne("SkillBridge.Models.Entities.ProjectAssignment", "ProjectAssignment") - .WithMany("UserProjectAssignments") - .HasForeignKey("ProjectAssignmentId") + b.HasOne("SkillBridge.Models.Entities.AssignmentTask", "AssignmentTask") + .WithMany("UserAssignmentTasks") + .HasForeignKey("AssignmentTaskId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); - b.HasOne("SkillBridge.Models.Entities.UserProfile", "UserProfile") - .WithMany("UserProjectAssignments") - .HasForeignKey("UserProfileId") + b.HasOne("SkillBridge.Models.Entities.UserProjectAssignment", "UserProjectAssignment") + .WithMany("UserAssignmentTasks") + .HasForeignKey("UserProfileId", "ProjectAssignmentId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); - b.Navigation("ProjectAssignment"); + b.Navigation("AssignmentTask"); - b.Navigation("UserProfile"); + b.Navigation("UserProjectAssignment"); }); modelBuilder.Entity("SkillBridge.Models.Entities.AssignmentTask", b => diff --git a/src/SkillBridge/Models/Entities/AssignmentTask.cs b/src/SkillBridge/Models/Entities/AssignmentTask.cs index c1fbc5d..1673724 100644 --- a/src/SkillBridge/Models/Entities/AssignmentTask.cs +++ b/src/SkillBridge/Models/Entities/AssignmentTask.cs @@ -58,6 +58,6 @@ public class AssignmentTask /// /// Gets or sets the collection of tasks belonging to this project assignment /// - public ICollection UserAssignmentTasks { get; set; } = new List(); + public ICollection UserProjectAssignmentTasks { get; set; } = new List(); } } \ No newline at end of file diff --git a/src/SkillBridge/Models/Entities/UserProjectAssignment.cs b/src/SkillBridge/Models/Entities/UserProjectAssignment.cs index 7c3325d..a42e674 100644 --- a/src/SkillBridge/Models/Entities/UserProjectAssignment.cs +++ b/src/SkillBridge/Models/Entities/UserProjectAssignment.cs @@ -49,12 +49,8 @@ public class UserProjectAssignment public DateTime Deadline { get; set; } - public int TotalTasks { get; set; } - - public int CompletedTasks { get; set; } - /// - /// Gets or sets the collection of tasks belonging to this project assignment + /// Gets or sets the collection of tasks belonging to this user project assignment /// - public ICollection UserAssignmentTasks { get; set; } = new List(); + public ICollection UserProjectAssignmentTasks { get; set; } = new List(); } \ No newline at end of file diff --git a/src/SkillBridge/Models/Response/AssignmentTaskResponse.cs b/src/SkillBridge/Models/Response/AssignmentTaskResponse.cs index 9da2b0e..a400e31 100644 --- a/src/SkillBridge/Models/Response/AssignmentTaskResponse.cs +++ b/src/SkillBridge/Models/Response/AssignmentTaskResponse.cs @@ -11,38 +11,36 @@ public class AssignmentTaskResponse /// Gets or sets the unique identifier for the task /// public Guid Id { get; set; } - + /// /// Gets or sets the title of the task /// public string Title { get; set; } = default!; - + /// /// Gets or sets the description of the task /// public string? Description { get; set; } - + /// /// Gets or sets whether the task is completed /// public bool IsCompleted { get; set; } - - /// /// Gets or sets the sequence number of the task (for ordering) /// public int Sequence { get; set; } - + /// /// Gets or sets the ID of the project assignment this task belongs to /// public Guid ProjectAssignmentId { get; set; } - + /// /// Gets or sets the date when this task was created /// public DateTime CreatedAt { get; set; } - + /// /// Gets or sets the date when this task was last updated /// diff --git a/src/SkillBridge/Models/Response/UserProjectAssignmentResponse.cs b/src/SkillBridge/Models/Response/UserProjectAssignmentResponse.cs index e3d8626..4a1adaf 100644 --- a/src/SkillBridge/Models/Response/UserProjectAssignmentResponse.cs +++ b/src/SkillBridge/Models/Response/UserProjectAssignmentResponse.cs @@ -30,10 +30,10 @@ public class UserProjectAssignmentResponse public DateTime Deadline { get; set; } - public int TotalTasks { get; set; } + public int TotalTasks => ProjectAssignment.Tasks.Count; public int CompletedTasks { get; set; } - public double CompletionPercentage - => TotalTasks == 0 ? 0 : (double)CompletedTasks / TotalTasks * 100; + public double CompletionPercentage => + TotalTasks == 0 ? 0 : Math.Round((double)CompletedTasks / TotalTasks * 100, 2); } \ No newline at end of file diff --git a/src/SkillBridge/Services/UserProjectAssignment/UserProjectAssignmentService.cs b/src/SkillBridge/Services/UserProjectAssignment/UserProjectAssignmentService.cs index 22c9814..d64efa1 100644 --- a/src/SkillBridge/Services/UserProjectAssignment/UserProjectAssignmentService.cs +++ b/src/SkillBridge/Services/UserProjectAssignment/UserProjectAssignmentService.cs @@ -36,9 +36,9 @@ public UserProjectAssignmentService( /// public async Task ClaimProjectAsync(string userId, ClaimProjectRequest request) { - _logger.LogInformation("User {UserId} claiming project assignment {ProjectAssignmentId}", + _logger.LogInformation("User {UserId} claiming project assignment {ProjectAssignmentId}", userId, request.ProjectAssignmentId); - + // Verify user profile exists var userExists = await _dbContext.UserProfiles.AnyAsync(u => u.Id == userId); if (!userExists) @@ -46,7 +46,7 @@ public async Task ClaimProjectAsync(string userId _logger.LogWarning("User profile with ID {UserId} not found", userId); throw new EntityNotFoundException("UserProfile", userId); } - + // Verify project assignment exists and is published var projectAssignment = await _dbContext.ProjectAssignments .Include(p => p.Company) @@ -54,24 +54,24 @@ public async Task ClaimProjectAsync(string userId .ThenInclude(ps => ps.Skill) .Include(p => p.Tasks) .FirstOrDefaultAsync(p => p.Id == request.ProjectAssignmentId); - + if (projectAssignment == null) { _logger.LogWarning("Project assignment with ID {ProjectAssignmentId} not found", request.ProjectAssignmentId); throw new EntityNotFoundException("ProjectAssignment", request.ProjectAssignmentId); } - + // Check if the user has already claimed this project var existingClaim = await _dbContext.UserProjectAssignments .FirstOrDefaultAsync(up => up.UserProfileId == userId && up.ProjectAssignmentId == request.ProjectAssignmentId); - + if (existingClaim != null) { _logger.LogWarning("User {UserId} has already claimed project assignment {ProjectAssignmentId}", userId, request.ProjectAssignmentId); throw new InvalidOperationException("You have already claimed this project assignment"); } - + // Create new user project assignment var userProjectAssignment = new Models.Entities.UserProjectAssignment { @@ -80,18 +80,15 @@ public async Task ClaimProjectAsync(string userId ClaimedAt = DateTime.UtcNow, IsCompleted = false, Deadline = DateTime.UtcNow + projectAssignment.Duration, - TotalTasks = projectAssignment.Tasks.Count, - CompletedTasks = 0 - }; - + // Save to database await _dbContext.UserProjectAssignments.AddAsync(userProjectAssignment); await _dbContext.SaveChangesAsync(); - + _logger.LogInformation("User {UserId} successfully claimed project assignment {ProjectAssignmentId}", userId, request.ProjectAssignmentId); - + // Build the response var response = new UserProjectAssignmentResponse { @@ -101,7 +98,7 @@ public async Task ClaimProjectAsync(string userId CompletedAt = userProjectAssignment.CompletedAt, Deadline = userProjectAssignment.Deadline }; - + return response; } @@ -111,7 +108,7 @@ public async Task ClaimProjectAsync(string userId public async Task> GetUserProjectsAsync(string userId) { _logger.LogInformation("Getting all project assignments claimed by user {UserId}", userId); - + // Verify user profile exists var userExists = await _dbContext.UserProfiles.AnyAsync(u => u.Id == userId); if (!userExists) @@ -119,7 +116,7 @@ public async Task> GetUserProjectsAsy _logger.LogWarning("User profile with ID {UserId} not found", userId); throw new EntityNotFoundException("UserProfile", userId); } - + // Get all user project assignments with related data var userProjectAssignments = await _dbContext.UserProjectAssignments .Where(upa => upa.UserProfileId == userId) @@ -129,22 +126,24 @@ public async Task> GetUserProjectsAsy .ThenInclude(pa => pa.ProjectSkills) .ThenInclude(ps => ps.Skill) .Include(upa => upa.ProjectAssignment) - .ThenInclude(pa => pa.Tasks) + .ThenInclude(pa => pa.Tasks). + Include(upa => upa.UserProjectAssignmentTasks) .OrderByDescending(upa => upa.ClaimedAt) .ToListAsync(); - + _logger.LogInformation("Found {Count} project assignments claimed by user {UserId}", userProjectAssignments.Count, userId); - + // Map to response model var response = userProjectAssignments.Select(upa => new UserProjectAssignmentResponse { ProjectAssignment = _mapper.Map(upa.ProjectAssignment), ClaimedAt = upa.ClaimedAt, IsCompleted = upa.IsCompleted, - CompletedAt = upa.CompletedAt + CompletedAt = upa.CompletedAt, + CompletedTasks = upa.UserProjectAssignmentTasks.Count(x => x.IsCompleted), }); - + return response; } @@ -155,7 +154,7 @@ public async Task CompleteProjectAsync(string use { _logger.LogInformation("User {UserId} marking project assignment {ProjectAssignmentId} as completed", userId, projectAssignmentId); - + // Find the user project assignment var userProjectAssignment = await _dbContext.UserProjectAssignments .Include(upa => upa.ProjectAssignment) @@ -165,20 +164,20 @@ public async Task CompleteProjectAsync(string use .ThenInclude(ps => ps.Skill) .Include(upa => upa.ProjectAssignment) .ThenInclude(pa => pa.Tasks) - .FirstOrDefaultAsync(upa => - upa.UserProfileId == userId && + .FirstOrDefaultAsync(upa => + upa.UserProfileId == userId && upa.ProjectAssignmentId == projectAssignmentId); - + if (userProjectAssignment == null) { _logger.LogWarning( "User project assignment not found for user {UserId} and project {ProjectAssignmentId}", userId, projectAssignmentId); throw new EntityNotFoundException( - "UserProjectAssignment", + "UserProjectAssignment", $"User: {userId}, Project: {projectAssignmentId}"); } - + if (userProjectAssignment.IsCompleted) { _logger.LogWarning( @@ -186,18 +185,18 @@ public async Task CompleteProjectAsync(string use projectAssignmentId, userId); throw new InvalidOperationException("This project assignment is already marked as completed"); } - + // Mark as completed userProjectAssignment.IsCompleted = true; userProjectAssignment.CompletedAt = DateTime.UtcNow; - + // Save changes await _dbContext.SaveChangesAsync(); - + _logger.LogInformation( "User {UserId} successfully marked project assignment {ProjectAssignmentId} as completed", userId, projectAssignmentId); - + // Build response var response = new UserProjectAssignmentResponse { @@ -206,7 +205,7 @@ public async Task CompleteProjectAsync(string use IsCompleted = userProjectAssignment.IsCompleted, CompletedAt = userProjectAssignment.CompletedAt }; - + return response; } } \ No newline at end of file