soft deletes available for applications and environments
- parent relation will not include applications or environments marked as deleted - domain classes will exclude deleted objects from selections - changed some test factories to use domain_word for resource names, because they were using person names and it bugged me
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
from sqlalchemy.orm.exc import NoResultFound
|
||||
|
||||
from atst.database import db
|
||||
from atst.domain.environments import Environments
|
||||
from atst.domain.exceptions import NotFoundError
|
||||
@@ -23,7 +25,9 @@ class Applications(object):
|
||||
def get(cls, application_id):
|
||||
try:
|
||||
application = (
|
||||
db.session.query(Application).filter_by(id=application_id).one()
|
||||
db.session.query(Application)
|
||||
.filter_by(id=application_id, deleted=False)
|
||||
.one()
|
||||
)
|
||||
except NoResultFound:
|
||||
raise NotFoundError("application")
|
||||
|
||||
@@ -51,7 +51,11 @@ class Environments(object):
|
||||
@classmethod
|
||||
def get(cls, environment_id):
|
||||
try:
|
||||
env = db.session.query(Environment).filter_by(id=environment_id).one()
|
||||
env = (
|
||||
db.session.query(Environment)
|
||||
.filter_by(id=environment_id, deleted=False)
|
||||
.one()
|
||||
)
|
||||
except NoResultFound:
|
||||
raise NotFoundError("environment")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user