mirror of
https://github.com/Govor-team/Govor.git
synced 2026-07-21 19:54:55 +00:00
28 lines
715 B
C#
28 lines
715 B
C#
using Govor.Application.Interfaces;
|
|
using Govor.Core.Models;
|
|
using Govor.Core.Repositories.Groups;
|
|
using Govor.Data.Repositories.Exceptions;
|
|
|
|
namespace Govor.Application.Services;
|
|
|
|
public class UserGroupsGetterService : IUserGroupsGetterService
|
|
{
|
|
private readonly IGroupsRepository _groupRep;
|
|
|
|
public UserGroupsGetterService(IGroupsRepository groupsRepository)
|
|
{
|
|
_groupRep = groupsRepository;
|
|
}
|
|
|
|
public async Task<List<ChatGroup>> GetUserGroupsAsync(Guid userId)
|
|
{
|
|
try
|
|
{
|
|
return await _groupRep.GetByUserIdAsync(userId);
|
|
}
|
|
catch (NotFoundByKeyException<Guid> ex)
|
|
{
|
|
return new List<ChatGroup>();
|
|
}
|
|
}
|
|
} |