@hedhog/setting 0.0.5 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) 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 +26 -0
  24. package/dist/setting/setting.controller.d.ts.map +1 -0
  25. package/dist/setting/setting.controller.js +160 -0
  26. package/dist/setting/setting.controller.js.map +1 -0
  27. package/dist/setting/setting.service.d.ts +33 -0
  28. package/dist/setting/setting.service.d.ts.map +1 -0
  29. package/dist/setting/setting.service.js +377 -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 +39 -27
  58. package/dist/dto/create.dto.d.ts +0 -4
  59. package/dist/dto/create.dto.d.ts.map +0 -1
  60. package/dist/dto/create.dto.js.map +0 -1
  61. package/dist/dto/delete.dto.d.ts.map +0 -1
  62. package/dist/dto/delete.dto.js.map +0 -1
  63. package/dist/dto/update.dto.d.ts +0 -4
  64. package/dist/dto/update.dto.d.ts.map +0 -1
  65. package/dist/dto/update.dto.js.map +0 -1
  66. package/dist/migrations/index.d.ts +0 -6
  67. package/dist/migrations/index.d.ts.map +0 -1
  68. package/dist/migrations/index.js +0 -67
  69. package/dist/migrations/index.js.map +0 -1
  70. package/dist/settings.controller.d.ts +0 -14
  71. package/dist/settings.controller.d.ts.map +0 -1
  72. package/dist/settings.controller.js +0 -93
  73. package/dist/settings.controller.js.map +0 -1
  74. package/dist/settings.module.d.ts +0 -3
  75. package/dist/settings.module.d.ts.map +0 -1
  76. package/dist/settings.module.js.map +0 -1
  77. package/dist/settings.service.d.ts +0 -19
  78. package/dist/settings.service.d.ts.map +0 -1
  79. package/dist/settings.service.js +0 -83
  80. package/dist/settings.service.js.map +0 -1
  81. package/src/dto/create.dto.ts +0 -7
  82. package/src/dto/delete.dto.ts +0 -8
  83. package/src/dto/update.dto.ts +0 -3
  84. package/src/index.ts +0 -2
  85. package/src/migrations/index.ts +0 -78
  86. package/src/settings.controller.ts +0 -63
  87. package/src/settings.module.ts +0 -18
  88. package/src/settings.service.ts +0 -86
  89. package/tsconfig.lib.json +0 -9
  90. package/tsconfig.production.json +0 -20
  91. /package/dist/{dto → setting/dto}/delete.dto.d.ts +0 -0
  92. /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,26 @@
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
+ appearanceCSS(res: any): Promise<any>;
12
+ listSettingGroups(paginationParams: any, locale: any): Promise<import("@hedhog/pagination").PaginatedResult<unknown>>;
13
+ listSettings(paginationParams: any, locale: any): Promise<import("@hedhog/pagination").PaginatedResult<unknown>>;
14
+ get(settingId: number): Promise<any>;
15
+ create(data: CreateDTO): Promise<any>;
16
+ updateUserFromSlug(slug: string, { value }: SettingUserDTO, { id }: {
17
+ id: any;
18
+ }): Promise<any>;
19
+ updateFromSlug(slug: string, data: UpdateDTO): Promise<any>;
20
+ setManySettings(data: SettingDTO): Promise<{
21
+ success: boolean;
22
+ }>;
23
+ update(settingId: number, data: UpdateDTO): Promise<any>;
24
+ delete(data: DeleteDTO): Promise<any>;
25
+ }
26
+ //# 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":"AAiBA,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;IAWvB,aAAa,CAAQ,GAAG,KAAA;IAKxB,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,160 @@
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 appearanceCSS(res) {
34
+ return this.settingService.getAppearanceCSS(res);
35
+ }
36
+ async listSettingGroups(paginationParams, locale) {
37
+ return this.settingService.listSettingGroups(locale, paginationParams);
38
+ }
39
+ async listSettings(paginationParams, locale) {
40
+ return this.settingService.listSettings(locale, paginationParams);
41
+ }
42
+ async get(settingId) {
43
+ return this.settingService.get(settingId);
44
+ }
45
+ async create(data) {
46
+ return this.settingService.create(data);
47
+ }
48
+ async updateUserFromSlug(slug, { value }, { id }) {
49
+ return this.settingService.setSettingUserValue(id, slug, value);
50
+ }
51
+ async updateFromSlug(slug, data) {
52
+ return this.settingService.updateFromSlug(slug, data);
53
+ }
54
+ async setManySettings(data) {
55
+ return this.settingService.setManySettings(data);
56
+ }
57
+ async update(settingId, data) {
58
+ return this.settingService.update({
59
+ id: settingId,
60
+ data,
61
+ });
62
+ }
63
+ async delete(data) {
64
+ return this.settingService.delete(data);
65
+ }
66
+ };
67
+ exports.SettingsController = SettingsController;
68
+ __decorate([
69
+ (0, common_1.Get)('group/:slug'),
70
+ __param(0, (0, pagination_1.Pagination)()),
71
+ __param(1, (0, locale_1.Locale)()),
72
+ __param(2, (0, common_1.Param)('slug')),
73
+ __metadata("design:type", Function),
74
+ __metadata("design:paramtypes", [Object, Object, String]),
75
+ __metadata("design:returntype", Promise)
76
+ ], SettingsController.prototype, "getSettingFromGroup", null);
77
+ __decorate([
78
+ (0, utils_1.Public)(),
79
+ (0, common_1.Get)('appearance.css'),
80
+ __param(0, (0, common_1.Res)()),
81
+ __metadata("design:type", Function),
82
+ __metadata("design:paramtypes", [Object]),
83
+ __metadata("design:returntype", Promise)
84
+ ], SettingsController.prototype, "appearanceCSS", null);
85
+ __decorate([
86
+ (0, common_1.Get)('group'),
87
+ __param(0, (0, pagination_1.Pagination)()),
88
+ __param(1, (0, locale_1.Locale)()),
89
+ __metadata("design:type", Function),
90
+ __metadata("design:paramtypes", [Object, Object]),
91
+ __metadata("design:returntype", Promise)
92
+ ], SettingsController.prototype, "listSettingGroups", null);
93
+ __decorate([
94
+ (0, common_1.Get)(),
95
+ __param(0, (0, pagination_1.Pagination)()),
96
+ __param(1, (0, locale_1.Locale)()),
97
+ __metadata("design:type", Function),
98
+ __metadata("design:paramtypes", [Object, Object]),
99
+ __metadata("design:returntype", Promise)
100
+ ], SettingsController.prototype, "listSettings", null);
101
+ __decorate([
102
+ (0, common_1.Get)(':settingId'),
103
+ __param(0, (0, common_1.Param)('settingId', common_1.ParseIntPipe)),
104
+ __metadata("design:type", Function),
105
+ __metadata("design:paramtypes", [Number]),
106
+ __metadata("design:returntype", Promise)
107
+ ], SettingsController.prototype, "get", null);
108
+ __decorate([
109
+ (0, common_1.Post)(),
110
+ __param(0, (0, common_1.Body)()),
111
+ __metadata("design:type", Function),
112
+ __metadata("design:paramtypes", [create_dto_1.CreateDTO]),
113
+ __metadata("design:returntype", Promise)
114
+ ], SettingsController.prototype, "create", null);
115
+ __decorate([
116
+ (0, common_1.Put)('user/:slug'),
117
+ __param(0, (0, common_1.Param)('slug')),
118
+ __param(1, (0, common_1.Body)()),
119
+ __param(2, (0, utils_1.User)()),
120
+ __metadata("design:type", Function),
121
+ __metadata("design:paramtypes", [String, setting_user_dto_1.SettingUserDTO, Object]),
122
+ __metadata("design:returntype", Promise)
123
+ ], SettingsController.prototype, "updateUserFromSlug", null);
124
+ __decorate([
125
+ (0, common_1.Put)(':slug'),
126
+ __param(0, (0, common_1.Param)('slug')),
127
+ __param(1, (0, common_1.Body)()),
128
+ __metadata("design:type", Function),
129
+ __metadata("design:paramtypes", [String, update_dto_1.UpdateDTO]),
130
+ __metadata("design:returntype", Promise)
131
+ ], SettingsController.prototype, "updateFromSlug", null);
132
+ __decorate([
133
+ (0, common_1.Put)(),
134
+ __param(0, (0, common_1.Body)()),
135
+ __metadata("design:type", Function),
136
+ __metadata("design:paramtypes", [setting_dto_1.SettingDTO]),
137
+ __metadata("design:returntype", Promise)
138
+ ], SettingsController.prototype, "setManySettings", null);
139
+ __decorate([
140
+ (0, common_1.Patch)(':settingId'),
141
+ __param(0, (0, common_1.Param)('settingId', common_1.ParseIntPipe)),
142
+ __param(1, (0, common_1.Body)()),
143
+ __metadata("design:type", Function),
144
+ __metadata("design:paramtypes", [Number, update_dto_1.UpdateDTO]),
145
+ __metadata("design:returntype", Promise)
146
+ ], SettingsController.prototype, "update", null);
147
+ __decorate([
148
+ (0, common_1.Delete)(),
149
+ __param(0, (0, common_1.Body)()),
150
+ __metadata("design:type", Function),
151
+ __metadata("design:paramtypes", [delete_dto_1.DeleteDTO]),
152
+ __metadata("design:returntype", Promise)
153
+ ], SettingsController.prototype, "delete", null);
154
+ exports.SettingsController = SettingsController = __decorate([
155
+ (0, utils_1.Role)(),
156
+ (0, common_1.Controller)('setting'),
157
+ __param(0, (0, common_1.Inject)((0, common_1.forwardRef)(() => setting_service_1.SettingService))),
158
+ __metadata("design:paramtypes", [setting_service_1.SettingService])
159
+ ], SettingsController);
160
+ //# 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,mDAAgD;AAChD,2CAawB;AACxB,2CAAwC;AACxC,yCAAmD;AACnD,iDAA6C;AAC7C,iDAA6C;AAC7C,6DAAwD;AACxD,mDAA+C;AAC/C,iDAA6C;AAC7C,uDAAmD;AAI5C,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAC7B,YAEmB,cAA8B;QAA9B,mBAAc,GAAd,cAAc,CAAgB;IAC9C,CAAC;IAGE,AAAN,KAAK,CAAC,mBAAmB,CACT,gBAAgB,EACpB,MAAM,EACD,IAAY;QAE3B,OAAO,IAAI,CAAC,cAAc,CAAC,mBAAmB,CAC5C,MAAM,EACN,gBAAgB,EAChB,IAAI,CACL,CAAC;IACJ,CAAC;IAIK,AAAN,KAAK,CAAC,aAAa,CAAQ,GAAG;QAC5B,OAAO,IAAI,CAAC,cAAc,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;IACnD,CAAC;IAGK,AAAN,KAAK,CAAC,iBAAiB,CAAe,gBAAgB,EAAY,MAAM;QACtE,OAAO,IAAI,CAAC,cAAc,CAAC,iBAAiB,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IACzE,CAAC;IAGK,AAAN,KAAK,CAAC,YAAY,CAAe,gBAAgB,EAAY,MAAM;QACjE,OAAO,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IACpE,CAAC;IAGK,AAAN,KAAK,CAAC,GAAG,CAAmC,SAAiB;QAC3D,OAAO,IAAI,CAAC,cAAc,CAAC,G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AAA,mBAAU,EAAC,GAAG,EAAE,CAAC,gCAAc,CAAC,CAAC,CAAA;qCACR,gCAAc;GAHtC,kBAAkB,CA+E9B"}
@@ -0,0 +1,33 @@
1
+ import { FileService } from '@hedhog/file';
2
+ import { PaginationDTO, PaginationService } from '@hedhog/pagination';
3
+ import { PrismaService } from '@hedhog/prisma';
4
+ import { Response } from 'express';
5
+ import { DeleteDTO } from './dto/delete.dto';
6
+ import { CreateDTO } from './dto/create.dto';
7
+ import { SettingDTO } from './dto/setting.dto';
8
+ import { UpdateDTO } from './dto/update.dto';
9
+ export declare class SettingService {
10
+ private readonly prismaService;
11
+ private readonly paginationService;
12
+ private readonly fileService;
13
+ constructor(prismaService: PrismaService, paginationService: PaginationService, fileService: FileService);
14
+ getAppearanceCSS(res: Response): Promise<any>;
15
+ updateAppearanceSettings(): Promise<void>;
16
+ setManySettings(data: SettingDTO): Promise<{
17
+ success: boolean;
18
+ }>;
19
+ getSettingFromGroup(locale: any, paginationParams: any, slug: string): Promise<import("@hedhog/pagination").PaginatedResult<unknown>>;
20
+ listSettingGroups(locale: string, paginationParams: PaginationDTO): Promise<import("@hedhog/pagination").PaginatedResult<unknown>>;
21
+ listSettings(locale: string, paginationParams: PaginationDTO): Promise<import("@hedhog/pagination").PaginatedResult<unknown>>;
22
+ get(settingId: number): Promise<any>;
23
+ create({}: CreateDTO): Promise<any>;
24
+ update({ id, data }: {
25
+ id: number;
26
+ data: UpdateDTO;
27
+ }): Promise<any>;
28
+ updateFromSlug(slug: string, data: UpdateDTO): Promise<any>;
29
+ delete({ ids }: DeleteDTO): Promise<any>;
30
+ setSettingUserValue(user_id: number, slug: string, value: string): Promise<any>;
31
+ getSettingValues(slug: string | string[]): Promise<Record<string, any>>;
32
+ }
33
+ //# 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":"AAAA,OAAO,EAAE,WAA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