<filename>saleor/graphql/crawler/resolvers.py
import graphene

from ...unurshop.crawler import models
from .types import Crawler
import tldextract
from datetime import datetime


CRAWLER_SEARCH_FIELDS = ("url", "shop", "completed")


def resolve_crawler(info, crawler_id=None):
    assert crawler_id, "No crawler ID or slug provided."
    user = info.context.user

    crawler = graphene.Node.get_node_from_global_id(info, crawler_id, Crawler)
    # Resolve to null if page is not published and user has no permission
    # to manage pages.

    return crawler


def resolve_crawlers(info, query):
    user = info.context.user
    return models.Crawler.objects.visible_to_user(user)

def resolve_crawler_lines(info, query):
    return models.CrawlerLine.objects

def resolve_expired_crawler_lines(info, query):
    return models.CrawlerLine.objects.filter(ustatus=1).filter(sync_at__lt=datetime.today())
<filename>saleor/graphql/crawler/resolvers.py
import graphene

from ...unurshop.crawler import models
from .types import Crawler
import tldextract
from datetime import datetime


CRAWLER_SEARCH_FIELDS = ("url", "shop", "completed")


def resolve_crawler(info, crawler_id=None):
    assert crawler_id, "No crawler ID or slug provided."
    user = info.context.user

    crawler = graphene.Node.get_node_from_global_id(info, crawler_id, Crawler)
    # Resolve to null if page is not published and user has no permission
    # to manage pages.

    return crawler


def resolve_crawlers(info, query):
    user = info.context.user
    return models.Crawler.objects.visible_to_user(user)

def resolve_crawler_lines(info, query):
    return models.CrawlerLine.objects

def resolve_expired_crawler_lines(info, query):
    return models.CrawlerLine.objects.filter(ustatus=1).filter(sync_at__lt=datetime.today())
# Resolve to null if page is not published and user has no permission # to manage pages.