diff --git a/.version b/.version new file mode 100644 index 0000000..726017f --- /dev/null +++ b/.version @@ -0,0 +1 @@ +0.1.0.0 \ No newline at end of file diff --git a/Berizco.Api/AppSettings/appsettings.Development.json b/Berizco.Api/AppSettings/appsettings.Development.json index 873928d..9a2d1d3 100644 --- a/Berizco.Api/AppSettings/appsettings.Development.json +++ b/Berizco.Api/AppSettings/appsettings.Development.json @@ -13,7 +13,7 @@ } }, "SiteSettings": { - "BaseUrl": "http://localhost:32769", + "BaseUrl": "http://192.168.88.12:32769", "UserSetting": { "Username": "root", "Email": "info@brizco.io", diff --git a/Berizco.Api/Brizco.Api.csproj b/Berizco.Api/Brizco.Api.csproj index cb6fddc..8082e41 100644 --- a/Berizco.Api/Brizco.Api.csproj +++ b/Berizco.Api/Brizco.Api.csproj @@ -6,6 +6,8 @@ enable Linux ..\docker-compose.dcproj + 0.1.0.0 + 0.1.0.0 diff --git a/Berizco.Api/Controllers/RoleController.cs b/Berizco.Api/Controllers/RoleController.cs index 73d7744..c2b38bf 100644 --- a/Berizco.Api/Controllers/RoleController.cs +++ b/Berizco.Api/Controllers/RoleController.cs @@ -1,4 +1,6 @@ -namespace Brizco.Api.Controllers; +using Brizco.Core.EntityServices; + +namespace Brizco.Api.Controllers; public class RoleController : ICarterModule { @@ -11,6 +13,10 @@ public class RoleController : ICarterModule .MapGroup($"api/role") .RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser()); + group.MapGet("/permission", GetPermissions) + .WithDisplayName("Permissions") + .HasApiVersion(1.0); + group.MapGet("", GetAllAsync) .WithDisplayName("GetAllRoles") .HasApiVersion(1.0); @@ -48,4 +54,7 @@ public class RoleController : ICarterModule // DELETE:Delete Entity public async Task Delete(Guid id, IUserService userService, CancellationToken cancellationToken) => TypedResults.Ok(await userService.RemoveRoleAsync(id)); + + public IResult GetPermissions(IUserService userService) + => TypedResults.Ok(userService.GetPermissions()); } \ No newline at end of file diff --git a/Berizco.Repository/Handlers/Complex/CreateComplexUserCommandHandler.cs b/Berizco.Repository/Handlers/Complex/CreateComplexUserCommandHandler.cs index 2434856..2181e89 100644 --- a/Berizco.Repository/Handlers/Complex/CreateComplexUserCommandHandler.cs +++ b/Berizco.Repository/Handlers/Complex/CreateComplexUserCommandHandler.cs @@ -26,7 +26,7 @@ public class CreateComplexUserCommandHandler : IRequestHandler().TableNoTracking .FirstOrDefaultAsync(c => c.Id == request.ComplexId, cancellationToken); if (complex == null) @@ -53,7 +53,7 @@ public class CreateComplexUserCommandHandler : IRequestHandler().Add(complexUser); await _repositoryWrapper.SaveChangesAsync(cancellationToken); - await _repositoryWrapper.CommitAsync(cancellationToken); + //await _repositoryWrapper.CommitAsync(cancellationToken); return complexUser.AdaptToSDto(); } catch (Exception) diff --git a/Berizco.Repository/Migrations/20231015082502_editTask.Designer.cs b/Berizco.Repository/Migrations/20231015082502_editTask.Designer.cs new file mode 100644 index 0000000..fd170be --- /dev/null +++ b/Berizco.Repository/Migrations/20231015082502_editTask.Designer.cs @@ -0,0 +1,1138 @@ +// +using System; +using Brizco.Repository.Models; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace Brizco.Repository.Migrations +{ + [DbContext(typeof(ApplicationContext))] + [Migration("20231015082502_editTask")] + partial class editTask + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("public") + .HasAnnotation("ProductVersion", "7.0.11") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("Brizco.Domain.Entities.Complex.Complex", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Address") + .IsRequired() + .HasColumnType("text"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("SupportPhone") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Complexes", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Complex.ComplexUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ComplexId") + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("ComplexId"); + + b.HasIndex("UserId"); + + b.ToTable("ComplexUsers", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Complex.ComplexUserRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ComplexUserId") + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("RoleId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("ComplexUserId"); + + b.HasIndex("RoleId"); + + b.ToTable("ComplexUserRoles", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Shift.Shift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ComplexId") + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("EndAt") + .HasColumnType("interval"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("StartAt") + .HasColumnType("interval"); + + b.Property("Title") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ComplexId"); + + b.ToTable("Shifts", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftDay", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("DayOfWeek") + .HasColumnType("integer"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("ShiftId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("ShiftId"); + + b.ToTable("ShiftDays", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlan", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("EndAt") + .HasColumnType("timestamp without time zone"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("ShiftId") + .HasColumnType("uuid"); + + b.Property("StartAt") + .HasColumnType("timestamp without time zone"); + + b.HasKey("Id"); + + b.HasIndex("ShiftId"); + + b.ToTable("ShiftPlans", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlanUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ApplicationUserId") + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("ShiftPlanId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationUserId"); + + b.HasIndex("ShiftPlanId"); + + b.ToTable("ShiftPlanUsers", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Task.Task", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Amount") + .HasColumnType("integer"); + + b.Property("AmountType") + .HasColumnType("integer"); + + b.Property("ComplexId") + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("Discriminator") + .IsRequired() + .HasColumnType("text"); + + b.Property("HasDisposed") + .HasColumnType("boolean"); + + b.Property("IsDisposable") + .HasColumnType("boolean"); + + b.Property("IsRelatedToPerson") + .HasColumnType("boolean"); + + b.Property("IsRelatedToRole") + .HasColumnType("boolean"); + + b.Property("IsRelatedToShift") + .HasColumnType("boolean"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("SetFor") + .HasColumnType("timestamp without time zone"); + + b.Property("Title") + .IsRequired() + .HasColumnType("text"); + + b.Property("Type") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("ComplexId"); + + b.ToTable("Tasks", "public"); + + b.HasDiscriminator("Discriminator").HasValue("Task"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskDay", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("DayOfWeek") + .HasColumnType("integer"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("TaskId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("TaskId"); + + b.ToTable("TaskDays", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("RoleId") + .HasColumnType("uuid"); + + b.Property("TaskId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.HasIndex("TaskId"); + + b.ToTable("TaskRoles", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskShift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("ShiftId") + .HasColumnType("uuid"); + + b.Property("TaskId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("ShiftId"); + + b.HasIndex("TaskId"); + + b.ToTable("TaskShifts", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("TaskId") + .HasColumnType("uuid"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("TaskId"); + + b.HasIndex("UserId"); + + b.ToTable("TaskUsers", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.User.ApplicationRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ComplexId") + .HasColumnType("uuid"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("text"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("EnglishName") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("PersianName") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ComplexId"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("Roles", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.User.ApplicationUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AccessFailedCount") + .HasColumnType("integer"); + + b.Property("BirthDate") + .HasColumnType("timestamp without time zone"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("text"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("boolean"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("text"); + + b.Property("Gender") + .HasColumnType("integer"); + + b.Property("InternationalId") + .IsRequired() + .HasColumnType("text"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("text"); + + b.Property("LockoutEnabled") + .HasColumnType("boolean"); + + b.Property("LockoutEnd") + .HasColumnType("timestamp with time zone"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("PasswordHash") + .HasColumnType("text"); + + b.Property("PhoneNumber") + .HasColumnType("text"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("boolean"); + + b.Property("SecurityStamp") + .HasColumnType("text"); + + b.Property("SignUpStatus") + .HasColumnType("integer"); + + b.Property("TwoFactorEnabled") + .HasColumnType("boolean"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("Users", "public"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("text"); + + b.Property("ClaimValue") + .HasColumnType("text"); + + b.Property("RoleId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("RoleClaims", "public"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("text"); + + b.Property("ClaimValue") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Claims", "public"); + }); + + 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("uuid"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("Logins", "public"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("uuid"); + + b.Property("RoleId") + .HasColumnType("uuid"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("UserRoles", "public"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("uuid"); + + b.Property("LoginProvider") + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("Value") + .HasColumnType("text"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("Tokens", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Task.Activity", b => + { + b.HasBaseType("Brizco.Domain.Entities.Task.Task"); + + b.Property("DoneAt") + .HasColumnType("timestamp without time zone"); + + b.Property("IsDone") + .HasColumnType("boolean"); + + b.Property("PerformanceDescription") + .IsRequired() + .HasColumnType("text"); + + b.Property("Status") + .HasColumnType("integer"); + + b.HasDiscriminator().HasValue("Activity"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Complex.ComplexUser", b => + { + b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex") + .WithMany("Users") + .HasForeignKey("ComplexId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Complex"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Complex.ComplexUserRole", b => + { + b.HasOne("Brizco.Domain.Entities.Complex.ComplexUser", "ComplexUser") + .WithMany("Roles") + .HasForeignKey("ComplexUserId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Brizco.Domain.Entities.User.ApplicationRole", "Role") + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("ComplexUser"); + + b.Navigation("Role"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Shift.Shift", b => + { + b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex") + .WithMany("Shifts") + .HasForeignKey("ComplexId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Complex"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftDay", b => + { + b.HasOne("Brizco.Domain.Entities.Shift.Shift", "Shift") + .WithMany("Days") + .HasForeignKey("ShiftId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Shift"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlan", b => + { + b.HasOne("Brizco.Domain.Entities.Shift.Shift", "Shift") + .WithMany("Plans") + .HasForeignKey("ShiftId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Shift"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlanUser", b => + { + b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", "ApplicationUser") + .WithMany() + .HasForeignKey("ApplicationUserId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Brizco.Domain.Entities.Shift.ShiftPlan", "ShiftPlan") + .WithMany("Users") + .HasForeignKey("ShiftPlanId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("ApplicationUser"); + + b.Navigation("ShiftPlan"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Task.Task", b => + { + b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex") + .WithMany("Tasks") + .HasForeignKey("ComplexId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Complex"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskDay", b => + { + b.HasOne("Brizco.Domain.Entities.Task.Task", "Task") + .WithMany("Days") + .HasForeignKey("TaskId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Task"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskRole", b => + { + b.HasOne("Brizco.Domain.Entities.User.ApplicationRole", "Role") + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Brizco.Domain.Entities.Task.Task", "Task") + .WithMany("Roles") + .HasForeignKey("TaskId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Role"); + + b.Navigation("Task"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskShift", b => + { + b.HasOne("Brizco.Domain.Entities.Shift.Shift", "Shift") + .WithMany() + .HasForeignKey("ShiftId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Brizco.Domain.Entities.Task.Task", "Task") + .WithMany("Shifts") + .HasForeignKey("TaskId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Shift"); + + b.Navigation("Task"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskUser", b => + { + b.HasOne("Brizco.Domain.Entities.Task.Task", "Task") + .WithMany("Users") + .HasForeignKey("TaskId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Task"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.User.ApplicationRole", b => + { + b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex") + .WithMany("Roles") + .HasForeignKey("ComplexId"); + + b.Navigation("Complex"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Brizco.Domain.Entities.User.ApplicationRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Brizco.Domain.Entities.User.ApplicationRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Complex.Complex", b => + { + b.Navigation("Roles"); + + b.Navigation("Shifts"); + + b.Navigation("Tasks"); + + b.Navigation("Users"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Complex.ComplexUser", b => + { + b.Navigation("Roles"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Shift.Shift", b => + { + b.Navigation("Days"); + + b.Navigation("Plans"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlan", b => + { + b.Navigation("Users"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Task.Task", b => + { + b.Navigation("Days"); + + b.Navigation("Roles"); + + b.Navigation("Shifts"); + + b.Navigation("Users"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Berizco.Repository/Migrations/20231015082502_editTask.cs b/Berizco.Repository/Migrations/20231015082502_editTask.cs new file mode 100644 index 0000000..f2d6da4 --- /dev/null +++ b/Berizco.Repository/Migrations/20231015082502_editTask.cs @@ -0,0 +1,57 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Brizco.Repository.Migrations +{ + /// + public partial class editTask : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "TaskDays", + schema: "public", + columns: table => new + { + Id = table.Column(type: "uuid", nullable: false), + DayOfWeek = table.Column(type: "integer", nullable: false), + TaskId = table.Column(type: "uuid", nullable: false), + RemovedAt = table.Column(type: "timestamp without time zone", nullable: false), + CreatedAt = table.Column(type: "timestamp without time zone", nullable: false), + CreatedBy = table.Column(type: "text", nullable: false), + IsRemoved = table.Column(type: "boolean", nullable: false), + RemovedBy = table.Column(type: "text", nullable: false), + ModifiedAt = table.Column(type: "timestamp without time zone", nullable: false), + ModifiedBy = table.Column(type: "text", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_TaskDays", x => x.Id); + table.ForeignKey( + name: "FK_TaskDays_Tasks_TaskId", + column: x => x.TaskId, + principalSchema: "public", + principalTable: "Tasks", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateIndex( + name: "IX_TaskDays_TaskId", + schema: "public", + table: "TaskDays", + column: "TaskId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "TaskDays", + schema: "public"); + } + } +} diff --git a/Berizco.Repository/Migrations/20231018090720_editUserNationalId.Designer.cs b/Berizco.Repository/Migrations/20231018090720_editUserNationalId.Designer.cs new file mode 100644 index 0000000..3622558 --- /dev/null +++ b/Berizco.Repository/Migrations/20231018090720_editUserNationalId.Designer.cs @@ -0,0 +1,1138 @@ +// +using System; +using Brizco.Repository.Models; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace Brizco.Repository.Migrations +{ + [DbContext(typeof(ApplicationContext))] + [Migration("20231018090720_editUserNationalId")] + partial class editUserNationalId + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("public") + .HasAnnotation("ProductVersion", "7.0.11") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("Brizco.Domain.Entities.Complex.Complex", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Address") + .IsRequired() + .HasColumnType("text"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("SupportPhone") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Complexes", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Complex.ComplexUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ComplexId") + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("ComplexId"); + + b.HasIndex("UserId"); + + b.ToTable("ComplexUsers", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Complex.ComplexUserRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ComplexUserId") + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("RoleId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("ComplexUserId"); + + b.HasIndex("RoleId"); + + b.ToTable("ComplexUserRoles", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Shift.Shift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ComplexId") + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("EndAt") + .HasColumnType("interval"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("StartAt") + .HasColumnType("interval"); + + b.Property("Title") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ComplexId"); + + b.ToTable("Shifts", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftDay", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("DayOfWeek") + .HasColumnType("integer"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("ShiftId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("ShiftId"); + + b.ToTable("ShiftDays", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlan", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("EndAt") + .HasColumnType("timestamp without time zone"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("ShiftId") + .HasColumnType("uuid"); + + b.Property("StartAt") + .HasColumnType("timestamp without time zone"); + + b.HasKey("Id"); + + b.HasIndex("ShiftId"); + + b.ToTable("ShiftPlans", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlanUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ApplicationUserId") + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("ShiftPlanId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationUserId"); + + b.HasIndex("ShiftPlanId"); + + b.ToTable("ShiftPlanUsers", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Task.Task", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Amount") + .HasColumnType("integer"); + + b.Property("AmountType") + .HasColumnType("integer"); + + b.Property("ComplexId") + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("Discriminator") + .IsRequired() + .HasColumnType("text"); + + b.Property("HasDisposed") + .HasColumnType("boolean"); + + b.Property("IsDisposable") + .HasColumnType("boolean"); + + b.Property("IsRelatedToPerson") + .HasColumnType("boolean"); + + b.Property("IsRelatedToRole") + .HasColumnType("boolean"); + + b.Property("IsRelatedToShift") + .HasColumnType("boolean"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("SetFor") + .HasColumnType("timestamp without time zone"); + + b.Property("Title") + .IsRequired() + .HasColumnType("text"); + + b.Property("Type") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("ComplexId"); + + b.ToTable("Tasks", "public"); + + b.HasDiscriminator("Discriminator").HasValue("Task"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskDay", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("DayOfWeek") + .HasColumnType("integer"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("TaskId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("TaskId"); + + b.ToTable("TaskDays", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("RoleId") + .HasColumnType("uuid"); + + b.Property("TaskId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.HasIndex("TaskId"); + + b.ToTable("TaskRoles", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskShift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("ShiftId") + .HasColumnType("uuid"); + + b.Property("TaskId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("ShiftId"); + + b.HasIndex("TaskId"); + + b.ToTable("TaskShifts", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("TaskId") + .HasColumnType("uuid"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("TaskId"); + + b.HasIndex("UserId"); + + b.ToTable("TaskUsers", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.User.ApplicationRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ComplexId") + .HasColumnType("uuid"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("text"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("EnglishName") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("PersianName") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ComplexId"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("Roles", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.User.ApplicationUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AccessFailedCount") + .HasColumnType("integer"); + + b.Property("BirthDate") + .HasColumnType("timestamp without time zone"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("text"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("boolean"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("text"); + + b.Property("Gender") + .HasColumnType("integer"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("text"); + + b.Property("LockoutEnabled") + .HasColumnType("boolean"); + + b.Property("LockoutEnd") + .HasColumnType("timestamp with time zone"); + + b.Property("NationalId") + .IsRequired() + .HasColumnType("text"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("PasswordHash") + .HasColumnType("text"); + + b.Property("PhoneNumber") + .HasColumnType("text"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("boolean"); + + b.Property("SecurityStamp") + .HasColumnType("text"); + + b.Property("SignUpStatus") + .HasColumnType("integer"); + + b.Property("TwoFactorEnabled") + .HasColumnType("boolean"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("Users", "public"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("text"); + + b.Property("ClaimValue") + .HasColumnType("text"); + + b.Property("RoleId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("RoleClaims", "public"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("text"); + + b.Property("ClaimValue") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Claims", "public"); + }); + + 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("uuid"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("Logins", "public"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("uuid"); + + b.Property("RoleId") + .HasColumnType("uuid"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("UserRoles", "public"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("uuid"); + + b.Property("LoginProvider") + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("Value") + .HasColumnType("text"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("Tokens", "public"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Task.Activity", b => + { + b.HasBaseType("Brizco.Domain.Entities.Task.Task"); + + b.Property("DoneAt") + .HasColumnType("timestamp without time zone"); + + b.Property("IsDone") + .HasColumnType("boolean"); + + b.Property("PerformanceDescription") + .IsRequired() + .HasColumnType("text"); + + b.Property("Status") + .HasColumnType("integer"); + + b.HasDiscriminator().HasValue("Activity"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Complex.ComplexUser", b => + { + b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex") + .WithMany("Users") + .HasForeignKey("ComplexId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Complex"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Complex.ComplexUserRole", b => + { + b.HasOne("Brizco.Domain.Entities.Complex.ComplexUser", "ComplexUser") + .WithMany("Roles") + .HasForeignKey("ComplexUserId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Brizco.Domain.Entities.User.ApplicationRole", "Role") + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("ComplexUser"); + + b.Navigation("Role"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Shift.Shift", b => + { + b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex") + .WithMany("Shifts") + .HasForeignKey("ComplexId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Complex"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftDay", b => + { + b.HasOne("Brizco.Domain.Entities.Shift.Shift", "Shift") + .WithMany("Days") + .HasForeignKey("ShiftId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Shift"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlan", b => + { + b.HasOne("Brizco.Domain.Entities.Shift.Shift", "Shift") + .WithMany("Plans") + .HasForeignKey("ShiftId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Shift"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlanUser", b => + { + b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", "ApplicationUser") + .WithMany() + .HasForeignKey("ApplicationUserId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Brizco.Domain.Entities.Shift.ShiftPlan", "ShiftPlan") + .WithMany("Users") + .HasForeignKey("ShiftPlanId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("ApplicationUser"); + + b.Navigation("ShiftPlan"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Task.Task", b => + { + b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex") + .WithMany("Tasks") + .HasForeignKey("ComplexId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Complex"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskDay", b => + { + b.HasOne("Brizco.Domain.Entities.Task.Task", "Task") + .WithMany("Days") + .HasForeignKey("TaskId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Task"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskRole", b => + { + b.HasOne("Brizco.Domain.Entities.User.ApplicationRole", "Role") + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Brizco.Domain.Entities.Task.Task", "Task") + .WithMany("Roles") + .HasForeignKey("TaskId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Role"); + + b.Navigation("Task"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskShift", b => + { + b.HasOne("Brizco.Domain.Entities.Shift.Shift", "Shift") + .WithMany() + .HasForeignKey("ShiftId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Brizco.Domain.Entities.Task.Task", "Task") + .WithMany("Shifts") + .HasForeignKey("TaskId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Shift"); + + b.Navigation("Task"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskUser", b => + { + b.HasOne("Brizco.Domain.Entities.Task.Task", "Task") + .WithMany("Users") + .HasForeignKey("TaskId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Task"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.User.ApplicationRole", b => + { + b.HasOne("Brizco.Domain.Entities.Complex.Complex", "Complex") + .WithMany("Roles") + .HasForeignKey("ComplexId"); + + b.Navigation("Complex"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Brizco.Domain.Entities.User.ApplicationRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Brizco.Domain.Entities.User.ApplicationRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Complex.Complex", b => + { + b.Navigation("Roles"); + + b.Navigation("Shifts"); + + b.Navigation("Tasks"); + + b.Navigation("Users"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Complex.ComplexUser", b => + { + b.Navigation("Roles"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Shift.Shift", b => + { + b.Navigation("Days"); + + b.Navigation("Plans"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Shift.ShiftPlan", b => + { + b.Navigation("Users"); + }); + + modelBuilder.Entity("Brizco.Domain.Entities.Task.Task", b => + { + b.Navigation("Days"); + + b.Navigation("Roles"); + + b.Navigation("Shifts"); + + b.Navigation("Users"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Berizco.Repository/Migrations/20231018090720_editUserNationalId.cs b/Berizco.Repository/Migrations/20231018090720_editUserNationalId.cs new file mode 100644 index 0000000..860f6ba --- /dev/null +++ b/Berizco.Repository/Migrations/20231018090720_editUserNationalId.cs @@ -0,0 +1,30 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Brizco.Repository.Migrations +{ + /// + public partial class editUserNationalId : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.RenameColumn( + name: "InternationalId", + schema: "public", + table: "Users", + newName: "NationalId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.RenameColumn( + name: "NationalId", + schema: "public", + table: "Users", + newName: "InternationalId"); + } + } +} diff --git a/Berizco.Repository/Migrations/ApplicationContextModelSnapshot.cs b/Berizco.Repository/Migrations/ApplicationContextModelSnapshot.cs index 060d09c..bccedd3 100644 --- a/Berizco.Repository/Migrations/ApplicationContextModelSnapshot.cs +++ b/Berizco.Repository/Migrations/ApplicationContextModelSnapshot.cs @@ -431,6 +431,49 @@ namespace Brizco.Repository.Migrations b.UseTphMappingStrategy(); }); + modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskDay", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("DayOfWeek") + .HasColumnType("integer"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("TaskId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("TaskId"); + + b.ToTable("TaskDays", "public"); + }); + modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskRole", b => { b.Property("Id") @@ -640,10 +683,6 @@ namespace Brizco.Repository.Migrations b.Property("Gender") .HasColumnType("integer"); - b.Property("InternationalId") - .IsRequired() - .HasColumnType("text"); - b.Property("LastName") .IsRequired() .HasColumnType("text"); @@ -654,6 +693,10 @@ namespace Brizco.Repository.Migrations b.Property("LockoutEnd") .HasColumnType("timestamp with time zone"); + b.Property("NationalId") + .IsRequired() + .HasColumnType("text"); + b.Property("NormalizedEmail") .HasMaxLength(256) .HasColumnType("character varying(256)"); @@ -920,6 +963,17 @@ namespace Brizco.Repository.Migrations b.Navigation("Complex"); }); + modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskDay", b => + { + b.HasOne("Brizco.Domain.Entities.Task.Task", "Task") + .WithMany("Days") + .HasForeignKey("TaskId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Task"); + }); + modelBuilder.Entity("Brizco.Domain.Entities.Task.TaskRole", b => { b.HasOne("Brizco.Domain.Entities.User.ApplicationRole", "Role") @@ -1067,6 +1121,8 @@ namespace Brizco.Repository.Migrations modelBuilder.Entity("Brizco.Domain.Entities.Task.Task", b => { + b.Navigation("Days"); + b.Navigation("Roles"); b.Navigation("Shifts"); diff --git a/Brizco.Common/Models/Claims/ApplicationClaims.cs b/Brizco.Common/Models/Claims/ApplicationClaims.cs index d275794..50ca9c0 100644 --- a/Brizco.Common/Models/Claims/ApplicationClaims.cs +++ b/Brizco.Common/Models/Claims/ApplicationClaims.cs @@ -62,6 +62,19 @@ public static class ApplicationClaims Detail = "دسترسی به افزودن و مدیریت فعالیت ها فروشگاه شما" }; + public static List AllClaimDtos = new List + { + ManageActivities, + ViewTasks, + ManageTasks, + + ManageShiftPlans, + ViewShifts, + ManageShifts, + + ViewComplexes, + ManageComplexes, + }; public static List AllClaims = new List { diff --git a/Brizco.Core/BaseServices/JwtService.cs b/Brizco.Core/BaseServices/JwtService.cs index b8a5339..8608a37 100644 --- a/Brizco.Core/BaseServices/JwtService.cs +++ b/Brizco.Core/BaseServices/JwtService.cs @@ -129,6 +129,7 @@ public class JwtService : IJwtService var claims = new List(); claims.Add(new Claim("JwtID", jwtId)); claims.Add(new Claim(ClaimTypes.Name, baseUser.UserName)); + claims.Add(new Claim("SignUpStatus", ((int)baseUser.SignUpStatus).ToString())); claims.Add(new Claim(ClaimTypes.NameIdentifier, baseUser.Id.ToString())); if (baseUser.Email != null) claims.Add(new Claim(ClaimTypes.Email, baseUser.Email)); @@ -142,6 +143,7 @@ public class JwtService : IJwtService var applicationRole = await _roleManager.FindByIdAsync(roleId); var roleClaims = await _roleManager.GetClaimsAsync(applicationRole); var claims = new List(); + claims.Add(new Claim("SignUpStatus",((int)baseUser.SignUpStatus).ToString())); claims.Add(new Claim(ClaimTypes.Name, baseUser.UserName)); claims.Add(new Claim(ClaimTypes.NameIdentifier, baseUser.Id.ToString())); claims.Add(new Claim(ClaimTypes.Role,applicationRole.EnglishName)); diff --git a/Brizco.Core/Brizco.Core.csproj b/Brizco.Core/Brizco.Core.csproj index 28d732b..a9319c7 100644 --- a/Brizco.Core/Brizco.Core.csproj +++ b/Brizco.Core/Brizco.Core.csproj @@ -35,6 +35,7 @@ + diff --git a/Brizco.Core/CoreServices/Abstracts/IAccountService.cs b/Brizco.Core/CoreServices/Abstracts/IAccountService.cs index e81c9aa..e9164f1 100644 --- a/Brizco.Core/CoreServices/Abstracts/IAccountService.cs +++ b/Brizco.Core/CoreServices/Abstracts/IAccountService.cs @@ -4,7 +4,7 @@ public interface IAccountService : IScopedDependency { public Task> LoginWithPasswordAsync(string userName, string password, CancellationToken cancellationToken); public Task> LoginWithVerifyCodeAsync(string userName, string verifyCode, CancellationToken cancellationToken); - public Task GetVerifyCodeAsync(string phoneNumber); + public Task GetVerifyCodeAsync(string phoneNumber); public Task ForgetPasswordAsync(string phoneNumber); public Task CheckMemberShipAsync(string phoneNumber); public Task> CompleteComplexSignUpAsync(SignUpRequestDto requestDto, CancellationToken cancellationToken); diff --git a/Brizco.Core/CoreServices/AccountService.cs b/Brizco.Core/CoreServices/AccountService.cs index b406152..7803edc 100644 --- a/Brizco.Core/CoreServices/AccountService.cs +++ b/Brizco.Core/CoreServices/AccountService.cs @@ -64,7 +64,7 @@ public class AccountService : IAccountService return true; } - public async Task GetVerifyCodeAsync(string phoneNumber) + public async Task GetVerifyCodeAsync(string phoneNumber) { var newPhoneNumber = StringExtensions.CheckPhoneNumber(phoneNumber); if (!PhoneNumberExtensions.CheckPhoneNumber(newPhoneNumber)) @@ -74,8 +74,8 @@ public class AccountService : IAccountService user = await _userService.CreateUserAsync(phoneNumber); var token = await _userManager.GenerateTwoFactorTokenAsync(user, "Phone"); - await _smsService.SendVerifyCodeAsync(newPhoneNumber, token); - return user.SignUpStatus; + //await _smsService.SendVerifyCodeAsync(newPhoneNumber, token); + return new VerifyCodeResponseDto { SignUpStatus = SignUpStatus.StartSignOn }; } public async Task> LoginWithPasswordAsync(string userName, string password, CancellationToken cancellationToken) @@ -133,12 +133,14 @@ public class AccountService : IAccountService throw new AppException("آدرس مجموعه را وارد کنید"); + + user.FirstName = requestDto.FirstName; user.LastName = requestDto.LastName; user.SignUpStatus = SignUpStatus.ComplexCreated; var result = await _userManager.UpdateAsync(user); if (!result.Succeeded) - throw new AppException(string.Join('|', result.Errors)); + throw new AppException(string.Join('|', result.Errors.Select(e => e.Description))); var complex = await _complexService.CreateComplexAsync(requestDto.ComplexName, requestDto.ComplexAddress, diff --git a/Brizco.Core/EntityServices/Abstracts/IUserService.cs b/Brizco.Core/EntityServices/Abstracts/IUserService.cs index d33dd59..7a2451d 100644 --- a/Brizco.Core/EntityServices/Abstracts/IUserService.cs +++ b/Brizco.Core/EntityServices/Abstracts/IUserService.cs @@ -16,4 +16,5 @@ public interface IUserService : IScopedDependency Task CreateRoleAsync(RoleActionRequestDto request); Task EditRoleAsync(RoleActionRequestDto request); Task RemoveRoleAsync(Guid roleId); + List GetPermissions(); } \ No newline at end of file diff --git a/Brizco.Core/EntityServices/UserService.cs b/Brizco.Core/EntityServices/UserService.cs index e86a493..d8d1ef8 100644 --- a/Brizco.Core/EntityServices/UserService.cs +++ b/Brizco.Core/EntityServices/UserService.cs @@ -44,7 +44,7 @@ public class UserService : IUserService { UserName = phoneNumber, PhoneNumber = phoneNumber, - SignUpStatus = SignUpStatus.StartSignUp + SignUpStatus = SignUpStatus.StartSignOn }; var result = await _userManager.CreateAsync(user); if (!result.Succeeded) @@ -65,7 +65,7 @@ public class UserService : IUserService PhoneNumber = request.PhoneNumber, FirstName = request.FirstName, LastName = request.LastName, - InternationalId = request.InternationalId, + NationalId = request.NationalId, BirthDate = request.BirthDate, Gender = request.Gender, SignUpStatus = SignUpStatus.SignUpCompleted @@ -105,7 +105,7 @@ public class UserService : IUserService user.PhoneNumber = request.PhoneNumber; user.FirstName = request.FirstName; user.LastName = request.LastName; - user.InternationalId = request.InternationalId; + user.NationalId = request.NationalId; user.BirthDate = request.BirthDate; user.Gender = request.Gender; @@ -140,7 +140,7 @@ public class UserService : IUserService user.PhoneNumber = request.PhoneNumber; user.FirstName = request.FirstName; user.LastName = request.LastName; - user.InternationalId = request.InternationalId; + user.NationalId = request.NationalId; user.BirthDate = request.BirthDate; user.Gender = request.Gender; @@ -284,4 +284,8 @@ public class UserService : IUserService return true; } + public List GetPermissions() + { + return ApplicationClaims.AllClaimDtos; + } } \ No newline at end of file diff --git a/Brizco.Domain/Dtos/RequestDtos/UserActionRequestDto.cs b/Brizco.Domain/Dtos/RequestDtos/UserActionRequestDto.cs index 0be160e..7b132fa 100644 --- a/Brizco.Domain/Dtos/RequestDtos/UserActionRequestDto.cs +++ b/Brizco.Domain/Dtos/RequestDtos/UserActionRequestDto.cs @@ -7,7 +7,7 @@ public class UserActionRequestDto public string LastName { get; set; } = string.Empty; public DateTime BirthDate { get; set; } public Gender Gender { get; set; } - public string InternationalId { get; set; } = string.Empty; + public string NationalId { get; set; } = string.Empty; public string Password { get; set; } = string.Empty; public List RoleIds { get; set; } = new(); diff --git a/Brizco.Domain/Dtos/ResponseDto/VerifyCodeResponseDto.cs b/Brizco.Domain/Dtos/ResponseDto/VerifyCodeResponseDto.cs new file mode 100644 index 0000000..2224ea5 --- /dev/null +++ b/Brizco.Domain/Dtos/ResponseDto/VerifyCodeResponseDto.cs @@ -0,0 +1,6 @@ +namespace Brizco.Domain.Dtos.ResponseDto; + +public class VerifyCodeResponseDto +{ + public SignUpStatus SignUpStatus { get; set; } +} \ No newline at end of file diff --git a/Brizco.Domain/Dtos/SmallDtos/ApplicationUserSDto.cs b/Brizco.Domain/Dtos/SmallDtos/ApplicationUserSDto.cs index 0d1283f..682688a 100644 --- a/Brizco.Domain/Dtos/SmallDtos/ApplicationUserSDto.cs +++ b/Brizco.Domain/Dtos/SmallDtos/ApplicationUserSDto.cs @@ -12,5 +12,5 @@ public class ApplicationUserSDto : BaseDto public SignUpStatus SignUpStatus { get; set; } public string SelectedRoleName { get; set; } = string.Empty; public string SelectedComplexName { get; set; } = string.Empty; - public string InternationalId { get; set; } = string.Empty; + public string NationalId { get; set; } = string.Empty; } \ No newline at end of file diff --git a/Brizco.Domain/Entities/Task/TaskDay.cs b/Brizco.Domain/Entities/Task/TaskDay.cs index d90b858..49b335b 100644 --- a/Brizco.Domain/Entities/Task/TaskDay.cs +++ b/Brizco.Domain/Entities/Task/TaskDay.cs @@ -1,6 +1,6 @@ namespace Brizco.Domain.Entities.Task; -public class TaskDay +public class TaskDay : ApiEntity { public TaskDay() { diff --git a/Brizco.Domain/Entities/User/ApplicationUser.cs b/Brizco.Domain/Entities/User/ApplicationUser.cs index a7c1dda..4febed0 100644 --- a/Brizco.Domain/Entities/User/ApplicationUser.cs +++ b/Brizco.Domain/Entities/User/ApplicationUser.cs @@ -6,7 +6,7 @@ public class ApplicationUser : IdentityUser { public string FirstName { get; set; } = string.Empty; public string LastName { get; set; } = string.Empty; - public string InternationalId { get; set; } = string.Empty; + public string NationalId { get; set; } = string.Empty; public DateTime BirthDate { get; set; } public Gender Gender { get; set; } public SignUpStatus SignUpStatus { get; set; } diff --git a/Brizco.Domain/Enums/SignUpStatus.cs b/Brizco.Domain/Enums/SignUpStatus.cs index ca60767..4246046 100644 --- a/Brizco.Domain/Enums/SignUpStatus.cs +++ b/Brizco.Domain/Enums/SignUpStatus.cs @@ -2,7 +2,7 @@ public enum SignUpStatus { - StartSignUp = 0, + StartSignOn = 0, PhoneNumberVerified = 1, ComplexCreated = 2, SignUpCompleted = 3, diff --git a/Brizco.Domain/Mappers/ApplicationUserMapper.g.cs b/Brizco.Domain/Mappers/ApplicationUserMapper.g.cs index e09daa1..b80f0f7 100644 --- a/Brizco.Domain/Mappers/ApplicationUserMapper.g.cs +++ b/Brizco.Domain/Mappers/ApplicationUserMapper.g.cs @@ -13,7 +13,7 @@ namespace Brizco.Domain.Mappers { FirstName = p1.FirstName, LastName = p1.LastName, - InternationalId = p1.InternationalId, + NationalId = p1.NationalId, BirthDate = p1.BirthDate, Gender = p1.Gender, SignUpStatus = p1.SignUpStatus, @@ -31,7 +31,7 @@ namespace Brizco.Domain.Mappers result.FirstName = p2.FirstName; result.LastName = p2.LastName; - result.InternationalId = p2.InternationalId; + result.NationalId = p2.NationalId; result.BirthDate = p2.BirthDate; result.Gender = p2.Gender; result.SignUpStatus = p2.SignUpStatus; @@ -44,7 +44,7 @@ namespace Brizco.Domain.Mappers { FirstName = p4.FirstName, LastName = p4.LastName, - InternationalId = p4.InternationalId, + NationalId = p4.NationalId, BirthDate = p4.BirthDate, Gender = p4.Gender, SignUpStatus = p4.SignUpStatus, @@ -61,7 +61,7 @@ namespace Brizco.Domain.Mappers BirthDate = p5.BirthDate, Gender = p5.Gender, SignUpStatus = p5.SignUpStatus, - InternationalId = p5.InternationalId, + NationalId = p5.NationalId, Id = p5.Id }; } @@ -79,7 +79,7 @@ namespace Brizco.Domain.Mappers result.BirthDate = p6.BirthDate; result.Gender = p6.Gender; result.SignUpStatus = p6.SignUpStatus; - result.InternationalId = p6.InternationalId; + result.NationalId = p6.NationalId; result.Id = p6.Id; return result; @@ -92,7 +92,7 @@ namespace Brizco.Domain.Mappers BirthDate = p8.BirthDate, Gender = p8.Gender, SignUpStatus = p8.SignUpStatus, - InternationalId = p8.InternationalId, + NationalId = p8.NationalId, Id = p8.Id }; } diff --git a/Brizco.Domain/MapsterRegister.cs b/Brizco.Domain/MapsterRegister.cs index 2f01a30..3d416b2 100644 --- a/Brizco.Domain/MapsterRegister.cs +++ b/Brizco.Domain/MapsterRegister.cs @@ -16,7 +16,7 @@ public class MapsterRegister : IRegister .Map(s=>s.ComplexName,o=>o.Complex!=null ? o.Complex.Name : string.Empty) .Map(s=>s.FirstName,o=>o.User!=null ? o.User.FirstName : string.Empty) .Map(s=>s.LastName,o=>o.User!=null ? o.User.LastName : string.Empty) - .Map(s=>s.InternationalId,o=>o.User!=null ? o.User.InternationalId : string.Empty) + .Map(s=>s.InternationalId,o=>o.User!=null ? o.User.NationalId : string.Empty) .TwoWays(); } } \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d8b5929 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +FROM registry.vnfco.ir/library/dotnet/aspnet:7.0 AS base +ENV ASPNETCORE_URLS=http://0.0.0.0:8010 +WORKDIR /app +EXPOSE 8010 + +FROM registry.vnfco.ir/library/dotnet/sdk:7.0 AS build +WORKDIR /src +COPY ["Berizco.Api/Brizco.Api.csproj", "Brizco.Api/"] +RUN dotnet restore "Brizco.Api/Brizco.Api.csproj" +COPY . . +WORKDIR "/src/Brizco.Api" +RUN dotnet build "Brizco.Api.csproj" -c Release -o /app/build + +FROM build AS publish +RUN dotnet publish "Brizco.Api.csproj" -c Release -o /app/publish + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "Brizco.Api.dll"] \ No newline at end of file diff --git a/NuGet.config b/NuGet.config index 9229be7..b727bdf 100644 --- a/NuGet.config +++ b/NuGet.config @@ -1,15 +1,23 @@ - + + - + - + + + + + + + + + -