from datetime import datetime from sqlalchemy import DateTime, Sequence, LargeBinary, JSON, func from sqlalchemy_serializer import SerializerMixin from ..ext.database import db from flask_login import UserMixin class User(db.Model, UserMixin): __tablename__ = 'users' id = db.Column(db.Integer, primary_key=True, nullable=False ) nome = db.Column(db.String(128), nullable=False) sobrenome = db.Column(db.String(128), nullable=False) email = db.Column(db.String(128), nullable=False) username = db.Column(db.String(128), nullable=False) password = db.Column(db.String(128), nullable=False) dt_criacao = db.Column(DateTime, default=datetime.now(), nullable=False) status = db.Column(db.String(128), nullable=False) user_type = db.Column(db.String(128), nullable=False) class Vagas(db.Model, SerializerMixin): __tablename__ = 'vagas' id = db.Column(db.Integer, primary_key=True, autoincrement=True, nullable=False ) cargo = db.Column(db.String(128), nullable=False) departamento = db.Column(db.String(128), nullable=False) local = db.Column(db.String(128), nullable=False) nivel = db.Column(db.String(128), nullable=False) escopo_vaga = db.Column(db.Text, nullable=False) requisitos = db.Column(db.Text, nullable=False) qualificacoes = db.Column(db.Text, nullable=False) info_adicionais = db.Column(db.Text, nullable=True) data_abertura = db.Column(db.Date, default=datetime.now(), nullable=False) data_fechamento = db.Column(db.Date, nullable=True) status = db.Column(db.String(128), default='ativo', nullable=False) class Candidatos(db.Model, SerializerMixin): __tablename__ = 'candidatos' id = db.Column(db.Integer, primary_key=True, autoincrement=True, nullable=False ) vaga_id = db.Column(db.Integer, db.ForeignKey('vagas.id'), nullable=False) vaga = db.relationship('Vagas', backref='candidatos') nome = db.Column(db.String(128), nullable=True) idade = db.Column(db.String(128), nullable=True) email = db.Column(db.String(128), nullable=True) telefone = db.Column(db.String(128), nullable=True) localizacao = db.Column(db.String(128), nullable=True) experiencia = db.Column(JSON, nullable=True) educacao = db.Column(JSON, nullable=True) habilidades = db.Column(JSON, nullable=True) curriculo_pdf = db.Column(LargeBinary(length=(2**32)-1), nullable=False) status = db.Column(db.String(128), default='CurrĂ­culo enviado', nullable=False) data_cadastro = db.Column(DateTime, nullable=False, server_default=func.now()) data_encerramento = db.Column(DateTime, nullable=True) motivo_encerramento = db.Column(db.Text, nullable=True) resumo_ia = db.Column(db.Text, nullable=True) avaliacao_ia = db.Column(db.Text, nullable=True)