mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-03 01:41:05 -05:00
New table to store the inbound api information for a service. The table is versioned.
There is a new endpoint to create the inbound api and one to update it.
This commit is contained in:
@@ -1,10 +1,26 @@
|
||||
from app import db
|
||||
from datetime import datetime
|
||||
|
||||
from app import db, create_uuid
|
||||
from app.authentication.utils import generate_secret
|
||||
from app.dao.dao_utils import transactional
|
||||
from app.dao.dao_utils import transactional, version_class
|
||||
from app.models import ServiceInboundApi
|
||||
|
||||
|
||||
@transactional
|
||||
@version_class(ServiceInboundApi)
|
||||
def save_service_inbound_api(service_inbound_api):
|
||||
|
||||
service_inbound_api.id = create_uuid()
|
||||
service_inbound_api.created_at == datetime.utcnow()
|
||||
service_inbound_api.bearer_token = generate_secret(service_inbound_api.bearer_token)
|
||||
db.session.add(service_inbound_api)
|
||||
|
||||
|
||||
@transactional
|
||||
@version_class(ServiceInboundApi)
|
||||
def reset_service_inbound_api(service_inbound_api):
|
||||
db.session.add(service_inbound_api)
|
||||
|
||||
|
||||
def get_service_inbound_api(service_inbound_api_id, service_id):
|
||||
return ServiceInboundApi.query.filter_by(id=service_inbound_api_id,
|
||||
service_id=service_id).one()
|
||||
|
||||
Reference in New Issue
Block a user