Skip to content

Commit f5e4081

Browse files
author
Jhon
committed
feat(backend): ajuste na busca por ultimas compras
1 parent f58520a commit f5e4081

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ NFCe e o sistema irá buscar os dados e salvar no banco de dados para posteriore
3636
- `/start` - Inicia uma nova conversa com o chatbot
3737
- `/nfce` - Inicia o processo de salvar uma NFCe no banco de dados, aqui temos a possibilidade de processar tanto um link quanto um QR-Code. No final, perguntamos se deseja salvar uma movimentação de despesa no Finanças na Mão.
3838
- `/month` - Relatório do mês atual
39-
- `/lastpurchase` - Relatório da última compra
39+
- `/last_purchase` - Relatório da última compra
4040
- `/end` - Finaliza a conversa com o chatbot
4141

4242
## Acessos

backend/app/Modules/ChatBot/Controller/ChatBotController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public function __invoke(Request $request): JsonResponse
7979
return ResponseChat::responseChat($status, $chatId);
8080
}
8181

82-
if ($message === '/lastpurchase') {
82+
if ($message === '/last_purchase') {
8383
$this->lastPurchaseChatUseCase->execute($chatId);
8484
return ResponseChat::responseChat(ResponseChatEnum::FinishChat, $chatId);
8585
}

backend/app/Modules/ChatBot/UseCase/LastPurchaseChat/LastPurchaseChatUseCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public function execute(string $chatId): void
1717
{
1818
Log::info('Buscando últimas compras...');
1919
$lastPurchase = $this->getLastPurchaseUseCase->execute();
20-
if (empty($lastPurchase)) {
20+
if (empty($lastPurchase['purchase'])) {
2121
ResponseChat::interactWithUser($chatId, '😞 Poxa, não encontrei nenhuma compra 😞');
2222
}
2323
ResponseChat::interactWithUser($chatId, $this->formatToUser($lastPurchase));

backend/app/Modules/ChatBot/UseCase/StartChat/StartChatUseCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ protected function getMenuOptions(): string
2222
/start -> Iniciar uma nova conversa
2323
/nfce -> Processar NFC-e
2424
/month -> Relatório do mês atual
25-
/lastpurchase -> Relatório da última compra
25+
/last_purchase -> Relatório da última compra
2626
/end -> Finalizar conversa\n\n";
2727
}
2828
}

0 commit comments

Comments
 (0)