Add server_commands and update readme.md

Update command to search for services from the user.
This commit is contained in:
Nicholas Staples
2016-05-11 15:52:49 +01:00
parent 55ed143889
commit 15607c0977
6 changed files with 63 additions and 17 deletions

View File

@@ -50,7 +50,6 @@ def get_unsigned_secret(key_id):
def _generate_secret(token=None):
import uuid
if not token:
token = uuid.uuid4()
serializer = URLSafeSerializer(current_app.config.get('SECRET_KEY'))

View File

@@ -95,9 +95,11 @@ def delete_service_and_all_associated_db_objects(service):
_delete_commit(InvitedUser.query.filter_by(service=service))
_delete_commit(Permission.query.filter_by(service=service))
_delete_commit(ApiKey.query.filter_by(service=service))
_delete_commit(ApiKey.get_history_model().query.filter_by(service_id=service.id))
_delete_commit(Notification.query.filter_by(service=service))
_delete_commit(Job.query.filter_by(service=service))
_delete_commit(Template.query.filter_by(service=service))
_delete_commit(Template.get_history_model().query.filter_by(service_id=service.id))
verify_codes = VerifyCode.query.join(User).filter(User.id.in_([x.id for x in service.users]))
list(map(db.session.delete, verify_codes))
@@ -105,6 +107,7 @@ def delete_service_and_all_associated_db_objects(service):
users = [x for x in service.users]
map(service.users.remove, users)
[service.users.remove(x) for x in users]
_delete_commit(Service.get_history_model().query.filter_by(id=service.id))
db.session.delete(service)
db.session.commit()
list(map(db.session.delete, users))