fix: resolve ambiguous order by vencimento error in portal financial and boletos endpoints
Build and Deploy (Gitea) / build-and-deploy (push) Successful in 2m2s Details

This commit is contained in:
Sidney 2026-05-31 18:07:07 -03:00
parent 438c175246
commit 7951787b16
1 changed files with 2 additions and 2 deletions

View File

@ -308,7 +308,7 @@ app.get('/api/portal/financeiro', authMiddleware, async (req, res) => {
TO_CHAR(data_pagamento, 'YYYY-MM-DD') as data_pagamento TO_CHAR(data_pagamento, 'YYYY-MM-DD') as data_pagamento
FROM alunos_cobrancas FROM alunos_cobrancas
WHERE aluno_id = $1 WHERE aluno_id = $1
ORDER BY vencimento ASC`, ORDER BY alunos_cobrancas.vencimento ASC`,
[req.user.studentId] [req.user.studentId]
); );
dbRows = rows || []; dbRows = rows || [];
@ -388,7 +388,7 @@ app.get('/api/portal/financeiro', authMiddleware, async (req, res) => {
app.get('/api/portal/boletos', authMiddleware, async (req, res) => { app.get('/api/portal/boletos', authMiddleware, async (req, res) => {
try { try {
const { rows } = await pool.query( const { rows } = await pool.query(
`SELECT *, TO_CHAR(vencimento, 'YYYY-MM-DD') as vencimento, TO_CHAR(data_pagamento, 'YYYY-MM-DD') as data_pagamento FROM alunos_cobrancas WHERE aluno_id = $1 ORDER BY vencimento ASC`, `SELECT *, TO_CHAR(vencimento, 'YYYY-MM-DD') as vencimento, TO_CHAR(data_pagamento, 'YYYY-MM-DD') as data_pagamento FROM alunos_cobrancas WHERE aluno_id = $1 ORDER BY alunos_cobrancas.vencimento ASC`,
[req.user.studentId] [req.user.studentId]
); );