Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
- Restored @transactional decorator
- Simplified setting the default template categories during a delete
  • Loading branch information
whabanks committed Jul 9, 2024
1 parent be9f2e6 commit e026f9c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/dao/template_categories_dao.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def dao_update_template_category(template_category: TemplateCategory):
db.session.commit()


@transactional
def dao_delete_template_category_by_id(template_category_id, cascade=False):
"""
Deletes a `TemplateCategory`. By default, if the `TemplateCategory` is associated with any `Template`, it will not be deleted.
Expand All @@ -68,7 +69,7 @@ def dao_delete_template_category_by_id(template_category_id, cascade=False):
if template.template_type == "sms"
else template_category.email_process_type
)
template.template_category_id = dao_get_template_category_by_id(default_category_id).id
template.template_category_id = default_category_id
template.updated_at = datetime.utcnow()
db.session.add(template)
db.session.commit()
Expand Down

0 comments on commit e026f9c

Please sign in to comment.