File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -157,7 +157,6 @@ async def _build_plano_trabalho_model(
157157 f" matricula_siape: { plano_trabalho .matricula_siape } \n "
158158 f" cod_unidade_lotacao: { plano_trabalho .cod_unidade_lotacao_participante } "
159159 )
160-
161160 session .add (db_participante )
162161 db_participante .planos_trabalho .append (db_plano )
163162
@@ -274,13 +273,14 @@ async def update_plano_trabalho(
274273 )
275274 session .add (db_plano_atualizado )
276275 try :
277- await session .refresh ( db_plano_atualizado )
276+ await session .flush ( )
278277 except IntegrityError as e :
279278 raise HTTPException (
280279 status_code = 422 ,
281280 detail = "Alteração rejeitada por violar regras de integridade" ,
282281 ) from e
283- return schemas .PlanoTrabalhoSchema .model_validate (db_plano_atualizado )
282+ await session .refresh (db_plano_atualizado )
283+ return schemas .PlanoTrabalhoSchema .model_validate (db_plano_atualizado )
284284
285285
286286async def get_plano_entregas (
@@ -469,8 +469,11 @@ async def update_plano_entregas(
469469
470470 for entrega in db_plano_entregas_atualizado .entregas :
471471 session .add (entrega )
472+
472473 session .add (db_plano_entregas_atualizado )
473474
475+ await session .flush ()
476+
474477 await session .refresh (db_plano_entregas_atualizado )
475478 return schemas .PlanoEntregasSchema .model_validate (db_plano_entregas_atualizado )
476479
You can’t perform that action at this time.
0 commit comments