vantuz 3.5.15 β 3.5.16
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 +19 -0
- package/index.js +3 -3
- package/package.json +1 -1
package/core/database.js
CHANGED
|
@@ -86,6 +86,25 @@ class Model {
|
|
|
86
86
|
return stmt.get().count;
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
+
async destroy(query = {}) {
|
|
90
|
+
if (!query.where) return;
|
|
91
|
+
const whereClause = Object.keys(query.where).map(k => `${k} = ?`).join(' AND ');
|
|
92
|
+
const values = Object.values(query.where);
|
|
93
|
+
const sql = `DELETE FROM ${this.tableName} WHERE ${whereClause}`;
|
|
94
|
+
const stmt = db.prepare(sql);
|
|
95
|
+
return stmt.run(...values);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
async update(data, query = {}) {
|
|
99
|
+
if (!query.where) return;
|
|
100
|
+
const updateClause = Object.keys(data).map(k => `${k} = ?`).join(', ');
|
|
101
|
+
const whereClause = Object.keys(query.where).map(k => `${k} = ?`).join(' AND ');
|
|
102
|
+
const values = [...Object.values(data), ...Object.values(query.where)];
|
|
103
|
+
const sql = `UPDATE ${this.tableName} SET ${updateClause}, updatedAt = ? WHERE ${whereClause}`;
|
|
104
|
+
const stmt = db.prepare(sql);
|
|
105
|
+
return stmt.run(...values, new Date().toISOString());
|
|
106
|
+
}
|
|
107
|
+
|
|
89
108
|
_parseRow(row) {
|
|
90
109
|
// Convert JSON fields back to objects
|
|
91
110
|
for (const [key, props] of Object.entries(this.schema)) {
|
package/index.js
CHANGED
|
@@ -246,7 +246,7 @@ async function showDashboard(licenseData) {
|
|
|
246
246
|
if (stores.length > 0) {
|
|
247
247
|
console.log(chalk.cyan('\n π AKTΔ°F MAΔAZALAR:'));
|
|
248
248
|
stores.forEach((store, i) => {
|
|
249
|
-
const status = store.
|
|
249
|
+
const status = store.isActive ? chalk.green('β') : chalk.red('β');
|
|
250
250
|
console.log(chalk.white(` ${i+1}. ${status} ${store.name || store.platform} ${chalk.grey(`(${store.platform})`)}`));
|
|
251
251
|
});
|
|
252
252
|
} else {
|
|
@@ -756,7 +756,7 @@ AI_MODEL=gpt-4
|
|
|
756
756
|
console.log(chalk.white('\n # | Platform | MaΔaza AdΔ± | Durum'));
|
|
757
757
|
console.log(chalk.grey(' ββββββββββββββββββββββββββββββββββββββββββββββ'));
|
|
758
758
|
stores.forEach((store, i) => {
|
|
759
|
-
const status = store.
|
|
759
|
+
const status = store.isActive ? chalk.green('Aktif') : chalk.red('Pasif');
|
|
760
760
|
const name = store.name || store.storeName || '-';
|
|
761
761
|
console.log(chalk.white(` ${i+1} | ${(store.platform || '-').padEnd(15)} | ${name.substring(0,15).padEnd(15)} | ${status}`));
|
|
762
762
|
});
|
|
@@ -802,7 +802,7 @@ AI_MODEL=gpt-4
|
|
|
802
802
|
const idx = storeList.indexOf(selectedStore);
|
|
803
803
|
if (idx >= 0) {
|
|
804
804
|
const store = stores[idx];
|
|
805
|
-
await db.Store.update({ active: !store.
|
|
805
|
+
await db.Store.update({ active: !store.isActive }, { where: { id: store.id } });
|
|
806
806
|
console.log(chalk.green(` β
Durum deΔiΕtirildi!`));
|
|
807
807
|
await new Promise(r => setTimeout(r, 1000));
|
|
808
808
|
}
|