2017-07-04 17:02:28 +01:00
|
|
|
from app import db
|
2017-07-07 14:48:00 +01:00
|
|
|
from app.dao.dao_utils import transactional
|
2016-08-05 15:48:06 +01:00
|
|
|
from app.models import Organisation
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def dao_get_organisations():
|
|
|
|
|
return Organisation.query.all()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def dao_get_organisation_by_id(org_id):
|
|
|
|
|
return Organisation.query.filter_by(id=org_id).one()
|
2017-07-04 17:02:28 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
@transactional
|
|
|
|
|
def dao_create_organisation(organisation):
|
|
|
|
|
db.session.add(organisation)
|
2017-07-11 18:18:23 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
@transactional
|
|
|
|
|
def dao_update_organisation(organisation, **kwargs):
|
|
|
|
|
for key, value in kwargs.items():
|
|
|
|
|
setattr(organisation, key, value)
|
|
|
|
|
db.session.add(organisation)
|