From efa9545b70479904d64176bfc157e0cdbbb7acb0 Mon Sep 17 00:00:00 2001 From: Ahmed naeem Date: Tue, 19 Nov 2024 00:18:33 +0300 Subject: [PATCH 1/5] merge --- Contexts/MainAppContext.cs | 5 +- Controllers/Mobile/v1/AuthController.cs | 131 ++++- .../Mobile/v1/FreelancersController.cs | 3 +- ...241112205304_TempUserMigration.Designer.cs | 463 ++++++++++++++++++ .../20241112205304_TempUserMigration.cs | 41 ++ Migrations/MainAppContextModelSnapshot.cs | 20 + Models/DTOs/CompletRegister.cs | 21 + Models/DTOs/ProjectProfileDTO.cs | 16 + Models/DTOs/RegistByPhoneNumberDTO.cs | 14 + Models/DTOs/UserProfileDTO.cs | 15 + Models/Responses/TemUser.cs | 17 + Models/User.cs | 1 + aon.db | Bin 143360 -> 143360 bytes aon.db-shm | Bin 32768 -> 32768 bytes aon.db-wal | Bin 0 -> 12392 bytes 15 files changed, 741 insertions(+), 6 deletions(-) create mode 100644 Migrations/20241112205304_TempUserMigration.Designer.cs create mode 100644 Migrations/20241112205304_TempUserMigration.cs create mode 100644 Models/DTOs/CompletRegister.cs create mode 100644 Models/DTOs/ProjectProfileDTO.cs create mode 100644 Models/DTOs/RegistByPhoneNumberDTO.cs create mode 100644 Models/DTOs/UserProfileDTO.cs create mode 100644 Models/Responses/TemUser.cs diff --git a/Contexts/MainAppContext.cs b/Contexts/MainAppContext.cs index 348a4a6..392c046 100644 --- a/Contexts/MainAppContext.cs +++ b/Contexts/MainAppContext.cs @@ -1,4 +1,5 @@ using AonFreelancing.Models; +using AonFreelancing.Models.Responses; using Microsoft.AspNetCore.Identity.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; using System.Reflection.Emit; @@ -13,6 +14,7 @@ public class MainAppContext:IdentityDbContext //public DbSet Clients { get; set; } // instead, use User only + public DbSet TemUsers { get; set; } public DbSet Users { get; set; } // Will access Freelancers, Clients, SystemUsers through inheritance and ofType public DbSet OTPs { get; set; } public MainAppContext(DbContextOptions contextOptions) : base(contextOptions) { @@ -23,13 +25,14 @@ protected override void OnModelCreating(ModelBuilder builder) { // For TPT design + builder.Entity().ToTable("AspNetUsers") .HasIndex(u=>u.PhoneNumber).IsUnique(); builder.Entity().ToTable("Freelancers"); builder.Entity().ToTable("Clients"); builder.Entity().ToTable("SystemUsers"); builder.Entity().ToTable("otps", o => o.HasCheckConstraint("CK_CODE","length([Code]) = 6")); - + builder.Entity().ToTable("TempUsers").HasIndex(u=>u.phoneNumber).IsUnique(); //set up relationships builder.Entity().HasOne() .WithOne() diff --git a/Controllers/Mobile/v1/AuthController.cs b/Controllers/Mobile/v1/AuthController.cs index dc6ead2..b6ed366 100644 --- a/Controllers/Mobile/v1/AuthController.cs +++ b/Controllers/Mobile/v1/AuthController.cs @@ -13,6 +13,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using Microsoft.IdentityModel.Tokens; +using System.Net; using Twilio; using Twilio.Rest.Api.V2010.Account; using Twilio.TwiML.Messaging; @@ -47,6 +48,79 @@ JwtService jwtService _jwtService = jwtService; } + + [HttpPost("RegisterByPhone")] + + public async Task RegisterPhoneNumberAsync([FromBody] RegistByPhoneNumberDTO reg) + { + var user= await _mainAppContext.TemUsers.Where(ph=>ph.phoneNumber==reg.PhoneNumber).FirstOrDefaultAsync(); + + + if (user != null && !user.PhoneNumberConfirm==false) + { + + return Unauthorized(CreateErrorResponse(StatusCodes.Status401Unauthorized.ToString(), "Verify Your Account First")); + } + + user = new TemUser() { phoneNumber=reg.PhoneNumber }; + + await _mainAppContext.TemUsers.AddAsync(user); + + string otpCode = _otpManager.GenerateOtp(); + await _mainAppContext.SaveChangesAsync(); + + OTP otp = new OTP() + { + Code = otpCode, + PhoneNumber = reg.PhoneNumber, + CreatedDate = DateTime.Now, + ExpiresAt = DateTime.Now.AddMinutes(1), + }; + + + //send the otp to the specified phone number + await _otpManager.SendOTPAsync(otp.Code, reg.PhoneNumber); + await _mainAppContext.OTPs.AddAsync(otp); + await _mainAppContext.SaveChangesAsync(); + + + + return Ok(); + + + } + + + [HttpPost("completeRegister")] + + public async Task completeRegister([FromBody]CompletRegister re) + { + + + var user = new User() + { + + Email = re.EmailAddress, + + Name = re.Name, + + PhoneNumber=re.PhoneNumber + }; + await _userManager.CreateAsync(user,re.Password); + + var ApiResponce = new ApiResponse() + { + IsSuccess = true, + Results = user, + Errors = [] + }; + return Ok (ApiResponce); + + + + + } + [HttpPost("register")] public async Task RegisterAsync([FromBody] RegRequest regRequest) { @@ -177,19 +251,20 @@ public async Task LoginAsync([FromBody] AuthRequest Req) [HttpPost("verify")] public async Task VerifyAsync([FromBody] VerifyReq verifyReq) { - var user = await _userManager.Users.Where(x => x.PhoneNumber == verifyReq.Phone).FirstOrDefaultAsync(); - if (user != null && !await _userManager.IsPhoneNumberConfirmedAsync(user)) + var user = await _mainAppContext.TemUsers.Where(x => x.phoneNumber == verifyReq.Phone).FirstOrDefaultAsync(); + if (user != null && ! user.PhoneNumberConfirm==false) { OTP? otp = await _mainAppContext.OTPs.Where(o => o.PhoneNumber == verifyReq.Phone).FirstOrDefaultAsync(); // verify OTP if (otp != null && verifyReq.Otp.Equals(otp.Code) && DateTime.Now < otp.ExpiresAt) { - user.PhoneNumberConfirmed = true; - await _userManager.UpdateAsync(user); + user.PhoneNumberConfirm = true; + _mainAppContext.Update(user); // disable sent OTP otp.IsUsed = true; + _mainAppContext.Update(otp); await _mainAppContext.SaveChangesAsync(); return Ok(CreateSuccessResponse("Activated")); @@ -198,6 +273,54 @@ public async Task VerifyAsync([FromBody] VerifyReq verifyReq) return Unauthorized(CreateErrorResponse(StatusCodes.Status401Unauthorized.ToString(), "UnAuthorized")); } + + + [HttpGet("PhoneNumber")] + + public async Task GetProfile(string PhoneNumber) + { + var User = _userManager.Users.Where(p => p.PhoneNumber == PhoneNumber).FirstOrDefault(); + + if (User != null) + { + var user = await _userManager.Users.Include(p => p.projects).Select(async U => new UserProfileDTO + + + + { + + PhoneNumber = User.PhoneNumber, + Email = User.Email, + id = User.Id, + name = User.Name, + About = U.projects.Select(p => new ProjectProfileDTO + { + + + Id = p.Id, + Description = p.Description, + startDate = DateTime.Now, + endDate = DateTime.Now, + + }).ToList() + + + }).ToListAsync(); + + var ApiRespons = new ApiResponse() + { + IsSuccess = true, + Results = user, + Errors = [] + }; + return Ok(ApiRespons); + } + return NotFound(); + + + + } + //[HttpPost("forgotpassword")] //public async Task ForgotPasswordMethod([FromBody] ForgotPasswordReq forgotPasswordRequest) //{ diff --git a/Controllers/Mobile/v1/FreelancersController.cs b/Controllers/Mobile/v1/FreelancersController.cs index 9a749d8..1278c6c 100644 --- a/Controllers/Mobile/v1/FreelancersController.cs +++ b/Controllers/Mobile/v1/FreelancersController.cs @@ -10,7 +10,8 @@ namespace AonFreelancing.Controllers.Mobile.v1 { - [Authorize] + [Authorize ] + [Route("api/mobile/v1/freelancers")] [ApiController] public class FreelancersController : BaseController diff --git a/Migrations/20241112205304_TempUserMigration.Designer.cs b/Migrations/20241112205304_TempUserMigration.Designer.cs new file mode 100644 index 0000000..c4f9361 --- /dev/null +++ b/Migrations/20241112205304_TempUserMigration.Designer.cs @@ -0,0 +1,463 @@ +// +using System; +using AonFreelancing.Contexts; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace AonFreelancing.Migrations +{ + [DbContext(typeof(MainAppContext))] + [Migration("20241112205304_TempUserMigration")] + partial class TempUserMigration + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "8.0.10"); + + modelBuilder.Entity("AonFreelancing.Models.ApplicationRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("TEXT"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("AonFreelancing.Models.OTP", b => + { + b.Property("PhoneNumber") + .HasColumnType("TEXT"); + + b.Property("Code") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("CreatedDate") + .HasColumnType("TEXT"); + + b.Property("ExpiresAt") + .HasColumnType("TEXT"); + + b.Property("IsUsed") + .HasColumnType("INTEGER"); + + b.HasKey("PhoneNumber"); + + b.ToTable("otps", null, t => + { + t.HasCheckConstraint("CK_CODE", "length([Code]) = 6"); + }); + }); + + modelBuilder.Entity("AonFreelancing.Models.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Budget") + .HasColumnType("TEXT"); + + b.Property("ClientId") + .HasColumnType("INTEGER"); + + b.Property("CreatedAt") + .HasColumnType("TEXT"); + + b.Property("Description") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Duration") + .HasColumnType("INTEGER"); + + b.Property("FreelancerId") + .HasColumnType("INTEGER"); + + b.Property("PriceType") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("QualificationName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Title") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ClientId"); + + b.HasIndex("FreelancerId"); + + b.ToTable("Projects"); + }); + + modelBuilder.Entity("AonFreelancing.Models.Responses.TemUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("PhoneNumberConfirm") + .HasColumnType("INTEGER"); + + b.Property("phoneNumber") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("phoneNumber") + .IsUnique(); + + b.ToTable("TempUsers", (string)null); + }); + + modelBuilder.Entity("AonFreelancing.Models.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AccessFailedCount") + .HasColumnType("INTEGER"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("TEXT"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("EmailConfirmed") + .HasColumnType("INTEGER"); + + b.Property("LockoutEnabled") + .HasColumnType("INTEGER"); + + b.Property("LockoutEnd") + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("PasswordHash") + .HasColumnType("TEXT"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("INTEGER"); + + b.Property("SecurityStamp") + .HasColumnType("TEXT"); + + b.Property("TwoFactorEnabled") + .HasColumnType("INTEGER"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.HasIndex("PhoneNumber") + .IsUnique(); + + b.ToTable("AspNetUsers", (string)null); + + b.UseTptMappingStrategy(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("ClaimType") + .HasColumnType("TEXT"); + + b.Property("ClaimValue") + .HasColumnType("TEXT"); + + b.Property("RoleId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("ClaimType") + .HasColumnType("TEXT"); + + b.Property("ClaimValue") + .HasColumnType("TEXT"); + + b.Property("UserId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("TEXT"); + + b.Property("ProviderKey") + .HasColumnType("TEXT"); + + b.Property("ProviderDisplayName") + .HasColumnType("TEXT"); + + b.Property("UserId") + .HasColumnType("INTEGER"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("INTEGER"); + + b.Property("RoleId") + .HasColumnType("INTEGER"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("INTEGER"); + + b.Property("LoginProvider") + .HasColumnType("TEXT"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("Value") + .HasColumnType("TEXT"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("AonFreelancing.Models.Client", b => + { + b.HasBaseType("AonFreelancing.Models.User"); + + b.Property("CompanyName") + .IsRequired() + .HasColumnType("TEXT"); + + b.ToTable("Clients", (string)null); + }); + + modelBuilder.Entity("AonFreelancing.Models.Freelancer", b => + { + b.HasBaseType("AonFreelancing.Models.User"); + + b.Property("Skills") + .IsRequired() + .HasColumnType("TEXT"); + + b.ToTable("Freelancers", (string)null); + }); + + modelBuilder.Entity("AonFreelancing.Models.SystemUser", b => + { + b.HasBaseType("AonFreelancing.Models.User"); + + b.Property("Permissions") + .IsRequired() + .HasColumnType("TEXT"); + + b.ToTable("SystemUsers", (string)null); + }); + + modelBuilder.Entity("AonFreelancing.Models.OTP", b => + { + b.HasOne("AonFreelancing.Models.User", null) + .WithOne() + .HasForeignKey("AonFreelancing.Models.OTP", "PhoneNumber") + .HasPrincipalKey("AonFreelancing.Models.User", "PhoneNumber") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("AonFreelancing.Models.Project", b => + { + b.HasOne("AonFreelancing.Models.Client", "Client") + .WithMany("Projects") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AonFreelancing.Models.Freelancer", "Freelancer") + .WithMany() + .HasForeignKey("FreelancerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Client"); + + b.Navigation("Freelancer"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("AonFreelancing.Models.ApplicationRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("AonFreelancing.Models.User", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("AonFreelancing.Models.User", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("AonFreelancing.Models.ApplicationRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AonFreelancing.Models.User", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("AonFreelancing.Models.User", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("AonFreelancing.Models.Client", b => + { + b.HasOne("AonFreelancing.Models.User", null) + .WithOne() + .HasForeignKey("AonFreelancing.Models.Client", "Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("AonFreelancing.Models.Freelancer", b => + { + b.HasOne("AonFreelancing.Models.User", null) + .WithOne() + .HasForeignKey("AonFreelancing.Models.Freelancer", "Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("AonFreelancing.Models.SystemUser", b => + { + b.HasOne("AonFreelancing.Models.User", null) + .WithOne() + .HasForeignKey("AonFreelancing.Models.SystemUser", "Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("AonFreelancing.Models.Client", b => + { + b.Navigation("Projects"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Migrations/20241112205304_TempUserMigration.cs b/Migrations/20241112205304_TempUserMigration.cs new file mode 100644 index 0000000..124c7b7 --- /dev/null +++ b/Migrations/20241112205304_TempUserMigration.cs @@ -0,0 +1,41 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace AonFreelancing.Migrations +{ + /// + public partial class TempUserMigration : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "TempUsers", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + phoneNumber = table.Column(type: "TEXT", nullable: true), + PhoneNumberConfirm = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_TempUsers", x => x.Id); + }); + + migrationBuilder.CreateIndex( + name: "IX_TempUsers_phoneNumber", + table: "TempUsers", + column: "phoneNumber", + unique: true); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "TempUsers"); + } + } +} diff --git a/Migrations/MainAppContextModelSnapshot.cs b/Migrations/MainAppContextModelSnapshot.cs index 703f24a..afdd8b0 100644 --- a/Migrations/MainAppContextModelSnapshot.cs +++ b/Migrations/MainAppContextModelSnapshot.cs @@ -116,6 +116,26 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("Projects"); }); + modelBuilder.Entity("AonFreelancing.Models.Responses.TemUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("PhoneNumberConfirm") + .HasColumnType("INTEGER"); + + b.Property("phoneNumber") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("phoneNumber") + .IsUnique(); + + b.ToTable("TempUsers", (string)null); + }); + modelBuilder.Entity("AonFreelancing.Models.User", b => { b.Property("Id") diff --git a/Models/DTOs/CompletRegister.cs b/Models/DTOs/CompletRegister.cs new file mode 100644 index 0000000..23605b6 --- /dev/null +++ b/Models/DTOs/CompletRegister.cs @@ -0,0 +1,21 @@ +using System.ComponentModel.DataAnnotations; + +namespace AonFreelancing.Models.DTOs +{ + public class CompletRegister + { + + [Required] + public string Name { get; set; } + + + [EmailAddress] + [Required] + public string EmailAddress { get; set; } + [Required] + public string Password { get; set; } + [Required] + public string PhoneNumber { get; set; } + + } +} diff --git a/Models/DTOs/ProjectProfileDTO.cs b/Models/DTOs/ProjectProfileDTO.cs new file mode 100644 index 0000000..287be4e --- /dev/null +++ b/Models/DTOs/ProjectProfileDTO.cs @@ -0,0 +1,16 @@ +namespace AonFreelancing.Models.DTOs +{ + public class ProjectProfileDTO + { + + + public long Id { get; set; } + + public string Name { get; set; } + public string Description { get; set; } + + public DateTime startDate { get; set; } + public DateTime endDate { get; set; } + + } +} diff --git a/Models/DTOs/RegistByPhoneNumberDTO.cs b/Models/DTOs/RegistByPhoneNumberDTO.cs new file mode 100644 index 0000000..4ec58c4 --- /dev/null +++ b/Models/DTOs/RegistByPhoneNumberDTO.cs @@ -0,0 +1,14 @@ + +using System.ComponentModel.DataAnnotations; +using System.Diagnostics.CodeAnalysis; +namespace AonFreelancing.Models.DTOs + +{ + public class RegistByPhoneNumberDTO + { + + [Required] + public string PhoneNumber { get; set; } + + } +} diff --git a/Models/DTOs/UserProfileDTO.cs b/Models/DTOs/UserProfileDTO.cs new file mode 100644 index 0000000..49f4db0 --- /dev/null +++ b/Models/DTOs/UserProfileDTO.cs @@ -0,0 +1,15 @@ +namespace AonFreelancing.Models.DTOs +{ + public class UserProfileDTO + { + public long id { get; set; } + + public string name { get; set; } + public string CompanyName { get; set; } + + public string PhoneNumber { get; set; } + public string Email { get; set; } + public List About { get; set; } + + } +} diff --git a/Models/Responses/TemUser.cs b/Models/Responses/TemUser.cs new file mode 100644 index 0000000..da5a578 --- /dev/null +++ b/Models/Responses/TemUser.cs @@ -0,0 +1,17 @@ +using System.ComponentModel.DataAnnotations; +using Twilio.Types; + +namespace AonFreelancing.Models.Responses +{ + public class TemUser + { + + [Key] + public long Id { get; set; } + public string? phoneNumber { get; set; } + + public bool PhoneNumberConfirm { get; set; } + + + } +} diff --git a/Models/User.cs b/Models/User.cs index bfc9279..824de98 100644 --- a/Models/User.cs +++ b/Models/User.cs @@ -17,5 +17,6 @@ namespace AonFreelancing.Models public class User : IdentityUser { public string Name { get; set; } + public IEnumerable?projects { get; set; } } } diff --git a/aon.db b/aon.db index c962e03a30db12f5c5e5532c541a86ed80ffa19c..6c10f2c872948beb08d7cf7f97de0b246dea5967 100644 GIT binary patch delta 466 zcmZp8z|ru4V}i6G8v_G_G7!Un=|ml4RyGE`v{xHb7VwL4@R9uJwBmn}fKr9Qy3L6_!{TLZHHlAl^WZKyHlY^0YW23zS0QCqrtN;K2 delta 71 xcmZo@U}|V!VwQNMJNd1jDz^o@1e@vP+ni9o0*uc91^>~&#)+wZ8y6@W0syBvAOipZ diff --git a/aon.db-wal b/aon.db-wal index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..f16053ac09e4110a839c3dce710f4733e80e9c0e 100644 GIT binary patch literal 12392 zcmeI&F-yZh6bJB2uZ^iypB9mVmKHh{u^>uAMiCrEiY{GBTTZaXr1r9k;5QIN2OWxw zn}dUE!7pG1cfm4J3NPi00bZa0SG_<0uX=z1Rwwb z2teRh1gI-=mfEZYYNuJ@hbc?%x+9j%#Me35(5j_L%AB#Jo2x1)`L5CtGQNV(17>1K zrmeM>-%#~HyNV+Gex;?9TlMPvfmk9cr;TNIOL>7dIp9gs;WUH$g2U_6PGc|Q4|8Tv zPw>j}c7}VBJKSfuQ4oLt1Rwwb2tWV=5P$##AOHaf{5gRMnUBvp#YNj*aEi{nW7|AJ zmOD4N7f5<%$JO3zHvC_}pclal1px>^00Izz00bZa0SG_<0uX?}KM+V7QIWTP-V1yH D=@(l- literal 0 HcmV?d00001 From 21b09c19dbe2e0cb80aa4573a30ee4f4ed1db76e Mon Sep 17 00:00:00 2001 From: Ahmed naeem Date: Thu, 21 Nov 2024 22:21:01 +0300 Subject: [PATCH 2/5] Task7_done --- AonFreelancing.csproj | 4 + Contexts/MainAppContext.cs | 8 +- Controllers/Mobile/v1/AuthController.cs | 2 +- Controllers/Mobile/v1/ProjectsController.cs | 262 +++++++++- ...109125128_ProjectModifications.Designer.cs | 443 ---------------- .../20241109125128_ProjectModifications.cs | 94 ---- ...09131530_ProjectModifications2.Designer.cs | 443 ---------------- .../20241109131530_ProjectModifications2.cs | 22 - ...241112205304_TempUserMigration.Designer.cs | 463 ----------------- .../20241112205304_TempUserMigration.cs | 41 -- ...0241113063403_InitialMigration.Designer.cs | 467 ----------------- .../20241113064604_otpToTempUser.Designer.cs | 466 ----------------- Migrations/20241113064604_otpToTempUser.cs | 78 --- ...0241114060939_projectMirgation.Designer.cs | 483 ------------------ Migrations/20241114060939_projectMirgation.cs | 126 ----- .../20241114063948_userTypeToUserTable.cs | 28 - ...14072136_reomvedUserTypeColumn.Designer.cs | 483 ------------------ .../20241114072136_reomvedUserTypeColumn.cs | 28 - ...4113925_projectsTableMigration.Designer.cs | 483 ------------------ .../20241114113925_projectsTableMigration.cs | 22 - ...20241121190728_ImageMigration.Designer.cs} | 137 ++++- ...on.cs => 20241121190728_ImageMigration.cs} | 166 ++++-- Migrations/MainAppContextModelSnapshot.cs | 126 ++++- Models/DTOs/ProjectInputDTO.cs | 2 + Models/DTOs/ProjectOutDTO.cs | 17 + Models/EntityTask.cs | 26 + Models/Project.cs | 10 +- Models/Requests/BidsRquset.cs | 9 + Models/Requests/TaskRq.cs | 12 + Models/Requests/TaskStatusRq.cs | 11 + Models/Responses/Bid.cs | 30 ++ Models/Services/FileService.cs | 23 + {Services => Models/Services}/JwtService.cs | 4 +- Program.cs | 36 +- aon.db | Bin 143360 -> 176128 bytes aon.db-shm | Bin 32768 -> 0 bytes aon.db-wal | Bin 12392 -> 0 bytes 37 files changed, 815 insertions(+), 4240 deletions(-) delete mode 100644 Migrations/20241109125128_ProjectModifications.Designer.cs delete mode 100644 Migrations/20241109125128_ProjectModifications.cs delete mode 100644 Migrations/20241109131530_ProjectModifications2.Designer.cs delete mode 100644 Migrations/20241109131530_ProjectModifications2.cs delete mode 100644 Migrations/20241112205304_TempUserMigration.Designer.cs delete mode 100644 Migrations/20241112205304_TempUserMigration.cs delete mode 100644 Migrations/20241113063403_InitialMigration.Designer.cs delete mode 100644 Migrations/20241113064604_otpToTempUser.Designer.cs delete mode 100644 Migrations/20241113064604_otpToTempUser.cs delete mode 100644 Migrations/20241114060939_projectMirgation.Designer.cs delete mode 100644 Migrations/20241114060939_projectMirgation.cs delete mode 100644 Migrations/20241114063948_userTypeToUserTable.cs delete mode 100644 Migrations/20241114072136_reomvedUserTypeColumn.Designer.cs delete mode 100644 Migrations/20241114072136_reomvedUserTypeColumn.cs delete mode 100644 Migrations/20241114113925_projectsTableMigration.Designer.cs delete mode 100644 Migrations/20241114113925_projectsTableMigration.cs rename Migrations/{20241114063948_userTypeToUserTable.Designer.cs => 20241121190728_ImageMigration.Designer.cs} (79%) rename Migrations/{20241113063403_InitialMigration.cs => 20241121190728_ImageMigration.cs} (75%) create mode 100644 Models/EntityTask.cs create mode 100644 Models/Requests/BidsRquset.cs create mode 100644 Models/Requests/TaskRq.cs create mode 100644 Models/Requests/TaskStatusRq.cs create mode 100644 Models/Responses/Bid.cs create mode 100644 Models/Services/FileService.cs rename {Services => Models/Services}/JwtService.cs (91%) delete mode 100644 aon.db-shm delete mode 100644 aon.db-wal diff --git a/AonFreelancing.csproj b/AonFreelancing.csproj index fda919b..5617e12 100644 --- a/AonFreelancing.csproj +++ b/AonFreelancing.csproj @@ -19,4 +19,8 @@ + + + + diff --git a/Contexts/MainAppContext.cs b/Contexts/MainAppContext.cs index b3a3230..c277806 100644 --- a/Contexts/MainAppContext.cs +++ b/Contexts/MainAppContext.cs @@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Identity.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; using static System.Net.WebRequestMethods; +using Task = System.Threading.Tasks.Task; namespace AonFreelancing.Contexts { @@ -19,6 +20,9 @@ public class MainAppContext(DbContextOptions contextOptions) public DbSet Users { get; set; } // Will access Freelancers, Clients, SystemUsers through inheritance and ofType public DbSet OTPs { get; set; } public DbSet TempUsers { get; set; } + public DbSet Tasks { get; set; } + + public DbSetBids { get; set; } protected override void OnModelCreating(ModelBuilder builder) { @@ -29,8 +33,10 @@ protected override void OnModelCreating(ModelBuilder builder) .HasIndex(u=>u.PhoneNumber).IsUnique(); builder.Entity().ToTable("TempUser") .HasIndex(u=>u.PhoneNumber).IsUnique(); - + builder.Entity().ToTable("Tasks"); + builder.Entity().ToTable("Freelancers"); + builder.Entity().ToTable("Bids"); builder.Entity().ToTable("Clients"); builder.Entity().ToTable("SystemUsers"); builder.Entity().ToTable("otps", o => o.HasCheckConstraint("CK_CODE","length([Code]) = 6")); diff --git a/Controllers/Mobile/v1/AuthController.cs b/Controllers/Mobile/v1/AuthController.cs index d16fd51..e689cdc 100644 --- a/Controllers/Mobile/v1/AuthController.cs +++ b/Controllers/Mobile/v1/AuthController.cs @@ -3,7 +3,7 @@ using AonFreelancing.Models.DTOs; using AonFreelancing.Models.Requests; using AonFreelancing.Models.Responses; -using AonFreelancing.Services; +using AonFreelancing.Models.Services; using AonFreelancing.Utilities; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; diff --git a/Controllers/Mobile/v1/ProjectsController.cs b/Controllers/Mobile/v1/ProjectsController.cs index 2e7e64c..0c802ec 100644 --- a/Controllers/Mobile/v1/ProjectsController.cs +++ b/Controllers/Mobile/v1/ProjectsController.cs @@ -1,27 +1,40 @@ using AonFreelancing.Contexts; using AonFreelancing.Models; using AonFreelancing.Models.DTOs; +using AonFreelancing.Models.Requests; +using AonFreelancing.Models.Responses; +using AonFreelancing.Models.Services; using AonFreelancing.Utilities; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.EntityFrameworkCore; using System.Security.Claims; +using System.Security.Cryptography.Xml; + + namespace AonFreelancing.Controllers.Mobile.v1 { [Authorize] [Route("api/mobile/v1/projects")] [ApiController] - public class ProjectsController(MainAppContext mainAppContext, UserManager userManager) : BaseController + + public class ProjectsController(MainAppContext mainAppContext, UserManager userManager,FileService fileService) : BaseController + + { + + + [Authorize(Roles = "CLIENT")] [HttpPost] public async Task PostProjectAsync([FromBody] ProjectInputDto projectInputDto) { - if(!ModelState.IsValid) + if (!ModelState.IsValid) { - + return base.CustomBadRequest(); } var user = await userManager.GetUserAsync(HttpContext.User); @@ -42,6 +55,12 @@ public async Task PostProjectAsync([FromBody] ProjectInputDto pro CreatedAt = DateTime.Now, }; + if (projectInputDto.ImageName != null) + { + string fileName = await fileService.SaveAsync(projectInputDto.ImageName); + project.ImageName = fileName; + } + await mainAppContext.Projects.AddAsync(project); await mainAppContext.SaveChangesAsync(); @@ -55,6 +74,7 @@ public async Task GetClientFeedAsync( [FromQuery] int pageSize = 8, [FromQuery] string? qur = default ) { + var imagesBaseUrl = $"{Request.Scheme}://{Request.Host}/images"; var trimmedQuery = qur?.ToLower().Replace(" ", "").Trim(); List? projects; @@ -62,12 +82,12 @@ public async Task GetClientFeedAsync( var count = await query.CountAsync(); - if(!string.IsNullOrEmpty(trimmedQuery)) + if (!string.IsNullOrEmpty(trimmedQuery)) { query = query - .Where(p=>p.Title.ToLower().Contains(trimmedQuery)); + .Where(p => p.Title.ToLower().Contains(trimmedQuery)); } - if(qualificationNames != null && qualificationNames.Count >0) + if (qualificationNames != null && qualificationNames.Count > 0) { query = query .Where(p => qualificationNames.Contains(p.QualificationName)); @@ -77,7 +97,7 @@ public async Task GetClientFeedAsync( projects = await query.OrderByDescending(p => p.CreatedAt) .Skip(page * pageSize) .Take(pageSize) - .Select(p => new ProjectOutDTO + .Select(p => new ProjectOutDTO(p,imagesBaseUrl) { Title = p.Title, @@ -93,22 +113,226 @@ public async Task GetClientFeedAsync( CreationTime = StringOperations.GetTimeAgo(p.CreatedAt) }) .ToListAsync(); - - return Ok(CreateSuccessResponse(new { - Total=count, - Items=projects + + return Ok(CreateSuccessResponse(new + { + Total = count, + Items = projects })); } - //[HttpGet("{id}")] - //public IActionResult GetProject(int id) + + + [Authorize(Roles = "FREELANCER")] + [HttpPost("{id}/bids")] + + + public async Task GetProjectToBids([FromBody] BidsRequset bidrq, long id) + { + + var user = await userManager.GetUserAsync(User); + + var project = await mainAppContext.Projects.Where(p => p.Id == id).FirstOrDefaultAsync(); + + var rol = User.FindFirst(ClaimTypes.Role)?.Value; + var lastproposed = mainAppContext.Bids.Where(b => b.ProjectId == id).OrderByDescending(b => b.submittedAt).FirstOrDefault(); + if (user != null) + { + if (!(rol == Constants.USER_TYPE_FREELANCER)) + { + return Unauthorized(CreateErrorResponse(StatusCodes.Status403Forbidden.ToString(), "you are not Freelancer")); + + } + if (bidrq.proposed < 0) + { + return BadRequest("you must not put price in negative"); + + } + + + if (bidrq.proposed < project.Budget && bidrq.proposed < lastproposed.proposed_Price && user != null) + { + + var bid = new Bid() + { + + FreelancerId = user.Id, + proposed_Price = bidrq.proposed, + Nots = bidrq.Nots, + ProjectId = project.Id, + submittedAt = DateTime.Now, + + + }; + + return Ok(CreateSuccessResponse(bid)); + } + else + { + + return BadRequest("you must put price less"); + } + } + + return NotFound("the User NOt Found"); + } + + [HttpGet("{Id}")] + public async Task GetProject(long id) + { + var project = await mainAppContext.Projects.Where(p => p.Id == id).Include(p => p.Bids.OrderBy(b => b.proposed_Price)).FirstOrDefaultAsync(); + + if (project == null) + { + return NotFound(CreateErrorResponse("400","Not Found")); + + + + } + + + + return Ok(project); + + + + + } + + [Authorize(Roles = "CLIENT")] + [HttpPatch("{pid}/bids/{bid}/approve")] + public async Task AprroverBids(long Pid, long bid) + { + var project = await mainAppContext.Projects.FindAsync(Pid); + + + if (project == null || project.Status != "available") + { + + return BadRequest(CreateErrorResponse("400", "the project is not available")); + } + var bidd = await mainAppContext.Bids.FindAsync(bid); + if (bidd.status == "pending") + { + project.Status = "closed"; + bidd.status = "approved"; + bidd.ApprovedAt = DateTime.Now; + + mainAppContext.Projects.Update(project); + mainAppContext.SaveChanges(); + + mainAppContext.Bids.Update(bidd); + mainAppContext.SaveChanges(); + + } + return NotFound("The Project Not Found"); + + } + + + [HttpPost("{id}/tasks")] + + public async Task ProjectTasks([FromBody] TaskRq Rq, int id) + { + var project = await mainAppContext.Projects.FindAsync(id); + + if (project != null) + { + var task = new EntityTask() + { + ProjectId = project.Id, + Name = Rq.Name, + DedlineAt = Rq.DeadLine, + + }; + + + await mainAppContext.Tasks.AddAsync(task); + await mainAppContext.SaveChangesAsync(); + return Ok(); + } + return NotFound(); + + + } + [Authorize(Roles = "CLIENT")] + [HttpPatch("/task{id}")] + public async Task UpdateTaskStatus([FromBody] TaskStatusRq Rq, int id) + { + var Task = await mainAppContext.Tasks.FindAsync(id); + if (Task != null) + { + Task.status = Rq.newStatus; + + mainAppContext.Tasks.Update(Task); + await mainAppContext.SaveChangesAsync(); + } + return NotFound(); + + } + + //[Authorize(Roles = "CLIENT")] + //[HttpPost("upload-image")] + //public async Task UploadImage(IFormFile file, int id) //{ - // var project = _mainAppContext.Projects - // .Include(p => p.Client) - // .FirstOrDefault(p => p.Id == id); - // return Ok(CreateSuccessResponse(project)); + // var user = await mainAppContext.Users.FindAsync(id); + // if (file == null || file.Length == 0) + // { + // return BadRequest("No file uploaded."); + // } + + // if (file.Length > 10 * 1024 * 1024) + // { + // return BadRequest("File size is too large."); + // } + // var fileName = Path.GetFileNameWithoutExtension(file.FileName); + // var extension = Path.GetExtension(file.FileName).ToLower(); + // var newFileName = $"{fileName}_{Guid.NewGuid()}{extension}"; + // var filePath = Path.Combine(_uploadFolder, newFileName); + // // Validate file type (example: allow only image files) + // var allowedExtensions = new[] { ".jpg", ".jpeg", ".png", ".gif" }; - //} + // if (!allowedExtensions.Contains(extension)) + // { + // return BadRequest("Invalid file type."); + // } + + // // Convert the image file to byte array + // using (var memoryStream = new MemoryStream()) + // { + // await file.CopyToAsync(memoryStream); + // var imageData = memoryStream.ToArray(); + + // // Create a new ImageModel instance + // var image = new Image + // { + // Name = file.FileName, + // ImageData = imageData, + // Contenttype = file.ContentType, + // UserId = user.Id + + // }; + + // // Save the image to the database + // mainAppContext.Images.Add(image); + // await mainAppContext.SaveChangesAsync(); + + + // return Ok(new { filePath = $"/uploads/{newFileName}" }); + // } + + + //[HttpGet("{id}")] + //public IActionResult GetProject(int id) + //{ + // var project = _mainAppContext.Projects + // .Include(p => p.Client) + // .FirstOrDefault(p => p.Id == id); + + // return Ok(CreateSuccessResponse(project)); + + //} + } } -} \ No newline at end of file + diff --git a/Migrations/20241109125128_ProjectModifications.Designer.cs b/Migrations/20241109125128_ProjectModifications.Designer.cs deleted file mode 100644 index 51597dc..0000000 --- a/Migrations/20241109125128_ProjectModifications.Designer.cs +++ /dev/null @@ -1,443 +0,0 @@ -// -using System; -using AonFreelancing.Contexts; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace AonFreelancing.Migrations -{ - [DbContext(typeof(MainAppContext))] - [Migration("20241109125128_ProjectModifications")] - partial class ProjectModifications - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "8.0.10"); - - modelBuilder.Entity("AonFreelancing.Models.ApplicationRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("AonFreelancing.Models.OTP", b => - { - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("Code") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("ExpiresAt") - .HasColumnType("TEXT"); - - b.Property("IsUsed") - .HasColumnType("INTEGER"); - - b.HasKey("PhoneNumber"); - - b.ToTable("otps", null, t => - { - t.HasCheckConstraint("CK_CODE", "length([Code]) = 6"); - }); - }); - - modelBuilder.Entity("AonFreelancing.Models.Project", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Budget") - .HasColumnType("TEXT"); - - b.Property("ClientId") - .HasColumnType("INTEGER"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("Description") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Duration") - .HasColumnType("INTEGER"); - - b.Property("FreelancerId") - .HasColumnType("INTEGER"); - - b.Property("PriceType") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("QualificationName") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Title") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("ClientId"); - - b.HasIndex("FreelancerId"); - - b.ToTable("Projects"); - }); - - modelBuilder.Entity("AonFreelancing.Models.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.HasIndex("PhoneNumber") - .IsUnique(); - - b.ToTable("AspNetUsers", (string)null); - - b.UseTptMappingStrategy(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.Property("RoleId") - .HasColumnType("INTEGER"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("AonFreelancing.Models.Client", b => - { - b.HasBaseType("AonFreelancing.Models.User"); - - b.Property("CompanyName") - .IsRequired() - .HasColumnType("TEXT"); - - b.ToTable("Clients", (string)null); - }); - - modelBuilder.Entity("AonFreelancing.Models.Freelancer", b => - { - b.HasBaseType("AonFreelancing.Models.User"); - - b.Property("Skills") - .IsRequired() - .HasColumnType("TEXT"); - - b.ToTable("Freelancers", (string)null); - }); - - modelBuilder.Entity("AonFreelancing.Models.SystemUser", b => - { - b.HasBaseType("AonFreelancing.Models.User"); - - b.Property("Permissions") - .IsRequired() - .HasColumnType("TEXT"); - - b.ToTable("SystemUsers", (string)null); - }); - - modelBuilder.Entity("AonFreelancing.Models.OTP", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithOne() - .HasForeignKey("AonFreelancing.Models.OTP", "PhoneNumber") - .HasPrincipalKey("AonFreelancing.Models.User", "PhoneNumber") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AonFreelancing.Models.Project", b => - { - b.HasOne("AonFreelancing.Models.Client", "Client") - .WithMany("Projects") - .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("AonFreelancing.Models.Freelancer", "Freelancer") - .WithMany() - .HasForeignKey("FreelancerId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Client"); - - b.Navigation("Freelancer"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("AonFreelancing.Models.ApplicationRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("AonFreelancing.Models.ApplicationRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("AonFreelancing.Models.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AonFreelancing.Models.Client", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithOne() - .HasForeignKey("AonFreelancing.Models.Client", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AonFreelancing.Models.Freelancer", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithOne() - .HasForeignKey("AonFreelancing.Models.Freelancer", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AonFreelancing.Models.SystemUser", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithOne() - .HasForeignKey("AonFreelancing.Models.SystemUser", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AonFreelancing.Models.Client", b => - { - b.Navigation("Projects"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Migrations/20241109125128_ProjectModifications.cs b/Migrations/20241109125128_ProjectModifications.cs deleted file mode 100644 index 5c1edac..0000000 --- a/Migrations/20241109125128_ProjectModifications.cs +++ /dev/null @@ -1,94 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace AonFreelancing.Migrations -{ - /// - public partial class ProjectModifications : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "Budget", - table: "Projects", - type: "TEXT", - nullable: false, - defaultValue: 0m); - - migrationBuilder.AddColumn( - name: "Duration", - table: "Projects", - type: "INTEGER", - nullable: false, - defaultValue: 0); - - migrationBuilder.AddColumn( - name: "FreelancerId", - table: "Projects", - type: "INTEGER", - nullable: false, - defaultValue: 0L); - - migrationBuilder.AddColumn( - name: "PriceType", - table: "Projects", - type: "TEXT", - nullable: false, - defaultValue: ""); - - migrationBuilder.AddColumn( - name: "QualificationName", - table: "Projects", - type: "TEXT", - nullable: false, - defaultValue: ""); - - migrationBuilder.CreateIndex( - name: "IX_Projects_FreelancerId", - table: "Projects", - column: "FreelancerId"); - - migrationBuilder.AddForeignKey( - name: "FK_Projects_Freelancers_FreelancerId", - table: "Projects", - column: "FreelancerId", - principalTable: "Freelancers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_Projects_Freelancers_FreelancerId", - table: "Projects"); - - migrationBuilder.DropIndex( - name: "IX_Projects_FreelancerId", - table: "Projects"); - - migrationBuilder.DropColumn( - name: "Budget", - table: "Projects"); - - migrationBuilder.DropColumn( - name: "Duration", - table: "Projects"); - - migrationBuilder.DropColumn( - name: "FreelancerId", - table: "Projects"); - - migrationBuilder.DropColumn( - name: "PriceType", - table: "Projects"); - - migrationBuilder.DropColumn( - name: "QualificationName", - table: "Projects"); - } - } -} diff --git a/Migrations/20241109131530_ProjectModifications2.Designer.cs b/Migrations/20241109131530_ProjectModifications2.Designer.cs deleted file mode 100644 index 85d1de7..0000000 --- a/Migrations/20241109131530_ProjectModifications2.Designer.cs +++ /dev/null @@ -1,443 +0,0 @@ -// -using System; -using AonFreelancing.Contexts; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace AonFreelancing.Migrations -{ - [DbContext(typeof(MainAppContext))] - [Migration("20241109131530_ProjectModifications2")] - partial class ProjectModifications2 - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "8.0.10"); - - modelBuilder.Entity("AonFreelancing.Models.ApplicationRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("AonFreelancing.Models.OTP", b => - { - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("Code") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("ExpiresAt") - .HasColumnType("TEXT"); - - b.Property("IsUsed") - .HasColumnType("INTEGER"); - - b.HasKey("PhoneNumber"); - - b.ToTable("otps", null, t => - { - t.HasCheckConstraint("CK_CODE", "length([Code]) = 6"); - }); - }); - - modelBuilder.Entity("AonFreelancing.Models.Project", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Budget") - .HasColumnType("TEXT"); - - b.Property("ClientId") - .HasColumnType("INTEGER"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("Description") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Duration") - .HasColumnType("INTEGER"); - - b.Property("FreelancerId") - .HasColumnType("INTEGER"); - - b.Property("PriceType") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("QualificationName") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Title") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("ClientId"); - - b.HasIndex("FreelancerId"); - - b.ToTable("Projects"); - }); - - modelBuilder.Entity("AonFreelancing.Models.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.HasIndex("PhoneNumber") - .IsUnique(); - - b.ToTable("AspNetUsers", (string)null); - - b.UseTptMappingStrategy(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.Property("RoleId") - .HasColumnType("INTEGER"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("AonFreelancing.Models.Client", b => - { - b.HasBaseType("AonFreelancing.Models.User"); - - b.Property("CompanyName") - .IsRequired() - .HasColumnType("TEXT"); - - b.ToTable("Clients", (string)null); - }); - - modelBuilder.Entity("AonFreelancing.Models.Freelancer", b => - { - b.HasBaseType("AonFreelancing.Models.User"); - - b.Property("Skills") - .IsRequired() - .HasColumnType("TEXT"); - - b.ToTable("Freelancers", (string)null); - }); - - modelBuilder.Entity("AonFreelancing.Models.SystemUser", b => - { - b.HasBaseType("AonFreelancing.Models.User"); - - b.Property("Permissions") - .IsRequired() - .HasColumnType("TEXT"); - - b.ToTable("SystemUsers", (string)null); - }); - - modelBuilder.Entity("AonFreelancing.Models.OTP", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithOne() - .HasForeignKey("AonFreelancing.Models.OTP", "PhoneNumber") - .HasPrincipalKey("AonFreelancing.Models.User", "PhoneNumber") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AonFreelancing.Models.Project", b => - { - b.HasOne("AonFreelancing.Models.Client", "Client") - .WithMany("Projects") - .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("AonFreelancing.Models.Freelancer", "Freelancer") - .WithMany() - .HasForeignKey("FreelancerId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Client"); - - b.Navigation("Freelancer"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("AonFreelancing.Models.ApplicationRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("AonFreelancing.Models.ApplicationRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("AonFreelancing.Models.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AonFreelancing.Models.Client", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithOne() - .HasForeignKey("AonFreelancing.Models.Client", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AonFreelancing.Models.Freelancer", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithOne() - .HasForeignKey("AonFreelancing.Models.Freelancer", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AonFreelancing.Models.SystemUser", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithOne() - .HasForeignKey("AonFreelancing.Models.SystemUser", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AonFreelancing.Models.Client", b => - { - b.Navigation("Projects"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Migrations/20241109131530_ProjectModifications2.cs b/Migrations/20241109131530_ProjectModifications2.cs deleted file mode 100644 index 0d2141c..0000000 --- a/Migrations/20241109131530_ProjectModifications2.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace AonFreelancing.Migrations -{ - /// - public partial class ProjectModifications2 : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - - } - } -} diff --git a/Migrations/20241112205304_TempUserMigration.Designer.cs b/Migrations/20241112205304_TempUserMigration.Designer.cs deleted file mode 100644 index c4f9361..0000000 --- a/Migrations/20241112205304_TempUserMigration.Designer.cs +++ /dev/null @@ -1,463 +0,0 @@ -// -using System; -using AonFreelancing.Contexts; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace AonFreelancing.Migrations -{ - [DbContext(typeof(MainAppContext))] - [Migration("20241112205304_TempUserMigration")] - partial class TempUserMigration - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "8.0.10"); - - modelBuilder.Entity("AonFreelancing.Models.ApplicationRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("AonFreelancing.Models.OTP", b => - { - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("Code") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("ExpiresAt") - .HasColumnType("TEXT"); - - b.Property("IsUsed") - .HasColumnType("INTEGER"); - - b.HasKey("PhoneNumber"); - - b.ToTable("otps", null, t => - { - t.HasCheckConstraint("CK_CODE", "length([Code]) = 6"); - }); - }); - - modelBuilder.Entity("AonFreelancing.Models.Project", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Budget") - .HasColumnType("TEXT"); - - b.Property("ClientId") - .HasColumnType("INTEGER"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("Description") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Duration") - .HasColumnType("INTEGER"); - - b.Property("FreelancerId") - .HasColumnType("INTEGER"); - - b.Property("PriceType") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("QualificationName") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Title") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("ClientId"); - - b.HasIndex("FreelancerId"); - - b.ToTable("Projects"); - }); - - modelBuilder.Entity("AonFreelancing.Models.Responses.TemUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("PhoneNumberConfirm") - .HasColumnType("INTEGER"); - - b.Property("phoneNumber") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("phoneNumber") - .IsUnique(); - - b.ToTable("TempUsers", (string)null); - }); - - modelBuilder.Entity("AonFreelancing.Models.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.HasIndex("PhoneNumber") - .IsUnique(); - - b.ToTable("AspNetUsers", (string)null); - - b.UseTptMappingStrategy(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.Property("RoleId") - .HasColumnType("INTEGER"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("AonFreelancing.Models.Client", b => - { - b.HasBaseType("AonFreelancing.Models.User"); - - b.Property("CompanyName") - .IsRequired() - .HasColumnType("TEXT"); - - b.ToTable("Clients", (string)null); - }); - - modelBuilder.Entity("AonFreelancing.Models.Freelancer", b => - { - b.HasBaseType("AonFreelancing.Models.User"); - - b.Property("Skills") - .IsRequired() - .HasColumnType("TEXT"); - - b.ToTable("Freelancers", (string)null); - }); - - modelBuilder.Entity("AonFreelancing.Models.SystemUser", b => - { - b.HasBaseType("AonFreelancing.Models.User"); - - b.Property("Permissions") - .IsRequired() - .HasColumnType("TEXT"); - - b.ToTable("SystemUsers", (string)null); - }); - - modelBuilder.Entity("AonFreelancing.Models.OTP", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithOne() - .HasForeignKey("AonFreelancing.Models.OTP", "PhoneNumber") - .HasPrincipalKey("AonFreelancing.Models.User", "PhoneNumber") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AonFreelancing.Models.Project", b => - { - b.HasOne("AonFreelancing.Models.Client", "Client") - .WithMany("Projects") - .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("AonFreelancing.Models.Freelancer", "Freelancer") - .WithMany() - .HasForeignKey("FreelancerId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Client"); - - b.Navigation("Freelancer"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("AonFreelancing.Models.ApplicationRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("AonFreelancing.Models.ApplicationRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("AonFreelancing.Models.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AonFreelancing.Models.Client", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithOne() - .HasForeignKey("AonFreelancing.Models.Client", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AonFreelancing.Models.Freelancer", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithOne() - .HasForeignKey("AonFreelancing.Models.Freelancer", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AonFreelancing.Models.SystemUser", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithOne() - .HasForeignKey("AonFreelancing.Models.SystemUser", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AonFreelancing.Models.Client", b => - { - b.Navigation("Projects"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Migrations/20241112205304_TempUserMigration.cs b/Migrations/20241112205304_TempUserMigration.cs deleted file mode 100644 index 124c7b7..0000000 --- a/Migrations/20241112205304_TempUserMigration.cs +++ /dev/null @@ -1,41 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace AonFreelancing.Migrations -{ - /// - public partial class TempUserMigration : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "TempUsers", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - phoneNumber = table.Column(type: "TEXT", nullable: true), - PhoneNumberConfirm = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_TempUsers", x => x.Id); - }); - - migrationBuilder.CreateIndex( - name: "IX_TempUsers_phoneNumber", - table: "TempUsers", - column: "phoneNumber", - unique: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "TempUsers"); - } - } -} diff --git a/Migrations/20241113063403_InitialMigration.Designer.cs b/Migrations/20241113063403_InitialMigration.Designer.cs deleted file mode 100644 index b3cb8ce..0000000 --- a/Migrations/20241113063403_InitialMigration.Designer.cs +++ /dev/null @@ -1,467 +0,0 @@ -// -using System; -using AonFreelancing.Contexts; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace AonFreelancing.Migrations -{ - [DbContext(typeof(MainAppContext))] - [Migration("20241113063403_InitialMigration")] - partial class InitialMigration - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "8.0.10"); - - modelBuilder.Entity("AonFreelancing.Models.ApplicationRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("AonFreelancing.Models.OTP", b => - { - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("Code") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("ExpiresAt") - .HasColumnType("TEXT"); - - b.Property("IsUsed") - .HasColumnType("INTEGER"); - - b.HasKey("PhoneNumber"); - - b.ToTable("otps", null, t => - { - t.HasCheckConstraint("CK_CODE", "length([Code]) = 6"); - }); - }); - - modelBuilder.Entity("AonFreelancing.Models.Project", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Budget") - .HasColumnType("TEXT"); - - b.Property("ClientId") - .HasColumnType("INTEGER"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("Description") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FreelancerId") - .HasColumnType("INTEGER"); - - b.Property("PriceType") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ProgressStatus") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Qualification") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Status") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Title") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("ClientId"); - - b.HasIndex("FreelancerId"); - - b.ToTable("Projects"); - }); - - modelBuilder.Entity("AonFreelancing.Models.TempUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("PhoneNumber") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("PhoneNumber") - .IsUnique(); - - b.ToTable("TempUser", (string)null); - }); - - modelBuilder.Entity("AonFreelancing.Models.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.HasIndex("PhoneNumber") - .IsUnique(); - - b.ToTable("AspNetUsers", (string)null); - - b.UseTptMappingStrategy(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.Property("RoleId") - .HasColumnType("INTEGER"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("AonFreelancing.Models.Client", b => - { - b.HasBaseType("AonFreelancing.Models.User"); - - b.Property("CompanyName") - .IsRequired() - .HasColumnType("TEXT"); - - b.ToTable("Clients", (string)null); - }); - - modelBuilder.Entity("AonFreelancing.Models.Freelancer", b => - { - b.HasBaseType("AonFreelancing.Models.User"); - - b.Property("Skills") - .IsRequired() - .HasColumnType("TEXT"); - - b.ToTable("Freelancers", (string)null); - }); - - modelBuilder.Entity("AonFreelancing.Models.SystemUser", b => - { - b.HasBaseType("AonFreelancing.Models.User"); - - b.Property("Permissions") - .IsRequired() - .HasColumnType("TEXT"); - - b.ToTable("SystemUsers", (string)null); - }); - - modelBuilder.Entity("AonFreelancing.Models.OTP", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithOne() - .HasForeignKey("AonFreelancing.Models.OTP", "PhoneNumber") - .HasPrincipalKey("AonFreelancing.Models.User", "PhoneNumber") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AonFreelancing.Models.Project", b => - { - b.HasOne("AonFreelancing.Models.Client", "Client") - .WithMany("Projects") - .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("AonFreelancing.Models.Freelancer", "Freelancer") - .WithMany() - .HasForeignKey("FreelancerId"); - - b.Navigation("Client"); - - b.Navigation("Freelancer"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("AonFreelancing.Models.ApplicationRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("AonFreelancing.Models.ApplicationRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("AonFreelancing.Models.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AonFreelancing.Models.Client", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithOne() - .HasForeignKey("AonFreelancing.Models.Client", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AonFreelancing.Models.Freelancer", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithOne() - .HasForeignKey("AonFreelancing.Models.Freelancer", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AonFreelancing.Models.SystemUser", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithOne() - .HasForeignKey("AonFreelancing.Models.SystemUser", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AonFreelancing.Models.Client", b => - { - b.Navigation("Projects"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Migrations/20241113064604_otpToTempUser.Designer.cs b/Migrations/20241113064604_otpToTempUser.Designer.cs deleted file mode 100644 index 2ed3d21..0000000 --- a/Migrations/20241113064604_otpToTempUser.Designer.cs +++ /dev/null @@ -1,466 +0,0 @@ -// -using System; -using AonFreelancing.Contexts; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace AonFreelancing.Migrations -{ - [DbContext(typeof(MainAppContext))] - [Migration("20241113064604_otpToTempUser")] - partial class otpToTempUser - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "8.0.10"); - - modelBuilder.Entity("AonFreelancing.Models.ApplicationRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("AonFreelancing.Models.OTP", b => - { - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("Code") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("ExpiresAt") - .HasColumnType("TEXT"); - - b.Property("IsUsed") - .HasColumnType("INTEGER"); - - b.HasKey("PhoneNumber"); - - b.ToTable("otps", null, t => - { - t.HasCheckConstraint("CK_CODE", "length([Code]) = 6"); - }); - }); - - modelBuilder.Entity("AonFreelancing.Models.Project", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Budget") - .HasColumnType("TEXT"); - - b.Property("ClientId") - .HasColumnType("INTEGER"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("Description") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("FreelancerId") - .HasColumnType("INTEGER"); - - b.Property("PriceType") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ProgressStatus") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Qualification") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Status") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Title") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("ClientId"); - - b.HasIndex("FreelancerId"); - - b.ToTable("Projects"); - }); - - modelBuilder.Entity("AonFreelancing.Models.TempUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("PhoneNumber") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("PhoneNumber") - .IsUnique(); - - b.ToTable("TempUser", (string)null); - }); - - modelBuilder.Entity("AonFreelancing.Models.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.HasIndex("PhoneNumber") - .IsUnique(); - - b.ToTable("AspNetUsers", (string)null); - - b.UseTptMappingStrategy(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.Property("RoleId") - .HasColumnType("INTEGER"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("AonFreelancing.Models.Client", b => - { - b.HasBaseType("AonFreelancing.Models.User"); - - b.Property("CompanyName") - .IsRequired() - .HasColumnType("TEXT"); - - b.ToTable("Clients", (string)null); - }); - - modelBuilder.Entity("AonFreelancing.Models.Freelancer", b => - { - b.HasBaseType("AonFreelancing.Models.User"); - - b.Property("Skills") - .IsRequired() - .HasColumnType("TEXT"); - - b.ToTable("Freelancers", (string)null); - }); - - modelBuilder.Entity("AonFreelancing.Models.SystemUser", b => - { - b.HasBaseType("AonFreelancing.Models.User"); - - b.Property("Permissions") - .IsRequired() - .HasColumnType("TEXT"); - - b.ToTable("SystemUsers", (string)null); - }); - - modelBuilder.Entity("AonFreelancing.Models.OTP", b => - { - b.HasOne("AonFreelancing.Models.TempUser", null) - .WithOne() - .HasForeignKey("AonFreelancing.Models.OTP", "PhoneNumber") - .HasPrincipalKey("AonFreelancing.Models.TempUser", "PhoneNumber") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AonFreelancing.Models.Project", b => - { - b.HasOne("AonFreelancing.Models.Client", "Client") - .WithMany("Projects") - .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("AonFreelancing.Models.Freelancer", "Freelancer") - .WithMany() - .HasForeignKey("FreelancerId"); - - b.Navigation("Client"); - - b.Navigation("Freelancer"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("AonFreelancing.Models.ApplicationRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("AonFreelancing.Models.ApplicationRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("AonFreelancing.Models.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AonFreelancing.Models.Client", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithOne() - .HasForeignKey("AonFreelancing.Models.Client", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AonFreelancing.Models.Freelancer", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithOne() - .HasForeignKey("AonFreelancing.Models.Freelancer", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AonFreelancing.Models.SystemUser", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithOne() - .HasForeignKey("AonFreelancing.Models.SystemUser", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AonFreelancing.Models.Client", b => - { - b.Navigation("Projects"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Migrations/20241113064604_otpToTempUser.cs b/Migrations/20241113064604_otpToTempUser.cs deleted file mode 100644 index b2821c8..0000000 --- a/Migrations/20241113064604_otpToTempUser.cs +++ /dev/null @@ -1,78 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace AonFreelancing.Migrations -{ - /// - public partial class otpToTempUser : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_otps_AspNetUsers_PhoneNumber", - table: "otps"); - - migrationBuilder.DropUniqueConstraint( - name: "AK_AspNetUsers_PhoneNumber", - table: "AspNetUsers"); - - migrationBuilder.AlterColumn( - name: "PhoneNumber", - table: "AspNetUsers", - type: "TEXT", - nullable: true, - oldClrType: typeof(string), - oldType: "TEXT"); - - migrationBuilder.AddUniqueConstraint( - name: "AK_TempUser_PhoneNumber", - table: "TempUser", - column: "PhoneNumber"); - - migrationBuilder.AddForeignKey( - name: "FK_otps_TempUser_PhoneNumber", - table: "otps", - column: "PhoneNumber", - principalTable: "TempUser", - principalColumn: "PhoneNumber", - onDelete: ReferentialAction.Cascade); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_otps_TempUser_PhoneNumber", - table: "otps"); - - migrationBuilder.DropUniqueConstraint( - name: "AK_TempUser_PhoneNumber", - table: "TempUser"); - - migrationBuilder.AlterColumn( - name: "PhoneNumber", - table: "AspNetUsers", - type: "TEXT", - nullable: false, - defaultValue: "", - oldClrType: typeof(string), - oldType: "TEXT", - oldNullable: true); - - migrationBuilder.AddUniqueConstraint( - name: "AK_AspNetUsers_PhoneNumber", - table: "AspNetUsers", - column: "PhoneNumber"); - - migrationBuilder.AddForeignKey( - name: "FK_otps_AspNetUsers_PhoneNumber", - table: "otps", - column: "PhoneNumber", - principalTable: "AspNetUsers", - principalColumn: "PhoneNumber", - onDelete: ReferentialAction.Cascade); - } - } -} diff --git a/Migrations/20241114060939_projectMirgation.Designer.cs b/Migrations/20241114060939_projectMirgation.Designer.cs deleted file mode 100644 index b6f586b..0000000 --- a/Migrations/20241114060939_projectMirgation.Designer.cs +++ /dev/null @@ -1,483 +0,0 @@ -// -using System; -using AonFreelancing.Contexts; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace AonFreelancing.Migrations -{ - [DbContext(typeof(MainAppContext))] - [Migration("20241114060939_projectMirgation")] - partial class projectMirgation - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "8.0.10"); - - modelBuilder.Entity("AonFreelancing.Models.ApplicationRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("AonFreelancing.Models.OTP", b => - { - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("Code") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("ExpiresAt") - .HasColumnType("TEXT"); - - b.Property("IsUsed") - .HasColumnType("INTEGER"); - - b.HasKey("PhoneNumber"); - - b.ToTable("otps", null, t => - { - t.HasCheckConstraint("CK_CODE", "length([Code]) = 6"); - }); - }); - - modelBuilder.Entity("AonFreelancing.Models.Project", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Budget") - .HasColumnType("TEXT"); - - b.Property("ClientId") - .HasColumnType("INTEGER"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("Description") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Duration") - .HasColumnType("INTEGER"); - - b.Property("EndDate") - .HasColumnType("TEXT"); - - b.Property("FreelancerId") - .HasColumnType("INTEGER"); - - b.Property("PriceType") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("QualificationName") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("StartDate") - .HasColumnType("TEXT"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasColumnType("TEXT") - .HasDefaultValue("Available"); - - b.Property("Title") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("ClientId"); - - b.HasIndex("FreelancerId"); - - b.ToTable("Projects", null, t => - { - t.HasCheckConstraint("CK_PRICE_TYPE", "[PriceType] IN ('Fixed', 'PerHour')"); - - t.HasCheckConstraint("CK_QUALIFICATION_NAME", "[QualificationName] IN ('uiux', 'frontend', 'mobile', 'backend', 'fullstack')"); - - t.HasCheckConstraint("CK_STATUS", "[Status] IN ('Available', 'Closed')"); - }); - }); - - modelBuilder.Entity("AonFreelancing.Models.TempUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("PhoneNumber") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("PhoneNumber") - .IsUnique(); - - b.ToTable("TempUser", (string)null); - }); - - modelBuilder.Entity("AonFreelancing.Models.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("About") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.HasIndex("PhoneNumber") - .IsUnique(); - - b.ToTable("AspNetUsers", (string)null); - - b.UseTptMappingStrategy(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.Property("RoleId") - .HasColumnType("INTEGER"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("AonFreelancing.Models.Client", b => - { - b.HasBaseType("AonFreelancing.Models.User"); - - b.Property("CompanyName") - .IsRequired() - .HasColumnType("TEXT"); - - b.ToTable("Clients", (string)null); - }); - - modelBuilder.Entity("AonFreelancing.Models.Freelancer", b => - { - b.HasBaseType("AonFreelancing.Models.User"); - - b.Property("Skills") - .IsRequired() - .HasColumnType("TEXT"); - - b.ToTable("Freelancers", (string)null); - }); - - modelBuilder.Entity("AonFreelancing.Models.SystemUser", b => - { - b.HasBaseType("AonFreelancing.Models.User"); - - b.Property("Permissions") - .IsRequired() - .HasColumnType("TEXT"); - - b.ToTable("SystemUsers", (string)null); - }); - - modelBuilder.Entity("AonFreelancing.Models.OTP", b => - { - b.HasOne("AonFreelancing.Models.TempUser", null) - .WithOne() - .HasForeignKey("AonFreelancing.Models.OTP", "PhoneNumber") - .HasPrincipalKey("AonFreelancing.Models.TempUser", "PhoneNumber") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AonFreelancing.Models.Project", b => - { - b.HasOne("AonFreelancing.Models.Client", "Client") - .WithMany("Projects") - .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("AonFreelancing.Models.Freelancer", "Freelancer") - .WithMany() - .HasForeignKey("FreelancerId"); - - b.Navigation("Client"); - - b.Navigation("Freelancer"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("AonFreelancing.Models.ApplicationRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("AonFreelancing.Models.ApplicationRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("AonFreelancing.Models.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AonFreelancing.Models.Client", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithOne() - .HasForeignKey("AonFreelancing.Models.Client", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AonFreelancing.Models.Freelancer", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithOne() - .HasForeignKey("AonFreelancing.Models.Freelancer", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AonFreelancing.Models.SystemUser", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithOne() - .HasForeignKey("AonFreelancing.Models.SystemUser", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AonFreelancing.Models.Client", b => - { - b.Navigation("Projects"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Migrations/20241114060939_projectMirgation.cs b/Migrations/20241114060939_projectMirgation.cs deleted file mode 100644 index 64cbdc7..0000000 --- a/Migrations/20241114060939_projectMirgation.cs +++ /dev/null @@ -1,126 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace AonFreelancing.Migrations -{ - /// - public partial class projectMirgation : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "ProgressStatus", - table: "Projects"); - - migrationBuilder.RenameColumn( - name: "Qualification", - table: "Projects", - newName: "QualificationName"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "Projects", - type: "TEXT", - nullable: false, - defaultValue: "Available", - oldClrType: typeof(string), - oldType: "TEXT"); - - migrationBuilder.AddColumn( - name: "Duration", - table: "Projects", - type: "INTEGER", - nullable: false, - defaultValue: 0); - - migrationBuilder.AddColumn( - name: "EndDate", - table: "Projects", - type: "TEXT", - nullable: true); - - migrationBuilder.AddColumn( - name: "StartDate", - table: "Projects", - type: "TEXT", - nullable: true); - - migrationBuilder.AddColumn( - name: "About", - table: "AspNetUsers", - type: "TEXT", - nullable: true); - - migrationBuilder.AddCheckConstraint( - name: "CK_PRICE_TYPE", - table: "Projects", - sql: "[PriceType] IN ('Fixed', 'PerHour')"); - - migrationBuilder.AddCheckConstraint( - name: "CK_QUALIFICATION_NAME", - table: "Projects", - sql: "[QualificationName] IN ('uiux', 'frontend', 'mobile', 'backend', 'fullstack')"); - - migrationBuilder.AddCheckConstraint( - name: "CK_STATUS", - table: "Projects", - sql: "[Status] IN ('Available', 'Closed')"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropCheckConstraint( - name: "CK_PRICE_TYPE", - table: "Projects"); - - migrationBuilder.DropCheckConstraint( - name: "CK_QUALIFICATION_NAME", - table: "Projects"); - - migrationBuilder.DropCheckConstraint( - name: "CK_STATUS", - table: "Projects"); - - migrationBuilder.DropColumn( - name: "Duration", - table: "Projects"); - - migrationBuilder.DropColumn( - name: "EndDate", - table: "Projects"); - - migrationBuilder.DropColumn( - name: "StartDate", - table: "Projects"); - - migrationBuilder.DropColumn( - name: "About", - table: "AspNetUsers"); - - migrationBuilder.RenameColumn( - name: "QualificationName", - table: "Projects", - newName: "Qualification"); - - migrationBuilder.AlterColumn( - name: "Status", - table: "Projects", - type: "TEXT", - nullable: false, - oldClrType: typeof(string), - oldType: "TEXT", - oldDefaultValue: "Available"); - - migrationBuilder.AddColumn( - name: "ProgressStatus", - table: "Projects", - type: "TEXT", - nullable: false, - defaultValue: ""); - } - } -} diff --git a/Migrations/20241114063948_userTypeToUserTable.cs b/Migrations/20241114063948_userTypeToUserTable.cs deleted file mode 100644 index 5fe0f53..0000000 --- a/Migrations/20241114063948_userTypeToUserTable.cs +++ /dev/null @@ -1,28 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace AonFreelancing.Migrations -{ - /// - public partial class userTypeToUserTable : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "UserType", - table: "AspNetUsers", - type: "TEXT", - nullable: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "UserType", - table: "AspNetUsers"); - } - } -} diff --git a/Migrations/20241114072136_reomvedUserTypeColumn.Designer.cs b/Migrations/20241114072136_reomvedUserTypeColumn.Designer.cs deleted file mode 100644 index a62f938..0000000 --- a/Migrations/20241114072136_reomvedUserTypeColumn.Designer.cs +++ /dev/null @@ -1,483 +0,0 @@ -// -using System; -using AonFreelancing.Contexts; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace AonFreelancing.Migrations -{ - [DbContext(typeof(MainAppContext))] - [Migration("20241114072136_reomvedUserTypeColumn")] - partial class reomvedUserTypeColumn - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "8.0.10"); - - modelBuilder.Entity("AonFreelancing.Models.ApplicationRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("AonFreelancing.Models.OTP", b => - { - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("Code") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("ExpiresAt") - .HasColumnType("TEXT"); - - b.Property("IsUsed") - .HasColumnType("INTEGER"); - - b.HasKey("PhoneNumber"); - - b.ToTable("otps", null, t => - { - t.HasCheckConstraint("CK_CODE", "length([Code]) = 6"); - }); - }); - - modelBuilder.Entity("AonFreelancing.Models.Project", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Budget") - .HasColumnType("TEXT"); - - b.Property("ClientId") - .HasColumnType("INTEGER"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("Description") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Duration") - .HasColumnType("INTEGER"); - - b.Property("EndDate") - .HasColumnType("TEXT"); - - b.Property("FreelancerId") - .HasColumnType("INTEGER"); - - b.Property("PriceType") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("QualificationName") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("StartDate") - .HasColumnType("TEXT"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasColumnType("TEXT") - .HasDefaultValue("Available"); - - b.Property("Title") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("ClientId"); - - b.HasIndex("FreelancerId"); - - b.ToTable("Projects", null, t => - { - t.HasCheckConstraint("CK_PRICE_TYPE", "[PriceType] IN ('Fixed', 'PerHour')"); - - t.HasCheckConstraint("CK_QUALIFICATION_NAME", "[QualificationName] IN ('uiux', 'frontend', 'mobile', 'backend', 'fullstack')"); - - t.HasCheckConstraint("CK_STATUS", "[Status] IN ('Available', 'Closed')"); - }); - }); - - modelBuilder.Entity("AonFreelancing.Models.TempUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("PhoneNumber") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("PhoneNumber") - .IsUnique(); - - b.ToTable("TempUser", (string)null); - }); - - modelBuilder.Entity("AonFreelancing.Models.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("About") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.HasIndex("PhoneNumber") - .IsUnique(); - - b.ToTable("AspNetUsers", (string)null); - - b.UseTptMappingStrategy(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.Property("RoleId") - .HasColumnType("INTEGER"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("AonFreelancing.Models.Client", b => - { - b.HasBaseType("AonFreelancing.Models.User"); - - b.Property("CompanyName") - .IsRequired() - .HasColumnType("TEXT"); - - b.ToTable("Clients", (string)null); - }); - - modelBuilder.Entity("AonFreelancing.Models.Freelancer", b => - { - b.HasBaseType("AonFreelancing.Models.User"); - - b.Property("Skills") - .IsRequired() - .HasColumnType("TEXT"); - - b.ToTable("Freelancers", (string)null); - }); - - modelBuilder.Entity("AonFreelancing.Models.SystemUser", b => - { - b.HasBaseType("AonFreelancing.Models.User"); - - b.Property("Permissions") - .IsRequired() - .HasColumnType("TEXT"); - - b.ToTable("SystemUsers", (string)null); - }); - - modelBuilder.Entity("AonFreelancing.Models.OTP", b => - { - b.HasOne("AonFreelancing.Models.TempUser", null) - .WithOne() - .HasForeignKey("AonFreelancing.Models.OTP", "PhoneNumber") - .HasPrincipalKey("AonFreelancing.Models.TempUser", "PhoneNumber") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AonFreelancing.Models.Project", b => - { - b.HasOne("AonFreelancing.Models.Client", "Client") - .WithMany("Projects") - .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("AonFreelancing.Models.Freelancer", "Freelancer") - .WithMany() - .HasForeignKey("FreelancerId"); - - b.Navigation("Client"); - - b.Navigation("Freelancer"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("AonFreelancing.Models.ApplicationRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("AonFreelancing.Models.ApplicationRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("AonFreelancing.Models.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AonFreelancing.Models.Client", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithOne() - .HasForeignKey("AonFreelancing.Models.Client", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AonFreelancing.Models.Freelancer", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithOne() - .HasForeignKey("AonFreelancing.Models.Freelancer", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AonFreelancing.Models.SystemUser", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithOne() - .HasForeignKey("AonFreelancing.Models.SystemUser", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AonFreelancing.Models.Client", b => - { - b.Navigation("Projects"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Migrations/20241114072136_reomvedUserTypeColumn.cs b/Migrations/20241114072136_reomvedUserTypeColumn.cs deleted file mode 100644 index a31108d..0000000 --- a/Migrations/20241114072136_reomvedUserTypeColumn.cs +++ /dev/null @@ -1,28 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace AonFreelancing.Migrations -{ - /// - public partial class reomvedUserTypeColumn : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "UserType", - table: "AspNetUsers"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "UserType", - table: "AspNetUsers", - type: "TEXT", - nullable: true); - } - } -} diff --git a/Migrations/20241114113925_projectsTableMigration.Designer.cs b/Migrations/20241114113925_projectsTableMigration.Designer.cs deleted file mode 100644 index f8e79b9..0000000 --- a/Migrations/20241114113925_projectsTableMigration.Designer.cs +++ /dev/null @@ -1,483 +0,0 @@ -// -using System; -using AonFreelancing.Contexts; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace AonFreelancing.Migrations -{ - [DbContext(typeof(MainAppContext))] - [Migration("20241114113925_projectsTableMigration")] - partial class projectsTableMigration - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "8.0.10"); - - modelBuilder.Entity("AonFreelancing.Models.ApplicationRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("AonFreelancing.Models.OTP", b => - { - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("Code") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("ExpiresAt") - .HasColumnType("TEXT"); - - b.Property("IsUsed") - .HasColumnType("INTEGER"); - - b.HasKey("PhoneNumber"); - - b.ToTable("otps", null, t => - { - t.HasCheckConstraint("CK_CODE", "length([Code]) = 6"); - }); - }); - - modelBuilder.Entity("AonFreelancing.Models.Project", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Budget") - .HasColumnType("TEXT"); - - b.Property("ClientId") - .HasColumnType("INTEGER"); - - b.Property("CreatedAt") - .HasColumnType("TEXT"); - - b.Property("Description") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Duration") - .HasColumnType("INTEGER"); - - b.Property("EndDate") - .HasColumnType("TEXT"); - - b.Property("FreelancerId") - .HasColumnType("INTEGER"); - - b.Property("PriceType") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("QualificationName") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("StartDate") - .HasColumnType("TEXT"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasColumnType("TEXT") - .HasDefaultValue("Available"); - - b.Property("Title") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("ClientId"); - - b.HasIndex("FreelancerId"); - - b.ToTable("Projects", null, t => - { - t.HasCheckConstraint("CK_PRICE_TYPE", "[PriceType] IN ('Fixed', 'PerHour')"); - - t.HasCheckConstraint("CK_QUALIFICATION_NAME", "[QualificationName] IN ('uiux', 'frontend', 'mobile', 'backend', 'fullstack')"); - - t.HasCheckConstraint("CK_STATUS", "[Status] IN ('Available', 'Closed')"); - }); - }); - - modelBuilder.Entity("AonFreelancing.Models.TempUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("PhoneNumber") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("PhoneNumber") - .IsUnique(); - - b.ToTable("TempUser", (string)null); - }); - - modelBuilder.Entity("AonFreelancing.Models.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("About") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.HasIndex("PhoneNumber") - .IsUnique(); - - b.ToTable("AspNetUsers", (string)null); - - b.UseTptMappingStrategy(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.Property("RoleId") - .HasColumnType("INTEGER"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("AonFreelancing.Models.Client", b => - { - b.HasBaseType("AonFreelancing.Models.User"); - - b.Property("CompanyName") - .IsRequired() - .HasColumnType("TEXT"); - - b.ToTable("Clients", (string)null); - }); - - modelBuilder.Entity("AonFreelancing.Models.Freelancer", b => - { - b.HasBaseType("AonFreelancing.Models.User"); - - b.Property("Skills") - .IsRequired() - .HasColumnType("TEXT"); - - b.ToTable("Freelancers", (string)null); - }); - - modelBuilder.Entity("AonFreelancing.Models.SystemUser", b => - { - b.HasBaseType("AonFreelancing.Models.User"); - - b.Property("Permissions") - .IsRequired() - .HasColumnType("TEXT"); - - b.ToTable("SystemUsers", (string)null); - }); - - modelBuilder.Entity("AonFreelancing.Models.OTP", b => - { - b.HasOne("AonFreelancing.Models.TempUser", null) - .WithOne() - .HasForeignKey("AonFreelancing.Models.OTP", "PhoneNumber") - .HasPrincipalKey("AonFreelancing.Models.TempUser", "PhoneNumber") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AonFreelancing.Models.Project", b => - { - b.HasOne("AonFreelancing.Models.Client", "Client") - .WithMany("Projects") - .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("AonFreelancing.Models.Freelancer", "Freelancer") - .WithMany() - .HasForeignKey("FreelancerId"); - - b.Navigation("Client"); - - b.Navigation("Freelancer"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("AonFreelancing.Models.ApplicationRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("AonFreelancing.Models.ApplicationRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("AonFreelancing.Models.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AonFreelancing.Models.Client", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithOne() - .HasForeignKey("AonFreelancing.Models.Client", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AonFreelancing.Models.Freelancer", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithOne() - .HasForeignKey("AonFreelancing.Models.Freelancer", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AonFreelancing.Models.SystemUser", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithOne() - .HasForeignKey("AonFreelancing.Models.SystemUser", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AonFreelancing.Models.Client", b => - { - b.Navigation("Projects"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Migrations/20241114113925_projectsTableMigration.cs b/Migrations/20241114113925_projectsTableMigration.cs deleted file mode 100644 index ebd0f69..0000000 --- a/Migrations/20241114113925_projectsTableMigration.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace AonFreelancing.Migrations -{ - /// - public partial class projectsTableMigration : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - - } - } -} diff --git a/Migrations/20241114063948_userTypeToUserTable.Designer.cs b/Migrations/20241121190728_ImageMigration.Designer.cs similarity index 79% rename from Migrations/20241114063948_userTypeToUserTable.Designer.cs rename to Migrations/20241121190728_ImageMigration.Designer.cs index 33925b8..7c5f46e 100644 --- a/Migrations/20241114063948_userTypeToUserTable.Designer.cs +++ b/Migrations/20241121190728_ImageMigration.Designer.cs @@ -11,8 +11,8 @@ namespace AonFreelancing.Migrations { [DbContext(typeof(MainAppContext))] - [Migration("20241114063948_userTypeToUserTable")] - partial class userTypeToUserTable + [Migration("20241121190728_ImageMigration")] + partial class ImageMigration { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -47,6 +47,38 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.ToTable("AspNetRoles", (string)null); }); + modelBuilder.Entity("AonFreelancing.Models.EntityTask", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("CompletedAt") + .HasColumnType("TEXT"); + + b.Property("DedlineAt") + .HasColumnType("TEXT"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("Notes") + .HasColumnType("TEXT"); + + b.Property("ProjectId") + .HasColumnType("INTEGER"); + + b.Property("status") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.ToTable("Tasks", (string)null); + }); + modelBuilder.Entity("AonFreelancing.Models.OTP", b => { b.Property("PhoneNumber") @@ -101,6 +133,9 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Property("FreelancerId") .HasColumnType("INTEGER"); + b.Property("ImageName") + .HasColumnType("TEXT"); + b.Property("PriceType") .IsRequired() .HasColumnType("TEXT"); @@ -138,6 +173,64 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) }); }); + modelBuilder.Entity("AonFreelancing.Models.Responses.Bid", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("ApprovedAt") + .HasColumnType("TEXT"); + + b.Property("FreelancerId") + .HasColumnType("INTEGER"); + + b.Property("Nots") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("ProjectId") + .HasColumnType("INTEGER"); + + b.Property("proposed_Price") + .HasColumnType("TEXT"); + + b.Property("status") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("submittedAt") + .HasColumnType("TEXT"); + + b.HasKey("id"); + + b.HasIndex("FreelancerId"); + + b.HasIndex("ProjectId"); + + b.ToTable("Bids", (string)null); + }); + + modelBuilder.Entity("AonFreelancing.Models.Responses.TemUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("PhoneNumberConfirm") + .HasColumnType("INTEGER"); + + b.Property("phoneNumber") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("phoneNumber") + .IsUnique(); + + b.ToTable("TempUsers", (string)null); + }); + modelBuilder.Entity("AonFreelancing.Models.TempUser", b => { b.Property("Id") @@ -219,9 +312,6 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasMaxLength(256) .HasColumnType("TEXT"); - b.Property("UserType") - .HasColumnType("TEXT"); - b.HasKey("Id"); b.HasIndex("NormalizedEmail") @@ -371,6 +461,17 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.ToTable("SystemUsers", (string)null); }); + modelBuilder.Entity("AonFreelancing.Models.EntityTask", b => + { + b.HasOne("AonFreelancing.Models.Project", "Project") + .WithMany("Tasks") + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Project"); + }); + modelBuilder.Entity("AonFreelancing.Models.OTP", b => { b.HasOne("AonFreelancing.Models.TempUser", null) @@ -398,6 +499,25 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Navigation("Freelancer"); }); + modelBuilder.Entity("AonFreelancing.Models.Responses.Bid", b => + { + b.HasOne("AonFreelancing.Models.Freelancer", "Freelancer") + .WithMany() + .HasForeignKey("FreelancerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AonFreelancing.Models.Project", "Project") + .WithMany("Bids") + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Freelancer"); + + b.Navigation("Project"); + }); + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => { b.HasOne("AonFreelancing.Models.ApplicationRole", null) @@ -476,6 +596,13 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsRequired(); }); + modelBuilder.Entity("AonFreelancing.Models.Project", b => + { + b.Navigation("Bids"); + + b.Navigation("Tasks"); + }); + modelBuilder.Entity("AonFreelancing.Models.Client", b => { b.Navigation("Projects"); diff --git a/Migrations/20241113063403_InitialMigration.cs b/Migrations/20241121190728_ImageMigration.cs similarity index 75% rename from Migrations/20241113063403_InitialMigration.cs rename to Migrations/20241121190728_ImageMigration.cs index b56845f..aa8242f 100644 --- a/Migrations/20241113063403_InitialMigration.cs +++ b/Migrations/20241121190728_ImageMigration.cs @@ -6,7 +6,7 @@ namespace AonFreelancing.Migrations { /// - public partial class InitialMigration : Migration + public partial class ImageMigration : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) @@ -33,6 +33,7 @@ protected override void Up(MigrationBuilder migrationBuilder) Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), Name = table.Column(type: "TEXT", nullable: false), + About = table.Column(type: "TEXT", nullable: true), UserName = table.Column(type: "TEXT", maxLength: 256, nullable: true), NormalizedUserName = table.Column(type: "TEXT", maxLength: 256, nullable: true), Email = table.Column(type: "TEXT", maxLength: 256, nullable: true), @@ -41,7 +42,7 @@ protected override void Up(MigrationBuilder migrationBuilder) PasswordHash = table.Column(type: "TEXT", nullable: true), SecurityStamp = table.Column(type: "TEXT", nullable: true), ConcurrencyStamp = table.Column(type: "TEXT", nullable: true), - PhoneNumber = table.Column(type: "TEXT", nullable: false), + PhoneNumber = table.Column(type: "TEXT", nullable: true), PhoneNumberConfirmed = table.Column(type: "INTEGER", nullable: false), TwoFactorEnabled = table.Column(type: "INTEGER", nullable: false), LockoutEnd = table.Column(type: "TEXT", nullable: true), @@ -51,7 +52,6 @@ protected override void Up(MigrationBuilder migrationBuilder) constraints: table => { table.PrimaryKey("PK_AspNetUsers", x => x.Id); - table.UniqueConstraint("AK_AspNetUsers_PhoneNumber", x => x.PhoneNumber); }); migrationBuilder.CreateTable( @@ -66,6 +66,21 @@ protected override void Up(MigrationBuilder migrationBuilder) constraints: table => { table.PrimaryKey("PK_TempUser", x => x.Id); + table.UniqueConstraint("AK_TempUser_PhoneNumber", x => x.PhoneNumber); + }); + + migrationBuilder.CreateTable( + name: "TempUsers", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + phoneNumber = table.Column(type: "TEXT", nullable: true), + PhoneNumberConfirm = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_TempUsers", x => x.Id); }); migrationBuilder.CreateTable( @@ -213,43 +228,43 @@ protected override void Up(MigrationBuilder migrationBuilder) }); migrationBuilder.CreateTable( - name: "otps", + name: "SystemUsers", columns: table => new { - PhoneNumber = table.Column(type: "TEXT", nullable: false), - Code = table.Column(type: "TEXT", nullable: false), - CreatedDate = table.Column(type: "TEXT", nullable: false), - ExpiresAt = table.Column(type: "TEXT", nullable: false), - IsUsed = table.Column(type: "INTEGER", nullable: false) + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Permissions = table.Column(type: "TEXT", nullable: false) }, constraints: table => { - table.PrimaryKey("PK_otps", x => x.PhoneNumber); - table.CheckConstraint("CK_CODE", "length([Code]) = 6"); + table.PrimaryKey("PK_SystemUsers", x => x.Id); table.ForeignKey( - name: "FK_otps_AspNetUsers_PhoneNumber", - column: x => x.PhoneNumber, + name: "FK_SystemUsers_AspNetUsers_Id", + column: x => x.Id, principalTable: "AspNetUsers", - principalColumn: "PhoneNumber", + principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( - name: "SystemUsers", + name: "otps", columns: table => new { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Permissions = table.Column(type: "TEXT", nullable: false) + PhoneNumber = table.Column(type: "TEXT", nullable: false), + Code = table.Column(type: "TEXT", nullable: false), + CreatedDate = table.Column(type: "TEXT", nullable: false), + ExpiresAt = table.Column(type: "TEXT", nullable: false), + IsUsed = table.Column(type: "INTEGER", nullable: false) }, constraints: table => { - table.PrimaryKey("PK_SystemUsers", x => x.Id); + table.PrimaryKey("PK_otps", x => x.PhoneNumber); + table.CheckConstraint("CK_CODE", "length([Code]) = 6"); table.ForeignKey( - name: "FK_SystemUsers_AspNetUsers_Id", - column: x => x.Id, - principalTable: "AspNetUsers", - principalColumn: "Id", + name: "FK_otps_TempUser_PhoneNumber", + column: x => x.PhoneNumber, + principalTable: "TempUser", + principalColumn: "PhoneNumber", onDelete: ReferentialAction.Cascade); }); @@ -263,16 +278,22 @@ protected override void Up(MigrationBuilder migrationBuilder) Description = table.Column(type: "TEXT", nullable: false), ClientId = table.Column(type: "INTEGER", nullable: false), CreatedAt = table.Column(type: "TEXT", nullable: false), + StartDate = table.Column(type: "TEXT", nullable: true), + ImageName = table.Column(type: "TEXT", nullable: true), + EndDate = table.Column(type: "TEXT", nullable: true), PriceType = table.Column(type: "TEXT", nullable: false), + Duration = table.Column(type: "INTEGER", nullable: false), Budget = table.Column(type: "TEXT", nullable: false), - Qualification = table.Column(type: "TEXT", nullable: false), - FreelancerId = table.Column(type: "INTEGER", nullable: true), - Status = table.Column(type: "TEXT", nullable: false), - ProgressStatus = table.Column(type: "TEXT", nullable: false) + QualificationName = table.Column(type: "TEXT", nullable: false), + Status = table.Column(type: "TEXT", nullable: false, defaultValue: "Available"), + FreelancerId = table.Column(type: "INTEGER", nullable: true) }, constraints: table => { table.PrimaryKey("PK_Projects", x => x.Id); + table.CheckConstraint("CK_PRICE_TYPE", "[PriceType] IN ('Fixed', 'PerHour')"); + table.CheckConstraint("CK_QUALIFICATION_NAME", "[QualificationName] IN ('uiux', 'frontend', 'mobile', 'backend', 'fullstack')"); + table.CheckConstraint("CK_STATUS", "[Status] IN ('Available', 'Closed')"); table.ForeignKey( name: "FK_Projects_Clients_ClientId", column: x => x.ClientId, @@ -286,6 +307,61 @@ protected override void Up(MigrationBuilder migrationBuilder) principalColumn: "Id"); }); + migrationBuilder.CreateTable( + name: "Bids", + columns: table => new + { + id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + ProjectId = table.Column(type: "INTEGER", nullable: false), + FreelancerId = table.Column(type: "INTEGER", nullable: false), + proposed_Price = table.Column(type: "TEXT", nullable: false), + Nots = table.Column(type: "TEXT", nullable: false), + status = table.Column(type: "TEXT", nullable: false), + submittedAt = table.Column(type: "TEXT", nullable: false), + ApprovedAt = table.Column(type: "TEXT", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Bids", x => x.id); + table.ForeignKey( + name: "FK_Bids_Freelancers_FreelancerId", + column: x => x.FreelancerId, + principalTable: "Freelancers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Bids_Projects_ProjectId", + column: x => x.ProjectId, + principalTable: "Projects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Tasks", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Name = table.Column(type: "TEXT", nullable: true), + ProjectId = table.Column(type: "INTEGER", nullable: false), + status = table.Column(type: "TEXT", nullable: false), + DedlineAt = table.Column(type: "TEXT", nullable: false), + CompletedAt = table.Column(type: "TEXT", nullable: false), + Notes = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Tasks", x => x.Id); + table.ForeignKey( + name: "FK_Tasks_Projects_ProjectId", + column: x => x.ProjectId, + principalTable: "Projects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + migrationBuilder.CreateIndex( name: "IX_AspNetRoleClaims_RoleId", table: "AspNetRoleClaims", @@ -329,6 +405,16 @@ protected override void Up(MigrationBuilder migrationBuilder) column: "NormalizedUserName", unique: true); + migrationBuilder.CreateIndex( + name: "IX_Bids_FreelancerId", + table: "Bids", + column: "FreelancerId"); + + migrationBuilder.CreateIndex( + name: "IX_Bids_ProjectId", + table: "Bids", + column: "ProjectId"); + migrationBuilder.CreateIndex( name: "IX_Projects_ClientId", table: "Projects", @@ -339,11 +425,22 @@ protected override void Up(MigrationBuilder migrationBuilder) table: "Projects", column: "FreelancerId"); + migrationBuilder.CreateIndex( + name: "IX_Tasks_ProjectId", + table: "Tasks", + column: "ProjectId"); + migrationBuilder.CreateIndex( name: "IX_TempUser_PhoneNumber", table: "TempUser", column: "PhoneNumber", unique: true); + + migrationBuilder.CreateIndex( + name: "IX_TempUsers_phoneNumber", + table: "TempUsers", + column: "phoneNumber", + unique: true); } /// @@ -365,20 +462,29 @@ protected override void Down(MigrationBuilder migrationBuilder) name: "AspNetUserTokens"); migrationBuilder.DropTable( - name: "otps"); + name: "Bids"); migrationBuilder.DropTable( - name: "Projects"); + name: "otps"); migrationBuilder.DropTable( name: "SystemUsers"); migrationBuilder.DropTable( - name: "TempUser"); + name: "Tasks"); + + migrationBuilder.DropTable( + name: "TempUsers"); migrationBuilder.DropTable( name: "AspNetRoles"); + migrationBuilder.DropTable( + name: "TempUser"); + + migrationBuilder.DropTable( + name: "Projects"); + migrationBuilder.DropTable( name: "Clients"); diff --git a/Migrations/MainAppContextModelSnapshot.cs b/Migrations/MainAppContextModelSnapshot.cs index 674bd33..b18d909 100644 --- a/Migrations/MainAppContextModelSnapshot.cs +++ b/Migrations/MainAppContextModelSnapshot.cs @@ -44,6 +44,38 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("AspNetRoles", (string)null); }); + modelBuilder.Entity("AonFreelancing.Models.EntityTask", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("CompletedAt") + .HasColumnType("TEXT"); + + b.Property("DedlineAt") + .HasColumnType("TEXT"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("Notes") + .HasColumnType("TEXT"); + + b.Property("ProjectId") + .HasColumnType("INTEGER"); + + b.Property("status") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.ToTable("Tasks", (string)null); + }); + modelBuilder.Entity("AonFreelancing.Models.OTP", b => { b.Property("PhoneNumber") @@ -98,6 +130,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("FreelancerId") .HasColumnType("INTEGER"); + b.Property("ImageName") + .HasColumnType("TEXT"); + b.Property("PriceType") .IsRequired() .HasColumnType("TEXT"); @@ -135,25 +170,42 @@ protected override void BuildModel(ModelBuilder modelBuilder) }); }); - modelBuilder.Entity("AonFreelancing.Models.TempUser", b => + modelBuilder.Entity("AonFreelancing.Models.Responses.Bid", b => { - b.Property("Id") + b.Property("id") .ValueGeneratedOnAdd() .HasColumnType("INTEGER"); - b.Property("PhoneNumber") + b.Property("ApprovedAt") + .HasColumnType("TEXT"); + + b.Property("FreelancerId") + .HasColumnType("INTEGER"); + + b.Property("Nots") .IsRequired() .HasColumnType("TEXT"); - b.Property("PhoneNumberConfirmed") + b.Property("ProjectId") .HasColumnType("INTEGER"); - b.HasKey("Id"); + b.Property("proposed_Price") + .HasColumnType("TEXT"); - b.HasIndex("PhoneNumber") - .IsUnique(); + b.Property("status") + .IsRequired() + .HasColumnType("TEXT"); - b.ToTable("TempUser", (string)null); + b.Property("submittedAt") + .HasColumnType("TEXT"); + + b.HasKey("id"); + + b.HasIndex("FreelancerId"); + + b.HasIndex("ProjectId"); + + b.ToTable("Bids", (string)null); }); modelBuilder.Entity("AonFreelancing.Models.Responses.TemUser", b => @@ -176,6 +228,27 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("TempUsers", (string)null); }); + modelBuilder.Entity("AonFreelancing.Models.TempUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("PhoneNumber") + .IsUnique(); + + b.ToTable("TempUser", (string)null); + }); + modelBuilder.Entity("AonFreelancing.Models.User", b => { b.Property("Id") @@ -385,6 +458,17 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("SystemUsers", (string)null); }); + modelBuilder.Entity("AonFreelancing.Models.EntityTask", b => + { + b.HasOne("AonFreelancing.Models.Project", "Project") + .WithMany("Tasks") + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Project"); + }); + modelBuilder.Entity("AonFreelancing.Models.OTP", b => { b.HasOne("AonFreelancing.Models.TempUser", null) @@ -412,6 +496,25 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("Freelancer"); }); + modelBuilder.Entity("AonFreelancing.Models.Responses.Bid", b => + { + b.HasOne("AonFreelancing.Models.Freelancer", "Freelancer") + .WithMany() + .HasForeignKey("FreelancerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AonFreelancing.Models.Project", "Project") + .WithMany("Bids") + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Freelancer"); + + b.Navigation("Project"); + }); + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => { b.HasOne("AonFreelancing.Models.ApplicationRole", null) @@ -490,6 +593,13 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsRequired(); }); + modelBuilder.Entity("AonFreelancing.Models.Project", b => + { + b.Navigation("Bids"); + + b.Navigation("Tasks"); + }); + modelBuilder.Entity("AonFreelancing.Models.Client", b => { b.Navigation("Projects"); diff --git a/Models/DTOs/ProjectInputDTO.cs b/Models/DTOs/ProjectInputDTO.cs index 1234e59..e7fa3b4 100644 --- a/Models/DTOs/ProjectInputDTO.cs +++ b/Models/DTOs/ProjectInputDTO.cs @@ -16,6 +16,8 @@ public class ProjectInputDto [AllowedValues(["uiux", "mobile", "frontend", "backend", "fullstack"])] public string QualificationName { get; set; } + + public IFormFile? ImageName { get; set; } [Required] [Range(1,int.MaxValue)] public int Duration { get; set; } //Number of days diff --git a/Models/DTOs/ProjectOutDTO.cs b/Models/DTOs/ProjectOutDTO.cs index 8c9a1f2..3a912ab 100644 --- a/Models/DTOs/ProjectOutDTO.cs +++ b/Models/DTOs/ProjectOutDTO.cs @@ -10,6 +10,7 @@ public class ProjectOutDTO public int Duration { get; set; } public string Title { get; set; } public string Description { get; set; } + public string Image { get; set; } public string Qualifications { get; set; } public string PriceType { get; set; } public string Status { get; set; } @@ -18,5 +19,21 @@ public class ProjectOutDTO public DateTime? StartDate { get; set; } public DateTime? EndDate { get; set; } public string? CreationTime { get; set; } + + public ProjectOutDTO(Project project, string imageBaseUrl) + { + Title = project.Title; + Description = project.Description; + Status = project.Status; + Budget = project.Budget; + if (project.ImageName != null) + Image = $"{imageBaseUrl}/{project.ImageName}"; + Duration = project.Duration; + PriceType = project.PriceType; + Qualifications = project.QualificationName; + CreatedAt = project.CreatedAt; + StartDate = project.StartDate; + EndDate = project.EndDate; + } } } diff --git a/Models/EntityTask.cs b/Models/EntityTask.cs new file mode 100644 index 0000000..a2b5212 --- /dev/null +++ b/Models/EntityTask.cs @@ -0,0 +1,26 @@ +using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel.DataAnnotations; + +namespace AonFreelancing.Models +{ + public class EntityTask + { + + [Key] + public int Id { get; set; } + + public string? Name { get; set; } + public int ProjectId { get; set; } + + [ForeignKey("ProjectId")] + public Project Project { get; set; } + + [AllowedValues("to_do", "in_progress", "in _review", "done")] + public string status { get; set; } = "to_do"; + + + public DateTime DedlineAt { get; set; } + public DateTime CompletedAt { get; set; } + public string? Notes { get; set; } + } +} diff --git a/Models/Project.cs b/Models/Project.cs index d2a3754..8f5871f 100644 --- a/Models/Project.cs +++ b/Models/Project.cs @@ -1,4 +1,5 @@ -using System.ComponentModel.DataAnnotations; +using AonFreelancing.Models.Responses; +using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Diagnostics.CodeAnalysis; @@ -21,14 +22,19 @@ public class Project public DateTime CreatedAt { get; set; } public DateTime? StartDate { get; set; } + + public string ?ImageName { get; set; } + public DateTime? EndDate { get; set; } public string PriceType { get; set; } public int Duration { get; set; } public decimal Budget { get; set; } public string QualificationName { get; set; } - public string Status { get; set; } + public string Status { get; set; } = "available"; public long? FreelancerId { get; set; } [ForeignKey("FreelancerId")] public virtual Freelancer? Freelancer { get; set; } + public List ?Bids { get; set; } + public List?Tasks { get; set; } } } diff --git a/Models/Requests/BidsRquset.cs b/Models/Requests/BidsRquset.cs new file mode 100644 index 0000000..de22551 --- /dev/null +++ b/Models/Requests/BidsRquset.cs @@ -0,0 +1,9 @@ +namespace AonFreelancing.Models.Requests +{ + public class BidsRequset + { + + public decimal proposed { get; set; } + public string? Nots { get; set; } + } +} diff --git a/Models/Requests/TaskRq.cs b/Models/Requests/TaskRq.cs new file mode 100644 index 0000000..65ac5e2 --- /dev/null +++ b/Models/Requests/TaskRq.cs @@ -0,0 +1,12 @@ +using Microsoft.EntityFrameworkCore.Storage.ValueConversion.Internal; +using System.ComponentModel.DataAnnotations; + +namespace AonFreelancing.Models.Requests +{ + public class TaskRq + { + [AllowedValues("to_do", "in_progress", "in _review", "done")] + public string Name { get; set; } + public DateTime DeadLine { get; set; } + } +} diff --git a/Models/Requests/TaskStatusRq.cs b/Models/Requests/TaskStatusRq.cs new file mode 100644 index 0000000..22bf13a --- /dev/null +++ b/Models/Requests/TaskStatusRq.cs @@ -0,0 +1,11 @@ +using System.ComponentModel.DataAnnotations; + +namespace AonFreelancing.Models.Requests +{ + public class TaskStatusRq + { + + [AllowedValues] + public string newStatus { get; set; } + } +} diff --git a/Models/Responses/Bid.cs b/Models/Responses/Bid.cs new file mode 100644 index 0000000..b0960cc --- /dev/null +++ b/Models/Responses/Bid.cs @@ -0,0 +1,30 @@ +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace AonFreelancing.Models.Responses +{ + public class Bid + { + [Key] + public int id { get; set; } + + [Required] + public int ProjectId { get; set; } + + [ForeignKey("ProjectId")] + + public Project Project { get; set; } + + public long FreelancerId { get; set; } + [ForeignKey("FreelancerId")] + public Freelancer Freelancer { get; set; } + public decimal proposed_Price { get; set; } + public string Nots { get; set; } + + [AllowedValues("approved","Pending")] + public string status { get; set; } = "pending"; + public DateTime submittedAt { get; set; } + + public DateTime ApprovedAt{ get; set; } + } +} diff --git a/Models/Services/FileService.cs b/Models/Services/FileService.cs new file mode 100644 index 0000000..683e521 --- /dev/null +++ b/Models/Services/FileService.cs @@ -0,0 +1,23 @@ +using AonFreelancing.Contexts; + + +namespace AonFreelancing.Models.Services +{ + public class FileService + { + public static readonly string _uploadFolder = Path.Combine(Directory.GetCurrentDirectory(), "uploads"); + private readonly MainAppContext mainAppContext; + public FileService(MainAppContext _mainappcontext) + { + mainAppContext = _mainappcontext; + } + public async Task SaveAsync(IFormFile formFile) + { + string filePath = $"{Guid.NewGuid().ToString()}{Path.GetExtension(formFile.FileName)}"; + using Stream stream = File.Create(Path.Combine(_uploadFolder, filePath)); + await formFile.CopyToAsync(stream); + return filePath; + } + } + } + diff --git a/Services/JwtService.cs b/Models/Services/JwtService.cs similarity index 91% rename from Services/JwtService.cs rename to Models/Services/JwtService.cs index c5a4917..ced0310 100644 --- a/Services/JwtService.cs +++ b/Models/Services/JwtService.cs @@ -3,7 +3,7 @@ using System.Security.Claims; using System.Text; -namespace AonFreelancing.Services +namespace AonFreelancing.Models.Services { public class JwtService { @@ -14,7 +14,7 @@ public JwtService(IConfiguration config) _config = config; } - public string GenerateJWT(Models.User user, string role) + public string GenerateJWT(User user, string role) { var key = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(_config["Jwt:Key"])); var creds = new SigningCredentials(key, SecurityAlgorithms.HmacSha256); diff --git a/Program.cs b/Program.cs index 659cd4e..1f8a708 100644 --- a/Program.cs +++ b/Program.cs @@ -2,14 +2,16 @@ using AonFreelancing.Contexts; using AonFreelancing.Middlewares; using AonFreelancing.Models; -using AonFreelancing.Services; +using AonFreelancing.Models.Services; using AonFreelancing.Utilities; using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.FileProviders; using Microsoft.IdentityModel.Tokens; +using Microsoft.OpenApi.Models; using System.Text; namespace AonFreelancing @@ -22,9 +24,33 @@ public static void Main(string[] args) builder.Services.AddControllers(o => o.SuppressAsyncSuffixInActionNames = false); builder.Services.AddEndpointsApiExplorer(); - builder.Services.AddSwaggerGen(); + builder.Services.AddSwaggerGen(options => + { + options.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme() + { + Name = "Authorization", + In = ParameterLocation.Header, + Type = SecuritySchemeType.Http, + Scheme = "Bearer" + }); + options.AddSecurityRequirement(new OpenApiSecurityRequirement + { + { + new OpenApiSecurityScheme + { + Reference = new OpenApiReference + { + Type = ReferenceType.SecurityScheme, + Id = "Bearer" + } + }, + Array.Empty() + } + }); + }); builder.Services.AddSingleton(); builder.Services.AddSingleton(); + builder.Services.AddScoped(); builder.Services.AddDbContext(options => options.UseSqlite("Data Source=aon.db")); builder.Services.AddIdentity() .AddEntityFrameworkStores() @@ -68,7 +94,13 @@ public static void Main(string[] args) app.UseSwagger(); app.UseSwaggerUI(); } + app.UseStaticFiles(new StaticFileOptions + { + FileProvider = new PhysicalFileProvider(FileService._uploadFolder), + RequestPath = "/images" + }); + app.MapControllers(); app.UseMiddleware(); diff --git a/aon.db b/aon.db index 6c10f2c872948beb08d7cf7f97de0b246dea5967..d074bf1d857782694ee8b36fe905a71d7fdca4eb 100644 GIT binary patch delta 3304 zcmeHJUu;{|8TV)3KlZ(G>^OF=?ZnCTO=`zYn%HTRQB@mto$F$nI%(oa4THLNd|NJc zY~w$yh#}I3g{^&PqbqhKkU+HJrN9Fi=nDd-Rhss&fsiVdfdtbe9=eCUY!wpSpL4G5 z#O|u?Wlw09&%Nh-=lj0%{r#Q0{;yNm8$qIaHjZ1h zKbUqyx8`TubszOhpt~92*qF|veM*azZDTL5{gobvuDYLj0qCx66?mJ|K4IOIb;HDI ze`d#l*R_Pr2LUYFla_JdFu{qQ9sq0oBg-_H&MlkKMF$Lm1zmH%`!nY~3@iA2@H}13 zWb;Z&St~79lyd9M#unvhN)}VmLvykywaDmK4wykv0fy23Uf|KM-7t&R0lN6;k@Pmx zrU!z|B+CdfpYDyXwUdstX6B!TX;v5>h6_RMAKaUCG+V4ywVtlt`Za!za^jfw_Th)a zYQ;~m-7?s2)q56xZ<`8$>9A)iJhd+pnTkaAhkr2jKsvFOIjtO3PnR=QwODvyB0LcZ zbGqDD2HRIy?xxKznhsn3qu7;`;VUKkJC`YYojQ4UvN^v>t&4SP{qI9T+qVWQd~WFe z%=VV`kJd{a+5Vg9UHH6_?YiF{0mk+%eXBj)bPuK=?F&=L)!iA{Xr**-CAHC=aW7M!2C(b~!ZlSUU{(|Kj%j@QgY?j$aWf`9Tt&ujI*xEX@o1z3kfX!f| zdNY+Xl@xjOcSe`c(8mr4o5kXEwF+8yfnb?c za(T6&M63Fej}_NSd8Ml4nglvotSS}s7b6Tl9LF_J4ox?8ZBG(8NsP}g%8A2C@rb-4 zj!I1qyb%%?<+!{kCu8!G*rKB+tuQ$K{38M@xLoiHLHFvAnyZlE?evL|ByrTriTEd} zTGTvj!Zh8xcCWa2SyA$t!m3gxPFhRlVyReBa@bmRRogPUDeOwa>GlBdm0EU9t?qct zMN3%psa6E~NWa_k6K@Yf5Jc271R->j29LIf?u!%i{zn0EZv>orKsG1!fE25x3K_!n z@0_p;%q=iMV|_5QvDz!-F)51bI7+~>!7U;GV7(D&YLFoWrQz=7s@ymnnL^FRai zY<=Mc=hmIO_rqwv4b2!~9P9*MuRmji$L>XGzwPJy`gA0{d_Xs{RST`R2fgM454z!i zF?4eXTqr3(AC*$8d6ENuR;jF()e-?Nz2KNwUR4UDEPdv(lG#avd8wKyS7$R-?KQ?p z>yW3t!U&99$Tf*(l2|46bcrZ7&(<1nh_;O2We(MHr+-^v`DEZk}3JHyogSEz`Z|q zB)zbhh{@^H%7QG3v4`Z?5pnd#E!&jGFuOP!jH_prTyR_rE-2-PinVeuq=~Ha43<8& z9Gy$V6R~J2F`rB)qet7cbeNvZthKb&)Y@61>{Pi}s44|r@mevf5|hPXHnV!BNjz1{ z=W(~Mo@tynjn7+3MN`X5JC-(r(KNHobuk#rlm5{q1(X|t051LuL*PeCG)$sD4Z=jT z8#vtYq}8olXy;nFN}W6y=%J?#)~ozo{w&XNo1D?IVey+^Hiy_7tjZdgi_94P4n2)8 z5uP?a6GT=A?7?+&zyU`meiC4X13ox6tQK<0*~Ibf`!>Dsc(I@)Yirq^`+GN$5sm2u zbix7d=P+JKZCq05#4c8d2yhOzm9+y|BB$e8s0loYjrHjIk!A-GM$thZc+ocl;Omt-DkyY%m=)059vsmiVcPqg)Mx{uYDHp% zNf$iZva}sw5;?L8{F|MfJPk7m?H(&v{j4zUf^(J*-Pp8b6F3|CcimrqhYNZnT1Ry3 zgi0dH_QD8^pci`KC=8*Sy%51)P^=RcVGupy1V2dVr%w2h@mU{odto0gsZYGnj~@5J zBn+T|eheVDy?%vVC3F6(@F5C${sl6Q@w6j(wfFbsfi# zrY%Dzv>>WY3#qr=fdrcR4;!N0Ml?l&KQ?JRl2%BFZDOL;fOQ+MZH&SYFO8jR$4T=5 zHVI4j`rh;XzVCeJd*6Fs*WCNM`k|U~C5B-Q=qmjz^KERa5^ImXqd-dlekKvN!O!$_ znh%MD>Mh0ls>ktH6iZtZ!jI?YefWJwgZTX>uoFP>XHDR9{A|5We7hO60ewEC zs#t7k0Y`xHfL>`FCiB14?8wgmv)phtsL4MHT7Xuk;!j(FNv=D~ zs>P4DBRNDtj=ch;kQ`!F&VvfGTyqvz(J%tkhWu8;D0o6iCH3BsE?@*|W z4GrM@O#W}0Cl{Zn0fX{7bf)q$J-QQyJ27}2J_G0AFsw4%F#O8!fZ@)C@-l}Z*G%Bv zYKCGsnx+|sval34?iWrZ18E`UjZLOPnb=fQR6id5r)6)0t=SsG!-2U1hVgmA_? z6^TV-;Q~0#6ya?ue0UAcSZIdd49`s^(nUC}#1EI?79`z9vE!jggbb&IP)3M2GGr`4 zCX3sxu-vY|r`K30#zynw-q3Mjd@7S1Pad602#M^82_ZEeok|I@$;5Ht^!SO`WO2WJ za(t?q$rVmcaWuB zFn9wl!HX~sEl_QE-LPo5fc$vMkZZ)f;OpE-G~t02&{sQ9y%!%|1Ad9?kmpow_~9Zh zM^j(xG^G`vE=je}|FgRk7JRD2_N9Kxr8YWBz8mjfWBW1};X85r8fu+$WVhi5h@wfU z&0dl6N(NuX;9t=V!xk#aehWLxWeTji8taP3ghZyx<97M{)j)yO*JIr&L5PPEVIkE$ z97sT!0=*N8r;f-?Y5+gP;D_)v1pFOr zEyHnauVX4{-n4 zGQ6aJLqAul=<+K36&VX|>ato7_AILD6{x1Gj5RgjoT6aWf-&ajzlGn|S|-}|05jOW zcxVq$Z&BAb75~r{m3>3;e;DB3NU?_>W5Ly8j~de+C<=R#vSo`8?ga_}*7d2yxmu8t zk;EmeT&BfzTJ59SYRwNdRmx@M1^Es6)AAtxGJZrqtFP2ODtiz?FzlZB`5{7$9x&pP z?3y_DJZQ<)bq%>3ewWGZbGm{ivpYCGfQXM6J37Gm!v*7QiqK69B^iE4r^jV7Z=#z` zO&Y@Nj+hCz&+qDS4VirXev>cY@wDX-p)(tq6f$PQ?+T*T5(N>8F}x+8L@o7?EjXP* zI-H6nr53jpHCya{NT0hlDue{D<;~ecC14a6c7vAuoLVW~u@?~H+q;2TX)!5{?gnXUIZ&)Qg%UGP-||v_f2gi7 zgM61Lh`xn%%i}I-fXP>BL;0A#LHva@^?Xlf&cCDGk#E#Bq?(FeARx~s?&Rg&4=V4HaNRYa?lXhw1QDqxLhGlP_$=V~QG zoNQAW_t%2iI`Ie3BNN{yX|+@Q{qvxcDE+)$^B;{%ud=rCj!kef!U4uI{cr_?a12R2cPpnM(lwvK6oePHqA)P%QlGJbvI?&JUaEyf}r6*Tc z`gDimREIt6>9Gdc<1-_t{bQ$2`ZC9;(SfcsKiNCX_KXh3=>VT_b>uQJZZbM(4W$Pn z?&(o~ho^7Ev48)1TX9Zjz~vt8>hbs6yd#0ppm(fi!0%uzgZ)nKAk&}D&N`KwPr)%v z#A*py$Oz3?NiG@=lM@p>M@D%jWDV0CWsgR4Q8b`PR@`(9hoA2W2ZyG+<3Z~wU%Z!b z2%Ypvk0sL^=;%D?42*^PTnrzkC+vs1PsEu(FOz1H){|#^iIc;gu@lk3l~b(x*UfR= zgJWFZ2orGHd_9N8yll5G*VRAb?s0p20|BR`%51M=r&Ai%+ct!KR~lheDZba4gwBBMdnD;-1v>&_PE}tp8AJ;P9yH zD1B@uleKYN*3HG(4q?*iA8__h3u!N(J~NV~tS6@?H+aPA8ym4Y4_Z1c-cj4ZfieG} zHxRVBEZw$Y&KLA@K}j1Fju$CYF=M`&Y$y)$cVTD(zYFS6{Qk#~8^D##)m>fc^%29e zJY};;Uj!sgla$3oTlaC)KFZe4*f`q4a~nvO6%s=Y$ZnCh>N|86&SG6hiHg|LXc$#KtUw2PDLxj(srI-WwV+n`#vOt3mY}Aem^{z8HUH> zJHRVW(^RLE(x4ZYNz`&RAC|Yv?0G%!ch$DKj}OPqdhsZ}{9pIZeP4|<-}AX2HHs>u zga82o1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&U zAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t9|VAU53z0RjXF5FpTUfo{v^ zH$DLZ1PBlyK;UzMyjNcc5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7csf&UhG E1JxZZV*mgE diff --git a/aon.db-wal b/aon.db-wal deleted file mode 100644 index f16053ac09e4110a839c3dce710f4733e80e9c0e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12392 zcmeI&F-yZh6bJB2uZ^iypB9mVmKHh{u^>uAMiCrEiY{GBTTZaXr1r9k;5QIN2OWxw zn}dUE!7pG1cfm4J3NPi00bZa0SG_<0uX=z1Rwwb z2teRh1gI-=mfEZYYNuJ@hbc?%x+9j%#Me35(5j_L%AB#Jo2x1)`L5CtGQNV(17>1K zrmeM>-%#~HyNV+Gex;?9TlMPvfmk9cr;TNIOL>7dIp9gs;WUH$g2U_6PGc|Q4|8Tv zPw>j}c7}VBJKSfuQ4oLt1Rwwb2tWV=5P$##AOHaf{5gRMnUBvp#YNj*aEi{nW7|AJ zmOD4N7f5<%$JO3zHvC_}pclal1px>^00Izz00bZa0SG_<0uX?}KM+V7QIWTP-V1yH D=@(l- From 7577ee241809dde679c6d4926d5f0ce9202df9cb Mon Sep 17 00:00:00 2001 From: Ahmed naeem Date: Fri, 22 Nov 2024 00:00:54 +0300 Subject: [PATCH 3/5] update the code --- Controllers/Mobile/v1/ProjectsController.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Controllers/Mobile/v1/ProjectsController.cs b/Controllers/Mobile/v1/ProjectsController.cs index 0c802ec..8a8f33d 100644 --- a/Controllers/Mobile/v1/ProjectsController.cs +++ b/Controllers/Mobile/v1/ProjectsController.cs @@ -180,7 +180,8 @@ public async Task GetProjectToBids([FromBody] BidsRequset bidrq, [HttpGet("{Id}")] public async Task GetProject(long id) { - var project = await mainAppContext.Projects.Where(p => p.Id == id).Include(p => p.Bids.OrderBy(b => b.proposed_Price)).FirstOrDefaultAsync(); + string imageUrL = $"{Request.Scheme}://{Request.Host}/images"; + var project = await mainAppContext.Projects.Where(p => p.Id == id).Include(p => p.Bids.OrderBy(b => b.proposed_Price)).Select(p=>new ProjectOutDTO(p,imageUrL)).FirstOrDefaultAsync(); if (project == null) { @@ -192,7 +193,7 @@ public async Task GetProject(long id) - return Ok(project); + return Ok(CreateSuccessResponse(project)); @@ -251,7 +252,7 @@ public async Task ProjectTasks([FromBody] TaskRq Rq, int id) await mainAppContext.SaveChangesAsync(); return Ok(); } - return NotFound(); + return NotFound(CreateErrorResponse("400","the project Task Not Found")); } @@ -267,7 +268,7 @@ public async Task UpdateTaskStatus([FromBody] TaskStatusRq Rq, in mainAppContext.Tasks.Update(Task); await mainAppContext.SaveChangesAsync(); } - return NotFound(); + return NotFound(CreateErrorResponse("400", "the project Not Found")); } From 4edf7a86853901905edfcb49bffafa2569b1a24e Mon Sep 17 00:00:00 2001 From: Ahmed naeem Date: Fri, 22 Nov 2024 18:38:41 +0300 Subject: [PATCH 4/5] sfsd --- Controllers/Mobile/v1/ProjectsController.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Controllers/Mobile/v1/ProjectsController.cs b/Controllers/Mobile/v1/ProjectsController.cs index 8a8f33d..63d4b82 100644 --- a/Controllers/Mobile/v1/ProjectsController.cs +++ b/Controllers/Mobile/v1/ProjectsController.cs @@ -139,18 +139,18 @@ public async Task GetProjectToBids([FromBody] BidsRequset bidrq, if (user != null) { if (!(rol == Constants.USER_TYPE_FREELANCER)) - { + return Unauthorized(CreateErrorResponse(StatusCodes.Status403Forbidden.ToString(), "you are not Freelancer")); - } + if (bidrq.proposed < 0) - { + return BadRequest("you must not put price in negative"); - } + - if (bidrq.proposed < project.Budget && bidrq.proposed < lastproposed.proposed_Price && user != null) + if (bidrq.proposed < project.Budget && bidrq.proposed < lastproposed.proposed_Price ) { var bid = new Bid() @@ -174,7 +174,7 @@ public async Task GetProjectToBids([FromBody] BidsRequset bidrq, } } - return NotFound("the User NOt Found"); + return NotFound(CreateErrorResponse("400","the user NOt found")); } [HttpGet("{Id}")] From 3b4d7798144a5a5b62877b31270713ca440f8acd Mon Sep 17 00:00:00 2001 From: Ahmed naeem Date: Sat, 23 Nov 2024 03:09:14 +0300 Subject: [PATCH 5/5] Task8done --- .gitignore | 1 + Contexts/MainAppContext.cs | 30 +- Controllers/Mobile/v1/AuthController.cs | 8 +- Controllers/Mobile/v1/ProjectsController.cs | 175 +--- Controllers/Mobile/v1/TaskController.cs | 178 +++- .../20241121190728_ImageMigration.Designer.cs | 786 ------------------ Migrations/20241121190728_ImageMigration.cs | 635 -------------- .../20241122085257_Lecture07Mig.Designer.cs | 786 ------------------ Migrations/20241122085257_Lecture07Mig.cs | 635 -------------- Migrations/MainAppContextModelSnapshot.cs | 774 ----------------- Models/DTOs/ProjectOutDTO.cs | 16 +- Models/Project.cs | 7 +- Models/Services/TaskService.cs | 27 + Models/TaskEntity.cs | 2 +- Program.cs | 44 +- Utilities/ConstantStatus.cs | 11 + 16 files changed, 271 insertions(+), 3844 deletions(-) delete mode 100644 Migrations/20241121190728_ImageMigration.Designer.cs delete mode 100644 Migrations/20241121190728_ImageMigration.cs delete mode 100644 Migrations/20241122085257_Lecture07Mig.Designer.cs delete mode 100644 Migrations/20241122085257_Lecture07Mig.cs delete mode 100644 Migrations/MainAppContextModelSnapshot.cs create mode 100644 Models/Services/TaskService.cs create mode 100644 Utilities/ConstantStatus.cs diff --git a/.gitignore b/.gitignore index 52720ca..e8e8bdc 100644 --- a/.gitignore +++ b/.gitignore @@ -364,4 +364,5 @@ FodyWeavers.xsd appsettings.json appsettings.Development.json +appsettings.example.json /.idea diff --git a/Contexts/MainAppContext.cs b/Contexts/MainAppContext.cs index 92260e9..106f444 100644 --- a/Contexts/MainAppContext.cs +++ b/Contexts/MainAppContext.cs @@ -1,14 +1,13 @@ -using AonFreelancing.Models; -using AonFreelancing.Models.Responses; + +using AonFreelancing.Models; using Microsoft.AspNetCore.Identity.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; using System.Reflection.Emit; using static System.Net.WebRequestMethods; -using Task = System.Threading.Tasks.Task; namespace AonFreelancing.Contexts { - public class MainAppContext(DbContextOptions contextOptions) + public class MainAppContext(DbContextOptions contextOptions) : IdentityDbContext(contextOptions) { // For TPT design, no need to define each one @@ -17,29 +16,28 @@ public class MainAppContext(DbContextOptions contextOptions) //public DbSet Clients { get; set; } // instead, use User only - public DbSet TemUsers { get; set; } public DbSet Users { get; set; } // Will access Freelancers, Clients, SystemUsers through inheritance and ofType public DbSet OTPs { get; set; } public DbSet TempUsers { get; set; } public DbSet Bids { get; set; } public DbSet Tasks { get; set; } - + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) + { + optionsBuilder.UseSqlServer("aon"); + } protected override void OnModelCreating(ModelBuilder builder) { - - // For TPT design + // For TPT design builder.Entity().ToTable("AspNetUsers") - .HasIndex(u=>u.PhoneNumber).IsUnique(); + .HasIndex(u => u.PhoneNumber).IsUnique(); builder.Entity().ToTable("TempUser") - .HasIndex(u=>u.PhoneNumber).IsUnique(); - builder.Entity().ToTable("Tasks"); - + .HasIndex(u => u.PhoneNumber).IsUnique(); + builder.Entity().ToTable("Freelancers"); - builder.Entity().ToTable("Bids"); builder.Entity().ToTable("Clients"); builder.Entity().ToTable("SystemUsers"); - builder.Entity().ToTable("otps", o => o.HasCheckConstraint("CK_CODE","LEN([Code]) = 6")); + builder.Entity().ToTable("otps", o => o.HasCheckConstraint("CK_CODE", "LEN([Code]) = 6")); //set up relationships builder.Entity().HasOne() @@ -48,11 +46,11 @@ protected override void OnModelCreating(ModelBuilder builder) .HasPrincipalKey(nameof(TempUser.PhoneNumber)); builder.Entity().ToTable("Projects", tb => tb.HasCheckConstraint("CK_PRICE_TYPE", "[PriceType] IN ('Fixed', 'PerHour')")); - + builder.Entity() .ToTable("Projects", tb => tb.HasCheckConstraint("CK_QUALIFICATION_NAME", "[QualificationName] IN ('uiux', 'frontend', 'mobile', 'backend', 'fullstack')")); builder.Entity().ToTable("Projects", tb => tb.HasCheckConstraint("CK_STATUS", "[Status] IN ('Available', 'Closed')")) - .Property(p=>p.Status).HasDefaultValue("Available"); + .Property(p => p.Status).HasDefaultValue("Available"); builder.Entity() .HasOne(b => b.Project) diff --git a/Controllers/Mobile/v1/AuthController.cs b/Controllers/Mobile/v1/AuthController.cs index f7122e3..7045f71 100644 --- a/Controllers/Mobile/v1/AuthController.cs +++ b/Controllers/Mobile/v1/AuthController.cs @@ -42,18 +42,18 @@ JwtService jwtService public async Task RegisterPhoneNumberAsync([FromBody] RegistByPhoneNumberDTO reg) { - var user= await _mainAppContext.TemUsers.Where(ph=>ph.phoneNumber==reg.PhoneNumber).FirstOrDefaultAsync(); + var user= await _mainAppContext.TempUsers.Where(ph=>ph.PhoneNumber==reg.PhoneNumber).FirstOrDefaultAsync(); - if (user != null && !user.PhoneNumberConfirm==false) + if (user != null && !user.PhoneNumberConfirmed==false) { return Unauthorized(CreateErrorResponse(StatusCodes.Status401Unauthorized.ToString(), "Verify Your Account First")); } - user = new TemUser() { phoneNumber=reg.PhoneNumber }; + user = new TempUser() { PhoneNumber=reg.PhoneNumber }; - await _mainAppContext.TemUsers.AddAsync(user); + await _mainAppContext.TempUsers.AddAsync(user); string otpCode = _otpManager.GenerateOtp(); await _mainAppContext.SaveChangesAsync(); diff --git a/Controllers/Mobile/v1/ProjectsController.cs b/Controllers/Mobile/v1/ProjectsController.cs index f59315f..437f82b 100644 --- a/Controllers/Mobile/v1/ProjectsController.cs +++ b/Controllers/Mobile/v1/ProjectsController.cs @@ -1,31 +1,22 @@  + using AonFreelancing.Contexts; using AonFreelancing.Models; using AonFreelancing.Models.DTOs; -using AonFreelancing.Models.Requests; -using AonFreelancing.Models.Responses; using AonFreelancing.Models.Services; using AonFreelancing.Utilities; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.EntityFrameworkCore; - - namespace AonFreelancing.Controllers.Mobile.v1 { [Authorize] [Route("api/mobile/v1/projects")] [ApiController] - - public class ProjectsController(MainAppContext mainAppContext, UserManager userManager,FileService fileService) : BaseController - - + public class ProjectsController(MainAppContext mainAppContext, UserManager userManager,TaskService taskService) : BaseController { - - [Authorize(Roles = "CLIENT")] [HttpPost] @@ -52,14 +43,9 @@ public async Task PostProjectAsync([FromBody] ProjectInputDto pro Budget = projectInputDto.Budget, PriceType = projectInputDto.PriceType, CreatedAt = DateTime.Now, + }; - if (projectInputDto.ImageName != null) - { - string fileName = await fileService.SaveAsync(projectInputDto.ImageName); - project.ImageName = fileName; - } - await mainAppContext.Projects.AddAsync(project); await mainAppContext.SaveChangesAsync(); @@ -73,7 +59,6 @@ public async Task GetClientFeedAsync( [FromQuery] int pageSize = 8, [FromQuery] string? qur = default ) { - var imagesBaseUrl = $"{Request.Scheme}://{Request.Host}/images"; var trimmedQuery = qur?.ToLower().Replace(" ", "").Trim(); List? projects; @@ -95,9 +80,9 @@ public async Task GetClientFeedAsync( projects = await query.OrderByDescending(p => p.CreatedAt) .Skip(page * pageSize) .Take(pageSize) - .Select(p => new ProjectOutDTO(p,imagesBaseUrl) + .Select(p => new ProjectOutDTO { - Id= p.Id, + Id = p.Id, Title = p.Title, Description = p.Description, Status = p.Status, @@ -153,7 +138,7 @@ public async Task SubmitBidAsync(int id, [FromBody] BidInputDto b FreelancerId = user.Id, ProposedPrice = bidDto.ProposedPrice, Notes = bidDto.Notes, - Status = "pending", + Status = "pending", SubmittedAt = DateTime.Now }; @@ -201,22 +186,24 @@ public async Task GetProjectDetailsAsync(int id) var orderedBids = project.Bids .OrderByDescending(b => b.ProposedPrice) - .Select(b => new BidOutDto { - Id = b.Id, - FreelancerId = b.FreelancerId, - Freelancer = new FreelancerShortOutDTO { - Id = b.FreelancerId, - Name = b.Freelancer.Name - }, - ProposedPrice = b.ProposedPrice, - Notes = b.Notes, - Status = b.Status, - SubmittedAt = b.SubmittedAt, - ApprovedAt = b.ApprovedAt - } ); - - - + .Select(b => new BidOutDto + { + Id = b.Id, + FreelancerId = b.FreelancerId, + Freelancer = new FreelancerShortOutDTO + { + Id = b.FreelancerId, + Name = b.Freelancer.Name + }, + ProposedPrice = b.ProposedPrice, + Notes = b.Notes, + Status = b.Status, + SubmittedAt = b.SubmittedAt, + ApprovedAt = b.ApprovedAt + }); + + + return Ok(CreateSuccessResponse(new { project.Id, @@ -224,7 +211,7 @@ public async Task GetProjectDetailsAsync(int id) project.Status, project.Budget, project.Duration, - project.Description, + project.Description, Bids = orderedBids })); } @@ -253,109 +240,8 @@ public async Task CreateTaskAsync(int id, [FromBody] TaskInputDto } - [Authorize(Roles = "CLIENT, FREELANCER")] - [HttpPut("tasks/{id}")] - public async Task UpdateTaskStatusAsync(int id, [FromBody] TaskStatusDto taskStatusDto) - { - var task = await mainAppContext.Tasks.FindAsync(id); - if (task == null) - { - var errorResponse = new ApiResponse - { - IsSuccess = false, - Results = null, - Errors = new List - { - new Error { Code = "404", Message = "Task not found." } - } - }; - return NotFound(errorResponse); - } - - var validStatuses = new List { "to-do", "in-progress", "in-review", "done" }; - - if (!validStatuses.Contains(taskStatusDto.NewStatus.ToLower())) - { - var errorResponse = new ApiResponse - { - IsSuccess = false, - Results = null, - Errors = new List - { - new Error { Code = "400", Message = "Invalid status provided." } - } - }; - return BadRequest(errorResponse); - } - - if (task.Status.ToLower() == "to do" && taskStatusDto.NewStatus.ToLower() != "in progress") - { - var errorResponse = new ApiResponse - { - IsSuccess = false, - Results = null, - Errors = new List - { - new Error { Code = "400", Message = "Invalid status transition from 'To Do'." } - } - }; - return BadRequest(errorResponse); - } - if (task.Status.ToLower() == "in progress" && - taskStatusDto.NewStatus.ToLower() != "in review" && taskStatusDto.NewStatus.ToLower() != "done") - { - var errorResponse = new ApiResponse - { - IsSuccess = false, - Results = null, - Errors = new List - { - new Error { Code = "400", Message = "Invalid status transition from 'In Progress'." } - } - }; - return BadRequest(errorResponse); - } - if (task.Status.ToLower() == "in review" && taskStatusDto.NewStatus.ToLower() != "done") - { - var errorResponse = new ApiResponse - { - IsSuccess = false, - Results = null, - Errors = new List - { - new Error { Code = "400", Message = "Invalid status transition from 'In Review'." } - } - }; - return BadRequest(errorResponse); - } - if (task.Status.ToLower() == "done") - { - var errorResponse = new ApiResponse - { - IsSuccess = false, - Results = null, - Errors = new List - { - new Error { Code = "400", Message = "No further status transitions allowed from 'Done'." } - } - }; - return BadRequest(errorResponse); - } - - task.Status = taskStatusDto.NewStatus; - - task.CompletedAt = taskStatusDto.NewStatus.ToLower() == "done" ? DateTime.UtcNow : (DateTime?)null; - - await mainAppContext.SaveChangesAsync(); - - var successResponse = new ApiResponse - { - IsSuccess = true, - Results = "Task status updated.", - Errors = null - }; - return Ok(successResponse); - } + + [Authorize(Roles = "CLIENT")] @@ -443,9 +329,8 @@ public async Task UploadProjectImage(int id, IFormFile file) // .Include(p => p.Client) // .FirstOrDefault(p => p.Id == id); - // return Ok(CreateSuccessResponse(project)); + // return Ok(CreateSuccessResponse(project)); - //} - } + //} } - +} diff --git a/Controllers/Mobile/v1/TaskController.cs b/Controllers/Mobile/v1/TaskController.cs index e662f56..17ec5c6 100644 --- a/Controllers/Mobile/v1/TaskController.cs +++ b/Controllers/Mobile/v1/TaskController.cs @@ -1,11 +1,183 @@ -using Microsoft.AspNetCore.Http; +using AonFreelancing.Contexts; +using AonFreelancing.Models; +using AonFreelancing.Models.DTOs; +using AonFreelancing.Models.Services; +using AonFreelancing.Utilities; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Internal; namespace AonFreelancing.Controllers.Mobile.v1 { - [Route("api/[controller]")] + [Authorize] + [Route("api/mobile/v1/Task")] [ApiController] - public class TaskController : ControllerBase + public class TaskController(MainAppContext mainAppContext, UserManager userManager,TaskService taskService) : BaseController { + + + + [HttpPut("{id}/UpdateTask")] + public async TaskUpdateTask(int id, [FromBody]TaskInputDto T) + { + + if (!ModelState.IsValid) + return BadRequest(CreateErrorResponse("400","enter vaild Input")); + + var task=await mainAppContext .Tasks.Where(t=>t.Id==id).FirstOrDefaultAsync(); + if (task != null) { + task.Name = T.Name; + task.DeadlineAt=T.DeadlineAt; + task.Notes = T.Notes; + + mainAppContext.Tasks.Update(task); + mainAppContext.SaveChanges(); + + + } + + return NotFound(CreateErrorResponse("404","the Task Not Found")); + + + } + [HttpGet("{id}/GEtTask")] + public async Task GetTasks(long id,string status) + { + if (string.IsNullOrEmpty(status)) + { + + return BadRequest("Status is requird"); + + } + var task= await mainAppContext.Tasks.Where(t => t.ProjectId == id && t.Status == status).ToListAsync(); + if (task != null) { + + return Ok(CreateSuccessResponse(task)); + } + return BadRequest(CreateErrorResponse("404", "the project Not Found")); + + + } + + [HttpPut("{id}")] + public async Task UpdateTaskStatusAsync(int id, [FromBody] TaskStatusDto taskStatusDto) + { + var task = await mainAppContext.Tasks.FindAsync(id); + if (task == null) + { + var errorResponse = new ApiResponse + { + IsSuccess = false, + Results = null, + Errors = new List + { + new Error { Code = "404", Message = "Task not found." } + } + }; + return NotFound(errorResponse); + } + + var validStatuses = new List { "to-do", "in-progress", "in-review", "done" }; + + if (!validStatuses.Contains(taskStatusDto.NewStatus.ToLower())) + { + var errorResponse = new ApiResponse + { + IsSuccess = false, + Results = null, + Errors = new List + { + new Error { Code = "400", Message = "Invalid status provided." } + } + }; + return BadRequest(errorResponse); + } + + if (task.Status.ToLower() == ConstantStatus.Status_To_Do && taskStatusDto.NewStatus.ToLower() != ConstantStatus.Status_IN_Progress) + { + var errorResponse = new ApiResponse + { + IsSuccess = false, + Results = null, + Errors = new List + { + new Error { Code = "400", Message = "Invalid status transition from 'To Do'." } + } + }; + return BadRequest(errorResponse); + } + if (task.Status.ToLower() == ConstantStatus.Status_IN_Progress && + taskStatusDto.NewStatus.ToLower() != ConstantStatus.Status_review && taskStatusDto.NewStatus.ToLower() != ConstantStatus.Status_done) + { + var errorResponse = new ApiResponse + { + IsSuccess = false, + Results = null, + Errors = new List + { + new Error { Code = "400", Message = "Invalid status transition from 'In Progress'." } + } + }; + return BadRequest(errorResponse); + } + if (task.Status.ToLower() == ConstantStatus.Status_review && taskStatusDto.NewStatus.ToLower() != ConstantStatus.Status_done) + { + var errorResponse = new ApiResponse + { + IsSuccess = false, + Results = null, + Errors = new List + { + new Error { Code = "400", Message = "Invalid status transition from 'In Review'." } + } + }; + return BadRequest(errorResponse); + } + if (task.Status.ToLower() == ConstantStatus.Status_done) + { + var errorResponse = new ApiResponse + { + IsSuccess = false, + Results = null, + Errors = new List + { + new Error { Code = "400", Message = "No further status transitions allowed from 'Done'." } + } + }; + return BadRequest(errorResponse); + } + if (taskStatusDto.NewStatus.ToLower() == ConstantStatus.Status_done) + { + double precentge = taskService.GetPrecentgeOfTask(task.ProjectId); + + var project = mainAppContext.Projects.Where(p => p.Id == task.ProjectId).FirstOrDefault(); + project.prenctgeTasks=precentge; + + + mainAppContext.Projects.Update(project); + mainAppContext.SaveChanges(); + + } + task.Status = taskStatusDto.NewStatus; + + task.CompletedAt = taskStatusDto.NewStatus.ToLower() == "done" ? DateTime.UtcNow : (DateTime?)null; + + await mainAppContext.SaveChangesAsync(); + + var successResponse = new ApiResponse + { + IsSuccess = true, + Results = "Task status updated.", + Errors = null + }; + return Ok(successResponse); + } + + + + } } diff --git a/Migrations/20241121190728_ImageMigration.Designer.cs b/Migrations/20241121190728_ImageMigration.Designer.cs deleted file mode 100644 index 5762e21..0000000 --- a/Migrations/20241121190728_ImageMigration.Designer.cs +++ /dev/null @@ -1,786 +0,0 @@ -// -using System; -using AonFreelancing.Contexts; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace AonFreelancing.Migrations -{ - [DbContext(typeof(MainAppContext))] -<<<<<<<< HEAD:Migrations/20241121190728_ImageMigration.Designer.cs - [Migration("20241121190728_ImageMigration")] - partial class ImageMigration -======== - [Migration("20241122085257_Lecture07Mig")] - partial class Lecture07Mig ->>>>>>>> master:Migrations/20241122085257_Lecture07Mig.Designer.cs - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.10") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("AonFreelancing.Models.ApplicationRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex") - .HasFilter("[NormalizedName] IS NOT NULL"); - - b.ToTable("AspNetRoles", (string)null); - }); - -<<<<<<<< HEAD:Migrations/20241121190728_ImageMigration.Designer.cs - modelBuilder.Entity("AonFreelancing.Models.EntityTask", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CompletedAt") - .HasColumnType("TEXT"); - - b.Property("DedlineAt") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Notes") - .HasColumnType("TEXT"); - - b.Property("ProjectId") - .HasColumnType("INTEGER"); - - b.Property("status") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("ProjectId"); - - b.ToTable("Tasks", (string)null); -======== - modelBuilder.Entity("AonFreelancing.Models.Bid", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ApprovedAt") - .HasColumnType("datetime2"); - - b.Property("ClientId") - .HasColumnType("bigint"); - - b.Property("FreelancerId") - .HasColumnType("bigint"); - - b.Property("Notes") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ProjectId") - .HasColumnType("int"); - - b.Property("ProposedPrice") - .HasColumnType("decimal(18,2)"); - - b.Property("Status") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("SubmittedAt") - .HasColumnType("datetime2"); - - b.Property("SystemUserId") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.HasIndex("ClientId"); - - b.HasIndex("FreelancerId"); - - b.HasIndex("ProjectId"); - - b.HasIndex("SystemUserId"); - - b.ToTable("Bids"); ->>>>>>>> master:Migrations/20241122085257_Lecture07Mig.Designer.cs - }); - - modelBuilder.Entity("AonFreelancing.Models.OTP", b => - { - b.Property("PhoneNumber") - .HasColumnType("nvarchar(450)"); - - b.Property("Code") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedDate") - .HasColumnType("datetime2"); - - b.Property("ExpiresAt") - .HasColumnType("datetime2"); - - b.Property("IsUsed") - .HasColumnType("bit"); - - b.HasKey("PhoneNumber"); - - b.ToTable("otps", null, t => - { - t.HasCheckConstraint("CK_CODE", "LEN([Code]) = 6"); - }); - }); - - modelBuilder.Entity("AonFreelancing.Models.Project", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Budget") - .HasColumnType("decimal(18,2)"); - - b.Property("ClientId") - .HasColumnType("bigint"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("Description") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Duration") - .HasColumnType("int"); - - b.Property("EndDate") - .HasColumnType("datetime2"); - - b.Property("FreelancerId") - .HasColumnType("bigint"); - - b.Property("ImagePath") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ImageName") - .HasColumnType("TEXT"); - - b.Property("PriceType") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("QualificationName") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("StartDate") - .HasColumnType("datetime2"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasColumnType("nvarchar(max)") - .HasDefaultValue("Available"); - - b.Property("Title") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("ClientId"); - - b.HasIndex("FreelancerId"); - - b.ToTable("Projects", null, t => - { - t.HasCheckConstraint("CK_PRICE_TYPE", "[PriceType] IN ('Fixed', 'PerHour')"); - - t.HasCheckConstraint("CK_QUALIFICATION_NAME", "[QualificationName] IN ('uiux', 'frontend', 'mobile', 'backend', 'fullstack')"); - - t.HasCheckConstraint("CK_STATUS", "[Status] IN ('Available', 'Closed')"); - }); - }); - -<<<<<<<< HEAD:Migrations/20241121190728_ImageMigration.Designer.cs - modelBuilder.Entity("AonFreelancing.Models.Responses.Bid", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ApprovedAt") - .HasColumnType("TEXT"); - - b.Property("FreelancerId") - .HasColumnType("INTEGER"); - - b.Property("Nots") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ProjectId") - .HasColumnType("INTEGER"); - - b.Property("proposed_Price") - .HasColumnType("TEXT"); - - b.Property("status") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("submittedAt") - .HasColumnType("TEXT"); - - b.HasKey("id"); - - b.HasIndex("FreelancerId"); - - b.HasIndex("ProjectId"); - - b.ToTable("Bids", (string)null); - }); - - modelBuilder.Entity("AonFreelancing.Models.Responses.TemUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("PhoneNumberConfirm") - .HasColumnType("INTEGER"); - - b.Property("phoneNumber") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("phoneNumber") - .IsUnique(); - - b.ToTable("TempUsers", (string)null); -======== - modelBuilder.Entity("AonFreelancing.Models.Tasks", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("CompletedAt") - .HasColumnType("datetime2"); - - b.Property("DeadlineAt") - .HasColumnType("datetime2"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Notes") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ProjectId") - .HasColumnType("int"); - - b.Property("Status") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("ProjectId"); - - b.ToTable("Tasks"); ->>>>>>>> master:Migrations/20241122085257_Lecture07Mig.Designer.cs - }); - - modelBuilder.Entity("AonFreelancing.Models.TempUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("PhoneNumber") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("bit"); - - b.HasKey("Id"); - - b.HasIndex("PhoneNumber") - .IsUnique(); - - b.ToTable("TempUser", (string)null); - }); - - modelBuilder.Entity("AonFreelancing.Models.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("About") - .HasColumnType("nvarchar(max)"); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("nvarchar(max)"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("EmailConfirmed") - .HasColumnType("bit"); - - b.Property("LockoutEnabled") - .HasColumnType("bit"); - - b.Property("LockoutEnd") - .HasColumnType("datetimeoffset"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("PasswordHash") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumber") - .HasColumnType("nvarchar(450)"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("bit"); - - b.Property("SecurityStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("TwoFactorEnabled") - .HasColumnType("bit"); - - b.Property("UserName") - .HasMaxLength(256) -<<<<<<<< HEAD:Migrations/20241121190728_ImageMigration.Designer.cs - .HasColumnType("TEXT"); -======== - .HasColumnType("nvarchar(256)"); ->>>>>>>> master:Migrations/20241122085257_Lecture07Mig.Designer.cs - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex") - .HasFilter("[NormalizedUserName] IS NOT NULL"); - - b.HasIndex("PhoneNumber") - .IsUnique() - .HasFilter("[PhoneNumber] IS NOT NULL"); - - b.ToTable("AspNetUsers", (string)null); - - b.UseTptMappingStrategy(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("RoleId") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("nvarchar(450)"); - - b.Property("ProviderKey") - .HasColumnType("nvarchar(450)"); - - b.Property("ProviderDisplayName") - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .HasColumnType("bigint"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("bigint"); - - b.Property("RoleId") - .HasColumnType("bigint"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("bigint"); - - b.Property("LoginProvider") - .HasColumnType("nvarchar(450)"); - - b.Property("Name") - .HasColumnType("nvarchar(450)"); - - b.Property("Value") - .HasColumnType("nvarchar(max)"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("AonFreelancing.Models.Client", b => - { - b.HasBaseType("AonFreelancing.Models.User"); - - b.Property("CompanyName") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.ToTable("Clients", (string)null); - }); - - modelBuilder.Entity("AonFreelancing.Models.Freelancer", b => - { - b.HasBaseType("AonFreelancing.Models.User"); - - b.Property("Skills") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.ToTable("Freelancers", (string)null); - }); - - modelBuilder.Entity("AonFreelancing.Models.SystemUser", b => - { - b.HasBaseType("AonFreelancing.Models.User"); - - b.Property("Permissions") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.ToTable("SystemUsers", (string)null); - }); - -<<<<<<<< HEAD:Migrations/20241121190728_ImageMigration.Designer.cs - modelBuilder.Entity("AonFreelancing.Models.EntityTask", b => - { - b.HasOne("AonFreelancing.Models.Project", "Project") - .WithMany("Tasks") - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - -======== - modelBuilder.Entity("AonFreelancing.Models.Bid", b => - { - b.HasOne("AonFreelancing.Models.Client", null) - .WithMany("Bids") - .HasForeignKey("ClientId"); - - b.HasOne("AonFreelancing.Models.Freelancer", "Freelancer") - .WithMany("Bids") - .HasForeignKey("FreelancerId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.HasOne("AonFreelancing.Models.Project", "Project") - .WithMany("Bids") - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.HasOne("AonFreelancing.Models.SystemUser", null) - .WithMany("Bids") - .HasForeignKey("SystemUserId"); - - b.Navigation("Freelancer"); - ->>>>>>>> master:Migrations/20241122085257_Lecture07Mig.Designer.cs - b.Navigation("Project"); - }); - - modelBuilder.Entity("AonFreelancing.Models.OTP", b => - { - b.HasOne("AonFreelancing.Models.TempUser", null) - .WithOne() - .HasForeignKey("AonFreelancing.Models.OTP", "PhoneNumber") - .HasPrincipalKey("AonFreelancing.Models.TempUser", "PhoneNumber") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AonFreelancing.Models.Project", b => - { - b.HasOne("AonFreelancing.Models.Client", "Client") - .WithMany("Projects") - .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("AonFreelancing.Models.Freelancer", "Freelancer") - .WithMany() - .HasForeignKey("FreelancerId"); - - b.Navigation("Client"); - - b.Navigation("Freelancer"); - }); - -<<<<<<<< HEAD:Migrations/20241121190728_ImageMigration.Designer.cs - modelBuilder.Entity("AonFreelancing.Models.Responses.Bid", b => - { - b.HasOne("AonFreelancing.Models.Freelancer", "Freelancer") - .WithMany() - .HasForeignKey("FreelancerId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("AonFreelancing.Models.Project", "Project") - .WithMany("Bids") -======== - modelBuilder.Entity("AonFreelancing.Models.Tasks", b => - { - b.HasOne("AonFreelancing.Models.Project", "Project") - .WithMany() ->>>>>>>> master:Migrations/20241122085257_Lecture07Mig.Designer.cs - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - -<<<<<<<< HEAD:Migrations/20241121190728_ImageMigration.Designer.cs - b.Navigation("Freelancer"); - -======== ->>>>>>>> master:Migrations/20241122085257_Lecture07Mig.Designer.cs - b.Navigation("Project"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("AonFreelancing.Models.ApplicationRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("AonFreelancing.Models.ApplicationRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("AonFreelancing.Models.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AonFreelancing.Models.Client", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithOne() - .HasForeignKey("AonFreelancing.Models.Client", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AonFreelancing.Models.Freelancer", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithOne() - .HasForeignKey("AonFreelancing.Models.Freelancer", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AonFreelancing.Models.SystemUser", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithOne() - .HasForeignKey("AonFreelancing.Models.SystemUser", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AonFreelancing.Models.Project", b => - { - b.Navigation("Bids"); -<<<<<<<< HEAD:Migrations/20241121190728_ImageMigration.Designer.cs - - b.Navigation("Tasks"); -======== ->>>>>>>> master:Migrations/20241122085257_Lecture07Mig.Designer.cs - }); - - modelBuilder.Entity("AonFreelancing.Models.Client", b => - { - b.Navigation("Bids"); - - b.Navigation("Projects"); - }); - - modelBuilder.Entity("AonFreelancing.Models.Freelancer", b => - { - b.Navigation("Bids"); - }); - - modelBuilder.Entity("AonFreelancing.Models.SystemUser", b => - { - b.Navigation("Bids"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Migrations/20241121190728_ImageMigration.cs b/Migrations/20241121190728_ImageMigration.cs deleted file mode 100644 index 1163f76..0000000 --- a/Migrations/20241121190728_ImageMigration.cs +++ /dev/null @@ -1,635 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace AonFreelancing.Migrations -{ - /// -<<<<<<<< HEAD:Migrations/20241121190728_ImageMigration.cs - public partial class ImageMigration : Migration -======== - public partial class Lecture07Mig : Migration ->>>>>>>> master:Migrations/20241122085257_Lecture07Mig.cs - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "AspNetRoles", - columns: table => new - { - Id = table.Column(type: "bigint", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - Name = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), - NormalizedName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), - ConcurrencyStamp = table.Column(type: "nvarchar(max)", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetRoles", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "AspNetUsers", - columns: table => new - { -<<<<<<<< HEAD:Migrations/20241121190728_ImageMigration.cs - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Name = table.Column(type: "TEXT", nullable: false), - About = table.Column(type: "TEXT", nullable: true), - UserName = table.Column(type: "TEXT", maxLength: 256, nullable: true), - NormalizedUserName = table.Column(type: "TEXT", maxLength: 256, nullable: true), - Email = table.Column(type: "TEXT", maxLength: 256, nullable: true), - NormalizedEmail = table.Column(type: "TEXT", maxLength: 256, nullable: true), - EmailConfirmed = table.Column(type: "INTEGER", nullable: false), - PasswordHash = table.Column(type: "TEXT", nullable: true), - SecurityStamp = table.Column(type: "TEXT", nullable: true), - ConcurrencyStamp = table.Column(type: "TEXT", nullable: true), - PhoneNumber = table.Column(type: "TEXT", nullable: true), - PhoneNumberConfirmed = table.Column(type: "INTEGER", nullable: false), - TwoFactorEnabled = table.Column(type: "INTEGER", nullable: false), - LockoutEnd = table.Column(type: "TEXT", nullable: true), - LockoutEnabled = table.Column(type: "INTEGER", nullable: false), - AccessFailedCount = table.Column(type: "INTEGER", nullable: false) -======== - Id = table.Column(type: "bigint", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - Name = table.Column(type: "nvarchar(max)", nullable: false), - About = table.Column(type: "nvarchar(max)", nullable: true), - UserName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), - NormalizedUserName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), - Email = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), - NormalizedEmail = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), - EmailConfirmed = table.Column(type: "bit", nullable: false), - PasswordHash = table.Column(type: "nvarchar(max)", nullable: true), - SecurityStamp = table.Column(type: "nvarchar(max)", nullable: true), - ConcurrencyStamp = table.Column(type: "nvarchar(max)", nullable: true), - PhoneNumber = table.Column(type: "nvarchar(450)", nullable: true), - PhoneNumberConfirmed = table.Column(type: "bit", nullable: false), - TwoFactorEnabled = table.Column(type: "bit", nullable: false), - LockoutEnd = table.Column(type: "datetimeoffset", nullable: true), - LockoutEnabled = table.Column(type: "bit", nullable: false), - AccessFailedCount = table.Column(type: "int", nullable: false) ->>>>>>>> master:Migrations/20241122085257_Lecture07Mig.cs - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetUsers", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "TempUser", - columns: table => new - { - Id = table.Column(type: "bigint", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - PhoneNumber = table.Column(type: "nvarchar(450)", nullable: false), - PhoneNumberConfirmed = table.Column(type: "bit", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_TempUser", x => x.Id); - table.UniqueConstraint("AK_TempUser_PhoneNumber", x => x.PhoneNumber); -<<<<<<<< HEAD:Migrations/20241121190728_ImageMigration.cs - }); - - migrationBuilder.CreateTable( - name: "TempUsers", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - phoneNumber = table.Column(type: "TEXT", nullable: true), - PhoneNumberConfirm = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_TempUsers", x => x.Id); -======== ->>>>>>>> master:Migrations/20241122085257_Lecture07Mig.cs - }); - - migrationBuilder.CreateTable( - name: "AspNetRoleClaims", - columns: table => new - { - Id = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - RoleId = table.Column(type: "bigint", nullable: false), - ClaimType = table.Column(type: "nvarchar(max)", nullable: true), - ClaimValue = table.Column(type: "nvarchar(max)", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id); - table.ForeignKey( - name: "FK_AspNetRoleClaims_AspNetRoles_RoleId", - column: x => x.RoleId, - principalTable: "AspNetRoles", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AspNetUserClaims", - columns: table => new - { - Id = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - UserId = table.Column(type: "bigint", nullable: false), - ClaimType = table.Column(type: "nvarchar(max)", nullable: true), - ClaimValue = table.Column(type: "nvarchar(max)", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetUserClaims", x => x.Id); - table.ForeignKey( - name: "FK_AspNetUserClaims_AspNetUsers_UserId", - column: x => x.UserId, - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AspNetUserLogins", - columns: table => new - { - LoginProvider = table.Column(type: "nvarchar(450)", nullable: false), - ProviderKey = table.Column(type: "nvarchar(450)", nullable: false), - ProviderDisplayName = table.Column(type: "nvarchar(max)", nullable: true), - UserId = table.Column(type: "bigint", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey }); - table.ForeignKey( - name: "FK_AspNetUserLogins_AspNetUsers_UserId", - column: x => x.UserId, - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AspNetUserRoles", - columns: table => new - { - UserId = table.Column(type: "bigint", nullable: false), - RoleId = table.Column(type: "bigint", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId }); - table.ForeignKey( - name: "FK_AspNetUserRoles_AspNetRoles_RoleId", - column: x => x.RoleId, - principalTable: "AspNetRoles", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_AspNetUserRoles_AspNetUsers_UserId", - column: x => x.UserId, - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AspNetUserTokens", - columns: table => new - { - UserId = table.Column(type: "bigint", nullable: false), - LoginProvider = table.Column(type: "nvarchar(450)", nullable: false), - Name = table.Column(type: "nvarchar(450)", nullable: false), - Value = table.Column(type: "nvarchar(max)", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name }); - table.ForeignKey( - name: "FK_AspNetUserTokens_AspNetUsers_UserId", - column: x => x.UserId, - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "Clients", - columns: table => new - { - Id = table.Column(type: "bigint", nullable: false), - CompanyName = table.Column(type: "nvarchar(max)", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Clients", x => x.Id); - table.ForeignKey( - name: "FK_Clients_AspNetUsers_Id", - column: x => x.Id, - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "Freelancers", - columns: table => new - { - Id = table.Column(type: "bigint", nullable: false), - Skills = table.Column(type: "nvarchar(max)", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Freelancers", x => x.Id); - table.ForeignKey( - name: "FK_Freelancers_AspNetUsers_Id", - column: x => x.Id, - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "SystemUsers", - columns: table => new - { - Id = table.Column(type: "bigint", nullable: false), - Permissions = table.Column(type: "nvarchar(max)", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_SystemUsers", x => x.Id); - table.ForeignKey( - name: "FK_SystemUsers_AspNetUsers_Id", - column: x => x.Id, - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "otps", - columns: table => new - { -<<<<<<<< HEAD:Migrations/20241121190728_ImageMigration.cs - PhoneNumber = table.Column(type: "TEXT", nullable: false), - Code = table.Column(type: "TEXT", nullable: false), - CreatedDate = table.Column(type: "TEXT", nullable: false), - ExpiresAt = table.Column(type: "TEXT", nullable: false), - IsUsed = table.Column(type: "INTEGER", nullable: false) -======== - PhoneNumber = table.Column(type: "nvarchar(450)", nullable: false), - Code = table.Column(type: "nvarchar(max)", nullable: false), - CreatedDate = table.Column(type: "datetime2", nullable: false), - ExpiresAt = table.Column(type: "datetime2", nullable: false), - IsUsed = table.Column(type: "bit", nullable: false) ->>>>>>>> master:Migrations/20241122085257_Lecture07Mig.cs - }, - constraints: table => - { - table.PrimaryKey("PK_otps", x => x.PhoneNumber); -<<<<<<<< HEAD:Migrations/20241121190728_ImageMigration.cs - table.CheckConstraint("CK_CODE", "length([Code]) = 6"); -======== - table.CheckConstraint("CK_CODE", "LEN([Code]) = 6"); ->>>>>>>> master:Migrations/20241122085257_Lecture07Mig.cs - table.ForeignKey( - name: "FK_otps_TempUser_PhoneNumber", - column: x => x.PhoneNumber, - principalTable: "TempUser", - principalColumn: "PhoneNumber", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "Projects", - columns: table => new - { -<<<<<<<< HEAD:Migrations/20241121190728_ImageMigration.cs - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Title = table.Column(type: "TEXT", nullable: false), - Description = table.Column(type: "TEXT", nullable: false), - ClientId = table.Column(type: "INTEGER", nullable: false), - CreatedAt = table.Column(type: "TEXT", nullable: false), - StartDate = table.Column(type: "TEXT", nullable: true), - ImageName = table.Column(type: "TEXT", nullable: true), - EndDate = table.Column(type: "TEXT", nullable: true), - PriceType = table.Column(type: "TEXT", nullable: false), - Duration = table.Column(type: "INTEGER", nullable: false), - Budget = table.Column(type: "TEXT", nullable: false), - QualificationName = table.Column(type: "TEXT", nullable: false), - Status = table.Column(type: "TEXT", nullable: false, defaultValue: "Available"), - FreelancerId = table.Column(type: "INTEGER", nullable: true) -======== - Id = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - Title = table.Column(type: "nvarchar(max)", nullable: false), - Description = table.Column(type: "nvarchar(max)", nullable: false), - ClientId = table.Column(type: "bigint", nullable: false), - CreatedAt = table.Column(type: "datetime2", nullable: false), - StartDate = table.Column(type: "datetime2", nullable: true), - EndDate = table.Column(type: "datetime2", nullable: true), - PriceType = table.Column(type: "nvarchar(max)", nullable: false), - Duration = table.Column(type: "int", nullable: false), - Budget = table.Column(type: "decimal(18,2)", nullable: false), - QualificationName = table.Column(type: "nvarchar(max)", nullable: false), - Status = table.Column(type: "nvarchar(max)", nullable: false, defaultValue: "Available"), - FreelancerId = table.Column(type: "bigint", nullable: true), - ImagePath = table.Column(type: "nvarchar(max)", nullable: false) ->>>>>>>> master:Migrations/20241122085257_Lecture07Mig.cs - }, - constraints: table => - { - table.PrimaryKey("PK_Projects", x => x.Id); - table.CheckConstraint("CK_PRICE_TYPE", "[PriceType] IN ('Fixed', 'PerHour')"); - table.CheckConstraint("CK_QUALIFICATION_NAME", "[QualificationName] IN ('uiux', 'frontend', 'mobile', 'backend', 'fullstack')"); - table.CheckConstraint("CK_STATUS", "[Status] IN ('Available', 'Closed')"); - table.ForeignKey( - name: "FK_Projects_Clients_ClientId", - column: x => x.ClientId, - principalTable: "Clients", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_Projects_Freelancers_FreelancerId", - column: x => x.FreelancerId, - principalTable: "Freelancers", - principalColumn: "Id"); - }); - - migrationBuilder.CreateTable( - name: "Bids", - columns: table => new - { -<<<<<<<< HEAD:Migrations/20241121190728_ImageMigration.cs - id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - ProjectId = table.Column(type: "INTEGER", nullable: false), - FreelancerId = table.Column(type: "INTEGER", nullable: false), - proposed_Price = table.Column(type: "TEXT", nullable: false), - Nots = table.Column(type: "TEXT", nullable: false), - status = table.Column(type: "TEXT", nullable: false), - submittedAt = table.Column(type: "TEXT", nullable: false), - ApprovedAt = table.Column(type: "TEXT", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Bids", x => x.id); -======== - Id = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - ProjectId = table.Column(type: "int", nullable: false), - FreelancerId = table.Column(type: "bigint", nullable: false), - ProposedPrice = table.Column(type: "decimal(18,2)", nullable: false), - Notes = table.Column(type: "nvarchar(max)", nullable: false), - Status = table.Column(type: "nvarchar(max)", nullable: false), - SubmittedAt = table.Column(type: "datetime2", nullable: false), - ApprovedAt = table.Column(type: "datetime2", nullable: true), - ClientId = table.Column(type: "bigint", nullable: true), - SystemUserId = table.Column(type: "bigint", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Bids", x => x.Id); - table.ForeignKey( - name: "FK_Bids_Clients_ClientId", - column: x => x.ClientId, - principalTable: "Clients", - principalColumn: "Id"); ->>>>>>>> master:Migrations/20241122085257_Lecture07Mig.cs - table.ForeignKey( - name: "FK_Bids_Freelancers_FreelancerId", - column: x => x.FreelancerId, - principalTable: "Freelancers", -<<<<<<<< HEAD:Migrations/20241121190728_ImageMigration.cs - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); -======== - principalColumn: "Id"); ->>>>>>>> master:Migrations/20241122085257_Lecture07Mig.cs - table.ForeignKey( - name: "FK_Bids_Projects_ProjectId", - column: x => x.ProjectId, - principalTable: "Projects", -<<<<<<<< HEAD:Migrations/20241121190728_ImageMigration.cs - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); -======== - principalColumn: "Id"); - table.ForeignKey( - name: "FK_Bids_SystemUsers_SystemUserId", - column: x => x.SystemUserId, - principalTable: "SystemUsers", - principalColumn: "Id"); ->>>>>>>> master:Migrations/20241122085257_Lecture07Mig.cs - }); - - migrationBuilder.CreateTable( - name: "Tasks", - columns: table => new - { -<<<<<<<< HEAD:Migrations/20241121190728_ImageMigration.cs - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Name = table.Column(type: "TEXT", nullable: true), - ProjectId = table.Column(type: "INTEGER", nullable: false), - status = table.Column(type: "TEXT", nullable: false), - DedlineAt = table.Column(type: "TEXT", nullable: false), - CompletedAt = table.Column(type: "TEXT", nullable: false), - Notes = table.Column(type: "TEXT", nullable: true) -======== - Id = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - ProjectId = table.Column(type: "int", nullable: false), - Name = table.Column(type: "nvarchar(max)", nullable: false), - Status = table.Column(type: "nvarchar(max)", nullable: false), - DeadlineAt = table.Column(type: "datetime2", nullable: true), - CompletedAt = table.Column(type: "datetime2", nullable: true), - Notes = table.Column(type: "nvarchar(max)", nullable: false) ->>>>>>>> master:Migrations/20241122085257_Lecture07Mig.cs - }, - constraints: table => - { - table.PrimaryKey("PK_Tasks", x => x.Id); - table.ForeignKey( - name: "FK_Tasks_Projects_ProjectId", - column: x => x.ProjectId, - principalTable: "Projects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_AspNetRoleClaims_RoleId", - table: "AspNetRoleClaims", - column: "RoleId"); - - migrationBuilder.CreateIndex( - name: "RoleNameIndex", - table: "AspNetRoles", - column: "NormalizedName", - unique: true, - filter: "[NormalizedName] IS NOT NULL"); - - migrationBuilder.CreateIndex( - name: "IX_AspNetUserClaims_UserId", - table: "AspNetUserClaims", - column: "UserId"); - - migrationBuilder.CreateIndex( - name: "IX_AspNetUserLogins_UserId", - table: "AspNetUserLogins", - column: "UserId"); - - migrationBuilder.CreateIndex( - name: "IX_AspNetUserRoles_RoleId", - table: "AspNetUserRoles", - column: "RoleId"); - - migrationBuilder.CreateIndex( - name: "EmailIndex", - table: "AspNetUsers", - column: "NormalizedEmail"); - - migrationBuilder.CreateIndex( - name: "IX_AspNetUsers_PhoneNumber", - table: "AspNetUsers", - column: "PhoneNumber", - unique: true, - filter: "[PhoneNumber] IS NOT NULL"); - - migrationBuilder.CreateIndex( - name: "UserNameIndex", - table: "AspNetUsers", - column: "NormalizedUserName", - unique: true, - filter: "[NormalizedUserName] IS NOT NULL"); - - migrationBuilder.CreateIndex( - name: "IX_Bids_ClientId", - table: "Bids", - column: "ClientId"); - - migrationBuilder.CreateIndex( - name: "IX_Bids_FreelancerId", - table: "Bids", - column: "FreelancerId"); - - migrationBuilder.CreateIndex( - name: "IX_Bids_ProjectId", - table: "Bids", - column: "ProjectId"); - - migrationBuilder.CreateIndex( - name: "IX_Bids_SystemUserId", - table: "Bids", - column: "SystemUserId"); - - migrationBuilder.CreateIndex( - name: "IX_Bids_FreelancerId", - table: "Bids", - column: "FreelancerId"); - - migrationBuilder.CreateIndex( - name: "IX_Bids_ProjectId", - table: "Bids", - column: "ProjectId"); - - migrationBuilder.CreateIndex( - name: "IX_Projects_ClientId", - table: "Projects", - column: "ClientId"); - - migrationBuilder.CreateIndex( - name: "IX_Projects_FreelancerId", - table: "Projects", - column: "FreelancerId"); - - migrationBuilder.CreateIndex( - name: "IX_Tasks_ProjectId", - table: "Tasks", - column: "ProjectId"); - - migrationBuilder.CreateIndex( - name: "IX_TempUser_PhoneNumber", - table: "TempUser", - column: "PhoneNumber", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_TempUsers_phoneNumber", - table: "TempUsers", - column: "phoneNumber", - unique: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "AspNetRoleClaims"); - - migrationBuilder.DropTable( - name: "AspNetUserClaims"); - - migrationBuilder.DropTable( - name: "AspNetUserLogins"); - - migrationBuilder.DropTable( - name: "AspNetUserRoles"); - - migrationBuilder.DropTable( - name: "AspNetUserTokens"); - - migrationBuilder.DropTable( - name: "Bids"); -<<<<<<<< HEAD:Migrations/20241121190728_ImageMigration.cs - - migrationBuilder.DropTable( - name: "otps"); -======== - - migrationBuilder.DropTable( - name: "otps"); - - migrationBuilder.DropTable( - name: "Tasks"); - - migrationBuilder.DropTable( - name: "AspNetRoles"); ->>>>>>>> master:Migrations/20241122085257_Lecture07Mig.cs - - migrationBuilder.DropTable( - name: "SystemUsers"); - - migrationBuilder.DropTable( - name: "Tasks"); - - migrationBuilder.DropTable( - name: "TempUsers"); - - migrationBuilder.DropTable( - name: "Projects"); - - migrationBuilder.DropTable( - name: "TempUser"); - - migrationBuilder.DropTable( - name: "Projects"); - - migrationBuilder.DropTable( - name: "Clients"); - - migrationBuilder.DropTable( - name: "Freelancers"); - - migrationBuilder.DropTable( - name: "AspNetUsers"); - } - } -} diff --git a/Migrations/20241122085257_Lecture07Mig.Designer.cs b/Migrations/20241122085257_Lecture07Mig.Designer.cs deleted file mode 100644 index 5762e21..0000000 --- a/Migrations/20241122085257_Lecture07Mig.Designer.cs +++ /dev/null @@ -1,786 +0,0 @@ -// -using System; -using AonFreelancing.Contexts; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace AonFreelancing.Migrations -{ - [DbContext(typeof(MainAppContext))] -<<<<<<<< HEAD:Migrations/20241121190728_ImageMigration.Designer.cs - [Migration("20241121190728_ImageMigration")] - partial class ImageMigration -======== - [Migration("20241122085257_Lecture07Mig")] - partial class Lecture07Mig ->>>>>>>> master:Migrations/20241122085257_Lecture07Mig.Designer.cs - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.10") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("AonFreelancing.Models.ApplicationRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex") - .HasFilter("[NormalizedName] IS NOT NULL"); - - b.ToTable("AspNetRoles", (string)null); - }); - -<<<<<<<< HEAD:Migrations/20241121190728_ImageMigration.Designer.cs - modelBuilder.Entity("AonFreelancing.Models.EntityTask", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CompletedAt") - .HasColumnType("TEXT"); - - b.Property("DedlineAt") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Notes") - .HasColumnType("TEXT"); - - b.Property("ProjectId") - .HasColumnType("INTEGER"); - - b.Property("status") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("ProjectId"); - - b.ToTable("Tasks", (string)null); -======== - modelBuilder.Entity("AonFreelancing.Models.Bid", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ApprovedAt") - .HasColumnType("datetime2"); - - b.Property("ClientId") - .HasColumnType("bigint"); - - b.Property("FreelancerId") - .HasColumnType("bigint"); - - b.Property("Notes") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ProjectId") - .HasColumnType("int"); - - b.Property("ProposedPrice") - .HasColumnType("decimal(18,2)"); - - b.Property("Status") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("SubmittedAt") - .HasColumnType("datetime2"); - - b.Property("SystemUserId") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.HasIndex("ClientId"); - - b.HasIndex("FreelancerId"); - - b.HasIndex("ProjectId"); - - b.HasIndex("SystemUserId"); - - b.ToTable("Bids"); ->>>>>>>> master:Migrations/20241122085257_Lecture07Mig.Designer.cs - }); - - modelBuilder.Entity("AonFreelancing.Models.OTP", b => - { - b.Property("PhoneNumber") - .HasColumnType("nvarchar(450)"); - - b.Property("Code") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedDate") - .HasColumnType("datetime2"); - - b.Property("ExpiresAt") - .HasColumnType("datetime2"); - - b.Property("IsUsed") - .HasColumnType("bit"); - - b.HasKey("PhoneNumber"); - - b.ToTable("otps", null, t => - { - t.HasCheckConstraint("CK_CODE", "LEN([Code]) = 6"); - }); - }); - - modelBuilder.Entity("AonFreelancing.Models.Project", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Budget") - .HasColumnType("decimal(18,2)"); - - b.Property("ClientId") - .HasColumnType("bigint"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("Description") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Duration") - .HasColumnType("int"); - - b.Property("EndDate") - .HasColumnType("datetime2"); - - b.Property("FreelancerId") - .HasColumnType("bigint"); - - b.Property("ImagePath") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ImageName") - .HasColumnType("TEXT"); - - b.Property("PriceType") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("QualificationName") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("StartDate") - .HasColumnType("datetime2"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasColumnType("nvarchar(max)") - .HasDefaultValue("Available"); - - b.Property("Title") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("ClientId"); - - b.HasIndex("FreelancerId"); - - b.ToTable("Projects", null, t => - { - t.HasCheckConstraint("CK_PRICE_TYPE", "[PriceType] IN ('Fixed', 'PerHour')"); - - t.HasCheckConstraint("CK_QUALIFICATION_NAME", "[QualificationName] IN ('uiux', 'frontend', 'mobile', 'backend', 'fullstack')"); - - t.HasCheckConstraint("CK_STATUS", "[Status] IN ('Available', 'Closed')"); - }); - }); - -<<<<<<<< HEAD:Migrations/20241121190728_ImageMigration.Designer.cs - modelBuilder.Entity("AonFreelancing.Models.Responses.Bid", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ApprovedAt") - .HasColumnType("TEXT"); - - b.Property("FreelancerId") - .HasColumnType("INTEGER"); - - b.Property("Nots") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ProjectId") - .HasColumnType("INTEGER"); - - b.Property("proposed_Price") - .HasColumnType("TEXT"); - - b.Property("status") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("submittedAt") - .HasColumnType("TEXT"); - - b.HasKey("id"); - - b.HasIndex("FreelancerId"); - - b.HasIndex("ProjectId"); - - b.ToTable("Bids", (string)null); - }); - - modelBuilder.Entity("AonFreelancing.Models.Responses.TemUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("PhoneNumberConfirm") - .HasColumnType("INTEGER"); - - b.Property("phoneNumber") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("phoneNumber") - .IsUnique(); - - b.ToTable("TempUsers", (string)null); -======== - modelBuilder.Entity("AonFreelancing.Models.Tasks", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("CompletedAt") - .HasColumnType("datetime2"); - - b.Property("DeadlineAt") - .HasColumnType("datetime2"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Notes") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ProjectId") - .HasColumnType("int"); - - b.Property("Status") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("ProjectId"); - - b.ToTable("Tasks"); ->>>>>>>> master:Migrations/20241122085257_Lecture07Mig.Designer.cs - }); - - modelBuilder.Entity("AonFreelancing.Models.TempUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("PhoneNumber") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("bit"); - - b.HasKey("Id"); - - b.HasIndex("PhoneNumber") - .IsUnique(); - - b.ToTable("TempUser", (string)null); - }); - - modelBuilder.Entity("AonFreelancing.Models.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("About") - .HasColumnType("nvarchar(max)"); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("nvarchar(max)"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("EmailConfirmed") - .HasColumnType("bit"); - - b.Property("LockoutEnabled") - .HasColumnType("bit"); - - b.Property("LockoutEnd") - .HasColumnType("datetimeoffset"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("PasswordHash") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumber") - .HasColumnType("nvarchar(450)"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("bit"); - - b.Property("SecurityStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("TwoFactorEnabled") - .HasColumnType("bit"); - - b.Property("UserName") - .HasMaxLength(256) -<<<<<<<< HEAD:Migrations/20241121190728_ImageMigration.Designer.cs - .HasColumnType("TEXT"); -======== - .HasColumnType("nvarchar(256)"); ->>>>>>>> master:Migrations/20241122085257_Lecture07Mig.Designer.cs - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex") - .HasFilter("[NormalizedUserName] IS NOT NULL"); - - b.HasIndex("PhoneNumber") - .IsUnique() - .HasFilter("[PhoneNumber] IS NOT NULL"); - - b.ToTable("AspNetUsers", (string)null); - - b.UseTptMappingStrategy(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("RoleId") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("nvarchar(450)"); - - b.Property("ProviderKey") - .HasColumnType("nvarchar(450)"); - - b.Property("ProviderDisplayName") - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .HasColumnType("bigint"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("bigint"); - - b.Property("RoleId") - .HasColumnType("bigint"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("bigint"); - - b.Property("LoginProvider") - .HasColumnType("nvarchar(450)"); - - b.Property("Name") - .HasColumnType("nvarchar(450)"); - - b.Property("Value") - .HasColumnType("nvarchar(max)"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("AonFreelancing.Models.Client", b => - { - b.HasBaseType("AonFreelancing.Models.User"); - - b.Property("CompanyName") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.ToTable("Clients", (string)null); - }); - - modelBuilder.Entity("AonFreelancing.Models.Freelancer", b => - { - b.HasBaseType("AonFreelancing.Models.User"); - - b.Property("Skills") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.ToTable("Freelancers", (string)null); - }); - - modelBuilder.Entity("AonFreelancing.Models.SystemUser", b => - { - b.HasBaseType("AonFreelancing.Models.User"); - - b.Property("Permissions") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.ToTable("SystemUsers", (string)null); - }); - -<<<<<<<< HEAD:Migrations/20241121190728_ImageMigration.Designer.cs - modelBuilder.Entity("AonFreelancing.Models.EntityTask", b => - { - b.HasOne("AonFreelancing.Models.Project", "Project") - .WithMany("Tasks") - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - -======== - modelBuilder.Entity("AonFreelancing.Models.Bid", b => - { - b.HasOne("AonFreelancing.Models.Client", null) - .WithMany("Bids") - .HasForeignKey("ClientId"); - - b.HasOne("AonFreelancing.Models.Freelancer", "Freelancer") - .WithMany("Bids") - .HasForeignKey("FreelancerId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.HasOne("AonFreelancing.Models.Project", "Project") - .WithMany("Bids") - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.HasOne("AonFreelancing.Models.SystemUser", null) - .WithMany("Bids") - .HasForeignKey("SystemUserId"); - - b.Navigation("Freelancer"); - ->>>>>>>> master:Migrations/20241122085257_Lecture07Mig.Designer.cs - b.Navigation("Project"); - }); - - modelBuilder.Entity("AonFreelancing.Models.OTP", b => - { - b.HasOne("AonFreelancing.Models.TempUser", null) - .WithOne() - .HasForeignKey("AonFreelancing.Models.OTP", "PhoneNumber") - .HasPrincipalKey("AonFreelancing.Models.TempUser", "PhoneNumber") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AonFreelancing.Models.Project", b => - { - b.HasOne("AonFreelancing.Models.Client", "Client") - .WithMany("Projects") - .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("AonFreelancing.Models.Freelancer", "Freelancer") - .WithMany() - .HasForeignKey("FreelancerId"); - - b.Navigation("Client"); - - b.Navigation("Freelancer"); - }); - -<<<<<<<< HEAD:Migrations/20241121190728_ImageMigration.Designer.cs - modelBuilder.Entity("AonFreelancing.Models.Responses.Bid", b => - { - b.HasOne("AonFreelancing.Models.Freelancer", "Freelancer") - .WithMany() - .HasForeignKey("FreelancerId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("AonFreelancing.Models.Project", "Project") - .WithMany("Bids") -======== - modelBuilder.Entity("AonFreelancing.Models.Tasks", b => - { - b.HasOne("AonFreelancing.Models.Project", "Project") - .WithMany() ->>>>>>>> master:Migrations/20241122085257_Lecture07Mig.Designer.cs - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - -<<<<<<<< HEAD:Migrations/20241121190728_ImageMigration.Designer.cs - b.Navigation("Freelancer"); - -======== ->>>>>>>> master:Migrations/20241122085257_Lecture07Mig.Designer.cs - b.Navigation("Project"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("AonFreelancing.Models.ApplicationRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("AonFreelancing.Models.ApplicationRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("AonFreelancing.Models.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AonFreelancing.Models.Client", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithOne() - .HasForeignKey("AonFreelancing.Models.Client", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AonFreelancing.Models.Freelancer", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithOne() - .HasForeignKey("AonFreelancing.Models.Freelancer", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AonFreelancing.Models.SystemUser", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithOne() - .HasForeignKey("AonFreelancing.Models.SystemUser", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AonFreelancing.Models.Project", b => - { - b.Navigation("Bids"); -<<<<<<<< HEAD:Migrations/20241121190728_ImageMigration.Designer.cs - - b.Navigation("Tasks"); -======== ->>>>>>>> master:Migrations/20241122085257_Lecture07Mig.Designer.cs - }); - - modelBuilder.Entity("AonFreelancing.Models.Client", b => - { - b.Navigation("Bids"); - - b.Navigation("Projects"); - }); - - modelBuilder.Entity("AonFreelancing.Models.Freelancer", b => - { - b.Navigation("Bids"); - }); - - modelBuilder.Entity("AonFreelancing.Models.SystemUser", b => - { - b.Navigation("Bids"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Migrations/20241122085257_Lecture07Mig.cs b/Migrations/20241122085257_Lecture07Mig.cs deleted file mode 100644 index 1163f76..0000000 --- a/Migrations/20241122085257_Lecture07Mig.cs +++ /dev/null @@ -1,635 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace AonFreelancing.Migrations -{ - /// -<<<<<<<< HEAD:Migrations/20241121190728_ImageMigration.cs - public partial class ImageMigration : Migration -======== - public partial class Lecture07Mig : Migration ->>>>>>>> master:Migrations/20241122085257_Lecture07Mig.cs - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "AspNetRoles", - columns: table => new - { - Id = table.Column(type: "bigint", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - Name = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), - NormalizedName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), - ConcurrencyStamp = table.Column(type: "nvarchar(max)", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetRoles", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "AspNetUsers", - columns: table => new - { -<<<<<<<< HEAD:Migrations/20241121190728_ImageMigration.cs - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Name = table.Column(type: "TEXT", nullable: false), - About = table.Column(type: "TEXT", nullable: true), - UserName = table.Column(type: "TEXT", maxLength: 256, nullable: true), - NormalizedUserName = table.Column(type: "TEXT", maxLength: 256, nullable: true), - Email = table.Column(type: "TEXT", maxLength: 256, nullable: true), - NormalizedEmail = table.Column(type: "TEXT", maxLength: 256, nullable: true), - EmailConfirmed = table.Column(type: "INTEGER", nullable: false), - PasswordHash = table.Column(type: "TEXT", nullable: true), - SecurityStamp = table.Column(type: "TEXT", nullable: true), - ConcurrencyStamp = table.Column(type: "TEXT", nullable: true), - PhoneNumber = table.Column(type: "TEXT", nullable: true), - PhoneNumberConfirmed = table.Column(type: "INTEGER", nullable: false), - TwoFactorEnabled = table.Column(type: "INTEGER", nullable: false), - LockoutEnd = table.Column(type: "TEXT", nullable: true), - LockoutEnabled = table.Column(type: "INTEGER", nullable: false), - AccessFailedCount = table.Column(type: "INTEGER", nullable: false) -======== - Id = table.Column(type: "bigint", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - Name = table.Column(type: "nvarchar(max)", nullable: false), - About = table.Column(type: "nvarchar(max)", nullable: true), - UserName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), - NormalizedUserName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), - Email = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), - NormalizedEmail = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), - EmailConfirmed = table.Column(type: "bit", nullable: false), - PasswordHash = table.Column(type: "nvarchar(max)", nullable: true), - SecurityStamp = table.Column(type: "nvarchar(max)", nullable: true), - ConcurrencyStamp = table.Column(type: "nvarchar(max)", nullable: true), - PhoneNumber = table.Column(type: "nvarchar(450)", nullable: true), - PhoneNumberConfirmed = table.Column(type: "bit", nullable: false), - TwoFactorEnabled = table.Column(type: "bit", nullable: false), - LockoutEnd = table.Column(type: "datetimeoffset", nullable: true), - LockoutEnabled = table.Column(type: "bit", nullable: false), - AccessFailedCount = table.Column(type: "int", nullable: false) ->>>>>>>> master:Migrations/20241122085257_Lecture07Mig.cs - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetUsers", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "TempUser", - columns: table => new - { - Id = table.Column(type: "bigint", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - PhoneNumber = table.Column(type: "nvarchar(450)", nullable: false), - PhoneNumberConfirmed = table.Column(type: "bit", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_TempUser", x => x.Id); - table.UniqueConstraint("AK_TempUser_PhoneNumber", x => x.PhoneNumber); -<<<<<<<< HEAD:Migrations/20241121190728_ImageMigration.cs - }); - - migrationBuilder.CreateTable( - name: "TempUsers", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - phoneNumber = table.Column(type: "TEXT", nullable: true), - PhoneNumberConfirm = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_TempUsers", x => x.Id); -======== ->>>>>>>> master:Migrations/20241122085257_Lecture07Mig.cs - }); - - migrationBuilder.CreateTable( - name: "AspNetRoleClaims", - columns: table => new - { - Id = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - RoleId = table.Column(type: "bigint", nullable: false), - ClaimType = table.Column(type: "nvarchar(max)", nullable: true), - ClaimValue = table.Column(type: "nvarchar(max)", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id); - table.ForeignKey( - name: "FK_AspNetRoleClaims_AspNetRoles_RoleId", - column: x => x.RoleId, - principalTable: "AspNetRoles", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AspNetUserClaims", - columns: table => new - { - Id = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - UserId = table.Column(type: "bigint", nullable: false), - ClaimType = table.Column(type: "nvarchar(max)", nullable: true), - ClaimValue = table.Column(type: "nvarchar(max)", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetUserClaims", x => x.Id); - table.ForeignKey( - name: "FK_AspNetUserClaims_AspNetUsers_UserId", - column: x => x.UserId, - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AspNetUserLogins", - columns: table => new - { - LoginProvider = table.Column(type: "nvarchar(450)", nullable: false), - ProviderKey = table.Column(type: "nvarchar(450)", nullable: false), - ProviderDisplayName = table.Column(type: "nvarchar(max)", nullable: true), - UserId = table.Column(type: "bigint", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey }); - table.ForeignKey( - name: "FK_AspNetUserLogins_AspNetUsers_UserId", - column: x => x.UserId, - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AspNetUserRoles", - columns: table => new - { - UserId = table.Column(type: "bigint", nullable: false), - RoleId = table.Column(type: "bigint", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId }); - table.ForeignKey( - name: "FK_AspNetUserRoles_AspNetRoles_RoleId", - column: x => x.RoleId, - principalTable: "AspNetRoles", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_AspNetUserRoles_AspNetUsers_UserId", - column: x => x.UserId, - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AspNetUserTokens", - columns: table => new - { - UserId = table.Column(type: "bigint", nullable: false), - LoginProvider = table.Column(type: "nvarchar(450)", nullable: false), - Name = table.Column(type: "nvarchar(450)", nullable: false), - Value = table.Column(type: "nvarchar(max)", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name }); - table.ForeignKey( - name: "FK_AspNetUserTokens_AspNetUsers_UserId", - column: x => x.UserId, - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "Clients", - columns: table => new - { - Id = table.Column(type: "bigint", nullable: false), - CompanyName = table.Column(type: "nvarchar(max)", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Clients", x => x.Id); - table.ForeignKey( - name: "FK_Clients_AspNetUsers_Id", - column: x => x.Id, - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "Freelancers", - columns: table => new - { - Id = table.Column(type: "bigint", nullable: false), - Skills = table.Column(type: "nvarchar(max)", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Freelancers", x => x.Id); - table.ForeignKey( - name: "FK_Freelancers_AspNetUsers_Id", - column: x => x.Id, - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "SystemUsers", - columns: table => new - { - Id = table.Column(type: "bigint", nullable: false), - Permissions = table.Column(type: "nvarchar(max)", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_SystemUsers", x => x.Id); - table.ForeignKey( - name: "FK_SystemUsers_AspNetUsers_Id", - column: x => x.Id, - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "otps", - columns: table => new - { -<<<<<<<< HEAD:Migrations/20241121190728_ImageMigration.cs - PhoneNumber = table.Column(type: "TEXT", nullable: false), - Code = table.Column(type: "TEXT", nullable: false), - CreatedDate = table.Column(type: "TEXT", nullable: false), - ExpiresAt = table.Column(type: "TEXT", nullable: false), - IsUsed = table.Column(type: "INTEGER", nullable: false) -======== - PhoneNumber = table.Column(type: "nvarchar(450)", nullable: false), - Code = table.Column(type: "nvarchar(max)", nullable: false), - CreatedDate = table.Column(type: "datetime2", nullable: false), - ExpiresAt = table.Column(type: "datetime2", nullable: false), - IsUsed = table.Column(type: "bit", nullable: false) ->>>>>>>> master:Migrations/20241122085257_Lecture07Mig.cs - }, - constraints: table => - { - table.PrimaryKey("PK_otps", x => x.PhoneNumber); -<<<<<<<< HEAD:Migrations/20241121190728_ImageMigration.cs - table.CheckConstraint("CK_CODE", "length([Code]) = 6"); -======== - table.CheckConstraint("CK_CODE", "LEN([Code]) = 6"); ->>>>>>>> master:Migrations/20241122085257_Lecture07Mig.cs - table.ForeignKey( - name: "FK_otps_TempUser_PhoneNumber", - column: x => x.PhoneNumber, - principalTable: "TempUser", - principalColumn: "PhoneNumber", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "Projects", - columns: table => new - { -<<<<<<<< HEAD:Migrations/20241121190728_ImageMigration.cs - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Title = table.Column(type: "TEXT", nullable: false), - Description = table.Column(type: "TEXT", nullable: false), - ClientId = table.Column(type: "INTEGER", nullable: false), - CreatedAt = table.Column(type: "TEXT", nullable: false), - StartDate = table.Column(type: "TEXT", nullable: true), - ImageName = table.Column(type: "TEXT", nullable: true), - EndDate = table.Column(type: "TEXT", nullable: true), - PriceType = table.Column(type: "TEXT", nullable: false), - Duration = table.Column(type: "INTEGER", nullable: false), - Budget = table.Column(type: "TEXT", nullable: false), - QualificationName = table.Column(type: "TEXT", nullable: false), - Status = table.Column(type: "TEXT", nullable: false, defaultValue: "Available"), - FreelancerId = table.Column(type: "INTEGER", nullable: true) -======== - Id = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - Title = table.Column(type: "nvarchar(max)", nullable: false), - Description = table.Column(type: "nvarchar(max)", nullable: false), - ClientId = table.Column(type: "bigint", nullable: false), - CreatedAt = table.Column(type: "datetime2", nullable: false), - StartDate = table.Column(type: "datetime2", nullable: true), - EndDate = table.Column(type: "datetime2", nullable: true), - PriceType = table.Column(type: "nvarchar(max)", nullable: false), - Duration = table.Column(type: "int", nullable: false), - Budget = table.Column(type: "decimal(18,2)", nullable: false), - QualificationName = table.Column(type: "nvarchar(max)", nullable: false), - Status = table.Column(type: "nvarchar(max)", nullable: false, defaultValue: "Available"), - FreelancerId = table.Column(type: "bigint", nullable: true), - ImagePath = table.Column(type: "nvarchar(max)", nullable: false) ->>>>>>>> master:Migrations/20241122085257_Lecture07Mig.cs - }, - constraints: table => - { - table.PrimaryKey("PK_Projects", x => x.Id); - table.CheckConstraint("CK_PRICE_TYPE", "[PriceType] IN ('Fixed', 'PerHour')"); - table.CheckConstraint("CK_QUALIFICATION_NAME", "[QualificationName] IN ('uiux', 'frontend', 'mobile', 'backend', 'fullstack')"); - table.CheckConstraint("CK_STATUS", "[Status] IN ('Available', 'Closed')"); - table.ForeignKey( - name: "FK_Projects_Clients_ClientId", - column: x => x.ClientId, - principalTable: "Clients", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_Projects_Freelancers_FreelancerId", - column: x => x.FreelancerId, - principalTable: "Freelancers", - principalColumn: "Id"); - }); - - migrationBuilder.CreateTable( - name: "Bids", - columns: table => new - { -<<<<<<<< HEAD:Migrations/20241121190728_ImageMigration.cs - id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - ProjectId = table.Column(type: "INTEGER", nullable: false), - FreelancerId = table.Column(type: "INTEGER", nullable: false), - proposed_Price = table.Column(type: "TEXT", nullable: false), - Nots = table.Column(type: "TEXT", nullable: false), - status = table.Column(type: "TEXT", nullable: false), - submittedAt = table.Column(type: "TEXT", nullable: false), - ApprovedAt = table.Column(type: "TEXT", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Bids", x => x.id); -======== - Id = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - ProjectId = table.Column(type: "int", nullable: false), - FreelancerId = table.Column(type: "bigint", nullable: false), - ProposedPrice = table.Column(type: "decimal(18,2)", nullable: false), - Notes = table.Column(type: "nvarchar(max)", nullable: false), - Status = table.Column(type: "nvarchar(max)", nullable: false), - SubmittedAt = table.Column(type: "datetime2", nullable: false), - ApprovedAt = table.Column(type: "datetime2", nullable: true), - ClientId = table.Column(type: "bigint", nullable: true), - SystemUserId = table.Column(type: "bigint", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Bids", x => x.Id); - table.ForeignKey( - name: "FK_Bids_Clients_ClientId", - column: x => x.ClientId, - principalTable: "Clients", - principalColumn: "Id"); ->>>>>>>> master:Migrations/20241122085257_Lecture07Mig.cs - table.ForeignKey( - name: "FK_Bids_Freelancers_FreelancerId", - column: x => x.FreelancerId, - principalTable: "Freelancers", -<<<<<<<< HEAD:Migrations/20241121190728_ImageMigration.cs - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); -======== - principalColumn: "Id"); ->>>>>>>> master:Migrations/20241122085257_Lecture07Mig.cs - table.ForeignKey( - name: "FK_Bids_Projects_ProjectId", - column: x => x.ProjectId, - principalTable: "Projects", -<<<<<<<< HEAD:Migrations/20241121190728_ImageMigration.cs - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); -======== - principalColumn: "Id"); - table.ForeignKey( - name: "FK_Bids_SystemUsers_SystemUserId", - column: x => x.SystemUserId, - principalTable: "SystemUsers", - principalColumn: "Id"); ->>>>>>>> master:Migrations/20241122085257_Lecture07Mig.cs - }); - - migrationBuilder.CreateTable( - name: "Tasks", - columns: table => new - { -<<<<<<<< HEAD:Migrations/20241121190728_ImageMigration.cs - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Name = table.Column(type: "TEXT", nullable: true), - ProjectId = table.Column(type: "INTEGER", nullable: false), - status = table.Column(type: "TEXT", nullable: false), - DedlineAt = table.Column(type: "TEXT", nullable: false), - CompletedAt = table.Column(type: "TEXT", nullable: false), - Notes = table.Column(type: "TEXT", nullable: true) -======== - Id = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - ProjectId = table.Column(type: "int", nullable: false), - Name = table.Column(type: "nvarchar(max)", nullable: false), - Status = table.Column(type: "nvarchar(max)", nullable: false), - DeadlineAt = table.Column(type: "datetime2", nullable: true), - CompletedAt = table.Column(type: "datetime2", nullable: true), - Notes = table.Column(type: "nvarchar(max)", nullable: false) ->>>>>>>> master:Migrations/20241122085257_Lecture07Mig.cs - }, - constraints: table => - { - table.PrimaryKey("PK_Tasks", x => x.Id); - table.ForeignKey( - name: "FK_Tasks_Projects_ProjectId", - column: x => x.ProjectId, - principalTable: "Projects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_AspNetRoleClaims_RoleId", - table: "AspNetRoleClaims", - column: "RoleId"); - - migrationBuilder.CreateIndex( - name: "RoleNameIndex", - table: "AspNetRoles", - column: "NormalizedName", - unique: true, - filter: "[NormalizedName] IS NOT NULL"); - - migrationBuilder.CreateIndex( - name: "IX_AspNetUserClaims_UserId", - table: "AspNetUserClaims", - column: "UserId"); - - migrationBuilder.CreateIndex( - name: "IX_AspNetUserLogins_UserId", - table: "AspNetUserLogins", - column: "UserId"); - - migrationBuilder.CreateIndex( - name: "IX_AspNetUserRoles_RoleId", - table: "AspNetUserRoles", - column: "RoleId"); - - migrationBuilder.CreateIndex( - name: "EmailIndex", - table: "AspNetUsers", - column: "NormalizedEmail"); - - migrationBuilder.CreateIndex( - name: "IX_AspNetUsers_PhoneNumber", - table: "AspNetUsers", - column: "PhoneNumber", - unique: true, - filter: "[PhoneNumber] IS NOT NULL"); - - migrationBuilder.CreateIndex( - name: "UserNameIndex", - table: "AspNetUsers", - column: "NormalizedUserName", - unique: true, - filter: "[NormalizedUserName] IS NOT NULL"); - - migrationBuilder.CreateIndex( - name: "IX_Bids_ClientId", - table: "Bids", - column: "ClientId"); - - migrationBuilder.CreateIndex( - name: "IX_Bids_FreelancerId", - table: "Bids", - column: "FreelancerId"); - - migrationBuilder.CreateIndex( - name: "IX_Bids_ProjectId", - table: "Bids", - column: "ProjectId"); - - migrationBuilder.CreateIndex( - name: "IX_Bids_SystemUserId", - table: "Bids", - column: "SystemUserId"); - - migrationBuilder.CreateIndex( - name: "IX_Bids_FreelancerId", - table: "Bids", - column: "FreelancerId"); - - migrationBuilder.CreateIndex( - name: "IX_Bids_ProjectId", - table: "Bids", - column: "ProjectId"); - - migrationBuilder.CreateIndex( - name: "IX_Projects_ClientId", - table: "Projects", - column: "ClientId"); - - migrationBuilder.CreateIndex( - name: "IX_Projects_FreelancerId", - table: "Projects", - column: "FreelancerId"); - - migrationBuilder.CreateIndex( - name: "IX_Tasks_ProjectId", - table: "Tasks", - column: "ProjectId"); - - migrationBuilder.CreateIndex( - name: "IX_TempUser_PhoneNumber", - table: "TempUser", - column: "PhoneNumber", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_TempUsers_phoneNumber", - table: "TempUsers", - column: "phoneNumber", - unique: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "AspNetRoleClaims"); - - migrationBuilder.DropTable( - name: "AspNetUserClaims"); - - migrationBuilder.DropTable( - name: "AspNetUserLogins"); - - migrationBuilder.DropTable( - name: "AspNetUserRoles"); - - migrationBuilder.DropTable( - name: "AspNetUserTokens"); - - migrationBuilder.DropTable( - name: "Bids"); -<<<<<<<< HEAD:Migrations/20241121190728_ImageMigration.cs - - migrationBuilder.DropTable( - name: "otps"); -======== - - migrationBuilder.DropTable( - name: "otps"); - - migrationBuilder.DropTable( - name: "Tasks"); - - migrationBuilder.DropTable( - name: "AspNetRoles"); ->>>>>>>> master:Migrations/20241122085257_Lecture07Mig.cs - - migrationBuilder.DropTable( - name: "SystemUsers"); - - migrationBuilder.DropTable( - name: "Tasks"); - - migrationBuilder.DropTable( - name: "TempUsers"); - - migrationBuilder.DropTable( - name: "Projects"); - - migrationBuilder.DropTable( - name: "TempUser"); - - migrationBuilder.DropTable( - name: "Projects"); - - migrationBuilder.DropTable( - name: "Clients"); - - migrationBuilder.DropTable( - name: "Freelancers"); - - migrationBuilder.DropTable( - name: "AspNetUsers"); - } - } -} diff --git a/Migrations/MainAppContextModelSnapshot.cs b/Migrations/MainAppContextModelSnapshot.cs deleted file mode 100644 index 5ec156f..0000000 --- a/Migrations/MainAppContextModelSnapshot.cs +++ /dev/null @@ -1,774 +0,0 @@ -// -using System; -using AonFreelancing.Contexts; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace AonFreelancing.Migrations -{ - [DbContext(typeof(MainAppContext))] - partial class MainAppContextModelSnapshot : ModelSnapshot - { - protected override void BuildModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.10") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("AonFreelancing.Models.ApplicationRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex") - .HasFilter("[NormalizedName] IS NOT NULL"); - - b.ToTable("AspNetRoles", (string)null); - }); - -<<<<<<< HEAD - modelBuilder.Entity("AonFreelancing.Models.EntityTask", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CompletedAt") - .HasColumnType("TEXT"); - - b.Property("DedlineAt") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Notes") - .HasColumnType("TEXT"); - - b.Property("ProjectId") - .HasColumnType("INTEGER"); - - b.Property("status") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("ProjectId"); - - b.ToTable("Tasks", (string)null); -======= - modelBuilder.Entity("AonFreelancing.Models.Bid", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ApprovedAt") - .HasColumnType("datetime2"); - - b.Property("ClientId") - .HasColumnType("bigint"); - - b.Property("FreelancerId") - .HasColumnType("bigint"); - - b.Property("Notes") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ProjectId") - .HasColumnType("int"); - - b.Property("ProposedPrice") - .HasColumnType("decimal(18,2)"); - - b.Property("Status") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("SubmittedAt") - .HasColumnType("datetime2"); - - b.Property("SystemUserId") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.HasIndex("ClientId"); - - b.HasIndex("FreelancerId"); - - b.HasIndex("ProjectId"); - - b.HasIndex("SystemUserId"); - - b.ToTable("Bids"); ->>>>>>> master - }); - - modelBuilder.Entity("AonFreelancing.Models.OTP", b => - { - b.Property("PhoneNumber") - .HasColumnType("nvarchar(450)"); - - b.Property("Code") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("CreatedDate") - .HasColumnType("datetime2"); - - b.Property("ExpiresAt") - .HasColumnType("datetime2"); - - b.Property("IsUsed") - .HasColumnType("bit"); - - b.HasKey("PhoneNumber"); - - b.ToTable("otps", null, t => - { - t.HasCheckConstraint("CK_CODE", "LEN([Code]) = 6"); - }); - }); - - modelBuilder.Entity("AonFreelancing.Models.Project", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Budget") - .HasColumnType("decimal(18,2)"); - - b.Property("ClientId") - .HasColumnType("bigint"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("Description") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Duration") - .HasColumnType("int"); - - b.Property("EndDate") - .HasColumnType("datetime2"); - - b.Property("FreelancerId") - .HasColumnType("bigint"); - - b.Property("ImagePath") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ImageName") - .HasColumnType("TEXT"); - - b.Property("PriceType") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("QualificationName") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("StartDate") - .HasColumnType("datetime2"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasColumnType("nvarchar(max)") - .HasDefaultValue("Available"); - - b.Property("Title") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("ClientId"); - - b.HasIndex("FreelancerId"); - - b.ToTable("Projects", null, t => - { - t.HasCheckConstraint("CK_PRICE_TYPE", "[PriceType] IN ('Fixed', 'PerHour')"); - - t.HasCheckConstraint("CK_QUALIFICATION_NAME", "[QualificationName] IN ('uiux', 'frontend', 'mobile', 'backend', 'fullstack')"); - - t.HasCheckConstraint("CK_STATUS", "[Status] IN ('Available', 'Closed')"); - }); - }); - -<<<<<<< HEAD - modelBuilder.Entity("AonFreelancing.Models.Responses.Bid", b => - { - b.Property("id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ApprovedAt") - .HasColumnType("TEXT"); - - b.Property("FreelancerId") - .HasColumnType("INTEGER"); - - b.Property("Nots") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ProjectId") - .HasColumnType("INTEGER"); - - b.Property("proposed_Price") - .HasColumnType("TEXT"); - - b.Property("status") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("submittedAt") - .HasColumnType("TEXT"); - - b.HasKey("id"); - - b.HasIndex("FreelancerId"); - - b.HasIndex("ProjectId"); - - b.ToTable("Bids", (string)null); - }); - - modelBuilder.Entity("AonFreelancing.Models.Responses.TemUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("PhoneNumberConfirm") - .HasColumnType("INTEGER"); - - b.Property("phoneNumber") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("phoneNumber") - .IsUnique(); - - b.ToTable("TempUsers", (string)null); -======= - modelBuilder.Entity("AonFreelancing.Models.Tasks", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("CompletedAt") - .HasColumnType("datetime2"); - - b.Property("DeadlineAt") - .HasColumnType("datetime2"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Notes") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ProjectId") - .HasColumnType("int"); - - b.Property("Status") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("ProjectId"); - - b.ToTable("Tasks"); ->>>>>>> master - }); - - modelBuilder.Entity("AonFreelancing.Models.TempUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("PhoneNumber") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("bit"); - - b.HasKey("Id"); - - b.HasIndex("PhoneNumber") - .IsUnique(); - - b.ToTable("TempUser", (string)null); - }); - - modelBuilder.Entity("AonFreelancing.Models.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("About") - .HasColumnType("nvarchar(max)"); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("nvarchar(max)"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("EmailConfirmed") - .HasColumnType("bit"); - - b.Property("LockoutEnabled") - .HasColumnType("bit"); - - b.Property("LockoutEnd") - .HasColumnType("datetimeoffset"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("PasswordHash") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumber") - .HasColumnType("nvarchar(450)"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("bit"); - - b.Property("SecurityStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("TwoFactorEnabled") - .HasColumnType("bit"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex") - .HasFilter("[NormalizedUserName] IS NOT NULL"); - - b.HasIndex("PhoneNumber") - .IsUnique() - .HasFilter("[PhoneNumber] IS NOT NULL"); - - b.ToTable("AspNetUsers", (string)null); - - b.UseTptMappingStrategy(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("RoleId") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("nvarchar(450)"); - - b.Property("ProviderKey") - .HasColumnType("nvarchar(450)"); - - b.Property("ProviderDisplayName") - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .HasColumnType("bigint"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("bigint"); - - b.Property("RoleId") - .HasColumnType("bigint"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("bigint"); - - b.Property("LoginProvider") - .HasColumnType("nvarchar(450)"); - - b.Property("Name") - .HasColumnType("nvarchar(450)"); - - b.Property("Value") - .HasColumnType("nvarchar(max)"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("AonFreelancing.Models.Client", b => - { - b.HasBaseType("AonFreelancing.Models.User"); - - b.Property("CompanyName") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.ToTable("Clients", (string)null); - }); - - modelBuilder.Entity("AonFreelancing.Models.Freelancer", b => - { - b.HasBaseType("AonFreelancing.Models.User"); - - b.Property("Skills") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.ToTable("Freelancers", (string)null); - }); - - modelBuilder.Entity("AonFreelancing.Models.SystemUser", b => - { - b.HasBaseType("AonFreelancing.Models.User"); - - b.Property("Permissions") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.ToTable("SystemUsers", (string)null); - }); - -<<<<<<< HEAD - modelBuilder.Entity("AonFreelancing.Models.EntityTask", b => - { - b.HasOne("AonFreelancing.Models.Project", "Project") - .WithMany("Tasks") - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - -======= - modelBuilder.Entity("AonFreelancing.Models.Bid", b => - { - b.HasOne("AonFreelancing.Models.Client", null) - .WithMany("Bids") - .HasForeignKey("ClientId"); - - b.HasOne("AonFreelancing.Models.Freelancer", "Freelancer") - .WithMany("Bids") - .HasForeignKey("FreelancerId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.HasOne("AonFreelancing.Models.Project", "Project") - .WithMany("Bids") - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.HasOne("AonFreelancing.Models.SystemUser", null) - .WithMany("Bids") - .HasForeignKey("SystemUserId"); - - b.Navigation("Freelancer"); - ->>>>>>> master - b.Navigation("Project"); - }); - - modelBuilder.Entity("AonFreelancing.Models.OTP", b => - { - b.HasOne("AonFreelancing.Models.TempUser", null) - .WithOne() - .HasForeignKey("AonFreelancing.Models.OTP", "PhoneNumber") - .HasPrincipalKey("AonFreelancing.Models.TempUser", "PhoneNumber") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AonFreelancing.Models.Project", b => - { - b.HasOne("AonFreelancing.Models.Client", "Client") - .WithMany("Projects") - .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("AonFreelancing.Models.Freelancer", "Freelancer") - .WithMany() - .HasForeignKey("FreelancerId"); - - b.Navigation("Client"); - - b.Navigation("Freelancer"); - }); - -<<<<<<< HEAD - modelBuilder.Entity("AonFreelancing.Models.Responses.Bid", b => - { - b.HasOne("AonFreelancing.Models.Freelancer", "Freelancer") - .WithMany() - .HasForeignKey("FreelancerId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("AonFreelancing.Models.Project", "Project") - .WithMany("Bids") -======= - modelBuilder.Entity("AonFreelancing.Models.Tasks", b => - { - b.HasOne("AonFreelancing.Models.Project", "Project") - .WithMany() ->>>>>>> master - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - -<<<<<<< HEAD - b.Navigation("Freelancer"); - -======= ->>>>>>> master - b.Navigation("Project"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("AonFreelancing.Models.ApplicationRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("AonFreelancing.Models.ApplicationRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("AonFreelancing.Models.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AonFreelancing.Models.Client", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithOne() - .HasForeignKey("AonFreelancing.Models.Client", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AonFreelancing.Models.Freelancer", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithOne() - .HasForeignKey("AonFreelancing.Models.Freelancer", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AonFreelancing.Models.SystemUser", b => - { - b.HasOne("AonFreelancing.Models.User", null) - .WithOne() - .HasForeignKey("AonFreelancing.Models.SystemUser", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("AonFreelancing.Models.Project", b => - { - b.Navigation("Bids"); -<<<<<<< HEAD - - b.Navigation("Tasks"); -======= ->>>>>>> master - }); - - modelBuilder.Entity("AonFreelancing.Models.Client", b => - { - b.Navigation("Bids"); - - b.Navigation("Projects"); - }); - - modelBuilder.Entity("AonFreelancing.Models.Freelancer", b => - { - b.Navigation("Bids"); - }); - - modelBuilder.Entity("AonFreelancing.Models.SystemUser", b => - { - b.Navigation("Bids"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Models/DTOs/ProjectOutDTO.cs b/Models/DTOs/ProjectOutDTO.cs index 3a912ab..34623ce 100644 --- a/Models/DTOs/ProjectOutDTO.cs +++ b/Models/DTOs/ProjectOutDTO.cs @@ -20,20 +20,6 @@ public class ProjectOutDTO public DateTime? EndDate { get; set; } public string? CreationTime { get; set; } - public ProjectOutDTO(Project project, string imageBaseUrl) - { - Title = project.Title; - Description = project.Description; - Status = project.Status; - Budget = project.Budget; - if (project.ImageName != null) - Image = $"{imageBaseUrl}/{project.ImageName}"; - Duration = project.Duration; - PriceType = project.PriceType; - Qualifications = project.QualificationName; - CreatedAt = project.CreatedAt; - StartDate = project.StartDate; - EndDate = project.EndDate; - } + } } diff --git a/Models/Project.cs b/Models/Project.cs index 1a621de..dae005a 100644 --- a/Models/Project.cs +++ b/Models/Project.cs @@ -1,4 +1,5 @@ using AonFreelancing.Models.Responses; +using AonFreelancing.Models.Services; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Diagnostics.CodeAnalysis; @@ -9,6 +10,7 @@ namespace AonFreelancing.Models [Table("Projects")] public class Project { + private readonly TaskService taskService; public int Id { get; set; } [Required] public string Title { get; set; } @@ -22,9 +24,8 @@ public class Project public DateTime CreatedAt { get; set; } public DateTime? StartDate { get; set; } - - public string ?ImageName { get; set; } - + + public double prenctgeTasks { get; set; } = 0; public DateTime? EndDate { get; set; } public string PriceType { get; set; } public int Duration { get; set; } diff --git a/Models/Services/TaskService.cs b/Models/Services/TaskService.cs new file mode 100644 index 0000000..ad54122 --- /dev/null +++ b/Models/Services/TaskService.cs @@ -0,0 +1,27 @@ +using AonFreelancing.Contexts; +using AonFreelancing.Utilities; +using Microsoft.AspNetCore.Http.HttpResults; +using Microsoft.AspNetCore.Identity; +using Microsoft.EntityFrameworkCore; +namespace AonFreelancing.Models.Services +{ + public class TaskService(MainAppContext mainAppContext,UserManageruserManager) + { + + public double GetPrecentgeOfTask(int id) + { + var project = mainAppContext.Projects.Where(p => p.Id == id).FirstOrDefault(); + if (project != null) { + var toatalTask = project.Tasks.Count(); + var completeTasks = project.Tasks.Count(t => t.Status.ToLower() == ConstantStatus.Status_done.ToLower()); + var percetge = toatalTask > 0 ? (completeTasks / toatalTask) : 0; + + return percetge; + } + return 0; + } + + + + } +} diff --git a/Models/TaskEntity.cs b/Models/TaskEntity.cs index 6e9fa09..7cc8c37 100644 --- a/Models/TaskEntity.cs +++ b/Models/TaskEntity.cs @@ -1,6 +1,6 @@ namespace AonFreelancing.Models { - public class ProjectTask + public class TaskEntity { public int Id { get; set; } public int ProjectId { get; set; } diff --git a/Program.cs b/Program.cs index 8948e0c..2d046f6 100644 --- a/Program.cs +++ b/Program.cs @@ -1,4 +1,5 @@ + using AonFreelancing.Contexts; using AonFreelancing.Middlewares; using AonFreelancing.Models; @@ -8,10 +9,7 @@ using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.FileProviders; using Microsoft.IdentityModel.Tokens; -using Microsoft.OpenApi.Models; using System.Text; namespace AonFreelancing @@ -25,38 +23,11 @@ public static void Main(string[] args) var conf = builder.Configuration; builder.Services.AddControllers(o => o.SuppressAsyncSuffixInActionNames = false); builder.Services.AddEndpointsApiExplorer(); - builder.Services.AddSwaggerGen(options => - { - options.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme() - { - Name = "Authorization", - In = ParameterLocation.Header, - Type = SecuritySchemeType.Http, - Scheme = "Bearer" - }); - options.AddSecurityRequirement(new OpenApiSecurityRequirement - { - { - new OpenApiSecurityScheme - { - Reference = new OpenApiReference - { - Type = ReferenceType.SecurityScheme, - Id = "Bearer" - } - }, - Array.Empty() - } - }); - }); + builder.Services.AddSwaggerGen(); builder.Services.AddSingleton(); builder.Services.AddSingleton(); -<<<<<<< HEAD - builder.Services.AddScoped(); - builder.Services.AddDbContext(options => options.UseSqlite("Data Source=aon.db")); -======= + builder.Services.AddSingleton(); builder.Services.AddDbContext(options => options.UseSqlServer(conf.GetConnectionString("Default"))); ->>>>>>> master builder.Services.AddIdentity() .AddEntityFrameworkStores() .AddDefaultTokenProviders(); @@ -98,19 +69,10 @@ public static void Main(string[] args) app.UseSwagger(); app.UseSwaggerUI(); } -<<<<<<< HEAD - app.UseStaticFiles(new StaticFileOptions - { - FileProvider = new PhysicalFileProvider(FileService._uploadFolder), - RequestPath = "/images" - }); -======= // just for testing app.UseSwagger(); app.UseSwaggerUI(); ->>>>>>> master - app.MapControllers(); app.UseMiddleware(); diff --git a/Utilities/ConstantStatus.cs b/Utilities/ConstantStatus.cs new file mode 100644 index 0000000..3bc2b63 --- /dev/null +++ b/Utilities/ConstantStatus.cs @@ -0,0 +1,11 @@ +namespace AonFreelancing.Utilities +{ + public class ConstantStatus + { + + public const string Status_review = "reviwe"; + public const string Status_done = "done"; + public const string Status_IN_Progress = "in_progress"; + public const string Status_To_Do = "to_do"; + } +}