mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-04 02:11:11 -05:00
use db models instead of tuples when referring to rate objects
makes it less confusing
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import random
|
||||
import uuid
|
||||
from datetime import datetime, date
|
||||
from decimal import Decimal
|
||||
|
||||
from app import db
|
||||
from app.dao.email_branding_dao import dao_create_email_branding
|
||||
@@ -29,6 +30,7 @@ from app.models import (
|
||||
Job,
|
||||
Notification,
|
||||
EmailBranding,
|
||||
LetterRate,
|
||||
Organisation,
|
||||
Rate,
|
||||
Service,
|
||||
@@ -403,6 +405,23 @@ def create_rate(start_date, value, notification_type):
|
||||
return rate
|
||||
|
||||
|
||||
def create_letter_rate(start_date=None, end_date=None, crown=True, sheet_count=1, rate=0.33, post_class='second'):
|
||||
if start_date is None:
|
||||
start_date = datetime(2016, 1, 1)
|
||||
rate = LetterRate(
|
||||
id=uuid.uuid4(),
|
||||
start_date=start_date,
|
||||
end_date=end_date,
|
||||
crown=crown,
|
||||
sheet_count=sheet_count,
|
||||
rate=Decimal(rate),
|
||||
post_class=post_class
|
||||
)
|
||||
db.session.add(rate)
|
||||
db.session.commit()
|
||||
return rate
|
||||
|
||||
|
||||
def create_api_key(service, key_type=KEY_TYPE_NORMAL):
|
||||
id_ = uuid.uuid4()
|
||||
api_key = ApiKey(
|
||||
|
||||
Reference in New Issue
Block a user