@hedhog/setting 0.0.6 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. package/dist/index.d.ts +1 -2
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +1 -2
  4. package/dist/index.js.map +1 -1
  5. package/dist/setting/dto/create.dto.d.ts +8 -0
  6. package/dist/setting/dto/create.dto.d.ts.map +1 -0
  7. package/dist/setting/dto/create.dto.js +36 -0
  8. package/dist/setting/dto/create.dto.js.map +1 -0
  9. package/dist/setting/dto/delete.dto.d.ts.map +1 -0
  10. package/dist/setting/dto/delete.dto.js.map +1 -0
  11. package/dist/setting/dto/setting-user.dto.d.ts +4 -0
  12. package/dist/setting/dto/setting-user.dto.d.ts.map +1 -0
  13. package/dist/{dto/create.dto.js → setting/dto/setting-user.dto.js} +6 -7
  14. package/dist/setting/dto/setting-user.dto.js.map +1 -0
  15. package/dist/setting/dto/setting.dto.d.ts +9 -0
  16. package/dist/setting/dto/setting.dto.d.ts.map +1 -0
  17. package/dist/setting/dto/setting.dto.js +34 -0
  18. package/dist/setting/dto/setting.dto.js.map +1 -0
  19. package/dist/setting/dto/update.dto.d.ts +6 -0
  20. package/dist/setting/dto/update.dto.d.ts.map +1 -0
  21. package/dist/{dto → setting/dto}/update.dto.js +2 -1
  22. package/dist/setting/dto/update.dto.js.map +1 -0
  23. package/dist/setting/setting.controller.d.ts +25 -0
  24. package/dist/setting/setting.controller.d.ts.map +1 -0
  25. package/dist/setting/setting.controller.js +149 -0
  26. package/dist/setting/setting.controller.js.map +1 -0
  27. package/dist/setting/setting.service.d.ts +28 -0
  28. package/dist/setting/setting.service.d.ts.map +1 -0
  29. package/dist/setting/setting.service.js +296 -0
  30. package/dist/setting/setting.service.js.map +1 -0
  31. package/dist/setting.module.d.ts +3 -0
  32. package/dist/setting.module.d.ts.map +1 -0
  33. package/dist/{settings.module.js → setting.module.js} +8 -8
  34. package/dist/setting.module.js.map +1 -0
  35. package/frontend/setting/components/create-panel.tsx +83 -0
  36. package/frontend/setting/components/setting.screen.tsx +105 -0
  37. package/frontend/setting/components/update-panel.tsx +96 -0
  38. package/frontend/setting/locales/en/setting.setting.json +11 -0
  39. package/frontend/setting/locales/pt/setting.setting.json +11 -0
  40. package/frontend/setting/react-query/handlers.ts +28 -0
  41. package/frontend/setting/react-query/requests.ts +55 -0
  42. package/frontend/setting-group/components/create-panel.tsx +62 -0
  43. package/frontend/setting-group/components/setting-group.screen.tsx +107 -0
  44. package/frontend/setting-group/components/update-panel.tsx +76 -0
  45. package/frontend/setting-group/locales/en/setting.setting-group.json +11 -0
  46. package/frontend/setting-group/locales/pt/setting.setting-group.json +11 -0
  47. package/frontend/setting-group/react-query/handlers.ts +28 -0
  48. package/frontend/setting-group/react-query/requests.ts +58 -0
  49. package/frontend/setting-user/components/create-panel.tsx +71 -0
  50. package/frontend/setting-user/components/setting-user.screen.tsx +107 -0
  51. package/frontend/setting-user/components/update-panel.tsx +85 -0
  52. package/frontend/setting-user/locales/en/setting.setting-user.json +11 -0
  53. package/frontend/setting-user/locales/pt/setting.setting-user.json +11 -0
  54. package/frontend/setting-user/react-query/handlers.ts +28 -0
  55. package/frontend/setting-user/react-query/requests.ts +57 -0
  56. package/hedhog.yaml +380 -0
  57. package/package.json +37 -29
  58. package/README.md +0 -108
  59. package/dist/dto/create.dto.d.ts +0 -4
  60. package/dist/dto/create.dto.d.ts.map +0 -1
  61. package/dist/dto/create.dto.js.map +0 -1
  62. package/dist/dto/delete.dto.d.ts.map +0 -1
  63. package/dist/dto/delete.dto.js.map +0 -1
  64. package/dist/dto/update.dto.d.ts +0 -4
  65. package/dist/dto/update.dto.d.ts.map +0 -1
  66. package/dist/dto/update.dto.js.map +0 -1
  67. package/dist/migrations/index.d.ts +0 -6
  68. package/dist/migrations/index.d.ts.map +0 -1
  69. package/dist/migrations/index.js +0 -67
  70. package/dist/migrations/index.js.map +0 -1
  71. package/dist/settings.controller.d.ts +0 -14
  72. package/dist/settings.controller.d.ts.map +0 -1
  73. package/dist/settings.controller.js +0 -95
  74. package/dist/settings.controller.js.map +0 -1
  75. package/dist/settings.module.d.ts +0 -3
  76. package/dist/settings.module.d.ts.map +0 -1
  77. package/dist/settings.module.js.map +0 -1
  78. package/dist/settings.service.d.ts +0 -19
  79. package/dist/settings.service.d.ts.map +0 -1
  80. package/dist/settings.service.js +0 -70
  81. package/dist/settings.service.js.map +0 -1
  82. package/src/dto/create.dto.ts +0 -7
  83. package/src/dto/delete.dto.ts +0 -8
  84. package/src/dto/update.dto.ts +0 -3
  85. package/src/index.ts +0 -2
  86. package/src/migrations/index.ts +0 -78
  87. package/src/settings.controller.ts +0 -65
  88. package/src/settings.module.ts +0 -18
  89. package/src/settings.service.ts +0 -75
  90. package/tsconfig.lib.json +0 -9
  91. package/tsconfig.production.json +0 -20
  92. /package/dist/{dto → setting/dto}/delete.dto.d.ts +0 -0
  93. /package/dist/{dto → setting/dto}/delete.dto.js +0 -0
package/dist/index.d.ts CHANGED
@@ -1,3 +1,2 @@
1
- export * from './settings.module';
2
- export * from './settings.service';
1
+ export * from "./setting.module";
3
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC"}
package/dist/index.js CHANGED
@@ -14,6 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./settings.module"), exports);
18
- __exportStar(require("./settings.service"), exports);
17
+ __exportStar(require("./setting.module"), exports);
19
18
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,qDAAmC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC"}
@@ -0,0 +1,8 @@
1
+ import { WithLocaleDTO } from '@hedhog/locale';
2
+ export declare class CreateDTO extends WithLocaleDTO {
3
+ slug: string;
4
+ type: string;
5
+ value: string;
6
+ user_override: boolean;
7
+ }
8
+ //# sourceMappingURL=create.dto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.dto.d.ts","sourceRoot":"","sources":["../../../src/setting/dto/create.dto.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,qBAAa,SAAU,SAAQ,aAAa;IAG1C,IAAI,EAAE,MAAM,CAAC;IAGb,IAAI,EAAE,MAAM,CAAC;IAIb,KAAK,EAAE,MAAM,CAAC;IAGd,aAAa,EAAE,OAAO,CAAC;CACxB"}
@@ -0,0 +1,36 @@
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 class_validator_1 = require("class-validator");
14
+ const locale_1 = require("@hedhog/locale");
15
+ class CreateDTO extends locale_1.WithLocaleDTO {
16
+ }
17
+ exports.CreateDTO = CreateDTO;
18
+ __decorate([
19
+ (0, class_validator_1.IsString)(),
20
+ (0, class_validator_1.Length)(0, 255),
21
+ __metadata("design:type", String)
22
+ ], CreateDTO.prototype, "slug", void 0);
23
+ __decorate([
24
+ (0, class_validator_1.IsString)(),
25
+ __metadata("design:type", String)
26
+ ], CreateDTO.prototype, "type", void 0);
27
+ __decorate([
28
+ (0, class_validator_1.IsString)(),
29
+ (0, class_validator_1.Length)(0, 1023),
30
+ __metadata("design:type", String)
31
+ ], CreateDTO.prototype, "value", void 0);
32
+ __decorate([
33
+ (0, class_validator_1.IsBoolean)(),
34
+ __metadata("design:type", Boolean)
35
+ ], CreateDTO.prototype, "user_override", void 0);
36
+ //# sourceMappingURL=create.dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.dto.js","sourceRoot":"","sources":["../../../src/setting/dto/create.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAA8D;AAC9D,2CAA+C;AAE/C,MAAa,SAAU,SAAQ,sBAAa;CAc3C;AAdD,8BAcC;AAXC;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,wBAAM,EAAC,CAAC,EAAE,GAAG,CAAC;;uCACF;AAGb;IADC,IAAA,0BAAQ,GAAE;;uCACE;AAIb;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,wBAAM,EAAC,CAAC,EAAE,IAAI,CAAC;;wCACF;AAGd;IADC,IAAA,2BAAS,GAAE;;gDACW"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete.dto.d.ts","sourceRoot":"","sources":["../../../src/setting/dto/delete.dto.ts"],"names":[],"mappings":"AAEA,qBAAa,SAAS;IAIpB,GAAG,EAAE,MAAM,EAAE,CAAC;CACf"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete.dto.js","sourceRoot":"","sources":["../../../src/setting/dto/delete.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAA+D;AAE/D,MAAa,SAAS;CAKrB;AALD,8BAKC;AADC;IAHC,IAAA,yBAAO,GAAE;IACT,IAAA,8BAAY,EAAC,CAAC,CAAC;IACf,IAAA,uBAAK,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;;sCACR"}
@@ -0,0 +1,4 @@
1
+ export declare class SettingUserDTO {
2
+ value: string;
3
+ }
4
+ //# sourceMappingURL=setting-user.dto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setting-user.dto.d.ts","sourceRoot":"","sources":["../../../src/setting/dto/setting-user.dto.ts"],"names":[],"mappings":"AAEA,qBAAa,cAAc;IAEzB,KAAK,EAAE,MAAM,CAAC;CACf"}
@@ -9,14 +9,13 @@ var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.CreateDTO = void 0;
12
+ exports.SettingUserDTO = void 0;
13
13
  const class_validator_1 = require("class-validator");
14
- class CreateDTO {
14
+ class SettingUserDTO {
15
15
  }
16
- exports.CreateDTO = CreateDTO;
16
+ exports.SettingUserDTO = SettingUserDTO;
17
17
  __decorate([
18
- (0, class_validator_1.IsString)({ message: 'O nome deve ser uma string' }),
19
- (0, class_validator_1.IsNotEmpty)({ message: 'O nome é obrigatório.' }),
18
+ (0, class_validator_1.IsString)(),
20
19
  __metadata("design:type", String)
21
- ], CreateDTO.prototype, "name", void 0);
22
- //# sourceMappingURL=create.dto.js.map
20
+ ], SettingUserDTO.prototype, "value", void 0);
21
+ //# sourceMappingURL=setting-user.dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setting-user.dto.js","sourceRoot":"","sources":["../../../src/setting/dto/setting-user.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAA2C;AAE3C,MAAa,cAAc;CAG1B;AAHD,wCAGC;AADC;IADC,IAAA,0BAAQ,GAAE;;6CACG"}
@@ -0,0 +1,9 @@
1
+ declare class Setting {
2
+ slug: string;
3
+ value: string;
4
+ }
5
+ export declare class SettingDTO {
6
+ setting: Setting[];
7
+ }
8
+ export {};
9
+ //# sourceMappingURL=setting.dto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setting.dto.d.ts","sourceRoot":"","sources":["../../../src/setting/dto/setting.dto.ts"],"names":[],"mappings":"AAGA,cAAM,OAAO;IAEX,IAAI,EAAE,MAAM,CAAC;IAGb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,qBAAa,UAAU;IAIrB,OAAO,EAAE,OAAO,EAAE,CAAC;CACpB"}
@@ -0,0 +1,34 @@
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.SettingDTO = void 0;
13
+ const class_transformer_1 = require("class-transformer");
14
+ const class_validator_1 = require("class-validator");
15
+ class Setting {
16
+ }
17
+ __decorate([
18
+ (0, class_validator_1.IsString)(),
19
+ __metadata("design:type", String)
20
+ ], Setting.prototype, "slug", void 0);
21
+ __decorate([
22
+ (0, class_validator_1.IsString)(),
23
+ __metadata("design:type", String)
24
+ ], Setting.prototype, "value", void 0);
25
+ class SettingDTO {
26
+ }
27
+ exports.SettingDTO = SettingDTO;
28
+ __decorate([
29
+ (0, class_validator_1.IsArray)(),
30
+ (0, class_validator_1.ValidateNested)({ each: true }),
31
+ (0, class_transformer_1.Type)(() => Setting),
32
+ __metadata("design:type", Array)
33
+ ], SettingDTO.prototype, "setting", void 0);
34
+ //# sourceMappingURL=setting.dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setting.dto.js","sourceRoot":"","sources":["../../../src/setting/dto/setting.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAAyC;AACzC,qDAAoE;AAEpE,MAAM,OAAO;CAMZ;AAJC;IADC,IAAA,0BAAQ,GAAE;;qCACE;AAGb;IADC,IAAA,0BAAQ,GAAE;;sCACG;AAGhB,MAAa,UAAU;CAKtB;AALD,gCAKC;AADC;IAHC,IAAA,yBAAO,GAAE;IACT,IAAA,gCAAc,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IAC9B,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,OAAO,CAAC;;2CACD"}
@@ -0,0 +1,6 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update.dto.d.ts","sourceRoot":"","sources":["../../../src/setting/dto/update.dto.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;;AAEzC,qBAAa,SAAU,SAAQ,cAAsB;CAAG"}
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.UpdateDTO = void 0;
4
+ const mapped_types_1 = require("@nestjs/mapped-types");
4
5
  const create_dto_1 = require("./create.dto");
5
- class UpdateDTO extends create_dto_1.CreateDTO {
6
+ class UpdateDTO extends (0, mapped_types_1.PartialType)(create_dto_1.CreateDTO) {
6
7
  }
7
8
  exports.UpdateDTO = UpdateDTO;
8
9
  //# sourceMappingURL=update.dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update.dto.js","sourceRoot":"","sources":["../../../src/setting/dto/update.dto.ts"],"names":[],"mappings":";;;AAAA,uDAAmD;AACnD,6CAAyC;AAEzC,MAAa,SAAU,SAAQ,IAAA,0BAAW,EAAC,sBAAS,CAAC;CAAG;AAAxD,8BAAwD"}
@@ -0,0 +1,25 @@
1
+ import { DeleteDTO } from './dto/delete.dto';
2
+ import { CreateDTO } from './dto/create.dto';
3
+ import { SettingUserDTO } from './dto/setting-user.dto';
4
+ import { SettingDTO } from './dto/setting.dto';
5
+ import { UpdateDTO } from './dto/update.dto';
6
+ import { SettingService } from './setting.service';
7
+ export declare class SettingsController {
8
+ private readonly settingService;
9
+ constructor(settingService: SettingService);
10
+ getSettingFromGroup(paginationParams: any, locale: any, slug: string): Promise<import("@hedhog/pagination").PaginatedResult<unknown>>;
11
+ listSettingGroups(paginationParams: any, locale: any): Promise<import("@hedhog/pagination").PaginatedResult<unknown>>;
12
+ listSettings(paginationParams: any, locale: any): Promise<import("@hedhog/pagination").PaginatedResult<unknown>>;
13
+ get(settingId: number): Promise<any>;
14
+ create(data: CreateDTO): Promise<any>;
15
+ updateUserFromSlug(slug: string, { value }: SettingUserDTO, { id }: {
16
+ id: any;
17
+ }): Promise<any>;
18
+ updateFromSlug(slug: string, data: UpdateDTO): Promise<any>;
19
+ setManySettings(data: SettingDTO): Promise<{
20
+ success: boolean;
21
+ }>;
22
+ update(settingId: number, data: UpdateDTO): Promise<any>;
23
+ delete(data: DeleteDTO): Promise<any>;
24
+ }
25
+ //# sourceMappingURL=setting.controller.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setting.controller.d.ts","sourceRoot":"","sources":["../../src/setting/setting.controller.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,qBAEa,kBAAkB;IAG3B,OAAO,CAAC,QAAQ,CAAC,cAAc;gBAAd,cAAc,EAAE,cAAc;IAI3C,mBAAmB,CACT,gBAAgB,KAAA,EACpB,MAAM,KAAA,EACD,IAAI,EAAE,MAAM;IAUvB,iBAAiB,CAAe,gBAAgB,KAAA,EAAY,MAAM,KAAA;IAKlE,YAAY,CAAe,gBAAgB,KAAA,EAAY,MAAM,KAAA;IAK7D,GAAG,CAAmC,SAAS,EAAE,MAAM;IAKvD,MAAM,CAAS,IAAI,EAAE,SAAS;IAK9B,kBAAkB,CACP,IAAI,EAAE,MAAM,EACnB,EAAE,KAAK,EAAE,EAAE,cAAc,EACzB,EAAE,EAAE,EAAE;;KAAA;IAMV,cAAc,CAAgB,IAAI,EAAE,MAAM,EAAU,IAAI,EAAE,SAAS;IAKnE,eAAe,CAAS,IAAI,EAAE,UAAU;;;IAKxC,MAAM,CACwB,SAAS,EAAE,MAAM,EAC3C,IAAI,EAAE,SAAS;IASnB,MAAM,CAAS,IAAI,EAAE,SAAS;CAGrC"}
@@ -0,0 +1,149 @@
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.SettingsController = void 0;
16
+ const pagination_1 = require("@hedhog/pagination");
17
+ const common_1 = require("@nestjs/common");
18
+ const locale_1 = require("@hedhog/locale");
19
+ const utils_1 = require("@hedhog/utils");
20
+ const delete_dto_1 = require("./dto/delete.dto");
21
+ const create_dto_1 = require("./dto/create.dto");
22
+ const setting_user_dto_1 = require("./dto/setting-user.dto");
23
+ const setting_dto_1 = require("./dto/setting.dto");
24
+ const update_dto_1 = require("./dto/update.dto");
25
+ const setting_service_1 = require("./setting.service");
26
+ let SettingsController = class SettingsController {
27
+ constructor(settingService) {
28
+ this.settingService = settingService;
29
+ }
30
+ async getSettingFromGroup(paginationParams, locale, slug) {
31
+ return this.settingService.getSettingFromGroup(locale, paginationParams, slug);
32
+ }
33
+ async listSettingGroups(paginationParams, locale) {
34
+ return this.settingService.listSettingGroups(locale, paginationParams);
35
+ }
36
+ async listSettings(paginationParams, locale) {
37
+ return this.settingService.listSettings(locale, paginationParams);
38
+ }
39
+ async get(settingId) {
40
+ return this.settingService.get(settingId);
41
+ }
42
+ async create(data) {
43
+ return this.settingService.create(data);
44
+ }
45
+ async updateUserFromSlug(slug, { value }, { id }) {
46
+ return this.settingService.setSettingUserValue(id, slug, value);
47
+ }
48
+ async updateFromSlug(slug, data) {
49
+ return this.settingService.updateFromSlug(slug, data);
50
+ }
51
+ async setManySettings(data) {
52
+ return this.settingService.setManySettings(data);
53
+ }
54
+ async update(settingId, data) {
55
+ return this.settingService.update({
56
+ id: settingId,
57
+ data,
58
+ });
59
+ }
60
+ async delete(data) {
61
+ return this.settingService.delete(data);
62
+ }
63
+ };
64
+ exports.SettingsController = SettingsController;
65
+ __decorate([
66
+ (0, common_1.Get)('group/:slug'),
67
+ __param(0, (0, pagination_1.Pagination)()),
68
+ __param(1, (0, locale_1.Locale)()),
69
+ __param(2, (0, common_1.Param)('slug')),
70
+ __metadata("design:type", Function),
71
+ __metadata("design:paramtypes", [Object, Object, String]),
72
+ __metadata("design:returntype", Promise)
73
+ ], SettingsController.prototype, "getSettingFromGroup", null);
74
+ __decorate([
75
+ (0, common_1.Get)('group'),
76
+ __param(0, (0, pagination_1.Pagination)()),
77
+ __param(1, (0, locale_1.Locale)()),
78
+ __metadata("design:type", Function),
79
+ __metadata("design:paramtypes", [Object, Object]),
80
+ __metadata("design:returntype", Promise)
81
+ ], SettingsController.prototype, "listSettingGroups", null);
82
+ __decorate([
83
+ (0, common_1.Get)(),
84
+ __param(0, (0, pagination_1.Pagination)()),
85
+ __param(1, (0, locale_1.Locale)()),
86
+ __metadata("design:type", Function),
87
+ __metadata("design:paramtypes", [Object, Object]),
88
+ __metadata("design:returntype", Promise)
89
+ ], SettingsController.prototype, "listSettings", null);
90
+ __decorate([
91
+ (0, common_1.Get)(':settingId'),
92
+ __param(0, (0, common_1.Param)('settingId', common_1.ParseIntPipe)),
93
+ __metadata("design:type", Function),
94
+ __metadata("design:paramtypes", [Number]),
95
+ __metadata("design:returntype", Promise)
96
+ ], SettingsController.prototype, "get", null);
97
+ __decorate([
98
+ (0, common_1.Post)(),
99
+ __param(0, (0, common_1.Body)()),
100
+ __metadata("design:type", Function),
101
+ __metadata("design:paramtypes", [create_dto_1.CreateDTO]),
102
+ __metadata("design:returntype", Promise)
103
+ ], SettingsController.prototype, "create", null);
104
+ __decorate([
105
+ (0, common_1.Put)('user/:slug'),
106
+ __param(0, (0, common_1.Param)('slug')),
107
+ __param(1, (0, common_1.Body)()),
108
+ __param(2, (0, utils_1.User)()),
109
+ __metadata("design:type", Function),
110
+ __metadata("design:paramtypes", [String, setting_user_dto_1.SettingUserDTO, Object]),
111
+ __metadata("design:returntype", Promise)
112
+ ], SettingsController.prototype, "updateUserFromSlug", null);
113
+ __decorate([
114
+ (0, common_1.Put)(':slug'),
115
+ __param(0, (0, common_1.Param)('slug')),
116
+ __param(1, (0, common_1.Body)()),
117
+ __metadata("design:type", Function),
118
+ __metadata("design:paramtypes", [String, update_dto_1.UpdateDTO]),
119
+ __metadata("design:returntype", Promise)
120
+ ], SettingsController.prototype, "updateFromSlug", null);
121
+ __decorate([
122
+ (0, common_1.Put)(),
123
+ __param(0, (0, common_1.Body)()),
124
+ __metadata("design:type", Function),
125
+ __metadata("design:paramtypes", [setting_dto_1.SettingDTO]),
126
+ __metadata("design:returntype", Promise)
127
+ ], SettingsController.prototype, "setManySettings", null);
128
+ __decorate([
129
+ (0, common_1.Patch)(':settingId'),
130
+ __param(0, (0, common_1.Param)('settingId', common_1.ParseIntPipe)),
131
+ __param(1, (0, common_1.Body)()),
132
+ __metadata("design:type", Function),
133
+ __metadata("design:paramtypes", [Number, update_dto_1.UpdateDTO]),
134
+ __metadata("design:returntype", Promise)
135
+ ], SettingsController.prototype, "update", null);
136
+ __decorate([
137
+ (0, common_1.Delete)(),
138
+ __param(0, (0, common_1.Body)()),
139
+ __metadata("design:type", Function),
140
+ __metadata("design:paramtypes", [delete_dto_1.DeleteDTO]),
141
+ __metadata("design:returntype", Promise)
142
+ ], SettingsController.prototype, "delete", null);
143
+ exports.SettingsController = SettingsController = __decorate([
144
+ (0, utils_1.Role)(),
145
+ (0, common_1.Controller)('setting'),
146
+ __param(0, (0, common_1.Inject)((0, common_1.forwardRef)(() => setting_service_1.SettingService))),
147
+ __metadata("design:paramtypes", [setting_service_1.SettingService])
148
+ ], SettingsController);
149
+ //# sourceMappingURL=setting.controller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setting.controller.js","sourceRoot":"","sources":["../../src/setting/setting.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mDA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A;IACb,WAAA,IAAA,aAAI,GAAE,CAAA;IACN,WAAA,IAAA,YAAI,GAAE,CAAA;;6CADY,iCAAc;;4DAIlC;AAGK;IADL,IAAA,YAAG,EAAC,OAAO,CAAC;IACS,WAAA,IAAA,cAAK,EAAC,MAAM,CAAC,CAAA;IAAgB,WAAA,IAAA,aAAI,GAAE,CAAA;;6CAAO,sBAAS;;wDAExE;AAGK;IADL,IAAA,YAAG,GAAE;IACiB,WAAA,IAAA,aAAI,GAAE,CAAA;;qCAAO,wBAAU;;yDAE7C;AAGK;IADL,IAAA,cAAK,EAAC,YAAY,CAAC;IAEjB,WAAA,IAAA,cAAK,EAAC,WAAW,EAAE,qBAAY,CAAC,CAAA;IAChC,WAAA,IAAA,aAAI,GAAE,CAAA;;6CAAO,sBAAS;;gDAMxB;AAGK;IADL,IAAA,eAAM,GAAE;IACK,WAAA,IAAA,aAAI,GAAE,CAAA;;qCAAO,sBAAS;;gDAEnC;6BAxEU,kBAAkB;IAF9B,IAAA,YAAI,GAAE;IACN,IAAA,mBAAU,EAAC,SAAS,CAAC;IAGjB,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,gCAAc,CAAC,CAAC,CAAA;qCACR,gCAAc;GAHtC,kBAAkB,CAyE9B"}
@@ -0,0 +1,28 @@
1
+ import { PaginationDTO, PaginationService } from '@hedhog/pagination';
2
+ import { PrismaService } from '@hedhog/prisma';
3
+ import { DeleteDTO } from './dto/delete.dto';
4
+ import { CreateDTO } from './dto/create.dto';
5
+ import { SettingDTO } from './dto/setting.dto';
6
+ import { UpdateDTO } from './dto/update.dto';
7
+ export declare class SettingService {
8
+ private readonly prismaService;
9
+ private readonly paginationService;
10
+ constructor(prismaService: PrismaService, paginationService: PaginationService);
11
+ setManySettings(data: SettingDTO): Promise<{
12
+ success: boolean;
13
+ }>;
14
+ getSettingFromGroup(locale: any, paginationParams: any, slug: string): Promise<import("@hedhog/pagination").PaginatedResult<unknown>>;
15
+ listSettingGroups(locale: string, paginationParams: PaginationDTO): Promise<import("@hedhog/pagination").PaginatedResult<unknown>>;
16
+ listSettings(locale: string, paginationParams: PaginationDTO): Promise<import("@hedhog/pagination").PaginatedResult<unknown>>;
17
+ get(settingId: number): Promise<any>;
18
+ create({}: CreateDTO): Promise<any>;
19
+ update({ id, data }: {
20
+ id: number;
21
+ data: UpdateDTO;
22
+ }): Promise<any>;
23
+ updateFromSlug(slug: string, data: UpdateDTO): Promise<any>;
24
+ delete({ ids }: DeleteDTO): Promise<any>;
25
+ setSettingUserValue(user_id: number, slug: string, value: string): Promise<any>;
26
+ getSettingValues(slug: string | string[]): Promise<Record<string, any>>;
27
+ }
28
+ //# sourceMappingURL=setting.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setting.service.d.ts","sourceRoot":"","sources":["../../src/setting/setting.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAS/C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,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,eAAe,CAAC,IAAI,EAAE,UAAU;;;IAgChC,mBAAmB,CAAC,MAAM,EAAE,GAAG,EAAE,gBAAgB,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM;IAiEpE,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,aAAa;IAqCjE,Y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