@hedhog/admin 0.0.23 → 0.0.24
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +505 -93
- package/dist/admin.module.d.ts.map +1 -1
- package/dist/admin.module.js +3 -0
- package/dist/admin.module.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/setting/dto/create.dto.d.ts +4 -0
- package/dist/setting/dto/create.dto.d.ts.map +1 -0
- package/dist/setting/dto/create.dto.js +22 -0
- package/dist/setting/dto/create.dto.js.map +1 -0
- package/dist/setting/dto/update.dto.d.ts +4 -0
- package/dist/setting/dto/update.dto.d.ts.map +1 -0
- package/dist/setting/dto/update.dto.js +8 -0
- package/dist/setting/dto/update.dto.js.map +1 -0
- package/dist/setting/settings.controller.d.ts +14 -0
- package/dist/setting/settings.controller.d.ts.map +1 -0
- package/dist/setting/settings.controller.js +95 -0
- package/dist/setting/settings.controller.js.map +1 -0
- package/dist/setting/settings.module.d.ts +3 -0
- package/dist/setting/settings.module.d.ts.map +1 -0
- package/dist/setting/settings.module.js +31 -0
- package/dist/setting/settings.module.js.map +1 -0
- package/dist/setting/settings.service.d.ts +19 -0
- package/dist/setting/settings.service.d.ts.map +1 -0
- package/dist/setting/settings.service.js +70 -0
- package/dist/setting/settings.service.js.map +1 -0
- package/package.json +1 -1
- package/src/migrations/migrate-02.ts +6 -0
- package/src/migrations/migrate-03.ts +9 -1
- package/src/migrations/migrate-12.ts +8 -0
- package/src/migrations/migrate-17.ts +78 -0
- package/dist/auth/auth.service.spec.d.ts +0 -2
- package/dist/auth/auth.service.spec.d.ts.map +0 -1
- package/dist/auth/auth.service.spec.js +0 -17
- package/dist/auth/auth.service.spec.js.map +0 -1
package/README.md
CHANGED
@@ -9,7 +9,8 @@
|
|
9
9
|
- [Overview](#overview)
|
10
10
|
- [Hedhog Auth](#hedhog-auth)
|
11
11
|
- [Hedhog Menu](#hedhog-menu)
|
12
|
-
- [Hedhog
|
12
|
+
- [Hedhog Role](#hedhog-role)
|
13
|
+
- [Hedhog Route](#hedhog-route)
|
13
14
|
- [Hedhog Screen](#hedhog-screen)
|
14
15
|
- [Hedhog User](#hedhog-user)
|
15
16
|
|
@@ -23,7 +24,8 @@ Whether you need to secure access to resources, manage user roles, or handle fil
|
|
23
24
|
|
24
25
|
- **@hedhog/auth**: Provides authentication and authorization mechanisms, ensuring secure access to application resources.
|
25
26
|
- **@hedhog/menu**: Allows for the creation and management of dynamic menus within the application interface.
|
26
|
-
- **@hedhog/
|
27
|
+
- **@hedhog/role**: Facilitates the management of roles, controlling access to specific features or areas.
|
28
|
+
- **@hedhog/route**: Provides a comprehensive system for managing routes within your application.
|
27
29
|
- **@hedhog/screen**: Provides a structure for managing different screens and UI components.
|
28
30
|
- **@hedhog/user**: Manages user accounts, including creation, updates, and deletion, along with password encryption and secure access.
|
29
31
|
|
@@ -87,35 +89,22 @@ The `AuthService` provides methods for:
|
|
87
89
|
### Folder Structure
|
88
90
|
|
89
91
|
```plaintext
|
90
|
-
auth
|
91
|
-
├──
|
92
|
-
├──
|
93
|
-
├──
|
94
|
-
│ ├──
|
95
|
-
│ ├──
|
96
|
-
│
|
97
|
-
|
98
|
-
│ ├──
|
99
|
-
│
|
100
|
-
|
101
|
-
│
|
102
|
-
|
103
|
-
│
|
104
|
-
|
105
|
-
│
|
106
|
-
│ │ └── user.type.ts # Type definitions for user-related data
|
107
|
-
│ ├── enums/
|
108
|
-
│ │ └── multifactor-type.enum.ts # Enumeration for multi-factor authentication types
|
109
|
-
│ ├── guards/
|
110
|
-
│ │ └── auth.guard.ts # Guard for protecting routes
|
111
|
-
│ ├── migrations/
|
112
|
-
│ │ └── index.ts # Migration scripts
|
113
|
-
├── .gitignore # Specifies which files Git should ignore
|
114
|
-
├── package.json # Manages dependencies and scripts for the library
|
115
|
-
├── package-lock.json # Lock file for package dependencies
|
116
|
-
├── README.md # Documentation for the library
|
117
|
-
├── tsconfig.lib.json # TypeScript configuration for the library
|
118
|
-
└── tsconfig.production.json # TypeScript configuration for production builds
|
92
|
+
├── auth.controller.ts # Defines routes for authentication
|
93
|
+
├── auth.service.ts # Contains authentication logic
|
94
|
+
├── auth.module.ts # Authentication module
|
95
|
+
├── dto/
|
96
|
+
│ ├── forget.dto.ts # Data Transfer Object for password reset
|
97
|
+
│ ├── login.dto.ts # Data Transfer Object for login
|
98
|
+
│ └── otp.dto.ts # Data Transfer Object for OTP verification
|
99
|
+
├── decorators/
|
100
|
+
│ ├── public.decorator.ts # Custom decorator to mark public routes
|
101
|
+
│ └── user.decorator.ts # Custom decorator to get user from request
|
102
|
+
├── types/
|
103
|
+
│ └── user.type.ts # Type definitions for user-related data
|
104
|
+
├── enums/
|
105
|
+
│ └── multifactor-type.enum.ts # Enumeration for multi-factor authentication types
|
106
|
+
├── guards/
|
107
|
+
│ └── auth.guard.ts # Guard for protecting routes
|
119
108
|
```
|
120
109
|
|
121
110
|
---
|
@@ -155,27 +144,477 @@ The `MenuService` class contains the business logic for handling menu operations
|
|
155
144
|
### Folder Structure
|
156
145
|
|
157
146
|
```plaintext
|
158
|
-
menu
|
159
|
-
├──
|
160
|
-
├──
|
161
|
-
├──
|
162
|
-
│ ├──
|
163
|
-
│ ├──
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
147
|
+
├── menu.controller.ts # Handles HTTP requests related to menus
|
148
|
+
├── menu.service.ts # Contains business logic for menu operations
|
149
|
+
├── menu.module.ts # Module definition for menu functionalities
|
150
|
+
├── dto/
|
151
|
+
│ ├── create.dto.ts # Data Transfer Object for creating a menu
|
152
|
+
│ ├── update.dto.ts # Data Transfer Object for updating a menu
|
153
|
+
└── order.dto.ts # Data Transfer Object for updating menu order
|
154
|
+
```
|
155
|
+
|
156
|
+
---
|
157
|
+
|
158
|
+
# Hedhog Role
|
159
|
+
|
160
|
+
**HedHog Role** module is designed to handle role management within the HedHog framework. It allows for creating, updating, and deleting roles and managing their relationships with users, menus, routes, and screens.
|
161
|
+
|
162
|
+
### Features
|
163
|
+
|
164
|
+
- **Role Management**: Create, update, and delete roles.
|
165
|
+
- **User Associations**: Assign and manage users associated with roles.
|
166
|
+
- **Menu, Route, and Screen Associations**: Manage the association between roles and menus, routes, or screens.
|
167
|
+
- **Pagination**: Handle paginated responses for all resources.
|
168
|
+
|
169
|
+
### Controller Endpoints
|
170
|
+
|
171
|
+
#### `GET /roles`
|
172
|
+
|
173
|
+
- **Description**: Retrieve a paginated list of all roles.
|
174
|
+
- **Authentication**: Required (uses `AuthGuard`).
|
175
|
+
- **Parameters**:
|
176
|
+
- `paginationParams` (optional): Standard pagination parameters.
|
177
|
+
|
178
|
+
#### `GET /roles/:roleId`
|
179
|
+
|
180
|
+
- **Description**: Retrieve details of a specific role.
|
181
|
+
- **Authentication**: Required (uses `AuthGuard`).
|
182
|
+
- **Parameters**:
|
183
|
+
- `roleId (number)`: The ID of the role to retrieve.
|
184
|
+
|
185
|
+
#### `POST /roles`
|
186
|
+
|
187
|
+
- **Description**: Create a new role.
|
188
|
+
- **Authentication**: Required (uses `AuthGuard`).
|
189
|
+
- **Parameters**:
|
190
|
+
- `data` (CreateDTO): The data for the new role (name, description, etc).
|
191
|
+
|
192
|
+
#### `PATCH /roles/:roleId`
|
193
|
+
|
194
|
+
- **Description**: Update an existing role.
|
195
|
+
- **Authentication**: Required (uses `AuthGuard`).
|
196
|
+
- **Parameters**:
|
197
|
+
- `roleId (number)`: The ID of the role to update.
|
198
|
+
- `data` (UpdateDTO): The data to update for the role.
|
199
|
+
|
200
|
+
#### `DELETE /roles`
|
201
|
+
|
202
|
+
- **Description**: Delete one or more roles.
|
203
|
+
- **Authentication**: Required (uses `AuthGuard`).
|
204
|
+
- **Parameters**:
|
205
|
+
- `data` (DeleteDTO): List of role IDs to delete.
|
206
|
+
|
207
|
+
#### `GET /roles/:roleId/users`
|
208
|
+
|
209
|
+
- **Description**: Get a list of users associated with a specific role.
|
210
|
+
- **Authentication**: Required (uses `AuthGuard`).
|
211
|
+
- **Parameters**:
|
212
|
+
- `roleId (number)`: The ID of the role to retrieve users for.
|
213
|
+
- `paginationParams` (optional): Standard pagination parameters.
|
214
|
+
|
215
|
+
#### `GET /roles/:roleId/menus`
|
216
|
+
|
217
|
+
- **Description**: Get a list of menus associated with a specific role.
|
218
|
+
- **Authentication**: Required (uses `AuthGuard`).
|
219
|
+
- **Parameters**:
|
220
|
+
- `roleId (number)`: The ID of the role to retrieve menus for.
|
221
|
+
- `paginationParams` (optional): Standard pagination parameters.
|
222
|
+
|
223
|
+
#### `GET /roles/:roleId/routes`
|
224
|
+
|
225
|
+
- **Description**: Get a list of routes associated with a specific role.
|
226
|
+
- **Authentication**: Required (uses `AuthGuard`).
|
227
|
+
- **Parameters**:
|
228
|
+
- `roleId (number)`: The ID of the role to retrieve routes for.
|
229
|
+
- `paginationParams` (optional): Standard pagination parameters.
|
230
|
+
|
231
|
+
#### `GET /roles/:roleId/screens`
|
232
|
+
|
233
|
+
- **Description**: Get a list of screens associated with a specific role.
|
234
|
+
- **Authentication**: Required (uses `AuthGuard`).
|
235
|
+
- **Parameters**:
|
236
|
+
- `roleId (number)`: The ID of the role to retrieve screens for.
|
237
|
+
- `paginationParams` (optional): Standard pagination parameters.
|
238
|
+
|
239
|
+
#### `PATCH /roles/:roleId/users`
|
240
|
+
|
241
|
+
- **Description**: Update the users associated with a specific role.
|
242
|
+
- **Authentication**: Required (uses `AuthGuard`).
|
243
|
+
- **Parameters**:
|
244
|
+
- `roleId (number)`: The ID of the role. -`data` (UpdateIdsDTO): List of user IDs to associate with the role.
|
245
|
+
|
246
|
+
#### `PATCH /roles/:roleId/menus`
|
247
|
+
|
248
|
+
- **Description**: Update the menus associated with a specific role.
|
249
|
+
- **Authentication**: Required (uses `AuthGuard`).
|
250
|
+
- **Parameters**:
|
251
|
+
- `roleId (number)`: The ID of the role.
|
252
|
+
- `data` (UpdateIdsDTO): List of menu IDs to associate with the role.
|
253
|
+
|
254
|
+
#### `PATCH /roles/:roleId/routes`
|
255
|
+
|
256
|
+
- **Description**: Update the routes associated with a specific role.
|
257
|
+
- **Authentication**: Required (uses `AuthGuard`).
|
258
|
+
- **Parameters**:
|
259
|
+
- `roleId (number)`: The ID of the role.
|
260
|
+
- `data` (UpdateIdsDTO): List of route IDs to associate with the role.
|
261
|
+
|
262
|
+
#### `PATCH /roles/:roleId/screens`
|
263
|
+
|
264
|
+
- **Description**: Update the screens associated with a specific role.
|
265
|
+
- **Authentication**: Required (uses `AuthGuard`).
|
266
|
+
- **Parameters**:
|
267
|
+
- `roleId (number)`: The ID of the role.
|
268
|
+
- `data` (UpdateIdsDTO): List of screen IDs to associate with the role.
|
269
|
+
|
270
|
+
### Service Methods
|
271
|
+
|
272
|
+
#### `updateUsers(roleId: number, { ids }: UpdateIdsDTO)`
|
273
|
+
|
274
|
+
- **Description**: Updates the users associated with a specific role by deleting existing associations and creating new ones.
|
275
|
+
- **Parameters**:
|
276
|
+
- `roleId (number)`: The ID of the role to update.
|
277
|
+
- `data`: An object containing an array of user IDs to associate with the role.
|
278
|
+
|
279
|
+
#### `updateScreens(roleId: number, data: UpdateIdsDTO)`
|
280
|
+
|
281
|
+
- **Description**: Updates the screens associated with a specific role by deleting existing associations and creating new ones.
|
282
|
+
- **Parameters**:
|
283
|
+
- `roleId (number)`: The ID of the role to update.
|
284
|
+
- `data`: An object containing an array of screen IDs to associate with the role.
|
285
|
+
|
286
|
+
#### `updateRoutes(roleId: number, data: UpdateIdsDTO)`
|
287
|
+
|
288
|
+
- **Description**: Updates the routes associated with a specific role by deleting existing associations and creating new ones.
|
289
|
+
- **Parameters**:
|
290
|
+
- `roleId (number)`: The ID of the role to update.
|
291
|
+
- `data`: An object containing an array of route IDs to associate with the role.
|
292
|
+
|
293
|
+
#### `updateMenus(roleId: number, data: UpdateIdsDTO)`
|
294
|
+
|
295
|
+
- **Description**: Updates the menus associated with a specific role by deleting existing associations and creating new ones.
|
296
|
+
- **Parameters**:
|
297
|
+
- `roleId (number)`: The ID of the role to update.
|
298
|
+
- `data`: An object containing an array of menu IDs to associate with the role.
|
299
|
+
|
300
|
+
#### `listUsers(roleId: number, paginationParams: PaginationDTO)`
|
301
|
+
|
302
|
+
- **Description**: Retrieves a paginated list of users associated with a specific role.
|
303
|
+
- **Parameters**:
|
304
|
+
- `roleId (number)`: The ID of the role to retrieve associated users.
|
305
|
+
- `paginationParams`: Includes pagination criteria.
|
306
|
+
|
307
|
+
#### `listMenus(roleId: number, paginationParams: PaginationDTO)`
|
308
|
+
|
309
|
+
- **Description**: Retrieves a paginated list of menus associated with a specific role.
|
310
|
+
- **Parameters**:
|
311
|
+
- `roleId (number)`: The ID of the role to retrieve associated menus.
|
312
|
+
- `paginationParams`: Includes pagination criteria.
|
313
|
+
|
314
|
+
#### `listRoutes(roleId: number, paginationParams: PaginationDTO)`
|
315
|
+
|
316
|
+
- **Description**: Retrieves a paginated list of routes associated with a specific role.
|
317
|
+
- **Parameters**:
|
318
|
+
- `roleId (number)`: The ID of the role to retrieve associated routes.
|
319
|
+
- `paginationParams`: Includes pagination criteria.
|
320
|
+
|
321
|
+
#### `listScreens(roleId: number, paginationParams: PaginationDTO)`
|
322
|
+
|
323
|
+
- **Description**: Retrieves a paginated list of screens associated with a specific role.
|
324
|
+
- **Parameters**:
|
325
|
+
- `roleId (number)`: The ID of the role to retrieve associated screens.
|
326
|
+
- `paginationParams`: Includes pagination criteria.
|
327
|
+
|
328
|
+
#### `getRoles(paginationParams: PaginationDTO)`
|
329
|
+
|
330
|
+
- **Description**: Retrieves a paginated list of all roles, with optional search functionality based on name and description.
|
331
|
+
- **Parameters**:
|
332
|
+
- `paginationParams`: Includes pagination and search criteria.
|
333
|
+
|
334
|
+
#### `get(roleId: number)`
|
335
|
+
|
336
|
+
- **Description**: Retrieves a specific role by its ID.
|
337
|
+
- **Parameters**:
|
338
|
+
- `roleId (number)`: The ID of the role to retrieve.
|
339
|
+
|
340
|
+
#### `create(data: CreateDTO)`
|
341
|
+
|
342
|
+
- **Description**: Creates a new role with the specified name and description.
|
343
|
+
- **Parameters**:
|
344
|
+
- `data`: An object containing the following properties:
|
345
|
+
- `name (string)`: The name of the new role.
|
346
|
+
- `description (string)`: A description of the new role.
|
347
|
+
|
348
|
+
#### `update({ id, data }: { id: number; data: UpdateDTO })`
|
349
|
+
|
350
|
+
- **Description**: Updates an existing role identified by its ID.
|
351
|
+
- **Parameters**:
|
352
|
+
- `id (number)`: The ID of the role to update.
|
353
|
+
- `data`: An object containing the updated information for the role, defined in UpdateDTO.
|
354
|
+
|
355
|
+
#### `delete({ ids }: DeleteDTO)`
|
356
|
+
|
357
|
+
- **Description**: Deletes one or more roles identified by their IDs.
|
358
|
+
- **Parameters**:
|
359
|
+
- `ids (array of number)`: An array containing the IDs of the roles to delete.
|
360
|
+
|
361
|
+
### Folder Structure
|
362
|
+
|
363
|
+
```plaintext
|
364
|
+
├── decorators/
|
365
|
+
│ ├── role.decorator.ts # Custom decorator for roles
|
366
|
+
├── dto/ # Data Transfer Objects
|
367
|
+
│ ├── create.dto.ts # DTO for creating a role
|
368
|
+
│ ├── update.dto.ts # DTO for updating a role
|
369
|
+
├── guards/
|
370
|
+
│ └── role.guard.ts # Guard for roles
|
371
|
+
├── role.controller.ts # Handles HTTP requests related to roles
|
372
|
+
├── role.module.ts # Module definition for the role
|
373
|
+
└── role.service.ts # Service class for role-related logic
|
374
|
+
```
|
375
|
+
|
376
|
+
---
|
377
|
+
|
378
|
+
# Hedhog Route
|
379
|
+
|
380
|
+
**Hedhog Route** module provides a comprehensive system for managing routes within your application. It allows administrators to define, modify, and control access to different routes within the application. The module also integrates with other Hedhog modules to ensure that permissions and roles are respected when accessing routes.
|
381
|
+
|
382
|
+
### Features
|
383
|
+
|
384
|
+
- **CRUD Operations**: Create, Read, Update, and Delete routes.
|
385
|
+
- **Route Management**: Manage application routes, including their accessibility and assignment to user roles.
|
386
|
+
- **Permissions Integration**: Integrates with Hedhog Permission to control access to specific routes based on user roles.
|
387
|
+
|
388
|
+
### Controller Endpoints
|
389
|
+
|
390
|
+
#### `GET /routes`
|
391
|
+
|
392
|
+
- **Description**: Retrieves a paginated list of all routes.
|
393
|
+
- **Authentication**: Required (uses `AuthGuard`).
|
394
|
+
- **Parameters**:
|
395
|
+
- `paginationParams`: Includes pagination criteria.
|
396
|
+
|
397
|
+
#### `GET /routes/:routeId`
|
398
|
+
|
399
|
+
- **Description**: Retrieves a specific route by its ID.
|
400
|
+
- **Authentication**: Required (uses `AuthGuard`).
|
401
|
+
- **Parameters**:
|
402
|
+
- `routeId (number)`: The ID of the route to retrieve.
|
403
|
+
|
404
|
+
#### `POST /routes`
|
405
|
+
|
406
|
+
- **Description**: Creates a new route with the specified URL and method.
|
407
|
+
- **Authentication**: Required (uses `AuthGuard`).
|
408
|
+
- **Parameters**:
|
409
|
+
- `data`: An object containing the url and method for the new route.
|
410
|
+
|
411
|
+
#### `PATCH /routes/:routeId`
|
412
|
+
|
413
|
+
- **Description**: Updates an existing route identified by its ID.
|
414
|
+
- **Authentication**: Required (uses `AuthGuard`).
|
415
|
+
- **Parameters**:
|
416
|
+
- `routeId (number)`: The ID of the route to update.
|
417
|
+
- `data`: An object containing the updated information for the route.
|
418
|
+
|
419
|
+
#### `DELETE /routes`
|
420
|
+
|
421
|
+
- **Description**: Deletes one or more routes.
|
422
|
+
- **Authentication**: Required (uses `AuthGuard`).
|
423
|
+
- **Parameters**:
|
424
|
+
- `data`: An object containing an array of route IDs to delete.
|
425
|
+
|
426
|
+
#### `GET /routes/:routeId/roles`
|
427
|
+
|
428
|
+
- **Description**: Retrieves a paginated list of roles associated with a specific route.
|
429
|
+
- **Authentication**: Required (uses `AuthGuard`).
|
430
|
+
- **Parameters**:
|
431
|
+
- `routeId (number)`: The ID of the route to retrieve associated roles.
|
432
|
+
- `paginationParams`: Includes pagination criteria.
|
433
|
+
|
434
|
+
#### `PATCH /routes/:routeId/roles`
|
435
|
+
|
436
|
+
- **Description**: Updates the roles associated with a specific route.
|
437
|
+
- **Authentication**: Required (uses `AuthGuard`).
|
438
|
+
- **Parameters**:
|
439
|
+
- `routeId (number)`: The ID of the route.
|
440
|
+
- `data`: An object containing an array of role IDs to associate with the route.
|
441
|
+
|
442
|
+
#### `GET /routes/:routeId/screens`
|
443
|
+
|
444
|
+
- **Description**: Retrieves a paginated list of screens associated with a specific route.
|
445
|
+
- **Authentication**: Required (uses `AuthGuard`).
|
446
|
+
- **Parameters**:
|
447
|
+
- `routeId (number)`: The ID of the route to retrieve associated screens.
|
448
|
+
- `paginationParams`: Includes pagination criteria.
|
449
|
+
|
450
|
+
#### `PATCH /routes/:routeId/screens`
|
451
|
+
|
452
|
+
- **Description:** Updates the screens associated with a specific route.
|
453
|
+
- **Authentication**: Required (uses AuthGuard).
|
454
|
+
- **Parameters**:
|
455
|
+
- `routeId (number)`: The ID of the route.
|
456
|
+
- `data`: An object containing an array of screen IDs to associate with the route.
|
457
|
+
|
458
|
+
### Service Methods
|
459
|
+
|
460
|
+
#### `getRoutes(paginationParams: PaginationDTO)`
|
461
|
+
|
462
|
+
- **Description**: Retrieves a paginated list of routes with optional search functionality based on URL and method.
|
463
|
+
- **Parameters**:
|
464
|
+
- `paginationParams`: Includes pagination and search criteria.
|
465
|
+
|
466
|
+
#### `getRouteById(routeId: number)`
|
467
|
+
|
468
|
+
- **Description**: Retrieves a specific route by its ID.
|
469
|
+
- **Parameters**:
|
470
|
+
- `routeId`: The ID of the route to retrieve.
|
471
|
+
|
472
|
+
#### `create(data: CreateDTO)`
|
473
|
+
|
474
|
+
- **Description**: Creates a new route with the specified URL and method.
|
475
|
+
- **Parameters**:
|
476
|
+
- `data`: An object containing the URL and method for the new route.
|
477
|
+
|
478
|
+
#### `update({ id, data }: { id: number; data: UpdateDTO })`
|
479
|
+
|
480
|
+
- **Description**: Updates an existing route identified by its ID.
|
481
|
+
- **Parameters**:
|
482
|
+
- `id`: The ID of the route to update.
|
483
|
+
- `data`: An object containing the updated information for the route.
|
484
|
+
|
485
|
+
#### `delete({ ids }: DeleteDTO)`
|
486
|
+
|
487
|
+
- **Description**: Deletes one or more routes identified by their IDs.
|
488
|
+
- **Parameters**:
|
489
|
+
- `ids`: An object containing an array of route IDs to delete.
|
490
|
+
|
491
|
+
#### `listRoles(routeId: number, paginationParams: PaginationDTO)`
|
492
|
+
|
493
|
+
- **Description**: Retrieves a paginated list of roles associated with a specific route.
|
494
|
+
- **Parameters**:
|
495
|
+
- `routeId`: The ID of the route to retrieve associated roles.
|
496
|
+
- `paginationParams`: Includes pagination parameters.
|
497
|
+
|
498
|
+
#### `updateRoles(routeId: number, data: UpdateIdsDTO)`
|
499
|
+
|
500
|
+
- **Description**: Updates the roles associated with a specific route.
|
501
|
+
- **Parameters**:
|
502
|
+
- `routeId`: The ID of the route.
|
503
|
+
- `data`: An object containing an array of role IDs to associate with the route.
|
504
|
+
|
505
|
+
#### `listScreens(routeId: number, paginationParams: PaginationDTO)`
|
506
|
+
|
507
|
+
- **Description**: Retrieves a paginated list of screens associated with a specific route.
|
508
|
+
- **Parameters**:
|
509
|
+
- `routeId`: The ID of the route to retrieve associated screens.
|
510
|
+
- `paginationParams`: Includes pagination parameters.
|
511
|
+
|
512
|
+
#### `updateScreens(routeId: number, data: UpdateIdsDTO)`
|
513
|
+
|
514
|
+
- **Description**: Updates the screens associated with a specific route.
|
515
|
+
- **Parameters**:
|
516
|
+
- `routeId`: The ID of the route.
|
517
|
+
- `data`: An object containing an array of screen IDs to associate with the route.
|
518
|
+
|
519
|
+
### Folder Structure
|
520
|
+
|
521
|
+
```plaintext
|
522
|
+
├── dto/ # Data Transfer Objects
|
523
|
+
│ ├── create.dto.ts # DTO for creating a route
|
524
|
+
│ ├── update.dto.ts # DTO for updating a route
|
525
|
+
├── guards/
|
526
|
+
│ └── route.guard.ts # Guard for routes
|
527
|
+
├── route.controller.ts # Handles HTTP requests related to routes
|
528
|
+
├── route.module.ts # Module definition for the route
|
529
|
+
└── route.service.ts # Service class for route-related logic
|
530
|
+
```
|
531
|
+
|
532
|
+
---
|
533
|
+
|
534
|
+
# Hedhog Setting
|
535
|
+
|
536
|
+
**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
|
+
|
538
|
+
## Controller Endpoints
|
539
|
+
|
540
|
+
### `GET /settings`
|
541
|
+
|
542
|
+
- **Description**: Retrieve a paginated list of settings.
|
543
|
+
- **Authentication**: Required (uses `AuthGuard`).
|
544
|
+
- **Pagination**: Supports pagination through query parameters.
|
545
|
+
|
546
|
+
### `GET /settings/:settingId`
|
547
|
+
|
548
|
+
- **Description**: Retrieve a specific setting by its ID.
|
549
|
+
- **Authentication**: Required (uses AuthGuard).
|
550
|
+
- **Parameters**:
|
551
|
+
- **settingId** (number): The ID of the setting to retrieve.
|
552
|
+
|
553
|
+
### `POST /settings`
|
554
|
+
|
555
|
+
- **Description**: Create a new setting.
|
556
|
+
- **Authentication**: Required (uses AuthGuard).
|
557
|
+
- **Body**:
|
558
|
+
- **name** (string): Name of the setting.
|
559
|
+
|
560
|
+
### `PATCH /settings/:settingId`
|
561
|
+
|
562
|
+
- **Description**: Update an existing setting.
|
563
|
+
- **Authentication**: Required (uses AuthGuard).
|
564
|
+
- **Parameters**:
|
565
|
+
- **settingId** (number): The ID of the setting to update.
|
566
|
+
- **Body**:
|
567
|
+
- **name** (string, optional): Updated name of the setting.
|
568
|
+
|
569
|
+
### `DELETE /settings`
|
570
|
+
|
571
|
+
- **Description**: Delete one or more settings.
|
572
|
+
- **Authentication**: Required (uses AuthGuard).
|
573
|
+
- **Body**:
|
574
|
+
- **ids** (number[]): Array of setting IDs to delete.
|
575
|
+
|
576
|
+
## Service Methods
|
577
|
+
|
578
|
+
- **getSettings(paginationParams: PaginationDTO)**
|
579
|
+
|
580
|
+
- **Description**: Retrieves a paginated list of settings with optional search functionality.
|
581
|
+
- **Parameters**:
|
582
|
+
- **paginationParams**: Includes pagination and search criteria.
|
583
|
+
|
584
|
+
- **get(settingId: number)**
|
585
|
+
|
586
|
+
- **Description**: Retrieves a specific setting by its ID.
|
587
|
+
- **Parameters**:
|
588
|
+
- **settingId**: ID of the setting to retrieve.
|
589
|
+
|
590
|
+
- **create(data: CreateDTO)**
|
591
|
+
|
592
|
+
- **Description**: Creates a new setting.
|
593
|
+
- **Parameters**:
|
594
|
+
- **data**: Includes name of the setting.
|
595
|
+
|
596
|
+
- **update(id: number, data: UpdateDTO)**
|
597
|
+
|
598
|
+
- **Description**: Updates an existing setting.
|
599
|
+
- **Parameters**:
|
600
|
+
- **id**: ID of the setting to update.
|
601
|
+
- **data**: Includes updated name of the setting.
|
602
|
+
|
603
|
+
- **delete(data: DeleteDTO)**
|
604
|
+
- **Description**: Deletes one or more settings.
|
605
|
+
- **Parameters**:
|
606
|
+
- **data**: Includes array of ids to delete.
|
607
|
+
|
608
|
+
## Folder Structure
|
609
|
+
|
610
|
+
```plaintext
|
611
|
+
|── dto/ # Data Transfer Objects
|
612
|
+
│ |── create.dto.ts # DTO for creating settings
|
613
|
+
│ |── delete.dto.ts # DTO for deleting settings
|
614
|
+
│ |── update.dto.ts # DTO for updating settings
|
615
|
+
|── setting.controller.ts # Controller for settings
|
616
|
+
|── setting.module.ts # Module definition for settings
|
617
|
+
|── setting.service.ts # Service class for settings logic
|
179
618
|
```
|
180
619
|
|
181
620
|
---
|
@@ -270,26 +709,12 @@ menu/
|
|
270
709
|
### Folder Structure
|
271
710
|
|
272
711
|
```plaintext
|
273
|
-
|
274
|
-
├──
|
275
|
-
├──
|
276
|
-
├──
|
277
|
-
|
278
|
-
|
279
|
-
│ │ ├── update.dto.ts # DTO for updating a screen
|
280
|
-
│ │ └── delete.dto.ts # DTO for deleting a screen
|
281
|
-
│ ├── migrations/ # Database migration files
|
282
|
-
│ │ └── <migration-files> # Migration scripts
|
283
|
-
│ ├── index.ts # Entry point for the screen module
|
284
|
-
│ ├── screen.controller.ts # Handles HTTP requests related to screens
|
285
|
-
│ ├── screen.module.ts # Module definition for the screen
|
286
|
-
│ └── screen.service.ts # Service class for screen-related logic
|
287
|
-
├── .gitignore # Specifies which files Git should ignore
|
288
|
-
├── package.json # Manages dependencies and scripts for the module
|
289
|
-
├── package-lock.json # Lock file for dependencies
|
290
|
-
├── README.md # Documentation for the library
|
291
|
-
├── tsconfig.lib.json # TypeScript configuration for library builds
|
292
|
-
├── tsconfig.production.json # TypeScript configuration for production builds
|
712
|
+
├── dto/ # Data Transfer Objects
|
713
|
+
│ ├── create.dto.ts # DTO for creating a screen
|
714
|
+
│ ├── update.dto.ts # DTO for updating a screen
|
715
|
+
├── screen.controller.ts # Handles HTTP requests related to screens
|
716
|
+
├── screen.module.ts # Module definition for the screen
|
717
|
+
└── screen.service.ts # Service class for screen-related logic
|
293
718
|
```
|
294
719
|
|
295
720
|
---
|
@@ -388,25 +813,12 @@ The **Hedhog User** module in HedHog provides functionality to manage user data
|
|
388
813
|
### Folder Structure
|
389
814
|
|
390
815
|
```plaintext
|
391
|
-
|
392
|
-
|
393
|
-
├──
|
394
|
-
├──
|
395
|
-
│
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
│ │ ├── delete.dto.ts # Data Transfer Object for deleting a user
|
400
|
-
│ │ └── update.dto.ts # Data Transfer Object for updating a user
|
401
|
-
│ ├── migrations/ # Migration files for database schema changes
|
402
|
-
| ├── user.module.ts # Module for UserService
|
403
|
-
│ ├── user.service.spec.ts # Unit tests for UserService
|
404
|
-
│ ├── user.controller.ts # Controller for user-related endpoints
|
405
|
-
│ └── user.service.ts # Service handling business logic for users
|
406
|
-
├── .gitignore # Specifies which files Git should ignore
|
407
|
-
├── package.json # Manages dependencies and scripts for the module
|
408
|
-
├── package-lock.json # Lock file for dependencies
|
409
|
-
├── README.md # Documentation for the library
|
410
|
-
├── tsconfig.lib.json # TypeScript configuration for library builds
|
411
|
-
├── tsconfig.production.json # TypeScript configuration for production builds
|
816
|
+
├── constants/
|
817
|
+
│ └── user.constants.ts # Constants related to user module
|
818
|
+
├── dto/
|
819
|
+
│ ├── create.dto.ts # Data Transfer Object for creating a user
|
820
|
+
│ └── update.dto.ts # Data Transfer Object for updating a user
|
821
|
+
├── user.module.ts # Module for UserService
|
822
|
+
├── user.controller.ts # Controller for user-related endpoints
|
823
|
+
└── user.service.ts # Service handling business logic for users
|
412
824
|
```
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"admin.module.d.ts","sourceRoot":"","sources":["../src/admin.module.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"admin.module.d.ts","sourceRoot":"","sources":["../src/admin.module.ts"],"names":[],"mappings":"AAYA,qBAsBa,WAAW;CAAG"}
|
package/dist/admin.module.js
CHANGED
@@ -16,6 +16,7 @@ const screen_module_1 = require("./screen/screen.module");
|
|
16
16
|
const user_module_1 = require("./user/user.module");
|
17
17
|
const role_module_1 = require("./role/role.module");
|
18
18
|
const route_module_1 = require("./route/route.module");
|
19
|
+
const settings_module_1 = require("./setting/settings.module");
|
19
20
|
let AdminModule = class AdminModule {
|
20
21
|
};
|
21
22
|
exports.AdminModule = AdminModule;
|
@@ -29,6 +30,7 @@ exports.AdminModule = AdminModule = __decorate([
|
|
29
30
|
(0, common_1.forwardRef)(() => route_module_1.RouteModule),
|
30
31
|
(0, common_1.forwardRef)(() => prisma_1.PrismaModule),
|
31
32
|
(0, common_1.forwardRef)(() => screen_module_1.ScreenModule),
|
33
|
+
(0, common_1.forwardRef)(() => settings_module_1.SettingModule),
|
32
34
|
(0, common_1.forwardRef)(() => user_module_1.UserModule),
|
33
35
|
],
|
34
36
|
exports: [
|
@@ -37,6 +39,7 @@ exports.AdminModule = AdminModule = __decorate([
|
|
37
39
|
route_module_1.RouteModule,
|
38
40
|
role_module_1.RoleModule,
|
39
41
|
menu_module_1.MenuModule,
|
42
|
+
settings_module_1.SettingModule,
|
40
43
|
screen_module_1.ScreenModule,
|
41
44
|
],
|
42
45
|
})
|
package/dist/admin.module.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"admin.module.js","sourceRoot":"","sources":["../src/admin.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA8C;AAC9C,mDAAsD;AACtD,2CAAoD;AACpD,oDAAgD;AAChD,oDAAgD;AAEhD,0DAAsD;AACtD,oDAAgD;AAChD,oDAAgD;AAChD,uDAAmD;
|
1
|
+
{"version":3,"file":"admin.module.js","sourceRoot":"","sources":["../src/admin.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA8C;AAC9C,mDAAsD;AACtD,2CAAoD;AACpD,oDAAgD;AAChD,oDAAgD;AAEhD,0DAAsD;AACtD,oDAAgD;AAChD,oDAAgD;AAChD,uDAAmD;AACnD,+DAA0D;AAwBnD,IAAM,WAAW,GAAjB,MAAM,WAAW;CAAG,CAAA;AAAd,kCAAW;sBAAX,WAAW;IAtBvB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,wBAAU,CAAC;YAC5B,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,wBAAU,CAAC;YAC5B,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,6BAAgB,CAAC;YAClC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,wBAAU,CAAC;YAC5B,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,0BAAW,CAAC;YAC7B,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,qBAAY,CAAC;YAC9B,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,4BAAY,CAAC;YAC9B,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,+BAAa,CAAC;YAC/B,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,wBAAU,CAAC;SAC7B;QACD,OAAO,EAAE;YACP,wBAAU;YACV,wBAAU;YACV,0BAAW;YACX,wBAAU;YACV,wBAAU;YACV,+BAAa;YACb,4BAAY;SACb;KACF,CAAC;GACW,WAAW,CAAG"}
|
package/dist/index.d.ts
CHANGED
@@ -8,6 +8,7 @@ export * from './role/role.service';
|
|
8
8
|
export * from './role/decorators/role.decorator';
|
9
9
|
export * from './role/guards/role.guard';
|
10
10
|
export * from './screen/screen.service';
|
11
|
+
export * from './setting/settings.service';
|
11
12
|
export * from './user/constants/user.constants';
|
12
13
|
export * from './user/user.service';
|
13
14
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,gBAAgB,CAAC;AAG/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,oCAAoC,CAAC;AACnD,cAAc,kCAAkC,CAAC;AACjD,cAAc,0BAA0B,CAAC;AAGzC,cAAc,qBAAqB,CAAC;AAGpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kCAAkC,CAAC;AACjD,cAAc,0BAA0B,CAAC;AAGzC,cAAc,yBAAyB,CAAC;AAGxC,cAAc,iCAAiC,CAAC;AAChD,cAAc,qBAAqB,CAAC"}
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,gBAAgB,CAAC;AAG/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,oCAAoC,CAAC;AACnD,cAAc,kCAAkC,CAAC;AACjD,cAAc,0BAA0B,CAAC;AAGzC,cAAc,qBAAqB,CAAC;AAGpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kCAAkC,CAAC;AACjD,cAAc,0BAA0B,CAAC;AAGzC,cAAc,yBAAyB,CAAC;AAGxC,cAAc,4BAA4B,CAAC;AAG3C,cAAc,iCAAiC,CAAC;AAChD,cAAc,qBAAqB,CAAC"}
|
package/dist/index.js
CHANGED
@@ -29,6 +29,8 @@ __exportStar(require("./role/decorators/role.decorator"), exports);
|
|
29
29
|
__exportStar(require("./role/guards/role.guard"), exports);
|
30
30
|
// Screen Module
|
31
31
|
__exportStar(require("./screen/screen.service"), exports);
|
32
|
+
// Screen Module
|
33
|
+
__exportStar(require("./setting/settings.service"), exports);
|
32
34
|
// User Module
|
33
35
|
__exportStar(require("./user/constants/user.constants"), exports);
|
34
36
|
__exportStar(require("./user/user.service"), exports);
|
package/dist/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,eAAe;AACf,iDAA+B;AAE/B,cAAc;AACd,sDAAoC;AACpC,qEAAmD;AACnD,mEAAiD;AACjD,2DAAyC;AAEzC,cAAc;AACd,sDAAoC;AAEpC,oBAAoB;AACpB,sDAAoC;AACpC,mEAAiD;AACjD,2DAAyC;AAEzC,gBAAgB;AAChB,0DAAwC;AAExC,cAAc;AACd,kEAAgD;AAChD,sDAAoC"}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,eAAe;AACf,iDAA+B;AAE/B,cAAc;AACd,sDAAoC;AACpC,qEAAmD;AACnD,mEAAiD;AACjD,2DAAyC;AAEzC,cAAc;AACd,sDAAoC;AAEpC,oBAAoB;AACpB,sDAAoC;AACpC,mEAAiD;AACjD,2DAAyC;AAEzC,gBAAgB;AAChB,0DAAwC;AAExC,gBAAgB;AAChB,6DAA2C;AAE3C,cAAc;AACd,kEAAgD;AAChD,sDAAoC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"create.dto.d.ts","sourceRoot":"","sources":["../../../src/setting/dto/create.dto.ts"],"names":[],"mappings":"AAEA,qBAAa,SAAS;IAGpB,IAAI,EAAE,MAAM,CAAC;CACd"}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7
|
+
};
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
10
|
+
};
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
+
exports.CreateDTO = void 0;
|
13
|
+
const class_validator_1 = require("class-validator");
|
14
|
+
class CreateDTO {
|
15
|
+
}
|
16
|
+
exports.CreateDTO = CreateDTO;
|
17
|
+
__decorate([
|
18
|
+
(0, class_validator_1.IsString)({ message: 'O nome deve ser uma string' }),
|
19
|
+
(0, class_validator_1.IsNotEmpty)({ message: 'O nome é obrigatório.' }),
|
20
|
+
__metadata("design:type", String)
|
21
|
+
], CreateDTO.prototype, "name", void 0);
|
22
|
+
//# sourceMappingURL=create.dto.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"create.dto.js","sourceRoot":"","sources":["../../../src/setting/dto/create.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAuD;AAEvD,MAAa,SAAS;CAIrB;AAJD,8BAIC;AADC;IAFC,IAAA,0BAAQ,EAAC,EAAE,OAAO,EAAE,4BAA4B,EAAE,CAAC;IACnD,IAAA,4BAAU,EAAC,EAAE,OAAO,EAAE,uBAAuB,EAAE,CAAC;;uCACpC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"update.dto.d.ts","sourceRoot":"","sources":["../../../src/setting/dto/update.dto.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,qBAAa,SAAU,SAAQ,SAAS;CAAG"}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.UpdateDTO = void 0;
|
4
|
+
const create_dto_1 = require("./create.dto");
|
5
|
+
class UpdateDTO extends create_dto_1.CreateDTO {
|
6
|
+
}
|
7
|
+
exports.UpdateDTO = UpdateDTO;
|
8
|
+
//# sourceMappingURL=update.dto.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"update.dto.js","sourceRoot":"","sources":["../../../src/setting/dto/update.dto.ts"],"names":[],"mappings":";;;AAAA,6CAAyC;AAEzC,MAAa,SAAU,SAAQ,sBAAS;CAAG;AAA3C,8BAA2C"}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { CreateDTO } from './dto/create.dto';
|
2
|
+
import { DeleteDTO } from '../dto/delete.dto';
|
3
|
+
import { UpdateDTO } from './dto/update.dto';
|
4
|
+
import { SettingsService } from './settings.service';
|
5
|
+
export declare class SettingsController {
|
6
|
+
private readonly settingsService;
|
7
|
+
constructor(settingsService: SettingsService);
|
8
|
+
getSettings(paginationParams: any): Promise<import("@hedhog/pagination").PaginatedResult<unknown>>;
|
9
|
+
show(settingId: number): Promise<any>;
|
10
|
+
create(data: CreateDTO): Promise<any>;
|
11
|
+
update(settingId: number, data: UpdateDTO): Promise<any>;
|
12
|
+
delete(data: DeleteDTO): Promise<any>;
|
13
|
+
}
|
14
|
+
//# sourceMappingURL=settings.controller.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"settings.controller.d.ts","sourceRoot":"","sources":["../../src/setting/settings.controller.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,qBAEa,kBAAkB;IAG3B,OAAO,CAAC,QAAQ,CAAC,eAAe;gBAAf,eAAe,EAAE,eAAe;IAK7C,WAAW,CAAe,gBAAgB,KAAA;IAM1C,IAAI,CAAmC,SAAS,EAAE,MAAM;IAM9D,MAAM,CAAS,IAAI,EAAE,SAAS;IAMxB,MAAM,CACwB,SAAS,EAAE,MAAM,EAC3C,IAAI,EAAE,SAAS;IAUnB,MAAM,CAAS,IAAI,EAAE,SAAS;CAGrC"}
|
@@ -0,0 +1,95 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7
|
+
};
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
10
|
+
};
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
13
|
+
};
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
15
|
+
exports.SettingsController = void 0;
|
16
|
+
const pagination_1 = require("@hedhog/pagination");
|
17
|
+
const common_1 = require("@nestjs/common");
|
18
|
+
const auth_guard_1 = require("../auth/guards/auth.guard");
|
19
|
+
const role_decorator_1 = require("../role/decorators/role.decorator");
|
20
|
+
const create_dto_1 = require("./dto/create.dto");
|
21
|
+
const delete_dto_1 = require("../dto/delete.dto");
|
22
|
+
const update_dto_1 = require("./dto/update.dto");
|
23
|
+
const settings_service_1 = require("./settings.service");
|
24
|
+
let SettingsController = class SettingsController {
|
25
|
+
constructor(settingsService) {
|
26
|
+
this.settingsService = settingsService;
|
27
|
+
}
|
28
|
+
async getSettings(paginationParams) {
|
29
|
+
return this.settingsService.getSettings(paginationParams);
|
30
|
+
}
|
31
|
+
async show(settingId) {
|
32
|
+
return this.settingsService.get(settingId);
|
33
|
+
}
|
34
|
+
create(data) {
|
35
|
+
return this.settingsService.create(data);
|
36
|
+
}
|
37
|
+
async update(settingId, data) {
|
38
|
+
return this.settingsService.update({
|
39
|
+
id: settingId,
|
40
|
+
data,
|
41
|
+
});
|
42
|
+
}
|
43
|
+
async delete(data) {
|
44
|
+
return this.settingsService.delete(data);
|
45
|
+
}
|
46
|
+
};
|
47
|
+
exports.SettingsController = SettingsController;
|
48
|
+
__decorate([
|
49
|
+
(0, common_1.UseGuards)(auth_guard_1.AuthGuard),
|
50
|
+
(0, common_1.Get)(),
|
51
|
+
__param(0, (0, pagination_1.Pagination)()),
|
52
|
+
__metadata("design:type", Function),
|
53
|
+
__metadata("design:paramtypes", [Object]),
|
54
|
+
__metadata("design:returntype", Promise)
|
55
|
+
], SettingsController.prototype, "getSettings", null);
|
56
|
+
__decorate([
|
57
|
+
(0, common_1.UseGuards)(auth_guard_1.AuthGuard),
|
58
|
+
(0, common_1.Get)(':settingId'),
|
59
|
+
__param(0, (0, common_1.Param)('settingId', common_1.ParseIntPipe)),
|
60
|
+
__metadata("design:type", Function),
|
61
|
+
__metadata("design:paramtypes", [Number]),
|
62
|
+
__metadata("design:returntype", Promise)
|
63
|
+
], SettingsController.prototype, "show", null);
|
64
|
+
__decorate([
|
65
|
+
(0, common_1.UseGuards)(auth_guard_1.AuthGuard),
|
66
|
+
(0, common_1.Post)(),
|
67
|
+
__param(0, (0, common_1.Body)()),
|
68
|
+
__metadata("design:type", Function),
|
69
|
+
__metadata("design:paramtypes", [create_dto_1.CreateDTO]),
|
70
|
+
__metadata("design:returntype", void 0)
|
71
|
+
], SettingsController.prototype, "create", null);
|
72
|
+
__decorate([
|
73
|
+
(0, common_1.UseGuards)(auth_guard_1.AuthGuard),
|
74
|
+
(0, common_1.Patch)(':settingId'),
|
75
|
+
__param(0, (0, common_1.Param)('settingId', common_1.ParseIntPipe)),
|
76
|
+
__param(1, (0, common_1.Body)()),
|
77
|
+
__metadata("design:type", Function),
|
78
|
+
__metadata("design:paramtypes", [Number, update_dto_1.UpdateDTO]),
|
79
|
+
__metadata("design:returntype", Promise)
|
80
|
+
], SettingsController.prototype, "update", null);
|
81
|
+
__decorate([
|
82
|
+
(0, common_1.UseGuards)(auth_guard_1.AuthGuard),
|
83
|
+
(0, common_1.Delete)(),
|
84
|
+
__param(0, (0, common_1.Body)()),
|
85
|
+
__metadata("design:type", Function),
|
86
|
+
__metadata("design:paramtypes", [delete_dto_1.DeleteDTO]),
|
87
|
+
__metadata("design:returntype", Promise)
|
88
|
+
], SettingsController.prototype, "delete", null);
|
89
|
+
exports.SettingsController = SettingsController = __decorate([
|
90
|
+
(0, role_decorator_1.Role)(),
|
91
|
+
(0, common_1.Controller)('settings'),
|
92
|
+
__param(0, (0, common_1.Inject)((0, common_1.forwardRef)(() => settings_service_1.SettingsService))),
|
93
|
+
__metadata("design:paramtypes", [settings_service_1.SettingsService])
|
94
|
+
], SettingsController);
|
95
|
+
//# sourceMappingURL=settings.controller.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"settings.controller.js","sourceRoot":"","sources":["../../src/setting/settings.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mDAAgD;AAChD,2CAYwB;AACxB,0DAAsD;AACtD,sEAAyD;AACzD,iDAA6C;AAC7C,kDAA8C;AAC9C,iDAA6C;AAC7C,yDAAqD;AAI9C,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAC7B,YAEmB,eAAgC;QAAhC,oBAAe,GAAf,eAAe,CAAiB;IAChD,CAAC;IAIE,AAAN,KAAK,CAAC,WAAW,CAAe,gBAAgB;QAC9C,OAAO,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC;IAC5D,CAAC;IAIK,AAAN,KAAK,CAAC,IAAI,CAAmC,SAAiB;QAC5D,OAAO,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAC7C,CAAC;IAID,MAAM,CAAS,IAAe;QAC5B,OAAO,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC3C,CAAC;IAIK,AAAN,KAAK,CAAC,MAAM,CACwB,SAAiB,EAC3C,IAAe;QAEvB,OAAO,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC;YACjC,EAAE,EAAE,SAAS;YACb,IAAI;SACL,CAAC,CAAC;IACL,CAAC;IAIK,AAAN,KAAK,CAAC,MAAM,CAAS,IAAe;QAClC,OAAO,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC3C,CAAC;CACF,CAAA;AAzCY,gDAAkB;AAQvB;IAFL,IAAA,kBAAS,EAAC,sBAAS,CAAC;IACpB,IAAA,YAAG,GAAE;IACa,WAAA,IAAA,uBAAU,GAAE,CAAA;;;;qDAE9B;AAIK;IAFL,IAAA,kBAAS,EAAC,sBAAS,CAAC;IACpB,IAAA,YAAG,EAAC,YAAY,CAAC;IACN,WAAA,IAAA,cAAK,EAAC,WAAW,EAAE,qBAAY,CAAC,CAAA;;;;8CAE3C;AAID;IAFC,IAAA,kBAAS,EAAC,sBAAS,CAAC;IACpB,IAAA,aAAI,GAAE;IACC,WAAA,IAAA,aAAI,GAAE,CAAA;;qCAAO,sBAAS;;gDAE7B;AAIK;IAFL,IAAA,kBAAS,EAAC,sBAAS,CAAC;IACpB,IAAA,cAAK,EAAC,YAAY,CAAC;IAEjB,WAAA,IAAA,cAAK,EAAC,WAAW,EAAE,qBAAY,CAAC,CAAA;IAChC,WAAA,IAAA,aAAI,GAAE,CAAA;;6CAAO,sBAAS;;gDAMxB;AAIK;IAFL,IAAA,kBAAS,EAAC,sBAAS,CAAC;IACpB,IAAA,eAAM,GAAE;IACK,WAAA,IAAA,aAAI,GAAE,CAAA;;qCAAO,sBAAS;;gDAEnC;6BAxCU,kBAAkB;IAF9B,IAAA,qBAAI,GAAE;IACN,IAAA,mBAAU,EAAC,UAAU,CAAC;IAGlB,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,kCAAe,CAAC,CAAC,CAAA;qCACR,kCAAe;GAHxC,kBAAkB,CAyC9B"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"settings.module.d.ts","sourceRoot":"","sources":["../../src/setting/settings.module.ts"],"names":[],"mappings":"AAOA,qBAUa,aAAa;CAAG"}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7
|
+
};
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
9
|
+
exports.SettingModule = void 0;
|
10
|
+
const pagination_1 = require("@hedhog/pagination");
|
11
|
+
const prisma_1 = require("@hedhog/prisma");
|
12
|
+
const common_1 = require("@nestjs/common");
|
13
|
+
const settings_controller_1 = require("./settings.controller");
|
14
|
+
const settings_service_1 = require("./settings.service");
|
15
|
+
const auth_module_1 = require("../auth/auth.module");
|
16
|
+
let SettingModule = class SettingModule {
|
17
|
+
};
|
18
|
+
exports.SettingModule = SettingModule;
|
19
|
+
exports.SettingModule = SettingModule = __decorate([
|
20
|
+
(0, common_1.Module)({
|
21
|
+
providers: [settings_service_1.SettingsService],
|
22
|
+
exports: [settings_service_1.SettingsService],
|
23
|
+
controllers: [settings_controller_1.SettingsController],
|
24
|
+
imports: [
|
25
|
+
(0, common_1.forwardRef)(() => auth_module_1.AuthModule),
|
26
|
+
(0, common_1.forwardRef)(() => prisma_1.PrismaModule),
|
27
|
+
(0, common_1.forwardRef)(() => pagination_1.PaginationModule),
|
28
|
+
],
|
29
|
+
})
|
30
|
+
], SettingModule);
|
31
|
+
//# sourceMappingURL=settings.module.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"settings.module.js","sourceRoot":"","sources":["../../src/setting/settings.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,mDAAsD;AACtD,2CAA8C;AAC9C,2CAAoD;AACpD,+DAA2D;AAC3D,yDAAqD;AACrD,qDAAiD;AAY1C,IAAM,aAAa,GAAnB,MAAM,aAAa;CAAG,CAAA;AAAhB,sCAAa;wBAAb,aAAa;IAVzB,IAAA,eAAM,EAAC;QACN,SAAS,EAAE,CAAC,kCAAe,CAAC;QAC5B,OAAO,EAAE,CAAC,kCAAe,CAAC;QAC1B,WAAW,EAAE,CAAC,wCAAkB,CAAC;QACjC,OAAO,EAAE;YACP,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,wBAAU,CAAC;YAC5B,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,qBAAY,CAAC;YAC9B,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,6BAAgB,CAAC;SACnC;KACF,CAAC;GACW,aAAa,CAAG"}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import { PaginationDTO, PaginationService } from '@hedhog/pagination';
|
2
|
+
import { PrismaService } from '@hedhog/prisma';
|
3
|
+
import { CreateDTO } from './dto/create.dto';
|
4
|
+
import { DeleteDTO } from '../dto/delete.dto';
|
5
|
+
import { UpdateDTO } from './dto/update.dto';
|
6
|
+
export declare class SettingsService {
|
7
|
+
private readonly prismaService;
|
8
|
+
private readonly paginationService;
|
9
|
+
constructor(prismaService: PrismaService, paginationService: PaginationService);
|
10
|
+
getSettings(paginationParams: PaginationDTO): Promise<import("@hedhog/pagination").PaginatedResult<unknown>>;
|
11
|
+
get(settingId: number): Promise<any>;
|
12
|
+
create({ name }: CreateDTO): Promise<any>;
|
13
|
+
update({ id, data }: {
|
14
|
+
id: number;
|
15
|
+
data: UpdateDTO;
|
16
|
+
}): Promise<any>;
|
17
|
+
delete({ ids }: DeleteDTO): Promise<any>;
|
18
|
+
}
|
19
|
+
//# sourceMappingURL=settings.service.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"settings.service.d.ts","sourceRoot":"","sources":["../../src/setting/settings.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,mBAAmB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,qBACa,eAAe;IAGxB,OAAO,CAAC,QAAQ,CAAC,aAAa;IAE9B,OAAO,CAAC,QAAQ,CAAC,iBAAiB;gBAFjB,aAAa,EAAE,aAAa,EAE5B,iBAAiB,EAAE,iBAAiB;IAGjD,WAAW,CAAC,gBAAgB,EAAE,aAAa;IAmB3C,GAAG,CAAC,SAAS,EAAE,MAAM;IAMrB,MAAM,CAAC,EAAE,IAAI,EAAE,EAAE,SAAS;IAM1B,MAAM,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,SAAS,CAAA;KAAE;IAOpD,MAAM,CAAC,EAAE,GAAG,EAAE,EAAE,SAAS;CAehC"}
|
@@ -0,0 +1,70 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7
|
+
};
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
10
|
+
};
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
13
|
+
};
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
15
|
+
exports.SettingsService = void 0;
|
16
|
+
const pagination_1 = require("@hedhog/pagination");
|
17
|
+
const prisma_1 = require("@hedhog/prisma");
|
18
|
+
const common_1 = require("@nestjs/common");
|
19
|
+
let SettingsService = class SettingsService {
|
20
|
+
constructor(prismaService, paginationService) {
|
21
|
+
this.prismaService = prismaService;
|
22
|
+
this.paginationService = paginationService;
|
23
|
+
}
|
24
|
+
async getSettings(paginationParams) {
|
25
|
+
const fields = ['name'];
|
26
|
+
const OR = this.prismaService.createInsensitiveSearch(fields, paginationParams);
|
27
|
+
return this.paginationService.paginate(this.prismaService.settings, paginationParams, {
|
28
|
+
where: {
|
29
|
+
OR,
|
30
|
+
},
|
31
|
+
});
|
32
|
+
}
|
33
|
+
async get(settingId) {
|
34
|
+
return this.prismaService.settings.findUnique({
|
35
|
+
where: { id: settingId },
|
36
|
+
});
|
37
|
+
}
|
38
|
+
async create({ name }) {
|
39
|
+
return this.prismaService.settings.create({
|
40
|
+
data: { name },
|
41
|
+
});
|
42
|
+
}
|
43
|
+
async update({ id, data }) {
|
44
|
+
return this.prismaService.settings.update({
|
45
|
+
where: { id },
|
46
|
+
data,
|
47
|
+
});
|
48
|
+
}
|
49
|
+
async delete({ ids }) {
|
50
|
+
if (ids == undefined || ids == null) {
|
51
|
+
throw new common_1.BadRequestException(`You must select at least one setting to delete.`);
|
52
|
+
}
|
53
|
+
return this.prismaService.settings.deleteMany({
|
54
|
+
where: {
|
55
|
+
id: {
|
56
|
+
in: ids,
|
57
|
+
},
|
58
|
+
},
|
59
|
+
});
|
60
|
+
}
|
61
|
+
};
|
62
|
+
exports.SettingsService = SettingsService;
|
63
|
+
exports.SettingsService = SettingsService = __decorate([
|
64
|
+
(0, common_1.Injectable)(),
|
65
|
+
__param(0, (0, common_1.Inject)((0, common_1.forwardRef)(() => prisma_1.PrismaService))),
|
66
|
+
__param(1, (0, common_1.Inject)((0, common_1.forwardRef)(() => pagination_1.PaginationService))),
|
67
|
+
__metadata("design:paramtypes", [prisma_1.PrismaService,
|
68
|
+
pagination_1.PaginationService])
|
69
|
+
], SettingsService);
|
70
|
+
//# sourceMappingURL=settings.service.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"settings.service.js","sourceRoot":"","sources":["../../src/setting/settings.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mDAAsE;AACtE,2CAA+C;AAC/C,2CAKwB;AAMjB,IAAM,eAAe,GAArB,MAAM,eAAe;IAC1B,YAEmB,aAA4B,EAE5B,iBAAoC;QAFpC,kBAAa,GAAb,aAAa,CAAe;QAE5B,sBAAiB,GAAjB,iBAAiB,CAAmB;IACpD,CAAC;IAEJ,KAAK,CAAC,WAAW,CAAC,gBAA+B;QAC/C,MAAM,MAAM,GAAG,CAAC,MAAM,CAAC,CAAC;QAExB,MAAM,EAAE,GAAU,IAAI,CAAC,aAAa,CAAC,uBAAuB,CAC1D,MAAM,EACN,gBAAgB,CACjB,CAAC;QAEF,OAAO,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CACpC,IAAI,CAAC,aAAa,CAAC,QAAQ,EAC3B,gBAAgB,EAChB;YACE,KAAK,EAAE;gBACL,EAAE;aACH;SACF,CACF,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,SAAiB;QACzB,OAAO,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,UAAU,CAAC;YAC5C,KAAK,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE;SACzB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,EAAE,IAAI,EAAa;QAC9B,OAAO,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,MAAM,CAAC;YACxC,IAAI,EAAE,EAAE,IAAI,EAAE;SACf,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,IAAI,EAAmC;QACxD,OAAO,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,MAAM,CAAC;YACxC,KAAK,EAAE,EAAE,EAAE,EAAE;YACb,IAAI;SACL,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,EAAE,GAAG,EAAa;QAC7B,IAAI,GAAG,IAAI,SAAS,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;YACpC,MAAM,IAAI,4BAAmB,CAC3B,iDAAiD,CAClD,CAAC;QACJ,CAAC;QAED,OAAO,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,UAAU,CAAC;YAC5C,KAAK,EAAE;gBACL,EAAE,EAAE;oBACF,EAAE,EAAE,GAAG;iBACR;aACF;SACF,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AA7DY,0CAAe;0BAAf,eAAe;IAD3B,IAAA,mBAAU,GAAE;IAGR,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,sBAAa,CAAC,CAAC,CAAA;IAEvC,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,8BAAiB,CAAC,CAAC,CAAA;qCADZ,sBAAa;QAET,8BAAiB;GAL5C,eAAe,CA6D3B"}
|
package/package.json
CHANGED
@@ -68,6 +68,12 @@ export class Migrate implements MigrationInterface {
|
|
68
68
|
description: 'Check all routes registered in the system.',
|
69
69
|
icon: 'route',
|
70
70
|
},
|
71
|
+
{
|
72
|
+
name: 'Settings',
|
73
|
+
slug: '/management/settings',
|
74
|
+
description: 'Check all settings registered in the system.',
|
75
|
+
icon: 'settings',
|
76
|
+
},
|
71
77
|
])
|
72
78
|
.execute();
|
73
79
|
}
|
@@ -90,7 +90,7 @@ export class Migrate implements MigrationInterface {
|
|
90
90
|
const managementId = await this.insertMenu(
|
91
91
|
queryRunner,
|
92
92
|
'Management',
|
93
|
-
|
93
|
+
'/management',
|
94
94
|
1,
|
95
95
|
null,
|
96
96
|
'settings',
|
@@ -135,6 +135,14 @@ export class Migrate implements MigrationInterface {
|
|
135
135
|
managementId,
|
136
136
|
'route',
|
137
137
|
);
|
138
|
+
await this.insertMenu(
|
139
|
+
queryRunner,
|
140
|
+
'Settings',
|
141
|
+
'/management/settings',
|
142
|
+
5,
|
143
|
+
managementId,
|
144
|
+
'settings',
|
145
|
+
);
|
138
146
|
}
|
139
147
|
|
140
148
|
private async insertMenu(
|
@@ -37,12 +37,20 @@ export class Migrate implements MigrationInterface {
|
|
37
37
|
.where('slug = :slug', { slug: '/management/routes' })
|
38
38
|
.execute();
|
39
39
|
|
40
|
+
const screenIdSetting = await queryRunner.manager
|
41
|
+
.createQueryBuilder()
|
42
|
+
.select()
|
43
|
+
.from('screens', 's')
|
44
|
+
.where('slug = :slug', { slug: '/management/settings' })
|
45
|
+
.execute();
|
46
|
+
|
40
47
|
for (const { url, screendId } of [
|
41
48
|
{ url: '/screens%', screendId: screenIdScreen[0].id },
|
42
49
|
{ url: '/roles%', screendId: screenIdRole[0].id },
|
43
50
|
{ url: '/users%', screendId: screenIdUser[0].id },
|
44
51
|
{ url: '/menus%', screendId: screenIdMenu[0].id },
|
45
52
|
{ url: '/routes%', screendId: screenIdRoute[0].id },
|
53
|
+
{ url: '/settings%', screendId: screenIdSetting[0].id },
|
46
54
|
]) {
|
47
55
|
const routesScreens = await queryRunner.manager
|
48
56
|
.createQueryBuilder()
|
@@ -0,0 +1,78 @@
|
|
1
|
+
import {
|
2
|
+
MigrationInterface,
|
3
|
+
QueryRunner,
|
4
|
+
Table,
|
5
|
+
TableForeignKey,
|
6
|
+
} from 'typeorm';
|
7
|
+
import { idColumn, timestampColumn } from '@hedhog/utils';
|
8
|
+
|
9
|
+
export class Migrate implements MigrationInterface {
|
10
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
11
|
+
await queryRunner.createTable(
|
12
|
+
new Table({
|
13
|
+
name: 'settings',
|
14
|
+
columns: [
|
15
|
+
idColumn(),
|
16
|
+
{
|
17
|
+
name: 'name',
|
18
|
+
type: 'varchar',
|
19
|
+
},
|
20
|
+
timestampColumn(),
|
21
|
+
timestampColumn('updated_at'),
|
22
|
+
],
|
23
|
+
}),
|
24
|
+
);
|
25
|
+
|
26
|
+
await queryRunner.createTable(
|
27
|
+
new Table({
|
28
|
+
name: 'setting_values',
|
29
|
+
columns: [
|
30
|
+
idColumn(),
|
31
|
+
{
|
32
|
+
name: 'value',
|
33
|
+
type: 'varchar',
|
34
|
+
length: '1023',
|
35
|
+
},
|
36
|
+
{
|
37
|
+
name: 'name',
|
38
|
+
type: 'varchar',
|
39
|
+
isUnique: true,
|
40
|
+
},
|
41
|
+
{
|
42
|
+
name: 'description',
|
43
|
+
type: 'varchar',
|
44
|
+
isNullable: true,
|
45
|
+
},
|
46
|
+
{
|
47
|
+
name: 'label',
|
48
|
+
type: 'varchar',
|
49
|
+
isNullable: true,
|
50
|
+
},
|
51
|
+
{
|
52
|
+
name: 'setting_id',
|
53
|
+
type: 'int',
|
54
|
+
unsigned: true,
|
55
|
+
},
|
56
|
+
timestampColumn(),
|
57
|
+
timestampColumn('updated_at'),
|
58
|
+
],
|
59
|
+
}),
|
60
|
+
);
|
61
|
+
|
62
|
+
// Criação das foreign keys
|
63
|
+
await queryRunner.createForeignKey(
|
64
|
+
'setting_values',
|
65
|
+
new TableForeignKey({
|
66
|
+
columnNames: ['setting_id'],
|
67
|
+
referencedColumnNames: ['id'],
|
68
|
+
referencedTableName: 'settings',
|
69
|
+
onDelete: 'CASCADE',
|
70
|
+
}),
|
71
|
+
);
|
72
|
+
}
|
73
|
+
|
74
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
75
|
+
await queryRunner.dropTable('setting_values');
|
76
|
+
await queryRunner.dropTable('settings');
|
77
|
+
}
|
78
|
+
}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"auth.service.spec.d.ts","sourceRoot":"","sources":["../../src/auth/auth.service.spec.ts"],"names":[],"mappings":""}
|
@@ -1,17 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
const testing_1 = require("@nestjs/testing");
|
4
|
-
const auth_service_1 = require("./auth.service");
|
5
|
-
describe('AuthService', () => {
|
6
|
-
let service;
|
7
|
-
beforeEach(async () => {
|
8
|
-
const module = await testing_1.Test.createTestingModule({
|
9
|
-
providers: [auth_service_1.AuthService],
|
10
|
-
}).compile();
|
11
|
-
service = module.get(auth_service_1.AuthService);
|
12
|
-
});
|
13
|
-
it('should be defined', () => {
|
14
|
-
expect(service).toBeDefined();
|
15
|
-
});
|
16
|
-
});
|
17
|
-
//# sourceMappingURL=auth.service.spec.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"auth.service.spec.js","sourceRoot":"","sources":["../../src/auth/auth.service.spec.ts"],"names":[],"mappings":";;AAAA,6CAAsD;AACtD,iDAA6C;AAE7C,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IAC3B,IAAI,OAAoB,CAAC;IAEzB,UAAU,CAAC,KAAK,IAAI,EAAE;QACpB,MAAM,MAAM,GAAkB,MAAM,cAAI,CAAC,mBAAmB,CAAC;YAC3D,SAAS,EAAE,CAAC,0BAAW,CAAC;SACzB,CAAC,CAAC,OAAO,EAAE,CAAC;QAEb,OAAO,GAAG,MAAM,CAAC,GAAG,CAAc,0BAAW,CAAC,CAAC;IACjD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,mBAAmB,EAAE,GAAG,EAAE;QAC3B,MAAM,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC;IAChC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|