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:
1 parent
55eebde0ba
commit
ab37b477df
106 files changed
+15261
-301
No files matched your search
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
* Script de execução de migrations
|
||||
/**
|
||||
* Script de execução de migrations
|
||||
* Executa todas as migrations SQL em ordem
|
||||
*/
|
||||
|
||||
// Carregar variáveis de ambiente
|
||||
// Carregar variáveis de ambiente
|
||||
import { config } from "dotenv";
|
||||
import { resolve } from "path";
|
||||
|
||||
@@ -18,8 +18,7 @@ import { getPool, query, healthCheck } from "../index";
|
||||
const MIGRATIONS_DIR = join(__dirname, ".");
|
||||
|
||||
// Lista de migrations em ordem
|
||||
const MIGRATIONS = [
|
||||
"001_users.sql",
|
||||
const MIGRATIONS = [ "001_users.sql",
|
||||
"002_servers.sql",
|
||||
"003_fix_servers_location.sql",
|
||||
"004_listings.sql",
|
||||
@@ -30,21 +29,27 @@ const MIGRATIONS = [
|
||||
"009_item_price_history.sql",
|
||||
"010_notifications.sql",
|
||||
"011_donations.sql",
|
||||
];
|
||||
"012_telemetry_and_ads_enhancement.sql",
|
||||
"013_add_trade_item_support.sql",
|
||||
"014_add_bid_increment.sql",
|
||||
"015_add_purchase_intentions.sql",
|
||||
"016_create_unified_items_table.sql",
|
||||
"017_add_items_foreign_key.sql",
|
||||
"018_migrate_listings_to_unified_items.sql",];
|
||||
|
||||
async function runMigrations() {
|
||||
console.log("🚀 Iniciando execução de migrations...\n");
|
||||
console.log("🚀 Iniciando execução de migrations...\n");
|
||||
|
||||
// Verificar conexão com banco
|
||||
console.log("🔍 Verificando conexão com PostgreSQL...");
|
||||
// Verificar conexão com banco
|
||||
console.log("🔠Verificando conexão com PostgreSQL...");
|
||||
const isHealthy = await healthCheck();
|
||||
|
||||
if (!isHealthy) {
|
||||
console.error("❌ Falha na conexão com PostgreSQL. Verifique a variável PG_DB.");
|
||||
console.error("⌠Falha na conexão com PostgreSQL. Verifique a variável PG_DB.");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
console.log("✅ Conexão estabelecida com sucesso\n");
|
||||
console.log("✅ Conexão estabelecida com sucesso\n");
|
||||
|
||||
// Verificar tabela de controle de migrations (opcional)
|
||||
try {
|
||||
@@ -55,7 +60,7 @@ async function runMigrations() {
|
||||
)
|
||||
`);
|
||||
} catch (error) {
|
||||
console.error("❌ Erro ao criar tabela de controle:", error);
|
||||
console.error("⌠Erro ao criar tabela de controle:", error);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
@@ -65,18 +70,18 @@ async function runMigrations() {
|
||||
const version = migrationFile.replace(".sql", "");
|
||||
|
||||
try {
|
||||
// Verificar se já foi executada
|
||||
// Verificar se já foi executada
|
||||
const checkResult = await query<{ version: string }>(
|
||||
"SELECT version FROM schema_migrations WHERE version = $1",
|
||||
[version]
|
||||
);
|
||||
|
||||
if (checkResult.rows.length > 0) {
|
||||
console.log(`⏭️ Migration ${version} já executada, pulando...`);
|
||||
console.log(`âï¸ Migration ${version} já executada, pulando...`);
|
||||
continue;
|
||||
}
|
||||
|
||||
console.log(`📝 Executando migration: ${migrationFile}...`);
|
||||
console.log(`📠Executando migration: ${migrationFile}...`);
|
||||
|
||||
// Ler arquivo SQL
|
||||
const sql = readFileSync(migrationPath, "utf-8");
|
||||
@@ -90,14 +95,14 @@ async function runMigrations() {
|
||||
[version]
|
||||
);
|
||||
|
||||
console.log(`✅ Migration ${version} executada com sucesso\n`);
|
||||
console.log(`✅ Migration ${version} executada com sucesso\n`);
|
||||
} catch (error) {
|
||||
console.error(`❌ Erro ao executar migration ${version}:`, error);
|
||||
console.error(`⌠Erro ao executar migration ${version}:`, error);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
console.log("🎉 Todas as migrations foram executadas com sucesso!");
|
||||
console.log("🎉 Todas as migrations foram executadas com sucesso!");
|
||||
|
||||
// Fechar pool
|
||||
const pool = getPool();
|
||||
@@ -107,7 +112,8 @@ async function runMigrations() {
|
||||
|
||||
// Executar
|
||||
runMigrations().catch((error) => {
|
||||
console.error("❌ Erro fatal:", error);
|
||||
console.error("⌠Erro fatal:", error);
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user