@hedhog/admin 0.0.108 → 0.0.109

Sign up to get free protection for your applications and to get access to all the features.
Files changed (124) hide show
  1. package/dist/admin.module.d.ts.map +1 -1
  2. package/dist/admin.module.js +1 -3
  3. package/dist/admin.module.js.map +1 -1
  4. package/dist/auth/auth.controller.d.ts.map +1 -1
  5. package/dist/auth/auth.controller.js +5 -6
  6. package/dist/auth/auth.controller.js.map +1 -1
  7. package/dist/auth/guards/auth.guard.js +2 -2
  8. package/dist/auth/guards/auth.guard.js.map +1 -1
  9. package/dist/index.d.ts +0 -7
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +0 -8
  12. package/dist/index.js.map +1 -1
  13. package/dist/menu/menu.controller.js +3 -3
  14. package/dist/menu/menu.controller.js.map +1 -1
  15. package/dist/role/guards/role.guard.d.ts.map +1 -1
  16. package/dist/role/guards/role.guard.js +3 -4
  17. package/dist/role/guards/role.guard.js.map +1 -1
  18. package/dist/role/role.controller.js +3 -3
  19. package/dist/role/role.controller.js.map +1 -1
  20. package/dist/role/role.module.js +1 -1
  21. package/dist/role/role.module.js.map +1 -1
  22. package/dist/role/role.service.d.ts +1 -1
  23. package/dist/role/role.service.d.ts.map +1 -1
  24. package/dist/role/role.service.js +1 -1
  25. package/dist/role/role.service.js.map +1 -1
  26. package/dist/route/route.controller.js +3 -3
  27. package/dist/route/route.controller.js.map +1 -1
  28. package/dist/screen/screen.controller.js +3 -3
  29. package/dist/screen/screen.controller.js.map +1 -1
  30. package/dist/setting/setting.controller.d.ts +1 -0
  31. package/dist/setting/setting.controller.d.ts.map +1 -1
  32. package/dist/setting/setting.controller.js +14 -3
  33. package/dist/setting/setting.controller.js.map +1 -1
  34. package/dist/setting/setting.module.d.ts.map +1 -1
  35. package/dist/setting/setting.module.js +2 -0
  36. package/dist/setting/setting.module.js.map +1 -1
  37. package/dist/setting/setting.service.d.ts +2 -0
  38. package/dist/setting/setting.service.d.ts.map +1 -1
  39. package/dist/setting/setting.service.js +63 -0
  40. package/dist/setting/setting.service.js.map +1 -1
  41. package/dist/user/user.controller.js +2 -2
  42. package/dist/user/user.controller.js.map +1 -1
  43. package/hedhog.yaml +1 -21
  44. package/package.json +8 -6
  45. package/src/admin.module.ts +1 -3
  46. package/src/auth/auth.controller.ts +1 -2
  47. package/src/auth/guards/auth.guard.ts +1 -1
  48. package/src/index.ts +0 -10
  49. package/src/menu/menu.controller.ts +2 -2
  50. package/src/role/guards/role.guard.ts +1 -2
  51. package/src/role/role.controller.ts +2 -2
  52. package/src/role/role.module.ts +1 -1
  53. package/src/role/role.service.ts +1 -1
  54. package/src/route/route.controller.ts +2 -2
  55. package/src/screen/screen.controller.ts +2 -2
  56. package/src/setting/setting.controller.ts +10 -3
  57. package/src/setting/setting.module.ts +2 -0
  58. package/src/setting/setting.service.ts +73 -0
  59. package/src/user/user.controller.ts +1 -1
  60. package/dist/auth/decorators/public.decorator.d.ts +0 -3
  61. package/dist/auth/decorators/public.decorator.d.ts.map +0 -1
  62. package/dist/auth/decorators/public.decorator.js +0 -8
  63. package/dist/auth/decorators/public.decorator.js.map +0 -1
  64. package/dist/locale/dto/create.dto.d.ts +0 -6
  65. package/dist/locale/dto/create.dto.d.ts.map +0 -1
  66. package/dist/locale/dto/create.dto.js +0 -29
  67. package/dist/locale/dto/create.dto.js.map +0 -1
  68. package/dist/locale/dto/delete.dto.d.ts +0 -4
  69. package/dist/locale/dto/delete.dto.d.ts.map +0 -1
  70. package/dist/locale/dto/delete.dto.js +0 -23
  71. package/dist/locale/dto/delete.dto.js.map +0 -1
  72. package/dist/locale/dto/set-enabled.dto.d.ts +0 -4
  73. package/dist/locale/dto/set-enabled.dto.d.ts.map +0 -1
  74. package/dist/locale/dto/set-enabled.dto.js +0 -24
  75. package/dist/locale/dto/set-enabled.dto.js.map +0 -1
  76. package/dist/locale/dto/update.dto.d.ts +0 -6
  77. package/dist/locale/dto/update.dto.d.ts.map +0 -1
  78. package/dist/locale/dto/update.dto.js +0 -32
  79. package/dist/locale/dto/update.dto.js.map +0 -1
  80. package/dist/locale/index.d.ts +0 -5
  81. package/dist/locale/index.d.ts.map +0 -1
  82. package/dist/locale/index.js +0 -21
  83. package/dist/locale/index.js.map +0 -1
  84. package/dist/locale/locale.controller.d.ts +0 -18
  85. package/dist/locale/locale.controller.d.ts.map +0 -1
  86. package/dist/locale/locale.controller.js +0 -127
  87. package/dist/locale/locale.controller.js.map +0 -1
  88. package/dist/locale/locale.decorator.d.ts +0 -2
  89. package/dist/locale/locale.decorator.d.ts.map +0 -1
  90. package/dist/locale/locale.decorator.js +0 -9
  91. package/dist/locale/locale.decorator.js.map +0 -1
  92. package/dist/locale/locale.middleware.d.ts +0 -10
  93. package/dist/locale/locale.middleware.d.ts.map +0 -1
  94. package/dist/locale/locale.middleware.js +0 -45
  95. package/dist/locale/locale.middleware.js.map +0 -1
  96. package/dist/locale/locale.module.d.ts +0 -5
  97. package/dist/locale/locale.module.d.ts.map +0 -1
  98. package/dist/locale/locale.module.js +0 -35
  99. package/dist/locale/locale.module.js.map +0 -1
  100. package/dist/locale/locale.service.d.ts +0 -32
  101. package/dist/locale/locale.service.d.ts.map +0 -1
  102. package/dist/locale/locale.service.js +0 -290
  103. package/dist/locale/locale.service.js.map +0 -1
  104. package/dist/locale/locale.service.spec.d.ts +0 -2
  105. package/dist/locale/locale.service.spec.d.ts.map +0 -1
  106. package/dist/locale/locale.service.spec.js +0 -174
  107. package/dist/locale/locale.service.spec.js.map +0 -1
  108. package/dist/role/decorators/role.decorator.d.ts +0 -3
  109. package/dist/role/decorators/role.decorator.d.ts.map +0 -1
  110. package/dist/role/decorators/role.decorator.js +0 -10
  111. package/dist/role/decorators/role.decorator.js.map +0 -1
  112. package/src/auth/decorators/public.decorator.ts +0 -4
  113. package/src/locale/dto/create.dto.ts +0 -12
  114. package/src/locale/dto/delete.dto.ts +0 -8
  115. package/src/locale/dto/set-enabled.dto.ts +0 -9
  116. package/src/locale/dto/update.dto.ts +0 -15
  117. package/src/locale/index.ts +0 -4
  118. package/src/locale/locale.controller.ts +0 -79
  119. package/src/locale/locale.decorator.ts +0 -8
  120. package/src/locale/locale.middleware.ts +0 -34
  121. package/src/locale/locale.module.ts +0 -23
  122. package/src/locale/locale.service.spec.ts +0 -193
  123. package/src/locale/locale.service.ts +0 -364
  124. package/src/role/decorators/role.decorator.ts +0 -7
@@ -1 +0,0 @@
1
- {"version":3,"file":"set-enabled.dto.d.ts","sourceRoot":"","sources":["../../../src/locale/dto/set-enabled.dto.ts"],"names":[],"mappings":"AAEA,qBAAa,aAAa;IAKxB,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB"}
@@ -1,24 +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.SetEnabledDTO = void 0;
13
- const class_validator_1 = require("class-validator");
14
- class SetEnabledDTO {
15
- }
16
- exports.SetEnabledDTO = SetEnabledDTO;
17
- __decorate([
18
- (0, class_validator_1.IsArray)(),
19
- (0, class_validator_1.IsString)({
20
- each: true,
21
- }),
22
- __metadata("design:type", Array)
23
- ], SetEnabledDTO.prototype, "codes", void 0);
24
- //# sourceMappingURL=set-enabled.dto.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"set-enabled.dto.js","sourceRoot":"","sources":["../../../src/locale/dto/set-enabled.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAoD;AAEpD,MAAa,aAAa;CAMzB;AAND,sCAMC;AADC;IAJC,IAAA,yBAAO,GAAE;IACT,IAAA,0BAAQ,EAAC;QACR,IAAI,EAAE,IAAI;KACX,CAAC;;4CACc"}
@@ -1,6 +0,0 @@
1
- export declare class UpdateDTO {
2
- name?: string;
3
- code?: string;
4
- region?: string;
5
- }
6
- //# sourceMappingURL=update.dto.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"update.dto.d.ts","sourceRoot":"","sources":["../../../src/locale/dto/update.dto.ts"],"names":[],"mappings":"AAEA,qBAAa,SAAS;IAGpB,IAAI,CAAC,EAAE,MAAM,CAAC;IAId,IAAI,CAAC,EAAE,MAAM,CAAC;IAId,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
@@ -1,32 +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.UpdateDTO = void 0;
13
- const class_validator_1 = require("class-validator");
14
- class UpdateDTO {
15
- }
16
- exports.UpdateDTO = UpdateDTO;
17
- __decorate([
18
- (0, class_validator_1.IsString)(),
19
- (0, class_validator_1.IsOptional)(),
20
- __metadata("design:type", String)
21
- ], UpdateDTO.prototype, "name", void 0);
22
- __decorate([
23
- (0, class_validator_1.IsString)(),
24
- (0, class_validator_1.IsOptional)(),
25
- __metadata("design:type", String)
26
- ], UpdateDTO.prototype, "code", void 0);
27
- __decorate([
28
- (0, class_validator_1.IsString)(),
29
- (0, class_validator_1.IsOptional)(),
30
- __metadata("design:type", String)
31
- ], UpdateDTO.prototype, "region", void 0);
32
- //# sourceMappingURL=update.dto.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"update.dto.js","sourceRoot":"","sources":["../../../src/locale/dto/update.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAuD;AAEvD,MAAa,SAAS;CAYrB;AAZD,8BAYC;AATC;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;uCACC;AAId;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;uCACC;AAId;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;yCACG"}
@@ -1,5 +0,0 @@
1
- export * from './locale.module';
2
- export * from './locale.service';
3
- export * from './locale.controller';
4
- export * from './locale.decorator';
5
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/locale/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC"}
@@ -1,21 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./locale.module"), exports);
18
- __exportStar(require("./locale.service"), exports);
19
- __exportStar(require("./locale.controller"), exports);
20
- __exportStar(require("./locale.decorator"), exports);
21
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/locale/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,mDAAiC;AACjC,sDAAoC;AACpC,qDAAmC"}
@@ -1,18 +0,0 @@
1
- import { CreateDTO } from './dto/create.dto';
2
- import { DeleteDTO } from './dto/delete.dto';
3
- import { SetEnabledDTO } from './dto/set-enabled.dto';
4
- import { UpdateDTO } from './dto/update.dto';
5
- import { LocaleService } from './locale.service';
6
- export declare class LocaleController {
7
- private readonly localeService;
8
- constructor(localeService: LocaleService);
9
- listEnabled(paginationParams: any, locale: string): Promise<import("@hedhog/pagination").PaginatedResult<unknown>>;
10
- getTranslations(localeCode: string, namespace: string): Promise<{}>;
11
- get(paginationParams: any, locale: string): Promise<import("@hedhog/pagination").PaginatedResult<unknown>>;
12
- getById(id: number): Promise<any>;
13
- create(data: CreateDTO): Promise<any>;
14
- setEnabled({ codes }: SetEnabledDTO): Promise<any>;
15
- update(id: number, data: UpdateDTO): Promise<any>;
16
- delete(data: DeleteDTO): Promise<any>;
17
- }
18
- //# sourceMappingURL=locale.controller.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"locale.controller.d.ts","sourceRoot":"","sources":["../../src/locale/locale.controller.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,qBAEa,gBAAgB;IAGzB,OAAO,CAAC,QAAQ,CAAC,aAAa;gBAAb,aAAa,EAAE,aAAa;IAKzC,WAAW,CAAe,gBAAgB,KAAA,EAAY,MAAM,EAAE,MAAM;IAMpE,eAAe,CACE,UAAU,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM;IAMjC,GAAG,CAAe,gBAAgB,KAAA,EAAY,MAAM,EAAE,MAAM;IAK5D,OAAO,CAA4B,EAAE,EAAE,MAAM;IAKnD,MAAM,CAAS,IAAI,EAAE,SAAS;IAKxB,UAAU,CAAS,EAAE,KAAK,EAAE,EAAE,aAAa;IAK3C,MAAM,CAA4B,EAAE,EAAE,MAAM,EAAU,IAAI,EAAE,SAAS;IAQrE,MAAM,CAAS,IAAI,EAAE,SAAS;CAGrC"}
@@ -1,127 +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.LocaleController = void 0;
16
- const pagination_1 = require("@hedhog/pagination");
17
- const common_1 = require("@nestjs/common");
18
- const public_decorator_1 = require("../auth/decorators/public.decorator");
19
- const role_decorator_1 = require("../role/decorators/role.decorator");
20
- const create_dto_1 = require("./dto/create.dto");
21
- const delete_dto_1 = require("./dto/delete.dto");
22
- const set_enabled_dto_1 = require("./dto/set-enabled.dto");
23
- const update_dto_1 = require("./dto/update.dto");
24
- const locale_decorator_1 = require("./locale.decorator");
25
- const locale_service_1 = require("./locale.service");
26
- let LocaleController = class LocaleController {
27
- constructor(localeService) {
28
- this.localeService = localeService;
29
- }
30
- async listEnabled(paginationParams, locale) {
31
- return this.localeService.getEnables(locale, paginationParams);
32
- }
33
- async getTranslations(localeCode, namespace) {
34
- return this.localeService.getTranslations(localeCode, namespace);
35
- }
36
- async get(paginationParams, locale) {
37
- return this.localeService.get(locale, paginationParams);
38
- }
39
- async getById(id) {
40
- return this.localeService.getById(id);
41
- }
42
- create(data) {
43
- return this.localeService.create(data);
44
- }
45
- async setEnabled({ codes }) {
46
- return this.localeService.setEnabled(codes);
47
- }
48
- async update(id, data) {
49
- return this.localeService.update({
50
- id,
51
- data,
52
- });
53
- }
54
- async delete(data) {
55
- return this.localeService.delete(data);
56
- }
57
- };
58
- exports.LocaleController = LocaleController;
59
- __decorate([
60
- (0, public_decorator_1.Public)(),
61
- (0, common_1.Get)('system/enabled'),
62
- __param(0, (0, pagination_1.Pagination)()),
63
- __param(1, (0, locale_decorator_1.Locale)()),
64
- __metadata("design:type", Function),
65
- __metadata("design:paramtypes", [Object, String]),
66
- __metadata("design:returntype", Promise)
67
- ], LocaleController.prototype, "listEnabled", null);
68
- __decorate([
69
- (0, public_decorator_1.Public)(),
70
- (0, common_1.Get)(':localeCode/:namespace'),
71
- __param(0, (0, common_1.Param)('localeCode')),
72
- __param(1, (0, common_1.Param)('namespace')),
73
- __metadata("design:type", Function),
74
- __metadata("design:paramtypes", [String, String]),
75
- __metadata("design:returntype", Promise)
76
- ], LocaleController.prototype, "getTranslations", null);
77
- __decorate([
78
- (0, common_1.Get)(),
79
- __param(0, (0, pagination_1.Pagination)()),
80
- __param(1, (0, locale_decorator_1.Locale)()),
81
- __metadata("design:type", Function),
82
- __metadata("design:paramtypes", [Object, String]),
83
- __metadata("design:returntype", Promise)
84
- ], LocaleController.prototype, "get", null);
85
- __decorate([
86
- (0, common_1.Get)(':id'),
87
- __param(0, (0, common_1.Param)('id', common_1.ParseIntPipe)),
88
- __metadata("design:type", Function),
89
- __metadata("design:paramtypes", [Number]),
90
- __metadata("design:returntype", Promise)
91
- ], LocaleController.prototype, "getById", null);
92
- __decorate([
93
- (0, common_1.Post)(),
94
- __param(0, (0, common_1.Body)()),
95
- __metadata("design:type", Function),
96
- __metadata("design:paramtypes", [create_dto_1.CreateDTO]),
97
- __metadata("design:returntype", void 0)
98
- ], LocaleController.prototype, "create", null);
99
- __decorate([
100
- (0, common_1.Put)(),
101
- __param(0, (0, common_1.Body)()),
102
- __metadata("design:type", Function),
103
- __metadata("design:paramtypes", [set_enabled_dto_1.SetEnabledDTO]),
104
- __metadata("design:returntype", Promise)
105
- ], LocaleController.prototype, "setEnabled", null);
106
- __decorate([
107
- (0, common_1.Patch)(':id'),
108
- __param(0, (0, common_1.Param)('id', common_1.ParseIntPipe)),
109
- __param(1, (0, common_1.Body)()),
110
- __metadata("design:type", Function),
111
- __metadata("design:paramtypes", [Number, update_dto_1.UpdateDTO]),
112
- __metadata("design:returntype", Promise)
113
- ], LocaleController.prototype, "update", null);
114
- __decorate([
115
- (0, common_1.Delete)(),
116
- __param(0, (0, common_1.Body)()),
117
- __metadata("design:type", Function),
118
- __metadata("design:paramtypes", [delete_dto_1.DeleteDTO]),
119
- __metadata("design:returntype", Promise)
120
- ], LocaleController.prototype, "delete", null);
121
- exports.LocaleController = LocaleController = __decorate([
122
- (0, role_decorator_1.Role)(),
123
- (0, common_1.Controller)('locale'),
124
- __param(0, (0, common_1.Inject)((0, common_1.forwardRef)(() => locale_service_1.LocaleService))),
125
- __metadata("design:paramtypes", [locale_service_1.LocaleService])
126
- ], LocaleController);
127
- //# sourceMappingURL=locale.controller.js.map
@@ -1 +0,0 @@
1
-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AF5B,IAAA,qBAAI,GAAE;IACN,IAAA,mBAAU,EAAC,QAAQ,CAAC;IAGhB,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,8BAAa,CAAC,CAAC,CAAA;qCACR,8BAAa;GAHpC,gBAAgB,CAqD5B"}
@@ -1,2 +0,0 @@
1
- export declare const Locale: (...dataOrPipes: unknown[]) => ParameterDecorator;
2
- //# sourceMappingURL=locale.decorator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"locale.decorator.d.ts","sourceRoot":"","sources":["../../src/locale/locale.decorator.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM,mDAKlB,CAAC"}
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Locale = void 0;
4
- const common_1 = require("@nestjs/common");
5
- exports.Locale = (0, common_1.createParamDecorator)((_data, ctx) => {
6
- const request = ctx.switchToHttp().getRequest();
7
- return request['locale'];
8
- });
9
- //# sourceMappingURL=locale.decorator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"locale.decorator.js","sourceRoot":"","sources":["../../src/locale/locale.decorator.ts"],"names":[],"mappings":";;;AAAA,2CAAwE;AAE3D,QAAA,MAAM,GAAG,IAAA,6BAAoB,EACxC,CAAC,KAAc,EAAE,GAAqB,EAAE,EAAE;IACxC,MAAM,OAAO,GAAG,GAAG,CAAC,YAAY,EAAE,CAAC,UAAU,EAAE,CAAC;IAChD,OAAO,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC3B,CAAC,CACF,CAAC"}
@@ -1,10 +0,0 @@
1
- import { PrismaService } from '@hedhog/prisma';
2
- import { NestMiddleware } from '@nestjs/common';
3
- import { NextFunction, Request, Response } from 'express';
4
- export declare class LocaleMiddleware implements NestMiddleware {
5
- private prisma;
6
- private languages;
7
- constructor(prisma: PrismaService);
8
- use(req: Request, _res: Response, next: NextFunction): Promise<void>;
9
- }
10
- //# sourceMappingURL=locale.middleware.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"locale.middleware.d.ts","sourceRoot":"","sources":["../../src/locale/locale.middleware.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAc,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAE1D,qBACa,gBAAiB,YAAW,cAAc;IAGzC,OAAO,CAAC,MAAM;IAF1B,OAAO,CAAC,SAAS,CAAM;gBAEH,MAAM,EAAE,aAAa;IAEnC,GAAG,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY;CAuB3D"}
@@ -1,45 +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.LocaleMiddleware = void 0;
13
- const prisma_1 = require("@hedhog/prisma");
14
- const common_1 = require("@nestjs/common");
15
- let LocaleMiddleware = class LocaleMiddleware {
16
- constructor(prisma) {
17
- this.prisma = prisma;
18
- this.languages = [];
19
- }
20
- async use(req, _res, next) {
21
- const locale = req.headers['accept-language'] || 'en-US';
22
- let code = locale.split(',')[0].split('-')[0];
23
- if (!this.languages.length) {
24
- const locale = await this.prisma.locale.findMany({
25
- select: {
26
- code: true,
27
- },
28
- });
29
- for (const l of locale) {
30
- this.languages.push(l.code);
31
- }
32
- }
33
- if (!this.languages.includes(code)) {
34
- code = 'en';
35
- }
36
- req['locale'] = code;
37
- next();
38
- }
39
- };
40
- exports.LocaleMiddleware = LocaleMiddleware;
41
- exports.LocaleMiddleware = LocaleMiddleware = __decorate([
42
- (0, common_1.Injectable)(),
43
- __metadata("design:paramtypes", [prisma_1.PrismaService])
44
- ], LocaleMiddleware);
45
- //# sourceMappingURL=locale.middleware.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"locale.middleware.js","sourceRoot":"","sources":["../../src/locale/locale.middleware.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA+C;AAC/C,2CAA4D;AAIrD,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAG3B,YAAoB,MAAqB;QAArB,WAAM,GAAN,MAAM,CAAe;QAFjC,cAAS,GAAG,EAAE,CAAC;IAEqB,CAAC;IAE7C,KAAK,CAAC,GAAG,CAAC,GAAY,EAAE,IAAc,EAAE,IAAkB;QACxD,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC,iBAAiB,CAAC,IAAI,OAAO,CAAC;QACzD,IAAI,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAE9C,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC;YAC3B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC;gBAC/C,MAAM,EAAE;oBACN,IAAI,EAAE,IAAI;iBACX;aACF,CAAC,CAAC;YAEH,KAAK,MAAM,CAAC,IAAI,MAAM,EAAE,CAAC;gBACvB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;YAC9B,CAAC;QACH,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;YACnC,IAAI,GAAG,IAAI,CAAC;QACd,CAAC;QAED,GAAG,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC;QACrB,IAAI,EAAE,CAAC;IACT,CAAC;CACF,CAAA;AA5BY,4CAAgB;2BAAhB,gBAAgB;IAD5B,IAAA,mBAAU,GAAE;qCAIiB,sBAAa;GAH9B,gBAAgB,CA4B5B"}
@@ -1,5 +0,0 @@
1
- import { MiddlewareConsumer } from '@nestjs/common';
2
- export declare class LocaleModule {
3
- configure(consumer: MiddlewareConsumer): void;
4
- }
5
- //# sourceMappingURL=locale.module.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"locale.module.d.ts","sourceRoot":"","sources":["../../src/locale/locale.module.ts"],"names":[],"mappings":"AAEA,OAAO,EAAc,kBAAkB,EAAU,MAAM,gBAAgB,CAAC;AAMxE,qBAUa,YAAY;IACvB,SAAS,CAAC,QAAQ,EAAE,kBAAkB;CAGvC"}
@@ -1,35 +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.LocaleModule = void 0;
10
- const pagination_1 = require("@hedhog/pagination");
11
- const prisma_1 = require("@hedhog/prisma");
12
- const common_1 = require("@nestjs/common");
13
- const locale_service_1 = require("./locale.service");
14
- const locale_controller_1 = require("./locale.controller");
15
- const locale_middleware_1 = require("./locale.middleware");
16
- const auth_module_1 = require("../auth/auth.module");
17
- let LocaleModule = class LocaleModule {
18
- configure(consumer) {
19
- consumer.apply(locale_middleware_1.LocaleMiddleware).forRoutes('*');
20
- }
21
- };
22
- exports.LocaleModule = LocaleModule;
23
- exports.LocaleModule = LocaleModule = __decorate([
24
- (0, common_1.Module)({
25
- imports: [
26
- (0, common_1.forwardRef)(() => auth_module_1.AuthModule),
27
- (0, common_1.forwardRef)(() => prisma_1.PrismaModule),
28
- (0, common_1.forwardRef)(() => pagination_1.PaginationModule),
29
- ],
30
- controllers: [locale_controller_1.LocaleController],
31
- providers: [locale_service_1.LocaleService],
32
- exports: [locale_service_1.LocaleService],
33
- })
34
- ], LocaleModule);
35
- //# sourceMappingURL=locale.module.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"locale.module.js","sourceRoot":"","sources":["../../src/locale/locale.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,mDAAsD;AACtD,2CAA8C;AAC9C,2CAAwE;AACxE,qDAAiD;AACjD,2DAAuD;AACvD,2DAAuD;AACvD,qDAAiD;AAY1C,IAAM,YAAY,GAAlB,MAAM,YAAY;IACvB,SAAS,CAAC,QAA4B;QACpC,QAAQ,CAAC,KAAK,CAAC,oCAAgB,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IAClD,CAAC;CACF,CAAA;AAJY,oCAAY;uBAAZ,YAAY;IAVxB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,wBAAU,CAAC;YAC5B,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,qBAAY,CAAC;YAC9B,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,6BAAgB,CAAC;SACnC;QACD,WAAW,EAAE,CAAC,oCAAgB,CAAC;QAC/B,SAAS,EAAE,CAAC,8BAAa,CAAC;QAC1B,OAAO,EAAE,CAAC,8BAAa,CAAC;KACzB,CAAC;GACW,YAAY,CAIxB"}
@@ -1,32 +0,0 @@
1
- import { PaginationDTO, PaginationService } from '@hedhog/pagination';
2
- import { PrismaService } from '@hedhog/prisma';
3
- import { CreateDTO } from './dto/create.dto';
4
- import { DeleteDTO } from './dto/delete.dto';
5
- import { UpdateDTO } from './dto/update.dto';
6
- export declare class LocaleService {
7
- private readonly prismaService;
8
- private readonly paginationService;
9
- private codes;
10
- constructor(prismaService: PrismaService, paginationService: PaginationService);
11
- setEnabled(codes: string[]): Promise<any>;
12
- getEnables(currentLocale: string, paginationParams: PaginationDTO): Promise<import("@hedhog/pagination").PaginatedResult<unknown>>;
13
- parseLocale(locale: string): {
14
- code: string;
15
- region: string;
16
- locale: string[];
17
- };
18
- getTranslations(localeCode: string, namespace: string): Promise<{}>;
19
- get(currentLocale: string, paginationParams: PaginationDTO): Promise<import("@hedhog/pagination").PaginatedResult<unknown>>;
20
- getByCode(code: string): Promise<any>;
21
- getById(localeId: number): Promise<any>;
22
- create(data: CreateDTO): Promise<any>;
23
- update({ id, data }: {
24
- id: number;
25
- data: UpdateDTO;
26
- }): Promise<any>;
27
- delete({ ids }: DeleteDTO): Promise<any>;
28
- private getTableNameTranslations;
29
- createModelWithLocale<T>(modelName: string, foreignKeyName: string, data: T, locale: Record<string, Record<string, string>>): Promise<any>;
30
- updateModelWithLocale<T>(modelName: string, foreignKeyName: string, id: number, data: T, locale: Record<string, Record<string, string>>): Promise<any>;
31
- }
32
- //# sourceMappingURL=locale.service.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"locale.service.d.ts","sourceRoot":"","sources":["../../src/locale/locale.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAO/C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,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