Introduced ExceptionHandlingMiddleware to catch and log unhandled exceptions, returning standardized JSON error responses. Registered the middleware in the request pipeline. Also made minor formatting and comment improvements in Program.cs and ICatalogRepository.cs.
16 lines
900 B
C#
16 lines
900 B
C#
using DbFirst.Domain.Entities;
|
|
|
|
namespace DbFirst.Domain.Repositories;
|
|
|
|
// TODO: instead of creating interface per entity, consider using generic repository pattern (eg. IRepository<T>) to reduce code duplication.
|
|
// TODO: move to application layer as a part of clean architecture
|
|
public interface ICatalogRepository
|
|
{
|
|
Task<List<VwmyCatalog>> GetAllAsync(CancellationToken cancellationToken = default);
|
|
Task<VwmyCatalog?> GetByIdAsync(int id, CancellationToken cancellationToken = default);
|
|
Task<VwmyCatalog?> GetByTitleAsync(string title, CancellationToken cancellationToken = default);
|
|
Task<VwmyCatalog> InsertAsync(VwmyCatalog catalog, CancellationToken cancellationToken = default);
|
|
Task<VwmyCatalog?> UpdateAsync(int id, VwmyCatalog catalog, CancellationToken cancellationToken = default);
|
|
Task<bool> DeleteAsync(int id, CancellationToken cancellationToken = default);
|
|
}
|