
- Set up project structure with modular organization - Implement database models for users, organizations, clients, invoices - Create Alembic migration scripts for database setup - Implement JWT-based authentication and authorization - Create API endpoints for users, organizations, clients, invoices - Add PDF generation for invoices using ReportLab - Add comprehensive documentation in README
20 lines
619 B
Python
20 lines
619 B
Python
from typing import Any
|
|
from sqlalchemy import Column, Integer, DateTime
|
|
from sqlalchemy.ext.declarative import as_declarative, declared_attr
|
|
import datetime
|
|
|
|
|
|
@as_declarative()
|
|
class Base:
|
|
id: Any
|
|
__name__: str
|
|
|
|
# Generate tablename automatically
|
|
@declared_attr
|
|
def __tablename__(cls) -> str:
|
|
return cls.__name__.lower()
|
|
|
|
# Common columns for all models
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
created_at = Column(DateTime, default=datetime.datetime.utcnow)
|
|
updated_at = Column(DateTime, default=datetime.datetime.utcnow, onupdate=datetime.datetime.utcnow) |