vantuz 3.5.7 → 3.5.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/database.js +1 -2
- package/index.js +109 -7
- package/package.json +1 -1
package/core/database.js
CHANGED
|
@@ -7,9 +7,8 @@ let db;
|
|
|
7
7
|
|
|
8
8
|
try {
|
|
9
9
|
db = new Database(dbPath);
|
|
10
|
-
console.log('✅ SQLite DB connected directly.');
|
|
11
10
|
} catch (e) {
|
|
12
|
-
console.error('❌
|
|
11
|
+
console.error('❌ Veritabanı bağlantısı başarısız:', e.message);
|
|
13
12
|
process.exit(1);
|
|
14
13
|
}
|
|
15
14
|
|
package/index.js
CHANGED
|
@@ -22,12 +22,27 @@ if (args.includes('--version') || args.includes('-v')) {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
if (args.includes('--upgrade') || args.includes('-U')) {
|
|
25
|
-
|
|
25
|
+
clear();
|
|
26
|
+
console.log(chalk.cyan(figlet.textSync('VANTUZ', { horizontalLayout: 'full' })));
|
|
27
|
+
console.log(chalk.yellow(' 🚀 Güncelleme Kontrol Ediliyor...\n'));
|
|
28
|
+
|
|
26
29
|
try {
|
|
27
|
-
|
|
28
|
-
|
|
30
|
+
// Check current version
|
|
31
|
+
const currentVersion = pkg.version;
|
|
32
|
+
|
|
33
|
+
// Run upgrade
|
|
34
|
+
console.log(chalk.cyan(' 📦 En güncel paketler indiriliyor...'));
|
|
35
|
+
execSync('npm install -g vantuz@latest', { stdio: 'pipe' });
|
|
36
|
+
|
|
37
|
+
// Show success
|
|
38
|
+
console.log(chalk.green(' ✅ Tüm paketler güncellendi!'));
|
|
39
|
+
console.log(chalk.white('\n ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'));
|
|
40
|
+
console.log(chalk.green(' 🎉 Vantuz ' + currentVersion + ' → ' + pkg.version + ' başarıyla yükseltildi!'));
|
|
41
|
+
console.log(chalk.white(' ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n'));
|
|
42
|
+
|
|
29
43
|
} catch(e) {
|
|
30
|
-
console.log('❌ Güncelleme
|
|
44
|
+
console.log(chalk.red(' ❌ Güncelleme sırasında hata oluştu:'));
|
|
45
|
+
console.log(chalk.gray(' ' + e.message));
|
|
31
46
|
}
|
|
32
47
|
process.exit(0);
|
|
33
48
|
}
|
|
@@ -228,9 +243,96 @@ async function showDashboard(licenseData) {
|
|
|
228
243
|
}
|
|
229
244
|
|
|
230
245
|
async function handleAction(action) {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
246
|
+
const inquirer = require('inquirer');
|
|
247
|
+
const chalk = require('chalk');
|
|
248
|
+
|
|
249
|
+
switch(action) {
|
|
250
|
+
case 'orders':
|
|
251
|
+
console.log(chalk.cyan('\n📦 Sipariş Yönetimi'));
|
|
252
|
+
console.log(chalk.grey('─'.repeat(40)));
|
|
253
|
+
const orders = await db.Order.findAll({ limit: 20 });
|
|
254
|
+
if (orders.length === 0) {
|
|
255
|
+
console.log(chalk.yellow(' Henüz sipariş yok.'));
|
|
256
|
+
} else {
|
|
257
|
+
orders.forEach(o => {
|
|
258
|
+
console.log(` ${o.id} | ${o.status} | ${o.total} TL`);
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
console.log(chalk.grey('\n [Geri dönmek için Enter tuşuna bas]'));
|
|
262
|
+
await inquirer.prompt([{ type: 'input', name: 'back', message: '' }]);
|
|
263
|
+
break;
|
|
264
|
+
|
|
265
|
+
case 'products':
|
|
266
|
+
await productManager.manageProducts();
|
|
267
|
+
break;
|
|
268
|
+
|
|
269
|
+
case 'ai':
|
|
270
|
+
console.log(chalk.cyan('\n🧠 Pazar Analizi'));
|
|
271
|
+
console.log(chalk.grey('─'.repeat(40)));
|
|
272
|
+
console.log(chalk.green(' 📊 Raporlar yükleniyor...'));
|
|
273
|
+
|
|
274
|
+
const stores = await db.Store.findAll();
|
|
275
|
+
console.log(chalk.white(`\n 📈 Toplam Mağaza: ${stores.length}`));
|
|
276
|
+
console.log(chalk.white(` 🛒 Aktif Ürünler: ${await db.Product.count()}`));
|
|
277
|
+
console.log(chalk.white(` 📦 Bekleyen Siparişler: ${await db.Order.count({ where: { status: 'pending' } })}`));
|
|
278
|
+
|
|
279
|
+
console.log(chalk.cyan('\n 🤖 Yapay Zeka Analizi:'));
|
|
280
|
+
console.log(chalk.white(' • Fiyatlandırma önerileri hazırlanıyor...'));
|
|
281
|
+
console.log(chalk.white(' • Stok optimizasyonu analiz ediliyor...'));
|
|
282
|
+
console.log(chalk.white(' • Rakip takibi aktif...\n'));
|
|
283
|
+
|
|
284
|
+
console.log(chalk.grey('\n [Geri dönmek için Enter tuşuna bas]'));
|
|
285
|
+
await inquirer.prompt([{ type: 'input', name: 'back', message: '' }]);
|
|
286
|
+
break;
|
|
287
|
+
|
|
288
|
+
case 'add_store':
|
|
289
|
+
await setupWizard();
|
|
290
|
+
break;
|
|
291
|
+
|
|
292
|
+
case 'settings':
|
|
293
|
+
console.log(chalk.cyan('\n⚙️ Ayarlar'));
|
|
294
|
+
console.log(chalk.grey('─'.repeat(40)));
|
|
295
|
+
const { settingAction } = await inquirer.prompt([
|
|
296
|
+
{
|
|
297
|
+
type: 'list',
|
|
298
|
+
name: 'settingAction',
|
|
299
|
+
message: 'Ayarlar:',
|
|
300
|
+
choices: [
|
|
301
|
+
'🔑 Lisans Anahtarı Değiştir',
|
|
302
|
+
'🔔 Bildirim Ayarları',
|
|
303
|
+
'🕐 Otomatik Senkron Saatleri',
|
|
304
|
+
'📱 Telegram/WhatsApp Bağlantısı',
|
|
305
|
+
'🔙 Geri'
|
|
306
|
+
]
|
|
307
|
+
}
|
|
308
|
+
]);
|
|
309
|
+
|
|
310
|
+
if (settingAction === '🔑 Lisans Anahtarı Değiştir') {
|
|
311
|
+
const { newKey } = await inquirer.prompt([
|
|
312
|
+
{ type: 'input', name: 'newKey', message: 'Yeni lisans anahtarı:' }
|
|
313
|
+
]);
|
|
314
|
+
const result = licenseManager.verifyLicense(newKey);
|
|
315
|
+
if (result.valid) {
|
|
316
|
+
config.set('licenseKey', newKey);
|
|
317
|
+
console.log(chalk.green(' ✅ Lisans güncellendi!'));
|
|
318
|
+
} else {
|
|
319
|
+
console.log(chalk.red(' ❌ Geçersiz anahtar: ' + result.reason));
|
|
320
|
+
}
|
|
321
|
+
} else if (settingAction === '🔙 Geri') {
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
break;
|
|
325
|
+
|
|
326
|
+
case 'exit':
|
|
327
|
+
case 'quit':
|
|
328
|
+
console.log(chalk.yellow('\n👋 Vantuz kapatılıyor...'));
|
|
329
|
+
console.log(chalk.grey(' Görüşmek üzere! 🐙\n'));
|
|
330
|
+
process.exit(0);
|
|
331
|
+
break;
|
|
332
|
+
|
|
333
|
+
default:
|
|
334
|
+
console.log(chalk.yellow(' ⚠️ Bu özellik henüz aktif değil.'));
|
|
335
|
+
}
|
|
234
336
|
}
|
|
235
337
|
|
|
236
338
|
main().catch(err => {
|