aboutsummaryrefslogtreecommitdiff
path: root/BackEnd/Timeline/Services/User/BasicUserServiceExtensions.cs
blob: 8a05f452c416ed283ad97eaf069e5767dff1d154 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
using System.Collections.Generic;
using System.Threading.Tasks;

namespace Timeline.Services.User
{
    public static class BasicUserServiceExtensions
    {
        public static async Task ThrowIfUserNotExist(this IBasicUserService service, long userId)
        {
            if (!await service.CheckUserExistenceAsync(userId))
            {
                throw new EntityNotExistException(EntityTypes.User,
                    new Dictionary<string, object> { ["id"] = userId });
            }
        }
    }
}