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/data/model/message.py

20 lines
525 B
Python
Raw Normal View History

from data.database import Messages
def get_messages():
2016-10-10 20:33:58 +00:00
"""Query the data base for messages and returns a container of database message objects"""
2016-10-10 16:55:00 +00:00
return Messages.select()
def create(messages):
2016-10-10 20:33:58 +00:00
"""Insert messages into the database."""
inserted = []
for message in messages:
2016-10-10 20:33:58 +00:00
inserted.append(Messages.create(content=message['content']))
return inserted
def delete_message(uuids):
"""Delete message from the database"""
if not uuids:
return
Messages.delete().where(Messages.uuid << uuids).execute()