feat: enhance purchase intentions with chat integration and offer tracking
- Added MongoDB chat/message integration for seller responses - Improved seller response validation and default messaging - Integrated automatic chat creation/update when responding to intentions - Added highest custom offer fields to listing queries and models - Enhanced listing data with top offer information for buyers
This commit is contained in:
1 parent
d27526e026
commit
d8e7d5d7e6
19 files changed
+806
-58
No files matched your search
@@ -139,7 +139,31 @@ export function CreateAdModal({ open, onOpenChange, onSuccess }: CreateAdModalPr
|
||||
const data = await response.json();
|
||||
|
||||
if (!response.ok) {
|
||||
setError(data.error || "Erro ao criar anúncio");
|
||||
if (data?.details?.length) {
|
||||
const fieldLabels: Record<string, string> = {
|
||||
item_id: "Item",
|
||||
item_id_unified: "Item",
|
||||
item_name: "Nome do item",
|
||||
quantity: "Quantidade",
|
||||
server_name: "Servidor",
|
||||
price_pix: "Preço PIX",
|
||||
price_tibia_coins: "Preço Tibia Coins",
|
||||
price_gold_coins: "Preço Gold Coins",
|
||||
trade_item_id: "Item de troca",
|
||||
trade_item_name: "Nome do item de troca",
|
||||
trade_item_quantity: "Quantidade do item de troca",
|
||||
auction_ends_at: "Término do leilão",
|
||||
};
|
||||
|
||||
const validationMessages = data.details.map((detail: { field?: string; message?: string }) => {
|
||||
const fieldLabel = detail.field ? fieldLabels[detail.field] || detail.field : "Campo";
|
||||
return `${fieldLabel}: ${detail.message ?? "preenchimento obrigatório"}`;
|
||||
});
|
||||
|
||||
setError(validationMessages.join(" "));
|
||||
} else {
|
||||
setError(data?.error || "Erro ao criar anúncio");
|
||||
}
|
||||
setLoading(false);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user