Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ SMTP_USER="seu-email@gmail.com"
SMTP_PASS="sua-senha-de-app-de-16-digitos"
SMTP_FROM="Sistema HCF <no-reply@hcf.com>"

URL_PAINEL=http://localhost:5173/
PAINEL_BASE_URL=http://localhost:5173
180 changes: 91 additions & 89 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,91 +1,93 @@
{
"name": "hcf-api",
"version": "0.1.1",
"description": "Projeto para construção da API para o sistema do Herbário da UTFPR",
"main": "dist/app/index.js",
"author": "Elaine Sangali <e.nani@gmail.com>",
"license": "MIT",
"private": true,
"engines": {
"node": "^22"
},
"scripts": {
"migration:create": "tsx --env-file=.env src/database/cli.ts migration:create",
"migration:apply": "tsx --env-file=.env src/database/cli.ts migration:apply",
"tsc:check": "tsc --noEmit",
"lint:eslint": "eslint --cache",
"lint": "run-p tsc:check lint:eslint",
"clean": "rimraf dist",
"build:app": "babel -d ./dist -x '.js,.ts,.tsx' --copy-files --no-copy-ignored ./src",
"start": "nodemon --ext 'js,ts,tsx' --exec babel-node --extensions '.js,.ts,.tsx' ./src/index.js",
"build": "run-s clean build:app",
"test": "vitest --run",
"test:coverage": "vitest --run --coverage",
"prepare": "husky",
"audit": "npm audit --audit-level=moderate",
"audit:fix": "npm audit fix"
},
"dependencies": {
"axios": "1.13.2",
"bcrypt": "6.0.0",
"body-parser": "2.2.0",
"commander": "14.0.2",
"cors": "2.8.5",
"date-fns": "4.1.0",
"dotenv": "17.2.3",
"ejs": "^2.6.1",
"express": "5.1.0",
"express-rate-limit": "8.2.1",
"express-validator": "7.3.0",
"fast-csv": "5.0.5",
"helmet": "8.1.0",
"jsonwebtoken": "9.0.2",
"knex": "3.1.0",
"moment": "^2.24.0",
"moment-timezone": "^0.5.21",
"morgan": "1.10.1",
"multer": "2.0.2",
"mysql2": "3.15.3",
"nodemailer": "7.0.10",
"puppeteer": "24.28.0",
"q": "1.5.1",
"react": "19.2.0",
"react-dom": "19.2.0",
"request": "2.88.2",
"sequelize": "^4.38.0",
"swagger-jsdoc": "6.2.8",
"swagger-ui-express": "5.0.1",
"throttled-queue": "3.0.0",
"tsx": "4.20.6",
"uuid": "13.0.0"
},
"devDependencies": {
"@babel/cli": "7.28.3",
"@babel/core": "7.28.5",
"@babel/node": "7.28.0",
"@babel/plugin-proposal-class-properties": "7.18.6",
"@babel/preset-env": "7.28.5",
"@babel/preset-react": "7.28.5",
"@babel/preset-typescript": "7.28.5",
"@eslint/js": "9.39.1",
"@stylistic/eslint-plugin": "5.5.0",
"@types/express": "5.0.5",
"@types/react": "19.2.2",
"@types/react-dom": "19.2.2",
"@vitest/coverage-v8": "4.0.7",
"babel-plugin-module-resolver": "5.0.2",
"chai": "6.2.0",
"chai-http": "^5.1.2",
"eslint": "9.39.1",
"eslint-plugin-import-helpers": "2.0.1",
"globals": "16.5.0",
"husky": "9.1.7",
"jiti": "2.6.1",
"nodemon": "3.1.10",
"npm-run-all": "4.1.5",
"rimraf": "6.1.2",
"typescript": "5.9.3",
"typescript-eslint": "8.46.3",
"vitest": "4.0.7"
}
"name": "hcf-api",
"version": "0.1.1",
"description": "Projeto para construção da API para o sistema do Herbário da UTFPR",
"main": "dist/app/index.js",
"author": "Elaine Sangali <e.nani@gmail.com>",
"license": "MIT",
"private": true,
"engines": {
"node": "^22"
},
"scripts": {
"migration:create": "tsx --env-file=.env src/database/cli.ts migration:create",
"migration:apply": "tsx --env-file=.env src/database/cli.ts migration:apply",
"typescript:check": "tsc --noEmit",
"lint:eslint": "eslint --cache",
"lint": "run-p typescript:check lint:eslint",
"clean": "rimraf dist",
"build:app": "babel -d ./dist -x '.js,.ts,.tsx' --copy-files --no-copy-ignored ./src",
"start": "nodemon --ext 'js,ts,tsx' --exec babel-node --extensions '.js,.ts,.tsx' ./src/index.js",
"build": "run-s clean build:app",
"test": "vitest --run",
"test:coverage": "vitest --run --coverage",
"prepare": "husky",
"audit": "npm audit --audit-level=moderate",
"audit:fix": "npm audit fix"
},
"dependencies": {
"@types/pg": "^8.15.6",
"axios": "1.13.2",
"bcrypt": "6.0.0",
"body-parser": "2.2.0",
"commander": "14.0.2",
"cors": "2.8.5",
"date-fns": "4.1.0",
"dotenv": "17.2.3",
"ejs": "^2.6.1",
"express": "5.1.0",
"express-rate-limit": "8.2.1",
"express-validator": "7.3.0",
"fast-csv": "5.0.5",
"helmet": "8.1.0",
"jsonwebtoken": "9.0.2",
"knex": "3.1.0",
"moment": "^2.24.0",
"moment-timezone": "^0.5.21",
"morgan": "1.10.1",
"multer": "2.0.2",
"mysql2": "3.15.3",
"nodemailer": "7.0.10",
"pg": "^8.16.3",
"puppeteer": "24.28.0",
"q": "1.5.1",
"react": "19.2.0",
"react-dom": "19.2.0",
"request": "2.88.2",
"sequelize": "^4.38.0",
"swagger-jsdoc": "6.2.8",
"swagger-ui-express": "5.0.1",
"throttled-queue": "3.0.0",
"tsx": "4.20.6",
"uuid": "13.0.0"
},
"devDependencies": {
"@babel/cli": "7.28.3",
"@babel/core": "7.28.5",
"@babel/node": "7.28.0",
"@babel/plugin-proposal-class-properties": "7.18.6",
"@babel/preset-env": "7.28.5",
"@babel/preset-react": "7.28.5",
"@babel/preset-typescript": "7.28.5",
"@eslint/js": "9.39.1",
"@stylistic/eslint-plugin": "5.5.0",
"@types/express": "5.0.5",
"@types/react": "19.2.2",
"@types/react-dom": "19.2.2",
"@vitest/coverage-v8": "4.0.7",
"babel-plugin-module-resolver": "5.0.2",
"chai": "6.2.0",
"chai-http": "^5.1.2",
"eslint": "9.39.1",
"eslint-plugin-import-helpers": "2.0.1",
"globals": "16.5.0",
"husky": "9.1.7",
"jiti": "2.6.1",
"nodemon": "3.1.10",
"npm-run-all": "4.1.5",
"rimraf": "6.1.2",
"typescript": "5.9.3",
"typescript-eslint": "8.46.3",
"vitest": "4.0.7"
}
}
27 changes: 9 additions & 18 deletions src/controllers/fichas-tombos-controller.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import moment from 'moment-timezone';
import path from 'path';

import { converteDecimalParaGMSSinal } from '~/helpers/coordenadas';
import { converteDecimalParaGrausMinutosSegundos } from '~/helpers/coordenadas';

// import identificador from '~/routes/identificador';

Expand Down Expand Up @@ -218,25 +218,16 @@ export default function fichaTomboController(request, response, next) {
});
})
.then(async resultado => {
const { tombo, identificacao, fotos } = resultado;
// IMPORTANTE: Ao mexerem na ficha tombo, deixem os
// campos como opcionais, pois a ficha pode ser gerada
// mesmo sem possuirem todos os dados preenchidos no tombo

// await Subfamilia.findAll({
// where: {
// familia_id: dadosTombo.familia?.id,
// },
// include: [
// {
// model: Autor,
// attributes: ['id', 'nome'],
// as: 'autor',
// },
// ],
// });
const { tombo, identificacao, fotos } = resultado;

const coletores = `${!!tombo?.coletore?.nome !== false ? tombo?.coletore?.nome?.concat(' ') : ''}${tombo?.coletor_complementar ? tombo.coletor_complementar?.complementares : ''}`;

const localColeta = tombo.local_coleta;
const cidade = localColeta.cidade || '';
const localColeta = tombo?.local_coleta;
const cidade = localColeta?.cidade || '';
const estado = cidade?.estado || '';
const pais = estado?.pais || '';

Expand Down Expand Up @@ -265,8 +256,8 @@ export default function fichaTomboController(request, response, next) {
tombo: {
...tombo,
coletores,
latitude: converteDecimalParaGMSSinal(tombo.latitude, true),
longitude: converteDecimalParaGMSSinal(tombo.longitude, true),
latitude: tombo.latitude && converteDecimalParaGrausMinutosSegundos(tombo.latitude, true, true),
longitude: tombo.longitude && converteDecimalParaGrausMinutosSegundos(tombo.longitude, false, true),
data_tombo: formataDataSaida(tombo.data_tombo),
data_coleta: formataColunasSeparadas(tombo.data_coleta_dia, tombo.data_coleta_mes, tombo.data_coleta_ano),
},
Expand Down
Loading
Loading