Add comments to projects.py
This commit is contained in:
parent
fc08032f0a
commit
822a041abe
1 changed files with 2 additions and 0 deletions
|
@ -81,6 +81,7 @@ async def patch_project(
|
||||||
) -> Project:
|
) -> Project:
|
||||||
"""Apply partial updates to a project."""
|
"""Apply partial updates to a project."""
|
||||||
|
|
||||||
|
# Search for project with name in database
|
||||||
try:
|
try:
|
||||||
db_project = session.exec(select(Project).where(Project.name == name)).one()
|
db_project = session.exec(select(Project).where(Project.name == name)).one()
|
||||||
except sqlalchemy.exc.NoResultFound:
|
except sqlalchemy.exc.NoResultFound:
|
||||||
|
@ -90,6 +91,7 @@ async def patch_project(
|
||||||
for key, value in project.dict(exclude_unset=True).items():
|
for key, value in project.dict(exclude_unset=True).items():
|
||||||
setattr(db_project, key, value)
|
setattr(db_project, key, value)
|
||||||
|
|
||||||
|
# Write modified project to database
|
||||||
session.add(db_project)
|
session.add(db_project)
|
||||||
session.commit()
|
session.commit()
|
||||||
session.refresh(db_project)
|
session.refresh(db_project)
|
||||||
|
|
Loading…
Reference in a new issue