feat: implement market page with QueryProvider and dynamic listings

- wrap root layout with QueryProvider for React Query
- replace market UnderConstruction placeholder with MarketClient and real data fetching
- implement search, pagination, and sort via search params using getActiveListings
- add necessary client components and queries
- update dependencies (e.g., prisma, pkg-types)
This commit is contained in:
Evandro Fonseca Junior committed 2025-11-05 01:58:03 -03:00
1 parent 55eebde0ba
commit ab37b477df
106 files changed
+15261 -301

No files matched your search

+21
View File
@@ -92,6 +92,27 @@ export async function getUserCharacters(userId: number): Promise<Character[]> {
return result.rows;
}
/**
* Busca personagem principal de um usuário em um servidor específico
* Retorna o personagem principal (is_main = true) ou o primeiro personagem do servidor
*/
export async function getMainCharacterByUserId(
userId: number,
serverName: string
): Promise<Character | null> {
const result = await query<Character>(
`
SELECT * FROM user_characters
WHERE user_id = $1 AND server_name = $2
ORDER BY is_main DESC, created_at ASC
LIMIT 1
`,
[userId, serverName]
);
return result.rows[0] || null;
}
/**
* Busca personagem por ID
*/