initial topicUpdated
This commit is contained in:
parent
7f8908a84b
commit
e5aa568933
0
create_crt.sh
Executable file → Normal file
0
create_crt.sh
Executable file → Normal file
|
@ -16,3 +16,4 @@ transliterate
|
||||||
requests
|
requests
|
||||||
bcrypt
|
bcrypt
|
||||||
bs4
|
bs4
|
||||||
|
websockets
|
||||||
|
|
|
@ -45,3 +45,18 @@ async def topic_unsubscribe(_, info, slug):
|
||||||
session.delete(sub)
|
session.delete(sub)
|
||||||
return {} # type Result
|
return {} # type Result
|
||||||
return { "error": "session error" }
|
return { "error": "session error" }
|
||||||
|
|
||||||
|
@subscription.source("topicUpdated")
|
||||||
|
async def new_shout_generator(obj, info, user_id):
|
||||||
|
with local_session() as session:
|
||||||
|
topics = session.query(TopicSubscription.topic).filter(TopicSubscription.user == user_id).all()
|
||||||
|
#TODO filter new shouts
|
||||||
|
while True:
|
||||||
|
new_shout = {"slug": "slug", "body" : "body"}
|
||||||
|
yield new_shout
|
||||||
|
await asyncio.sleep(30)
|
||||||
|
print("end")
|
||||||
|
|
||||||
|
@subscription.field("topicUpdated")
|
||||||
|
def shout_resolver(shout, info, user_id):
|
||||||
|
return shout
|
||||||
|
|
|
@ -129,7 +129,7 @@ type Subscription {
|
||||||
onlineUpdated: [User!]!
|
onlineUpdated: [User!]!
|
||||||
shoutUpdated: Shout!
|
shoutUpdated: Shout!
|
||||||
userUpdated: User!
|
userUpdated: User!
|
||||||
topicUpdated: Shout!
|
topicUpdated(user_id: Int!): Shout!
|
||||||
}
|
}
|
||||||
|
|
||||||
############################################ Entities
|
############################################ Entities
|
||||||
|
|
Loading…
Reference in New Issue
Block a user