@vitnode/blog 1.2.0-canary.76 → 1.2.0-canary.77

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (194) hide show
  1. package/dist/src/api/lib/categories-language.d.ts +10 -0
  2. package/dist/src/api/lib/categories-language.d.ts.map +1 -0
  3. package/dist/src/api/lib/categories-language.js +1 -0
  4. package/dist/src/api/lib/events.d.ts +28 -0
  5. package/dist/src/api/lib/events.d.ts.map +1 -0
  6. package/dist/src/api/lib/events.js +1 -0
  7. package/dist/src/api/lib/posts-language.d.ts +17 -0
  8. package/dist/src/api/lib/posts-language.d.ts.map +1 -0
  9. package/dist/src/api/lib/posts-language.js +1 -0
  10. package/dist/src/api/lib/search.d.ts +13 -0
  11. package/dist/src/api/lib/search.d.ts.map +1 -0
  12. package/dist/src/api/lib/search.js +1 -0
  13. package/dist/src/api/modules/admin/admin.module.d.ts +197 -180
  14. package/dist/src/api/modules/admin/admin.module.d.ts.map +1 -1
  15. package/dist/src/api/modules/admin/admin.module.js +1 -2
  16. package/dist/src/api/modules/admin/categories/categories.admin.module.d.ts +83 -80
  17. package/dist/src/api/modules/admin/categories/categories.admin.module.d.ts.map +1 -1
  18. package/dist/src/api/modules/admin/categories/categories.admin.module.js +1 -2
  19. package/dist/src/api/modules/admin/categories/routes/create.route.d.ts +38 -34
  20. package/dist/src/api/modules/admin/categories/routes/create.route.d.ts.map +1 -1
  21. package/dist/src/api/modules/admin/categories/routes/create.route.js +1 -2
  22. package/dist/src/api/modules/admin/categories/routes/delete.route.d.ts +15 -18
  23. package/dist/src/api/modules/admin/categories/routes/delete.route.d.ts.map +1 -1
  24. package/dist/src/api/modules/admin/categories/routes/delete.route.js +1 -2
  25. package/dist/src/api/modules/admin/categories/routes/edit.route.d.ts +38 -38
  26. package/dist/src/api/modules/admin/categories/routes/edit.route.d.ts.map +1 -1
  27. package/dist/src/api/modules/admin/categories/routes/edit.route.js +1 -2
  28. package/dist/src/api/modules/admin/posts/posts.admin.module.d.ts +104 -93
  29. package/dist/src/api/modules/admin/posts/posts.admin.module.d.ts.map +1 -1
  30. package/dist/src/api/modules/admin/posts/posts.admin.module.js +1 -2
  31. package/dist/src/api/modules/admin/posts/routes/create.route.d.ts +58 -44
  32. package/dist/src/api/modules/admin/posts/routes/create.route.d.ts.map +1 -1
  33. package/dist/src/api/modules/admin/posts/routes/create.route.js +1 -2
  34. package/dist/src/api/modules/admin/posts/routes/delete.route.d.ts +15 -18
  35. package/dist/src/api/modules/admin/posts/routes/delete.route.d.ts.map +1 -1
  36. package/dist/src/api/modules/admin/posts/routes/delete.route.js +1 -2
  37. package/dist/src/api/modules/admin/posts/routes/edit.route.d.ts +47 -43
  38. package/dist/src/api/modules/admin/posts/routes/edit.route.d.ts.map +1 -1
  39. package/dist/src/api/modules/admin/posts/routes/edit.route.js +1 -2
  40. package/dist/src/api/modules/categories/categories.module.d.ts +65 -64
  41. package/dist/src/api/modules/categories/categories.module.d.ts.map +1 -1
  42. package/dist/src/api/modules/categories/categories.module.js +1 -2
  43. package/dist/src/api/modules/categories/routes/get.route.d.ts +56 -45
  44. package/dist/src/api/modules/categories/routes/get.route.d.ts.map +1 -1
  45. package/dist/src/api/modules/categories/routes/get.route.js +1 -2
  46. package/dist/src/api/modules/categories/test.route.d.ts +20 -23
  47. package/dist/src/api/modules/categories/test.route.d.ts.map +1 -1
  48. package/dist/src/api/modules/categories/test.route.js +1 -2
  49. package/dist/src/api/modules/posts/posts.module.d.ts +68 -54
  50. package/dist/src/api/modules/posts/posts.module.d.ts.map +1 -1
  51. package/dist/src/api/modules/posts/posts.module.js +1 -2
  52. package/dist/src/api/modules/posts/routes/get.route.d.ts +97 -66
  53. package/dist/src/api/modules/posts/routes/get.route.d.ts.map +1 -1
  54. package/dist/src/api/modules/posts/routes/get.route.js +1 -2
  55. package/dist/src/config.api.d.ts +1 -4
  56. package/dist/src/config.api.d.ts.map +1 -1
  57. package/dist/src/config.api.js +1 -2
  58. package/dist/src/config.d.ts +1 -4
  59. package/dist/src/config.d.ts.map +1 -1
  60. package/dist/src/config.js +1 -2
  61. package/dist/src/const.d.ts +2 -5
  62. package/dist/src/const.d.ts.map +1 -1
  63. package/dist/src/const.js +1 -2
  64. package/dist/src/database/categories.d.ts +76 -98
  65. package/dist/src/database/categories.d.ts.map +1 -1
  66. package/dist/src/database/categories.js +1 -2
  67. package/dist/src/database/index.d.ts +4 -4
  68. package/dist/src/database/index.d.ts.map +1 -0
  69. package/dist/src/database/index.js +1 -1
  70. package/dist/src/database/posts.d.ts +91 -132
  71. package/dist/src/database/posts.d.ts.map +1 -1
  72. package/dist/src/database/posts.js +1 -2
  73. package/dist/src/database/relations.d.ts +4 -7
  74. package/dist/src/database/relations.d.ts.map +1 -1
  75. package/dist/src/database/relations.js +1 -2
  76. package/dist/src/emails/test-template.d.ts +18 -20
  77. package/dist/src/emails/test-template.d.ts.map +1 -1
  78. package/dist/src/emails/test-template.js +1 -2
  79. package/dist/src/globals.css +44 -0
  80. package/dist/src/locales/en.json +92 -0
  81. package/dist/src/locales/index.d.ts +4 -0
  82. package/dist/src/locales/index.d.ts.map +1 -0
  83. package/dist/src/locales/index.js +1 -0
  84. package/dist/src/routes/admin/blog/categories/page.d.ts +5 -7
  85. package/dist/src/routes/admin/blog/categories/page.d.ts.map +1 -1
  86. package/dist/src/routes/admin/blog/categories/page.js +1 -2
  87. package/dist/src/routes/admin/blog/posts/page.d.ts +5 -7
  88. package/dist/src/routes/admin/blog/posts/page.d.ts.map +1 -1
  89. package/dist/src/routes/admin/blog/posts/page.js +1 -2
  90. package/dist/src/routes/breadcrumb/admin/blog/categories/page.d.ts +2 -0
  91. package/dist/src/routes/breadcrumb/admin/blog/categories/page.d.ts.map +1 -0
  92. package/dist/src/routes/breadcrumb/admin/blog/categories/page.js +1 -0
  93. package/dist/src/routes/breadcrumb/admin/blog/posts/page.d.ts +2 -0
  94. package/dist/src/routes/breadcrumb/admin/blog/posts/page.d.ts.map +1 -0
  95. package/dist/src/routes/breadcrumb/admin/blog/posts/page.js +1 -0
  96. package/dist/src/views/admin/categories/actions/actions.d.ts +1 -4
  97. package/dist/src/views/admin/categories/actions/actions.d.ts.map +1 -1
  98. package/dist/src/views/admin/categories/actions/actions.js +1 -2
  99. package/dist/src/views/admin/categories/actions/create-edit/create-edit.d.ts +5 -8
  100. package/dist/src/views/admin/categories/actions/create-edit/create-edit.d.ts.map +1 -1
  101. package/dist/src/views/admin/categories/actions/create-edit/create-edit.js +1 -2
  102. package/dist/src/views/admin/categories/actions/create-edit/mutation-api.server.d.ts +11 -0
  103. package/dist/src/views/admin/categories/actions/create-edit/mutation-api.server.d.ts.map +1 -0
  104. package/dist/src/views/admin/categories/actions/create-edit/mutation-api.server.js +1 -0
  105. package/dist/src/views/admin/categories/table/actions/delete/delete-action.d.ts +3 -6
  106. package/dist/src/views/admin/categories/table/actions/delete/delete-action.d.ts.map +1 -1
  107. package/dist/src/views/admin/categories/table/actions/delete/delete-action.js +1 -2
  108. package/dist/src/views/admin/categories/table/actions/delete/mutation-api.server.d.ts +4 -0
  109. package/dist/src/views/admin/categories/table/actions/delete/mutation-api.server.d.ts.map +1 -0
  110. package/dist/src/views/admin/categories/table/actions/delete/mutation-api.server.js +1 -0
  111. package/dist/src/views/admin/categories/table/actions/edit-action.d.ts +5 -8
  112. package/dist/src/views/admin/categories/table/actions/edit-action.d.ts.map +1 -1
  113. package/dist/src/views/admin/categories/table/actions/edit-action.js +1 -2
  114. package/dist/src/views/admin/categories/table/categories-admin-view.d.ts +2 -5
  115. package/dist/src/views/admin/categories/table/categories-admin-view.d.ts.map +1 -1
  116. package/dist/src/views/admin/categories/table/categories-admin-view.js +1 -2
  117. package/dist/src/views/admin/posts/actions/actions.d.ts +1 -4
  118. package/dist/src/views/admin/posts/actions/actions.d.ts.map +1 -1
  119. package/dist/src/views/admin/posts/actions/actions.js +1 -2
  120. package/dist/src/views/admin/posts/actions/create-edit/create-edit.d.ts +7 -9
  121. package/dist/src/views/admin/posts/actions/create-edit/create-edit.d.ts.map +1 -1
  122. package/dist/src/views/admin/posts/actions/create-edit/create-edit.js +1 -2
  123. package/dist/src/views/admin/posts/actions/create-edit/multi-lang-fields.d.ts +10 -0
  124. package/dist/src/views/admin/posts/actions/create-edit/multi-lang-fields.d.ts.map +1 -0
  125. package/dist/src/views/admin/posts/actions/create-edit/multi-lang-fields.js +1 -0
  126. package/dist/src/views/admin/posts/actions/create-edit/mutation-api.server.d.ts +11 -0
  127. package/dist/src/views/admin/posts/actions/create-edit/mutation-api.server.d.ts.map +1 -0
  128. package/dist/src/views/admin/posts/actions/create-edit/mutation-api.server.js +1 -0
  129. package/dist/src/views/admin/posts/table/actions/delete/delete-action.d.ts +3 -6
  130. package/dist/src/views/admin/posts/table/actions/delete/delete-action.d.ts.map +1 -1
  131. package/dist/src/views/admin/posts/table/actions/delete/delete-action.js +1 -2
  132. package/dist/src/views/admin/posts/table/actions/delete/mutation-api.server.d.ts +4 -0
  133. package/dist/src/views/admin/posts/table/actions/delete/mutation-api.server.d.ts.map +1 -0
  134. package/dist/src/views/admin/posts/table/actions/delete/mutation-api.server.js +1 -0
  135. package/dist/src/views/admin/posts/table/actions/edit-action.d.ts +5 -8
  136. package/dist/src/views/admin/posts/table/actions/edit-action.d.ts.map +1 -1
  137. package/dist/src/views/admin/posts/table/actions/edit-action.js +1 -2
  138. package/dist/src/views/admin/posts/table/posts-admin-view.d.ts +2 -5
  139. package/dist/src/views/admin/posts/table/posts-admin-view.d.ts.map +1 -1
  140. package/dist/src/views/admin/posts/table/posts-admin-view.js +1 -2
  141. package/package.json +20 -18
  142. package/src/locales/en.json +17 -5
  143. package/src/locales/index.ts +11 -0
  144. package/src/routes/breadcrumb/admin/blog/categories/page.tsx +5 -0
  145. package/src/routes/breadcrumb/admin/blog/posts/page.tsx +5 -0
  146. package/dist/src/api/modules/admin/admin.module.js.map +0 -1
  147. package/dist/src/api/modules/admin/categories/categories.admin.module.js.map +0 -1
  148. package/dist/src/api/modules/admin/categories/routes/create.route.js.map +0 -1
  149. package/dist/src/api/modules/admin/categories/routes/delete.route.js.map +0 -1
  150. package/dist/src/api/modules/admin/categories/routes/edit.route.js.map +0 -1
  151. package/dist/src/api/modules/admin/posts/posts.admin.module.js.map +0 -1
  152. package/dist/src/api/modules/admin/posts/routes/create.route.js.map +0 -1
  153. package/dist/src/api/modules/admin/posts/routes/delete.route.js.map +0 -1
  154. package/dist/src/api/modules/admin/posts/routes/edit.route.js.map +0 -1
  155. package/dist/src/api/modules/categories/categories.module.js.map +0 -1
  156. package/dist/src/api/modules/categories/routes/get.route.js.map +0 -1
  157. package/dist/src/api/modules/categories/test.route.js.map +0 -1
  158. package/dist/src/api/modules/posts/posts.module.js.map +0 -1
  159. package/dist/src/api/modules/posts/routes/get.route.js.map +0 -1
  160. package/dist/src/config.api.js.map +0 -1
  161. package/dist/src/config.js.map +0 -1
  162. package/dist/src/const.js.map +0 -1
  163. package/dist/src/database/categories.js.map +0 -1
  164. package/dist/src/database/posts.js.map +0 -1
  165. package/dist/src/database/relations.js.map +0 -1
  166. package/dist/src/emails/test-template.js.map +0 -1
  167. package/dist/src/routes/admin/blog/categories/page.js.map +0 -1
  168. package/dist/src/routes/admin/blog/posts/page.js.map +0 -1
  169. package/dist/src/views/admin/categories/actions/actions.js.map +0 -1
  170. package/dist/src/views/admin/categories/actions/create-edit/create-edit.js.map +0 -1
  171. package/dist/src/views/admin/categories/actions/create-edit/mutation-api.d.ts +0 -14
  172. package/dist/src/views/admin/categories/actions/create-edit/mutation-api.d.ts.map +0 -1
  173. package/dist/src/views/admin/categories/actions/create-edit/mutation-api.js +0 -2
  174. package/dist/src/views/admin/categories/actions/create-edit/mutation-api.js.map +0 -1
  175. package/dist/src/views/admin/categories/table/actions/delete/delete-action.js.map +0 -1
  176. package/dist/src/views/admin/categories/table/actions/delete/mutation-api.d.ts +0 -7
  177. package/dist/src/views/admin/categories/table/actions/delete/mutation-api.d.ts.map +0 -1
  178. package/dist/src/views/admin/categories/table/actions/delete/mutation-api.js +0 -2
  179. package/dist/src/views/admin/categories/table/actions/delete/mutation-api.js.map +0 -1
  180. package/dist/src/views/admin/categories/table/actions/edit-action.js.map +0 -1
  181. package/dist/src/views/admin/categories/table/categories-admin-view.js.map +0 -1
  182. package/dist/src/views/admin/posts/actions/actions.js.map +0 -1
  183. package/dist/src/views/admin/posts/actions/create-edit/create-edit.js.map +0 -1
  184. package/dist/src/views/admin/posts/actions/create-edit/mutation-api.d.ts +0 -14
  185. package/dist/src/views/admin/posts/actions/create-edit/mutation-api.d.ts.map +0 -1
  186. package/dist/src/views/admin/posts/actions/create-edit/mutation-api.js +0 -2
  187. package/dist/src/views/admin/posts/actions/create-edit/mutation-api.js.map +0 -1
  188. package/dist/src/views/admin/posts/table/actions/delete/delete-action.js.map +0 -1
  189. package/dist/src/views/admin/posts/table/actions/delete/mutation-api.d.ts +0 -7
  190. package/dist/src/views/admin/posts/table/actions/delete/mutation-api.d.ts.map +0 -1
  191. package/dist/src/views/admin/posts/table/actions/delete/mutation-api.js +0 -2
  192. package/dist/src/views/admin/posts/table/actions/delete/mutation-api.js.map +0 -1
  193. package/dist/src/views/admin/posts/table/actions/edit-action.js.map +0 -1
  194. package/dist/src/views/admin/posts/table/posts-admin-view.js.map +0 -1
@@ -1,97 +1,100 @@
1
- //#region src/api/modules/admin/categories/categories.admin.module.d.ts
2
- declare const categoriesAdminModule: import("@vitnode/core/api/lib/module").BuildModuleReturn<"@vitnode/blog", "categories", [import("@vitnode/core/api/lib/route").Route<"@vitnode/blog", {
3
- method: "post";
4
- path: "/";
5
- request: {
6
- body: {
7
- content: {
8
- "application/json": {
9
- schema: import("zod").ZodObject<{
10
- title: import("zod").ZodString;
11
- }, import("zod/v4/core").$strip>;
1
+ export declare const categoriesAdminModule: import("@vitnode/core/api/lib/module").BuildModuleReturn<"@vitnode/blog", "categories", [import("@vitnode/core/api/lib/route").Route<"@vitnode/blog", {
2
+ method: "post";
3
+ path: "/";
4
+ request: {
5
+ body: {
6
+ content: {
7
+ "application/json": {
8
+ schema: import("zod").ZodObject<{
9
+ title: import("zod").ZodArray<import("zod").ZodObject<{
10
+ languageCode: import("zod").ZodString;
11
+ value: import("zod").ZodString;
12
+ }, import("zod/v4/core").$strip>>;
13
+ color: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
14
+ }, import("zod/v4/core").$strip>;
15
+ };
16
+ };
12
17
  };
13
- };
14
18
  };
15
- };
16
- responses: {
17
- 201: {
18
- content: {
19
- "application/json": {
20
- schema: import("zod").ZodObject<{
21
- id: import("zod").ZodNumber;
22
- title: import("zod").ZodString;
23
- createdAt: import("zod").ZodDate;
24
- updatedAt: import("zod").ZodDate;
25
- }, import("zod/v4/core").$strip>;
19
+ responses: {
20
+ 201: {
21
+ content: {
22
+ "application/json": {
23
+ schema: import("zod").ZodObject<{
24
+ id: import("zod").ZodNumber;
25
+ createdAt: import("zod").ZodDate;
26
+ updatedAt: import("zod").ZodDate;
27
+ }, import("zod/v4/core").$strip>;
28
+ };
29
+ };
30
+ description: string;
31
+ };
32
+ 400: {
33
+ description: string;
26
34
  };
27
- };
28
- description: string;
29
- };
30
- 400: {
31
- description: string;
32
35
  };
33
- };
34
36
  } & {
35
- path: string;
37
+ path: string;
36
38
  }>, import("@vitnode/core/api/lib/route").Route<"@vitnode/blog", {
37
- method: "put";
38
- path: "/{id}";
39
- request: {
40
- params: import("zod").ZodObject<{
41
- id: import("zod").ZodPipe<import("zod").ZodString, import("zod").ZodTransform<number, string>>;
42
- }, import("zod/v4/core").$strip>;
43
- body: {
44
- content: {
45
- "application/json": {
46
- schema: import("zod").ZodObject<{
47
- title: import("zod").ZodString;
48
- }, import("zod/v4/core").$strip>;
39
+ method: "put";
40
+ path: "/{id}";
41
+ request: {
42
+ params: import("zod").ZodObject<{
43
+ id: import("zod").ZodPipe<import("zod").ZodString, import("zod").ZodTransform<number, string>>;
44
+ }, import("zod/v4/core").$strip>;
45
+ body: {
46
+ content: {
47
+ "application/json": {
48
+ schema: import("zod").ZodObject<{
49
+ title: import("zod").ZodArray<import("zod").ZodObject<{
50
+ languageCode: import("zod").ZodString;
51
+ value: import("zod").ZodString;
52
+ }, import("zod/v4/core").$strip>>;
53
+ color: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
54
+ }, import("zod/v4/core").$strip>;
55
+ };
56
+ };
49
57
  };
50
- };
51
58
  };
52
- };
53
- responses: {
54
- 200: {
55
- content: {
56
- "application/json": {
57
- schema: import("zod").ZodObject<{
58
- id: import("zod").ZodNumber;
59
- title: import("zod").ZodString;
60
- createdAt: import("zod").ZodDate;
61
- updatedAt: import("zod").ZodDate;
62
- }, import("zod/v4/core").$strip>;
59
+ responses: {
60
+ 200: {
61
+ content: {
62
+ "application/json": {
63
+ schema: import("zod").ZodObject<{
64
+ id: import("zod").ZodNumber;
65
+ createdAt: import("zod").ZodDate;
66
+ updatedAt: import("zod").ZodDate;
67
+ }, import("zod/v4/core").$strip>;
68
+ };
69
+ };
70
+ description: string;
71
+ };
72
+ 400: {
73
+ description: string;
74
+ };
75
+ 404: {
76
+ description: string;
63
77
  };
64
- };
65
- description: string;
66
- };
67
- 400: {
68
- description: string;
69
- };
70
- 404: {
71
- description: string;
72
78
  };
73
- };
74
79
  } & {
75
- path: string;
80
+ path: string;
76
81
  }>, import("@vitnode/core/api/lib/route").Route<"@vitnode/blog", {
77
- method: "delete";
78
- path: "/{id}";
79
- request: {
80
- params: import("zod").ZodObject<{
81
- id: import("zod").ZodPipe<import("zod").ZodString, import("zod").ZodTransform<number, string>>;
82
- }, import("zod/v4/core").$strip>;
83
- };
84
- responses: {
85
- 204: {
86
- description: string;
82
+ method: "delete";
83
+ path: "/{id}";
84
+ request: {
85
+ params: import("zod").ZodObject<{
86
+ id: import("zod").ZodPipe<import("zod").ZodString, import("zod").ZodTransform<number, string>>;
87
+ }, import("zod/v4/core").$strip>;
87
88
  };
88
- 404: {
89
- description: string;
89
+ responses: {
90
+ 204: {
91
+ description: string;
92
+ };
93
+ 404: {
94
+ description: string;
95
+ };
90
96
  };
91
- };
92
97
  } & {
93
- path: string;
98
+ path: string;
94
99
  }>], import("@vitnode/core/api/lib/module").BaseBuildModuleReturn<"@vitnode/blog", string, import("@vitnode/core/api/lib/route").Route<"@vitnode/blog", import("@hono/zod-openapi").RouteConfig>[]>[]>;
95
- //#endregion
96
- export { categoriesAdminModule };
97
100
  //# sourceMappingURL=categories.admin.module.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"categories.admin.module.d.ts","names":[],"sources":["../../../../../../src/api/modules/admin/categories/categories.admin.module.ts"],"mappings":";cAOa,8DAAqB,wFAAA"}
1
+ {"version":3,"file":"categories.admin.module.d.ts","sourceRoot":"","sources":["../../../../../../src/api/modules/admin/categories/categories.admin.module.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sMAIhC,CAAC"}
@@ -1,2 +1 @@
1
- import{CONFIG_PLUGIN as e}from"../../../../const.js";import{createCategoryRoute as t}from"./routes/create.route.js";import{deleteCategoryRoute as n}from"./routes/delete.route.js";import{editCategoryRoute as r}from"./routes/edit.route.js";import{buildModule as i}from"@vitnode/core/api/lib/module";const a=i({pluginId:e.pluginId,name:`categories`,routes:[t,r,n]});export{a as categoriesAdminModule};
2
- //# sourceMappingURL=categories.admin.module.js.map
1
+ import{buildModule}from"@vitnode/core/api/lib/module";import{CONFIG_PLUGIN}from"../../../../const.js";import{createCategoryRoute}from"./routes/create.route.js";import{deleteCategoryRoute}from"./routes/delete.route.js";import{editCategoryRoute}from"./routes/edit.route.js";export const categoriesAdminModule=buildModule({pluginId:CONFIG_PLUGIN.pluginId,name:"categories",routes:[createCategoryRoute,editCategoryRoute,deleteCategoryRoute]});
@@ -1,43 +1,47 @@
1
1
  import { z } from "@hono/zod-openapi";
2
- //#region src/api/modules/admin/categories/routes/create.route.d.ts
3
- declare const zodCreateCategorySchema: z.ZodObject<{
4
- title: z.ZodString;
2
+ export declare const zodCreateCategorySchema: z.ZodObject<{
3
+ title: z.ZodArray<z.ZodObject<{
4
+ languageCode: z.ZodString;
5
+ value: z.ZodString;
6
+ }, z.core.$strip>>;
7
+ color: z.ZodOptional<z.ZodNullable<z.ZodString>>;
5
8
  }, z.core.$strip>;
6
- declare const createCategoryRoute: import("@vitnode/core/api/lib/route").Route<"@vitnode/blog", {
7
- method: "post";
8
- path: "/";
9
- request: {
10
- body: {
11
- content: {
12
- "application/json": {
13
- schema: z.ZodObject<{
14
- title: z.ZodString;
15
- }, z.core.$strip>;
9
+ export declare const createCategoryRoute: import("@vitnode/core/api/lib/route").Route<"@vitnode/blog", {
10
+ method: "post";
11
+ path: "/";
12
+ request: {
13
+ body: {
14
+ content: {
15
+ "application/json": {
16
+ schema: z.ZodObject<{
17
+ title: z.ZodArray<z.ZodObject<{
18
+ languageCode: z.ZodString;
19
+ value: z.ZodString;
20
+ }, z.core.$strip>>;
21
+ color: z.ZodOptional<z.ZodNullable<z.ZodString>>;
22
+ }, z.core.$strip>;
23
+ };
24
+ };
16
25
  };
17
- };
18
26
  };
19
- };
20
- responses: {
21
- 201: {
22
- content: {
23
- "application/json": {
24
- schema: z.ZodObject<{
25
- id: z.ZodNumber;
26
- title: z.ZodString;
27
- createdAt: z.ZodDate;
28
- updatedAt: z.ZodDate;
29
- }, z.core.$strip>;
27
+ responses: {
28
+ 201: {
29
+ content: {
30
+ "application/json": {
31
+ schema: z.ZodObject<{
32
+ id: z.ZodNumber;
33
+ createdAt: z.ZodDate;
34
+ updatedAt: z.ZodDate;
35
+ }, z.core.$strip>;
36
+ };
37
+ };
38
+ description: string;
39
+ };
40
+ 400: {
41
+ description: string;
30
42
  };
31
- };
32
- description: string;
33
- };
34
- 400: {
35
- description: string;
36
43
  };
37
- };
38
44
  } & {
39
- path: string;
45
+ path: string;
40
46
  }>;
41
- //#endregion
42
- export { createCategoryRoute, zodCreateCategorySchema };
43
47
  //# sourceMappingURL=create.route.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"create.route.d.ts","names":[],"sources":["../../../../../../../src/api/modules/admin/categories/routes/create.route.ts"],"mappings":";;cAgBa,yBAAuB,EAAA;;;cAIvB,2DAAmB"}
1
+ {"version":3,"file":"create.route.d.ts","sourceRoot":"","sources":["../../../../../../../src/api/modules/admin/categories/routes/create.route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAetC,eAAO,MAAM,uBAAuB;;;;;;iBAGlC,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+C9B,CAAC"}
@@ -1,2 +1 @@
1
- import{CONFIG_PLUGIN as e}from"../../../../../const.js";import{blog_categories as t}from"../../../../../database/categories.js";import{z as n}from"@hono/zod-openapi";import{buildRoute as r}from"@vitnode/core/api/lib/route";import{removeSpecialCharacters as i}from"@vitnode/core/lib/special-characters";import{eq as a}from"drizzle-orm";import{HTTPException as o}from"hono/http-exception";const s=n.object({id:n.number(),title:n.string(),createdAt:n.date(),updatedAt:n.date()}),c=n.object({title:n.string()}),l=r({pluginId:e.pluginId,adminStaffPermission:{module:`categories`,permission:`can_create`},route:{method:`post`,path:`/`,request:{body:{content:{"application/json":{schema:c}}}},responses:{201:{content:{"application/json":{schema:s}},description:`Category created successfully`},400:{description:`Bad request - Invalid input data`}}},handler:async e=>{let{title:n}=e.req.valid(`json`),r=i(n),[s]=await e.get(`db`).select({titleSeo:t.titleSeo}).from(t).where(a(t.titleSeo,r)).limit(1);if(s?.titleSeo===r)throw new o(400,{message:`Category with this title already exists.`});let[c]=await e.get(`db`).insert(t).values({title:n,titleSeo:i(n)}).returning();return e.json(c,201)}});export{l as createCategoryRoute,c as zodCreateCategorySchema};
2
- //# sourceMappingURL=create.route.js.map
1
+ import{z}from"@hono/zod-openapi";import{buildRoute}from"@vitnode/core/api/lib/route";import{multiLangValueSchema}from"@vitnode/core/lib/helpers/multi-lang";import{CONFIG_PLUGIN}from"../../../../../const.js";import{blog_categories}from"../../../../../database/categories.js";import{saveCategoryTranslations}from"../../../../lib/categories-language.js";const zodCategoryResponseSchema=z.object({id:z.number(),createdAt:z.date(),updatedAt:z.date()});export const zodCreateCategorySchema=z.object({title:multiLangValueSchema({minLength:1,maxLength:100}).min(1),color:z.string().nullish()});export const createCategoryRoute=buildRoute({pluginId:CONFIG_PLUGIN.pluginId,adminStaffPermission:{module:"categories",permission:"can_create"},route:{method:"post",path:"/",request:{body:{content:{"application/json":{schema:zodCreateCategorySchema}}}},responses:{201:{content:{"application/json":{schema:zodCategoryResponseSchema}},description:"Category created successfully"},400:{description:"Bad request - Invalid input data"}}},handler:async c=>{const{title,color}=c.req.valid("json");const[category]=await c.get("db").insert(blog_categories).values({color:color?.trim()?color:null}).returning();await saveCategoryTranslations(c,category.id,{title});await c.get("events").emit("blog.category.created",{categoryId:category.id});return c.json(category,201)}});
@@ -1,24 +1,21 @@
1
1
  import { z } from "@hono/zod-openapi";
2
- //#region src/api/modules/admin/categories/routes/delete.route.d.ts
3
- declare const deleteCategoryRoute: import("@vitnode/core/api/lib/route").Route<"@vitnode/blog", {
4
- method: "delete";
5
- path: "/{id}";
6
- request: {
7
- params: z.ZodObject<{
8
- id: z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>;
9
- }, z.core.$strip>;
10
- };
11
- responses: {
12
- 204: {
13
- description: string;
2
+ export declare const deleteCategoryRoute: import("@vitnode/core/api/lib/route").Route<"@vitnode/blog", {
3
+ method: "delete";
4
+ path: "/{id}";
5
+ request: {
6
+ params: z.ZodObject<{
7
+ id: z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>;
8
+ }, z.core.$strip>;
14
9
  };
15
- 404: {
16
- description: string;
10
+ responses: {
11
+ 204: {
12
+ description: string;
13
+ };
14
+ 404: {
15
+ description: string;
16
+ };
17
17
  };
18
- };
19
18
  } & {
20
- path: string;
19
+ path: string;
21
20
  }>;
22
- //#endregion
23
- export { deleteCategoryRoute };
24
21
  //# sourceMappingURL=delete.route.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"delete.route.d.ts","names":[],"sources":["../../../../../../../src/api/modules/admin/categories/routes/delete.route.ts"],"mappings":";;cAQa,2DAAmB"}
1
+ {"version":3,"file":"delete.route.d.ts","sourceRoot":"","sources":["../../../../../../../src/api/modules/admin/categories/routes/delete.route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAStC,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;EAgD9B,CAAC"}
@@ -1,2 +1 @@
1
- import{CONFIG_PLUGIN as e}from"../../../../../const.js";import{blog_categories as t}from"../../../../../database/categories.js";import{z as n}from"@hono/zod-openapi";import{buildRoute as r}from"@vitnode/core/api/lib/route";import{eq as i}from"drizzle-orm";import{HTTPException as a}from"hono/http-exception";const o=r({pluginId:e.pluginId,adminStaffPermission:{module:`categories`,permission:`can_delete`},route:{method:`delete`,path:`/{id}`,request:{params:n.object({id:n.string().transform(Number)})},responses:{204:{description:`Category deleted successfully`},404:{description:`Category not found`}}},handler:async e=>{let{id:n}=e.req.valid(`param`);if((await e.get(`db`).delete(t).where(i(t.id,n)).returning()).length===0)throw new a(404);return e.body(null,204)}});export{o as deleteCategoryRoute};
2
- //# sourceMappingURL=delete.route.js.map
1
+ import{z}from"@hono/zod-openapi";import{buildRoute}from"@vitnode/core/api/lib/route";import{eq}from"drizzle-orm";import{HTTPException}from"hono/http-exception";import{CONFIG_PLUGIN}from"../../../../../const.js";import{blog_categories}from"../../../../../database/categories.js";import{blog_posts}from"../../../../../database/posts.js";export const deleteCategoryRoute=buildRoute({pluginId:CONFIG_PLUGIN.pluginId,adminStaffPermission:{module:"categories",permission:"can_delete"},route:{method:"delete",path:"/{id}",request:{params:z.object({id:z.string().transform(Number)})},responses:{204:{description:"Category deleted successfully"},404:{description:"Category not found"}}},handler:async c=>{const{id}=c.req.valid("param");const posts=await c.get("db").select({id:blog_posts.id}).from(blog_posts).where(eq(blog_posts.categoryId,id));const result=await c.get("db").delete(blog_categories).where(eq(blog_categories.id,id)).returning();if(result.length===0){throw new HTTPException(404)}await c.get("events").emit("blog.category.deleted",{categoryId:id,postIds:posts.map(post=>post.id)});return c.body(null,204)}});
@@ -1,46 +1,46 @@
1
1
  import { z } from "@hono/zod-openapi";
2
- //#region src/api/modules/admin/categories/routes/edit.route.d.ts
3
- declare const editCategoryRoute: import("@vitnode/core/api/lib/route").Route<"@vitnode/blog", {
4
- method: "put";
5
- path: "/{id}";
6
- request: {
7
- params: z.ZodObject<{
8
- id: z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>;
9
- }, z.core.$strip>;
10
- body: {
11
- content: {
12
- "application/json": {
13
- schema: z.ZodObject<{
14
- title: z.ZodString;
15
- }, z.core.$strip>;
2
+ export declare const editCategoryRoute: import("@vitnode/core/api/lib/route").Route<"@vitnode/blog", {
3
+ method: "put";
4
+ path: "/{id}";
5
+ request: {
6
+ params: z.ZodObject<{
7
+ id: z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>;
8
+ }, z.core.$strip>;
9
+ body: {
10
+ content: {
11
+ "application/json": {
12
+ schema: z.ZodObject<{
13
+ title: z.ZodArray<z.ZodObject<{
14
+ languageCode: z.ZodString;
15
+ value: z.ZodString;
16
+ }, z.core.$strip>>;
17
+ color: z.ZodOptional<z.ZodNullable<z.ZodString>>;
18
+ }, z.core.$strip>;
19
+ };
20
+ };
16
21
  };
17
- };
18
22
  };
19
- };
20
- responses: {
21
- 200: {
22
- content: {
23
- "application/json": {
24
- schema: z.ZodObject<{
25
- id: z.ZodNumber;
26
- title: z.ZodString;
27
- createdAt: z.ZodDate;
28
- updatedAt: z.ZodDate;
29
- }, z.core.$strip>;
23
+ responses: {
24
+ 200: {
25
+ content: {
26
+ "application/json": {
27
+ schema: z.ZodObject<{
28
+ id: z.ZodNumber;
29
+ createdAt: z.ZodDate;
30
+ updatedAt: z.ZodDate;
31
+ }, z.core.$strip>;
32
+ };
33
+ };
34
+ description: string;
35
+ };
36
+ 400: {
37
+ description: string;
38
+ };
39
+ 404: {
40
+ description: string;
30
41
  };
31
- };
32
- description: string;
33
- };
34
- 400: {
35
- description: string;
36
- };
37
- 404: {
38
- description: string;
39
42
  };
40
- };
41
43
  } & {
42
- path: string;
44
+ path: string;
43
45
  }>;
44
- //#endregion
45
- export { editCategoryRoute };
46
46
  //# sourceMappingURL=edit.route.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"edit.route.d.ts","names":[],"sources":["../../../../../../../src/api/modules/admin/categories/routes/edit.route.ts"],"mappings":";;cAkBa,yDAAiB"}
1
+ {"version":3,"file":"edit.route.d.ts","sourceRoot":"","sources":["../../../../../../../src/api/modules/admin/categories/routes/edit.route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAiBtC,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkE5B,CAAC"}
@@ -1,2 +1 @@
1
- import{CONFIG_PLUGIN as e}from"../../../../../const.js";import{blog_categories as t}from"../../../../../database/categories.js";import{zodCreateCategorySchema as n}from"./create.route.js";import{z as r}from"@hono/zod-openapi";import{buildRoute as i}from"@vitnode/core/api/lib/route";import{removeSpecialCharacters as a}from"@vitnode/core/lib/special-characters";import{eq as o}from"drizzle-orm";import{HTTPException as s}from"hono/http-exception";const c=r.object({id:r.number(),title:r.string(),createdAt:r.date(),updatedAt:r.date()}),l=i({pluginId:e.pluginId,adminStaffPermission:{module:`categories`,permission:`can_edit`},route:{method:`put`,path:`/{id}`,request:{params:r.object({id:r.string().transform(Number)}),body:{content:{"application/json":{schema:n}}}},responses:{200:{content:{"application/json":{schema:c}},description:`Category updated successfully`},400:{description:`Bad request - Invalid input data`},404:{description:`Category not found`}}},handler:async e=>{let{id:n}=e.req.valid(`param`),{title:r}=e.req.valid(`json`),i=a(r),[c]=await e.get(`db`).select({titleSeo:t.titleSeo}).from(t).where(o(t.id,n)).limit(1);if(!c)throw new s(404);let[l]=await e.get(`db`).select({titleSeo:t.titleSeo}).from(t).where(o(t.titleSeo,i)).limit(1);if(l?.titleSeo===i&&l.titleSeo!==c.titleSeo)throw new s(400,{message:`Category with this title already exists.`});let[u]=await e.get(`db`).update(t).set({title:r,titleSeo:a(r)}).where(o(t.id,n)).returning();return e.json(u)}});export{l as editCategoryRoute};
2
- //# sourceMappingURL=edit.route.js.map
1
+ import{z}from"@hono/zod-openapi";import{buildRoute}from"@vitnode/core/api/lib/route";import{eq}from"drizzle-orm";import{HTTPException}from"hono/http-exception";import{CONFIG_PLUGIN}from"../../../../../const.js";import{blog_categories}from"../../../../../database/categories.js";import{saveCategoryTranslations}from"../../../../lib/categories-language.js";import{zodCreateCategorySchema}from"./create.route.js";const zodCategoryResponseSchema=z.object({id:z.number(),createdAt:z.date(),updatedAt:z.date()});export const editCategoryRoute=buildRoute({pluginId:CONFIG_PLUGIN.pluginId,adminStaffPermission:{module:"categories",permission:"can_edit"},route:{method:"put",path:"/{id}",request:{params:z.object({id:z.string().transform(Number)}),body:{content:{"application/json":{schema:zodCreateCategorySchema}}}},responses:{200:{content:{"application/json":{schema:zodCategoryResponseSchema}},description:"Category updated successfully"},400:{description:"Bad request - Invalid input data"},404:{description:"Category not found"}}},handler:async c=>{const{id}=c.req.valid("param");const{title,color}=c.req.valid("json");const[editData]=await c.get("db").select({id:blog_categories.id}).from(blog_categories).where(eq(blog_categories.id,id)).limit(1);if(!editData){throw new HTTPException(404)}const[category]=await c.get("db").update(blog_categories).set({color:color?.trim()?color:null}).where(eq(blog_categories.id,id)).returning();await saveCategoryTranslations(c,id,{title});await c.get("events").emit("blog.category.updated",{categoryId:id});return c.json(category)}});