@hedhog/blog 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (142) hide show
  1. package/dist/author/author.controller.d.ts +14 -0
  2. package/dist/author/author.controller.d.ts.map +1 -0
  3. package/dist/author/author.controller.js +89 -0
  4. package/dist/author/author.controller.js.map +1 -0
  5. package/dist/author/author.module.d.ts +3 -0
  6. package/dist/author/author.module.d.ts.map +1 -0
  7. package/dist/author/author.module.js +31 -0
  8. package/dist/author/author.module.js.map +1 -0
  9. package/dist/author/author.service.d.ts +19 -0
  10. package/dist/author/author.service.d.ts.map +1 -0
  11. package/dist/author/author.service.js +72 -0
  12. package/dist/author/author.service.js.map +1 -0
  13. package/dist/author/dto/create.dto.d.ts +5 -0
  14. package/dist/author/dto/create.dto.d.ts.map +1 -0
  15. package/dist/author/dto/create.dto.js +27 -0
  16. package/dist/author/dto/create.dto.js.map +1 -0
  17. package/dist/author/dto/delete.dto.d.ts +4 -0
  18. package/dist/author/dto/delete.dto.d.ts.map +1 -0
  19. package/dist/author/dto/delete.dto.js +23 -0
  20. package/dist/author/dto/delete.dto.js.map +1 -0
  21. package/dist/author/dto/update.dto.d.ts +6 -0
  22. package/dist/author/dto/update.dto.d.ts.map +1 -0
  23. package/dist/author/dto/update.dto.js +9 -0
  24. package/dist/author/dto/update.dto.js.map +1 -0
  25. package/dist/blog.module.d.ts +3 -0
  26. package/dist/blog.module.d.ts.map +1 -0
  27. package/dist/blog.module.js +35 -0
  28. package/dist/blog.module.js.map +1 -0
  29. package/dist/category/category.controller.d.ts +14 -0
  30. package/dist/category/category.controller.d.ts.map +1 -0
  31. package/dist/category/category.controller.js +91 -0
  32. package/dist/category/category.controller.js.map +1 -0
  33. package/dist/category/category.module.d.ts +3 -0
  34. package/dist/category/category.module.d.ts.map +1 -0
  35. package/dist/category/category.module.js +31 -0
  36. package/dist/category/category.module.js.map +1 -0
  37. package/dist/category/category.service.d.ts +19 -0
  38. package/dist/category/category.service.d.ts.map +1 -0
  39. package/dist/category/category.service.js +87 -0
  40. package/dist/category/category.service.js.map +1 -0
  41. package/dist/category/dto/create.dto.d.ts +5 -0
  42. package/dist/category/dto/create.dto.d.ts.map +1 -0
  43. package/dist/category/dto/create.dto.js +23 -0
  44. package/dist/category/dto/create.dto.js.map +1 -0
  45. package/dist/category/dto/delete.dto.d.ts +4 -0
  46. package/dist/category/dto/delete.dto.d.ts.map +1 -0
  47. package/dist/category/dto/delete.dto.js +23 -0
  48. package/dist/category/dto/delete.dto.js.map +1 -0
  49. package/dist/category/dto/update.dto.d.ts +6 -0
  50. package/dist/category/dto/update.dto.d.ts.map +1 -0
  51. package/dist/category/dto/update.dto.js +9 -0
  52. package/dist/category/dto/update.dto.js.map +1 -0
  53. package/dist/index.d.ts +2 -0
  54. package/dist/index.d.ts.map +1 -0
  55. package/dist/index.js +18 -0
  56. package/dist/index.js.map +1 -0
  57. package/dist/post/dto/create.dto.d.ts +5 -0
  58. package/dist/post/dto/create.dto.d.ts.map +1 -0
  59. package/dist/post/dto/create.dto.js +26 -0
  60. package/dist/post/dto/create.dto.js.map +1 -0
  61. package/dist/post/dto/delete.dto.d.ts +4 -0
  62. package/dist/post/dto/delete.dto.d.ts.map +1 -0
  63. package/dist/post/dto/delete.dto.js +23 -0
  64. package/dist/post/dto/delete.dto.js.map +1 -0
  65. package/dist/post/dto/update.dto.d.ts +6 -0
  66. package/dist/post/dto/update.dto.d.ts.map +1 -0
  67. package/dist/post/dto/update.dto.js +9 -0
  68. package/dist/post/dto/update.dto.js.map +1 -0
  69. package/dist/post/post.controller.d.ts +14 -0
  70. package/dist/post/post.controller.d.ts.map +1 -0
  71. package/dist/post/post.controller.js +89 -0
  72. package/dist/post/post.controller.js.map +1 -0
  73. package/dist/post/post.module.d.ts +3 -0
  74. package/dist/post/post.module.d.ts.map +1 -0
  75. package/dist/post/post.module.js +31 -0
  76. package/dist/post/post.module.js.map +1 -0
  77. package/dist/post/post.service.d.ts +19 -0
  78. package/dist/post/post.service.d.ts.map +1 -0
  79. package/dist/post/post.service.js +72 -0
  80. package/dist/post/post.service.js.map +1 -0
  81. package/frontend/author/components/create-panel.d.ts +9 -0
  82. package/frontend/author/components/create-panel.d.ts.map +1 -0
  83. package/frontend/author/components/create-panel.js +42 -0
  84. package/frontend/author/components/create-panel.js.map +1 -0
  85. package/frontend/author/components/create-panel.tsx +60 -0
  86. package/frontend/author/components/update-panel.d.ts +7 -0
  87. package/frontend/author/components/update-panel.d.ts.map +1 -0
  88. package/frontend/author/components/update-panel.js +52 -0
  89. package/frontend/author/components/update-panel.js.map +1 -0
  90. package/frontend/author/components/update-panel.tsx +70 -0
  91. package/frontend/author/react-query/handlers.d.ts +5 -0
  92. package/frontend/author/react-query/handlers.d.ts.map +1 -0
  93. package/frontend/author/react-query/handlers.js +30 -0
  94. package/frontend/author/react-query/handlers.js.map +1 -0
  95. package/frontend/author/react-query/handlers.ts +28 -0
  96. package/frontend/author/react-query/requests.d.ts +10 -0
  97. package/frontend/author/react-query/requests.d.ts.map +1 -0
  98. package/frontend/author/react-query/requests.js +48 -0
  99. package/frontend/author/react-query/requests.js.map +1 -0
  100. package/frontend/author/react-query/requests.ts +53 -0
  101. package/frontend/category/components/create-panel.d.ts +9 -0
  102. package/frontend/category/components/create-panel.d.ts.map +1 -0
  103. package/frontend/category/components/create-panel.js +48 -0
  104. package/frontend/category/components/create-panel.js.map +1 -0
  105. package/frontend/category/components/create-panel.tsx +49 -0
  106. package/frontend/category/components/update-panel.d.ts +7 -0
  107. package/frontend/category/components/update-panel.d.ts.map +1 -0
  108. package/frontend/category/components/update-panel.js +61 -0
  109. package/frontend/category/components/update-panel.js.map +1 -0
  110. package/frontend/category/components/update-panel.tsx +59 -0
  111. package/frontend/category/react-query/handlers.d.ts +5 -0
  112. package/frontend/category/react-query/handlers.d.ts.map +1 -0
  113. package/frontend/category/react-query/handlers.js +30 -0
  114. package/frontend/category/react-query/handlers.js.map +1 -0
  115. package/frontend/category/react-query/handlers.ts +28 -0
  116. package/frontend/category/react-query/requests.d.ts +10 -0
  117. package/frontend/category/react-query/requests.d.ts.map +1 -0
  118. package/frontend/category/react-query/requests.js +49 -0
  119. package/frontend/category/react-query/requests.js.map +1 -0
  120. package/frontend/category/react-query/requests.ts +54 -0
  121. package/frontend/post/components/create-panel.d.ts +9 -0
  122. package/frontend/post/components/create-panel.d.ts.map +1 -0
  123. package/frontend/post/components/create-panel.js +54 -0
  124. package/frontend/post/components/create-panel.js.map +1 -0
  125. package/frontend/post/components/create-panel.tsx +74 -0
  126. package/frontend/post/components/update-panel.d.ts +7 -0
  127. package/frontend/post/components/update-panel.d.ts.map +1 -0
  128. package/frontend/post/components/update-panel.js +64 -0
  129. package/frontend/post/components/update-panel.js.map +1 -0
  130. package/frontend/post/components/update-panel.tsx +84 -0
  131. package/frontend/post/react-query/handlers.d.ts +5 -0
  132. package/frontend/post/react-query/handlers.d.ts.map +1 -0
  133. package/frontend/post/react-query/handlers.js +30 -0
  134. package/frontend/post/react-query/handlers.js.map +1 -0
  135. package/frontend/post/react-query/handlers.ts +28 -0
  136. package/frontend/post/react-query/requests.d.ts +10 -0
  137. package/frontend/post/react-query/requests.d.ts.map +1 -0
  138. package/frontend/post/react-query/requests.js +48 -0
  139. package/frontend/post/react-query/requests.js.map +1 -0
  140. package/frontend/post/react-query/requests.ts +53 -0
  141. package/hedhog.yaml +133 -0
  142. package/package.json +35 -0
@@ -0,0 +1,87 @@
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.CategoryService = void 0;
16
+ const pagination_1 = require("@hedhog/pagination");
17
+ const prisma_1 = require("@hedhog/prisma");
18
+ const common_1 = require("@nestjs/common");
19
+ let CategoryService = class CategoryService {
20
+ constructor(prismaService, paginationService) {
21
+ this.prismaService = prismaService;
22
+ this.paginationService = paginationService;
23
+ }
24
+ async list(locale, paginationParams) {
25
+ const OR = [];
26
+ const include = {
27
+ category: {
28
+ select: {
29
+ id: true,
30
+ category_locale: {
31
+ where: {
32
+ locale: {
33
+ code: locale,
34
+ },
35
+ },
36
+ select: {
37
+ name: true,
38
+ },
39
+ },
40
+ },
41
+ },
42
+ };
43
+ return this.paginationService.paginate(this.prismaService.category_locale, paginationParams, {
44
+ where: {
45
+ OR,
46
+ },
47
+ include,
48
+ }, "category_locale");
49
+ }
50
+ async get(categoryId) {
51
+ return this.prismaService.category.findUnique({
52
+ where: { id: categoryId },
53
+ });
54
+ }
55
+ async create(data) {
56
+ return this.prismaService.category.create({
57
+ data,
58
+ });
59
+ }
60
+ async update({ id, data }) {
61
+ return this.prismaService.category.update({
62
+ where: { id },
63
+ data,
64
+ });
65
+ }
66
+ async delete({ ids }) {
67
+ if (ids == undefined || ids == null) {
68
+ throw new common_1.BadRequestException("You must select at least one item to delete.");
69
+ }
70
+ return this.prismaService.category.deleteMany({
71
+ where: {
72
+ id: {
73
+ in: ids,
74
+ },
75
+ },
76
+ });
77
+ }
78
+ };
79
+ exports.CategoryService = CategoryService;
80
+ exports.CategoryService = CategoryService = __decorate([
81
+ (0, common_1.Injectable)(),
82
+ __param(0, (0, common_1.Inject)((0, common_1.forwardRef)(() => prisma_1.PrismaService))),
83
+ __param(1, (0, common_1.Inject)((0, common_1.forwardRef)(() => pagination_1.PaginationService))),
84
+ __metadata("design:paramtypes", [prisma_1.PrismaService,
85
+ pagination_1.PaginationService])
86
+ ], CategoryService);
87
+ //# sourceMappingURL=category.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"category.service.js","sourceRoot":"","sources":["../../src/category/category.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mDAAsE;AACtE,2CAA+C;AAC/C,2CAKwB;AAMjB,IAAM,eAAe,GAArB,MAAM,eAAe;IAC1B,YAEmB,aAA4B,EAE5B,iBAAoC;QAFpC,kBAAa,GAAb,aAAa,CAAe;QAE5B,sBAAiB,GAAjB,iBAAiB,CAAmB;IACpD,CAAC;IAEJ,KAAK,CAAC,IAAI,CAAC,MAAc,EAAE,gBAA+B;QACxD,MAAM,EAAE,GAAU,EAAE,CAAC;QAErB,MAAM,OAAO,GAAG;YACd,QAAQ,EAAE;gBACR,MAAM,EAAE;oBACN,EAAE,EAAE,IAAI;oBACR,eAAe,EAAE;wBACf,KAAK,EAAE;4BACL,MAAM,EAAE;gCACN,IAAI,EAAE,MAAM;6BACb;yBACF;wBACD,MAAM,EAAE;4BACN,IAAI,EAAE,IAAI;yBACX;qBACF;iBACF;aACF;SACF,CAAC;QAEF,OAAO,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CACpC,IAAI,CAAC,aAAa,CAAC,eAAe,EAClC,gBAAgB,EAChB;YACE,KAAK,EAAE;gBACL,EAAE;aACH;YACD,OAAO;SACR,EACD,iBAAiB,CAClB,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,UAAkB;QAC1B,OAAO,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,UAAU,CAAC;YAC5C,KAAK,EAAE,EAAE,EAAE,EAAE,UAAU,EAAE;SAC1B,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;YACb,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;AA5EY,0CAAe;0BAAf,eAAe;IAD3B,IAAA,mBAAU,GAAE;IAGR,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,sBAAa,CAAC,CAAC,CAAA;IAEvC,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,8BAAiB,CAAC,CAAC,CAAA;qCADZ,sBAAa;QAET,8BAAiB;GAL5C,eAAe,CA4E3B"}
@@ -0,0 +1,5 @@
1
+ import { WithLocaleDTO } from '@hedhog/admin';
2
+ export declare class CreateDTO extends WithLocaleDTO {
3
+ slug: string;
4
+ }
5
+ //# sourceMappingURL=create.dto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.dto.d.ts","sourceRoot":"","sources":["../../../src/category/dto/create.dto.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C,qBAAa,SAAU,SAAQ,aAAa;IAG1C,IAAI,EAAE,MAAM,CAAC;CACd"}
@@ -0,0 +1,23 @@
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 admin_1 = require("@hedhog/admin");
15
+ class CreateDTO extends admin_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
+ //# sourceMappingURL=create.dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.dto.js","sourceRoot":"","sources":["../../../src/category/dto/create.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAmD;AACnD,yCAA8C;AAE9C,MAAa,SAAU,SAAQ,qBAAa;CAI3C;AAJD,8BAIC;AADC;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,wBAAM,EAAC,CAAC,EAAE,GAAG,CAAC;;uCACF"}
@@ -0,0 +1,4 @@
1
+ export declare class DeleteDTO {
2
+ ids: number[];
3
+ }
4
+ //# sourceMappingURL=delete.dto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete.dto.d.ts","sourceRoot":"","sources":["../../../src/category/dto/delete.dto.ts"],"names":[],"mappings":"AAEA,qBAAa,SAAS;IAIpB,GAAG,EAAE,MAAM,EAAE,CAAC;CACf"}
@@ -0,0 +1,23 @@
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.DeleteDTO = void 0;
13
+ const class_validator_1 = require("class-validator");
14
+ class DeleteDTO {
15
+ }
16
+ exports.DeleteDTO = DeleteDTO;
17
+ __decorate([
18
+ (0, class_validator_1.IsArray)(),
19
+ (0, class_validator_1.ArrayMinSize)(1),
20
+ (0, class_validator_1.IsInt)({ each: true }),
21
+ __metadata("design:type", Array)
22
+ ], DeleteDTO.prototype, "ids", void 0);
23
+ //# sourceMappingURL=delete.dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete.dto.js","sourceRoot":"","sources":["../../../src/category/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,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/category/dto/update.dto.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;;AAEzC,qBAAa,SAAU,SAAQ,cAAsB;CAAG"}
@@ -0,0 +1,9 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update.dto.js","sourceRoot":"","sources":["../../../src/category/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,2 @@
1
+ export * from "./blog.module";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,18 @@
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("./blog.module"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B"}
@@ -0,0 +1,5 @@
1
+ export declare class CreateDTO {
2
+ title: string;
3
+ content: string;
4
+ }
5
+ //# sourceMappingURL=create.dto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.dto.d.ts","sourceRoot":"","sources":["../../../src/post/dto/create.dto.ts"],"names":[],"mappings":"AAEA,qBAAa,SAAS;IAGpB,KAAK,EAAE,MAAM,CAAC;IAGd,OAAO,EAAE,MAAM,CAAC;CACjB"}
@@ -0,0 +1,26 @@
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
+ class CreateDTO {
15
+ }
16
+ exports.CreateDTO = CreateDTO;
17
+ __decorate([
18
+ (0, class_validator_1.IsString)(),
19
+ (0, class_validator_1.Length)(0, 255),
20
+ __metadata("design:type", String)
21
+ ], CreateDTO.prototype, "title", void 0);
22
+ __decorate([
23
+ (0, class_validator_1.IsString)(),
24
+ __metadata("design:type", String)
25
+ ], CreateDTO.prototype, "content", void 0);
26
+ //# sourceMappingURL=create.dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.dto.js","sourceRoot":"","sources":["../../../src/post/dto/create.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAmD;AAEnD,MAAa,SAAS;CAOrB;AAPD,8BAOC;AAJC;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,wBAAM,EAAC,CAAC,EAAE,GAAG,CAAC;;wCACD;AAGd;IADC,IAAA,0BAAQ,GAAE;;0CACK"}
@@ -0,0 +1,4 @@
1
+ export declare class DeleteDTO {
2
+ ids: number[];
3
+ }
4
+ //# sourceMappingURL=delete.dto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete.dto.d.ts","sourceRoot":"","sources":["../../../src/post/dto/delete.dto.ts"],"names":[],"mappings":"AAEA,qBAAa,SAAS;IAIpB,GAAG,EAAE,MAAM,EAAE,CAAC;CACf"}
@@ -0,0 +1,23 @@
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.DeleteDTO = void 0;
13
+ const class_validator_1 = require("class-validator");
14
+ class DeleteDTO {
15
+ }
16
+ exports.DeleteDTO = DeleteDTO;
17
+ __decorate([
18
+ (0, class_validator_1.IsArray)(),
19
+ (0, class_validator_1.ArrayMinSize)(1),
20
+ (0, class_validator_1.IsInt)({ each: true }),
21
+ __metadata("design:type", Array)
22
+ ], DeleteDTO.prototype, "ids", void 0);
23
+ //# sourceMappingURL=delete.dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete.dto.js","sourceRoot":"","sources":["../../../src/post/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,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/post/dto/update.dto.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;;AAEzC,qBAAa,SAAU,SAAQ,cAAsB;CAAG"}
@@ -0,0 +1,9 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update.dto.js","sourceRoot":"","sources":["../../../src/post/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,14 @@
1
+ import { CreateDTO } from "./dto/create.dto";
2
+ import { DeleteDTO } from "./dto/delete.dto";
3
+ import { UpdateDTO } from "./dto/update.dto";
4
+ import { PostService } from "./post.service";
5
+ export declare class PostController {
6
+ private readonly postService;
7
+ constructor(postService: PostService);
8
+ list(paginationParams: any): Promise<import("@hedhog/pagination").PaginatedResult<unknown>>;
9
+ get(id: number): Promise<any>;
10
+ create(data: CreateDTO): Promise<any>;
11
+ update(id: number, data: UpdateDTO): Promise<any>;
12
+ delete(data: DeleteDTO): Promise<any>;
13
+ }
14
+ //# sourceMappingURL=post.controller.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"post.controller.d.ts","sourceRoot":"","sources":["../../src/post/post.controller.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG7C,qBAEa,cAAc;IAGvB,OAAO,CAAC,QAAQ,CAAC,WAAW;gBAAX,WAAW,EAAE,WAAW;IAIrC,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"}
@@ -0,0 +1,89 @@
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.PostController = void 0;
16
+ const pagination_1 = require("@hedhog/pagination");
17
+ const common_1 = require("@nestjs/common");
18
+ const create_dto_1 = require("./dto/create.dto");
19
+ const delete_dto_1 = require("./dto/delete.dto");
20
+ const update_dto_1 = require("./dto/update.dto");
21
+ const post_service_1 = require("./post.service");
22
+ const admin_1 = require("@hedhog/admin");
23
+ let PostController = class PostController {
24
+ constructor(postService) {
25
+ this.postService = postService;
26
+ }
27
+ async list(paginationParams) {
28
+ return this.postService.list(paginationParams);
29
+ }
30
+ async get(id) {
31
+ return this.postService.get(id);
32
+ }
33
+ async create(data) {
34
+ return this.postService.create(data);
35
+ }
36
+ async update(id, data) {
37
+ return this.postService.update({
38
+ id,
39
+ data,
40
+ });
41
+ }
42
+ async delete(data) {
43
+ return this.postService.delete(data);
44
+ }
45
+ };
46
+ exports.PostController = PostController;
47
+ __decorate([
48
+ (0, common_1.Get)(),
49
+ __param(0, (0, pagination_1.Pagination)()),
50
+ __metadata("design:type", Function),
51
+ __metadata("design:paramtypes", [Object]),
52
+ __metadata("design:returntype", Promise)
53
+ ], PostController.prototype, "list", null);
54
+ __decorate([
55
+ (0, common_1.Get)(":id"),
56
+ __param(0, (0, common_1.Param)("id", common_1.ParseIntPipe)),
57
+ __metadata("design:type", Function),
58
+ __metadata("design:paramtypes", [Number]),
59
+ __metadata("design:returntype", Promise)
60
+ ], PostController.prototype, "get", null);
61
+ __decorate([
62
+ (0, common_1.Post)(),
63
+ __param(0, (0, common_1.Body)()),
64
+ __metadata("design:type", Function),
65
+ __metadata("design:paramtypes", [create_dto_1.CreateDTO]),
66
+ __metadata("design:returntype", Promise)
67
+ ], PostController.prototype, "create", null);
68
+ __decorate([
69
+ (0, common_1.Patch)(":id"),
70
+ __param(0, (0, common_1.Param)("id", common_1.ParseIntPipe)),
71
+ __param(1, (0, common_1.Body)()),
72
+ __metadata("design:type", Function),
73
+ __metadata("design:paramtypes", [Number, update_dto_1.UpdateDTO]),
74
+ __metadata("design:returntype", Promise)
75
+ ], PostController.prototype, "update", null);
76
+ __decorate([
77
+ (0, common_1.Delete)(),
78
+ __param(0, (0, common_1.Body)()),
79
+ __metadata("design:type", Function),
80
+ __metadata("design:paramtypes", [delete_dto_1.DeleteDTO]),
81
+ __metadata("design:returntype", Promise)
82
+ ], PostController.prototype, "delete", null);
83
+ exports.PostController = PostController = __decorate([
84
+ (0, admin_1.Role)(),
85
+ (0, common_1.Controller)("post"),
86
+ __param(0, (0, common_1.Inject)((0, common_1.forwardRef)(() => post_service_1.PostService))),
87
+ __metadata("design:paramtypes", [post_service_1.PostService])
88
+ ], PostController);
89
+ //# sourceMappingURL=post.controller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"post.controller.js","sourceRoot":"","sources":["../../src/post/post.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mDAAgD;AAChD,2CAWwB;AACxB,iDAA6C;AAC7C,iDAA6C;AAC7C,iDAA6C;AAC7C,iDAA6C;AAC7C,yCAAqC;AAI9B,IAAM,cAAc,GAApB,MAAM,cAAc;IACzB,YAEmB,WAAwB;QAAxB,gBAAW,GAAX,WAAW,CAAa;IACxC,CAAC;IAGE,AAAN,KAAK,CAAC,IAAI,CAAe,gBAAgB;QACvC,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IACjD,CAAC;IAGK,AAAN,KAAK,CAAC,GAAG,CAA4B,EAAU;QAC7C,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAClC,CAAC;IAGK,AAAN,KAAK,CAAC,MAAM,CAAS,IAAe;QAClC,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC;IAGK,AAAN,KAAK,CAAC,MAAM,CAA4B,EAAU,EAAU,IAAe;QACzE,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC;YAC7B,EAAE;YACF,IAAI;SACL,CAAC,CAAC;IACL,CAAC;IAGK,AAAN,KAAK,CAAC,MAAM,CAAS,IAAe;QAClC,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC;CACF,CAAA;AAjCY,wCAAc;AAOnB;IADL,IAAA,YAAG,GAAE;IACM,WAAA,IAAA,uBAAU,GAAE,CAAA;;;;0CAEvB;AAGK;IADL,IAAA,YAAG,EAAC,KAAK,CAAC;IACA,WAAA,IAAA,cAAK,EAAC,IAAI,EAAE,qBAAY,CAAC,CAAA;;;;yCAEnC;AAGK;IADL,IAAA,aAAI,GAAE;IACO,WAAA,IAAA,aAAI,GAAE,CAAA;;qCAAO,sBAAS;;4CAEnC;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;;4CAK1E;AAGK;IADL,IAAA,eAAM,GAAE;IACK,WAAA,IAAA,aAAI,GAAE,CAAA;;qCAAO,sBAAS;;4CAEnC;yBAhCU,cAAc;IAF1B,IAAA,YAAI,GAAE;IACN,IAAA,mBAAU,EAAC,MAAM,CAAC;IAGd,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,0BAAW,CAAC,CAAC,CAAA;qCACR,0BAAW;GAHhC,cAAc,CAiC1B"}
@@ -0,0 +1,3 @@
1
+ export declare class PostModule {
2
+ }
3
+ //# sourceMappingURL=post.module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"post.module.d.ts","sourceRoot":"","sources":["../../src/post/post.module.ts"],"names":[],"mappings":"AAMA,qBAUa,UAAU;CAAG"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.PostModule = void 0;
10
+ const admin_1 = require("@hedhog/admin");
11
+ const pagination_1 = require("@hedhog/pagination");
12
+ const prisma_1 = require("@hedhog/prisma");
13
+ const common_1 = require("@nestjs/common");
14
+ const post_service_1 = require("./post.service");
15
+ const post_controller_1 = require("./post.controller");
16
+ let PostModule = class PostModule {
17
+ };
18
+ exports.PostModule = PostModule;
19
+ exports.PostModule = PostModule = __decorate([
20
+ (0, common_1.Module)({
21
+ imports: [
22
+ (0, common_1.forwardRef)(() => admin_1.AdminModule),
23
+ (0, common_1.forwardRef)(() => prisma_1.PrismaModule),
24
+ (0, common_1.forwardRef)(() => pagination_1.PaginationModule),
25
+ ],
26
+ controllers: [post_controller_1.PostController],
27
+ providers: [post_service_1.PostService],
28
+ exports: [post_service_1.PostService],
29
+ })
30
+ ], PostModule);
31
+ //# sourceMappingURL=post.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"post.module.js","sourceRoot":"","sources":["../../src/post/post.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,yCAA4C;AAC5C,mDAAsD;AACtD,2CAA8C;AAC9C,2CAAoD;AACpD,iDAA6C;AAC7C,uDAAmD;AAW5C,IAAM,UAAU,GAAhB,MAAM,UAAU;CAAG,CAAA;AAAb,gCAAU;qBAAV,UAAU;IAVtB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,mBAAW,CAAC;YAC7B,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,qBAAY,CAAC;YAC9B,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,6BAAgB,CAAC;SACnC;QACD,WAAW,EAAE,CAAC,gCAAc,CAAC;QAC7B,SAAS,EAAE,CAAC,0BAAW,CAAC;QACxB,OAAO,EAAE,CAAC,0BAAW,CAAC;KACvB,CAAC;GACW,UAAU,CAAG"}
@@ -0,0 +1,19 @@
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 PostService {
7
+ private readonly prismaService;
8
+ private readonly paginationService;
9
+ constructor(prismaService: PrismaService, paginationService: PaginationService);
10
+ list(paginationParams: PaginationDTO): Promise<import("@hedhog/pagination").PaginatedResult<unknown>>;
11
+ get(postId: number): Promise<any>;
12
+ create(data: CreateDTO): Promise<any>;
13
+ update({ id, data }: {
14
+ id: number;
15
+ data: UpdateDTO;
16
+ }): Promise<any>;
17
+ delete({ ids }: DeleteDTO): Promise<any>;
18
+ }
19
+ //# sourceMappingURL=post.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"post.service.d.ts","sourceRoot":"","sources":["../../src/post/post.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,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,qBACa,WAAW;IAGpB,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;IAkBpC,GAAG,CAAC,MAAM,EAAE,MAAM;IAMlB,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;CAehC"}
@@ -0,0 +1,72 @@
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.PostService = void 0;
16
+ const pagination_1 = require("@hedhog/pagination");
17
+ const prisma_1 = require("@hedhog/prisma");
18
+ const common_1 = require("@nestjs/common");
19
+ let PostService = class PostService {
20
+ constructor(prismaService, paginationService) {
21
+ this.prismaService = prismaService;
22
+ this.paginationService = paginationService;
23
+ }
24
+ async list(paginationParams) {
25
+ const OR = [];
26
+ if (!isNaN(+paginationParams.search)) {
27
+ OR.push({ id: { equals: +paginationParams.search } });
28
+ }
29
+ return this.paginationService.paginate(this.prismaService.post, paginationParams, {
30
+ where: {
31
+ OR,
32
+ },
33
+ });
34
+ }
35
+ async get(postId) {
36
+ return this.prismaService.post.findUnique({
37
+ where: { id: postId },
38
+ });
39
+ }
40
+ async create(data) {
41
+ return this.prismaService.post.create({
42
+ data,
43
+ });
44
+ }
45
+ async update({ id, data }) {
46
+ return this.prismaService.post.update({
47
+ where: { id },
48
+ data,
49
+ });
50
+ }
51
+ async delete({ ids }) {
52
+ if (ids == undefined || ids == null) {
53
+ throw new common_1.BadRequestException("You must select at least one item to delete.");
54
+ }
55
+ return this.prismaService.post.deleteMany({
56
+ where: {
57
+ id: {
58
+ in: ids,
59
+ },
60
+ },
61
+ });
62
+ }
63
+ };
64
+ exports.PostService = PostService;
65
+ exports.PostService = PostService = __decorate([
66
+ (0, common_1.Injectable)(),
67
+ __param(0, (0, common_1.Inject)((0, common_1.forwardRef)(() => prisma_1.PrismaService))),
68
+ __param(1, (0, common_1.Inject)((0, common_1.forwardRef)(() => pagination_1.PaginationService))),
69
+ __metadata("design:paramtypes", [prisma_1.PrismaService,
70
+ pagination_1.PaginationService])
71
+ ], PostService);
72
+ //# sourceMappingURL=post.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"post.service.js","sourceRoot":"","sources":["../../src/post/post.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mDAAsE;AACtE,2CAA+C;AAC/C,2CAKwB;AAMjB,IAAM,WAAW,GAAjB,MAAM,WAAW;IACtB,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,EAAE,GAAU,EAAE,CAAC;QAErB,IAAI,CAAC,KAAK,CAAC,CAAC,gBAAgB,CAAC,MAAM,CAAC,EAAE,CAAC;YACrC,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,IAAI,EACvB,gBAAgB,EAChB;YACE,KAAK,EAAE;gBACL,EAAE;aACH;SACF,CACF,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,MAAc;QACtB,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,UAAU,CAAC;YACxC,KAAK,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE;SACtB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,IAAe;QAC1B,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC;YACpC,IAAI;SACL,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,IAAI,EAAmC;QACxD,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC;YACpC,KAAK,EAAE,EAAE,EAAE,EAAE;YACb,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,IAAI,CAAC,UAAU,CAAC;YACxC,KAAK,EAAE;gBACL,EAAE,EAAE;oBACF,EAAE,EAAE,GAAG;iBACR;aACF;SACF,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AA5DY,kCAAW;sBAAX,WAAW;IADvB,IAAA,mBAAU,GAAE;IAGR,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,sBAAa,CAAC,CAAC,CAAA;IAEvC,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,8BAAiB,CAAC,CAAC,CAAA;qCADZ,sBAAa;QAET,8BAAiB;GAL5C,WAAW,CA4DvB"}
@@ -0,0 +1,9 @@
1
+ import { Author } from "@/types/models";
2
+ export type AuthorCreatePanelRef = {
3
+ submit: () => void;
4
+ };
5
+ export type AuthorCreatePanelProps = {
6
+ onCreated?: (data: Author) => void;
7
+ };
8
+ export declare const AuthorCreatePanel: any;
9
+ //# sourceMappingURL=create-panel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-panel.d.ts","sourceRoot":"","sources":["create-panel.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAIxC,MAAM,MAAM,oBAAoB,GAAG;IACjC,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC,CAAC;AAEF,eAAO,MAAM,iBAAiB,KA4C7B,CAAC"}