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