Skip to content
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

Merged
merged 2 commits into from
May 30, 2024
Merged

Feat: add modify category #43

merged 2 commits into from
May 30, 2024

Conversation

saantim
Copy link
Contributor

@saantim saantim commented May 29, 2024

No description provided.

@saantim saantim linked an issue May 29, 2024 that may be closed by this pull request
2 tasks
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
Copy link
Contributor

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?

Comment on lines +51 to +52
class CategoryUpdate(BaseModel):
name: str
Copy link
Contributor

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)
Copy link
Contributor

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.

Suggested change
@app.put("/category", status_code=HTTPStatus.OK)
@app.put("/category/{category_name}")

@saantim saantim self-assigned this May 29, 2024
@gabokatta
Copy link
Contributor

Vamos a mergear, pero queda pendiente el siguiente cambio: #46

@gabokatta gabokatta merged commit b04f6bb into main May 30, 2024
1 check passed
@gabokatta gabokatta deleted the feature/modify-category-name branch May 30, 2024 22:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Modificar nombre de categoria[1]
3 participants