feat(frontend): Add Meal Tags + UI Improvements (#807)

* feat: 

* fix colors

* add additional support for settings meal tag

* add defaults to recipe

* use group reciep settings

* fix login infinite loading

* disable owner on initial load

* add skeleton loader

* add v-model support

* formatting

* fix overwriting existing values

* feat(frontend):  add markdown preview for steps

* update black plus formatting

* update help text

* fix overwrite error

* remove print

Co-authored-by: hay-kot <hay-kot@pm.me>
This commit is contained in:
Hayden
2021-11-20 14:30:38 -09:00
committed by GitHub
parent d4bf81dee6
commit 912cc6d956
50 changed files with 456 additions and 246 deletions

View File

@@ -20,7 +20,7 @@ async def create_api_token(
current_user: PrivateUser = Depends(get_current_user),
session: Session = Depends(generate_session),
):
""" Create api_token in the Database """
"""Create api_token in the Database"""
token_data = {"long_token": True, "id": current_user.id}
@@ -47,7 +47,7 @@ async def delete_api_token(
current_user: PrivateUser = Depends(get_current_user),
session: Session = Depends(generate_session),
):
""" Delete api_token from the Database """
"""Delete api_token from the Database"""
db = get_database(session)
token: LongLiveTokenInDB = db.api_tokens.get(token_id)

View File

@@ -51,7 +51,7 @@ def delete_user(
session: Session = Depends(generate_session),
current_user: PrivateUser = Depends(get_current_user),
):
""" Removes a user from the database. Must be the current user or a super user"""
"""Removes a user from the database. Must be the current user or a super user"""
assert_user_change_allowed(id, current_user)

View File

@@ -13,7 +13,7 @@ user_router = UserAPIRouter()
@user_router.get("/{id}/favorites", response_model=UserFavorites)
async def get_favorites(id: str, session: Session = Depends(generate_session)):
""" Get user's favorite recipes """
"""Get user's favorite recipes"""
db = get_database(session)
return db.users.get(id, override_schema=UserFavorites)
@@ -24,7 +24,7 @@ def add_favorite(
current_user: PrivateUser = Depends(get_current_user),
session: Session = Depends(generate_session),
):
""" Adds a Recipe to the users favorites """
"""Adds a Recipe to the users favorites"""
current_user.favorite_recipes.append(slug)
db = get_database(session)
@@ -37,7 +37,7 @@ def remove_favorite(
current_user: PrivateUser = Depends(get_current_user),
session: Session = Depends(generate_session),
):
""" Adds a Recipe to the users favorites """
"""Adds a Recipe to the users favorites"""
assert_user_change_allowed(id, current_user)
current_user.favorite_recipes = [x for x in current_user.favorite_recipes if x != slug]

View File

@@ -18,7 +18,7 @@ user_router = UserAPIRouter(prefix="", tags=["Users: Images"])
@public_router.get("/{id}/image")
async def get_user_image(id: str):
""" Returns a users profile picture """
"""Returns a users profile picture"""
user_dir = app_dirs.USER_DIR.joinpath(id)
for recipe_image in user_dir.glob("profile_image.*"):
return FileResponse(recipe_image)
@@ -32,7 +32,7 @@ def update_user_image(
profile_image: UploadFile = File(...),
current_user: PrivateUser = Depends(get_current_user),
):
""" Updates a User Image """
"""Updates a User Image"""
assert_user_change_allowed(id, current_user)

View File

@@ -26,19 +26,19 @@ async def reset_user_password(id: int, session: Session = Depends(generate_sessi
@user_router.put("/{item_id}/password")
def update_password(password_change: ChangePassword, user_service: UserService = Depends(UserService.write_existing)):
""" Resets the User Password"""
"""Resets the User Password"""
return user_service.change_password(password_change)
@public_router.post("/forgot-password")
def forgot_password(email: ForgotPassword, session: Session = Depends(generate_session)):
""" Sends an email with a reset link to the user"""
"""Sends an email with a reset link to the user"""
f_service = PasswordResetService(session)
return f_service.send_reset_email(email.email)
@public_router.post("/reset-password")
def reset_password(reset_password: ResetPassword, session: Session = Depends(generate_session)):
""" Resets the user password"""
"""Resets the user password"""
f_service = PasswordResetService(session)
return f_service.reset_password(reset_password.token, reset_password.password)