- Add update dao_update_annual_billing_for_current_and_future_years

- moved get_current_financial_year_start_year from service.utils to dao.date_utils
- Moved logic for data persistence from rest to dao when updating records in db
This commit is contained in:
venusbb
2017-11-02 12:19:17 +00:00
parent cc3d5ba8d1
commit 6f7793d761
10 changed files with 186 additions and 230 deletions

View File

@@ -26,7 +26,8 @@ from app.models import (
EMAIL_TYPE,
SMS_TYPE,
INBOUND_SMS_TYPE,
KEY_TYPE_NORMAL
KEY_TYPE_NORMAL,
AnnualBilling,
)
from app.dao.users_dao import save_model_user
from app.dao.notifications_dao import dao_create_notification, dao_created_scheduled_notification
@@ -407,3 +408,17 @@ def create_reply_to_email_for_notification(
db.session.commit()
return reply_to
def create_annual_billing(
service_id, free_sms_fragment_limit, financial_year_start
):
annual_billing = AnnualBilling(
service_id=service_id,
free_sms_fragment_limit=free_sms_fragment_limit,
financial_year_start=financial_year_start
)
db.session.add(annual_billing)
db.session.commit()
return annual_billing