@hedhog/admin 0.0.93 → 0.0.95

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. package/README.md +171 -35
  2. package/dist/auth/auth.module.d.ts.map +1 -1
  3. package/dist/auth/auth.module.js +1 -0
  4. package/dist/auth/auth.module.js.map +1 -1
  5. package/dist/locale/dto/create.dto.d.ts.map +1 -1
  6. package/dist/locale/dto/create.dto.js.map +1 -1
  7. package/dist/locale/dto/set-enabled.dto.d.ts +4 -0
  8. package/dist/locale/dto/set-enabled.dto.d.ts.map +1 -0
  9. package/dist/{entities/multifactor.entity.js → locale/dto/set-enabled.dto.js} +12 -18
  10. package/dist/locale/dto/set-enabled.dto.js.map +1 -0
  11. package/dist/locale/dto/update.dto.d.ts.map +1 -1
  12. package/dist/locale/dto/update.dto.js.map +1 -1
  13. package/dist/locale/locale.controller.d.ts +3 -1
  14. package/dist/locale/locale.controller.d.ts.map +1 -1
  15. package/dist/locale/locale.controller.js +15 -3
  16. package/dist/locale/locale.controller.js.map +1 -1
  17. package/dist/locale/locale.service.d.ts +2 -1
  18. package/dist/locale/locale.service.d.ts.map +1 -1
  19. package/dist/locale/locale.service.js +57 -3
  20. package/dist/locale/locale.service.js.map +1 -1
  21. package/dist/locale/locale.service.spec.js +33 -25
  22. package/dist/locale/locale.service.spec.js.map +1 -1
  23. package/dist/menu/menu.controller.d.ts.map +1 -1
  24. package/dist/menu/menu.controller.js +0 -4
  25. package/dist/menu/menu.controller.js.map +1 -1
  26. package/dist/role/role.controller.d.ts.map +1 -1
  27. package/dist/role/role.controller.js +0 -4
  28. package/dist/role/role.controller.js.map +1 -1
  29. package/dist/route/route.controller.d.ts.map +1 -1
  30. package/dist/route/route.controller.js +0 -4
  31. package/dist/route/route.controller.js.map +1 -1
  32. package/dist/screen/screen.controller.d.ts.map +1 -1
  33. package/dist/screen/screen.controller.js +0 -4
  34. package/dist/screen/screen.controller.js.map +1 -1
  35. package/dist/setting/dto/setting-user.dto.d.ts +4 -0
  36. package/dist/setting/dto/setting-user.dto.d.ts.map +1 -0
  37. package/dist/{entities/role.entity.js → setting/dto/setting-user.dto.js} +8 -19
  38. package/dist/setting/dto/setting-user.dto.js.map +1 -0
  39. package/dist/setting/settings.controller.d.ts +7 -1
  40. package/dist/setting/settings.controller.d.ts.map +1 -1
  41. package/dist/setting/settings.controller.js +14 -12
  42. package/dist/setting/settings.controller.js.map +1 -1
  43. package/dist/setting/settings.service.d.ts +4 -2
  44. package/dist/setting/settings.service.d.ts.map +1 -1
  45. package/dist/setting/settings.service.js +27 -19
  46. package/dist/setting/settings.service.js.map +1 -1
  47. package/dist/user/user.controller.d.ts.map +1 -1
  48. package/dist/user/user.controller.js +0 -4
  49. package/dist/user/user.controller.js.map +1 -1
  50. package/hedhog.yaml +8 -1
  51. package/package.json +3 -2
  52. package/dist/entities/country.entity.d.ts +0 -6
  53. package/dist/entities/country.entity.d.ts.map +0 -1
  54. package/dist/entities/country.entity.js +0 -38
  55. package/dist/entities/country.entity.js.map +0 -1
  56. package/dist/entities/index.d.ts +0 -12
  57. package/dist/entities/index.d.ts.map +0 -1
  58. package/dist/entities/index.js +0 -28
  59. package/dist/entities/index.js.map +0 -1
  60. package/dist/entities/locale.entity.d.ts +0 -7
  61. package/dist/entities/locale.entity.d.ts.map +0 -1
  62. package/dist/entities/locale.entity.js +0 -44
  63. package/dist/entities/locale.entity.js.map +0 -1
  64. package/dist/entities/menu.entity.d.ts +0 -9
  65. package/dist/entities/menu.entity.d.ts.map +0 -1
  66. package/dist/entities/menu.entity.js +0 -57
  67. package/dist/entities/menu.entity.js.map +0 -1
  68. package/dist/entities/multifactor.entity.d.ts +0 -5
  69. package/dist/entities/multifactor.entity.d.ts.map +0 -1
  70. package/dist/entities/multifactor.entity.js.map +0 -1
  71. package/dist/entities/role.entity.d.ts +0 -5
  72. package/dist/entities/role.entity.d.ts.map +0 -1
  73. package/dist/entities/role.entity.js.map +0 -1
  74. package/dist/entities/route.entity.d.ts +0 -6
  75. package/dist/entities/route.entity.d.ts.map +0 -1
  76. package/dist/entities/route.entity.js +0 -36
  77. package/dist/entities/route.entity.js.map +0 -1
  78. package/dist/entities/screen.entity.d.ts +0 -6
  79. package/dist/entities/screen.entity.d.ts.map +0 -1
  80. package/dist/entities/screen.entity.js +0 -36
  81. package/dist/entities/screen.entity.js.map +0 -1
  82. package/dist/entities/setting-group.entity.d.ts +0 -6
  83. package/dist/entities/setting-group.entity.d.ts.map +0 -1
  84. package/dist/entities/setting-group.entity.js +0 -39
  85. package/dist/entities/setting-group.entity.js.map +0 -1
  86. package/dist/entities/setting.entity.d.ts +0 -8
  87. package/dist/entities/setting.entity.d.ts.map +0 -1
  88. package/dist/entities/setting.entity.js +0 -51
  89. package/dist/entities/setting.entity.js.map +0 -1
  90. package/dist/entities/translation.entity.d.ts +0 -8
  91. package/dist/entities/translation.entity.d.ts.map +0 -1
  92. package/dist/entities/translation.entity.js +0 -42
  93. package/dist/entities/translation.entity.js.map +0 -1
  94. package/dist/entities/user.entity.d.ts +0 -9
  95. package/dist/entities/user.entity.d.ts.map +0 -1
  96. package/dist/entities/user.entity.js +0 -51
  97. package/dist/entities/user.entity.js.map +0 -1
  98. package/src/entities/country.entity.ts +0 -19
  99. package/src/entities/index.ts +0 -11
  100. package/src/entities/locale.entity.ts +0 -24
  101. package/src/entities/menu.entity.ts +0 -35
  102. package/src/entities/multifactor.entity.ts +0 -12
  103. package/src/entities/role.entity.ts +0 -14
  104. package/src/entities/route.entity.ts +0 -17
  105. package/src/entities/screen.entity.ts +0 -17
  106. package/src/entities/setting-group.entity.ts +0 -20
  107. package/src/entities/setting.entity.ts +0 -30
  108. package/src/entities/translation.entity.ts +0 -21
  109. package/src/entities/user.entity.ts +0 -29
package/README.md CHANGED
@@ -8,10 +8,12 @@
8
8
 
9
9
  - [Overview](#overview)
10
10
  - [Hedhog Auth](#hedhog-auth)
11
+ - [Hedhog Locale](#hedhog-locale)
11
12
  - [Hedhog Menu](#hedhog-menu)
12
13
  - [Hedhog Role](#hedhog-role)
13
14
  - [Hedhog Route](#hedhog-route)
14
15
  - [Hedhog Screen](#hedhog-screen)
16
+ - [Hedhog Setting](#hedhog-setting)
15
17
  - [Hedhog User](#hedhog-user)
16
18
 
17
19
  # Overview
@@ -23,9 +25,11 @@ Whether you need to secure access to resources, manage user roles, or handle fil
23
25
  ### Included Modules<
24
26
 
25
27
  - **@hedhog/auth**: Provides authentication and authorization mechanisms, ensuring secure access to application resources.
28
+ - **@hedhog/locale**: Provides solution for managing locales and translations across applications.
26
29
  - **@hedhog/menu**: Allows for the creation and management of dynamic menus within the application interface.
27
30
  - **@hedhog/role**: Facilitates the management of roles, controlling access to specific features or areas.
28
31
  - **@hedhog/route**: Provides a comprehensive system for managing routes within your application.
32
+ - **@hedhog/setting**: Provides a solution for managing application settings.
29
33
  - **@hedhog/screen**: Provides a structure for managing different screens and UI components.
30
34
  - **@hedhog/user**: Manages user accounts, including creation, updates, and deletion, along with password encryption and secure access.
31
35
 
@@ -91,6 +95,7 @@ The `AuthService` provides methods for:
91
95
  ```plaintext
92
96
  ├── auth.controller.ts # Defines routes for authentication
93
97
  ├── auth.service.ts # Contains authentication logic
98
+ ├── auth.service.spec.ts # Testing file for auth service
94
99
  ├── auth.module.ts # Authentication module
95
100
  ├── dto/
96
101
  │ ├── forget.dto.ts # Data Transfer Object for password reset
@@ -109,6 +114,131 @@ The `AuthService` provides methods for:
109
114
 
110
115
  ---
111
116
 
117
+ # Hedhog Locale
118
+
119
+ **Hedhog Locale** module provides a powerful solution for managing locales and translations across applications. It includes functionalities to retrieve, create, update, and delete locale data, with support for pagination and localization. The module integrates seamlessly within the HedHog ecosystem, using @hedhog/pagination for handling paginated responses and @hedhog/prisma for database interactions.
120
+
121
+ ### Controller Endpoints
122
+
123
+ #### `GET /locales/system/enables`
124
+
125
+ - **Description**: Retrieve a paginated list of enabled locales.
126
+ - **Authentication**: Not required (public endpoint).
127
+ - **Parameters**:
128
+ - `locale (string)`: Locale code for filtering.
129
+ - Pagination parameters (optional).
130
+
131
+ #### `GET /locales/:localeCode/:namespace`
132
+
133
+ - **Description**: Retrieve translations for a specific locale and namespace.
134
+ - **Authentication**: Not required (public endpoint).
135
+ - **Parameters**:
136
+ - `localeCode (string)`: The locale code to fetch translations for.
137
+ - `namespace (string)`: The namespace to fetch translations from.
138
+
139
+ #### `GET /locales`
140
+
141
+ - **Description**: Retrieve a paginated list of locales.
142
+ - **Authentication**: Required.
143
+ - **Pagination**: Supports pagination through query parameters.
144
+
145
+ #### `GET /locales/:id`
146
+
147
+ - **Description**: Retrieve a specific locale by its ID.
148
+ - **Authentication**: Required.
149
+ - **Parameters**:
150
+ - `id (number)`: The ID of the locale to retrieve.
151
+
152
+ #### `POST /locales`
153
+
154
+ - **Description**: Create a new locale entry.
155
+ - **Authentication**: Required.
156
+ - **Body**:
157
+ - `code (string)`: The code of the locale.
158
+ - `region (string)`: The region of the locale.
159
+
160
+ #### `PATCH /locales/:id`
161
+
162
+ - **Description**: Update an existing locale entry.
163
+ - **Authentication**: Required.
164
+ - **Parameters**:
165
+ - `id (number)`: The ID of the locale to update.
166
+ - **Body**:
167
+ - `code (string, optional)`: Updated code of the locale.
168
+ - `region (string, optional)`: Updated region of the locale.
169
+
170
+ #### `DELETE /locales`
171
+
172
+ - **Description**: Delete one or more locales.
173
+ - **Authentication**: Required.
174
+ - **Body**:
175
+ - `ids (number[])`: Array of locale IDs to delete.
176
+
177
+ ### Service Methods
178
+
179
+ #### `getEnables(locale: string, paginationParams: PaginationDTO)`
180
+
181
+ - **Description**: Retrieves a paginated list of enabled locales based on locale code and pagination parameters.
182
+ - **Parameters**:
183
+ - `locale (string)`: Locale code for filtering.
184
+ - `paginationParams (PaginationDTO)`: Includes pagination criteria.
185
+
186
+ #### `getTranslations(localeCode: string, namespace: string)`
187
+
188
+ - **Description**: Retrieves translations for a given locale code and namespace.
189
+ - **Parameters**:
190
+ - `localeCode (string)`: The locale code to fetch translations for.
191
+ - `namespace (string)`: The namespace to fetch translations from.
192
+
193
+ #### `get(paginationParams: PaginationDTO)`
194
+
195
+ - **Description**: Retrieves a paginated list of all locales.
196
+ - **Parameters**:
197
+ - `paginationParams (PaginationDTO)`: Includes pagination criteria.
198
+
199
+ #### `getById(localeId: number)`
200
+
201
+ - **Description**: Retrieves a specific locale by its ID.
202
+ - **Parameters**:
203
+ - `localeId (number)`: ID of the locale to retrieve.
204
+
205
+ #### `create(data: CreateDTO)`
206
+
207
+ - **Description**: Creates a new locale entry.
208
+ - **Parameters**:
209
+ - `data (CreateDTO)`: Includes code and region of the new locale.
210
+
211
+ #### `update(id: number, data: UpdateDTO)`
212
+
213
+ - **Description**: Updates an existing locale entry.
214
+ - **Parameters**:
215
+ - `id (number)`: ID of the locale to update.
216
+ - `data (UpdateDTO)`: Includes updated code and region.
217
+
218
+ #### `delete(data: DeleteDTO)`
219
+
220
+ - **Description**: Deletes one or more locale entries.
221
+ - **Parameters**:
222
+ - `data (DeleteDTO)`: Includes array of IDs to delete.
223
+
224
+ ### Folder Structure
225
+
226
+ ```plaintext
227
+ |── dto/ # Data Transfer Objects
228
+ │ ├── create.dto.ts # DTO for creating locales
229
+ │ ├── delete.dto.ts # DTO for deleting locales
230
+ │ └── update.dto.ts # DTO for updating locales
231
+ |── locale.controller.ts # Controller for locales
232
+ |── locale.decorator.ts # Decorator for injecting locale into requests
233
+ |── locale.middleware.ts # Middleware to handle locale-specific processing
234
+ |── locale.module.ts # Module definition for locales
235
+ |── locale.service.ts # Service class for locales logic
236
+ ├── locale.service.spec.ts # Testing file for locale service
237
+ |── index.ts # Main export file for the module
238
+ ```
239
+
240
+ ---
241
+
112
242
  # Hedhog Menu
113
243
 
114
244
  **HedHog Menu** is a library for managing menus within the HedHog framework. It provides a set of RESTful endpoints for CRUD operations on menu items, as well as functionalities to handle pagination and ordering of menus.
@@ -146,6 +276,7 @@ The `MenuService` class contains the business logic for handling menu operations
146
276
  ```plaintext
147
277
  ├── menu.controller.ts # Handles HTTP requests related to menus
148
278
  ├── menu.service.ts # Contains business logic for menu operations
279
+ ├── menu.service.spec.ts # Testing file for menu service
149
280
  ├── menu.module.ts # Module definition for menu functionalities
150
281
  ├── dto/
151
282
  │ ├── create.dto.ts # Data Transfer Object for creating a menu
@@ -371,6 +502,7 @@ The `MenuService` class contains the business logic for handling menu operations
371
502
  ├── role.controller.ts # Handles HTTP requests related to roles
372
503
  ├── role.module.ts # Module definition for the role
373
504
  └── role.service.ts # Service class for role-related logic
505
+ └── role.service.spec.ts # Testing file for role service
374
506
  ```
375
507
 
376
508
  ---
@@ -526,7 +658,8 @@ The `MenuService` class contains the business logic for handling menu operations
526
658
  │ └── route.guard.ts # Guard for routes
527
659
  ├── route.controller.ts # Handles HTTP requests related to routes
528
660
  ├── route.module.ts # Module definition for the route
529
- └── route.service.ts # Service class for route-related logic
661
+ ├── route.service.ts # Service class for route-related logic
662
+ └── route.service.spec.ts # Testing file for route service
530
663
  ```
531
664
 
532
665
  ---
@@ -535,29 +668,29 @@ The `MenuService` class contains the business logic for handling menu operations
535
668
 
536
669
  **Hedhog Setting** module provides a comprehensive solution for managing application settings. It includes functionalities to create, read, update, and delete settings, along with support for pagination and search capabilities. This module integrates with the HedHog ecosystem, utilizing @hedhog/pagination for managing paginated results and @hedhog/prisma for database interactions.
537
670
 
538
- ## Controller Endpoints
671
+ ### Controller Endpoints
539
672
 
540
- ### `GET /settings`
673
+ #### `GET /settings`
541
674
 
542
675
  - **Description**: Retrieve a paginated list of settings.
543
676
  - **Authentication**: Required (uses `AuthGuard`).
544
677
  - **Pagination**: Supports pagination through query parameters.
545
678
 
546
- ### `GET /settings/:settingId`
679
+ #### `GET /settings/:settingId`
547
680
 
548
681
  - **Description**: Retrieve a specific setting by its ID.
549
682
  - **Authentication**: Required (uses AuthGuard).
550
683
  - **Parameters**:
551
684
  - **settingId** (number): The ID of the setting to retrieve.
552
685
 
553
- ### `POST /settings`
686
+ #### `POST /settings`
554
687
 
555
688
  - **Description**: Create a new setting.
556
689
  - **Authentication**: Required (uses AuthGuard).
557
690
  - **Body**:
558
691
  - **name** (string): Name of the setting.
559
692
 
560
- ### `PATCH /settings/:settingId`
693
+ #### `PATCH /settings/:settingId`
561
694
 
562
695
  - **Description**: Update an existing setting.
563
696
  - **Authentication**: Required (uses AuthGuard).
@@ -566,44 +699,45 @@ The `MenuService` class contains the business logic for handling menu operations
566
699
  - **Body**:
567
700
  - **name** (string, optional): Updated name of the setting.
568
701
 
569
- ### `DELETE /settings`
702
+ #### `DELETE /settings`
570
703
 
571
704
  - **Description**: Delete one or more settings.
572
705
  - **Authentication**: Required (uses AuthGuard).
573
706
  - **Body**:
574
707
  - **ids** (number[]): Array of setting IDs to delete.
575
708
 
576
- ## Service Methods
709
+ ### Service Methods
577
710
 
578
- - **getSettings(paginationParams: PaginationDTO)**
711
+ #### `getSettings(paginationParams: PaginationDTO)`
579
712
 
580
- - **Description**: Retrieves a paginated list of settings with optional search functionality.
581
- - **Parameters**:
582
- - **paginationParams**: Includes pagination and search criteria.
713
+ - **Description**: Retrieves a paginated list of settings with optional search functionality.
714
+ - **Parameters**:
715
+ - **paginationParams**: Includes pagination and search criteria.
583
716
 
584
- - **get(settingId: number)**
717
+ #### `get(settingId: number)`
718
+
719
+ - **Description**: Retrieves a specific setting by its ID.
720
+ - **Parameters**:
721
+ - **settingId**: ID of the setting to retrieve.
585
722
 
586
- - **Description**: Retrieves a specific setting by its ID.
587
- - **Parameters**:
588
- - **settingId**: ID of the setting to retrieve.
723
+ #### `create(data: CreateDTO)`
589
724
 
590
- - **create(data: CreateDTO)**
725
+ - **Description**: Creates a new setting.
726
+ - **Parameters**:
727
+ - **data**: Includes name of the setting.
591
728
 
592
- - **Description**: Creates a new setting.
593
- - **Parameters**:
594
- - **data**: Includes name of the setting.
729
+ #### `update(id: number, data: UpdateDTO)`
595
730
 
596
- - **update(id: number, data: UpdateDTO)**
731
+ - **Description**: Updates an existing setting.
732
+ - **Parameters**:
733
+ - **id**: ID of the setting to update.
734
+ - **data**: Includes updated name of the setting.
597
735
 
598
- - **Description**: Updates an existing setting.
599
- - **Parameters**:
600
- - **id**: ID of the setting to update.
601
- - **data**: Includes updated name of the setting.
736
+ #### `delete(data: DeleteDTO)`
602
737
 
603
- - **delete(data: DeleteDTO)**
604
- - **Description**: Deletes one or more settings.
605
- - **Parameters**:
606
- - **data**: Includes array of ids to delete.
738
+ - **Description**: Deletes one or more settings.
739
+ - **Parameters**:
740
+ - **data**: Includes array of ids to delete.
607
741
 
608
742
  ## Folder Structure
609
743
 
@@ -615,6 +749,7 @@ The `MenuService` class contains the business logic for handling menu operations
615
749
  |── setting.controller.ts # Controller for settings
616
750
  |── setting.module.ts # Module definition for settings
617
751
  |── setting.service.ts # Service class for settings logic
752
+ |── setting.service.spec.ts # Testing file for setting service
618
753
  ```
619
754
 
620
755
  ---
@@ -715,6 +850,7 @@ The `MenuService` class contains the business logic for handling menu operations
715
850
  ├── screen.controller.ts # Handles HTTP requests related to screens
716
851
  ├── screen.module.ts # Module definition for the screen
717
852
  └── screen.service.ts # Service class for screen-related logic
853
+ └── screen.service.spec.ts # Testing file for screen service
718
854
  ```
719
855
 
720
856
  ---
@@ -773,38 +909,38 @@ The **Hedhog User** module in HedHog provides functionality to manage user data
773
909
 
774
910
  ### Service Methods
775
911
 
776
- **getUsers(paginationParams: PaginationDTO)**
912
+ #### `getUsers(paginationParams: PaginationDTO)`
777
913
 
778
914
  - **Description**: Retrieves a paginated list of users with optional search functionality.
779
915
  - **Parameters**:
780
916
  - **paginationParams**: Includes pagination and search criteria.
781
917
 
782
- **get(userId: number)**
918
+ #### `get(userId: number)`
783
919
 
784
920
  - **Description**: Retrieves a specific user by its ID.
785
921
  - **Parameters**:
786
922
  - **userId**: ID of the user to retrieve.
787
923
 
788
- **hashPassword(password: string): Promise<string>**
924
+ #### `hashPassword(password: string): Promise<string>`
789
925
 
790
926
  - **Description**: Hashes a password using bcrypt.
791
927
  - **Parameters**:
792
928
  - **password**: The password to be hashed.
793
929
 
794
- **create(data: CreateDTO)**
930
+ #### `create(data: CreateDTO)`
795
931
 
796
932
  - **Description**: Creates a new user.
797
933
  - **Parameters**:
798
934
  - **data**: Includes email, name, and password.
799
935
 
800
- **update(id: number, data: UpdateDTO)**
936
+ #### `update(id: number, data: UpdateDTO)`
801
937
 
802
938
  - **Description**: Updates an existing user.
803
939
  - **Parameters**:
804
940
  - **id**: ID of the user to update.
805
941
  - **data**: Includes updated email, name, and password.
806
942
 
807
- **delete(data: DeleteDTO)**
943
+ #### `delete(data: DeleteDTO)`
808
944
 
809
945
  - **Description**: Deletes one or more users.
810
946
  - **Parameters**:
@@ -1 +1 @@
1
- {"version":3,"file":"auth.module.d.ts","sourceRoot":"","sources":["../../src/auth/auth.module.ts"],"names":[],"mappings":"AASA,qBA6Ba,UAAU;CAAG"}
1
+ {"version":3,"file":"auth.module.d.ts","sourceRoot":"","sources":["../../src/auth/auth.module.ts"],"names":[],"mappings":"AASA,qBAiCa,UAAU;CAAG"}
@@ -24,6 +24,7 @@ exports.AuthModule = AuthModule = __decorate([
24
24
  (0, common_1.forwardRef)(() => jwt_1.JwtModule.registerAsync({
25
25
  global: true,
26
26
  useFactory: () => {
27
+ console.log('AuthModule -> process.env.JWT_SECRET', process.env.JWT_SECRET);
27
28
  return {
28
29
  secret: String(process.env.JWT_SECRET),
29
30
  global: true,
@@ -1 +1 @@
1
- {"version":3,"file":"auth.module.js","sourceRoot":"","sources":["../../src/auth/auth.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAoD;AACpD,iDAA6C;AAC7C,uDAAmD;AACnD,2CAA8C;AAC9C,qCAAwC;AACxC,uCAAyC;AACzC,oDAAgD;AAChD,uCAA0C;AA+BnC,IAAM,UAAU,GAAhB,MAAM,UAAU;CAAG,CAAA;AAAb,gCAAU;qBAAV,UAAU;IA7BtB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,IAAA,mBAAU,EAAC,GAAG,EAAE,CACd,eAAS,CAAC,aAAa,CAAC;gBACtB,MAAM,EAAE,IAAI;gBACZ,UAAU,E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AAS,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,KAAK;yBAC/C;qBACF,CAAC;gBACJ,CAAC;aACF,CAAC,CACH;YACD,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,qBAAY,CAAC;YAC9B,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,iBAAU,CAAC;SAC7B;QACD,WAAW,EAAE,CAAC,gCAAc,CAAC;QAC7B,SAAS,EAAE;YACT,0BAAW;YACX;gBACE,OAAO,EAAE,gBAAS;gBAClB,QAAQ,EAAE,sBAAS;aACpB;SACF;QACD,OAAO,EAAE,CAAC,0BAAW,CAAC;KACvB,CAAC;GACW,UAAU,CAAG"}
@@ -1 +1 @@
1
- {"version":3,"file":"create.dto.d.ts","sourceRoot":"","sources":["../../../src/locale/dto/create.dto.ts"],"names":[],"mappings":"AAUA,qBAAa,SAAS;IAEpB,IAAI,EAAE,MAAM,CAAC;IAGb,IAAI,EAAE,MAAM,CAAC;IAGb,MAAM,EAAE,MAAM,CAAC;CAChB"}
1
+ {"version":3,"file":"create.dto.d.ts","sourceRoot":"","sources":["../../../src/locale/dto/create.dto.ts"],"names":[],"mappings":"AAEA,qBAAa,SAAS;IAEpB,IAAI,EAAE,MAAM,CAAC;IAGb,IAAI,EAAE,MAAM,CAAC;IAGb,MAAM,EAAE,MAAM,CAAC;CAChB"}
@@ -1 +1 @@
1
- {"version":3,"file":"create.dto.js","sourceRoot":"","sources":["../../../src/locale/dto/create.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAQyB;AAEzB,MAAa,SAAS;CASrB;AATD,8BASC;AAPC;IADC,IAAA,0BAAQ,GAAE;;uCACE;AAGb;IADC,IAAA,0BAAQ,GAAE;;uCACE;AAGb;IADC,IAAA,0BAAQ,GAAE;;yCACI"}
1
+ {"version":3,"file":"create.dto.js","sourceRoot":"","sources":["../../../src/locale/dto/create.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAA2C;AAE3C,MAAa,SAAS;CASrB;AATD,8BASC;AAPC;IADC,IAAA,0BAAQ,GAAE;;uCACE;AAGb;IADC,IAAA,0BAAQ,GAAE;;uCACE;AAGb;IADC,IAAA,0BAAQ,GAAE;;yCACI"}
@@ -0,0 +1,4 @@
1
+ export declare class SetEnabledDTO {
2
+ codes: string[];
3
+ }
4
+ //# sourceMappingURL=set-enabled.dto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"set-enabled.dto.d.ts","sourceRoot":"","sources":["../../../src/locale/dto/set-enabled.dto.ts"],"names":[],"mappings":"AAEA,qBAAa,aAAa;IAKxB,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB"}
@@ -9,22 +9,16 @@ var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.Multifactor = void 0;
13
- const typeorm_1 = require("typeorm");
14
- let Multifactor = class Multifactor {
15
- };
16
- exports.Multifactor = Multifactor;
17
- __decorate([
18
- (0, typeorm_1.PrimaryGeneratedColumn)(),
19
- __metadata("design:type", Number)
20
- ], Multifactor.prototype, "id", void 0);
12
+ exports.SetEnabledDTO = void 0;
13
+ const class_validator_1 = require("class-validator");
14
+ class SetEnabledDTO {
15
+ }
16
+ exports.SetEnabledDTO = SetEnabledDTO;
21
17
  __decorate([
22
- (0, typeorm_1.Column)(),
23
- __metadata("design:type", String)
24
- ], Multifactor.prototype, "slug", void 0);
25
- exports.Multifactor = Multifactor = __decorate([
26
- (0, typeorm_1.Entity)({
27
- name: 'multifactors',
28
- })
29
- ], Multifactor);
30
- //# sourceMappingURL=multifactor.entity.js.map
18
+ (0, class_validator_1.IsArray)(),
19
+ (0, class_validator_1.IsString)({
20
+ each: true,
21
+ }),
22
+ __metadata("design:type", Array)
23
+ ], SetEnabledDTO.prototype, "codes", void 0);
24
+ //# sourceMappingURL=set-enabled.dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"set-enabled.dto.js","sourceRoot":"","sources":["../../../src/locale/dto/set-enabled.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAoD;AAEpD,MAAa,aAAa;CAMzB;AAND,sCAMC;AADC;IAJC,IAAA,yBAAO,GAAE;IACT,IAAA,0BAAQ,EAAC;QACR,IAAI,EAAE,IAAI;KACX,CAAC;;4CACc"}
@@ -1 +1 @@
1
- {"version":3,"file":"update.dto.d.ts","sourceRoot":"","sources":["../../../src/locale/dto/update.dto.ts"],"names":[],"mappings":"AAUA,qBAAa,SAAS;IAGpB,IAAI,CAAC,EAAE,MAAM,CAAC;IAId,IAAI,CAAC,EAAE,MAAM,CAAC;IAId,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
1
+ {"version":3,"file":"update.dto.d.ts","sourceRoot":"","sources":["../../../src/locale/dto/update.dto.ts"],"names":[],"mappings":"AAEA,qBAAa,SAAS;IAGpB,IAAI,CAAC,EAAE,MAAM,CAAC;IAId,IAAI,CAAC,EAAE,MAAM,CAAC;IAId,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
@@ -1 +1 @@
1
- {"version":3,"file":"update.dto.js","sourceRoot":"","sources":["../../../src/locale/dto/update.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAQyB;AAEzB,MAAa,SAAS;CAYrB;AAZD,8BAYC;AATC;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;uCACC;AAId;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;uCACC;AAId;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;yCACG"}
1
+ {"version":3,"file":"update.dto.js","sourceRoot":"","sources":["../../../src/locale/dto/update.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAuD;AAEvD,MAAa,SAAS;CAYrB;AAZD,8BAYC;AATC;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;uCACC;AAId;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;uCACC;AAId;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;yCACG"}
@@ -2,14 +2,16 @@ import { CreateDTO } from './dto/create.dto';
2
2
  import { DeleteDTO } from './dto/delete.dto';
3
3
  import { UpdateDTO } from './dto/update.dto';
4
4
  import { LocaleService } from './locale.service';
5
+ import { SetEnabledDTO } from './dto/set-enabled.dto';
5
6
  export declare class LocaleController {
6
7
  private readonly localeService;
7
8
  constructor(localeService: LocaleService);
8
9
  getEnables(paginationParams: any, locale: string): Promise<import("@hedhog/pagination").PaginatedResult<unknown>>;
9
10
  getTranslations(localeCode: string, namespace: string): Promise<{}>;
10
- get(paginationParams: any): Promise<import("@hedhog/pagination").PaginatedResult<unknown>>;
11
+ get(paginationParams: any, locale: string): Promise<import("@hedhog/pagination").PaginatedResult<unknown>>;
11
12
  getById(id: number): Promise<any>;
12
13
  create(data: CreateDTO): Promise<any>;
14
+ setEnabled({ codes }: SetEnabledDTO): Promise<any>;
13
15
  update(id: number, data: UpdateDTO): Promise<any>;
14
16
  delete(data: DeleteDTO): Promise<any>;
15
17
  }
@@ -1 +1 @@
1
- {"version":3,"file":"locale.controller.d.ts","sourceRoot":"","sources":["../../src/locale/locale.controller.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAIjD,qBACa,gBAAgB;IAGzB,OAAO,CAAC,QAAQ,CAAC,aAAa;gBAAb,aAAa,EAAE,aAAa;IAKzC,UAAU,CAAe,gBAAgB,KAAA,EAAY,MAAM,EAAE,MAAM;IAMnE,eAAe,CACE,UAAU,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM;IAMjC,GAAG,CAAe,gBAAgB,KAAA;IAKlC,OAAO,CAA4B,EAAE,EAAE,MAAM;IAKnD,MAAM,CAAS,IAAI,EAAE,SAAS;IAKxB,MAAM,CAA4B,EAAE,EAAE,MAAM,EAAU,IAAI,EAAE,SAAS;IAQrE,MAAM,CAAS,IAAI,EAAE,SAAS;CAGrC"}
1
+ {"version":3,"file":"locale.controller.d.ts","sourceRoot":"","sources":["../../src/locale/locale.controller.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGjD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,qBACa,gBAAgB;IAGzB,OAAO,CAAC,QAAQ,CAAC,aAAa;gBAAb,aAAa,EAAE,aAAa;IAKzC,UAAU,CAAe,gBAAgB,KAAA,EAAY,MAAM,EAAE,MAAM;IAMnE,eAAe,CACE,UAAU,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM;IAMjC,GAAG,CAAe,gBAAgB,KAAA,EAAY,MAAM,EAAE,MAAM;IAK5D,OAAO,CAA4B,EAAE,EAAE,MAAM;IAKnD,MAAM,CAAS,IAAI,EAAE,SAAS;IAKxB,UAAU,CAAS,EAAE,KAAK,EAAE,EAAE,aAAa;IAK3C,MAAM,CAA4B,EAAE,EAAE,MAAM,EAAU,IAAI,EAAE,SAAS;IAQrE,MAAM,CAAS,IAAI,EAAE,SAAS;CAGrC"}
@@ -21,6 +21,7 @@ const update_dto_1 = require("./dto/update.dto");
21
21
  const locale_service_1 = require("./locale.service");
22
22
  const locale_decorator_1 = require("./locale.decorator");
23
23
  const public_decorator_1 = require("../auth/decorators/public.decorator");
24
+ const set_enabled_dto_1 = require("./dto/set-enabled.dto");
24
25
  let LocaleController = class LocaleController {
25
26
  constructor(localeService) {
26
27
  this.localeService = localeService;
@@ -31,8 +32,8 @@ let LocaleController = class LocaleController {
31
32
  async getTranslations(localeCode, namespace) {
32
33
  return this.localeService.getTranslations(localeCode, namespace);
33
34
  }
34
- async get(paginationParams) {
35
- return this.localeService.get(paginationParams);
35
+ async get(paginationParams, locale) {
36
+ return this.localeService.get(locale, paginationParams);
36
37
  }
37
38
  async getById(id) {
38
39
  return this.localeService.getById(id);
@@ -40,6 +41,9 @@ let LocaleController = class LocaleController {
40
41
  create(data) {
41
42
  return this.localeService.create(data);
42
43
  }
44
+ async setEnabled({ codes }) {
45
+ return this.localeService.setEnabled(codes);
46
+ }
43
47
  async update(id, data) {
44
48
  return this.localeService.update({
45
49
  id,
@@ -72,8 +76,9 @@ __decorate([
72
76
  __decorate([
73
77
  (0, common_1.Get)(),
74
78
  __param(0, (0, pagination_1.Pagination)()),
79
+ __param(1, (0, locale_decorator_1.Locale)()),
75
80
  __metadata("design:type", Function),
76
- __metadata("design:paramtypes", [Object]),
81
+ __metadata("design:paramtypes", [Object, String]),
77
82
  __metadata("design:returntype", Promise)
78
83
  ], LocaleController.prototype, "get", null);
79
84
  __decorate([
@@ -90,6 +95,13 @@ __decorate([
90
95
  __metadata("design:paramtypes", [create_dto_1.CreateDTO]),
91
96
  __metadata("design:returntype", void 0)
92
97
  ], LocaleController.prototype, "create", null);
98
+ __decorate([
99
+ (0, common_1.Put)(),
100
+ __param(0, (0, common_1.Body)()),
101
+ __metadata("design:type", Function),
102
+ __metadata("design:paramtypes", [set_enabled_dto_1.SetEnabledDTO]),
103
+ __metadata("design:returntype", Promise)
104
+ ], LocaleController.prototype, "setEnabled", null);
93
105
  __decorate([
94
106
  (0, common_1.Patch)(':id'),
95
107
  __param(0, (0, common_1.Param)('id', common_1.ParseIntPipe)),
@@ -1 +1 @@
1
- {"version":3,"file":"locale.controller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
@@ -7,6 +7,7 @@ export declare class LocaleService {
7
7
  private readonly prismaService;
8
8
  private readonly paginationService;
9
9
  constructor(prismaService: PrismaService, paginationService: PaginationService);
10
+ setEnabled(codes: string[]): Promise<any>;
10
11
  getEnables(locale: string, paginationParams: PaginationDTO): Promise<import("@hedhog/pagination").PaginatedResult<unknown>>;
11
12
  parseLocale(locale: string): {
12
13
  code: string;
@@ -14,7 +15,7 @@ export declare class LocaleService {
14
15
  locales: string[];
15
16
  };
16
17
  getTranslations(localeCode: string, namespace: string): Promise<{}>;
17
- get(paginationParams: PaginationDTO): Promise<import("@hedhog/pagination").PaginatedResult<unknown>>;
18
+ get(locale: string, paginationParams: PaginationDTO): Promise<import("@hedhog/pagination").PaginatedResult<unknown>>;
18
19
  getById(localesId: number): Promise<any>;
19
20
  create(data: CreateDTO): Promise<any>;
20
21
  update({ id, data }: {
@@ -1 +1 @@
1
- {"version":3,"file":"locale.service.d.ts","sourceRoot":"","sources":["../../src/locale/locale.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAO/C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,qBACa,aAAa;IAGtB,OAAO,CAAC,QAAQ,CAAC,aAAa;IAE9B,OAAO,CAAC,QAAQ,CAAC,iBAAiB;gBAFjB,aAAa,EAAE,aAAa,EAE5B,iBAAiB,EAAE,iBAAiB;IAGjD,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,aAAa;IAiEhE,WAAW,CAAC,MAAM,EAAE,MAAM;;;;;IAWpB,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAwCrD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AAC,IAAI,EAAE,SAAS,CAAA;KAAE;IAOpD,MAAM,CAAC,EAAE,GAAG,EAAE,EAAE,SAAS;CAehC"}
@@ -21,6 +21,29 @@ let LocaleService = class LocaleService {
21
21
  this.prismaService = prismaService;
22
22
  this.paginationService = paginationService;
23
23
  }
24
+ async setEnabled(codes) {
25
+ if (!codes || codes.length < 1) {
26
+ throw new common_1.BadRequestException('You must select at least one item code.');
27
+ }
28
+ await this.prismaService.locales.updateMany({
29
+ where: {
30
+ enabled: true,
31
+ },
32
+ data: {
33
+ enabled: false,
34
+ },
35
+ });
36
+ return this.prismaService.locales.updateMany({
37
+ where: {
38
+ code: {
39
+ in: codes,
40
+ },
41
+ },
42
+ data: {
43
+ enabled: true,
44
+ },
45
+ });
46
+ }
24
47
  async getEnables(locale, paginationParams) {
25
48
  const fields = ['code', 'region'];
26
49
  const OR = this.prismaService.createInsensitiveSearch(fields, paginationParams);
@@ -111,14 +134,45 @@ let LocaleService = class LocaleService {
111
134
  }
112
135
  return translations;
113
136
  }
114
- async get(paginationParams) {
115
- const fields = [];
137
+ async get(locale, paginationParams) {
138
+ const fields = ['code', 'region'];
116
139
  const OR = this.prismaService.createInsensitiveSearch(fields, paginationParams);
117
- let result = await this.paginationService.paginate(this.prismaService.locales, paginationParams, {
140
+ const result = await this.paginationService.paginate(this.prismaService.locales, paginationParams, {
118
141
  where: {
119
142
  OR,
120
143
  },
121
144
  });
145
+ const codes = [];
146
+ for (const item of result.data) {
147
+ codes.push(item.code);
148
+ }
149
+ const { code, region, locales } = this.parseLocale(locale);
150
+ const where = {
151
+ locales: {
152
+ code,
153
+ },
154
+ translation_namespaces: {
155
+ name: 'translation',
156
+ },
157
+ };
158
+ if (locales.length > 1) {
159
+ where.locale.region = region;
160
+ }
161
+ const values = await this.prismaService.translations.findMany({
162
+ where,
163
+ select: {
164
+ name: true,
165
+ value: true,
166
+ },
167
+ });
168
+ for (let i = 0; i < result.data.length; i++) {
169
+ for (const value of values) {
170
+ if (value.name === result.data[i].code) {
171
+ result.data[i].name = value.value;
172
+ break;
173
+ }
174
+ }
175
+ }
122
176
  return result;
123
177
  }
124
178
  async getById(localesId) {