from data.database import Messages
def get_messages():
"""Query the data base for messages and returns a container of database message objects"""
return Messages.select()
def create(messages):
"""Insert messages into the database."""
inserted = []
for message in messages:
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()