Compare commits
39 Commits
Feature/lo
...
Feature/pr
| Author | SHA1 | Date | |
|---|---|---|---|
| 77b5c8168e | |||
| cd2c770a9f | |||
| 64693b2ca3 | |||
| 03657b6848 | |||
| 15f1c938f7 | |||
| 7e563a0f01 | |||
| a3fd3e6920 | |||
| 025c59e695 | |||
| 36ccd96352 | |||
| a7c97b22b4 | |||
| 4c143d6bbc | |||
| 0e5a0a16ac | |||
| 88f54b6310 | |||
| d4694e7e1c | |||
| 4bde4ade2d | |||
| bd12ff0506 | |||
|
|
8ec13ffae1 | ||
|
|
5508d4e88f | ||
| 43abb74c61 | |||
| 73e6681baa | |||
| 90b2fd2eab | |||
| d9c431e20e | |||
|
|
2746bf69ea | ||
|
|
77dbb50512 | ||
|
|
1c7e8824c7 | ||
| 0eff1b9a66 | |||
|
|
0d33d79620 | ||
|
|
e4355faffc | ||
|
|
577fe5db76 | ||
|
|
ec8333c715 | ||
|
|
8aa93e089a | ||
|
|
0ab3052251 | ||
|
|
5202779d9f | ||
|
|
67a85735f0 | ||
|
|
35e6355069 | ||
|
|
4de2e12ac5 | ||
|
|
23b65cfbfe | ||
|
|
48b75d2baa | ||
|
|
63edb33bf5 |
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
public enum TypeOfSmsSetting
|
public enum TypeOfSmsSetting
|
||||||
{
|
{
|
||||||
|
//همه انواع پیامک
|
||||||
|
All = 0,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// پیامک
|
/// پیامک
|
||||||
@@ -23,7 +25,7 @@ public enum TypeOfSmsSetting
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// پیامک
|
/// پیامک
|
||||||
/// هشدار اول
|
/// هشدار بدهی
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Warning,
|
Warning,
|
||||||
|
|
||||||
@@ -38,4 +40,14 @@ public enum TypeOfSmsSetting
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
InstitutionContractConfirm,
|
InstitutionContractConfirm,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ارسال کد تاییدیه قرارداد مالی
|
||||||
|
/// </summary>
|
||||||
|
SendInstitutionContractConfirmationCode,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// یادآور وظایف
|
||||||
|
/// </summary>
|
||||||
|
TaskReminder,
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -18,3 +18,17 @@ public class ApiResultViewModel
|
|||||||
public string DeliveryColor { get; set; }
|
public string DeliveryColor { get; set; }
|
||||||
public string FullName { get; set; }
|
public string FullName { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public class ApiReportDto
|
||||||
|
{
|
||||||
|
public int MessageId { 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; }
|
||||||
|
|
||||||
|
}
|
||||||
@@ -19,6 +19,13 @@ public interface ISmsService
|
|||||||
bool SendAccountsInfo(string number,string fullName, string userName);
|
bool SendAccountsInfo(string number,string fullName, string userName);
|
||||||
Task<ApiResultViewModel> GetByMessageId(int messId);
|
Task<ApiResultViewModel> GetByMessageId(int messId);
|
||||||
Task<List<ApiResultViewModel>> GetApiResult(string startDate, string endDate);
|
Task<List<ApiResultViewModel>> GetApiResult(string startDate, string endDate);
|
||||||
|
|
||||||
|
#region ForApi
|
||||||
|
|
||||||
|
Task<List<ApiReportDto>> GetApiReport(string startDate, string endDate);
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
string DeliveryStatus(byte? dv);
|
string DeliveryStatus(byte? dv);
|
||||||
string DeliveryColorStatus(byte? dv);
|
string DeliveryColorStatus(byte? dv);
|
||||||
string UnixTimeStampToDateTime(int? unixTimeStamp);
|
string UnixTimeStampToDateTime(int? unixTimeStamp);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
|
|
||||||
using _0_Framework.Application;
|
using _0_Framework.Application;
|
||||||
|
using _0_Framework.Application.Enums;
|
||||||
using _0_Framework.Application.Sms;
|
using _0_Framework.Application.Sms;
|
||||||
using Company.Domain.ContarctingPartyAgg;
|
using Company.Domain.ContarctingPartyAgg;
|
||||||
using Company.Domain.InstitutionContractAgg;
|
using Company.Domain.InstitutionContractAgg;
|
||||||
@@ -12,19 +13,21 @@ public class JobSchedulerRegistrator
|
|||||||
private readonly IBackgroundJobClient _backgroundJobClient;
|
private readonly IBackgroundJobClient _backgroundJobClient;
|
||||||
private readonly SmsReminder _smsReminder;
|
private readonly SmsReminder _smsReminder;
|
||||||
private readonly IInstitutionContractRepository _institutionContractRepository;
|
private readonly IInstitutionContractRepository _institutionContractRepository;
|
||||||
|
private readonly IInstitutionContractSmsServiceRepository _institutionContractSmsServiceRepository;
|
||||||
private static DateTime? _lastRunCreateTransaction;
|
private static DateTime? _lastRunCreateTransaction;
|
||||||
private static DateTime? _lastRunSendMonthlySms;
|
private static DateTime? _lastRunSendMonthlySms;
|
||||||
private readonly ISmsService _smsService;
|
private readonly ISmsService _smsService;
|
||||||
private readonly ILogger<JobSchedulerRegistrator> _logger;
|
private readonly ILogger<JobSchedulerRegistrator> _logger;
|
||||||
|
|
||||||
|
|
||||||
public JobSchedulerRegistrator(SmsReminder smsReminder, IBackgroundJobClient backgroundJobClient, IInstitutionContractRepository institutionContractRepository, ISmsService smsService, ILogger<JobSchedulerRegistrator> logger)
|
public JobSchedulerRegistrator(SmsReminder smsReminder, IBackgroundJobClient backgroundJobClient, IInstitutionContractRepository institutionContractRepository, ISmsService smsService, ILogger<JobSchedulerRegistrator> logger, IInstitutionContractSmsServiceRepository institutionContractSmsServiceRepository)
|
||||||
{
|
{
|
||||||
_smsReminder = smsReminder;
|
_smsReminder = smsReminder;
|
||||||
_backgroundJobClient = backgroundJobClient;
|
_backgroundJobClient = backgroundJobClient;
|
||||||
_institutionContractRepository = institutionContractRepository;
|
_institutionContractRepository = institutionContractRepository;
|
||||||
_smsService = smsService;
|
_smsService = smsService;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
|
_institutionContractSmsServiceRepository = institutionContractSmsServiceRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Register()
|
public void Register()
|
||||||
@@ -58,17 +61,43 @@ public class JobSchedulerRegistrator
|
|||||||
"*/1 * * * *" // هر 1 دقیقه یکبار چک کن
|
"*/1 * * * *" // هر 1 دقیقه یکبار چک کن
|
||||||
);
|
);
|
||||||
|
|
||||||
//RecurringJob.AddOrUpdate(
|
RecurringJob.AddOrUpdate(
|
||||||
// "InstitutionContract.SendWarningSms",
|
"InstitutionContract.SendWarningSms",
|
||||||
// () => SendWarningSms(),
|
() => SendWarningSms(),
|
||||||
// "*/1 * * * *" // هر 1 دقیقه یکبار چک کن
|
"*/1 * * * *" // هر 1 دقیقه یکبار چک کن
|
||||||
//);
|
);
|
||||||
|
|
||||||
//RecurringJob.AddOrUpdate(
|
RecurringJob.AddOrUpdate(
|
||||||
// "InstitutionContract.SendLegalActionSms",
|
"InstitutionContract.SendLegalActionSms",
|
||||||
// () => SendLegalActionSms(),
|
() => SendLegalActionSms(),
|
||||||
// "*/1 * * * *" // هر 1 دقیقه یکبار چک کن
|
"*/1 * * * *" // هر 1 دقیقه یکبار چک کن
|
||||||
//);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
RecurringJob.AddOrUpdate(
|
||||||
|
"InstitutionContract.Block",
|
||||||
|
() => Block(),
|
||||||
|
"*/30 * * * *" // هر 30 دقیقه یکبار چک کن
|
||||||
|
);
|
||||||
|
|
||||||
|
RecurringJob.AddOrUpdate(
|
||||||
|
"InstitutionContract.UnBlock",
|
||||||
|
() => UnBlock(),
|
||||||
|
"*/10 * * * *"
|
||||||
|
);
|
||||||
|
|
||||||
|
RecurringJob.AddOrUpdate(
|
||||||
|
"InstitutionContract.DeActiveInstitutionEndOfContract",
|
||||||
|
() => DeActiveInstitutionEndOfContract(),
|
||||||
|
"*/30 * * * *"
|
||||||
|
);
|
||||||
|
|
||||||
|
RecurringJob.AddOrUpdate(
|
||||||
|
"InstitutionContract.BlueDeActiveAfterZeroDebt",
|
||||||
|
() => BlueDeActiveAfterZeroDebt(),
|
||||||
|
"*/10 * * * *"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -79,7 +108,7 @@ public class JobSchedulerRegistrator
|
|||||||
[DisableConcurrentExecution(timeoutInSeconds: 1200)]
|
[DisableConcurrentExecution(timeoutInSeconds: 1200)]
|
||||||
public async System.Threading.Tasks.Task CreateFinancialTransaction()
|
public async System.Threading.Tasks.Task CreateFinancialTransaction()
|
||||||
{
|
{
|
||||||
var now =DateTime.Now;
|
var now = DateTime.Now;
|
||||||
var endOfMonth = now.ToFarsi().FindeEndOfMonth();
|
var endOfMonth = now.ToFarsi().FindeEndOfMonth();
|
||||||
var endOfMonthGr = endOfMonth.ToGeorgianDateTime();
|
var endOfMonthGr = endOfMonth.ToGeorgianDateTime();
|
||||||
_logger.LogInformation("CreateFinancialTransaction job run");
|
_logger.LogInformation("CreateFinancialTransaction job run");
|
||||||
@@ -101,7 +130,7 @@ public class JobSchedulerRegistrator
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await _institutionContractRepository.CreateTransactionForInstitutionContracts(endNewGr, endNewFa, description);
|
await _institutionContractRepository.CreateTransactionForInstitutionContracts(endNewGr, endNewFa, description);
|
||||||
_lastRunCreateTransaction = now;
|
_lastRunCreateTransaction = now;
|
||||||
Console.WriteLine("CreateTransAction executed");
|
Console.WriteLine("CreateTransAction executed");
|
||||||
|
|
||||||
@@ -134,7 +163,7 @@ public class JobSchedulerRegistrator
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await _institutionContractRepository.SendMonthlySms(now);
|
await _institutionContractSmsServiceRepository.SendMonthlySms(now);
|
||||||
_lastRunSendMonthlySms = now;
|
_lastRunSendMonthlySms = now;
|
||||||
Console.WriteLine("Send Monthly sms executed");
|
Console.WriteLine("Send Monthly sms executed");
|
||||||
|
|
||||||
@@ -156,7 +185,7 @@ public class JobSchedulerRegistrator
|
|||||||
public async System.Threading.Tasks.Task SendReminderSms()
|
public async System.Threading.Tasks.Task SendReminderSms()
|
||||||
{
|
{
|
||||||
_logger.LogInformation("SendReminderSms job run");
|
_logger.LogInformation("SendReminderSms job run");
|
||||||
await _institutionContractRepository.SendReminderSmsForBackgroundTask();
|
await _institutionContractSmsServiceRepository.SendReminderSmsForBackgroundTask();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -167,7 +196,7 @@ public class JobSchedulerRegistrator
|
|||||||
public async System.Threading.Tasks.Task SendBlockSms()
|
public async System.Threading.Tasks.Task SendBlockSms()
|
||||||
{
|
{
|
||||||
_logger.LogInformation("SendBlockSms job run");
|
_logger.LogInformation("SendBlockSms job run");
|
||||||
await _institutionContractRepository.SendBlockSmsForBackgroundTask();
|
await _institutionContractSmsServiceRepository.SendBlockSmsForBackgroundTask();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -179,7 +208,7 @@ public class JobSchedulerRegistrator
|
|||||||
public async System.Threading.Tasks.Task SendInstitutionContractConfirmSms()
|
public async System.Threading.Tasks.Task SendInstitutionContractConfirmSms()
|
||||||
{
|
{
|
||||||
_logger.LogInformation("SendInstitutionContractConfirmSms job run");
|
_logger.LogInformation("SendInstitutionContractConfirmSms job run");
|
||||||
await _institutionContractRepository.SendInstitutionContractConfirmSmsTask();
|
await _institutionContractSmsServiceRepository.SendInstitutionContractConfirmSmsTask();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -190,14 +219,86 @@ public class JobSchedulerRegistrator
|
|||||||
public async System.Threading.Tasks.Task SendWarningSms()
|
public async System.Threading.Tasks.Task SendWarningSms()
|
||||||
{
|
{
|
||||||
_logger.LogInformation("SendWarningSms job run");
|
_logger.LogInformation("SendWarningSms job run");
|
||||||
await _institutionContractRepository.SendWarningSmsTask();
|
await _institutionContractSmsServiceRepository.SendWarningOrLegalActionSmsTask(TypeOfSmsSetting.Warning);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// پیامک اقدام قضایی
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
[DisableConcurrentExecution(timeoutInSeconds: 100)]
|
[DisableConcurrentExecution(timeoutInSeconds: 100)]
|
||||||
public async System.Threading.Tasks.Task SendLegalActionSms()
|
public async System.Threading.Tasks.Task SendLegalActionSms()
|
||||||
{
|
{
|
||||||
_logger.LogInformation("SendWarningSms job run");
|
_logger.LogInformation("SendWarningSms job run");
|
||||||
await _institutionContractRepository.SendLegalActionSmsTask();
|
await _institutionContractSmsServiceRepository.SendWarningOrLegalActionSmsTask(TypeOfSmsSetting.LegalAction);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// بلاگ سازی
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[DisableConcurrentExecution(timeoutInSeconds: 100)]
|
||||||
|
public async System.Threading.Tasks.Task Block()
|
||||||
|
{
|
||||||
|
_logger.LogInformation("block job run");
|
||||||
|
var now = DateTime.Now;
|
||||||
|
var executeDate = now.ToFarsi().Substring(8, 2);
|
||||||
|
if (executeDate == "20")
|
||||||
|
{
|
||||||
|
if (now.Hour >= 9 && now.Hour < 10)
|
||||||
|
{
|
||||||
|
await _institutionContractSmsServiceRepository.Block(now);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// آنبلاک
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[DisableConcurrentExecution(timeoutInSeconds: 100)]
|
||||||
|
public async System.Threading.Tasks.Task UnBlock()
|
||||||
|
{
|
||||||
|
_logger.LogInformation("UnBlock job run");
|
||||||
|
|
||||||
|
await _institutionContractSmsServiceRepository.UnBlock();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// غیر فعال سازی قراداد های پایان یافته
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[DisableConcurrentExecution(timeoutInSeconds: 100)]
|
||||||
|
public async System.Threading.Tasks.Task DeActiveInstitutionEndOfContract()
|
||||||
|
{
|
||||||
|
_logger.LogInformation("DeActiveInstitutionEndOfContract job run");
|
||||||
|
|
||||||
|
|
||||||
|
var now = DateTime.Now;
|
||||||
|
var executeDate = now.ToFarsi().Substring(8, 2);
|
||||||
|
if (executeDate == "01")
|
||||||
|
{
|
||||||
|
if (now.Hour >= 9 && now.Hour < 10)
|
||||||
|
{
|
||||||
|
await _institutionContractSmsServiceRepository.DeActiveInstitutionEndOfContract(now);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// غیرفعال سازس قرارداد های آبی که بدهی ندارند
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[DisableConcurrentExecution(timeoutInSeconds: 800)]
|
||||||
|
public async System.Threading.Tasks.Task BlueDeActiveAfterZeroDebt()
|
||||||
|
{
|
||||||
|
_logger.LogInformation("BlueDeActiveAfterZeroDebt job run");
|
||||||
|
await _institutionContractSmsServiceRepository.BlueDeActiveAfterZeroDebt();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -91,65 +91,7 @@ public interface IInstitutionContractRepository : IRepository<long, InstitutionC
|
|||||||
Task<List<InstitutionContractPrintViewModel>> PrintAllAsync(List<long> ids);
|
Task<List<InstitutionContractPrintViewModel>> PrintAllAsync(List<long> ids);
|
||||||
|
|
||||||
|
|
||||||
#region ReminderSMS
|
|
||||||
/// <summary>
|
|
||||||
/// دریافت لیست - ارسال پیامک
|
|
||||||
/// فراخوانی از سمت بک گراند سرویس
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
Task<bool> SendReminderSmsForBackgroundTask();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// ارسال پیامک صورت حساب ماهانه
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="now"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
Task SendMonthlySms(DateTime now);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// ارسال پیامک مسدودی از طرف بک گراند سرویس
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
Task SendBlockSmsForBackgroundTask();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// دریافت لیست واجد شرایط بلاک
|
|
||||||
/// جهت ارسال پیامک مسدودی
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="checkDate"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
Task<List<BlockSmsListData>> GetBlockListData(DateTime checkDate);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// ارسال پیامک مسدودی
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="smsListData"></param>
|
|
||||||
/// <param name="typeOfSms"></param>
|
|
||||||
/// <param name="sendMessStart"></param>
|
|
||||||
/// <param name="sendMessEnd"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
Task SendBlockSmsToContractingParties(List<BlockSmsListData> smsListData, string typeOfSms,
|
|
||||||
string sendMessStart, string sendMessEnd);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///دریافت لیست بدهکارن
|
|
||||||
/// جهت ارسال پیامک
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
Task<List<SmsListData>> GetSmsListData(DateTime checkDate, TypeOfSmsSetting typeOfSmsSetting);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// ارسال پیامک های یاد آور بدهی
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
Task SendReminderSmsToContractingParties(List<SmsListData> smsListData, string typeOfSms, string sendMessStart, string sendMessEnd);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// ارسال پیامک یادآور تایید قراداد مالی
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
Task SendInstitutionContractConfirmSmsTask();
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region CreateMontlyTransaction
|
#region CreateMontlyTransaction
|
||||||
|
|
||||||
@@ -162,24 +104,12 @@ public interface IInstitutionContractRepository : IRepository<long, InstitutionC
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region WarningSms
|
|
||||||
/// <summary>
|
|
||||||
/// پیامک های هشدار
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
Task SendWarningSmsTask();
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region legalAction
|
|
||||||
/// <summary>
|
|
||||||
/// پیامک اقدام قضائی
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
Task SendLegalActionSmsTask();
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Task<long> GetIdByInstallmentId(long installmentId);
|
Task<long> GetIdByInstallmentId(long installmentId);
|
||||||
Task<InstitutionContract> GetPreviousContract(long currentInstitutionContractId);
|
Task<InstitutionContract> GetPreviousContract(long currentInstitutionContractId);
|
||||||
|
|||||||
@@ -0,0 +1,145 @@
|
|||||||
|
using _0_Framework.Application.Enums;
|
||||||
|
using _0_Framework.Domain;
|
||||||
|
using CompanyManagment.App.Contracts.InstitutionContract;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Company.Domain.InstitutionContractAgg;
|
||||||
|
|
||||||
|
public interface IInstitutionContractSmsServiceRepository : IRepository<long, InstitutionContract>
|
||||||
|
{
|
||||||
|
#region reminderSMs
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ارسال پیامک یادآور تایید قراداد مالی
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task SendInstitutionContractConfirmSmsTask();
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//هشدار و اقدام قضایی
|
||||||
|
#region WarningOrLegalActionSmsListData
|
||||||
|
/// <summary>
|
||||||
|
/// اجرای تسک پیامک هشدار یا اقدام قضایی
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="typeOfSmsSetting"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task SendWarningOrLegalActionSmsTask(TypeOfSmsSetting typeOfSmsSetting);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// دریافت لیست بدهکاران آبی جهت هشدار یا اقدام قضایی
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="typeOfSmsSetting"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<List<SmsListData>> GetWarningOrLegalActionSmsListData(TypeOfSmsSetting typeOfSmsSetting);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ارسال پیامک هشدار یا اقدام قضایی
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="smsListData"></param>
|
||||||
|
/// <param name="typeOfSmsSetting"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task SendWarningOrLegalActionSms(List<SmsListData> smsListData, TypeOfSmsSetting typeOfSmsSetting);
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//بلاک - آنبلاک - پیامک بلاک -
|
||||||
|
// غیر فعال سازی قراداد های پایان یافته
|
||||||
|
#region Block
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ارسال پیامک مسدودی از طرف بک گراند سرویس
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task SendBlockSmsForBackgroundTask();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// دریافت لیست واجد شرایط بلاک
|
||||||
|
/// جهت ارسال پیامک مسدودی
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="checkDate"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<List<BlockSmsListData>> GetBlockListData(DateTime checkDate);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ارسال پیامک مسدودی
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="smsListData"></param>
|
||||||
|
/// <param name="typeOfSms"></param>
|
||||||
|
/// <param name="sendMessStart"></param>
|
||||||
|
/// <param name="sendMessEnd"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task SendBlockSmsToContractingParties(List<BlockSmsListData> smsListData, string typeOfSms,
|
||||||
|
string sendMessStart, string sendMessEnd);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// بلاک سازی
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="checkDate"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task Block(DateTime checkDate);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// دریافت لیست بدهکارانی که باید بلاک شوند
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="checkDate"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<List<long>> GetToBeBlockList(DateTime checkDate);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// آنبلاک
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task UnBlock();
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// غیر فعالسازی قرارداد های پایان یافته
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="checkDate"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task DeActiveInstitutionEndOfContract(DateTime checkDate);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// غیرفعال سازس قرارداد های آبی که بدهی ندارند
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task BlueDeActiveAfterZeroDebt();
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
#region ReminderSMS
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// دریافت لیست - ارسال پیامک
|
||||||
|
/// فراخوانی از سمت بک گراند سرویس
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<bool> SendReminderSmsForBackgroundTask();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ارسال پیامک صورت حساب ماهانه
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="now"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task SendMonthlySms(DateTime now);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///دریافت لیست بدهکارن
|
||||||
|
/// جهت ارسال پیامک
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<List<SmsListData>> GetSmsListData(DateTime checkDate, TypeOfSmsSetting typeOfSmsSetting);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ارسال پیامک های یاد آور بدهی
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task SendReminderSmsToContractingParties(List<SmsListData> smsListData, string typeOfSms, string sendMessStart, string sendMessEnd);
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
@@ -15,7 +15,6 @@ public interface ISalaryAidRepository:IRepository<long,SalaryAid>
|
|||||||
void RemoveRange(IEnumerable<SalaryAid> salaryAids);
|
void RemoveRange(IEnumerable<SalaryAid> salaryAids);
|
||||||
|
|
||||||
#region Pooya
|
#region Pooya
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// گروهبندی بر اساس ماه هنگام جستجو با انتخاب کارمند
|
/// گروهبندی بر اساس ماه هنگام جستجو با انتخاب کارمند
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -1,10 +1,30 @@
|
|||||||
using CompanyManagment.App.Contracts.SmsResult;
|
using _0_Framework.Domain;
|
||||||
|
using CompanyManagment.App.Contracts.SmsResult;
|
||||||
|
using CompanyManagment.App.Contracts.SmsResult.Dto;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using _0_Framework.Domain;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Company.Domain.SmsResultAgg;
|
namespace Company.Domain.SmsResultAgg;
|
||||||
|
|
||||||
public interface ISmsResultRepository : IRepository<long, SmsResult>
|
public interface ISmsResultRepository : IRepository<long, SmsResult>
|
||||||
{
|
{
|
||||||
|
#region ForApi
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// دریافت لیست پیامکها
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="command"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<List<SmsReportDto>> GetSmsReportList(SmsReportSearchModel searchModel);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// دریافت اکسپند لیست هر تاریخ
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="searchModel"></param>
|
||||||
|
/// <param name="date"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<List<SmsReportListDto>> GetSmsReportExpandList(SmsReportSearchModel searchModel, string date);
|
||||||
|
|
||||||
|
#endregion
|
||||||
List<SmsResultViewModel> Search(SmsResultSearchModel searchModel);
|
List<SmsResultViewModel> Search(SmsResultSearchModel searchModel);
|
||||||
}
|
}
|
||||||
15
CompanyManagment.App.Contracts/SmsResult/Dto/SendStatus.cs
Normal file
15
CompanyManagment.App.Contracts/SmsResult/Dto/SendStatus.cs
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
namespace CompanyManagment.App.Contracts.SmsResult.Dto;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// وضعیت ارسال پیامک
|
||||||
|
/// </summary>
|
||||||
|
public enum SendStatus
|
||||||
|
{
|
||||||
|
All=0,
|
||||||
|
/// <summary>
|
||||||
|
/// موفق
|
||||||
|
/// </summary>
|
||||||
|
Success,
|
||||||
|
//ناموفق
|
||||||
|
Failed,
|
||||||
|
}
|
||||||
54
CompanyManagment.App.Contracts/SmsResult/Dto/SmsReportDto.cs
Normal file
54
CompanyManagment.App.Contracts/SmsResult/Dto/SmsReportDto.cs
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace CompanyManagment.App.Contracts.SmsResult.Dto;
|
||||||
|
|
||||||
|
public class SmsReportDto
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// تاریخ ارسال
|
||||||
|
/// </summary>
|
||||||
|
public string SentDate { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class SmsReportListDto
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// آی دی
|
||||||
|
/// </summary>
|
||||||
|
public long Id { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// آی دی پیامک در sms.ir
|
||||||
|
/// </summary>
|
||||||
|
public int MessageId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// وضعیت ارسال
|
||||||
|
/// </summary>
|
||||||
|
public string Status { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// نوع پیامک
|
||||||
|
/// </summary>
|
||||||
|
public string TypeOfSms { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// نام طرف حساب
|
||||||
|
/// </summary>
|
||||||
|
public string ContractingPartyName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// شماره موبایل
|
||||||
|
/// </summary>
|
||||||
|
public string Mobile { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ساعت و دقیقه
|
||||||
|
/// </summary>
|
||||||
|
public string HourAndMinute { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
using _0_Framework.Application.Enums;
|
||||||
|
|
||||||
|
namespace CompanyManagment.App.Contracts.SmsResult.Dto;
|
||||||
|
|
||||||
|
public class SmsReportSearchModel
|
||||||
|
{
|
||||||
|
//نوع پیامک
|
||||||
|
public TypeOfSmsSetting TypeOfSms { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// وضعیت ارسال پیامک
|
||||||
|
/// </summary>
|
||||||
|
public SendStatus SendStatus { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// شماره موبایل
|
||||||
|
/// </summary>
|
||||||
|
public string Mobile { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// آی دی طرف حساب
|
||||||
|
/// </summary>
|
||||||
|
public long ContractingPatyId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// سال
|
||||||
|
/// </summary>
|
||||||
|
public string Year { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// ماه
|
||||||
|
/// </summary>
|
||||||
|
public string Month { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// تاریخ شروع
|
||||||
|
/// </summary>
|
||||||
|
public string StartDateFa { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// تاریخ پایان
|
||||||
|
/// </summary>
|
||||||
|
public string EndDateFa { get; set; }
|
||||||
|
}
|
||||||
@@ -1,14 +1,34 @@
|
|||||||
using System;
|
using _0_Framework.Application;
|
||||||
|
using CompanyManagment.App.Contracts.SmsResult.Dto;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using _0_Framework.Application;
|
|
||||||
|
|
||||||
namespace CompanyManagment.App.Contracts.SmsResult;
|
namespace CompanyManagment.App.Contracts.SmsResult;
|
||||||
|
|
||||||
public interface ISmsResultApplication
|
public interface ISmsResultApplication
|
||||||
{
|
{
|
||||||
|
#region ForApi
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// دریافت لیست پیامکها
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="searchModel"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<List<SmsReportDto>> GetSmsReportList(SmsReportSearchModel searchModel);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// دریافت اکسپند لیست هر تاریخ
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="searchModel"></param>
|
||||||
|
/// <param name="date"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<List<SmsReportListDto>> GetSmsReportExpandList(SmsReportSearchModel searchModel, string date);
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
OperationResult Create(CreateSmsResult command);
|
OperationResult Create(CreateSmsResult command);
|
||||||
List<SmsResultViewModel> Search(SmsResultSearchModel searchModel);
|
List<SmsResultViewModel> Search(SmsResultSearchModel searchModel);
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,10 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using _0_Framework.Application;
|
using _0_Framework.Application;
|
||||||
using Company.Domain.SmsResultAgg;
|
using Company.Domain.SmsResultAgg;
|
||||||
using CompanyManagment.App.Contracts.SmsResult;
|
using CompanyManagment.App.Contracts.SmsResult;
|
||||||
|
using CompanyManagment.App.Contracts.SmsResult.Dto;
|
||||||
|
|
||||||
namespace CompanyManagment.Application;
|
namespace CompanyManagment.Application;
|
||||||
|
|
||||||
@@ -15,6 +17,23 @@ public class SmsResultApplication : ISmsResultApplication
|
|||||||
_smsResultRepository = smsResultRepository;
|
_smsResultRepository = smsResultRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#region ForApi
|
||||||
|
|
||||||
|
public async Task<List<SmsReportDto>> GetSmsReportList(SmsReportSearchModel searchModel)
|
||||||
|
{
|
||||||
|
return await _smsResultRepository.GetSmsReportList(searchModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<List<SmsReportListDto>> GetSmsReportExpandList(SmsReportSearchModel searchModel, string date)
|
||||||
|
{
|
||||||
|
return await _smsResultRepository.GetSmsReportExpandList(searchModel, date);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public OperationResult Create(CreateSmsResult command)
|
public OperationResult Create(CreateSmsResult command)
|
||||||
{
|
{
|
||||||
var op = new OperationResult();
|
var op = new OperationResult();
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
using System;
|
using _0_Framework.Application;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using _0_Framework.Application;
|
|
||||||
using _0_Framework.Application.Enums;
|
using _0_Framework.Application.Enums;
|
||||||
using Company.Domain.InstitutionContractAgg;
|
using Company.Domain.InstitutionContractAgg;
|
||||||
using Company.Domain.SmsResultAgg;
|
using Company.Domain.SmsResultAgg;
|
||||||
using CompanyManagment.App.Contracts.InstitutionContract;
|
using CompanyManagment.App.Contracts.InstitutionContract;
|
||||||
using CompanyManagment.App.Contracts.SmsResult;
|
using CompanyManagment.App.Contracts.SmsResult;
|
||||||
|
using CompanyManagment.EFCore.Repository;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace CompanyManagment.Application;
|
namespace CompanyManagment.Application;
|
||||||
|
|
||||||
@@ -15,11 +16,13 @@ public class SmsSettingApplication : ISmsSettingApplication
|
|||||||
{
|
{
|
||||||
private readonly ISmsSettingsRepository _smsSettingsRepository;
|
private readonly ISmsSettingsRepository _smsSettingsRepository;
|
||||||
private readonly IInstitutionContractRepository _institutionContractRepository;
|
private readonly IInstitutionContractRepository _institutionContractRepository;
|
||||||
|
private readonly IInstitutionContractSmsServiceRepository _institutionContractSmsServiceRepository;
|
||||||
|
|
||||||
public SmsSettingApplication(ISmsSettingsRepository smsSettingsRepository, IInstitutionContractRepository institutionContractRepository)
|
public SmsSettingApplication(ISmsSettingsRepository smsSettingsRepository, IInstitutionContractRepository institutionContractRepository, IInstitutionContractSmsServiceRepository institutionContractSmsServiceRepository)
|
||||||
{
|
{
|
||||||
_smsSettingsRepository = smsSettingsRepository;
|
_smsSettingsRepository = smsSettingsRepository;
|
||||||
_institutionContractRepository = institutionContractRepository;
|
_institutionContractRepository = institutionContractRepository;
|
||||||
|
_institutionContractSmsServiceRepository = institutionContractSmsServiceRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -116,12 +119,12 @@ public class SmsSettingApplication : ISmsSettingApplication
|
|||||||
|
|
||||||
public async Task<List<SmsListData>> GetSmsListData(TypeOfSmsSetting typeOfSmsSetting)
|
public async Task<List<SmsListData>> GetSmsListData(TypeOfSmsSetting typeOfSmsSetting)
|
||||||
{
|
{
|
||||||
return await _institutionContractRepository.GetSmsListData(DateTime.Now, typeOfSmsSetting);
|
return await _institutionContractSmsServiceRepository.GetSmsListData(DateTime.Now, typeOfSmsSetting);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<List<BlockSmsListData>> GetBlockSmsListData(TypeOfSmsSetting typeOfSmsSetting)
|
public async Task<List<BlockSmsListData>> GetBlockSmsListData(TypeOfSmsSetting typeOfSmsSetting)
|
||||||
{
|
{
|
||||||
return await _institutionContractRepository.GetBlockListData(DateTime.Now);
|
return await _institutionContractSmsServiceRepository.GetBlockListData(DateTime.Now);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -134,7 +137,7 @@ public class SmsSettingApplication : ISmsSettingApplication
|
|||||||
|
|
||||||
if (command.Any())
|
if (command.Any())
|
||||||
{
|
{
|
||||||
await _institutionContractRepository.SendReminderSmsToContractingParties(command, typeOfSms, sendMessStart, sendMessEnd);
|
await _institutionContractSmsServiceRepository.SendReminderSmsToContractingParties(command, typeOfSms, sendMessStart, sendMessEnd);
|
||||||
return op.Succcedded();
|
return op.Succcedded();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -153,7 +156,7 @@ public class SmsSettingApplication : ISmsSettingApplication
|
|||||||
string sendMessEnd = "پایان مسدودی آنی ";
|
string sendMessEnd = "پایان مسدودی آنی ";
|
||||||
if (command.Any())
|
if (command.Any())
|
||||||
{
|
{
|
||||||
await _institutionContractRepository.SendBlockSmsToContractingParties(command, typeOfSms, sendMessStart,
|
await _institutionContractSmsServiceRepository.SendBlockSmsToContractingParties(command, typeOfSms, sendMessStart,
|
||||||
sendMessEnd);
|
sendMessEnd);
|
||||||
return op.Succcedded();
|
return op.Succcedded();
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,13 +1,20 @@
|
|||||||
using System.Collections.Generic;
|
using _0_Framework.Application;
|
||||||
using System.Linq;
|
|
||||||
using _0_Framework.Application;
|
|
||||||
using _0_Framework.InfraStructure;
|
using _0_Framework.InfraStructure;
|
||||||
using Company.Domain.SmsResultAgg;
|
using Company.Domain.SmsResultAgg;
|
||||||
using CompanyManagment.App.Contracts.SmsResult;
|
using CompanyManagment.App.Contracts.SmsResult;
|
||||||
|
using CompanyManagment.App.Contracts.SmsResult.Dto;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using _0_Framework.Application.Enums;
|
||||||
|
using static Microsoft.EntityFrameworkCore.DbLoggerCategory;
|
||||||
|
|
||||||
namespace CompanyManagment.EFCore.Repository;
|
namespace CompanyManagment.EFCore.Repository;
|
||||||
|
|
||||||
public class SmsResultRepository : RepositoryBase<long, SmsResult> , ISmsResultRepository
|
public class SmsResultRepository : RepositoryBase<long, SmsResult>, ISmsResultRepository
|
||||||
{
|
{
|
||||||
private readonly CompanyContext _context;
|
private readonly CompanyContext _context;
|
||||||
public SmsResultRepository(CompanyContext context) : base(context)
|
public SmsResultRepository(CompanyContext context) : base(context)
|
||||||
@@ -15,6 +22,260 @@ public class SmsResultRepository : RepositoryBase<long, SmsResult> , ISmsResultR
|
|||||||
_context = context;
|
_context = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region ForApi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public async Task<List<SmsReportDto>> GetSmsReportList(SmsReportSearchModel searchModel)
|
||||||
|
{
|
||||||
|
|
||||||
|
// مرحله 1: همه رکوردها را با projection ساده بگیرید
|
||||||
|
var rawQuery = await _context.SmsResults
|
||||||
|
.Select(x => new
|
||||||
|
{
|
||||||
|
x.id,
|
||||||
|
x.ContractingPatyId,
|
||||||
|
x.Mobile,
|
||||||
|
x.Status,
|
||||||
|
x.TypeOfSms,
|
||||||
|
x.CreationDate,
|
||||||
|
DateOnly = x.CreationDate.Date // فقط تاریخ بدون ساعت
|
||||||
|
})
|
||||||
|
.AsNoTracking()
|
||||||
|
.ToListAsync(); // اینجا SQL اجرا میشود و همه دادهها به client میآیند
|
||||||
|
|
||||||
|
if (searchModel.ContractingPatyId > 0)
|
||||||
|
{
|
||||||
|
rawQuery = rawQuery.Where(x => x.ContractingPatyId == searchModel.ContractingPatyId).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(searchModel.Mobile))
|
||||||
|
{
|
||||||
|
rawQuery = rawQuery.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;
|
||||||
|
}
|
||||||
|
|
||||||
|
rawQuery = rawQuery.Where(x => x.TypeOfSms == typeOfSms).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (searchModel.TypeOfSms == TypeOfSmsSetting.Warning)
|
||||||
|
{
|
||||||
|
rawQuery = rawQuery.Where(x => x.TypeOfSms.Contains("هشدار")).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (searchModel.SendStatus != SendStatus.All)
|
||||||
|
{
|
||||||
|
var status = "All";
|
||||||
|
|
||||||
|
switch (searchModel.SendStatus)
|
||||||
|
{
|
||||||
|
case SendStatus.Success: status = "موفق";
|
||||||
|
break;
|
||||||
|
case SendStatus.Failed: status = "ناموفق";
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
rawQuery = rawQuery.Where(x => x.Status == status).ToList();
|
||||||
|
|
||||||
|
}
|
||||||
|
#region searchByDate
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(searchModel.StartDateFa) &&
|
||||||
|
!string.IsNullOrWhiteSpace(searchModel.EndDateFa))
|
||||||
|
{
|
||||||
|
if (searchModel.StartDateFa.TryToGeorgianDateTime(out var startGr) == false ||
|
||||||
|
searchModel.EndDateFa.TryToGeorgianDateTime(out var endGr) == false)
|
||||||
|
return new List<SmsReportDto>();
|
||||||
|
|
||||||
|
rawQuery = rawQuery.Where(x => x.CreationDate.Date >= startGr.Date && x.CreationDate.Date <= endGr.Date).ToList();
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrWhiteSpace(searchModel.Year) && !string.IsNullOrWhiteSpace(searchModel.Month))
|
||||||
|
{
|
||||||
|
var start = searchModel.Year + "/" + searchModel.Month + "/01";
|
||||||
|
var end = start.FindeEndOfMonth();
|
||||||
|
var startGr = start.ToGeorgianDateTime();
|
||||||
|
var endGr = end.ToGeorgianDateTime();
|
||||||
|
rawQuery = rawQuery.Where(x => x.CreationDate.Date >= startGr.Date && x.CreationDate.Date <= endGr.Date).ToList();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (!string.IsNullOrWhiteSpace(searchModel.Year) && string.IsNullOrWhiteSpace(searchModel.Month))
|
||||||
|
{
|
||||||
|
var start = searchModel.Year + "/01/01";
|
||||||
|
var findEndOfYear = searchModel.Year + "/12/01";
|
||||||
|
var end = findEndOfYear.FindeEndOfMonth();
|
||||||
|
var startGr = start.ToGeorgianDateTime();
|
||||||
|
var endGr = end.ToGeorgianDateTime();
|
||||||
|
rawQuery = rawQuery.Where(x => x.CreationDate.Date >= startGr.Date && x.CreationDate.Date <= endGr.Date).ToList();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
// مرحله 2: گروهبندی و انتخاب آخرین رکورد هر روز روی Client
|
||||||
|
var grouped = rawQuery
|
||||||
|
.GroupBy(x => x.DateOnly)
|
||||||
|
.Select(g => g.OrderByDescending(x => x.CreationDate).First())
|
||||||
|
.OrderByDescending(x => x.CreationDate)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
// مرحله 3: تبدیل به DTO و ToFarsi
|
||||||
|
var result = grouped.Select(x => new SmsReportDto
|
||||||
|
{
|
||||||
|
SentDate = x.CreationDate.ToFarsi()
|
||||||
|
}).ToList();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public async Task<List<SmsReportListDto>> GetSmsReportExpandList(SmsReportSearchModel searchModel, string date)
|
||||||
|
{
|
||||||
|
if(string.IsNullOrWhiteSpace(date))
|
||||||
|
return new List<SmsReportListDto>();
|
||||||
|
|
||||||
|
if (date.TryToGeorgianDateTime(out var searchDate) == false)
|
||||||
|
return new List<SmsReportListDto>();
|
||||||
|
|
||||||
|
var query = await _context.SmsResults.Where(x => x.CreationDate.Date == searchDate.Date)
|
||||||
|
.Select(x =>
|
||||||
|
new
|
||||||
|
{
|
||||||
|
x.id,
|
||||||
|
x.MessageId,
|
||||||
|
x.Status,
|
||||||
|
x.TypeOfSms,
|
||||||
|
x.ContractingPartyName,
|
||||||
|
x.Mobile,
|
||||||
|
x.ContractingPatyId,
|
||||||
|
x.InstitutionContractId,
|
||||||
|
x.CreationDate,
|
||||||
|
x.CreationDate.Hour,
|
||||||
|
x.CreationDate.Minute
|
||||||
|
|
||||||
|
}).AsNoTracking()
|
||||||
|
.ToListAsync(); ;
|
||||||
|
|
||||||
|
if (searchModel.ContractingPatyId > 0)
|
||||||
|
{
|
||||||
|
query = query.Where(x => x.ContractingPatyId == searchModel.ContractingPatyId).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(searchModel.Mobile))
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
query = query.Where(x => x.TypeOfSms == typeOfSms).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (searchModel.TypeOfSms == TypeOfSmsSetting.Warning)
|
||||||
|
{
|
||||||
|
query = query.Where(x => x.TypeOfSms.Contains("هشدار")).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (searchModel.SendStatus != SendStatus.All)
|
||||||
|
{
|
||||||
|
var status = "All";
|
||||||
|
|
||||||
|
switch (searchModel.SendStatus)
|
||||||
|
{
|
||||||
|
case SendStatus.Success:
|
||||||
|
status = "موفق";
|
||||||
|
break;
|
||||||
|
case SendStatus.Failed:
|
||||||
|
status = "ناموفق";
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
query = query.Where(x => x.Status == status).ToList();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (query.Count == 0)
|
||||||
|
return new List<SmsReportListDto>();
|
||||||
|
|
||||||
|
var result = query.OrderByDescending(x => x.CreationDate.Hour)
|
||||||
|
.ThenByDescending(x => x.CreationDate.Minute).Select(x =>
|
||||||
|
new SmsReportListDto()
|
||||||
|
{
|
||||||
|
Id = x.id,
|
||||||
|
MessageId = x.MessageId,
|
||||||
|
Status = x.Status,
|
||||||
|
TypeOfSms = x.TypeOfSms,
|
||||||
|
ContractingPartyName = x.ContractingPartyName,
|
||||||
|
Mobile = x.Mobile,
|
||||||
|
HourAndMinute = x.CreationDate.TimeOfDay.ToString(@"hh\:mm"),
|
||||||
|
}).ToList();
|
||||||
|
|
||||||
|
return result;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
public List<App.Contracts.SmsResult.SmsResultViewModel> Search(SmsResultSearchModel searchModel)
|
public List<App.Contracts.SmsResult.SmsResultViewModel> Search(SmsResultSearchModel searchModel)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -82,7 +343,7 @@ public class SmsResultRepository : RepositoryBase<long, SmsResult> , ISmsResultR
|
|||||||
|
|
||||||
|
|
||||||
query = query.OrderByDescending(x => x.CreationDate)
|
query = query.OrderByDescending(x => x.CreationDate)
|
||||||
.ThenByDescending(x=>x.CreationDate.Hour).ThenByDescending(x=>x.CreationDate.Minute);
|
.ThenByDescending(x => x.CreationDate.Hour).ThenByDescending(x => x.CreationDate.Minute);
|
||||||
|
|
||||||
return query.Skip(searchModel.PageIndex).Take(30).ToList();
|
return query.Skip(searchModel.PageIndex).Take(30).ToList();
|
||||||
|
|
||||||
|
|||||||
@@ -207,16 +207,11 @@ public class SmsService : ISmsService
|
|||||||
}
|
}
|
||||||
public async Task<List<ApiResultViewModel>> GetApiResult(string startDate, string endDate)
|
public async Task<List<ApiResultViewModel>> GetApiResult(string startDate, string endDate)
|
||||||
{
|
{
|
||||||
var st = new DateTime(2024, 6, 2);
|
|
||||||
var ed = new DateTime(2024, 7, 1);
|
|
||||||
if (!string.IsNullOrWhiteSpace(startDate) && startDate.Length == 10)
|
if(startDate.TryToGeorgianDateTime(out var st) == false || endDate.TryToGeorgianDateTime(out var ed) == false)
|
||||||
{
|
return new List<ApiResultViewModel>();
|
||||||
st = startDate.ToGeorgianDateTime();
|
|
||||||
}
|
|
||||||
if (!string.IsNullOrWhiteSpace(endDate) && endDate.Length == 10)
|
|
||||||
{
|
|
||||||
ed = endDate.ToGeorgianDateTime();
|
|
||||||
}
|
|
||||||
var res = new List<ApiResultViewModel>();
|
var res = new List<ApiResultViewModel>();
|
||||||
Int32 unixTimestamp = (int)st.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;
|
Int32 unixTimestamp = (int)st.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;
|
||||||
Int32 unixTimestamp2 = (int)ed.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;
|
Int32 unixTimestamp2 = (int)ed.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;
|
||||||
@@ -248,6 +243,44 @@ public class SmsService : ISmsService
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<List<ApiReportDto>> GetApiReport(string startDate, string endDate)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
if (startDate.TryToGeorgianDateTime(out var st) == false || endDate.TryToGeorgianDateTime(out var ed) == false)
|
||||||
|
return new List<ApiReportDto>();
|
||||||
|
|
||||||
|
var res = new List<ApiReportDto>();
|
||||||
|
Int32 unixTimestamp = (int)st.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;
|
||||||
|
Int32 unixTimestamp2 = (int)ed.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;
|
||||||
|
// int? fromDateUnixTime = null; // unix time - for instance: 1700598600
|
||||||
|
//int? toDateUnixTime = null; // unix time - for instance: 1703190600
|
||||||
|
int pageNumber = 2;
|
||||||
|
int pageSize = 100; // max: 100
|
||||||
|
SmsIr smsIr = new SmsIr("Og5M562igmzJRhQPnq0GdtieYdLgtfikjzxOmeQBPxJjZtyge5Klc046Lfw1mxSa");
|
||||||
|
var response = await smsIr.GetArchivedReportAsync(pageNumber, pageSize, unixTimestamp, unixTimestamp2);
|
||||||
|
|
||||||
|
MessageReportResult[] messages = response.Data;
|
||||||
|
foreach (var message in messages)
|
||||||
|
{
|
||||||
|
var appendData = new ApiReportDto()
|
||||||
|
{
|
||||||
|
MessageId = message.MessageId,
|
||||||
|
|
||||||
|
Mobile = message.Mobile,
|
||||||
|
|
||||||
|
SendUnixTime = UnixTimeStampToDateTime(message.SendDateTime),
|
||||||
|
DeliveryState = DeliveryStatus(message.DeliveryState),
|
||||||
|
DeliveryUnixTime = UnixTimeStampToDateTime(message.DeliveryDateTime),
|
||||||
|
DeliveryColor = DeliveryColorStatus(message.DeliveryState),
|
||||||
|
};
|
||||||
|
res.Add(appendData);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
public string DeliveryStatus(byte? dv)
|
public string DeliveryStatus(byte? dv)
|
||||||
{
|
{
|
||||||
string mess = "";
|
string mess = "";
|
||||||
|
|||||||
@@ -563,6 +563,7 @@ public class PersonalBootstrapper
|
|||||||
services.AddTransient<ISmsSettingsRepository, SmsSettingsRepository>();
|
services.AddTransient<ISmsSettingsRepository, SmsSettingsRepository>();
|
||||||
services.AddTransient<ISmsSettingApplication, SmsSettingApplication>();
|
services.AddTransient<ISmsSettingApplication, SmsSettingApplication>();
|
||||||
|
|
||||||
|
services.AddTransient<IInstitutionContractSmsServiceRepository, InstitutionContractSmsServiceRepository>();
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -209,22 +209,38 @@ public class CreateOrEditCheckoutCommandHandler : IBaseCommandHandler<CreateOrEd
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
//حقوق نهایی
|
////حقوق نهایی
|
||||||
var monthlySalaryPay = (totalHoursWorked * monthlySalaryDefined) / mandatoryHours;
|
//var monthlySalaryPay = (totalHoursWorked * monthlySalaryDefined) / mandatoryHours;
|
||||||
// اگر اضافه کار داشت حقوق تعین شده به عنوان حقوق نهایی در نظر گرفته میشود
|
//// اگر اضافه کار داشت حقوق تعین شده به عنوان حقوق نهایی در نظر گرفته میشود
|
||||||
monthlySalaryPay = monthlySalaryPay > monthlySalaryDefined ? monthlySalaryDefined : monthlySalaryPay;
|
//monthlySalaryPay = monthlySalaryPay > monthlySalaryDefined ? monthlySalaryDefined : monthlySalaryPay;
|
||||||
|
|
||||||
//حقوق کسر شده
|
////حقوق کسر شده
|
||||||
var deductionFromSalary = monthlySalaryDefined - monthlySalaryPay;
|
//var deductionFromSalary = monthlySalaryDefined - monthlySalaryPay;
|
||||||
|
|
||||||
|
//new chang salary compute
|
||||||
|
var monthlySalaryPay = totalHoursWorked * monthlySalaryDefined;
|
||||||
|
|
||||||
//زمان باقی مانده
|
//زمان باقی مانده
|
||||||
var remainingTime = totalHoursWorked - mandatoryHours;
|
var remainingTime = totalHoursWorked - mandatoryHours;
|
||||||
|
|
||||||
|
|
||||||
|
//تناسب به دقیقه
|
||||||
|
#region MyRegion
|
||||||
|
|
||||||
|
//var monthlySalaryDefinedTest = monthlySalaryDefined * mandatoryHours;
|
||||||
|
//var monthlySalaryPayTest = totalHoursWorked * monthlySalaryDefined;
|
||||||
|
////// اگر اضافه کار داشت حقوق تعین شده به عنوان حقوق نهایی در نظر گرفته میشود
|
||||||
|
//monthlySalaryPayTest = monthlySalaryPayTest > monthlySalaryDefinedTest ? monthlySalaryDefinedTest : monthlySalaryPayTest;
|
||||||
|
//////حقوق کسر شده
|
||||||
|
//var deductionFromSalaryTest = monthlySalaryDefinedTest - monthlySalaryPayTest;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
var computeResult = new ComputeResultDto
|
var computeResult = new ComputeResultDto
|
||||||
{
|
{
|
||||||
MandatoryHours = mandatoryHours,
|
MandatoryHours = mandatoryHours,
|
||||||
MonthlySalaryPay = monthlySalaryPay,
|
MonthlySalaryPay = monthlySalaryPay,
|
||||||
DeductionFromSalary = deductionFromSalary,
|
DeductionFromSalary = 0 /*deductionFromSalary*/,
|
||||||
RemainingHours = remainingTime
|
RemainingHours = remainingTime
|
||||||
};
|
};
|
||||||
Console.WriteLine(mandatoryHours);
|
Console.WriteLine(mandatoryHours);
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
using GozareshgirProgramManager.Application._Common.Interfaces;
|
using DNTPersianUtils.Core;
|
||||||
|
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||||
using GozareshgirProgramManager.Application._Common.Models;
|
using GozareshgirProgramManager.Application._Common.Models;
|
||||||
using GozareshgirProgramManager.Application.Modules.SalaryPaymentSettings.Queries.GetUserListWhoHaveSettings;
|
using GozareshgirProgramManager.Application.Modules.SalaryPaymentSettings.Queries.GetUserListWhoHaveSettings;
|
||||||
using GozareshgirProgramManager.Domain._Common;
|
using GozareshgirProgramManager.Domain._Common;
|
||||||
using GozareshgirProgramManager.Domain.CheckoutAgg.Enums;
|
using GozareshgirProgramManager.Domain.CheckoutAgg.Enums;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using PersianTools.Core;
|
using PersianDateTime = PersianTools.Core.PersianDateTime;
|
||||||
|
|
||||||
namespace GozareshgirProgramManager.Application.Modules.Checkouts.Queries.GetUserToGropCreate;
|
namespace GozareshgirProgramManager.Application.Modules.Checkouts.Queries.GetUserToGropCreate;
|
||||||
|
|
||||||
@@ -45,8 +46,8 @@ public class GetUserToGroupCreatingQueryHandler : IBaseQueryHandler<GetUserToGro
|
|||||||
"ایجاد فیش فقط برای ماه های گذشته امکان پذیر است");
|
"ایجاد فیش فقط برای ماه های گذشته امکان پذیر است");
|
||||||
|
|
||||||
|
|
||||||
var lastMonthStart = lastMonth;
|
//var lastMonthStart = lastMonth;
|
||||||
var lastMonthEnd = lastMonth;
|
var lastMonthEnd = ((selectedDate.ToFarsi().FindeEndOfMonth())).ToGeorgianDateTime();
|
||||||
|
|
||||||
var query =
|
var query =
|
||||||
await (from u in _context.Users
|
await (from u in _context.Users
|
||||||
@@ -60,8 +61,8 @@ public class GetUserToGroupCreatingQueryHandler : IBaseQueryHandler<GetUserToGro
|
|||||||
// LEFT JOIN
|
// LEFT JOIN
|
||||||
//فیش
|
//فیش
|
||||||
join ch in _context.Checkouts
|
join ch in _context.Checkouts
|
||||||
.Where(x => x.CheckoutStartDate < lastMonthStart
|
.Where(x => x.CheckoutStartDate < lastMonthEnd
|
||||||
&& x.CheckoutEndDate >= lastMonthStart)
|
&& x.CheckoutEndDate > selectedDate)
|
||||||
on u.Id equals ch.UserId into chJoin
|
on u.Id equals ch.UserId into chJoin
|
||||||
from ch in chJoin.DefaultIfEmpty()
|
from ch in chJoin.DefaultIfEmpty()
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,9 @@ using GozareshgirProgramManager.Application._Common.Interfaces;
|
|||||||
using GozareshgirProgramManager.Application._Common.Models;
|
using GozareshgirProgramManager.Application._Common.Models;
|
||||||
using GozareshgirProgramManager.Domain._Common;
|
using GozareshgirProgramManager.Domain._Common;
|
||||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
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.Enums;
|
||||||
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
||||||
using GozareshgirProgramManager.Domain.SkillAgg.Repositories;
|
using GozareshgirProgramManager.Domain.SkillAgg.Repositories;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using System.Linq;
|
|||||||
using GozareshgirProgramManager.Application._Common.Interfaces;
|
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||||
using GozareshgirProgramManager.Application._Common.Models;
|
using GozareshgirProgramManager.Application._Common.Models;
|
||||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||||
|
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase;
|
||||||
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using GozareshgirProgramManager.Application._Common.Interfaces;
|
|||||||
using GozareshgirProgramManager.Application._Common.Models;
|
using GozareshgirProgramManager.Application._Common.Models;
|
||||||
using GozareshgirProgramManager.Domain._Common;
|
using GozareshgirProgramManager.Domain._Common;
|
||||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||||
|
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase;
|
||||||
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
||||||
|
|
||||||
namespace GozareshgirProgramManager.Application.Modules.Projects.Commands.ChangeDeployStatusProject;
|
namespace GozareshgirProgramManager.Application.Modules.Projects.Commands.ChangeDeployStatusProject;
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
using GozareshgirProgramManager.Application._Common.Interfaces;
|
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||||
using GozareshgirProgramManager.Application._Common.Models;
|
using GozareshgirProgramManager.Application._Common.Models;
|
||||||
using GozareshgirProgramManager.Domain._Common;
|
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.Enums;
|
||||||
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
||||||
|
|
||||||
@@ -69,7 +71,7 @@ public class ChangeTaskPriorityCommandHandler : IBaseCommandHandler<ChangeTaskPr
|
|||||||
if (phase is null)
|
if (phase is null)
|
||||||
return OperationResult.NotFound("فاز یافت نشد");
|
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)
|
foreach (var t in tasks)
|
||||||
{
|
{
|
||||||
if (t.Priority != priority)
|
if (t.Priority != priority)
|
||||||
@@ -89,10 +91,10 @@ public class ChangeTaskPriorityCommandHandler : IBaseCommandHandler<ChangeTaskPr
|
|||||||
if (project is null)
|
if (project is null)
|
||||||
return OperationResult.NotFound("پروژه یافت نشد");
|
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)
|
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)
|
foreach (var t in tasks)
|
||||||
{
|
{
|
||||||
if (t.Priority != priority)
|
if (t.Priority != priority)
|
||||||
|
|||||||
@@ -3,6 +3,9 @@ using GozareshgirProgramManager.Application._Common.Models;
|
|||||||
using GozareshgirProgramManager.Domain._Common;
|
using GozareshgirProgramManager.Domain._Common;
|
||||||
using GozareshgirProgramManager.Domain._Common.Exceptions;
|
using GozareshgirProgramManager.Domain._Common.Exceptions;
|
||||||
using GozareshgirProgramManager.Domain.ProjectAgg.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.Enums;
|
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
||||||
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using GozareshgirProgramManager.Application._Common.Interfaces;
|
|||||||
using GozareshgirProgramManager.Application._Common.Models;
|
using GozareshgirProgramManager.Application._Common.Models;
|
||||||
using GozareshgirProgramManager.Domain._Common;
|
using GozareshgirProgramManager.Domain._Common;
|
||||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||||
|
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project;
|
||||||
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
||||||
using MediatR;
|
using MediatR;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
using GozareshgirProgramManager.Application._Common.Interfaces;
|
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||||
using GozareshgirProgramManager.Application.Modules.Projects.DTOs;
|
using GozareshgirProgramManager.Application.Modules.Projects.DTOs;
|
||||||
|
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||||
|
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
|
||||||
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
||||||
|
|
||||||
namespace GozareshgirProgramManager.Application.Modules.Projects.Commands.SetTimeProject;
|
namespace GozareshgirProgramManager.Application.Modules.Projects.Commands.SetTimeProject;
|
||||||
@@ -15,4 +17,5 @@ public class SetTimeSectionTime
|
|||||||
public string Description { get; set; }
|
public string Description { get; set; }
|
||||||
public int Hours { get; set; }
|
public int Hours { get; set; }
|
||||||
public int Minutes { 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;
|
||||||
using GozareshgirProgramManager.Domain._Common.Exceptions;
|
using GozareshgirProgramManager.Domain._Common.Exceptions;
|
||||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
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.Enums;
|
||||||
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
||||||
using GozareshgirProgramManager.Domain.SkillAgg.Repositories;
|
using GozareshgirProgramManager.Domain.SkillAgg.Repositories;
|
||||||
@@ -369,7 +372,7 @@ public class SetTimeProjectCommandHandler : IBaseCommandHandler<SetTimeProjectCo
|
|||||||
foreach (var additionalTime in sectionItem.AdditionalTime)
|
foreach (var additionalTime in sectionItem.AdditionalTime)
|
||||||
{
|
{
|
||||||
var additionalTimeSpan = TimeSpan.FromHours(additionalTime.Hours).Add(TimeSpan.FromMinutes(additionalTime.Minutes));
|
var additionalTimeSpan = TimeSpan.FromHours(additionalTime.Hours).Add(TimeSpan.FromMinutes(additionalTime.Minutes));
|
||||||
section.AddAdditionalTime(additionalTimeSpan, additionalTime.Description, addedByUserId);
|
section.AddAdditionalTime(additionalTimeSpan, additionalTime.Type, additionalTime.Description, addedByUserId);
|
||||||
hasAdditionalTime = true;
|
hasAdditionalTime = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
using GozareshgirProgramManager.Application.Modules.Projects.DTOs;
|
using GozareshgirProgramManager.Application.Modules.Projects.DTOs;
|
||||||
using GozareshgirProgramManager.Domain.ProjectAgg.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.ProjectAgg.Enums;
|
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
||||||
|
|
||||||
namespace GozareshgirProgramManager.Application.Modules.Projects.Extensions;
|
namespace GozareshgirProgramManager.Application.Modules.Projects.Extensions;
|
||||||
|
|||||||
@@ -4,6 +4,10 @@ using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
|||||||
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using System.Linq;
|
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;
|
namespace GozareshgirProgramManager.Application.Modules.Projects.Queries.GetProjectsList;
|
||||||
|
|
||||||
|
|||||||
@@ -7,5 +7,6 @@ namespace GozareshgirProgramManager.Application.Modules.Projects.Queries.Project
|
|||||||
public record ProjectBoardListQuery: IBaseQuery<List<ProjectBoardListResponse>>
|
public record ProjectBoardListQuery: IBaseQuery<List<ProjectBoardListResponse>>
|
||||||
{
|
{
|
||||||
public long? UserId { get; set; }
|
public long? UserId { get; set; }
|
||||||
|
public string? SearchText { get; set; }
|
||||||
public TaskSectionStatus? Status { get; set; }
|
public TaskSectionStatus? Status { get; set; }
|
||||||
}
|
}
|
||||||
@@ -3,7 +3,6 @@ using GozareshgirProgramManager.Application._Common.Interfaces;
|
|||||||
using GozareshgirProgramManager.Application._Common.Models;
|
using GozareshgirProgramManager.Application._Common.Models;
|
||||||
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Query.Internal;
|
|
||||||
|
|
||||||
namespace GozareshgirProgramManager.Application.Modules.Projects.Queries.ProjectBoardList;
|
namespace GozareshgirProgramManager.Application.Modules.Projects.Queries.ProjectBoardList;
|
||||||
|
|
||||||
@@ -24,7 +23,8 @@ public class ProjectBoardListQueryHandler : IBaseQueryHandler<ProjectBoardListQu
|
|||||||
var currentUserId = _authHelper.GetCurrentUserId();
|
var currentUserId = _authHelper.GetCurrentUserId();
|
||||||
|
|
||||||
var queryable = _programManagerDbContext.TaskSections.AsNoTracking()
|
var queryable = _programManagerDbContext.TaskSections.AsNoTracking()
|
||||||
.Where(x => x.InitialEstimatedHours > TimeSpan.Zero && x.Status != TaskSectionStatus.Completed)
|
.Where(x => x.InitialEstimatedHours > TimeSpan.Zero
|
||||||
|
&& x.Status != TaskSectionStatus.Completed)
|
||||||
.Include(x => x.Task)
|
.Include(x => x.Task)
|
||||||
.ThenInclude(x => x.Phase)
|
.ThenInclude(x => x.Phase)
|
||||||
.ThenInclude(x => x.Project)
|
.ThenInclude(x => x.Project)
|
||||||
@@ -46,9 +46,17 @@ public class ProjectBoardListQueryHandler : IBaseQueryHandler<ProjectBoardListQu
|
|||||||
queryable = queryable.Where(x => x.CurrentAssignedUserId == request.UserId);
|
queryable = queryable.Where(x => x.CurrentAssignedUserId == request.UserId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(request.SearchText))
|
||||||
|
{
|
||||||
|
queryable = queryable.Where(x=>x.Task.Name.Contains(request.SearchText)
|
||||||
|
|| x.Task.Phase.Name.Contains(request.SearchText)
|
||||||
|
|| x.Task.Phase.Project.Name.Contains(request.SearchText));
|
||||||
|
}
|
||||||
|
|
||||||
var data = await queryable.ToListAsync(cancellationToken);
|
var data = await queryable.ToListAsync(cancellationToken);
|
||||||
|
|
||||||
var activityUserIds = data.SelectMany(x => x.Activities).Select(a => a.UserId).Distinct().ToList();
|
var activityUserIds = data.SelectMany(x => x.Activities)
|
||||||
|
.Select(a => a.UserId).Distinct().ToList();
|
||||||
var assignedUser = data.Select(x => x.CurrentAssignedUserId)
|
var assignedUser = data.Select(x => x.CurrentAssignedUserId)
|
||||||
.Concat(data.Select(x => x.OriginalAssignedUserId)).ToList();
|
.Concat(data.Select(x => x.OriginalAssignedUserId)).ToList();
|
||||||
var allUserIds = activityUserIds.Concat(assignedUser).Distinct().ToList();
|
var allUserIds = activityUserIds.Concat(assignedUser).Distinct().ToList();
|
||||||
@@ -72,7 +80,7 @@ public class ProjectBoardListQueryHandler : IBaseQueryHandler<ProjectBoardListQu
|
|||||||
{
|
{
|
||||||
Activity = a,
|
Activity = a,
|
||||||
TimeSpent = timeSpent,
|
TimeSpent = timeSpent,
|
||||||
TotalSeconds = timeSpent.TotalSeconds,
|
timeSpent.TotalSeconds,
|
||||||
FormattedTime = timeSpent.ToString(@"hh\:mm")
|
FormattedTime = timeSpent.ToString(@"hh\:mm")
|
||||||
};
|
};
|
||||||
}).ToList();
|
}).ToList();
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using GozareshgirProgramManager.Application._Common.Interfaces;
|
|||||||
using GozareshgirProgramManager.Application._Common.Models;
|
using GozareshgirProgramManager.Application._Common.Models;
|
||||||
using GozareshgirProgramManager.Application.Modules.Projects.Queries.GetProjectsList;
|
using GozareshgirProgramManager.Application.Modules.Projects.Queries.GetProjectsList;
|
||||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||||
|
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase;
|
||||||
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ public class ProjectSetTimeDetailsQueryHandler
|
|||||||
|
|
||||||
var skills = await _context.Skills
|
var skills = await _context.Skills
|
||||||
.AsNoTracking()
|
.AsNoTracking()
|
||||||
|
.OrderBy(x=>x.CreationDate)
|
||||||
.ToListAsync(cancellationToken);
|
.ToListAsync(cancellationToken);
|
||||||
|
|
||||||
var res = new ProjectSetTimeResponse(
|
var res = new ProjectSetTimeResponse(
|
||||||
@@ -84,7 +85,7 @@ public class ProjectSetTimeDetailsQueryHandler
|
|||||||
UserId = section?.OriginalAssignedUserId ?? 0,
|
UserId = section?.OriginalAssignedUserId ?? 0,
|
||||||
SkillId = skill.Id,
|
SkillId = skill.Id,
|
||||||
};
|
};
|
||||||
}).OrderBy(x => x.SkillId).ToList(),
|
}).ToList(),
|
||||||
task.Id,
|
task.Id,
|
||||||
level);
|
level);
|
||||||
|
|
||||||
@@ -114,6 +115,7 @@ public class ProjectSetTimeDetailsQueryHandler
|
|||||||
|
|
||||||
var skills = await _context.Skills
|
var skills = await _context.Skills
|
||||||
.AsNoTracking()
|
.AsNoTracking()
|
||||||
|
.OrderBy(x=>x.CreationDate)
|
||||||
.ToListAsync(cancellationToken);
|
.ToListAsync(cancellationToken);
|
||||||
|
|
||||||
var res = new ProjectSetTimeResponse(
|
var res = new ProjectSetTimeResponse(
|
||||||
@@ -135,7 +137,7 @@ public class ProjectSetTimeDetailsQueryHandler
|
|||||||
UserId = section?.UserId ?? 0,
|
UserId = section?.UserId ?? 0,
|
||||||
SkillId = skill.Id,
|
SkillId = skill.Id,
|
||||||
};
|
};
|
||||||
}).OrderBy(x => x.SkillId).ToList(),
|
}).ToList(),
|
||||||
phase.Id,
|
phase.Id,
|
||||||
level);
|
level);
|
||||||
|
|
||||||
@@ -165,6 +167,7 @@ public class ProjectSetTimeDetailsQueryHandler
|
|||||||
|
|
||||||
var skills = await _context.Skills
|
var skills = await _context.Skills
|
||||||
.AsNoTracking()
|
.AsNoTracking()
|
||||||
|
.OrderBy(x=>x.CreationDate)
|
||||||
.ToListAsync(cancellationToken);
|
.ToListAsync(cancellationToken);
|
||||||
|
|
||||||
var res = new ProjectSetTimeResponse(
|
var res = new ProjectSetTimeResponse(
|
||||||
@@ -186,7 +189,7 @@ public class ProjectSetTimeDetailsQueryHandler
|
|||||||
UserId = section?.UserId ?? 0,
|
UserId = section?.UserId ?? 0,
|
||||||
SkillId = skill.Id,
|
SkillId = skill.Id,
|
||||||
};
|
};
|
||||||
}).OrderBy(x => x.SkillId).ToList(),
|
}).ToList(),
|
||||||
project.Id,
|
project.Id,
|
||||||
level);
|
level);
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,16 @@
|
|||||||
using GozareshgirProgramManager.Application._Common.Interfaces;
|
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||||
using GozareshgirProgramManager.Application._Common.Models;
|
using GozareshgirProgramManager.Application._Common.Models;
|
||||||
using GozareshgirProgramManager.Application.Modules.TaskChat.DTOs;
|
using GozareshgirProgramManager.Application.Modules.TaskChat.DTOs;
|
||||||
|
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
|
||||||
|
using GozareshgirProgramManager.Domain.TaskChatAgg.Enums;
|
||||||
|
using MediatR;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace GozareshgirProgramManager.Application.Modules.TaskChat.Queries.GetMessages;
|
namespace GozareshgirProgramManager.Application.Modules.TaskChat.Queries.GetMessages;
|
||||||
|
|
||||||
public record GetMessagesQuery(
|
public record GetMessagesQuery(
|
||||||
Guid TaskId,
|
Guid TaskId,
|
||||||
|
MessageType? MessageType,
|
||||||
int Page = 1,
|
int Page = 1,
|
||||||
int PageSize = 50
|
int PageSize = 50
|
||||||
) : IBaseQuery<PaginationResult<MessageDto>>;
|
) : IBaseQuery<PaginationResult<MessageDto>>;
|
||||||
@@ -25,7 +29,7 @@ public class GetMessagesQueryHandler : IBaseQueryHandler<GetMessagesQuery, Pagin
|
|||||||
}
|
}
|
||||||
|
|
||||||
private List<MessageDto> CreateAdditionalTimeNotes(
|
private List<MessageDto> CreateAdditionalTimeNotes(
|
||||||
IEnumerable<Domain.ProjectAgg.Entities.TaskSectionAdditionalTime> additionalTimes,
|
IEnumerable<TaskSectionAdditionalTime> additionalTimes,
|
||||||
Dictionary<long, string> users,
|
Dictionary<long, string> users,
|
||||||
Guid taskId)
|
Guid taskId)
|
||||||
{
|
{
|
||||||
@@ -66,7 +70,12 @@ public class GetMessagesQueryHandler : IBaseQueryHandler<GetMessagesQuery, Pagin
|
|||||||
var query = _context.TaskChatMessages
|
var query = _context.TaskChatMessages
|
||||||
.Where(m => m.TaskId == request.TaskId && !m.IsDeleted)
|
.Where(m => m.TaskId == request.TaskId && !m.IsDeleted)
|
||||||
.Include(m => m.ReplyToMessage)
|
.Include(m => m.ReplyToMessage)
|
||||||
.OrderBy(m => m.CreationDate);
|
.OrderBy(m => m.CreationDate).AsQueryable();
|
||||||
|
|
||||||
|
if (request.MessageType.HasValue)
|
||||||
|
{
|
||||||
|
query = query.Where(m => m.MessageType == request.MessageType.Value);
|
||||||
|
}
|
||||||
|
|
||||||
var totalCount = await query.CountAsync(cancellationToken);
|
var totalCount = await query.CountAsync(cancellationToken);
|
||||||
|
|
||||||
|
|||||||
@@ -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,66 @@
|
|||||||
|
using GozareshgirProgramManager.Application._Common.Extensions;
|
||||||
|
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||||
|
using GozareshgirProgramManager.Application._Common.Models;
|
||||||
|
using GozareshgirProgramManager.Domain._Common;
|
||||||
|
using GozareshgirProgramManager.Domain._Common.Exceptions;
|
||||||
|
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
namespace GozareshgirProgramManager.Application.Modules.TaskSectionTimeRequests.Queries.CreateTimeRequestDetails;
|
||||||
|
|
||||||
|
public record CreateTimeRequestDetailsResponse(List<CreateTimeRequestDetailsRevision> Revisions,
|
||||||
|
string ProjectName,string PhaseName,string SectionName,string SkillName);
|
||||||
|
|
||||||
|
public record CreateTimeRequestDetailsRevision(string Message, List<UploadedFileDto> Files,Guid Id,string CreationDate);
|
||||||
|
|
||||||
|
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 section =await _context.TaskSections
|
||||||
|
.Include(x => x.Task)
|
||||||
|
.ThenInclude(x => x.Phase)
|
||||||
|
.ThenInclude(x => x.Project)
|
||||||
|
.Include(x => x.Skill)
|
||||||
|
.FirstOrDefaultAsync(x => x.Id == request.TaskSectionId, cancellationToken: cancellationToken);
|
||||||
|
|
||||||
|
if (section == null)
|
||||||
|
{
|
||||||
|
throw new BadRequestException("بخش فرعی نامعتبر است");
|
||||||
|
}
|
||||||
|
|
||||||
|
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.FileId).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,x.Id,x.CreationDate.ToFarsi());
|
||||||
|
}).ToList();
|
||||||
|
var res = new CreateTimeRequestDetailsResponse(resItem,section.Task.Phase.Project.Name,section.Task.Phase.Name,section.Task.Name,
|
||||||
|
section.Skill!.Name);
|
||||||
|
|
||||||
|
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,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,
|
||||||
|
}
|
||||||
|
|
||||||
|
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>();
|
||||||
|
|
||||||
|
foreach (var provider in _providers)
|
||||||
|
{
|
||||||
|
var providerItems = await provider.GetItems(currentUserId, _context, cancellationToken);
|
||||||
|
if (providerItems?.Count > 0)
|
||||||
|
items.AddRange(providerItems);
|
||||||
|
}
|
||||||
|
|
||||||
|
var res = new WorkflowListResponse(items);
|
||||||
|
return OperationResult<WorkflowListResponse>.Success(res);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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 Microsoft.EntityFrameworkCore;
|
||||||
using GozareshgirProgramManager.Domain.TaskChatAgg.Entities;
|
using GozareshgirProgramManager.Domain.TaskChatAgg.Entities;
|
||||||
using GozareshgirProgramManager.Domain.FileManagementAgg.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;
|
namespace GozareshgirProgramManager.Application._Common.Interfaces;
|
||||||
|
|
||||||
@@ -31,6 +35,12 @@ public interface IProgramManagerDbContext
|
|||||||
DbSet<TaskChatMessage> TaskChatMessages { get; set; }
|
DbSet<TaskChatMessage> TaskChatMessages { get; set; }
|
||||||
DbSet<UploadedFile> UploadedFiles { 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; }
|
DbSet<Skill> Skills { get; set; }
|
||||||
Task<int> SaveChangesAsync(CancellationToken cancellationToken = default);
|
Task<int> SaveChangesAsync(CancellationToken cancellationToken = default);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ public class OperationResult
|
|||||||
|
|
||||||
// Helper methods for specific error types
|
// Helper methods for specific error types
|
||||||
public static OperationResult NotFound(string errorMessage) => new(false, errorMessage, errorType: ErrorType.NotFound);
|
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(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 ValidationError(List<string> errors) => new(false, errors: errors, errorType: ErrorType.Validation);
|
||||||
public static OperationResult InternalServerError(string errorMessage) => new(false, errorMessage, errorType: ErrorType.InternalServerError);
|
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,7 @@ public enum FileCategory
|
|||||||
ProjectDocument = 3, // مستندات پروژه
|
ProjectDocument = 3, // مستندات پروژه
|
||||||
UserProfilePhoto = 4, // عکس پروفایل کاربر
|
UserProfilePhoto = 4, // عکس پروفایل کاربر
|
||||||
Report = 5, // گزارش
|
Report = 5, // گزارش
|
||||||
Other = 6 // سایر
|
Other = 6, // سایر
|
||||||
|
TaskSectionRevision
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
using GozareshgirProgramManager.Domain._Common;
|
using GozareshgirProgramManager.Domain._Common;
|
||||||
using GozareshgirProgramManager.Domain.SkillAgg.Entities;
|
using GozareshgirProgramManager.Domain.SkillAgg.Entities;
|
||||||
|
|
||||||
namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// بخش فاز - برای ذخیره تخصیص کاربر و مهارت در سطح Phase
|
/// بخش فاز - برای ذخیره تخصیص کاربر و مهارت در سطح 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.Enums;
|
||||||
using GozareshgirProgramManager.Domain.ProjectAgg.Events;
|
using GozareshgirProgramManager.Domain.ProjectAgg.Events;
|
||||||
|
|
||||||
namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// فاز پروژه - سطح میانی در سلسله مراتب
|
/// فاز پروژه - سطح میانی در سلسله مراتب
|
||||||
@@ -28,7 +29,7 @@ public class ProjectPhase : ProjectHierarchyNode
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Guid ProjectId { get; private set; }
|
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<ProjectTask> Tasks => _tasks.AsReadOnly();
|
||||||
public IReadOnlyList<PhaseSection> PhaseSections => _phaseSections.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.Enums;
|
||||||
using GozareshgirProgramManager.Domain.ProjectAgg.Events;
|
using GozareshgirProgramManager.Domain.ProjectAgg.Events;
|
||||||
|
|
||||||
namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// پروژه - بالاترین سطح در سلسله مراتب و Aggregate Root
|
/// پروژه - بالاترین سطح در سلسله مراتب و Aggregate Root
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
using GozareshgirProgramManager.Domain._Common;
|
using GozareshgirProgramManager.Domain._Common;
|
||||||
using GozareshgirProgramManager.Domain.SkillAgg.Entities;
|
using GozareshgirProgramManager.Domain.SkillAgg.Entities;
|
||||||
|
|
||||||
namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ProjectSection: shortcut container for UserId + SkillId at Project level
|
/// ProjectSection: shortcut container for UserId + SkillId at Project level
|
||||||
@@ -1,32 +1,32 @@
|
|||||||
using GozareshgirProgramManager.Domain._Common;
|
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase;
|
||||||
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
||||||
using GozareshgirProgramManager.Domain.ProjectAgg.Events;
|
using GozareshgirProgramManager.Domain.ProjectAgg.Events;
|
||||||
|
|
||||||
namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// تسک - پایینترین سطح در سلسله مراتب که شامل بخشها میشود
|
/// تسک - پایینترین سطح در سلسله مراتب که شامل بخشها میشود
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class ProjectTask : ProjectHierarchyNode
|
public class ProjectTask : ProjectHierarchyNode
|
||||||
{
|
{
|
||||||
private readonly List<TaskSection> _sections;
|
private readonly List<TaskSection.TaskSection> _sections;
|
||||||
|
|
||||||
private ProjectTask()
|
private ProjectTask()
|
||||||
{
|
{
|
||||||
_sections = new List<TaskSection>();
|
_sections = new List<TaskSection.TaskSection>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProjectTask(string name, Guid phaseId, string? description = null) : base(name, description)
|
public ProjectTask(string name, Guid phaseId, string? description = null) : base(name, description)
|
||||||
{
|
{
|
||||||
PhaseId = phaseId;
|
PhaseId = phaseId;
|
||||||
_sections = new List<TaskSection>();
|
_sections = new List<TaskSection.TaskSection>();
|
||||||
Priority = ProjectTaskPriority.Medium;
|
Priority = ProjectTaskPriority.Low;
|
||||||
AddDomainEvent(new TaskCreatedEvent(Id, phaseId, name));
|
AddDomainEvent(new TaskCreatedEvent(Id, phaseId, name));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Guid PhaseId { get; private set; }
|
public Guid PhaseId { get; private set; }
|
||||||
public ProjectPhase Phase { get; private set; } = null!;
|
public ProjectPhase Phase { get; private set; } = null!;
|
||||||
public IReadOnlyList<TaskSection> Sections => _sections.AsReadOnly();
|
public IReadOnlyList<TaskSection.TaskSection> Sections => _sections.AsReadOnly();
|
||||||
|
|
||||||
// Task-specific properties
|
// Task-specific properties
|
||||||
public Enums.TaskStatus Status { get; private set; } = Enums.TaskStatus.NotStarted;
|
public Enums.TaskStatus Status { get; private set; } = Enums.TaskStatus.NotStarted;
|
||||||
@@ -40,7 +40,7 @@ public class ProjectTask : ProjectHierarchyNode
|
|||||||
|
|
||||||
#region Section Management
|
#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);
|
var existingSection = _sections.FirstOrDefault(s => s.SkillId == section.SkillId);
|
||||||
if (existingSection != null)
|
if (existingSection != null)
|
||||||
@@ -84,7 +84,7 @@ public class ProjectTask : ProjectHierarchyNode
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var section = new TaskSection(Id, skillId, assignedUserId);
|
var section = new TaskSection.TaskSection(Id, skillId, assignedUserId);
|
||||||
_sections.Add(section);
|
_sections.Add(section);
|
||||||
AddDomainEvent(new TaskSectionAddedEvent(Id, section.Id, skillId));
|
AddDomainEvent(new TaskSectionAddedEvent(Id, section.Id, skillId));
|
||||||
}
|
}
|
||||||
@@ -204,12 +204,12 @@ public class ProjectTask : ProjectHierarchyNode
|
|||||||
|
|
||||||
#region Query Helpers
|
#region Query Helpers
|
||||||
|
|
||||||
public IEnumerable<TaskSection> GetSectionsBySkill(Guid skillId)
|
public IEnumerable<TaskSection.TaskSection> GetSectionsBySkill(Guid skillId)
|
||||||
{
|
{
|
||||||
return _sections.Where(s => s.SkillId == 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);
|
return _sections.FirstOrDefault(s => s.SkillId == skillId);
|
||||||
}
|
}
|
||||||
@@ -219,7 +219,7 @@ public class ProjectTask : ProjectHierarchyNode
|
|||||||
return _sections.Any(s => s.SkillId == skillId);
|
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);
|
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._Common.Exceptions;
|
||||||
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
||||||
using GozareshgirProgramManager.Domain.ProjectAgg.Events;
|
using GozareshgirProgramManager.Domain.ProjectAgg.Events;
|
||||||
using GozareshgirProgramManager.Domain.ProjectAgg.Models;
|
|
||||||
using GozareshgirProgramManager.Domain.SkillAgg.Entities;
|
using GozareshgirProgramManager.Domain.SkillAgg.Entities;
|
||||||
|
|
||||||
namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// بخش تسک - برای ذخیره کار واقعی که کاربر روی یک مهارت خاص انجام میدهد
|
/// بخش تسک - برای ذخیره کار واقعی که کاربر روی یک مهارت خاص انجام میدهد
|
||||||
@@ -61,12 +59,13 @@ public class TaskSection : EntityBase<Guid>
|
|||||||
// برای backward compatibility
|
// برای backward compatibility
|
||||||
public TimeSpan EstimatedHours => FinalEstimatedHours;
|
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)
|
if (additionalHours <= TimeSpan.Zero)
|
||||||
throw new BadRequestException("تایم اضافی باید بزرگتر از صفر باشد", nameof(additionalHours));
|
throw new BadRequestException("تایم اضافی باید بزرگتر از صفر باشد", nameof(additionalHours));
|
||||||
|
|
||||||
var additionalTime = new TaskSectionAdditionalTime(additionalHours, reason, addedByUserId);
|
var additionalTime = new TaskSectionAdditionalTime(additionalHours,type, reason, addedByUserId);
|
||||||
_additionalTimes.Add(additionalTime);
|
_additionalTimes.Add(additionalTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
using System.Diagnostics.CodeAnalysis;
|
|
||||||
using GozareshgirProgramManager.Domain._Common;
|
using GozareshgirProgramManager.Domain._Common;
|
||||||
|
|
||||||
namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// فعالیت کاری روی یک بخش
|
/// فعالیت کاری روی یک بخش
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
using GozareshgirProgramManager.Domain._Common;
|
using GozareshgirProgramManager.Domain._Common;
|
||||||
|
|
||||||
namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// زمان اضافی اضافه شده بعد از تخمین اولیه
|
/// زمان اضافی اضافه شده بعد از تخمین اولیه
|
||||||
@@ -9,12 +9,13 @@ public class TaskSectionAdditionalTime : EntityBase<Guid>
|
|||||||
{
|
{
|
||||||
private TaskSectionAdditionalTime() { }
|
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;
|
Hours = hours;
|
||||||
Reason = reason;
|
Reason = reason;
|
||||||
AddedByUserId = addedByUserId;
|
AddedByUserId = addedByUserId;
|
||||||
AddedAt = DateTime.UtcNow;
|
AddedAt = DateTime.Now;
|
||||||
|
Type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TimeSpan Hours { get; private set; }
|
public TimeSpan Hours { get; private set; }
|
||||||
@@ -22,8 +23,15 @@ public class TaskSectionAdditionalTime : EntityBase<Guid>
|
|||||||
public long? AddedByUserId { get; private set; }
|
public long? AddedByUserId { get; private set; }
|
||||||
public DateTime AddedAt { get; private set; }
|
public DateTime AddedAt { get; private set; }
|
||||||
|
|
||||||
|
public TaskSectionAdditionalTimeType Type { get; set; }
|
||||||
public void UpdateReason(string? reason)
|
public void UpdateReason(string? reason)
|
||||||
{
|
{
|
||||||
Reason = reason;
|
Reason = reason;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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,
|
||||||
|
}
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||||
using GozareshgirProgramManager.Domain._Common;
|
using GozareshgirProgramManager.Domain._Common;
|
||||||
|
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase;
|
||||||
|
|
||||||
namespace GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
namespace GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
||||||
public interface IPhaseSectionRepository : IRepository<Guid, PhaseSection>
|
public interface IPhaseSectionRepository : IRepository<Guid, PhaseSection>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using GozareshgirProgramManager.Domain._Common;
|
using GozareshgirProgramManager.Domain._Common;
|
||||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||||
|
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase;
|
||||||
|
|
||||||
namespace GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
namespace GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using GozareshgirProgramManager.Domain._Common;
|
using GozareshgirProgramManager.Domain._Common;
|
||||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||||
|
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project;
|
||||||
|
|
||||||
namespace GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
namespace GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using GozareshgirProgramManager.Domain._Common;
|
using GozareshgirProgramManager.Domain._Common;
|
||||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||||
|
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project;
|
||||||
|
|
||||||
namespace GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
namespace GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using GozareshgirProgramManager.Domain._Common;
|
using GozareshgirProgramManager.Domain._Common;
|
||||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||||
|
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task;
|
||||||
|
|
||||||
namespace GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
namespace GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using GozareshgirProgramManager.Domain._Common;
|
using GozareshgirProgramManager.Domain._Common;
|
||||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||||
|
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
|
||||||
|
|
||||||
namespace GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
namespace GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using GozareshgirProgramManager.Domain._Common;
|
using GozareshgirProgramManager.Domain._Common;
|
||||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||||
|
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
|
||||||
|
|
||||||
namespace GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
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._Common;
|
||||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||||
|
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
|
||||||
|
|
||||||
namespace GozareshgirProgramManager.Domain.SkillAgg.Entities;
|
namespace GozareshgirProgramManager.Domain.SkillAgg.Entities;
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
public class UnAuthorizedException:Exception
|
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.Behaviors;
|
||||||
using GozareshgirProgramManager.Application._Common.Interfaces;
|
using GozareshgirProgramManager.Application._Common.Interfaces;
|
||||||
using GozareshgirProgramManager.Application.Services.FileManagement;
|
using GozareshgirProgramManager.Application.Services.FileManagement;
|
||||||
@@ -11,10 +7,7 @@ using GozareshgirProgramManager.Domain.CustomerAgg.Repositories;
|
|||||||
using GozareshgirProgramManager.Domain.FileManagementAgg.Repositories;
|
using GozareshgirProgramManager.Domain.FileManagementAgg.Repositories;
|
||||||
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
||||||
using GozareshgirProgramManager.Domain.RoleAgg.Repositories;
|
using GozareshgirProgramManager.Domain.RoleAgg.Repositories;
|
||||||
using GozareshgirProgramManager.Domain.RoleAgg.Repositories;
|
|
||||||
using GozareshgirProgramManager.Domain.SalaryPaymentSettingAgg.Repositories;
|
using GozareshgirProgramManager.Domain.SalaryPaymentSettingAgg.Repositories;
|
||||||
using GozareshgirProgramManager.Domain.SalaryPaymentSettingAgg.Repositories;
|
|
||||||
using GozareshgirProgramManager.Domain.SkillAgg.Repositories;
|
|
||||||
using GozareshgirProgramManager.Domain.SkillAgg.Repositories;
|
using GozareshgirProgramManager.Domain.SkillAgg.Repositories;
|
||||||
using GozareshgirProgramManager.Domain.TaskChatAgg.Repositories;
|
using GozareshgirProgramManager.Domain.TaskChatAgg.Repositories;
|
||||||
using GozareshgirProgramManager.Domain.UserAgg.Repositories;
|
using GozareshgirProgramManager.Domain.UserAgg.Repositories;
|
||||||
@@ -32,6 +25,9 @@ using Shared.Contracts.PmRole.Commands;
|
|||||||
using Shared.Contracts.PmRole.Queries;
|
using Shared.Contracts.PmRole.Queries;
|
||||||
using Shared.Contracts.PmUser.Commands;
|
using Shared.Contracts.PmUser.Commands;
|
||||||
using Shared.Contracts.PmUser.Queries;
|
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;
|
namespace GozareshgirProgramManager.Infrastructure;
|
||||||
|
|
||||||
@@ -101,6 +97,11 @@ public static class DependencyInjection
|
|||||||
services.AddScoped<IAuthHelper, AuthHelper>();
|
services.AddScoped<IAuthHelper, AuthHelper>();
|
||||||
|
|
||||||
|
|
||||||
|
//TaskSection Time Request
|
||||||
|
services.AddScoped<ITaskSectionTimeRequestRepository, TaskSectionTimeRequestRepository>();
|
||||||
|
|
||||||
|
//TaskSection Revision
|
||||||
|
services.AddScoped<ITaskSectionRevisionRepository, TaskSectionRevisionRepository>();
|
||||||
|
|
||||||
#region ServicesInjection
|
#region ServicesInjection
|
||||||
|
|
||||||
@@ -116,6 +117,16 @@ public static class DependencyInjection
|
|||||||
// MediatR Validation Behavior
|
// MediatR Validation Behavior
|
||||||
services.AddTransient(typeof(IPipelineBehavior<,>), typeof(ValidationBehavior<,>));
|
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;
|
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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -227,7 +227,7 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations
|
|||||||
b.ToTable("UploadedFiles", (string)null);
|
b.ToTable("UploadedFiles", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.PhaseSection", b =>
|
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase.PhaseSection", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
@@ -254,49 +254,7 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations
|
|||||||
b.ToTable("PhaseSections");
|
b.ToTable("PhaseSections");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project", b =>
|
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase.ProjectPhase", 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 =>
|
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
@@ -348,7 +306,49 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations
|
|||||||
b.ToTable("ProjectPhases", (string)null);
|
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")
|
b.Property<Guid>("Id")
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
@@ -374,7 +374,7 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations
|
|||||||
b.ToTable("ProjectSections");
|
b.ToTable("ProjectSections");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.ProjectTask", b =>
|
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.ProjectTask", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
@@ -433,7 +433,7 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations
|
|||||||
b.ToTable("ProjectTasks", (string)null);
|
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")
|
b.Property<Guid>("Id")
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
@@ -476,7 +476,7 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations
|
|||||||
b.ToTable("TaskSections", (string)null);
|
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")
|
b.Property<Guid>("Id")
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
@@ -514,7 +514,7 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations
|
|||||||
b.ToTable("TaskSectionActivities", (string)null);
|
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")
|
b.Property<Guid>("Id")
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
@@ -540,6 +540,11 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations
|
|||||||
b.Property<Guid?>("TaskSectionId")
|
b.Property<Guid?>("TaskSectionId")
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<string>("Type")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.HasColumnType("nvarchar(50)");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.HasIndex("TaskSectionId");
|
b.HasIndex("TaskSectionId");
|
||||||
@@ -547,6 +552,76 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations
|
|||||||
b.ToTable("TaskSectionAdditionalTimes", (string)null);
|
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 =>
|
modelBuilder.Entity("GozareshgirProgramManager.Domain.RoleAgg.Entities.Role", b =>
|
||||||
{
|
{
|
||||||
b.Property<long>("Id")
|
b.Property<long>("Id")
|
||||||
@@ -792,9 +867,9 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations
|
|||||||
b.ToTable("UserRefreshTokens", (string)null);
|
b.ToTable("UserRefreshTokens", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.PhaseSection", b =>
|
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase.PhaseSection", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("GozareshgirProgramManager.Domain.ProjectAgg.Entities.ProjectPhase", "Phase")
|
b.HasOne("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase.ProjectPhase", "Phase")
|
||||||
.WithMany("PhaseSections")
|
.WithMany("PhaseSections")
|
||||||
.HasForeignKey("PhaseId")
|
.HasForeignKey("PhaseId")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
@@ -810,9 +885,9 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations
|
|||||||
b.Navigation("Skill");
|
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")
|
.WithMany("Phases")
|
||||||
.HasForeignKey("ProjectId")
|
.HasForeignKey("ProjectId")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
@@ -821,9 +896,9 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations
|
|||||||
b.Navigation("Project");
|
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")
|
.WithMany("ProjectSections")
|
||||||
.HasForeignKey("ProjectId")
|
.HasForeignKey("ProjectId")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
@@ -839,9 +914,9 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations
|
|||||||
b.Navigation("Skill");
|
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")
|
.WithMany("Tasks")
|
||||||
.HasForeignKey("PhaseId")
|
.HasForeignKey("PhaseId")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
@@ -850,7 +925,7 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations
|
|||||||
b.Navigation("Phase");
|
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")
|
b.HasOne("GozareshgirProgramManager.Domain.SkillAgg.Entities.Skill", "Skill")
|
||||||
.WithMany("Sections")
|
.WithMany("Sections")
|
||||||
@@ -858,7 +933,7 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations
|
|||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
b.HasOne("GozareshgirProgramManager.Domain.ProjectAgg.Entities.ProjectTask", "Task")
|
b.HasOne("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.ProjectTask", "Task")
|
||||||
.WithMany("Sections")
|
.WithMany("Sections")
|
||||||
.HasForeignKey("TaskId")
|
.HasForeignKey("TaskId")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
@@ -869,9 +944,9 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations
|
|||||||
b.Navigation("Task");
|
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")
|
.WithMany("Activities")
|
||||||
.HasForeignKey("SectionId")
|
.HasForeignKey("SectionId")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
@@ -880,13 +955,61 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations
|
|||||||
b.Navigation("Section");
|
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")
|
.WithMany("AdditionalTimes")
|
||||||
.HasForeignKey("TaskSectionId");
|
.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 =>
|
modelBuilder.Entity("GozareshgirProgramManager.Domain.RoleAgg.Entities.Role", b =>
|
||||||
{
|
{
|
||||||
b.OwnsMany("GozareshgirProgramManager.Domain.PermissionAgg.Entities.Permission", "Permissions", b1 =>
|
b.OwnsMany("GozareshgirProgramManager.Domain.PermissionAgg.Entities.Permission", "Permissions", b1 =>
|
||||||
@@ -1031,26 +1154,26 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations
|
|||||||
b.Navigation("User");
|
b.Navigation("User");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project", b =>
|
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase.ProjectPhase", b =>
|
||||||
{
|
|
||||||
b.Navigation("Phases");
|
|
||||||
|
|
||||||
b.Navigation("ProjectSections");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.ProjectPhase", b =>
|
|
||||||
{
|
{
|
||||||
b.Navigation("PhaseSections");
|
b.Navigation("PhaseSections");
|
||||||
|
|
||||||
b.Navigation("Tasks");
|
b.Navigation("Tasks");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.ProjectTask", b =>
|
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project.Project", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Phases");
|
||||||
|
|
||||||
|
b.Navigation("ProjectSections");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.ProjectTask", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("Sections");
|
b.Navigation("Sections");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.TaskSection", b =>
|
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection.TaskSection", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("Activities");
|
b.Navigation("Activities");
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,10 @@ using GozareshgirProgramManager.Application._Common.Interfaces;
|
|||||||
using GozareshgirProgramManager.Domain.CustomerAgg;
|
using GozareshgirProgramManager.Domain.CustomerAgg;
|
||||||
using GozareshgirProgramManager.Domain.FileManagementAgg.Entities;
|
using GozareshgirProgramManager.Domain.FileManagementAgg.Entities;
|
||||||
using GozareshgirProgramManager.Domain.ProjectAgg.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.RoleAgg.Entities;
|
||||||
using GozareshgirProgramManager.Domain.RoleUserAgg;
|
using GozareshgirProgramManager.Domain.RoleUserAgg;
|
||||||
using GozareshgirProgramManager.Domain.SalaryPaymentSettingAgg.Entities;
|
using GozareshgirProgramManager.Domain.SalaryPaymentSettingAgg.Entities;
|
||||||
@@ -49,6 +53,12 @@ public class ProgramManagerDbContext : DbContext, IProgramManagerDbContext
|
|||||||
// Task Chat
|
// Task Chat
|
||||||
public DbSet<TaskChatMessage> TaskChatMessages { get; set; } = null!;
|
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)
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||||
{
|
{
|
||||||
modelBuilder.ApplyConfigurationsFromAssembly(typeof(ProgramManagerDbContext).Assembly);
|
modelBuilder.ApplyConfigurationsFromAssembly(typeof(ProgramManagerDbContext).Assembly);
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||||
|
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
|
||||||
using GozareshgirProgramManager.Infrastructure.Persistence._Common;
|
using GozareshgirProgramManager.Infrastructure.Persistence._Common;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||||
|
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||||
|
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project;
|
||||||
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||||
|
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase;
|
||||||
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||||
|
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||||
|
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task;
|
||||||
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
||||||
using GozareshgirProgramManager.Infrastructure.Persistence._Common;
|
using GozareshgirProgramManager.Infrastructure.Persistence._Common;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||||
|
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||||
|
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
|
||||||
using GozareshgirProgramManager.Infrastructure.Persistence._Common;
|
using GozareshgirProgramManager.Infrastructure.Persistence._Common;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
@@ -33,6 +34,9 @@ public class TaskSectionAdditionalTimeMapping : IEntityTypeConfiguration<TaskSec
|
|||||||
builder.Property(at => at.CreationDate)
|
builder.Property(at => at.CreationDate)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.Property(x=>x.Type)
|
||||||
|
.HasConversion<string>()
|
||||||
|
.HasMaxLength(50);
|
||||||
// Ignore domain events
|
// Ignore domain events
|
||||||
builder.Ignore(at => at.DomainEvents);
|
builder.Ignore(at => at.DomainEvents);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||||
|
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
|
||||||
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
||||||
using GozareshgirProgramManager.Infrastructure.Persistence._Common;
|
using GozareshgirProgramManager.Infrastructure.Persistence._Common;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
using GozareshgirProgramManager.Domain.FileManagementAgg.Entities;
|
||||||
|
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
|
||||||
|
namespace GozareshgirProgramManager.Infrastructure.Persistence.Mappings;
|
||||||
|
|
||||||
|
public class TaskSectionRevisionMapping:IEntityTypeConfiguration<TaskSectionRevision>
|
||||||
|
{
|
||||||
|
public void Configure(EntityTypeBuilder<TaskSectionRevision> builder)
|
||||||
|
{
|
||||||
|
builder.HasKey(x => x.Id);
|
||||||
|
|
||||||
|
builder.Property(x => x.Id)
|
||||||
|
.ValueGeneratedNever();
|
||||||
|
|
||||||
|
builder.Property(x => x.Status).HasConversion<string>()
|
||||||
|
.HasMaxLength(50);
|
||||||
|
|
||||||
|
builder.Property(x => x.Message).HasMaxLength(500);
|
||||||
|
|
||||||
|
builder.OwnsMany(x => x.Files, file =>
|
||||||
|
{
|
||||||
|
file.HasKey(x => x.Id);
|
||||||
|
file.Property(x => x.Id).ValueGeneratedNever();
|
||||||
|
|
||||||
|
file.HasOne<UploadedFile>()
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey(x => x.FileId)
|
||||||
|
.IsRequired()
|
||||||
|
.OnDelete(DeleteBehavior.Restrict);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
|
||||||
|
using GozareshgirProgramManager.Infrastructure.Persistence._Common;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
|
||||||
|
namespace GozareshgirProgramManager.Infrastructure.Persistence.Mappings;
|
||||||
|
|
||||||
|
public class TaskSectionTimeRequestMapping:IEntityTypeConfiguration<TaskSectionTimeRequest>
|
||||||
|
{
|
||||||
|
public void Configure(EntityTypeBuilder<TaskSectionTimeRequest> builder)
|
||||||
|
{
|
||||||
|
builder.HasKey(x => x.Id);
|
||||||
|
|
||||||
|
builder.Property(x => x.Id)
|
||||||
|
.ValueGeneratedNever();
|
||||||
|
|
||||||
|
builder.Property(x => x.RequestStatus).
|
||||||
|
HasConversion<string>().HasMaxLength(50);
|
||||||
|
|
||||||
|
builder.Property(x=>x.RequestType).
|
||||||
|
HasConversion<string>().HasMaxLength(50);
|
||||||
|
|
||||||
|
builder.Property(x => x.RequestedTime)
|
||||||
|
.HasTimeSpanConversion();
|
||||||
|
|
||||||
|
builder.Property(x=>x.Description)
|
||||||
|
.HasMaxLength(1200);
|
||||||
|
|
||||||
|
builder.HasOne(x=>x.TaskSection)
|
||||||
|
.WithMany().HasForeignKey(x=>x.TaskSectionId);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
using GozareshgirProgramManager.Infrastructure.Persistence._Common;
|
using GozareshgirProgramManager.Infrastructure.Persistence._Common;
|
||||||
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
||||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||||
|
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase;
|
||||||
using GozareshgirProgramManager.Infrastructure.Persistence.Context;
|
using GozareshgirProgramManager.Infrastructure.Persistence.Context;
|
||||||
|
|
||||||
namespace GozareshgirProgramManager.Infrastructure.Persistence.Repositories;
|
namespace GozareshgirProgramManager.Infrastructure.Persistence.Repositories;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||||
|
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Phase;
|
||||||
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
||||||
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
||||||
using GozareshgirProgramManager.Infrastructure.Persistence._Common;
|
using GozareshgirProgramManager.Infrastructure.Persistence._Common;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
|
|
||||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||||
|
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project;
|
||||||
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
||||||
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
||||||
using GozareshgirProgramManager.Infrastructure.Persistence._Common;
|
using GozareshgirProgramManager.Infrastructure.Persistence._Common;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||||
|
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project;
|
||||||
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
||||||
using GozareshgirProgramManager.Infrastructure.Persistence._Common;
|
using GozareshgirProgramManager.Infrastructure.Persistence._Common;
|
||||||
using GozareshgirProgramManager.Infrastructure.Persistence.Context;
|
using GozareshgirProgramManager.Infrastructure.Persistence.Context;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||||
|
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task;
|
||||||
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
||||||
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
|
||||||
using GozareshgirProgramManager.Infrastructure.Persistence._Common;
|
using GozareshgirProgramManager.Infrastructure.Persistence._Common;
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user