❔ Service layer design

This is my interface
using OneOf;
namespace petaverseapi;
public interface IAnimalService
{
    #region [ READS ]
    Task<IEnumerable<AnimalDTO>> FindAll(string consumerName, CancellationToken cancellationToken = default!);
    Task<AnimalDTO?> FindById(int id, string consumerName, CancellationToken cancellationToken = default!);
    Task<OneOf<IEnumerable<AnimalDTO>, ServiceError>> FindAllByUserGuid(string userGuid, string consumerName, CancellationToken cancellationToken = default!);
    #endregion

    #region [ MUTATES ]
    Task<OneOf<ServiceSuccess, ServiceError>> Create(CreatePetDTO dto, string consumerName, CancellationToken cancellationToken = default!);
    Task<OneOf<ServiceSuccess, ServiceError>> UploadAnimalMultiplePhotosAsync(int animalId, MediaTypeDTO mediaType, IFormFileCollection medias, string consumerName, CancellationToken cancellationToken = default!);


    Task<OneOf<ServiceSuccess, ServiceError>> UploadAnimalAvatarPhotoAsync(int animalId, IFormFile avatar, MediaTypeDTO type, string consumerName, CancellationToken cancellationToken = default!);
    Task<OneOf<ServiceSuccess, ServiceError>> UploadAnimalPhotoAsync(int animalId, IFormFile file, MediaTypeDTO type, string consumerName, CancellationToken cancellationToken = default!);
    Task<OneOf<ServiceSuccess, ServiceError>> Delete(int id, string consumerName, CancellationToken cancellationToken = default!);
    #endregion

}

and here are my the ServiceSuccess and ServiceError basically they are just return information.
namespace petaverseapi;

public record ServiceSuccess(string ServiceName = "",
                             string MethodName = "",
                             string ConsumerName = "",
                             object? AttachedData = default!) : PetaverseSuccess;

namespace petaverseapi;
public record ServiceError(string ServiceName = "", string MethodName = "", string ConsumerName = "") : PetaverseError;

My question is for FindAll, FindById and FindAllByUserGuid should I return the same a the rest as OneOf<ServiceSuccess, ServiceError> and attached the data in ?
Was this page helpful?