Feat: Cambios Varios

This commit is contained in:
2025-12-23 15:12:57 -03:00
parent 32663e6324
commit 8bc1308bc5
58 changed files with 4080 additions and 663 deletions

View File

@@ -0,0 +1,14 @@
namespace SIGCM.Domain.Entities;
public class AuditLog
{
public int Id { get; set; }
public int UserId { get; set; }
public required string Action { get; set; }
public int? EntityId { get; set; }
public string? EntityType { get; set; }
public string? Details { get; set; }
public DateTime CreatedAt { get; set; }
// Propiedad auxiliar para el Join
public string? Username { get; set; }
}

View File

@@ -0,0 +1,11 @@
namespace SIGCM.Domain.Entities;
public class Client
{
public int Id { get; set; }
public required string Name { get; set; }
public required string DniOrCuit { get; set; }
public string? Email { get; set; }
public string? Phone { get; set; }
public string? Address { get; set; }
}

View File

@@ -8,19 +8,23 @@ public class Listing
public required string Title { get; set; }
public string? Description { get; set; }
public decimal Price { get; set; }
public decimal AdFee { get; set; }
public string Currency { get; set; } = "ARS";
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
public string Status { get; set; } = "Draft";
public int? UserId { get; set; }
public int? ClientId { get; set; }
// Propiedades para impresión
public string? PrintText { get; set; }
public DateTime? PrintStartDate { get; set; }
public int PrintDaysCount { get; set; }
public bool IsBold { get; set; }
public bool IsFrame { get; set; }
public string PrintFontSize { get; set; } = "normal";
public string PrintAlignment { get; set; } = "left";
// Propiedades auxiliares (no están en la tabla Listings, vienen de Joins/Subqueries)
// Propiedades auxiliares
public string? CategoryName { get; set; }
public string? MainImageUrl { get; set; }
}

View File

@@ -1,6 +1,7 @@
namespace SIGCM.Domain.Interfaces;
using SIGCM.Domain.Entities;
namespace SIGCM.Domain.Interfaces;
public interface ICategoryRepository
{
Task<IEnumerable<Category>> GetAllAsync();
@@ -12,4 +13,6 @@ public interface ICategoryRepository
Task<IEnumerable<Operation>> GetOperationsAsync(int categoryId);
Task AddOperationAsync(int categoryId, int operationId);
Task RemoveOperationAsync(int categoryId, int operationId);
}
Task MergeCategoriesAsync(int sourceId, int targetId);
Task<bool> HasChildrenAsync(int categoryId);
}

View File

@@ -1,5 +1,6 @@
using SIGCM.Domain.Models;
using SIGCM.Domain.Entities;
using SIGCM.Application.DTOs;
namespace SIGCM.Domain.Interfaces;
@@ -9,6 +10,24 @@ public interface IListingRepository
Task<Listing?> GetByIdAsync(int id);
Task<ListingDetail?> GetDetailByIdAsync(int id);
Task<IEnumerable<Listing>> GetAllAsync();
Task<int> CountByCategoryIdAsync(int categoryId);
Task MoveListingsAsync(int sourceCategoryId, int targetCategoryId);
// Búsqueda Simple y Facetada
Task<IEnumerable<Listing>> SearchAsync(string? query, int? categoryId);
Task<IEnumerable<Listing>> SearchFacetedAsync(string? query, int? categoryId, Dictionary<string, string>? attributes);
// Impresión
Task<IEnumerable<Listing>> GetListingsForPrintAsync(DateTime date);
// Moderación
Task<IEnumerable<Listing>> GetPendingModerationAsync();
Task UpdateStatusAsync(int id, string status);
Task<int> GetPendingCountAsync();
// Estadísticas
Task<IEnumerable<CategorySalesReportDto>> GetSalesByRootCategoryAsync(DateTime startDate, DateTime endDate);
Task<DashboardStats> GetDashboardStatsAsync(DateTime startDate, DateTime endDate);
Task<CashierDashboardDto?> GetCashierStatsAsync(int userId, DateTime startDate, DateTime endDate);
Task<GlobalReportDto> GetDetailedReportAsync(DateTime start, DateTime end, int? userId = null);
}

View File

@@ -0,0 +1,8 @@
namespace SIGCM.Domain.Models;
public class CashierDashboardDto
{
public decimal MyRevenue { get; set; }
public int MyAdsCount { get; set; }
public int MyPendingAds { get; set; }
}

View File

@@ -0,0 +1,10 @@
namespace SIGCM.Application.DTOs;
public class CategorySalesReportDto
{
public int CategoryId { get; set; }
public required string CategoryName { get; set; }
public decimal TotalSales { get; set; }
public int AdCount { get; set; }
public decimal Percentage { get; set; }
}

View File

@@ -0,0 +1,23 @@
namespace SIGCM.Domain.Models;
public class DashboardStats
{
public decimal RevenueToday { get; set; }
public int AdsToday { get; set; }
public decimal TicketAverage { get; set; }
public double PaperOccupation { get; set; }
public List<DailyRevenue> WeeklyTrend { get; set; } = new();
public List<ChannelStat> ChannelMix { get; set; } = new();
}
public class DailyRevenue
{
public string Day { get; set; } = "";
public decimal Amount { get; set; }
}
public class ChannelStat
{
public string Name { get; set; } = "";
public int Value { get; set; }
}

View File

@@ -0,0 +1,21 @@
namespace SIGCM.Domain.Models;
public class GlobalReportDto
{
public DateTime GeneratedAt { get; set; } = DateTime.UtcNow;
public DateTime FromDate { get; set; }
public DateTime ToDate { get; set; }
public decimal TotalRevenue { get; set; }
public int TotalAds { get; set; }
public List<ReportItemDto> Items { get; set; } = new();
}
public class ReportItemDto
{
public int Id { get; set; }
public DateTime Date { get; set; }
public string Title { get; set; } = "";
public string Category { get; set; } = "";
public string Cashier { get; set; } = "";
public decimal Amount { get; set; }
}