aboutsummaryrefslogtreecommitdiff
path: root/BackEnd/Timeline/Services/User/UserServiceExtensions.cs
blob: 82b55fbaa101780596623b22308caaffaf653318 (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 UserServiceExtensions
    {
        public static async Task ThrowIfUserNotExist(this IUserService service, long userId)
        {
            if (!await service.CheckUserExistenceAsync(userId))
            {
                throw new EntityNotExistException(EntityTypes.User,
                    new Dictionary<string, object> { ["id"] = userId });
            }
        }
    }
}