diff --git a/ProgramManager/src/Application/GozareshgirProgramManager.Application/GozareshgirProgramManager.Application.csproj b/ProgramManager/src/Application/GozareshgirProgramManager.Application/GozareshgirProgramManager.Application.csproj index cc16cc3a..e153fe58 100644 --- a/ProgramManager/src/Application/GozareshgirProgramManager.Application/GozareshgirProgramManager.Application.csproj +++ b/ProgramManager/src/Application/GozareshgirProgramManager.Application/GozareshgirProgramManager.Application.csproj @@ -26,7 +26,8 @@ - + + diff --git a/ProgramManager/src/Application/GozareshgirProgramManager.Application/Modules/Projects/Commands/CreateTaskSectionRevision/CreateTaskSectionRevisionCommand.cs b/ProgramManager/src/Application/GozareshgirProgramManager.Application/Modules/Projects/Commands/CreateTaskSectionRevision/CreateTaskSectionRevisionCommand.cs deleted file mode 100644 index d524694e..00000000 --- a/ProgramManager/src/Application/GozareshgirProgramManager.Application/Modules/Projects/Commands/CreateTaskSectionRevision/CreateTaskSectionRevisionCommand.cs +++ /dev/null @@ -1,134 +0,0 @@ -using GozareshgirProgramManager.Application._Common.Interfaces; -using GozareshgirProgramManager.Application._Common.Models; -using GozareshgirProgramManager.Application.Modules.TaskChat.DTOs; -using GozareshgirProgramManager.Application.Services.FileManagement; -using GozareshgirProgramManager.Domain._Common; -using GozareshgirProgramManager.Domain.FileManagementAgg.Entities; -using GozareshgirProgramManager.Domain.FileManagementAgg.Enums; -using GozareshgirProgramManager.Domain.FileManagementAgg.Repositories; -using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection; -using GozareshgirProgramManager.Domain.ProjectAgg.Repositories; -using Microsoft.AspNetCore.Http; - -namespace GozareshgirProgramManager.Application.Modules.Projects.Commands.CreateTaskSectionRevision; - -public record CreateTaskSectionRevisionCommand(string Message, List Files, Guid SectionId) : IBaseCommand; - -public class CreateTaskSectionRevisionCommandHandler : IBaseCommandHandler -{ - private readonly ITaskSectionRevisionRepository _revisionRepository; - private readonly IFileStorageService _fileStorageService; - private readonly IAuthHelper _authHelper; - private readonly IUnitOfWork _unitOfWork; - private readonly IUploadedFileRepository _fileRepository; - private readonly IThumbnailGeneratorService _thumbnailService; - - public CreateTaskSectionRevisionCommandHandler(ITaskSectionRevisionRepository revisionRepository, - IFileStorageService fileStorageService, IAuthHelper authHelper, IUnitOfWork unitOfWork, IUploadedFileRepository fileRepository, IThumbnailGeneratorService thumbnailService) - { - _revisionRepository = revisionRepository; - _fileStorageService = fileStorageService; - _authHelper = authHelper; - _unitOfWork = unitOfWork; - _fileRepository = fileRepository; - _thumbnailService = thumbnailService; - } - - public async Task Handle(CreateTaskSectionRevisionCommand request, - CancellationToken cancellationToken) - { - var currentId = _authHelper.GetCurrentUserId(); - - var entity = new TaskSectionRevision(request.SectionId, request.Message, currentId!.Value); - - foreach (var file in request.Files) - { - if (file.Length == 0) - { - return OperationResult.ValidationError("فایل خالی است"); - } - - const long maxFileSize = 100 * 1024 * 1024; - if (file.Length > maxFileSize) - { - return OperationResult.ValidationError("حجم فایل بیش از حد مجاز است (حداکثر 100MB)"); - } - - var fileType = DetectFileType(file.ContentType, Path.GetExtension(file.FileName)); - - var uploadedFile = new UploadedFile( - originalFileName: file.FileName, - fileSizeBytes: file.Length, - mimeType: file.ContentType, - fileType: fileType, - category: FileCategory.TaskSectionRevision, - uploadedByUserId: currentId!.Value, - storageProvider: StorageProvider.LocalFileSystem - ); - - await _fileRepository.AddAsync(uploadedFile); - await _fileRepository.SaveChangesAsync(); - - try - { - await using var stream = file.OpenReadStream(); - var uploadResult = await _fileStorageService.UploadAsync( - stream, - uploadedFile.UniqueFileName, - "TaskSectionRevision" - ); - - uploadedFile.CompleteUpload(uploadResult.StoragePath, uploadResult.StorageUrl); - - if (fileType == FileType.Image) - { - var dimensions = await _thumbnailService.GetImageDimensionsAsync(uploadResult.StoragePath); - if (dimensions.HasValue) - { - uploadedFile.SetImageDimensions(dimensions.Value.Width, dimensions.Value.Height); - } - - var thumbnail = await _thumbnailService - .GenerateImageThumbnailAsync(uploadResult.StoragePath, category: "TaskSectionRevision"); - if (thumbnail.HasValue) - { - uploadedFile.SetThumbnail(thumbnail.Value.ThumbnailUrl); - } - } - - await _fileRepository.UpdateAsync(uploadedFile); - await _fileRepository.SaveChangesAsync(); - - var taskRevisionFile = new TaskRevisionFile(uploadedFile.Id); - entity.AddFile(taskRevisionFile); - } - catch (Exception ex) - { - await _fileRepository.DeleteAsync(uploadedFile); - await _fileRepository.SaveChangesAsync(); - - return OperationResult.ValidationError($"خطا در آپلود فایل: {ex.Message}"); - } - } - - await _revisionRepository.CreateAsync(entity); - await _unitOfWork.SaveChangesAsync(cancellationToken); - return OperationResult.Success(); - } - private FileType DetectFileType(string mimeType, string extension) - { - if (mimeType.StartsWith("image/", StringComparison.OrdinalIgnoreCase)) - return FileType.Image; - - if (mimeType.StartsWith("video/", StringComparison.OrdinalIgnoreCase)) - return FileType.Video; - - if (mimeType.StartsWith("audio/", StringComparison.OrdinalIgnoreCase)) - return FileType.Audio; - - if (new[] { ".zip", ".rar", ".7z", ".tar", ".gz" }.Contains(extension.ToLower())) - return FileType.Archive; - - return FileType.Document; - } -} \ No newline at end of file diff --git a/ProgramManager/src/Application/GozareshgirProgramManager.Application/Modules/TaskSectionRevision/Commands/CreateTaskSectionRevision/CreateTaskSectionRevisionCommand.cs b/ProgramManager/src/Application/GozareshgirProgramManager.Application/Modules/TaskSectionRevision/Commands/CreateTaskSectionRevision/CreateTaskSectionRevisionCommand.cs new file mode 100644 index 00000000..c5ad2249 --- /dev/null +++ b/ProgramManager/src/Application/GozareshgirProgramManager.Application/Modules/TaskSectionRevision/Commands/CreateTaskSectionRevision/CreateTaskSectionRevisionCommand.cs @@ -0,0 +1,136 @@ +using GozareshgirProgramManager.Application._Common.Interfaces; +using GozareshgirProgramManager.Application._Common.Models; +using GozareshgirProgramManager.Application.Modules.TaskChat.DTOs; +using GozareshgirProgramManager.Application.Services.FileManagement; +using GozareshgirProgramManager.Domain._Common; +using GozareshgirProgramManager.Domain.FileManagementAgg.Entities; +using GozareshgirProgramManager.Domain.FileManagementAgg.Enums; +using GozareshgirProgramManager.Domain.FileManagementAgg.Repositories; +using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection; +using GozareshgirProgramManager.Domain.ProjectAgg.Repositories; +using Microsoft.AspNetCore.Http; + +namespace GozareshgirProgramManager.Application.Modules.TaskSectionRevision.Commands.CreateTaskSectionRevision; + +public record CreateTaskSectionRevisionCommand(string Message, List Files, Guid SectionId) : IBaseCommand; + +public class CreateTaskSectionRevisionCommandHandler : IBaseCommandHandler +{ + private readonly ITaskSectionRevisionRepository _revisionRepository; + private readonly IFileStorageService _fileStorageService; + private readonly IAuthHelper _authHelper; + private readonly IUnitOfWork _unitOfWork; + private readonly IUploadedFileRepository _fileRepository; + private readonly IThumbnailGeneratorService _thumbnailService; + + public CreateTaskSectionRevisionCommandHandler(ITaskSectionRevisionRepository revisionRepository, + IFileStorageService fileStorageService, IAuthHelper authHelper, IUnitOfWork unitOfWork, IUploadedFileRepository fileRepository, IThumbnailGeneratorService thumbnailService) + { + _revisionRepository = revisionRepository; + _fileStorageService = fileStorageService; + _authHelper = authHelper; + _unitOfWork = unitOfWork; + _fileRepository = fileRepository; + _thumbnailService = thumbnailService; + } + + public async Task Handle(CreateTaskSectionRevisionCommand request, + CancellationToken cancellationToken) + { + var currentId = _authHelper.GetCurrentUserId(); + + var entity = new Domain.ProjectAgg.Entities.Task.TaskSection.TaskSectionRevision(request.SectionId, request.Message, currentId!.Value); + if (request.Files is { Count: > 0 }) + { + foreach (var file in request.Files) + { + if (file.Length == 0) + { + return OperationResult.ValidationError("فایل خالی است"); + } + + const long maxFileSize = 100 * 1024 * 1024; + if (file.Length > maxFileSize) + { + return OperationResult.ValidationError("حجم فایل بیش از حد مجاز است (حداکثر 100MB)"); + } + + var fileType = DetectFileType(file.ContentType, Path.GetExtension(file.FileName)); + + var uploadedFile = new UploadedFile( + originalFileName: file.FileName, + fileSizeBytes: file.Length, + mimeType: file.ContentType, + fileType: fileType, + category: FileCategory.TaskSectionRevision, + uploadedByUserId: currentId!.Value, + storageProvider: StorageProvider.LocalFileSystem + ); + + await _fileRepository.AddAsync(uploadedFile); + await _fileRepository.SaveChangesAsync(); + + try + { + await using var stream = file.OpenReadStream(); + var uploadResult = await _fileStorageService.UploadAsync( + stream, + uploadedFile.UniqueFileName, + "TaskSectionRevision" + ); + + uploadedFile.CompleteUpload(uploadResult.StoragePath, uploadResult.StorageUrl); + + if (fileType == FileType.Image) + { + var dimensions = await _thumbnailService.GetImageDimensionsAsync(uploadResult.StoragePath); + if (dimensions.HasValue) + { + uploadedFile.SetImageDimensions(dimensions.Value.Width, dimensions.Value.Height); + } + + var thumbnail = await _thumbnailService + .GenerateImageThumbnailAsync(uploadResult.StoragePath, category: "TaskSectionRevision"); + if (thumbnail.HasValue) + { + uploadedFile.SetThumbnail(thumbnail.Value.ThumbnailUrl); + } + } + + await _fileRepository.UpdateAsync(uploadedFile); + await _fileRepository.SaveChangesAsync(); + + var taskRevisionFile = new TaskRevisionFile(uploadedFile.Id); + entity.AddFile(taskRevisionFile); + } + catch (Exception ex) + { + await _fileRepository.DeleteAsync(uploadedFile); + await _fileRepository.SaveChangesAsync(); + + return OperationResult.ValidationError($"خطا در آپلود فایل: {ex.Message}"); + } + } + } + + await _revisionRepository.CreateAsync(entity); + await _unitOfWork.SaveChangesAsync(cancellationToken); + return OperationResult.Success(); + } + private FileType DetectFileType(string mimeType, string extension) + { + if (mimeType.StartsWith("image/", StringComparison.OrdinalIgnoreCase)) + return FileType.Image; + + if (mimeType.StartsWith("video/", StringComparison.OrdinalIgnoreCase)) + return FileType.Video; + + if (mimeType.StartsWith("audio/", StringComparison.OrdinalIgnoreCase)) + return FileType.Audio; + + if (new[] { ".zip", ".rar", ".7z", ".tar", ".gz" }.Contains(extension.ToLower())) + return FileType.Archive; + + return FileType.Document; + } +} \ No newline at end of file diff --git a/ProgramManager/src/Application/GozareshgirProgramManager.Application/Modules/TaskSectionRevision/Queries/TaskRevisionsByTaskSectionId/TaskRevisionsByTaskSectionIdQuery.cs b/ProgramManager/src/Application/GozareshgirProgramManager.Application/Modules/TaskSectionRevision/Queries/TaskRevisionsByTaskSectionId/TaskRevisionsByTaskSectionIdQuery.cs new file mode 100644 index 00000000..9ee7ae0f --- /dev/null +++ b/ProgramManager/src/Application/GozareshgirProgramManager.Application/Modules/TaskSectionRevision/Queries/TaskRevisionsByTaskSectionId/TaskRevisionsByTaskSectionIdQuery.cs @@ -0,0 +1,74 @@ +using GozareshgirProgramManager.Application._Common.Interfaces; +using GozareshgirProgramManager.Application._Common.Models; +using Microsoft.EntityFrameworkCore; + +namespace GozareshgirProgramManager.Application.Modules.TaskSectionRevision.Queries.TaskRevisionsByTaskSectionId; + +public record TaskRevisionsByTaskSectionIdQuery(Guid TaskSectionId) + : IBaseQuery; + +public class TaskRevisionsByTaskSectionIdQueryHandler : IBaseQueryHandler +{ + private readonly IProgramManagerDbContext _dbContext; + + public TaskRevisionsByTaskSectionIdQueryHandler(IProgramManagerDbContext dbContext) + { + _dbContext = dbContext; + } + + public async Task> Handle( + TaskRevisionsByTaskSectionIdQuery request, CancellationToken cancellationToken) + { + var taskEntity = await _dbContext.TaskSections + .Include(x=>x.Task) + .ThenInclude(x => x.Phase) + .ThenInclude(x => x.Project) + .FirstOrDefaultAsync(x => x.Id == request.TaskSectionId, + cancellationToken: cancellationToken); + if (taskEntity == null) + { + return OperationResult.NotFound("بخش فرعی یافت نشد"); + } + + var taskRevisions = await _dbContext.TaskSectionRevisions + .Include(x => x.Files).Where(x => x.TaskSectionId == request.TaskSectionId) + .ToListAsync(cancellationToken); + if (taskRevisions.Count == 0) + { + return OperationResult.NotFound("اصلاحی یافت نشد"); + } + + var fileIds = taskRevisions.SelectMany(x => x.Files) + .Select(x => x.FileId).Distinct().ToList(); + + var uploadedFiles = _dbContext.UploadedFiles + .Where(x => fileIds.Contains(x.Id)).ToList(); + + var resItems = taskRevisions.Select(x => + { + var itemFileIds = x.Files.Select(f => f.FileId).Distinct().ToList(); + + var files = uploadedFiles.Where(f => itemFileIds.Contains(f.Id)) + .Select(file => new TaskRevisionsByTaskSectionIdItemFile() + { + Id = file.Id, + FileName = file.OriginalFileName, + FileUrl = file.StorageUrl ?? "", + FileSizeBytes = file.FileSizeBytes, + FileType = file.FileType.ToString(), + ThumbnailUrl = file.ThumbnailUrl, + ImageWidth = file.ImageWidth, + ImageHeight = file.ImageHeight, + DurationSeconds = file.DurationSeconds + }).ToList(); + + return new TaskRevisionsByTaskSectionIdItem(x.Message, files); + }).ToList(); + + var res = new TaskRevisionsByTaskSectionIdResponse(resItems, taskEntity.Task.Phase.Project.Name, + taskEntity.Task.Phase.Name, taskEntity.Task.Name); + + return OperationResult.Success(res); + } +} \ No newline at end of file diff --git a/ProgramManager/src/Application/GozareshgirProgramManager.Application/Modules/TaskSectionRevision/Queries/TaskRevisionsByTaskSectionId/TaskRevisionsByTaskSectionIdResponse.cs b/ProgramManager/src/Application/GozareshgirProgramManager.Application/Modules/TaskSectionRevision/Queries/TaskRevisionsByTaskSectionId/TaskRevisionsByTaskSectionIdResponse.cs new file mode 100644 index 00000000..cc0fdcd2 --- /dev/null +++ b/ProgramManager/src/Application/GozareshgirProgramManager.Application/Modules/TaskSectionRevision/Queries/TaskRevisionsByTaskSectionId/TaskRevisionsByTaskSectionIdResponse.cs @@ -0,0 +1,42 @@ +namespace GozareshgirProgramManager.Application.Modules.TaskSectionRevision.Queries.TaskRevisionsByTaskSectionId; + +public record TaskRevisionsByTaskSectionIdResponse( + List Items, + string ProjectName, + string PhaseName, + string TaskName); + + +public record TaskRevisionsByTaskSectionIdItem(string Message, List Files); + +public class TaskRevisionsByTaskSectionIdItemFile +{ + public Guid Id { get; set; } + public string FileName { get; set; } = string.Empty; + public string FileUrl { get; set; } = string.Empty; + public long FileSizeBytes { get; set; } + public string FileType { get; set; } = string.Empty; + public string? ThumbnailUrl { get; set; } + public int? ImageWidth { get; set; } + public int? ImageHeight { get; set; } + public int? DurationSeconds { get; set; } + + public string FileSizeFormatted + { + get + { + const long kb = 1024; + const long mb = kb * 1024; + const long gb = mb * 1024; + + if (FileSizeBytes >= gb) + return $"{FileSizeBytes / (double)gb:F2} GB"; + if (FileSizeBytes >= mb) + return $"{FileSizeBytes / (double)mb:F2} MB"; + if (FileSizeBytes >= kb) + return $"{FileSizeBytes / (double)kb:F2} KB"; + + return $"{FileSizeBytes} Bytes"; + } + } +} \ No newline at end of file diff --git a/ProgramManager/src/Application/GozareshgirProgramManager.Application/Modules/TaskSectionTimeRequests/Commands/CreateTimeRequest/CreateTimeRequestCommand.cs b/ProgramManager/src/Application/GozareshgirProgramManager.Application/Modules/TaskSectionTimeRequests/Commands/CreateTimeRequest/CreateTimeRequestCommand.cs index 629acf16..fa0bf44a 100644 --- a/ProgramManager/src/Application/GozareshgirProgramManager.Application/Modules/TaskSectionTimeRequests/Commands/CreateTimeRequest/CreateTimeRequestCommand.cs +++ b/ProgramManager/src/Application/GozareshgirProgramManager.Application/Modules/TaskSectionTimeRequests/Commands/CreateTimeRequest/CreateTimeRequestCommand.cs @@ -15,14 +15,16 @@ public class CreateTimeRequestCommandHandler : IBaseCommandHandler Handle(CreateTimeRequestCommand request, CancellationToken cancellationToken) @@ -33,10 +35,16 @@ public class CreateTimeRequestCommandHandler : IBaseCommandHandlerx.Id == request.TaskSectionId)) + { + return OperationResult.NotFound("وظیفه فرعی مورد نظر یافت نشد"); + } + + var requestTimeSpan = TimeSpan.FromHours(request.Hours) + TimeSpan.FromMinutes(request.Minutes); var entity = new TaskSectionTimeRequest(currentUser.Value, request.Description, requestTimeSpan, - TaskSectionTimeRequestType.RejectedTime,request.TaskSectionId); + request.RequestType,request.TaskSectionId); await _timeRequestRepository.CreateAsync(entity); await _unitOfWork.SaveChangesAsync(cancellationToken); return OperationResult.Success(); diff --git a/ProgramManager/src/Application/GozareshgirProgramManager.Application/_Common/Interfaces/IProgramManagerDbContext.cs b/ProgramManager/src/Application/GozareshgirProgramManager.Application/_Common/Interfaces/IProgramManagerDbContext.cs index 8246d281..1b77c175 100644 --- a/ProgramManager/src/Application/GozareshgirProgramManager.Application/_Common/Interfaces/IProgramManagerDbContext.cs +++ b/ProgramManager/src/Application/GozareshgirProgramManager.Application/_Common/Interfaces/IProgramManagerDbContext.cs @@ -35,6 +35,12 @@ public interface IProgramManagerDbContext DbSet TaskChatMessages { get; set; } DbSet UploadedFiles { get; set; } + //Task Section Time Request + DbSet TaskSectionTimeRequests { get; set; } + + // Task Section Revision + DbSet TaskSectionRevisions { get; set; } + DbSet Skills { get; set; } Task SaveChangesAsync(CancellationToken cancellationToken = default); } diff --git a/ProgramManager/src/Infrastructure/GozareshgirProgramManager.Infrastructure/Migrations/20260122100032_Add time Request and Task section revision.Designer.cs b/ProgramManager/src/Infrastructure/GozareshgirProgramManager.Infrastructure/Migrations/20260122100032_Add time Request and Task section revision.Designer.cs new file mode 100644 index 00000000..5e92b274 --- /dev/null +++ b/ProgramManager/src/Infrastructure/GozareshgirProgramManager.Infrastructure/Migrations/20260122100032_Add time Request and Task section revision.Designer.cs @@ -0,0 +1,1198 @@ +// +using System; +using GozareshgirProgramManager.Infrastructure.Persistence.Context; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace GozareshgirProgramManager.Infrastructure.Migrations +{ + [DbContext(typeof(ProgramManagerDbContext))] + [Migration("20260122100032_Add time Request and Task section revision")] + partial class AddtimeRequestandTasksectionrevision + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "10.0.1") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("GozareshgirProgramManager.Domain.CheckoutAgg.Entities.Checkout", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CheckoutEndDate") + .HasColumnType("datetime2"); + + b.Property("CheckoutStartDate") + .HasColumnType("datetime2"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("DeductionFromSalary") + .HasColumnType("float"); + + b.Property("FullName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("MandatoryHours") + .HasColumnType("int"); + + b.Property("Month") + .HasColumnType("int"); + + b.Property("MonthlySalaryDefined") + .HasColumnType("float"); + + b.Property("MonthlySalaryPay") + .HasColumnType("float"); + + b.Property("RemainingHours") + .HasColumnType("int"); + + b.Property("TotalDaysWorked") + .HasColumnType("int"); + + b.Property("TotalHoursWorked") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("bigint"); + + b.Property("Year") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Checkouts", (string)null); + }); + + modelBuilder.Entity("GozareshgirProgramManager.Domain.CustomerAgg.Customer", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.HasKey("Id"); + + b.ToTable("Customers", (string)null); + }); + + modelBuilder.Entity("GozareshgirProgramManager.Domain.FileManagementAgg.Entities.UploadedFile", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Category") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("DeletedByUserId") + .HasColumnType("bigint"); + + b.Property("DeletedDate") + .HasColumnType("datetime2"); + + b.Property("DurationSeconds") + .HasColumnType("int"); + + b.Property("FileExtension") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("FileSizeBytes") + .HasColumnType("bigint"); + + b.Property("FileType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ImageHeight") + .HasColumnType("int"); + + b.Property("ImageWidth") + .HasColumnType("int"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("IsVirusScanPassed") + .HasColumnType("bit"); + + b.Property("MimeType") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("OriginalFileName") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("ReferenceEntityId") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ReferenceEntityType") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("StoragePath") + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("StorageProvider") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("StorageUrl") + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("ThumbnailUrl") + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("UniqueFileName") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("UploadDate") + .HasColumnType("datetime2"); + + b.Property("UploadedByUserId") + .HasColumnType("bigint"); + + b.Property("VirusScanDate") + .HasColumnType("datetime2"); + + b.Property("VirusScanResult") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.HasKey("Id"); + + b.HasIndex("Category"); + + b.HasIndex("IsDeleted"); + + b.HasIndex("Status"); + + b.HasIndex("UniqueFileName") + .IsUnique(); + + b.HasIndex("UploadedByUserId"); + + b.HasIndex("ReferenceEntityType", "ReferenceEntityId"); + + b.ToTable("UploadedFiles", (string)null); + }); + + modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase.PhaseSection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("PhaseId") + .HasColumnType("uniqueidentifier"); + + b.Property("SkillId") + .HasColumnType("uniqueidentifier"); + + b.Property("UserId") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("PhaseId"); + + b.HasIndex("SkillId"); + + b.ToTable("PhaseSections"); + }); + + modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase.ProjectPhase", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("DeployStatus") + .IsRequired() + .HasMaxLength(30) + .HasColumnType("nvarchar(30)"); + + b.Property("Description") + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("HasAssignmentOverride") + .HasColumnType("bit"); + + b.Property("IsArchived") + .HasColumnType("bit"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("OrderIndex") + .HasColumnType("int"); + + b.Property("ProjectId") + .HasColumnType("uniqueidentifier"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.ToTable("ProjectPhases", (string)null); + }); + + modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project.Project", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("HasAssignmentOverride") + .HasColumnType("bit"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("PlannedEndDate") + .HasColumnType("datetime2"); + + b.Property("PlannedStartDate") + .HasColumnType("datetime2"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.ToTable("Projects", (string)null); + }); + + modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project.ProjectSection", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("ProjectId") + .HasColumnType("uniqueidentifier"); + + b.Property("SkillId") + .HasColumnType("uniqueidentifier"); + + b.Property("UserId") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.HasIndex("SkillId"); + + b.ToTable("ProjectSections"); + }); + + modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.ProjectTask", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("AllocatedTime") + .HasMaxLength(30) + .HasColumnType("nvarchar(30)"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("DueDate") + .HasColumnType("datetime2"); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("HasAssignmentOverride") + .HasColumnType("bit"); + + b.Property("HasTimeOverride") + .HasColumnType("bit"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("OrderIndex") + .HasColumnType("int"); + + b.Property("PhaseId") + .HasColumnType("uniqueidentifier"); + + b.Property("Priority") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.HasIndex("PhaseId"); + + b.ToTable("ProjectTasks", (string)null); + }); + + modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection.TaskSection", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("CurrentAssignedUserId") + .HasColumnType("bigint"); + + b.Property("InitialDescription") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("InitialEstimatedHours") + .IsRequired() + .HasMaxLength(30) + .HasColumnType("nvarchar(30)"); + + b.Property("OriginalAssignedUserId") + .HasColumnType("bigint"); + + b.Property("SkillId") + .HasColumnType("uniqueidentifier"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("TaskId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("SkillId"); + + b.HasIndex("TaskId"); + + b.ToTable("TaskSections", (string)null); + }); + + modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection.TaskSectionActivity", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("EndNotes") + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("IsActive") + .HasColumnType("bit"); + + b.Property("Notes") + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("SectionId") + .HasColumnType("uniqueidentifier"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.Property("UserId") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("SectionId"); + + b.ToTable("TaskSectionActivities", (string)null); + }); + + modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection.TaskSectionAdditionalTime", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("AddedAt") + .HasColumnType("datetime2"); + + b.Property("AddedByUserId") + .HasColumnType("bigint"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("Hours") + .IsRequired() + .HasMaxLength(30) + .HasColumnType("nvarchar(30)"); + + b.Property("Reason") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("TaskSectionId") + .HasColumnType("uniqueidentifier"); + + b.Property("Type") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.HasIndex("TaskSectionId"); + + b.ToTable("TaskSectionAdditionalTimes", (string)null); + }); + + modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection.TaskSectionRevision", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreatedByUserId") + .HasColumnType("bigint"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("Message") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("TaskSectionId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.ToTable("TaskSectionRevisions"); + }); + + modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection.TaskSectionTimeRequest", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(1200) + .HasColumnType("nvarchar(1200)"); + + b.Property("RequestStatus") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("RequestType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("RequestedTime") + .IsRequired() + .HasMaxLength(30) + .HasColumnType("nvarchar(30)"); + + b.Property("TaskSectionId") + .HasColumnType("uniqueidentifier"); + + b.Property("UserId") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("TaskSectionId"); + + b.ToTable("TaskSectionTimeRequests"); + }); + + modelBuilder.Entity("GozareshgirProgramManager.Domain.RoleAgg.Entities.Role", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("GozareshgirRoleId") + .HasColumnType("bigint"); + + b.Property("RoleName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("Id"); + + b.ToTable("PmRoles", (string)null); + }); + + modelBuilder.Entity("GozareshgirProgramManager.Domain.SalaryPaymentSettingAgg.Entities.SalaryPaymentSetting", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("EndSettingDate") + .HasColumnType("datetime2"); + + b.Property("HolidayWorking") + .HasColumnType("bit"); + + b.Property("MonthlySalary") + .HasColumnType("float"); + + b.Property("StartSettingDate") + .HasColumnType("datetime2"); + + b.Property("UserId") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.ToTable("SalaryPaymentSetting", (string)null); + }); + + modelBuilder.Entity("GozareshgirProgramManager.Domain.SkillAgg.Entities.Skill", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.HasKey("Id"); + + b.ToTable("Skills", (string)null); + }); + + modelBuilder.Entity("GozareshgirProgramManager.Domain.TaskChatAgg.Entities.TaskChatMessage", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("DeletedDate") + .HasColumnType("datetime2"); + + b.Property("EditedDate") + .HasColumnType("datetime2"); + + b.Property("FileId") + .HasColumnType("uniqueidentifier"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("IsEdited") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("IsPinned") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("MessageType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PinnedByUserId") + .HasColumnType("bigint"); + + b.Property("PinnedDate") + .HasColumnType("datetime2"); + + b.Property("ReplyToMessageId") + .HasColumnType("uniqueidentifier"); + + b.Property("SenderUserId") + .HasColumnType("bigint"); + + b.Property("TaskId") + .HasColumnType("uniqueidentifier"); + + b.Property("TextContent") + .HasMaxLength(4000) + .HasColumnType("nvarchar(4000)"); + + b.HasKey("Id"); + + b.HasIndex("CreationDate"); + + b.HasIndex("FileId"); + + b.HasIndex("IsDeleted"); + + b.HasIndex("ReplyToMessageId"); + + b.HasIndex("SenderUserId"); + + b.HasIndex("TaskId"); + + b.HasIndex("TaskId", "IsPinned"); + + b.ToTable("TaskChatMessages", (string)null); + }); + + modelBuilder.Entity("GozareshgirProgramManager.Domain.UserAgg.Entities.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("Email") + .HasMaxLength(150) + .HasColumnType("nvarchar(150)"); + + b.Property("FullName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("IsActive") + .HasColumnType("bit"); + + b.Property("Mobile") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b.Property("Password") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("ProfilePhotoPath") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("UserName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("VerifyCode") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.HasKey("Id"); + + b.ToTable("Users", (string)null); + }); + + modelBuilder.Entity("GozareshgirProgramManager.Domain.UserAgg.Entities.UserRefreshToken", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("ExpiresAt") + .HasColumnType("datetime2"); + + b.Property("IpAddress") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("RevokedAt") + .HasColumnType("datetime2"); + + b.Property("Token") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("UserAgent") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("UserId") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("ExpiresAt"); + + b.HasIndex("Token") + .IsUnique(); + + b.HasIndex("UserId"); + + b.ToTable("UserRefreshTokens", (string)null); + }); + + modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase.PhaseSection", b => + { + b.HasOne("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase.ProjectPhase", "Phase") + .WithMany("PhaseSections") + .HasForeignKey("PhaseId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("GozareshgirProgramManager.Domain.SkillAgg.Entities.Skill", "Skill") + .WithMany() + .HasForeignKey("SkillId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Phase"); + + b.Navigation("Skill"); + }); + + modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase.ProjectPhase", b => + { + b.HasOne("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project.Project", "Project") + .WithMany("Phases") + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Project"); + }); + + modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project.ProjectSection", b => + { + b.HasOne("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project.Project", "Project") + .WithMany("ProjectSections") + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("GozareshgirProgramManager.Domain.SkillAgg.Entities.Skill", "Skill") + .WithMany() + .HasForeignKey("SkillId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Project"); + + b.Navigation("Skill"); + }); + + modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.ProjectTask", b => + { + b.HasOne("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase.ProjectPhase", "Phase") + .WithMany("Tasks") + .HasForeignKey("PhaseId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Phase"); + }); + + modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection.TaskSection", b => + { + b.HasOne("GozareshgirProgramManager.Domain.SkillAgg.Entities.Skill", "Skill") + .WithMany("Sections") + .HasForeignKey("SkillId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.ProjectTask", "Task") + .WithMany("Sections") + .HasForeignKey("TaskId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Skill"); + + b.Navigation("Task"); + }); + + modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection.TaskSectionActivity", b => + { + b.HasOne("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection.TaskSection", "Section") + .WithMany("Activities") + .HasForeignKey("SectionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Section"); + }); + + modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection.TaskSectionAdditionalTime", b => + { + b.HasOne("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection.TaskSection", null) + .WithMany("AdditionalTimes") + .HasForeignKey("TaskSectionId"); + }); + + modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection.TaskSectionRevision", b => + { + b.OwnsMany("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection.TaskRevisionFile", "Files", b1 => + { + b1.Property("Id") + .HasColumnType("uniqueidentifier"); + + b1.Property("CreationDate") + .HasColumnType("datetime2"); + + b1.Property("FileId") + .HasColumnType("uniqueidentifier"); + + b1.Property("TaskSectionRevisionId") + .HasColumnType("uniqueidentifier"); + + b1.HasKey("Id"); + + b1.HasIndex("FileId"); + + b1.HasIndex("TaskSectionRevisionId"); + + b1.ToTable("TaskRevisionFile"); + + b1.HasOne("GozareshgirProgramManager.Domain.FileManagementAgg.Entities.UploadedFile", null) + .WithMany() + .HasForeignKey("FileId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b1.WithOwner() + .HasForeignKey("TaskSectionRevisionId"); + }); + + b.Navigation("Files"); + }); + + modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection.TaskSectionTimeRequest", b => + { + b.HasOne("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection.TaskSection", "TaskSection") + .WithMany() + .HasForeignKey("TaskSectionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("TaskSection"); + }); + + modelBuilder.Entity("GozareshgirProgramManager.Domain.RoleAgg.Entities.Role", b => + { + b.OwnsMany("GozareshgirProgramManager.Domain.PermissionAgg.Entities.Permission", "Permissions", b1 => + { + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("Id")); + + b1.Property("Code") + .HasColumnType("int"); + + b1.Property("RoleId") + .HasColumnType("bigint"); + + b1.HasKey("Id"); + + b1.HasIndex("RoleId"); + + b1.ToTable("PmRolePermissions", (string)null); + + b1.WithOwner("Role") + .HasForeignKey("RoleId"); + + b1.Navigation("Role"); + }); + + b.Navigation("Permissions"); + }); + + modelBuilder.Entity("GozareshgirProgramManager.Domain.SalaryPaymentSettingAgg.Entities.SalaryPaymentSetting", b => + { + b.OwnsMany("GozareshgirProgramManager.Domain.SalaryPaymentSettingAgg.Entities.WorkingHours", "WorkingHoursList", b1 => + { + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("Id")); + + b1.Property("EndShiftOne") + .HasColumnType("time(0)"); + + b1.Property("EndShiftTwo") + .HasColumnType("time(0)"); + + b1.Property("HasRestTime") + .HasColumnType("bit"); + + b1.Property("HasShiftOne") + .HasColumnType("bit"); + + b1.Property("HasShiftTow") + .HasColumnType("bit"); + + b1.Property("IsActiveDay") + .HasColumnType("bit"); + + b1.Property("PersianDayOfWeek") + .HasColumnType("int"); + + b1.Property("RestTime") + .HasColumnType("time(0)"); + + b1.Property("SalaryPaymentSettingId") + .HasColumnType("bigint"); + + b1.Property("ShiftDurationInMinutes") + .HasColumnType("int"); + + b1.Property("StartShiftOne") + .HasColumnType("time(0)"); + + b1.Property("StartShiftTwo") + .HasColumnType("time(0)"); + + b1.HasKey("Id"); + + b1.HasIndex("SalaryPaymentSettingId"); + + b1.ToTable("WorkingHours", (string)null); + + b1.WithOwner("SalaryPaymentSetting") + .HasForeignKey("SalaryPaymentSettingId"); + + b1.Navigation("SalaryPaymentSetting"); + }); + + b.Navigation("WorkingHoursList"); + }); + + modelBuilder.Entity("GozareshgirProgramManager.Domain.TaskChatAgg.Entities.TaskChatMessage", b => + { + b.HasOne("GozareshgirProgramManager.Domain.TaskChatAgg.Entities.TaskChatMessage", "ReplyToMessage") + .WithMany() + .HasForeignKey("ReplyToMessageId") + .OnDelete(DeleteBehavior.NoAction); + + b.Navigation("ReplyToMessage"); + }); + + modelBuilder.Entity("GozareshgirProgramManager.Domain.UserAgg.Entities.User", b => + { + b.OwnsMany("GozareshgirProgramManager.Domain.RoleUserAgg.RoleUser", "RoleUser", b1 => + { + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("Id")); + + b1.Property("RoleId") + .HasColumnType("bigint"); + + b1.Property("UserId") + .HasColumnType("bigint"); + + b1.HasKey("Id"); + + b1.HasIndex("UserId"); + + b1.ToTable("RoleUsers", (string)null); + + b1.WithOwner("User") + .HasForeignKey("UserId"); + + b1.Navigation("User"); + }); + + b.Navigation("RoleUser"); + }); + + modelBuilder.Entity("GozareshgirProgramManager.Domain.UserAgg.Entities.UserRefreshToken", b => + { + b.HasOne("GozareshgirProgramManager.Domain.UserAgg.Entities.User", "User") + .WithMany("RefreshTokens") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + }); + + modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase.ProjectPhase", b => + { + b.Navigation("PhaseSections"); + + b.Navigation("Tasks"); + }); + + modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project.Project", b => + { + b.Navigation("Phases"); + + b.Navigation("ProjectSections"); + }); + + modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.ProjectTask", b => + { + b.Navigation("Sections"); + }); + + modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection.TaskSection", b => + { + b.Navigation("Activities"); + + b.Navigation("AdditionalTimes"); + }); + + modelBuilder.Entity("GozareshgirProgramManager.Domain.SkillAgg.Entities.Skill", b => + { + b.Navigation("Sections"); + }); + + modelBuilder.Entity("GozareshgirProgramManager.Domain.UserAgg.Entities.User", b => + { + b.Navigation("RefreshTokens"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/ProgramManager/src/Infrastructure/GozareshgirProgramManager.Infrastructure/Migrations/20260122100032_Add time Request and Task section revision.cs b/ProgramManager/src/Infrastructure/GozareshgirProgramManager.Infrastructure/Migrations/20260122100032_Add time Request and Task section revision.cs new file mode 100644 index 00000000..0a12abce --- /dev/null +++ b/ProgramManager/src/Infrastructure/GozareshgirProgramManager.Infrastructure/Migrations/20260122100032_Add time Request and Task section revision.cs @@ -0,0 +1,121 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace GozareshgirProgramManager.Infrastructure.Migrations +{ + /// + public partial class AddtimeRequestandTasksectionrevision : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "Type", + table: "TaskSectionAdditionalTimes", + type: "nvarchar(50)", + maxLength: 50, + nullable: false, + defaultValue: ""); + + migrationBuilder.CreateTable( + name: "TaskSectionRevisions", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TaskSectionId = table.Column(type: "uniqueidentifier", nullable: false), + Status = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), + Message = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: false), + CreatedByUserId = table.Column(type: "bigint", nullable: false), + CreationDate = table.Column(type: "datetime2", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_TaskSectionRevisions", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "TaskSectionTimeRequests", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TaskSectionId = table.Column(type: "uniqueidentifier", nullable: false), + UserId = table.Column(type: "bigint", nullable: false), + Description = table.Column(type: "nvarchar(1200)", maxLength: 1200, nullable: false), + RequestedTime = table.Column(type: "nvarchar(30)", maxLength: 30, nullable: false), + RequestType = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), + RequestStatus = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), + CreationDate = table.Column(type: "datetime2", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_TaskSectionTimeRequests", x => x.Id); + table.ForeignKey( + name: "FK_TaskSectionTimeRequests_TaskSections_TaskSectionId", + column: x => x.TaskSectionId, + principalTable: "TaskSections", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "TaskRevisionFile", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + FileId = table.Column(type: "uniqueidentifier", nullable: false), + TaskSectionRevisionId = table.Column(type: "uniqueidentifier", nullable: false), + CreationDate = table.Column(type: "datetime2", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_TaskRevisionFile", x => x.Id); + table.ForeignKey( + name: "FK_TaskRevisionFile_TaskSectionRevisions_TaskSectionRevisionId", + column: x => x.TaskSectionRevisionId, + principalTable: "TaskSectionRevisions", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_TaskRevisionFile_UploadedFiles_FileId", + column: x => x.FileId, + principalTable: "UploadedFiles", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateIndex( + name: "IX_TaskRevisionFile_FileId", + table: "TaskRevisionFile", + column: "FileId"); + + migrationBuilder.CreateIndex( + name: "IX_TaskRevisionFile_TaskSectionRevisionId", + table: "TaskRevisionFile", + column: "TaskSectionRevisionId"); + + migrationBuilder.CreateIndex( + name: "IX_TaskSectionTimeRequests_TaskSectionId", + table: "TaskSectionTimeRequests", + column: "TaskSectionId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "TaskRevisionFile"); + + migrationBuilder.DropTable( + name: "TaskSectionTimeRequests"); + + migrationBuilder.DropTable( + name: "TaskSectionRevisions"); + + migrationBuilder.DropColumn( + name: "Type", + table: "TaskSectionAdditionalTimes"); + } + } +} diff --git a/ProgramManager/src/Infrastructure/GozareshgirProgramManager.Infrastructure/Migrations/AppDbContextModelSnapshot.cs b/ProgramManager/src/Infrastructure/GozareshgirProgramManager.Infrastructure/Migrations/AppDbContextModelSnapshot.cs index 2ac44b92..6bf8b72b 100644 --- a/ProgramManager/src/Infrastructure/GozareshgirProgramManager.Infrastructure/Migrations/AppDbContextModelSnapshot.cs +++ b/ProgramManager/src/Infrastructure/GozareshgirProgramManager.Infrastructure/Migrations/AppDbContextModelSnapshot.cs @@ -227,7 +227,7 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations b.ToTable("UploadedFiles", (string)null); }); - modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.PhaseSection", b => + modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase.PhaseSection", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -254,49 +254,7 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations b.ToTable("PhaseSections"); }); - modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("CreationDate") - .HasColumnType("datetime2"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("nvarchar(1000)"); - - b.Property("EndDate") - .HasColumnType("datetime2"); - - b.Property("HasAssignmentOverride") - .HasColumnType("bit"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("nvarchar(200)"); - - b.Property("PlannedEndDate") - .HasColumnType("datetime2"); - - b.Property("PlannedStartDate") - .HasColumnType("datetime2"); - - b.Property("StartDate") - .HasColumnType("datetime2"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.HasKey("Id"); - - b.ToTable("Projects", (string)null); - }); - - modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.ProjectPhase", b => + modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase.ProjectPhase", b => { b.Property("Id") .HasColumnType("uniqueidentifier"); @@ -348,7 +306,49 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations b.ToTable("ProjectPhases", (string)null); }); - modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.ProjectSection", b => + modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project.Project", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("HasAssignmentOverride") + .HasColumnType("bit"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("PlannedEndDate") + .HasColumnType("datetime2"); + + b.Property("PlannedStartDate") + .HasColumnType("datetime2"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.ToTable("Projects", (string)null); + }); + + modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project.ProjectSection", b => { b.Property("Id") .HasColumnType("uniqueidentifier"); @@ -374,7 +374,7 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations b.ToTable("ProjectSections"); }); - modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.ProjectTask", b => + modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.ProjectTask", b => { b.Property("Id") .HasColumnType("uniqueidentifier"); @@ -433,7 +433,7 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations b.ToTable("ProjectTasks", (string)null); }); - modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.TaskSection", b => + modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection.TaskSection", b => { b.Property("Id") .HasColumnType("uniqueidentifier"); @@ -476,7 +476,7 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations b.ToTable("TaskSections", (string)null); }); - modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.TaskSectionActivity", b => + modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection.TaskSectionActivity", b => { b.Property("Id") .HasColumnType("uniqueidentifier"); @@ -514,7 +514,7 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations b.ToTable("TaskSectionActivities", (string)null); }); - modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.TaskSectionAdditionalTime", b => + modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection.TaskSectionAdditionalTime", b => { b.Property("Id") .HasColumnType("uniqueidentifier"); @@ -540,6 +540,11 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations b.Property("TaskSectionId") .HasColumnType("uniqueidentifier"); + b.Property("Type") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + b.HasKey("Id"); b.HasIndex("TaskSectionId"); @@ -547,6 +552,76 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations b.ToTable("TaskSectionAdditionalTimes", (string)null); }); + modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection.TaskSectionRevision", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreatedByUserId") + .HasColumnType("bigint"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("Message") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("TaskSectionId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.ToTable("TaskSectionRevisions"); + }); + + modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection.TaskSectionTimeRequest", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(1200) + .HasColumnType("nvarchar(1200)"); + + b.Property("RequestStatus") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("RequestType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("RequestedTime") + .IsRequired() + .HasMaxLength(30) + .HasColumnType("nvarchar(30)"); + + b.Property("TaskSectionId") + .HasColumnType("uniqueidentifier"); + + b.Property("UserId") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("TaskSectionId"); + + b.ToTable("TaskSectionTimeRequests"); + }); + modelBuilder.Entity("GozareshgirProgramManager.Domain.RoleAgg.Entities.Role", b => { b.Property("Id") @@ -792,9 +867,9 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations b.ToTable("UserRefreshTokens", (string)null); }); - modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.PhaseSection", b => + modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase.PhaseSection", b => { - b.HasOne("GozareshgirProgramManager.Domain.ProjectAgg.Entities.ProjectPhase", "Phase") + b.HasOne("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase.ProjectPhase", "Phase") .WithMany("PhaseSections") .HasForeignKey("PhaseId") .OnDelete(DeleteBehavior.Cascade) @@ -810,9 +885,9 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations b.Navigation("Skill"); }); - modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.ProjectPhase", b => + modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase.ProjectPhase", b => { - b.HasOne("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project", "Project") + b.HasOne("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project.Project", "Project") .WithMany("Phases") .HasForeignKey("ProjectId") .OnDelete(DeleteBehavior.Cascade) @@ -821,9 +896,9 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations b.Navigation("Project"); }); - modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.ProjectSection", b => + modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project.ProjectSection", b => { - b.HasOne("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project", "Project") + b.HasOne("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project.Project", "Project") .WithMany("ProjectSections") .HasForeignKey("ProjectId") .OnDelete(DeleteBehavior.Cascade) @@ -839,9 +914,9 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations b.Navigation("Skill"); }); - modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.ProjectTask", b => + modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.ProjectTask", b => { - b.HasOne("GozareshgirProgramManager.Domain.ProjectAgg.Entities.ProjectPhase", "Phase") + b.HasOne("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase.ProjectPhase", "Phase") .WithMany("Tasks") .HasForeignKey("PhaseId") .OnDelete(DeleteBehavior.Cascade) @@ -850,7 +925,7 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations b.Navigation("Phase"); }); - modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.TaskSection", b => + modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection.TaskSection", b => { b.HasOne("GozareshgirProgramManager.Domain.SkillAgg.Entities.Skill", "Skill") .WithMany("Sections") @@ -858,7 +933,7 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations .OnDelete(DeleteBehavior.Cascade) .IsRequired(); - b.HasOne("GozareshgirProgramManager.Domain.ProjectAgg.Entities.ProjectTask", "Task") + b.HasOne("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.ProjectTask", "Task") .WithMany("Sections") .HasForeignKey("TaskId") .OnDelete(DeleteBehavior.Cascade) @@ -869,9 +944,9 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations b.Navigation("Task"); }); - modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.TaskSectionActivity", b => + modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection.TaskSectionActivity", b => { - b.HasOne("GozareshgirProgramManager.Domain.ProjectAgg.Entities.TaskSection", "Section") + b.HasOne("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection.TaskSection", "Section") .WithMany("Activities") .HasForeignKey("SectionId") .OnDelete(DeleteBehavior.Cascade) @@ -880,13 +955,61 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations b.Navigation("Section"); }); - modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.TaskSectionAdditionalTime", b => + modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection.TaskSectionAdditionalTime", b => { - b.HasOne("GozareshgirProgramManager.Domain.ProjectAgg.Entities.TaskSection", null) + b.HasOne("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection.TaskSection", null) .WithMany("AdditionalTimes") .HasForeignKey("TaskSectionId"); }); + modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection.TaskSectionRevision", b => + { + b.OwnsMany("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection.TaskRevisionFile", "Files", b1 => + { + b1.Property("Id") + .HasColumnType("uniqueidentifier"); + + b1.Property("CreationDate") + .HasColumnType("datetime2"); + + b1.Property("FileId") + .HasColumnType("uniqueidentifier"); + + b1.Property("TaskSectionRevisionId") + .HasColumnType("uniqueidentifier"); + + b1.HasKey("Id"); + + b1.HasIndex("FileId"); + + b1.HasIndex("TaskSectionRevisionId"); + + b1.ToTable("TaskRevisionFile"); + + b1.HasOne("GozareshgirProgramManager.Domain.FileManagementAgg.Entities.UploadedFile", null) + .WithMany() + .HasForeignKey("FileId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b1.WithOwner() + .HasForeignKey("TaskSectionRevisionId"); + }); + + b.Navigation("Files"); + }); + + modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection.TaskSectionTimeRequest", b => + { + b.HasOne("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection.TaskSection", "TaskSection") + .WithMany() + .HasForeignKey("TaskSectionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("TaskSection"); + }); + modelBuilder.Entity("GozareshgirProgramManager.Domain.RoleAgg.Entities.Role", b => { b.OwnsMany("GozareshgirProgramManager.Domain.PermissionAgg.Entities.Permission", "Permissions", b1 => @@ -1031,26 +1154,26 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations b.Navigation("User"); }); - modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project", b => - { - b.Navigation("Phases"); - - b.Navigation("ProjectSections"); - }); - - modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.ProjectPhase", b => + modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase.ProjectPhase", b => { b.Navigation("PhaseSections"); b.Navigation("Tasks"); }); - modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.ProjectTask", b => + modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project.Project", b => + { + b.Navigation("Phases"); + + b.Navigation("ProjectSections"); + }); + + modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.ProjectTask", b => { b.Navigation("Sections"); }); - modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.TaskSection", b => + modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection.TaskSection", b => { b.Navigation("Activities"); diff --git a/ProgramManager/src/Infrastructure/GozareshgirProgramManager.Infrastructure/Persistence/Mappings/TaskSectionAdditionalTimeMapping.cs b/ProgramManager/src/Infrastructure/GozareshgirProgramManager.Infrastructure/Persistence/Mappings/TaskSectionAdditionalTimeMapping.cs index 6629b740..30dc130c 100644 --- a/ProgramManager/src/Infrastructure/GozareshgirProgramManager.Infrastructure/Persistence/Mappings/TaskSectionAdditionalTimeMapping.cs +++ b/ProgramManager/src/Infrastructure/GozareshgirProgramManager.Infrastructure/Persistence/Mappings/TaskSectionAdditionalTimeMapping.cs @@ -34,6 +34,9 @@ public class TaskSectionAdditionalTimeMapping : IEntityTypeConfiguration at.CreationDate) .IsRequired(); + builder.Property(x=>x.Type) + .HasConversion() + .HasMaxLength(50); // Ignore domain events builder.Ignore(at => at.DomainEvents); } diff --git a/ProgramManager/src/Infrastructure/GozareshgirProgramManager.Infrastructure/Persistence/Mappings/TaskSectionRevisionMapping.cs b/ProgramManager/src/Infrastructure/GozareshgirProgramManager.Infrastructure/Persistence/Mappings/TaskSectionRevisionMapping.cs index 1408c86b..25a796ad 100644 --- a/ProgramManager/src/Infrastructure/GozareshgirProgramManager.Infrastructure/Persistence/Mappings/TaskSectionRevisionMapping.cs +++ b/ProgramManager/src/Infrastructure/GozareshgirProgramManager.Infrastructure/Persistence/Mappings/TaskSectionRevisionMapping.cs @@ -14,7 +14,8 @@ public class TaskSectionRevisionMapping:IEntityTypeConfiguration x.Id) .ValueGeneratedNever(); - builder.Property(x => x.Status).HasConversion(); + builder.Property(x => x.Status).HasConversion() + .HasMaxLength(50); builder.Property(x => x.Message).HasMaxLength(500); diff --git a/ProgramManager/src/Infrastructure/GozareshgirProgramManager.Infrastructure/Persistence/Mappings/TaskSectionTimeRequestMapping.cs b/ProgramManager/src/Infrastructure/GozareshgirProgramManager.Infrastructure/Persistence/Mappings/TaskSectionTimeRequestMapping.cs index 79f292c2..6e3e6311 100644 --- a/ProgramManager/src/Infrastructure/GozareshgirProgramManager.Infrastructure/Persistence/Mappings/TaskSectionTimeRequestMapping.cs +++ b/ProgramManager/src/Infrastructure/GozareshgirProgramManager.Infrastructure/Persistence/Mappings/TaskSectionTimeRequestMapping.cs @@ -23,9 +23,8 @@ public class TaskSectionTimeRequestMapping:IEntityTypeConfiguration x.RequestedTime) .HasTimeSpanConversion(); - builder.Property(x => x.TaskSection) - .HasConversion() - .HasMaxLength(50); + builder.Property(x=>x.Description) + .HasMaxLength(1200); builder.HasOne(x=>x.TaskSection) .WithMany().HasForeignKey(x=>x.TaskSectionId); diff --git a/ServiceHost/Areas/Admin/Controllers/ProgramManager/TaskSectionRevisionController.cs b/ServiceHost/Areas/Admin/Controllers/ProgramManager/TaskSectionRevisionController.cs index 04648882..39752fb7 100644 --- a/ServiceHost/Areas/Admin/Controllers/ProgramManager/TaskSectionRevisionController.cs +++ b/ServiceHost/Areas/Admin/Controllers/ProgramManager/TaskSectionRevisionController.cs @@ -1,5 +1,6 @@ using GozareshgirProgramManager.Application._Common.Models; -using GozareshgirProgramManager.Application.Modules.Projects.Commands.CreateTaskSectionRevision; +using GozareshgirProgramManager.Application.Modules.TaskSectionRevision.Commands.CreateTaskSectionRevision; +using GozareshgirProgramManager.Application.Modules.TaskSectionRevision.Queries.TaskRevisionsByTaskSectionId; using MediatR; using Microsoft.AspNetCore.Mvc; using ServiceHost.BaseControllers; @@ -14,10 +15,19 @@ public class TaskSectionRevisionController:ProgramManagerBaseController { _mediator = mediator; } - + + [HttpPost] public async Task> CreateTaskRevision([FromForm]CreateTaskSectionRevisionCommand command) { var res =await _mediator.Send(command); return Ok(res); } + + [HttpGet()] + public async Task>> GetRevisionsBySectionId( + TaskRevisionsByTaskSectionIdQuery query) + { + var res = await _mediator.Send(query); + return res; + } } \ No newline at end of file