Exemplo n.º 1
0
def show_restaurants():
    restaurants = restaurant_service.get_restaurants()

    username = session.get("username")
    user_id = account_service.find_id_by_username(username)[0]

    return render_template("restaurant/show_restaurants.html",
                           restaurants=restaurants,
                           user_id=user_id)
Exemplo n.º 2
0
def check_user():  # todo siirra accounttiin ja mieti koko kuvio viela
    username_logged_in = session.get("username")
    if not username_logged_in:
        return redirect("/login")

    user = account_service.find_user_by_username(username_logged_in)
    username, is_admin = user

    user_id = account_service.find_id_by_username(username)[0]
    return user_id, is_admin
Exemplo n.º 3
0
def review_restaurant_get():
    username_logged_in = session.get("username")
    user = account_service.find_user_by_username(username_logged_in)
    user_id = account_service.find_id_by_username(username_logged_in)[0]

    if user:
        username = user[0]

    if not username:
        return redirect("/")

    restaurants = restaurant_service.get_restaurants()


    return render_template("review/review_restaurant.html", restaurants=restaurants, user_id=user_id)
Exemplo n.º 4
0
def index():

    username_logged_in = session.get("username")
    if not username_logged_in:
        return redirect("/login")


    user = account_service.find_user_by_username(username_logged_in)
    username, is_admin = user

    if not username:
        return redirect("/login")

    user_id = account_service.find_id_by_username(username)[0]


    return render_template("home/index.html", user_id=user_id, admin=is_admin)
Exemplo n.º 5
0
def add_restaurant_get():
    username_logged_in = session.get("username")

    if not username_logged_in:
        return redirect("/login")

    user = account_service.find_user_by_username(username_logged_in)
    username, admin = user

    if not admin:
        return redirect("/")

    user_id = account_service.find_id_by_username(username)[0]

    restaurants = restaurant_service.get_restaurants()

    return render_template("restaurant/add_restaurant.html",
                           restaurants=restaurants,
                           user_id=user_id)