Files
hDiyanetProxy/backend/src/utils/seed.js
hOLOlu a798066049 İlk sürüm: hDiyanetProxy v1.0.0
- Backend: Node.js + Express + MySQL + JWT auth
- 8 MySQL tablosu (users, countries, states, cities, prayer_times, ramadan_times, eid_times, fetch_logs)
- Diyanet API entegrasyonu (auth + token yönetimi)
- Tüm API endpointleri (places, prayer-times, ramadan, eid, admin)
- Rate limiting, CORS, input validation
- Cron job (gece 02:00 otomatik veri çekme)
- Frontend: Login, Dashboard, Fetch Panel, Namaz Vakitleri, Ramazan, Admin, Profil
- Admin kullanıcı: admin/admin123
2026-02-27 07:53:41 +03:00

32 lines
940 B
JavaScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// hDiyanetProxy - Seed Script
// İlk admin kullanıcıyı oluşturur
const pool = require('./db');
const bcrypt = require('bcrypt');
async function seed() {
console.log('🌱 Seed başlatılıyor...\n');
try {
// Admin kullanıcı kontrolü
const [existing] = await pool.execute('SELECT id FROM users WHERE username = ?', ['admin']);
if (existing.length > 0) {
console.log(' Admin kullanıcı zaten mevcut, atlanıyor');
} else {
const hashedPassword = await bcrypt.hash('admin123', 10);
await pool.execute(
'INSERT INTO users (username, password, role, is_active) VALUES (?, ?, ?, ?)',
['admin', hashedPassword, 'admin', 1]
);
console.log(' ✅ Admin kullanıcı oluşturuldu (admin / admin123)');
}
} catch (err) {
console.error(' ❌ Seed hatası:', err.message);
}
console.log('\n✅ Seed tamamlandı!');
process.exit(0);
}
seed();