Files
AutonetSellCar/backend/app/models/notification.py
AutonetSellCar Deploy 1f0dcb1ddb Initial commit: AutonetSellCar platform with deployment system
- Frontend: Next.js 14 with TypeScript
- Backend: FastAPI with SQLAlchemy
- Agent: Carmodoo sync agent
- Deployment: Docker Compose based staging/production setup
- Scripts: Automated deployment with rollback support

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 13:24:39 +09:00

38 lines
1.3 KiB
Python

from sqlalchemy import Column, Integer, String, Boolean, DateTime, ForeignKey, Text
from sqlalchemy.orm import relationship
from sqlalchemy.sql import func
from ..database import Base
class Notification(Base):
"""User notifications"""
__tablename__ = "notifications"
id = Column(Integer, primary_key=True, index=True)
user_id = Column(Integer, ForeignKey("users.id"), nullable=False)
# Notification type: vehicle_recommended, shipping_update, withdrawal_processed,
# referral_reward, dealer_approved, share_purchased, system
notification_type = Column(String(50), nullable=False)
# Title and message (supports i18n keys or direct text)
title = Column(String(200), nullable=False)
message = Column(Text, nullable=False)
# Optional link to navigate when clicked
link = Column(String(500), nullable=True)
# Related entity (optional)
related_id = Column(Integer, nullable=True) # ID of related entity
related_type = Column(String(50), nullable=True) # Type: vehicle_request, purchased_vehicle, withdrawal, etc.
# Status
is_read = Column(Boolean, default=False)
read_at = Column(DateTime(timezone=True), nullable=True)
# Timestamps
created_at = Column(DateTime(timezone=True), server_default=func.now())
# Relationships
user = relationship("User", backref="notifications")