Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Us11 selecionar tipo de documento financeiro #5

Merged
merged 3 commits into from
Jan 26, 2025
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
4 changes: 2 additions & 2 deletions src/Controllers/financialMovementsController.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
const FinancialMovements = require("../Models/financialMovementsSchema");

const validateCPF = (cpf) => {

Check failure on line 3 in src/Controllers/financialMovementsController.js

View workflow job for this annotation

GitHub Actions / lint

'validateCPF' is assigned a value but never used
return /\d{3}\.\d{3}\.\d{3}-\d{2}/.test(cpf);
};


Check failure on line 7 in src/Controllers/financialMovementsController.js

View workflow job for this annotation

GitHub Actions / lint

Delete `⏎`
const createFinancialMovements = async (req, res) => {
try {
console.log("Dados recebidos:", req.body);

Check warning on line 10 in src/Controllers/financialMovementsController.js

View workflow job for this annotation

GitHub Actions / lint

Unexpected console statement
const financialMovementsData = req.body.financialMovementsData || {};
if (!financialMovementsData) {
return res.status(400).send({ error: "No data provided" });
}
if (!validateCPF(financialMovementsData.cpFCnpj)) {
/* if (!validateCPF(financialMovementsData.cpFCnpj)) {
return res.status(400).send({ error: "Invalid CPF" });
}
} */
if (!financialMovementsData.contaOrigem) {

Check failure on line 18 in src/Controllers/financialMovementsController.js

View workflow job for this annotation

GitHub Actions / lint

Delete `··`
throw new Error("Database error");

Check failure on line 19 in src/Controllers/financialMovementsController.js

View workflow job for this annotation

GitHub Actions / lint

Delete `·`
}

// Criação da movimentação financeira
Expand All @@ -27,7 +27,7 @@

res.status(201).send(financialMovement);
} catch (error) {
console.error("Error creating financial movement:", error.message);

Check warning on line 30 in src/Controllers/financialMovementsController.js

View workflow job for this annotation

GitHub Actions / lint

Unexpected console statement
return res.status(400).send({ error: error.message });
}
};
Expand Down
5 changes: 5 additions & 0 deletions src/Models/financialMovementsSchema.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const financialMovementsSchema = new mongoose.Schema({
tipoDocumento: {
type: String,
required: true,
default: " ",
},
cpFCnpj: {
type: String,
Expand Down Expand Up @@ -77,6 +78,10 @@ const financialMovementsSchema = new mongoose.Schema({
type: Date,
default: Date.now,
},
gastoFixo:{
type: Boolean,
default: false,
}
});

const financialMovements = mongoose.model(
Expand Down
Loading