app backend prima
This commit is contained in:
27
app/models/cliente.py
Normal file
27
app/models/cliente.py
Normal file
@@ -0,0 +1,27 @@
|
||||
from sqlalchemy import Column, Integer, String, DateTime, Boolean
|
||||
from sqlalchemy.orm import relationship
|
||||
from sqlalchemy.sql import func
|
||||
|
||||
from app.core.database import Base
|
||||
|
||||
|
||||
class Cliente(Base):
|
||||
"""Modello per i clienti che possiedono siti monitorati"""
|
||||
|
||||
__tablename__ = "clienti"
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
nome = Column(String(255), nullable=False)
|
||||
ragione_sociale = Column(String(255))
|
||||
codice_fiscale = Column(String(16), unique=True)
|
||||
partita_iva = Column(String(11), unique=True)
|
||||
email = Column(String(255), nullable=False)
|
||||
telefono = Column(String(20))
|
||||
indirizzo = Column(String(500))
|
||||
attivo = Column(Boolean, default=True)
|
||||
created_at = Column(DateTime(timezone=True), server_default=func.now())
|
||||
updated_at = Column(DateTime(timezone=True), onupdate=func.now())
|
||||
|
||||
# Relazioni
|
||||
siti = relationship("Sito", back_populates="cliente", cascade="all, delete-orphan")
|
||||
utenti = relationship("Utente", back_populates="cliente", cascade="all, delete-orphan")
|
||||
Reference in New Issue
Block a user