New CustomerInventory,
New Mitgliederverwaltung für Vereine New Bank Auto Complete
This commit is contained in:
@@ -12,7 +12,7 @@ import {
|
||||
|
||||
import { resourceConfig } from "../../utils/resource.config";
|
||||
import { useNextNumberRangeNumber } from "../../utils/functions";
|
||||
import { insertHistoryItem } from "../../utils/history";
|
||||
import { getHistoryEntityLabel, insertHistoryItem } from "../../utils/history";
|
||||
import { diffObjects } from "../../utils/diff";
|
||||
import { recalculateServicePricesForTenant } from "../../modules/service-price-recalculation.service";
|
||||
import { decrypt, encrypt } from "../../utils/crypt";
|
||||
@@ -67,7 +67,8 @@ function getUserVisibleChanges(oldRecord: Record<string, any>, updated: Record<s
|
||||
}
|
||||
|
||||
function buildFieldUpdateHistoryText(resource: string, label: string, oldValue: any, newValue: any) {
|
||||
return `${resource}: ${label} geändert von "${formatDiffValue(oldValue)}" zu "${formatDiffValue(newValue)}"`
|
||||
const resourceLabel = getHistoryEntityLabel(resource)
|
||||
return `${resourceLabel}: ${label} geändert von "${formatDiffValue(oldValue)}" zu "${formatDiffValue(newValue)}"`
|
||||
}
|
||||
|
||||
function applyResourceWhereFilters(resource: string, table: any, whereCond: any) {
|
||||
@@ -525,6 +526,7 @@ export default async function resourceRoutes(server: FastifyInstance) {
|
||||
|
||||
if (created) {
|
||||
try {
|
||||
const resourceLabel = getHistoryEntityLabel(resource)
|
||||
await insertHistoryItem(server, {
|
||||
tenant_id: req.user.tenant_id,
|
||||
created_by: req.user?.user_id || null,
|
||||
@@ -533,7 +535,7 @@ export default async function resourceRoutes(server: FastifyInstance) {
|
||||
action: "created",
|
||||
oldVal: null,
|
||||
newVal: created,
|
||||
text: `Neuer Eintrag in ${resource} erstellt`,
|
||||
text: `Neuer Eintrag in ${resourceLabel} erstellt`,
|
||||
})
|
||||
} catch (historyError) {
|
||||
server.log.warn({ err: historyError, resource }, "Failed to write create history entry")
|
||||
@@ -608,6 +610,7 @@ export default async function resourceRoutes(server: FastifyInstance) {
|
||||
|
||||
if (updated) {
|
||||
try {
|
||||
const resourceLabel = getHistoryEntityLabel(resource)
|
||||
const changes = oldRecord ? getUserVisibleChanges(oldRecord, updated) : []
|
||||
if (!changes.length) {
|
||||
await insertHistoryItem(server, {
|
||||
@@ -618,7 +621,7 @@ export default async function resourceRoutes(server: FastifyInstance) {
|
||||
action: "updated",
|
||||
oldVal: oldRecord || null,
|
||||
newVal: updated,
|
||||
text: `Eintrag in ${resource} geändert`,
|
||||
text: `Eintrag in ${resourceLabel} geändert`,
|
||||
})
|
||||
} else {
|
||||
for (const change of changes) {
|
||||
|
||||
Reference in New Issue
Block a user