This repository has been archived on 2020-03-24. You can view files and clone it, but cannot push or open issues or pull requests.
quay/endpoints/api/globalmessages_models_pre_oci.py

25 lines
707 B
Python
Raw Normal View History

from globalmessages_models_interface import GlobalMessageDataInterface, GlobalMessage
from data import model
class GlobalMessagePreOCI(GlobalMessageDataInterface):
def get_all_messages(self):
messages = model.message.get_messages()
return [self._message(m) for m in messages]
def create_message(self, content):
model.message.create([content])
def delete_message(self, uuid):
model.message.delete_message([uuid])
def _message(self, message_obj):
return GlobalMessage(
uuid=message_obj.uuid,
content=message_obj.content,
severity=message_obj.severity,
media_type_name=message_obj.media_type.name,
)
pre_oci_model = GlobalMessagePreOCI()