2019-06-04 20:43:08 +00:00
|
|
|
from flask_sqlalchemy import SQLAlchemy
|
|
|
|
|
|
|
|
from model.cce import CCE
|
2019-07-08 20:55:30 +00:00
|
|
|
from model.errorCCE import ErrorCCE
|
2019-06-04 20:43:08 +00:00
|
|
|
from model.registration import Registration
|
|
|
|
from model.renewal import Renewal, RENEWAL_REG
|
|
|
|
from model.volume import Volume
|
|
|
|
|
|
|
|
|
|
|
|
db = SQLAlchemy()
|
|
|
|
|
|
|
|
|
|
|
|
class QueryManager():
|
|
|
|
def __init__(self, session):
|
|
|
|
self.session = session
|
|
|
|
|
|
|
|
def registrationQuery(self, uuid):
|
|
|
|
return self.session.query(CCE)\
|
|
|
|
.outerjoin(Registration, RENEWAL_REG, Renewal)\
|
|
|
|
.filter(CCE.uuid == uuid).one()
|
|
|
|
|
|
|
|
def renewalQuery(self, uuid):
|
|
|
|
return self.session.query(Renewal)\
|
|
|
|
.outerjoin(RENEWAL_REG, Registration, CCE)\
|
|
|
|
.filter(Renewal.uuid == uuid).one()
|
|
|
|
|
|
|
|
def orphanRenewalQuery(self, uuid):
|
|
|
|
return self.session.query(Renewal).filter(Renewal.uuid == uuid).one()
|