initial topicUpdated

This commit is contained in:
knst-kotov 2021-11-04 19:37:41 +03:00
parent 7f8908a84b
commit e5aa568933
4 changed files with 29 additions and 13 deletions

24
create_crt.sh Executable file → Normal file
View File

@ -1,12 +1,12 @@
#!/bin/bash
openssl req -newkey rsa:4096 \
-x509 \
-sha256 \
-days 3650 \
-nodes \
-out discours.crt \
-keyout discours.key \
-subj "/C=RU/ST=Moscow/L=Moscow/O=Discours/OU=Site/CN=build.discours.io"
openssl x509 -in discours.crt -out discours.pem -outform PEM
#!/bin/bash
openssl req -newkey rsa:4096 \
-x509 \
-sha256 \
-days 3650 \
-nodes \
-out discours.crt \
-keyout discours.key \
-subj "/C=RU/ST=Moscow/L=Moscow/O=Discours/OU=Site/CN=build.discours.io"
openssl x509 -in discours.crt -out discours.pem -outform PEM

View File

@ -16,3 +16,4 @@ transliterate
requests
bcrypt
bs4
websockets

View File

@ -45,3 +45,18 @@ async def topic_unsubscribe(_, info, slug):
session.delete(sub)
return {} # type Result
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

View File

@ -129,7 +129,7 @@ type Subscription {
onlineUpdated: [User!]!
shoutUpdated: Shout!
userUpdated: User!
topicUpdated: Shout!
topicUpdated(user_id: Int!): Shout!
}
############################################ Entities