@lenne.tech/nest-server 11.1.12 → 11.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lenne.tech/nest-server",
3
- "version": "11.1.12",
3
+ "version": "11.1.13",
4
4
  "description": "Modern, fast, powerful Node.js web framework in TypeScript based on Nest with a GraphQL API and a connection to MongoDB (or other databases).",
5
5
  "keywords": [
6
6
  "node",
@@ -147,7 +147,7 @@
147
147
  "husky": "9.1.7",
148
148
  "jest": "29.7.0",
149
149
  "npm-watch": "0.13.0",
150
- "pm2": "6.0.8",
150
+ "pm2": "6.0.10",
151
151
  "prettier": "3.5.3",
152
152
  "pretty-quick": "4.1.1",
153
153
  "supertest": "7.1.0",
@@ -30,16 +30,29 @@ export function updateLanguage<T extends Record<string, any>, K extends readonly
30
30
  translatableFields: string[],
31
31
  ): T {
32
32
  const changedFields: Partial<Pick<T, K[number]>> = {};
33
-
34
33
  for (const key of translatableFields) {
35
- const k = key as keyof T;
34
+ const k = key;
35
+
36
+ // For languages other than 'de', compare with existing translation value instead of main value
37
+ let compareValue;
38
+ if (language !== 'de' && oldValue._translations?.[language]?.[k] !== undefined) {
39
+ compareValue = oldValue._translations[language][k];
40
+ } else {
41
+ compareValue = oldValue[k];
42
+ }
36
43
 
37
- if (input[k] !== oldValue[k] && input[k] !== undefined) {
44
+ if (input[k] !== compareValue && input[k] !== undefined) {
38
45
  changedFields[k] = input[k];
39
- input[k] = oldValue[k] as T[typeof k];
46
+ // Only reset if the current field isn't in german
47
+ if (language !== 'de') {
48
+ input[k] = oldValue[k];
49
+ }
50
+ } else if (language !== 'de' && input[k] !== undefined) {
51
+ // If no change detected but we have input for this field, reset to original value
52
+ // to prevent overwriting the default with translation values
53
+ input[k] = oldValue[k];
40
54
  }
41
55
  }
42
-
43
56
  input._translations = input._translations ?? {};
44
57
  input._translations[language] = {
45
58
  ...(input._translations[language] ?? {}),