Exemple #1
0
async def get_patient_collects():
    for patient in db.patients.find():
        collects = []
        for collect in db.collects.find({'patient': patient['_id']}):
            collects.append(Collect(**collect))
        db.patient.update({'_id': patient['_id']},
                          {'$set': {
                              'collects': collects
                          }})
Exemple #2
0
async def list_collects(user: User = Depends(get_current_active_user)):
    collects = []
    for collect in db.collects.find():
        collects.append(Collect(**collect))

    return collects
Exemple #3
0
def create_collect():
    request_data = request.get_json()
    collect = Collect(**request_data).save()
    return jsonify(collect)