26 lines
629 B
Python
26 lines
629 B
Python
from sqlalchemy import Column, Integer, String, Text
|
|
|
|
from .base import BaseModel
|
|
|
|
|
|
class Task(BaseModel):
|
|
"""
|
|
Database model for tasks.
|
|
"""
|
|
|
|
__tablename__ = 'tasks'
|
|
|
|
id: int = Column(Integer, nullable=False, primary_key=True)
|
|
# TODO: created_at, modified_at
|
|
|
|
title: str = Column(String(255), nullable=False)
|
|
description: str = Column(Text, nullable=False, default='')
|
|
|
|
def to_dict(self) -> dict:
|
|
# TODO: Implement a generic to_dict() in the base model
|
|
return {
|
|
'id': self.id,
|
|
'title': self.title,
|
|
'description': self.description,
|
|
}
|