feat(IProfileObjRepository): Schnittstelle von ProfileObjRepository erstellen und in ProfileObjRepository implementieren

This commit is contained in:
tekh 2025-07-25 17:04:58 +02:00
parent b7c6477ec2
commit eb7ed81cac
2 changed files with 25 additions and 1 deletions

View File

@ -0,0 +1,23 @@
using WorkFlow.Domain.Entities;
namespace WorkFlow.Application.Contracts.Repositories;
/// <summary>
/// Repository for retrieving <see cref="ProfileObject"/> entities from the database.
/// </summary>
public interface IProfileObjRepository
{
/// <summary>
/// Retrieves the list of <see cref="ProfileObject"/> associated with a given user ID and profile ID by calling a database function.
/// </summary>
/// <param name="userId">The unique identifier of the user whose profile is to be retrieved.</param>
/// <param name="profileId">The unique identifier of the profile whose object is to be retrieved.</param>
/// <param name="cancel">Propagates notification that operations should be canceled.</param>
/// <returns>
/// A task that represents the asynchronous operation. The task result contains the <see cref="ProfileObject"/> object if found; otherwise, <c>null</c>.
/// </returns>
/// <remarks>
/// Logs an error if no profile is found, or if multiple profiles are returned, indicating potential data issues.
/// </remarks>
public Task<IEnumerable<ProfileObject>> ReadAsync(int userId, int profileId, CancellationToken cancel = default);
}

View File

@ -1,4 +1,5 @@
using Microsoft.EntityFrameworkCore;
using WorkFlow.Application.Contracts.Repositories;
using WorkFlow.Domain.Entities;
namespace WorkFlow.Infrastructure.Repositories;
@ -6,7 +7,7 @@ namespace WorkFlow.Infrastructure.Repositories;
/// <summary>
/// Repository implementation for retrieving <see cref="ProfileObject"/> entities from the database.
/// </summary>
public class ProfileObjRepository
public class ProfileObjRepository : IProfileObjRepository
{
private readonly WFDBContext _context;