- Changed the `baileys` dependency source from `EvolutionAPI` to `WhiskeySockets`.
- Updated the start and development server scripts to use `tsx` instead of `tsnd`.
- Added `tsx` as a new dependency and removed `ts-node-dev`.
- Updated `music-metadata` to version 11.7.1 and adjusted its dependencies.
- Cleaned up the package-lock by removing unused modules and adding new ones like `fflate` and `uint8array-extras`.
Problema:
O método fetchChats estava aplicando a lógica de paginação duas vezes, causando resultados vazios ao usar o parâmetro skip com valores maiores que 0.
Causa Raiz:
A query SQL já aplica LIMIT e OFFSET corretamente
O código JavaScript então aplica .slice(skip, skip + take) nos resultados já paginados
Este "offset duplo" faz com que o slice tente acessar posições do array que não existem
Exemplo do bug:
Requisição: {"take": 10, "skip": 10}
SQL: LIMIT 10 OFFSET 10 → retorna chats 11-20 (10 itens)
JS: .slice(10, 20) → tenta pegar posições 10-20 de um array com apenas 10 itens
Resultado: [] (array vazio)
Solução:
Removida a lógica de paginação JavaScript redundante (linhas 796-800) já que a query SQL já manipula a paginação corretamente com LIMIT e OFFSET.
Arquivos Alterados:
src/api/services/channel.service.ts
Testes:
✅ {"take": 10, "skip": 0} - Retorna os primeiros 10 chats
✅ {"take": 10, "skip": 10} - Retorna chats 11-20 (anteriormente retornava [])
✅ {"take": 5, "skip": 15} - Retorna chats 16-20 (anteriormente retornava [])
Impacto:
Corrige a funcionalidade de paginação para todos os valores de skip > 0
Mantém compatibilidade com versões anteriores
Sem mudanças que quebrem implementações existentes
### Fix: Add support for templateMessage media in getBase64FromMediaMessage
#### What this does
Adds support to download media from `templateMessage` structures in `getBase64FromMediaMessage`, by checking for `hydratedTemplate` and `hydratedFourRowTemplate`.
#### Why it's needed
Currently, media inside templates (e.g. `imageMessage`, `videoMessage`, `documentMessage`) is not processed by the method, which leads to errors or media being skipped.
#### How it works
If a `templateMessage` is detected, the code looks into the inner hydrated template and assigns the correct `mediaMessage` and `mediaType`. Then it proceeds as usual with the download logic.
#### Example message
```json
{
"message": {
"templateMessage": {
"hydratedTemplate": {
"imageMessage": {
"mimetype": "image/jpeg",
"fileLength": 123456,
"url": "https://..."
}
}
}
}
}
- [Baileys] Trocar @lids em remoteJid por senderPn em todos os serviços;
- [Baileys] Adicionar valor @lid recebido em remoteJid para previousRemoteJid (Posteriormente utilizasse em ChatwootService);
- Minors fixes;
- Add pgbouncer service to handle connection pooling
- Update database connection URIs to support direct and pooled connections
- Optimize postgres configuration with better memory settings
- Update prisma schema to support directUrl connection
Delete prisma/mysql-migrations/1707735894523_add_wavoip_token_to_settings_table, which executes before the initial Setting table is created and breaks fresh MySQL installs.
The later migration 20250214181954_add_wavoip_token_column, line 145, already adds the column correctly, so keeping only that directory guarantees a clean deploy.