- Introduced "Minhas Intenções" tab visible only to logged-in users. - Integrated MyPurchaseIntentionsPanel and useMyPurchaseIntentions hook. - Added tab badge showing count of pending intentions. - Extended session API to include user’s main character for downstream features.
29 lines
815 B
TypeScript
29 lines
815 B
TypeScript
/**
|
|
* Schemas de validação para Chat usando Zod
|
|
*/
|
|
|
|
import { z } from "zod";
|
|
import sanitizeHtml from "sanitize-html";
|
|
|
|
// Schema para criar chat
|
|
export const createChatSchema = z.object({
|
|
listing_id: z.number().int().positive(),
|
|
buyer_message: z.string().max(1000).optional(),
|
|
});
|
|
|
|
// Schema para enviar mensagem
|
|
export const sendMessageSchema = z.object({
|
|
content: z
|
|
.string()
|
|
.min(1, "Mensagem não pode estar vazia")
|
|
.max(1000, "Mensagem muito longa (máximo 1000 caracteres)")
|
|
.transform((val) => sanitizeHtml(val.trim(), { allowedTags: [], allowedAttributes: {} })),
|
|
});
|
|
|
|
// Schema para query params de mensagens
|
|
export const getMessagesSchema = z.object({
|
|
page: z.coerce.number().int().positive().default(1),
|
|
limit: z.coerce.number().int().positive().max(100).default(50),
|
|
});
|
|
|