@vitnode/blog 1.2.0-canary.23 → 1.2.0-canary.25

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 (106) hide show
  1. package/dist/src/api/modules/admin/admin.module.d.ts +439 -0
  2. package/dist/src/api/modules/admin/admin.module.d.ts.map +1 -0
  3. package/dist/src/api/modules/admin/admin.module.js +1 -0
  4. package/dist/src/api/modules/admin/categories/categories.admin.module.d.ts +198 -0
  5. package/dist/src/api/modules/admin/categories/categories.admin.module.d.ts.map +1 -0
  6. package/dist/src/api/modules/admin/categories/categories.admin.module.js +1 -0
  7. package/dist/src/api/modules/{categories → admin/categories}/routes/create.route.d.ts +1 -1
  8. package/dist/src/api/modules/admin/categories/routes/create.route.d.ts.map +1 -0
  9. package/dist/src/api/modules/admin/categories/routes/create.route.js +1 -0
  10. package/dist/src/api/modules/{categories → admin/categories}/routes/delete.route.d.ts +1 -1
  11. package/dist/src/api/modules/admin/categories/routes/delete.route.d.ts.map +1 -0
  12. package/dist/src/api/modules/admin/categories/routes/delete.route.js +1 -0
  13. package/dist/src/api/modules/{categories → admin/categories}/routes/edit.route.d.ts +1 -1
  14. package/dist/src/api/modules/admin/categories/routes/edit.route.d.ts.map +1 -0
  15. package/dist/src/api/modules/admin/categories/routes/edit.route.js +1 -0
  16. package/dist/src/api/modules/admin/posts/posts.admin.module.d.ts +243 -0
  17. package/dist/src/api/modules/admin/posts/posts.admin.module.d.ts.map +1 -0
  18. package/dist/src/api/modules/admin/posts/posts.admin.module.js +1 -0
  19. package/dist/src/api/modules/{posts → admin/posts}/routes/create.route.d.ts +1 -1
  20. package/dist/src/api/modules/admin/posts/routes/create.route.d.ts.map +1 -0
  21. package/dist/src/api/modules/admin/posts/routes/create.route.js +1 -0
  22. package/dist/src/api/modules/{posts → admin/posts}/routes/delete.route.d.ts +1 -1
  23. package/dist/src/api/modules/admin/posts/routes/delete.route.d.ts.map +1 -0
  24. package/dist/src/api/modules/admin/posts/routes/delete.route.js +1 -0
  25. package/dist/src/api/modules/{posts → admin/posts}/routes/edit.route.d.ts +1 -1
  26. package/dist/src/api/modules/admin/posts/routes/edit.route.d.ts.map +1 -0
  27. package/dist/src/api/modules/admin/posts/routes/edit.route.js +1 -0
  28. package/dist/src/api/modules/categories/categories.module.d.ts +1 -197
  29. package/dist/src/api/modules/categories/categories.module.d.ts.map +1 -1
  30. package/dist/src/api/modules/categories/categories.module.js +1 -1
  31. package/dist/src/api/modules/categories/routes/get.route.d.ts +1 -1
  32. package/dist/src/api/modules/posts/posts.module.d.ts +5 -246
  33. package/dist/src/api/modules/posts/posts.module.d.ts.map +1 -1
  34. package/dist/src/api/modules/posts/posts.module.js +1 -1
  35. package/dist/src/api/modules/posts/routes/get.route.d.ts +5 -5
  36. package/dist/src/app_admin/blog/categories/page.d.ts +5 -1
  37. package/dist/src/app_admin/blog/categories/page.d.ts.map +1 -1
  38. package/dist/src/app_admin/blog/categories/page.js +1 -1
  39. package/dist/src/app_admin/blog/posts/page.d.ts +5 -1
  40. package/dist/src/app_admin/blog/posts/page.d.ts.map +1 -1
  41. package/dist/src/app_admin/blog/posts/page.js +1 -1
  42. package/dist/src/config.api.d.ts.map +1 -1
  43. package/dist/src/config.api.js +1 -1
  44. package/dist/src/views/admin/categories/actions/create-edit/create-edit.d.ts +1 -1
  45. package/dist/src/views/admin/categories/actions/create-edit/create-edit.d.ts.map +1 -1
  46. package/dist/src/views/admin/categories/actions/create-edit/mutation-api.d.ts +1 -1
  47. package/dist/src/views/admin/categories/actions/create-edit/mutation-api.d.ts.map +1 -1
  48. package/dist/src/views/admin/categories/actions/create-edit/mutation-api.js +1 -1
  49. package/dist/src/views/admin/categories/table/actions/delete/delete-action.d.ts.map +1 -0
  50. package/dist/src/views/admin/categories/table/actions/delete/delete-action.js +1 -0
  51. package/dist/src/views/admin/categories/table/actions/delete/mutation-api.d.ts.map +1 -0
  52. package/dist/src/views/admin/categories/table/actions/delete/mutation-api.js +1 -0
  53. package/dist/src/views/admin/categories/{row-actions → table/actions}/edit-action.d.ts +1 -1
  54. package/dist/src/views/admin/categories/table/actions/edit-action.d.ts.map +1 -0
  55. package/dist/src/views/admin/categories/table/actions/edit-action.js +1 -0
  56. package/dist/src/views/admin/categories/table/categories-admin-view.d.ts.map +1 -0
  57. package/dist/src/views/admin/categories/table/categories-admin-view.js +1 -0
  58. package/dist/src/views/admin/posts/actions/create-edit/mutation-api.d.ts +1 -1
  59. package/dist/src/views/admin/posts/actions/create-edit/mutation-api.d.ts.map +1 -1
  60. package/dist/src/views/admin/posts/actions/create-edit/mutation-api.js +1 -1
  61. package/dist/src/views/admin/posts/table/actions/delete/delete-action.d.ts.map +1 -0
  62. package/dist/src/views/admin/posts/table/actions/delete/delete-action.js +1 -0
  63. package/dist/src/views/admin/{categories/row-actions → posts/table/actions}/delete/mutation-api.d.ts.map +1 -1
  64. package/dist/src/views/admin/posts/table/actions/delete/mutation-api.js +1 -0
  65. package/dist/src/views/admin/posts/{row-actions → table/actions}/edit-action.d.ts +1 -1
  66. package/dist/src/views/admin/posts/table/actions/edit-action.d.ts.map +1 -0
  67. package/dist/src/views/admin/posts/table/actions/edit-action.js +1 -0
  68. package/dist/src/views/admin/posts/table/posts-admin-view.d.ts.map +1 -0
  69. package/dist/src/views/admin/posts/table/posts-admin-view.js +1 -0
  70. package/dist/tsconfig.tsbuildinfo +1 -1
  71. package/package.json +18 -18
  72. package/src/app_admin/blog/categories/page.tsx +11 -3
  73. package/src/app_admin/blog/posts/page.tsx +11 -2
  74. package/dist/src/api/modules/categories/routes/create.route.d.ts.map +0 -1
  75. package/dist/src/api/modules/categories/routes/create.route.js +0 -1
  76. package/dist/src/api/modules/categories/routes/delete.route.d.ts.map +0 -1
  77. package/dist/src/api/modules/categories/routes/delete.route.js +0 -1
  78. package/dist/src/api/modules/categories/routes/edit.route.d.ts.map +0 -1
  79. package/dist/src/api/modules/categories/routes/edit.route.js +0 -1
  80. package/dist/src/api/modules/posts/routes/create.route.d.ts.map +0 -1
  81. package/dist/src/api/modules/posts/routes/create.route.js +0 -1
  82. package/dist/src/api/modules/posts/routes/delete.route.d.ts.map +0 -1
  83. package/dist/src/api/modules/posts/routes/delete.route.js +0 -1
  84. package/dist/src/api/modules/posts/routes/edit.route.d.ts.map +0 -1
  85. package/dist/src/api/modules/posts/routes/edit.route.js +0 -1
  86. package/dist/src/views/admin/categories/categories-admin-view.d.ts.map +0 -1
  87. package/dist/src/views/admin/categories/categories-admin-view.js +0 -1
  88. package/dist/src/views/admin/categories/row-actions/delete/delete-action.d.ts.map +0 -1
  89. package/dist/src/views/admin/categories/row-actions/delete/delete-action.js +0 -1
  90. package/dist/src/views/admin/categories/row-actions/delete/mutation-api.js +0 -1
  91. package/dist/src/views/admin/categories/row-actions/edit-action.d.ts.map +0 -1
  92. package/dist/src/views/admin/categories/row-actions/edit-action.js +0 -1
  93. package/dist/src/views/admin/posts/posts-admin-view.d.ts.map +0 -1
  94. package/dist/src/views/admin/posts/posts-admin-view.js +0 -1
  95. package/dist/src/views/admin/posts/row-actions/delete/delete-action.d.ts.map +0 -1
  96. package/dist/src/views/admin/posts/row-actions/delete/delete-action.js +0 -1
  97. package/dist/src/views/admin/posts/row-actions/delete/mutation-api.d.ts.map +0 -1
  98. package/dist/src/views/admin/posts/row-actions/delete/mutation-api.js +0 -1
  99. package/dist/src/views/admin/posts/row-actions/edit-action.d.ts.map +0 -1
  100. package/dist/src/views/admin/posts/row-actions/edit-action.js +0 -1
  101. /package/dist/src/views/admin/categories/{row-actions → table/actions}/delete/delete-action.d.ts +0 -0
  102. /package/dist/src/views/admin/categories/{row-actions → table/actions}/delete/mutation-api.d.ts +0 -0
  103. /package/dist/src/views/admin/categories/{categories-admin-view.d.ts → table/categories-admin-view.d.ts} +0 -0
  104. /package/dist/src/views/admin/posts/{row-actions → table/actions}/delete/delete-action.d.ts +0 -0
  105. /package/dist/src/views/admin/posts/{row-actions → table/actions}/delete/mutation-api.d.ts +0 -0
  106. /package/dist/src/views/admin/posts/{posts-admin-view.d.ts → table/posts-admin-view.d.ts} +0 -0
@@ -1,6 +1,6 @@
1
1
  import { z } from '@hono/zod-openapi';
2
2
  export declare const editCategoryRoute: {
3
- handler: (c: import("hono").Context<import("@vitnode/core/api/middlewares/global/global").EnvVitNode, "/:id", {
3
+ handler: (c: import("hono").Context<import("@vitnode/core/api/middlewares/global.middleware").EnvVitNode, "/:id", {
4
4
  in: {
5
5
  param: {
6
6
  id: string;
@@ -0,0 +1 @@
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;AAkBtC,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiF5B,CAAC"}
@@ -0,0 +1 @@
1
+ import{z}from"@hono/zod-openapi";import{buildRoute}from"@vitnode/core/api/lib/route";import{removeSpecialCharacters}from"@vitnode/core/lib/special-characters";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{zodCreateCategorySchema}from"./create.route.js";const zodCategoryResponseSchema=z.object({id:z.number(),title:z.string(),createdAt:z.date(),updatedAt:z.date()});export const editCategoryRoute=buildRoute({...CONFIG_PLUGIN,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}=c.req.valid("json");const titleSeo=removeSpecialCharacters(title);const[editData]=await c.get("db").select({titleSeo:blog_categories.titleSeo}).from(blog_categories).where(eq(blog_categories.id,id)).limit(1);if(!editData){throw new HTTPException(404)}const[titleSEODuplocate]=await c.get("db").select({titleSeo:blog_categories.titleSeo}).from(blog_categories).where(eq(blog_categories.titleSeo,titleSeo)).limit(1);if(titleSEODuplocate?.titleSeo===titleSeo&&titleSEODuplocate.titleSeo!==editData.titleSeo){throw new HTTPException(400,{message:"Category with this title already exists."})}const[category]=await c.get("db").update(blog_categories).set({title,titleSeo:removeSpecialCharacters(title)}).where(eq(blog_categories.id,id)).returning();return c.json(category)}});
@@ -0,0 +1,243 @@
1
+ export declare const postsAdminModule: import("@vitnode/core/api/lib/module").BuildModuleReturn<"@vitnode/blog", "posts", [{
2
+ handler: (c: import("hono").Context<import("@vitnode/core/api/middlewares/global.middleware").EnvVitNode, "/:id", {
3
+ in: {
4
+ param: {
5
+ id: string;
6
+ };
7
+ };
8
+ out: {
9
+ param: {
10
+ id: number;
11
+ };
12
+ };
13
+ } & {
14
+ in: {
15
+ json: {
16
+ title: string;
17
+ content: string;
18
+ categoryId: number;
19
+ };
20
+ };
21
+ out: {
22
+ json: {
23
+ title: string;
24
+ content: string;
25
+ categoryId: number;
26
+ };
27
+ };
28
+ }>) => Promise<Response & import("hono").TypedResponse<{
29
+ id: number;
30
+ title: string;
31
+ titleSeo: string;
32
+ content: string;
33
+ categoryId: number;
34
+ createdAt: string;
35
+ updatedAt: string;
36
+ }, 400 | 200 | 404, "json">>;
37
+ pluginId: "@vitnode/blog";
38
+ route: {
39
+ method: "put";
40
+ path: "/{id}";
41
+ request: {
42
+ params: import("zod").ZodObject<{
43
+ id: import("zod").ZodEffects<import("zod").ZodString, number, string>;
44
+ }, "strip", import("zod").ZodTypeAny, {
45
+ id: number;
46
+ }, {
47
+ id: string;
48
+ }>;
49
+ body: {
50
+ content: {
51
+ 'application/json': {
52
+ schema: import("zod").ZodObject<{
53
+ title: import("zod").ZodString;
54
+ content: import("zod").ZodString;
55
+ categoryId: import("zod").ZodNumber;
56
+ }, "strip", import("zod").ZodTypeAny, {
57
+ title: string;
58
+ content: string;
59
+ categoryId: number;
60
+ }, {
61
+ title: string;
62
+ content: string;
63
+ categoryId: number;
64
+ }>;
65
+ };
66
+ };
67
+ };
68
+ };
69
+ responses: {
70
+ 200: {
71
+ content: {
72
+ 'application/json': {
73
+ schema: import("zod").ZodObject<{
74
+ id: import("zod").ZodNumber;
75
+ title: import("zod").ZodString;
76
+ titleSeo: import("zod").ZodString;
77
+ content: import("zod").ZodString;
78
+ categoryId: import("zod").ZodNumber;
79
+ createdAt: import("zod").ZodDate;
80
+ updatedAt: import("zod").ZodDate;
81
+ }, "strip", import("zod").ZodTypeAny, {
82
+ id: number;
83
+ title: string;
84
+ createdAt: Date;
85
+ updatedAt: Date;
86
+ titleSeo: string;
87
+ content: string;
88
+ categoryId: number;
89
+ }, {
90
+ id: number;
91
+ title: string;
92
+ createdAt: Date;
93
+ updatedAt: Date;
94
+ titleSeo: string;
95
+ content: string;
96
+ categoryId: number;
97
+ }>;
98
+ };
99
+ };
100
+ description: string;
101
+ };
102
+ 400: {
103
+ description: string;
104
+ };
105
+ 404: {
106
+ description: string;
107
+ };
108
+ };
109
+ } & {
110
+ getRoutingPath: () => "/:id";
111
+ };
112
+ }, {
113
+ handler: (c: import("hono").Context<import("@vitnode/core/api/middlewares/global.middleware").EnvVitNode, "/", {
114
+ in: {
115
+ json: {
116
+ title: string;
117
+ content: string;
118
+ categoryId: number;
119
+ };
120
+ };
121
+ out: {
122
+ json: {
123
+ title: string;
124
+ content: string;
125
+ categoryId: number;
126
+ };
127
+ };
128
+ }>) => Promise<Response & import("hono").TypedResponse<{
129
+ id: number;
130
+ title: string;
131
+ createdAt: string;
132
+ updatedAt: string;
133
+ titleSeo: string;
134
+ content: string;
135
+ categoryId: number;
136
+ }, 201, "json">>;
137
+ pluginId: "@vitnode/blog";
138
+ route: {
139
+ method: "post";
140
+ path: "/";
141
+ request: {
142
+ body: {
143
+ content: {
144
+ 'application/json': {
145
+ schema: import("zod").ZodObject<{
146
+ title: import("zod").ZodString;
147
+ content: import("zod").ZodString;
148
+ categoryId: import("zod").ZodNumber;
149
+ }, "strip", import("zod").ZodTypeAny, {
150
+ title: string;
151
+ content: string;
152
+ categoryId: number;
153
+ }, {
154
+ title: string;
155
+ content: string;
156
+ categoryId: number;
157
+ }>;
158
+ };
159
+ };
160
+ };
161
+ };
162
+ responses: {
163
+ 201: {
164
+ content: {
165
+ 'application/json': {
166
+ schema: import("zod").ZodObject<{
167
+ id: import("zod").ZodNumber;
168
+ title: import("zod").ZodString;
169
+ titleSeo: import("zod").ZodString;
170
+ content: import("zod").ZodString;
171
+ categoryId: import("zod").ZodNumber;
172
+ createdAt: import("zod").ZodDate;
173
+ updatedAt: import("zod").ZodDate;
174
+ }, "strip", import("zod").ZodTypeAny, {
175
+ id: number;
176
+ title: string;
177
+ createdAt: Date;
178
+ updatedAt: Date;
179
+ titleSeo: string;
180
+ content: string;
181
+ categoryId: number;
182
+ }, {
183
+ id: number;
184
+ title: string;
185
+ createdAt: Date;
186
+ updatedAt: Date;
187
+ titleSeo: string;
188
+ content: string;
189
+ categoryId: number;
190
+ }>;
191
+ };
192
+ };
193
+ description: string;
194
+ };
195
+ 400: {
196
+ description: string;
197
+ };
198
+ 404: {
199
+ description: string;
200
+ };
201
+ };
202
+ } & {
203
+ getRoutingPath: () => "/";
204
+ };
205
+ }, {
206
+ handler: (c: import("hono").Context<import("@vitnode/core/api/middlewares/global.middleware").EnvVitNode, "/:id", {
207
+ in: {
208
+ param: {
209
+ id: string;
210
+ };
211
+ };
212
+ out: {
213
+ param: {
214
+ id: number;
215
+ };
216
+ };
217
+ }>) => Promise<Response & import("hono").TypedResponse<null, 204, "body">>;
218
+ pluginId: "@vitnode/blog";
219
+ route: {
220
+ method: "delete";
221
+ path: "/{id}";
222
+ request: {
223
+ params: import("zod").ZodObject<{
224
+ id: import("zod").ZodEffects<import("zod").ZodString, number, string>;
225
+ }, "strip", import("zod").ZodTypeAny, {
226
+ id: number;
227
+ }, {
228
+ id: string;
229
+ }>;
230
+ };
231
+ responses: {
232
+ 204: {
233
+ description: string;
234
+ };
235
+ 404: {
236
+ description: string;
237
+ };
238
+ };
239
+ } & {
240
+ getRoutingPath: () => "/:id";
241
+ };
242
+ }], import("@vitnode/core/api/lib/module").BaseBuildModuleReturn<"@vitnode/blog", string, import("@vitnode/core/api/lib/route").Route<"@vitnode/blog", import("@hono/zod-openapi").RouteConfig, import("@hono/zod-openapi").RouteHandler<import("@hono/zod-openapi").RouteConfig>>[]>[]>;
243
+ //# sourceMappingURL=posts.admin.module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"posts.admin.module.d.ts","sourceRoot":"","sources":["../../../../../../src/api/modules/admin/posts/posts.admin.module.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wRAI3B,CAAC"}
@@ -0,0 +1 @@
1
+ import{buildModule}from"@vitnode/core/api/lib/module";import{CONFIG_PLUGIN}from"../../../../const.js";import{createPostRoute}from"./routes/create.route.js";import{deletePostRoute}from"./routes/delete.route.js";import{editPostRoute}from"./routes/edit.route.js";export const postsAdminModule=buildModule({...CONFIG_PLUGIN,name:"posts",routes:[editPostRoute,createPostRoute,deletePostRoute]});
@@ -13,7 +13,7 @@ export declare const zodCreatePostSchema: z.ZodObject<{
13
13
  categoryId: number;
14
14
  }>;
15
15
  export declare const createPostRoute: {
16
- handler: (c: import("hono").Context<import("@vitnode/core/api/middlewares/global/global").EnvVitNode, "/", {
16
+ handler: (c: import("hono").Context<import("@vitnode/core/api/middlewares/global.middleware").EnvVitNode, "/", {
17
17
  in: {
18
18
  json: {
19
19
  title: string;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.route.d.ts","sourceRoot":"","sources":["../../../../../../../src/api/modules/admin/posts/routes/create.route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAUtC,eAAO,MAAM,mBAAmB;;;;;;;;;;;;EAO9B,CAAC;AAYH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4E1B,CAAC"}
@@ -0,0 +1 @@
1
+ import{z}from"@hono/zod-openapi";import{buildRoute}from"@vitnode/core/api/lib/route";import{removeSpecialCharacters}from"@vitnode/core/lib/special-characters";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 zodCreatePostSchema=z.object({title:z.string().min(3,"Title must be at least 3 characters long").max(255,"Title must not exceed 255 characters"),content:z.string(),categoryId:z.number()});const zodPostResponseSchema=z.object({id:z.number(),title:z.string(),titleSeo:z.string(),content:z.string(),categoryId:z.number(),createdAt:z.date(),updatedAt:z.date()});export const createPostRoute=buildRoute({...CONFIG_PLUGIN,route:{method:"post",path:"/",request:{body:{content:{"application/json":{schema:zodCreatePostSchema}}}},responses:{201:{content:{"application/json":{schema:zodPostResponseSchema}},description:"Post created successfully"},400:{description:"Bad request - Invalid input data"},404:{description:"Category not found"}}},handler:async c=>{const{title,content,categoryId}=c.req.valid("json");const titleSeo=removeSpecialCharacters(title);const[category]=await c.get("db").select({id:blog_categories.id}).from(blog_categories).where(eq(blog_categories.id,categoryId)).limit(1);if(!category){throw new HTTPException(404,{message:"Category not found."})}const[titleSEODuplicate]=await c.get("db").select({titleSeo:blog_posts.titleSeo}).from(blog_posts).where(eq(blog_posts.titleSeo,titleSeo)).limit(1);if(titleSEODuplicate?.titleSeo===titleSeo){throw new HTTPException(400,{message:"Post with this title already exists."})}const[post]=await c.get("db").insert(blog_posts).values({title,titleSeo,content,categoryId}).returning();return c.json(post,201)}});
@@ -1,6 +1,6 @@
1
1
  import { z } from '@hono/zod-openapi';
2
2
  export declare const deletePostRoute: {
3
- handler: (c: import("hono").Context<import("@vitnode/core/api/middlewares/global/global").EnvVitNode, "/:id", {
3
+ handler: (c: import("hono").Context<import("@vitnode/core/api/middlewares/global.middleware").EnvVitNode, "/:id", {
4
4
  in: {
5
5
  param: {
6
6
  id: string;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete.route.d.ts","sourceRoot":"","sources":["../../../../../../../src/api/modules/admin/posts/routes/delete.route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAQtC,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkC1B,CAAC"}
@@ -0,0 +1 @@
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_posts}from"../../../../../database/posts.js";export const deletePostRoute=buildRoute({...CONFIG_PLUGIN,route:{method:"delete",path:"/{id}",request:{params:z.object({id:z.string().transform(Number)})},responses:{204:{description:"Post deleted successfully"},404:{description:"Post not found"}}},handler:async c=>{const{id}=c.req.valid("param");const result=await c.get("db").delete(blog_posts).where(eq(blog_posts.id,id)).returning();if(result.length===0){throw new HTTPException(404)}return c.body(null,204)}});
@@ -1,6 +1,6 @@
1
1
  import { z } from '@hono/zod-openapi';
2
2
  export declare const editPostRoute: {
3
- handler: (c: import("hono").Context<import("@vitnode/core/api/middlewares/global/global").EnvVitNode, "/:id", {
3
+ handler: (c: import("hono").Context<import("@vitnode/core/api/middlewares/global.middleware").EnvVitNode, "/:id", {
4
4
  in: {
5
5
  param: {
6
6
  id: string;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edit.route.d.ts","sourceRoot":"","sources":["../../../../../../../src/api/modules/admin/posts/routes/edit.route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAsBtC,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8FxB,CAAC"}
@@ -0,0 +1 @@
1
+ import{z}from"@hono/zod-openapi";import{buildRoute}from"@vitnode/core/api/lib/route";import{removeSpecialCharacters}from"@vitnode/core/lib/special-characters";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";import{zodCreatePostSchema}from"./create.route.js";const zodPostResponseSchema=z.object({id:z.number(),title:z.string(),titleSeo:z.string(),content:z.string(),categoryId:z.number(),createdAt:z.date(),updatedAt:z.date()});export const editPostRoute=buildRoute({...CONFIG_PLUGIN,route:{method:"put",path:"/{id}",request:{params:z.object({id:z.string().transform(Number)}),body:{content:{"application/json":{schema:zodCreatePostSchema}}}},responses:{200:{content:{"application/json":{schema:zodPostResponseSchema}},description:"Post updated successfully"},400:{description:"Bad request - Invalid input data"},404:{description:"Post or category not found"}}},handler:async c=>{const{id}=c.req.valid("param");const{title,content,categoryId}=c.req.valid("json");const titleSeo=removeSpecialCharacters(title);const[existingPost]=await c.get("db").select({titleSeo:blog_posts.titleSeo}).from(blog_posts).where(eq(blog_posts.id,id)).limit(1);if(!existingPost){throw new HTTPException(404,{message:"Post not found."})}const[category]=await c.get("db").select({id:blog_categories.id}).from(blog_categories).where(eq(blog_categories.id,categoryId)).limit(1);if(!category){throw new HTTPException(404,{message:"Category not found."})}const[titleSEODuplicate]=await c.get("db").select({titleSeo:blog_posts.titleSeo}).from(blog_posts).where(eq(blog_posts.titleSeo,titleSeo)).limit(1);if(titleSEODuplicate?.titleSeo===titleSeo&&titleSEODuplicate.titleSeo!==existingPost.titleSeo){throw new HTTPException(400,{message:"Post with this title already exists."})}const[post]=await c.get("db").update(blog_posts).set({title,titleSeo,content,categoryId}).where(eq(blog_posts.id,id)).returning();return c.json(post)}});
@@ -1,5 +1,5 @@
1
1
  export declare const categoriesModule: import("@vitnode/core/api/lib/module").BuildModuleReturn<"@vitnode/blog", "categories", [{
2
- handler: (c: import("hono").Context<import("@vitnode/core/api/middlewares/global/global").EnvVitNode, "/", {
2
+ handler: (c: import("hono").Context<import("@vitnode/core/api/middlewares/global.middleware").EnvVitNode, "/", {
3
3
  in: {
4
4
  query: {
5
5
  search?: string | undefined;
@@ -148,201 +148,5 @@ export declare const categoriesModule: import("@vitnode/core/api/lib/module").Bu
148
148
  } & {
149
149
  getRoutingPath: () => "/";
150
150
  };
151
- }, {
152
- handler: (c: import("hono").Context<import("@vitnode/core/api/middlewares/global/global").EnvVitNode, "/", {
153
- in: {
154
- json: {
155
- title: string;
156
- };
157
- };
158
- out: {
159
- json: {
160
- title: string;
161
- };
162
- };
163
- }>) => Promise<Response & import("hono").TypedResponse<{
164
- id: number;
165
- title: string;
166
- createdAt: string;
167
- updatedAt: string;
168
- titleSeo: string;
169
- }, 201, "json">>;
170
- pluginId: "@vitnode/blog";
171
- route: {
172
- method: "post";
173
- path: "/";
174
- request: {
175
- body: {
176
- content: {
177
- 'application/json': {
178
- schema: import("zod").ZodObject<{
179
- title: import("zod").ZodString;
180
- }, "strip", import("zod").ZodTypeAny, {
181
- title: string;
182
- }, {
183
- title: string;
184
- }>;
185
- };
186
- };
187
- };
188
- };
189
- responses: {
190
- 201: {
191
- content: {
192
- 'application/json': {
193
- schema: import("zod").ZodObject<{
194
- id: import("zod").ZodNumber;
195
- title: import("zod").ZodString;
196
- createdAt: import("zod").ZodDate;
197
- updatedAt: import("zod").ZodDate;
198
- }, "strip", import("zod").ZodTypeAny, {
199
- id: number;
200
- title: string;
201
- createdAt: Date;
202
- updatedAt: Date;
203
- }, {
204
- id: number;
205
- title: string;
206
- createdAt: Date;
207
- updatedAt: Date;
208
- }>;
209
- };
210
- };
211
- description: string;
212
- };
213
- 400: {
214
- description: string;
215
- };
216
- };
217
- } & {
218
- getRoutingPath: () => "/";
219
- };
220
- }, {
221
- handler: (c: import("hono").Context<import("@vitnode/core/api/middlewares/global/global").EnvVitNode, "/:id", {
222
- in: {
223
- param: {
224
- id: string;
225
- };
226
- };
227
- out: {
228
- param: {
229
- id: number;
230
- };
231
- };
232
- } & {
233
- in: {
234
- json: {
235
- title: string;
236
- };
237
- };
238
- out: {
239
- json: {
240
- title: string;
241
- };
242
- };
243
- }>) => Promise<Response & import("hono").TypedResponse<{
244
- id: number;
245
- title: string;
246
- createdAt: string;
247
- updatedAt: string;
248
- titleSeo: string;
249
- }, 400 | 200 | 404, "json">>;
250
- pluginId: "@vitnode/blog";
251
- route: {
252
- method: "put";
253
- path: "/{id}";
254
- request: {
255
- params: import("zod").ZodObject<{
256
- id: import("zod").ZodEffects<import("zod").ZodString, number, string>;
257
- }, "strip", import("zod").ZodTypeAny, {
258
- id: number;
259
- }, {
260
- id: string;
261
- }>;
262
- body: {
263
- content: {
264
- 'application/json': {
265
- schema: import("zod").ZodObject<{
266
- title: import("zod").ZodString;
267
- }, "strip", import("zod").ZodTypeAny, {
268
- title: string;
269
- }, {
270
- title: string;
271
- }>;
272
- };
273
- };
274
- };
275
- };
276
- responses: {
277
- 200: {
278
- content: {
279
- 'application/json': {
280
- schema: import("zod").ZodObject<{
281
- id: import("zod").ZodNumber;
282
- title: import("zod").ZodString;
283
- createdAt: import("zod").ZodDate;
284
- updatedAt: import("zod").ZodDate;
285
- }, "strip", import("zod").ZodTypeAny, {
286
- id: number;
287
- title: string;
288
- createdAt: Date;
289
- updatedAt: Date;
290
- }, {
291
- id: number;
292
- title: string;
293
- createdAt: Date;
294
- updatedAt: Date;
295
- }>;
296
- };
297
- };
298
- description: string;
299
- };
300
- 400: {
301
- description: string;
302
- };
303
- 404: {
304
- description: string;
305
- };
306
- };
307
- } & {
308
- getRoutingPath: () => "/:id";
309
- };
310
- }, {
311
- handler: (c: import("hono").Context<import("@vitnode/core/api/middlewares/global/global").EnvVitNode, "/:id", {
312
- in: {
313
- param: {
314
- id: string;
315
- };
316
- };
317
- out: {
318
- param: {
319
- id: number;
320
- };
321
- };
322
- }>) => Promise<Response & import("hono").TypedResponse<null, 204, "body">>;
323
- pluginId: "@vitnode/blog";
324
- route: {
325
- method: "delete";
326
- path: "/{id}";
327
- request: {
328
- params: import("zod").ZodObject<{
329
- id: import("zod").ZodEffects<import("zod").ZodString, number, string>;
330
- }, "strip", import("zod").ZodTypeAny, {
331
- id: number;
332
- }, {
333
- id: string;
334
- }>;
335
- };
336
- responses: {
337
- 204: {
338
- description: string;
339
- };
340
- 404: {
341
- description: string;
342
- };
343
- };
344
- } & {
345
- getRoutingPath: () => "/:id";
346
- };
347
151
  }], import("@vitnode/core/api/lib/module").BaseBuildModuleReturn<"@vitnode/blog", string, import("@vitnode/core/api/lib/route").Route<"@vitnode/blog", import("@hono/zod-openapi").RouteConfig, import("@hono/zod-openapi").RouteHandler<import("@hono/zod-openapi").RouteConfig>>[]>[]>;
348
152
  //# sourceMappingURL=categories.module.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"categories.module.d.ts","sourceRoot":"","sources":["../../../../../src/api/modules/categories/categories.module.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wRAS3B,CAAC"}
1
+ {"version":3,"file":"categories.module.d.ts","sourceRoot":"","sources":["../../../../../src/api/modules/categories/categories.module.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wRAI3B,CAAC"}
@@ -1 +1 @@
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";import{categoriesRoute}from"./routes/get.route.js";export const categoriesModule=buildModule({...CONFIG_PLUGIN,name:"categories",routes:[categoriesRoute,createCategoryRoute,editCategoryRoute,deleteCategoryRoute]});
1
+ import{buildModule}from"@vitnode/core/api/lib/module";import{CONFIG_PLUGIN}from"../../../const.js";import{categoriesRoute}from"./routes/get.route.js";export const categoriesModule=buildModule({...CONFIG_PLUGIN,name:"categories",routes:[categoriesRoute]});
@@ -1,6 +1,6 @@
1
1
  import { z } from '@hono/zod-openapi';
2
2
  export declare const categoriesRoute: {
3
- handler: (c: import("hono").Context<import("@vitnode/core/api/middlewares/global/global").EnvVitNode, "/", {
3
+ handler: (c: import("hono").Context<import("@vitnode/core/api/middlewares/global.middleware").EnvVitNode, "/", {
4
4
  in: {
5
5
  query: {
6
6
  search?: string | undefined;