mirror of
https://github.com/GSA/notifications-api.git
synced 2026-09-10 18:23:01 -04:00
New strategy for transaction management.
Introduce a contextmanger function to handle exceptions and nested transactions. Using the nested_transaction will start a nested transaction with `db.session.begin_nested`, once the nested transaction is complete the commit will happen. `@transactional` has been updated to commit unless in a nested transaction.
This commit is contained in:
@@ -7,12 +7,7 @@ from sqlalchemy.orm import joinedload
|
||||
from sqlalchemy.sql.expression import and_, asc, case, func
|
||||
|
||||
from app import db
|
||||
from app.dao.dao_utils import (
|
||||
VersionOptions,
|
||||
nested_transactional,
|
||||
transactional,
|
||||
version_class,
|
||||
)
|
||||
from app.dao.dao_utils import VersionOptions, transactional, version_class
|
||||
from app.dao.date_util import get_current_financial_year
|
||||
from app.dao.email_branding_dao import dao_get_email_branding_by_name
|
||||
from app.dao.letter_branding_dao import dao_get_letter_branding_by_name
|
||||
@@ -289,7 +284,7 @@ def dao_fetch_service_by_id_and_user(service_id, user_id):
|
||||
).one()
|
||||
|
||||
|
||||
@nested_transactional
|
||||
@transactional
|
||||
@version_class(Service)
|
||||
def dao_create_service(
|
||||
service,
|
||||
|
||||
Reference in New Issue
Block a user