BugSectionAdditionalTime get and post
This commit is contained in:
@@ -8,6 +8,7 @@ using GozareshgirProgramManager.Domain.FileManagementAgg.Entities;
|
||||
using GozareshgirProgramManager.Domain.FileManagementAgg.Enums;
|
||||
using GozareshgirProgramManager.Domain.FileManagementAgg.Repositories;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Bug;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
using GozareshgirProgramManager.Application._Common.Models;
|
||||
using GozareshgirProgramManager.Domain._Common;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Bug;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
||||
|
||||
namespace GozareshgirProgramManager.Application.Modules.Projects.Commands.bugTimeRequestFromUser;
|
||||
|
||||
public class BugTimeRequestFromUserCommandHandler : IBaseCommandHandler<BugTimeRequestFromUserCommand>
|
||||
{
|
||||
readonly IUnitOfWork _unitOfWork;
|
||||
readonly IBugSectionRepository _bugSectionRepository;
|
||||
readonly IBugSectionAdditionalTimeRepository _bugSectionAdditionalTimeRepository;
|
||||
|
||||
|
||||
public BugTimeRequestFromUserCommandHandler(IUnitOfWork unitOfWork, IBugSectionRepository bugSectionRepository, IBugSectionAdditionalTimeRepository bugSectionAdditionalTimeRepository)
|
||||
{
|
||||
_unitOfWork = unitOfWork;
|
||||
_bugSectionRepository = bugSectionRepository;
|
||||
_bugSectionAdditionalTimeRepository = bugSectionAdditionalTimeRepository;
|
||||
}
|
||||
|
||||
public async Task<OperationResult> Handle(BugTimeRequestFromUserCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
var bugSection = await _bugSectionRepository.GetByIdAsync(request.BugSectionId, cancellationToken);
|
||||
#region Validation
|
||||
if (bugSection == null)
|
||||
return OperationResult.NotFound("بخش باگ مورد نظر یافت نشد");
|
||||
if (request.Hours == 0 && request.Minutes == 0)
|
||||
return OperationResult.Failure("لطفا زمان درخواستی را وارد کنید");
|
||||
if (string.IsNullOrWhiteSpace(request.UserDescription))
|
||||
return OperationResult.Failure("نوشتن توضیحات اجباری است");
|
||||
#endregion
|
||||
var requestTimeSpan = TimeSpan.FromHours(request.Hours) + TimeSpan.FromMinutes(request.Minutes);
|
||||
var additionalTime = new BugSectionAdditionalTime(bugSection.Id, bugSection.OriginalAssignedUserId,
|
||||
requestTimeSpan, request.UserDescription);
|
||||
await _bugSectionAdditionalTimeRepository.CreateAsync(additionalTime);
|
||||
await _unitOfWork.SaveChangesAsync(cancellationToken);
|
||||
|
||||
return OperationResult.Success();
|
||||
}
|
||||
}
|
||||
|
||||
public record BugTimeRequestFromUserCommand(Guid BugSectionId, int Hours, int Minutes, string UserDescription) : IBaseCommand;
|
||||
@@ -0,0 +1,53 @@
|
||||
|
||||
|
||||
using GozareshgirProgramManager.Application._Common.Extensions;
|
||||
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
using GozareshgirProgramManager.Application._Common.Models;
|
||||
using GozareshgirProgramManager.Application.Modules.Projects.Queries.GetBugModalDetails;
|
||||
using GozareshgirProgramManager.Domain._Common;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace GozareshgirProgramManager.Application.Modules.Projects.Queries.GetBugRequestTimeModalDetails;
|
||||
|
||||
public class GetBugRequestTimeModalDetailsQueryHandler : IBaseQueryHandler<GetBugRequestTimeModalDetailsQuery, GetBugRequestTimeModalDetailsResponse>
|
||||
{
|
||||
private readonly IProgramManagerDbContext _context;
|
||||
|
||||
public GetBugRequestTimeModalDetailsQueryHandler(IProgramManagerDbContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task<OperationResult<GetBugRequestTimeModalDetailsResponse>> Handle(GetBugRequestTimeModalDetailsQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
var bugSection = await _context.BugSections.Include(tr => tr.BugSectionAdditionalTimes)
|
||||
.FirstOrDefaultAsync(x => x.Id == request.BugSectionId, cancellationToken);
|
||||
if (bugSection == null)
|
||||
return OperationResult<GetBugRequestTimeModalDetailsResponse>.NotFound("موردی یافت نشد");
|
||||
|
||||
var projectTask = await _context.ProjectTasks
|
||||
.Include(ph => ph.Phase)
|
||||
.ThenInclude(p => p.Project)
|
||||
.FirstOrDefaultAsync(x => x.Id == bugSection.TaskId, cancellationToken);
|
||||
|
||||
if (projectTask == null)
|
||||
return OperationResult<GetBugRequestTimeModalDetailsResponse>.NotFound("پروژه یافت نشد");
|
||||
var date = bugSection.CreationDate.ToFarsi();
|
||||
var time = bugSection.CreationDate.TimeOfDay.ToString(@"hh\:mm");
|
||||
var fileIds = bugSection.BugDocuments.Select(d => d.Id).ToList();
|
||||
var files = await _context.UploadedFiles
|
||||
.Where(x => fileIds.Contains(x.Id)).Select(f => f.ToDto())
|
||||
.ToListAsync(cancellationToken: cancellationToken);
|
||||
var lastTimeRequest = "";
|
||||
if (bugSection.BugSectionAdditionalTimes.Any())
|
||||
lastTimeRequest = bugSection.BugSectionAdditionalTimes.MaxBy(x => x.CreationDate)!.RequestedTime.ToString(@"hh\:mm");
|
||||
var response = new GetBugRequestTimeModalDetailsResponse(bugSection.Id, projectTask.Name, projectTask.Phase.Name, projectTask.Phase.Project.Name, bugSection.InitialDescription, date, time, files, lastTimeRequest);
|
||||
return OperationResult<GetBugRequestTimeModalDetailsResponse>.Success(response);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public record GetBugRequestTimeModalDetailsQuery(Guid BugSectionId) : IBaseQuery<GetBugRequestTimeModalDetailsResponse>;
|
||||
|
||||
public record GetBugRequestTimeModalDetailsResponse(Guid BugSectionId, string TaskName, string PhaseName, string ProjectName, string Description, string Date, string Time, List<UploadedFileDto> Files, string LastTimeRequest);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using GozareshgirProgramManager.Domain.CheckoutAgg.Entities;
|
||||
using GozareshgirProgramManager.Domain.CustomerAgg;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||
using GozareshgirProgramManager.Domain.RoleAgg.Entities;
|
||||
using GozareshgirProgramManager.Domain.RoleUserAgg;
|
||||
using GozareshgirProgramManager.Domain.SalaryPaymentSettingAgg.Entities;
|
||||
@@ -13,6 +12,7 @@ using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Bug;
|
||||
|
||||
namespace GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||
namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities.Bug;
|
||||
|
||||
public class BugDocument
|
||||
{
|
||||
@@ -2,7 +2,7 @@
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
||||
|
||||
namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||
namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities.Bug;
|
||||
|
||||
public class BugSection : EntityBase<Guid>
|
||||
{
|
||||
@@ -13,6 +13,7 @@ public class BugSection : EntityBase<Guid>
|
||||
Status = TaskSectionStatus.ReadyToStart;
|
||||
OriginalAssignedUserId = originalAssignedUserId;
|
||||
Priority = priority;
|
||||
BugSectionAdditionalTimes = new List<BugSectionAdditionalTime>();
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +23,7 @@ public class BugSection : EntityBase<Guid>
|
||||
// برای EF Core
|
||||
private BugSection()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -58,9 +59,13 @@ public class BugSection : EntityBase<Guid>
|
||||
/// </summary>
|
||||
public List<BugDocument> BugDocuments { get; private set; } = new();
|
||||
|
||||
public List<BugSectionAdditionalTime> BugSectionAdditionalTimes { get; private set; }
|
||||
|
||||
public void AddDocument(BugDocument document)
|
||||
{
|
||||
BugDocuments.Add(document);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
using GozareshgirProgramManager.Domain._Common;
|
||||
|
||||
namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities.Bug;
|
||||
|
||||
public class BugSectionAdditionalTime : EntityBase<Guid>
|
||||
{
|
||||
public BugSectionAdditionalTime(Guid bugSectionId, long userId, TimeSpan requestedTime, string userDescription)
|
||||
{
|
||||
BugSectionId = bugSectionId;
|
||||
UserId = userId;
|
||||
RequestedTime = requestedTime;
|
||||
UserDescription = userDescription;
|
||||
}
|
||||
|
||||
//آی دی بخش باگ
|
||||
public Guid BugSectionId { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// کاربری که درخواست افزایش زمان داده است
|
||||
/// </summary>
|
||||
public long UserId { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// مدت زمان درخواستی
|
||||
/// </summary>
|
||||
public TimeSpan RequestedTime { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// توضیحات کاربر در مورد دلیل درخواست افزایش زمان
|
||||
/// </summary>
|
||||
public string UserDescription { get; private set; }
|
||||
|
||||
|
||||
public BugSection BugSection { get; set; }
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Bug;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Events;
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
using GozareshgirProgramManager.Domain._Common;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Bug;
|
||||
|
||||
namespace GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
||||
|
||||
public interface IBugSectionAdditionalTimeRepository : IRepository<Guid, BugSectionAdditionalTime>
|
||||
{
|
||||
|
||||
}
|
||||
@@ -1,9 +1,8 @@
|
||||
using GozareshgirProgramManager.Domain._Common;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Bug;
|
||||
|
||||
namespace GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
||||
|
||||
public interface IBugSectionRepository : IRepository<Guid,BugSection>
|
||||
{
|
||||
|
||||
}
|
||||
@@ -77,6 +77,7 @@ public static class DependencyInjection
|
||||
services.AddScoped<IPhaseSectionRepository, PhaseSectionRepository>();
|
||||
services.AddScoped<IProjectSectionRepository, ProjectSectionRepository>();
|
||||
services.AddScoped<IBugSectionRepository, BugSectionRepository>();
|
||||
services.AddScoped<IBugSectionAdditionalTimeRepository, BugSectionAdditionalTimeRepository>();
|
||||
|
||||
services.AddScoped<ISkillRepository, SkillRepository>();
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,49 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace GozareshgirProgramManager.Infrastructure.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class BugSectionAdditionalTimeInit : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "BugSectionsAdditionalTimes",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
BugSectionId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
UserId = table.Column<long>(type: "bigint", nullable: false),
|
||||
RequestedTime = table.Column<string>(type: "nvarchar(30)", maxLength: 30, nullable: false),
|
||||
UserDescription = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: false),
|
||||
CreationDate = table.Column<DateTime>(type: "datetime2", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_BugSectionsAdditionalTimes", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_BugSectionsAdditionalTimes_BugSections_BugSectionId",
|
||||
column: x => x.BugSectionId,
|
||||
principalTable: "BugSections",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_BugSectionsAdditionalTimes_BugSectionId",
|
||||
table: "BugSectionsAdditionalTimes",
|
||||
column: "BugSectionId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "BugSectionsAdditionalTimes");
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,78 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace GozareshgirProgramManager.Infrastructure.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class BugSectionAdditionalTimeTableNameChanged : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_BugSectionsAdditionalTimes_BugSections_BugSectionId",
|
||||
table: "BugSectionsAdditionalTimes");
|
||||
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_BugSectionsAdditionalTimes",
|
||||
table: "BugSectionsAdditionalTimes");
|
||||
|
||||
migrationBuilder.RenameTable(
|
||||
name: "BugSectionsAdditionalTimes",
|
||||
newName: "BugSectionAdditionalTimes");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_BugSectionsAdditionalTimes_BugSectionId",
|
||||
table: "BugSectionAdditionalTimes",
|
||||
newName: "IX_BugSectionAdditionalTimes_BugSectionId");
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_BugSectionAdditionalTimes",
|
||||
table: "BugSectionAdditionalTimes",
|
||||
column: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_BugSectionAdditionalTimes_BugSections_BugSectionId",
|
||||
table: "BugSectionAdditionalTimes",
|
||||
column: "BugSectionId",
|
||||
principalTable: "BugSections",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_BugSectionAdditionalTimes_BugSections_BugSectionId",
|
||||
table: "BugSectionAdditionalTimes");
|
||||
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_BugSectionAdditionalTimes",
|
||||
table: "BugSectionAdditionalTimes");
|
||||
|
||||
migrationBuilder.RenameTable(
|
||||
name: "BugSectionAdditionalTimes",
|
||||
newName: "BugSectionsAdditionalTimes");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_BugSectionAdditionalTimes_BugSectionId",
|
||||
table: "BugSectionsAdditionalTimes",
|
||||
newName: "IX_BugSectionsAdditionalTimes_BugSectionId");
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_BugSectionsAdditionalTimes",
|
||||
table: "BugSectionsAdditionalTimes",
|
||||
column: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_BugSectionsAdditionalTimes_BugSections_BugSectionId",
|
||||
table: "BugSectionsAdditionalTimes",
|
||||
column: "BugSectionId",
|
||||
principalTable: "BugSections",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -227,7 +227,7 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations
|
||||
b.ToTable("UploadedFiles", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.BugSection", b =>
|
||||
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Bug.BugSection", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
@@ -262,6 +262,37 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations
|
||||
b.ToTable("BugSections", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Bug.BugSectionAdditionalTime", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<Guid>("BugSectionId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("RequestedTime")
|
||||
.IsRequired()
|
||||
.HasMaxLength(30)
|
||||
.HasColumnType("nvarchar(30)");
|
||||
|
||||
b.Property<string>("UserDescription")
|
||||
.IsRequired()
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("nvarchar(500)");
|
||||
|
||||
b.Property<long>("UserId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("BugSectionId");
|
||||
|
||||
b.ToTable("BugSectionAdditionalTimes", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase.PhaseSection", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
@@ -902,7 +933,7 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations
|
||||
b.ToTable("UserRefreshTokens", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.BugSection", b =>
|
||||
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Bug.BugSection", b =>
|
||||
{
|
||||
b.HasOne("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.ProjectTask", "ProjectTask")
|
||||
.WithMany("BugSectionList")
|
||||
@@ -910,7 +941,7 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.OwnsMany("GozareshgirProgramManager.Domain.ProjectAgg.Entities.BugDocument", "BugDocuments", b1 =>
|
||||
b.OwnsMany("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Bug.BugDocument", "BugDocuments", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
@@ -939,6 +970,17 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations
|
||||
b.Navigation("ProjectTask");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Bug.BugSectionAdditionalTime", b =>
|
||||
{
|
||||
b.HasOne("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Bug.BugSection", "BugSection")
|
||||
.WithMany("BugSectionAdditionalTimes")
|
||||
.HasForeignKey("BugSectionId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("BugSection");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase.PhaseSection", b =>
|
||||
{
|
||||
b.HasOne("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase.ProjectPhase", "Phase")
|
||||
@@ -1226,6 +1268,11 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Bug.BugSection", b =>
|
||||
{
|
||||
b.Navigation("BugSectionAdditionalTimes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase.ProjectPhase", b =>
|
||||
{
|
||||
b.Navigation("PhaseSections");
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
using GozareshgirProgramManager.Domain.CheckoutAgg.Entities;
|
||||
using GozareshgirProgramManager.Domain.CustomerAgg;
|
||||
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
using GozareshgirProgramManager.Domain.CheckoutAgg.Entities;
|
||||
using GozareshgirProgramManager.Domain.CustomerAgg;
|
||||
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
using GozareshgirProgramManager.Domain.CustomerAgg;
|
||||
using GozareshgirProgramManager.Domain.FileManagementAgg.Entities;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task;
|
||||
@@ -16,6 +15,7 @@ using GozareshgirProgramManager.Domain.UserAgg.Entities;
|
||||
using GozareshgirProgramManager.Domain.SkillAgg.Entities;
|
||||
using GozareshgirProgramManager.Domain.TaskChatAgg.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Bug;
|
||||
|
||||
namespace GozareshgirProgramManager.Infrastructure.Persistence.Context;
|
||||
|
||||
@@ -30,6 +30,7 @@ public class ProgramManagerDbContext : DbContext, IProgramManagerDbContext
|
||||
public DbSet<ProjectSection> ProjectSections { get; set; } = null!;
|
||||
public DbSet<PhaseSection> PhaseSections { get; set; } = null!;
|
||||
public DbSet<BugSection> BugSections { get; set; } = null!;
|
||||
public DbSet<BugSectionAdditionalTime> BugSectionAdditionalTimes { get; set; } = null!;
|
||||
|
||||
// New Hierarchy entities
|
||||
public DbSet<Project> Projects { get; set; } = null!;
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Bug;
|
||||
using GozareshgirProgramManager.Infrastructure.Persistence._Common;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace GozareshgirProgramManager.Infrastructure.Persistence.Mappings;
|
||||
|
||||
public class BugSectionAdditionalTimeMapping : IEntityTypeConfiguration<BugSectionAdditionalTime>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<BugSectionAdditionalTime> builder)
|
||||
{
|
||||
builder.ToTable("BugSectionAdditionalTimes");
|
||||
|
||||
builder.HasKey(x => x.Id);
|
||||
|
||||
builder.Property(x => x.Id)
|
||||
.ValueGeneratedNever();
|
||||
|
||||
builder.Property(x => x.BugSectionId)
|
||||
.IsRequired();
|
||||
|
||||
builder.Property(x => x.UserId)
|
||||
.IsRequired();
|
||||
|
||||
|
||||
builder.Property(x => x.RequestedTime)
|
||||
.HasTimeSpanConversion();
|
||||
|
||||
builder.Property(x => x.UserDescription)
|
||||
.HasMaxLength(500);
|
||||
|
||||
// Relationship with BugSection
|
||||
builder.HasOne(x => x.BugSection)
|
||||
.WithMany(t => t.BugSectionAdditionalTimes)
|
||||
.HasForeignKey(x => x.BugSectionId);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Bug;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
@@ -47,5 +47,12 @@ public class BugSectionMapping : IEntityTypeConfiguration<BugSection>
|
||||
.WithMany(t => t.BugSectionList)
|
||||
.HasForeignKey(x => x.TaskId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
|
||||
// One-to-many relationship with BugSectionAdditionalTimes
|
||||
builder.HasMany(t => t.BugSectionAdditionalTimes)
|
||||
.WithOne(s => s.BugSection)
|
||||
.HasForeignKey(s => s.BugSectionId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Bug;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
||||
using GozareshgirProgramManager.Infrastructure.Persistence._Common;
|
||||
using GozareshgirProgramManager.Infrastructure.Persistence.Context;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace GozareshgirProgramManager.Infrastructure.Persistence.Repositories;
|
||||
|
||||
public class BugSectionAdditionalTimeRepository : RepositoryBase<Guid,BugSectionAdditionalTime>, IBugSectionAdditionalTimeRepository
|
||||
{
|
||||
private readonly ProgramManagerDbContext _context;
|
||||
public BugSectionAdditionalTimeRepository(ProgramManagerDbContext context) : base(context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Bug;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
||||
using GozareshgirProgramManager.Infrastructure.Persistence._Common;
|
||||
using GozareshgirProgramManager.Infrastructure.Persistence.Context;
|
||||
@@ -13,4 +13,6 @@ public class BugSectionRepository : RepositoryBase<Guid,BugSection>, IBugSection
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -25,7 +25,9 @@ using MediatR;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ServiceHost.BaseControllers;
|
||||
using System.Runtime.InteropServices;
|
||||
using GozareshgirProgramManager.Application.Modules.Projects.Commands.bugTimeRequestFromUser;
|
||||
using GozareshgirProgramManager.Application.Modules.Projects.Queries.GetBugModalDetails;
|
||||
using GozareshgirProgramManager.Application.Modules.Projects.Queries.GetBugRequestTimeModalDetails;
|
||||
|
||||
namespace ServiceHost.Areas.Admin.Controllers.ProgramManager;
|
||||
|
||||
@@ -204,6 +206,29 @@ public class ProjectController : ProgramManagerBaseController
|
||||
return res;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// دریافت اطلاعات مودال درخواست زمان برای باگ
|
||||
/// </summary>
|
||||
/// <param name="query"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("GetBugTimeRequestModalDetails")]
|
||||
public async Task<ActionResult<OperationResult<GetBugRequestTimeModalDetailsResponse>>> GetBugTimeRequestModalDetails(
|
||||
[FromQuery] GetBugRequestTimeModalDetailsQuery query)
|
||||
{
|
||||
var res = await _mediator.Send(query);
|
||||
return res;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ارسال درخواست زمان برای باگ
|
||||
/// </summary>
|
||||
/// <param name="command"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("BugTimeRequestFromUser")]
|
||||
public async Task<ActionResult<OperationResult>> BugTimeRequestFromUser([FromBody] BugTimeRequestFromUserCommand command)
|
||||
{
|
||||
var res = await _mediator.Send(command);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user