Fase 3: Soporte de Imágenes en Wizard y Backend (Upload Local)

This commit is contained in:
2025-12-17 13:56:47 -03:00
parent 1b88394b00
commit 8f535f3a6e
14 changed files with 311 additions and 3 deletions

View File

@@ -0,0 +1,33 @@
using Dapper;
using SIGCM.Domain.Entities;
using SIGCM.Domain.Interfaces;
using SIGCM.Infrastructure.Data;
namespace SIGCM.Infrastructure.Repositories;
public class ImageRepository : IImageRepository
{
private readonly IDbConnectionFactory _connectionFactory;
public ImageRepository(IDbConnectionFactory connectionFactory)
{
_connectionFactory = connectionFactory;
}
public async Task AddAsync(ListingImage image)
{
using var conn = _connectionFactory.CreateConnection();
var sql = @"
INSERT INTO ListingImages (ListingId, Url, IsMainInfo, DisplayOrder)
VALUES (@ListingId, @Url, @IsMainInfo, @DisplayOrder)";
await conn.ExecuteAsync(sql, image);
}
public async Task<IEnumerable<ListingImage>> GetByListingIdAsync(int listingId)
{
using var conn = _connectionFactory.CreateConnection();
return await conn.QueryAsync<ListingImage>(
"SELECT * FROM ListingImages WHERE ListingId = @ListingId ORDER BY DisplayOrder",
new { ListingId = listingId });
}
}