simple body title search, reacted filted fix
This commit is contained in:
parent
4918022013
commit
f764577136
|
@ -10,8 +10,8 @@ deploy:
|
||||||
stage: deploy
|
stage: deploy
|
||||||
environment:
|
environment:
|
||||||
name: production
|
name: production
|
||||||
url: https://testapi.discours.io
|
url: https://v2.discours.io
|
||||||
only:
|
only:
|
||||||
- main
|
- main
|
||||||
script:
|
script:
|
||||||
- git-push ssh://dokku@staging.discours.io:22/$APP_NAME
|
- git-push ssh://dokku@v2.discours.io:22/$APP_NAME
|
||||||
|
|
|
@ -47,8 +47,11 @@ async def load_shouts_by(_, info, by, limit=50, offset=0):
|
||||||
q = q.filter(Shout.slug == by["slug"])
|
q = q.filter(Shout.slug == by["slug"])
|
||||||
else:
|
else:
|
||||||
if by.get("reacted"):
|
if by.get("reacted"):
|
||||||
|
try:
|
||||||
user = info.context["request"].user
|
user = info.context["request"].user
|
||||||
q = q.filter(Reaction.createdBy == user.slug)
|
q = q.filter(Reaction.createdBy == user.slug)
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
if by.get("visibility"):
|
if by.get("visibility"):
|
||||||
q = q.filter(or_(
|
q = q.filter(or_(
|
||||||
Shout.visibility.ilike(f"%{by.get('visibility')}%"),
|
Shout.visibility.ilike(f"%{by.get('visibility')}%"),
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
import asyncio
|
import asyncio
|
||||||
|
|
||||||
from orm.shout import Shout
|
from orm.shout import Shout
|
||||||
|
from resolvers.zine import load_shouts_by
|
||||||
|
|
||||||
|
|
||||||
class SearchService:
|
class SearchService:
|
||||||
|
@ -13,6 +15,10 @@ class SearchService:
|
||||||
SearchService.cache = {}
|
SearchService.cache = {}
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
async def search(text) -> [Shout]:
|
async def search(text, limit, offset) -> [Shout]:
|
||||||
async with SearchService.lock:
|
async with SearchService.lock:
|
||||||
return [] # TODO: implement getting shouts list
|
by = {
|
||||||
|
"title": text,
|
||||||
|
"body": text
|
||||||
|
}
|
||||||
|
return await load_shouts_by(None, None, by, limit, offset)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user