From d4c4bb2ffd50a0e878cf1e9d9c247b7b6cd3b2b5 Mon Sep 17 00:00:00 2001 From: mmrbnjd Date: Thu, 24 Jul 2025 23:18:11 +0330 Subject: [PATCH] ... --- Common/Validation/FixedValidation.cs | 2 +- .../ApplicationServicesRegistration.cs | 13 +- Hushian.Application/Services/AuthService.cs | 31 +- Hushian.Application/Services/ExMethod.cs | 32 +- Hushian.Application/Services/UserService.cs | 6 + .../Services/VerificationService.cs | 14 +- .../InfrastractureServicesRegistration.cs | 2 +- .../Persistence/HushianDbContext.cs | 29 +- .../20250724132732_InitalDB.Designer.cs | 425 ++++++++++++++++ .../Migrations/20250724132732_InitalDB.cs | 287 +++++++++++ .../20250724140236_changetbeg.Designer.cs | 425 ++++++++++++++++ .../Migrations/20250724140236_changetbeg.cs | 41 ++ .../20250724183709_tbverification.Designer.cs | 452 ++++++++++++++++++ .../20250724183709_tbverification.cs | 38 ++ .../HushianDbContextModelSnapshot.cs | 449 +++++++++++++++++ Presentation/Hushian.WebApi/Program.cs | 5 +- .../Components/Verification.razor | 88 +++- .../Pages/Auth/ForgetPassword.razor | 2 +- .../HushianWebApp/Pages/Auth/Register.razor | 7 +- Presentation/HushianWebApp/Program.cs | 2 +- 20 files changed, 2285 insertions(+), 65 deletions(-) create mode 100644 Infrastructure/Persistence/Migrations/20250724132732_InitalDB.Designer.cs create mode 100644 Infrastructure/Persistence/Migrations/20250724132732_InitalDB.cs create mode 100644 Infrastructure/Persistence/Migrations/20250724140236_changetbeg.Designer.cs create mode 100644 Infrastructure/Persistence/Migrations/20250724140236_changetbeg.cs create mode 100644 Infrastructure/Persistence/Migrations/20250724183709_tbverification.Designer.cs create mode 100644 Infrastructure/Persistence/Migrations/20250724183709_tbverification.cs create mode 100644 Infrastructure/Persistence/Migrations/HushianDbContextModelSnapshot.cs diff --git a/Common/Validation/FixedValidation.cs b/Common/Validation/FixedValidation.cs index 5191a73..fffd221 100644 --- a/Common/Validation/FixedValidation.cs +++ b/Common/Validation/FixedValidation.cs @@ -6,7 +6,7 @@ namespace Common.Validation public static bool CheckLawPassword(this string password, ref List errors) { bool ret = true; - if (password.Length != 6) + if (password.Length < 6) { errors.Add("کلمه عبور باید حداقل 6 گاراکتر باشد"); ret = false; diff --git a/Hushian.Application/ApplicationServicesRegistration.cs b/Hushian.Application/ApplicationServicesRegistration.cs index 96ebb46..8e04b88 100644 --- a/Hushian.Application/ApplicationServicesRegistration.cs +++ b/Hushian.Application/ApplicationServicesRegistration.cs @@ -1,4 +1,6 @@ -using Hushian.WebApi; +using Hushian.Application.Models; +using Hushian.Application.Services; +using Hushian.WebApi; using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; @@ -58,7 +60,14 @@ namespace Hushian.Application } }; }); - + services.AddScoped(typeof(AuthService)); + services.AddScoped(typeof(CompanyService)); + services.AddScoped(typeof(ConversationService)); + services.AddScoped(typeof(ExperService)); + services.AddScoped(typeof(GroupService)); + services.AddScoped(typeof(UserService)); + services.AddScoped(typeof(VerificationService)); + services.Configure(configuration.GetSection("JwtSettings")); } } } diff --git a/Hushian.Application/Services/AuthService.cs b/Hushian.Application/Services/AuthService.cs index 15a5cc3..357f057 100644 --- a/Hushian.Application/Services/AuthService.cs +++ b/Hushian.Application/Services/AuthService.cs @@ -67,7 +67,7 @@ namespace Hushian.Application.Services Role="Company", img=Company.logo, MobileOrUserName = Company.Mobile, - Token = new JwtSecurityTokenHandler().WriteToken(await GenerateToken(Company.Mobile, Company.ID, "Company")) + Token = new JwtSecurityTokenHandler().WriteToken(_jwtSettings.GenerateToken(Company.Mobile, Company.ID, "Company")) }; } } @@ -89,7 +89,7 @@ namespace Hushian.Application.Services CompanyId = exper.CompanyID, MobileOrUserName = exper.UserName, Role="Exper", - Token = new JwtSecurityTokenHandler().WriteToken(await GenerateToken(exper.UserName, exper.ID, "Exper")) + Token = new JwtSecurityTokenHandler().WriteToken(_jwtSettings.GenerateToken(exper.UserName, exper.ID, "Exper")) }; } } @@ -126,31 +126,6 @@ namespace Hushian.Application.Services return Response; } - public async Task GenerateToken(string UserName, int userId, string Role) - { - var claims = new[] - { - new Claim(JwtRegisteredClaimNames.Sub,UserName), - new Claim(ClaimTypes.NameIdentifier, UserName), - new Claim(CustomClaimTypes.Uid,userId.ToString()), - new Claim(ClaimTypes.Role, Role) - }; - - - var symmetricSecurityKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(_jwtSettings.Key)); - var signingCredentials = new SigningCredentials(symmetricSecurityKey, SecurityAlgorithms.HmacSha256); - - var jwtSecurityToken = new JwtSecurityToken( - issuer: _jwtSettings.Issuer, - audience: _jwtSettings.Audience, - claims: claims, - expires: DateTime.UtcNow.AddMinutes(_jwtSettings.DurationInMinutes), - signingCredentials: signingCredentials); - - //user.Token = new JwtSecurityTokenHandler().WriteToken(jwtSecurityToken); - //var resultupdateuser = await _userManager.UpdateAsync(user); - - return jwtSecurityToken; - } + } } diff --git a/Hushian.Application/Services/ExMethod.cs b/Hushian.Application/Services/ExMethod.cs index fa55bf5..4af12e2 100644 --- a/Hushian.Application/Services/ExMethod.cs +++ b/Hushian.Application/Services/ExMethod.cs @@ -1,7 +1,12 @@ -using System; +using Hushian.Application.Constants; +using Hushian.Application.Models; +using Microsoft.IdentityModel.Tokens; +using System; using System.Collections.Generic; using System.Globalization; +using System.IdentityModel.Tokens.Jwt; using System.Linq; +using System.Security.Claims; using System.Text; using System.Threading.Tasks; @@ -18,5 +23,30 @@ namespace Hushian.Application.Services { return d.Hour.ToString() + ":" + d.Minute.ToString(); } + public static JwtSecurityToken GenerateToken(this JwtSettings _jwtSettings,string UserName, int userId, string Role) + { + var claims = new[] + { + new Claim(JwtRegisteredClaimNames.Sub,UserName), + new Claim(ClaimTypes.NameIdentifier, UserName), + new Claim(CustomClaimTypes.Uid,userId.ToString()), + new Claim(ClaimTypes.Role, Role) + }; + + + var symmetricSecurityKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(_jwtSettings.Key)); + var signingCredentials = new SigningCredentials(symmetricSecurityKey, SecurityAlgorithms.HmacSha256); + var jwtSecurityToken = new JwtSecurityToken( + issuer: _jwtSettings.Issuer, + audience: _jwtSettings.Audience, + claims: claims, + expires: DateTime.UtcNow.AddMinutes(_jwtSettings.DurationInMinutes), + signingCredentials: signingCredentials); + + //user.Token = new JwtSecurityTokenHandler().WriteToken(jwtSecurityToken); + //var resultupdateuser = await _userManager.UpdateAsync(user); + + return jwtSecurityToken; + } } } diff --git a/Hushian.Application/Services/UserService.cs b/Hushian.Application/Services/UserService.cs index c111666..f76d653 100644 --- a/Hushian.Application/Services/UserService.cs +++ b/Hushian.Application/Services/UserService.cs @@ -12,6 +12,12 @@ namespace Hushian.Application.Services public class UserService { private readonly IGenericRepository _UserRepository; + + public UserService(IGenericRepository userRepository) + { + _UserRepository = userRepository; + } + public async Task AnyUser(int UserID) =>await _UserRepository.Get().AnyAsync(a=>a.ID==UserID); } diff --git a/Hushian.Application/Services/VerificationService.cs b/Hushian.Application/Services/VerificationService.cs index eea6ba6..e4ac47b 100644 --- a/Hushian.Application/Services/VerificationService.cs +++ b/Hushian.Application/Services/VerificationService.cs @@ -11,31 +11,33 @@ using Microsoft.EntityFrameworkCore; using System; using System.Collections.Generic; using System.IdentityModel.Tokens.Jwt; +using Hushian.Application.Models.Message; +using Microsoft.Extensions.Options; namespace Hushian.Application.Services { public class VerificationService { + private readonly JwtSettings _jwtSettings; private readonly IGenericRepository _VerificationCodeRepository; private readonly IGenericRepository _CompanyRepository; private readonly IGenericRepository _ExperRepository; private readonly IMessageSender _messageSender; private readonly IGenericRepository _UserRepository; - private readonly AuthService _authService; public VerificationService(IGenericRepository verificationCodeRepository , IMessageSender messageSender , IGenericRepository userRepository - , AuthService authService , IGenericRepository companyRepository - , IGenericRepository experRepository) + , IGenericRepository experRepository + , IOptions jwtSettings) { _VerificationCodeRepository = verificationCodeRepository; _messageSender = messageSender; _UserRepository = userRepository; - _authService = authService; _CompanyRepository = companyRepository; _ExperRepository = experRepository; + _jwtSettings = jwtSettings.Value; } public async Task GenerateCodeForLoginUser(string Mobile) @@ -93,7 +95,7 @@ namespace Hushian.Application.Services Id = User.ID, MobileOrUserName = User.Mobile, Role="User", - Token = new JwtSecurityTokenHandler().WriteToken(await _authService.GenerateToken(User.Mobile, User.ID, "User")) + Token = new JwtSecurityTokenHandler().WriteToken(_jwtSettings.GenerateToken(User.Mobile, User.ID, "User")) }; } else @@ -156,7 +158,7 @@ namespace Hushian.Application.Services Role = "Company", img = anyCompany.logo, MobileOrUserName = anyCompany.Mobile, - Token = new JwtSecurityTokenHandler().WriteToken(await _authService.GenerateToken(anyCompany.Mobile, anyCompany.ID, "Company")) + Token = new JwtSecurityTokenHandler().WriteToken(_jwtSettings.GenerateToken(anyCompany.Mobile, anyCompany.ID, "Company")) }; } else diff --git a/Infrastructure/Infrastructure/InfrastractureServicesRegistration.cs b/Infrastructure/Infrastructure/InfrastractureServicesRegistration.cs index 79eafce..e7b1947 100644 --- a/Infrastructure/Infrastructure/InfrastractureServicesRegistration.cs +++ b/Infrastructure/Infrastructure/InfrastractureServicesRegistration.cs @@ -20,7 +20,7 @@ namespace Hushian.Infrastructure //services.Configure(configuration.GetSection("aiSettings")); //services.AddTransient(); - // services.AddScoped(c => new Melipayamak.RestClient(configuration.GetSection("MessageSettings:UserName").Value, configuration.GetSection("MessageSettings:Password").Value)); + services.AddScoped(c => new Melipayamak.RestClient(configuration.GetSection("MessageSettings:UserName").Value, configuration.GetSection("MessageSettings:Password").Value)); return services; } } diff --git a/Infrastructure/Persistence/HushianDbContext.cs b/Infrastructure/Persistence/HushianDbContext.cs index a9604ee..7dbfdce 100644 --- a/Infrastructure/Persistence/HushianDbContext.cs +++ b/Infrastructure/Persistence/HushianDbContext.cs @@ -1,4 +1,5 @@ using Hushian.Domain.Entites; +using Identity.Models; using Microsoft.EntityFrameworkCore; @@ -7,30 +8,40 @@ namespace Hushian.Persistence public class HushianDbContext : DbContext { public HushianDbContext(DbContextOptions options) - :base(options) + : base(options) { - + } #region Table - public DbSet Companies { get; set; } - public DbSet Conversations { get; set; } - public DbSet ConversationItems { get; set; } - public DbSet Groups { get; set; } - public DbSet Expers { get; set; } - public DbSet EG { get; set; } + public DbSet Companies { get; set; } + public DbSet Conversations { get; set; } + public DbSet ConversationItems { get; set; } + public DbSet Groups { get; set; } + public DbSet Expers { get; set; } + public DbSet EG { get; set; } public DbSet Users { get; set; } + public DbSet verificationCodes { get; set; } #endregion protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity().HasKey(c => new { c.ExperID, c.GroupID }); + modelBuilder.Entity().HasOne(eg => eg.Exper) + .WithMany(e => e.EG) + .HasForeignKey(eg => eg.ExperID) + .OnDelete(DeleteBehavior.ClientCascade); + modelBuilder.Entity() + .HasOne(eg => eg.Group) + .WithMany(g => g.EG) + .HasForeignKey(eg => eg.GroupID) + .OnDelete(DeleteBehavior.ClientCascade); modelBuilder .ApplyConfigurationsFromAssembly(typeof(HushianDbContext).Assembly); } - + } } diff --git a/Infrastructure/Persistence/Migrations/20250724132732_InitalDB.Designer.cs b/Infrastructure/Persistence/Migrations/20250724132732_InitalDB.Designer.cs new file mode 100644 index 0000000..814d8a4 --- /dev/null +++ b/Infrastructure/Persistence/Migrations/20250724132732_InitalDB.Designer.cs @@ -0,0 +1,425 @@ +// +using System; +using Hushian.Persistence; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Hushian.Persistence.Migrations +{ + [DbContext(typeof(HushianDbContext))] + [Migration("20250724132732_InitalDB")] + partial class InitalDB + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "9.0.7") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("Hushian.Domain.Entites.Company", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID")); + + b.Property("Available") + .HasColumnType("bit"); + + b.Property("Cdatetime") + .HasColumnType("datetime2"); + + b.Property("Email") + .HasColumnType("nvarchar(max)"); + + b.Property("FullName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("FullNameManager") + .HasColumnType("nvarchar(max)"); + + b.Property("Mobile") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Password") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Verified") + .HasColumnType("bit"); + + b.Property("WebSite") + .HasColumnType("nvarchar(max)"); + + b.Property("allowBot") + .HasColumnType("bit"); + + b.Property("logo") + .HasColumnType("varbinary(max)"); + + b.HasKey("ID"); + + b.ToTable("Companies"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.CompanyContentInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID")); + + b.Property("Cdatetime") + .HasColumnType("datetime2"); + + b.Property("CompanyID") + .HasColumnType("int"); + + b.Property("Content") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("ID"); + + b.HasIndex("CompanyID"); + + b.ToTable("CompanyContentInfo"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.Conversation", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID")); + + b.Property("Cdatetime") + .HasColumnType("datetime2"); + + b.Property("CompanyID") + .HasColumnType("int"); + + b.Property("FinishedDateTime") + .HasColumnType("datetime2"); + + b.Property("GroupID") + .HasColumnType("int"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("UserID") + .HasColumnType("int"); + + b.HasKey("ID"); + + b.HasIndex("CompanyID"); + + b.HasIndex("GroupID"); + + b.HasIndex("UserID"); + + b.ToTable("Conversations"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.ConversationResponse", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID")); + + b.Property("Cdatetime") + .HasColumnType("datetime2"); + + b.Property("ConversationID") + .HasColumnType("int"); + + b.Property("ExperID") + .HasColumnType("int"); + + b.Property("FileContent") + .HasColumnType("varbinary(max)"); + + b.Property("FileName") + .HasColumnType("nvarchar(max)"); + + b.Property("FileType") + .HasColumnType("nvarchar(max)"); + + b.Property("IsRead") + .HasColumnType("bit"); + + b.Property("ReadDateTime") + .HasColumnType("datetime2"); + + b.Property("Text") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("ID"); + + b.HasIndex("ConversationID"); + + b.HasIndex("ExperID"); + + b.ToTable("ConversationItems"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.Exper", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID")); + + b.Property("Available") + .HasColumnType("bit"); + + b.Property("Cdatetime") + .HasColumnType("datetime2"); + + b.Property("CompanyID") + .HasColumnType("int"); + + b.Property("FullName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Password") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("UserName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("ID"); + + b.HasIndex("CompanyID"); + + b.ToTable("Expers"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.ExperGroup", b => + { + b.Property("ExperID") + .HasColumnType("int"); + + b.Property("GroupID") + .HasColumnType("int"); + + b.Property("Cdatetime") + .HasColumnType("datetime2"); + + b.HasKey("ExperID", "GroupID"); + + b.HasIndex("GroupID"); + + b.ToTable("EG"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.Group", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID")); + + b.Property("Available") + .HasColumnType("bit"); + + b.Property("Cdatetime") + .HasColumnType("datetime2"); + + b.Property("CompanyID") + .HasColumnType("int"); + + b.Property("Info") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("img") + .HasColumnType("varbinary(max)"); + + b.HasKey("ID"); + + b.HasIndex("CompanyID"); + + b.ToTable("Groups"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.User", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID")); + + b.Property("Cdatetime") + .HasColumnType("datetime2"); + + b.Property("FullName") + .HasColumnType("nvarchar(max)"); + + b.Property("Mobile") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("ID"); + + b.ToTable("Users"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.CompanyContentInfo", b => + { + b.HasOne("Hushian.Domain.Entites.Company", "company") + .WithMany("CompanyContentInfos") + .HasForeignKey("CompanyID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("company"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.Conversation", b => + { + b.HasOne("Hushian.Domain.Entites.Company", "Company") + .WithMany("Conversations") + .HasForeignKey("CompanyID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Hushian.Domain.Entites.Group", "Group") + .WithMany() + .HasForeignKey("GroupID"); + + b.HasOne("Hushian.Domain.Entites.User", "User") + .WithMany("Conversations") + .HasForeignKey("UserID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Company"); + + b.Navigation("Group"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.ConversationResponse", b => + { + b.HasOne("Hushian.Domain.Entites.Conversation", "conversation") + .WithMany("ConversationResponses") + .HasForeignKey("ConversationID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Hushian.Domain.Entites.Exper", "Exper") + .WithMany() + .HasForeignKey("ExperID"); + + b.Navigation("Exper"); + + b.Navigation("conversation"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.Exper", b => + { + b.HasOne("Hushian.Domain.Entites.Company", "Company") + .WithMany("Expers") + .HasForeignKey("CompanyID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Company"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.ExperGroup", b => + { + b.HasOne("Hushian.Domain.Entites.Exper", "Exper") + .WithMany("EG") + .HasForeignKey("ExperID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Hushian.Domain.Entites.Group", "Group") + .WithMany("EG") + .HasForeignKey("GroupID") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.Navigation("Exper"); + + b.Navigation("Group"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.Group", b => + { + b.HasOne("Hushian.Domain.Entites.Company", "Company") + .WithMany("Groups") + .HasForeignKey("CompanyID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Company"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.Company", b => + { + b.Navigation("CompanyContentInfos"); + + b.Navigation("Conversations"); + + b.Navigation("Expers"); + + b.Navigation("Groups"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.Conversation", b => + { + b.Navigation("ConversationResponses"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.Exper", b => + { + b.Navigation("EG"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.Group", b => + { + b.Navigation("EG"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.User", b => + { + b.Navigation("Conversations"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Infrastructure/Persistence/Migrations/20250724132732_InitalDB.cs b/Infrastructure/Persistence/Migrations/20250724132732_InitalDB.cs new file mode 100644 index 0000000..6e04f75 --- /dev/null +++ b/Infrastructure/Persistence/Migrations/20250724132732_InitalDB.cs @@ -0,0 +1,287 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Hushian.Persistence.Migrations +{ + /// + public partial class InitalDB : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Companies", + columns: table => new + { + ID = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Cdatetime = table.Column(type: "datetime2", nullable: false), + Password = table.Column(type: "nvarchar(max)", nullable: false), + FullName = table.Column(type: "nvarchar(max)", nullable: false), + FullNameManager = table.Column(type: "nvarchar(max)", nullable: true), + Mobile = table.Column(type: "nvarchar(max)", nullable: false), + WebSite = table.Column(type: "nvarchar(max)", nullable: true), + Email = table.Column(type: "nvarchar(max)", nullable: true), + logo = table.Column(type: "varbinary(max)", nullable: true), + Available = table.Column(type: "bit", nullable: false), + allowBot = table.Column(type: "bit", nullable: false), + Verified = table.Column(type: "bit", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Companies", x => x.ID); + }); + + migrationBuilder.CreateTable( + name: "Users", + columns: table => new + { + ID = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Cdatetime = table.Column(type: "datetime2", nullable: false), + FullName = table.Column(type: "nvarchar(max)", nullable: true), + Mobile = table.Column(type: "nvarchar(max)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Users", x => x.ID); + }); + + migrationBuilder.CreateTable( + name: "CompanyContentInfo", + columns: table => new + { + ID = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + CompanyID = table.Column(type: "int", nullable: false), + Content = table.Column(type: "nvarchar(max)", nullable: false), + Cdatetime = table.Column(type: "datetime2", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_CompanyContentInfo", x => x.ID); + table.ForeignKey( + name: "FK_CompanyContentInfo_Companies_CompanyID", + column: x => x.CompanyID, + principalTable: "Companies", + principalColumn: "ID", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Expers", + columns: table => new + { + ID = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + CompanyID = table.Column(type: "int", nullable: false), + Cdatetime = table.Column(type: "datetime2", nullable: false), + FullName = table.Column(type: "nvarchar(max)", nullable: false), + UserName = table.Column(type: "nvarchar(max)", nullable: false), + Password = table.Column(type: "nvarchar(max)", nullable: false), + Available = table.Column(type: "bit", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Expers", x => x.ID); + table.ForeignKey( + name: "FK_Expers_Companies_CompanyID", + column: x => x.CompanyID, + principalTable: "Companies", + principalColumn: "ID", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Groups", + columns: table => new + { + ID = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + CompanyID = table.Column(type: "int", nullable: false), + Cdatetime = table.Column(type: "datetime2", nullable: false), + Name = table.Column(type: "nvarchar(max)", nullable: false), + img = table.Column(type: "varbinary(max)", nullable: true), + Info = table.Column(type: "nvarchar(max)", nullable: true), + Available = table.Column(type: "bit", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Groups", x => x.ID); + table.ForeignKey( + name: "FK_Groups_Companies_CompanyID", + column: x => x.CompanyID, + principalTable: "Companies", + principalColumn: "ID", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Conversations", + columns: table => new + { + ID = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + CompanyID = table.Column(type: "int", nullable: false), + UserID = table.Column(type: "int", nullable: false), + GroupID = table.Column(type: "int", nullable: true), + Status = table.Column(type: "int", nullable: false), + FinishedDateTime = table.Column(type: "datetime2", nullable: true), + Cdatetime = table.Column(type: "datetime2", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Conversations", x => x.ID); + table.ForeignKey( + name: "FK_Conversations_Companies_CompanyID", + column: x => x.CompanyID, + principalTable: "Companies", + principalColumn: "ID", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Conversations_Groups_GroupID", + column: x => x.GroupID, + principalTable: "Groups", + principalColumn: "ID"); + table.ForeignKey( + name: "FK_Conversations_Users_UserID", + column: x => x.UserID, + principalTable: "Users", + principalColumn: "ID", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "EG", + columns: table => new + { + ExperID = table.Column(type: "int", nullable: false), + GroupID = table.Column(type: "int", nullable: false), + Cdatetime = table.Column(type: "datetime2", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_EG", x => new { x.ExperID, x.GroupID }); + table.ForeignKey( + name: "FK_EG_Expers_ExperID", + column: x => x.ExperID, + principalTable: "Expers", + principalColumn: "ID", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_EG_Groups_GroupID", + column: x => x.GroupID, + principalTable: "Groups", + principalColumn: "ID"); + }); + + migrationBuilder.CreateTable( + name: "ConversationItems", + columns: table => new + { + ID = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + ConversationID = table.Column(type: "int", nullable: false), + ExperID = table.Column(type: "int", nullable: true), + IsRead = table.Column(type: "bit", nullable: false), + Type = table.Column(type: "int", nullable: false), + Text = table.Column(type: "nvarchar(max)", nullable: false), + FileName = table.Column(type: "nvarchar(max)", nullable: true), + FileType = table.Column(type: "nvarchar(max)", nullable: true), + FileContent = table.Column(type: "varbinary(max)", nullable: true), + ReadDateTime = table.Column(type: "datetime2", nullable: true), + Cdatetime = table.Column(type: "datetime2", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ConversationItems", x => x.ID); + table.ForeignKey( + name: "FK_ConversationItems_Conversations_ConversationID", + column: x => x.ConversationID, + principalTable: "Conversations", + principalColumn: "ID", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ConversationItems_Expers_ExperID", + column: x => x.ExperID, + principalTable: "Expers", + principalColumn: "ID"); + }); + + migrationBuilder.CreateIndex( + name: "IX_CompanyContentInfo_CompanyID", + table: "CompanyContentInfo", + column: "CompanyID"); + + migrationBuilder.CreateIndex( + name: "IX_ConversationItems_ConversationID", + table: "ConversationItems", + column: "ConversationID"); + + migrationBuilder.CreateIndex( + name: "IX_ConversationItems_ExperID", + table: "ConversationItems", + column: "ExperID"); + + migrationBuilder.CreateIndex( + name: "IX_Conversations_CompanyID", + table: "Conversations", + column: "CompanyID"); + + migrationBuilder.CreateIndex( + name: "IX_Conversations_GroupID", + table: "Conversations", + column: "GroupID"); + + migrationBuilder.CreateIndex( + name: "IX_Conversations_UserID", + table: "Conversations", + column: "UserID"); + + migrationBuilder.CreateIndex( + name: "IX_EG_GroupID", + table: "EG", + column: "GroupID"); + + migrationBuilder.CreateIndex( + name: "IX_Expers_CompanyID", + table: "Expers", + column: "CompanyID"); + + migrationBuilder.CreateIndex( + name: "IX_Groups_CompanyID", + table: "Groups", + column: "CompanyID"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "CompanyContentInfo"); + + migrationBuilder.DropTable( + name: "ConversationItems"); + + migrationBuilder.DropTable( + name: "EG"); + + migrationBuilder.DropTable( + name: "Conversations"); + + migrationBuilder.DropTable( + name: "Expers"); + + migrationBuilder.DropTable( + name: "Groups"); + + migrationBuilder.DropTable( + name: "Users"); + + migrationBuilder.DropTable( + name: "Companies"); + } + } +} diff --git a/Infrastructure/Persistence/Migrations/20250724140236_changetbeg.Designer.cs b/Infrastructure/Persistence/Migrations/20250724140236_changetbeg.Designer.cs new file mode 100644 index 0000000..727f77c --- /dev/null +++ b/Infrastructure/Persistence/Migrations/20250724140236_changetbeg.Designer.cs @@ -0,0 +1,425 @@ +// +using System; +using Hushian.Persistence; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Hushian.Persistence.Migrations +{ + [DbContext(typeof(HushianDbContext))] + [Migration("20250724140236_changetbeg")] + partial class changetbeg + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "9.0.7") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("Hushian.Domain.Entites.Company", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID")); + + b.Property("Available") + .HasColumnType("bit"); + + b.Property("Cdatetime") + .HasColumnType("datetime2"); + + b.Property("Email") + .HasColumnType("nvarchar(max)"); + + b.Property("FullName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("FullNameManager") + .HasColumnType("nvarchar(max)"); + + b.Property("Mobile") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Password") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Verified") + .HasColumnType("bit"); + + b.Property("WebSite") + .HasColumnType("nvarchar(max)"); + + b.Property("allowBot") + .HasColumnType("bit"); + + b.Property("logo") + .HasColumnType("varbinary(max)"); + + b.HasKey("ID"); + + b.ToTable("Companies"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.CompanyContentInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID")); + + b.Property("Cdatetime") + .HasColumnType("datetime2"); + + b.Property("CompanyID") + .HasColumnType("int"); + + b.Property("Content") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("ID"); + + b.HasIndex("CompanyID"); + + b.ToTable("CompanyContentInfo"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.Conversation", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID")); + + b.Property("Cdatetime") + .HasColumnType("datetime2"); + + b.Property("CompanyID") + .HasColumnType("int"); + + b.Property("FinishedDateTime") + .HasColumnType("datetime2"); + + b.Property("GroupID") + .HasColumnType("int"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("UserID") + .HasColumnType("int"); + + b.HasKey("ID"); + + b.HasIndex("CompanyID"); + + b.HasIndex("GroupID"); + + b.HasIndex("UserID"); + + b.ToTable("Conversations"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.ConversationResponse", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID")); + + b.Property("Cdatetime") + .HasColumnType("datetime2"); + + b.Property("ConversationID") + .HasColumnType("int"); + + b.Property("ExperID") + .HasColumnType("int"); + + b.Property("FileContent") + .HasColumnType("varbinary(max)"); + + b.Property("FileName") + .HasColumnType("nvarchar(max)"); + + b.Property("FileType") + .HasColumnType("nvarchar(max)"); + + b.Property("IsRead") + .HasColumnType("bit"); + + b.Property("ReadDateTime") + .HasColumnType("datetime2"); + + b.Property("Text") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("ID"); + + b.HasIndex("ConversationID"); + + b.HasIndex("ExperID"); + + b.ToTable("ConversationItems"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.Exper", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID")); + + b.Property("Available") + .HasColumnType("bit"); + + b.Property("Cdatetime") + .HasColumnType("datetime2"); + + b.Property("CompanyID") + .HasColumnType("int"); + + b.Property("FullName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Password") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("UserName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("ID"); + + b.HasIndex("CompanyID"); + + b.ToTable("Expers"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.ExperGroup", b => + { + b.Property("ExperID") + .HasColumnType("int"); + + b.Property("GroupID") + .HasColumnType("int"); + + b.Property("Cdatetime") + .HasColumnType("datetime2"); + + b.HasKey("ExperID", "GroupID"); + + b.HasIndex("GroupID"); + + b.ToTable("EG"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.Group", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID")); + + b.Property("Available") + .HasColumnType("bit"); + + b.Property("Cdatetime") + .HasColumnType("datetime2"); + + b.Property("CompanyID") + .HasColumnType("int"); + + b.Property("Info") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("img") + .HasColumnType("varbinary(max)"); + + b.HasKey("ID"); + + b.HasIndex("CompanyID"); + + b.ToTable("Groups"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.User", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID")); + + b.Property("Cdatetime") + .HasColumnType("datetime2"); + + b.Property("FullName") + .HasColumnType("nvarchar(max)"); + + b.Property("Mobile") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("ID"); + + b.ToTable("Users"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.CompanyContentInfo", b => + { + b.HasOne("Hushian.Domain.Entites.Company", "company") + .WithMany("CompanyContentInfos") + .HasForeignKey("CompanyID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("company"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.Conversation", b => + { + b.HasOne("Hushian.Domain.Entites.Company", "Company") + .WithMany("Conversations") + .HasForeignKey("CompanyID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Hushian.Domain.Entites.Group", "Group") + .WithMany() + .HasForeignKey("GroupID"); + + b.HasOne("Hushian.Domain.Entites.User", "User") + .WithMany("Conversations") + .HasForeignKey("UserID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Company"); + + b.Navigation("Group"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.ConversationResponse", b => + { + b.HasOne("Hushian.Domain.Entites.Conversation", "conversation") + .WithMany("ConversationResponses") + .HasForeignKey("ConversationID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Hushian.Domain.Entites.Exper", "Exper") + .WithMany() + .HasForeignKey("ExperID"); + + b.Navigation("Exper"); + + b.Navigation("conversation"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.Exper", b => + { + b.HasOne("Hushian.Domain.Entites.Company", "Company") + .WithMany("Expers") + .HasForeignKey("CompanyID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Company"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.ExperGroup", b => + { + b.HasOne("Hushian.Domain.Entites.Exper", "Exper") + .WithMany("EG") + .HasForeignKey("ExperID") + .OnDelete(DeleteBehavior.ClientCascade) + .IsRequired(); + + b.HasOne("Hushian.Domain.Entites.Group", "Group") + .WithMany("EG") + .HasForeignKey("GroupID") + .OnDelete(DeleteBehavior.ClientCascade) + .IsRequired(); + + b.Navigation("Exper"); + + b.Navigation("Group"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.Group", b => + { + b.HasOne("Hushian.Domain.Entites.Company", "Company") + .WithMany("Groups") + .HasForeignKey("CompanyID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Company"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.Company", b => + { + b.Navigation("CompanyContentInfos"); + + b.Navigation("Conversations"); + + b.Navigation("Expers"); + + b.Navigation("Groups"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.Conversation", b => + { + b.Navigation("ConversationResponses"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.Exper", b => + { + b.Navigation("EG"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.Group", b => + { + b.Navigation("EG"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.User", b => + { + b.Navigation("Conversations"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Infrastructure/Persistence/Migrations/20250724140236_changetbeg.cs b/Infrastructure/Persistence/Migrations/20250724140236_changetbeg.cs new file mode 100644 index 0000000..e846db8 --- /dev/null +++ b/Infrastructure/Persistence/Migrations/20250724140236_changetbeg.cs @@ -0,0 +1,41 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Hushian.Persistence.Migrations +{ + /// + public partial class changetbeg : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_EG_Expers_ExperID", + table: "EG"); + + migrationBuilder.AddForeignKey( + name: "FK_EG_Expers_ExperID", + table: "EG", + column: "ExperID", + principalTable: "Expers", + principalColumn: "ID"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_EG_Expers_ExperID", + table: "EG"); + + migrationBuilder.AddForeignKey( + name: "FK_EG_Expers_ExperID", + table: "EG", + column: "ExperID", + principalTable: "Expers", + principalColumn: "ID", + onDelete: ReferentialAction.Cascade); + } + } +} diff --git a/Infrastructure/Persistence/Migrations/20250724183709_tbverification.Designer.cs b/Infrastructure/Persistence/Migrations/20250724183709_tbverification.Designer.cs new file mode 100644 index 0000000..fb8b23e --- /dev/null +++ b/Infrastructure/Persistence/Migrations/20250724183709_tbverification.Designer.cs @@ -0,0 +1,452 @@ +// +using System; +using Hushian.Persistence; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Hushian.Persistence.Migrations +{ + [DbContext(typeof(HushianDbContext))] + [Migration("20250724183709_tbverification")] + partial class tbverification + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "9.0.7") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("Hushian.Domain.Entites.Company", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID")); + + b.Property("Available") + .HasColumnType("bit"); + + b.Property("Cdatetime") + .HasColumnType("datetime2"); + + b.Property("Email") + .HasColumnType("nvarchar(max)"); + + b.Property("FullName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("FullNameManager") + .HasColumnType("nvarchar(max)"); + + b.Property("Mobile") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Password") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Verified") + .HasColumnType("bit"); + + b.Property("WebSite") + .HasColumnType("nvarchar(max)"); + + b.Property("allowBot") + .HasColumnType("bit"); + + b.Property("logo") + .HasColumnType("varbinary(max)"); + + b.HasKey("ID"); + + b.ToTable("Companies"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.CompanyContentInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID")); + + b.Property("Cdatetime") + .HasColumnType("datetime2"); + + b.Property("CompanyID") + .HasColumnType("int"); + + b.Property("Content") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("ID"); + + b.HasIndex("CompanyID"); + + b.ToTable("CompanyContentInfo"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.Conversation", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID")); + + b.Property("Cdatetime") + .HasColumnType("datetime2"); + + b.Property("CompanyID") + .HasColumnType("int"); + + b.Property("FinishedDateTime") + .HasColumnType("datetime2"); + + b.Property("GroupID") + .HasColumnType("int"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("UserID") + .HasColumnType("int"); + + b.HasKey("ID"); + + b.HasIndex("CompanyID"); + + b.HasIndex("GroupID"); + + b.HasIndex("UserID"); + + b.ToTable("Conversations"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.ConversationResponse", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID")); + + b.Property("Cdatetime") + .HasColumnType("datetime2"); + + b.Property("ConversationID") + .HasColumnType("int"); + + b.Property("ExperID") + .HasColumnType("int"); + + b.Property("FileContent") + .HasColumnType("varbinary(max)"); + + b.Property("FileName") + .HasColumnType("nvarchar(max)"); + + b.Property("FileType") + .HasColumnType("nvarchar(max)"); + + b.Property("IsRead") + .HasColumnType("bit"); + + b.Property("ReadDateTime") + .HasColumnType("datetime2"); + + b.Property("Text") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("ID"); + + b.HasIndex("ConversationID"); + + b.HasIndex("ExperID"); + + b.ToTable("ConversationItems"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.Exper", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID")); + + b.Property("Available") + .HasColumnType("bit"); + + b.Property("Cdatetime") + .HasColumnType("datetime2"); + + b.Property("CompanyID") + .HasColumnType("int"); + + b.Property("FullName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Password") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("UserName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("ID"); + + b.HasIndex("CompanyID"); + + b.ToTable("Expers"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.ExperGroup", b => + { + b.Property("ExperID") + .HasColumnType("int"); + + b.Property("GroupID") + .HasColumnType("int"); + + b.Property("Cdatetime") + .HasColumnType("datetime2"); + + b.HasKey("ExperID", "GroupID"); + + b.HasIndex("GroupID"); + + b.ToTable("EG"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.Group", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID")); + + b.Property("Available") + .HasColumnType("bit"); + + b.Property("Cdatetime") + .HasColumnType("datetime2"); + + b.Property("CompanyID") + .HasColumnType("int"); + + b.Property("Info") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("img") + .HasColumnType("varbinary(max)"); + + b.HasKey("ID"); + + b.HasIndex("CompanyID"); + + b.ToTable("Groups"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.User", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID")); + + b.Property("Cdatetime") + .HasColumnType("datetime2"); + + b.Property("FullName") + .HasColumnType("nvarchar(max)"); + + b.Property("Mobile") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("ID"); + + b.ToTable("Users"); + }); + + modelBuilder.Entity("Identity.Models.VerificationCode", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID")); + + b.Property("Cdatetime") + .HasColumnType("datetime2"); + + b.Property("Code") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Mobile") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("ID"); + + b.ToTable("verificationCodes"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.CompanyContentInfo", b => + { + b.HasOne("Hushian.Domain.Entites.Company", "company") + .WithMany("CompanyContentInfos") + .HasForeignKey("CompanyID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("company"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.Conversation", b => + { + b.HasOne("Hushian.Domain.Entites.Company", "Company") + .WithMany("Conversations") + .HasForeignKey("CompanyID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Hushian.Domain.Entites.Group", "Group") + .WithMany() + .HasForeignKey("GroupID"); + + b.HasOne("Hushian.Domain.Entites.User", "User") + .WithMany("Conversations") + .HasForeignKey("UserID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Company"); + + b.Navigation("Group"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.ConversationResponse", b => + { + b.HasOne("Hushian.Domain.Entites.Conversation", "conversation") + .WithMany("ConversationResponses") + .HasForeignKey("ConversationID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Hushian.Domain.Entites.Exper", "Exper") + .WithMany() + .HasForeignKey("ExperID"); + + b.Navigation("Exper"); + + b.Navigation("conversation"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.Exper", b => + { + b.HasOne("Hushian.Domain.Entites.Company", "Company") + .WithMany("Expers") + .HasForeignKey("CompanyID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Company"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.ExperGroup", b => + { + b.HasOne("Hushian.Domain.Entites.Exper", "Exper") + .WithMany("EG") + .HasForeignKey("ExperID") + .OnDelete(DeleteBehavior.ClientCascade) + .IsRequired(); + + b.HasOne("Hushian.Domain.Entites.Group", "Group") + .WithMany("EG") + .HasForeignKey("GroupID") + .OnDelete(DeleteBehavior.ClientCascade) + .IsRequired(); + + b.Navigation("Exper"); + + b.Navigation("Group"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.Group", b => + { + b.HasOne("Hushian.Domain.Entites.Company", "Company") + .WithMany("Groups") + .HasForeignKey("CompanyID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Company"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.Company", b => + { + b.Navigation("CompanyContentInfos"); + + b.Navigation("Conversations"); + + b.Navigation("Expers"); + + b.Navigation("Groups"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.Conversation", b => + { + b.Navigation("ConversationResponses"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.Exper", b => + { + b.Navigation("EG"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.Group", b => + { + b.Navigation("EG"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.User", b => + { + b.Navigation("Conversations"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Infrastructure/Persistence/Migrations/20250724183709_tbverification.cs b/Infrastructure/Persistence/Migrations/20250724183709_tbverification.cs new file mode 100644 index 0000000..21de189 --- /dev/null +++ b/Infrastructure/Persistence/Migrations/20250724183709_tbverification.cs @@ -0,0 +1,38 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Hushian.Persistence.Migrations +{ + /// + public partial class tbverification : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "verificationCodes", + columns: table => new + { + ID = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Type = table.Column(type: "int", nullable: false), + Code = table.Column(type: "nvarchar(max)", nullable: false), + Mobile = table.Column(type: "nvarchar(max)", nullable: false), + Cdatetime = table.Column(type: "datetime2", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_verificationCodes", x => x.ID); + }); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "verificationCodes"); + } + } +} diff --git a/Infrastructure/Persistence/Migrations/HushianDbContextModelSnapshot.cs b/Infrastructure/Persistence/Migrations/HushianDbContextModelSnapshot.cs new file mode 100644 index 0000000..31c5447 --- /dev/null +++ b/Infrastructure/Persistence/Migrations/HushianDbContextModelSnapshot.cs @@ -0,0 +1,449 @@ +// +using System; +using Hushian.Persistence; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Hushian.Persistence.Migrations +{ + [DbContext(typeof(HushianDbContext))] + partial class HushianDbContextModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "9.0.7") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("Hushian.Domain.Entites.Company", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID")); + + b.Property("Available") + .HasColumnType("bit"); + + b.Property("Cdatetime") + .HasColumnType("datetime2"); + + b.Property("Email") + .HasColumnType("nvarchar(max)"); + + b.Property("FullName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("FullNameManager") + .HasColumnType("nvarchar(max)"); + + b.Property("Mobile") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Password") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Verified") + .HasColumnType("bit"); + + b.Property("WebSite") + .HasColumnType("nvarchar(max)"); + + b.Property("allowBot") + .HasColumnType("bit"); + + b.Property("logo") + .HasColumnType("varbinary(max)"); + + b.HasKey("ID"); + + b.ToTable("Companies"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.CompanyContentInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID")); + + b.Property("Cdatetime") + .HasColumnType("datetime2"); + + b.Property("CompanyID") + .HasColumnType("int"); + + b.Property("Content") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("ID"); + + b.HasIndex("CompanyID"); + + b.ToTable("CompanyContentInfo"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.Conversation", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID")); + + b.Property("Cdatetime") + .HasColumnType("datetime2"); + + b.Property("CompanyID") + .HasColumnType("int"); + + b.Property("FinishedDateTime") + .HasColumnType("datetime2"); + + b.Property("GroupID") + .HasColumnType("int"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("UserID") + .HasColumnType("int"); + + b.HasKey("ID"); + + b.HasIndex("CompanyID"); + + b.HasIndex("GroupID"); + + b.HasIndex("UserID"); + + b.ToTable("Conversations"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.ConversationResponse", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID")); + + b.Property("Cdatetime") + .HasColumnType("datetime2"); + + b.Property("ConversationID") + .HasColumnType("int"); + + b.Property("ExperID") + .HasColumnType("int"); + + b.Property("FileContent") + .HasColumnType("varbinary(max)"); + + b.Property("FileName") + .HasColumnType("nvarchar(max)"); + + b.Property("FileType") + .HasColumnType("nvarchar(max)"); + + b.Property("IsRead") + .HasColumnType("bit"); + + b.Property("ReadDateTime") + .HasColumnType("datetime2"); + + b.Property("Text") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("ID"); + + b.HasIndex("ConversationID"); + + b.HasIndex("ExperID"); + + b.ToTable("ConversationItems"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.Exper", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID")); + + b.Property("Available") + .HasColumnType("bit"); + + b.Property("Cdatetime") + .HasColumnType("datetime2"); + + b.Property("CompanyID") + .HasColumnType("int"); + + b.Property("FullName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Password") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("UserName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("ID"); + + b.HasIndex("CompanyID"); + + b.ToTable("Expers"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.ExperGroup", b => + { + b.Property("ExperID") + .HasColumnType("int"); + + b.Property("GroupID") + .HasColumnType("int"); + + b.Property("Cdatetime") + .HasColumnType("datetime2"); + + b.HasKey("ExperID", "GroupID"); + + b.HasIndex("GroupID"); + + b.ToTable("EG"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.Group", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID")); + + b.Property("Available") + .HasColumnType("bit"); + + b.Property("Cdatetime") + .HasColumnType("datetime2"); + + b.Property("CompanyID") + .HasColumnType("int"); + + b.Property("Info") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("img") + .HasColumnType("varbinary(max)"); + + b.HasKey("ID"); + + b.HasIndex("CompanyID"); + + b.ToTable("Groups"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.User", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID")); + + b.Property("Cdatetime") + .HasColumnType("datetime2"); + + b.Property("FullName") + .HasColumnType("nvarchar(max)"); + + b.Property("Mobile") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("ID"); + + b.ToTable("Users"); + }); + + modelBuilder.Entity("Identity.Models.VerificationCode", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID")); + + b.Property("Cdatetime") + .HasColumnType("datetime2"); + + b.Property("Code") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Mobile") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("ID"); + + b.ToTable("verificationCodes"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.CompanyContentInfo", b => + { + b.HasOne("Hushian.Domain.Entites.Company", "company") + .WithMany("CompanyContentInfos") + .HasForeignKey("CompanyID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("company"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.Conversation", b => + { + b.HasOne("Hushian.Domain.Entites.Company", "Company") + .WithMany("Conversations") + .HasForeignKey("CompanyID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Hushian.Domain.Entites.Group", "Group") + .WithMany() + .HasForeignKey("GroupID"); + + b.HasOne("Hushian.Domain.Entites.User", "User") + .WithMany("Conversations") + .HasForeignKey("UserID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Company"); + + b.Navigation("Group"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.ConversationResponse", b => + { + b.HasOne("Hushian.Domain.Entites.Conversation", "conversation") + .WithMany("ConversationResponses") + .HasForeignKey("ConversationID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Hushian.Domain.Entites.Exper", "Exper") + .WithMany() + .HasForeignKey("ExperID"); + + b.Navigation("Exper"); + + b.Navigation("conversation"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.Exper", b => + { + b.HasOne("Hushian.Domain.Entites.Company", "Company") + .WithMany("Expers") + .HasForeignKey("CompanyID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Company"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.ExperGroup", b => + { + b.HasOne("Hushian.Domain.Entites.Exper", "Exper") + .WithMany("EG") + .HasForeignKey("ExperID") + .OnDelete(DeleteBehavior.ClientCascade) + .IsRequired(); + + b.HasOne("Hushian.Domain.Entites.Group", "Group") + .WithMany("EG") + .HasForeignKey("GroupID") + .OnDelete(DeleteBehavior.ClientCascade) + .IsRequired(); + + b.Navigation("Exper"); + + b.Navigation("Group"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.Group", b => + { + b.HasOne("Hushian.Domain.Entites.Company", "Company") + .WithMany("Groups") + .HasForeignKey("CompanyID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Company"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.Company", b => + { + b.Navigation("CompanyContentInfos"); + + b.Navigation("Conversations"); + + b.Navigation("Expers"); + + b.Navigation("Groups"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.Conversation", b => + { + b.Navigation("ConversationResponses"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.Exper", b => + { + b.Navigation("EG"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.Group", b => + { + b.Navigation("EG"); + }); + + modelBuilder.Entity("Hushian.Domain.Entites.User", b => + { + b.Navigation("Conversations"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Presentation/Hushian.WebApi/Program.cs b/Presentation/Hushian.WebApi/Program.cs index 1eb405b..f468dde 100644 --- a/Presentation/Hushian.WebApi/Program.cs +++ b/Presentation/Hushian.WebApi/Program.cs @@ -1,4 +1,5 @@ using Hushian.Application; +using Hushian.Infrastructure; using Hushian.Persistence; using Hushian.WebApi; @@ -12,7 +13,10 @@ builder.Services.AddOpenApi(); builder.Services.ConfigureApplicationServices(builder.Configuration); builder.Services.ConfigurePersistenceServices(builder.Configuration); +builder.Services.ConfigureInfrastractureServices(builder.Configuration); builder.Services.AddSignalR(); + + var app = builder.Build(); // Configure the HTTP request pipeline. @@ -21,7 +25,6 @@ if (app.Environment.IsDevelopment()) app.MapOpenApi(); } - app.MapHub("/chatNotificationHub"); app.UseHttpsRedirection(); diff --git a/Presentation/HushianWebApp/Components/Verification.razor b/Presentation/HushianWebApp/Components/Verification.razor index 2cb0988..c570484 100644 --- a/Presentation/HushianWebApp/Components/Verification.razor +++ b/Presentation/HushianWebApp/Components/Verification.razor @@ -6,19 +6,33 @@ @inject NavigationManager navigation;
- Hushian - - @Title + @Title
-

@if (type == VerificationCodeType.ForgetPassword) { -
- +
+ -
+ -
+ + + +
+ +
@@ -28,10 +42,28 @@ } else { -
- +
+ + + + + + + + -
} @@ -59,6 +91,10 @@ else bool loading = false; string resendmsg = "ارسال مجدد"; bool Disabledresendmsg = false; + //----------------- + private string code1, code2, code3, code4; + + private ElementReference input1, input2, input3, input4; } @functions { protected override async Task OnParametersSetAsync() @@ -125,5 +161,35 @@ else } loading = false; } + private async Task MoveNext(ChangeEventArgs e) + { + if (e.Value?.ToString()?.Length == 1) + { + if (input1.Context == null) return; + + if (string.IsNullOrEmpty(code1)) + await input2.FocusAsync(); + else if (string.IsNullOrEmpty(code2)) + await input3.FocusAsync(); + else if (string.IsNullOrEmpty(code3)) + await input4.FocusAsync(); + else if (string.IsNullOrEmpty(code4)) + { + code = $"{code1}{code2}{code3}{code4}"; + } + } + } + private async Task OnLastInput(ChangeEventArgs e) + { + code4 = e.Value?.ToString(); + + if (!string.IsNullOrEmpty(code4) && code4.Length == 1) + { + code = $"{code1}{code2}{code3}{code4}"; + if(type==VerificationCodeType.PhoneNumberConfirmed) + await onClick(); + } + } + } diff --git a/Presentation/HushianWebApp/Pages/Auth/ForgetPassword.razor b/Presentation/HushianWebApp/Pages/Auth/ForgetPassword.razor index aef1638..cb7931c 100644 --- a/Presentation/HushianWebApp/Pages/Auth/ForgetPassword.razor +++ b/Presentation/HushianWebApp/Pages/Auth/ForgetPassword.razor @@ -91,7 +91,7 @@ parameters.Add("sendValue", Username); parameters.Add("ID", 0); parameters.Add("OnMultipleOfThree", EventCallback.Factory.Create(this, CallBackVer)); - parameters.Add("Title", "بازیابی کلمه عبور"); + parameters.Add("Title", "بازیابی کلمه عبور" + '\n' + "برای تکمیل کد پبامک شده را وارد کنید"); await modal.ShowAsync(title: "احراز", parameters: parameters); } async Task CallBackVer(VerificationCodeType type) diff --git a/Presentation/HushianWebApp/Pages/Auth/Register.razor b/Presentation/HushianWebApp/Pages/Auth/Register.razor index db3f925..df28708 100644 --- a/Presentation/HushianWebApp/Pages/Auth/Register.razor +++ b/Presentation/HushianWebApp/Pages/Auth/Register.razor @@ -23,7 +23,7 @@ کاربر گرامی، لطفاً توجه فرمایید که شماره‌همراه واردشده به نام خودتان باشد .
-
+
*@
- +
@@ -120,6 +120,7 @@ } async Task onClick() { + //-----------validate if (string.IsNullOrEmpty(FullName)) { @@ -167,7 +168,7 @@ parameters.Add("type", VerificationCodeType.PhoneNumberConfirmed); parameters.Add("sendValue", PhoneNumber); parameters.Add("ID", ID); - parameters.Add("Title", "ثبت نام با موفقیت انجام شد برای استفاده کاربری را احرار کنید"); + parameters.Add("Title", "ثبت نام با موفقیت انجام شد" +'\n'+ "برای تکمیل کد پبامک شده را وارد کنید"); parameters.Add("OnMultipleOfThree", EventCallback.Factory.Create(this, CallBackVer)); await modal.ShowAsync(title: "احراز", parameters: parameters); } diff --git a/Presentation/HushianWebApp/Program.cs b/Presentation/HushianWebApp/Program.cs index b441412..270687f 100644 --- a/Presentation/HushianWebApp/Program.cs +++ b/Presentation/HushianWebApp/Program.cs @@ -8,7 +8,7 @@ var builder = WebAssemblyHostBuilder.CreateDefault(args); builder.RootComponents.Add("#app"); builder.RootComponents.Add("head::after"); -builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("http://localhost:5137/api/") }); +builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("http://localhost:5089/api/") }); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped();