From eb7ed81cacfea05e1d3835f16d0f6c7edaab530b Mon Sep 17 00:00:00 2001 From: TekH Date: Fri, 25 Jul 2025 17:04:58 +0200 Subject: [PATCH] feat(IProfileObjRepository): Schnittstelle von ProfileObjRepository erstellen und in ProfileObjRepository implementieren --- .../Repositories/IProfileObjRepository.cs | 23 +++++++++++++++++++ .../Repositories/ProfileObjRepository.cs | 3 ++- 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 src/WorkFlow.Application/Contracts/Repositories/IProfileObjRepository.cs diff --git a/src/WorkFlow.Application/Contracts/Repositories/IProfileObjRepository.cs b/src/WorkFlow.Application/Contracts/Repositories/IProfileObjRepository.cs new file mode 100644 index 0000000..3cc045a --- /dev/null +++ b/src/WorkFlow.Application/Contracts/Repositories/IProfileObjRepository.cs @@ -0,0 +1,23 @@ +using WorkFlow.Domain.Entities; + +namespace WorkFlow.Application.Contracts.Repositories; + +/// +/// Repository for retrieving entities from the database. +/// +public interface IProfileObjRepository +{ + /// + /// Retrieves the list of associated with a given user ID and profile ID by calling a database function. + /// + /// The unique identifier of the user whose profile is to be retrieved. + /// The unique identifier of the profile whose object is to be retrieved. + /// Propagates notification that operations should be canceled. + /// + /// A task that represents the asynchronous operation. The task result contains the object if found; otherwise, null. + /// + /// + /// Logs an error if no profile is found, or if multiple profiles are returned, indicating potential data issues. + /// + public Task> ReadAsync(int userId, int profileId, CancellationToken cancel = default); +} \ No newline at end of file diff --git a/src/WorkFlow.Infrastructure/Repositories/ProfileObjRepository.cs b/src/WorkFlow.Infrastructure/Repositories/ProfileObjRepository.cs index b8db9a2..8fa15bd 100644 --- a/src/WorkFlow.Infrastructure/Repositories/ProfileObjRepository.cs +++ b/src/WorkFlow.Infrastructure/Repositories/ProfileObjRepository.cs @@ -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; /// /// Repository implementation for retrieving entities from the database. /// -public class ProfileObjRepository +public class ProfileObjRepository : IProfileObjRepository { private readonly WFDBContext _context;