@tc-libs/setting 3.6.0 → 3.8.0

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.
Files changed (2) hide show
  1. package/README.md +51 -6
  2. package/package.json +11 -11
package/README.md CHANGED
@@ -1,11 +1,56 @@
1
- # setting
1
+ # @tc-libs/setting
2
2
 
3
- This library was generated with [Nx](https://nx.dev).
3
+ Gestione centralizzata delle impostazioni applicative persistite su database.
4
4
 
5
- ## Building
5
+ Il package espone soprattutto:
6
6
 
7
- Run `nx build setting` to build the library.
7
+ - `SettingModule`
8
+ - `BaseSettingService`
9
+ - entity/repository/controller/dto/serializzazioni
8
10
 
9
- ## Running unit tests
11
+ ## Cosa fa `BaseSettingService`
10
12
 
11
- Run `nx test setting` to execute the unit tests via [Jest](https://jestjs.io).
13
+ Estende `AbstractService` e aggiunge:
14
+
15
+ - `getAllPublic()`
16
+ - `findOneByName(name)`
17
+ - `updateValue(repository, dto)`
18
+ - `updateByName(name, value)`
19
+ - `getValue(setting)`
20
+ - `checkValue(value, type)`
21
+ - `getSetting(name, defaultValue)`
22
+ - `getMaintenance()`
23
+
24
+ ## Tipi supportati
25
+
26
+ Le impostazioni sono tipizzate con `ENUM_SETTING_DATA_TYPE`:
27
+
28
+ - `BOOLEAN`
29
+ - `STRING`
30
+ - `ARRAY_OF_STRING`
31
+ - `ARRAY_OF_OBJECT`
32
+ - `ARRAY_OF_ID`
33
+ - `ID`
34
+ - `NUMBER`
35
+
36
+ ## Esempi
37
+
38
+ ```ts
39
+ const maintenance = await this.baseSettingService.getMaintenance();
40
+ const value = await this.baseSettingService.getSetting<number>('otp_ttl', 300);
41
+ ```
42
+
43
+ ## Caching interno
44
+
45
+ `BaseSettingService` mantiene una cache in-memory molto semplice per nome setting con TTL di 1 minuto.
46
+
47
+ ## Quando usarlo
48
+
49
+ Usa questo package quando vuoi spostare feature flags e configurazioni editabili dal codice al database, mantenendo comunque conversione di tipo e repository base gia pronti.
50
+
51
+ ## Sviluppo
52
+
53
+ ```bash
54
+ nx build setting
55
+ nx test setting
56
+ ```
package/package.json CHANGED
@@ -1,25 +1,25 @@
1
1
  {
2
2
  "name": "@tc-libs/setting",
3
- "version": "3.6.0",
3
+ "version": "3.8.0",
4
4
  "dependencies": {
5
- "@tc-libs/pagination": "3.6.0",
6
- "@tc-libs/authentication": "3.6.0",
7
- "@tc-libs/request": "3.6.0",
8
- "@tc-libs/response": "3.6.0",
5
+ "@tc-libs/pagination": "3.8.0",
6
+ "@tc-libs/authentication": "3.8.0",
7
+ "@tc-libs/request": "3.8.0",
8
+ "@tc-libs/response": "3.8.0",
9
9
  "@nestjs/common": "^11.0.12",
10
10
  "@nestjs/swagger": "^11.1.0",
11
- "@tc-libs/doc": "3.6.0",
11
+ "@tc-libs/doc": "3.8.0",
12
12
  "class-transformer": "^0.5.1",
13
13
  "class-validator": "^0.14.1",
14
- "@tc-libs/errors": "3.6.0",
14
+ "@tc-libs/errors": "3.8.0",
15
15
  "express": "5.0.1",
16
16
  "@nestjs/mongoose": "^11.0.3",
17
- "@tc-libs/database": "3.6.0",
17
+ "@tc-libs/database": "3.8.0",
18
18
  "mongoose": "^8.13.1",
19
- "@tc-libs/app-cache": "3.6.0",
19
+ "@tc-libs/app-cache": "3.8.0",
20
20
  "@faker-js/faker": "^9.6.0",
21
- "@tc-libs/helper": "3.6.0",
22
- "@tc-libs/service": "3.6.0",
21
+ "@tc-libs/helper": "3.8.0",
22
+ "@tc-libs/service": "3.8.0",
23
23
  "tslib": "^2.8.1"
24
24
  },
25
25
  "type": "commonjs",