示例#1
0
async def get_all_users(request: Request, db: Session = Depends(get_db)):
    print("getting all users.............")
    print(request.headers)
    print(await request.body())
    print(await request.form())
    all_users = crud.get_all_users(db=db)
    return None
示例#2
0
async def list_users(message: types.Message, allowed: bool):
    if allowed:
        users = crud.get_all_users()
        await message.answer(users)
    else:
        logging.warning("NOT ALLOWED")
        send_admin_message(f"NOT ALLOWED: {message}")
示例#3
0
def check_plants_for_watering():
    """Searches through the User_Plants table to see if any plants need reminders for watering."""

    users_to_notify = {}

    users = crud.get_all_users()

    for user in users:
        #       #access the plants associated to each user
        plants = user.plants

        for plant in plants:

            if (plant.last_watered >= plant.plant_info.water_schedule):

                if (user.text_service == True):
                    print(
                        'User signed up for texts!!!!!!!!!!!!!!!!!!!!!!!!!!!')
                    if (user.phone_number not in users_to_notify):
                        users_to_notify[user.phone_number] = [
                            plant.plant_info.plant_name
                        ]
                    else:
                        users_to_notify[user.phone_number].append(
                            plant.plant_info.plant_name)
                crud.reset_plant_last_watered(plant.user_plant_id)

            else:
                #                 #Use a patch to increment plant last_watered property by 1
                crud.increment_plant_last_watered(plant.user_plant_id)

    return users_to_notify
示例#4
0
def all_users():
    """View all users."""

    users = crud.get_all_users()

    return render_template('all_users.html', users=users)
示例#5
0
def get_users():
    """Users"""

    users = crud.get_all_users()
    return render_template("users.html", users = users)
示例#6
0
def all_users():
    """Display all users."""
    users = crud.get_all_users()

    return render_template("all_users.html", users=users)
示例#7
0
def read_all_users(db: Session = Depends(get_db)):
    """Returns a all users"""

    users = crud.get_all_users(db)
    return users
示例#8
0
        random_feature = choice(all_features)
        random_shop = choice(all_shops_in_db)
        details = faker.sentence(nb_words=8)
        last_updated = datetime.now()
        liked = choice([True, False])

        user_feature = crud.create_user_feature(
                                    user=user,
                                    feature=random_feature,
                                    shop=random_shop,
                                    details=details,
                                    last_updated=last_updated,                                
                                    )

# MORE USER_FEATURES DATA
# Rank the already made features
crud.set_seed_rankings(crud.get_all_users())













def show_all_users():
    """Show a list of all users"""

    users = crud.get_all_users()

    return render_template('all_users.html', users=users)
示例#10
0
def read_user(db: Session = Depends(get_db), current_user: schemas.UserInfo = Depends(get_current_user)):
    return crud.get_all_users(db)
示例#11
0
 async def get_all_users(db: Session = Depends(get_db)):
     return crud.get_all_users(db=db)
示例#12
0
def admin_users():
    users = get_all_users()
    return render_template("admin_users.html", users=users)
示例#13
0
def user_list():
    """View user list."""

    all_users = crud.get_all_users()

    return render_template('users.html', all_users=all_users)