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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/dist/src/api/lib/categories-language.d.ts +10 -0
  2. package/dist/src/api/lib/categories-language.d.ts.map +1 -0
  3. package/dist/src/api/lib/categories-language.js +1 -0
  4. package/dist/src/api/lib/events.d.ts +28 -0
  5. package/dist/src/api/lib/events.d.ts.map +1 -0
  6. package/dist/src/api/lib/events.js +1 -0
  7. package/dist/src/api/lib/posts-language.d.ts +17 -0
  8. package/dist/src/api/lib/posts-language.d.ts.map +1 -0
  9. package/dist/src/api/lib/posts-language.js +1 -0
  10. package/dist/src/api/lib/search.d.ts +13 -0
  11. package/dist/src/api/lib/search.d.ts.map +1 -0
  12. package/dist/src/api/lib/search.js +1 -0
  13. package/dist/src/api/modules/admin/admin.module.d.ts +34 -14
  14. package/dist/src/api/modules/admin/admin.module.d.ts.map +1 -1
  15. package/dist/src/api/modules/admin/admin.module.js +1 -1
  16. package/dist/src/api/modules/admin/categories/categories.admin.module.d.ts +10 -4
  17. package/dist/src/api/modules/admin/categories/categories.admin.module.d.ts.map +1 -1
  18. package/dist/src/api/modules/admin/categories/routes/create.route.d.ts +10 -3
  19. package/dist/src/api/modules/admin/categories/routes/create.route.d.ts.map +1 -1
  20. package/dist/src/api/modules/admin/categories/routes/create.route.js +1 -1
  21. package/dist/src/api/modules/admin/categories/routes/delete.route.d.ts.map +1 -1
  22. package/dist/src/api/modules/admin/categories/routes/delete.route.js +1 -1
  23. package/dist/src/api/modules/admin/categories/routes/edit.route.d.ts +5 -2
  24. package/dist/src/api/modules/admin/categories/routes/edit.route.d.ts.map +1 -1
  25. package/dist/src/api/modules/admin/categories/routes/edit.route.js +1 -1
  26. package/dist/src/api/modules/admin/posts/posts.admin.module.d.ts +24 -10
  27. package/dist/src/api/modules/admin/posts/posts.admin.module.d.ts.map +1 -1
  28. package/dist/src/api/modules/admin/posts/routes/create.route.d.ts +24 -7
  29. package/dist/src/api/modules/admin/posts/routes/create.route.d.ts.map +1 -1
  30. package/dist/src/api/modules/admin/posts/routes/create.route.js +1 -1
  31. package/dist/src/api/modules/admin/posts/routes/delete.route.d.ts.map +1 -1
  32. package/dist/src/api/modules/admin/posts/routes/delete.route.js +1 -1
  33. package/dist/src/api/modules/admin/posts/routes/edit.route.d.ts +12 -5
  34. package/dist/src/api/modules/admin/posts/routes/edit.route.d.ts.map +1 -1
  35. package/dist/src/api/modules/admin/posts/routes/edit.route.js +1 -1
  36. package/dist/src/api/modules/categories/categories.module.d.ts +5 -1
  37. package/dist/src/api/modules/categories/categories.module.d.ts.map +1 -1
  38. package/dist/src/api/modules/categories/routes/get.route.d.ts +15 -1
  39. package/dist/src/api/modules/categories/routes/get.route.d.ts.map +1 -1
  40. package/dist/src/api/modules/categories/routes/get.route.js +1 -1
  41. package/dist/src/api/modules/posts/posts.module.d.ts +22 -5
  42. package/dist/src/api/modules/posts/posts.module.d.ts.map +1 -1
  43. package/dist/src/api/modules/posts/routes/get.route.d.ts +44 -10
  44. package/dist/src/api/modules/posts/routes/get.route.d.ts.map +1 -1
  45. package/dist/src/api/modules/posts/routes/get.route.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/config.d.ts.map +1 -1
  49. package/dist/src/config.js +1 -1
  50. package/dist/src/database/categories.d.ts +4 -23
  51. package/dist/src/database/categories.d.ts.map +1 -1
  52. package/dist/src/database/categories.js +1 -1
  53. package/dist/src/database/posts.d.ts +10 -48
  54. package/dist/src/database/posts.d.ts.map +1 -1
  55. package/dist/src/database/posts.js +1 -1
  56. package/dist/src/globals.css +44 -0
  57. package/dist/src/locales/en.json +92 -0
  58. package/dist/src/locales/index.d.ts +4 -0
  59. package/dist/src/locales/index.d.ts.map +1 -0
  60. package/dist/src/locales/index.js +1 -0
  61. package/dist/src/routes/breadcrumb/admin/blog/categories/page.d.ts +2 -0
  62. package/dist/src/routes/breadcrumb/admin/blog/categories/page.d.ts.map +1 -0
  63. package/dist/src/routes/breadcrumb/admin/blog/categories/page.js +1 -0
  64. package/dist/src/routes/breadcrumb/admin/blog/posts/page.d.ts +2 -0
  65. package/dist/src/routes/breadcrumb/admin/blog/posts/page.d.ts.map +1 -0
  66. package/dist/src/routes/breadcrumb/admin/blog/posts/page.js +1 -0
  67. package/dist/src/views/admin/categories/actions/create-edit/create-edit.d.ts +2 -2
  68. package/dist/src/views/admin/categories/actions/create-edit/create-edit.d.ts.map +1 -1
  69. package/dist/src/views/admin/categories/actions/create-edit/create-edit.js +1 -1
  70. package/dist/src/views/admin/categories/actions/create-edit/{mutation-api.d.ts → mutation-api.server.d.ts} +1 -1
  71. package/dist/src/views/admin/categories/actions/create-edit/mutation-api.server.d.ts.map +1 -0
  72. package/dist/src/views/admin/categories/table/actions/delete/delete-action.js +1 -1
  73. package/dist/src/views/admin/{posts/table/actions/delete/mutation-api.d.ts → categories/table/actions/delete/mutation-api.server.d.ts} +1 -1
  74. package/dist/src/views/admin/categories/table/actions/delete/mutation-api.server.d.ts.map +1 -0
  75. package/dist/src/views/admin/categories/table/actions/edit-action.d.ts +1 -1
  76. package/dist/src/views/admin/categories/table/actions/edit-action.d.ts.map +1 -1
  77. package/dist/src/views/admin/categories/table/actions/edit-action.js +1 -1
  78. package/dist/src/views/admin/categories/table/categories-admin-view.d.ts.map +1 -1
  79. package/dist/src/views/admin/categories/table/categories-admin-view.js +1 -1
  80. package/dist/src/views/admin/posts/actions/create-edit/create-edit.d.ts +2 -1
  81. package/dist/src/views/admin/posts/actions/create-edit/create-edit.d.ts.map +1 -1
  82. package/dist/src/views/admin/posts/actions/create-edit/create-edit.js +1 -1
  83. package/dist/src/views/admin/posts/actions/create-edit/multi-lang-fields.d.ts +10 -0
  84. package/dist/src/views/admin/posts/actions/create-edit/multi-lang-fields.d.ts.map +1 -0
  85. package/dist/src/views/admin/posts/actions/create-edit/multi-lang-fields.js +1 -0
  86. package/dist/src/views/admin/posts/actions/create-edit/{mutation-api.d.ts → mutation-api.server.d.ts} +1 -1
  87. package/dist/src/views/admin/posts/actions/create-edit/mutation-api.server.d.ts.map +1 -0
  88. package/dist/src/views/admin/posts/table/actions/delete/delete-action.js +1 -1
  89. package/dist/src/views/admin/{categories/table/actions/delete/mutation-api.d.ts → posts/table/actions/delete/mutation-api.server.d.ts} +1 -1
  90. package/dist/src/views/admin/posts/table/actions/delete/mutation-api.server.d.ts.map +1 -0
  91. package/dist/src/views/admin/posts/table/actions/edit-action.d.ts.map +1 -1
  92. package/dist/src/views/admin/posts/table/actions/edit-action.js +1 -1
  93. package/dist/src/views/admin/posts/table/posts-admin-view.d.ts.map +1 -1
  94. package/dist/src/views/admin/posts/table/posts-admin-view.js +1 -1
  95. package/package.json +19 -19
  96. package/src/locales/en.json +17 -5
  97. package/src/locales/index.ts +11 -0
  98. package/src/routes/breadcrumb/admin/blog/categories/page.tsx +5 -0
  99. package/src/routes/breadcrumb/admin/blog/posts/page.tsx +5 -0
  100. package/tsconfig.build.json +5 -0
  101. package/dist/src/views/admin/categories/actions/create-edit/mutation-api.d.ts.map +0 -1
  102. package/dist/src/views/admin/categories/table/actions/delete/mutation-api.d.ts.map +0 -1
  103. package/dist/src/views/admin/posts/actions/create-edit/mutation-api.d.ts.map +0 -1
  104. package/dist/src/views/admin/posts/table/actions/delete/mutation-api.d.ts.map +0 -1
  105. /package/dist/src/views/admin/categories/actions/create-edit/{mutation-api.js → mutation-api.server.js} +0 -0
  106. /package/dist/src/views/admin/categories/table/actions/delete/{mutation-api.js → mutation-api.server.js} +0 -0
  107. /package/dist/src/views/admin/posts/actions/create-edit/{mutation-api.js → mutation-api.server.js} +0 -0
  108. /package/dist/src/views/admin/posts/table/actions/delete/{mutation-api.js → mutation-api.server.js} +0 -0
@@ -23,7 +23,11 @@ export declare const categoriesModule: import("@vitnode/core/api/lib/module").Bu
23
23
  schema: import("zod").ZodObject<{
24
24
  edges: import("zod").ZodArray<import("zod").ZodObject<{
25
25
  id: import("zod").ZodNumber;
26
- title: import("zod").ZodString;
26
+ titleTranslations: import("zod").ZodArray<import("zod").ZodObject<{
27
+ languageCode: import("zod").ZodString;
28
+ value: import("zod").ZodString;
29
+ }, import("zod/v4/core").$strip>>;
30
+ color: import("zod").ZodNullable<import("zod").ZodString>;
27
31
  createdAt: import("zod").ZodDate;
28
32
  updatedAt: import("zod").ZodDate;
29
33
  }, import("zod/v4/core").$strip>>;
@@ -1 +1 @@
1
- {"version":3,"file":"categories.module.d.ts","sourceRoot":"","sources":["../../../../../src/api/modules/categories/categories.module.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sMAI3B,CAAC"}
1
+ {"version":3,"file":"categories.module.d.ts","sourceRoot":"","sources":["../../../../../src/api/modules/categories/categories.module.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sMAI3B,CAAC"}
@@ -1,4 +1,14 @@
1
1
  import { z } from "@hono/zod-openapi";
2
+ export declare const zodCategorySchema: z.ZodObject<{
3
+ id: z.ZodNumber;
4
+ titleTranslations: z.ZodArray<z.ZodObject<{
5
+ languageCode: z.ZodString;
6
+ value: z.ZodString;
7
+ }, z.core.$strip>>;
8
+ color: z.ZodNullable<z.ZodString>;
9
+ createdAt: z.ZodDate;
10
+ updatedAt: z.ZodDate;
11
+ }, z.core.$strip>;
2
12
  export declare const categoriesRoute: import("@vitnode/core/api/lib/route").Route<"@vitnode/blog", {
3
13
  method: "get";
4
14
  path: "/";
@@ -24,7 +34,11 @@ export declare const categoriesRoute: import("@vitnode/core/api/lib/route").Rout
24
34
  schema: z.ZodObject<{
25
35
  edges: z.ZodArray<z.ZodObject<{
26
36
  id: z.ZodNumber;
27
- title: z.ZodString;
37
+ titleTranslations: z.ZodArray<z.ZodObject<{
38
+ languageCode: z.ZodString;
39
+ value: z.ZodString;
40
+ }, z.core.$strip>>;
41
+ color: z.ZodNullable<z.ZodString>;
28
42
  createdAt: z.ZodDate;
29
43
  updatedAt: z.ZodDate;
30
44
  }, z.core.$strip>>;
@@ -1 +1 @@
1
- {"version":3,"file":"get.route.d.ts","sourceRoot":"","sources":["../../../../../../src/api/modules/categories/routes/get.route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAmBtC,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsE1B,CAAC"}
1
+ {"version":3,"file":"get.route.d.ts","sourceRoot":"","sources":["../../../../../../src/api/modules/categories/routes/get.route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAsBtC,eAAO,MAAM,iBAAiB;;;;;;;;;iBAQ5B,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiG1B,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{and,ilike}from"drizzle-orm";import{CONFIG_PLUGIN}from"../../../../const.js";import{blog_categories}from"../../../../database/categories.js";const zodCategorySchema=z.object({id:z.number(),title:z.string(),createdAt:z.date(),updatedAt:z.date()});export const categoriesRoute=buildRoute({pluginId:CONFIG_PLUGIN.pluginId,route:{method:"get",path:"/",request:{query:zodPaginationQuery.extend({order:z.enum(["asc","desc"]).optional(),orderBy:z.enum(["updatedAt"]).optional(),search:z.string().optional()})},responses:{200:{content:{"application/json":{schema:z.object({edges:z.array(zodCategorySchema),pageInfo:zodPaginationPageInfo})}},description:"Categories retrieved successfully"}}},handler:async c=>{const query=c.req.valid("query");const data=await withPagination({c,params:{query},primaryCursor:blog_categories.id,query:async({limit,where,orderBy})=>{const searchCondition=query.search?ilike(blog_categories.title,`%${query.search}%`):undefined;let combinedWhere;if(searchCondition){if(where){combinedWhere=and(where,searchCondition)}else{combinedWhere=searchCondition}}else{combinedWhere=where}return await c.get("db").select().from(blog_categories).where(combinedWhere).orderBy(orderBy).limit(limit)},table:blog_categories,orderBy:{column:query.orderBy?blog_categories[query.orderBy]:blog_categories.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{core_languages_words}from"@vitnode/core/database/languages";import{multiLangValueSchema}from"@vitnode/core/lib/helpers/multi-lang";import{and,eq,ilike,inArray}from"drizzle-orm";import{CONFIG_PLUGIN}from"../../../../const.js";import{blog_categories}from"../../../../database/categories.js";import{CATEGORY_LANG_TABLE,CATEGORY_LANG_VARIABLE,loadCategoryTranslations}from"../../../lib/categories-language.js";const zodMultiLangValue=multiLangValueSchema();export const zodCategorySchema=z.object({id:z.number(),titleTranslations:zodMultiLangValue,color:z.string().nullable(),createdAt:z.date(),updatedAt:z.date()});export const categoriesRoute=buildRoute({pluginId:CONFIG_PLUGIN.pluginId,route:{method:"get",path:"/",request:{query:zodPaginationQuery.extend({order:z.enum(["asc","desc"]).optional(),orderBy:z.enum(["updatedAt"]).optional(),search:z.string().optional()})},responses:{200:{content:{"application/json":{schema:z.object({edges:z.array(zodCategorySchema),pageInfo:zodPaginationPageInfo})}},description:"Categories retrieved successfully"}}},handler:async c=>{const query=c.req.valid("query");const data=await withPagination({c,params:{query},primaryCursor:blog_categories.id,query:async({limit,where,orderBy})=>{const searchCondition=query.search?inArray(blog_categories.id,c.get("db").select({id:core_languages_words.itemId}).from(core_languages_words).where(and(eq(core_languages_words.pluginCode,CONFIG_PLUGIN.pluginId),eq(core_languages_words.tableName,CATEGORY_LANG_TABLE),eq(core_languages_words.variable,CATEGORY_LANG_VARIABLE),ilike(core_languages_words.value,`%${query.search}%`)))):undefined;let combinedWhere;if(searchCondition){if(where){combinedWhere=and(where,searchCondition)}else{combinedWhere=searchCondition}}else{combinedWhere=where}return await c.get("db").select().from(blog_categories).where(combinedWhere).orderBy(orderBy).limit(limit)},table:blog_categories,orderBy:{column:query.orderBy?blog_categories[query.orderBy]:blog_categories.updatedAt,order:query.order??"desc"}});const translations=await loadCategoryTranslations(c,data.edges.map(edge=>edge.id));return c.json({...data,edges:data.edges.map(edge=>({...edge,titleTranslations:translations.get(edge.id)??[]}))})}});
@@ -24,17 +24,34 @@ export declare const postsModule: import("@vitnode/core/api/lib/module").BuildMo
24
24
  schema: import("zod").ZodObject<{
25
25
  edges: import("zod").ZodArray<import("zod").ZodObject<{
26
26
  id: import("zod").ZodNumber;
27
- title: import("zod").ZodString;
28
- titleSeo: import("zod").ZodString;
29
- content: import("zod").ZodString;
27
+ titleTranslations: import("zod").ZodArray<import("zod").ZodObject<{
28
+ languageCode: import("zod").ZodString;
29
+ value: import("zod").ZodString;
30
+ }, import("zod/v4/core").$strip>>;
31
+ contentTranslations: import("zod").ZodArray<import("zod").ZodObject<{
32
+ languageCode: import("zod").ZodString;
33
+ value: import("zod").ZodString;
34
+ }, import("zod/v4/core").$strip>>;
35
+ friendlyUrlTranslations: import("zod").ZodArray<import("zod").ZodObject<{
36
+ languageCode: import("zod").ZodString;
37
+ value: import("zod").ZodString;
38
+ }, import("zod/v4/core").$strip>>;
30
39
  categoryId: import("zod").ZodNumber;
31
40
  createdAt: import("zod").ZodDate;
32
41
  updatedAt: import("zod").ZodDate;
33
42
  category: import("zod").ZodObject<{
34
43
  id: import("zod").ZodNumber;
35
- title: import("zod").ZodString;
36
- titleSeo: import("zod").ZodString;
44
+ titleTranslations: import("zod").ZodArray<import("zod").ZodObject<{
45
+ languageCode: import("zod").ZodString;
46
+ value: import("zod").ZodString;
47
+ }, import("zod/v4/core").$strip>>;
37
48
  }, import("zod/v4/core").$strip>;
49
+ author: import("zod").ZodNullable<import("zod").ZodObject<{
50
+ id: import("zod").ZodNumber;
51
+ name: import("zod").ZodString;
52
+ nameCode: import("zod").ZodString;
53
+ avatarColor: import("zod").ZodString;
54
+ }, import("zod/v4/core").$strip>>;
38
55
  }, import("zod/v4/core").$strip>>;
39
56
  pageInfo: import("zod").ZodObject<{
40
57
  totalCount: import("zod").ZodNumber;
@@ -1 +1 @@
1
- {"version":3,"file":"posts.module.d.ts","sourceRoot":"","sources":["../../../../../src/api/modules/posts/posts.module.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sMAItB,CAAC"}
1
+ {"version":3,"file":"posts.module.d.ts","sourceRoot":"","sources":["../../../../../src/api/modules/posts/posts.module.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sMAItB,CAAC"}
@@ -1,17 +1,34 @@
1
1
  import { z } from "@hono/zod-openapi";
2
2
  export declare const zodPostSchema: z.ZodObject<{
3
3
  id: z.ZodNumber;
4
- title: z.ZodString;
5
- titleSeo: z.ZodString;
6
- content: z.ZodString;
4
+ titleTranslations: z.ZodArray<z.ZodObject<{
5
+ languageCode: z.ZodString;
6
+ value: z.ZodString;
7
+ }, z.core.$strip>>;
8
+ contentTranslations: z.ZodArray<z.ZodObject<{
9
+ languageCode: z.ZodString;
10
+ value: z.ZodString;
11
+ }, z.core.$strip>>;
12
+ friendlyUrlTranslations: z.ZodArray<z.ZodObject<{
13
+ languageCode: z.ZodString;
14
+ value: z.ZodString;
15
+ }, z.core.$strip>>;
7
16
  categoryId: z.ZodNumber;
8
17
  createdAt: z.ZodDate;
9
18
  updatedAt: z.ZodDate;
10
19
  category: z.ZodObject<{
11
20
  id: z.ZodNumber;
12
- title: z.ZodString;
13
- titleSeo: z.ZodString;
21
+ titleTranslations: z.ZodArray<z.ZodObject<{
22
+ languageCode: z.ZodString;
23
+ value: z.ZodString;
24
+ }, z.core.$strip>>;
14
25
  }, z.core.$strip>;
26
+ author: z.ZodNullable<z.ZodObject<{
27
+ id: z.ZodNumber;
28
+ name: z.ZodString;
29
+ nameCode: z.ZodString;
30
+ avatarColor: z.ZodString;
31
+ }, z.core.$strip>>;
15
32
  }, z.core.$strip>;
16
33
  export declare const postsRoute: import("@vitnode/core/api/lib/route").Route<"@vitnode/blog", {
17
34
  method: "get";
@@ -39,17 +56,34 @@ export declare const postsRoute: import("@vitnode/core/api/lib/route").Route<"@v
39
56
  schema: z.ZodObject<{
40
57
  edges: z.ZodArray<z.ZodObject<{
41
58
  id: z.ZodNumber;
42
- title: z.ZodString;
43
- titleSeo: z.ZodString;
44
- content: z.ZodString;
59
+ titleTranslations: z.ZodArray<z.ZodObject<{
60
+ languageCode: z.ZodString;
61
+ value: z.ZodString;
62
+ }, z.core.$strip>>;
63
+ contentTranslations: z.ZodArray<z.ZodObject<{
64
+ languageCode: z.ZodString;
65
+ value: z.ZodString;
66
+ }, z.core.$strip>>;
67
+ friendlyUrlTranslations: z.ZodArray<z.ZodObject<{
68
+ languageCode: z.ZodString;
69
+ value: z.ZodString;
70
+ }, z.core.$strip>>;
45
71
  categoryId: z.ZodNumber;
46
72
  createdAt: z.ZodDate;
47
73
  updatedAt: z.ZodDate;
48
74
  category: z.ZodObject<{
49
75
  id: z.ZodNumber;
50
- title: z.ZodString;
51
- titleSeo: z.ZodString;
76
+ titleTranslations: z.ZodArray<z.ZodObject<{
77
+ languageCode: z.ZodString;
78
+ value: z.ZodString;
79
+ }, z.core.$strip>>;
52
80
  }, z.core.$strip>;
81
+ author: z.ZodNullable<z.ZodObject<{
82
+ id: z.ZodNumber;
83
+ name: z.ZodString;
84
+ nameCode: z.ZodString;
85
+ avatarColor: z.ZodString;
86
+ }, z.core.$strip>>;
53
87
  }, z.core.$strip>>;
54
88
  pageInfo: z.ZodObject<{
55
89
  totalCount: z.ZodNumber;
@@ -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;AAatC,eAAO,MAAM,aAAa;;;;;;;;;;;;;iBAaxB,CAAC;AAEH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2ErB,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;AAoBtC,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAsBxB,CAAC;AAEH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwGrB,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";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({pluginId:CONFIG_PLUGIN.pluginId,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{core_users}from"@vitnode/core/database/users";import{multiLangValueSchema}from"@vitnode/core/lib/helpers/multi-lang";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";import{loadCategoryTranslations}from"../../../lib/categories-language.js";import{loadPostTranslations}from"../../../lib/posts-language.js";const zodMultiLangValue=multiLangValueSchema();export const zodPostSchema=z.object({id:z.number(),titleTranslations:zodMultiLangValue,contentTranslations:zodMultiLangValue,friendlyUrlTranslations:zodMultiLangValue,categoryId:z.number(),createdAt:z.date(),updatedAt:z.date(),category:z.object({id:z.number(),titleTranslations:zodMultiLangValue}),author:z.object({id:z.number(),name:z.string(),nameCode:z.string(),avatarColor:z.string()}).nullable()});export const postsRoute=buildRoute({pluginId:CONFIG_PLUGIN.pluginId,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,categoryId:blog_posts.categoryId,createdAt:blog_posts.createdAt,updatedAt:blog_posts.updatedAt,category:{id:blog_categories.id},author:{id:core_users.id,name:core_users.name,nameCode:core_users.nameCode,avatarColor:core_users.avatarColor}}).from(blog_posts).innerJoin(blog_categories,eq(blog_posts.categoryId,blog_categories.id)).leftJoin(core_users,eq(core_users.id,blog_posts.authorId)).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"}});const[translations,categoryTranslations]=await Promise.all([loadPostTranslations(c,data.edges.map(edge=>edge.id)),loadCategoryTranslations(c,data.edges.map(edge=>edge.category.id))]);return c.json({...data,edges:data.edges.map(edge=>{const words=translations.get(edge.id);return{...edge,titleTranslations:words?.title??[],contentTranslations:words?.content??[],friendlyUrlTranslations:words?.friendlyUrl??[],category:{...edge.category,titleTranslations:categoryTranslations.get(edge.category.id)??[]}}})})}});
@@ -1 +1 @@
1
- {"version":3,"file":"config.api.d.ts","sourceRoot":"","sources":["../../src/config.api.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,aAAa,mEAsBzB,CAAC"}
1
+ {"version":3,"file":"config.api.d.ts","sourceRoot":"","sources":["../../src/config.api.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,aAAa,mEAwBzB,CAAC"}
@@ -1 +1 @@
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({pluginId:CONFIG_PLUGIN.pluginId,modules:[adminModule,categoriesModule,postsModule],permissionStaff:{moderator:{posts:["can_edit","can_delete"]},admin:{posts:["can_view",{permission:"can_create",dependsOn:["can_view"]},"can_edit","can_delete"],categories:["can_view","can_create","can_edit","can_delete"]}}})};
1
+ import{buildApiPlugin}from"@vitnode/core/api/lib/plugin";import{CONFIG_PLUGIN}from"./const.js";import{blogPostSearchIndexer}from"./api/lib/search.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";import messages from"./locales/index.js";export const blogApiPlugin=()=>{return buildApiPlugin({pluginId:CONFIG_PLUGIN.pluginId,messages,modules:[adminModule,categoriesModule,postsModule],searchIndexers:[blogPostSearchIndexer],permissionStaff:{moderator:{posts:["can_edit","can_delete"]},admin:{posts:["can_view",{permission:"can_create",dependsOn:["can_view"]},"can_edit","can_delete"],categories:["can_view","can_create","can_edit","can_delete"]}}})};
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.tsx"],"names":[],"mappings":"AAKA,eAAO,MAAM,UAAU,6EAoBtB,CAAC"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.tsx"],"names":[],"mappings":"AAOA,eAAO,MAAM,UAAU,6EAqBtB,CAAC"}
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{buildPlugin}from"@vitnode/core/lib/plugin";import{ListIcon,NotebookPenIcon}from"lucide-react";import{CONFIG_PLUGIN}from"./const.js";export const blogPlugin=()=>{return buildPlugin({pluginId:CONFIG_PLUGIN.pluginId,admin:{nav:[{id:"posts",href:"/admin/blog/posts",icon:_jsx(NotebookPenIcon,{}),permission:{module:"posts",permission:"can_view"}},{id:"categories",href:"/admin/blog/categories",icon:_jsx(ListIcon,{}),permission:{module:"categories",permission:"can_view"}}]}})};
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{buildPlugin}from"@vitnode/core/lib/plugin";import{ListIcon,NotebookPenIcon}from"lucide-react";import{CONFIG_PLUGIN}from"./const.js";import messages from"./locales/index.js";export const blogPlugin=()=>{return buildPlugin({pluginId:CONFIG_PLUGIN.pluginId,messages,admin:{nav:[{id:"posts",href:"/admin/blog/posts",icon:_jsx(NotebookPenIcon,{}),permission:{module:"posts",permission:"can_view"}},{id:"categories",href:"/admin/blog/categories",icon:_jsx(ListIcon,{}),permission:{module:"categories",permission:"can_view"}}]}})};
@@ -19,14 +19,14 @@ export declare const blog_categories: Omit<import("drizzle-orm/pg-core").PgTable
19
19
  identity: undefined;
20
20
  generated: undefined;
21
21
  }, {}, {}>;
22
- title: import("drizzle-orm/pg-core").PgColumn<{
23
- name: "title";
22
+ color: import("drizzle-orm/pg-core").PgColumn<{
23
+ name: "color";
24
24
  tableName: "blog_categories";
25
25
  dataType: "string";
26
26
  columnType: "PgVarchar";
27
27
  data: string;
28
28
  driverParam: string;
29
- notNull: true;
29
+ notNull: false;
30
30
  hasDefault: false;
31
31
  isPrimaryKey: false;
32
32
  isAutoincrement: false;
@@ -36,7 +36,7 @@ export declare const blog_categories: Omit<import("drizzle-orm/pg-core").PgTable
36
36
  identity: undefined;
37
37
  generated: undefined;
38
38
  }, {}, {
39
- length: 100;
39
+ length: 50;
40
40
  }>;
41
41
  createdAt: import("drizzle-orm/pg-core").PgColumn<{
42
42
  name: "createdAt";
@@ -72,25 +72,6 @@ export declare const blog_categories: Omit<import("drizzle-orm/pg-core").PgTable
72
72
  identity: undefined;
73
73
  generated: undefined;
74
74
  }, {}, {}>;
75
- titleSeo: import("drizzle-orm/pg-core").PgColumn<{
76
- name: "titleSeo";
77
- tableName: "blog_categories";
78
- dataType: "string";
79
- columnType: "PgVarchar";
80
- data: string;
81
- driverParam: string;
82
- notNull: true;
83
- hasDefault: true;
84
- isPrimaryKey: false;
85
- isAutoincrement: false;
86
- hasRuntimeDefault: false;
87
- enumValues: [string, ...string[]];
88
- baseColumn: never;
89
- identity: undefined;
90
- generated: undefined;
91
- }, {}, {
92
- length: 100;
93
- }>;
94
75
  };
95
76
  dialect: "pg";
96
77
  }>, "enableRLS">;
@@ -1 +1 @@
1
- {"version":3,"file":"categories.d.ts","sourceRoot":"","sources":["../../../src/database/categories.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBASb,CAAC"}
1
+ {"version":3,"file":"categories.d.ts","sourceRoot":"","sources":["../../../src/database/categories.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAQb,CAAC"}
@@ -1 +1 @@
1
- import{pgTable}from"drizzle-orm/pg-core";export const blog_categories=pgTable("blog_categories",t=>({id:t.serial().primaryKey(),title:t.varchar({length:100}).notNull(),createdAt:t.timestamp().notNull().defaultNow(),updatedAt:t.timestamp().notNull().$onUpdate(()=>new Date),titleSeo:t.varchar({length:100}).notNull().unique().default("")})).enableRLS();
1
+ import{pgTable}from"drizzle-orm/pg-core";export const blog_categories=pgTable("blog_categories",t=>({id:t.serial().primaryKey(),color:t.varchar({length:50}),createdAt:t.timestamp().notNull().defaultNow(),updatedAt:t.timestamp().notNull().$onUpdate(()=>new Date)})).enableRLS();
@@ -19,69 +19,31 @@ export declare const blog_posts: Omit<import("drizzle-orm/pg-core").PgTableWithC
19
19
  identity: undefined;
20
20
  generated: undefined;
21
21
  }, {}, {}>;
22
- title: import("drizzle-orm/pg-core").PgColumn<{
23
- name: "title";
24
- tableName: "blog_posts";
25
- dataType: "string";
26
- columnType: "PgVarchar";
27
- data: string;
28
- driverParam: string;
29
- notNull: true;
30
- hasDefault: false;
31
- isPrimaryKey: false;
32
- isAutoincrement: false;
33
- hasRuntimeDefault: false;
34
- enumValues: [string, ...string[]];
35
- baseColumn: never;
36
- identity: undefined;
37
- generated: undefined;
38
- }, {}, {
39
- length: 255;
40
- }>;
41
- titleSeo: import("drizzle-orm/pg-core").PgColumn<{
42
- name: "titleSeo";
43
- tableName: "blog_posts";
44
- dataType: "string";
45
- columnType: "PgVarchar";
46
- data: string;
47
- driverParam: string;
48
- notNull: true;
49
- hasDefault: false;
50
- isPrimaryKey: false;
51
- isAutoincrement: false;
52
- hasRuntimeDefault: false;
53
- enumValues: [string, ...string[]];
54
- baseColumn: never;
55
- identity: undefined;
56
- generated: undefined;
57
- }, {}, {
58
- length: 255;
59
- }>;
60
- content: import("drizzle-orm/pg-core").PgColumn<{
61
- name: "content";
22
+ categoryId: import("drizzle-orm/pg-core").PgColumn<{
23
+ name: "categoryId";
62
24
  tableName: "blog_posts";
63
- dataType: "string";
64
- columnType: "PgText";
65
- data: string;
66
- driverParam: string;
25
+ dataType: "number";
26
+ columnType: "PgInteger";
27
+ data: number;
28
+ driverParam: string | number;
67
29
  notNull: true;
68
30
  hasDefault: false;
69
31
  isPrimaryKey: false;
70
32
  isAutoincrement: false;
71
33
  hasRuntimeDefault: false;
72
- enumValues: [string, ...string[]];
34
+ enumValues: undefined;
73
35
  baseColumn: never;
74
36
  identity: undefined;
75
37
  generated: undefined;
76
38
  }, {}, {}>;
77
- categoryId: import("drizzle-orm/pg-core").PgColumn<{
78
- name: "categoryId";
39
+ authorId: import("drizzle-orm/pg-core").PgColumn<{
40
+ name: "authorId";
79
41
  tableName: "blog_posts";
80
42
  dataType: "number";
81
43
  columnType: "PgInteger";
82
44
  data: number;
83
45
  driverParam: string | number;
84
- notNull: true;
46
+ notNull: false;
85
47
  hasDefault: false;
86
48
  isPrimaryKey: false;
87
49
  isAutoincrement: false;
@@ -1 +1 @@
1
- {"version":3,"file":"posts.d.ts","sourceRoot":"","sources":["../../../src/database/posts.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAcR,CAAC"}
1
+ {"version":3,"file":"posts.d.ts","sourceRoot":"","sources":["../../../src/database/posts.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAeR,CAAC"}
@@ -1 +1 @@
1
- import{pgTable}from"drizzle-orm/pg-core";import{blog_categories}from"./categories.js";export const blog_posts=pgTable("blog_posts",t=>({id:t.serial().primaryKey(),title:t.varchar({length:255}).notNull(),titleSeo:t.varchar({length:255}).notNull().unique(),content:t.text().notNull(),categoryId:t.integer().references(()=>blog_categories.id).notNull(),createdAt:t.timestamp().notNull().defaultNow(),updatedAt:t.timestamp().notNull().$onUpdate(()=>new Date)})).enableRLS();
1
+ import{core_users}from"@vitnode/core/database/users";import{pgTable}from"drizzle-orm/pg-core";import{blog_categories}from"./categories.js";export const blog_posts=pgTable("blog_posts",t=>({id:t.serial().primaryKey(),categoryId:t.integer().references(()=>blog_categories.id).notNull(),authorId:t.integer().references(()=>core_users.id,{onDelete:"set null",onUpdate:"cascade"}),createdAt:t.timestamp().notNull().defaultNow(),updatedAt:t.timestamp().notNull().$onUpdate(()=>new Date)})).enableRLS();
@@ -0,0 +1,44 @@
1
+ @import "tailwindcss";
2
+
3
+ @custom-variant dark (&:is(.dark *));
4
+
5
+ @import "tw-animate-css";
6
+
7
+ @theme inline {
8
+ --radius-sm: calc(var(--radius) - 4px);
9
+ --radius-md: calc(var(--radius) - 2px);
10
+ --radius-lg: var(--radius);
11
+ --radius-xl: calc(var(--radius) + 4px);
12
+ --color-background: var(--background);
13
+ --color-foreground: var(--foreground);
14
+ --color-card: var(--card);
15
+ --color-card-foreground: var(--card-foreground);
16
+ --color-popover: var(--popover);
17
+ --color-popover-foreground: var(--popover-foreground);
18
+ --color-primary: var(--primary);
19
+ --color-primary-foreground: var(--primary-foreground);
20
+ --color-secondary: var(--secondary);
21
+ --color-secondary-foreground: var(--secondary-foreground);
22
+ --color-muted: var(--muted);
23
+ --color-muted-foreground: var(--muted-foreground);
24
+ --color-accent: var(--accent);
25
+ --color-accent-foreground: var(--accent-foreground);
26
+ --color-destructive: var(--destructive);
27
+ --color-warn: var(--warn);
28
+ --color-border: var(--border);
29
+ --color-input: var(--input);
30
+ --color-ring: var(--ring);
31
+ --color-chart-1: var(--chart-1);
32
+ --color-chart-2: var(--chart-2);
33
+ --color-chart-3: var(--chart-3);
34
+ --color-chart-4: var(--chart-4);
35
+ --color-chart-5: var(--chart-5);
36
+ --color-sidebar: var(--sidebar);
37
+ --color-sidebar-foreground: var(--sidebar-foreground);
38
+ --color-sidebar-primary: var(--sidebar-primary);
39
+ --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
40
+ --color-sidebar-accent: var(--sidebar-accent);
41
+ --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
42
+ --color-sidebar-border: var(--sidebar-border);
43
+ --color-sidebar-ring: var(--sidebar-ring);
44
+ }
@@ -0,0 +1,92 @@
1
+ {
2
+ "@vitnode/blog": {
3
+ "title": "Blog",
4
+ "admin": {
5
+ "nav": {
6
+ "posts": "Posts",
7
+ "categories": "Categories"
8
+ },
9
+ "categories": {
10
+ "desc": "Manage categories for blog posts.",
11
+ "table": {
12
+ "title": "Title",
13
+ "color": "Color",
14
+ "updated_at": "Updated At"
15
+ },
16
+ "delete": {
17
+ "title": "Delete Category",
18
+ "desc": "Are you sure you want to delete <title></title> category? This action cannot be undone.",
19
+ "confirm": "Yes, delete this category",
20
+ "success": "Category has been deleted successfully."
21
+ },
22
+ "create": {
23
+ "title": "Create Category",
24
+ "desc": "A new category for your blog posts.",
25
+ "form": {
26
+ "title": {
27
+ "label": "Title",
28
+ "already_exists": "This category title already exists."
29
+ },
30
+ "color": "Color"
31
+ },
32
+ "submit": "Create",
33
+ "success": "Category has been created successfully."
34
+ },
35
+ "edit": {
36
+ "title": "Edit Category",
37
+ "submit": "Save Changes",
38
+ "success": "Category has been updated successfully."
39
+ }
40
+ },
41
+ "posts": {
42
+ "desc": "Write and manage your blog posts.",
43
+ "table": {
44
+ "title": "Title",
45
+ "category": "Category",
46
+ "author": "Author",
47
+ "updated_at": "Updated At"
48
+ },
49
+ "create": {
50
+ "title": "Create Post",
51
+ "desc": "Write a new article for your blog.",
52
+ "form": {
53
+ "title": {
54
+ "label": "Title",
55
+ "already_exists": "This post title already exists."
56
+ },
57
+ "friendly_url": {
58
+ "label": "Friendly URL",
59
+ "desc": "Used in the post address. Auto-filled from the title.",
60
+ "already_exists": "This friendly URL already exists."
61
+ },
62
+ "content": "Content",
63
+ "category": "Category"
64
+ },
65
+ "submit": "Create Post",
66
+ "success": "Post has been created successfully."
67
+ },
68
+ "edit": {
69
+ "title": "Edit Post",
70
+ "submit": "Save Changes",
71
+ "success": "Post has been updated successfully."
72
+ },
73
+ "delete": {
74
+ "title": "Delete Post",
75
+ "desc": "Are you sure you want to delete <title></title> post? This action cannot be undone.",
76
+ "confirm": "Yes, delete this post",
77
+ "success": "Post has been deleted successfully."
78
+ }
79
+ }
80
+ }
81
+ },
82
+ "@vitnode/blog:posts": "Posts",
83
+ "@vitnode/blog:posts:can_view": "View posts list",
84
+ "@vitnode/blog:posts:can_create": "Create posts",
85
+ "@vitnode/blog:posts:can_edit": "Edit posts",
86
+ "@vitnode/blog:posts:can_delete": "Delete posts",
87
+ "@vitnode/blog:categories": "Categories",
88
+ "@vitnode/blog:categories:can_view": "View categories list",
89
+ "@vitnode/blog:categories:can_create": "Create categories",
90
+ "@vitnode/blog:categories:can_edit": "Edit categories",
91
+ "@vitnode/blog:categories:can_delete": "Delete categories"
92
+ }
@@ -0,0 +1,4 @@
1
+ import type { LocaleMessagesMap } from "@vitnode/core/lib/i18n/types";
2
+ declare const messages: LocaleMessagesMap;
3
+ export default messages;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/locales/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAMtE,QAAA,MAAM,QAAQ,EAAE,iBAEf,CAAC;AAEF,eAAe,QAAQ,CAAC"}
@@ -0,0 +1 @@
1
+ const messages={en:async()=>await import("./en.json",{with:{type:"json"}})};export default messages;
@@ -0,0 +1,2 @@
1
+ export default function BreadcrumbSlot(): import("react").JSX.Element;
2
+ //# sourceMappingURL=page.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../../../../../../src/routes/breadcrumb/admin/blog/categories/page.tsx"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,UAAU,cAAc,gCAErC"}
@@ -0,0 +1 @@
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{BreadcrumbAdmin}from"@vitnode/core/views/admin/layouts/breadcrumb/breadcrumb-admin";export default function BreadcrumbSlot(){return _jsx(BreadcrumbAdmin,{segments:["blog","categories"]})}
@@ -0,0 +1,2 @@
1
+ export default function BreadcrumbSlot(): import("react").JSX.Element;
2
+ //# sourceMappingURL=page.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../../../../../../src/routes/breadcrumb/admin/blog/posts/page.tsx"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,UAAU,cAAc,gCAErC"}
@@ -0,0 +1 @@
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{BreadcrumbAdmin}from"@vitnode/core/views/admin/layouts/breadcrumb/breadcrumb-admin";export default function BreadcrumbSlot(){return _jsx(BreadcrumbAdmin,{segments:["blog","posts"]})}
@@ -1,7 +1,7 @@
1
1
  import { z } from "zod";
2
- import type { zodCreateCategorySchema } from "../../../../../api/modules/admin/categories/routes/create.route";
2
+ import type { zodCategorySchema } from "../../../../../api/modules/categories/routes/get.route";
3
3
  export declare const CreateEditActionCategoriesAdmin: ({ data, }: {
4
- data?: z.infer<typeof zodCreateCategorySchema> & {
4
+ data?: z.infer<typeof zodCategorySchema> & {
5
5
  id: number;
6
6
  };
7
7
  }) => import("react").JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"create-edit.d.ts","sourceRoot":"","sources":["../../../../../../../src/views/admin/categories/actions/create-edit/create-edit.tsx"],"names":[],"mappings":"AASA,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,gCAqEA,CAAC"}
1
+ {"version":3,"file":"create-edit.d.ts","sourceRoot":"","sources":["../../../../../../../src/views/admin/categories/actions/create-edit/create-edit.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAInF,eAAO,MAAM,+BAA+B,GAAI,WAE7C;IACD,IAAI,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,GAAG;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;CAC3D,gCAiEA,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().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{AutoFormColor}from"@vitnode/core/components/form/fields/color";import{AutoFormInput}from"@vitnode/core/components/form/fields/input";import{useDialog}from"@vitnode/core/components/ui/dialog";import{getLangValue,multiLangValueSchema}from"@vitnode/core/lib/helpers/multi-lang";import{usePathname,useRouter}from"@vitnode/core/lib/navigation";import{useLocale,useTranslations}from"next-intl";import{toast}from"sonner";import{z}from"zod";import{createMutationApi,editMutationApi}from"./mutation-api.server.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 locale=useLocale();const formSchema=z.object({title:multiLangValueSchema({minLength:1,maxLength:100}).min(1).default(data?.titleTranslations??[]),color:z.string().default(data?.color??"")});const onSubmit=async values=>{const mutation=data?.id?await editMutationApi({id:data.id,...values}):await createMutationApi(values);if(mutation?.error){toast.error(tCore("title"),{description:tCore("internal_server_error")});return}toast.success(t(data?"edit.success":"create.success"),{description:getLangValue(values.title,locale)||values.title[0]?.value});setOpen?.(false);push(pathname)};return _jsx(AutoForm,{fields:[{id:"title",component:props=>_jsx(AutoFormInput,{label:t("create.form.title.label"),multiLang:true,...props})},{id:"color",component:props=>_jsx(AutoFormColor,{allowRemoveColor:true,label:t("create.form.color"),...props})}],formSchema:formSchema,onSubmit:onSubmit,submitButtonProps:{children:t(`${data?"edit":"create"}.submit`)}})};
@@ -8,4 +8,4 @@ export declare const editMutationApi: ({ id, ...body }: z.infer<typeof zodCreate
8
8
  }) => Promise<{
9
9
  error: string;
10
10
  } | undefined>;
11
- //# sourceMappingURL=mutation-api.d.ts.map
11
+ //# sourceMappingURL=mutation-api.server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mutation-api.server.d.ts","sourceRoot":"","sources":["../../../../../../../src/views/admin/categories/actions/create-edit/mutation-api.server.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"}