Пример #1
0
    def create(user, notebook_id, title, content):
        """ Create a new note """

        if len(title) > 32:
            return UnprocessableEntity(description="NOTE_TITLE_MAX_LENGTH")

        current_time = int(time.time())
        note = Note(notebook_id=notebook_id,
                    title=title,
                    content=content,
                    user_id=user.id,
                    created_at=current_time,
                    updated_at=current_time)

        note.save()

        return note.transform()