Compare commits
26 Commits
c2fdc217b9
...
Feature/pr
| Author | SHA1 | Date | |
|---|---|---|---|
| 23d42bd8f5 | |||
| 25aa76b16c | |||
| d6a9c5e87d | |||
|
|
34d336f43e | ||
|
|
6b81f383f6 | ||
|
|
54ff59de48 | ||
|
|
9f09b6af97 | ||
|
|
63e169b82d | ||
|
|
7339eaaadf | ||
|
|
e5c96c8bcb | ||
|
|
17f117726e | ||
|
|
13fb6fec5d | ||
| 64693b2ca3 | |||
| 03657b6848 | |||
| 15f1c938f7 | |||
| 7e563a0f01 | |||
| a3fd3e6920 | |||
| 025c59e695 | |||
| 36ccd96352 | |||
| a7c97b22b4 | |||
| 4c143d6bbc | |||
| 0e5a0a16ac | |||
| 88f54b6310 | |||
| d4694e7e1c | |||
| 4bde4ade2d | |||
| bd12ff0506 |
@@ -45,11 +45,6 @@ public enum TypeOfSmsSetting
|
||||
/// </summary>
|
||||
SendInstitutionContractConfirmationCode,
|
||||
|
||||
/// <summary>
|
||||
/// لینک تاییدیه ایجاد قرارداد مالی
|
||||
/// </summary>
|
||||
SendInstitutionContractConfirmationLink,
|
||||
|
||||
/// <summary>
|
||||
/// یادآور وظایف
|
||||
/// </summary>
|
||||
|
||||
@@ -30,22 +30,5 @@ public class ApiReportDto
|
||||
public string DeliveryState { get; set; }
|
||||
public string DeliveryUnixTime { get; set; }
|
||||
public string DeliveryColor { get; set; }
|
||||
public string FullName { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class SmsDetailsDto
|
||||
{
|
||||
|
||||
|
||||
public string MessageText { get; set; }
|
||||
|
||||
public long Mobile { get; set; }
|
||||
|
||||
public string SendUnixTime { get; set; }
|
||||
public string DeliveryState { get; set; }
|
||||
public string DeliveryUnixTime { get; set; }
|
||||
public string DeliveryColor { get; set; }
|
||||
public string FullName { get; set; }
|
||||
|
||||
}
|
||||
@@ -16,21 +16,15 @@ public interface ISmsService
|
||||
/// <param name="code"></param>
|
||||
/// <returns></returns>
|
||||
Task<SentSmsViewModel> SendVerifyCodeToClient(string number, string code);
|
||||
bool SendAccountsInfo(string number, string fullName, string userName);
|
||||
bool SendAccountsInfo(string number,string fullName, string userName);
|
||||
Task<ApiResultViewModel> GetByMessageId(int messId);
|
||||
Task<List<ApiResultViewModel>> GetApiResult(string startDate, string endDate);
|
||||
|
||||
#region ForApi
|
||||
|
||||
Task<List<ApiReportDto>> GetApiReport(string startDate, string endDate);
|
||||
/// <summary>
|
||||
/// دریافت جزئیات پیامک
|
||||
/// </summary>
|
||||
/// <param name="messId"></param>
|
||||
/// <param name="fullName"></param>
|
||||
/// <returns></returns>
|
||||
Task<SmsDetailsDto> GetSmsDetailsByMessageId(int messId, string fullName);
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
string DeliveryStatus(byte? dv);
|
||||
string DeliveryColorStatus(byte? dv);
|
||||
@@ -39,9 +33,9 @@ public interface ISmsService
|
||||
#region Mahan
|
||||
|
||||
Task<double> GetCreditAmount();
|
||||
|
||||
|
||||
public Task<bool> SendInstitutionCreationVerificationLink(string number, string fullName, Guid institutionId, long contractingPartyId, long institutionContractId, string typeOfSms = null);
|
||||
|
||||
|
||||
public Task<bool> SendInstitutionVerificationCode(string number, string code, string contractingPartyFullName,
|
||||
long contractingPartyId, long institutionContractId);
|
||||
|
||||
@@ -74,7 +68,7 @@ public interface ISmsService
|
||||
/// <param name="aprove"></param>
|
||||
/// <returns></returns>
|
||||
Task<(byte status, string message, int messaeId, bool isSucceded)> MonthlyBill(string number, int tamplateId, string fullname, string amount, string id, string aprove);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// پیامک مسدودی طرف حساب
|
||||
/// قراردادهای قدیم
|
||||
|
||||
@@ -15,12 +15,11 @@ public interface ISalaryAidRepository:IRepository<long,SalaryAid>
|
||||
void RemoveRange(IEnumerable<SalaryAid> salaryAids);
|
||||
|
||||
#region Pooya
|
||||
|
||||
/// <summary>
|
||||
/// گروهبندی بر اساس ماه هنگام جستجو با انتخاب کارمند
|
||||
/// </summary>
|
||||
|
||||
SalaryAidsGroupedViewModel GetSearchListAsGrouped(SalaryAidSearchViewModel searchModel);
|
||||
SalaryAidsGroupedViewModel GetSearchListAsGrouped(SalaryAidSearchViewModel searchModel);
|
||||
#endregion
|
||||
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
using _0_Framework.Application.Enums;
|
||||
using _0_Framework.Domain;
|
||||
using _0_Framework.Domain;
|
||||
using CompanyManagment.App.Contracts.SmsResult;
|
||||
using CompanyManagment.App.Contracts.SmsResult.Dto;
|
||||
using System.Collections.Generic;
|
||||
@@ -23,9 +22,8 @@ public interface ISmsResultRepository : IRepository<long, SmsResult>
|
||||
/// </summary>
|
||||
/// <param name="searchModel"></param>
|
||||
/// <param name="date"></param>
|
||||
/// <param name="typeOfSmsSetting"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<SmsReportListDto>> GetSmsReportExpandList(SmsReportSearchModel searchModel, string date, string typeOfSmsSetting);
|
||||
Task<List<SmsReportListDto>> GetSmsReportExpandList(SmsReportSearchModel searchModel, string date);
|
||||
|
||||
#endregion
|
||||
List<SmsResultViewModel> Search(SmsResultSearchModel searchModel);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using _0_Framework.Application.Enums;
|
||||
using _0_Framework.Domain;
|
||||
using CompanyManagment.App.Contracts.SmsResult;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Company.Domain.SmsResultAgg;
|
||||
@@ -28,25 +27,4 @@ public interface ISmsSettingsRepository : IRepository<long, SmsSetting>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task RemoveItem(long id);
|
||||
|
||||
|
||||
#region ForApi
|
||||
|
||||
/// <summary>
|
||||
/// دریافت لیست پیامک های خودکار بر اساس نوع آن
|
||||
/// Api
|
||||
/// </summary>
|
||||
/// <param name="typeOfSmsSetting"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<SmsSettingDto>> GetSmsSettingList(TypeOfSmsSetting typeOfSmsSetting);
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// دریافت اطلاعات تنظیمات پیامک جهت ویرایش
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task<SmsSettingDto> GetSmsSettingDataToEdit(long id);
|
||||
#endregion
|
||||
}
|
||||
@@ -7,7 +7,6 @@ public class InstitutionContractExtensionCompleteRequest
|
||||
public Guid TemporaryId { get; set; }
|
||||
public bool IsInstallment { get; set; }
|
||||
public long LawId { get; set; }
|
||||
public bool CancelSendVerificationSms { get; set; }
|
||||
}
|
||||
|
||||
public class InstitutionContractCreationCompleteRequest
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.InstitutionContract;
|
||||
namespace CompanyManagment.App.Contracts.InstitutionContract;
|
||||
|
||||
/// <summary>
|
||||
/// لیست پیامکهای بدهکاران قرارداد ملی
|
||||
@@ -115,30 +113,10 @@ public class BlockSmsListData
|
||||
|
||||
|
||||
/// <summary>
|
||||
///پیامک آنی یادآور
|
||||
/// لیست قراداد های آبی
|
||||
/// جهت ارسال هشدار یا اقدام قضائی
|
||||
/// </summary>
|
||||
public class InstantReminderSendSms
|
||||
public class BlueWarningSmsData
|
||||
{
|
||||
/// <summary>
|
||||
/// نام طرف حساب
|
||||
/// </summary>
|
||||
public string FullName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ بدهی
|
||||
/// </summary>
|
||||
public string Amount { get; set; }
|
||||
public List<InstantReminderSmsList> InstantReminderSmsList { get; set; }
|
||||
}
|
||||
|
||||
public class InstantReminderSmsList
|
||||
{
|
||||
/// <summary>
|
||||
/// شماره تماس طرف حساب
|
||||
/// </summary>
|
||||
public string PhoneNumber { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -60,43 +60,3 @@ public class SmsSettingViewModel
|
||||
/// </summary>
|
||||
public List<EditSmsSetting> EditSmsSettings { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// لیست تنظیمات پیامک خودکار
|
||||
/// </summary>
|
||||
public class SmsSettingDto
|
||||
{
|
||||
/// <summary>
|
||||
/// آی دی
|
||||
/// </summary>
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// عدد روز از ماه
|
||||
/// </summary>
|
||||
public int DayOfMonth { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نمایش ساعت و دقیقه
|
||||
/// </summary>
|
||||
public string TimeOfDayDisplay { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class CreateSmsSettingDto
|
||||
{
|
||||
/// <summary>
|
||||
/// عدد روز از ماه
|
||||
/// </summary>
|
||||
public int DayOfMonth { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نمایش ساعت و دقیقه
|
||||
/// </summary>
|
||||
public string TimeOfDayDisplay { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -9,11 +9,6 @@ public class SmsReportDto
|
||||
/// </summary>
|
||||
public string SentDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نوع پیامک
|
||||
/// </summary>
|
||||
public string TypeOfSms { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Application.Enums;
|
||||
using CompanyManagment.App.Contracts.SmsResult.Dto;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -25,9 +24,8 @@ public interface ISmsResultApplication
|
||||
/// </summary>
|
||||
/// <param name="searchModel"></param>
|
||||
/// <param name="date"></param>
|
||||
/// <param name="typeOfSmsSetting"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<SmsReportListDto>> GetSmsReportExpandList(SmsReportSearchModel searchModel, string date, string typeOfSmsSetting);
|
||||
Task<List<SmsReportListDto>> GetSmsReportExpandList(SmsReportSearchModel searchModel, string date);
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -75,45 +75,4 @@ public interface ISmsSettingApplication
|
||||
/// <param name="command"></param>
|
||||
/// <returns></returns>
|
||||
Task<OperationResult> InstantSendBlockSms(List<BlockSmsListData> command);
|
||||
|
||||
|
||||
#region ForApi
|
||||
|
||||
/// <summary>
|
||||
/// دریافت لیست پیامک های خودکار بر اساس نوع آن
|
||||
/// Api
|
||||
/// </summary>
|
||||
/// <param name="typeOfSmsSetting"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<SmsSettingDto>> GetSmsSettingList(TypeOfSmsSetting typeOfSmsSetting);
|
||||
|
||||
/// <summary>
|
||||
/// دریافت اطلاعات تنظیمات پیامک جهت ویرایش
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task<SmsSettingDto> GetSmsSettingDataToEdit(long id);
|
||||
|
||||
/// <summary>
|
||||
/// ویرایش تنظیمات پیامک
|
||||
/// </summary>
|
||||
/// <param name="command"></param>
|
||||
/// <returns></returns>
|
||||
Task<OperationResult> EditSmsSetting(SmsSettingDto command);
|
||||
|
||||
/// <summary>
|
||||
/// دریافت لیست ارسال آنی
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<List<InstantReminderSendSms>> GetInstantReminderSmsListData(TypeOfSmsSetting typeOfSmsSetting);
|
||||
|
||||
/// <summary>
|
||||
/// ارسال پیامک آنی
|
||||
/// </summary>
|
||||
/// <param name="typeOfSmsSetting"></param>
|
||||
/// <param name="phoneNumbers"></param>
|
||||
/// <returns></returns>
|
||||
Task<OperationResult> InstantSmsSendApi(TypeOfSmsSetting typeOfSmsSetting, List<string> phoneNumbers);
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,26 +1,20 @@
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Application.Enums;
|
||||
using _0_Framework.Application.Sms;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
using Company.Domain.SmsResultAgg;
|
||||
using CompanyManagment.App.Contracts.SmsResult;
|
||||
using CompanyManagment.App.Contracts.SmsResult.Dto;
|
||||
using CompanyManagment.EFCore.Services;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using SmsResult = Company.Domain.SmsResultAgg.SmsResult;
|
||||
|
||||
namespace CompanyManagment.Application;
|
||||
|
||||
public class SmsResultApplication : ISmsResultApplication
|
||||
{
|
||||
private readonly ISmsResultRepository _smsResultRepository;
|
||||
private readonly ISmsService _smsService;
|
||||
|
||||
public SmsResultApplication(ISmsResultRepository smsResultRepository, ISmsService smsService)
|
||||
public SmsResultApplication(ISmsResultRepository smsResultRepository)
|
||||
{
|
||||
_smsResultRepository = smsResultRepository;
|
||||
_smsService = smsService;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,9 +25,9 @@ public class SmsResultApplication : ISmsResultApplication
|
||||
return await _smsResultRepository.GetSmsReportList(searchModel);
|
||||
}
|
||||
|
||||
public async Task<List<SmsReportListDto>> GetSmsReportExpandList(SmsReportSearchModel searchModel, string date, string typeOfSmsSetting)
|
||||
public async Task<List<SmsReportListDto>> GetSmsReportExpandList(SmsReportSearchModel searchModel, string date)
|
||||
{
|
||||
return await _smsResultRepository.GetSmsReportExpandList(searchModel, date, typeOfSmsSetting);
|
||||
return await _smsResultRepository.GetSmsReportExpandList(searchModel, date);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -73,6 +67,4 @@ public class SmsResultApplication : ISmsResultApplication
|
||||
}).ToList();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -9,8 +9,6 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
|
||||
namespace CompanyManagment.Application;
|
||||
|
||||
@@ -19,15 +17,12 @@ public class SmsSettingApplication : ISmsSettingApplication
|
||||
private readonly ISmsSettingsRepository _smsSettingsRepository;
|
||||
private readonly IInstitutionContractRepository _institutionContractRepository;
|
||||
private readonly IInstitutionContractSmsServiceRepository _institutionContractSmsServiceRepository;
|
||||
private readonly IHostEnvironment _hostEnvironment;
|
||||
|
||||
public SmsSettingApplication(ISmsSettingsRepository smsSettingsRepository, IInstitutionContractRepository institutionContractRepository, IInstitutionContractSmsServiceRepository institutionContractSmsServiceRepository, IHostEnvironment hostEnvironment)
|
||||
public SmsSettingApplication(ISmsSettingsRepository smsSettingsRepository, IInstitutionContractRepository institutionContractRepository, IInstitutionContractSmsServiceRepository institutionContractSmsServiceRepository)
|
||||
{
|
||||
_smsSettingsRepository = smsSettingsRepository;
|
||||
_institutionContractRepository = institutionContractRepository;
|
||||
_institutionContractSmsServiceRepository = institutionContractSmsServiceRepository;
|
||||
_hostEnvironment = hostEnvironment;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -136,12 +131,6 @@ public class SmsSettingApplication : ISmsSettingApplication
|
||||
public async Task<OperationResult> InstantSendReminderSms(List<SmsListData> command)
|
||||
{
|
||||
var op = new OperationResult();
|
||||
if (_hostEnvironment.IsDevelopment())
|
||||
{
|
||||
|
||||
return op.Failed(" در محیط توسعه امکان ارسال وجود ندارد ");
|
||||
|
||||
}
|
||||
string typeOfSms = "یادآور بدهی ماهانه";
|
||||
string sendMessStart = "شروع یادآور آنی";
|
||||
string sendMessEnd = "پایان یادآور آنی";
|
||||
@@ -162,13 +151,6 @@ public class SmsSettingApplication : ISmsSettingApplication
|
||||
public async Task<OperationResult> InstantSendBlockSms(List<BlockSmsListData> command)
|
||||
{
|
||||
var op = new OperationResult();
|
||||
|
||||
if (_hostEnvironment.IsDevelopment())
|
||||
{
|
||||
|
||||
return op.Failed(" در محیط توسعه امکان ارسال وجود ندارد ");
|
||||
|
||||
}
|
||||
string typeOfSms = "اعلام مسدودی طرف حساب";
|
||||
string sendMessStart = "شروع مسدودی آنی";
|
||||
string sendMessEnd = "پایان مسدودی آنی ";
|
||||
@@ -183,166 +165,4 @@ public class SmsSettingApplication : ISmsSettingApplication
|
||||
return op.Failed("موردی انتخاب نشده است");
|
||||
}
|
||||
}
|
||||
|
||||
#region ForApi
|
||||
|
||||
/// <summary>
|
||||
/// دریافت لیست پیامک های خودکار بر اساس نوع آن
|
||||
/// Api
|
||||
/// </summary>
|
||||
/// <param name="typeOfSmsSetting"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<SmsSettingDto>> GetSmsSettingList(TypeOfSmsSetting typeOfSmsSetting)
|
||||
{
|
||||
return await _smsSettingsRepository.GetSmsSettingList(typeOfSmsSetting);
|
||||
}
|
||||
|
||||
|
||||
public async Task<SmsSettingDto> GetSmsSettingDataToEdit(long id)
|
||||
{
|
||||
return await _smsSettingsRepository.GetSmsSettingDataToEdit(id);
|
||||
}
|
||||
|
||||
|
||||
public async Task<OperationResult> EditSmsSetting(SmsSettingDto command)
|
||||
{
|
||||
var op = new OperationResult();
|
||||
var editSmsSetting = _smsSettingsRepository.Get(command.Id);
|
||||
var timeSpan = new TimeSpan();
|
||||
if (string.IsNullOrWhiteSpace(command.TimeOfDayDisplay))
|
||||
return op.Failed("ساعت وارد نشده است");
|
||||
|
||||
try
|
||||
{
|
||||
timeSpan = TimeSpan.ParseExact(command.TimeOfDayDisplay, @"hh\:mm", null);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return op.Failed("فرمت ساعت اشتباه است");
|
||||
}
|
||||
|
||||
if (command.DayOfMonth < 1 || command.DayOfMonth > 31)
|
||||
{
|
||||
return op.Failed("عدد روز می بایست بین 1 تا 31 باشد");
|
||||
}
|
||||
|
||||
if (_smsSettingsRepository.Exists(x => x.DayOfMonth == command.DayOfMonth && x.TimeOfDay == timeSpan && x.TypeOfSmsSetting == editSmsSetting.TypeOfSmsSetting && x.id != command.Id))
|
||||
return op.Failed("رکورد ایجاد شده تکراری است");
|
||||
|
||||
|
||||
editSmsSetting.Edit(command.DayOfMonth, timeSpan);
|
||||
await _smsSettingsRepository.SaveChangesAsync();
|
||||
|
||||
return op.Succcedded();
|
||||
}
|
||||
|
||||
|
||||
public async Task<List<InstantReminderSendSms>> GetInstantReminderSmsListData(TypeOfSmsSetting typeOfSmsSetting)
|
||||
{
|
||||
var result = new List<InstantReminderSendSms>();
|
||||
|
||||
|
||||
if (typeOfSmsSetting == TypeOfSmsSetting.InstitutionContractDebtReminder)
|
||||
{
|
||||
var data = await _institutionContractSmsServiceRepository.GetSmsListData(DateTime.Now, TypeOfSmsSetting.InstitutionContractDebtReminder);
|
||||
|
||||
if (data.Any())
|
||||
{
|
||||
result = data.GroupBy(x => x.PartyName).Select(m => new InstantReminderSendSms()
|
||||
{
|
||||
FullName = m.Key,
|
||||
Amount = m.Select(c => c.Amount).First(),
|
||||
InstantReminderSmsList = m.Select(c => new InstantReminderSmsList()
|
||||
{
|
||||
PhoneNumber = c.PhoneNumber,
|
||||
}).ToList()
|
||||
|
||||
|
||||
}).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
if (typeOfSmsSetting == TypeOfSmsSetting.BlockContractingParty)
|
||||
{
|
||||
var data = await _institutionContractSmsServiceRepository.GetBlockListData(DateTime.Now);
|
||||
|
||||
if (data.Any())
|
||||
{
|
||||
result = data.GroupBy(x => x.PartyName).Select(m => new InstantReminderSendSms()
|
||||
{
|
||||
FullName = m.Key,
|
||||
Amount = m.Select(c => c.Amount).First(),
|
||||
InstantReminderSmsList = m.Select(c => new InstantReminderSmsList()
|
||||
{
|
||||
PhoneNumber = c.PhoneNumber,
|
||||
}).ToList()
|
||||
|
||||
|
||||
}).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task<OperationResult> InstantSmsSendApi(TypeOfSmsSetting typeOfSmsSetting, List<string> phoneNumbers)
|
||||
{
|
||||
|
||||
var op = new OperationResult();
|
||||
if (_hostEnvironment.IsDevelopment())
|
||||
{
|
||||
var str = "";
|
||||
foreach (var item in phoneNumbers)
|
||||
{
|
||||
str += $" {item}, ";
|
||||
}
|
||||
return op.Failed(" در محیط توسعه امکان ارسال وجود ندارد " + " لیست ارسال شما " + str);
|
||||
|
||||
}
|
||||
if (typeOfSmsSetting == TypeOfSmsSetting.InstitutionContractDebtReminder)
|
||||
{
|
||||
if (phoneNumbers.Any())
|
||||
{
|
||||
var data = await _institutionContractSmsServiceRepository.GetSmsListData(DateTime.Now, TypeOfSmsSetting.InstitutionContractDebtReminder);
|
||||
|
||||
if (data.Any())
|
||||
{
|
||||
phoneNumbers = phoneNumbers.Where(x => x.Length == 11).ToList();
|
||||
var sendItems = data.Where(x => phoneNumbers.Contains(x.PhoneNumber)).ToList();
|
||||
var res = await InstantSendReminderSms(sendItems);
|
||||
return res;
|
||||
|
||||
}
|
||||
|
||||
return op.Succcedded();
|
||||
}
|
||||
|
||||
return op.Failed("موردی انتخاب نشده است");
|
||||
|
||||
}
|
||||
|
||||
if (typeOfSmsSetting == TypeOfSmsSetting.BlockContractingParty)
|
||||
{
|
||||
if (phoneNumbers.Any())
|
||||
{
|
||||
var data = await _institutionContractSmsServiceRepository.GetBlockListData(DateTime.Now);
|
||||
|
||||
if (data.Any())
|
||||
{
|
||||
phoneNumbers = phoneNumbers.Where(x => x.Length == 11).ToList();
|
||||
var sendItems = data.Where(x => phoneNumbers.Contains(x.PhoneNumber)).ToList();
|
||||
var res = await InstantSendBlockSms(sendItems);
|
||||
return res;
|
||||
}
|
||||
return op.Succcedded();
|
||||
}
|
||||
return op.Failed("موردی انتخاب نشده است");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return op.Failed("خطای انتخاب نوع ارسال");
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -2269,8 +2269,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
extenstionTemp
|
||||
);
|
||||
|
||||
var workshopIds = prevInstitutionContracts.WorkshopGroup?.CurrentWorkshops?.Select(x => x.WorkshopId.Value) ??
|
||||
[];
|
||||
var workshopIds = prevInstitutionContracts.WorkshopGroup?.CurrentWorkshops?.Select(x => x.WorkshopId.Value)??[];
|
||||
|
||||
var workshopsNotInInstitution = employerWorkshopIds.Where(x => !workshopIds.Contains(x)).ToList();
|
||||
|
||||
@@ -2318,7 +2317,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
WorkshopId = workshop?.id ?? 0,
|
||||
RollCallInPerson = service.RollCallInPerson
|
||||
};
|
||||
}).ToList() ?? [];
|
||||
}).ToList()??[];
|
||||
var notIncludeWorskhopsLeftWork = await _context.LeftWorkList
|
||||
.Where(x => workshopsNotInInstitution.Contains(x.WorkshopId) && x.StartWorkDate <= DateTime.Now &&
|
||||
x.LeftWorkDate >= DateTime.Now)
|
||||
@@ -2960,11 +2959,8 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
|
||||
await SaveChangesAsync();
|
||||
|
||||
if (!request.CancelSendVerificationSms)
|
||||
{
|
||||
await _smsService.SendInstitutionCreationVerificationLink(contractingParty.Phone, contractingPartyFullName,
|
||||
entity.PublicId, contractingParty.id, entity.id);
|
||||
}
|
||||
await _smsService.SendInstitutionCreationVerificationLink(contractingParty.Phone, contractingPartyFullName,
|
||||
entity.PublicId, contractingParty.id, entity.id);
|
||||
|
||||
|
||||
await SaveChangesAsync();
|
||||
@@ -3367,10 +3363,10 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
institution.VerificationStatus == InstitutionContractVerificationStatus.PendingForVerify
|
||||
? null
|
||||
: institution.VerifierFullName,
|
||||
VerifierPhoneNumber =
|
||||
VerifierPhoneNumber =
|
||||
institution.VerificationStatus == InstitutionContractVerificationStatus.PendingForVerify
|
||||
? null
|
||||
: institution.VerifierPhoneNumber,
|
||||
? null
|
||||
: institution.VerifierPhoneNumber,
|
||||
VerifyCode = institution.VerificationStatus == InstitutionContractVerificationStatus.PendingForVerify
|
||||
? null
|
||||
: institution.VerifyCode,
|
||||
@@ -4370,8 +4366,8 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
bool tempCreated = false;
|
||||
if (creationTemp == null)
|
||||
{
|
||||
creationTemp = new InstitutionContractCreationTemp();
|
||||
await _institutionContractCreationTemp.InsertOneAsync(creationTemp);
|
||||
creationTemp = new InstitutionContractCreationTemp();
|
||||
await _institutionContractCreationTemp.InsertOneAsync(creationTemp);
|
||||
}
|
||||
|
||||
List<WorkshopTempViewModel> workshopDetails = [];
|
||||
@@ -5113,11 +5109,9 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
|
||||
await SaveChangesAsync();
|
||||
|
||||
if (!request.CancelSendVerificationSms)
|
||||
{
|
||||
await _smsService.SendInstitutionCreationVerificationLink(contractingParty.Phone, contractingPartyFullName,
|
||||
entity.PublicId, contractingParty.id, entity.id);
|
||||
}
|
||||
await _smsService.SendInstitutionCreationVerificationLink(contractingParty.Phone, contractingPartyFullName,
|
||||
entity.PublicId, contractingParty.id, entity.id);
|
||||
|
||||
|
||||
await SaveChangesAsync();
|
||||
await transaction.CommitAsync();
|
||||
|
||||
@@ -2109,24 +2109,11 @@ public class InstitutionContractSmsServiceRepository : RepositoryBase<long, Inst
|
||||
int successProcess = 1;
|
||||
int countList = smsListData.Count;
|
||||
|
||||
#region Test
|
||||
|
||||
|
||||
//for (int i = 0; i < 100; i++)
|
||||
//{
|
||||
// var percent = (successProcess / (double)countList) * 100;
|
||||
// await _hubContext.Clients.Group(SendSmsHub.GetGroupName(7))
|
||||
// .SendAsync("showStatus", (int)percent);
|
||||
// Thread.Sleep(1000);
|
||||
// successProcess += 1;
|
||||
//}
|
||||
#endregion
|
||||
|
||||
foreach (var item in smsListData)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
if (item.TypeOfSmsMethod == "MonthlyBill")
|
||||
{
|
||||
var res = await _smsService.MonthlyBill(item.PhoneNumber, item.TemplateId, item.PartyName,
|
||||
|
||||
@@ -82,45 +82,25 @@ public class RollCallEmployeeRepository : RepositoryBase<long, RollCallEmployee>
|
||||
|
||||
var service = _rollCallServiceRepository.GetAllServiceByWorkshopId(workshopId);
|
||||
|
||||
//اگر سرویس حضور غیاب نداشت
|
||||
if (!service.Any(x => x.StartService.Date <= contractStart.Date && x.EndService.Date >= contractEnd.Date))
|
||||
return false;
|
||||
//var rollCallEmployee = GetByEmployeeIdAndWorkshopId(employeeId, workshopId);
|
||||
|
||||
//if (rollCallEmployee == null)
|
||||
// return false;
|
||||
var rollCallEmployee = _context.RollCallEmployees.Include(xs => xs.EmployeesStatus)
|
||||
.FirstOrDefault(x => x.EmployeeId == employeeId && x.WorkshopId == workshopId);
|
||||
//اگر تنظیمات حضور غیاب نداشت
|
||||
if (rollCallEmployee == null)
|
||||
return false;
|
||||
|
||||
//اگر استاتوس نداشت
|
||||
if (!rollCallEmployee.EmployeesStatus.Any())
|
||||
var rollCallEmployee = _context.RollCallEmployees
|
||||
.Where(x => x.EmployeeId == employeeId && x.WorkshopId == workshopId)
|
||||
.Include(x => x.EmployeesStatus);
|
||||
if (!rollCallEmployee.Any())
|
||||
return false;
|
||||
|
||||
var leftWork =
|
||||
_context.LeftWorkList.FirstOrDefault(x =>
|
||||
x.StartWorkDate <= contractEnd.Date && x.LeftWorkDate > contractStart);
|
||||
if (leftWork == null)
|
||||
return false;
|
||||
|
||||
var status = rollCallEmployee.EmployeesStatus.FirstOrDefault(s =>
|
||||
(s.StartDate <= contractStart.Date && s.EndDate.Date >= contractEnd.Date));
|
||||
//اگر استاتوس کامل پوشش داد
|
||||
if (status != null)
|
||||
return true;
|
||||
|
||||
|
||||
status = rollCallEmployee.EmployeesStatus.FirstOrDefault(s =>
|
||||
(s.StartDate.Date <= contractStart.Date && s.EndDate.Date > contractStart.Date &&
|
||||
s.EndDate.Date < contractEnd.Date));
|
||||
//اگر قبل از پایان فیس استاتوس قطع شده ولی ترک کار داره
|
||||
if (status != null && leftWork.HasLeft)
|
||||
return true;
|
||||
|
||||
|
||||
return false;
|
||||
var a = rollCallEmployee.Any(x => x.EmployeesStatus.Any(s =>
|
||||
(s.StartDate <= contractStart.Date && s.EndDate.Date >= contractEnd.Date) ||
|
||||
(s.StartDate.Date <= contractStart.Date && s.EndDate.Date > contractStart.Date)));
|
||||
//var result = _employeeRollCallStatusRepository.w(x => x.RollCallEmployeeId == rollCallEmployee.Id &&
|
||||
// (x.StartDate.Date <= contractStart.Date && x.EndDate.Date >= contractEnd.Date) ||
|
||||
// (x.StartDate.Date <= contractStart.Date && x.EndDate.Date > contractStart.Date));
|
||||
return a;
|
||||
}
|
||||
public List<RollCallEmployeeViewModel> GetByWorkshopId(long workshopId)
|
||||
{
|
||||
|
||||
@@ -77,9 +77,6 @@ public class SmsResultRepository : RepositoryBase<long, SmsResult>, ISmsResultRe
|
||||
case TypeOfSmsSetting.SendInstitutionContractConfirmationCode:
|
||||
typeOfSms = "کد تاییدیه قرارداد مالی";
|
||||
break;
|
||||
case TypeOfSmsSetting.SendInstitutionContractConfirmationLink:
|
||||
typeOfSms = "لینک تاییدیه ایجاد قرارداد مالی";
|
||||
break;
|
||||
case TypeOfSmsSetting.TaskReminder:
|
||||
typeOfSms = "یادآور وظایف";
|
||||
break;
|
||||
@@ -150,7 +147,7 @@ public class SmsResultRepository : RepositoryBase<long, SmsResult>, ISmsResultRe
|
||||
|
||||
// مرحله 2: گروهبندی و انتخاب آخرین رکورد هر روز روی Client
|
||||
var grouped = rawQuery
|
||||
.GroupBy(x => (x.DateOnly, x.TypeOfSms))
|
||||
.GroupBy(x => x.DateOnly)
|
||||
.Select(g => g.OrderByDescending(x => x.CreationDate).First())
|
||||
.OrderByDescending(x => x.CreationDate)
|
||||
.ToList();
|
||||
@@ -158,16 +155,15 @@ public class SmsResultRepository : RepositoryBase<long, SmsResult>, ISmsResultRe
|
||||
// مرحله 3: تبدیل به DTO و ToFarsi
|
||||
var result = grouped.Select(x => new SmsReportDto
|
||||
{
|
||||
SentDate = x.CreationDate.ToFarsi(),
|
||||
TypeOfSms = x.TypeOfSms
|
||||
SentDate = x.CreationDate.ToFarsi()
|
||||
}).ToList();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public async Task<List<SmsReportListDto>> GetSmsReportExpandList(SmsReportSearchModel searchModel, string date, string typeOfSmsSetting)
|
||||
public async Task<List<SmsReportListDto>> GetSmsReportExpandList(SmsReportSearchModel searchModel, string date)
|
||||
{
|
||||
if(string.IsNullOrWhiteSpace(date) || string.IsNullOrWhiteSpace(typeOfSmsSetting))
|
||||
if(string.IsNullOrWhiteSpace(date))
|
||||
return new List<SmsReportListDto>();
|
||||
|
||||
if (date.TryToGeorgianDateTime(out var searchDate) == false)
|
||||
@@ -202,12 +198,41 @@ public class SmsResultRepository : RepositoryBase<long, SmsResult>, ISmsResultRe
|
||||
query = query.Where(x => x.Mobile.Contains(searchModel.Mobile)).ToList();
|
||||
}
|
||||
|
||||
if (searchModel.TypeOfSms != TypeOfSmsSetting.All && searchModel.TypeOfSms != TypeOfSmsSetting.Warning)
|
||||
{
|
||||
var typeOfSms = "All";
|
||||
switch (searchModel.TypeOfSms)
|
||||
{
|
||||
case TypeOfSmsSetting.InstitutionContractDebtReminder:
|
||||
typeOfSms = "یادآور بدهی ماهانه";
|
||||
break;
|
||||
case TypeOfSmsSetting.MonthlyInstitutionContract:
|
||||
typeOfSms = "صورت حساب ماهانه";
|
||||
break;
|
||||
case TypeOfSmsSetting.BlockContractingParty:
|
||||
typeOfSms = "اعلام مسدودی طرف حساب";
|
||||
break;
|
||||
case TypeOfSmsSetting.LegalAction:
|
||||
typeOfSms = "اقدام قضایی";
|
||||
break;
|
||||
case TypeOfSmsSetting.InstitutionContractConfirm:
|
||||
typeOfSms = "یادآور تایید قرارداد مالی";
|
||||
break;
|
||||
case TypeOfSmsSetting.SendInstitutionContractConfirmationCode:
|
||||
typeOfSms = "کد تاییدیه قرارداد مالی";
|
||||
break;
|
||||
case TypeOfSmsSetting.TaskReminder:
|
||||
typeOfSms = "یادآور وظایف";
|
||||
break;
|
||||
}
|
||||
|
||||
if (typeOfSmsSetting.Contains("هشدار"))
|
||||
query = query.Where(x => x.TypeOfSms == typeOfSms).ToList();
|
||||
}
|
||||
|
||||
if (searchModel.TypeOfSms == TypeOfSmsSetting.Warning)
|
||||
{
|
||||
query = query.Where(x => x.TypeOfSms.Contains("هشدار")).ToList();
|
||||
}
|
||||
query = query.Where(x => x.TypeOfSms == typeOfSmsSetting).ToList();
|
||||
|
||||
if (searchModel.SendStatus != SendStatus.All)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application.Enums;
|
||||
using _0_Framework.InfraStructure;
|
||||
@@ -69,48 +68,4 @@ public class SmsSettingsRepository : RepositoryBase<long, SmsSetting>, ISmsSetti
|
||||
_context.SmsSettings.Remove(removeItem);
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
|
||||
#region ForApi
|
||||
/// <summary>
|
||||
/// دریافت لیست پیامک های خودکار بر اساس نوع آن
|
||||
/// Api
|
||||
/// </summary>
|
||||
/// <param name="typeOfSmsSetting"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<SmsSettingDto>> GetSmsSettingList(TypeOfSmsSetting typeOfSmsSetting)
|
||||
{
|
||||
|
||||
var data = await _context.SmsSettings
|
||||
.Where(x => x.TypeOfSmsSetting == typeOfSmsSetting)
|
||||
.OrderBy(x => x.DayOfMonth).ThenBy(x => x.TimeOfDay)
|
||||
.Select(x =>
|
||||
new SmsSettingDto()
|
||||
{
|
||||
Id = x.id,
|
||||
DayOfMonth = x.DayOfMonth,
|
||||
TimeOfDayDisplay = x.TimeOfDay.ToString(@"hh\:mm")
|
||||
}).ToListAsync();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
public async Task<SmsSettingDto> GetSmsSettingDataToEdit(long id)
|
||||
{
|
||||
var edit = new SmsSettingDto();
|
||||
var getItem = await _context.SmsSettings.FirstOrDefaultAsync(x => x.id == id);
|
||||
|
||||
if (getItem != null)
|
||||
{
|
||||
edit.Id = getItem.id;
|
||||
edit.TimeOfDayDisplay = getItem.TimeOfDay.ToString(@"hh\:mm");
|
||||
edit.DayOfMonth = getItem.DayOfMonth;
|
||||
|
||||
}
|
||||
|
||||
return edit;
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -2859,7 +2859,7 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
|
||||
var contactCanToleaveList = new List<ContractsCanToLeave>();
|
||||
var allContractsBetween = _context.Contracts.AsSplitQuery().Include(x => x.WorkingHoursList)
|
||||
.Where(x => x.WorkshopIds == workshopId && x.EmployeeId == employeeId &&
|
||||
x.ContractEnd >= startDate && x.ContarctStart <= endDate).OrderBy(x=>x.ContarctStart).ToList();
|
||||
x.ContractEnd >= startDate && x.ContarctStart <= endDate).ToList();
|
||||
var isWorkshopStaticCheckout = _context.Workshops.FirstOrDefault(x => x.id == workshopId)!.IsStaticCheckout;
|
||||
int mandatoryDays = 0;
|
||||
double allCanToLeave = 0;
|
||||
|
||||
@@ -205,26 +205,6 @@ public class SmsService : ISmsService
|
||||
};
|
||||
return appendData;
|
||||
}
|
||||
|
||||
public async Task<SmsDetailsDto> GetSmsDetailsByMessageId(int messId, string fullName)
|
||||
{
|
||||
|
||||
SmsIr smsIr = new SmsIr("Og5M562igmzJRhQPnq0GdtieYdLgtfikjzxOmeQBPxJjZtyge5Klc046Lfw1mxSa");
|
||||
var response = await smsIr.GetReportAsync(messId);
|
||||
MessageReportResult messages = response.Data;
|
||||
|
||||
var appendData = new SmsDetailsDto()
|
||||
{
|
||||
Mobile = messages.Mobile,
|
||||
MessageText = messages.MessageText,
|
||||
SendUnixTime = UnixTimeStampToDateTime(messages.SendDateTime),
|
||||
DeliveryState = DeliveryStatus(messages.DeliveryState),
|
||||
DeliveryUnixTime = UnixTimeStampToDateTime(messages.DeliveryDateTime),
|
||||
DeliveryColor = DeliveryColorStatus(messages.DeliveryState),
|
||||
FullName = fullName
|
||||
};
|
||||
return appendData;
|
||||
}
|
||||
public async Task<List<ApiResultViewModel>> GetApiResult(string startDate, string endDate)
|
||||
{
|
||||
|
||||
|
||||
5
Directory.Build.props
Normal file
5
Directory.Build.props
Normal file
@@ -0,0 +1,5 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<NuGetAudit>false</NuGetAudit>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -2,6 +2,9 @@ using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
using GozareshgirProgramManager.Application._Common.Models;
|
||||
using GozareshgirProgramManager.Domain._Common;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
||||
using GozareshgirProgramManager.Domain.SkillAgg.Repositories;
|
||||
|
||||
@@ -2,6 +2,7 @@ using System.Linq;
|
||||
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
using GozareshgirProgramManager.Application._Common.Models;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
using GozareshgirProgramManager.Application._Common.Models;
|
||||
using GozareshgirProgramManager.Domain._Common;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
||||
|
||||
namespace GozareshgirProgramManager.Application.Modules.Projects.Commands.ChangeDeployStatusProject;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
using GozareshgirProgramManager.Application._Common.Models;
|
||||
using GozareshgirProgramManager.Domain._Common;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
||||
|
||||
@@ -69,7 +71,7 @@ public class ChangeTaskPriorityCommandHandler : IBaseCommandHandler<ChangeTaskPr
|
||||
if (phase is null)
|
||||
return OperationResult.NotFound("فاز یافت نشد");
|
||||
|
||||
var tasks = phase.Tasks?.ToList() ?? new List<Domain.ProjectAgg.Entities.ProjectTask>();
|
||||
var tasks = phase.Tasks?.ToList() ?? new List<ProjectTask>();
|
||||
foreach (var t in tasks)
|
||||
{
|
||||
if (t.Priority != priority)
|
||||
@@ -89,10 +91,10 @@ public class ChangeTaskPriorityCommandHandler : IBaseCommandHandler<ChangeTaskPr
|
||||
if (project is null)
|
||||
return OperationResult.NotFound("پروژه یافت نشد");
|
||||
|
||||
var phases = project.Phases?.ToList() ?? new List<Domain.ProjectAgg.Entities.ProjectPhase>();
|
||||
var phases = project.Phases?.ToList() ?? new List<ProjectPhase>();
|
||||
foreach (var phase in phases)
|
||||
{
|
||||
var tasks = phase.Tasks?.ToList() ?? new List<Domain.ProjectAgg.Entities.ProjectTask>();
|
||||
var tasks = phase.Tasks?.ToList() ?? new List<ProjectTask>();
|
||||
foreach (var t in tasks)
|
||||
{
|
||||
if (t.Priority != priority)
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
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._Common.Exceptions;
|
||||
using GozareshgirProgramManager.Domain.FileManagementAgg.Entities;
|
||||
using GozareshgirProgramManager.Domain.FileManagementAgg.Enums;
|
||||
using GozareshgirProgramManager.Domain.FileManagementAgg.Repositories;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace GozareshgirProgramManager.Application.Modules.Projects.Commands.CreateBugSection;
|
||||
|
||||
public class CreateBugSectionCommandHandler : IBaseCommandHandler<CreateBugSectionCommand>
|
||||
{
|
||||
readonly IUnitOfWork _unitOfWork;
|
||||
readonly IBugSectionRepository _bugSectionRepository;
|
||||
readonly IFileUploadService _fileUploadService;
|
||||
private readonly IAuthHelper _authHelper;
|
||||
|
||||
public CreateBugSectionCommandHandler(IUnitOfWork unitOfWork, IBugSectionRepository bugSectionRepository,
|
||||
IAuthHelper authHelper, IFileUploadService fileUploadService)
|
||||
{
|
||||
_unitOfWork = unitOfWork;
|
||||
_bugSectionRepository = bugSectionRepository;
|
||||
|
||||
_authHelper = authHelper;
|
||||
_fileUploadService = fileUploadService;
|
||||
}
|
||||
|
||||
public async Task<OperationResult> Handle(CreateBugSectionCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
var currentUserId = _authHelper.GetCurrentUserId()
|
||||
?? throw new UnAuthorizedException("کاربر احراز هویت نشده است");
|
||||
|
||||
#region Validation
|
||||
if (_bugSectionRepository.Exists(x => x.TaskId == request.TaskId))
|
||||
return OperationResult.Failure("برای این بخش قبلا تسک باگ ایجاد شده است");
|
||||
|
||||
if (string.IsNullOrWhiteSpace(request.InitialDescription))
|
||||
return OperationResult.Failure("توضیحات باگ خالی است");
|
||||
|
||||
if (request.OriginalAssignedUserId == 0)
|
||||
return OperationResult.Failure("کاربر انتخاب نشده است");
|
||||
#endregion
|
||||
|
||||
var bug = new BugSection(request.TaskId, request.InitialDescription, request.OriginalAssignedUserId,
|
||||
request.Priority);
|
||||
await _bugSectionRepository.CreateAsync(bug);
|
||||
|
||||
if (request.Files.Any())
|
||||
{
|
||||
foreach (var file in request.Files)
|
||||
{
|
||||
var uploadedFile = await _fileUploadService.UploadFileAsync
|
||||
(
|
||||
file,
|
||||
FileCategory.BugSection,
|
||||
currentUserId
|
||||
);
|
||||
if (!uploadedFile.IsSuccess)
|
||||
{
|
||||
return OperationResult.Failure(uploadedFile.ErrorMessage ?? "خطا در آپلود فایل");
|
||||
}
|
||||
bug.AddDocument(new BugDocument(uploadedFile.FileId!.Value));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
await _unitOfWork.SaveChangesAsync(cancellationToken);
|
||||
return OperationResult.Success();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public record CreateBugSectionCommand(Guid TaskId, string InitialDescription, long OriginalAssignedUserId, ProjectTaskPriority Priority, List<IFormFile> Files) : IBaseCommand;
|
||||
|
||||
@@ -3,6 +3,9 @@ using GozareshgirProgramManager.Application._Common.Models;
|
||||
using GozareshgirProgramManager.Domain._Common;
|
||||
using GozareshgirProgramManager.Domain._Common.Exceptions;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
using GozareshgirProgramManager.Application._Common.Models;
|
||||
using GozareshgirProgramManager.Domain._Common;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
||||
using MediatR;
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
using GozareshgirProgramManager.Application.Modules.Projects.DTOs;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
||||
|
||||
namespace GozareshgirProgramManager.Application.Modules.Projects.Commands.SetTimeProject;
|
||||
@@ -12,8 +14,8 @@ public record SetTimeProjectCommand(
|
||||
|
||||
public class SetTimeSectionTime
|
||||
{
|
||||
public Guid? Id { get; set; }
|
||||
public string Description { get; set; }
|
||||
public int Hours { get; set; }
|
||||
public int Minutes { get; set; }
|
||||
public TaskSectionAdditionalTimeType Type { get; set; }
|
||||
}
|
||||
@@ -4,6 +4,9 @@ using GozareshgirProgramManager.Application.Modules.Projects.DTOs;
|
||||
using GozareshgirProgramManager.Domain._Common;
|
||||
using GozareshgirProgramManager.Domain._Common.Exceptions;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
||||
using GozareshgirProgramManager.Domain.SkillAgg.Repositories;
|
||||
@@ -349,15 +352,6 @@ public class SetTimeProjectCommandHandler : IBaseCommandHandler<SetTimeProjectCo
|
||||
return OperationResult.Success();
|
||||
}
|
||||
|
||||
private void ValidateTotalTimeNotLessThanSpent(TimeSpan newTotalTime, TimeSpan currentTotalSpent)
|
||||
{
|
||||
if (newTotalTime < currentTotalSpent)
|
||||
{
|
||||
throw new BadRequestException(
|
||||
$"تایم کل سکشن نمیتواند کمتر از زمان مصرف شده ({currentTotalSpent.TotalHours:F2} ساعت) باشد");
|
||||
}
|
||||
}
|
||||
|
||||
private void SetSectionTime(TaskSection section, SetTimeProjectSkillItem sectionItem, long? addedByUserId)
|
||||
{
|
||||
var initData = sectionItem.InitData;
|
||||
@@ -372,62 +366,18 @@ public class SetTimeProjectCommandHandler : IBaseCommandHandler<SetTimeProjectCo
|
||||
// تنظیم زمان اولیه
|
||||
section.UpdateInitialEstimatedHours(initialTime, initData.Description);
|
||||
|
||||
// مدیریت هوشمند زمانهای اضافی
|
||||
var existingAdditionalTimes = section.AdditionalTimes.ToList();
|
||||
var incomingAdditionalTimes = sectionItem.AdditionalTime ?? [];
|
||||
|
||||
bool hasRealChange = false;
|
||||
|
||||
// حذف آیتمهایی که دیگر در لیست نیستند
|
||||
foreach (var existingTime in existingAdditionalTimes)
|
||||
section.ClearAdditionalTimes();
|
||||
// افزودن زمانهای اضافی
|
||||
bool hasAdditionalTime = false;
|
||||
foreach (var additionalTime in sectionItem.AdditionalTime)
|
||||
{
|
||||
var stillExists = incomingAdditionalTimes.Any(x => x.Id == existingTime.Id);
|
||||
if (!stillExists)
|
||||
{
|
||||
section.RemoveAdditionalTime(existingTime.Id);
|
||||
hasRealChange = true;
|
||||
}
|
||||
}
|
||||
|
||||
// ویرایش یا اضافه کردن آیتمهای جدید
|
||||
foreach (var additionalTime in incomingAdditionalTimes)
|
||||
{
|
||||
var additionalTimeSpan = TimeSpan.FromHours(additionalTime.Hours)
|
||||
.Add(TimeSpan.FromMinutes(additionalTime.Minutes));
|
||||
|
||||
if (additionalTimeSpan <= TimeSpan.Zero)
|
||||
continue;
|
||||
|
||||
var existingAdditionalTime = existingAdditionalTimes.FirstOrDefault(x => x.Id == additionalTime.Id);
|
||||
|
||||
if (existingAdditionalTime != null)
|
||||
{
|
||||
// اگر آیتم با این ID وجود دارد، بررسی کن اگر تغییر کرده باشد
|
||||
if (existingAdditionalTime.HasChanged(additionalTimeSpan, additionalTime.Description))
|
||||
{
|
||||
// ویرایش بدون حذف و ایجاد دوباره
|
||||
existingAdditionalTime.Update(additionalTimeSpan, additionalTime.Description);
|
||||
hasRealChange = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// اگر ID نداشت یا ID جدید بود، اضافه کن
|
||||
if (additionalTime.Id == null || additionalTime.Id == Guid.Empty)
|
||||
{
|
||||
section.AddAdditionalTime(additionalTimeSpan, additionalTime.Description, addedByUserId);
|
||||
hasRealChange = true;
|
||||
}
|
||||
}
|
||||
var additionalTimeSpan = TimeSpan.FromHours(additionalTime.Hours).Add(TimeSpan.FromMinutes(additionalTime.Minutes));
|
||||
section.AddAdditionalTime(additionalTimeSpan, additionalTime.Type, additionalTime.Description, addedByUserId);
|
||||
hasAdditionalTime = true;
|
||||
}
|
||||
|
||||
// اعتبارسنجی بعد از اعمال تمام تغییرات
|
||||
var currentTotalSpent = section.GetTotalTimeSpent();
|
||||
var newTotalTime = section.FinalEstimatedHours;
|
||||
ValidateTotalTimeNotLessThanSpent(newTotalTime, currentTotalSpent);
|
||||
|
||||
// تغییر status به Incomplete فقط اگر تغییری واقعی اعمال شده باشد و در وضعیتی غیر از ReadyToStart باشد
|
||||
if (hasRealChange && section.Status != TaskSectionStatus.ReadyToStart)
|
||||
// تغییر status به Incomplete فقط اگر زمان اضافی اضافه شده باشد و در وضعیتی غیر از ReadyToStart باشد
|
||||
if (hasAdditionalTime && section.Status != TaskSectionStatus.ReadyToStart)
|
||||
{
|
||||
// اگر سکشن درحال انجام است، باید متوقف شود قبل از تغییر status
|
||||
if (section.Status == TaskSectionStatus.InProgress)
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
using GozareshgirProgramManager.Application.Modules.Projects.DTOs;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||
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.Enums;
|
||||
|
||||
namespace GozareshgirProgramManager.Application.Modules.Projects.Extensions;
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
using GozareshgirProgramManager.Application._Common.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace GozareshgirProgramManager.Application.Modules.Projects.Queries.GetBugModalDetails;
|
||||
|
||||
public class GetBugModalDetailsQueryHandler : IBaseQueryHandler<GetBugModalDetailsQuery, GetBugModalDetailsResponse>
|
||||
{
|
||||
private readonly IProgramManagerDbContext _context;
|
||||
|
||||
public GetBugModalDetailsQueryHandler(IProgramManagerDbContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task<OperationResult<GetBugModalDetailsResponse>> Handle(GetBugModalDetailsQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
var projectTask =await _context.ProjectTasks.Include(ph=>ph.Phase).ThenInclude(p=>p.Project).FirstOrDefaultAsync(x=>x.Id == request.TaskId);
|
||||
if(projectTask == null)
|
||||
return OperationResult<GetBugModalDetailsResponse>.NotFound("بخش یافت نشد");
|
||||
|
||||
var response = new GetBugModalDetailsResponse(projectTask.Name,projectTask.Phase.Name, projectTask.Phase.Project.Name);
|
||||
return OperationResult<GetBugModalDetailsResponse>.Success(response);
|
||||
}
|
||||
}
|
||||
|
||||
public record GetBugModalDetailsQuery(Guid TaskId) : IBaseQuery<GetBugModalDetailsResponse>;
|
||||
|
||||
public record GetBugModalDetailsResponse(string TaskName, string PhaseName, string ProjectName);
|
||||
@@ -4,6 +4,10 @@ using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Linq;
|
||||
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;
|
||||
|
||||
namespace GozareshgirProgramManager.Application.Modules.Projects.Queries.GetProjectsList;
|
||||
|
||||
@@ -228,30 +232,28 @@ public class GetProjectsListQueryHandler : IBaseQueryHandler<GetProjectsListQuer
|
||||
// For projects: gather all phases, then tasks, then sections
|
||||
var phases = await _context.ProjectPhases
|
||||
.Where(ph => projectIds.Contains(ph.ProjectId))
|
||||
.Select(ph => new { ph.Id, ph.ProjectId })
|
||||
.Select(ph => ph.Id)
|
||||
.ToListAsync(cancellationToken);
|
||||
var phaseIds = phases.Select(ph => ph.Id).ToList();
|
||||
var tasks = await _context.ProjectTasks
|
||||
.Where(t => phaseIds.Contains(t.PhaseId))
|
||||
.Select(t => new { t.Id, t.PhaseId })
|
||||
.Where(t => phases.Contains(t.PhaseId))
|
||||
.Select(t => t.Id)
|
||||
.ToListAsync(cancellationToken);
|
||||
var taskIds = tasks.Select(t => t.Id).ToList();
|
||||
var sections = await _context.TaskSections
|
||||
.Include(s => s.Skill)
|
||||
.Where(s => taskIds.Contains(s.TaskId))
|
||||
.Where(s => tasks.Contains(s.TaskId))
|
||||
.ToListAsync(cancellationToken);
|
||||
|
||||
// Convert to tuple list for AggregatePhaseStatuses
|
||||
var tasksList = tasks.Select(t => (t.Id, t.PhaseId)).ToList();
|
||||
|
||||
foreach (var item in items)
|
||||
{
|
||||
var projectPhaseIds = phases.Where(ph => ph.ProjectId == item.Id).Select(ph => ph.Id).ToList();
|
||||
|
||||
// برای هر Skill، وضعیتهای تمام Phases را تجمیع کنیم
|
||||
item.Backend = AggregatePhaseStatuses(projectPhaseIds, tasksList, sections, "Backend");
|
||||
item.Front = AggregatePhaseStatuses(projectPhaseIds, tasksList, sections, "Frontend");
|
||||
item.Design = AggregatePhaseStatuses(projectPhaseIds, tasksList, sections, "UI/UX Design");
|
||||
var relatedPhases = phases; // used for filtering tasks by project
|
||||
var relatedTasks = await _context.ProjectTasks
|
||||
.Where(t => t.PhaseId != Guid.Empty && relatedPhases.Contains(t.PhaseId))
|
||||
.Select(t => t.Id)
|
||||
.ToListAsync(cancellationToken);
|
||||
var itemSections = sections.Where(s => relatedTasks.Contains(s.TaskId));
|
||||
item.Backend = GetAssignmentStatus(itemSections.FirstOrDefault(x => x.Skill?.Name == "Backend"));
|
||||
item.Front = GetAssignmentStatus(itemSections.FirstOrDefault(x => x.Skill?.Name == "Frontend"));
|
||||
item.Design = GetAssignmentStatus(itemSections.FirstOrDefault(x => x.Skill?.Name == "UI/UX Design"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -261,22 +263,24 @@ public class GetProjectsListQueryHandler : IBaseQueryHandler<GetProjectsListQuer
|
||||
// For phases: gather tasks, then sections
|
||||
var tasks = await _context.ProjectTasks
|
||||
.Where(t => phaseIds.Contains(t.PhaseId))
|
||||
.Select(t => new { t.Id, t.PhaseId })
|
||||
.Select(t => t.Id)
|
||||
.ToListAsync(cancellationToken);
|
||||
var taskIds = tasks.Select(t => t.Id).ToList();
|
||||
var sections = await _context.TaskSections
|
||||
.Include(s => s.Skill)
|
||||
.Where(s => taskIds.Contains(s.TaskId))
|
||||
.Where(s => tasks.Contains(s.TaskId))
|
||||
.ToListAsync(cancellationToken);
|
||||
|
||||
foreach (var item in items)
|
||||
{
|
||||
var phaseTaskIds = tasks.Where(t => t.PhaseId == item.Id).Select(t => t.Id).ToList();
|
||||
// Filter tasks for this phase
|
||||
var phaseTaskIds = await _context.ProjectTasks
|
||||
.Where(t => t.PhaseId == item.Id)
|
||||
.Select(t => t.Id)
|
||||
.ToListAsync(cancellationToken);
|
||||
var itemSections = sections.Where(s => phaseTaskIds.Contains(s.TaskId));
|
||||
|
||||
item.Backend = AggregateAssignmentStatus(itemSections.Where(x => x.Skill?.Name == "Backend"));
|
||||
item.Front = AggregateAssignmentStatus(itemSections.Where(x => x.Skill?.Name == "Frontend"));
|
||||
item.Design = AggregateAssignmentStatus(itemSections.Where(x => x.Skill?.Name == "UI/UX Design"));
|
||||
item.Backend = GetAssignmentStatus(itemSections.FirstOrDefault(x => x.Skill?.Name == "Backend"));
|
||||
item.Front = GetAssignmentStatus(itemSections.FirstOrDefault(x => x.Skill?.Name == "Frontend"));
|
||||
item.Design = GetAssignmentStatus(itemSections.FirstOrDefault(x => x.Skill?.Name == "UI/UX Design"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -380,57 +384,4 @@ public class GetProjectsListQueryHandler : IBaseQueryHandler<GetProjectsListQuer
|
||||
// تعیین تکلیف نشده: نه user دارد نه time
|
||||
return AssignmentStatus.Unassigned;
|
||||
}
|
||||
|
||||
private static AssignmentStatus AggregatePhaseStatuses(
|
||||
List<Guid> phaseIds,
|
||||
List<(Guid Id, Guid PhaseId)> tasks,
|
||||
List<TaskSection> sections,
|
||||
string skillName)
|
||||
{
|
||||
var phaseStatuses = new List<AssignmentStatus>();
|
||||
|
||||
foreach (var phaseId in phaseIds)
|
||||
{
|
||||
var phaseTaskIds = tasks.Where(t => t.PhaseId == phaseId).Select(t => t.Id).ToList();
|
||||
var phaseSections = sections.Where(s => phaseTaskIds.Contains(s.TaskId) && s.Skill?.Name == skillName);
|
||||
var phaseStatus = AggregateAssignmentStatus(phaseSections);
|
||||
phaseStatuses.Add(phaseStatus);
|
||||
}
|
||||
|
||||
// الآن تجمیع وضعیتهای Phases
|
||||
if (!phaseStatuses.Any())
|
||||
return AssignmentStatus.Unassigned;
|
||||
|
||||
// اگر هر یکی Unassigned باشد → Unassigned
|
||||
if (phaseStatuses.Any(s => s == AssignmentStatus.Unassigned))
|
||||
return AssignmentStatus.Unassigned;
|
||||
|
||||
// اگر Unassigned نیست و هر یکی UserOnly باشد → UserOnly
|
||||
if (phaseStatuses.Any(s => s == AssignmentStatus.UserOnly))
|
||||
return AssignmentStatus.UserOnly;
|
||||
|
||||
// فقط اگر همه Assigned باشند → Assigned
|
||||
return AssignmentStatus.Assigned;
|
||||
}
|
||||
|
||||
private static AssignmentStatus AggregateAssignmentStatus(IEnumerable<TaskSection> sections)
|
||||
{
|
||||
var sectionList = sections.ToList();
|
||||
if (!sectionList.Any())
|
||||
return AssignmentStatus.Unassigned;
|
||||
|
||||
var statuses = sectionList.Select(GetAssignmentStatus).ToList();
|
||||
|
||||
// اگر هر یکی Unassigned باشد → Unassigned (بدترین وضعیت)
|
||||
if (statuses.Any(s => s == AssignmentStatus.Unassigned))
|
||||
return AssignmentStatus.Unassigned;
|
||||
|
||||
// اگر Unassigned نیست و هر یکی UserOnly باشد → UserOnly (وضعیت متوسط)
|
||||
if (statuses.Any(s => s == AssignmentStatus.UserOnly))
|
||||
return AssignmentStatus.UserOnly;
|
||||
|
||||
// فقط اگر همه Assigned باشند → Assigned (بهترین وضعیت)
|
||||
return AssignmentStatus.Assigned;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,6 +3,7 @@ using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
using GozareshgirProgramManager.Application._Common.Models;
|
||||
using GozareshgirProgramManager.Application.Modules.Projects.Queries.GetProjectsList;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@ public record ProjectSetTimeResponseSkill
|
||||
|
||||
public class ProjectSetTimeResponseSectionAdditionalTime
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public int Hours { get; init; }
|
||||
public int Minutes { get; init; }
|
||||
public string Description { get; init; }
|
||||
|
||||
@@ -70,7 +70,6 @@ public class ProjectSetTimeDetailsQueryHandler
|
||||
AdditionalTimes = section?.AdditionalTimes
|
||||
.Select(x => new ProjectSetTimeResponseSectionAdditionalTime
|
||||
{
|
||||
Id = x.Id,
|
||||
Description = x.Reason ?? "",
|
||||
Hours = (int)x.Hours.TotalHours,
|
||||
Minutes = x.Hours.Minutes,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
using GozareshgirProgramManager.Application._Common.Models;
|
||||
using GozareshgirProgramManager.Application.Modules.TaskChat.DTOs;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
|
||||
using GozareshgirProgramManager.Domain.TaskChatAgg.Enums;
|
||||
using MediatR;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
@@ -28,7 +29,7 @@ public class GetMessagesQueryHandler : IBaseQueryHandler<GetMessagesQuery, Pagin
|
||||
}
|
||||
|
||||
private List<MessageDto> CreateAdditionalTimeNotes(
|
||||
IEnumerable<Domain.ProjectAgg.Entities.TaskSectionAdditionalTime> additionalTimes,
|
||||
IEnumerable<TaskSectionAdditionalTime> additionalTimes,
|
||||
Dictionary<long, string> users,
|
||||
Guid taskId)
|
||||
{
|
||||
|
||||
@@ -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<IFormFile> Files, Guid SectionId) : IBaseCommand;
|
||||
|
||||
public class CreateTaskSectionRevisionCommandHandler : IBaseCommandHandler<CreateTaskSectionRevisionCommand>
|
||||
{
|
||||
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<OperationResult> 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<MessageDto>.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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using FluentValidation;
|
||||
using Microsoft.EntityFrameworkCore.ChangeTracking;
|
||||
|
||||
namespace GozareshgirProgramManager.Application.Modules.TaskSectionRevision.Commands.CreateTaskSectionRevision;
|
||||
|
||||
public class CreateTaskSectionRevisionValidator:AbstractValidator<CreateTaskSectionRevisionCommand>
|
||||
{
|
||||
public CreateTaskSectionRevisionValidator()
|
||||
{
|
||||
RuleFor(x=>x.Message)
|
||||
.NotEmpty()
|
||||
.WithMessage("توضیحات اجباری است");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
using GozareshgirProgramManager.Application._Common.Models;
|
||||
using GozareshgirProgramManager.Domain._Common;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
||||
|
||||
namespace GozareshgirProgramManager.Application.Modules.TaskSectionRevision.Commands.SetStatusReviewedRevision;
|
||||
|
||||
public record SetStatusReviewedRevisionCommand(Guid TaskSectionId):IBaseCommand;
|
||||
|
||||
public class SetStatusReviewedRevisionCommandHandler : IBaseCommandHandler<SetStatusReviewedRevisionCommand>
|
||||
{
|
||||
private readonly ITaskSectionRevisionRepository _revisionRepository;
|
||||
private readonly IUnitOfWork _unitOfWork;
|
||||
|
||||
public SetStatusReviewedRevisionCommandHandler(ITaskSectionRevisionRepository revisionRepository, IUnitOfWork unitOfWork)
|
||||
{
|
||||
_revisionRepository = revisionRepository;
|
||||
_unitOfWork = unitOfWork;
|
||||
}
|
||||
|
||||
public async Task<OperationResult> Handle(SetStatusReviewedRevisionCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
var taskSectionRevisions = await _revisionRepository.GetByTaskSectionId(request.TaskSectionId);
|
||||
if (taskSectionRevisions == null || taskSectionRevisions.Count == 0)
|
||||
return OperationResult.NotFound("اصلاحی برای این بخش یافت نشد");
|
||||
|
||||
foreach (var revision in taskSectionRevisions)
|
||||
{
|
||||
revision.MarkReviewed();
|
||||
}
|
||||
|
||||
await _unitOfWork.SaveChangesAsync(cancellationToken);
|
||||
return OperationResult.Success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
using GozareshgirProgramManager.Application._Common.Models;
|
||||
using GozareshgirProgramManager.Domain._Common;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace GozareshgirProgramManager.Application.Modules.TaskSectionRevision.Queries.TaskRevisionsByTaskSectionId;
|
||||
|
||||
public record TaskRevisionsByTaskSectionIdQuery(Guid TaskSectionId)
|
||||
: IBaseQuery<TaskRevisionsByTaskSectionIdResponse>;
|
||||
|
||||
public class TaskRevisionsByTaskSectionIdQueryHandler : IBaseQueryHandler<TaskRevisionsByTaskSectionIdQuery,
|
||||
TaskRevisionsByTaskSectionIdResponse>
|
||||
{
|
||||
private readonly IProgramManagerDbContext _dbContext;
|
||||
|
||||
public TaskRevisionsByTaskSectionIdQueryHandler(IProgramManagerDbContext dbContext)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
}
|
||||
|
||||
public async Task<OperationResult<TaskRevisionsByTaskSectionIdResponse>> Handle(
|
||||
TaskRevisionsByTaskSectionIdQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
var taskSectionEntity = await _dbContext.TaskSections
|
||||
.Include(x=>x.Task)
|
||||
.ThenInclude(x => x.Phase)
|
||||
.ThenInclude(x => x.Project)
|
||||
.FirstOrDefaultAsync(x => x.Id == request.TaskSectionId,
|
||||
cancellationToken: cancellationToken);
|
||||
|
||||
if (taskSectionEntity == null)
|
||||
{
|
||||
return OperationResult<TaskRevisionsByTaskSectionIdResponse>.NotFound("بخش فرعی یافت نشد");
|
||||
}
|
||||
|
||||
var taskRevisions = await _dbContext.TaskSectionRevisions
|
||||
.Include(x => x.Files).Where(x => x.TaskSectionId == request.TaskSectionId)
|
||||
.ToListAsync(cancellationToken);
|
||||
if (taskRevisions.Count == 0)
|
||||
{
|
||||
return OperationResult<TaskRevisionsByTaskSectionIdResponse>.NotFound("اصلاحی یافت نشد");
|
||||
}
|
||||
|
||||
var skill = await _dbContext.Skills.FirstOrDefaultAsync(x => x.Id == taskSectionEntity.SkillId,
|
||||
cancellationToken: cancellationToken);
|
||||
|
||||
if (skill == null)
|
||||
return OperationResult<TaskRevisionsByTaskSectionIdResponse>.NotFound("مهارت مورد نظر یافت نشد");
|
||||
|
||||
|
||||
var user =await _dbContext.Users.FirstOrDefaultAsync(x => x.Id == taskSectionEntity.CurrentAssignedUserId,
|
||||
cancellationToken: cancellationToken);
|
||||
if (user == null)
|
||||
return OperationResult<TaskRevisionsByTaskSectionIdResponse>.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,$"{x.CreationDate.ToFarsi()} {x.CreationDate:HH:mm}");
|
||||
}).ToList();
|
||||
|
||||
var res = new TaskRevisionsByTaskSectionIdResponse(resItems, taskSectionEntity.Task.Phase.Project.Name,
|
||||
taskSectionEntity.Task.Phase.Name, taskSectionEntity.Task.Name,
|
||||
skill.Name,
|
||||
user.FullName
|
||||
);
|
||||
|
||||
return OperationResult<TaskRevisionsByTaskSectionIdResponse>.Success(res);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using GozareshgirProgramManager.Application._Common.Models;
|
||||
|
||||
namespace GozareshgirProgramManager.Application.Modules.TaskSectionRevision.Queries.TaskRevisionsByTaskSectionId;
|
||||
|
||||
public record TaskRevisionsByTaskSectionIdResponse(
|
||||
List<TaskRevisionsByTaskSectionIdItem> Items,
|
||||
string ProjectName,
|
||||
string PhaseName,
|
||||
string TaskName,
|
||||
string SkillName,
|
||||
string UserName);
|
||||
|
||||
|
||||
public record TaskRevisionsByTaskSectionIdItem(string Message, List<TaskRevisionsByTaskSectionIdItemFile> Files,string CreationDate);
|
||||
|
||||
public class TaskRevisionsByTaskSectionIdItemFile:UploadedFileDto;
|
||||
@@ -0,0 +1,56 @@
|
||||
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
using GozareshgirProgramManager.Application._Common.Models;
|
||||
using GozareshgirProgramManager.Domain._Common;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
||||
|
||||
namespace GozareshgirProgramManager.Application.Modules.TaskSectionTimeRequests.Commands.AcceptTimeRequest;
|
||||
|
||||
public record AcceptTimeRequestCommand(Guid TimeRequestId,
|
||||
Guid SectionId,TaskSectionAdditionalTimeType TimeType,int Hour,int Minute):IBaseCommand;
|
||||
|
||||
public class AcceptTimeRequestCommandHandler:IBaseCommandHandler<AcceptTimeRequestCommand>
|
||||
{
|
||||
private readonly ITaskSectionTimeRequestRepository _timeRequestRepository;
|
||||
private readonly ITaskSectionRepository _taskSectionRepository;
|
||||
private readonly IUnitOfWork _unitOfWork;
|
||||
public AcceptTimeRequestCommandHandler(ITaskSectionTimeRequestRepository timeRequestRepository, ITaskSectionRepository taskSectionRepository, IUnitOfWork unitOfWork)
|
||||
{
|
||||
_timeRequestRepository = timeRequestRepository;
|
||||
_taskSectionRepository = taskSectionRepository;
|
||||
_unitOfWork = unitOfWork;
|
||||
}
|
||||
|
||||
public async Task<OperationResult> Handle(AcceptTimeRequestCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
var timeRequest = await _timeRequestRepository.GetByIdAsync(request.TimeRequestId, cancellationToken);
|
||||
if (timeRequest == null)
|
||||
{
|
||||
return OperationResult.NotFound("درخواست زمان شما یافت نشد");
|
||||
}
|
||||
|
||||
var taskSection = await _taskSectionRepository.GetByIdAsync(request.SectionId, cancellationToken);
|
||||
|
||||
if (taskSection == null)
|
||||
{
|
||||
return OperationResult.NotFound("بخش فرعی وارد شده نامعتبر است");
|
||||
}
|
||||
if (timeRequest.RequestStatus == TaskSectionTimeRequestStatus.Accepted)
|
||||
{
|
||||
return OperationResult.Failure("این درخواست قبلا تایید شده است");
|
||||
}
|
||||
|
||||
// تایید درخواست زمان
|
||||
timeRequest.AcceptTimeRequest();
|
||||
|
||||
// اضافه کردن زمان به TaskSection
|
||||
var totalMinutes = (request.Hour * 60) + request.Minute;
|
||||
var additionalTime = TimeSpan.FromMinutes(totalMinutes);
|
||||
taskSection.AddAdditionalTime(additionalTime, request.TimeType, timeRequest.Description);
|
||||
|
||||
await _unitOfWork.SaveChangesAsync(cancellationToken);
|
||||
return OperationResult.Success();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using FluentValidation;
|
||||
|
||||
namespace GozareshgirProgramManager.Application.Modules.TaskSectionTimeRequests.Commands.AcceptTimeRequest;
|
||||
|
||||
public class AcceptTimeRequestCommandValidator : AbstractValidator<AcceptTimeRequestCommand>
|
||||
{
|
||||
public AcceptTimeRequestCommandValidator()
|
||||
{
|
||||
RuleFor(c => c.TimeRequestId)
|
||||
.NotEmpty().WithMessage("شناسه درخواست نمیتواند خالی باشد");
|
||||
|
||||
RuleFor(c => c.SectionId)
|
||||
.NotEmpty().WithMessage("شناسه بخش فرعی نمیتواند خالی باشد");
|
||||
|
||||
RuleFor(c => c.TimeType)
|
||||
.NotNull().WithMessage("نوع زمان درخواست شده نامعتبر است")
|
||||
.IsInEnum();
|
||||
|
||||
RuleFor(c => c.Hour)
|
||||
.InclusiveBetween(0, 100).WithMessage("ساعت وارد شده میتواند بین 0 تا 100 باشد");
|
||||
RuleFor(c => c.Minute)
|
||||
.InclusiveBetween(0, 60).WithMessage("دقیقه وارد شده میتواند بین 0 تا 60 باشد");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
using GozareshgirProgramManager.Application._Common.Models;
|
||||
using GozareshgirProgramManager.Domain._Common;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
||||
|
||||
namespace GozareshgirProgramManager.Application.Modules.TaskSectionTimeRequests.Commands.CreateTimeRequest;
|
||||
|
||||
public record CreateTimeRequestCommand(int Hours, int Minutes, string Description,
|
||||
TaskSectionTimeRequestType RequestType,Guid TaskSectionId) : IBaseCommand;
|
||||
|
||||
public class CreateTimeRequestCommandHandler : IBaseCommandHandler<CreateTimeRequestCommand>
|
||||
{
|
||||
private readonly IAuthHelper _authHelper;
|
||||
private readonly ITaskSectionTimeRequestRepository _timeRequestRepository;
|
||||
private readonly ITaskSectionRepository _taskSectionRepository;
|
||||
private readonly IUnitOfWork _unitOfWork;
|
||||
|
||||
public CreateTimeRequestCommandHandler
|
||||
(ITaskSectionTimeRequestRepository timeRequestRepository, IAuthHelper authHelper, IUnitOfWork unitOfWork, ITaskSectionRepository taskSectionRepository)
|
||||
{
|
||||
_timeRequestRepository = timeRequestRepository;
|
||||
_authHelper = authHelper;
|
||||
_unitOfWork = unitOfWork;
|
||||
_taskSectionRepository = taskSectionRepository;
|
||||
}
|
||||
|
||||
public async Task<OperationResult> Handle(CreateTimeRequestCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
var currentUser = _authHelper.GetCurrentUserId();
|
||||
if (!currentUser.HasValue)
|
||||
{
|
||||
return OperationResult.Unauthorized();
|
||||
}
|
||||
|
||||
if (!_taskSectionRepository.Exists(x=>x.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,
|
||||
request.RequestType,request.TaskSectionId);
|
||||
await _timeRequestRepository.CreateAsync(entity);
|
||||
await _unitOfWork.SaveChangesAsync(cancellationToken);
|
||||
return OperationResult.Success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using FluentValidation;
|
||||
|
||||
namespace GozareshgirProgramManager.Application.Modules.TaskSectionTimeRequests.Commands.CreateTimeRequest;
|
||||
|
||||
public class CreateTimeRequestValidator : AbstractValidator<CreateTimeRequestCommand>
|
||||
{
|
||||
public CreateTimeRequestValidator()
|
||||
{
|
||||
RuleFor(c => c.Hours)
|
||||
.InclusiveBetween(0, 100).WithMessage("ساعت درخواست شده باید کمتر از 100 ساعت باشد");
|
||||
|
||||
RuleFor(c => c.Minutes)
|
||||
.InclusiveBetween(0, 59)
|
||||
.WithMessage("دقیقه وارد شده باید بین 0 تا 60 باشد");
|
||||
|
||||
RuleFor(x => x.RequestType)
|
||||
.IsInEnum()
|
||||
.NotNull();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
using GozareshgirProgramManager.Application._Common.Extensions;
|
||||
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
using GozareshgirProgramManager.Application._Common.Models;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace GozareshgirProgramManager.Application.Modules.TaskSectionTimeRequests.Queries.CreateTimeRequestDetails;
|
||||
|
||||
public record CreateTimeRequestDetailsResponse(List<CreateTimeRequestDetailsRevision> Revisions);
|
||||
|
||||
public record CreateTimeRequestDetailsRevision(string Message, List<UploadedFileDto> Files);
|
||||
|
||||
public record CreateTimeRequestDetailsQuery(Guid TaskSectionId) : IBaseQuery<CreateTimeRequestDetailsResponse>;
|
||||
|
||||
public class
|
||||
CreateTimeRequestDetailsQueryHandler : IBaseQueryHandler<CreateTimeRequestDetailsQuery,
|
||||
CreateTimeRequestDetailsResponse>
|
||||
{
|
||||
private readonly IProgramManagerDbContext _context;
|
||||
|
||||
public CreateTimeRequestDetailsQueryHandler(IProgramManagerDbContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task<OperationResult<CreateTimeRequestDetailsResponse>> Handle(CreateTimeRequestDetailsQuery request,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
var revisions = await _context.TaskSectionRevisions.Where(x =>
|
||||
x.TaskSectionId == request.TaskSectionId && x.Status == RevisionReviewStatus.Pending).ToListAsync(cancellationToken: cancellationToken);
|
||||
|
||||
var fileIds = revisions.SelectMany(x => x.Files)
|
||||
.Select(x => x.Id).ToList();
|
||||
|
||||
var files =await _context.UploadedFiles
|
||||
.Where(x => fileIds.Contains(x.Id)).ToListAsync(cancellationToken: cancellationToken);
|
||||
|
||||
var resItem = revisions.Select(x =>
|
||||
{
|
||||
var selectFileIds = x.Files.Select(f => f.FileId).ToList();
|
||||
var filesDto = files.Where(f => selectFileIds.Contains(f.Id))
|
||||
.Select(f => f.ToDto()).ToList();
|
||||
return new CreateTimeRequestDetailsRevision(x.Message, filesDto);
|
||||
}).ToList();
|
||||
var res = new CreateTimeRequestDetailsResponse(resItem);
|
||||
|
||||
return OperationResult<CreateTimeRequestDetailsResponse>.Success(res);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
using GozareshgirProgramManager.Application.Modules.Workflows.Queries.WorkflowList;
|
||||
|
||||
namespace GozareshgirProgramManager.Application.Modules.Workflows.Queries.WorkflowList;
|
||||
|
||||
public interface IWorkflowProvider
|
||||
{
|
||||
WorkflowType Type { get; }
|
||||
Task<List<WorkflowListItem>> GetItems(long currentUserId, IProgramManagerDbContext context, CancellationToken cancellationToken);
|
||||
Task<int> GetCount(long currentUserId, IProgramManagerDbContext context, CancellationToken cancellationToken);
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace GozareshgirProgramManager.Application.Modules.Workflows.Queries.WorkflowList.Providers;
|
||||
|
||||
public class BugSectionWorkflowProvider : IWorkflowProvider
|
||||
{
|
||||
public WorkflowType Type => WorkflowType.BugSection;
|
||||
public async Task<List<WorkflowListItem>> GetItems(long currentUserId, IProgramManagerDbContext context, CancellationToken cancellationToken)
|
||||
{
|
||||
var bugs =context.BugSections
|
||||
.Where(b=>b.Status == TaskSectionStatus.ReadyToStart)
|
||||
.Include(x => x.ProjectTask).AsNoTracking();
|
||||
|
||||
return await bugs.Select(x => new WorkflowListItem
|
||||
{
|
||||
EntityId = x.Id,
|
||||
Title = x.ProjectTask.Name,
|
||||
Type = WorkflowType.BugSection
|
||||
}).ToListAsync(cancellationToken);
|
||||
|
||||
}
|
||||
|
||||
public async Task<int> GetCount(long currentUserId, IProgramManagerDbContext context, CancellationToken cancellationToken)
|
||||
{
|
||||
var query = context.BugSections
|
||||
.Where(b => b.Status == TaskSectionStatus.ReadyToStart);
|
||||
|
||||
return await query.CountAsync(cancellationToken);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace GozareshgirProgramManager.Application.Modules.Workflows.Queries.WorkflowList.Providers;
|
||||
|
||||
public class NotAssignedWorkflowProvider : IWorkflowProvider
|
||||
{
|
||||
public WorkflowType Type => WorkflowType.NotAssigned;
|
||||
|
||||
public async Task<List<WorkflowListItem>> GetItems(long currentUserId, IProgramManagerDbContext context, CancellationToken cancellationToken)
|
||||
{
|
||||
// Assuming 0 means unassigned in CurrentAssignedUserId
|
||||
var sections = await context.TaskSections
|
||||
.Where(x => x.CurrentAssignedUserId == 0)
|
||||
.ToListAsync(cancellationToken);
|
||||
|
||||
return sections.Select(ts => new WorkflowListItem
|
||||
{
|
||||
EntityId = ts.Id,
|
||||
Title = "تخصیص نیافته",
|
||||
Type = WorkflowType.NotAssigned
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
public async Task<int> GetCount(long currentUserId, IProgramManagerDbContext context, CancellationToken cancellationToken)
|
||||
{
|
||||
return await context.TaskSections
|
||||
.Where(x => x.CurrentAssignedUserId == 0)
|
||||
.CountAsync(cancellationToken);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace GozareshgirProgramManager.Application.Modules.Workflows.Queries.WorkflowList.Providers;
|
||||
|
||||
public class RejectedRevisionsWorkflowProvider : IWorkflowProvider
|
||||
{
|
||||
public WorkflowType Type => WorkflowType.Rejected;
|
||||
|
||||
public async Task<List<WorkflowListItem>> GetItems(long currentUserId, IProgramManagerDbContext context, CancellationToken cancellationToken)
|
||||
{
|
||||
var query = from revision in context.TaskSectionRevisions
|
||||
.Where(x => x.Status == RevisionReviewStatus.Pending)
|
||||
join taskSection in context.TaskSections
|
||||
on revision.TaskSectionId equals taskSection.Id
|
||||
where taskSection.CurrentAssignedUserId == currentUserId
|
||||
select taskSection;
|
||||
|
||||
var sections = await query.ToListAsync(cancellationToken);
|
||||
|
||||
return sections.Select(ts => new WorkflowListItem
|
||||
{
|
||||
EntityId = ts.Id,
|
||||
Title = "برگشت از سمت مدیر",
|
||||
Type = WorkflowType.Rejected
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
public async Task<int> GetCount(long currentUserId, IProgramManagerDbContext context, CancellationToken cancellationToken)
|
||||
{
|
||||
var query = from revision in context.TaskSectionRevisions
|
||||
.Where(x => x.Status == RevisionReviewStatus.Pending)
|
||||
join taskSection in context.TaskSections
|
||||
on revision.TaskSectionId equals taskSection.Id
|
||||
where taskSection.CurrentAssignedUserId == currentUserId
|
||||
select revision.Id;
|
||||
|
||||
return await query.CountAsync(cancellationToken);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
using GozareshgirProgramManager.Application._Common.Models;
|
||||
using GozareshgirProgramManager.Application.Modules.Workflows.Queries.WorkflowList.Providers;
|
||||
|
||||
namespace GozareshgirProgramManager.Application.Modules.Workflows.Queries.WorkflowList;
|
||||
|
||||
public record WorkflowCountResponse(int Total, int Rejected, int NotAssigned, int PendingForApproval);
|
||||
|
||||
public record WorkflowCountQuery() : IBaseQuery<WorkflowCountResponse>;
|
||||
|
||||
public class WorkflowCountQueryHandler : IBaseQueryHandler<WorkflowCountQuery, WorkflowCountResponse>
|
||||
{
|
||||
private readonly IProgramManagerDbContext _context;
|
||||
private readonly IAuthHelper _authHelper;
|
||||
private readonly IEnumerable<IWorkflowProvider> _providers;
|
||||
|
||||
public WorkflowCountQueryHandler(IProgramManagerDbContext context, IAuthHelper authHelper, IEnumerable<IWorkflowProvider> providers)
|
||||
{
|
||||
_context = context;
|
||||
_authHelper = authHelper;
|
||||
_providers = providers;
|
||||
}
|
||||
|
||||
public async Task<OperationResult<WorkflowCountResponse>> Handle(WorkflowCountQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
long currentUserId = _authHelper.GetCurrentUserId()!.Value;
|
||||
|
||||
int rejectedCount = 0;
|
||||
int notAssignedCount = 0;
|
||||
int pendingForApprovalCount = 0;
|
||||
|
||||
foreach (var provider in _providers)
|
||||
{
|
||||
var count = await provider.GetCount(currentUserId, _context, cancellationToken);
|
||||
switch (provider.Type)
|
||||
{
|
||||
case WorkflowType.Rejected:
|
||||
rejectedCount += count; break;
|
||||
case WorkflowType.NotAssigned:
|
||||
notAssignedCount += count; break;
|
||||
case WorkflowType.PendingForApproval:
|
||||
pendingForApprovalCount += count; break;
|
||||
}
|
||||
}
|
||||
|
||||
var total = rejectedCount + notAssignedCount + pendingForApprovalCount;
|
||||
var response = new WorkflowCountResponse(total, rejectedCount, notAssignedCount, pendingForApprovalCount);
|
||||
return OperationResult<WorkflowCountResponse>.Success(response);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
using GozareshgirProgramManager.Application._Common.Models;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
|
||||
using GozareshgirProgramManager.Application.Modules.Workflows.Queries.WorkflowList.Providers;
|
||||
|
||||
namespace GozareshgirProgramManager.Application.Modules.Workflows.Queries.WorkflowList;
|
||||
|
||||
public record WorkflowListResponse(List<WorkflowListItem>Items);
|
||||
|
||||
public class WorkflowListItem
|
||||
{
|
||||
public string Title { get; set; }
|
||||
public WorkflowType Type { get; set; }
|
||||
public Guid EntityId { get; set; }
|
||||
}
|
||||
|
||||
public enum WorkflowType
|
||||
{
|
||||
Rejected,
|
||||
NotAssigned,
|
||||
PendingForApproval,
|
||||
BugSection,
|
||||
}
|
||||
|
||||
public record WorkflowListQuery():IBaseQuery<WorkflowListResponse>;
|
||||
|
||||
public class WorkflowListQueryHandler:IBaseQueryHandler<WorkflowListQuery,WorkflowListResponse>
|
||||
{
|
||||
private readonly IProgramManagerDbContext _context;
|
||||
private readonly IAuthHelper _authHelper;
|
||||
private readonly IEnumerable<IWorkflowProvider> _providers;
|
||||
|
||||
public WorkflowListQueryHandler(IProgramManagerDbContext context,
|
||||
IAuthHelper authHelper,
|
||||
IEnumerable<IWorkflowProvider> providers)
|
||||
{
|
||||
_context = context;
|
||||
_authHelper = authHelper;
|
||||
_providers = providers;
|
||||
}
|
||||
|
||||
public async Task<OperationResult<WorkflowListResponse>> Handle(WorkflowListQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
var currentUserId = _authHelper.GetCurrentUserId()!.Value;
|
||||
var items = new List<WorkflowListItem>();
|
||||
var response = new WorkflowListResponse(items);
|
||||
foreach (var provider in _providers)
|
||||
{
|
||||
var providerItems = await provider.GetItems(currentUserId, _context, cancellationToken);
|
||||
if (providerItems?.Count > 0)
|
||||
items.AddRange(providerItems);
|
||||
}
|
||||
|
||||
return OperationResult<WorkflowListResponse>.Success(response);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using GozareshgirProgramManager.Application._Common.Models;
|
||||
using GozareshgirProgramManager.Domain.FileManagementAgg.Entities;
|
||||
|
||||
namespace GozareshgirProgramManager.Application._Common.Extensions;
|
||||
|
||||
public static class FileExtensions
|
||||
{
|
||||
public static UploadedFileDto ToDto(this UploadedFile file)
|
||||
{
|
||||
return new UploadedFileDto()
|
||||
{
|
||||
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
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,10 @@ using GozareshgirProgramManager.Domain.UserAgg.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using GozareshgirProgramManager.Domain.TaskChatAgg.Entities;
|
||||
using GozareshgirProgramManager.Domain.FileManagementAgg.Entities;
|
||||
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;
|
||||
|
||||
namespace GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
|
||||
@@ -25,12 +29,18 @@ public interface IProgramManagerDbContext
|
||||
DbSet<TaskSection> TaskSections { get; set; }
|
||||
DbSet<ProjectSection> ProjectSections { get; set; }
|
||||
DbSet<PhaseSection> PhaseSections { get; set; }
|
||||
|
||||
DbSet<BugSection> BugSections { get; set; }
|
||||
DbSet<ProjectTask> ProjectTasks { get; set; }
|
||||
|
||||
DbSet<TaskChatMessage> TaskChatMessages { get; set; }
|
||||
DbSet<UploadedFile> UploadedFiles { get; set; }
|
||||
|
||||
//Task Section Time Request
|
||||
DbSet<TaskSectionTimeRequest> TaskSectionTimeRequests { get; set; }
|
||||
|
||||
// Task Section Revision
|
||||
DbSet<TaskSectionRevision> TaskSectionRevisions { get; set; }
|
||||
|
||||
DbSet<Skill> Skills { get; set; }
|
||||
Task<int> SaveChangesAsync(CancellationToken cancellationToken = default);
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ public class OperationResult
|
||||
|
||||
// Helper methods for specific error types
|
||||
public static OperationResult NotFound(string errorMessage) => new(false, errorMessage, errorType: ErrorType.NotFound);
|
||||
public static OperationResult Unauthorized(string errorMessage) => new(false, errorMessage, errorType: ErrorType.Unauthorized);
|
||||
public static OperationResult Unauthorized(string errorMessage="احراز هویت شما منقضی شده است. لطفا دوباره وارد شوید") => new(false, errorMessage, errorType: ErrorType.Unauthorized);
|
||||
public static OperationResult ValidationError(string errorMessage) => new(false, errorMessage, errorType: ErrorType.Validation);
|
||||
public static OperationResult ValidationError(List<string> errors) => new(false, errors: errors, errorType: ErrorType.Validation);
|
||||
public static OperationResult InternalServerError(string errorMessage) => new(false, errorMessage, errorType: ErrorType.InternalServerError);
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
namespace GozareshgirProgramManager.Application._Common.Models;
|
||||
|
||||
public class UploadedFileDto
|
||||
{
|
||||
|
||||
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";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,8 @@ public enum FileCategory
|
||||
ProjectDocument = 3, // مستندات پروژه
|
||||
UserProfilePhoto = 4, // عکس پروفایل کاربر
|
||||
Report = 5, // گزارش
|
||||
Other = 6 // سایر
|
||||
Other = 6, // سایر
|
||||
BugSection = 7, // تسک باگ
|
||||
TaskSectionRevision
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||
|
||||
public class BugDocument
|
||||
{
|
||||
|
||||
public BugDocument(Guid fileId)
|
||||
{
|
||||
FileId = fileId;
|
||||
}
|
||||
private BugDocument() { } // EF
|
||||
public Guid Id { get; private set; }
|
||||
public Guid FileId { get; private set; }
|
||||
public BugSection BugSection { get; private set; }
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
using GozareshgirProgramManager.Domain._Common;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
||||
|
||||
namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||
|
||||
public class BugSection : EntityBase<Guid>
|
||||
{
|
||||
public BugSection(Guid taskId, string initialDescription, long originalAssignedUserId, ProjectTaskPriority priority)
|
||||
{
|
||||
TaskId = taskId;
|
||||
InitialDescription = initialDescription;
|
||||
Status = TaskSectionStatus.ReadyToStart;
|
||||
OriginalAssignedUserId = originalAssignedUserId;
|
||||
Priority = priority;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// برای EF Core
|
||||
private BugSection()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// آی دی تسک - بخش فرعی
|
||||
/// </summary>
|
||||
public Guid TaskId { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// توضیحات مدیر
|
||||
/// </summary>
|
||||
public string InitialDescription { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// وضعیت باگ گزارش شده
|
||||
/// </summary>
|
||||
public TaskSectionStatus Status { get; private set; }
|
||||
|
||||
|
||||
// شخصی که برای اولین بار این بخش به او اختصاص داده شده (مالک اصلی)
|
||||
public long OriginalAssignedUserId { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// اولویت رسیدگی
|
||||
/// </summary>
|
||||
public ProjectTaskPriority Priority { get; private set; }
|
||||
|
||||
// Navigation to ProjectTask (must be Task level)
|
||||
public ProjectTask ProjectTask { get; private set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// لیست مدارک و فایلها
|
||||
/// </summary>
|
||||
public List<BugDocument> BugDocuments { get; private set; } = new();
|
||||
|
||||
public void AddDocument(BugDocument document)
|
||||
{
|
||||
BugDocuments.Add(document);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
using GozareshgirProgramManager.Domain._Common;
|
||||
using GozareshgirProgramManager.Domain.SkillAgg.Entities;
|
||||
|
||||
namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||
namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase;
|
||||
|
||||
/// <summary>
|
||||
/// بخش فاز - برای ذخیره تخصیص کاربر و مهارت در سطح Phase
|
||||
@@ -1,8 +1,9 @@
|
||||
using GozareshgirProgramManager.Domain._Common;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Events;
|
||||
|
||||
namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||
namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase;
|
||||
|
||||
/// <summary>
|
||||
/// فاز پروژه - سطح میانی در سلسله مراتب
|
||||
@@ -28,7 +29,7 @@ public class ProjectPhase : ProjectHierarchyNode
|
||||
}
|
||||
|
||||
public Guid ProjectId { get; private set; }
|
||||
public Project Project { get; private set; } = null!;
|
||||
public Project.Project Project { get; private set; } = null!;
|
||||
public IReadOnlyList<ProjectTask> Tasks => _tasks.AsReadOnly();
|
||||
public IReadOnlyList<PhaseSection> PhaseSections => _phaseSections.AsReadOnly();
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using GozareshgirProgramManager.Domain._Common;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Events;
|
||||
|
||||
namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||
namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project;
|
||||
|
||||
/// <summary>
|
||||
/// پروژه - بالاترین سطح در سلسله مراتب و Aggregate Root
|
||||
@@ -1,7 +1,7 @@
|
||||
using GozareshgirProgramManager.Domain._Common;
|
||||
using GozareshgirProgramManager.Domain.SkillAgg.Entities;
|
||||
|
||||
namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||
namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project;
|
||||
|
||||
/// <summary>
|
||||
/// ProjectSection: shortcut container for UserId + SkillId at Project level
|
||||
@@ -1,32 +1,34 @@
|
||||
using GozareshgirProgramManager.Domain._Common;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Events;
|
||||
|
||||
namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||
namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task;
|
||||
|
||||
/// <summary>
|
||||
/// تسک - پایینترین سطح در سلسله مراتب که شامل بخشها میشود
|
||||
/// </summary>
|
||||
public class ProjectTask : ProjectHierarchyNode
|
||||
{
|
||||
private readonly List<TaskSection> _sections;
|
||||
private readonly List<TaskSection.TaskSection> _sections;
|
||||
|
||||
private ProjectTask()
|
||||
{
|
||||
_sections = new List<TaskSection>();
|
||||
_sections = new List<TaskSection.TaskSection>();
|
||||
}
|
||||
|
||||
public ProjectTask(string name, Guid phaseId,ProjectTaskPriority priority, string? description = null) : base(name, description)
|
||||
{
|
||||
PhaseId = phaseId;
|
||||
_sections = new List<TaskSection>();
|
||||
_sections = new List<TaskSection.TaskSection>();
|
||||
BugSectionList = new List<BugSection>();
|
||||
Priority = priority;
|
||||
AddDomainEvent(new TaskCreatedEvent(Id, phaseId, name));
|
||||
}
|
||||
|
||||
public Guid PhaseId { get; private set; }
|
||||
public ProjectPhase Phase { get; private set; } = null!;
|
||||
public IReadOnlyList<TaskSection> Sections => _sections.AsReadOnly();
|
||||
public IReadOnlyList<TaskSection.TaskSection> Sections => _sections.AsReadOnly();
|
||||
public List<BugSection> BugSectionList { get; set; }
|
||||
|
||||
// Task-specific properties
|
||||
public Enums.TaskStatus Status { get; private set; } = Enums.TaskStatus.NotStarted;
|
||||
@@ -40,7 +42,7 @@ public class ProjectTask : ProjectHierarchyNode
|
||||
|
||||
#region Section Management
|
||||
|
||||
public void AddSection(TaskSection section, bool cascadeToChildren = false)
|
||||
public void AddSection(TaskSection.TaskSection section, bool cascadeToChildren = false)
|
||||
{
|
||||
var existingSection = _sections.FirstOrDefault(s => s.SkillId == section.SkillId);
|
||||
if (existingSection != null)
|
||||
@@ -84,7 +86,7 @@ public class ProjectTask : ProjectHierarchyNode
|
||||
return;
|
||||
}
|
||||
|
||||
var section = new TaskSection(Id, skillId, assignedUserId);
|
||||
var section = new TaskSection.TaskSection(Id, skillId, assignedUserId);
|
||||
_sections.Add(section);
|
||||
AddDomainEvent(new TaskSectionAddedEvent(Id, section.Id, skillId));
|
||||
}
|
||||
@@ -204,12 +206,12 @@ public class ProjectTask : ProjectHierarchyNode
|
||||
|
||||
#region Query Helpers
|
||||
|
||||
public IEnumerable<TaskSection> GetSectionsBySkill(Guid skillId)
|
||||
public IEnumerable<TaskSection.TaskSection> GetSectionsBySkill(Guid skillId)
|
||||
{
|
||||
return _sections.Where(s => s.SkillId == skillId);
|
||||
}
|
||||
|
||||
public TaskSection? GetSectionBySkill(Guid skillId)
|
||||
public TaskSection.TaskSection? GetSectionBySkill(Guid skillId)
|
||||
{
|
||||
return _sections.FirstOrDefault(s => s.SkillId == skillId);
|
||||
}
|
||||
@@ -219,7 +221,7 @@ public class ProjectTask : ProjectHierarchyNode
|
||||
return _sections.Any(s => s.SkillId == skillId);
|
||||
}
|
||||
|
||||
public IEnumerable<TaskSection> GetAssignedSections(long userId)
|
||||
public IEnumerable<TaskSection.TaskSection> GetAssignedSections(long userId)
|
||||
{
|
||||
return _sections.Where(s => s.CurrentAssignedUserId == userId);
|
||||
}
|
||||
@@ -1,12 +1,10 @@
|
||||
using System.Linq;
|
||||
using GozareshgirProgramManager.Domain._Common;
|
||||
using GozareshgirProgramManager.Domain._Common;
|
||||
using GozareshgirProgramManager.Domain._Common.Exceptions;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Events;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Models;
|
||||
using GozareshgirProgramManager.Domain.SkillAgg.Entities;
|
||||
|
||||
namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||
namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
|
||||
|
||||
/// <summary>
|
||||
/// بخش تسک - برای ذخیره کار واقعی که کاربر روی یک مهارت خاص انجام میدهد
|
||||
@@ -61,12 +59,13 @@ public class TaskSection : EntityBase<Guid>
|
||||
// برای backward compatibility
|
||||
public TimeSpan EstimatedHours => FinalEstimatedHours;
|
||||
|
||||
public void AddAdditionalTime(TimeSpan additionalHours, string? reason = null, long? addedByUserId = null)
|
||||
public void AddAdditionalTime(TimeSpan additionalHours, TaskSectionAdditionalTimeType type, string? reason = null,
|
||||
long? addedByUserId = null)
|
||||
{
|
||||
if (additionalHours <= TimeSpan.Zero)
|
||||
throw new BadRequestException("تایم اضافی باید بزرگتر از صفر باشد", nameof(additionalHours));
|
||||
|
||||
var additionalTime = new TaskSectionAdditionalTime(additionalHours, reason, addedByUserId);
|
||||
var additionalTime = new TaskSectionAdditionalTime(additionalHours,type, reason, addedByUserId);
|
||||
_additionalTimes.Add(additionalTime);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using GozareshgirProgramManager.Domain._Common;
|
||||
|
||||
namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||
namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
|
||||
|
||||
/// <summary>
|
||||
/// فعالیت کاری روی یک بخش
|
||||
@@ -1,6 +1,6 @@
|
||||
using GozareshgirProgramManager.Domain._Common;
|
||||
|
||||
namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||
namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
|
||||
|
||||
/// <summary>
|
||||
/// زمان اضافی اضافه شده بعد از تخمین اولیه
|
||||
@@ -9,12 +9,13 @@ public class TaskSectionAdditionalTime : EntityBase<Guid>
|
||||
{
|
||||
private TaskSectionAdditionalTime() { }
|
||||
|
||||
public TaskSectionAdditionalTime(TimeSpan hours, string? reason = null, long? addedByUserId = null)
|
||||
public TaskSectionAdditionalTime(TimeSpan hours, TaskSectionAdditionalTimeType type, string? reason = null,long? addedByUserId = null)
|
||||
{
|
||||
Hours = hours;
|
||||
Reason = reason;
|
||||
AddedByUserId = addedByUserId;
|
||||
AddedAt = DateTime.UtcNow;
|
||||
AddedAt = DateTime.Now;
|
||||
Type = type;
|
||||
}
|
||||
|
||||
public TimeSpan Hours { get; private set; }
|
||||
@@ -22,19 +23,15 @@ public class TaskSectionAdditionalTime : EntityBase<Guid>
|
||||
public long? AddedByUserId { get; private set; }
|
||||
public DateTime AddedAt { get; private set; }
|
||||
|
||||
public TaskSectionAdditionalTimeType Type { get; set; }
|
||||
public void UpdateReason(string? reason)
|
||||
{
|
||||
Reason = reason;
|
||||
}
|
||||
|
||||
public void Update(TimeSpan hours, string? reason = null)
|
||||
{
|
||||
Hours = hours;
|
||||
Reason = reason;
|
||||
}
|
||||
|
||||
public bool HasChanged(TimeSpan newHours, string? newReason)
|
||||
{
|
||||
return Hours != newHours || Reason != newReason;
|
||||
}
|
||||
}
|
||||
|
||||
public enum TaskSectionAdditionalTimeType
|
||||
{
|
||||
Effective,
|
||||
Ineffective,
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
using GozareshgirProgramManager.Domain._Common;
|
||||
using GozareshgirProgramManager.Domain.FileManagementAgg.Entities;
|
||||
|
||||
namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
|
||||
|
||||
public class TaskSectionRevision : EntityBase<Guid>
|
||||
{
|
||||
public TaskSectionRevision(Guid taskSectionId,
|
||||
string message, long createdByUserId)
|
||||
{
|
||||
TaskSectionId = taskSectionId;
|
||||
Status = RevisionReviewStatus.Pending;
|
||||
Message = message;
|
||||
CreatedByUserId = createdByUserId;
|
||||
}
|
||||
|
||||
public Guid TaskSectionId { get; private set; }
|
||||
|
||||
public RevisionReviewStatus Status { get; private set; }
|
||||
|
||||
|
||||
public string Message { get; private set; }
|
||||
|
||||
public long CreatedByUserId { get; private set; }
|
||||
|
||||
public IReadOnlyCollection<TaskRevisionFile> Files => _files;
|
||||
private readonly List<TaskRevisionFile> _files = new();
|
||||
|
||||
public void AddFile(TaskRevisionFile file)
|
||||
{
|
||||
_files.Add(file);
|
||||
}
|
||||
|
||||
public void MarkReviewed()
|
||||
{
|
||||
if (Status == RevisionReviewStatus.Reviewed)
|
||||
return;
|
||||
Status = RevisionReviewStatus.Reviewed;
|
||||
}
|
||||
|
||||
}
|
||||
public class TaskRevisionFile: EntityBase<Guid>
|
||||
{
|
||||
public TaskRevisionFile(Guid fileId)
|
||||
{
|
||||
FileId = fileId;
|
||||
}
|
||||
|
||||
public Guid FileId { get; private set; }
|
||||
}
|
||||
|
||||
public enum RevisionReviewStatus : short
|
||||
{
|
||||
Pending = 1,
|
||||
Reviewed = 2
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using GozareshgirProgramManager.Domain._Common;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
||||
|
||||
namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
|
||||
|
||||
public class TaskSectionTimeRequest:EntityBase<Guid>
|
||||
{
|
||||
|
||||
public TaskSectionTimeRequest(long userId, string description,
|
||||
TimeSpan requestedTime, TaskSectionTimeRequestType requestType,
|
||||
Guid taskSectionId)
|
||||
{
|
||||
UserId = userId;
|
||||
Description = description;
|
||||
RequestedTime = requestedTime;
|
||||
RequestType = requestType;
|
||||
TaskSectionId = taskSectionId;
|
||||
RequestStatus = TaskSectionTimeRequestStatus.Pending;
|
||||
}
|
||||
|
||||
public TaskSection TaskSection { get; set; }
|
||||
public Guid TaskSectionId { get; set; }
|
||||
public long UserId { get; private set; }
|
||||
public string Description { get; private set; }
|
||||
public TimeSpan RequestedTime { get; private set; }
|
||||
public TaskSectionTimeRequestType RequestType { get; private set; }
|
||||
public TaskSectionTimeRequestStatus RequestStatus { get; private set; }
|
||||
|
||||
public void AcceptTimeRequest()
|
||||
{
|
||||
RequestStatus = TaskSectionTimeRequestStatus.Accepted;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
||||
|
||||
public enum TaskSectionTimeRequestStatus
|
||||
{
|
||||
Pending,
|
||||
Accepted,
|
||||
Rejected
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
||||
|
||||
public enum TaskSectionTimeRequestType
|
||||
{
|
||||
InitialTime,
|
||||
AdditionalTime,
|
||||
RejectedTime,
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using GozareshgirProgramManager.Domain._Common;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||
|
||||
namespace GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
||||
|
||||
public interface IBugSectionRepository : IRepository<Guid,BugSection>
|
||||
{
|
||||
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||
using GozareshgirProgramManager.Domain._Common;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase;
|
||||
|
||||
namespace GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
||||
public interface IPhaseSectionRepository : IRepository<Guid, PhaseSection>
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using GozareshgirProgramManager.Domain._Common;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase;
|
||||
|
||||
namespace GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using GozareshgirProgramManager.Domain._Common;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project;
|
||||
|
||||
namespace GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using GozareshgirProgramManager.Domain._Common;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project;
|
||||
|
||||
namespace GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using GozareshgirProgramManager.Domain._Common;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task;
|
||||
|
||||
namespace GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using GozareshgirProgramManager.Domain._Common;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
|
||||
|
||||
namespace GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Collections;
|
||||
using GozareshgirProgramManager.Domain._Common;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
|
||||
|
||||
namespace GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
using GozareshgirProgramManager.Domain._Common;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
|
||||
|
||||
namespace GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
||||
|
||||
public interface ITaskSectionRevisionRepository:IRepository<Guid,TaskSectionRevision>
|
||||
{
|
||||
Task<List<TaskSectionRevision>> GetByTaskSectionId(Guid requestTaskSectionId);
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using GozareshgirProgramManager.Domain._Common;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
|
||||
|
||||
namespace GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
||||
|
||||
public interface ITaskSectionTimeRequestRepository:IRepository<Guid,TaskSectionTimeRequest>
|
||||
{
|
||||
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using GozareshgirProgramManager.Domain._Common;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
|
||||
|
||||
namespace GozareshgirProgramManager.Domain.SkillAgg.Entities;
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
public class UnAuthorizedException:Exception
|
||||
{
|
||||
public UnAuthorizedException(string message) : base(message)
|
||||
public UnAuthorizedException(string message="احراز هویت شما منقضی شده است. لطفا دوباره وارد شوید") : base(message)
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,3 @@
|
||||
|
||||
|
||||
|
||||
using FluentValidation;
|
||||
using GozareshgirProgramManager.Application._Common.Behaviors;
|
||||
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||
using GozareshgirProgramManager.Application.Services.FileManagement;
|
||||
@@ -11,10 +7,7 @@ using GozareshgirProgramManager.Domain.CustomerAgg.Repositories;
|
||||
using GozareshgirProgramManager.Domain.FileManagementAgg.Repositories;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
||||
using GozareshgirProgramManager.Domain.RoleAgg.Repositories;
|
||||
using GozareshgirProgramManager.Domain.RoleAgg.Repositories;
|
||||
using GozareshgirProgramManager.Domain.SalaryPaymentSettingAgg.Repositories;
|
||||
using GozareshgirProgramManager.Domain.SalaryPaymentSettingAgg.Repositories;
|
||||
using GozareshgirProgramManager.Domain.SkillAgg.Repositories;
|
||||
using GozareshgirProgramManager.Domain.SkillAgg.Repositories;
|
||||
using GozareshgirProgramManager.Domain.TaskChatAgg.Repositories;
|
||||
using GozareshgirProgramManager.Domain.UserAgg.Repositories;
|
||||
@@ -32,6 +25,9 @@ using Shared.Contracts.PmRole.Commands;
|
||||
using Shared.Contracts.PmRole.Queries;
|
||||
using Shared.Contracts.PmUser.Commands;
|
||||
using Shared.Contracts.PmUser.Queries;
|
||||
using System.Reflection;
|
||||
using GozareshgirProgramManager.Application.Modules.Workflows.Queries.WorkflowList;
|
||||
using GozareshgirProgramManager.Application.Modules.Workflows.Queries.WorkflowList.Providers;
|
||||
|
||||
namespace GozareshgirProgramManager.Infrastructure;
|
||||
|
||||
@@ -80,7 +76,8 @@ public static class DependencyInjection
|
||||
services.AddScoped<ITaskSectionActivityRepository, TaskSectionActivityRepository>();
|
||||
services.AddScoped<IPhaseSectionRepository, PhaseSectionRepository>();
|
||||
services.AddScoped<IProjectSectionRepository, ProjectSectionRepository>();
|
||||
|
||||
services.AddScoped<IBugSectionRepository, BugSectionRepository>();
|
||||
|
||||
services.AddScoped<ISkillRepository, SkillRepository>();
|
||||
|
||||
services.AddScoped<IUserRefreshTokenRepository, UserRefreshTokenRepository>();
|
||||
@@ -101,7 +98,12 @@ public static class DependencyInjection
|
||||
services.AddScoped<JwtTokenGenerator>();
|
||||
services.AddScoped<IAuthHelper, AuthHelper>();
|
||||
|
||||
|
||||
//TaskSection Time Request
|
||||
services.AddScoped<ITaskSectionTimeRequestRepository, TaskSectionTimeRequestRepository>();
|
||||
|
||||
//TaskSection Revision
|
||||
services.AddScoped<ITaskSectionRevisionRepository, TaskSectionRevisionRepository>();
|
||||
|
||||
#region ServicesInjection
|
||||
|
||||
@@ -117,6 +119,16 @@ public static class DependencyInjection
|
||||
// MediatR Validation Behavior
|
||||
services.AddTransient(typeof(IPipelineBehavior<,>), typeof(ValidationBehavior<,>));
|
||||
|
||||
// Workflow providers: auto-register all IWorkflowProvider implementations in the Application assembly
|
||||
var appAssembly = typeof(IWorkflowProvider).Assembly;
|
||||
var providerTypes = appAssembly
|
||||
.GetTypes()
|
||||
.Where(t => !t.IsAbstract && !t.IsInterface && typeof(IWorkflowProvider).IsAssignableFrom(t))
|
||||
.ToList();
|
||||
foreach (var providerType in providerTypes)
|
||||
{
|
||||
services.AddScoped(typeof(IWorkflowProvider), providerType);
|
||||
}
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,121 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace GozareshgirProgramManager.Infrastructure.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddtimeRequestandTasksectionrevision : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "Type",
|
||||
table: "TaskSectionAdditionalTimes",
|
||||
type: "nvarchar(50)",
|
||||
maxLength: 50,
|
||||
nullable: false,
|
||||
defaultValue: "");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "TaskSectionRevisions",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
TaskSectionId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
Status = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
|
||||
Message = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: false),
|
||||
CreatedByUserId = table.Column<long>(type: "bigint", nullable: false),
|
||||
CreationDate = table.Column<DateTime>(type: "datetime2", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_TaskSectionRevisions", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "TaskSectionTimeRequests",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
TaskSectionId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
UserId = table.Column<long>(type: "bigint", nullable: false),
|
||||
Description = table.Column<string>(type: "nvarchar(1200)", maxLength: 1200, nullable: false),
|
||||
RequestedTime = table.Column<string>(type: "nvarchar(30)", maxLength: 30, nullable: false),
|
||||
RequestType = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
|
||||
RequestStatus = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
|
||||
CreationDate = table.Column<DateTime>(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<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
FileId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
TaskSectionRevisionId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
CreationDate = table.Column<DateTime>(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");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "TaskRevisionFile");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "TaskSectionTimeRequests");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "TaskSectionRevisions");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Type",
|
||||
table: "TaskSectionAdditionalTimes");
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,77 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace GozareshgirProgramManager.Infrastructure.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class BugSectionInit : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "BugSections",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
TaskId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
InitialDescription = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
|
||||
Status = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
|
||||
OriginalAssignedUserId = table.Column<long>(type: "bigint", nullable: false),
|
||||
Priority = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
|
||||
CreationDate = table.Column<DateTime>(type: "datetime2", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_BugSections", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_BugSections_ProjectTasks_TaskId",
|
||||
column: x => x.TaskId,
|
||||
principalTable: "ProjectTasks",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "BugDocuments",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
FileId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
BugSectionId = table.Column<Guid>(type: "uniqueidentifier", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_BugDocuments", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_BugDocuments_BugSections_BugSectionId",
|
||||
column: x => x.BugSectionId,
|
||||
principalTable: "BugSections",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_BugDocuments_BugSectionId",
|
||||
table: "BugDocuments",
|
||||
column: "BugSectionId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_BugSections_TaskId",
|
||||
table: "BugSections",
|
||||
column: "TaskId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "BugDocuments");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "BugSections");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -227,6 +227,41 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations
|
||||
b.ToTable("UploadedFiles", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.BugSection", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("InitialDescription")
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("nvarchar(500)");
|
||||
|
||||
b.Property<long>("OriginalAssignedUserId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Priority")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)");
|
||||
|
||||
b.Property<Guid>("TaskId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("TaskId");
|
||||
|
||||
b.ToTable("BugSections", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.PhaseSection", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
@@ -254,49 +289,7 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations
|
||||
b.ToTable("PhaseSections");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("nvarchar(1000)");
|
||||
|
||||
b.Property<DateTime?>("EndDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<bool>("HasAssignmentOverride")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("nvarchar(200)");
|
||||
|
||||
b.Property<DateTime?>("PlannedEndDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime?>("PlannedStartDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime?>("StartDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("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<Guid>("Id")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
@@ -348,7 +341,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<Guid>("Id")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("nvarchar(1000)");
|
||||
|
||||
b.Property<DateTime?>("EndDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<bool>("HasAssignmentOverride")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("nvarchar(200)");
|
||||
|
||||
b.Property<DateTime?>("PlannedEndDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime?>("PlannedStartDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime?>("StartDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("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<Guid>("Id")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
@@ -374,7 +409,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<Guid>("Id")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
@@ -433,7 +468,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<Guid>("Id")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
@@ -476,7 +511,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<Guid>("Id")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
@@ -514,7 +549,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<Guid>("Id")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
@@ -540,6 +575,11 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations
|
||||
b.Property<Guid?>("TaskSectionId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<string>("Type")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("TaskSectionId");
|
||||
@@ -547,6 +587,76 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations
|
||||
b.ToTable("TaskSectionAdditionalTimes", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection.TaskSectionRevision", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<long>("CreatedByUserId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("Message")
|
||||
.IsRequired()
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("nvarchar(500)");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)");
|
||||
|
||||
b.Property<Guid>("TaskSectionId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("TaskSectionRevisions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection.TaskSectionTimeRequest", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasMaxLength(1200)
|
||||
.HasColumnType("nvarchar(1200)");
|
||||
|
||||
b.Property<string>("RequestStatus")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)");
|
||||
|
||||
b.Property<string>("RequestType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)");
|
||||
|
||||
b.Property<string>("RequestedTime")
|
||||
.IsRequired()
|
||||
.HasMaxLength(30)
|
||||
.HasColumnType("nvarchar(30)");
|
||||
|
||||
b.Property<Guid>("TaskSectionId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<long>("UserId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("TaskSectionId");
|
||||
|
||||
b.ToTable("TaskSectionTimeRequests");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GozareshgirProgramManager.Domain.RoleAgg.Entities.Role", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
@@ -792,6 +902,43 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations
|
||||
b.ToTable("UserRefreshTokens", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.BugSection", b =>
|
||||
{
|
||||
b.HasOne("GozareshgirProgramManager.Domain.ProjectAgg.Entities.ProjectTask", "ProjectTask")
|
||||
.WithMany("BugSectionList")
|
||||
.HasForeignKey("TaskId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.OwnsMany("GozareshgirProgramManager.Domain.ProjectAgg.Entities.BugDocument", "BugDocuments", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b1.Property<Guid>("BugSectionId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b1.Property<Guid>("FileId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b1.HasKey("Id");
|
||||
|
||||
b1.HasIndex("BugSectionId");
|
||||
|
||||
b1.ToTable("BugDocuments", (string)null);
|
||||
|
||||
b1.WithOwner("BugSection")
|
||||
.HasForeignKey("BugSectionId");
|
||||
|
||||
b1.Navigation("BugSection");
|
||||
});
|
||||
|
||||
b.Navigation("BugDocuments");
|
||||
|
||||
b.Navigation("ProjectTask");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.PhaseSection", b =>
|
||||
{
|
||||
b.HasOne("GozareshgirProgramManager.Domain.ProjectAgg.Entities.ProjectPhase", "Phase")
|
||||
@@ -810,9 +957,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 +968,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 +986,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 +997,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 +1005,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 +1016,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 +1027,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<Guid>("Id")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b1.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b1.Property<Guid>("FileId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b1.Property<Guid>("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 +1226,28 @@ 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("BugSectionList");
|
||||
|
||||
b.Navigation("Sections");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.TaskSection", b =>
|
||||
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection.TaskSection", b =>
|
||||
{
|
||||
b.Navigation("Activities");
|
||||
|
||||
|
||||
@@ -5,6 +5,10 @@ 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;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
|
||||
using GozareshgirProgramManager.Domain.RoleAgg.Entities;
|
||||
using GozareshgirProgramManager.Domain.RoleUserAgg;
|
||||
using GozareshgirProgramManager.Domain.SalaryPaymentSettingAgg.Entities;
|
||||
@@ -25,6 +29,7 @@ public class ProgramManagerDbContext : DbContext, IProgramManagerDbContext
|
||||
public DbSet<TaskSection> TaskSections { get; set; } = null!;
|
||||
public DbSet<ProjectSection> ProjectSections { get; set; } = null!;
|
||||
public DbSet<PhaseSection> PhaseSections { get; set; } = null!;
|
||||
public DbSet<BugSection> BugSections { get; set; } = null!;
|
||||
|
||||
// New Hierarchy entities
|
||||
public DbSet<Project> Projects { get; set; } = null!;
|
||||
@@ -49,6 +54,12 @@ public class ProgramManagerDbContext : DbContext, IProgramManagerDbContext
|
||||
// Task Chat
|
||||
public DbSet<TaskChatMessage> TaskChatMessages { get; set; } = null!;
|
||||
|
||||
//Task Section Time Request
|
||||
public DbSet<TaskSectionTimeRequest> TaskSectionTimeRequests { get; set; }
|
||||
|
||||
// Task Section Revision
|
||||
public DbSet<TaskSectionRevision> TaskSectionRevisions { get; set; }
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.ApplyConfigurationsFromAssembly(typeof(ProgramManagerDbContext).Assembly);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
|
||||
using GozareshgirProgramManager.Infrastructure.Persistence._Common;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace GozareshgirProgramManager.Infrastructure.Persistence.Mappings;
|
||||
|
||||
public class BugSectionMapping : IEntityTypeConfiguration<BugSection>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<BugSection> builder)
|
||||
{
|
||||
builder.ToTable("BugSections");
|
||||
|
||||
builder.HasKey(x => x.Id);
|
||||
|
||||
builder.Property(x => x.Id)
|
||||
.ValueGeneratedNever();
|
||||
|
||||
builder.Property(x => x.TaskId)
|
||||
.IsRequired();
|
||||
|
||||
builder.Property(x => x.Status)
|
||||
.HasConversion<string>()
|
||||
.HasMaxLength(50)
|
||||
.IsRequired();
|
||||
|
||||
|
||||
builder.Property(x => x.Priority)
|
||||
.HasConversion<string>()
|
||||
.HasMaxLength(50)
|
||||
.IsRequired();
|
||||
|
||||
builder.Property(x => x.InitialDescription)
|
||||
.HasMaxLength(500)
|
||||
.IsRequired(false);
|
||||
|
||||
|
||||
builder.OwnsMany(x => x.BugDocuments, navigationBuilder =>
|
||||
{
|
||||
|
||||
navigationBuilder.ToTable("BugDocuments");
|
||||
navigationBuilder.HasKey(x => x.Id);
|
||||
navigationBuilder.WithOwner(x => x.BugSection);
|
||||
});
|
||||
|
||||
// Navigation to ProjectTask (Task level)
|
||||
builder.HasOne(x => x.ProjectTask)
|
||||
.WithMany(t => t.BugSectionList)
|
||||
.HasForeignKey(x => x.TaskId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
||||
using GozareshgirProgramManager.Infrastructure.Persistence._Common;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
@@ -74,6 +75,12 @@ public class ProjectTaskMapping : IEntityTypeConfiguration<ProjectTask>
|
||||
.WithOne(s => s.Task)
|
||||
.HasForeignKey(s => s.TaskId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
|
||||
// One-to-many relationship with BugSections
|
||||
builder.HasMany(t => t.BugSectionList)
|
||||
.WithOne(s => s.ProjectTask)
|
||||
.HasForeignKey(s => s.TaskId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user