@vitnode/blog 1.2.0-canary.10 → 1.2.0-canary.12

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 (71) hide show
  1. package/package.json +19 -5
  2. package/dist/src/api/modules/categories/categories.module.d.ts +0 -343
  3. package/dist/src/api/modules/categories/categories.module.d.ts.map +0 -1
  4. package/dist/src/api/modules/categories/categories.module.js +0 -1
  5. package/dist/src/api/modules/categories/routes/create.route.d.ts +0 -79
  6. package/dist/src/api/modules/categories/routes/create.route.d.ts.map +0 -1
  7. package/dist/src/api/modules/categories/routes/create.route.js +0 -1
  8. package/dist/src/api/modules/categories/routes/delete.route.d.ts +0 -40
  9. package/dist/src/api/modules/categories/routes/delete.route.d.ts.map +0 -1
  10. package/dist/src/api/modules/categories/routes/delete.route.js +0 -1
  11. package/dist/src/api/modules/categories/routes/edit.route.d.ts +0 -100
  12. package/dist/src/api/modules/categories/routes/edit.route.d.ts.map +0 -1
  13. package/dist/src/api/modules/categories/routes/edit.route.js +0 -1
  14. package/dist/src/api/modules/categories/routes/get.route.d.ts +0 -148
  15. package/dist/src/api/modules/categories/routes/get.route.d.ts.map +0 -1
  16. package/dist/src/api/modules/categories/routes/get.route.js +0 -1
  17. package/dist/src/api/modules/categories/utils/generate-unique-title-seo.d.ts +0 -1
  18. package/dist/src/api/modules/categories/utils/generate-unique-title-seo.d.ts.map +0 -1
  19. package/dist/src/app_admin/blog/categories/page.d.ts +0 -5
  20. package/dist/src/app_admin/blog/categories/page.d.ts.map +0 -1
  21. package/dist/src/app_admin/blog/categories/page.js +0 -1
  22. package/dist/src/config.api.d.ts +0 -2
  23. package/dist/src/config.api.d.ts.map +0 -1
  24. package/dist/src/config.api.js +0 -1
  25. package/dist/src/config.d.ts +0 -4
  26. package/dist/src/config.d.ts.map +0 -1
  27. package/dist/src/config.js +0 -1
  28. package/dist/src/database/categories.d.ts +0 -97
  29. package/dist/src/database/categories.d.ts.map +0 -1
  30. package/dist/src/database/categories.js +0 -1
  31. package/dist/src/plugin.d.ts +0 -2
  32. package/dist/src/plugin.d.ts.map +0 -1
  33. package/dist/src/plugin.js +0 -1
  34. package/dist/src/views/admin/categories/actions/actions.d.ts +0 -2
  35. package/dist/src/views/admin/categories/actions/actions.d.ts.map +0 -1
  36. package/dist/src/views/admin/categories/actions/actions.js +0 -1
  37. package/dist/src/views/admin/categories/actions/create/create-edit.d.ts +0 -2
  38. package/dist/src/views/admin/categories/actions/create/create-edit.d.ts.map +0 -1
  39. package/dist/src/views/admin/categories/actions/create/create.d.ts +0 -1
  40. package/dist/src/views/admin/categories/actions/create/create.d.ts.map +0 -1
  41. package/dist/src/views/admin/categories/actions/create-edit/create-edit.d.ts +0 -8
  42. package/dist/src/views/admin/categories/actions/create-edit/create-edit.d.ts.map +0 -1
  43. package/dist/src/views/admin/categories/actions/create-edit/create-edit.js +0 -1
  44. package/dist/src/views/admin/categories/actions/create-edit/create-mutation-api.d.ts +0 -6
  45. package/dist/src/views/admin/categories/actions/create-edit/create-mutation-api.d.ts.map +0 -1
  46. package/dist/src/views/admin/categories/actions/create-edit/mutation-api.d.ts +0 -11
  47. package/dist/src/views/admin/categories/actions/create-edit/mutation-api.d.ts.map +0 -1
  48. package/dist/src/views/admin/categories/actions/create-edit/mutation-api.js +0 -1
  49. package/dist/src/views/admin/categories/actions/create-edit.d.ts +0 -2
  50. package/dist/src/views/admin/categories/actions/create-edit.d.ts.map +0 -1
  51. package/dist/src/views/admin/categories/actions.d.ts +0 -2
  52. package/dist/src/views/admin/categories/actions.d.ts.map +0 -1
  53. package/dist/src/views/admin/categories/categories-admin-view.d.ts +0 -4
  54. package/dist/src/views/admin/categories/categories-admin-view.d.ts.map +0 -1
  55. package/dist/src/views/admin/categories/categories-admin-view.js +0 -1
  56. package/dist/src/views/admin/categories/row-actions/delete/delete-action.d.ts +0 -5
  57. package/dist/src/views/admin/categories/row-actions/delete/delete-action.d.ts.map +0 -1
  58. package/dist/src/views/admin/categories/row-actions/delete/delete-action.js +0 -1
  59. package/dist/src/views/admin/categories/row-actions/delete/mutation-api.d.ts +0 -4
  60. package/dist/src/views/admin/categories/row-actions/delete/mutation-api.d.ts.map +0 -1
  61. package/dist/src/views/admin/categories/row-actions/delete/mutation-api.js +0 -1
  62. package/dist/src/views/admin/categories/row-actions/edit-action.d.ts +0 -9
  63. package/dist/src/views/admin/categories/row-actions/edit-action.d.ts.map +0 -1
  64. package/dist/src/views/admin/categories/row-actions/edit-action.js +0 -1
  65. package/dist/src/views/admin/categories/row-actions/mutation-api.d.ts +0 -4
  66. package/dist/src/views/admin/categories/row-actions/mutation-api.d.ts.map +0 -1
  67. package/dist/src/views/admin/categories/row-actions/row-actions.d.ts +0 -3
  68. package/dist/src/views/admin/categories/row-actions/row-actions.d.ts.map +0 -1
  69. package/dist/src/views/admin/categories-admin-view.d.ts +0 -4
  70. package/dist/src/views/admin/categories-admin-view.d.ts.map +0 -1
  71. package/dist/tsconfig.tsbuildinfo +0 -1
package/package.json CHANGED
@@ -1,9 +1,23 @@
1
1
  {
2
2
  "name": "@vitnode/blog",
3
- "version": "1.2.0-canary.10",
4
- "description": "Blog plugin for VitNode",
5
- "author": "VitNode",
3
+ "version": "1.2.0-canary.12",
4
+ "description": "Blog plugin for VitNode, providing a blogging platform with Next.js and Hono.js.",
5
+ "author": "VitNode Team",
6
+ "license": "MIT",
6
7
  "homepage": "https://vitnode.com",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/aXenDeveloper/vitnode.git",
11
+ "directory": "plugins/blog"
12
+ },
13
+ "keywords": [
14
+ "vitnode",
15
+ "react",
16
+ "hono.js",
17
+ "next.js",
18
+ "typescript",
19
+ "blog"
20
+ ],
7
21
  "type": "module",
8
22
  "exports": {
9
23
  "./*": {
@@ -25,7 +39,7 @@
25
39
  "react-hook-form": "^7.57.0",
26
40
  "sonner": "^2.0.5",
27
41
  "zod": "^3.25.56",
28
- "@vitnode/core": "1.2.0-canary.10"
42
+ "@vitnode/core": "1.2.0-canary.12"
29
43
  },
30
44
  "devDependencies": {
31
45
  "@swc/cli": "0.6.0",
@@ -36,7 +50,7 @@
36
50
  "eslint": "^9.25.1",
37
51
  "tsc-alias": "^1.8.15",
38
52
  "typescript": "^5.8.3",
39
- "eslint-config-typescript-vitnode": "1.2.0-canary.10"
53
+ "@vitnode/eslint-config": "1.2.0-canary.12"
40
54
  },
41
55
  "scripts": {
42
56
  "build:plugins": "tsc && swc src -d dist --config-file .swcrc && tsc-alias -p tsconfig.json",
@@ -1,343 +0,0 @@
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, "/", {
3
- in: {
4
- query: {
5
- orderBy?: "updatedAt" | undefined;
6
- cursor?: string | undefined;
7
- first?: string | undefined;
8
- last?: string | undefined;
9
- order?: "asc" | "desc" | undefined;
10
- };
11
- };
12
- out: {
13
- query: {
14
- orderBy?: "updatedAt" | undefined;
15
- cursor?: string | undefined;
16
- first?: string | undefined;
17
- last?: string | undefined;
18
- order?: "asc" | "desc" | undefined;
19
- };
20
- };
21
- }>) => Promise<Response & import("hono").TypedResponse<{
22
- edges: {
23
- id: number;
24
- title: string;
25
- createdAt: string;
26
- updatedAt: string;
27
- titleSeo: string;
28
- }[];
29
- pageInfo: {
30
- count: number;
31
- endCursor: null | number;
32
- hasNextPage: boolean;
33
- hasPreviousPage: boolean;
34
- startCursor: null | number;
35
- totalCount: number;
36
- };
37
- }, 200, "json">>;
38
- pluginId: "@vitnode/blog";
39
- route: {
40
- method: "get";
41
- path: "/";
42
- request: {
43
- query: import("zod").ZodObject<{
44
- cursor: import("zod").ZodOptional<import("zod").ZodString>;
45
- first: import("zod").ZodOptional<import("zod").ZodString>;
46
- last: import("zod").ZodOptional<import("zod").ZodString>;
47
- } & {
48
- order: import("zod").ZodOptional<import("zod").ZodEnum<["asc", "desc"]>>;
49
- orderBy: import("zod").ZodOptional<import("zod").ZodEnum<["updatedAt"]>>;
50
- }, "strip", import("zod").ZodTypeAny, {
51
- orderBy?: "updatedAt" | undefined;
52
- cursor?: string | undefined;
53
- first?: string | undefined;
54
- last?: string | undefined;
55
- order?: "asc" | "desc" | undefined;
56
- }, {
57
- orderBy?: "updatedAt" | undefined;
58
- cursor?: string | undefined;
59
- first?: string | undefined;
60
- last?: string | undefined;
61
- order?: "asc" | "desc" | undefined;
62
- }>;
63
- };
64
- responses: {
65
- 200: {
66
- content: {
67
- 'application/json': {
68
- schema: import("zod").ZodObject<{
69
- edges: import("zod").ZodArray<import("zod").ZodObject<{
70
- id: import("zod").ZodNumber;
71
- title: import("zod").ZodString;
72
- createdAt: import("zod").ZodDate;
73
- updatedAt: import("zod").ZodDate;
74
- }, "strip", import("zod").ZodTypeAny, {
75
- title: string;
76
- id: number;
77
- createdAt: Date;
78
- updatedAt: Date;
79
- }, {
80
- title: string;
81
- id: number;
82
- createdAt: Date;
83
- updatedAt: Date;
84
- }>, "many">;
85
- pageInfo: import("zod").ZodObject<{
86
- totalCount: import("zod").ZodNumber;
87
- count: import("zod").ZodNumber;
88
- hasNextPage: import("zod").ZodBoolean;
89
- hasPreviousPage: import("zod").ZodBoolean;
90
- startCursor: import("zod").ZodNullable<import("zod").ZodNumber>;
91
- endCursor: import("zod").ZodNullable<import("zod").ZodNumber>;
92
- }, "strip", import("zod").ZodTypeAny, {
93
- count: number;
94
- totalCount: number;
95
- hasNextPage: boolean;
96
- hasPreviousPage: boolean;
97
- startCursor: number | null;
98
- endCursor: number | null;
99
- }, {
100
- count: number;
101
- totalCount: number;
102
- hasNextPage: boolean;
103
- hasPreviousPage: boolean;
104
- startCursor: number | null;
105
- endCursor: number | null;
106
- }>;
107
- }, "strip", import("zod").ZodTypeAny, {
108
- edges: {
109
- title: string;
110
- id: number;
111
- createdAt: Date;
112
- updatedAt: Date;
113
- }[];
114
- pageInfo: {
115
- count: number;
116
- totalCount: number;
117
- hasNextPage: boolean;
118
- hasPreviousPage: boolean;
119
- startCursor: number | null;
120
- endCursor: number | null;
121
- };
122
- }, {
123
- edges: {
124
- title: string;
125
- id: number;
126
- createdAt: Date;
127
- updatedAt: Date;
128
- }[];
129
- pageInfo: {
130
- count: number;
131
- totalCount: number;
132
- hasNextPage: boolean;
133
- hasPreviousPage: boolean;
134
- startCursor: number | null;
135
- endCursor: number | null;
136
- };
137
- }>;
138
- };
139
- };
140
- description: string;
141
- };
142
- };
143
- } & {
144
- getRoutingPath: () => "/";
145
- };
146
- }, {
147
- handler: (c: import("hono").Context<import("@vitnode/core/api/middlewares/global/global").EnvVitNode, "/", {
148
- in: {
149
- json: {
150
- title: string;
151
- };
152
- };
153
- out: {
154
- json: {
155
- title: string;
156
- };
157
- };
158
- }>) => Promise<Response & import("hono").TypedResponse<{
159
- title: string;
160
- id: number;
161
- createdAt: string;
162
- updatedAt: string;
163
- titleSeo: string;
164
- }, 201, "json">>;
165
- pluginId: "@vitnode/blog";
166
- route: {
167
- method: "post";
168
- path: "/";
169
- request: {
170
- body: {
171
- content: {
172
- 'application/json': {
173
- schema: import("zod").ZodObject<{
174
- title: import("zod").ZodString;
175
- }, "strip", import("zod").ZodTypeAny, {
176
- title: string;
177
- }, {
178
- title: string;
179
- }>;
180
- };
181
- };
182
- };
183
- };
184
- responses: {
185
- 201: {
186
- content: {
187
- 'application/json': {
188
- schema: import("zod").ZodObject<{
189
- id: import("zod").ZodNumber;
190
- title: import("zod").ZodString;
191
- createdAt: import("zod").ZodDate;
192
- updatedAt: import("zod").ZodDate;
193
- }, "strip", import("zod").ZodTypeAny, {
194
- title: string;
195
- id: number;
196
- createdAt: Date;
197
- updatedAt: Date;
198
- }, {
199
- title: string;
200
- id: number;
201
- createdAt: Date;
202
- updatedAt: Date;
203
- }>;
204
- };
205
- };
206
- description: string;
207
- };
208
- 400: {
209
- description: string;
210
- };
211
- };
212
- } & {
213
- getRoutingPath: () => "/";
214
- };
215
- }, {
216
- handler: (c: import("hono").Context<import("@vitnode/core/api/middlewares/global/global").EnvVitNode, "/:id", {
217
- in: {
218
- param: {
219
- id: string;
220
- };
221
- };
222
- out: {
223
- param: {
224
- id: number;
225
- };
226
- };
227
- } & {
228
- in: {
229
- json: {
230
- title: string;
231
- };
232
- };
233
- out: {
234
- json: {
235
- title: string;
236
- };
237
- };
238
- }>) => Promise<Response & import("hono").TypedResponse<{
239
- id: number;
240
- title: string;
241
- createdAt: string;
242
- updatedAt: string;
243
- titleSeo: string;
244
- }, 200 | 400 | 404, "json">>;
245
- pluginId: "@vitnode/blog";
246
- route: {
247
- method: "put";
248
- path: "/{id}";
249
- request: {
250
- params: import("zod").ZodObject<{
251
- id: import("zod").ZodEffects<import("zod").ZodString, number, string>;
252
- }, "strip", import("zod").ZodTypeAny, {
253
- id: number;
254
- }, {
255
- id: string;
256
- }>;
257
- body: {
258
- content: {
259
- 'application/json': {
260
- schema: import("zod").ZodObject<{
261
- title: import("zod").ZodString;
262
- }, "strip", import("zod").ZodTypeAny, {
263
- title: string;
264
- }, {
265
- title: string;
266
- }>;
267
- };
268
- };
269
- };
270
- };
271
- responses: {
272
- 200: {
273
- content: {
274
- 'application/json': {
275
- schema: import("zod").ZodObject<{
276
- id: import("zod").ZodNumber;
277
- title: import("zod").ZodString;
278
- createdAt: import("zod").ZodDate;
279
- updatedAt: import("zod").ZodDate;
280
- }, "strip", import("zod").ZodTypeAny, {
281
- title: string;
282
- id: number;
283
- createdAt: Date;
284
- updatedAt: Date;
285
- }, {
286
- title: string;
287
- id: number;
288
- createdAt: Date;
289
- updatedAt: Date;
290
- }>;
291
- };
292
- };
293
- description: string;
294
- };
295
- 400: {
296
- description: string;
297
- };
298
- 404: {
299
- description: string;
300
- };
301
- };
302
- } & {
303
- getRoutingPath: () => "/:id";
304
- };
305
- }, {
306
- handler: (c: import("hono").Context<import("@vitnode/core/api/middlewares/global/global").EnvVitNode, "/:id", {
307
- in: {
308
- param: {
309
- id: string;
310
- };
311
- };
312
- out: {
313
- param: {
314
- id: number;
315
- };
316
- };
317
- }>) => Promise<Response & import("hono").TypedResponse<null, 204, "body">>;
318
- pluginId: "@vitnode/blog";
319
- route: {
320
- method: "delete";
321
- path: "/{id}";
322
- request: {
323
- params: import("zod").ZodObject<{
324
- id: import("zod").ZodEffects<import("zod").ZodString, number, string>;
325
- }, "strip", import("zod").ZodTypeAny, {
326
- id: number;
327
- }, {
328
- id: string;
329
- }>;
330
- };
331
- responses: {
332
- 204: {
333
- description: string;
334
- };
335
- 404: {
336
- description: string;
337
- };
338
- };
339
- } & {
340
- getRoutingPath: () => "/:id";
341
- };
342
- }], 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>>[]>[]>;
343
- //# sourceMappingURL=categories.module.d.ts.map
@@ -1 +0,0 @@
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 +0,0 @@
1
- import{buildModule}from"@vitnode/core/api/lib/module";import{CONFIG_PLUGIN}from"../../../config";import{createCategoryRoute}from"./routes/create.route";import{deleteCategoryRoute}from"./routes/delete.route";import{editCategoryRoute}from"./routes/edit.route";import{categoriesRoute}from"./routes/get.route";export const categoriesModule=buildModule({...CONFIG_PLUGIN,name:"categories",routes:[categoriesRoute,createCategoryRoute,editCategoryRoute,deleteCategoryRoute]});
@@ -1,79 +0,0 @@
1
- import { z } from '@hono/zod-openapi';
2
- export declare const zodCreateCategorySchema: z.ZodObject<{
3
- title: z.ZodString;
4
- }, "strip", z.ZodTypeAny, {
5
- title: string;
6
- }, {
7
- title: string;
8
- }>;
9
- export declare const createCategoryRoute: {
10
- handler: (c: import("hono").Context<import("@vitnode/core/api/middlewares/global/global").EnvVitNode, "/", {
11
- in: {
12
- json: {
13
- title: string;
14
- };
15
- };
16
- out: {
17
- json: {
18
- title: string;
19
- };
20
- };
21
- }>) => Promise<Response & import("hono").TypedResponse<{
22
- title: string;
23
- id: number;
24
- createdAt: string;
25
- updatedAt: string;
26
- titleSeo: string;
27
- }, 201, "json">>;
28
- pluginId: "@vitnode/blog";
29
- route: {
30
- method: "post";
31
- path: "/";
32
- request: {
33
- body: {
34
- content: {
35
- 'application/json': {
36
- schema: z.ZodObject<{
37
- title: z.ZodString;
38
- }, "strip", z.ZodTypeAny, {
39
- title: string;
40
- }, {
41
- title: string;
42
- }>;
43
- };
44
- };
45
- };
46
- };
47
- responses: {
48
- 201: {
49
- content: {
50
- 'application/json': {
51
- schema: z.ZodObject<{
52
- id: z.ZodNumber;
53
- title: z.ZodString;
54
- createdAt: z.ZodDate;
55
- updatedAt: z.ZodDate;
56
- }, "strip", z.ZodTypeAny, {
57
- title: string;
58
- id: number;
59
- createdAt: Date;
60
- updatedAt: Date;
61
- }, {
62
- title: string;
63
- id: number;
64
- createdAt: Date;
65
- updatedAt: Date;
66
- }>;
67
- };
68
- };
69
- description: string;
70
- };
71
- 400: {
72
- description: string;
73
- };
74
- };
75
- } & {
76
- getRoutingPath: () => "/";
77
- };
78
- };
79
- //# sourceMappingURL=create.route.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create.route.d.ts","sourceRoot":"","sources":["../../../../../../src/api/modules/categories/routes/create.route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAStC,eAAO,MAAM,uBAAuB;;;;;;EAKlC,CAAC;AASH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyD9B,CAAC"}
@@ -1 +0,0 @@
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"../../../../config";import{blog_categories}from"../../../../database/categories";export const zodCreateCategorySchema=z.object({title:z.string().min(3,"Title must be at least 3 characters long").max(100,"Title must not exceed 100 characters")});const zodCategoryResponseSchema=z.object({id:z.number(),title:z.string(),createdAt:z.date(),updatedAt:z.date()});export const createCategoryRoute=buildRoute({...CONFIG_PLUGIN,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}=c.req.valid("json");const titleSeo=removeSpecialCharacters(title);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){throw new HTTPException(400,{message:"Category with this title already exists."})}const[category]=await c.get("db").insert(blog_categories).values({title,titleSeo:removeSpecialCharacters(title)}).returning();return c.json(category,201)}});
@@ -1,40 +0,0 @@
1
- import { z } from '@hono/zod-openapi';
2
- export declare const deleteCategoryRoute: {
3
- handler: (c: import("hono").Context<import("@vitnode/core/api/middlewares/global/global").EnvVitNode, "/:id", {
4
- in: {
5
- param: {
6
- id: string;
7
- };
8
- };
9
- out: {
10
- param: {
11
- id: number;
12
- };
13
- };
14
- }>) => Promise<Response & import("hono").TypedResponse<null, 204, "body">>;
15
- pluginId: "@vitnode/blog";
16
- route: {
17
- method: "delete";
18
- path: "/{id}";
19
- request: {
20
- params: z.ZodObject<{
21
- id: z.ZodEffects<z.ZodString, number, string>;
22
- }, "strip", z.ZodTypeAny, {
23
- id: number;
24
- }, {
25
- id: string;
26
- }>;
27
- };
28
- responses: {
29
- 204: {
30
- description: string;
31
- };
32
- 404: {
33
- description: string;
34
- };
35
- };
36
- } & {
37
- getRoutingPath: () => "/:id";
38
- };
39
- };
40
- //# sourceMappingURL=delete.route.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"delete.route.d.ts","sourceRoot":"","sources":["../../../../../../src/api/modules/categories/routes/delete.route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAQtC,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkC9B,CAAC"}
@@ -1 +0,0 @@
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"../../../../config";import{blog_categories}from"../../../../database/categories";export const deleteCategoryRoute=buildRoute({...CONFIG_PLUGIN,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 result=await c.get("db").delete(blog_categories).where(eq(blog_categories.id,id)).returning();if(result.length===0){throw new HTTPException(404)}return c.body(null,204)}});
@@ -1,100 +0,0 @@
1
- import { z } from '@hono/zod-openapi';
2
- export declare const zodEditCategorySchema: z.ZodObject<{
3
- title: z.ZodString;
4
- }, "strip", z.ZodTypeAny, {
5
- title: string;
6
- }, {
7
- title: string;
8
- }>;
9
- export declare const editCategoryRoute: {
10
- handler: (c: import("hono").Context<import("@vitnode/core/api/middlewares/global/global").EnvVitNode, "/:id", {
11
- in: {
12
- param: {
13
- id: string;
14
- };
15
- };
16
- out: {
17
- param: {
18
- id: number;
19
- };
20
- };
21
- } & {
22
- in: {
23
- json: {
24
- title: string;
25
- };
26
- };
27
- out: {
28
- json: {
29
- title: string;
30
- };
31
- };
32
- }>) => Promise<Response & import("hono").TypedResponse<{
33
- id: number;
34
- title: string;
35
- createdAt: string;
36
- updatedAt: string;
37
- titleSeo: string;
38
- }, 200 | 400 | 404, "json">>;
39
- pluginId: "@vitnode/blog";
40
- route: {
41
- method: "put";
42
- path: "/{id}";
43
- request: {
44
- params: z.ZodObject<{
45
- id: z.ZodEffects<z.ZodString, number, string>;
46
- }, "strip", z.ZodTypeAny, {
47
- id: number;
48
- }, {
49
- id: string;
50
- }>;
51
- body: {
52
- content: {
53
- 'application/json': {
54
- schema: z.ZodObject<{
55
- title: z.ZodString;
56
- }, "strip", z.ZodTypeAny, {
57
- title: string;
58
- }, {
59
- title: string;
60
- }>;
61
- };
62
- };
63
- };
64
- };
65
- responses: {
66
- 200: {
67
- content: {
68
- 'application/json': {
69
- schema: z.ZodObject<{
70
- id: z.ZodNumber;
71
- title: z.ZodString;
72
- createdAt: z.ZodDate;
73
- updatedAt: z.ZodDate;
74
- }, "strip", z.ZodTypeAny, {
75
- title: string;
76
- id: number;
77
- createdAt: Date;
78
- updatedAt: Date;
79
- }, {
80
- title: string;
81
- id: number;
82
- createdAt: Date;
83
- updatedAt: Date;
84
- }>;
85
- };
86
- };
87
- description: string;
88
- };
89
- 400: {
90
- description: string;
91
- };
92
- 404: {
93
- description: string;
94
- };
95
- };
96
- } & {
97
- getRoutingPath: () => "/:id";
98
- };
99
- };
100
- //# sourceMappingURL=edit.route.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"edit.route.d.ts","sourceRoot":"","sources":["../../../../../../src/api/modules/categories/routes/edit.route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAStC,eAAO,MAAM,qBAAqB;;;;;;EAKhC,CAAC;AASH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiF5B,CAAC"}
@@ -1 +0,0 @@
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"../../../../config";import{blog_categories}from"../../../../database/categories";export const zodEditCategorySchema=z.object({title:z.string().min(3,"Title must be at least 3 characters long").max(100,"Title must not exceed 100 characters")});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:zodEditCategorySchema}}}},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)}});