@hed-hog/core 0.0.134 → 0.0.136

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 (70) hide show
  1. package/dist/auth/auth.module.d.ts.map +1 -1
  2. package/dist/auth/auth.module.js +0 -2
  3. package/dist/auth/auth.module.js.map +1 -1
  4. package/dist/core.module.d.ts.map +1 -1
  5. package/dist/core.module.js +0 -2
  6. package/dist/core.module.js.map +1 -1
  7. package/dist/install/dto/install.dto.d.ts.map +1 -1
  8. package/dist/install/dto/install.dto.js +7 -0
  9. package/dist/install/dto/install.dto.js.map +1 -1
  10. package/dist/mail-sent/mail-sent.controller.d.ts +4 -4
  11. package/dist/mail-sent/mail-sent.controller.d.ts.map +1 -1
  12. package/dist/mail-sent/mail-sent.controller.js +17 -13
  13. package/dist/mail-sent/mail-sent.controller.js.map +1 -1
  14. package/dist/mail-sent/mail-sent.service.d.ts +3 -3
  15. package/dist/mail-sent/mail-sent.service.d.ts.map +1 -1
  16. package/dist/mail-sent/mail-sent.service.js +25 -4
  17. package/dist/mail-sent/mail-sent.service.js.map +1 -1
  18. package/dist/role/guards/role.guard.d.ts.map +1 -1
  19. package/dist/role/guards/role.guard.js +0 -6
  20. package/dist/role/guards/role.guard.js.map +1 -1
  21. package/dist/setting/dto/create.dto.d.ts +2 -2
  22. package/dist/setting/dto/create.dto.d.ts.map +1 -1
  23. package/dist/setting/dto/create.dto.js +19 -9
  24. package/dist/setting/dto/create.dto.js.map +1 -1
  25. package/dist/setting/setting.controller.d.ts +2 -2
  26. package/dist/setting/setting.controller.d.ts.map +1 -1
  27. package/dist/setting/setting.controller.js +10 -8
  28. package/dist/setting/setting.controller.js.map +1 -1
  29. package/dist/setting/setting.service.d.ts +2 -2
  30. package/dist/setting/setting.service.d.ts.map +1 -1
  31. package/dist/setting/setting.service.js +68 -18
  32. package/dist/setting/setting.service.js.map +1 -1
  33. package/hedhog/data/setting_group.yaml +4 -0
  34. package/package.json +6 -6
  35. package/src/auth/auth.module.ts +0 -2
  36. package/src/core.module.ts +0 -2
  37. package/src/install/dto/install.dto.ts +5 -5
  38. package/src/language/en.json +3 -1
  39. package/src/language/pt.json +3 -1
  40. package/src/mail-sent/mail-sent.controller.ts +11 -8
  41. package/src/mail-sent/mail-sent.service.ts +32 -4
  42. package/src/role/guards/role.guard.ts +0 -7
  43. package/src/setting/dto/create.dto.ts +19 -10
  44. package/src/setting/setting.controller.ts +4 -4
  45. package/src/setting/setting.service.ts +89 -19
  46. package/dist/mail-var/dto/create.dto.d.ts +0 -5
  47. package/dist/mail-var/dto/create.dto.d.ts.map +0 -1
  48. package/dist/mail-var/dto/create.dto.js +0 -26
  49. package/dist/mail-var/dto/create.dto.js.map +0 -1
  50. package/dist/mail-var/dto/update.dto.d.ts +0 -6
  51. package/dist/mail-var/dto/update.dto.d.ts.map +0 -1
  52. package/dist/mail-var/dto/update.dto.js +0 -9
  53. package/dist/mail-var/dto/update.dto.js.map +0 -1
  54. package/dist/mail-var/mail-var.controller.d.ts +0 -42
  55. package/dist/mail-var/mail-var.controller.d.ts.map +0 -1
  56. package/dist/mail-var/mail-var.controller.js +0 -88
  57. package/dist/mail-var/mail-var.controller.js.map +0 -1
  58. package/dist/mail-var/mail-var.module.d.ts +0 -3
  59. package/dist/mail-var/mail-var.module.d.ts.map +0 -1
  60. package/dist/mail-var/mail-var.module.js +0 -26
  61. package/dist/mail-var/mail-var.module.js.map +0 -1
  62. package/dist/mail-var/mail-var.service.d.ts +0 -47
  63. package/dist/mail-var/mail-var.service.d.ts.map +0 -1
  64. package/dist/mail-var/mail-var.service.js +0 -73
  65. package/dist/mail-var/mail-var.service.js.map +0 -1
  66. package/src/mail-var/dto/create.dto.ts +0 -10
  67. package/src/mail-var/dto/update.dto.ts +0 -4
  68. package/src/mail-var/mail-var.controller.ts +0 -55
  69. package/src/mail-var/mail-var.module.ts +0 -13
  70. package/src/mail-var/mail-var.service.ts +0 -78
@@ -7,7 +7,8 @@ import {
7
7
  forwardRef,
8
8
  Inject,
9
9
  Injectable,
10
- Logger
10
+ Logger,
11
+ NotFoundException
11
12
  } from '@nestjs/common';
12
13
  import * as pako from 'pako';
13
14
  import { CreateDTO } from './dto/create.dto';
@@ -395,12 +396,18 @@ export class SettingService {
395
396
  }
396
397
 
397
398
  async get(settingId: number) {
398
- return this.prismaService.setting.findUnique({
399
+ const setting = await this.prismaService.setting.findUnique({
399
400
  where: { id: settingId },
400
401
  });
402
+
403
+ if (!setting) {
404
+ throw new NotFoundException(`Setting with ID ${settingId} not found.`);
405
+ }
406
+
407
+ return setting;
401
408
  }
402
409
 
403
- async create(data: CreateDTO) {
410
+ async create(data: CreateDTO, _locale: string) {
404
411
  this.clearCache();
405
412
  return this.prismaService.setting.create({
406
413
  data: {
@@ -427,22 +434,43 @@ export class SettingService {
427
434
  });
428
435
 
429
436
  if (!type) {
430
- throw new BadRequestException(`Setting not found.`);
437
+ throw new NotFoundException(`Setting not found.`);
438
+ }
439
+
440
+ // Build update data object with only provided fields
441
+ const updateData: any = {};
442
+
443
+ if (data.slug !== undefined) {
444
+ updateData.slug = data.slug;
445
+ }
446
+
447
+ if (data.type !== undefined) {
448
+ updateData.type = data.type as any;
449
+ }
450
+
451
+ if (data.value !== undefined) {
452
+ updateData.value = this.setValueFormattedByType(data.type || type, data.value);
453
+ }
454
+
455
+ if (data.user_override !== undefined) {
456
+ updateData.user_override = data.user_override;
457
+ }
458
+
459
+ if (data.component !== undefined) {
460
+ updateData.component = data.component as any;
461
+ }
462
+
463
+ if (data.group_id !== undefined) {
464
+ updateData.setting_group = {
465
+ connect: {
466
+ id: data.group_id,
467
+ },
468
+ };
431
469
  }
432
470
 
433
471
  const updatedSetting = await this.prismaService.setting.update({
434
472
  where: { id },
435
- data: {
436
- slug: data.slug,
437
- type: data.type as any,
438
- value: this.setValueFormattedByType(data.type, data.value),
439
- user_override: data.user_override,
440
- setting_group: {
441
- connect: {
442
- id: data.group_id,
443
- },
444
- },
445
- },
473
+ data: updateData,
446
474
  });
447
475
 
448
476
  // Garantir que o value sobrescreve o valor original
@@ -460,7 +488,7 @@ export class SettingService {
460
488
  });
461
489
 
462
490
  if (!id) {
463
- throw new BadRequestException(`Setting with slug ${slug} not found.`);
491
+ throw new NotFoundException(`Setting with slug ${slug} not found.`);
464
492
  }
465
493
 
466
494
  const updatedSetting = await this.prismaService.setting.update({
@@ -503,7 +531,7 @@ export class SettingService {
503
531
  }
504
532
  }
505
533
 
506
- async delete({ ids }: DeleteDTO) {
534
+ async delete(locale:string,{ ids }: DeleteDTO) {
507
535
  this.clearCache();
508
536
  if (ids == undefined || ids == null) {
509
537
  throw new BadRequestException(
@@ -511,6 +539,23 @@ export class SettingService {
511
539
  );
512
540
  }
513
541
 
542
+ const existingSettings = await this.prismaService.setting.findMany({
543
+ where: {
544
+ id: {
545
+ in: ids,
546
+ },
547
+ },
548
+ select: {
549
+ id: true,
550
+ },
551
+ });
552
+
553
+ if (existingSettings.length !== ids.length) {
554
+ throw new BadRequestException(
555
+ getLocaleText('someSettingsNotFound', locale, `Some settings were not found.`),
556
+ );
557
+ }
558
+
514
559
  return this.prismaService.setting.deleteMany({
515
560
  where: {
516
561
  id: {
@@ -532,7 +577,7 @@ export class SettingService {
532
577
  });
533
578
 
534
579
  if (!user) {
535
- throw new BadRequestException(getLocaleText('userNotFound', locale, `User not found.`));
580
+ throw new NotFoundException(getLocaleText('userNotFound', locale, `User not found.`));
536
581
  }
537
582
 
538
583
  const setting = await this.prismaService.setting.findFirst({
@@ -543,7 +588,7 @@ export class SettingService {
543
588
  });
544
589
 
545
590
  if (!setting) {
546
- throw new BadRequestException(
591
+ throw new NotFoundException(
547
592
  getLocaleText('settingNotFound', locale, `Setting not found or user can not override.`),
548
593
  );
549
594
  }
@@ -679,6 +724,20 @@ export class SettingService {
679
724
  }
680
725
 
681
726
  async getUserSettings(user_id: number) {
727
+
728
+ const user = await this.prismaService.user.findUnique({
729
+ where: {
730
+ id: user_id,
731
+ },
732
+ select: {
733
+ id: true,
734
+ },
735
+ });
736
+
737
+ if (!user) {
738
+ throw new NotFoundException(`User not found.`);
739
+ }
740
+
682
741
  return this.prismaService.setting_user.findMany({
683
742
  where: {
684
743
  user_id,
@@ -695,6 +754,17 @@ export class SettingService {
695
754
 
696
755
  async setValue(slug: string, value: string) {
697
756
  this.clearCache();
757
+
758
+ const { id } = await this.prismaService.setting.findFirst({
759
+ where: {
760
+ slug,
761
+ },
762
+ });
763
+
764
+ if (!id) {
765
+ throw new NotFoundException(`Setting with slug ${slug} not found.`);
766
+ }
767
+
698
768
  return this.prismaService.setting.updateMany({
699
769
  where: {
700
770
  slug,
@@ -1,5 +0,0 @@
1
- export declare class CreateDTO {
2
- mail_id: number;
3
- name: string;
4
- }
5
- //# sourceMappingURL=create.dto.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create.dto.d.ts","sourceRoot":"","sources":["../../../src/mail-var/dto/create.dto.ts"],"names":[],"mappings":"AAGA,qBAAa,SAAS;IAEpB,OAAO,EAAE,MAAM,CAAC;IAGhB,IAAI,EAAE,MAAM,CAAC;CACd"}
@@ -1,26 +0,0 @@
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
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.CreateDTO = void 0;
13
- const api_locale_1 = require("@hed-hog/api-locale");
14
- const class_validator_1 = require("class-validator");
15
- class CreateDTO {
16
- }
17
- exports.CreateDTO = CreateDTO;
18
- __decorate([
19
- (0, class_validator_1.IsNumber)({}, { message: (args) => (0, api_locale_1.getLocaleText)('validation.numberRequired', args.value) }),
20
- __metadata("design:type", Number)
21
- ], CreateDTO.prototype, "mail_id", void 0);
22
- __decorate([
23
- (0, class_validator_1.IsString)({ message: (args) => (0, api_locale_1.getLocaleText)('validation.stringRequired', args.value) }),
24
- __metadata("design:type", String)
25
- ], CreateDTO.prototype, "name", void 0);
26
- //# sourceMappingURL=create.dto.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create.dto.js","sourceRoot":"","sources":["../../../src/mail-var/dto/create.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAoD;AACpD,qDAAqD;AAErD,MAAa,SAAS;CAMrB;AAND,8BAMC;AAJC;IADC,IAAA,0BAAQ,EAAC,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,0BAAa,EAAC,2BAA2B,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;;0CAC5E;AAGhB;IADC,IAAA,0BAAQ,EAAC,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,0BAAa,EAAC,2BAA2B,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;;uCAC3E"}
@@ -1,6 +0,0 @@
1
- import { CreateDTO } from './create.dto';
2
- declare const UpdateDTO_base: import("@nestjs/mapped-types").MappedType<Partial<CreateDTO>>;
3
- export declare class UpdateDTO extends UpdateDTO_base {
4
- }
5
- export {};
6
- //# sourceMappingURL=update.dto.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"update.dto.d.ts","sourceRoot":"","sources":["../../../src/mail-var/dto/update.dto.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;;AAEzC,qBAAa,SAAU,SAAQ,cAAsB;CAAG"}
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UpdateDTO = void 0;
4
- const mapped_types_1 = require("@nestjs/mapped-types");
5
- const create_dto_1 = require("./create.dto");
6
- class UpdateDTO extends (0, mapped_types_1.PartialType)(create_dto_1.CreateDTO) {
7
- }
8
- exports.UpdateDTO = UpdateDTO;
9
- //# sourceMappingURL=update.dto.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"update.dto.js","sourceRoot":"","sources":["../../../src/mail-var/dto/update.dto.ts"],"names":[],"mappings":";;;AAAA,uDAAmD;AACnD,6CAAyC;AAEzC,MAAa,SAAU,SAAQ,IAAA,0BAAW,EAAC,sBAAS,CAAC;CAAG;AAAxD,8BAAwD"}
@@ -1,42 +0,0 @@
1
- import { CreateDTO } from './dto/create.dto';
2
- import { UpdateDTO } from './dto/update.dto';
3
- import { MailVarService } from './mail-var.service';
4
- import { DeleteDTO } from '@hed-hog/api';
5
- export declare class MailVarController {
6
- private readonly mailVarService;
7
- constructor(mailVarService: MailVarService);
8
- list(paginationParams: any): Promise<{
9
- total: any;
10
- lastPage: number;
11
- page: number;
12
- pageSize: number;
13
- prev: number;
14
- next: number;
15
- data: any;
16
- }>;
17
- get(id: number): Promise<{
18
- name: string;
19
- id: number;
20
- created_at: Date;
21
- updated_at: Date;
22
- mail_id: number;
23
- }>;
24
- create(data: CreateDTO): Promise<{
25
- name: string;
26
- id: number;
27
- created_at: Date;
28
- updated_at: Date;
29
- mail_id: number;
30
- }>;
31
- update(id: number, data: UpdateDTO): Promise<{
32
- name: string;
33
- id: number;
34
- created_at: Date;
35
- updated_at: Date;
36
- mail_id: number;
37
- }>;
38
- delete(data: DeleteDTO): Promise<{
39
- count: number;
40
- }>;
41
- }
42
- //# sourceMappingURL=mail-var.controller.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mail-var.controller.d.ts","sourceRoot":"","sources":["../../src/mail-var/mail-var.controller.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAQ,SAAS,EAAE,MAAM,cAAc,CAAC;AAE/C,qBAEa,iBAAiB;IAG1B,OAAO,CAAC,QAAQ,CAAC,cAAc;gBAAd,cAAc,EAAE,cAAc;IAI3C,IAAI,CAAe,gBAAgB,KAAA;;;;;;;;;IAKnC,GAAG,CAA4B,EAAE,EAAE,MAAM;;;;;;;IAKzC,MAAM,CAAS,IAAI,EAAE,SAAS;;;;;;;IAK9B,MAAM,CAA4B,EAAE,EAAE,MAAM,EAAU,IAAI,EAAE,SAAS;;;;;;;IAQrE,MAAM,CAAS,IAAI,EAAE,SAAS;;;CAGrC"}
@@ -1,88 +0,0 @@
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.MailVarController = void 0;
16
- const api_pagination_1 = require("@hed-hog/api-pagination");
17
- const common_1 = require("@nestjs/common");
18
- const create_dto_1 = require("./dto/create.dto");
19
- const update_dto_1 = require("./dto/update.dto");
20
- const mail_var_service_1 = require("./mail-var.service");
21
- const api_1 = require("@hed-hog/api");
22
- let MailVarController = class MailVarController {
23
- constructor(mailVarService) {
24
- this.mailVarService = mailVarService;
25
- }
26
- async list(paginationParams) {
27
- return this.mailVarService.list(paginationParams);
28
- }
29
- async get(id) {
30
- return this.mailVarService.get(id);
31
- }
32
- async create(data) {
33
- return this.mailVarService.create(data);
34
- }
35
- async update(id, data) {
36
- return this.mailVarService.update({
37
- id,
38
- data,
39
- });
40
- }
41
- async delete(data) {
42
- return this.mailVarService.delete(data);
43
- }
44
- };
45
- exports.MailVarController = MailVarController;
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
- ], MailVarController.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
- ], MailVarController.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
- ], MailVarController.prototype, "create", null);
67
- __decorate([
68
- (0, common_1.Patch)(':id'),
69
- __param(0, (0, common_1.Param)('id', common_1.ParseIntPipe)),
70
- __param(1, (0, common_1.Body)()),
71
- __metadata("design:type", Function),
72
- __metadata("design:paramtypes", [Number, update_dto_1.UpdateDTO]),
73
- __metadata("design:returntype", Promise)
74
- ], MailVarController.prototype, "update", null);
75
- __decorate([
76
- (0, common_1.Delete)(),
77
- __param(0, (0, common_1.Body)()),
78
- __metadata("design:type", Function),
79
- __metadata("design:paramtypes", [api_1.DeleteDTO]),
80
- __metadata("design:returntype", Promise)
81
- ], MailVarController.prototype, "delete", null);
82
- exports.MailVarController = MailVarController = __decorate([
83
- (0, api_1.Role)(),
84
- (0, common_1.Controller)('mail-var'),
85
- __param(0, (0, common_1.Inject)((0, common_1.forwardRef)(() => mail_var_service_1.MailVarService))),
86
- __metadata("design:paramtypes", [mail_var_service_1.MailVarService])
87
- ], MailVarController);
88
- //# sourceMappingURL=mail-var.controller.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mail-var.controller.js","sourceRoot":"","sources":["../../src/mail-var/mail-var.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4DAAqD;AAErD,2CAWwB;AACxB,iDAA6C;AAC7C,iDAA6C;AAC7C,yDAAoD;AACpD,sCAA+C;AAIxC,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAC5B,YAEmB,cAA8B;QAA9B,mBAAc,GAAd,cAAc,CAAgB;IAC9C,CAAC;IAGE,AAAN,KAAK,CAAC,IAAI,CAAe,gBAAgB;QACvC,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IACpD,CAAC;IAGK,AAAN,KAAK,CAAC,GAAG,CAA4B,EAAU;QAC7C,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACrC,CAAC;IAGK,AAAN,KAAK,CAAC,MAAM,CAAS,IAAe;QAClC,OAAO,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;IAGK,AAAN,KAAK,CAAC,MAAM,CAA4B,EAAU,EAAU,IAAe;QACzE,OAAO,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC;YAChC,EAAE;YACF,IAAI;SACL,CAAC,CAAC;IACL,CAAC;IAGK,AAAN,KAAK,CAAC,MAAM,CAAS,IAAe;QAClC,OAAO,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;CACF,CAAA;AAjCY,8CAAiB;AAOtB;IADL,IAAA,YAAG,GAAE;IACM,WAAA,IAAA,2BAAU,GAAE,CAAA;;;;6CAEvB;AAGK;IADL,IAAA,YAAG,EAAC,KAAK,CAAC;IACA,WAAA,IAAA,cAAK,EAAC,IAAI,EAAE,qBAAY,CAAC,CAAA;;;;4CAEnC;AAGK;IADL,IAAA,aAAI,GAAE;IACO,WAAA,IAAA,aAAI,GAAE,CAAA;;qCAAO,sBAAS;;+CAEnC;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;;+CAK1E;AAGK;IADL,IAAA,eAAM,GAAE;IACK,WAAA,IAAA,aAAI,GAAE,CAAA;;qCAAO,eAAS;;+CAEnC;4BAhCU,iBAAiB;IAF7B,IAAA,UAAI,GAAE;IACN,IAAA,mBAAU,EAAC,UAAU,CAAC;IAGlB,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,iCAAc,CAAC,CAAC,CAAA;qCACR,iCAAc;GAHtC,iBAAiB,CAiC7B"}
@@ -1,3 +0,0 @@
1
- export declare class MailVarModule {
2
- }
3
- //# sourceMappingURL=mail-var.module.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mail-var.module.d.ts","sourceRoot":"","sources":["../../src/mail-var/mail-var.module.ts"],"names":[],"mappings":"AAMA,qBAMa,aAAa;CAAG"}
@@ -1,26 +0,0 @@
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.MailVarModule = 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_var_service_1 = require("./mail-var.service");
14
- const mail_var_controller_1 = require("./mail-var.controller");
15
- let MailVarModule = class MailVarModule {
16
- };
17
- exports.MailVarModule = MailVarModule;
18
- exports.MailVarModule = MailVarModule = __decorate([
19
- (0, common_1.Module)({
20
- imports: [(0, common_1.forwardRef)(() => api_prisma_1.PrismaModule), (0, common_1.forwardRef)(() => api_pagination_1.PaginationModule)],
21
- controllers: [mail_var_controller_1.MailVarController],
22
- providers: [mail_var_service_1.MailVarService],
23
- exports: [mail_var_service_1.MailVarService],
24
- })
25
- ], MailVarModule);
26
- //# sourceMappingURL=mail-var.module.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mail-var.module.js","sourceRoot":"","sources":["../../src/mail-var/mail-var.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,4DAA2D;AAC3D,oDAAmD;AACnD,2CAAoD;AACpD,yDAAoD;AACpD,+DAA0D;AAQnD,IAAM,aAAa,GAAnB,MAAM,aAAa;CAAG,CAAA;AAAhB,sCAAa;wBAAb,aAAa;IANzB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,yBAAY,CAAC,EAAE,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,iCAAgB,CAAC,CAAC;QAC7E,WAAW,EAAE,CAAC,uCAAiB,CAAC;QAChC,SAAS,EAAE,CAAC,iCAAc,CAAC;QAC3B,OAAO,EAAE,CAAC,iCAAc,CAAC;KAC1B,CAAC;GACW,aAAa,CAAG"}
@@ -1,47 +0,0 @@
1
- import { PaginationDTO, PaginationService } from '@hed-hog/api-pagination';
2
- import { PrismaService } from '@hed-hog/api-prisma';
3
- import { CreateDTO } from './dto/create.dto';
4
- import { DeleteDTO } from '@hed-hog/api';
5
- import { UpdateDTO } from './dto/update.dto';
6
- export declare class MailVarService {
7
- private readonly prismaService;
8
- private readonly paginationService;
9
- constructor(prismaService: PrismaService, paginationService: PaginationService);
10
- list(paginationParams: PaginationDTO): Promise<{
11
- total: any;
12
- lastPage: number;
13
- page: number;
14
- pageSize: number;
15
- prev: number;
16
- next: number;
17
- data: any;
18
- }>;
19
- get(id: number): Promise<{
20
- name: string;
21
- id: number;
22
- created_at: Date;
23
- updated_at: Date;
24
- mail_id: number;
25
- }>;
26
- create(data: CreateDTO): Promise<{
27
- name: string;
28
- id: number;
29
- created_at: Date;
30
- updated_at: Date;
31
- mail_id: number;
32
- }>;
33
- update({ id, data }: {
34
- id: number;
35
- data: UpdateDTO;
36
- }): Promise<{
37
- name: string;
38
- id: number;
39
- created_at: Date;
40
- updated_at: Date;
41
- mail_id: number;
42
- }>;
43
- delete({ ids }: DeleteDTO): Promise<{
44
- count: number;
45
- }>;
46
- }
47
- //# sourceMappingURL=mail-var.service.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mail-var.service.d.ts","sourceRoot":"","sources":["../../src/mail-var/mail-var.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAOpD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,qBACa,cAAc;IAGvB,OAAO,CAAC,QAAQ,CAAC,aAAa;IAE9B,OAAO,CAAC,QAAQ,CAAC,iBAAiB;gBAFjB,aAAa,EAAE,aAAa,EAE5B,iBAAiB,EAAE,iBAAiB;IAGjD,IAAI,CAAC,gBAAgB,EAAE,aAAa;;;;;;;;;IAsBpC,GAAG,CAAC,EAAE,EAAE,MAAM;;;;;;;IAMd,MAAM,CAAC,IAAI,EAAE,SAAS;;;;;;;IAMtB,MAAM,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,SAAS,CAAA;KAAE;;;;;;;IAOpD,MAAM,CAAC,EAAE,GAAG,EAAE,EAAE,SAAS,GAAG,OAAO,CAAC;QAAC,KAAK,EAAC,MAAM,CAAA;KAAC,CAAC;CAe1D"}
@@ -1,73 +0,0 @@
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.MailVarService = void 0;
16
- const api_pagination_1 = require("@hed-hog/api-pagination");
17
- const api_prisma_1 = require("@hed-hog/api-prisma");
18
- const common_1 = require("@nestjs/common");
19
- let MailVarService = class MailVarService {
20
- constructor(prismaService, paginationService) {
21
- this.prismaService = prismaService;
22
- this.paginationService = paginationService;
23
- }
24
- async list(paginationParams) {
25
- const fields = ['name'];
26
- const OR = this.prismaService.createInsensitiveSearch(fields, paginationParams);
27
- if (paginationParams.search && !isNaN(+paginationParams.search)) {
28
- OR.push({ id: { equals: +paginationParams.search } });
29
- }
30
- return this.paginationService.paginate(this.prismaService.mail_var, paginationParams, {
31
- where: {
32
- OR,
33
- },
34
- });
35
- }
36
- async get(id) {
37
- return this.prismaService.mail_var.findUnique({
38
- where: { id: id },
39
- });
40
- }
41
- async create(data) {
42
- return this.prismaService.mail_var.create({
43
- data,
44
- });
45
- }
46
- async update({ id, data }) {
47
- return this.prismaService.mail_var.update({
48
- where: { id: id },
49
- data,
50
- });
51
- }
52
- async delete({ ids }) {
53
- if (ids == undefined || ids == null) {
54
- throw new common_1.BadRequestException('You must select at least one item to delete.');
55
- }
56
- return this.prismaService.mail_var.deleteMany({
57
- where: {
58
- id: {
59
- in: ids,
60
- },
61
- },
62
- });
63
- }
64
- };
65
- exports.MailVarService = MailVarService;
66
- exports.MailVarService = MailVarService = __decorate([
67
- (0, common_1.Injectable)(),
68
- __param(0, (0, common_1.Inject)((0, common_1.forwardRef)(() => api_prisma_1.PrismaService))),
69
- __param(1, (0, common_1.Inject)((0, common_1.forwardRef)(() => api_pagination_1.PaginationService))),
70
- __metadata("design:paramtypes", [api_prisma_1.PrismaService,
71
- api_pagination_1.PaginationService])
72
- ], MailVarService);
73
- //# sourceMappingURL=mail-var.service.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mail-var.service.js","sourceRoot":"","sources":["../../src/mail-var/mail-var.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4DAA2E;AAC3E,oDAAoD;AACpD,2CAKwB;AAMjB,IAAM,cAAc,GAApB,MAAM,cAAc;IACzB,YAEmB,aAA4B,EAE5B,iBAAoC;QAFpC,kBAAa,GAAb,aAAa,CAAe;QAE5B,sBAAiB,GAAjB,iBAAiB,CAAmB;IACpD,CAAC;IAEJ,KAAK,CAAC,IAAI,CAAC,gBAA+B;QACxC,MAAM,MAAM,GAAG,CAAC,MAAM,CAAC,CAAC;QACxB,MAAM,EAAE,GAAU,IAAI,CAAC,aAAa,CAAC,uBAAuB,CAC1D,MAAM,EACN,gBAAgB,CACjB,CAAC;QAEF,IAAI,gBAAgB,CAAC,MAAM,IAAI,CAAC,KAAK,CAAC,CAAC,gBAAgB,CAAC,MAAM,CAAC,EAAE,CAAC;YAChE,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,gBAAgB,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QACxD,CAAC;QAED,OAAO,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CACpC,IAAI,CAAC,aAAa,CAAC,QAAQ,EAC3B,gBAAgB,EAChB;YACE,KAAK,EAAE;gBACL,EAAE;aACH;SACF,CACF,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,EAAU;QAClB,OAAO,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,UAAU,CAAC;YAC5C,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE;SAClB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,IAAe;QAC1B,OAAO,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,MAAM,CAAC;YACxC,IAAI;SACL,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,IAAI,EAAmC;QACxD,OAAO,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,MAAM,CAAC;YACxC,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE;YACjB,IAAI;SACL,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,EAAE,GAAG,EAAa;QAC7B,IAAI,GAAG,IAAI,SAAS,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;YACpC,MAAM,IAAI,4BAAmB,CAC3B,8CAA8C,CAC/C,CAAC;QACJ,CAAC;QAED,OAAO,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,UAAU,CAAC;YAC5C,KAAK,EAAE;gBACL,EAAE,EAAE;oBACF,EAAE,EAAE,GAAG;iBACR;aACF;SACF,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AAhEY,wCAAc;yBAAd,cAAc;IAD1B,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;qCADZ,0BAAa;QAET,kCAAiB;GAL5C,cAAc,CAgE1B"}
@@ -1,10 +0,0 @@
1
- import { getLocaleText } from '@hed-hog/api-locale';
2
- import { IsNumber, IsString } from 'class-validator';
3
-
4
- export class CreateDTO {
5
- @IsNumber({}, { message: (args) => getLocaleText('validation.numberRequired', args.value) })
6
- mail_id: number;
7
-
8
- @IsString({ message: (args) => getLocaleText('validation.stringRequired', args.value) })
9
- name: string;
10
- }
@@ -1,4 +0,0 @@
1
- import { PartialType } from '@nestjs/mapped-types';
2
- import { CreateDTO } from './create.dto';
3
-
4
- export class UpdateDTO extends PartialType(CreateDTO) {}
@@ -1,55 +0,0 @@
1
- import { Pagination } from '@hed-hog/api-pagination';
2
- import { Locale } from '@hed-hog/api-locale';
3
- import {
4
- Body,
5
- Controller,
6
- Delete,
7
- Get,
8
- Inject,
9
- Param,
10
- ParseIntPipe,
11
- Patch,
12
- Post,
13
- forwardRef,
14
- } from '@nestjs/common';
15
- import { CreateDTO } from './dto/create.dto';
16
- import { UpdateDTO } from './dto/update.dto';
17
- import { MailVarService } from './mail-var.service';
18
- import { Role, DeleteDTO } from '@hed-hog/api';
19
-
20
- @Role()
21
- @Controller('mail-var')
22
- export class MailVarController {
23
- constructor(
24
- @Inject(forwardRef(() => MailVarService))
25
- private readonly mailVarService: MailVarService,
26
- ) {}
27
-
28
- @Get()
29
- async list(@Pagination() paginationParams) {
30
- return this.mailVarService.list(paginationParams);
31
- }
32
-
33
- @Get(':id')
34
- async get(@Param('id', ParseIntPipe) id: number) {
35
- return this.mailVarService.get(id);
36
- }
37
-
38
- @Post()
39
- async create(@Body() data: CreateDTO) {
40
- return this.mailVarService.create(data);
41
- }
42
-
43
- @Patch(':id')
44
- async update(@Param('id', ParseIntPipe) id: number, @Body() data: UpdateDTO) {
45
- return this.mailVarService.update({
46
- id,
47
- data,
48
- });
49
- }
50
-
51
- @Delete()
52
- async delete(@Body() data: DeleteDTO) {
53
- return this.mailVarService.delete(data);
54
- }
55
- }
@@ -1,13 +0,0 @@
1
- import { PaginationModule } from '@hed-hog/api-pagination';
2
- import { PrismaModule } from '@hed-hog/api-prisma';
3
- import { forwardRef, Module } from '@nestjs/common';
4
- import { MailVarService } from './mail-var.service';
5
- import { MailVarController } from './mail-var.controller';
6
-
7
- @Module({
8
- imports: [forwardRef(() => PrismaModule), forwardRef(() => PaginationModule)],
9
- controllers: [MailVarController],
10
- providers: [MailVarService],
11
- exports: [MailVarService],
12
- })
13
- export class MailVarModule {}