resetdb update (v2), loadDrafts
This commit is contained in:
parent
c11c862d96
commit
56e4700ace
|
@ -1,7 +1,7 @@
|
|||
database_name="discoursio"
|
||||
remote_backup_dir="/var/backups/mongodb_primero"
|
||||
remote_backup_dir="/var/backups/mongodb"
|
||||
user="root"
|
||||
host="testapi.discours.io"
|
||||
host="v2.discours.io"
|
||||
server="$user@$host"
|
||||
dump_dir="./dump"
|
||||
local_backup_filename="discours-backup.bson.gz.tar"
|
||||
|
|
|
@ -196,7 +196,7 @@ async def load_shouts_by(_, info, options):
|
|||
return shouts
|
||||
|
||||
@query.field("loadDrafts")
|
||||
async def get_drafts(_, info, options):
|
||||
async def get_drafts(_, info):
|
||||
auth: AuthCredentials = info.context["request"].auth
|
||||
user_id = auth.user_id
|
||||
|
||||
|
@ -207,17 +207,7 @@ async def get_drafts(_, info, options):
|
|||
and_(Shout.deletedAt.is_(None), Shout.createdBy == user_id)
|
||||
)
|
||||
|
||||
q = apply_filters(q, options.get("filters", {}), user_id)
|
||||
order_by = options.get("order_by", Shout.createdAt)
|
||||
if order_by == 'reacted':
|
||||
aliased_reaction = aliased(Reaction)
|
||||
q.outerjoin(aliased_reaction).add_columns(func.max(aliased_reaction.createdAt).label('reacted'))
|
||||
|
||||
query_order_by = desc(order_by) if options.get('order_by_desc', True) else asc(order_by)
|
||||
offset = options.get("offset", 0)
|
||||
limit = options.get("limit", 10)
|
||||
|
||||
q = q.group_by(Shout.id).order_by(query_order_by).limit(limit).offset(offset)
|
||||
q = q.group_by(Shout.id)
|
||||
|
||||
shouts = []
|
||||
with local_session() as session:
|
||||
|
|
|
@ -278,7 +278,7 @@ type Query {
|
|||
loadAuthorsBy(by: AuthorsBy, limit: Int, offset: Int): [Author]!
|
||||
loadShout(slug: String!): Shout
|
||||
loadShouts(options: LoadShoutsOptions): [Shout]!
|
||||
loadDrafts(options: LoadShoutsOptions): [Shout]!
|
||||
loadDrafts: [Shout]!
|
||||
loadReactionsBy(by: ReactionBy!, limit: Int, offset: Int): [Reaction]!
|
||||
userFollowers(slug: String!): [Author]!
|
||||
userFollowedAuthors(slug: String!): [Author]!
|
||||
|
|
Loading…
Reference in New Issue
Block a user