mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-18 16:12:32 -05:00
Moved creating queue name to model
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import uuid
|
||||
|
||||
from sqlalchemy import UniqueConstraint
|
||||
|
||||
from . import db
|
||||
@@ -84,7 +86,7 @@ class Service(db.Model):
|
||||
secondary=user_to_service,
|
||||
backref=db.backref('user_to_service', lazy='dynamic'))
|
||||
restricted = db.Column(db.Boolean, index=False, unique=False, nullable=False)
|
||||
queue_name = db.Column(UUID(as_uuid=True))
|
||||
queue_name = db.Column(UUID(as_uuid=True), default=uuid.uuid4)
|
||||
|
||||
|
||||
class ApiKey(db.Model):
|
||||
|
||||
@@ -28,9 +28,6 @@ def create_service():
|
||||
# I believe service is already added to the session but just needs a
|
||||
# db.session.commit
|
||||
try:
|
||||
# add service name to here or in dao?
|
||||
import uuid
|
||||
service.queue_name = uuid.uuid4()
|
||||
save_model_service(service)
|
||||
except DAOException as e:
|
||||
return jsonify(result="error", message=str(e)), 400
|
||||
|
||||
Reference in New Issue
Block a user