Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/workflows/ci_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,14 @@ jobs:
run: make build
- name: Run tests
run: make tests
- name: Debug failure
if: failure()
run: |
echo "=== Docker Compose Services ==="
docker compose ps
echo
echo "=== Logs for api-pgd ==="
docker compose logs api-pgd || true
echo
echo "=== Logs for all containers ==="
docker compose logs || true
4 changes: 4 additions & 0 deletions release-notes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release notes

## 3.3.6
* Add audit table for registering database operations (INSERT/UPDATE/DELETE)
* Hotfix: Refactor update_planos to ensure proper transaction handling

## 3.3.5
* Use transaction mode in update_plano_trabalho and update_plano_entregas

Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ pydantic[email]==2.8.2
pytest==8.2.2
httpx==0.27.0
python-jose[cryptography]==3.3.0
passlib[bcrypt]==1.7.4
passlib==1.7.4
bcrypt==4.0.1
python-multipart==0.0.9
fastapi-mail==1.4.1
9 changes: 6 additions & 3 deletions src/crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ async def _build_plano_trabalho_model(
f" matricula_siape: {plano_trabalho.matricula_siape}\n"
f" cod_unidade_lotacao: {plano_trabalho.cod_unidade_lotacao_participante}"
)

session.add(db_participante)
db_participante.planos_trabalho.append(db_plano)

Expand Down Expand Up @@ -274,13 +273,14 @@ async def update_plano_trabalho(
)
session.add(db_plano_atualizado)
try:
await session.refresh(db_plano_atualizado)
await session.flush()
except IntegrityError as e:
raise HTTPException(
status_code=422,
detail="Alteração rejeitada por violar regras de integridade",
) from e
return schemas.PlanoTrabalhoSchema.model_validate(db_plano_atualizado)
await session.refresh(db_plano_atualizado)
return schemas.PlanoTrabalhoSchema.model_validate(db_plano_atualizado)


async def get_plano_entregas(
Expand Down Expand Up @@ -469,8 +469,11 @@ async def update_plano_entregas(

for entrega in db_plano_entregas_atualizado.entregas:
session.add(entrega)

session.add(db_plano_entregas_atualizado)

await session.flush()

await session.refresh(db_plano_entregas_atualizado)
return schemas.PlanoEntregasSchema.model_validate(db_plano_entregas_atualizado)

Expand Down