feat(database): add repositories for tickets, moderation, polls and notifications

Keep every SQL statement out of the command layer so each feature can be built and tested without a Discord dependency.
This commit is contained in:
BlackAngelTV committed 2026-09-15 14:50:34 +02:00
1 parent abf6701bb0
commit 03a217c775
7 files changed
+460

No files matched your search

@@ -7,6 +7,18 @@ export function getSetting(guildId, key, fallback = null) {
return row ? JSON.parse(row.value) : fallback;
}
/**
* Reads a setting without throwing when the database is not ready (tests, early startup).
* Never use it when a missing database should be an error.
*/
export function resolveSetting(guildId, key, fallback = null) {
try {
return getSetting(guildId, key, fallback);
} catch {
return fallback;
}
}
export function setSetting(guildId, key, value, updatedBy = null) {
getDatabase()
.prepare(