-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat: add modify category #43
Conversation
return db.query(models.Category).filter(models.Category.group_id == group_id, models.Category.name == category_name).first() | ||
|
||
def update_category(db: Session, category: models.Category, put_category: schemas.CategoryUpdate): | ||
category.name=put_category.new_name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sqlalchemy actualiza el nombre en todos los lugares que referencian la categoría?
class CategoryUpdate(BaseModel): | ||
name: str |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Y si le metemos un ID? Creo que así queda más simple
@@ -107,6 +107,15 @@ def list_group_categories(db: DbDependency, group_id: int): | |||
|
|||
return categories | |||
|
|||
@app.put("/category", status_code=HTTPStatus.OK) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Estamos pasando la primary key como path parameter en estos casos.
@app.put("/category", status_code=HTTPStatus.OK) | |
@app.put("/category/{category_name}") |
Vamos a mergear, pero queda pendiente el siguiente cambio: #46 |
No description provided.