..bump readme
This commit is contained in:
parent
d20cd1e521
commit
158cb20717
18
README.md
18
README.md
|
@ -13,13 +13,13 @@ Install deps first
|
||||||
|
|
||||||
on osx
|
on osx
|
||||||
```
|
```
|
||||||
brew install redis poetry nginx
|
brew install redis nginx
|
||||||
brew services start redis
|
brew services start redis
|
||||||
```
|
```
|
||||||
|
|
||||||
on debian/ubuntu
|
on debian/ubuntu
|
||||||
```
|
```
|
||||||
apt install redis python-poetry nginx
|
apt install redis nginx
|
||||||
```
|
```
|
||||||
|
|
||||||
Then run nginx, redis and API server
|
Then run nginx, redis and API server
|
||||||
|
@ -30,17 +30,9 @@ redis-server
|
||||||
cp nginx.conf /usr/local/etc/nginx/.
|
cp nginx.conf /usr/local/etc/nginx/.
|
||||||
nginx -s reload
|
nginx -s reload
|
||||||
|
|
||||||
poetry install
|
pip install -r requirements.txt
|
||||||
poetry run python server.py
|
python server.py
|
||||||
poetry run python server.py inbox
|
python server.py inbox
|
||||||
```
|
|
||||||
|
|
||||||
## Data prepare
|
|
||||||
|
|
||||||
Also, you'll need to migrate some data
|
|
||||||
|
|
||||||
```
|
|
||||||
poetry run python migrate.py all
|
|
||||||
```
|
```
|
||||||
|
|
||||||
# How to do an authorized request
|
# How to do an authorized request
|
||||||
|
|
|
@ -105,20 +105,20 @@ async def delete_reaction(_, info, id):
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
@query.field("reactionsByShout")
|
@query.field("reactionsByShout")
|
||||||
def get_shout_reactions(_, info, slug)-> List[Reaction]:
|
def get_shout_reactions(_, info, slug):
|
||||||
#offset = page * size
|
#offset = page * size
|
||||||
#end = offset + size
|
#end = offset + size
|
||||||
return ReactionsStorage.reactions_by_shout.get(slug, []) #[offset:end]
|
return ReactionsStorage.reactions_by_shout.get(slug, []) #[offset:end]
|
||||||
|
|
||||||
|
|
||||||
@query.field("reactionsAll")
|
@query.field("reactionsAll")
|
||||||
def get_all_reactions(_, info, page=1, size=10) -> List[Reaction]:
|
def get_all_reactions(_, info, page=1, size=10):
|
||||||
offset = page * size
|
offset = page * size
|
||||||
end = offset + size
|
end = offset + size
|
||||||
return ReactionsStorage.reactions[offset:end]
|
return ReactionsStorage.reactions[offset:end]
|
||||||
|
|
||||||
@query.field("reactionsByAuthor")
|
@query.field("reactionsByAuthor")
|
||||||
def get_reactions_by_author(_, info, slug, page=1, size=50) -> List[Reaction]:
|
def get_reactions_by_author(_, info, slug, page=1, size=50):
|
||||||
offset = page * size
|
offset = page * size
|
||||||
end = offset + size
|
end = offset + size
|
||||||
return ReactionsStorage.reactions_by_author.get(slug, [])[offset:end]
|
return ReactionsStorage.reactions_by_author.get(slug, [])[offset:end]
|
||||||
|
|
|
@ -57,9 +57,10 @@ async def get_shout_by_slug(_, info, slug):
|
||||||
options([
|
options([
|
||||||
selectinload(Shout.topics),
|
selectinload(Shout.topics),
|
||||||
selectinload(Shout.reactions),
|
selectinload(Shout.reactions),
|
||||||
selectinload(Shout.authors)
|
joinedload(Shout.authors, innerjoin=True),
|
||||||
|
selectinload(ShoutAuthor.caption)
|
||||||
]).\
|
]).\
|
||||||
join([ShoutAuthor.user, ShoutAuthor.caption], ShoutAuthor.shout == slug ).\
|
join(ShoutAuthor.caption.label('caption'), ShoutAuthor.shout == slug ).\
|
||||||
filter(Shout.slug == slug).first()
|
filter(Shout.slug == slug).first()
|
||||||
|
|
||||||
if not shout:
|
if not shout:
|
||||||
|
|
|
@ -322,7 +322,7 @@ type Reaction {
|
||||||
|
|
||||||
type Author {
|
type Author {
|
||||||
slug: String!
|
slug: String!
|
||||||
name: String
|
name: String!
|
||||||
userpic: String
|
userpic: String
|
||||||
caption: String # only for full shout
|
caption: String # only for full shout
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user