v0.2.0 Release Candidate (#141)

* Fix link to Docker Hub

Found an extra s. DESTROYED it.

* Release v0.1.0 Candidate (#85)

* Changed uvicorn port to 80

* Changed port in docker-compose to match dockerfile

* Readded environment variables in docker-compose

* production image rework

* Use opengraph metadata to make basic recipe cards when full recipe metadata is not available

* fixed instrucitons on parse

* add last_recipe

* automated testing

* roadmap update

* Sqlite (#75)

* file structure

* auto-test

* take 2

* refactor ap scheduler and startup process

* fixed scraper error

* database abstraction

* database abstraction

* port recipes over to new schema

* meal migration

* start settings migration

* finale mongo port

* backup improvements

* migration imports to new DB structure

* unused import cleanup

* docs strings

* settings and theme import logic

* cleanup

* fixed tinydb error

* requirements

* fuzzy search

* remove scratch file

* sqlalchemy models

* improved search ui

* recipe models almost done

* sql modal population

* del scratch

* rewrite database model mixins

* mostly grabage

* recipe updates

* working sqllite

* remove old files and reorganize

* final cleanup

Co-authored-by: Hayden <hay-kot@pm.me>

* Backup card (#78)

* backup / import dialog

* upgrade to new tag method

* New import card

* rename settings.py to app_config.py

* migrate to poetry for development

* fix failing test

Co-authored-by: Hayden <hay-kot@pm.me>

* added mkdocs to docker-compose

* Translations (#72)

* Translations + danish

* changed back proxy target to use ENV

* Resolved more merge conflicts

* Removed test in translation

* Documentation of translations

* Updated translations

* removed old packages

Co-authored-by: Hayden <64056131+hay-kot@users.noreply.github.com>

* fail to start bug fixes

* feature: prep/cook/total time slots (#80)

Co-authored-by: Hayden <hay-kot@pm.me>

* missing bind attributes

* Bug fixes (#81)

* fix: url remains after succesful import

* docs: changelog + update todos

* arm image

* arm compose

* compose updates

* update poetry

* arm support

Co-authored-by: Hayden <hay-kot@pm.me>

* dockerfile hotfix

* dockerfile hotfix

* Version Release Final Touches (#84)

* Remove slim

* bug: opacity issues

* bug: startup failure with no database

* ci/cd on dev branch

* formatting

* v0.1.0 documentation

Co-authored-by: Hayden <hay-kot@pm.me>

* db init hotfix

* bug: fix crash in mongo

* fix mongo bug

* fixed version notifier

* finale changelog

Co-authored-by: kentora <=>
Co-authored-by: Hayden <hay-kot@pm.me>
Co-authored-by: Richard Mitic <richard.h.mitic@gmail.com>
Co-authored-by: kentora <kentora@kentora.dk>

* build container

* webscraper hotfix

* notes hot fix

* bug: mongo updates fail #99

* Fix error message (#101)

* gh funding

* Create Issue Templates (#125)

* Create bug_report.md

* Create config.yml

Included a link to feature requests.

* Update config.yml

Fixed link I had for testing to the actual link

* Update bug_report.md

fix capitalization

* Update .github/ISSUE_TEMPLATE/bug_report.md

Co-authored-by: Stephen Brown II <Stephen.Brown2@gmail.com>

Co-authored-by: Stephen Brown II <Stephen.Brown2@gmail.com>

* merge kentors changes

* refactor/recipe routers

* category/tag database relationship and endpoints

* frontend category management

* update branch todos

* bug/normalize recipe steps html

* remove console.log +  refactor categories

* fix categories database errors

* refactor/ router endpoint

* refactor/ remove old code

* drag and drop ingredients

* general cleanup

* route refactoring

* changelog

* api refactoring + random cleanup

* fixed backwards sort

* Update mkdocs.yml (#137)

Fix warning from Deploy Docs github action

* fixed navigate on enter in search

* refactor/create global css

* added category scroll

* cleanup todos

* debug routes

* docs/new gifs & general updates

* cleanup

* fix list test

Co-authored-by: David Young <davidy@funkypenguin.co.nz>
Co-authored-by: Hayden <hay-kot@pm.me>
Co-authored-by: Richard Mitic <richard.h.mitic@gmail.com>
Co-authored-by: kentora <kentora@kentora.dk>
Co-authored-by: Alexei Pesic <pesic.alexei@gmail.com>
Co-authored-by: Andrew <dpieski@gmail.com>
Co-authored-by: Stephen Brown II <Stephen.Brown2@gmail.com>
This commit is contained in:
Hayden 2021-02-06 14:06:09 -09:00 committed by GitHub
commit e884eb1762
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
129 changed files with 5417 additions and 708 deletions

38
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View file

@ -0,0 +1,38 @@
---
name: Bug Report
about: Create a bug report to help us improve
title: ''
labels: bug
assignees: ''
---
**Describe the bug**
<!-- A clear and concise description of what the bug is. -->
**Steps To Reproduce**
Please be specific!
1. Go to '...'
2. Click on '....'
3. etc.
**Sample Code**
<!-- If applicable, please include Sample code to reproduce the issue. -->
**Expected behavior**
<!-- A clear and concise description of what you expected to happen. -->
**Actual Behavior**
<!-- A clear and concise description of what actually happens. -->
**Screenshots**
<!-- If applicable, add screenshots to help explain your problem. -->
**Device Information (please complete the following information):**
- OS: [e.g., WSL2 on Win10, Mac]
- Deployment: [e.g., Docker-version, docker-compose, Python application]
- Browser: [e.g., chrome, safari]
- Version: [e.g., 0.2.0-dev]
**Additional context**
<!-- Add any other context about the problem here. If applicable, please include why you think the bug is occurring and/or troubleshooting you have already performed. -->

4
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View file

@ -0,0 +1,4 @@
contact_links:
- name: Feature Requests
url: https://github.com/hay-kot/mealie/issues/122
about: Please add any Feature Requests here.

View file

@ -14,5 +14,8 @@
"python.testing.pytestArgs": ["mealie"],
"i18n-ally.localesPaths": "frontend/src/locales",
"i18n-ally.enabledFrameworks": ["vue"],
"i18n-ally.keystyle": "nested"
"i18n-ally.keystyle": "nested",
"cSpell.words": [
"performant"
]
}

View file

@ -36,4 +36,4 @@ RUN rm -rf /app/test /app/.temp
VOLUME [ "/app_data/" ]
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "80"]
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "80"]

33
Dockerfile.arm Normal file
View file

@ -0,0 +1,33 @@
FROM node:lts-alpine as build-stage
WORKDIR /app
COPY ./frontend/package*.json ./
RUN npm install
COPY ./frontend/ .
RUN npm run build
FROM mrnr91/uvicorn-gunicorn-fastapi:python3.8
COPY ./requirements.txt /app/requirements.txt
WORKDIR /app
RUN apt-get update -y && \
apt-get install -y python-pip python-dev git curl --no-install-recommends
RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | POETRY_HOME=/opt/poetry python && \
cd /usr/local/bin && \
ln -s /opt/poetry/bin/poetry && \
poetry config virtualenvs.create false
COPY ./pyproject.toml ./app/poetry.lock* /app/
COPY ./mealie /app
RUN poetry install --no-root --no-dev
COPY --from=build-stage /app/dist /app/dist
RUN rm -rf /app/test /app/.temp
ENV ENV prod
ENV APP_MODULE "app:app"
VOLUME [ "/app/data" ]

View file

@ -33,7 +33,7 @@
Request Feature
</a>
·
<a href="https://hub.docker.com/repository/docker/hkotel/mealie"> Docker Hub
<a href="https://hub.docker.com/r/hkotel/mealie"> Docker Hub
</a>
</p>

16
docker-compose.arm.yml Normal file
View file

@ -0,0 +1,16 @@
# Use root/example as user/password credentials
# Frontend/Backend Served via the same Uvicorn Server
version: "3.1"
services:
mealie:
build:
context: ./
dockerfile: Dockerfile.arm
container_name: mealie
restart: always
ports:
- 9090:80
environment:
db_type: sql
volumes:
- ./mealie/data/:/app/data

View file

@ -1,44 +1,69 @@
# Release Notes
## V0.2.0 - Now with Test!
## v0.2.0 - Now with Test!
This is, what I think, is a big release! Tons of new features and some great quality of life improvements with some additional features. You may find that I made promises to include some fixes/features in v0.2.0. The short of is I greatly underestimated the work needed to refactor the database to a usable state and integrate categories in a way that is useful for users. This shouldn't be taken as a sign that I'm dropping those feature requests or ignoring them. I felt it was better to push a release in the current state rather than drag on development to try and fulfil all of the promises I made.
!!! warning "Upgrade Process"
Database Breaks! I have not yet implemented a database migration service. As such, upgrades cannot be done by simply pulling the image. You must first export your recipes, update your deployment, and then import your recipes. This pattern is likely to be how upgrades take place prior to v1.0. After v1.0 migrations will be done automatically.
### Bug Fixes
- Remove ability to save recipe with no name
- Fixed data validation error on missing parameters
- Fixed failed database initialization at startup
- Fixed failed database initialization at startup - Closes #98
- Fixed misaligned text on various cards
- Fixed bug that blocked opening links in new tabs
- Fixed router link bugs - Issue #122
- Fixed bug that blocked opening links in new tabs - Closes #122
- Fixed router link bugs - Closes #122
- Fixed navigation on keyboard selection - Closes #139
### Features and Improvements
- UI Language Selection
- Meal Planner
- 🐳 Dockerfile now 1/5 of the size!
- 🌎 UI Language Selection + Additional Supported Language
- **Home Page**
- By default your homepage will display only the recently added recipes. You can configured sections to show on the home-screen based of categories on the settings page.
- A new sidebar is now shown on the main page that lists all the categories in the database. Clicking on them navigates into a page that shows only recipes.
- Basic Sort functionality has been added. More options are on the way!
- **Meal Planner**
- Improved Search (Fuzzy Search)
- New Scheduled card support
- Upload/Download backups
- Dockerfile now 1/5 of the size!
- Migrations
- **Recipe Editor**
- Ingredients are now sortable via drag-and-drop
- Known categories now show up in the dropdown - Closes 83
- Initial code for data validation to prevent errors
- **Migrations**
- Card based redesign
- Upload from the UI
- Unified Chowdown/Nextcloud import process.
- Continued work on button/style unification
- Adding icons to buttons
- New Color Theme Picker UI
- Unified Chowdown / Nextcloud import process. (Removed Git as a dependency)
- **API**
- Category and Tag endpoints added
- Major Endpoint refactor
- Improved API documentation
- Link to your Local API is now on your `/settings/site`. You can use it to explore your API.
- **Style**
- Continued work on button/style unification
- Adding icons to buttons
- New Color Theme Picker UI
### Development
- Fixed Vetur config file. Autocomplete in VSCode works!
- File/Folder restructuring
- Added Prettier config
- Fixed incorrect layout code
- FastAPI Route tests for major operations
- FastAPI Route tests for major operations - WIP (shallow testing)
### Breaking Changes
- Officially Dropped MongoDB Support
- Mounting volume moved to different internal location due to development issues. New volume should be mounted as `mealie/data:/app_data/`
### Breaking Changes
!!! error "Breaking Changes"
- API endpoints have been refactored to adhear to a more consistent standard. This is a WIP and more changes are likely to occur.
- Officially Dropped MongoDB Support
- Mounting volume moved to different internal location due to development issues. New volume should be mounted as `mealie/data:/app_data/`. Volume mounts need to be changed.
- Database Breaks! We have not yet implemented a database migration service. As such, upgrades cannot be done by simply pulling the image. You must first export your recipes, update your deployment, and then import your recipes. This pattern is likely to be how upgrades take place prior to v1.0. After v1.0 migrations will be done automatically.
## v0.1.0 - Initial Beta
### Bug Fixes
- Fixed Can't delete recipe after changing name - Closes Issue #67
- Fixed No image when added by URL, and can't add an image - Closes Issue #66
- Fixed Images saved with no way to delete when add recipe via URL fails - Closes Issue #43
- Fixed Can't delete recipe after changing name - Closes Closes #67
- Fixed No image when added by URL, and can't add an image - Closes Closes #66
- Fixed Images saved with no way to delete when add recipe via URL fails - Closes Closes #43
### Features
- Additional Language Support
@ -72,8 +97,8 @@ A quality update with major props to [zackbcom](https://github.com/zackbcom) for
- Fixed empty backup failure without markdown template
- Fixed opacity issues with marked steps - [mtoohey31](https://github.com/mtoohey31)
- Fixed hot-reloading development environment - [grssmnn](https://github.com/grssmnn)
- Fixed recipe not saving without image - Issue #7 + Issue #54
- Fixed parsing error on image property null - Issue #43
- Fixed recipe not saving without image - Closes #7 + Closes #54
- Fixed parsing error on image property null - Closes #43
### General Improvements
- Added Confirmation component to deleting recipes - [zackbcom](https://github.com/zackbcom)
@ -86,7 +111,7 @@ A quality update with major props to [zackbcom](https://github.com/zackbcom) for
- Users can now add custom json key/value pairs to all recipes via the editor for access in 3rd part applications. For example users can add a "message" field in the extras that can be accessed on API calls to play a message over google home.
- Improved image rendering (nearly x2 speed)
- Improved documentation + API Documentation
- Improved recipe parsing - Issue #51
- Improved recipe parsing - Closes #51
- User feedback on backup importing
## v0.0.1 - Pre-release Patch
@ -97,8 +122,8 @@ A quality update with major props to [zackbcom](https://github.com/zackbcom) for
### Recipes
- Added user feedback on bad URL
- Better backend data validation for updating recipes, avoid small syntax errors corrupting database entry. [Issue #8](https://github.com/hay-kot/mealie/issues/8)
- Fixed spacing issue while editing new recipes in JSON
- Better backend data validation for updating recipes, avoid small syntax errors corrupting database entry. [Closes #8](https://github.com/hay-kot/mealie/issues/8)
- Fixed spacing Closes while editing new recipes in JSON
## v0.0.0 - Initial Pre-release
The initial pre-release. It should be semi-functional but does not include a lot of user feedback You may notice errors that have no user feedback and have no idea what went wrong.

View file

@ -1,5 +1,4 @@
# Backup and Export
![](../img/admin-backup.png)
# Backup and Imports
All recipe data can be imported and exported as necessary from the UI. Under the admin page you'll find the section for using Backups and Exports.
@ -7,6 +6,8 @@ To create an export simple add the tag and the markdown template and click Backu
To import a backup it must be in your backups folder. If it is in the backup folder it will automatically show up as an source to restore from. Selected the desired backup and import the backup file.
![](../gifs/backup-demo-v1.gif)
## Custom Templating
On export you can select a template to use to render files using the jinja2 syntax. This can be done to export recipes in other formats besides regular .json.Look at this example for rendering a markdown recipe using the jinja2 syntax.

View file

@ -1,5 +1,5 @@
# Installation
To deploy docker on your local network it is highly recommended to use docker to deploy the image straight from dockerhub. Using the docker-compose below you should be able to get a stack up and running easily by changing a few default values and deploying. Currently MongoDB and SQLite are supported. MongoDB support will be dropped in v0.2.0 so it is recommended to go with SQLite for new deployments. Postrgres support is planned for the next release, however for most loads you may find SQLite performant enough.
To deploy docker on your local network it is highly recommended to use docker to deploy the image straight from dockerhub. Using the docker-compose below you should be able to get a stack up and running easily by changing a few default values and deploying. Currently MongoDB and SQLite are supported. MongoDB support will be dropped in v0.2.0 so it is recommended to go with SQLite for new deployments. Postrgres support is planned, however for most loads you may find SQLite performant enough for most use cases.
[Get Docker](https://docs.docker.com/get-docker/)
@ -14,7 +14,7 @@ Deployment with the Docker CLI can be done with `docker run` and specify the dat
docker run \
-e db_type='sqlite' \
-p 9000:80 \
-v `pwd`:'/app/data/' \
-v `pwd`:'/app_data/' \
hkotel/mealie:latest
```
@ -35,67 +35,19 @@ services:
db_type: sqlite
TZ: America/Anchorage
volumes:
- ./mealie/data/:/app/data
- ./mealie/data/:/app_data
```
## Docker Compose with Mongo - DEPRECIATED
```yaml
# docker-compose.yml
version: "3.1"
services:
mealie:
container_name: mealie
image: hkotel/mealie:latest
restart: always
ports:
- 9000:80
environment:
db_username: root # Your Mongo DB Username - Please Change
db_password: example # Your Mongo DB Password - Please Change
db_host: mongo
db_port: 27017 # The Default port for Mongo DB
TZ: America/Anchorage
volumes:
- ./mealie/data/:/app/data/
mongo:
image: mongo
restart: always
volumes:
- ./mongo:/data/db
environment:
MONGO_INITDB_ROOT_USERNAME: root # Change!
MONGO_INITDB_ROOT_PASSWORD: example # Change!
mongo-express: # Optional Mongo GUI
image: mongo-express
restart: always
ports:
- 9091:8081
environment:
ME_CONFIG_MONGODB_ADMINUSERNAME: root
ME_CONFIG_MONGODB_ADMINPASSWORD: example
```
## Env Variables
| Variables | default | description |
| -------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| db_type | sqlite | The database type to be used. Current Options 'sqlite' and 'mongo' |
| mealie_db_name | mealie | The name of the database to be created in Mongodb |
| mealie_port | 9000 | The port exposed by mealie. **do not change this if you're running in docker** If you'd like to use another port, map 9000 to another port of the host. |
| db_username | root | The Mongodb username you specified in your mongo container |
| db_password | example | The Mongodb password you specified in your mongo container |
| db_host | mongo | The host address of MongoDB if you're in docker and using the same network you can use mongo as the host name |
| db_port | 27017 | the port to access MongoDB 27017 is the default for mongo |
| api_docs | True | Turns on/off access to the API documentation locally. |
| TZ | | You should set your time zone accordingly so the date/time features work correctly |
| Variables | default | description |
| ----------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| db_type | sqlite | The database type to be used. Current Options 'sqlite' |
| mealie_port | 9000 | The port exposed by mealie. **do not change this if you're running in docker** If you'd like to use another port, map 9000 to another port of the host. |
| api_docs | True | Turns on/off access to the API documentation locally. |
| TZ | | You should set your time zone accordingly so the date/time features work correctly |
## Deployed as a Python Application
Alternatively, this project is built on Python and Mongodb. If you are dead set on deploying on a linux machine you can run this in an python environment with a dedicated MongoDatabase. Provided that you know thats how you want to host the application, I'll assume you know how to do that. I may or may not get around to writing this guide. I'm open to pull requests if anyone has a good guide on it.
Alternatively, this project is built on Python and SQLite. If you are dead set on deploying on a linux machine you can run this in an python virtual env. Provided that you know thats how you want to host the application, I'll assume you know how to do that. I may or may not get around to writing this guide. I'm open to pull requests if anyone has a good guide on it.

View file

@ -3,9 +3,9 @@
## Working with Meal Plans
In Mealie you can create a mealplan based off the calendar inputs on the meal planner page. There is no limit to how long or how short a meal plan is. You may also create duplicate meal plans for the same date range. After selecting your date range, click on the card for each day and search through recipes to find your choice. After selecting a recipe for all meals save the plan. You can also randomly generate meal plans.
To edit the meal in a meal plan simply select the edit button on the card in the timeline. Similiarly, to delete a mealplan click the delete button on the card in the timeline. Currently there is no support to change the date range in a meal plan.
To edit the meal in a meal plan simply select the edit button on the card in the timeline. Similarly, to delete a mealplan click the delete button on the card in the timeline. Currently there is no support to change the date range in a meal plan.
!!! warning
In coming a future release recipes for meals will be restricted to specific categories.
![](../gifs/meal-plan-demo.gif)
![](../gifs/meal-plan-demo-v2.gif)

View file

@ -10,7 +10,7 @@ Adding a recipe can be as easy as copying the recipe URL into mealie and letting
## Recipe Editor
Recipes can be edited and created via the UI. This is done with both a form based approach where you have a UI to work with as well as with a in browser JSON Editor. The JSON editor allows you to easily copy and paste data from other sources.
You can also add a custom recipe with the UI editor built into the web view. After logging in as a user you'll have access to the editor to make changes to all the content in the recipe.
You can also add a custom recipe with the UI editor built into the web view.
![](../gifs/editor-demo.gif)

View file

@ -2,18 +2,22 @@
!!! danger
As this is still a **BETA** It is recommended that you backup your data often and store in more than one place. Ad-hear to backup best practices with the [3-2-1 Backup Rule](https://en.wikipedia.org/wiki/Backup)
## General Settings
In your site settings page you can select several options to change the layout of your homepage. You can choose to display the recent recipes, how many cards to show for each section, and which category sections to display. You can additionally select which language to use by default. Note the currently homepage settings are saved in your browser. In the future a database entry will be made for site settings so the homepage is consistent across users.
![](../gifs/homepage-settings-v1.gif)
## Theme Settings
Color themes can be created and set from the UI in the settings page. You can select an existing color theme or create a new one. On creation of a new color theme, the default colors will be used, then you can select and save as you'd like. By default the "default" theme will be loaded for all new users visiting the site. All created color themes are available to all users of the site. Theme Colors will be set for both light and dark modes.
![](../gifs/theme-demo.gif)
![](../gifs/theme-demo-v2.gif)
!!! note
Theme data is stored in localstorage in the browser. Calling "Save colors and apply theme will refresh the localstorage with the selected theme as well save the theme to the database.
Theme data is stored in localstorage in the browser. Calling "Save colors and apply theme will refresh the local storage with the selected theme as well save the theme to the database.
## Backups
Site backups can easily be taken and download from the UI. To import, simply select the backup you'd like to restore and check which items you'd like to import.
## Meal Planner Webhooks
Meal planner webhooks are post requests sent from Mealie to an external endpoint. The body of the message is the Recipe JSON of the scheduled meal. If no meal is schedule, no request is sent. The webhook functionality can be enabled or disabled as well as scheduled. Note that you must "Save Webhooks" prior to any changes taking affect server side.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 MiB

View file

@ -25,9 +25,9 @@
![Product Name Screen Shot][product-screenshot]
**Mealie** is a self hosted recipe manager and meal planner with a RestAPI backend and a reactive frontend application built in Vue for a pleasant user experience for the whole family. Easily add recipes into your database by providing the url and mealie will automatically import the relevant data or add a family recipe with the UI editor.
**Mealie** is a self hosted recipe manager and meal planner with a RestAPI backend and a reactive frontend application built in Vue for a pleasant user experience for the whole family. Easily add recipes into your database by providing the url and Mealie will automatically import the relevant data or add a family recipe with the UI editor. Mealie also provides an API for interactions from 3rd party applications.
Mealie also provides an API for interactions from 3rd party applications. **Why does my recipe manager need an API?** An API allows integration into applications like [Home Assistant](https://www.home-assistant.io/) that can act as notification engines to provide custom notifications based of Meal Plan data to remind you to defrost the chicken, marinade the steak, or start the CrockPot. Additionally, you can access any available API from the backend server. To explore the API spin up your server and navigate to http://yourserver.com/docs for interactive API documentation.
**Why does my recipe manager need an API?** An API allows integration into applications like [Home Assistant](https://www.home-assistant.io/) that can act as notification engines to provide custom notifications based of Meal Plan data to remind you to defrost the chicken, marinade the steak, or start the CrockPot. Additionally, you can access any available API from the backend server. To explore the API spin up your server and navigate to http://yourserver.com/docs for interactive API documentation.
[Remember to join the Discord](https://discord.gg/R6QDyJgbD2)!
@ -35,29 +35,37 @@ Mealie also provides an API for interactions from 3rd party applications. **Why
In some of the demo gifs the styling may be different than the finale application. demos were done during development prior to finale styling.
!!! warning
Note that this is a **ALPHA** release and that means things may break and or change down the line. I'll do my best to make sure that any API changes are thoughtful and necessary in order not to break things. Additionally, I'll do my best to provide a migration path if the database schema ever changes. That said, one of the nice things about MongoDB is that it's flexible!
Note that this is a **BETA** release and that means things may break and or change down the line. I'll do my best to make sure that any API changes are thoughtful and necessary in order not to break things. Additionally, I'll do my best to provide a migration path if the database schema ever changes. Do not use programs like watchtower to auto update your container. You **WILL** run into issues if you do this,
### Main Features
#### Recipes
- Automatic web scrapping for common recipe platforms
- Interactive API Documentation thanks to [FastAPI](https://fastapi.tiangolo.com/) and [Swagger](https://petstore.swagger.io/)
- UI Recipe Editor
- JSON Recipe Editor in browser
- Custom tags and categories
- Rate recipes
- Add notes to recipes
- Migration From Other Platforms
- UI recipe editor
- JSON recipe editor
- Additional recipe data
- custom notes
- ratings
- categories and tags
- total, cook, and prep time indicators
- View recipes by category
- Basic fuzzy search
- Migration from other platforms
- Chowdown
- Open Eats - **Coming Soon**
- Nextcloud Cookbook
#### Meal Planner
- Random Meal plan generation based off categories
- Expose notes in the API to allow external applications to access relevant information for meal plans
- Random meal plan generation
#### API
- The entire application is built on a restful API and can be accessed by the user
- Scheduled Webhooks
- Interactive API Documentation thanks to [FastAPI](https://fastapi.tiangolo.com/) and [Swagger](https://petstore.swagger.io/)
- Custom "API Extras" in recipes for custom key/value pairs to extendable API uses
#### Database Import / Export
- Easily Import / Export your recipes from the UI
- Export recipes in markdown format for universal access
- Easily import / export your recipes from the UI
- Export recipes in any format for universal access using Jinja2
- Use the default or a custom jinja2 template
### Built With

View file

@ -1,51 +1,4 @@
# Development Road Map
!!! Current Release
v0.1.0 BETA - This is technically a pre-release, as such take care to backup data and be aware that breaking changes in future releases are a real possibility.
Feature placement is not set in stone. This is much more of a guideline than anything else.
## v x.x.x - No planned target, but eventually...
### Frontend
- [ ] Login / Logout Navigation
* [ ] Initial Page
* [ ] Logic / Function Calls
* [ ] Password Reset
### Backend
- [ ] Image Minification
- [ ] User Setup
* [ ] Authentication
* [ ] Default Admin/Superuser Account
* [ ] Password Reset
* [ ] User Accounts
* [ ] Edit / Delete
## v0.2.0 - Targets
!!! error "MAJOR BREAKING CHANGE"
MongoDB will no longer be supported as of v0.2.0. Review the database migration page for details on migration to SQL (It's very easy)
## New Features
### Frontend
- [ ] Advanced search
- [ ] Category Filter
- [ ] Tag Filter
- [x] Fuzzy Search
- [x] Backup card redesign
- [ ] Additional Backup / Import Features
- [ ] Import Recipes Force/Rebase options
- [x] Upload .zip file
- [x] Improved Color Picker
- [x] Meal Plan redesign
### Backend
- [ ] PostgreSQL Support
- [ ] Setup SQL Migrations
## Breaking Changes
- MongoDB support dropped
## Code Chores
- [x] Remove MongoDB Interface Code
- [x] Dockerfile Trim
See the [Github META issue for tracking the Road Map](https://github.com/hay-kot/mealie/issues/122)

View file

@ -38,7 +38,7 @@ nav:
- API Documentation: "api/docs/index.html"
- Contributors Guide:
- Non-Code: "contributors/non-coders.md"
- Translating: "contributors/translating"
- Translating: "contributors/translating.md"
- Developers Guide:
- Code Contributions: "contributors/developers-guide/code-contributions.md"
- Dev Getting Started: "contributors/developers-guide/starting-dev-server.md"

View file

@ -1966,16 +1966,6 @@
"integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==",
"dev": true
},
"ansi-styles": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
"dev": true,
"optional": true,
"requires": {
"color-convert": "^2.0.1"
}
},
"cacache": {
"version": "13.0.1",
"resolved": "https://registry.npmjs.org/cacache/-/cacache-13.0.1.tgz",
@ -2037,16 +2027,14 @@
"dev": true,
"optional": true
},
"loader-utils": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.0.tgz",
"integrity": "sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ==",
"ssri": {
"version": "7.1.0",
"resolved": "https://registry.npmjs.org/ssri/-/ssri-7.1.0.tgz",
"integrity": "sha512-77/WrDZUWocK0mvA5NTRQyveUf+wsrIc6vyrxpS8tVvYBcX215QbafrJR3KtkpskIzoFLqqNuuYQvxaMjXJ/0g==",
"dev": true,
"optional": true,
"requires": {
"big.js": "^5.2.2",
"emojis-list": "^3.0.0",
"json5": "^2.1.2"
"figgy-pudding": "^3.5.1",
"minipass": "^3.1.1"
}
},
"source-map": {
@ -11605,6 +11593,87 @@
}
}
},
"vue-loader-v16": {
"version": "npm:vue-loader@16.1.2",
"resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.1.2.tgz",
"integrity": "sha512-8QTxh+Fd+HB6fiL52iEVLKqE9N1JSlMXLR92Ijm6g8PZrwIxckgpqjPDWRP5TWxdiPaHR+alUWsnu1ShQOwt+Q==",
"dev": true,
"optional": true,
"requires": {
"chalk": "^4.1.0",
"hash-sum": "^2.0.0",
"loader-utils": "^2.0.0"
},
"dependencies": {
"ansi-styles": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
"dev": true,
"optional": true,
"requires": {
"color-convert": "^2.0.1"
}
},
"chalk": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz",
"integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==",
"dev": true,
"optional": true,
"requires": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
}
},
"color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dev": true,
"optional": true,
"requires": {
"color-name": "~1.1.4"
}
},
"color-name": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true,
"optional": true
},
"has-flag": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
"dev": true,
"optional": true
},
"loader-utils": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.0.tgz",
"integrity": "sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ==",
"dev": true,
"optional": true,
"requires": {
"big.js": "^5.2.2",
"emojis-list": "^3.0.0",
"json5": "^2.1.2"
}
},
"supports-color": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
"dev": true,
"optional": true,
"requires": {
"has-flag": "^4.0.0"
}
}
}
},
"vue-router": {
"version": "3.4.9",
"resolved": "https://registry.npmjs.org/vue-router/-/vue-router-3.4.9.tgz",

View file

@ -8,6 +8,7 @@
<title> Mealie </title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@mdi/font@latest/css/materialdesignicons.min.css">
<link rel="stylesheet" href="./styles/global.css">
</head>
<body>
<noscript>

View file

@ -0,0 +1,11 @@
*::-webkit-scrollbar {
width: 0.25rem;
}
*::-webkit-scrollbar-track {
background: lightgray;
}
*::-webkit-scrollbar-thumb {
background: grey;
}

View file

@ -1,6 +1,6 @@
<template>
<v-app>
<v-app-bar dense app color="primary" dark class="d-print-none">
<v-app-bar clipped-left dense app color="primary" dark class="d-print-none">
<v-btn @click="$router.push('/')" icon>
<v-icon size="40"> mdi-silverware-variant </v-icon>
</v-btn>
@ -94,16 +94,5 @@ export default {
</script>
<style>
/* Scroll Bar PageSettings */
body::-webkit-scrollbar {
width: 0.25rem;
}
body::-webkit-scrollbar-track {
background: grey;
}
body::-webkit-scrollbar-thumb {
background: black;
}
</style>

View file

@ -5,6 +5,9 @@ import settings from "./api/settings";
import themes from "./api/themes";
import migration from "./api/migration";
import myUtils from "./api/upload";
import category from "./api/category";
// import api from "../api";
export default {
recipes: recipe,
@ -14,4 +17,5 @@ export default {
themes: themes,
migrations: migration,
utils: myUtils,
categories: category,
};

View file

@ -27,6 +27,17 @@ const apiReq = {
return response;
},
put: async function (url, data) {
let response = await axios.put(url, data).catch(function (error) {
if (error.response) {
processResponse(error.response);
return response;
} else return;
});
// processResponse(response);
return response;
},
get: async function (url, data) {
let response = await axios.get(url, data).catch(function (error) {
if (error.response) {

View file

@ -6,11 +6,11 @@ const backupBase = baseURL + "backups/";
const backupURLs = {
// Backup
available: `${backupBase}available/`,
createBackup: `${backupBase}export/database/`,
importBackup: (fileName) => `${backupBase}${fileName}/import/`,
deleteBackup: (fileName) => `${backupBase}${fileName}/delete/`,
downloadBackup: (fileName) => `${backupBase}${fileName}/download/`,
available: `${backupBase}available`,
createBackup: `${backupBase}export/database`,
importBackup: (fileName) => `${backupBase}${fileName}/import`,
deleteBackup: (fileName) => `${backupBase}${fileName}/delete`,
downloadBackup: (fileName) => `${backupBase}${fileName}/download`,
};
export default {

View file

@ -0,0 +1,25 @@
import { baseURL } from "./api-utils";
import { apiReq } from "./api-utils";
const prefix = baseURL + "categories";
const categoryURLs = {
get_all: `${prefix}`,
get_category: (category) => `${prefix}/${category}`,
delete_category: (category) => `${prefix}/${category}`,
};
export default {
async get_all() {
let response = await apiReq.get(categoryURLs.get_all);
return response.data;
},
async get_recipes_in_category(category) {
let response = await apiReq.get(categoryURLs.get_category(category));
return response.data;
},
async delete(category) {
let response = await apiReq.delete(categoryURLs.delete_category(category));
return response.data;
},
};

View file

@ -1,22 +1,21 @@
import { baseURL } from "./api-utils";
import { apiReq } from "./api-utils";
const mealplanBase = baseURL + "meal-plan/";
const prefix = baseURL + "meal-plans/";
const mealPlanURLs = {
// Meals
create: `${mealplanBase}create/`,
today: `${mealplanBase}today/`,
thisWeek: `${mealplanBase}this-week/`,
all: `${mealplanBase}all/`,
delete: (planID) => `${mealplanBase}${planID}/delete/`,
update: (planID) => `${mealplanBase}${planID}/update/`,
all: `${prefix}all`,
create: `${prefix}create`,
thisWeek: `${prefix}this-week`,
update: (planID) => `${prefix}${planID}`,
delete: (planID) => `${prefix}${planID}`,
today: `${prefix}today`,
};
export default {
async create(postBody) {
let response = await apiReq.post(mealPlanURLs.create, postBody);
console.log(JSON.stringify(postBody));
return response;
},
@ -41,7 +40,7 @@ export default {
},
async update(id, body) {
let response = await apiReq.post(mealPlanURLs.update(id), body);
let response = await apiReq.put(mealPlanURLs.update(id), body);
return response;
},
};

View file

@ -2,13 +2,13 @@ import { baseURL } from "./api-utils";
import { apiReq } from "./api-utils";
import { store } from "../store/store";
const migrationBase = baseURL + "migrations/";
const migrationBase = baseURL + "migrations";
const migrationURLs = {
// New
all: migrationBase,
delete: (folder, file) => `${migrationBase}/${folder}/${file}/delete/`,
import: (folder, file) => `${migrationBase}/${folder}/${file}/import/`,
delete: (folder, file) => `${migrationBase}/${folder}/${file}/delete`,
import: (folder, file) => `${migrationBase}/${folder}/${file}/import`,
};
export default {

View file

@ -4,18 +4,17 @@ import { store } from "../store/store";
import { router } from "../main";
import qs from "qs";
const recipeBase = baseURL + "recipe/";
const prefix = baseURL + "recipes/";
const recipeURLs = {
// Recipes
allRecipes: baseURL + "all-recipes/",
recipe: (slug) => recipeBase + slug + "/",
recipeImage: (slug) => recipeBase + "image/" + slug + "/",
createByURL: recipeBase + "create-url/",
create: recipeBase + "create/",
updateImage: (slug) => `${recipeBase}${slug}/update/image/`,
update: (slug) => `${recipeBase}${slug}/update/`,
delete: (slug) => `${recipeBase}${slug}/delete/`,
allRecipes: baseURL + "recipes",
create: prefix + "create",
createByURL: prefix + "create-url",
recipe: (slug) => prefix + slug,
update: (slug) => prefix + slug,
delete: (slug) => prefix + slug,
recipeImage: (slug) => `${prefix}${slug}/image`,
updateImage: (slug) => `${prefix}${slug}/image`,
};
export default {
@ -43,7 +42,7 @@ export default {
fd.append("image", fileObject);
fd.append("extension", fileObject.name.split(".").pop());
let response = apiReq.post(recipeURLs.updateImage(recipeSlug), fd);
let response = apiReq.put(recipeURLs.updateImage(recipeSlug), fd);
return response;
},
@ -51,7 +50,7 @@ export default {
async update(data) {
const recipeSlug = data.slug;
let response = await apiReq.post(recipeURLs.update(recipeSlug), data);
let response = await apiReq.put(recipeURLs.update(recipeSlug), data);
store.dispatch("requestRecentRecipes");
return response.data;
},

View file

@ -1,12 +1,12 @@
import { baseURL } from "./api-utils";
import { apiReq } from "./api-utils";
const settingsBase = baseURL + "site-settings/";
const settingsBase = baseURL + "site-settings";
const settingsURLs = {
siteSettings: `${settingsBase}`,
updateSiteSettings: `${settingsBase}update/`,
testWebhooks: `${settingsBase}webhooks/test/`,
updateSiteSettings: `${settingsBase}`,
testWebhooks: `${settingsBase}/webhooks/test`,
};
export default {
@ -21,7 +21,7 @@ export default {
},
async update(body) {
let response = await apiReq.post(settingsURLs.updateSiteSettings, body);
let response = await apiReq.put(settingsURLs.updateSiteSettings, body);
return response.data;
},
};

View file

@ -1,14 +1,14 @@
import { baseURL } from "./api-utils";
import { apiReq } from "./api-utils";
const themesBase = baseURL + "site-settings/";
const prefix = baseURL + "themes/";
const settingsURLs = {
allThemes: `${themesBase}themes/`,
specificTheme: (themeName) => `${themesBase}themes/${themeName}/`,
createTheme: `${themesBase}themes/create/`,
updateTheme: (themeName) => `${themesBase}themes/${themeName}/update/`,
deleteTheme: (themeName) => `${themesBase}themes/${themeName}/delete/`,
allThemes: `${baseURL}themes`,
specificTheme: (themeName) => `${prefix}themes/${themeName}`,
createTheme: `${prefix}themes/create`,
updateTheme: (themeName) => `${prefix}themes/${themeName}`,
deleteTheme: (themeName) => `${prefix}themes/${themeName}`,
};
export default {
@ -32,7 +32,7 @@ export default {
name: themeName,
colors: colors,
};
let response = await apiReq.post(settingsURLs.updateTheme(themeName), body);
let response = await apiReq.put(settingsURLs.updateTheme(themeName), body);
return response.data;
},

View file

@ -12,6 +12,26 @@
></v-file-input>
</v-col>
<v-col cols="3"></v-col>
<v-row>
<v-col>
<v-text-field
label="Total Time"
v-model="value.totalTime"
></v-text-field>
</v-col>
<v-col
><v-text-field
label="Prep Time"
v-model="value.prepTime"
></v-text-field
></v-col>
<v-col
><v-text-field
label="Cook Time / Perform Time"
v-model="value.performTime"
></v-text-field
></v-col>
</v-row>
</v-row>
<v-row>
<v-col>
@ -37,7 +57,7 @@
class="my-3"
:label="$t('recipe.recipe-name')"
v-model="value.name"
:rules="[rules.required, rules.whiteSpace]"
:rules="[rules.required]"
>
</v-text-field>
<v-textarea
@ -67,27 +87,43 @@
<v-row>
<v-col cols="12" sm="12" md="4" lg="4">
<h2 class="mb-4">{{ $t("recipe.ingredients") }}</h2>
<div
v-for="(ingredient, index) in value.recipeIngredient"
:key="generateKey('ingredient', index)"
<draggable
v-model="value.recipeIngredient"
@start="drag = true"
@end="drag = false"
>
<v-row align="center">
<v-btn
fab
x-small
color="white"
class="mr-2"
elevation="0"
@click="removeIngredient(index)"
<transition-group
type="transition"
:name="!drag ? 'flip-list' : null"
>
<div
v-for="(ingredient, index) in value.recipeIngredient"
:key="generateKey('ingredient', index)"
>
<v-icon color="error">mdi-delete</v-icon>
</v-btn>
<v-text-field
:label="$t('recipe.ingredient')"
v-model="value.recipeIngredient[index]"
></v-text-field>
</v-row>
</div>
<v-row align="center">
<v-text-field
class="mr-2"
:label="$t('recipe.ingredient')"
v-model="value.recipeIngredient[index]"
append-outer-icon="mdi-menu"
mdi-move-resize
solo
dense
>
<v-icon
class="mr-n1"
slot="prepend"
color="error"
@click="removeIngredient(index)"
>
mdi-delete
</v-icon>
</v-text-field>
</v-row>
</div>
</transition-group>
</draggable>
<v-btn color="secondary" fab dark small @click="addIngredient">
<v-icon>mdi-plus</v-icon>
</v-btn>
@ -101,6 +137,11 @@
item-color="secondary"
deletable-chips
v-model="value.categories"
hide-selected
:items="categories"
text="name"
:search-input.sync="categoriesSearchInput"
@change="categoriesSearchInput = ''"
>
<template v-slot:selection="data">
<v-chip
@ -116,7 +157,17 @@
</v-combobox>
<h2 class="mt-4">{{ $t("recipe.tags") }}</h2>
<v-combobox dense multiple chips deletable-chips v-model="value.tags">
<v-combobox
dense
multiple
chips
deletable-chips
v-model="value.tags"
hide-selected
:items="tags"
:search-input.sync="tagsSearchInput"
@change="tagssSearchInput = ''"
>
<template v-slot:selection="data">
<v-chip
:input-value="data.selected"
@ -218,6 +269,7 @@
</template>
<script>
import draggable from "vuedraggable";
import api from "../../../api";
import utils from "../../../utils";
import BulkAdd from "./BulkAdd";
@ -226,21 +278,36 @@ export default {
components: {
BulkAdd,
ExtrasEditor,
draggable,
},
props: {
value: Object,
},
data() {
return {
drag: false,
fileObject: null,
rules: {
required: v => !!v || this.$i18n.t("recipe.key-name-required"),
whiteSpace: v =>
!v || v.split(" ").length <= 1 || this.$i18n.t("recipe.no-white-space-allowed"),
required: (v) => !!v || this.$i18n.t("recipe.key-name-required"),
whiteSpace: (v) =>
!v ||
v.split(" ").length <= 1 ||
this.$i18n.t("recipe.no-white-space-allowed"),
},
categoriesSearchInput: "",
tagsSearchInput: "",
categories: [],
tags: [],
};
},
mounted() {
this.getCategories();
},
methods: {
async getCategories() {
let response = await api.categories.get_all();
this.categories = response.map((cat) => cat.name);
},
uploadImage() {
this.$emit("upload", this.fileObject);
},
@ -286,7 +353,7 @@ export default {
appendSteps(steps) {
let processSteps = [];
steps.forEach(element => {
steps.forEach((element) => {
processSteps.push({ text: element });
});

View file

@ -0,0 +1,90 @@
<template>
<div>
<ImportDialog
:name="selectedName"
:date="selectedDate"
ref="import_dialog"
@import="importBackup"
@delete="deleteBackup"
/>
<v-row>
<v-col
:sm="6"
:md="6"
:lg="4"
:xl="4"
v-for="backup in backups"
:key="backup.name"
>
<v-card @click="openDialog(backup)">
<v-card-text>
<v-row align="center">
<v-col cols="12" sm="2">
<v-icon color="primary"> mdi-backup-restore </v-icon>
</v-col>
<v-col cols="12" sm="10">
<div>
<strong>{{ backup.name }}</strong>
</div>
<div>{{ readableTime(backup.date) }}</div>
</v-col>
</v-row>
</v-card-text>
</v-card>
</v-col>
</v-row>
</div>
</template>
<script>
import ImportDialog from "./ImportDialog";
import api from "../../../api";
import utils from "../../../utils";
export default {
props: {
backups: Array,
},
components: {
ImportDialog,
},
data() {
return {
selectedName: "",
selectedDate: "",
loading: false,
};
},
methods: {
openDialog(backup) {
this.selectedDate = this.readableTime(backup.date);
this.selectedName = backup.name;
this.$refs.import_dialog.open();
},
readableTime(timestamp) {
let date = new Date(timestamp);
return utils.getDateAsText(date);
},
async importBackup(data) {
this.$emit("loading");
let response = await api.backups.import(data.name, data);
let failed = response.data.failed;
let succesful = response.data.successful;
this.$emit("finished", succesful, failed);
},
deleteBackup(data) {
this.$emit("loading");
api.backups.delete(data.name);
this.selectedBackup = null;
this.backupLoading = false;
this.$emit("finished");
},
},
};
</script>
<style>
</style>

View file

@ -65,7 +65,7 @@
<v-divider></v-divider>
<v-card-actions>
<v-btn color="accent" text :href="`/api/backups/${name}/download/`">
<v-btn color="accent" text :href="`/api/backups/${name}/download`">
{{ $t("general.download") }}
</v-btn>
<v-spacer></v-spacer>

View file

@ -101,7 +101,6 @@ export default {
templates: this.selectedTemplates,
};
console.log(data);
await api.backups.create(data);
this.loading = false;

View file

@ -22,7 +22,7 @@
<span>
<UploadBtn
class="mt-1"
url="/api/backups/upload/"
url="/api/backups/upload"
@uploaded="getAvailableBackups"
/>
</span>
@ -75,7 +75,6 @@ export default {
let response = await api.backups.requestAvailable();
this.availableBackups = response.imports;
this.availableTemplates = response.templates;
console.log(this.availableBackups);
},
deleteBackup() {
if (this.$refs.form.validate()) {

View file

@ -30,25 +30,30 @@
<h3>Homepage Categories</h3>
</v-card-text>
<v-divider></v-divider>
<v-list min-height="200px" dense>
<v-list
min-height="200"
dense
max-height="200"
style="overflow:auto"
>
<v-list-item-group>
<draggable
v-model="homeCategories"
group="categories"
:style="{
minHeight: `200px`,
minHeight: `150px`,
}"
>
<v-list-item
v-for="(item, index) in homeCategories"
:key="item"
:key="`${item.name}-${index}`"
>
<v-list-item-icon>
<v-icon>mdi-menu</v-icon>
</v-list-item-icon>
<v-list-item-content>
<v-list-item-title v-text="item"></v-list-item-title>
<v-list-item-title v-text="item.name"></v-list-item-title>
</v-list-item-content>
<v-list-item-icon @click="deleteActiveCategory(index)">
<v-icon>mdi-delete</v-icon>
@ -72,24 +77,34 @@
</h3>
</v-card-text>
<v-divider></v-divider>
<v-list min-height="200px" dense>
<v-list
min-height="200"
dense
max-height="200"
style="overflow:auto"
>
<v-list-item-group>
<draggable
v-model="categories"
group="categories"
:style="{
minHeight: `200px`,
minHeight: `150px`,
}"
>
<v-list-item v-for="item in categories" :key="item">
<v-list-item
v-for="(item, index) in categories"
:key="`${item.name}-${index}`"
>
<v-list-item-icon>
<v-icon>mdi-menu</v-icon>
</v-list-item-icon>
<v-list-item-content>
<v-list-item-title v-text="item"></v-list-item-title>
<v-list-item-title v-text="item.name"></v-list-item-title>
</v-list-item-content>
<v-list-item-icon @click="deleteActiveCategory(index)">
<v-list-item-icon
@click="deleteCategoryfromDatabase(item.slug)"
>
<v-icon>mdi-delete</v-icon>
</v-list-item-icon>
</v-list-item>
@ -111,6 +126,7 @@
</template>
<script>
import api from "../../../api";
import draggable from "vuedraggable";
export default {
@ -119,36 +135,39 @@ export default {
},
data() {
return {
homeCategories: [],
homeCategories: null,
showLimit: null,
categories: ["breakfast"],
showRecent: true,
};
},
mounted() {
this.getOptions();
},
computed: {
categories() {
return this.$store.getters.getCategories;
},
},
methods: {
deleteCategoryfromDatabase(category) {
api.categories.delete(category);
this.$store.dispatch("requestHomePageSettings");
},
getOptions() {
let options = this.$store.getters.getHomePageSettings;
this.showLimit = options.showLimit;
this.categories = options.categories;
this.showRecent = options.showRecent;
this.homeCategories = options.homeCategories;
this.showLimit = this.$store.getters.getShowLimit;
this.showRecent = this.$store.getters.getShowRecent;
this.homeCategories = this.$store.getters.getHomeCategories;
},
deleteActiveCategory(index) {
this.homeCategories.splice(index, 1);
},
saveSettings() {
let payload = {
showRecent: this.showRecent,
showLimit: this.showLimit,
categories: this.categories,
homeCategories: this.homeCategories,
};
this.$store.commit("setHomePageSettings", payload);
this.homeCategories.forEach((element, index) => {
element.position = index + 1;
});
this.$store.commit("setShowRecent", this.showRecent);
this.$store.commit("setShowLimit", this.showLimit);
this.$store.commit("setHomeCategories", this.homeCategories);
},
},
};

View file

@ -5,8 +5,8 @@
<v-spacer></v-spacer>
<span>
<v-btn class="pt-1" text href="/docs">
<v-icon left>mdi-link</v-icon>
{{ $t("settings.local-api") }}
<v-icon right>mdi-open-in-new</v-icon>
</v-btn>
</span>
</v-card-title>
@ -14,10 +14,11 @@
<HomePageSettings />
<v-divider></v-divider>
<v-card-text>
<h2 class="mt-1 mb-1">{{ $t("settings.language") }}</h2>
<h2 class="mt-1 mb-4">{{ $t("settings.language") }}</h2>
<v-row>
<v-col>
<v-col cols="3">
<v-select
dense
v-model="selectedLang"
:items="langOptions"
item-text="name"
@ -26,8 +27,6 @@
>
</v-select>
</v-col>
<v-spacer></v-spacer>
<v-spacer></v-spacer>
</v-row>
</v-card-text>
<v-divider></v-divider>
@ -43,22 +42,14 @@ export default {
},
data() {
return {
categories: ["cat 1", "cat 2", "cat 3"],
usedCategories: ["recent"],
langOptions: [],
selectedLang: "en",
homeOptions: {
recipesToShow: 10,
},
};
},
mounted() {
this.getOptions();
},
watch: {
usedCategories() {
console.log(this.usedCategories);
},
selectedLang() {
this.$store.commit("setLang", this.selectedLang);
},

View file

@ -6,7 +6,7 @@
<span>
<UploadBtn
class="mt-1"
:url="`/api/migrations/${folder}/upload/`"
:url="`/api/migrations/${folder}/upload`"
@uploaded="$emit('refresh')"
/>
</span>
@ -81,7 +81,6 @@ export default {
async importMigration(file_name) {
this.loading == true;
let response = await api.migrations.import(this.folder, file_name);
console.log(response);
this.$emit("imported", response.successful, response.failed);
this.loading == false;
},

View file

@ -17,7 +17,7 @@
<v-row dense>
<v-col
:sm="6"
:sm="12"
:md="6"
:lg="4"
:xl="3"
@ -78,7 +78,7 @@ export default {
},
async getAvailableMigrations() {
let response = await api.migrations.getMigrations();
response.forEach(element => {
response.forEach((element) => {
if (element.type === "nextcloud") {
this.migrations.nextcloud.availableImports = element.files;
} else if (element.type === "chowdown") {

View file

@ -21,7 +21,9 @@
mandatory
@change="setStoresDarkMode"
>
<v-btn value="system"> {{ $t("settings.theme.default-to-system") }} </v-btn>
<v-btn value="system">
{{ $t("settings.theme.default-to-system") }}
</v-btn>
<v-btn value="light"> {{ $t("settings.theme.light") }} </v-btn>
@ -51,13 +53,13 @@
return-object
v-model="selectedTheme"
@change="themeSelected"
:rules="[v => !!v || $t('settings.theme.theme-is-required')]"
:rules="[(v) => !!v || $t('settings.theme.theme-is-required')]"
required
>
</v-select>
</v-col>
<v-col>
<v-btn-toggle group>
<v-btn-toggle group class="mt-n5">
<NewThemeDialog @new-theme="appendTheme" class="mt-1" />
<v-btn text color="error" @click="deleteSelectedThemeValidation">
{{ $t("general.delete") }}
@ -184,7 +186,7 @@ export default {
//Change to default if deleting current theme.
if (
!this.availableThemes.some(
theme => theme.name === this.selectedTheme.name
(theme) => theme.name === this.selectedTheme.name
)
) {
await this.$store.dispatch("resetTheme");

View file

@ -4,14 +4,14 @@
{{ $t("settings.webhooks.meal-planner-webhooks") }}
</v-card-title>
<v-card-text>
<p
v-html="
<p>
{{
$t(
'settings.webhooks.the-urls-listed-below-will-recieve-webhooks-containing-the-recipe-data-for-the-meal-plan-on-its-scheduled-day-currently-webhooks-will-execute-at',
{ time: time }
"settings.webhooks.the-urls-listed-below-will-recieve-webhooks-containing-the-recipe-data-for-the-meal-plan-on-its-scheduled-day-currently-webhooks-will-execute-at"
)
"
></p>
}}
<strong>{{ time }}</strong>
</p>
<v-row dense align="center">
<v-col cols="12" md="2" sm="5">

View file

@ -43,12 +43,12 @@ export default {
props: {
open: {
type: Boolean,
default: true
}
default: true,
},
},
components: {
Confirmation
Confirmation,
},
methods: {
@ -66,8 +66,8 @@ export default {
},
json() {
this.$emit("json");
}
}
},
},
};
</script>

View file

@ -5,7 +5,7 @@
<v-row>
<v-col>
<v-btn-toggle group>
<v-btn text :to="`/recipes/category/${title.toLowerCase()}`">
<v-btn text :to="`/recipes/${title.toLowerCase()}`">
{{ title.toUpperCase() }}
</v-btn>
</v-btn-toggle>

View file

@ -0,0 +1,64 @@
<template>
<v-navigation-drawer width="175px" clipped app permanent expand-on-hover>
<v-list nav dense>
<v-list-item v-for="nav in links" :key="nav.title" link :to="nav.to">
<v-list-item-icon>
<v-icon>{{ nav.icon }}</v-icon>
</v-list-item-icon>
<v-list-item-title>{{ nav.title | titleCase }}</v-list-item-title>
</v-list-item>
</v-list>
</v-navigation-drawer>
</template>
<script>
export default {
data() {
return {
links: [],
baseLinks: [
{
icon: "mdi-home",
to: "/",
title: "Home",
},
{
icon: "mdi-view-module",
to: "/recipes/all",
title: "All Recipes",
},
],
};
},
computed: {
allCategories() {
return this.$store.getters.getCategories;
},
},
watch: {
allCategories() {
this.buildSidebar();
},
},
mounted() {
this.buildSidebar();
},
methods: {
async buildSidebar() {
this.links = [];
this.links.push(...this.baseLinks);
this.allCategories.forEach(async (element) => {
this.links.push({
title: element.name,
to: `/recipes/${element.slug}`,
icon: "mdi-tag",
});
});
},
},
};
</script>
<style>
</style>

View file

@ -2,6 +2,7 @@
<div>
<v-autocomplete
:items="autoResults"
v-model="searchSlug"
item-value="item.slug"
item-text="item.name"
dense
@ -52,7 +53,8 @@ export default {
},
data() {
return {
search: "",
searchSlug: "",
search: " ",
result: [],
autoResults: [],
isDark: false,
@ -82,13 +84,15 @@ export default {
search() {
if (this.search.trim() === "") this.result = this.list;
else this.result = this.fuse.search(this.search.trim());
console.log("test");
this.$emit("results", this.result);
if (this.showResults === true) {
this.autoResults = this.result;
}
},
searchSlug() {
this.selected(this.searchSlug);
},
},
methods: {
getImage(image) {

View file

@ -61,7 +61,6 @@ export default {
this.searchResults = results;
},
emitSelect(name, slug) {
console.log(name, slug);
this.$emit("select", name, slug);
this.dialog = false;
},

View file

@ -3,7 +3,7 @@
<input ref="uploader" class="d-none" type="file" @change="onFileChanged" />
<v-btn :loading="isSelecting" @click="onButtonClick" color="accent" text>
<v-icon left> mdi-cloud-upload </v-icon>
{{ $t('general.upload') }}
{{ $t("general.upload") }}
</v-btn>
</v-form>
</template>
@ -15,7 +15,6 @@ export default {
url: String,
},
data: () => ({
defaultButtonText: this.$t("general.upload"),
file: null,
isSelecting: false,
}),

View file

@ -70,7 +70,7 @@
"title": "Title",
"total-time": "Total Time",
"prep-time": "Prep Time",
"perform-time": "Cook Time / Perform Time",
"perform-time": "Cook Time",
"api-extras": "API Extras",
"object-key": "Object Key",
"object-value": "Object Value",
@ -122,7 +122,7 @@
},
"webhooks": {
"meal-planner-webhooks": "Meal Planner Webhooks",
"the-urls-listed-below-will-recieve-webhooks-containing-the-recipe-data-for-the-meal-plan-on-its-scheduled-day-currently-webhooks-will-execute-at": "The URLs listed below will receive webhooks containing the recipe data for the meal plan on it's scheduled day. Currently Webhooks will execute at <strong>{ time }</strong>",
"the-urls-listed-below-will-recieve-webhooks-containing-the-recipe-data-for-the-meal-plan-on-its-scheduled-day-currently-webhooks-will-execute-at": "The URLs listed below will receive webhooks containing the recipe data for the meal plan on it's scheduled day. Currently Webhooks will execute at",
"test-webhooks": "Test Webhooks",
"webhook-url": "Webhook URL"
},
@ -155,4 +155,4 @@
"description": "Migrate data from Chowdown"
}
}
}
}

View file

@ -14,17 +14,16 @@ const router = new VueRouter({
mode: process.env.NODE_ENV === "production" ? "history" : "hash",
});
new Vue({
vuetify,
store,
router,
i18n,
render: h => h(App),
render: (h) => h(App),
}).$mount("#app");
// Truncate
let filter = function(text, length, clamp) {
let truncate = function (text, length, clamp) {
clamp = clamp || "...";
let node = document.createElement("div");
node.innerHTML = text;
@ -32,6 +31,11 @@ let filter = function(text, length, clamp) {
return content.length > length ? content.slice(0, length) + clamp : content;
};
Vue.filter("truncate", filter);
let titleCase = function (value) {
return value.replace(/(?:^|\s|-)\S/g, (x) => x.toUpperCase());
};
Vue.filter("truncate", truncate);
Vue.filter("titleCase", titleCase);
export { router };

View file

@ -0,0 +1,43 @@
<template>
<div>
<CategorySidebar />
<CardSection
:sortable="true"
title="All Recipes"
:recipes="allRecipes"
:card-limit="9999"
@sort="sortAZ"
@sort-recent="sortRecent"
/>
</div>
</template>
<script>
import CardSection from "../components/UI/CardSection";
import CategorySidebar from "../components/UI/CategorySidebar";
export default {
components: {
CardSection,
CategorySidebar,
},
data() {
return {};
},
computed: {
allRecipes() {
return this.$store.getters.getRecentRecipes;
},
},
methods: {
sortAZ() {
this.allRecipes.sort((a, b) => (a.name > b.name ? 1 : -1));
},
sortRecent() {
this.allRecipes.sort((a, b) => (a.dateAdded > b.dateAdded ? -1 : 1));
},
},
};
</script>
<style>
</style>

View file

@ -0,0 +1,62 @@
<template>
<div>
<CategorySidebar />
<CardSection
:sortable="true"
:title="title"
:recipes="recipes"
:card-limit="9999"
@sort="sortAZ"
@sort-recent="sortRecent"
/>
</div>
</template>
<script>
import api from "../api";
import CardSection from "../components/UI/CardSection";
import CategorySidebar from "../components/UI/CategorySidebar";
export default {
components: {
CardSection,
CategorySidebar,
},
data() {
return {
title: "",
recipes: [],
};
},
computed: {
currentCategory() {
return this.$route.params.category;
},
},
watch: {
async currentCategory() {
this.getRecipes();
},
},
mounted() {
this.getRecipes();
},
methods: {
async getRecipes() {
let data = await api.categories.get_recipes_in_category(
this.currentCategory
);
this.title = data.name;
this.recipes = data.recipes;
},
sortAZ() {
this.recipes.sort((a, b) => (a.name > b.name ? 1 : -1));
},
sortRecent() {
this.recipes.sort((a, b) => (a.dateAdded > b.dateAdded ? -1 : 1));
},
},
};
</script>
<style>
</style>

View file

@ -1,18 +1,19 @@
<template>
<div>
<CategorySidebar />
<CardSection
v-if="pageSettings.showRecent"
v-if="showRecent"
title="Recent"
:recipes="recentRecipes"
:card-limit="pageSettings.showLimit"
:card-limit="showLimit"
/>
<CardSection
:sortable="true"
v-for="(section, index) in recipeByCategory"
:key="index"
:title="section.title"
:key="section.name + section.position"
:title="section.name"
:recipes="section.recipes"
:card-limit="pageSettings.showLimit"
:card-limit="showLimit"
@sort="sortAZ(index)"
@sort-recent="sortRecent(index)"
/>
@ -20,34 +21,49 @@
</template>
<script>
import api from "../api";
import CardSection from "../components/UI/CardSection";
import CategorySidebar from "../components/UI/CategorySidebar";
export default {
components: {
CardSection,
CategorySidebar,
},
data() {
return {
recipeByCategory: [
{
title: "Title 1",
recipes: this.$store.getters.getRecentRecipes,
},
{
title: "Title 2",
recipes: this.$store.getters.getRecentRecipes,
},
],
recipeByCategory: [],
};
},
computed: {
pageSettings() {
return this.$store.getters.getHomePageSettings;
showRecent() {
return this.$store.getters.getShowRecent;
},
showLimit() {
return this.$store.getters.getShowLimit;
},
homeCategories() {
return this.$store.getters.getHomeCategories;
},
recentRecipes() {
return this.$store.getters.getRecentRecipes;
let recipes = this.$store.getters.getRecentRecipes;
return recipes.sort((a, b) => (a.dateAdded > b.dateAdded ? -1 : 1));
},
},
async mounted() {
await this.buildPage();
this.recipeByCategory.sort((a, b) => a.position - b.position);
},
methods: {
async buildPage() {
this.homeCategories.forEach(async (element) => {
let recipes = await this.getRecipeByCategory(element.slug);
recipes.position = element.position;
this.recipeByCategory.push(recipes);
});
},
async getRecipeByCategory(category) {
return await api.categories.get_recipes_in_category(category);
},
getRecentRecipes() {
this.$store.dispatch("requestRecentRecipes");
},

View file

@ -22,6 +22,7 @@
"
@save="saveRecipe"
@delete="deleteRecipe"
class="sticky"
/>
<RecipeViewer
@ -106,7 +107,7 @@ export default {
},
watch: {
$route: function() {
$route: function () {
this.getRecipeDetails();
},
},
@ -142,19 +143,30 @@ export default {
deleteRecipe() {
api.recipes.delete(this.recipeDetails.slug);
},
validateRecipe() {
if (this.jsonEditor) {
return true;
} else {
return this.$refs.recipeEditor.validateRecipe();
}
},
async saveRecipe() {
if (this.$refs.recipeEditor.validateRecipe()) {
console.log("Thank you")
}
let slug = await api.recipes.update(this.recipeDetails);
if (this.validateRecipe()) {
let slug = await api.recipes.update(this.recipeDetails);
if (this.fileObject) {
await api.recipes.updateImage(this.recipeDetails.slug, this.fileObject);
}
if (this.fileObject) {
await api.recipes.updateImage(
this.recipeDetails.slug,
this.fileObject
);
}
this.form = false;
this.imageKey += 1;
this.$router.push(`/recipe/${slug}`);
this.form = false;
this.imageKey += 1;
if (slug != this.recipeDetails.slug) {
this.$router.push(`/recipe/${slug}`);
}
}
},
showForm() {
this.form = true;
@ -177,4 +189,9 @@ export default {
width: 100%;
bottom: 0;
}
.sticky {
position: sticky !important;
top: 0;
z-index: 2;
}
</style>

View file

@ -43,7 +43,7 @@ export default {
},
data() {
return {
searchResults: null,
searchResults: [],
};
},
methods: {

View file

@ -4,6 +4,8 @@ import SearchPage from "./pages/SearchPage";
import RecipePage from "./pages/RecipePage";
import RecipeNewPage from "./pages/RecipeNewPage";
import SettingsPage from "./pages/SettingsPage";
import AllRecipesPage from "./pages/AllRecipesPage";
import CategoryPage from "./pages/CategoryPage";
import MeaplPlanPage from "./pages/MealPlanPage";
import MealPlanThisWeekPage from "./pages/MealPlanThisWeekPage";
import api from "./api";
@ -12,6 +14,8 @@ export const routes = [
{ path: "/", component: HomePage },
{ path: "/mealie", component: HomePage },
{ path: "/search", component: SearchPage },
{ path: "/recipes/all", component: AllRecipesPage },
{ path: "/recipes/:category", component: CategoryPage },
{ path: "/recipe/:recipe", component: RecipePage },
{ path: "/new/", component: RecipeNewPage },
{ path: "/settings/site", component: SettingsPage },

View file

@ -0,0 +1,44 @@
import api from "../../api";
const state = {
showRecent: true,
showLimit: 9,
categories: [],
homeCategories: [],
};
const mutations = {
setShowRecent(state, payload) {
state.showRecent = payload;
},
setShowLimit(state, payload) {
state.showLimit = payload;
},
setCategories(state, payload) {
state.categories = payload;
},
setHomeCategories(state, payload) {
state.homeCategories = payload;
},
};
const actions = {
async requestHomePageSettings() {
let categories = await api.categories.get_all();
this.commit("setCategories", categories);
},
};
const getters = {
getShowRecent: (state) => state.showRecent,
getShowLimit: (state) => state.showLimit,
getCategories: (state) => state.categories,
getHomeCategories: (state) => state.homeCategories,
};
export default {
state,
mutations,
actions,
getters,
};

View file

@ -4,27 +4,23 @@ import api from "../api";
import createPersistedState from "vuex-persistedstate";
import userSettings from "./modules/userSettings";
import language from "./modules/language";
import homePage from "./modules/homePage";
Vue.use(Vuex);
const store = new Vuex.Store({
plugins: [
createPersistedState({
paths: ["userSettings", "language"],
paths: ["userSettings", "language", "homePage"],
}),
],
modules: {
userSettings,
language,
homePage,
},
state: {
// Home Page Settings
homePageSettings: {
showRecent: true,
showLimit: 9,
categories: [],
homeCategories: [],
},
// Snackbar
snackActive: false,
snackText: "",
@ -36,9 +32,6 @@ const store = new Vuex.Store({
},
mutations: {
setHomePageSettings(state, payload) {
state.homePageSettings = payload;
},
setSnackBar(state, payload) {
state.snackText = payload.text;
state.snackType = payload.type;
@ -67,26 +60,15 @@ const store = new Vuex.Store({
this.commit("setRecentRecipes", payload);
},
async requestHomePageSettings() {
// TODO: Query Backend for Categories
this.commit("setHomePageSettings", {
showRecent: true,
showLimit: 9,
categories: ["breakfast", "lunch", "dinner"],
homeCategories: [],
});
},
},
getters: {
//
getSnackText: state => state.snackText,
getSnackActive: state => state.snackActive,
getSnackType: state => state.snackType,
getSnackText: (state) => state.snackText,
getSnackActive: (state) => state.snackActive,
getSnackType: (state) => state.snackType,
getRecentRecipes: (state) => state.recentRecipes,
getHomePageSettings: (state) => state.homePageSettings,
},
});

View file

@ -43,7 +43,7 @@ const monthsShort = [
export default {
getImageURL(image) {
return `/api/recipe/image/${image}/`;
return `/api/recipes/${image}/image`;
},
generateUniqueKey(item, index) {
const uniqueKey = `${item}-${index}`;

View file

@ -6,17 +6,35 @@ from fastapi.staticfiles import StaticFiles
from app_config import PORT, PRODUCTION, WEB_PATH, docs_url, redoc_url
from routes import (
backup_routes,
debug_routes,
meal_routes,
migration_routes,
recipe_routes,
setting_routes,
static_routes,
theme_routes,
user_routes,
)
from routes.recipe import (
all_recipe_routes,
category_routes,
recipe_crud_routes,
tag_routes,
)
from utils.api_docs import generate_api_docs
from utils.logger import logger
"""
TODO:
- [x] Fix Duplicate Category
- [x] Fix category overflow
- [ ] Enable Database Name Versioning
- [ ] Finish Frontend Category Management
- [x] Delete Category
- [ ] Sort Sidebar A-Z
- [ ] Refactor Test Endpoints - Abstract to fixture?
"""
app = FastAPI(
title="Mealie",
description="A place for all your recipes",
@ -30,15 +48,28 @@ def mount_static_files():
app.mount("/static", StaticFiles(directory=WEB_PATH, html=True))
def start_scheduler():
import services.scheduler.scheduled_jobs
def api_routers():
# First
print()
app.include_router(recipe_routes.router)
# Recipes
app.include_router(all_recipe_routes.router)
app.include_router(category_routes.router)
app.include_router(tag_routes.router)
app.include_router(recipe_crud_routes.router)
# Meal Routes
app.include_router(meal_routes.router)
# Settings Routes
app.include_router(setting_routes.router)
app.include_router(theme_routes.router)
# Backups/Imports Routes
app.include_router(backup_routes.router)
# User Routes
app.include_router(user_routes.router)
# Migration Routes
app.include_router(migration_routes.router)
app.include_router(debug_routes.router)
if PRODUCTION:
@ -46,11 +77,6 @@ if PRODUCTION:
api_routers()
def start_scheduler():
import services.scheduler.scheduled_jobs
# API 404 Catch all CALL AFTER ROUTERS
@app.get("/api/{full_path:path}", status_code=404, include_in_schema=False)
def invalid_api():
@ -61,8 +87,8 @@ app.include_router(static_routes.router)
# Generate API Documentation
if not PRODUCTION:
generate_api_docs(app)
# if not PRODUCTION:
# generate_api_docs(app)
start_scheduler()

View file

@ -37,7 +37,7 @@ REQUIRED_DIRS = [
SQLITE_DIR,
]
APP_VERSION = "v0.2.0"
# General
PRODUCTION = os.environ.get("ENV")
PORT = int(os.getenv("mealie_port", 9000))
@ -55,7 +55,7 @@ SQLITE_FILE = None
DATABASE_TYPE = os.getenv("db_type", "sqlite") # mongo, sqlite
if DATABASE_TYPE == "sqlite":
USE_SQL = True
SQLITE_FILE = SQLITE_DIR.joinpath("mealie.sqlite")
SQLITE_FILE = SQLITE_DIR.joinpath(f"mealie_{APP_VERSION}.sqlite")
else:
raise Exception(

View file

@ -2,14 +2,14 @@ from sqlalchemy.orm.session import Session
from db.db_base import BaseDocument
from db.sql.meal_models import MealPlanModel
from db.sql.recipe_models import RecipeModel
from db.sql.recipe_models import Category, RecipeModel, Tag
from db.sql.settings_models import SiteSettingsModel
from db.sql.theme_models import SiteThemeModel
"""
# TODO
- [ ] Abstract Classes to use save_new, and update from base models
- [ ] Create Category and Tags Table with Many to Many relationship
- [x] Create Category and Tags Table with Many to Many relationship
"""
@ -19,13 +19,25 @@ class _Recipes(BaseDocument):
self.sql_model = RecipeModel
def update_image(self, session: Session, slug: str, extension: str) -> str:
entry = self._query_one(session, match_value=slug)
entry: RecipeModel = self._query_one(session, match_value=slug)
entry.image = f"{slug}.{extension}"
session.commit()
return f"{slug}.{extension}"
class _Categories(BaseDocument):
def __init__(self) -> None:
self.primary_key = "slug"
self.sql_model = Category
class _Tags(BaseDocument):
def __init__(self) -> None:
self.primary_key = "slug"
self.sql_model = Tag
class _Meals(BaseDocument):
def __init__(self) -> None:
self.primary_key = "uid"
@ -58,6 +70,8 @@ class Database:
self.meals = _Meals()
self.settings = _Settings()
self.themes = _Themes()
self.categories = _Categories()
self.tags = _Tags()
db = Database()

View file

@ -1,5 +1,6 @@
from typing import List, Union
from typing import List
from sqlalchemy.orm import load_only
from sqlalchemy.orm.session import Session
from db.sql.model_base import SqlAlchemyBase
@ -15,20 +16,56 @@ class BaseDocument:
def get_all(
self, session: Session, limit: int = None, order_by: str = None
) -> List[dict]:
list = [x.dict() for x in session.query(self.sql_model).all()]
list = [x.dict() for x in session.query(self.sql_model).limit(limit).all()]
if limit == 1:
return list[0]
return list
def get_all_limit_columns(
self, session: Session, fields: List[str], limit: int = None
) -> List[SqlAlchemyBase]:
"""Queries the database for the selected model. Restricts return responses to the
keys specified under "fields"
Args: \n
session (Session): Database Session Object
fields (List[str]): List of column names to query
limit (int): A limit of values to return
Returns:
list[SqlAlchemyBase]: Returns a list of ORM objects
"""
results = (
session.query(self.sql_model).options(load_only(*fields)).limit(limit).all()
)
return results
def get_all_primary_keys(self, session: Session) -> List[str]:
"""Queries the database of the selected model and returns a list
of all primary_key values
Args: \n
session (Session): Database Session object
Returns:
list[str]:
"""
results = session.query(self.sql_model).options(
load_only(str(self.primary_key))
)
results_as_dict = [x.dict() for x in results]
return [x.get(self.primary_key) for x in results_as_dict]
def _query_one(
self, session: Session, match_value: str, match_key: str = None
) -> SqlAlchemyBase:
"""Query the sql database for one item an return the sql alchemy model
object. If no match key is provided the primary_key attribute will be used.
Args:
Args: \n
match_value (str): The value to use in the query
match_key (str, optional): the key/property to match against. Defaults to None.
@ -72,14 +109,14 @@ class BaseDocument:
def save_new(self, session: Session, document: dict) -> dict:
"""Creates a new database entry for the given SQL Alchemy Model.
Args:
Args: \n
session (Session): A Database Session
document (dict): A python dictionary representing the data structure
Returns:
dict: A dictionary representation of the database entry
"""
new_document = self.sql_model(**document)
new_document = self.sql_model(session=session, **document)
session.add(new_document)
return_data = new_document.dict()
session.commit()
@ -89,7 +126,7 @@ class BaseDocument:
def update(self, session: Session, match_value: str, new_data: str) -> dict:
"""Update a database entry.
Args:
Args: \n
session (Session): Database Session
match_value (str): Match "key"
new_data (str): Match "value"
@ -113,5 +150,4 @@ class BaseDocument:
)
session.delete(result)
session.commit()

63
mealie/db/db_mealplan.py Normal file
View file

@ -0,0 +1,63 @@
from typing import List
from app_config import USE_MONGO, USE_SQL
from db.db_base import BaseDocument
from db.db_setup import USE_MONGO, USE_SQL
from db.mongo.meal_models import MealDocument, MealPlanDocument
from db.sql.db_session import create_session
from db.sql.meal_models import MealPlanModel
class _Meals(BaseDocument):
def __init__(self) -> None:
self.primary_key = "uid"
if USE_SQL:
self.sql_model = MealPlanModel
self.create_session = create_session
self.document = MealPlanDocument
@staticmethod
def _process_meals(meals: List[dict]) -> List[MealDocument]:
"""Turns a list of Meals in dictionary form into a list of
MealDocuments that can be attached to a MealPlanDocument
Args: \n
meals (List[dict]): From a Pydantic Class in meal_services.py \n
Returns:
a List of MealDocuments
"""
meal_docs = []
for meal in meals:
meal_doc = MealDocument(**meal)
meal_docs.append(meal_doc)
return meal_docs
def save_new_mongo(self, plan_data: dict) -> None:
"""Saves a new meal plan into the database
Args: \n
plan_data (dict): From a Pydantic Class in meal_services.py \n
"""
if USE_MONGO:
plan_data["meals"] = _Meals._process_meals(plan_data["meals"])
document = self.document(**plan_data)
document.save()
elif USE_SQL:
pass
def update_mongo(self, uid: str, plan_data: dict) -> dict:
if USE_MONGO:
document = self.document.objects.get(uid=uid)
if document:
new_meals = _Meals._process_meals(plan_data["meals"])
document.update(set__meals=new_meals)
document.save()
elif USE_SQL:
pass

68
mealie/db/db_recipes.py Normal file
View file

@ -0,0 +1,68 @@
from app_config import USE_MONGO, USE_SQL
from db.db_base import BaseDocument
from db.mongo.recipe_models import RecipeDocument
from db.sql.db_session import create_session
from db.sql.recipe_models import RecipeModel
class _Recipes(BaseDocument):
def __init__(self) -> None:
self.primary_key = "slug"
if USE_SQL:
self.sql_model = RecipeModel
self.create_session = create_session
else:
self.document = RecipeDocument
def save_new_sql(self, recipe_data: dict):
session = self.create_session()
new_recipe = self.sql_model(**recipe_data)
session.add(new_recipe)
session.commit()
return recipe_data
def update_mongo(self, slug: str, new_data: dict) -> None:
if USE_MONGO:
document = self.document.objects.get(slug=slug)
if document:
document.update(set__name=new_data.get("name"))
document.update(set__description=new_data.get("description"))
document.update(set__image=new_data.get("image"))
document.update(set__recipeYield=new_data.get("recipeYield"))
document.update(set__recipeIngredient=new_data.get("recipeIngredient"))
document.update(
set__recipeInstructions=new_data.get("recipeInstructions")
)
document.update(set__totalTime=new_data.get("totalTime"))
document.update(set__slug=new_data.get("slug"))
document.update(set__categories=new_data.get("categories"))
document.update(set__tags=new_data.get("tags"))
document.update(set__notes=new_data.get("notes"))
document.update(set__orgURL=new_data.get("orgURL"))
document.update(set__rating=new_data.get("rating"))
document.update(set__extras=new_data.get("extras"))
document.save()
return new_data
# elif USE_SQL:
# session, recipe = self._query_one(match_value=slug)
# recipe.update(session=session, **new_data)
# recipe_dict = recipe.dict()
# session.commit()
# session.close()
# return recipe_dict
def update_image(self, slug: str, extension: str) -> None:
if USE_MONGO:
document = self.document.objects.get(slug=slug)
if document:
document.update(set__image=f"{slug}.{extension}")
elif USE_SQL:
pass

44
mealie/db/db_settings.py Normal file
View file

@ -0,0 +1,44 @@
from app_config import USE_MONGO, USE_SQL
from db.db_base import BaseDocument
from db.db_setup import USE_MONGO, USE_SQL
from db.mongo.settings_models import SiteSettingsDocument, WebhooksDocument
from db.sql.db_session import create_session
from db.sql.settings_models import SiteSettingsModel
class _Settings(BaseDocument):
def __init__(self) -> None:
self.primary_key = "name"
if USE_SQL:
self.sql_model = SiteSettingsModel
self.create_session = create_session
self.document = SiteSettingsDocument
def save_new(self, main: dict, webhooks: dict) -> str:
if USE_MONGO:
main["webhooks"] = WebhooksDocument(**webhooks)
new_doc = self.document(**main)
return new_doc.save()
elif USE_SQL:
session = create_session()
new_settings = self.sql_model(main.get("name"), webhooks)
session.add(new_settings)
session.commit()
return new_settings.dict()
def update_mongo(self, name: str, new_data: dict) -> dict:
if USE_MONGO:
document = self.document.objects.get(name=name)
if document:
document.update(set__webhooks=WebhooksDocument(**new_data["webhooks"]))
document.save()
elif USE_SQL:
return

56
mealie/db/db_themes.py Normal file
View file

@ -0,0 +1,56 @@
from app_config import USE_MONGO, USE_SQL
from db.db_base import BaseDocument
from db.db_setup import USE_MONGO, USE_SQL
from db.mongo.settings_models import SiteThemeDocument, ThemeColorsDocument
from db.sql.db_session import create_session
from db.sql.theme_models import SiteThemeModel
class _Themes(BaseDocument):
def __init__(self) -> None:
self.primary_key = "name"
if USE_SQL:
self.sql_model = SiteThemeModel
self.create_session = create_session
else:
self.document = SiteThemeDocument
def save_new(self, theme_data: dict) -> None:
if USE_MONGO:
theme_data["colors"] = ThemeColorsDocument(**theme_data["colors"])
document = self.document(**theme_data)
document.save()
elif USE_SQL:
session = self.create_session()
new_theme = self.sql_model(**theme_data)
session.add(new_theme)
session.commit()
return_data = new_theme.dict()
session.close()
return return_data
def update(self, data: dict) -> dict:
if USE_MONGO:
colors = ThemeColorsDocument(**data["colors"])
theme_document = self.document.objects.get(name=data.get("name"))
if theme_document:
theme_document.update(set__colors=colors)
theme_document.save()
else:
raise Exception("No database entry was found to update")
elif USE_SQL:
session, theme_model = self._query_one(
match_value=data["name"], match_key="name"
)
theme_model.update(**data)
session.commit()
session.close()

View file

@ -17,7 +17,9 @@ class Meal(SqlAlchemyBase):
image = sa.Column(sa.String)
description = sa.Column(sa.String)
def __init__(self, slug, name, date, dateText, image, description) -> None:
def __init__(
self, slug, name, date, dateText, image, description, session=None
) -> None:
self.slug = slug
self.name = name
self.date = date
@ -45,7 +47,7 @@ class MealPlanModel(SqlAlchemyBase, BaseMixins):
endDate = sa.Column(sa.Date)
meals: List[Meal] = orm.relation(Meal)
def __init__(self, startDate, endDate, meals, uid=None) -> None:
def __init__(self, startDate, endDate, meals, uid=None, session=None) -> None:
self.startDate = startDate
self.endDate = endDate
self.meals = [Meal(**meal) for meal in meals]

View file

@ -5,7 +5,9 @@ from typing import List
import sqlalchemy as sa
import sqlalchemy.orm as orm
from db.sql.model_base import BaseMixins, SqlAlchemyBase
from slugify import slugify
from sqlalchemy.ext.orderinglist import ordering_list
from utils.logger import logger
class ApiExtras(SqlAlchemyBase):
@ -23,25 +25,100 @@ class ApiExtras(SqlAlchemyBase):
return {self.key_name: self.value}
recipes2categories = sa.Table(
"recipes2categories",
SqlAlchemyBase.metadata,
sa.Column("recipe_id", sa.Integer, sa.ForeignKey("recipes.id")),
sa.Column("category_slug", sa.String, sa.ForeignKey("categories.slug")),
)
recipes2tags = sa.Table(
"recipes2tags",
SqlAlchemyBase.metadata,
sa.Column("recipe_id", sa.Integer, sa.ForeignKey("recipes.id")),
sa.Column("tag_slug", sa.Integer, sa.ForeignKey("tags.slug")),
)
class Category(SqlAlchemyBase):
__tablename__ = "categories"
id = sa.Column(sa.Integer, primary_key=True)
parent_id = sa.Column(sa.String, sa.ForeignKey("recipes.id"))
name = sa.Column(sa.String, index=True)
slug = sa.Column(sa.String, index=True, unique=True)
recipes = orm.relationship(
"RecipeModel", secondary=recipes2categories, back_populates="categories"
)
def __init__(self, name) -> None:
self.name = name.strip()
self.slug = slugify(name)
@staticmethod
def create_if_not_exist(session, name: str = None):
try:
result = session.query(Category).filter(Category.name == name.strip()).one()
if result:
logger.info("Category exists, associating recipe")
return result
else:
logger.info("Category doesn't exists, creating tag")
return Category(name=name)
except:
logger.info("Category doesn't exists, creating category")
return Category(name=name)
def to_str(self):
return self.name
def dict(self):
return {
"id": self.id,
"slug": self.slug,
"name": self.name,
"recipes": [x.dict() for x in self.recipes],
}
class Tag(SqlAlchemyBase):
__tablename__ = "tags"
id = sa.Column(sa.Integer, primary_key=True)
parent_id = sa.Column(sa.String, sa.ForeignKey("recipes.id"))
name = sa.Column(sa.String, index=True)
slug = sa.Column(sa.String, index=True, unique=True)
recipes = orm.relationship(
"RecipeModel", secondary=recipes2tags, back_populates="tags"
)
def to_str(self):
return self.name
def __init__(self, name) -> None:
self.name = name.strip()
self.slug = slugify(self.name)
def dict(self):
return {
"id": self.id,
"slug": self.slug,
"name": self.name,
"recipes": [x.dict() for x in self.recipes],
}
@staticmethod
def create_if_not_exist(session, name: str = None):
try:
result = session.query(Tag).filter(Tag.name == name.strip()).first()
if result:
logger.info("Tag exists, associating recipe")
return result
else:
logger.info("Tag doesn't exists, creating tag")
return Tag(name=name)
except:
logger.info("Tag doesn't exists, creating tag")
return Tag(name=name)
class Note(SqlAlchemyBase):
__tablename__ = "notes"
@ -116,25 +193,21 @@ class RecipeModel(SqlAlchemyBase, BaseMixins):
# Mealie Specific
slug = sa.Column(sa.String, index=True, unique=True)
categories: List[Category] = orm.relationship(
"Category",
cascade="all, delete",
categories: List = orm.relationship(
"Category", secondary=recipes2categories, back_populates="recipes"
)
tags: List[Tag] = orm.relationship(
"Tag",
cascade="all, delete",
"Tag", secondary=recipes2tags, back_populates="recipes"
)
dateAdded = sa.Column(sa.Date, default=date.today)
notes: List[Note] = orm.relationship(
"Note",
cascade="all, delete",
)
notes: List[Note] = orm.relationship("Note", cascade="all, delete")
rating = sa.Column(sa.Integer)
orgURL = sa.Column(sa.String)
extras: List[ApiExtras] = orm.relationship("ApiExtras", cascade="all, delete")
def __init__(
self,
session,
name: str = None,
description: str = None,
image: str = None,
@ -161,7 +234,7 @@ class RecipeModel(SqlAlchemyBase, BaseMixins):
RecipeIngredient(ingredient=ingr) for ingr in recipeIngredient
]
self.recipeInstructions = [
RecipeInstruction(text=instruc.get("text"), type=instruc.get("text"))
RecipeInstruction(text=instruc.get("text"), type=instruc.get("@type", None))
for instruc in recipeInstructions
]
self.totalTime = totalTime
@ -170,8 +243,13 @@ class RecipeModel(SqlAlchemyBase, BaseMixins):
# Mealie Specific
self.slug = slug
self.categories = [Category(name=cat) for cat in categories]
self.tags = [Tag(name=tag) for tag in tags]
self.categories = [
Category.create_if_not_exist(session=session, name=cat)
for cat in categories
]
self.tags = [Tag.create_if_not_exist(session=session, name=tag) for tag in tags]
self.dateAdded = dateAdded
self.notes = [Note(**note) for note in notes]
self.rating = rating
@ -200,10 +278,11 @@ class RecipeModel(SqlAlchemyBase, BaseMixins):
extras: dict = None,
):
"""Updated a database entry by removing nested rows and rebuilds the row through the __init__ functions"""
list_of_tables = [RecipeIngredient, RecipeInstruction, Category, Tag, ApiExtras]
list_of_tables = [RecipeIngredient, RecipeInstruction, ApiExtras]
RecipeModel._sql_remove_list(session, list_of_tables, self.id)
self.__init__(
session=session,
name=name,
description=description,
image=image,

View file

@ -8,7 +8,7 @@ class SiteSettingsModel(SqlAlchemyBase):
name = sa.Column(sa.String, primary_key=True)
webhooks = orm.relationship("WebHookModel", uselist=False, cascade="all, delete")
def __init__(self, name: str = None, webhooks: dict = None) -> None:
def __init__(self, name: str = None, webhooks: dict = None, session=None) -> None:
self.name = name
self.webhooks = WebHookModel(**webhooks)
@ -33,7 +33,7 @@ class WebHookModel(SqlAlchemyBase, BaseMixins):
enabled = sa.Column(sa.Boolean, default=False)
def __init__(
self, webhookURLs: list, webhookTime: str, enabled: bool = False
self, webhookURLs: list, webhookTime: str, enabled: bool = False, session=None
) -> None:
self.webhookURLs = [WebhookURLModel(url=x) for x in webhookURLs]

View file

@ -8,7 +8,7 @@ class SiteThemeModel(SqlAlchemyBase):
name = sa.Column(sa.String, primary_key=True)
colors = orm.relationship("ThemeColorsModel", uselist=False, cascade="all, delete")
def __init__(self, name: str, colors: dict) -> None:
def __init__(self, name: str, colors: dict, session=None) -> None:
self.name = name
self.colors = ThemeColorsModel(**colors)

View file

@ -0,0 +1,14 @@
from typing import List
from pydantic.main import BaseModel
from services.recipe_services import Recipe
class RecipeCategoryResponse(BaseModel):
id: int
name: str
slug: str
recipes: List[Recipe]
class Config:
schema_extra = {"example": {"id": 1, "name": "dinner", "recipes": [{}]}}

View file

@ -4,8 +4,8 @@ import pydantic
from pydantic.main import BaseModel
class RecipeResponse(BaseModel):
List
class AllRecipeResponse(BaseModel):
class Config:
schema_extra = {

View file

@ -11,10 +11,10 @@ from sqlalchemy.orm.session import Session
from starlette.responses import FileResponse
from utils.snackbar import SnackResponse
router = APIRouter(tags=["Import / Export"])
router = APIRouter(prefix="/api/backups", tags=["Backups"])
@router.get("/api/backups/available/", response_model=Imports)
@router.get("/available", response_model=Imports)
def available_imports():
"""Returns a list of avaiable .zip files for import into Mealie."""
imports = []
@ -31,7 +31,7 @@ def available_imports():
return Imports(imports=imports, templates=templates)
@router.post("/api/backups/export/database/", status_code=201)
@router.post("/export/database", status_code=201)
def export_database(data: BackupJob, db: Session = Depends(generate_session)):
"""Generates a backup of the recipe database in json format."""
export_path = backup_all(
@ -51,7 +51,7 @@ def export_database(data: BackupJob, db: Session = Depends(generate_session)):
)
@router.post("/api/backups/upload/")
@router.post("/upload")
def upload_backup_zipfile(archive: UploadFile = File(...)):
""" Upload a .zip File to later be imported into Mealie """
dest = BACKUP_DIR.joinpath(archive.filename)
@ -65,7 +65,7 @@ def upload_backup_zipfile(archive: UploadFile = File(...)):
return SnackResponse.error("Failure uploading file")
@router.get("/api/backups/{file_name}/download/")
@router.get("/{file_name}/download")
def upload_nextcloud_zipfile(file_name: str):
""" Upload a .zip File to later be imported into Mealie """
file = BACKUP_DIR.joinpath(file_name)
@ -78,7 +78,7 @@ def upload_nextcloud_zipfile(file_name: str):
return SnackResponse.error("No File Found")
@router.post("/api/backups/{file_name}/import/", status_code=200)
@router.post("/{file_name}/import", status_code=200)
def import_database(
file_name: str, import_data: ImportJob, db: Session = Depends(generate_session)
):
@ -98,20 +98,16 @@ def import_database(
return imported
@router.delete(
"/api/backups/{backup_name}/delete/",
tags=["Import / Export"],
status_code=200,
)
def delete_backup(backup_name: str):
@router.delete("/{file_name}/delete", tags=["Import / Export"], status_code=200)
def delete_backup(file_name: str):
""" Removes a database backup from the file system """
try:
BACKUP_DIR.joinpath(backup_name).unlink()
BACKUP_DIR.joinpath(file_name).unlink()
except:
HTTPException(
status_code=400,
detail=SnackResponse.error("Unable to Delete Backup. See Log File"),
)
return SnackResponse.success(f"{backup_name} Deleted")
return SnackResponse.success(f"{file_name} Deleted")

View file

@ -0,0 +1,62 @@
import json
import os
from app_config import DEBUG_DIR
from fastapi import APIRouter
from fastapi.responses import HTMLResponse
from utils.logger import LOGGER_FILE
router = APIRouter(prefix="/api/debug", tags=["Debug"])
@router.get("/last-recipe-json")
async def get_last_recipe_json():
""" Doc Str """
with open(DEBUG_DIR.joinpath("last_recipe.json"), "r") as f:
return json.loads(f.read())
@router.get("/log/{num}", response_class=HTMLResponse)
async def get_log(num: int):
""" Doc Str """
with open(LOGGER_FILE, "rb") as f:
log_text = tail(f, num)
HTML_RESPONSE = f"""
<html>
<head>
<title>Mealie Log</title>
</head>
<body style="white-space: pre-line">
<p>
{log_text}
</p>
</body>
</html>
"""
return HTML_RESPONSE
def tail(f, lines=20):
total_lines_wanted = lines
BLOCK_SIZE = 1024
f.seek(0, 2)
block_end_byte = f.tell()
lines_to_go = total_lines_wanted
block_number = -1
blocks = []
while lines_to_go > 0 and block_end_byte > 0:
if block_end_byte - BLOCK_SIZE > 0:
f.seek(block_number * BLOCK_SIZE, 2)
blocks.append(f.read(BLOCK_SIZE))
else:
f.seek(0, 0)
blocks.append(f.read(block_end_byte))
lines_found = blocks[-1].count(b"\n")
lines_to_go -= lines_found
block_end_byte -= BLOCK_SIZE
block_number -= 1
all_read_text = b"".join(reversed(blocks))
return b"<br/>".join(all_read_text.splitlines()[-total_lines_wanted:])

View file

@ -6,17 +6,17 @@ from services.meal_services import MealPlan
from sqlalchemy.orm.session import Session
from utils.snackbar import SnackResponse
router = APIRouter(tags=["Meal Plan"])
router = APIRouter(prefix="/api/meal-plans", tags=["Meal Plan"])
@router.get("/api/meal-plan/all/", response_model=List[MealPlan])
@router.get("/all", response_model=List[MealPlan])
def get_all_meals(db: Session = Depends(generate_session)):
""" Returns a list of all available Meal Plan """
return MealPlan.get_all(db)
@router.post("/api/meal-plan/create/")
@router.post("/create")
def set_meal_plan(data: MealPlan, db: Session = Depends(generate_session)):
""" Creates a meal plan database entry """
data.process_meals(db)
@ -30,7 +30,14 @@ def set_meal_plan(data: MealPlan, db: Session = Depends(generate_session)):
return SnackResponse.success("Mealplan Created")
@router.post("/api/meal-plan/{plan_id}/update/")
@router.get("/this-week", response_model=MealPlan)
def get_this_week(db: Session = Depends(generate_session)):
""" Returns the meal plan data for this week """
return MealPlan.this_week(db)
@router.put("/{plan_id}")
def update_meal_plan(
plan_id: str, meal_plan: MealPlan, db: Session = Depends(generate_session)
):
@ -49,7 +56,7 @@ def update_meal_plan(
return SnackResponse.success("Mealplan Updated")
@router.delete("/api/meal-plan/{plan_id}/delete/")
@router.delete("/{plan_id}")
def delete_meal_plan(plan_id, db: Session = Depends(generate_session)):
""" Removes a meal plan from the database """
@ -58,10 +65,7 @@ def delete_meal_plan(plan_id, db: Session = Depends(generate_session)):
return SnackResponse.success("Mealplan Deleted")
@router.get(
"/api/meal-plan/today/",
tags=["Meal Plan"],
)
@router.get("/today", tags=["Meal Plan"])
def get_today(db: Session = Depends(generate_session)):
"""
Returns the recipe slug for the meal scheduled for today.
@ -69,10 +73,3 @@ def get_today(db: Session = Depends(generate_session)):
"""
return MealPlan.today(db)
@router.get("/api/meal-plan/this-week/", response_model=MealPlan)
def get_this_week(db: Session = Depends(generate_session)):
""" Returns the meal plan data for this week """
return MealPlan.this_week(db)

View file

@ -11,10 +11,10 @@ from services.migrations.nextcloud import migrate as nextcloud_migrate
from sqlalchemy.orm.session import Session
from utils.snackbar import SnackResponse
router = APIRouter(tags=["Migration"])
router = APIRouter(prefix="/api/migrations", tags=["Migration"])
@router.get("/api/migrations/", response_model=List[Migrations])
@router.get("", response_model=List[Migrations])
def get_avaiable_nextcloud_imports():
""" Returns a list of avaiable directories that can be imported into Mealie """
response_data = []
@ -35,7 +35,7 @@ def get_avaiable_nextcloud_imports():
return response_data
@router.post("/api/migrations/{type}/{file_name}/import/")
@router.post("/{type}/{file_name}/import")
def import_nextcloud_directory(
type: str, file_name: str, db: Session = Depends(generate_session)
):
@ -49,11 +49,11 @@ def import_nextcloud_directory(
return SnackResponse.error("Incorrect Migration Type Selected")
@router.delete("/api/migrations/{folder}/{file}/delete/")
def delete_migration_data(folder: str, file: str):
@router.delete("/{type}/{file_name}/delete")
def delete_migration_data(type: str, file_name: str):
""" Removes migration data from the file system """
remove_path = MIGRATION_DIR.joinpath(folder, file)
remove_path = MIGRATION_DIR.joinpath(type, file_name)
if remove_path.is_file():
remove_path.unlink()
@ -65,7 +65,7 @@ def delete_migration_data(folder: str, file: str):
return SnackResponse.info(f"Migration Data Remove: {remove_path.absolute()}")
@router.post("/api/migrations/{type}/upload/")
@router.post("/{type}/upload")
def upload_nextcloud_zipfile(type: str, archive: UploadFile = File(...)):
""" Upload a .zip File to later be imported into Mealie """
dir = MIGRATION_DIR.joinpath(type)

View file

@ -0,0 +1,71 @@
from typing import List, Optional
from db.database import db
from db.db_setup import generate_session
from fastapi import APIRouter, Depends, Query
from models.recipe_models import AllRecipeRequest
from sqlalchemy.orm.session import Session
router = APIRouter(tags=["Query All Recipes"])
@router.get("/api/recipes")
def get_all_recipes(
keys: Optional[List[str]] = Query(...),
num: Optional[int] = 100,
session: Session = Depends(generate_session),
):
"""
Returns key data for all recipes based off the query paramters provided.
For example, if slug, image, and name are provided you will recieve a list of
recipes containing the slug, image, and name property. By default, responses
are limited to 100.
At this time you can only query top level values:
- slug
- name
- description
- image
- recipeYield
- totalTime
- prepTime
- performTime
- rating
- orgURL
**Note:** You may experience problems with with query parameters. As an alternative
you may also use the post method and provide a body.
See the *Post* method for more details.
"""
return db.recipes.get_all_limit_columns(session, keys, limit=num)
@router.post("/api/recipes")
def get_all_recipes_post(
body: AllRecipeRequest, session: Session = Depends(generate_session)
):
"""
Returns key data for all recipes based off the body data provided.
For example, if slug, image, and name are provided you will recieve a list of
recipes containing the slug, image, and name property.
At this time you can only query top level values:
- slug
- name
- description
- image
- recipeYield
- totalTime
- prepTime
- performTime
- rating
- orgURL
Refer to the body example for data formats.
"""
return db.recipes.get_all_limit_columns(session, body.properties, body.limit)

View file

@ -0,0 +1,35 @@
from db.database import db
from db.db_setup import generate_session
from fastapi import APIRouter, Depends
from models.category_models import RecipeCategoryResponse
from sqlalchemy.orm.session import Session
router = APIRouter(
prefix="/api/categories",
tags=["Recipe Categories"],
)
@router.get("")
async def get_all_recipe_categories(session: Session = Depends(generate_session)):
""" Returns a list of available categories in the database """
return db.categories.get_all_limit_columns(session, ["slug", "name"])
@router.get("/{category}", response_model=RecipeCategoryResponse)
def get_all_recipes_by_category(
category: str, session: Session = Depends(generate_session)
):
""" Returns a list of recipes associated with the provided category. """
return db.categories.get(session, category)
@router.delete("/{category}")
async def delete_recipe_category(
category: str, session: Session = Depends(generate_session)
):
""" Removes a recipe category from the database. Deleting a
category does not impact a recipe. The category will be removed
from any recipes that contain it """
db.categories.delete(session, category)

View file

@ -1,78 +1,28 @@
from typing import List, Optional
from db.db_setup import generate_session
from fastapi import APIRouter, Depends, File, Form, HTTPException, Query
from fastapi.responses import FileResponse
from models.recipe_models import AllRecipeRequest, RecipeURLIn
from models.recipe_models import RecipeURLIn
from services.image_services import read_image, write_image
from services.recipe_services import Recipe, read_requested_values
from services.recipe_services import Recipe
from services.scrape_services import create_from_url
from sqlalchemy.orm.session import Session
from utils.snackbar import SnackResponse
router = APIRouter(tags=["Recipes"])
@router.get("/api/all-recipes/", response_model=List[dict])
def get_all_recipes(
keys: Optional[List[str]] = Query(...),
num: Optional[int] = 100,
db: Session = Depends(generate_session),
):
"""
Returns key data for all recipes based off the query paramters provided.
For example, if slug, image, and name are provided you will recieve a list of
recipes containing the slug, image, and name property. By default, responses
are limited to 100.
**Note:** You may experience problems with with query parameters. As an alternative
you may also use the post method and provide a body.
See the *Post* method for more details.
"""
all_recipes = read_requested_values(db, keys, num)
return all_recipes
@router.post("/api/all-recipes/", response_model=List[dict])
def get_all_recipes_post(
body: AllRecipeRequest, db: Session = Depends(generate_session)
):
"""
Returns key data for all recipes based off the body data provided.
For example, if slug, image, and name are provided you will recieve a list of
recipes containing the slug, image, and name property.
Refer to the body example for data formats.
"""
all_recipes = read_requested_values(db, body.properties, body.limit)
return all_recipes
@router.get("/api/recipe/{recipe_slug}/", response_model=Recipe)
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
@router.get("/api/recipe/image/{recipe_slug}/")
def get_recipe_img(recipe_slug: str):
""" Takes in a recipe slug, returns the static image """
recipe_image = read_image(recipe_slug)
return FileResponse(recipe_image)
@router.post(
"/api/recipe/create-url/",
status_code=201,
response_model=str,
router = APIRouter(
prefix="/api/recipes",
tags=["Recipe CRUD"],
)
@router.post("/create", status_code=201, response_model=str)
def create_from_json(data: Recipe, db: Session = Depends(generate_session)) -> str:
""" Takes in a JSON string and loads data into the database as a new entry"""
new_recipe_slug = data.save_to_db(db)
return new_recipe_slug
@router.post("/create-url", status_code=201, response_model=str)
def parse_recipe_url(url: RecipeURLIn, db: Session = Depends(generate_session)):
""" Takes in a URL and attempts to scrape data and load it into the database """
@ -82,26 +32,15 @@ def parse_recipe_url(url: RecipeURLIn, db: Session = Depends(generate_session)):
return recipe.slug
@router.post("/api/recipe/create/")
def create_from_json(data: Recipe, db: Session = Depends(generate_session)) -> str:
""" Takes in a JSON string and loads data into the database as a new entry"""
new_recipe_slug = data.save_to_db(db)
@router.get("/{recipe_slug}", response_model=Recipe)
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 new_recipe_slug
return recipe
@router.post("/api/recipe/{recipe_slug}/update/image/")
def update_recipe_image(
recipe_slug: str, image: bytes = File(...), extension: str = Form(...)
):
""" Removes an existing image and replaces it with the incoming file. """
response = write_image(recipe_slug, image, extension)
Recipe.update_image(recipe_slug, extension)
return response
@router.post("/api/recipe/{recipe_slug}/update/")
@router.put("/{recipe_slug}")
def update_recipe(
recipe_slug: str, data: Recipe, db: Session = Depends(generate_session)
):
@ -112,7 +51,7 @@ def update_recipe(
return new_slug
@router.delete("/api/recipe/{recipe_slug}/delete/")
@router.delete("/{recipe_slug}")
def delete_recipe(recipe_slug: str, db: Session = Depends(generate_session)):
""" Deletes a recipe by slug """
@ -124,3 +63,22 @@ def delete_recipe(recipe_slug: str, db: Session = Depends(generate_session)):
)
return SnackResponse.success("Recipe Deleted")
@router.get("/{recipe_slug}/image")
def get_recipe_img(recipe_slug: str):
""" Takes in a recipe slug, returns the static image """
recipe_image = read_image(recipe_slug)
return FileResponse(recipe_image)
@router.put("/{recipe_slug}/image")
def update_recipe_image(
recipe_slug: str, image: bytes = File(...), extension: str = Form(...)
):
""" Removes an existing image and replaces it with the incoming file. """
response = write_image(recipe_slug, image, extension)
Recipe.update_image(recipe_slug, extension)
return response

View file

@ -0,0 +1,32 @@
from db.database import db
from db.db_setup import generate_session
from fastapi import APIRouter, Depends
from sqlalchemy.orm.session import Session
router = APIRouter(tags=["Recipes"])
router = APIRouter(
prefix="/api/recipes/tags",
tags=["Recipe Tags"],
)
@router.get("/all")
async def get_all_recipe_tags(session: Session = Depends(generate_session)):
""" Returns a list of available tags in the database """
return db.tags.get_all_primary_keys(session)
@router.get("/{tag}")
def get_all_recipes_by_tag(tag: str, session: Session = Depends(generate_session)):
""" Returns a list of recipes associated with the provided tag. """
return db.tags.get(session, tag)
@router.delete("/{tag}")
async def delete_recipe_tag(tag: str, session: Session = Depends(generate_session)):
"""Removes a recipe tag from the database. Deleting a
tag does not impact a recipe. The tag will be removed
from any recipes that contain it"""
db.tags.delete(session, tag)

View file

@ -1,28 +1,28 @@
from db.db_setup import generate_session
from fastapi import APIRouter, Depends, HTTPException
from services.settings_services import SiteSettings, SiteTheme
from fastapi import APIRouter, Depends
from services.settings_services import SiteSettings
from sqlalchemy.orm.session import Session
from utils.post_webhooks import post_webhooks
from utils.snackbar import SnackResponse
router = APIRouter(tags=["Settings"])
router = APIRouter(prefix="/api/site-settings", tags=["Settings"])
@router.get("/api/site-settings/")
@router.get("")
def get_main_settings(db: Session = Depends(generate_session)):
""" Returns basic site settings """
return SiteSettings.get_site_settings(db)
@router.post("/api/site-settings/webhooks/test/")
@router.post("/webhooks/test")
def test_webhooks():
""" Run the function to test your webhooks """
return post_webhooks()
@router.post("/api/site-settings/update/")
@router.put("")
def update_settings(data: SiteSettings, db: Session = Depends(generate_session)):
""" Returns Site Settings """
data.update(db)
@ -36,58 +36,4 @@ def update_settings(data: SiteSettings, db: Session = Depends(generate_session))
return SnackResponse.success("Settings Updated")
@router.get("/api/site-settings/themes/", tags=["Themes"])
def get_all_themes(db: Session = Depends(generate_session)):
""" Returns all site themes """
return SiteTheme.get_all(db)
@router.get("/api/site-settings/themes/{theme_name}/", tags=["Themes"])
def get_single_theme(theme_name: str, db: Session = Depends(generate_session)):
""" Returns a named theme """
return SiteTheme.get_by_name(db, theme_name)
@router.post("/api/site-settings/themes/create/", tags=["Themes"])
def create_theme(data: SiteTheme, db: Session = Depends(generate_session)):
""" Creates a site color theme database entry """
data.save_to_db(db)
# try:
# data.save_to_db()
# except:
# raise HTTPException(
# status_code=400, detail=SnackResponse.error("Unable to Save Theme")
# )
return SnackResponse.success("Theme Saved")
@router.post("/api/site-settings/themes/{theme_name}/update/", tags=["Themes"])
def update_theme(
theme_name: str, data: SiteTheme, db: Session = Depends(generate_session)
):
""" Update a theme database entry """
data.update_document(db)
# try:
# except:
# raise HTTPException(
# status_code=400, detail=SnackResponse.error("Unable to Update Theme")
# )
return SnackResponse.success("Theme Updated")
@router.delete("/api/site-settings/themes/{theme_name}/delete/", tags=["Themes"])
def delete_theme(theme_name: str, db: Session = Depends(generate_session)):
""" Deletes theme from the database """
SiteTheme.delete_theme(db, theme_name)
# try:
# SiteTheme.delete_theme(theme_name)
# except:
# raise HTTPException(
# status_code=400, detail=SnackResponse.error("Unable to Delete Theme")
# )
return SnackResponse.success("Theme Deleted")

View file

@ -0,0 +1,64 @@
from db.db_setup import generate_session
from fastapi import APIRouter, Depends
from services.settings_services import SiteTheme
from sqlalchemy.orm.session import Session
from utils.snackbar import SnackResponse
router = APIRouter(prefix="/api", tags=["Themes"])
@router.get("/themes")
def get_all_themes(db: Session = Depends(generate_session)):
""" Returns all site themes """
return SiteTheme.get_all(db)
@router.post("/themes/create")
def create_theme(data: SiteTheme, db: Session = Depends(generate_session)):
""" Creates a site color theme database entry """
data.save_to_db(db)
# try:
# data.save_to_db()
# except:
# raise HTTPException(
# status_code=400, detail=SnackResponse.error("Unable to Save Theme")
# )
return SnackResponse.success("Theme Saved")
@router.get("/themes/{theme_name}")
def get_single_theme(theme_name: str, db: Session = Depends(generate_session)):
""" Returns a named theme """
return SiteTheme.get_by_name(db, theme_name)
@router.put("/themes/{theme_name}")
def update_theme(
theme_name: str, data: SiteTheme, db: Session = Depends(generate_session)
):
""" Update a theme database entry """
data.update_document(db)
# try:
# except:
# raise HTTPException(
# status_code=400, detail=SnackResponse.error("Unable to Update Theme")
# )
return SnackResponse.success("Theme Updated")
@router.delete("/themes/{theme_name}")
def delete_theme(theme_name: str, db: Session = Depends(generate_session)):
""" Deletes theme from the database """
SiteTheme.delete_theme(db, theme_name)
# try:
# SiteTheme.delete_theme(theme_name)
# except:
# raise HTTPException(
# status_code=400, detail=SnackResponse.error("Unable to Delete Theme")
# )
return SnackResponse.success("Theme Deleted")

5
mealie/run.sh Normal file
View file

@ -0,0 +1,5 @@
## Run Migration
## Start Application
uvicorn app:app --host 0.0.0.0 --port 80

View file

@ -80,7 +80,8 @@ class ImportDatabase:
recipe_obj.save_to_db(self.session)
successful_imports.append(recipe.stem)
logger.info(f"Imported: {recipe.stem}")
except:
except Exception as inst:
logger.error(inst)
logger.info(f"Failed Import: {recipe.stem}")
failed_imports.append(recipe.stem)

View file

@ -7,6 +7,7 @@ from pathlib import Path
from app_config import IMG_DIR, MIGRATION_DIR, TEMP_DIR
from services.recipe_services import Recipe
from services.scrape_services import normalize_data, process_recipe_data
from app_config import IMG_DIR, TEMP_DIR
def process_selection(selection: Path) -> Path:

View file

@ -40,7 +40,6 @@ class Recipe(BaseModel):
dateAdded: Optional[datetime.date]
notes: Optional[List[RecipeNote]] = []
rating: Optional[int]
rating: Optional[int]
orgURL: Optional[str]
extras: Optional[dict] = {}
@ -138,33 +137,4 @@ class Recipe(BaseModel):
return db.recipes.get_all(session)
def read_requested_values(
session: Session, keys: list, max_results: int = 0
) -> List[dict]:
"""
Pass in a list of key values to be run against the database. If a match is found
it is then added to a dictionary inside of a list. If a key does not exist the
it will simply not be added to the return data.
Parameters:
keys: list
Returns: returns a list of dicts containing recipe data
"""
recipe_list = []
for recipe in db.recipes.get_all(
session=session, limit=max_results, order_by="dateAdded"
):
recipe_details = {}
for key in keys:
try:
recipe_key = {key: recipe[key]}
except:
continue
recipe_details.update(recipe_key)
recipe_list.append(recipe_details)
return recipe_list

View file

@ -1,11 +1,11 @@
import html
import json
from pathlib import Path
import re
from typing import List, Tuple
import extruct
import requests
import scrape_schema_recipe
import html
from app_config import DEBUG_DIR
from slugify import slugify
from utils.logger import logger
@ -14,10 +14,15 @@ from w3lib.html import get_base_url
from services.image_services import scrape_image
from services.recipe_services import Recipe
CWD = Path(__file__).parent
TEMP_FILE = DEBUG_DIR.joinpath("last_recipe.json")
def cleanhtml(raw_html):
cleanr = re.compile("<.*?>")
cleantext = re.sub(cleanr, "", raw_html)
return cleantext
def normalize_image_url(image) -> str:
if type(image) == list:
return image[0]
@ -33,7 +38,9 @@ def normalize_instructions(instructions) -> List[dict]:
# One long string split by (possibly multiple) new lines
if type(instructions) == str:
return [
{"text": normalize_instruction(line)} for line in instructions.splitlines() if line
{"text": normalize_instruction(line)}
for line in instructions.splitlines()
if line
]
# Plain strings in a list
@ -53,13 +60,18 @@ def normalize_instructions(instructions) -> List[dict]:
def normalize_instruction(line) -> str:
l = line.strip()
l = cleanhtml(line.strip())
# Some sites erroneously escape their strings on multiple levels
while not l == (l := html.unescape(l)):
pass
return l
def normalize_ingredient(ingredients: list) -> str:
return [cleanhtml(html.unescape(ing)) for ing in ingredients]
def normalize_yield(yld) -> str:
if type(yld) == list:
return yld[-1]
@ -76,9 +88,13 @@ def normalize_time(time_entry) -> str:
def normalize_data(recipe_data: dict) -> dict:
recipe_data["totalTime"] = normalize_time(recipe_data.get("totalTime"))
recipe_data["description"] = cleanhtml(recipe_data.get("description", ""))
recipe_data["prepTime"] = normalize_time(recipe_data.get("prepTime"))
recipe_data["performTime"] = normalize_time(recipe_data.get("performTime"))
recipe_data["recipeYield"] = normalize_yield(recipe_data.get("recipeYield"))
recipe_data["recipeIngredient"] = normalize_ingredient(
recipe_data.get("recipeIngredient")
)
recipe_data["recipeInstructions"] = normalize_instructions(
recipe_data["recipeInstructions"]
)

View file

@ -141,6 +141,8 @@ def default_settings_init():
default_entry = SiteSettings(name="main", webhooks=webhooks)
document = db.settings.save_new(session, default_entry.dict(), webhooks.dict())
session.close()
if not sql_exists:
default_settings_init()

View file

@ -23,6 +23,8 @@ def override_get_db():
db.close()
@fixture(scope="session")
def api_client():

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,63 @@
{
"@context": "http:\/\/schema.org",
"@type": "Recipe",
"name": "Air Fryer Shrimp",
"author": {
"@type": "Person",
"name": "Anna"
},
"description": "These Air Fryer Shrimp are plump, juicy and perfectly seasoned! This healthy dish is ready in just 8 minutes and requires pantry staples to make it.",
"datePublished": "2020-07-13T16:48:25+00:00",
"image": "https:\/\/www.crunchycreamysweet.com\/wp-content\/uploads\/2020\/07\/air-fryer-shrimp-A-480x270.jpg",
"recipeYield": 4,
"prepTime": "PT0H15M",
"cookTime": "PT0H8M",
"totalTime": "PT0H23M",
"recipeIngredient": [
"1 lb shrimp",
"2 teaspoons olive oil",
"\u00bd teaspoon garlic powder",
"\u00bc teaspoon paprika",
"\u00bd teaspoon Italian seasoning",
"\u00bd teaspoon salt",
"\u00bc teaspoon black pepper"
],
"recipeInstructions": [
"Cleaning the shrimp by removing shells and veins. Run under tap water, then pat dry with paper towel.",
"Mix oil with seasoning in a small bowl.",
"Brush shrimp with seasoning mixture on both sides.",
"Arrange shrimp in air fryer basket or rack, in a single layer.",
"Cook at 400 degrees F for 8 minutes (no need to turn them).",
"Serve."
],
"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": "5",
"ratingCount": "4"
},
"recipeCategory": "Main Course",
"recipeCuisine": [
"American"
],
"keywords": "air fryer shrimp",
"nutrition": {
"@type": "NutritionInformation",
"calories": "134 kcal",
"carbohydrateContent": "1 g",
"proteinContent": "23 g",
"fatContent": "4 g",
"saturatedFatContent": "1 g",
"cholesterolContent": "286 mg",
"sodiumContent": "1172 mg",
"fiberContent": "1 g",
"sugarContent": "1 g",
"servingSize": "1 serving"
},
"@id": "https:\/\/www.crunchycreamysweet.com\/air-fryer-shrimp\/#recipe",
"isPartOf": {
"@id": "https:\/\/www.crunchycreamysweet.com\/air-fryer-shrimp\/#article"
},
"mainEntityOfPage": "https:\/\/www.crunchycreamysweet.com\/air-fryer-shrimp\/#webpage",
"tool": [],
"url": "https:\/\/www.crunchycreamysweet.com\/air-fryer-shrimp\/"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

View file

@ -0,0 +1,259 @@
{
"@context": "http:\/\/schema.org",
"@type": "Recipe",
"mainEntityOfPage": "https:\/\/www.allrecipes.com\/recipe\/8975\/chicken-parmigiana\/",
"name": "Chicken Parmigiana",
"image": "https:\/\/imagesvc.meredithcorp.io\/v3\/mm\/image?url=https%3A%2F%2Fimages.media-allrecipes.com%2Fuserphotos%2F10037.jpg",
"datePublished": "1999-04-27T12:40:19.000Z",
"description": "This is a very nice dinner for two. Serve it with your favorite pasta and tossed greens.",
"prepTime": "PT0H30M",
"cookTime": "PT1H0M",
"totalTime": "PT1H30M",
"recipeYield": 2,
"recipeIngredient": [
"1 egg, beaten",
"2 ounces dry bread crumbs",
"2 skinless, boneless chicken breast halves",
"\u00be (16 ounce) jar spaghetti sauce",
"2 ounces shredded mozzarella cheese",
"\u00bc cup grated Parmesan cheese"
],
"recipeInstructions": [
"Preheat oven to 350 degrees F (175 degrees C). Lightly grease a medium baking sheet.\n",
"Pour egg into a small shallow bowl. Place bread crumbs in a separate shallow bowl. Dip chicken into egg, then into the bread crumbs. Place coated chicken on the prepared baking sheet and bake in the preheated oven for 40 minutes, or until no longer pink and juices run clear.\n",
"Pour 1\/2 of the spaghetti sauce into a 7x11 inch baking dish. Place chicken over sauce, and cover with remaining sauce. Sprinkle mozzarella and Parmesan cheeses on top and return to the preheated oven for 20 minutes.\n"
],
"recipeCategory": "World Cuisine Recipes",
"recipeCuisine": [],
"author": [
{
"@type": "Person",
"name": "Candy"
}
],
"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": 4.580034423407917,
"ratingCount": 1743,
"itemReviewed": "Chicken Parmigiana",
"bestRating": "5",
"worstRating": "1"
},
"nutrition": {
"@type": "NutritionInformation",
"calories": "528.3 calories",
"carbohydrateContent": "44.9 g",
"cholesterolContent": "184.1 mg",
"fatContent": "18.3 g",
"fiberContent": "5.6 g",
"proteinContent": "43.5 g",
"saturatedFatContent": "7.6 g",
"servingSize": null,
"sodiumContent": "1309.5 mg",
"sugarContent": "17.2 g",
"transFatContent": null,
"unsaturatedFatContent": null
},
"review": [
{
"@type": "Review",
"datePublished": "2004-02-10T10:18:54.927Z",
"reviewBody": "This is a DELICIOUS basic recipe. I have been doing a similar one for years. I also, prefer adding a few more spices TO THE BREAD CRUMBS,like basil, oregano, garlic powder, salt, fresh cracked pepper and onion powder, and a few TBSP of the parmensan cheese;not only ON IT later. For some reason these spices (added separately) are good, but we don't like with an pre-mix of \"Italian\"spice. It seems to taste a little \"soapy\". Not sure which spice does that to it.? Some suggested to \"double dip\" in bread crumbs;if you do, you should really LIKE a heavy battering. It was too thick for our tastes(esp. since you bake in the sauce; to me,the bottom gets a little mushy, and it just adds extra fat and calories). I also use a cookie cooling \"RACK\" SET ON TOP of a baking sheet, to bake the chicken on instead of just on the cookie sheet pan. It comes out much crisper; letting air get to the BOTTOM of the chicken,also. Also,I wait to spoon the SECOND 1\/2 of the sauce UNTIL SERVING, the chicken will stay crisper,(even with the cheese on top). Obviously, we like the chicken on the crisp side (but we don't want to deep fry).\r\nFor company, put the chicken (with just the cheese baked on top) ON TOP of a small mound of spaghetti and sauce,or any pasta; It makes for a delicious looking presentation. A side salad with some sort of CREAMY dressing seems to compliment the red sauce, and completes the meal wonderfully. We get cravings for this one about 2c a month!",
"reviewRating": {
"@type": "Rating",
"worstRating": "1",
"bestRating": "5",
"ratingValue": 4
},
"author": {
"@type": "Person",
"name": "somethingdifferentagain?!",
"image": null,
"sameAs": "https:\/\/www.allrecipes.com\/cook\/342976\/"
}
},
{
"@type": "Review",
"datePublished": "2004-01-23T16:37:02.013Z",
"reviewBody": "This was an extremely easy, very tasty recipe. As many others suggested, I only put sauce on the bottom of the chicken and then spooned a little over the top when serving. I think the recipe could be improved, though, by (1) pounding the chicken to a uniform thickness and (2) by spicing up the bread crumbs. I used Italian bread crumbs but next time will sprinkle pepper on the chicken before dredging through the crumbs, and I also plan to add more Italian seasoning and maybe a little parmesan to the crumbs. Both these steps, in my opinion, would take this from a really good recipe to an excellent dish!",
"reviewRating": {
"@type": "Rating",
"worstRating": "1",
"bestRating": "5",
"ratingValue": 4
},
"author": {
"@type": "Person",
"name": "JBAGNALL",
"image": null,
"sameAs": "https:\/\/www.allrecipes.com\/cook\/642772\/"
}
},
{
"@type": "Review",
"datePublished": "2005-11-19T20:22:40.53Z",
"reviewBody": "I BRINED my chicken in 4 cups water , 1\/2 cup kosher salt (1\/4 table salt) \u00bd cup sugar for 30 minutes. No need to brine if you are using quick frozen chicken that has been enhanced. Kosher chicken is prebrined. Brining=juicy chicken. Took brined chicken, cut off thin edges, pounded out & shook chicken w\/flour (preflouring allows bread crumbs to stick) in a Ziploc-letting floured chicken sit for 5 min. I heated 6 TBS vegetable oil till it shimmered & then added 2 TBS butter to my pan, reserving half of this mixture for my second batch. Bread crumb mixture: I use \u00bd cup seasoned bread crumbs(same as 2 ounces), \u00bd cup grated parmesan( double what recipe calls for), 1tsp. Mrs. Dash Garlic and Herb, \u00bd tsp. garlic powder, \u00bd tsp, onion powder, \u00bd tsp. Italian seasoning & a pinch of pepper. Took pre-floured chicken, coated it with egg mixture, then dipped in bread crumbs & FRIED the chicken to a medium golden brown. Shook some parmesan on them right away when done frying to absorb any oil. Side-by side I plated plain spaghetti noodles & cutlets, w\/2 TBSP sauce on cutlet & desired amount of sauce on pasta, covered in cheese & baked each individual plate till cheese melted, serving them straight out of the oven. \r\nThe reviews on this were probably the best I have ever gotten, I used to work in an Italian Restaurant owned by NY Italians & have picked up some techniques. My Fettuccine Alfredo used to be my husband favorite dish, after last night he told me he has a new favorite. \r\n",
"reviewRating": {
"@type": "Rating",
"worstRating": "1",
"bestRating": "5",
"ratingValue": 5
},
"author": {
"@type": "Person",
"name": "KC MARTEL",
"image": null,
"sameAs": "https:\/\/www.allrecipes.com\/cook\/526291\/"
}
},
{
"@type": "Review",
"datePublished": "2003-10-22T15:32:26.607Z",
"reviewBody": "After several Chicken Parm recipes THIS is THE ONE:-) I've finally found one that we all love! It's simple and it's darned good:-) I will definately make this recipe again and again; thanks so much:-)",
"reviewRating": {
"@type": "Rating",
"worstRating": "1",
"bestRating": "5",
"ratingValue": 5
},
"author": {
"@type": "Person",
"name": "STARCHILD1166",
"image": null,
"sameAs": "https:\/\/www.allrecipes.com\/cook\/736533\/"
}
},
{
"@type": "Review",
"datePublished": "2003-11-14T16:55:26.39Z",
"reviewBody": "This chicken was so easy to make and turned out excellent! Used Best Marinara Sauce Yet (found here as well)instead of regular spaghetti sauce. This added even more flavor.",
"reviewRating": {
"@type": "Rating",
"worstRating": "1",
"bestRating": "5",
"ratingValue": 5
},
"author": {
"@type": "Person",
"name": "Alison",
"image": null,
"sameAs": "https:\/\/www.allrecipes.com\/cook\/516223\/"
}
},
{
"@type": "Review",
"datePublished": "2003-01-23T04:38:19.873Z",
"reviewBody": "I REALLY liked this recipe. I made my own spaghetti sauce and used parmesan reggiano. I also skipped dipping the breasts in egg as I thought it was unnecessary and it was. Cooking temp. and time are accurate. Even my fussy fiance liked this. I'll definitely make this again.",
"reviewRating": {
"@type": "Rating",
"worstRating": "1",
"bestRating": "5",
"ratingValue": 4
},
"author": {
"@type": "Person",
"name": "CSANDST1",
"image": null,
"sameAs": "https:\/\/www.allrecipes.com\/cook\/115553\/"
}
},
{
"@type": "Review",
"datePublished": "2003-08-05T20:26:00.81Z",
"reviewBody": "Wow! This was really tasty and simple. Something quick to make when you can't spend too much time figuring out what's for dinner. Also great on a toasted roll\/hero as a sandwich. I varied the recipe a little by adding some parmesan cheese (big cheese lover that I am!), garlic powder, onion powder and some salt into the bread crumbs and then mixing it up before breading the chicken with it. Also added a little salt to the beaten egg to make sure the chicken wouldn't end up bland, but that's just my preference. In response to the one reviewer who wanted thicker breading, what I did was double dip the chicken - coat first with the bread crumbs, then dip into the beaten egg and re-coat with breadcrumbs before actually baking (this would require some more breadcrumbs and probably another egg). Excellent recipe! =]",
"reviewRating": {
"@type": "Rating",
"worstRating": "1",
"bestRating": "5",
"ratingValue": 5
},
"author": {
"@type": "Person",
"name": "LIZCHAO74",
"image": null,
"sameAs": "https:\/\/www.allrecipes.com\/cook\/511187\/"
}
},
{
"@type": "Review",
"datePublished": "2003-07-23T07:53:37.18Z",
"reviewBody": "Wonderful chicken recipe! I have made this several times. One night we were craving it and I didn't have any bottled spaghetti sauce. I poured a 14 ounce can of tomato sauce in a microwave bowl added 2t Italian Seasoning and 1t of garlic powder cooked on high for 6 minutes and ended up with a rich thick sauce for the chicken.",
"reviewRating": {
"@type": "Rating",
"worstRating": "1",
"bestRating": "5",
"ratingValue": 4
},
"author": {
"@type": "Person",
"name": "MAGGIE MCGUIRE",
"image": null,
"sameAs": "https:\/\/www.allrecipes.com\/cook\/392086\/"
}
},
{
"@type": "Review",
"datePublished": "2008-06-10T21:54:38.893Z",
"reviewBody": "This is gonna be one of those it\u2019s a good recipe when you completely change it reviews. I did originally follow the recipe and the chicken tasted like it had been in breaded in cardboard. It just was not appetizing. However there is a great breaded chicken recipe on this site, garlic chicken. Made this simple and easy and oh so TASTY. I got great reviews. Here is what I did. Took \u00bc cup olive oil with 3 cloves garlic crushed and heated in microwave for 30 sec. Then coated the chicken in the oil and dipped in a mixture of \u00bd Italian seasoned bread crumbs and \u00bd parmesan cheese (double coat if u like thick breading). Cooked in oven at 325 for 20min (on a foil covered cookie sheet to make clean up easy). Set them in a casserole dish on top of about \u00bd a jar of spaghetti sauce for 3 chicken breast. Covered the breast with slices of mozzarella cheese and baked for another 20-25 minutes. Top with parmesan cheese. This turned out really really yummy and smells sooo good while it\u2019s cooking. ",
"reviewRating": {
"@type": "Rating",
"worstRating": "1",
"bestRating": "5",
"ratingValue": 4
},
"author": {
"@type": "Person",
"name": "ANGEL.9",
"image": null,
"sameAs": "https:\/\/www.allrecipes.com\/cook\/218599\/"
}
},
{
"@type": "Review",
"datePublished": "2006-02-02T19:05:24.607Z",
"reviewBody": "Check out \"Tomato Chicken Parmesan\" on this site for a truly fabulous chicken parm recipe. Every time I make that one people say its the best chicken parm they every had. No matter what kind you make though always pound your chicken breasts it will help immensely keeping the chicken tender and moist.",
"reviewRating": {
"@type": "Rating",
"worstRating": "1",
"bestRating": "5",
"ratingValue": 3
},
"author": {
"@type": "Person",
"name": "MomSavedbyGrace",
"image": null,
"sameAs": "https:\/\/www.allrecipes.com\/cook\/1366670\/"
}
}
],
"video": {
"@context": "http:\/\/schema.org",
"@type": "VideoObject",
"name": "Chicken Parmigiana",
"description": "Make this quick and easy version of chicken Parmigiana.",
"uploadDate": "2012-05-23T22:01:40.476Z",
"duration": "PT2M18.43S",
"thumbnailUrl": "https:\/\/imagesvc.meredithcorp.io\/v3\/mm\/image?url=https%3A%2F%2Fcf-images.us-east-1.prod.boltdns.net%2Fv1%2Fstatic%2F1033249144001%2F15c9e37d-979a-4c2c-a35d-fc3f436b0047%2F6b7f7749-9989-4707-971e-8578e60c0670%2F160x90%2Fmatch%2Fimage.jpg",
"publisher": {
"@type": "Organization",
"name": "Allrecipes",
"url": "https:\/\/www.allrecipes.com",
"logo": {
"@type": "ImageObject",
"url": "https:\/\/www.allrecipes.com\/img\/logo.png",
"width": 209,
"height": 60
},
"sameAs": [
"https:\/\/www.facebook.com\/allrecipes",
"https:\/\/twitter.com\/Allrecipes",
"https:\/\/www.pinterest.com\/allrecipes\/",
"https:\/\/www.instagram.com\/allrecipes\/"
]
},
"embedUrl": "https:\/\/players.brightcove.net\/1033249144001\/default_default\/index.html?videoId=1653498713001"
},
"keywords": "",
"tool": [],
"url": "https:\/\/www.allrecipes.com\/recipe\/8975\/chicken-parmigiana\/"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Some files were not shown because too many files have changed in this diff Show more