Added the comment in Received Invoice Payment and added provide all project flag in get basic project
This commit is contained in:
parent
4434ea971f
commit
e80728805b
6518
Marco.Pms.DataAccess/Migrations/20251014094816_Added_Comment_In_ReceivedInvoicePayment_Table.Designer.cs
generated
Normal file
6518
Marco.Pms.DataAccess/Migrations/20251014094816_Added_Comment_In_ReceivedInvoicePayment_Table.Designer.cs
generated
Normal file
File diff suppressed because one or more lines are too long
@ -0,0 +1,29 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Marco.Pms.DataAccess.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Added_Comment_In_ReceivedInvoicePayment_Table : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "Comment",
|
||||
table: "ReceivedInvoicePayments",
|
||||
type: "longtext",
|
||||
nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Comment",
|
||||
table: "ReceivedInvoicePayments");
|
||||
}
|
||||
}
|
||||
}
|
@ -510,6 +510,10 @@ namespace Marco.Pms.DataAccess.Migrations
|
||||
b.Property<double>("Amount")
|
||||
.HasColumnType("double");
|
||||
|
||||
b.Property<string>("Comment")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
|
@ -16,6 +16,7 @@ namespace Marco.Pms.Model.Collection
|
||||
public DateTime PaymentReceivedDate { get; set; }
|
||||
public string TransactionId { get; set; } = default!;
|
||||
public double Amount { get; set; }
|
||||
public string Comment { get; set; } = default!;
|
||||
public bool IsActive { get; set; } = true;
|
||||
public DateTime CreatedAt { get; set; }
|
||||
public Guid CreatedById { get; set; }
|
||||
|
@ -5,7 +5,8 @@
|
||||
public Guid? Id { get; set; }
|
||||
public required Guid InvoiceId { get; set; }
|
||||
public required DateTime PaymentReceivedDate { get; set; }
|
||||
public required string TransactionId { get; set; } = default!;
|
||||
public required string TransactionId { get; set; }
|
||||
public required double Amount { get; set; }
|
||||
public required string Comment { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ namespace Marco.Pms.Model.ViewModels.Collection
|
||||
public DateTime PaymentReceivedDate { get; set; }
|
||||
public string TransactionId { get; set; } = default!;
|
||||
public double Amount { get; set; }
|
||||
public string? Comment { get; set; }
|
||||
public bool IsActive { get; set; } = true;
|
||||
public DateTime CreatedAt { get; set; }
|
||||
public BasicEmployeeVM? CreatedBy { get; set; }
|
||||
|
@ -41,11 +41,11 @@ namespace MarcoBMS.Services.Controllers
|
||||
#region =================================================================== Project Get APIs ===================================================================
|
||||
|
||||
[HttpGet("list/basic")]
|
||||
public async Task<IActionResult> GetAllProjectsBasic()
|
||||
public async Task<IActionResult> GetAllProjectsBasic([FromQuery] bool provideAll = false)
|
||||
{
|
||||
// Get the current user
|
||||
var loggedInEmployee = await _userHelper.GetCurrentEmployeeAsync();
|
||||
var response = await _projectServices.GetAllProjectsBasicAsync(tenantId, loggedInEmployee);
|
||||
var response = await _projectServices.GetAllProjectsBasicAsync(provideAll, tenantId, loggedInEmployee);
|
||||
return StatusCode(response.StatusCode, response);
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@ namespace Marco.Pms.Services.Service
|
||||
|
||||
#region =================================================================== Project Get APIs ===================================================================
|
||||
|
||||
public async Task<ApiResponse<object>> GetAllProjectsBasicAsync(Guid tenantId, Employee loggedInEmployee)
|
||||
public async Task<ApiResponse<object>> GetAllProjectsBasicAsync(bool provideAll, Guid tenantId, Employee loggedInEmployee)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -67,7 +67,15 @@ namespace Marco.Pms.Services.Service
|
||||
_logger.LogInfo("Basic project list requested by EmployeeId {EmployeeId}", loggedInEmployee.Id);
|
||||
|
||||
// Step 2: Get the list of project IDs the user has access to
|
||||
List<Guid> accessibleProjectIds = await GetMyProjects(tenantId, loggedInEmployee);
|
||||
List<Guid> accessibleProjectIds = new List<Guid>();
|
||||
if (provideAll)
|
||||
{
|
||||
accessibleProjectIds = await _context.Projects.Where(p => p.TenantId == tenantId).Select(p => p.Id).ToListAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
accessibleProjectIds = await GetMyProjects(tenantId, loggedInEmployee);
|
||||
}
|
||||
|
||||
if (accessibleProjectIds == null || !accessibleProjectIds.Any())
|
||||
{
|
||||
|
@ -10,7 +10,7 @@ namespace Marco.Pms.Services.Service.ServiceInterfaces
|
||||
{
|
||||
public interface IProjectServices
|
||||
{
|
||||
Task<ApiResponse<object>> GetAllProjectsBasicAsync(Guid tenantId, Employee loggedInEmployee);
|
||||
Task<ApiResponse<object>> GetAllProjectsBasicAsync(bool provideAll, Guid tenantId, Employee loggedInEmployee);
|
||||
Task<ApiResponse<object>> GetAllProjectsAsync(Guid tenantId, Employee loggedInEmployee);
|
||||
Task<ApiResponse<object>> GetProjectAsync(Guid id, Guid tenantId, Employee loggedInEmployee);
|
||||
Task<ApiResponse<object>> GetProjectDetailsAsync(Guid id, Guid tenantId, Employee loggedInEmployee);
|
||||
|
Loading…
x
Reference in New Issue
Block a user