@hedhog/setting 0.0.5 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. package/dist/index.d.ts +1 -2
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +1 -2
  4. package/dist/index.js.map +1 -1
  5. package/dist/setting/dto/create.dto.d.ts +8 -0
  6. package/dist/setting/dto/create.dto.d.ts.map +1 -0
  7. package/dist/setting/dto/create.dto.js +36 -0
  8. package/dist/setting/dto/create.dto.js.map +1 -0
  9. package/dist/setting/dto/delete.dto.d.ts.map +1 -0
  10. package/dist/setting/dto/delete.dto.js.map +1 -0
  11. package/dist/setting/dto/setting-user.dto.d.ts +4 -0
  12. package/dist/setting/dto/setting-user.dto.d.ts.map +1 -0
  13. package/dist/{dto/create.dto.js → setting/dto/setting-user.dto.js} +6 -7
  14. package/dist/setting/dto/setting-user.dto.js.map +1 -0
  15. package/dist/setting/dto/setting.dto.d.ts +9 -0
  16. package/dist/setting/dto/setting.dto.d.ts.map +1 -0
  17. package/dist/setting/dto/setting.dto.js +34 -0
  18. package/dist/setting/dto/setting.dto.js.map +1 -0
  19. package/dist/setting/dto/update.dto.d.ts +6 -0
  20. package/dist/setting/dto/update.dto.d.ts.map +1 -0
  21. package/dist/{dto → setting/dto}/update.dto.js +2 -1
  22. package/dist/setting/dto/update.dto.js.map +1 -0
  23. package/dist/setting/setting.controller.d.ts +26 -0
  24. package/dist/setting/setting.controller.d.ts.map +1 -0
  25. package/dist/setting/setting.controller.js +160 -0
  26. package/dist/setting/setting.controller.js.map +1 -0
  27. package/dist/setting/setting.service.d.ts +33 -0
  28. package/dist/setting/setting.service.d.ts.map +1 -0
  29. package/dist/setting/setting.service.js +377 -0
  30. package/dist/setting/setting.service.js.map +1 -0
  31. package/dist/setting.module.d.ts +3 -0
  32. package/dist/setting.module.d.ts.map +1 -0
  33. package/dist/{settings.module.js → setting.module.js} +8 -8
  34. package/dist/setting.module.js.map +1 -0
  35. package/frontend/setting/components/create-panel.tsx +83 -0
  36. package/frontend/setting/components/setting.screen.tsx +105 -0
  37. package/frontend/setting/components/update-panel.tsx +96 -0
  38. package/frontend/setting/locales/en/setting.setting.json +11 -0
  39. package/frontend/setting/locales/pt/setting.setting.json +11 -0
  40. package/frontend/setting/react-query/handlers.ts +28 -0
  41. package/frontend/setting/react-query/requests.ts +55 -0
  42. package/frontend/setting-group/components/create-panel.tsx +62 -0
  43. package/frontend/setting-group/components/setting-group.screen.tsx +107 -0
  44. package/frontend/setting-group/components/update-panel.tsx +76 -0
  45. package/frontend/setting-group/locales/en/setting.setting-group.json +11 -0
  46. package/frontend/setting-group/locales/pt/setting.setting-group.json +11 -0
  47. package/frontend/setting-group/react-query/handlers.ts +28 -0
  48. package/frontend/setting-group/react-query/requests.ts +58 -0
  49. package/frontend/setting-user/components/create-panel.tsx +71 -0
  50. package/frontend/setting-user/components/setting-user.screen.tsx +107 -0
  51. package/frontend/setting-user/components/update-panel.tsx +85 -0
  52. package/frontend/setting-user/locales/en/setting.setting-user.json +11 -0
  53. package/frontend/setting-user/locales/pt/setting.setting-user.json +11 -0
  54. package/frontend/setting-user/react-query/handlers.ts +28 -0
  55. package/frontend/setting-user/react-query/requests.ts +57 -0
  56. package/hedhog.yaml +380 -0
  57. package/package.json +39 -27
  58. package/dist/dto/create.dto.d.ts +0 -4
  59. package/dist/dto/create.dto.d.ts.map +0 -1
  60. package/dist/dto/create.dto.js.map +0 -1
  61. package/dist/dto/delete.dto.d.ts.map +0 -1
  62. package/dist/dto/delete.dto.js.map +0 -1
  63. package/dist/dto/update.dto.d.ts +0 -4
  64. package/dist/dto/update.dto.d.ts.map +0 -1
  65. package/dist/dto/update.dto.js.map +0 -1
  66. package/dist/migrations/index.d.ts +0 -6
  67. package/dist/migrations/index.d.ts.map +0 -1
  68. package/dist/migrations/index.js +0 -67
  69. package/dist/migrations/index.js.map +0 -1
  70. package/dist/settings.controller.d.ts +0 -14
  71. package/dist/settings.controller.d.ts.map +0 -1
  72. package/dist/settings.controller.js +0 -93
  73. package/dist/settings.controller.js.map +0 -1
  74. package/dist/settings.module.d.ts +0 -3
  75. package/dist/settings.module.d.ts.map +0 -1
  76. package/dist/settings.module.js.map +0 -1
  77. package/dist/settings.service.d.ts +0 -19
  78. package/dist/settings.service.d.ts.map +0 -1
  79. package/dist/settings.service.js +0 -83
  80. package/dist/settings.service.js.map +0 -1
  81. package/src/dto/create.dto.ts +0 -7
  82. package/src/dto/delete.dto.ts +0 -8
  83. package/src/dto/update.dto.ts +0 -3
  84. package/src/index.ts +0 -2
  85. package/src/migrations/index.ts +0 -78
  86. package/src/settings.controller.ts +0 -63
  87. package/src/settings.module.ts +0 -18
  88. package/src/settings.service.ts +0 -86
  89. package/tsconfig.lib.json +0 -9
  90. package/tsconfig.production.json +0 -20
  91. /package/dist/{dto → setting/dto}/delete.dto.d.ts +0 -0
  92. /package/dist/{dto → setting/dto}/delete.dto.js +0 -0
@@ -1,86 +0,0 @@
1
- import { PaginationDTO, PaginationService } from '@hedhog/pagination';
2
- import { PrismaService } from '@hedhog/prisma';
3
- import {
4
- BadRequestException,
5
- Inject,
6
- Injectable,
7
- forwardRef,
8
- } from '@nestjs/common';
9
- import { CreateDTO } from './dto/create.dto';
10
- import { DeleteDTO } from './dto/delete.dto';
11
- import { UpdateDTO } from './dto/update.dto';
12
-
13
- @Injectable()
14
- export class SettingsService {
15
- constructor(
16
- @Inject(forwardRef(() => PrismaService))
17
- private readonly prismaService: PrismaService,
18
- @Inject(forwardRef(() => PaginationService))
19
- private readonly paginationService: PaginationService,
20
- ) {}
21
-
22
- async getSettings(paginationParams: PaginationDTO) {
23
- const OR: any[] = [
24
- {
25
- name: { contains: paginationParams.search },
26
- },
27
- ];
28
-
29
- if (this.prismaService.getProvider() === 'postgres') {
30
- for (let i = 0; i < OR.length; i++) {
31
- for (let x = 0; x < Object.keys(OR[i]).length; x++) {
32
- OR[i][Object.keys(OR[i])[x]].insensitive = true;
33
- }
34
- }
35
- }
36
-
37
- if (!isNaN(+paginationParams.search)) {
38
- OR.push({ id: { equals: +paginationParams.search } });
39
- }
40
-
41
- return this.paginationService.paginate(
42
- this.prismaService.settings,
43
- paginationParams,
44
- {
45
- where: {
46
- OR,
47
- },
48
- },
49
- );
50
- }
51
-
52
- async get(settingId: number) {
53
- return this.prismaService.settings.findUnique({
54
- where: { id: settingId },
55
- });
56
- }
57
-
58
- async create({ name }: CreateDTO) {
59
- return this.prismaService.settings.create({
60
- data: { name },
61
- });
62
- }
63
-
64
- async update({ id, data }: { id: number; data: UpdateDTO }) {
65
- return this.prismaService.settings.update({
66
- where: { id },
67
- data,
68
- });
69
- }
70
-
71
- async delete({ ids }: DeleteDTO) {
72
- if (ids == undefined || ids == null) {
73
- throw new BadRequestException(
74
- `You must select at least one setting to delete.`,
75
- );
76
- }
77
-
78
- return this.prismaService.settings.deleteMany({
79
- where: {
80
- id: {
81
- in: ids,
82
- },
83
- },
84
- });
85
- }
86
- }
package/tsconfig.lib.json DELETED
@@ -1,9 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.json",
3
- "compilerOptions": {
4
- "declaration": true,
5
- "outDir": "../../dist/libs/setting"
6
- },
7
- "include": ["src/**/*"],
8
- "exclude": ["node_modules", "dist", "test", "**/*spec.ts"]
9
- }
@@ -1,20 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "experimentalDecorators": true,
4
- "target": "es2017",
5
- "module": "commonjs",
6
- "lib": ["es2017", "es7", "es6"],
7
- "declaration": true,
8
- "declarationMap": true,
9
- "sourceMap": true,
10
- "outDir": "./dist",
11
- "rootDir": "./src",
12
- "strict": true,
13
- "noImplicitAny": false,
14
- "strictNullChecks": false,
15
- "allowSyntheticDefaultImports": true,
16
- "esModuleInterop": true,
17
- "emitDecoratorMetadata": true
18
- },
19
- "exclude": ["node_modules", "dist"]
20
- }
File without changes
File without changes