2024-10-30 12:17:59 -07:00
|
|
|
from sqlalchemy import delete, select
|
|
|
|
|
|
2016-09-20 17:35:15 +01:00
|
|
|
from app import db
|
2020-07-28 10:22:13 +01:00
|
|
|
from app.models import ServiceGuestList
|
2016-09-20 17:35:15 +01:00
|
|
|
|
2016-09-22 17:17:34 +01:00
|
|
|
|
2020-07-28 10:18:47 +01:00
|
|
|
def dao_fetch_service_guest_list(service_id):
|
2024-10-30 12:17:59 -07:00
|
|
|
stmt = select(ServiceGuestList).where(ServiceGuestList.service_id == service_id)
|
|
|
|
|
return db.session.execute(stmt).scalars().all()
|
2016-09-22 17:17:34 +01:00
|
|
|
|
|
|
|
|
|
2020-07-28 10:18:47 +01:00
|
|
|
def dao_add_and_commit_guest_list_contacts(objs):
|
2016-09-22 17:17:34 +01:00
|
|
|
db.session.add_all(objs)
|
|
|
|
|
db.session.commit()
|
2016-09-20 17:35:15 +01:00
|
|
|
|
|
|
|
|
|
2020-07-28 10:18:47 +01:00
|
|
|
def dao_remove_service_guest_list(service_id):
|
2024-10-30 12:17:59 -07:00
|
|
|
stmt = delete(ServiceGuestList).where(ServiceGuestList.service_id == service_id)
|
|
|
|
|
result = db.session.execute(stmt)
|
|
|
|
|
return result.rowcount
|