Implementación inicial del sistema de automatización de redes sociales
- Estructura completa del proyecto con FastAPI - Modelos de base de datos (productos, servicios, posts, calendario, interacciones) - Publishers para X, Threads, Instagram, Facebook - Generador de contenido con DeepSeek API - Worker de Celery con tareas programadas - Dashboard básico con templates HTML - Docker Compose para despliegue - Documentación completa Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
90
app/models/service.py
Normal file
90
app/models/service.py
Normal file
@@ -0,0 +1,90 @@
|
||||
"""
|
||||
Modelo de Servicio - Servicios de consultoría de Consultoría AS.
|
||||
"""
|
||||
|
||||
from datetime import datetime
|
||||
from sqlalchemy import Column, Integer, String, Text, Boolean, DateTime, JSON
|
||||
from sqlalchemy.dialects.postgresql import ARRAY
|
||||
|
||||
from app.core.database import Base
|
||||
|
||||
|
||||
class Service(Base):
|
||||
"""Modelo para servicios de consultoría."""
|
||||
|
||||
__tablename__ = "services"
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
|
||||
# Información básica
|
||||
name = Column(String(255), nullable=False, index=True)
|
||||
description = Column(Text, nullable=False)
|
||||
short_description = Column(String(500), nullable=True) # Para posts
|
||||
|
||||
# Categorización
|
||||
category = Column(String(100), nullable=False, index=True)
|
||||
# Categorías: ia, automatizacion, desarrollo, iot, voip, crm, etc.
|
||||
|
||||
# Sectores objetivo
|
||||
target_sectors = Column(ARRAY(String), nullable=True)
|
||||
# Ejemplo: ["hoteles", "construccion", "logistica", "retail"]
|
||||
|
||||
# Beneficios y características
|
||||
benefits = Column(ARRAY(String), nullable=True)
|
||||
# Ejemplo: ["Ahorro de tiempo", "Reducción de errores", "24/7"]
|
||||
|
||||
features = Column(ARRAY(String), nullable=True)
|
||||
# Características técnicas del servicio
|
||||
|
||||
# Casos de éxito
|
||||
case_studies = Column(JSON, nullable=True)
|
||||
# Ejemplo: [{"client": "Hotel X", "result": "50% menos tiempo en reservas"}]
|
||||
|
||||
# Imágenes e íconos
|
||||
icon = Column(String(100), nullable=True) # Nombre del ícono
|
||||
images = Column(ARRAY(String), nullable=True)
|
||||
main_image = Column(String(500), nullable=True)
|
||||
|
||||
# Precios (opcional, puede ser "cotizar")
|
||||
price_range = Column(String(100), nullable=True) # "Desde $5,000 MXN"
|
||||
has_free_demo = Column(Boolean, default=False)
|
||||
|
||||
# SEO y marketing
|
||||
tags = Column(ARRAY(String), nullable=True)
|
||||
call_to_action = Column(String(255), nullable=True) # "Agenda una demo"
|
||||
|
||||
# Control de publicación
|
||||
is_active = Column(Boolean, default=True)
|
||||
is_featured = Column(Boolean, default=False)
|
||||
last_posted_at = Column(DateTime, nullable=True)
|
||||
|
||||
# Timestamps
|
||||
created_at = Column(DateTime, default=datetime.utcnow)
|
||||
updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow)
|
||||
|
||||
def __repr__(self):
|
||||
return f"<Service {self.name}>"
|
||||
|
||||
def to_dict(self):
|
||||
"""Convertir a diccionario."""
|
||||
return {
|
||||
"id": self.id,
|
||||
"name": self.name,
|
||||
"description": self.description,
|
||||
"short_description": self.short_description,
|
||||
"category": self.category,
|
||||
"target_sectors": self.target_sectors,
|
||||
"benefits": self.benefits,
|
||||
"features": self.features,
|
||||
"case_studies": self.case_studies,
|
||||
"icon": self.icon,
|
||||
"images": self.images,
|
||||
"main_image": self.main_image,
|
||||
"price_range": self.price_range,
|
||||
"has_free_demo": self.has_free_demo,
|
||||
"tags": self.tags,
|
||||
"call_to_action": self.call_to_action,
|
||||
"is_active": self.is_active,
|
||||
"is_featured": self.is_featured,
|
||||
"created_at": self.created_at.isoformat() if self.created_at else None
|
||||
}
|
||||
Reference in New Issue
Block a user