This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
from functools import wraps
|
||||
|
||||
import httpx
|
||||
|
||||
from cache.cache import get_cached_author_by_user_id
|
||||
from resolvers.stat import get_with_stat
|
||||
from services.schema import request_graphql_data
|
||||
|
@@ -113,7 +113,7 @@ class SearchService:
|
||||
async def info(self):
|
||||
if not SEARCH_ENABLED:
|
||||
return {"status": "disabled"}
|
||||
|
||||
|
||||
try:
|
||||
return get_indices_stats()
|
||||
except Exception as e:
|
||||
@@ -158,7 +158,7 @@ class SearchService:
|
||||
def index(self, shout):
|
||||
if not SEARCH_ENABLED:
|
||||
return
|
||||
|
||||
|
||||
if self.client:
|
||||
logger.info(f"Индексируем пост {shout.id}")
|
||||
index_body = {
|
||||
@@ -184,7 +184,7 @@ class SearchService:
|
||||
async def search(self, text, limit, offset):
|
||||
if not SEARCH_ENABLED:
|
||||
return []
|
||||
|
||||
|
||||
logger.info(f"Ищем: {text} {offset}+{limit}")
|
||||
search_body = {
|
||||
"query": {"multi_match": {"query": text, "fields": ["title", "lead", "subtitle", "body", "media"]}}
|
||||
@@ -226,5 +226,6 @@ async def search_text(text: str, limit: int = 50, offset: int = 0):
|
||||
payload = await search_service.search(text, limit, offset)
|
||||
return payload
|
||||
|
||||
|
||||
# Проверить что URL корректный
|
||||
OPENSEARCH_URL = os.getenv('OPENSEARCH_URL', 'rc1a-3n5pi3bhuj9gieel.mdb.yandexcloud.net')
|
||||
OPENSEARCH_URL = os.getenv("OPENSEARCH_URL", "rc1a-3n5pi3bhuj9gieel.mdb.yandexcloud.net")
|
||||
|
@@ -27,9 +27,7 @@ async def check_webhook_existence() -> bool:
|
||||
|
||||
operation = "GetWebhooks"
|
||||
query_name = "_webhooks"
|
||||
variables = {
|
||||
"params": {}
|
||||
}
|
||||
variables = {"params": {}}
|
||||
# https://docs.authorizer.dev/core/graphql-api#_webhooks
|
||||
gql = {
|
||||
"query": f"query {operation}($params: GetWebhooksRequest!)"
|
||||
@@ -64,9 +62,7 @@ async def create_webhook_endpoint():
|
||||
"event_name": "user.login",
|
||||
"endpoint": "https://core.dscrs.site/new-author",
|
||||
"enabled": True,
|
||||
"headers": {
|
||||
"Authorization": WEBHOOK_SECRET
|
||||
},
|
||||
"headers": {"Authorization": WEBHOOK_SECRET},
|
||||
}
|
||||
}
|
||||
gql = {
|
||||
@@ -76,7 +72,6 @@ async def create_webhook_endpoint():
|
||||
+ "}",
|
||||
"variables": variables,
|
||||
"operationName": operation,
|
||||
|
||||
}
|
||||
result = await request_graphql_data(gql, headers=headers)
|
||||
logger.info(result)
|
||||
|
Reference in New Issue
Block a user