@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.
- 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 -27
- 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 -93
- 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 -83
- 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 -63
- package/src/settings.module.ts +0 -18
- package/src/settings.service.ts +0 -86
- 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
package/src/settings.service.ts
DELETED
@@ -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
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
|