complete new audit system
This commit is contained in:
+7
-5
@@ -1,12 +1,14 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getSetting = getSetting;
|
||||
exports.getSettingBool = getSettingBool;
|
||||
exports.setSetting = setSetting;
|
||||
exports.getAllSettings = getAllSettings;
|
||||
exports.getPublicSettings = getPublicSettings;
|
||||
const client_1 = require("@prisma/client");
|
||||
const prisma = new client_1.PrismaClient();
|
||||
const prisma_js_1 = __importDefault(require("../lib/prisma.js"));
|
||||
// Default settings
|
||||
const DEFAULT_SETTINGS = {
|
||||
customerSupportTicketsEnabled: 'false',
|
||||
@@ -19,7 +21,7 @@ const DEFAULT_SETTINGS = {
|
||||
documentExpiryWarningDays: '90', // Gelb: Warnung (Standard 90 Tage)
|
||||
};
|
||||
async function getSetting(key) {
|
||||
const setting = await prisma.appSetting.findUnique({
|
||||
const setting = await prisma_js_1.default.appSetting.findUnique({
|
||||
where: { key },
|
||||
});
|
||||
if (setting) {
|
||||
@@ -33,14 +35,14 @@ async function getSettingBool(key) {
|
||||
return value === 'true';
|
||||
}
|
||||
async function setSetting(key, value) {
|
||||
await prisma.appSetting.upsert({
|
||||
await prisma_js_1.default.appSetting.upsert({
|
||||
where: { key },
|
||||
update: { value },
|
||||
create: { key, value },
|
||||
});
|
||||
}
|
||||
async function getAllSettings() {
|
||||
const settings = await prisma.appSetting.findMany();
|
||||
const settings = await prisma_js_1.default.appSetting.findMany();
|
||||
// Start with defaults, then override with stored values
|
||||
const result = { ...DEFAULT_SETTINGS };
|
||||
for (const setting of settings) {
|
||||
|
||||
Reference in New Issue
Block a user