@vitnode/blog 1.2.0-canary.22 → 1.2.0-canary.24

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 (91) 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 +6 -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 +6 -1
  32. package/dist/src/api/modules/categories/routes/get.route.d.ts.map +1 -1
  33. package/dist/src/api/modules/categories/routes/get.route.js +1 -1
  34. package/dist/src/api/modules/posts/posts.module.d.ts +5 -246
  35. package/dist/src/api/modules/posts/posts.module.d.ts.map +1 -1
  36. package/dist/src/api/modules/posts/posts.module.js +1 -1
  37. package/dist/src/api/modules/posts/routes/get.route.d.ts +53 -5
  38. package/dist/src/api/modules/posts/routes/get.route.d.ts.map +1 -1
  39. package/dist/src/api/modules/posts/routes/get.route.js +1 -1
  40. package/dist/src/app_admin/blog/categories/page.d.ts +5 -1
  41. package/dist/src/app_admin/blog/categories/page.d.ts.map +1 -1
  42. package/dist/src/app_admin/blog/categories/page.js +1 -1
  43. package/dist/src/app_admin/blog/posts/page.d.ts +5 -1
  44. package/dist/src/app_admin/blog/posts/page.d.ts.map +1 -1
  45. package/dist/src/app_admin/blog/posts/page.js +1 -1
  46. package/dist/src/config.api.d.ts.map +1 -1
  47. package/dist/src/config.api.js +1 -1
  48. package/dist/src/views/admin/categories/actions/create-edit/create-edit.d.ts +1 -1
  49. package/dist/src/views/admin/categories/actions/create-edit/create-edit.d.ts.map +1 -1
  50. package/dist/src/views/admin/categories/actions/create-edit/create-edit.js +1 -1
  51. package/dist/src/views/admin/categories/actions/create-edit/mutation-api.d.ts +1 -1
  52. package/dist/src/views/admin/categories/actions/create-edit/mutation-api.d.ts.map +1 -1
  53. package/dist/src/views/admin/categories/actions/create-edit/mutation-api.js +1 -1
  54. package/dist/src/views/admin/categories/row-actions/delete/delete-action.d.ts.map +1 -1
  55. package/dist/src/views/admin/categories/row-actions/delete/delete-action.js +1 -1
  56. package/dist/src/views/admin/categories/row-actions/delete/mutation-api.d.ts.map +1 -1
  57. package/dist/src/views/admin/categories/row-actions/delete/mutation-api.js +1 -1
  58. package/dist/src/views/admin/categories/row-actions/edit-action.d.ts +1 -1
  59. package/dist/src/views/admin/categories/row-actions/edit-action.d.ts.map +1 -1
  60. package/dist/src/views/admin/posts/actions/create-edit/create-edit.d.ts +2 -2
  61. package/dist/src/views/admin/posts/actions/create-edit/create-edit.d.ts.map +1 -1
  62. package/dist/src/views/admin/posts/actions/create-edit/create-edit.js +1 -1
  63. package/dist/src/views/admin/posts/actions/create-edit/mutation-api.d.ts +11 -0
  64. package/dist/src/views/admin/posts/actions/create-edit/mutation-api.d.ts.map +1 -0
  65. package/dist/src/views/admin/posts/actions/create-edit/mutation-api.js +1 -0
  66. package/dist/src/views/admin/posts/posts-admin-view.d.ts.map +1 -1
  67. package/dist/src/views/admin/posts/posts-admin-view.js +1 -1
  68. package/dist/src/views/admin/posts/row-actions/delete/delete-action.d.ts.map +1 -1
  69. package/dist/src/views/admin/posts/row-actions/delete/delete-action.js +1 -1
  70. package/dist/src/views/admin/posts/row-actions/delete/mutation-api.d.ts.map +1 -1
  71. package/dist/src/views/admin/posts/row-actions/delete/mutation-api.js +1 -1
  72. package/dist/src/views/admin/posts/row-actions/edit-action.d.ts +9 -0
  73. package/dist/src/views/admin/posts/row-actions/edit-action.d.ts.map +1 -0
  74. package/dist/src/views/admin/posts/row-actions/edit-action.js +1 -0
  75. package/dist/tsconfig.tsbuildinfo +1 -1
  76. package/package.json +16 -16
  77. package/src/app_admin/blog/categories/page.tsx +12 -4
  78. package/src/app_admin/blog/posts/page.tsx +12 -3
  79. package/src/locales/en.json +6 -2
  80. package/dist/src/api/modules/categories/routes/create.route.d.ts.map +0 -1
  81. package/dist/src/api/modules/categories/routes/create.route.js +0 -1
  82. package/dist/src/api/modules/categories/routes/delete.route.d.ts.map +0 -1
  83. package/dist/src/api/modules/categories/routes/delete.route.js +0 -1
  84. package/dist/src/api/modules/categories/routes/edit.route.d.ts.map +0 -1
  85. package/dist/src/api/modules/categories/routes/edit.route.js +0 -1
  86. package/dist/src/api/modules/posts/routes/create.route.d.ts.map +0 -1
  87. package/dist/src/api/modules/posts/routes/create.route.js +0 -1
  88. package/dist/src/api/modules/posts/routes/delete.route.d.ts.map +0 -1
  89. package/dist/src/api/modules/posts/routes/delete.route.js +0 -1
  90. package/dist/src/api/modules/posts/routes/edit.route.d.ts.map +0 -1
  91. package/dist/src/api/modules/posts/routes/edit.route.js +0 -1
@@ -1,23 +1,23 @@
1
1
  export declare const postsModule: import("@vitnode/core/api/lib/module").BuildModuleReturn<"@vitnode/blog", "posts", [{
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
  orderBy?: "createdAt" | "updatedAt" | undefined;
6
+ categoryId?: string | undefined;
6
7
  cursor?: string | undefined;
7
8
  first?: string | undefined;
8
9
  last?: string | undefined;
9
10
  order?: "asc" | "desc" | undefined;
10
- categoryId?: string | undefined;
11
11
  };
12
12
  };
13
13
  out: {
14
14
  query: {
15
15
  orderBy?: "createdAt" | "updatedAt" | undefined;
16
+ categoryId?: number | undefined;
16
17
  cursor?: string | undefined;
17
18
  first?: string | undefined;
18
19
  last?: string | undefined;
19
20
  order?: "asc" | "desc" | undefined;
20
- categoryId?: number | undefined;
21
21
  };
22
22
  };
23
23
  }>) => Promise<Response & import("hono").TypedResponse<{
@@ -59,18 +59,18 @@ export declare const postsModule: import("@vitnode/core/api/lib/module").BuildMo
59
59
  categoryId: import("zod").ZodOptional<import("zod").ZodEffects<import("zod").ZodString, number, string>>;
60
60
  }, "strip", import("zod").ZodTypeAny, {
61
61
  orderBy?: "createdAt" | "updatedAt" | undefined;
62
+ categoryId?: number | undefined;
62
63
  cursor?: string | undefined;
63
64
  first?: string | undefined;
64
65
  last?: string | undefined;
65
66
  order?: "asc" | "desc" | undefined;
66
- categoryId?: number | undefined;
67
67
  }, {
68
68
  orderBy?: "createdAt" | "updatedAt" | undefined;
69
+ categoryId?: string | undefined;
69
70
  cursor?: string | undefined;
70
71
  first?: string | undefined;
71
72
  last?: string | undefined;
72
73
  order?: "asc" | "desc" | undefined;
73
- categoryId?: string | undefined;
74
74
  }>;
75
75
  };
76
76
  responses: {
@@ -203,246 +203,5 @@ export declare const postsModule: import("@vitnode/core/api/lib/module").BuildMo
203
203
  } & {
204
204
  getRoutingPath: () => "/";
205
205
  };
206
- }, {
207
- handler: (c: import("hono").Context<import("@vitnode/core/api/middlewares/global/global").EnvVitNode, "/", {
208
- in: {
209
- json: {
210
- title: string;
211
- content: string;
212
- categoryId: number;
213
- };
214
- };
215
- out: {
216
- json: {
217
- title: string;
218
- content: string;
219
- categoryId: number;
220
- };
221
- };
222
- }>) => Promise<Response & import("hono").TypedResponse<{
223
- id: number;
224
- title: string;
225
- createdAt: string;
226
- updatedAt: string;
227
- titleSeo: string;
228
- content: string;
229
- categoryId: number;
230
- }, 201, "json">>;
231
- pluginId: "@vitnode/blog";
232
- route: {
233
- method: "post";
234
- path: "/";
235
- request: {
236
- body: {
237
- content: {
238
- 'application/json': {
239
- schema: import("zod").ZodObject<{
240
- title: import("zod").ZodString;
241
- content: import("zod").ZodString;
242
- categoryId: import("zod").ZodNumber;
243
- }, "strip", import("zod").ZodTypeAny, {
244
- title: string;
245
- content: string;
246
- categoryId: number;
247
- }, {
248
- title: string;
249
- content: string;
250
- categoryId: number;
251
- }>;
252
- };
253
- };
254
- };
255
- };
256
- responses: {
257
- 201: {
258
- content: {
259
- 'application/json': {
260
- schema: import("zod").ZodObject<{
261
- id: import("zod").ZodNumber;
262
- title: import("zod").ZodString;
263
- titleSeo: import("zod").ZodString;
264
- content: import("zod").ZodString;
265
- categoryId: import("zod").ZodNumber;
266
- createdAt: import("zod").ZodDate;
267
- updatedAt: import("zod").ZodDate;
268
- }, "strip", import("zod").ZodTypeAny, {
269
- id: number;
270
- title: string;
271
- createdAt: Date;
272
- updatedAt: Date;
273
- titleSeo: string;
274
- content: string;
275
- categoryId: number;
276
- }, {
277
- id: number;
278
- title: string;
279
- createdAt: Date;
280
- updatedAt: Date;
281
- titleSeo: string;
282
- content: string;
283
- categoryId: number;
284
- }>;
285
- };
286
- };
287
- description: string;
288
- };
289
- 400: {
290
- description: string;
291
- };
292
- 404: {
293
- description: string;
294
- };
295
- };
296
- } & {
297
- getRoutingPath: () => "/";
298
- };
299
- }, {
300
- handler: (c: import("hono").Context<import("@vitnode/core/api/middlewares/global/global").EnvVitNode, "/:id", {
301
- in: {
302
- param: {
303
- id: string;
304
- };
305
- };
306
- out: {
307
- param: {
308
- id: number;
309
- };
310
- };
311
- } & {
312
- in: {
313
- json: {
314
- title: string;
315
- content: string;
316
- categoryId: number;
317
- };
318
- };
319
- out: {
320
- json: {
321
- title: string;
322
- content: string;
323
- categoryId: number;
324
- };
325
- };
326
- }>) => Promise<Response & import("hono").TypedResponse<{
327
- id: number;
328
- title: string;
329
- titleSeo: string;
330
- content: string;
331
- categoryId: number;
332
- createdAt: string;
333
- updatedAt: string;
334
- }, 400 | 200 | 404, "json">>;
335
- pluginId: "@vitnode/blog";
336
- route: {
337
- method: "put";
338
- path: "/{id}";
339
- request: {
340
- params: import("zod").ZodObject<{
341
- id: import("zod").ZodEffects<import("zod").ZodString, number, string>;
342
- }, "strip", import("zod").ZodTypeAny, {
343
- id: number;
344
- }, {
345
- id: string;
346
- }>;
347
- body: {
348
- content: {
349
- 'application/json': {
350
- schema: import("zod").ZodObject<{
351
- title: import("zod").ZodString;
352
- content: import("zod").ZodString;
353
- categoryId: import("zod").ZodNumber;
354
- }, "strip", import("zod").ZodTypeAny, {
355
- title: string;
356
- content: string;
357
- categoryId: number;
358
- }, {
359
- title: string;
360
- content: string;
361
- categoryId: number;
362
- }>;
363
- };
364
- };
365
- };
366
- };
367
- responses: {
368
- 200: {
369
- content: {
370
- 'application/json': {
371
- schema: import("zod").ZodObject<{
372
- id: import("zod").ZodNumber;
373
- title: import("zod").ZodString;
374
- titleSeo: import("zod").ZodString;
375
- content: import("zod").ZodString;
376
- categoryId: import("zod").ZodNumber;
377
- createdAt: import("zod").ZodDate;
378
- updatedAt: import("zod").ZodDate;
379
- }, "strip", import("zod").ZodTypeAny, {
380
- id: number;
381
- title: string;
382
- createdAt: Date;
383
- updatedAt: Date;
384
- titleSeo: string;
385
- content: string;
386
- categoryId: number;
387
- }, {
388
- id: number;
389
- title: string;
390
- createdAt: Date;
391
- updatedAt: Date;
392
- titleSeo: string;
393
- content: string;
394
- categoryId: number;
395
- }>;
396
- };
397
- };
398
- description: string;
399
- };
400
- 400: {
401
- description: string;
402
- };
403
- 404: {
404
- description: string;
405
- };
406
- };
407
- } & {
408
- getRoutingPath: () => "/:id";
409
- };
410
- }, {
411
- handler: (c: import("hono").Context<import("@vitnode/core/api/middlewares/global/global").EnvVitNode, "/:id", {
412
- in: {
413
- param: {
414
- id: string;
415
- };
416
- };
417
- out: {
418
- param: {
419
- id: number;
420
- };
421
- };
422
- }>) => Promise<Response & import("hono").TypedResponse<null, 204, "body">>;
423
- pluginId: "@vitnode/blog";
424
- route: {
425
- method: "delete";
426
- path: "/{id}";
427
- request: {
428
- params: import("zod").ZodObject<{
429
- id: import("zod").ZodEffects<import("zod").ZodString, number, string>;
430
- }, "strip", import("zod").ZodTypeAny, {
431
- id: number;
432
- }, {
433
- id: string;
434
- }>;
435
- };
436
- responses: {
437
- 204: {
438
- description: string;
439
- };
440
- 404: {
441
- description: string;
442
- };
443
- };
444
- } & {
445
- getRoutingPath: () => "/:id";
446
- };
447
206
  }], 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>>[]>[]>;
448
207
  //# sourceMappingURL=posts.module.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"posts.module.d.ts","sourceRoot":"","sources":["../../../../../src/api/modules/posts/posts.module.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wRAItB,CAAC"}
1
+ {"version":3,"file":"posts.module.d.ts","sourceRoot":"","sources":["../../../../../src/api/modules/posts/posts.module.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wRAItB,CAAC"}
@@ -1 +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";import{postsRoute}from"./routes/get.route.js";export const postsModule=buildModule({...CONFIG_PLUGIN,name:"posts",routes:[postsRoute,createPostRoute,editPostRoute,deletePostRoute]});
1
+ import{buildModule}from"@vitnode/core/api/lib/module";import{CONFIG_PLUGIN}from"../../../const.js";import{postsRoute}from"./routes/get.route.js";export const postsModule=buildModule({...CONFIG_PLUGIN,name:"posts",routes:[postsRoute]});
@@ -1,24 +1,72 @@
1
1
  import { z } from '@hono/zod-openapi';
2
+ export declare const zodPostSchema: z.ZodObject<{
3
+ id: z.ZodNumber;
4
+ title: z.ZodString;
5
+ titleSeo: z.ZodString;
6
+ content: z.ZodString;
7
+ categoryId: z.ZodNumber;
8
+ createdAt: z.ZodDate;
9
+ updatedAt: z.ZodDate;
10
+ category: z.ZodObject<{
11
+ id: z.ZodNumber;
12
+ title: z.ZodString;
13
+ titleSeo: z.ZodString;
14
+ }, "strip", z.ZodTypeAny, {
15
+ id: number;
16
+ title: string;
17
+ titleSeo: string;
18
+ }, {
19
+ id: number;
20
+ title: string;
21
+ titleSeo: string;
22
+ }>;
23
+ }, "strip", z.ZodTypeAny, {
24
+ id: number;
25
+ title: string;
26
+ createdAt: Date;
27
+ updatedAt: Date;
28
+ titleSeo: string;
29
+ content: string;
30
+ category: {
31
+ id: number;
32
+ title: string;
33
+ titleSeo: string;
34
+ };
35
+ categoryId: number;
36
+ }, {
37
+ id: number;
38
+ title: string;
39
+ createdAt: Date;
40
+ updatedAt: Date;
41
+ titleSeo: string;
42
+ content: string;
43
+ category: {
44
+ id: number;
45
+ title: string;
46
+ titleSeo: string;
47
+ };
48
+ categoryId: number;
49
+ }>;
2
50
  export declare const postsRoute: {
3
- handler: (c: import("hono").Context<import("@vitnode/core/api/middlewares/global/global").EnvVitNode, "/", {
51
+ handler: (c: import("hono").Context<import("@vitnode/core/api/middlewares/global.middleware").EnvVitNode, "/", {
4
52
  in: {
5
53
  query: {
6
54
  orderBy?: "createdAt" | "updatedAt" | undefined;
55
+ categoryId?: string | undefined;
7
56
  cursor?: string | undefined;
8
57
  first?: string | undefined;
9
58
  last?: string | undefined;
10
59
  order?: "asc" | "desc" | undefined;
11
- categoryId?: string | undefined;
12
60
  };
13
61
  };
14
62
  out: {
15
63
  query: {
16
64
  orderBy?: "createdAt" | "updatedAt" | undefined;
65
+ categoryId?: number | undefined;
17
66
  cursor?: string | undefined;
18
67
  first?: string | undefined;
19
68
  last?: string | undefined;
20
69
  order?: "asc" | "desc" | undefined;
21
- categoryId?: number | undefined;
22
70
  };
23
71
  };
24
72
  }>) => Promise<Response & import("hono").TypedResponse<{
@@ -60,18 +108,18 @@ export declare const postsRoute: {
60
108
  categoryId: z.ZodOptional<z.ZodEffects<z.ZodString, number, string>>;
61
109
  }, "strip", z.ZodTypeAny, {
62
110
  orderBy?: "createdAt" | "updatedAt" | undefined;
111
+ categoryId?: number | undefined;
63
112
  cursor?: string | undefined;
64
113
  first?: string | undefined;
65
114
  last?: string | undefined;
66
115
  order?: "asc" | "desc" | undefined;
67
- categoryId?: number | undefined;
68
116
  }, {
69
117
  orderBy?: "createdAt" | "updatedAt" | undefined;
118
+ categoryId?: string | undefined;
70
119
  cursor?: string | undefined;
71
120
  first?: string | undefined;
72
121
  last?: string | undefined;
73
122
  order?: "asc" | "desc" | undefined;
74
- categoryId?: string | undefined;
75
123
  }>;
76
124
  };
77
125
  responses: {
@@ -1 +1 @@
1
- {"version":3,"file":"get.route.d.ts","sourceRoot":"","sources":["../../../../../../src/api/modules/posts/routes/get.route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AA4BtC,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2ErB,CAAC"}
1
+ {"version":3,"file":"get.route.d.ts","sourceRoot":"","sources":["../../../../../../src/api/modules/posts/routes/get.route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAatC,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAaxB,CAAC;AAEH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2ErB,CAAC"}
@@ -1 +1 @@
1
- import{z}from"@hono/zod-openapi";import{buildRoute}from"@vitnode/core/api/lib/route";import{withPagination,zodPaginationPageInfo,zodPaginationQuery}from"@vitnode/core/api/lib/with-pagination";import{eq}from"drizzle-orm";import{CONFIG_PLUGIN}from"../../../../const.js";import{blog_categories}from"../../../../database/categories.js";import{blog_posts}from"../../../../database/posts.js";const zodPostSchema=z.object({id:z.number(),title:z.string(),titleSeo:z.string(),content:z.string(),categoryId:z.number(),createdAt:z.date(),updatedAt:z.date(),category:z.object({id:z.number(),title:z.string(),titleSeo:z.string()})});export const postsRoute=buildRoute({...CONFIG_PLUGIN,route:{method:"get",path:"/",request:{query:zodPaginationQuery.extend({order:z.enum(["asc","desc"]).optional(),orderBy:z.enum(["updatedAt","createdAt"]).optional(),categoryId:z.string().transform(Number).optional()})},responses:{200:{content:{"application/json":{schema:z.object({edges:z.array(zodPostSchema),pageInfo:zodPaginationPageInfo})}},description:"Posts retrieved successfully"}}},handler:async c=>{const query=c.req.valid("query");const data=await withPagination({c,params:{query},primaryCursor:blog_posts.id,query:async({limit,where,orderBy})=>await c.get("db").select({id:blog_posts.id,title:blog_posts.title,titleSeo:blog_posts.titleSeo,content:blog_posts.content,categoryId:blog_posts.categoryId,createdAt:blog_posts.createdAt,updatedAt:blog_posts.updatedAt,category:{id:blog_categories.id,title:blog_categories.title,titleSeo:blog_categories.titleSeo}}).from(blog_posts).innerJoin(blog_categories,eq(blog_posts.categoryId,blog_categories.id)).where(query.categoryId?eq(blog_posts.categoryId,query.categoryId):where).orderBy(orderBy).limit(limit),table:blog_posts,orderBy:{column:query.orderBy?blog_posts[query.orderBy]:blog_posts.updatedAt,order:query.order??"desc"}});return c.json(data)}});
1
+ import{z}from"@hono/zod-openapi";import{buildRoute}from"@vitnode/core/api/lib/route";import{withPagination,zodPaginationPageInfo,zodPaginationQuery}from"@vitnode/core/api/lib/with-pagination";import{eq}from"drizzle-orm";import{CONFIG_PLUGIN}from"../../../../const.js";import{blog_categories}from"../../../../database/categories.js";import{blog_posts}from"../../../../database/posts.js";export const zodPostSchema=z.object({id:z.number(),title:z.string(),titleSeo:z.string(),content:z.string(),categoryId:z.number(),createdAt:z.date(),updatedAt:z.date(),category:z.object({id:z.number(),title:z.string(),titleSeo:z.string()})});export const postsRoute=buildRoute({...CONFIG_PLUGIN,route:{method:"get",path:"/",request:{query:zodPaginationQuery.extend({order:z.enum(["asc","desc"]).optional(),orderBy:z.enum(["updatedAt","createdAt"]).optional(),categoryId:z.string().transform(Number).optional()})},responses:{200:{content:{"application/json":{schema:z.object({edges:z.array(zodPostSchema),pageInfo:zodPaginationPageInfo})}},description:"Posts retrieved successfully"}}},handler:async c=>{const query=c.req.valid("query");const data=await withPagination({c,params:{query},primaryCursor:blog_posts.id,query:async({limit,where,orderBy})=>await c.get("db").select({id:blog_posts.id,title:blog_posts.title,titleSeo:blog_posts.titleSeo,content:blog_posts.content,categoryId:blog_posts.categoryId,createdAt:blog_posts.createdAt,updatedAt:blog_posts.updatedAt,category:{id:blog_categories.id,title:blog_categories.title,titleSeo:blog_categories.titleSeo}}).from(blog_posts).innerJoin(blog_categories,eq(blog_posts.categoryId,blog_categories.id)).where(query.categoryId?eq(blog_posts.categoryId,query.categoryId):where).orderBy(orderBy).limit(limit),table:blog_posts,orderBy:{column:query.orderBy?blog_posts[query.orderBy]:blog_posts.updatedAt,order:query.order??"desc"}});return c.json(data)}});
@@ -1,5 +1,9 @@
1
1
  import type { Metadata } from 'next';
2
- import { CategoriesAdminView } from '../../../views/admin/categories/categories-admin-view';
2
+ import React from 'react';
3
+ declare const CategoriesAdminView: React.LazyExoticComponent<({ searchParams, }: {
4
+ searchParams: Promise<Record<string, string | string[] | undefined>>;
5
+ }) => Promise<import("react/jsx-runtime").JSX.Element>>;
3
6
  export declare const generateMetadata: () => Promise<Metadata>;
4
7
  export default function CategoriesPage(params: React.ComponentProps<typeof CategoriesAdminView>): Promise<import("react/jsx-runtime").JSX.Element>;
8
+ export {};
5
9
  //# sourceMappingURL=page.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../../../../src/app_admin/blog/categories/page.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAMrC,OAAO,EAAE,mBAAmB,EAAE,MAAM,gDAAgD,CAAC;AAIrF,eAAO,MAAM,gBAAgB,QAAa,OAAO,CAAC,QAAQ,CAMzD,CAAC;AAEF,wBAA8B,cAAc,CAC1C,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,mBAAmB,CAAC,oDAkBzD"}
1
+ {"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../../../../src/app_admin/blog/categories/page.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAMrC,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,QAAA,MAAM,mBAAmB;;uDAIxB,CAAC;AAEF,eAAO,MAAM,gBAAgB,QAAa,OAAO,CAAC,QAAQ,CAMzD,CAAC;AAEF,wBAA8B,cAAc,CAC1C,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,mBAAmB,CAAC,oDAoBzD"}
@@ -1 +1 @@
1
- import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{I18nProvider}from"@vitnode/core/components/i18n-provider";import{HeaderContent}from"@vitnode/core/components/ui/header-content";import{getTranslations}from"next-intl/server";import{CategoriesAdminView}from"../../../views/admin/categories/categories-admin-view.js";import{ActionsCategoriesAdmin}from"../../../views/admin/categories/actions/actions.js";export const generateMetadata=async()=>{const t=await getTranslations("@vitnode/blog.admin.nav");return{title:t("categories")}};export default async function CategoriesPage(params){const[t,tNav]=await Promise.all([getTranslations("@vitnode/blog.admin.categories"),getTranslations("@vitnode/blog.admin.nav")]);return _jsx(I18nProvider,{namespaces:["@vitnode/blog.admin.categories"],children:_jsxs("div",{className:"container mx-auto p-4",children:[_jsx(HeaderContent,{desc:t("desc"),h1:tNav("categories"),children:_jsx(ActionsCategoriesAdmin,{})}),_jsx(CategoriesAdminView,{...params})]})})}
1
+ import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{I18nProvider}from"@vitnode/core/components/i18n-provider";import{DataTableSkeleton}from"@vitnode/core/components/table/data-table";import{HeaderContent}from"@vitnode/core/components/ui/header-content";import{getTranslations}from"next-intl/server";import React from"react";import{ActionsCategoriesAdmin}from"../../../views/admin/categories/actions/actions.js";const CategoriesAdminView=React.lazy(async()=>import("../../../views/admin/categories/categories-admin-view.js").then(mod=>({default:mod.CategoriesAdminView})));export const generateMetadata=async()=>{const t=await getTranslations("@vitnode/blog.admin.nav");return{title:t("categories")}};export default async function CategoriesPage(params){const[t,tNav]=await Promise.all([getTranslations("@vitnode/blog.admin.categories"),getTranslations("@vitnode/blog.admin.nav")]);return _jsx(I18nProvider,{namespaces:["@vitnode/blog.admin.categories"],children:_jsxs("div",{className:"p-4",children:[_jsx(HeaderContent,{desc:t("desc"),h1:tNav("categories"),children:_jsx(ActionsCategoriesAdmin,{})}),_jsx(React.Suspense,{fallback:_jsx(DataTableSkeleton,{columns:4}),children:_jsx(CategoriesAdminView,{...params})})]})})}
@@ -1,5 +1,9 @@
1
1
  import type { Metadata } from 'next';
2
- import { PostsAdminView } from '../../../views/admin/posts/posts-admin-view';
2
+ import React from 'react';
3
+ declare const PostsAdminView: React.LazyExoticComponent<({ searchParams, }: {
4
+ searchParams: Promise<Record<string, string | string[] | undefined>>;
5
+ }) => Promise<import("react/jsx-runtime").JSX.Element>>;
3
6
  export declare const generateMetadata: () => Promise<Metadata>;
4
7
  export default function PostsPage(params: React.ComponentProps<typeof PostsAdminView>): Promise<import("react/jsx-runtime").JSX.Element>;
8
+ export {};
5
9
  //# sourceMappingURL=page.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../../../../src/app_admin/blog/posts/page.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAOrC,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAEtE,eAAO,MAAM,gBAAgB,QAAa,OAAO,CAAC,QAAQ,CAMzD,CAAC;AAEF,wBAA8B,SAAS,CACrC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,oDAkBpD"}
1
+ {"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../../../../src/app_admin/blog/posts/page.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAMrC,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,QAAA,MAAM,cAAc;;uDAInB,CAAC;AAEF,eAAO,MAAM,gBAAgB,QAAa,OAAO,CAAC,QAAQ,CAMzD,CAAC;AAEF,wBAA8B,SAAS,CACrC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,oDAoBpD"}
@@ -1 +1 @@
1
- import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{I18nProvider}from"@vitnode/core/components/i18n-provider";import{HeaderContent}from"@vitnode/core/components/ui/header-content";import{getTranslations}from"next-intl/server";import{ActionsPostsAdmin}from"../../../views/admin/posts/actions/actions.js";import{PostsAdminView}from"../../../views/admin/posts/posts-admin-view.js";export const generateMetadata=async()=>{const t=await getTranslations("@vitnode/blog.admin.nav");return{title:t("posts")}};export default async function PostsPage(params){const[t,tNav]=await Promise.all([getTranslations("@vitnode/blog.admin.posts"),getTranslations("@vitnode/blog.admin.nav")]);return _jsx(I18nProvider,{namespaces:["@vitnode/blog.admin.posts"],children:_jsxs("div",{className:"container mx-auto p-4",children:[_jsx(HeaderContent,{desc:t("desc"),h1:tNav("posts"),children:_jsx(ActionsPostsAdmin,{})}),_jsx(PostsAdminView,{...params})]})})}
1
+ import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{I18nProvider}from"@vitnode/core/components/i18n-provider";import{DataTableSkeleton}from"@vitnode/core/components/table/data-table";import{HeaderContent}from"@vitnode/core/components/ui/header-content";import{getTranslations}from"next-intl/server";import React from"react";import{ActionsPostsAdmin}from"../../../views/admin/posts/actions/actions.js";const PostsAdminView=React.lazy(async()=>import("../../../views/admin/posts/posts-admin-view.js").then(mod=>({default:mod.PostsAdminView})));export const generateMetadata=async()=>{const t=await getTranslations("@vitnode/blog.admin.nav");return{title:t("posts")}};export default async function PostsPage(params){const[t,tNav]=await Promise.all([getTranslations("@vitnode/blog.admin.posts"),getTranslations("@vitnode/blog.admin.nav")]);return _jsx(I18nProvider,{namespaces:["@vitnode/blog.admin.posts"],children:_jsxs("div",{className:"p-4",children:[_jsx(HeaderContent,{desc:t("desc"),h1:tNav("posts"),children:_jsx(ActionsPostsAdmin,{})}),_jsx(React.Suspense,{fallback:_jsx(DataTableSkeleton,{columns:5}),children:_jsx(PostsAdminView,{...params})})]})})}
@@ -1 +1 @@
1
- {"version":3,"file":"config.api.d.ts","sourceRoot":"","sources":["../../src/config.api.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,aAAa,mEAKzB,CAAC"}
1
+ {"version":3,"file":"config.api.d.ts","sourceRoot":"","sources":["../../src/config.api.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,aAAa,mEAKzB,CAAC"}
@@ -1 +1 @@
1
- import{buildApiPlugin}from"@vitnode/core/api/lib/plugin";import{CONFIG_PLUGIN}from"./const.js";import{categoriesModule}from"./api/modules/categories/categories.module.js";import{postsModule}from"./api/modules/posts/posts.module.js";export const blogApiPlugin=()=>{return buildApiPlugin({...CONFIG_PLUGIN,modules:[categoriesModule,postsModule]})};
1
+ import{buildApiPlugin}from"@vitnode/core/api/lib/plugin";import{CONFIG_PLUGIN}from"./const.js";import{adminModule}from"./api/modules/admin/admin.module.js";import{categoriesModule}from"./api/modules/categories/categories.module.js";import{postsModule}from"./api/modules/posts/posts.module.js";export const blogApiPlugin=()=>{return buildApiPlugin({...CONFIG_PLUGIN,modules:[adminModule,categoriesModule,postsModule]})};
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import type { zodCreateCategorySchema } from '../../../../../api/modules/categories/routes/create.route';
2
+ import type { zodCreateCategorySchema } from '../../../../../api/modules/admin/categories/routes/create.route';
3
3
  export declare const CreateEditActionCategoriesAdmin: ({ data, }: {
4
4
  data?: z.infer<typeof zodCreateCategorySchema> & {
5
5
  id: number;
@@ -1 +1 @@
1
- {"version":3,"file":"create-edit.d.ts","sourceRoot":"","sources":["../../../../../../../src/views/admin/categories/actions/create-edit/create-edit.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AAI5F,eAAO,MAAM,+BAA+B,GAAI,WAE7C;IACD,IAAI,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,GAAG;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;CACjE,4CA4EA,CAAC"}
1
+ {"version":3,"file":"create-edit.d.ts","sourceRoot":"","sources":["../../../../../../../src/views/admin/categories/actions/create-edit/create-edit.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oDAAoD,CAAC;AAIlG,eAAO,MAAM,+BAA+B,GAAI,WAE7C;IACD,IAAI,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,GAAG;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;CACjE,4CAqEA,CAAC"}
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{AutoForm}from"@vitnode/core/components/form/auto-form";import{AutoFormInput}from"@vitnode/core/components/form/fields/input";import{useDialog}from"@vitnode/core/components/ui/dialog";import{usePathname,useRouter}from"@vitnode/core/lib/navigation";import{useTranslations}from"next-intl";import{toast}from"sonner";import{z}from"zod";import{createMutationApi,editMutationApi}from"./mutation-api.js";export const CreateEditActionCategoriesAdmin=({data})=>{const t=useTranslations("@vitnode/blog.admin.categories");const tCore=useTranslations("core.global.errors");const{setOpen}=useDialog();const{push}=useRouter();const pathname=usePathname();const formSchema=z.object({title:z.string().min(3,{message:tCore("field_min_length",{min:3})}).default(data?.title??"")});const onSubmit=async(values,form)=>{let error="";if(data?.id){const mutation=await editMutationApi({id:data.id,...values});if(mutation?.error){error=mutation.error}}else{const mutation=await createMutationApi(values);if(mutation?.error){error=mutation.error}}if(error){if(error.includes("already exists")){form.setError("title",{type:"manual",message:t("create.form.title.already_exists")});return}toast.error(tCore("title"),{description:tCore("internal_server_error")});return}setOpen?.(false);push(pathname)};return _jsx(AutoForm,{fields:[{id:"title",component:props=>_jsx(AutoFormInput,{label:t("create.form.title.label"),...props})}],formSchema:formSchema,onSubmit:onSubmit,submitButtonProps:{children:t(`${data?"edit":"create"}.submit`)}})};
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{AutoForm}from"@vitnode/core/components/form/auto-form";import{AutoFormInput}from"@vitnode/core/components/form/fields/input";import{useDialog}from"@vitnode/core/components/ui/dialog";import{usePathname,useRouter}from"@vitnode/core/lib/navigation";import{useTranslations}from"next-intl";import{toast}from"sonner";import{z}from"zod";import{createMutationApi,editMutationApi}from"./mutation-api.js";export const CreateEditActionCategoriesAdmin=({data})=>{const t=useTranslations("@vitnode/blog.admin.categories");const tCore=useTranslations("core.global.errors");const{setOpen}=useDialog();const{push}=useRouter();const pathname=usePathname();const formSchema=z.object({title:z.string().default(data?.title??"")});const onSubmit=async(values,form)=>{let error="";if(data?.id){const mutation=await editMutationApi({id:data.id,...values});if(mutation?.error){error=mutation.error}}else{const mutation=await createMutationApi(values);if(mutation?.error){error=mutation.error}}if(error){if(error.includes("already exists")){form.setError("title",{type:"manual",message:t("create.form.title.already_exists")});return}toast.error(tCore("title"),{description:tCore("internal_server_error")});return}setOpen?.(false);push(pathname)};return _jsx(AutoForm,{fields:[{id:"title",component:props=>_jsx(AutoFormInput,{label:t("create.form.title.label"),...props})}],formSchema:formSchema,onSubmit:onSubmit,submitButtonProps:{children:t(`${data?"edit":"create"}.submit`)}})};
@@ -1,5 +1,5 @@
1
1
  import type { z } from 'zod';
2
- import type { zodCreateCategorySchema } from '../../../../../api/modules/categories/routes/create.route';
2
+ import type { zodCreateCategorySchema } from '../../../../../api/modules/admin/categories/routes/create.route';
3
3
  export declare const createMutationApi: (body: z.infer<typeof zodCreateCategorySchema>) => Promise<{
4
4
  error: string;
5
5
  } | undefined>;
@@ -1 +1 @@
1
- {"version":3,"file":"mutation-api.d.ts","sourceRoot":"","sources":["../../../../../../../src/views/admin/categories/actions/create-edit/mutation-api.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAK7B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AAI5F,eAAO,MAAM,iBAAiB,GAC5B,MAAM,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC;;cAmB9C,CAAC;AAEF,eAAO,MAAM,eAAe,GAAU,iBAGnC,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE;;cAqB1D,CAAC"}
1
+ {"version":3,"file":"mutation-api.d.ts","sourceRoot":"","sources":["../../../../../../../src/views/admin/categories/actions/create-edit/mutation-api.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAK7B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iEAAiE,CAAC;AAI/G,eAAO,MAAM,iBAAiB,GAC5B,MAAM,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC;;cAoB9C,CAAC;AAEF,eAAO,MAAM,eAAe,GAAU,iBAGnC,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE;;cAsB1D,CAAC"}
@@ -1 +1 @@
1
- "use server";import{fetcher}from"@vitnode/core/lib/fetcher";import{revalidatePath}from"next/cache";import{categoriesModule}from"../../../../../api/modules/categories/categories.module.js";export const createMutationApi=async body=>{const res=await fetcher(categoriesModule,{method:"post",module:"categories",path:"/",args:{body}});if(res.status!==201){return{error:await res.text()}}revalidatePath("/[locale]/admin/(auth)/(plugins)/(vitnode-blog)/blog/categories","page")};export const editMutationApi=async({id,...body})=>{const res=await fetcher(categoriesModule,{method:"put",module:"categories",path:"/{id}",args:{params:{id},body}});if(res.status!==200){return{error:await res.text()}}revalidatePath("/[locale]/admin/(auth)/(plugins)/(vitnode-blog)/blog/categories","page")};
1
+ "use server";import{fetcher}from"@vitnode/core/lib/fetcher";import{revalidatePath}from"next/cache";import{categoriesAdminModule}from"../../../../../api/modules/admin/categories/categories.admin.module.js";export const createMutationApi=async body=>{const res=await fetcher(categoriesAdminModule,{prefixPath:"/admin",method:"post",module:"categories",path:"/",args:{body}});if(res.status!==201){return{error:await res.text()}}revalidatePath("/[locale]/admin/(auth)/(plugins)/(vitnode-blog)/blog/categories","page")};export const editMutationApi=async({id,...body})=>{const res=await fetcher(categoriesAdminModule,{prefixPath:"/admin",method:"put",module:"categories",path:"/{id}",args:{params:{id},body}});if(res.status!==200){return{error:await res.text()}}revalidatePath("/[locale]/admin/(auth)/(plugins)/(vitnode-blog)/blog/categories","page")};
@@ -1 +1 @@
1
- {"version":3,"file":"delete-action.d.ts","sourceRoot":"","sources":["../../../../../../../src/views/admin/categories/row-actions/delete/delete-action.tsx"],"names":[],"mappings":"AA0BA,eAAO,MAAM,YAAY,GAAI,eAAe;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,4CAsDxE,CAAC"}
1
+ {"version":3,"file":"delete-action.d.ts","sourceRoot":"","sources":["../../../../../../../src/views/admin/categories/row-actions/delete/delete-action.tsx"],"names":[],"mappings":"AAgBA,eAAO,MAAM,YAAY,GAAI,eAAe;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,4CA0CxE,CAAC"}
@@ -1 +1 @@
1
- "use client";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{AlertDialog,AlertDialogAction,AlertDialogCancel,AlertDialogContent,AlertDialogDescription,AlertDialogFooter,AlertDialogHeader,AlertDialogTitle,AlertDialogTrigger}from"@vitnode/core/components/ui/alert-dialog";import{Button}from"@vitnode/core/components/ui/button";import{Tooltip,TooltipContent,TooltipProvider,TooltipTrigger}from"@vitnode/core/components/ui/tooltip";import{Trash2Icon}from"lucide-react";import{useTranslations}from"next-intl";import{toast}from"sonner";import{mutationApi}from"./mutation-api.js";export const DeleteAction=({title,id})=>{const t=useTranslations("@vitnode/blog.admin.categories.delete");const tGlobal=useTranslations("core.global");return _jsxs(AlertDialog,{children:[_jsx(TooltipProvider,{children:_jsxs(Tooltip,{children:[_jsx(TooltipTrigger,{asChild:true,children:_jsx(AlertDialogTrigger,{asChild:true,children:_jsx(Button,{size:"icon",variant:"destructiveGhost",children:_jsx(Trash2Icon,{className:"size-4"})})})}),_jsx(TooltipContent,{children:t("title")})]})}),_jsxs(AlertDialogContent,{children:[_jsxs(AlertDialogHeader,{children:[_jsx(AlertDialogTitle,{children:t("title")}),_jsx(AlertDialogDescription,{children:t.rich("desc",{title:()=>_jsx("span",{className:"text-foreground font-bold",children:title})})})]}),_jsxs(AlertDialogFooter,{children:[_jsx(AlertDialogCancel,{children:tGlobal("cancel")}),_jsx(AlertDialogAction,{onClick:async()=>{const mutation=await mutationApi(id);if(mutation?.error){toast.error(tGlobal("errors.title"),{description:tGlobal("errors.internal_server_error")});return}toast.success(t("success"),{description:title})},children:t("confirm")})]})]})]})};
1
+ "use client";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{ConfirmActionAlertDialog}from"@vitnode/core/components/confirm-action/confirm-action-alert-dialog";import{Button}from"@vitnode/core/components/ui/button";import{Tooltip,TooltipContent,TooltipProvider,TooltipTrigger}from"@vitnode/core/components/ui/tooltip";import{Trash2Icon}from"lucide-react";import{useTranslations}from"next-intl";import{toast}from"sonner";import{mutationApi}from"./mutation-api.js";export const DeleteAction=({title,id})=>{const t=useTranslations("@vitnode/blog.admin.categories.delete");const tGlobal=useTranslations("core.global");return _jsx(TooltipProvider,{children:_jsxs(Tooltip,{children:[_jsx(ConfirmActionAlertDialog,{description:t.rich("desc",{title:()=>_jsx("span",{className:"text-foreground font-bold",children:title})}),onSubmit:async({onClose})=>{const mutation=await mutationApi(id);if(mutation?.error){toast.error(tGlobal("errors.title"),{description:tGlobal("errors.internal_server_error")});return}toast.success(t("success"),{description:title});onClose()},textSubmit:t("confirm"),title:t("title"),children:_jsx(TooltipTrigger,{asChild:true,children:_jsx(Button,{size:"icon",variant:"destructiveGhost",children:_jsx(Trash2Icon,{className:"size-4"})})})}),_jsx(TooltipContent,{children:t("title")})]})})};
@@ -1 +1 @@
1
- {"version":3,"file":"mutation-api.d.ts","sourceRoot":"","sources":["../../../../../../../src/views/admin/categories/row-actions/delete/mutation-api.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,WAAW,GAAU,IAAI,MAAM;;cAoB3C,CAAC"}
1
+ {"version":3,"file":"mutation-api.d.ts","sourceRoot":"","sources":["../../../../../../../src/views/admin/categories/row-actions/delete/mutation-api.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,WAAW,GAAU,IAAI,MAAM;;cAqB3C,CAAC"}
@@ -1 +1 @@
1
- "use server";import{fetcher}from"@vitnode/core/lib/fetcher";import{revalidatePath}from"next/cache";import{categoriesModule}from"../../../../../api/modules/categories/categories.module.js";export const mutationApi=async id=>{const res=await fetcher(categoriesModule,{method:"delete",path:"/{id}",module:"categories",args:{params:{id}}});if(!res.ok){return{error:await res.text()}}revalidatePath("/[locale]/admin/(auth)/(plugins)/(vitnode-blog)/blog/categories","page")};
1
+ "use server";import{fetcher}from"@vitnode/core/lib/fetcher";import{revalidatePath}from"next/cache";import{categoriesAdminModule}from"../../../../../api/modules/admin/categories/categories.admin.module.js";export const mutationApi=async id=>{const res=await fetcher(categoriesAdminModule,{prefixPath:"/admin",method:"delete",path:"/{id}",module:"categories",args:{params:{id}}});if(!res.ok){return{error:await res.text()}}revalidatePath("/[locale]/admin/(auth)/(plugins)/(vitnode-blog)/blog/categories","page")};
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  declare const CreateEditActionCategoriesAdmin: React.LazyExoticComponent<({ data, }: {
3
- data?: import("zod").TypeOf<typeof import("../../../../api/modules/categories/routes/create.route").zodCreateCategorySchema> & {
3
+ data?: import("zod").TypeOf<typeof import("../../../../api/modules/admin/categories/routes/create.route").zodCreateCategorySchema> & {
4
4
  id: number;
5
5
  };
6
6
  }) => import("react/jsx-runtime").JSX.Element>;
@@ -1 +1 @@
1
- {"version":3,"file":"edit-action.d.ts","sourceRoot":"","sources":["../../../../../../src/views/admin/categories/row-actions/edit-action.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,QAAA,MAAM,+BAA+B;QAEhB,CAAC;;;8CAErB,CAAC;AAEF,eAAO,MAAM,UAAU,GACrB,OAAO,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,+BAA+B,CAAC,CAAC,4CA+B9E,CAAC"}
1
+ {"version":3,"file":"edit-action.d.ts","sourceRoot":"","sources":["../../../../../../src/views/admin/categories/row-actions/edit-action.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,QAAA,MAAM,+BAA+B;QAEV,CAAC;;;8CAE3B,CAAC;AAEF,eAAO,MAAM,UAAU,GACrB,OAAO,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,+BAA+B,CAAC,CAAC,4CA+B9E,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { z } from 'zod';
2
- import type { zodCreatePostSchema } from '../../../../../api/modules/posts/routes/create.route';
2
+ import type { zodPostSchema } from '../../../../../api/modules/posts/routes/get.route';
3
3
  export declare const CreateEditActionPostsAdmin: ({ data, }: {
4
- data?: z.infer<typeof zodCreatePostSchema> & {
4
+ data?: z.infer<typeof zodPostSchema> & {
5
5
  id?: number;
6
6
  };
7
7
  }) => import("react/jsx-runtime").JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"create-edit.d.ts","sourceRoot":"","sources":["../../../../../../../src/views/admin/posts/actions/create-edit/create-edit.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAEnF,eAAO,MAAM,0BAA0B,GAAI,WAExC;IACD,IAAI,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,GAAG;QAAE,EAAE,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC9D,4CA2CA,CAAC"}
1
+ {"version":3,"file":"create-edit.d.ts","sourceRoot":"","sources":["../../../../../../../src/views/admin/posts/actions/create-edit/create-edit.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAM1E,eAAO,MAAM,0BAA0B,GAAI,WAExC;IACD,IAAI,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,GAAG;QAAE,EAAE,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACxD,4CAiIA,CAAC"}
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{AutoForm}from"@vitnode/core/components/form/auto-form";import{AutoFormInput}from"@vitnode/core/components/form/fields/input";import{AutoFormTextarea}from"@vitnode/core/components/form/fields/textarea";import{useTranslations}from"next-intl";import{z}from"zod";export const CreateEditActionPostsAdmin=({data})=>{const t=useTranslations("@vitnode/blog.admin.posts");const tCore=useTranslations("core.global.errors");const formSchema=z.object({title:z.string().min(3,{message:tCore("field_min_length",{min:3})}).default(data?.title??""),content:z.string().min(1,{message:tCore("field_required")})});return _jsx(AutoForm,{fields:[{id:"title",component:props=>_jsx(AutoFormInput,{label:t("create.form.title"),...props})},{id:"content",component:props=>_jsx(AutoFormTextarea,{label:t("create.form.content"),rows:10,...props})}],formSchema:formSchema,submitButtonProps:{children:t(`${data?"edit":"create"}.submit`)}})};
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{AutoForm}from"@vitnode/core/components/form/auto-form";import{AutoFormComboboxAsync}from"@vitnode/core/components/form/fields/combobox-async";import{AutoFormInput}from"@vitnode/core/components/form/fields/input";import{AutoFormTextarea}from"@vitnode/core/components/form/fields/textarea";import{useDialog}from"@vitnode/core/components/ui/dialog";import{fetcherClient}from"@vitnode/core/lib/fetcher-client";import{usePathname,useRouter}from"@vitnode/core/lib/navigation";import{useTranslations}from"next-intl";import{toast}from"sonner";import{z}from"zod";import{categoriesModule}from"../../../../../api/modules/categories/categories.module.js";import{createMutationApi,editMutationApi}from"./mutation-api.js";export const CreateEditActionPostsAdmin=({data})=>{const t=useTranslations("@vitnode/blog.admin.posts");const tCore=useTranslations("core.global.errors");const{setOpen}=useDialog();const{push}=useRouter();const pathname=usePathname();const formSchema=z.object({title:z.string().min(3,{message:tCore("field_min_length",{min:3})}).default(data?.title??""),content:z.string().default(data?.content??""),categoryId:z.object({value:z.string(),label:z.string()}).refine(value=>value.value!=="",{message:tCore("field_required")}).default(data?.category?{value:data.category.id.toString(),label:data.category.title}:{value:"",label:""})});const onSubmit=async(values,form)=>{let error="";if(data?.id){const mutation=await editMutationApi({id:data.id,...values,categoryId:parseInt(values.categoryId.value,10)});if(mutation?.error){error=mutation.error}}else{const mutation=await createMutationApi({...values,categoryId:parseInt(values.categoryId.value,10)});if(mutation?.error){error=mutation.error}}if(error){if(error.includes("already exists")){form.setError("title",{type:"manual",message:t("create.form.title.already_exists")});return}toast.error(tCore("title"),{description:tCore("internal_server_error")});return}setOpen?.(false);push(pathname)};return _jsx(AutoForm,{fields:[{id:"title",component:props=>_jsx(AutoFormInput,{label:t("create.form.title.label"),...props})},{id:"categoryId",component:props=>_jsx(AutoFormComboboxAsync,{fetchData:async({search})=>{const res=await fetcherClient(categoriesModule,{path:"/",method:"get",module:"categories",args:{query:{search}}});const data=await res.json();return data.edges.map(category=>({label:category.title,value:category.id.toString()}))},id:"categoryId",label:t("create.form.category"),...props})},{id:"content",component:props=>_jsx(AutoFormTextarea,{label:t("create.form.content"),rows:10,...props})}],formSchema:formSchema,onSubmit:onSubmit,submitButtonProps:{children:t(`${data?"edit":"create"}.submit`)}})};
@@ -0,0 +1,11 @@
1
+ import type { z } from 'zod';
2
+ import type { zodCreatePostSchema } from '../../../../../api/modules/admin/posts/routes/create.route';
3
+ export declare const createMutationApi: (body: z.infer<typeof zodCreatePostSchema>) => Promise<{
4
+ error: string;
5
+ } | undefined>;
6
+ export declare const editMutationApi: ({ id, ...body }: z.infer<typeof zodCreatePostSchema> & {
7
+ id: number;
8
+ }) => Promise<{
9
+ error: string;
10
+ } | undefined>;
11
+ //# sourceMappingURL=mutation-api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mutation-api.d.ts","sourceRoot":"","sources":["../../../../../../../src/views/admin/posts/actions/create-edit/mutation-api.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAK7B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+CAA+C,CAAC;AAIzF,eAAO,MAAM,iBAAiB,GAC5B,MAAM,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC;;cAoB1C,CAAC;AAEF,eAAO,MAAM,eAAe,GAAU,iBAGnC,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE;;cAsBtD,CAAC"}