test article (#104)
Co-authored-by: Igor Lobanov <igor.lobanov@onetwotrip.com>
This commit is contained in:
parent
21316187e0
commit
0da4e110c1
|
@ -1,3 +1,4 @@
|
||||||
|
import json
|
||||||
from datetime import datetime, timedelta, timezone
|
from datetime import datetime, timedelta, timezone
|
||||||
|
|
||||||
from sqlalchemy.orm import aliased, joinedload
|
from sqlalchemy.orm import aliased, joinedload
|
||||||
|
@ -79,6 +80,15 @@ def apply_filters(q, filters, user_id=None): # noqa: C901
|
||||||
|
|
||||||
@query.field("loadShout")
|
@query.field("loadShout")
|
||||||
async def load_shout(_, info, slug=None, shout_id=None):
|
async def load_shout(_, info, slug=None, shout_id=None):
|
||||||
|
# for testing, soon will be removed
|
||||||
|
if slug == "testtesttest":
|
||||||
|
with open("test/test.json") as json_file:
|
||||||
|
test_shout = json.load(json_file)["data"]["loadShout"]
|
||||||
|
test_shout["createdAt"] = datetime.fromisoformat(test_shout["createdAt"])
|
||||||
|
test_shout["publishedAt"] = datetime.fromisoformat(test_shout["publishedAt"])
|
||||||
|
print(test_shout)
|
||||||
|
return test_shout
|
||||||
|
|
||||||
with local_session() as session:
|
with local_session() as session:
|
||||||
q = select(Shout).options(
|
q = select(Shout).options(
|
||||||
joinedload(Shout.authors),
|
joinedload(Shout.authors),
|
||||||
|
|
|
@ -142,7 +142,7 @@ class NewReactionNotificator:
|
||||||
|
|
||||||
class NotificationService:
|
class NotificationService:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._queue = asyncio.Queue()
|
self._queue = asyncio.Queue(maxsize=1000)
|
||||||
|
|
||||||
async def handle_new_reaction(self, reaction_id):
|
async def handle_new_reaction(self, reaction_id):
|
||||||
notificator = NewReactionNotificator(reaction_id)
|
notificator = NewReactionNotificator(reaction_id)
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user