@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.
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/dist/setting/dto/create.dto.d.ts +8 -0
- package/dist/setting/dto/create.dto.d.ts.map +1 -0
- package/dist/setting/dto/create.dto.js +36 -0
- package/dist/setting/dto/create.dto.js.map +1 -0
- package/dist/setting/dto/delete.dto.d.ts.map +1 -0
- package/dist/setting/dto/delete.dto.js.map +1 -0
- package/dist/setting/dto/setting-user.dto.d.ts +4 -0
- package/dist/setting/dto/setting-user.dto.d.ts.map +1 -0
- package/dist/{dto/create.dto.js → setting/dto/setting-user.dto.js} +6 -7
- package/dist/setting/dto/setting-user.dto.js.map +1 -0
- package/dist/setting/dto/setting.dto.d.ts +9 -0
- package/dist/setting/dto/setting.dto.d.ts.map +1 -0
- package/dist/setting/dto/setting.dto.js +34 -0
- package/dist/setting/dto/setting.dto.js.map +1 -0
- package/dist/setting/dto/update.dto.d.ts +6 -0
- package/dist/setting/dto/update.dto.d.ts.map +1 -0
- package/dist/{dto → setting/dto}/update.dto.js +2 -1
- package/dist/setting/dto/update.dto.js.map +1 -0
- package/dist/setting/setting.controller.d.ts +26 -0
- package/dist/setting/setting.controller.d.ts.map +1 -0
- package/dist/setting/setting.controller.js +160 -0
- package/dist/setting/setting.controller.js.map +1 -0
- package/dist/setting/setting.service.d.ts +33 -0
- package/dist/setting/setting.service.d.ts.map +1 -0
- package/dist/setting/setting.service.js +377 -0
- package/dist/setting/setting.service.js.map +1 -0
- package/dist/setting.module.d.ts +3 -0
- package/dist/setting.module.d.ts.map +1 -0
- package/dist/{settings.module.js → setting.module.js} +8 -8
- package/dist/setting.module.js.map +1 -0
- package/frontend/setting/components/create-panel.tsx +83 -0
- package/frontend/setting/components/setting.screen.tsx +105 -0
- package/frontend/setting/components/update-panel.tsx +96 -0
- package/frontend/setting/locales/en/setting.setting.json +11 -0
- package/frontend/setting/locales/pt/setting.setting.json +11 -0
- package/frontend/setting/react-query/handlers.ts +28 -0
- package/frontend/setting/react-query/requests.ts +55 -0
- package/frontend/setting-group/components/create-panel.tsx +62 -0
- package/frontend/setting-group/components/setting-group.screen.tsx +107 -0
- package/frontend/setting-group/components/update-panel.tsx +76 -0
- package/frontend/setting-group/locales/en/setting.setting-group.json +11 -0
- package/frontend/setting-group/locales/pt/setting.setting-group.json +11 -0
- package/frontend/setting-group/react-query/handlers.ts +28 -0
- package/frontend/setting-group/react-query/requests.ts +58 -0
- package/frontend/setting-user/components/create-panel.tsx +71 -0
- package/frontend/setting-user/components/setting-user.screen.tsx +107 -0
- package/frontend/setting-user/components/update-panel.tsx +85 -0
- package/frontend/setting-user/locales/en/setting.setting-user.json +11 -0
- package/frontend/setting-user/locales/pt/setting.setting-user.json +11 -0
- package/frontend/setting-user/react-query/handlers.ts +28 -0
- package/frontend/setting-user/react-query/requests.ts +57 -0
- package/hedhog.yaml +380 -0
- package/package.json +39 -29
- package/README.md +0 -108
- package/dist/dto/create.dto.d.ts +0 -4
- package/dist/dto/create.dto.d.ts.map +0 -1
- package/dist/dto/create.dto.js.map +0 -1
- package/dist/dto/delete.dto.d.ts.map +0 -1
- package/dist/dto/delete.dto.js.map +0 -1
- package/dist/dto/update.dto.d.ts +0 -4
- package/dist/dto/update.dto.d.ts.map +0 -1
- package/dist/dto/update.dto.js.map +0 -1
- package/dist/migrations/index.d.ts +0 -6
- package/dist/migrations/index.d.ts.map +0 -1
- package/dist/migrations/index.js +0 -67
- package/dist/migrations/index.js.map +0 -1
- package/dist/settings.controller.d.ts +0 -14
- package/dist/settings.controller.d.ts.map +0 -1
- package/dist/settings.controller.js +0 -95
- package/dist/settings.controller.js.map +0 -1
- package/dist/settings.module.d.ts +0 -3
- package/dist/settings.module.d.ts.map +0 -1
- package/dist/settings.module.js.map +0 -1
- package/dist/settings.service.d.ts +0 -19
- package/dist/settings.service.d.ts.map +0 -1
- package/dist/settings.service.js +0 -70
- package/dist/settings.service.js.map +0 -1
- package/src/dto/create.dto.ts +0 -7
- package/src/dto/delete.dto.ts +0 -8
- package/src/dto/update.dto.ts +0 -3
- package/src/index.ts +0 -2
- package/src/migrations/index.ts +0 -78
- package/src/settings.controller.ts +0 -65
- package/src/settings.module.ts +0 -18
- package/src/settings.service.ts +0 -75
- package/tsconfig.lib.json +0 -9
- package/tsconfig.production.json +0 -20
- /package/dist/{dto → setting/dto}/delete.dto.d.ts +0 -0
- /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
|
-
}
|
package/src/settings.module.ts
DELETED
@@ -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 {}
|
package/src/settings.service.ts
DELETED
@@ -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
package/tsconfig.production.json
DELETED
@@ -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
|