complete new audit system

This commit is contained in:
2026-03-21 18:23:54 +01:00
parent 38b3b7da73
commit fd55742c57
159 changed files with 2841 additions and 736 deletions
+19 -1
View File
@@ -39,6 +39,7 @@ exports.createPlatform = createPlatform;
exports.updatePlatform = updatePlatform;
exports.deletePlatform = deletePlatform;
const platformService = __importStar(require("../services/platform.service.js"));
const audit_service_js_1 = require("../services/audit.service.js");
async function getPlatforms(req, res) {
try {
const includeInactive = req.query.includeInactive === 'true';
@@ -74,6 +75,11 @@ async function getPlatform(req, res) {
async function createPlatform(req, res) {
try {
const platform = await platformService.createPlatform(req.body);
await (0, audit_service_js_1.logChange)({
req, action: 'CREATE', resourceType: 'Platform',
resourceId: platform.id.toString(),
label: `Vertriebsplattform ${platform.name} angelegt`,
});
res.status(201).json({ success: true, data: platform });
}
catch (error) {
@@ -86,6 +92,11 @@ async function createPlatform(req, res) {
async function updatePlatform(req, res) {
try {
const platform = await platformService.updatePlatform(parseInt(req.params.id), req.body);
await (0, audit_service_js_1.logChange)({
req, action: 'UPDATE', resourceType: 'Platform',
resourceId: platform.id.toString(),
label: `Vertriebsplattform ${platform.name} aktualisiert`,
});
res.json({ success: true, data: platform });
}
catch (error) {
@@ -97,7 +108,14 @@ async function updatePlatform(req, res) {
}
async function deletePlatform(req, res) {
try {
await platformService.deletePlatform(parseInt(req.params.id));
const platformId = parseInt(req.params.id);
const platform = await platformService.getPlatformById(platformId);
await platformService.deletePlatform(platformId);
await (0, audit_service_js_1.logChange)({
req, action: 'DELETE', resourceType: 'Platform',
resourceId: platformId.toString(),
label: `Vertriebsplattform ${platform?.name || platformId} gelöscht`,
});
res.json({ success: true, message: 'Vertriebsplattform gelöscht' });
}
catch (error) {