From 00b7dbc2f326c93a010776fda2e1837e1396e030 Mon Sep 17 00:00:00 2001
From: ems19 <ems19@inf.ufpr.br>
Date: Fri, 14 Feb 2025 10:00:03 -0300
Subject: [PATCH] [FIX] Unused and wrong files removed

---
 .gitignore                             |  4 +++
 docker-compose.yml                     | 11 ------
 entrypoint.sh                          |  5 ---
 gulpfile.babel.js                      | 23 ++++++++----
 gulpfile.template.js                   | 20 -----------
 src/libs/routes_v1/schoolProfessors.js | 50 ++++++++++++++++++++++++++
 6 files changed, 70 insertions(+), 43 deletions(-)
 delete mode 100644 docker-compose.yml
 delete mode 100644 entrypoint.sh
 delete mode 100644 gulpfile.template.js
 create mode 100644 src/libs/routes_v1/schoolProfessors.js

diff --git a/.gitignore b/.gitignore
index 2d98beea..2fa21185 100644
--- a/.gitignore
+++ b/.gitignore
@@ -28,3 +28,7 @@ package-lock.json
 Dockerfile
 DockerfileAntigo
 src/libs/db/postgres.js
+docker-compose.yml
+entrypoint.sh
+gulpfile.template.js
+
diff --git a/docker-compose.yml b/docker-compose.yml
deleted file mode 100644
index 85266ff9..00000000
--- a/docker-compose.yml
+++ /dev/null
@@ -1,11 +0,0 @@
-services:
-  simcaq-node:
-    container_name: simcaq-node
-    build: .
-    ports:
-      - '3000:3000'
-    develop:
-      watch:
-        - action: sync
-          path: .
-          target: /API
diff --git a/entrypoint.sh b/entrypoint.sh
deleted file mode 100644
index 04db5192..00000000
--- a/entrypoint.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/bash
-echo "Starting simcaq-node"
-gulp watch &> /dev/null &
-cd build
-NODE_ENV=production gulp run
diff --git a/gulpfile.babel.js b/gulpfile.babel.js
index 1d0724e1..7c8b7418 100644
--- a/gulpfile.babel.js
+++ b/gulpfile.babel.js
@@ -43,12 +43,12 @@ gulp.task('compile', ['lint'], () => {
     gulp.src('src/**/*.js')
     .pipe(cache.filter())       // cache source files
     .pipe(babel())      // compile only modified files
-    .pipe(cache.cache())        // cache compiled files
+    // .pipe(cache.cache())        // cache compiled files
     .pipe(gulp.dest('build'));  // move compiled files to build directory
 });
 
 gulp.task('build', ['compile'], () => {
-    var filesToCopy = [ 'config.json', 'package.json', '.eslintignore', '.eslintrc.json' ];
+    var filesToCopy = [ 'config.json', 'package.json' ];
     // copy configuration file to build directory
     gulp.src(filesToCopy)
     .pipe(gulp.dest('build'));
@@ -93,16 +93,25 @@ gulp.task('test', ['pre-test'], () => {
     });
 });
 
-gulp.task('watch', () => {
+gulp.task('watch', ['compile'], () => {
     console.log('Watching source directory for changes');
-    return gulp.watch('src/**/*.js').on('change', () => {
+    gulp.watch('src/**/*.js').on('change', () => {
         console.log('Recompiling source');
         gulp.start('compile');
         console.log('Source recompilation done');
     });
 });
 
-gulp.task('default', () => {
-    console.log("Não execuatar apenas gulp, execute da forma:");
-    console.log("\t\tgulp <task>");
+gulp.task('run', () => {
+    process.chdir('build');
+    nodemon({
+        script: 'server.js',
+        tasks: ['watch'],
+        ignore: ["test/test.js", "gulpfile.babel.js"],
+        ext: 'js html json',
+        env: { 'NODE_ENV': process.env.NODE_ENV }
+    });
 });
+
+gulp.task('default', ['run']);
+
diff --git a/gulpfile.template.js b/gulpfile.template.js
deleted file mode 100644
index 3de679df..00000000
--- a/gulpfile.template.js
+++ /dev/null
@@ -1,20 +0,0 @@
-const gulp = require('gulp');
-
-const nodemon = require('gulp-nodemon');
-
-gulp.task('run', () => {
-    // process.chdir('build');
-    nodemon({
-        script: 'server.js',
-        // tasks: ['watch'],
-        ignore: ["test/test.js", "gulpfile.babel.js"],
-        ext: 'js html json',
-        env: { 'NODE_ENV': process.env.NODE_ENV }
-    });
-});
-
-gulp.task('default', () => {
-    console.log("Não execuatar apenas gulp, execute da forma:");
-    console.log("\t\tgulp <task>");
-});
-
diff --git a/src/libs/routes_v1/schoolProfessors.js b/src/libs/routes_v1/schoolProfessors.js
new file mode 100644
index 00000000..8e80d2d1
--- /dev/null
+++ b/src/libs/routes_v1/schoolProfessors.js
@@ -0,0 +1,50 @@
+/*
+Copyright (C) 2024 Centro de Computacao Cientifica e Software Livre
+Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
+
+This file is part of simcaq-node.
+
+simcaq-node is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+simcaq-node is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with simcaq-node.  If not, see <https://www.gnu.org/licenses/>.
+*/
+
+const express = require('express');
+
+const SchoolProfessorsApp = express.Router();
+
+const libs = `${process.cwd()}/libs`;
+
+const squel = require('squel');
+
+const query = require(`${libs}/middlewares/query`).query;
+
+const response = require(`${libs}/middlewares/response`);
+
+const ReqQueryFields = require(`${libs}/middlewares/reqQueryFields`);
+
+const id2str = require(`${libs}/middlewares/id2str`);
+
+const config = require(`${libs}/config`); 
+
+const cache = require('apicache').options({ debug: config.debug, statusCodes: {include: [200]} }).middleware;
+
+let rqf = new ReqQueryFields();
+
+SchoolProfessorsApp.use(cache('15 day'));
+
+SchoolProfessorsApp.get('/', (req, res, next) => {
+    req.sql.from('pnad_novo')
+    .field('sum(num_doc_ed_basica)', 'escola_agregada')
+    next();
+}, query, response('years'));
+
-- 
GitLab