@hed-hog/core 0.0.321 → 0.0.325

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.
Files changed (68) hide show
  1. package/dist/auth/auth.controller.d.ts +3 -3
  2. package/dist/auth/auth.service.d.ts +8 -8
  3. package/dist/auth/guards/auth.guard.d.ts.map +1 -1
  4. package/dist/auth/guards/auth.guard.js +0 -1
  5. package/dist/auth/guards/auth.guard.js.map +1 -1
  6. package/dist/core.module.d.ts.map +1 -1
  7. package/dist/core.module.js +3 -0
  8. package/dist/core.module.js.map +1 -1
  9. package/dist/dashboard/dashboard-user/dashboard-user.controller.d.ts +3 -3
  10. package/dist/dashboard/dashboard-user/dashboard-user.service.d.ts +3 -3
  11. package/dist/file/file.controller.d.ts +2 -2
  12. package/dist/file/file.service.d.ts +4 -4
  13. package/dist/index.d.ts +2 -0
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +2 -0
  16. package/dist/index.js.map +1 -1
  17. package/dist/mail-profile/dto/create.dto.d.ts +23 -0
  18. package/dist/mail-profile/dto/create.dto.d.ts.map +1 -0
  19. package/dist/mail-profile/dto/create.dto.js +139 -0
  20. package/dist/mail-profile/dto/create.dto.js.map +1 -0
  21. package/dist/mail-profile/dto/update.dto.d.ts +6 -0
  22. package/dist/mail-profile/dto/update.dto.d.ts.map +1 -0
  23. package/dist/mail-profile/dto/update.dto.js +9 -0
  24. package/dist/mail-profile/dto/update.dto.js.map +1 -0
  25. package/dist/mail-profile/mail-profile.controller.d.ts +94 -0
  26. package/dist/mail-profile/mail-profile.controller.d.ts.map +1 -0
  27. package/dist/mail-profile/mail-profile.controller.js +95 -0
  28. package/dist/mail-profile/mail-profile.controller.js.map +1 -0
  29. package/dist/mail-profile/mail-profile.module.d.ts +3 -0
  30. package/dist/mail-profile/mail-profile.module.d.ts.map +1 -0
  31. package/dist/mail-profile/mail-profile.module.js +31 -0
  32. package/dist/mail-profile/mail-profile.module.js.map +1 -0
  33. package/dist/mail-profile/mail-profile.service.d.ts +109 -0
  34. package/dist/mail-profile/mail-profile.service.d.ts.map +1 -0
  35. package/dist/mail-profile/mail-profile.service.js +278 -0
  36. package/dist/mail-profile/mail-profile.service.js.map +1 -0
  37. package/dist/session/session.controller.d.ts +1 -1
  38. package/dist/session/session.service.d.ts +3 -3
  39. package/dist/user/user.controller.d.ts +18 -3
  40. package/dist/user/user.controller.d.ts.map +1 -1
  41. package/dist/user/user.controller.js +22 -0
  42. package/dist/user/user.controller.js.map +1 -1
  43. package/dist/user/user.service.d.ts +22 -7
  44. package/dist/user/user.service.d.ts.map +1 -1
  45. package/dist/user/user.service.js +99 -0
  46. package/dist/user/user.service.js.map +1 -1
  47. package/hedhog/data/menu.yaml +35 -3
  48. package/hedhog/data/route.yaml +64 -0
  49. package/hedhog/frontend/app/mail/page.tsx.ejs +5 -0
  50. package/hedhog/frontend/app/mail/profiles/page.tsx.ejs +825 -0
  51. package/hedhog/frontend/app/users/page.tsx.ejs +25 -1383
  52. package/hedhog/frontend/app/users/permissions.tsx.ejs +109 -55
  53. package/hedhog/frontend/app/users/user-access-sheet.tsx.ejs +304 -0
  54. package/hedhog/frontend/app/users/user-sheet.tsx.ejs +1385 -0
  55. package/hedhog/frontend/messages/en.json +91 -0
  56. package/hedhog/frontend/messages/pt.json +91 -0
  57. package/hedhog/table/mail_profile.yaml +75 -0
  58. package/package.json +4 -4
  59. package/src/auth/guards/auth.guard.ts +0 -2
  60. package/src/core.module.ts +3 -0
  61. package/src/index.ts +2 -0
  62. package/src/mail-profile/dto/create.dto.ts +145 -0
  63. package/src/mail-profile/dto/update.dto.ts +4 -0
  64. package/src/mail-profile/mail-profile.controller.ts +56 -0
  65. package/src/mail-profile/mail-profile.module.ts +18 -0
  66. package/src/mail-profile/mail-profile.service.ts +308 -0
  67. package/src/user/user.controller.ts +13 -0
  68. package/src/user/user.service.ts +98 -5
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.MailProfileController = void 0;
16
+ const api_1 = require("@hed-hog/api");
17
+ const api_pagination_1 = require("@hed-hog/api-pagination");
18
+ const common_1 = require("@nestjs/common");
19
+ const create_dto_1 = require("./dto/create.dto");
20
+ const update_dto_1 = require("./dto/update.dto");
21
+ const mail_profile_service_1 = require("./mail-profile.service");
22
+ let MailProfileController = class MailProfileController {
23
+ constructor(mailProfileService) {
24
+ this.mailProfileService = mailProfileService;
25
+ }
26
+ async list(paginationParams) {
27
+ return this.mailProfileService.list(paginationParams);
28
+ }
29
+ async get(id) {
30
+ return this.mailProfileService.get(id);
31
+ }
32
+ async create(data) {
33
+ return this.mailProfileService.create(data);
34
+ }
35
+ async test(data) {
36
+ return this.mailProfileService.test(data);
37
+ }
38
+ async update(id, data) {
39
+ return this.mailProfileService.update({ id, data });
40
+ }
41
+ async delete(data) {
42
+ return this.mailProfileService.delete(data);
43
+ }
44
+ };
45
+ exports.MailProfileController = MailProfileController;
46
+ __decorate([
47
+ (0, common_1.Get)(),
48
+ __param(0, (0, api_pagination_1.Pagination)()),
49
+ __metadata("design:type", Function),
50
+ __metadata("design:paramtypes", [Object]),
51
+ __metadata("design:returntype", Promise)
52
+ ], MailProfileController.prototype, "list", null);
53
+ __decorate([
54
+ (0, common_1.Get)(':id'),
55
+ __param(0, (0, common_1.Param)('id', common_1.ParseIntPipe)),
56
+ __metadata("design:type", Function),
57
+ __metadata("design:paramtypes", [Number]),
58
+ __metadata("design:returntype", Promise)
59
+ ], MailProfileController.prototype, "get", null);
60
+ __decorate([
61
+ (0, common_1.Post)(),
62
+ __param(0, (0, common_1.Body)()),
63
+ __metadata("design:type", Function),
64
+ __metadata("design:paramtypes", [create_dto_1.CreateDTO]),
65
+ __metadata("design:returntype", Promise)
66
+ ], MailProfileController.prototype, "create", null);
67
+ __decorate([
68
+ (0, common_1.Post)('test'),
69
+ __param(0, (0, common_1.Body)()),
70
+ __metadata("design:type", Function),
71
+ __metadata("design:paramtypes", [create_dto_1.CreateDTO]),
72
+ __metadata("design:returntype", Promise)
73
+ ], MailProfileController.prototype, "test", null);
74
+ __decorate([
75
+ (0, common_1.Patch)(':id'),
76
+ __param(0, (0, common_1.Param)('id', common_1.ParseIntPipe)),
77
+ __param(1, (0, common_1.Body)()),
78
+ __metadata("design:type", Function),
79
+ __metadata("design:paramtypes", [Number, update_dto_1.UpdateDTO]),
80
+ __metadata("design:returntype", Promise)
81
+ ], MailProfileController.prototype, "update", null);
82
+ __decorate([
83
+ (0, common_1.Delete)(),
84
+ __param(0, (0, common_1.Body)()),
85
+ __metadata("design:type", Function),
86
+ __metadata("design:paramtypes", [api_1.DeleteDTO]),
87
+ __metadata("design:returntype", Promise)
88
+ ], MailProfileController.prototype, "delete", null);
89
+ exports.MailProfileController = MailProfileController = __decorate([
90
+ (0, api_1.Role)(),
91
+ (0, common_1.Controller)('mail-profile'),
92
+ __param(0, (0, common_1.Inject)((0, common_1.forwardRef)(() => mail_profile_service_1.MailProfileService))),
93
+ __metadata("design:paramtypes", [mail_profile_service_1.MailProfileService])
94
+ ], MailProfileController);
95
+ //# sourceMappingURL=mail-profile.controller.js.map
@@ -0,0 +1 @@
1
+ {"version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ACA,WAAA,IAAA,cAAK,EAAC,IAAI,EAAE,qBAAY,CAAC,CAAA;;;;gDAEnC;AAGK;IADL,IAAA,aAAI,GAAE;IACO,WAAA,IAAA,aAAI,GAAE,CAAA;;qCAAO,sBAAS;;mDAEnC;AAGK;IADL,IAAA,aAAI,EAAC,MAAM,CAAC;IACD,WAAA,IAAA,aAAI,GAAE,CAAA;;qCAAO,sBAAS;;iDAEjC;AAGK;IADL,IAAA,cAAK,EAAC,KAAK,CAAC;IACC,WAAA,IAAA,cAAK,EAAC,IAAI,EAAE,qBAAY,CAAC,CAAA;IAAc,WAAA,IAAA,aAAI,GAAE,CAAA;;6CAAO,sBAAS;;mDAE1E;AAGK;IADL,IAAA,eAAM,GAAE;IACK,WAAA,IAAA,aAAI,GAAE,CAAA;;qCAAO,eAAS;;mDAEnC;gCAlCU,qBAAqB;IAFjC,IAAA,UAAI,GAAE;IACN,IAAA,mBAAU,EAAC,cAAc,CAAC;IAGtB,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,yCAAkB,CAAC,CAAC,CAAA;qCACR,yCAAkB;GAH9C,qBAAqB,CAmCjC"}
@@ -0,0 +1,3 @@
1
+ export declare class MailProfileModule {
2
+ }
3
+ //# sourceMappingURL=mail-profile.module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mail-profile.module.d.ts","sourceRoot":"","sources":["../../src/mail-profile/mail-profile.module.ts"],"names":[],"mappings":"AAOA,qBAUa,iBAAiB;CAAG"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.MailProfileModule = void 0;
10
+ const api_pagination_1 = require("@hed-hog/api-pagination");
11
+ const api_prisma_1 = require("@hed-hog/api-prisma");
12
+ const common_1 = require("@nestjs/common");
13
+ const mail_module_1 = require("../mail/mail.module");
14
+ const mail_profile_controller_1 = require("./mail-profile.controller");
15
+ const mail_profile_service_1 = require("./mail-profile.service");
16
+ let MailProfileModule = class MailProfileModule {
17
+ };
18
+ exports.MailProfileModule = MailProfileModule;
19
+ exports.MailProfileModule = MailProfileModule = __decorate([
20
+ (0, common_1.Module)({
21
+ imports: [
22
+ (0, common_1.forwardRef)(() => api_prisma_1.PrismaModule),
23
+ (0, common_1.forwardRef)(() => api_pagination_1.PaginationModule),
24
+ (0, common_1.forwardRef)(() => mail_module_1.MailModule),
25
+ ],
26
+ controllers: [mail_profile_controller_1.MailProfileController],
27
+ providers: [mail_profile_service_1.MailProfileService],
28
+ exports: [mail_profile_service_1.MailProfileService],
29
+ })
30
+ ], MailProfileModule);
31
+ //# sourceMappingURL=mail-profile.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mail-profile.module.js","sourceRoot":"","sources":["../../src/mail-profile/mail-profile.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,4DAA2D;AAC3D,oDAAmD;AACnD,2CAAoD;AACpD,qDAAiD;AACjD,uEAAkE;AAClE,iEAA4D;AAYrD,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;CAAG,CAAA;AAApB,8CAAiB;4BAAjB,iBAAiB;IAV7B,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,yBAAY,CAAC;YAC9B,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,iCAAgB,CAAC;YAClC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,wBAAU,CAAC;SAC7B;QACD,WAAW,EAAE,CAAC,+CAAqB,CAAC;QACpC,SAAS,EAAE,CAAC,yCAAkB,CAAC;QAC/B,OAAO,EAAE,CAAC,yCAAkB,CAAC;KAC9B,CAAC;GACW,iBAAiB,CAAG"}
@@ -0,0 +1,109 @@
1
+ import { DeleteDTO } from '@hed-hog/api';
2
+ import { MailService as MailMainService } from '@hed-hog/api-mail';
3
+ import { PaginationDTO, PaginationService } from '@hed-hog/api-pagination';
4
+ import { PrismaService } from '@hed-hog/api-prisma';
5
+ import { MailService } from '../mail/mail.service';
6
+ import { CreateDTO } from './dto/create.dto';
7
+ import { UpdateDTO } from './dto/update.dto';
8
+ export declare class MailProfileService {
9
+ private readonly prismaService;
10
+ private readonly paginationService;
11
+ private readonly mailMainService;
12
+ private readonly mailService;
13
+ constructor(prismaService: PrismaService, paginationService: PaginationService, mailMainService: MailMainService, mailService: MailService);
14
+ list(paginationParams: PaginationDTO): Promise<{
15
+ total: any;
16
+ lastPage: number;
17
+ page: number;
18
+ pageSize: number;
19
+ prev: number;
20
+ next: number;
21
+ data: any[];
22
+ }>;
23
+ get(id: number): Promise<{
24
+ name: string;
25
+ id: number;
26
+ provider: import("@prisma/client").$Enums.mail_profile_provider_e62e6be632_enum;
27
+ created_at: Date;
28
+ updated_at: Date;
29
+ slug: string;
30
+ from_name: string | null;
31
+ from_email: string;
32
+ reply_to_name: string | null;
33
+ reply_to_email: string | null;
34
+ smtp_host: string | null;
35
+ smtp_port: number | null;
36
+ smtp_secure: boolean;
37
+ smtp_username: string | null;
38
+ smtp_password: string | null;
39
+ gmail_client_id: string | null;
40
+ gmail_client_secret: string | null;
41
+ gmail_refresh_token: string | null;
42
+ ses_access_key_id: string | null;
43
+ ses_secret_access_key: string | null;
44
+ ses_region: string | null;
45
+ }>;
46
+ create(data: CreateDTO): Promise<{
47
+ name: string;
48
+ id: number;
49
+ provider: import("@prisma/client").$Enums.mail_profile_provider_e62e6be632_enum;
50
+ created_at: Date;
51
+ updated_at: Date;
52
+ slug: string;
53
+ from_name: string | null;
54
+ from_email: string;
55
+ reply_to_name: string | null;
56
+ reply_to_email: string | null;
57
+ smtp_host: string | null;
58
+ smtp_port: number | null;
59
+ smtp_secure: boolean;
60
+ smtp_username: string | null;
61
+ smtp_password: string | null;
62
+ gmail_client_id: string | null;
63
+ gmail_client_secret: string | null;
64
+ gmail_refresh_token: string | null;
65
+ ses_access_key_id: string | null;
66
+ ses_secret_access_key: string | null;
67
+ ses_region: string | null;
68
+ }>;
69
+ update({ id, data }: {
70
+ id: number;
71
+ data: UpdateDTO;
72
+ }): Promise<{
73
+ name: string;
74
+ id: number;
75
+ provider: import("@prisma/client").$Enums.mail_profile_provider_e62e6be632_enum;
76
+ created_at: Date;
77
+ updated_at: Date;
78
+ slug: string;
79
+ from_name: string | null;
80
+ from_email: string;
81
+ reply_to_name: string | null;
82
+ reply_to_email: string | null;
83
+ smtp_host: string | null;
84
+ smtp_port: number | null;
85
+ smtp_secure: boolean;
86
+ smtp_username: string | null;
87
+ smtp_password: string | null;
88
+ gmail_client_id: string | null;
89
+ gmail_client_secret: string | null;
90
+ gmail_refresh_token: string | null;
91
+ ses_access_key_id: string | null;
92
+ ses_secret_access_key: string | null;
93
+ ses_region: string | null;
94
+ }>;
95
+ delete({ ids }: DeleteDTO): Promise<{
96
+ count: number;
97
+ }>;
98
+ test(data: CreateDTO): Promise<{
99
+ success: boolean;
100
+ destination: string;
101
+ }>;
102
+ private ensureSlugIsAvailable;
103
+ private validateProviderFields;
104
+ private normalizeData;
105
+ private buildMailConfig;
106
+ private normalizeString;
107
+ private normalizeNullableString;
108
+ }
109
+ //# sourceMappingURL=mail-profile.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mail-profile.service.d.ts","sourceRoot":"","sources":["../../src/mail-profile/mail-profile.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,WAAW,IAAI,eAAe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
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.MailProfileService = void 0;
16
+ const api_mail_1 = require("@hed-hog/api-mail");
17
+ const api_pagination_1 = require("@hed-hog/api-pagination");
18
+ const api_prisma_1 = require("@hed-hog/api-prisma");
19
+ const common_1 = require("@nestjs/common");
20
+ const mail_service_1 = require("../mail/mail.service");
21
+ let MailProfileService = class MailProfileService {
22
+ constructor(prismaService, paginationService, mailMainService, mailService) {
23
+ this.prismaService = prismaService;
24
+ this.paginationService = paginationService;
25
+ this.mailMainService = mailMainService;
26
+ this.mailService = mailService;
27
+ }
28
+ async list(paginationParams) {
29
+ const fields = ['slug', 'name', 'provider', 'from_email', 'reply_to_email'];
30
+ const OR = this.prismaService.createInsensitiveSearch(fields, paginationParams);
31
+ return this.paginationService.paginate(this.prismaService.mail_profile, paginationParams, {
32
+ where: OR.length > 0 ? { OR } : {},
33
+ select: {
34
+ id: true,
35
+ slug: true,
36
+ name: true,
37
+ provider: true,
38
+ from_name: true,
39
+ from_email: true,
40
+ reply_to_name: true,
41
+ reply_to_email: true,
42
+ created_at: true,
43
+ updated_at: true,
44
+ },
45
+ orderBy: [{ updated_at: 'desc' }, { id: 'desc' }],
46
+ });
47
+ }
48
+ async get(id) {
49
+ const profile = await this.prismaService.mail_profile.findUnique({
50
+ where: { id },
51
+ });
52
+ if (!profile) {
53
+ throw new common_1.NotFoundException(`Mail profile with id ${id} not found.`);
54
+ }
55
+ return profile;
56
+ }
57
+ async create(data) {
58
+ await this.ensureSlugIsAvailable(data.slug);
59
+ this.validateProviderFields(data);
60
+ return this.prismaService.mail_profile.create({
61
+ data: this.normalizeData(data),
62
+ });
63
+ }
64
+ async update({ id, data }) {
65
+ const existing = await this.prismaService.mail_profile.findUnique({
66
+ where: { id },
67
+ });
68
+ if (!existing) {
69
+ throw new common_1.NotFoundException(`Mail profile with id ${id} not found.`);
70
+ }
71
+ if (data.slug && data.slug !== existing.slug) {
72
+ await this.ensureSlugIsAvailable(data.slug);
73
+ }
74
+ const merged = Object.assign(Object.assign({}, existing), data);
75
+ this.validateProviderFields(merged);
76
+ return this.prismaService.mail_profile.update({
77
+ where: { id },
78
+ data: this.normalizeData(merged),
79
+ });
80
+ }
81
+ async delete({ ids }) {
82
+ if (!(ids === null || ids === void 0 ? void 0 : ids.length)) {
83
+ throw new common_1.BadRequestException('You must select at least one item to delete.');
84
+ }
85
+ return this.prismaService.mail_profile.deleteMany({
86
+ where: {
87
+ id: {
88
+ in: ids,
89
+ },
90
+ },
91
+ });
92
+ }
93
+ async test(data) {
94
+ this.validateProviderFields(data);
95
+ const normalized = this.normalizeData(data);
96
+ const config = this.buildMailConfig(normalized);
97
+ const destinationEmail = normalized.from_email;
98
+ const sender = normalized.from_name
99
+ ? `${normalized.from_name} <${normalized.from_email}>`
100
+ : normalized.from_email;
101
+ const replyTo = normalized.reply_to_email
102
+ ? normalized.reply_to_name
103
+ ? `${normalized.reply_to_name} <${normalized.reply_to_email}>`
104
+ : normalized.reply_to_email
105
+ : undefined;
106
+ try {
107
+ this.mailMainService.setConfig(config);
108
+ await this.mailMainService.send({
109
+ to: destinationEmail,
110
+ from: sender,
111
+ replyTo,
112
+ subject: `[HedHog] Teste do perfil ${normalized.name}`,
113
+ body: `
114
+ <p>Este e-mail confirma que o perfil <strong>${normalized.name}</strong> foi validado com sucesso.</p>
115
+ <p><strong>Slug:</strong> ${normalized.slug}</p>
116
+ <p><strong>Provedor:</strong> ${normalized.provider}</p>
117
+ <p><strong>Remetente:</strong> ${sender}</p>
118
+ `,
119
+ });
120
+ return {
121
+ success: true,
122
+ destination: destinationEmail,
123
+ };
124
+ }
125
+ finally {
126
+ await this.mailService.reloadConfig().catch(() => undefined);
127
+ }
128
+ }
129
+ async ensureSlugIsAvailable(slug) {
130
+ const existing = await this.prismaService.mail_profile.findUnique({
131
+ where: { slug },
132
+ select: { id: true },
133
+ });
134
+ if (existing) {
135
+ throw new common_1.BadRequestException(`Mail profile with slug "${slug}" already exists.`);
136
+ }
137
+ }
138
+ validateProviderFields(input) {
139
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
140
+ const provider = String((_a = input.provider) !== null && _a !== void 0 ? _a : '').toUpperCase();
141
+ if (!provider) {
142
+ throw new common_1.BadRequestException('Provider is required.');
143
+ }
144
+ if (!String((_b = input.from_email) !== null && _b !== void 0 ? _b : '').trim()) {
145
+ throw new common_1.BadRequestException('Sender email is required.');
146
+ }
147
+ switch (provider) {
148
+ case 'SMTP':
149
+ if (!String((_c = input.smtp_host) !== null && _c !== void 0 ? _c : '').trim()) {
150
+ throw new common_1.BadRequestException('SMTP host is required.');
151
+ }
152
+ if (!input.smtp_port) {
153
+ throw new common_1.BadRequestException('SMTP port is required.');
154
+ }
155
+ if (!String((_d = input.smtp_username) !== null && _d !== void 0 ? _d : '').trim()) {
156
+ throw new common_1.BadRequestException('SMTP username is required.');
157
+ }
158
+ if (!String((_e = input.smtp_password) !== null && _e !== void 0 ? _e : '').trim()) {
159
+ throw new common_1.BadRequestException('SMTP password is required.');
160
+ }
161
+ break;
162
+ case 'GMAIL':
163
+ if (!String((_f = input.gmail_client_id) !== null && _f !== void 0 ? _f : '').trim()) {
164
+ throw new common_1.BadRequestException('Gmail client ID is required.');
165
+ }
166
+ if (!String((_g = input.gmail_client_secret) !== null && _g !== void 0 ? _g : '').trim()) {
167
+ throw new common_1.BadRequestException('Gmail client secret is required.');
168
+ }
169
+ if (!String((_h = input.gmail_refresh_token) !== null && _h !== void 0 ? _h : '').trim()) {
170
+ throw new common_1.BadRequestException('Gmail refresh token is required.');
171
+ }
172
+ break;
173
+ case 'SES':
174
+ if (!String((_j = input.ses_access_key_id) !== null && _j !== void 0 ? _j : '').trim()) {
175
+ throw new common_1.BadRequestException('SES access key ID is required.');
176
+ }
177
+ if (!String((_k = input.ses_secret_access_key) !== null && _k !== void 0 ? _k : '').trim()) {
178
+ throw new common_1.BadRequestException('SES secret access key is required.');
179
+ }
180
+ if (!String((_l = input.ses_region) !== null && _l !== void 0 ? _l : '').trim()) {
181
+ throw new common_1.BadRequestException('SES region is required.');
182
+ }
183
+ break;
184
+ default:
185
+ throw new common_1.BadRequestException(`Invalid provider: ${provider}`);
186
+ }
187
+ }
188
+ normalizeData(input) {
189
+ var _a;
190
+ const provider = String((_a = input.provider) !== null && _a !== void 0 ? _a : '').toUpperCase();
191
+ return {
192
+ slug: this.normalizeString(input.slug),
193
+ name: this.normalizeString(input.name),
194
+ provider,
195
+ from_name: this.normalizeNullableString(input.from_name),
196
+ from_email: this.normalizeString(input.from_email),
197
+ reply_to_name: this.normalizeNullableString(input.reply_to_name),
198
+ reply_to_email: this.normalizeNullableString(input.reply_to_email),
199
+ smtp_host: provider === 'SMTP' ? this.normalizeNullableString(input.smtp_host) : null,
200
+ smtp_port: provider === 'SMTP' && input.smtp_port !== undefined && input.smtp_port !== null
201
+ ? Number(input.smtp_port)
202
+ : null,
203
+ smtp_secure: provider === 'SMTP' ? Boolean(input.smtp_secure) : false,
204
+ smtp_username: provider === 'SMTP' ? this.normalizeNullableString(input.smtp_username) : null,
205
+ smtp_password: provider === 'SMTP' ? this.normalizeNullableString(input.smtp_password) : null,
206
+ gmail_client_id: provider === 'GMAIL' ? this.normalizeNullableString(input.gmail_client_id) : null,
207
+ gmail_client_secret: provider === 'GMAIL'
208
+ ? this.normalizeNullableString(input.gmail_client_secret)
209
+ : null,
210
+ gmail_refresh_token: provider === 'GMAIL'
211
+ ? this.normalizeNullableString(input.gmail_refresh_token)
212
+ : null,
213
+ ses_access_key_id: provider === 'SES' ? this.normalizeNullableString(input.ses_access_key_id) : null,
214
+ ses_secret_access_key: provider === 'SES'
215
+ ? this.normalizeNullableString(input.ses_secret_access_key)
216
+ : null,
217
+ ses_region: provider === 'SES' ? this.normalizeNullableString(input.ses_region) : null,
218
+ };
219
+ }
220
+ buildMailConfig(input) {
221
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
222
+ switch (input.provider) {
223
+ case 'SMTP':
224
+ return {
225
+ global: true,
226
+ type: 'SMTP',
227
+ host: (_a = input.smtp_host) !== null && _a !== void 0 ? _a : '',
228
+ port: (_b = input.smtp_port) !== null && _b !== void 0 ? _b : 587,
229
+ secure: input.smtp_secure,
230
+ username: (_c = input.smtp_username) !== null && _c !== void 0 ? _c : '',
231
+ password: (_d = input.smtp_password) !== null && _d !== void 0 ? _d : '',
232
+ };
233
+ case 'GMAIL':
234
+ return {
235
+ global: true,
236
+ type: 'GMAIL',
237
+ clientId: (_e = input.gmail_client_id) !== null && _e !== void 0 ? _e : '',
238
+ clientSecret: (_f = input.gmail_client_secret) !== null && _f !== void 0 ? _f : '',
239
+ refreshToken: (_g = input.gmail_refresh_token) !== null && _g !== void 0 ? _g : '',
240
+ from: input.from_email,
241
+ };
242
+ case 'SES':
243
+ return {
244
+ global: true,
245
+ type: 'SES',
246
+ region: (_h = input.ses_region) !== null && _h !== void 0 ? _h : '',
247
+ accessKeyId: (_j = input.ses_access_key_id) !== null && _j !== void 0 ? _j : '',
248
+ secretAccessKey: (_k = input.ses_secret_access_key) !== null && _k !== void 0 ? _k : '',
249
+ from: input.from_email,
250
+ };
251
+ default:
252
+ throw new common_1.BadRequestException(`Invalid provider: ${input.provider}`);
253
+ }
254
+ }
255
+ normalizeString(value) {
256
+ return String(value !== null && value !== void 0 ? value : '').trim();
257
+ }
258
+ normalizeNullableString(value) {
259
+ if (value === undefined || value === null) {
260
+ return null;
261
+ }
262
+ const normalized = String(value).trim();
263
+ return normalized.length > 0 ? normalized : null;
264
+ }
265
+ };
266
+ exports.MailProfileService = MailProfileService;
267
+ exports.MailProfileService = MailProfileService = __decorate([
268
+ (0, common_1.Injectable)(),
269
+ __param(0, (0, common_1.Inject)((0, common_1.forwardRef)(() => api_prisma_1.PrismaService))),
270
+ __param(1, (0, common_1.Inject)((0, common_1.forwardRef)(() => api_pagination_1.PaginationService))),
271
+ __param(2, (0, common_1.Inject)((0, common_1.forwardRef)(() => api_mail_1.MailService))),
272
+ __param(3, (0, common_1.Inject)((0, common_1.forwardRef)(() => mail_service_1.MailService))),
273
+ __metadata("design:paramtypes", [api_prisma_1.PrismaService,
274
+ api_pagination_1.PaginationService,
275
+ api_mail_1.MailService,
276
+ mail_service_1.MailService])
277
+ ], MailProfileService);
278
+ //# sourceMappingURL=mail-profile.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mail-profile.service.js","sourceRoot":"","sources":["../../src/mail-profile/mail-profile.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,gDAAmE;AACnE,4DAA2E;AAC3E,oDAAoD;AACpD,2CAMwB;AACxB,uDAAmD;AAK5C,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAC7B,YAEmB,aAA4B,EAE5B,iBAAoC,EAEpC,eAAgC,EAEhC,WAAwB;QANxB,kBAAa,GAAb,aAAa,CAAe;QAE5B,sBAAiB,GAAjB,iBAAiB,CAAmB;QAEpC,oBAAe,GAAf,eAAe,CAAiB;QAEhC,gBAAW,GAAX,WAAW,CAAa;IACxC,CAAC;IAEJ,KAAK,CAAC,IAAI,CAAC,gBAA+B;QACxC,MAAM,MAAM,GAAG,CAAC,MAAM,EAAE,MAA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1C,OAAO,IAAI,CAAC;QACd,CAAC;QAED,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC;QACxC,OAAO,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC;IACnD,CAAC;CACF,CAAA;AAnSY,gDAAkB;6BAAlB,kBAAkB;IAD9B,IAAA,mBAAU,GAAE;IAGR,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,0BAAa,CAAC,CAAC,CAAA;IAEvC,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,kCAAiB,CAAC,CAAC,CAAA;IAE3C,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,sBAAe,CAAC,CAAC,CAAA;IAEzC,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,0BAAW,CAAC,CAAC,CAAA;qCALN,0BAAa;QAET,kCAAiB;QAEnB,sBAAe;QAEnB,0BAAW;GAThC,kBAAkB,CAmS9B"}
@@ -37,8 +37,8 @@ export declare class SessionController {
37
37
  ip_address: string;
38
38
  user_agent: string;
39
39
  user_id: number;
40
- revoked_at: Date | null;
41
40
  expires_at: Date;
41
+ revoked_at: Date | null;
42
42
  }>;
43
43
  }
44
44
  //# sourceMappingURL=session.controller.d.ts.map
@@ -25,8 +25,8 @@ export declare class SessionService {
25
25
  ip_address: string;
26
26
  user_agent: string;
27
27
  user_id: number;
28
- revoked_at: Date | null;
29
28
  expires_at: Date;
29
+ revoked_at: Date | null;
30
30
  };
31
31
  }>;
32
32
  refresh(locale: string, refreshToken: string, ipAddress: string, userAgent: string): Promise<{
@@ -39,8 +39,8 @@ export declare class SessionService {
39
39
  ip_address: string;
40
40
  user_agent: string;
41
41
  user_id: number;
42
- revoked_at: Date | null;
43
42
  expires_at: Date;
43
+ revoked_at: Date | null;
44
44
  };
45
45
  }>;
46
46
  deleteRefreshTokenCookie(res: any, refreshToken: string): Promise<{
@@ -73,8 +73,8 @@ export declare class SessionService {
73
73
  ip_address: string;
74
74
  user_agent: string;
75
75
  user_id: number;
76
- revoked_at: Date | null;
77
76
  expires_at: Date;
77
+ revoked_at: Date | null;
78
78
  }>;
79
79
  /**
80
80
  * Enforce maximum concurrent sessions limit for a user.
@@ -57,8 +57,8 @@ export declare class UserController {
57
57
  created_at: Date;
58
58
  updated_at: Date;
59
59
  user_id: number;
60
- revoked_at: Date | null;
61
60
  expires_at: Date | null;
61
+ revoked_at: Date | null;
62
62
  requires_reset: boolean;
63
63
  }[];
64
64
  user_session: {
@@ -69,8 +69,8 @@ export declare class UserController {
69
69
  ip_address: string;
70
70
  user_agent: string;
71
71
  user_id: number;
72
- revoked_at: Date | null;
73
72
  expires_at: Date;
73
+ revoked_at: Date | null;
74
74
  }[];
75
75
  } & {
76
76
  name: string;
@@ -137,12 +137,27 @@ export declare class UserController {
137
137
  description: any;
138
138
  isAssigned: boolean;
139
139
  }[]>;
140
+ getUserMenus(userId: number, locale: string): Promise<{
141
+ id: number;
142
+ menuId: any;
143
+ url: any;
144
+ icon: any;
145
+ order: any;
146
+ name: any;
147
+ roles: any;
148
+ }[]>;
149
+ getUserRoutes(userId: number, locale: string): Promise<{
150
+ id: number;
151
+ url: string;
152
+ method: import("@prisma/client").$Enums.route_method_3b4d117a29_enum;
153
+ roles: any;
154
+ }[]>;
140
155
  assignRoleToUser(userId: number, roleId: number, locale: string): Promise<{
141
156
  id: number;
142
157
  created_at: Date;
143
158
  updated_at: Date;
144
- role_id: number;
145
159
  user_id: number;
160
+ role_id: number;
146
161
  }>;
147
162
  removeRoleFromUser(userId: number, roleId: number, locale: string): Promise<{
148
163
  count: number;
@@ -1 +1 @@
1
- {"version":3,"file":"user.controller.d.ts","sourceRoot":"","sources":["../../src/user/user.controller.ts"],"names":[],"mappings":"AAoBA,OAAO,E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