CARONTE v1.0 - Plataforma de Gestão Social
This commit is contained in:
6
backend/app/models/__init__.py
Normal file
6
backend/app/models/__init__.py
Normal file
@@ -0,0 +1,6 @@
|
||||
from app.models.usuario import Usuario
|
||||
from app.models.familia import Familia, MembroFamilia
|
||||
from app.models.falecido import Falecido
|
||||
from app.models.checklist import ChecklistItem
|
||||
from app.models.beneficio import Beneficio
|
||||
from app.models.documento import Documento
|
||||
16
backend/app/models/beneficio.py
Normal file
16
backend/app/models/beneficio.py
Normal file
@@ -0,0 +1,16 @@
|
||||
from sqlalchemy import Column, Integer, String, DateTime, ForeignKey, Float
|
||||
from sqlalchemy.sql import func
|
||||
from app.core.database import Base
|
||||
|
||||
class Beneficio(Base):
|
||||
__tablename__ = "beneficios"
|
||||
id = Column(Integer, primary_key=True, autoincrement=True)
|
||||
familia_id = Column(Integer, ForeignKey("familias.id"), nullable=False)
|
||||
falecido_id = Column(Integer, ForeignKey("falecidos.id"), nullable=False)
|
||||
tipo = Column(String, nullable=False) # fgts, pis, pensao_morte, seguro_vida, seguro_dpvat
|
||||
nome = Column(String, nullable=False)
|
||||
descricao = Column(String, nullable=True)
|
||||
status = Column(String, default="identificado") # identificado, em_processo, sacado
|
||||
valor_estimado = Column(Float, nullable=True)
|
||||
valor_sacado = Column(Float, nullable=True)
|
||||
created_at = Column(DateTime, server_default=func.now())
|
||||
19
backend/app/models/checklist.py
Normal file
19
backend/app/models/checklist.py
Normal file
@@ -0,0 +1,19 @@
|
||||
from sqlalchemy import Column, Integer, String, DateTime, ForeignKey, Text
|
||||
from sqlalchemy.sql import func
|
||||
from app.core.database import Base
|
||||
|
||||
class ChecklistItem(Base):
|
||||
__tablename__ = "checklist_items"
|
||||
id = Column(Integer, primary_key=True, autoincrement=True)
|
||||
familia_id = Column(Integer, ForeignKey("familias.id"), nullable=False)
|
||||
falecido_id = Column(Integer, ForeignKey("falecidos.id"), nullable=False)
|
||||
titulo = Column(String, nullable=False)
|
||||
descricao = Column(Text, nullable=True)
|
||||
fase = Column(String, nullable=False) # imediato, primeira_semana, 30_dias, 60_dias
|
||||
categoria = Column(String, nullable=False) # certidoes, inss, fgts, inventario, etc
|
||||
status = Column(String, default="pendente") # pendente, andamento, concluido
|
||||
prazo_dias = Column(Integer, nullable=True)
|
||||
ordem = Column(Integer, default=0)
|
||||
dependencia_id = Column(Integer, nullable=True)
|
||||
updated_at = Column(DateTime, server_default=func.now(), onupdate=func.now())
|
||||
created_at = Column(DateTime, server_default=func.now())
|
||||
14
backend/app/models/documento.py
Normal file
14
backend/app/models/documento.py
Normal file
@@ -0,0 +1,14 @@
|
||||
from sqlalchemy import Column, Integer, String, DateTime, ForeignKey
|
||||
from sqlalchemy.sql import func
|
||||
from app.core.database import Base
|
||||
|
||||
class Documento(Base):
|
||||
__tablename__ = "documentos"
|
||||
id = Column(Integer, primary_key=True, autoincrement=True)
|
||||
familia_id = Column(Integer, ForeignKey("familias.id"), nullable=False)
|
||||
falecido_id = Column(Integer, ForeignKey("falecidos.id"), nullable=True)
|
||||
tipo = Column(String, nullable=False) # procuracao, requerimento_fgts, peticao_pensao, alvara
|
||||
nome = Column(String, nullable=False)
|
||||
arquivo_path = Column(String, nullable=True)
|
||||
status = Column(String, default="gerado") # gerado, enviado, aprovado
|
||||
created_at = Column(DateTime, server_default=func.now())
|
||||
23
backend/app/models/falecido.py
Normal file
23
backend/app/models/falecido.py
Normal file
@@ -0,0 +1,23 @@
|
||||
from sqlalchemy import Column, Integer, String, DateTime, Date, ForeignKey, Float
|
||||
from sqlalchemy.sql import func
|
||||
from app.core.database import Base
|
||||
|
||||
class Falecido(Base):
|
||||
__tablename__ = "falecidos"
|
||||
id = Column(Integer, primary_key=True, autoincrement=True)
|
||||
familia_id = Column(Integer, ForeignKey("familias.id"), nullable=False)
|
||||
nome = Column(String, nullable=False)
|
||||
cpf = Column(String, nullable=True)
|
||||
data_nascimento = Column(Date, nullable=True)
|
||||
data_obito = Column(Date, nullable=False)
|
||||
causa_obito = Column(String, nullable=True)
|
||||
tipo_vinculo = Column(String, nullable=False) # empregado, aposentado, autonomo, servidor
|
||||
empregador = Column(String, nullable=True)
|
||||
tinha_carteira_assinada = Column(Integer, default=0)
|
||||
tinha_fgts = Column(Integer, default=0)
|
||||
era_aposentado = Column(Integer, default=0)
|
||||
tinha_seguro_vida = Column(Integer, default=0)
|
||||
tinha_imoveis = Column(Integer, default=0)
|
||||
tinha_veiculos = Column(Integer, default=0)
|
||||
salario_estimado = Column(Float, nullable=True)
|
||||
created_at = Column(DateTime, server_default=func.now())
|
||||
20
backend/app/models/familia.py
Normal file
20
backend/app/models/familia.py
Normal file
@@ -0,0 +1,20 @@
|
||||
from sqlalchemy import Column, Integer, String, DateTime, ForeignKey
|
||||
from sqlalchemy.sql import func
|
||||
from app.core.database import Base
|
||||
|
||||
class Familia(Base):
|
||||
__tablename__ = "familias"
|
||||
id = Column(Integer, primary_key=True, autoincrement=True)
|
||||
nome = Column(String, nullable=False)
|
||||
usuario_id = Column(Integer, ForeignKey("usuarios.id"), nullable=False)
|
||||
created_at = Column(DateTime, server_default=func.now())
|
||||
|
||||
class MembroFamilia(Base):
|
||||
__tablename__ = "membros_familia"
|
||||
id = Column(Integer, primary_key=True, autoincrement=True)
|
||||
familia_id = Column(Integer, ForeignKey("familias.id"), nullable=False)
|
||||
nome = Column(String, nullable=False)
|
||||
parentesco = Column(String, nullable=False)
|
||||
cpf = Column(String, nullable=True)
|
||||
telefone = Column(String, nullable=True)
|
||||
email = Column(String, nullable=True)
|
||||
12
backend/app/models/usuario.py
Normal file
12
backend/app/models/usuario.py
Normal file
@@ -0,0 +1,12 @@
|
||||
from sqlalchemy import Column, Integer, String, DateTime
|
||||
from sqlalchemy.sql import func
|
||||
from app.core.database import Base
|
||||
|
||||
class Usuario(Base):
|
||||
__tablename__ = "usuarios"
|
||||
id = Column(Integer, primary_key=True, autoincrement=True)
|
||||
nome = Column(String, nullable=False)
|
||||
email = Column(String, unique=True, nullable=False)
|
||||
senha_hash = Column(String, nullable=False)
|
||||
telefone = Column(String, nullable=True)
|
||||
created_at = Column(DateTime, server_default=func.now())
|
||||
Reference in New Issue
Block a user