Subir todos los cambios recientes a la rama principal
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
|
||||
"""
|
||||
Category Model - ServiceManagerWeb
|
||||
"""
|
||||
from sqlalchemy import String, Text, Boolean, ForeignKey
|
||||
from sqlalchemy import String, Text, Boolean, ForeignKey, DateTime
|
||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
from sqlalchemy.dialects.postgresql import UUID
|
||||
from sqlalchemy.sql import func
|
||||
from typing import List, Optional
|
||||
import uuid
|
||||
|
||||
from app.core.database import Base
|
||||
|
||||
class Category(Base):
|
||||
__tablename__ = "categories"
|
||||
__tablename__ = "ticket_categories"
|
||||
|
||||
name: Mapped[str] = mapped_column(String(100), nullable=False)
|
||||
description: Mapped[Optional[str]] = mapped_column(Text)
|
||||
@@ -20,6 +20,10 @@ class Category(Base):
|
||||
# Optional: Tenant specific categories?
|
||||
tenant_id: Mapped[Optional[uuid.UUID]] = mapped_column(UUID(as_uuid=True), ForeignKey("tenants.id", ondelete="CASCADE"), nullable=True)
|
||||
|
||||
# Timestamp columns
|
||||
created_at: Mapped[Optional[DateTime]] = mapped_column(DateTime(timezone=True), server_default=func.now())
|
||||
updated_at: Mapped[Optional[DateTime]] = mapped_column(DateTime(timezone=True), onupdate=func.now())
|
||||
|
||||
# Relationships
|
||||
tickets: Mapped[List["Ticket"]] = relationship("Ticket", back_populates="category")
|
||||
tenant: Mapped["Tenant"] = relationship("Tenant") # Assuming Tenant model is imported
|
||||
|
||||
29
backend/app/models/client.py
Normal file
29
backend/app/models/client.py
Normal file
@@ -0,0 +1,29 @@
|
||||
from sqlalchemy import Column, Integer, String
|
||||
from app.core.database import Base
|
||||
|
||||
class Client(Base):
|
||||
__tablename__ = "clients"
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
clave = Column(String, nullable=False)
|
||||
tipo_cliente = Column(String, nullable=False)
|
||||
nombre = Column(String, nullable=False)
|
||||
pais = Column(String, nullable=False)
|
||||
estado = Column(String, nullable=False)
|
||||
ciudad = Column(String, nullable=False)
|
||||
direccion = Column(String, nullable=False)
|
||||
numero_ext = Column(String, nullable=True)
|
||||
cp = Column(String, nullable=True)
|
||||
colonia = Column(String, nullable=True)
|
||||
lada = Column(String, nullable=True)
|
||||
telefono1 = Column(String, nullable=True)
|
||||
telefono2 = Column(String, nullable=True)
|
||||
tel_directo = Column(String, nullable=True)
|
||||
ext = Column(String, nullable=True)
|
||||
fax = Column(String, nullable=True)
|
||||
horario = Column(String, nullable=True)
|
||||
pagina = Column(String, nullable=True)
|
||||
correo = Column(String, nullable=True)
|
||||
medio_publicidad = Column(String, nullable=True)
|
||||
nacionalidad = Column(String, nullable=True)
|
||||
logo = Column(String, nullable=True)
|
||||
@@ -9,6 +9,8 @@ import enum
|
||||
import uuid
|
||||
|
||||
from app.core.database import Base
|
||||
from app.models.system import System
|
||||
from app.models.category import Category
|
||||
|
||||
class TicketStatus(str, enum.Enum):
|
||||
NEW = "NEW"
|
||||
@@ -43,8 +45,8 @@ class Ticket(Base):
|
||||
created_by: Mapped[uuid.UUID] = mapped_column(UUID(as_uuid=True), ForeignKey("users.id"), nullable=False)
|
||||
assigned_to: Mapped[Optional[uuid.UUID]] = mapped_column(UUID(as_uuid=True), ForeignKey("users.id"), nullable=True)
|
||||
|
||||
system_id: Mapped[Optional[uuid.UUID]] = mapped_column(UUID(as_uuid=True), ForeignKey("systems.id"), nullable=True)
|
||||
category_id: Mapped[Optional[uuid.UUID]] = mapped_column(UUID(as_uuid=True), ForeignKey("categories.id"), nullable=True)
|
||||
affected_system_id: Mapped[Optional[uuid.UUID]] = mapped_column(UUID(as_uuid=True), ForeignKey("systems.id"), nullable=True)
|
||||
category_id: Mapped[Optional[uuid.UUID]] = mapped_column(UUID(as_uuid=True), ForeignKey("ticket_categories.id"), nullable=True)
|
||||
|
||||
# Relationships
|
||||
tenant: Mapped["Tenant"] = relationship("Tenant", back_populates="tickets")
|
||||
|
||||
@@ -13,6 +13,7 @@ import uuid
|
||||
from datetime import datetime
|
||||
|
||||
from app.core.database import Base
|
||||
from app.models.ticket import Ticket
|
||||
|
||||
|
||||
class UserRole(str, enum.Enum):
|
||||
|
||||
Reference in New Issue
Block a user