
- Added comprehensive book management with CRUD operations - Implemented inventory tracking with stock management and reservations - Created order management system with status tracking - Integrated Stripe payment processing with payment intents - Added SQLite database with SQLAlchemy ORM and Alembic migrations - Implemented health check and API documentation endpoints - Added comprehensive error handling and validation - Configured CORS middleware for frontend integration
21 lines
959 B
Python
21 lines
959 B
Python
from sqlalchemy import Column, Integer, String, Float, Text, DateTime, Boolean
|
|
from sqlalchemy.sql import func
|
|
from app.db.base import Base
|
|
|
|
class Book(Base):
|
|
__tablename__ = "books"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
title = Column(String(255), nullable=False, index=True)
|
|
author = Column(String(255), nullable=False)
|
|
isbn = Column(String(13), unique=True, nullable=False, index=True)
|
|
description = Column(Text, nullable=True)
|
|
price = Column(Float, nullable=False)
|
|
category = Column(String(100), nullable=False)
|
|
publisher = Column(String(255), nullable=True)
|
|
publication_date = Column(DateTime, nullable=True)
|
|
pages = Column(Integer, nullable=True)
|
|
language = Column(String(50), default="English")
|
|
is_active = Column(Boolean, default=True)
|
|
created_at = Column(DateTime(timezone=True), server_default=func.now())
|
|
updated_at = Column(DateTime(timezone=True), onupdate=func.now()) |