@hedhog/setting 0.0.6 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) 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 -29
  58. package/README.md +0 -108
  59. package/dist/dto/create.dto.d.ts +0 -4
  60. package/dist/dto/create.dto.d.ts.map +0 -1
  61. package/dist/dto/create.dto.js.map +0 -1
  62. package/dist/dto/delete.dto.d.ts.map +0 -1
  63. package/dist/dto/delete.dto.js.map +0 -1
  64. package/dist/dto/update.dto.d.ts +0 -4
  65. package/dist/dto/update.dto.d.ts.map +0 -1
  66. package/dist/dto/update.dto.js.map +0 -1
  67. package/dist/migrations/index.d.ts +0 -6
  68. package/dist/migrations/index.d.ts.map +0 -1
  69. package/dist/migrations/index.js +0 -67
  70. package/dist/migrations/index.js.map +0 -1
  71. package/dist/settings.controller.d.ts +0 -14
  72. package/dist/settings.controller.d.ts.map +0 -1
  73. package/dist/settings.controller.js +0 -95
  74. package/dist/settings.controller.js.map +0 -1
  75. package/dist/settings.module.d.ts +0 -3
  76. package/dist/settings.module.d.ts.map +0 -1
  77. package/dist/settings.module.js.map +0 -1
  78. package/dist/settings.service.d.ts +0 -19
  79. package/dist/settings.service.d.ts.map +0 -1
  80. package/dist/settings.service.js +0 -70
  81. package/dist/settings.service.js.map +0 -1
  82. package/src/dto/create.dto.ts +0 -7
  83. package/src/dto/delete.dto.ts +0 -8
  84. package/src/dto/update.dto.ts +0 -3
  85. package/src/index.ts +0 -2
  86. package/src/migrations/index.ts +0 -78
  87. package/src/settings.controller.ts +0 -65
  88. package/src/settings.module.ts +0 -18
  89. package/src/settings.service.ts +0 -75
  90. package/tsconfig.lib.json +0 -9
  91. package/tsconfig.production.json +0 -20
  92. /package/dist/{dto → setting/dto}/delete.dto.d.ts +0 -0
  93. /package/dist/{dto → setting/dto}/delete.dto.js +0 -0
@@ -1,65 +0,0 @@
1
- import { AuthGuard } from '@hedhog/auth';
2
- import { Pagination } from '@hedhog/pagination';
3
- import {
4
- Body,
5
- Controller,
6
- Delete,
7
- Get,
8
- Inject,
9
- Param,
10
- ParseIntPipe,
11
- Patch,
12
- Post,
13
- UseGuards,
14
- forwardRef,
15
- } from '@nestjs/common';
16
- import { CreateDTO } from './dto/create.dto';
17
- import { DeleteDTO } from './dto/delete.dto';
18
- import { UpdateDTO } from './dto/update.dto';
19
- import { SettingsService } from './settings.service';
20
- import { Permission } from '@hedhog/permission';
21
-
22
- @Permission()
23
- @Controller('settings')
24
- export class SettingsController {
25
- constructor(
26
- @Inject(forwardRef(() => SettingsService))
27
- private readonly settingsService: SettingsService,
28
- ) {}
29
-
30
- @UseGuards(AuthGuard)
31
- @Get()
32
- async getSettings(@Pagination() paginationParams) {
33
- return this.settingsService.getSettings(paginationParams);
34
- }
35
-
36
- @UseGuards(AuthGuard)
37
- @Get(':settingId')
38
- async show(@Param('settingId', ParseIntPipe) settingId: number) {
39
- return this.settingsService.get(settingId);
40
- }
41
-
42
- @UseGuards(AuthGuard)
43
- @Post()
44
- create(@Body() data: CreateDTO) {
45
- return this.settingsService.create(data);
46
- }
47
-
48
- @UseGuards(AuthGuard)
49
- @Patch(':settingId')
50
- async update(
51
- @Param('settingId', ParseIntPipe) settingId: number,
52
- @Body() data: UpdateDTO,
53
- ) {
54
- return this.settingsService.update({
55
- id: settingId,
56
- data,
57
- });
58
- }
59
-
60
- @UseGuards(AuthGuard)
61
- @Delete()
62
- async delete(@Body() data: DeleteDTO) {
63
- return this.settingsService.delete(data);
64
- }
65
- }
@@ -1,18 +0,0 @@
1
- import { AuthModule } from '@hedhog/auth';
2
- import { PaginationModule } from '@hedhog/pagination';
3
- import { PrismaModule } from '@hedhog/prisma';
4
- import { Module, forwardRef } from '@nestjs/common';
5
- import { SettingsController } from './settings.controller';
6
- import { SettingsService } from './settings.service';
7
-
8
- @Module({
9
- providers: [SettingsService],
10
- exports: [SettingsService],
11
- controllers: [SettingsController],
12
- imports: [
13
- forwardRef(() => AuthModule),
14
- forwardRef(() => PrismaModule),
15
- forwardRef(() => PaginationModule),
16
- ],
17
- })
18
- export class SettingModule {}
@@ -1,75 +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 fields = ['name'];
24
-
25
- const OR: any[] = this.prismaService.createInsensitiveSearch(
26
- fields,
27
- paginationParams,
28
- );
29
-
30
- return this.paginationService.paginate(
31
- this.prismaService.settings,
32
- paginationParams,
33
- {
34
- where: {
35
- OR,
36
- },
37
- },
38
- );
39
- }
40
-
41
- async get(settingId: number) {
42
- return this.prismaService.settings.findUnique({
43
- where: { id: settingId },
44
- });
45
- }
46
-
47
- async create({ name }: CreateDTO) {
48
- return this.prismaService.settings.create({
49
- data: { name },
50
- });
51
- }
52
-
53
- async update({ id, data }: { id: number; data: UpdateDTO }) {
54
- return this.prismaService.settings.update({
55
- where: { id },
56
- data,
57
- });
58
- }
59
-
60
- async delete({ ids }: DeleteDTO) {
61
- if (ids == undefined || ids == null) {
62
- throw new BadRequestException(
63
- `You must select at least one setting to delete.`,
64
- );
65
- }
66
-
67
- return this.prismaService.settings.deleteMany({
68
- where: {
69
- id: {
70
- in: ids,
71
- },
72
- },
73
- });
74
- }
75
- }
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