@hed-hog/core 0.0.151 → 0.0.153
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dashboard/dashboard/dashboard.controller.d.ts +214 -9
- package/dist/dashboard/dashboard/dashboard.controller.d.ts.map +1 -1
- package/dist/dashboard/dashboard/dashboard.controller.js +35 -35
- package/dist/dashboard/dashboard/dashboard.controller.js.map +1 -1
- package/dist/dashboard/dashboard/dashboard.module.d.ts +1 -1
- package/dist/dashboard/dashboard/dashboard.module.d.ts.map +1 -1
- package/dist/dashboard/dashboard/dashboard.module.js +11 -6
- package/dist/dashboard/dashboard/dashboard.module.js.map +1 -1
- package/dist/dashboard/dashboard/dashboard.service.d.ts +217 -16
- package/dist/dashboard/dashboard/dashboard.service.d.ts.map +1 -1
- package/dist/dashboard/dashboard/dashboard.service.js +115 -28
- package/dist/dashboard/dashboard/dashboard.service.js.map +1 -1
- package/dist/dashboard/dashboard/dto/create.dto.d.ts +4 -2
- package/dist/dashboard/dashboard/dto/create.dto.d.ts.map +1 -1
- package/dist/dashboard/dashboard/dto/create.dto.js +10 -1
- package/dist/dashboard/dashboard/dto/create.dto.js.map +1 -1
- package/dist/dashboard/dashboard/dto/index.d.ts +5 -0
- package/dist/dashboard/dashboard/dto/index.d.ts.map +1 -0
- package/dist/dashboard/dashboard/dto/index.js +25 -0
- package/dist/dashboard/dashboard/dto/index.js.map +1 -0
- package/dist/dashboard/dashboard/dto/update.dto.d.ts +5 -4
- package/dist/dashboard/dashboard/dto/update.dto.d.ts.map +1 -1
- package/dist/dashboard/dashboard/dto/update.dto.js +27 -3
- package/dist/dashboard/dashboard/dto/update.dto.js.map +1 -1
- package/dist/dashboard/dashboard-component/dashboard-component.controller.d.ts +114 -9
- package/dist/dashboard/dashboard-component/dashboard-component.controller.d.ts.map +1 -1
- package/dist/dashboard/dashboard-component/dashboard-component.controller.js +35 -36
- package/dist/dashboard/dashboard-component/dashboard-component.controller.js.map +1 -1
- package/dist/dashboard/dashboard-component/dashboard-component.module.js +4 -3
- package/dist/dashboard/dashboard-component/dashboard-component.module.js.map +1 -1
- package/dist/dashboard/dashboard-component/dashboard-component.service.d.ts +116 -15
- package/dist/dashboard/dashboard-component/dashboard-component.service.d.ts.map +1 -1
- package/dist/dashboard/dashboard-component/dashboard-component.service.js +109 -22
- package/dist/dashboard/dashboard-component/dashboard-component.service.js.map +1 -1
- package/dist/dashboard/dashboard-component/dto/create.dto.d.ts +4 -2
- package/dist/dashboard/dashboard-component/dto/create.dto.d.ts.map +1 -1
- package/dist/dashboard/dashboard-component/dto/create.dto.js +10 -1
- package/dist/dashboard/dashboard-component/dto/create.dto.js.map +1 -1
- package/dist/dashboard/dashboard-component/dto/index.d.ts +5 -0
- package/dist/dashboard/dashboard-component/dto/index.d.ts.map +1 -0
- package/dist/dashboard/dashboard-component/dto/index.js +25 -0
- package/dist/dashboard/dashboard-component/dto/index.js.map +1 -0
- package/dist/dashboard/dashboard-component/dto/update.dto.d.ts +13 -4
- package/dist/dashboard/dashboard-component/dto/update.dto.d.ts.map +1 -1
- package/dist/dashboard/dashboard-component/dto/update.dto.js +67 -3
- package/dist/dashboard/dashboard-component/dto/update.dto.js.map +1 -1
- package/dist/dashboard/dashboard-core/dashboard-core.controller.d.ts +56 -0
- package/dist/dashboard/dashboard-core/dashboard-core.controller.d.ts.map +1 -1
- package/dist/dashboard/dashboard-core/dashboard-core.controller.js +65 -0
- package/dist/dashboard/dashboard-core/dashboard-core.controller.js.map +1 -1
- package/dist/dashboard/dashboard-core/dashboard-core.service.d.ts +52 -0
- package/dist/dashboard/dashboard-core/dashboard-core.service.d.ts.map +1 -1
- package/dist/dashboard/dashboard-core/dashboard-core.service.js +221 -0
- package/dist/dashboard/dashboard-core/dashboard-core.service.js.map +1 -1
- package/dist/dashboard/dashboard-item/dashboard-item.controller.d.ts +26 -29
- package/dist/dashboard/dashboard-item/dashboard-item.controller.d.ts.map +1 -1
- package/dist/dashboard/dashboard-item/dashboard-item.controller.js +24 -43
- package/dist/dashboard/dashboard-item/dashboard-item.controller.js.map +1 -1
- package/dist/dashboard/dashboard-item/dashboard-item.service.d.ts +30 -34
- package/dist/dashboard/dashboard-item/dashboard-item.service.d.ts.map +1 -1
- package/dist/dashboard/dashboard-item/dashboard-item.service.js +51 -35
- package/dist/dashboard/dashboard-item/dashboard-item.service.js.map +1 -1
- package/dist/dashboard/dashboard-item/dto/index.d.ts +5 -0
- package/dist/dashboard/dashboard-item/dto/index.d.ts.map +1 -0
- package/dist/dashboard/dashboard-item/dto/index.js +25 -0
- package/dist/dashboard/dashboard-item/dto/index.js.map +1 -0
- package/dist/dashboard/dashboard-item/dto/update.dto.d.ts +7 -4
- package/dist/dashboard/dashboard-item/dto/update.dto.d.ts.map +1 -1
- package/dist/dashboard/dashboard-item/dto/update.dto.js +42 -3
- package/dist/dashboard/dashboard-item/dto/update.dto.js.map +1 -1
- package/dist/dashboard/dashboard.module.js +1 -1
- package/dist/dashboard/dashboard.module.js.map +1 -1
- package/dist/oauth/oauth.controller.d.ts.map +1 -1
- package/dist/oauth/oauth.controller.js.map +1 -1
- package/dist/oauth/providers/microsoft-entra-id.provider.d.ts.map +1 -1
- package/dist/oauth/providers/microsoft-entra-id.provider.js +7 -4
- package/dist/oauth/providers/microsoft-entra-id.provider.js.map +1 -1
- package/dist/setting/setting.service.d.ts.map +1 -1
- package/dist/setting/setting.service.js +1 -0
- package/dist/setting/setting.service.js.map +1 -1
- package/hedhog/data/route.yaml +44 -14
- package/hedhog/data/setting_group.yaml +10 -0
- package/hedhog/query/dashboard-seed.sql +131 -0
- package/package.json +1 -1
- package/src/dashboard/dashboard/dashboard.controller.ts +26 -23
- package/src/dashboard/dashboard/dashboard.module.ts +7 -2
- package/src/dashboard/dashboard/dashboard.service.ts +125 -44
- package/src/dashboard/dashboard/dto/create.dto.ts +12 -3
- package/src/dashboard/dashboard/dto/index.ts +7 -0
- package/src/dashboard/dashboard/dto/update.dto.ts +17 -3
- package/src/dashboard/dashboard-component/dashboard-component.controller.ts +22 -19
- package/src/dashboard/dashboard-component/dashboard-component.module.ts +3 -3
- package/src/dashboard/dashboard-component/dashboard-component.service.ts +128 -39
- package/src/dashboard/dashboard-component/dto/create.dto.ts +12 -3
- package/src/dashboard/dashboard-component/dto/index.ts +7 -0
- package/src/dashboard/dashboard-component/dto/update.dto.ts +49 -3
- package/src/dashboard/dashboard-core/dashboard-core.controller.ts +53 -2
- package/src/dashboard/dashboard-core/dashboard-core.service.ts +271 -0
- package/src/dashboard/dashboard-item/dashboard-item.controller.ts +17 -26
- package/src/dashboard/dashboard-item/dashboard-item.service.ts +55 -47
- package/src/dashboard/dashboard-item/dto/index.ts +7 -0
- package/src/dashboard/dashboard-item/dto/update.dto.ts +27 -3
- package/src/dashboard/dashboard.module.ts +2 -2
- package/src/language/en.json +4 -1
- package/src/language/pt.json +4 -1
- package/src/oauth/oauth.controller.ts +1 -2
- package/src/oauth/providers/microsoft-entra-id.provider.ts +9 -4
- package/src/setting/setting.service.ts +1 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Role } from '@hed-hog/api';
|
|
2
2
|
import { Locale } from '@hed-hog/api-locale';
|
|
3
|
+
import { Pagination } from '@hed-hog/api-pagination';
|
|
3
4
|
import {
|
|
4
5
|
Body,
|
|
5
6
|
Controller,
|
|
@@ -8,14 +9,12 @@ import {
|
|
|
8
9
|
Inject,
|
|
9
10
|
Param,
|
|
10
11
|
ParseIntPipe,
|
|
11
|
-
Patch,
|
|
12
12
|
Post,
|
|
13
|
-
|
|
13
|
+
Query,
|
|
14
|
+
forwardRef
|
|
14
15
|
} from '@nestjs/common';
|
|
15
|
-
import { CreateDTO } from './dto/create.dto';
|
|
16
|
-
import { UpdateDTO } from './dto/update.dto';
|
|
17
16
|
import { DashboardItemService } from './dashboard-item.service';
|
|
18
|
-
import {
|
|
17
|
+
import { CreateDashboardItemDTO } from './dto';
|
|
19
18
|
|
|
20
19
|
@Role()
|
|
21
20
|
@Controller('dashboard-item')
|
|
@@ -26,30 +25,22 @@ export class DashboardItemController {
|
|
|
26
25
|
) {}
|
|
27
26
|
|
|
28
27
|
@Get()
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
return this.dashboardItemService.
|
|
28
|
+
getAllDashboardItems(
|
|
29
|
+
@Pagination() paginationParams,
|
|
30
|
+
@Locale() locale: string,
|
|
31
|
+
@Query('dashboardId') dashboardId?: string,
|
|
32
|
+
) {
|
|
33
|
+
const id = dashboardId ? parseInt(dashboardId) : undefined;
|
|
34
|
+
return this.dashboardItemService.getAllDashboardItems(paginationParams, locale, id);
|
|
36
35
|
}
|
|
37
36
|
|
|
38
37
|
@Post()
|
|
39
|
-
|
|
40
|
-
return this.dashboardItemService.
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
@Patch(':id')
|
|
44
|
-
async update(@Param('id', ParseIntPipe) id: number, @Body() data: UpdateDTO) {
|
|
45
|
-
return this.dashboardItemService.update({
|
|
46
|
-
id,
|
|
47
|
-
data,
|
|
48
|
-
});
|
|
38
|
+
createDashboardItem(@Body() data: CreateDashboardItemDTO, @Locale() locale: string) {
|
|
39
|
+
return this.dashboardItemService.createDashboardItem(data, locale);
|
|
49
40
|
}
|
|
50
41
|
|
|
51
|
-
@Delete()
|
|
52
|
-
|
|
53
|
-
return this.dashboardItemService.
|
|
42
|
+
@Delete(':id')
|
|
43
|
+
deleteDashboardItem(@Param('id', ParseIntPipe) id: number, @Locale() locale: string) {
|
|
44
|
+
return this.dashboardItemService.deleteDashboardItem(id, locale);
|
|
54
45
|
}
|
|
55
46
|
}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { getLocaleText, LocaleService } from '@hed-hog/api-locale';
|
|
2
|
+
import { PaginationService } from '@hed-hog/api-pagination';
|
|
3
3
|
import { PrismaService } from '@hed-hog/api-prisma';
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
forwardRef,
|
|
6
|
+
Inject,
|
|
7
|
+
Injectable,
|
|
8
|
+
NotFoundException
|
|
9
9
|
} from '@nestjs/common';
|
|
10
|
-
import {
|
|
11
|
-
import { UpdateDTO } from './dto/update.dto';
|
|
10
|
+
import { CreateDashboardItemDTO } from './dto';
|
|
12
11
|
|
|
13
12
|
@Injectable()
|
|
14
13
|
export class DashboardItemService {
|
|
@@ -17,66 +16,75 @@ export class DashboardItemService {
|
|
|
17
16
|
private readonly prismaService: PrismaService,
|
|
18
17
|
@Inject(forwardRef(() => PaginationService))
|
|
19
18
|
private readonly paginationService: PaginationService,
|
|
19
|
+
@Inject(forwardRef(() => LocaleService))
|
|
20
|
+
private readonly localeService: LocaleService,
|
|
20
21
|
) {}
|
|
21
22
|
|
|
22
|
-
async
|
|
23
|
-
const fields = [];
|
|
24
|
-
const OR: any[] = this.prismaService.createInsensitiveSearch(
|
|
25
|
-
fields,
|
|
26
|
-
paginationParams,
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
if (paginationParams.search && !isNaN(+paginationParams.search)) {
|
|
30
|
-
OR.push({ id: { equals: +paginationParams.search } });
|
|
31
|
-
}
|
|
32
|
-
|
|
23
|
+
async getAllDashboardItems(paginationParams, locale: string, dashboardId?: number) {
|
|
33
24
|
return this.paginationService.paginate(
|
|
34
25
|
this.prismaService.dashboard_item,
|
|
35
26
|
paginationParams,
|
|
36
27
|
{
|
|
37
|
-
where: {
|
|
38
|
-
OR,
|
|
39
|
-
},
|
|
28
|
+
where: dashboardId ? { dashboard_id: dashboardId } : undefined,
|
|
40
29
|
include: {
|
|
41
|
-
|
|
42
|
-
|
|
30
|
+
dashboard: {
|
|
31
|
+
include: {
|
|
32
|
+
dashboard_locale: {
|
|
33
|
+
include: {
|
|
34
|
+
locale: true,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
dashboard_component: {
|
|
40
|
+
include: {
|
|
41
|
+
dashboard_component_locale: {
|
|
42
|
+
include: {
|
|
43
|
+
locale: true,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
orderBy: {
|
|
50
|
+
id: 'desc',
|
|
43
51
|
},
|
|
44
52
|
},
|
|
53
|
+
'dashboardItem',
|
|
45
54
|
);
|
|
46
55
|
}
|
|
47
56
|
|
|
48
|
-
async
|
|
49
|
-
return this.prismaService.dashboard_item.findUnique({
|
|
50
|
-
where: { id: id },
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
async create(data: CreateDTO) {
|
|
57
|
+
async createDashboardItem(data: CreateDashboardItemDTO, locale: string) {
|
|
55
58
|
return this.prismaService.dashboard_item.create({
|
|
56
|
-
data
|
|
59
|
+
data: {
|
|
60
|
+
dashboard_id: data.dashboard_id,
|
|
61
|
+
component_id: data.component_id,
|
|
62
|
+
width: data.width,
|
|
63
|
+
height: data.height,
|
|
64
|
+
x_axis: data.x_axis,
|
|
65
|
+
y_axis: data.y_axis,
|
|
66
|
+
},
|
|
67
|
+
include: {
|
|
68
|
+
dashboard: true,
|
|
69
|
+
dashboard_component: true,
|
|
70
|
+
},
|
|
57
71
|
});
|
|
58
72
|
}
|
|
59
73
|
|
|
60
|
-
async
|
|
61
|
-
|
|
62
|
-
where: { id
|
|
63
|
-
data,
|
|
74
|
+
async deleteDashboardItem(id: number, locale: string) {
|
|
75
|
+
const item = await this.prismaService.dashboard_item.findUnique({
|
|
76
|
+
where: { id },
|
|
64
77
|
});
|
|
65
|
-
}
|
|
66
78
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
'You must select at least one item to delete.',
|
|
79
|
+
if (!item) {
|
|
80
|
+
throw new NotFoundException(
|
|
81
|
+
getLocaleText('dashboardItemNotFound', locale, 'Dashboard item not found'),
|
|
71
82
|
);
|
|
72
83
|
}
|
|
73
84
|
|
|
74
|
-
|
|
75
|
-
where: {
|
|
76
|
-
id: {
|
|
77
|
-
in: ids,
|
|
78
|
-
},
|
|
79
|
-
},
|
|
85
|
+
await this.prismaService.dashboard_item.delete({
|
|
86
|
+
where: { id },
|
|
80
87
|
});
|
|
88
|
+
return { success: true };
|
|
81
89
|
}
|
|
82
90
|
}
|
|
@@ -1,4 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { getLocaleText } from '@hed-hog/api-locale';
|
|
2
|
+
import { IsNumber, IsOptional } from 'class-validator';
|
|
3
3
|
|
|
4
|
-
export class UpdateDTO
|
|
4
|
+
export class UpdateDTO {
|
|
5
|
+
@IsOptional()
|
|
6
|
+
@IsNumber({}, { message: (args) => getLocaleText('validation.numberRequired', args.value) })
|
|
7
|
+
component_id?: number;
|
|
8
|
+
|
|
9
|
+
@IsOptional()
|
|
10
|
+
@IsNumber({}, { message: (args) => getLocaleText('validation.numberRequired', args.value) })
|
|
11
|
+
dashboard_id?: number;
|
|
12
|
+
|
|
13
|
+
@IsOptional()
|
|
14
|
+
@IsNumber({}, { message: (args) => getLocaleText('validation.numberRequired', args.value) })
|
|
15
|
+
width?: number;
|
|
16
|
+
|
|
17
|
+
@IsOptional()
|
|
18
|
+
@IsNumber({}, { message: (args) => getLocaleText('validation.numberRequired', args.value) })
|
|
19
|
+
height?: number;
|
|
20
|
+
|
|
21
|
+
@IsOptional()
|
|
22
|
+
@IsNumber({}, { message: (args) => getLocaleText('validation.numberRequired', args.value) })
|
|
23
|
+
x_axis?: number;
|
|
24
|
+
|
|
25
|
+
@IsOptional()
|
|
26
|
+
@IsNumber({}, { message: (args) => getLocaleText('validation.numberRequired', args.value) })
|
|
27
|
+
y_axis?: number;
|
|
28
|
+
}
|
|
@@ -5,13 +5,13 @@ import { DashboardComponentModule } from './dashboard-component/dashboard-compon
|
|
|
5
5
|
import { DashboardCoreModule } from './dashboard-core/dashboard-core.module';
|
|
6
6
|
import { DashboardItemModule } from './dashboard-item/dashboard-item.module';
|
|
7
7
|
import { DashboardUserModule } from './dashboard-user/dashboard-user.module';
|
|
8
|
-
import {
|
|
8
|
+
import { DashboardCrudModule } from './dashboard/dashboard.module';
|
|
9
9
|
|
|
10
10
|
@Module({
|
|
11
11
|
imports: [
|
|
12
12
|
forwardRef(() => LocaleModule),
|
|
13
13
|
forwardRef(() => PrismaModule),
|
|
14
|
-
forwardRef(() =>
|
|
14
|
+
forwardRef(() => DashboardCrudModule),
|
|
15
15
|
forwardRef(() => DashboardComponentModule),
|
|
16
16
|
forwardRef(() => DashboardItemModule),
|
|
17
17
|
forwardRef(() => DashboardUserModule),
|
package/src/language/en.json
CHANGED
|
@@ -167,5 +167,8 @@
|
|
|
167
167
|
},
|
|
168
168
|
"mail_sent_not_found": "Mail sent record not found.",
|
|
169
169
|
"validationSslugMustBeString": "Slug must be a string.",
|
|
170
|
-
"sessionRevoked": "Session has been revoked or expired."
|
|
170
|
+
"sessionRevoked": "Session has been revoked or expired.",
|
|
171
|
+
"dashboardNotFound": "Dashboard not found.",
|
|
172
|
+
"dashboardComponentNotFound": "Dashboard component not found.",
|
|
173
|
+
"dashboardItemNotFound": "Dashboard item not found."
|
|
171
174
|
}
|
package/src/language/pt.json
CHANGED
|
@@ -167,5 +167,8 @@
|
|
|
167
167
|
},
|
|
168
168
|
"mail_sent_not_found": "Registro de e-mail enviado não encontrado.",
|
|
169
169
|
"validationSslugMustBeString": "O slug deve ser uma string.",
|
|
170
|
-
"sessionRevoked": "Sessão foi revogada ou
|
|
170
|
+
"sessionRevoked": "Sessão foi revogada ou expirou.",
|
|
171
|
+
"dashboardNotFound": "Dashboard não encontrado.",
|
|
172
|
+
"dashboardComponentNotFound": "Componente de dashboard não encontrado.",
|
|
173
|
+
"dashboardItemNotFound": "Item de dashboard não encontrado."
|
|
171
174
|
}
|
|
@@ -20,7 +20,7 @@ import { OAuthService } from './oauth.service';
|
|
|
20
20
|
export class OAuthController {
|
|
21
21
|
constructor(private readonly service: OAuthService, private readonly settingService: SettingService) {}
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
@Public()
|
|
24
24
|
@Get('github/callback')
|
|
25
25
|
async githubCallback(
|
|
26
26
|
@Query('code') code: string,
|
|
@@ -33,7 +33,6 @@ export class OAuthController {
|
|
|
33
33
|
return res.redirect(redirectURL);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
|
|
37
36
|
@Public()
|
|
38
37
|
@Get(':provider/login')
|
|
39
38
|
async login(@Param('provider') provider: string, @Res() res) {
|
|
@@ -19,12 +19,17 @@ export class MicrosoftEntraIdProvider extends BaseOAuthProvider {
|
|
|
19
19
|
|
|
20
20
|
async getAuthUrl(callbackPath: string) {
|
|
21
21
|
const settings = await this.setting.getSettingValues([
|
|
22
|
-
'
|
|
23
|
-
'
|
|
24
|
-
'
|
|
25
|
-
'
|
|
22
|
+
'microsoft_entra_id_client_id',
|
|
23
|
+
'microsoft_entra_id_client_secret',
|
|
24
|
+
'microsoft_entra_id_scopes',
|
|
25
|
+
'microsoft_entra_id_tenant_id',
|
|
26
26
|
'url',
|
|
27
27
|
]);
|
|
28
|
+
|
|
29
|
+
console.log({
|
|
30
|
+
settings
|
|
31
|
+
})
|
|
32
|
+
|
|
28
33
|
const tenantId = settings['microsoft_tenant_id'];
|
|
29
34
|
const redirectURI = new URL(callbackPath, settings['url']).toString();
|
|
30
35
|
const scopes = settings['microsoft_scopes'];
|