feat: implement user update functionality by UUID and add validation to UpdateUserRequest

This commit is contained in:
2025-12-30 13:35:10 -05:00
parent 1ec4877aad
commit f40d4ab68c
4 changed files with 77 additions and 0 deletions
@@ -8,5 +8,6 @@ namespace SharpbinV3.Server.Services
Task<User?> GetByUsername(string username, bool withPastes = false);
Task<User?> GetByUUID(Guid uuid, bool withPastes = false);
Task<User?> GetByEmail(string email, bool withPastes = false);
Task<User> Update(User user);
}
}
@@ -39,5 +39,12 @@ namespace SharpbinV3.Server.Services
query = query.Include(u => u.Pastes);
return query.FirstOrDefaultAsync(u => u.Email == email);
}
public async Task<User> Update(User user)
{
_db.Users.Update(user);
await _db.SaveChangesAsync();
return user;
}
}
}