[WIP] Added dao method and rest endpoint for getting template

statistics by service.

Some cosmetic changes to imports.

Added fix for job rest not correctly returning errors.
This commit is contained in:
Adam Shimali
2016-04-04 12:21:38 +01:00
parent e2d0d39ea7
commit 0d06be05e1
10 changed files with 390 additions and 44 deletions

View File

@@ -357,7 +357,7 @@ class TemplateStatistics(db.Model):
id = db.Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
service_id = db.Column(UUID(as_uuid=True), db.ForeignKey('services.id'), index=True, unique=False, nullable=False)
service = db.relationship('Service', backref=db.backref('template_statics', lazy='dynamic'))
service = db.relationship('Service', backref=db.backref('template_statistics', lazy='dynamic'))
template_id = db.Column(db.BigInteger, db.ForeignKey('templates.id'), index=True, nullable=False, unique=False)
template = db.relationship('Template')
usage_count = db.Column(db.BigInteger, index=False, unique=False, nullable=False, default=1)