MCPcopy
hub / github.com/pickle-com/glass / updatePreset

Function updatePreset

src/features/settings/repositories/sqlite.repository.js:53–72  ·  view source on GitHub ↗
(id, { title, prompt }, uid)

Source from the content-addressed store, hash-verified

51}
52
53function updatePreset(id, { title, prompt }, uid) {
54 const db = sqliteClient.getDb();
55 const now = Math.floor(Date.now() / 1000);
56 const query = `
57 UPDATE prompt_presets
58 SET title = ?, prompt = ?, sync_state = 'dirty', updated_at = ?
59 WHERE id = ? AND uid = ? AND is_default = 0
60 `;
61
62 try {
63 const result = db.prepare(query).run(title, prompt, now, id, uid);
64 if (result.changes === 0) {
65 throw new Error('Preset not found, is default, or permission denied');
66 }
67 return { changes: result.changes };
68 } catch (err) {
69 console.error('SQLite: Failed to update preset:', err);
70 throw err;
71 }
72}
73
74function deletePreset(id, uid) {
75 const db = sqliteClient.getDb();

Callers

nothing calls this directly

Calls 1

getDbMethod · 0.80

Tested by

no test coverage detected