API and database models refactoring
This commit is contained in:
10
models/database/base.py
Normal file
10
models/database/base.py
Normal file
@@ -0,0 +1,10 @@
|
||||
from datetime import datetime
|
||||
from sqlalchemy import Column, DateTime
|
||||
from app.core.database import Base
|
||||
|
||||
class TimestampMixin:
|
||||
"""Mixin to add created_at and updated_at timestamps to models"""
|
||||
created_at = Column(DateTime, default=datetime.utcnow, nullable=False)
|
||||
updated_at = Column(
|
||||
DateTime, default=datetime.utcnow, onupdate=datetime.utcnow, nullable=False
|
||||
)
|
||||
Reference in New Issue
Block a user