Пример #1
0
 async def resolve_notify(self, info, id, text):
     if id == '':
         id = info.context['user'].id
     fields = get_projection(info, True)
     user = await info.context['request'].app.mongo.trader.users.find_one({'_id': ObjectId(id)}, fields)
     if user['subscription']:
         send_web_push(user['subscription'], text)
         return 'Success'
     else:
         return 'No subscription'
Пример #2
0
def get_user_projection_and_mongo(info):
    if 'request' in info.context:
        id = info.context['request'].user.display_name
    else:
        id = info.context['user']['_id']
    fields = get_projection(info, True)

    if 'request' in info.context:
        client = info.context['request'].app.mongo
    else:
        client = info.context['client']

    return id, fields, client
Пример #3
0
 async def resolve_wallet_types(self, info):
     fields = get_projection(info, True)
     result = []
     async for document in info.context['request'].app.mongo.trader.wallet_types.find({}, fields):
         result.append(document)
     return result
Пример #4
0
 async def resolve_coin_gecko(self, info):
     fields = get_projection(info, True)
     coin_gecko = await info.context['request'].app.mongo.trader.coin_gecko.find_one({}, fields)
     return coin_gecko