✨ Features: - Modern tourism website with responsive design - AdminJS admin panel with image editor integration - PostgreSQL database with comprehensive schema - Docker containerization - Image upload and gallery management 🛠 Tech Stack: - Backend: Node.js + Express.js - Database: PostgreSQL 13+ - Frontend: HTML/CSS/JS with responsive design - Admin: AdminJS with custom components - Deployment: Docker + Docker Compose - Image Processing: Sharp with optimization 📱 Admin Features: - Routes/Tours management (city, mountain, fishing) - Guides profiles with specializations - Articles and blog system - Image editor with upload/gallery/URL options - User management and authentication - Responsive admin interface 🎨 Design: - Korean tourism focused branding - Mobile-first responsive design - Custom CSS with modern aesthetics - Image optimization and gallery - SEO-friendly structure 🔒 Security: - Helmet.js security headers - bcrypt password hashing - Input validation and sanitization - CORS protection - Environment variables
58 lines
2.1 KiB
JavaScript
58 lines
2.1 KiB
JavaScript
require('dotenv').config();
|
|
const { Pool } = require('pg');
|
|
|
|
async function checkAdminsTable() {
|
|
const pool = new Pool({
|
|
connectionString: process.env.DATABASE_URL
|
|
});
|
|
|
|
try {
|
|
console.log('🔍 Проверяем таблицу admins...');
|
|
|
|
// Проверяем, существует ли таблица
|
|
const tableExists = await pool.query(`
|
|
SELECT EXISTS (
|
|
SELECT FROM information_schema.tables
|
|
WHERE table_schema = 'public'
|
|
AND table_name = 'admins'
|
|
)
|
|
`);
|
|
|
|
console.log('📋 Таблица admins существует:', tableExists.rows[0].exists);
|
|
|
|
if (tableExists.rows[0].exists) {
|
|
// Получаем структуру таблицы
|
|
const structure = await pool.query(`
|
|
SELECT column_name, data_type, is_nullable, column_default
|
|
FROM information_schema.columns
|
|
WHERE table_name = 'admins'
|
|
ORDER BY ordinal_position
|
|
`);
|
|
|
|
console.log('\n📋 Структура таблицы admins:');
|
|
structure.rows.forEach(row => {
|
|
console.log(` - ${row.column_name}: ${row.data_type} ${row.is_nullable === 'NO' ? '(NOT NULL)' : '(nullable)'}`);
|
|
});
|
|
|
|
// Проверяем количество записей
|
|
const count = await pool.query('SELECT COUNT(*) FROM admins');
|
|
console.log(`\n📊 Записей в таблице: ${count.rows[0].count}`);
|
|
|
|
// Получаем несколько записей для примера
|
|
const sample = await pool.query('SELECT id, username, name, role, is_active FROM admins LIMIT 3');
|
|
console.log('\n👥 Примеры записей:');
|
|
sample.rows.forEach(admin => {
|
|
console.log(` - ID: ${admin.id}, Username: ${admin.username}, Name: ${admin.name}, Role: ${admin.role}, Active: ${admin.is_active}`);
|
|
});
|
|
} else {
|
|
console.log('❌ Таблица admins не существует! Нужно создать её.');
|
|
}
|
|
|
|
} catch (error) {
|
|
console.error('❌ Ошибка:', error.message);
|
|
} finally {
|
|
await pool.end();
|
|
}
|
|
}
|
|
|
|
checkAdminsTable(); |