aboutsummaryrefslogtreecommitdiff
path: root/BackEnd/Timeline/Services/User/BasicUserServiceExtensions.cs
diff options
context:
space:
mode:
Diffstat (limited to 'BackEnd/Timeline/Services/User/BasicUserServiceExtensions.cs')
-rw-r--r--BackEnd/Timeline/Services/User/BasicUserServiceExtensions.cs17
1 files changed, 17 insertions, 0 deletions
diff --git a/BackEnd/Timeline/Services/User/BasicUserServiceExtensions.cs b/BackEnd/Timeline/Services/User/BasicUserServiceExtensions.cs
new file mode 100644
index 00000000..8a05f452
--- /dev/null
+++ b/BackEnd/Timeline/Services/User/BasicUserServiceExtensions.cs
@@ -0,0 +1,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 });
+ }
+ }
+ }
+}