Exemple #1
0
def post_webhooks():
    all_settings = SiteSettings.get_site_settings()

    if all_settings.webhooks.enabled:
        todays_meal = Recipe.get_by_slug(MealPlan.today()).dict()
        urls = all_settings.webhooks.webhookURLs

        for url in urls:
            requests.post(url, json.dumps(todays_meal, default=str))
Exemple #2
0
def post_webhooks():
    session = create_session()
    all_settings = db.get(session, "main")
    all_settings = SiteSettings(**all_settings)

    if all_settings.webhooks.enabled:
        todays_meal = Recipe.get_by_slug(MealPlan.today()).dict()
        urls = all_settings.webhooks.webhookURLs

        for url in urls:
            requests.post(url, json.dumps(todays_meal, default=str))

    session.close()
Exemple #3
0
    def process_meals(self):
        meals = []
        for x, meal in enumerate(self.meals):
            recipe = Recipe.get_by_slug(meal.slug)

            meal_data = {
                "slug": recipe.slug,
                "name": recipe.name,
                "date": self.startDate + timedelta(days=x),
                "dateText": meal.dateText,
                "image": recipe.image,
                "description": recipe.description,
            }

            meals.append(Meal(**meal_data))

        self.meals = meals
Exemple #4
0
def get_recipe(recipe_slug: str, db: Session = Depends(generate_session)):
    """ Takes in a recipe slug, returns all data for a recipe """
    recipe = Recipe.get_by_slug(db, recipe_slug)

    return recipe
Exemple #5
0
def get_recipe(recipe_slug: str):
    """ Takes in a recipe slug, returns all data for a recipe """
    recipe = Recipe.get_by_slug(recipe_slug)

    return recipe