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

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 (153) hide show
  1. package/dist/src/api/modules/admin/admin.module.d.ts +180 -177
  2. package/dist/src/api/modules/admin/admin.module.d.ts.map +1 -1
  3. package/dist/src/api/modules/admin/admin.module.js +2 -1
  4. package/dist/src/api/modules/admin/admin.module.js.map +1 -0
  5. package/dist/src/api/modules/admin/categories/categories.admin.module.d.ts +80 -77
  6. package/dist/src/api/modules/admin/categories/categories.admin.module.d.ts.map +1 -1
  7. package/dist/src/api/modules/admin/categories/categories.admin.module.js +2 -1
  8. package/dist/src/api/modules/admin/categories/categories.admin.module.js.map +1 -0
  9. package/dist/src/api/modules/admin/categories/routes/create.route.d.ts +34 -31
  10. package/dist/src/api/modules/admin/categories/routes/create.route.d.ts.map +1 -1
  11. package/dist/src/api/modules/admin/categories/routes/create.route.js +2 -1
  12. package/dist/src/api/modules/admin/categories/routes/create.route.js.map +1 -0
  13. package/dist/src/api/modules/admin/categories/routes/delete.route.d.ts +18 -15
  14. package/dist/src/api/modules/admin/categories/routes/delete.route.d.ts.map +1 -1
  15. package/dist/src/api/modules/admin/categories/routes/delete.route.js +2 -1
  16. package/dist/src/api/modules/admin/categories/routes/delete.route.js.map +1 -0
  17. package/dist/src/api/modules/admin/categories/routes/edit.route.d.ts +38 -35
  18. package/dist/src/api/modules/admin/categories/routes/edit.route.d.ts.map +1 -1
  19. package/dist/src/api/modules/admin/categories/routes/edit.route.js +2 -1
  20. package/dist/src/api/modules/admin/categories/routes/edit.route.js.map +1 -0
  21. package/dist/src/api/modules/admin/posts/posts.admin.module.d.ts +93 -90
  22. package/dist/src/api/modules/admin/posts/posts.admin.module.d.ts.map +1 -1
  23. package/dist/src/api/modules/admin/posts/posts.admin.module.js +2 -1
  24. package/dist/src/api/modules/admin/posts/posts.admin.module.js.map +1 -0
  25. package/dist/src/api/modules/admin/posts/routes/create.route.d.ts +44 -41
  26. package/dist/src/api/modules/admin/posts/routes/create.route.d.ts.map +1 -1
  27. package/dist/src/api/modules/admin/posts/routes/create.route.js +2 -1
  28. package/dist/src/api/modules/admin/posts/routes/create.route.js.map +1 -0
  29. package/dist/src/api/modules/admin/posts/routes/delete.route.d.ts +18 -15
  30. package/dist/src/api/modules/admin/posts/routes/delete.route.d.ts.map +1 -1
  31. package/dist/src/api/modules/admin/posts/routes/delete.route.js +2 -1
  32. package/dist/src/api/modules/admin/posts/routes/delete.route.js.map +1 -0
  33. package/dist/src/api/modules/admin/posts/routes/edit.route.d.ts +43 -40
  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 +2 -1
  36. package/dist/src/api/modules/admin/posts/routes/edit.route.js.map +1 -0
  37. package/dist/src/api/modules/categories/categories.module.d.ts +64 -61
  38. package/dist/src/api/modules/categories/categories.module.d.ts.map +1 -1
  39. package/dist/src/api/modules/categories/categories.module.js +2 -1
  40. package/dist/src/api/modules/categories/categories.module.js.map +1 -0
  41. package/dist/src/api/modules/categories/routes/get.route.d.ts +45 -42
  42. package/dist/src/api/modules/categories/routes/get.route.d.ts.map +1 -1
  43. package/dist/src/api/modules/categories/routes/get.route.js +2 -1
  44. package/dist/src/api/modules/categories/routes/get.route.js.map +1 -0
  45. package/dist/src/api/modules/categories/test.route.d.ts +23 -20
  46. package/dist/src/api/modules/categories/test.route.d.ts.map +1 -1
  47. package/dist/src/api/modules/categories/test.route.js +2 -1
  48. package/dist/src/api/modules/categories/test.route.js.map +1 -0
  49. package/dist/src/api/modules/posts/posts.module.d.ts +54 -51
  50. package/dist/src/api/modules/posts/posts.module.d.ts.map +1 -1
  51. package/dist/src/api/modules/posts/posts.module.js +2 -1
  52. package/dist/src/api/modules/posts/posts.module.js.map +1 -0
  53. package/dist/src/api/modules/posts/routes/get.route.d.ts +64 -61
  54. package/dist/src/api/modules/posts/routes/get.route.d.ts.map +1 -1
  55. package/dist/src/api/modules/posts/routes/get.route.js +2 -1
  56. package/dist/src/api/modules/posts/routes/get.route.js.map +1 -0
  57. package/dist/src/config.api.d.ts +4 -1
  58. package/dist/src/config.api.d.ts.map +1 -1
  59. package/dist/src/config.api.js +2 -1
  60. package/dist/src/config.api.js.map +1 -0
  61. package/dist/src/config.d.ts +4 -1
  62. package/dist/src/config.d.ts.map +1 -1
  63. package/dist/src/config.js +2 -1
  64. package/dist/src/config.js.map +1 -0
  65. package/dist/src/const.d.ts +5 -2
  66. package/dist/src/const.d.ts.map +1 -1
  67. package/dist/src/const.js +2 -1
  68. package/dist/src/const.js.map +1 -0
  69. package/dist/src/database/categories.d.ts +98 -95
  70. package/dist/src/database/categories.d.ts.map +1 -1
  71. package/dist/src/database/categories.js +2 -1
  72. package/dist/src/database/categories.js.map +1 -0
  73. package/dist/src/database/index.d.ts +4 -4
  74. package/dist/src/database/index.js +1 -1
  75. package/dist/src/database/posts.d.ts +132 -129
  76. package/dist/src/database/posts.d.ts.map +1 -1
  77. package/dist/src/database/posts.js +2 -1
  78. package/dist/src/database/posts.js.map +1 -0
  79. package/dist/src/database/relations.d.ts +7 -4
  80. package/dist/src/database/relations.d.ts.map +1 -1
  81. package/dist/src/database/relations.js +2 -1
  82. package/dist/src/database/relations.js.map +1 -0
  83. package/dist/src/emails/test-template.d.ts +20 -18
  84. package/dist/src/emails/test-template.d.ts.map +1 -1
  85. package/dist/src/emails/test-template.js +2 -1
  86. package/dist/src/emails/test-template.js.map +1 -0
  87. package/dist/src/routes/admin/blog/categories/page.d.ts +7 -5
  88. package/dist/src/routes/admin/blog/categories/page.d.ts.map +1 -1
  89. package/dist/src/routes/admin/blog/categories/page.js +2 -1
  90. package/dist/src/routes/admin/blog/categories/page.js.map +1 -0
  91. package/dist/src/routes/admin/blog/posts/page.d.ts +7 -5
  92. package/dist/src/routes/admin/blog/posts/page.d.ts.map +1 -1
  93. package/dist/src/routes/admin/blog/posts/page.js +2 -1
  94. package/dist/src/routes/admin/blog/posts/page.js.map +1 -0
  95. package/dist/src/views/admin/categories/actions/actions.d.ts +4 -1
  96. package/dist/src/views/admin/categories/actions/actions.d.ts.map +1 -1
  97. package/dist/src/views/admin/categories/actions/actions.js +2 -1
  98. package/dist/src/views/admin/categories/actions/actions.js.map +1 -0
  99. package/dist/src/views/admin/categories/actions/create-edit/create-edit.d.ts +8 -5
  100. package/dist/src/views/admin/categories/actions/create-edit/create-edit.d.ts.map +1 -1
  101. package/dist/src/views/admin/categories/actions/create-edit/create-edit.js +2 -1
  102. package/dist/src/views/admin/categories/actions/create-edit/create-edit.js.map +1 -0
  103. package/dist/src/views/admin/categories/actions/create-edit/mutation-api.d.ts +10 -7
  104. package/dist/src/views/admin/categories/actions/create-edit/mutation-api.d.ts.map +1 -1
  105. package/dist/src/views/admin/categories/actions/create-edit/mutation-api.js +2 -1
  106. package/dist/src/views/admin/categories/actions/create-edit/mutation-api.js.map +1 -0
  107. package/dist/src/views/admin/categories/table/actions/delete/delete-action.d.ts +6 -3
  108. package/dist/src/views/admin/categories/table/actions/delete/delete-action.d.ts.map +1 -1
  109. package/dist/src/views/admin/categories/table/actions/delete/delete-action.js +2 -1
  110. package/dist/src/views/admin/categories/table/actions/delete/delete-action.js.map +1 -0
  111. package/dist/src/views/admin/categories/table/actions/delete/mutation-api.d.ts +5 -2
  112. package/dist/src/views/admin/categories/table/actions/delete/mutation-api.d.ts.map +1 -1
  113. package/dist/src/views/admin/categories/table/actions/delete/mutation-api.js +2 -1
  114. package/dist/src/views/admin/categories/table/actions/delete/mutation-api.js.map +1 -0
  115. package/dist/src/views/admin/categories/table/actions/edit-action.d.ts +8 -5
  116. package/dist/src/views/admin/categories/table/actions/edit-action.d.ts.map +1 -1
  117. package/dist/src/views/admin/categories/table/actions/edit-action.js +2 -1
  118. package/dist/src/views/admin/categories/table/actions/edit-action.js.map +1 -0
  119. package/dist/src/views/admin/categories/table/categories-admin-view.d.ts +5 -2
  120. package/dist/src/views/admin/categories/table/categories-admin-view.d.ts.map +1 -1
  121. package/dist/src/views/admin/categories/table/categories-admin-view.js +2 -1
  122. package/dist/src/views/admin/categories/table/categories-admin-view.js.map +1 -0
  123. package/dist/src/views/admin/posts/actions/actions.d.ts +4 -1
  124. package/dist/src/views/admin/posts/actions/actions.d.ts.map +1 -1
  125. package/dist/src/views/admin/posts/actions/actions.js +2 -1
  126. package/dist/src/views/admin/posts/actions/actions.js.map +1 -0
  127. package/dist/src/views/admin/posts/actions/create-edit/create-edit.d.ts +8 -5
  128. package/dist/src/views/admin/posts/actions/create-edit/create-edit.d.ts.map +1 -1
  129. package/dist/src/views/admin/posts/actions/create-edit/create-edit.js +2 -1
  130. package/dist/src/views/admin/posts/actions/create-edit/create-edit.js.map +1 -0
  131. package/dist/src/views/admin/posts/actions/create-edit/mutation-api.d.ts +10 -7
  132. package/dist/src/views/admin/posts/actions/create-edit/mutation-api.d.ts.map +1 -1
  133. package/dist/src/views/admin/posts/actions/create-edit/mutation-api.js +2 -1
  134. package/dist/src/views/admin/posts/actions/create-edit/mutation-api.js.map +1 -0
  135. package/dist/src/views/admin/posts/table/actions/delete/delete-action.d.ts +6 -3
  136. package/dist/src/views/admin/posts/table/actions/delete/delete-action.d.ts.map +1 -1
  137. package/dist/src/views/admin/posts/table/actions/delete/delete-action.js +2 -1
  138. package/dist/src/views/admin/posts/table/actions/delete/delete-action.js.map +1 -0
  139. package/dist/src/views/admin/posts/table/actions/delete/mutation-api.d.ts +5 -2
  140. package/dist/src/views/admin/posts/table/actions/delete/mutation-api.d.ts.map +1 -1
  141. package/dist/src/views/admin/posts/table/actions/delete/mutation-api.js +2 -1
  142. package/dist/src/views/admin/posts/table/actions/delete/mutation-api.js.map +1 -0
  143. package/dist/src/views/admin/posts/table/actions/edit-action.d.ts +8 -5
  144. package/dist/src/views/admin/posts/table/actions/edit-action.d.ts.map +1 -1
  145. package/dist/src/views/admin/posts/table/actions/edit-action.js +2 -1
  146. package/dist/src/views/admin/posts/table/actions/edit-action.js.map +1 -0
  147. package/dist/src/views/admin/posts/table/posts-admin-view.d.ts +5 -2
  148. package/dist/src/views/admin/posts/table/posts-admin-view.d.ts.map +1 -1
  149. package/dist/src/views/admin/posts/table/posts-admin-view.js +2 -1
  150. package/dist/src/views/admin/posts/table/posts-admin-view.js.map +1 -0
  151. package/package.json +6 -8
  152. package/tsconfig.build.json +5 -0
  153. package/dist/src/database/index.d.ts.map +0 -1
@@ -1,40 +1,43 @@
1
1
  import { z } from "@hono/zod-openapi";
2
- export declare const zodCreateCategorySchema: z.ZodObject<{
3
- title: z.ZodString;
2
+ //#region src/api/modules/admin/categories/routes/create.route.d.ts
3
+ declare const zodCreateCategorySchema: z.ZodObject<{
4
+ title: z.ZodString;
4
5
  }, z.core.$strip>;
5
- export declare const createCategoryRoute: import("@vitnode/core/api/lib/route").Route<"@vitnode/blog", {
6
- method: "post";
7
- path: "/";
8
- request: {
9
- body: {
10
- content: {
11
- "application/json": {
12
- schema: z.ZodObject<{
13
- title: z.ZodString;
14
- }, z.core.$strip>;
15
- };
16
- };
6
+ declare const createCategoryRoute: import("@vitnode/core/api/lib/route").Route<"@vitnode/blog", {
7
+ method: "post";
8
+ path: "/";
9
+ request: {
10
+ body: {
11
+ content: {
12
+ "application/json": {
13
+ schema: z.ZodObject<{
14
+ title: z.ZodString;
15
+ }, z.core.$strip>;
17
16
  };
17
+ };
18
18
  };
19
- responses: {
20
- 201: {
21
- content: {
22
- "application/json": {
23
- schema: z.ZodObject<{
24
- id: z.ZodNumber;
25
- title: z.ZodString;
26
- createdAt: z.ZodDate;
27
- updatedAt: z.ZodDate;
28
- }, z.core.$strip>;
29
- };
30
- };
31
- description: string;
32
- };
33
- 400: {
34
- description: string;
19
+ };
20
+ responses: {
21
+ 201: {
22
+ content: {
23
+ "application/json": {
24
+ schema: z.ZodObject<{
25
+ id: z.ZodNumber;
26
+ title: z.ZodString;
27
+ createdAt: z.ZodDate;
28
+ updatedAt: z.ZodDate;
29
+ }, z.core.$strip>;
35
30
  };
31
+ };
32
+ description: string;
33
+ };
34
+ 400: {
35
+ description: string;
36
36
  };
37
+ };
37
38
  } & {
38
- path: string;
39
+ path: string;
39
40
  }>;
41
+ //#endregion
42
+ export { createCategoryRoute, zodCreateCategorySchema };
40
43
  //# sourceMappingURL=create.route.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"create.route.d.ts","sourceRoot":"","sources":["../../../../../../../src/api/modules/admin/categories/routes/create.route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAgBtC,eAAO,MAAM,uBAAuB;;iBAElC,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0D9B,CAAC"}
1
+ {"version":3,"file":"create.route.d.ts","names":[],"sources":["../../../../../../../src/api/modules/admin/categories/routes/create.route.ts"],"mappings":";;cAgBa,yBAAuB,EAAA;;;cAIvB,2DAAmB"}
@@ -1 +1,2 @@
1
- import{z}from"@hono/zod-openapi";import{buildRoute}from"@vitnode/core/api/lib/route";import{removeSpecialCharacters}from"@vitnode/core/lib/special-characters";import{eq}from"drizzle-orm";import{HTTPException}from"hono/http-exception";import{CONFIG_PLUGIN}from"../../../../../const.js";import{blog_categories}from"../../../../../database/categories.js";const zodCategoryResponseSchema=z.object({id:z.number(),title:z.string(),createdAt:z.date(),updatedAt:z.date()});export const zodCreateCategorySchema=z.object({title:z.string()});export const createCategoryRoute=buildRoute({pluginId:CONFIG_PLUGIN.pluginId,adminStaffPermission:{module:"categories",permission:"can_create"},route:{method:"post",path:"/",request:{body:{content:{"application/json":{schema:zodCreateCategorySchema}}}},responses:{201:{content:{"application/json":{schema:zodCategoryResponseSchema}},description:"Category created successfully"},400:{description:"Bad request - Invalid input data"}}},handler:async c=>{const{title}=c.req.valid("json");const titleSeo=removeSpecialCharacters(title);const[titleSEODuplocate]=await c.get("db").select({titleSeo:blog_categories.titleSeo}).from(blog_categories).where(eq(blog_categories.titleSeo,titleSeo)).limit(1);if(titleSEODuplocate?.titleSeo===titleSeo){throw new HTTPException(400,{message:"Category with this title already exists."})}const[category]=await c.get("db").insert(blog_categories).values({title,titleSeo:removeSpecialCharacters(title)}).returning();return c.json(category,201)}});
1
+ import{CONFIG_PLUGIN as e}from"../../../../../const.js";import{blog_categories as t}from"../../../../../database/categories.js";import{z as n}from"@hono/zod-openapi";import{buildRoute as r}from"@vitnode/core/api/lib/route";import{removeSpecialCharacters as i}from"@vitnode/core/lib/special-characters";import{eq as a}from"drizzle-orm";import{HTTPException as o}from"hono/http-exception";const s=n.object({id:n.number(),title:n.string(),createdAt:n.date(),updatedAt:n.date()}),c=n.object({title:n.string()}),l=r({pluginId:e.pluginId,adminStaffPermission:{module:`categories`,permission:`can_create`},route:{method:`post`,path:`/`,request:{body:{content:{"application/json":{schema:c}}}},responses:{201:{content:{"application/json":{schema:s}},description:`Category created successfully`},400:{description:`Bad request - Invalid input data`}}},handler:async e=>{let{title:n}=e.req.valid(`json`),r=i(n),[s]=await e.get(`db`).select({titleSeo:t.titleSeo}).from(t).where(a(t.titleSeo,r)).limit(1);if(s?.titleSeo===r)throw new o(400,{message:`Category with this title already exists.`});let[c]=await e.get(`db`).insert(t).values({title:n,titleSeo:i(n)}).returning();return e.json(c,201)}});export{l as createCategoryRoute,c as zodCreateCategorySchema};
2
+ //# sourceMappingURL=create.route.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.route.js","names":[],"sources":["../../../../../../../src/api/modules/admin/categories/routes/create.route.ts"],"sourcesContent":["import { z } from \"@hono/zod-openapi\";\nimport { buildRoute } from \"@vitnode/core/api/lib/route\";\nimport { removeSpecialCharacters } from \"@vitnode/core/lib/special-characters\";\nimport { eq } from \"drizzle-orm\";\nimport { HTTPException } from \"hono/http-exception\";\n\nimport { CONFIG_PLUGIN } from \"@/const\";\nimport { blog_categories } from \"@/database/categories\";\n\nconst zodCategoryResponseSchema = z.object({\n id: z.number(),\n title: z.string(),\n createdAt: z.date(),\n updatedAt: z.date(),\n});\n\nexport const zodCreateCategorySchema = z.object({\n title: z.string(),\n});\n\nexport const createCategoryRoute = buildRoute({\n pluginId: CONFIG_PLUGIN.pluginId,\n adminStaffPermission: { module: \"categories\", permission: \"can_create\" },\n route: {\n method: \"post\",\n path: \"/\",\n request: {\n body: {\n content: {\n \"application/json\": {\n schema: zodCreateCategorySchema,\n },\n },\n },\n },\n responses: {\n 201: {\n content: {\n \"application/json\": {\n schema: zodCategoryResponseSchema,\n },\n },\n description: \"Category created successfully\",\n },\n 400: {\n description: \"Bad request - Invalid input data\",\n },\n },\n },\n handler: async c => {\n const { title } = c.req.valid(\"json\");\n const titleSeo = removeSpecialCharacters(title);\n const [titleSEODuplocate] = await c\n .get(\"db\")\n .select({\n titleSeo: blog_categories.titleSeo,\n })\n .from(blog_categories)\n .where(eq(blog_categories.titleSeo, titleSeo))\n .limit(1);\n\n if (titleSEODuplocate?.titleSeo === titleSeo) {\n throw new HTTPException(400, {\n message: \"Category with this title already exists.\",\n });\n }\n\n const [category] = await c\n .get(\"db\")\n .insert(blog_categories)\n .values({\n title,\n titleSeo: removeSpecialCharacters(title),\n })\n .returning();\n\n return c.json(category, 201);\n },\n});\n"],"mappings":"mYASA,MAAM,EAA4B,EAAE,OAAO,CACzC,GAAI,EAAE,OAAO,EACb,MAAO,EAAE,OAAO,EAChB,UAAW,EAAE,KAAK,EAClB,UAAW,EAAE,KAAK,CACpB,CAAC,EAEY,EAA0B,EAAE,OAAO,CAC9C,MAAO,EAAE,OAAO,CAClB,CAAC,EAEY,EAAsB,EAAW,CAC5C,SAAU,EAAc,SACxB,qBAAsB,CAAE,OAAQ,aAAc,WAAY,YAAa,EACvE,MAAO,CACL,OAAQ,OACR,KAAM,IACN,QAAS,CACP,KAAM,CACJ,QAAS,CACP,mBAAoB,CAClB,OAAQ,CACV,CACF,CACF,CACF,EACA,UAAW,CACT,IAAK,CACH,QAAS,CACP,mBAAoB,CAClB,OAAQ,CACV,CACF,EACA,YAAa,+BACf,EACA,IAAK,CACH,YAAa,kCACf,CACF,CACF,EACA,QAAS,KAAM,IAAK,CAClB,GAAM,CAAE,SAAU,EAAE,IAAI,MAAM,MAAM,EAC9B,EAAW,EAAwB,CAAK,EACxC,CAAC,GAAqB,MAAM,EAC/B,IAAI,IAAI,CAAC,CACT,OAAO,CACN,SAAU,EAAgB,QAC5B,CAAC,CAAC,CACD,KAAK,CAAe,CAAC,CACrB,MAAM,EAAG,EAAgB,SAAU,CAAQ,CAAC,CAAC,CAC7C,MAAM,CAAC,EAEV,GAAI,GAAmB,WAAa,EAClC,MAAM,IAAI,EAAc,IAAK,CAC3B,QAAS,0CACX,CAAC,EAGH,GAAM,CAAC,GAAY,MAAM,EACtB,IAAI,IAAI,CAAC,CACT,OAAO,CAAe,CAAC,CACvB,OAAO,CACN,QACA,SAAU,EAAwB,CAAK,CACzC,CAAC,CAAC,CACD,UAAU,EAEb,OAAO,EAAE,KAAK,EAAU,GAAG,CAC7B,CACF,CAAC"}
@@ -1,21 +1,24 @@
1
1
  import { z } from "@hono/zod-openapi";
2
- export declare const deleteCategoryRoute: import("@vitnode/core/api/lib/route").Route<"@vitnode/blog", {
3
- method: "delete";
4
- path: "/{id}";
5
- request: {
6
- params: z.ZodObject<{
7
- id: z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>;
8
- }, z.core.$strip>;
2
+ //#region src/api/modules/admin/categories/routes/delete.route.d.ts
3
+ declare const deleteCategoryRoute: import("@vitnode/core/api/lib/route").Route<"@vitnode/blog", {
4
+ method: "delete";
5
+ path: "/{id}";
6
+ request: {
7
+ params: z.ZodObject<{
8
+ id: z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>;
9
+ }, z.core.$strip>;
10
+ };
11
+ responses: {
12
+ 204: {
13
+ description: string;
9
14
  };
10
- responses: {
11
- 204: {
12
- description: string;
13
- };
14
- 404: {
15
- description: string;
16
- };
15
+ 404: {
16
+ description: string;
17
17
  };
18
+ };
18
19
  } & {
19
- path: string;
20
+ path: string;
20
21
  }>;
22
+ //#endregion
23
+ export { deleteCategoryRoute };
21
24
  //# sourceMappingURL=delete.route.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"delete.route.d.ts","sourceRoot":"","sources":["../../../../../../../src/api/modules/admin/categories/routes/delete.route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAQtC,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;EAmC9B,CAAC"}
1
+ {"version":3,"file":"delete.route.d.ts","names":[],"sources":["../../../../../../../src/api/modules/admin/categories/routes/delete.route.ts"],"mappings":";;cAQa,2DAAmB"}
@@ -1 +1,2 @@
1
- import{z}from"@hono/zod-openapi";import{buildRoute}from"@vitnode/core/api/lib/route";import{eq}from"drizzle-orm";import{HTTPException}from"hono/http-exception";import{CONFIG_PLUGIN}from"../../../../../const.js";import{blog_categories}from"../../../../../database/categories.js";export const deleteCategoryRoute=buildRoute({pluginId:CONFIG_PLUGIN.pluginId,adminStaffPermission:{module:"categories",permission:"can_delete"},route:{method:"delete",path:"/{id}",request:{params:z.object({id:z.string().transform(Number)})},responses:{204:{description:"Category deleted successfully"},404:{description:"Category not found"}}},handler:async c=>{const{id}=c.req.valid("param");const result=await c.get("db").delete(blog_categories).where(eq(blog_categories.id,id)).returning();if(result.length===0){throw new HTTPException(404)}return c.body(null,204)}});
1
+ import{CONFIG_PLUGIN as e}from"../../../../../const.js";import{blog_categories as t}from"../../../../../database/categories.js";import{z as n}from"@hono/zod-openapi";import{buildRoute as r}from"@vitnode/core/api/lib/route";import{eq as i}from"drizzle-orm";import{HTTPException as a}from"hono/http-exception";const o=r({pluginId:e.pluginId,adminStaffPermission:{module:`categories`,permission:`can_delete`},route:{method:`delete`,path:`/{id}`,request:{params:n.object({id:n.string().transform(Number)})},responses:{204:{description:`Category deleted successfully`},404:{description:`Category not found`}}},handler:async e=>{let{id:n}=e.req.valid(`param`);if((await e.get(`db`).delete(t).where(i(t.id,n)).returning()).length===0)throw new a(404);return e.body(null,204)}});export{o as deleteCategoryRoute};
2
+ //# sourceMappingURL=delete.route.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete.route.js","names":[],"sources":["../../../../../../../src/api/modules/admin/categories/routes/delete.route.ts"],"sourcesContent":["import { z } from \"@hono/zod-openapi\";\nimport { buildRoute } from \"@vitnode/core/api/lib/route\";\nimport { eq } from \"drizzle-orm\";\nimport { HTTPException } from \"hono/http-exception\";\n\nimport { CONFIG_PLUGIN } from \"@/const\";\nimport { blog_categories } from \"@/database/categories\";\n\nexport const deleteCategoryRoute = buildRoute({\n pluginId: CONFIG_PLUGIN.pluginId,\n adminStaffPermission: { module: \"categories\", permission: \"can_delete\" },\n route: {\n method: \"delete\",\n path: \"/{id}\",\n request: {\n params: z.object({\n id: z.string().transform(Number),\n }),\n },\n responses: {\n 204: {\n description: \"Category deleted successfully\",\n },\n 404: {\n description: \"Category not found\",\n },\n },\n },\n handler: async c => {\n const { id } = c.req.valid(\"param\");\n\n const result = await c\n .get(\"db\")\n .delete(blog_categories)\n .where(eq(blog_categories.id, id))\n .returning();\n\n if (result.length === 0) {\n throw new HTTPException(404);\n }\n\n return c.body(null, 204);\n },\n});\n"],"mappings":"oTAQA,MAAa,EAAsB,EAAW,CAC5C,SAAU,EAAc,SACxB,qBAAsB,CAAE,OAAQ,aAAc,WAAY,YAAa,EACvE,MAAO,CACL,OAAQ,SACR,KAAM,QACN,QAAS,CACP,OAAQ,EAAE,OAAO,CACf,GAAI,EAAE,OAAO,CAAC,CAAC,UAAU,MAAM,CACjC,CAAC,CACH,EACA,UAAW,CACT,IAAK,CACH,YAAa,+BACf,EACA,IAAK,CACH,YAAa,oBACf,CACF,CACF,EACA,QAAS,KAAM,IAAK,CAClB,GAAM,CAAE,MAAO,EAAE,IAAI,MAAM,OAAO,EAQlC,IAAI,MANiB,EAClB,IAAI,IAAI,CAAC,CACT,OAAO,CAAe,CAAC,CACvB,MAAM,EAAG,EAAgB,GAAI,CAAE,CAAC,CAAC,CACjC,UAAU,EAAA,CAEF,SAAW,EACpB,MAAM,IAAI,EAAc,GAAG,EAG7B,OAAO,EAAE,KAAK,KAAM,GAAG,CACzB,CACF,CAAC"}
@@ -1,43 +1,46 @@
1
1
  import { z } from "@hono/zod-openapi";
2
- export declare const editCategoryRoute: import("@vitnode/core/api/lib/route").Route<"@vitnode/blog", {
3
- method: "put";
4
- path: "/{id}";
5
- request: {
6
- params: z.ZodObject<{
7
- id: z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>;
8
- }, z.core.$strip>;
9
- body: {
10
- content: {
11
- "application/json": {
12
- schema: z.ZodObject<{
13
- title: z.ZodString;
14
- }, z.core.$strip>;
15
- };
16
- };
2
+ //#region src/api/modules/admin/categories/routes/edit.route.d.ts
3
+ declare const editCategoryRoute: import("@vitnode/core/api/lib/route").Route<"@vitnode/blog", {
4
+ method: "put";
5
+ path: "/{id}";
6
+ request: {
7
+ params: z.ZodObject<{
8
+ id: z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>;
9
+ }, z.core.$strip>;
10
+ body: {
11
+ content: {
12
+ "application/json": {
13
+ schema: z.ZodObject<{
14
+ title: z.ZodString;
15
+ }, z.core.$strip>;
17
16
  };
17
+ };
18
18
  };
19
- responses: {
20
- 200: {
21
- content: {
22
- "application/json": {
23
- schema: z.ZodObject<{
24
- id: z.ZodNumber;
25
- title: z.ZodString;
26
- createdAt: z.ZodDate;
27
- updatedAt: z.ZodDate;
28
- }, z.core.$strip>;
29
- };
30
- };
31
- description: string;
32
- };
33
- 400: {
34
- description: string;
35
- };
36
- 404: {
37
- description: string;
19
+ };
20
+ responses: {
21
+ 200: {
22
+ content: {
23
+ "application/json": {
24
+ schema: z.ZodObject<{
25
+ id: z.ZodNumber;
26
+ title: z.ZodString;
27
+ createdAt: z.ZodDate;
28
+ updatedAt: z.ZodDate;
29
+ }, z.core.$strip>;
38
30
  };
31
+ };
32
+ description: string;
33
+ };
34
+ 400: {
35
+ description: string;
36
+ };
37
+ 404: {
38
+ description: string;
39
39
  };
40
+ };
40
41
  } & {
41
- path: string;
42
+ path: string;
42
43
  }>;
44
+ //#endregion
45
+ export { editCategoryRoute };
43
46
  //# sourceMappingURL=edit.route.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"edit.route.d.ts","sourceRoot":"","sources":["../../../../../../../src/api/modules/admin/categories/routes/edit.route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAkBtC,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkF5B,CAAC"}
1
+ {"version":3,"file":"edit.route.d.ts","names":[],"sources":["../../../../../../../src/api/modules/admin/categories/routes/edit.route.ts"],"mappings":";;cAkBa,yDAAiB"}
@@ -1 +1,2 @@
1
- import{z}from"@hono/zod-openapi";import{buildRoute}from"@vitnode/core/api/lib/route";import{removeSpecialCharacters}from"@vitnode/core/lib/special-characters";import{eq}from"drizzle-orm";import{HTTPException}from"hono/http-exception";import{CONFIG_PLUGIN}from"../../../../../const.js";import{blog_categories}from"../../../../../database/categories.js";import{zodCreateCategorySchema}from"./create.route.js";const zodCategoryResponseSchema=z.object({id:z.number(),title:z.string(),createdAt:z.date(),updatedAt:z.date()});export const editCategoryRoute=buildRoute({pluginId:CONFIG_PLUGIN.pluginId,adminStaffPermission:{module:"categories",permission:"can_edit"},route:{method:"put",path:"/{id}",request:{params:z.object({id:z.string().transform(Number)}),body:{content:{"application/json":{schema:zodCreateCategorySchema}}}},responses:{200:{content:{"application/json":{schema:zodCategoryResponseSchema}},description:"Category updated successfully"},400:{description:"Bad request - Invalid input data"},404:{description:"Category not found"}}},handler:async c=>{const{id}=c.req.valid("param");const{title}=c.req.valid("json");const titleSeo=removeSpecialCharacters(title);const[editData]=await c.get("db").select({titleSeo:blog_categories.titleSeo}).from(blog_categories).where(eq(blog_categories.id,id)).limit(1);if(!editData){throw new HTTPException(404)}const[titleSEODuplocate]=await c.get("db").select({titleSeo:blog_categories.titleSeo}).from(blog_categories).where(eq(blog_categories.titleSeo,titleSeo)).limit(1);if(titleSEODuplocate?.titleSeo===titleSeo&&titleSEODuplocate.titleSeo!==editData.titleSeo){throw new HTTPException(400,{message:"Category with this title already exists."})}const[category]=await c.get("db").update(blog_categories).set({title,titleSeo:removeSpecialCharacters(title)}).where(eq(blog_categories.id,id)).returning();return c.json(category)}});
1
+ import{CONFIG_PLUGIN as e}from"../../../../../const.js";import{blog_categories as t}from"../../../../../database/categories.js";import{zodCreateCategorySchema as n}from"./create.route.js";import{z as r}from"@hono/zod-openapi";import{buildRoute as i}from"@vitnode/core/api/lib/route";import{removeSpecialCharacters as a}from"@vitnode/core/lib/special-characters";import{eq as o}from"drizzle-orm";import{HTTPException as s}from"hono/http-exception";const c=r.object({id:r.number(),title:r.string(),createdAt:r.date(),updatedAt:r.date()}),l=i({pluginId:e.pluginId,adminStaffPermission:{module:`categories`,permission:`can_edit`},route:{method:`put`,path:`/{id}`,request:{params:r.object({id:r.string().transform(Number)}),body:{content:{"application/json":{schema:n}}}},responses:{200:{content:{"application/json":{schema:c}},description:`Category updated successfully`},400:{description:`Bad request - Invalid input data`},404:{description:`Category not found`}}},handler:async e=>{let{id:n}=e.req.valid(`param`),{title:r}=e.req.valid(`json`),i=a(r),[c]=await e.get(`db`).select({titleSeo:t.titleSeo}).from(t).where(o(t.id,n)).limit(1);if(!c)throw new s(404);let[l]=await e.get(`db`).select({titleSeo:t.titleSeo}).from(t).where(o(t.titleSeo,i)).limit(1);if(l?.titleSeo===i&&l.titleSeo!==c.titleSeo)throw new s(400,{message:`Category with this title already exists.`});let[u]=await e.get(`db`).update(t).set({title:r,titleSeo:a(r)}).where(o(t.id,n)).returning();return e.json(u)}});export{l as editCategoryRoute};
2
+ //# sourceMappingURL=edit.route.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edit.route.js","names":[],"sources":["../../../../../../../src/api/modules/admin/categories/routes/edit.route.ts"],"sourcesContent":["import { z } from \"@hono/zod-openapi\";\nimport { buildRoute } from \"@vitnode/core/api/lib/route\";\nimport { removeSpecialCharacters } from \"@vitnode/core/lib/special-characters\";\nimport { eq } from \"drizzle-orm\";\nimport { HTTPException } from \"hono/http-exception\";\n\nimport { CONFIG_PLUGIN } from \"@/const\";\nimport { blog_categories } from \"@/database/categories\";\n\nimport { zodCreateCategorySchema } from \"./create.route\";\n\nconst zodCategoryResponseSchema = z.object({\n id: z.number(),\n title: z.string(),\n createdAt: z.date(),\n updatedAt: z.date(),\n});\n\nexport const editCategoryRoute = buildRoute({\n pluginId: CONFIG_PLUGIN.pluginId,\n adminStaffPermission: { module: \"categories\", permission: \"can_edit\" },\n route: {\n method: \"put\",\n path: \"/{id}\",\n request: {\n params: z.object({\n id: z.string().transform(Number),\n }),\n body: {\n content: {\n \"application/json\": {\n schema: zodCreateCategorySchema,\n },\n },\n },\n },\n responses: {\n 200: {\n content: {\n \"application/json\": {\n schema: zodCategoryResponseSchema,\n },\n },\n description: \"Category updated successfully\",\n },\n 400: {\n description: \"Bad request - Invalid input data\",\n },\n 404: {\n description: \"Category not found\",\n },\n },\n },\n handler: async c => {\n const { id } = c.req.valid(\"param\");\n const { title } = c.req.valid(\"json\");\n const titleSeo = removeSpecialCharacters(title);\n const [editData] = await c\n .get(\"db\")\n .select({\n titleSeo: blog_categories.titleSeo,\n })\n .from(blog_categories)\n .where(eq(blog_categories.id, id))\n .limit(1);\n\n if (!editData) {\n throw new HTTPException(404);\n }\n\n const [titleSEODuplocate] = await c\n .get(\"db\")\n .select({\n titleSeo: blog_categories.titleSeo,\n })\n .from(blog_categories)\n .where(eq(blog_categories.titleSeo, titleSeo))\n .limit(1);\n\n if (\n titleSEODuplocate?.titleSeo === titleSeo &&\n titleSEODuplocate.titleSeo !== editData.titleSeo\n ) {\n throw new HTTPException(400, {\n message: \"Category with this title already exists.\",\n });\n }\n\n const [category] = await c\n .get(\"db\")\n .update(blog_categories)\n .set({\n title,\n titleSeo: removeSpecialCharacters(title),\n })\n .where(eq(blog_categories.id, id))\n .returning();\n\n return c.json(category);\n },\n});\n"],"mappings":"+bAWA,MAAM,EAA4B,EAAE,OAAO,CACzC,GAAI,EAAE,OAAO,EACb,MAAO,EAAE,OAAO,EAChB,UAAW,EAAE,KAAK,EAClB,UAAW,EAAE,KAAK,CACpB,CAAC,EAEY,EAAoB,EAAW,CAC1C,SAAU,EAAc,SACxB,qBAAsB,CAAE,OAAQ,aAAc,WAAY,UAAW,EACrE,MAAO,CACL,OAAQ,MACR,KAAM,QACN,QAAS,CACP,OAAQ,EAAE,OAAO,CACf,GAAI,EAAE,OAAO,CAAC,CAAC,UAAU,MAAM,CACjC,CAAC,EACD,KAAM,CACJ,QAAS,CACP,mBAAoB,CAClB,OAAQ,CACV,CACF,CACF,CACF,EACA,UAAW,CACT,IAAK,CACH,QAAS,CACP,mBAAoB,CAClB,OAAQ,CACV,CACF,EACA,YAAa,+BACf,EACA,IAAK,CACH,YAAa,kCACf,EACA,IAAK,CACH,YAAa,oBACf,CACF,CACF,EACA,QAAS,KAAM,IAAK,CAClB,GAAM,CAAE,MAAO,EAAE,IAAI,MAAM,OAAO,EAC5B,CAAE,SAAU,EAAE,IAAI,MAAM,MAAM,EAC9B,EAAW,EAAwB,CAAK,EACxC,CAAC,GAAY,MAAM,EACtB,IAAI,IAAI,CAAC,CACT,OAAO,CACN,SAAU,EAAgB,QAC5B,CAAC,CAAC,CACD,KAAK,CAAe,CAAC,CACrB,MAAM,EAAG,EAAgB,GAAI,CAAE,CAAC,CAAC,CACjC,MAAM,CAAC,EAEV,GAAI,CAAC,EACH,MAAM,IAAI,EAAc,GAAG,EAG7B,GAAM,CAAC,GAAqB,MAAM,EAC/B,IAAI,IAAI,CAAC,CACT,OAAO,CACN,SAAU,EAAgB,QAC5B,CAAC,CAAC,CACD,KAAK,CAAe,CAAC,CACrB,MAAM,EAAG,EAAgB,SAAU,CAAQ,CAAC,CAAC,CAC7C,MAAM,CAAC,EAEV,GACE,GAAmB,WAAa,GAChC,EAAkB,WAAa,EAAS,SAExC,MAAM,IAAI,EAAc,IAAK,CAC3B,QAAS,0CACX,CAAC,EAGH,GAAM,CAAC,GAAY,MAAM,EACtB,IAAI,IAAI,CAAC,CACT,OAAO,CAAe,CAAC,CACvB,IAAI,CACH,QACA,SAAU,EAAwB,CAAK,CACzC,CAAC,CAAC,CACD,MAAM,EAAG,EAAgB,GAAI,CAAE,CAAC,CAAC,CACjC,UAAU,EAEb,OAAO,EAAE,KAAK,CAAQ,CACxB,CACF,CAAC"}
@@ -1,107 +1,110 @@
1
- export declare const postsAdminModule: import("@vitnode/core/api/lib/module").BuildModuleReturn<"@vitnode/blog", "posts", [import("@vitnode/core/api/lib/route").Route<"@vitnode/blog", {
2
- method: "put";
3
- path: "/{id}";
4
- request: {
5
- params: import("zod").ZodObject<{
6
- id: import("zod").ZodPipe<import("zod").ZodString, import("zod").ZodTransform<number, string>>;
7
- }, import("zod/v4/core").$strip>;
8
- body: {
9
- content: {
10
- "application/json": {
11
- schema: import("zod").ZodObject<{
12
- title: import("zod").ZodString;
13
- content: import("zod").ZodString;
14
- categoryId: import("zod").ZodNumber;
15
- }, import("zod/v4/core").$strip>;
16
- };
17
- };
1
+ //#region src/api/modules/admin/posts/posts.admin.module.d.ts
2
+ declare const postsAdminModule: import("@vitnode/core/api/lib/module").BuildModuleReturn<"@vitnode/blog", "posts", [import("@vitnode/core/api/lib/route").Route<"@vitnode/blog", {
3
+ method: "put";
4
+ path: "/{id}";
5
+ request: {
6
+ params: import("zod").ZodObject<{
7
+ id: import("zod").ZodPipe<import("zod").ZodString, import("zod").ZodTransform<number, string>>;
8
+ }, import("zod/v4/core").$strip>;
9
+ body: {
10
+ content: {
11
+ "application/json": {
12
+ schema: import("zod").ZodObject<{
13
+ title: import("zod").ZodString;
14
+ content: import("zod").ZodString;
15
+ categoryId: import("zod").ZodNumber;
16
+ }, import("zod/v4/core").$strip>;
18
17
  };
18
+ };
19
19
  };
20
- responses: {
21
- 200: {
22
- content: {
23
- "application/json": {
24
- schema: import("zod").ZodObject<{
25
- id: import("zod").ZodNumber;
26
- title: import("zod").ZodString;
27
- titleSeo: import("zod").ZodString;
28
- content: import("zod").ZodString;
29
- categoryId: import("zod").ZodNumber;
30
- createdAt: import("zod").ZodDate;
31
- updatedAt: import("zod").ZodDate;
32
- }, import("zod/v4/core").$strip>;
33
- };
34
- };
35
- description: string;
36
- };
37
- 400: {
38
- description: string;
39
- };
40
- 404: {
41
- description: string;
20
+ };
21
+ responses: {
22
+ 200: {
23
+ content: {
24
+ "application/json": {
25
+ schema: import("zod").ZodObject<{
26
+ id: import("zod").ZodNumber;
27
+ title: import("zod").ZodString;
28
+ titleSeo: import("zod").ZodString;
29
+ content: import("zod").ZodString;
30
+ categoryId: import("zod").ZodNumber;
31
+ createdAt: import("zod").ZodDate;
32
+ updatedAt: import("zod").ZodDate;
33
+ }, import("zod/v4/core").$strip>;
42
34
  };
35
+ };
36
+ description: string;
37
+ };
38
+ 400: {
39
+ description: string;
43
40
  };
41
+ 404: {
42
+ description: string;
43
+ };
44
+ };
44
45
  } & {
45
- path: string;
46
+ path: string;
46
47
  }>, import("@vitnode/core/api/lib/route").Route<"@vitnode/blog", {
47
- method: "post";
48
- path: "/";
49
- request: {
50
- body: {
51
- content: {
52
- "application/json": {
53
- schema: import("zod").ZodObject<{
54
- title: import("zod").ZodString;
55
- content: import("zod").ZodString;
56
- categoryId: import("zod").ZodNumber;
57
- }, import("zod/v4/core").$strip>;
58
- };
59
- };
48
+ method: "post";
49
+ path: "/";
50
+ request: {
51
+ body: {
52
+ content: {
53
+ "application/json": {
54
+ schema: import("zod").ZodObject<{
55
+ title: import("zod").ZodString;
56
+ content: import("zod").ZodString;
57
+ categoryId: import("zod").ZodNumber;
58
+ }, import("zod/v4/core").$strip>;
60
59
  };
60
+ };
61
61
  };
62
- responses: {
63
- 201: {
64
- content: {
65
- "application/json": {
66
- schema: import("zod").ZodObject<{
67
- id: import("zod").ZodNumber;
68
- title: import("zod").ZodString;
69
- titleSeo: import("zod").ZodString;
70
- content: import("zod").ZodString;
71
- categoryId: import("zod").ZodNumber;
72
- createdAt: import("zod").ZodDate;
73
- updatedAt: import("zod").ZodDate;
74
- }, import("zod/v4/core").$strip>;
75
- };
76
- };
77
- description: string;
78
- };
79
- 400: {
80
- description: string;
81
- };
82
- 404: {
83
- description: string;
62
+ };
63
+ responses: {
64
+ 201: {
65
+ content: {
66
+ "application/json": {
67
+ schema: import("zod").ZodObject<{
68
+ id: import("zod").ZodNumber;
69
+ title: import("zod").ZodString;
70
+ titleSeo: import("zod").ZodString;
71
+ content: import("zod").ZodString;
72
+ categoryId: import("zod").ZodNumber;
73
+ createdAt: import("zod").ZodDate;
74
+ updatedAt: import("zod").ZodDate;
75
+ }, import("zod/v4/core").$strip>;
84
76
  };
77
+ };
78
+ description: string;
79
+ };
80
+ 400: {
81
+ description: string;
82
+ };
83
+ 404: {
84
+ description: string;
85
85
  };
86
+ };
86
87
  } & {
87
- path: string;
88
+ path: string;
88
89
  }>, import("@vitnode/core/api/lib/route").Route<"@vitnode/blog", {
89
- method: "delete";
90
- path: "/{id}";
91
- request: {
92
- params: import("zod").ZodObject<{
93
- id: import("zod").ZodPipe<import("zod").ZodString, import("zod").ZodTransform<number, string>>;
94
- }, import("zod/v4/core").$strip>;
90
+ method: "delete";
91
+ path: "/{id}";
92
+ request: {
93
+ params: import("zod").ZodObject<{
94
+ id: import("zod").ZodPipe<import("zod").ZodString, import("zod").ZodTransform<number, string>>;
95
+ }, import("zod/v4/core").$strip>;
96
+ };
97
+ responses: {
98
+ 204: {
99
+ description: string;
95
100
  };
96
- responses: {
97
- 204: {
98
- description: string;
99
- };
100
- 404: {
101
- description: string;
102
- };
101
+ 404: {
102
+ description: string;
103
103
  };
104
+ };
104
105
  } & {
105
- path: string;
106
+ path: string;
106
107
  }>], import("@vitnode/core/api/lib/module").BaseBuildModuleReturn<"@vitnode/blog", string, import("@vitnode/core/api/lib/route").Route<"@vitnode/blog", import("@hono/zod-openapi").RouteConfig>[]>[]>;
108
+ //#endregion
109
+ export { postsAdminModule };
107
110
  //# sourceMappingURL=posts.admin.module.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"posts.admin.module.d.ts","sourceRoot":"","sources":["../../../../../../src/api/modules/admin/posts/posts.admin.module.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sMAI3B,CAAC"}
1
+ {"version":3,"file":"posts.admin.module.d.ts","names":[],"sources":["../../../../../../src/api/modules/admin/posts/posts.admin.module.ts"],"mappings":";cAOa,yDAAgB,mFAAA"}
@@ -1 +1,2 @@
1
- import{buildModule}from"@vitnode/core/api/lib/module";import{CONFIG_PLUGIN}from"../../../../const.js";import{createPostRoute}from"./routes/create.route.js";import{deletePostRoute}from"./routes/delete.route.js";import{editPostRoute}from"./routes/edit.route.js";export const postsAdminModule=buildModule({pluginId:CONFIG_PLUGIN.pluginId,name:"posts",routes:[editPostRoute,createPostRoute,deletePostRoute]});
1
+ import{CONFIG_PLUGIN as e}from"../../../../const.js";import{createPostRoute as t}from"./routes/create.route.js";import{deletePostRoute as n}from"./routes/delete.route.js";import{editPostRoute as r}from"./routes/edit.route.js";import{buildModule as i}from"@vitnode/core/api/lib/module";const a=i({pluginId:e.pluginId,name:`posts`,routes:[r,t,n]});export{a as postsAdminModule};
2
+ //# sourceMappingURL=posts.admin.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"posts.admin.module.js","names":[],"sources":["../../../../../../src/api/modules/admin/posts/posts.admin.module.ts"],"sourcesContent":["import { buildModule } from \"@vitnode/core/api/lib/module\";\n\nimport { CONFIG_PLUGIN } from \"../../../../const\";\nimport { createPostRoute } from \"./routes/create.route\";\nimport { deletePostRoute } from \"./routes/delete.route\";\nimport { editPostRoute } from \"./routes/edit.route\";\n\nexport const postsAdminModule = buildModule({\n pluginId: CONFIG_PLUGIN.pluginId,\n name: \"posts\",\n routes: [editPostRoute, createPostRoute, deletePostRoute],\n});\n"],"mappings":"6RAOA,MAAa,EAAmB,EAAY,CAC1C,SAAU,EAAc,SACxB,KAAM,QACN,OAAQ,CAAC,EAAe,EAAiB,CAAe,CAC1D,CAAC"}
@@ -1,50 +1,53 @@
1
1
  import { z } from "@hono/zod-openapi";
2
- export declare const zodCreatePostSchema: z.ZodObject<{
3
- title: z.ZodString;
4
- content: z.ZodString;
5
- categoryId: z.ZodNumber;
2
+ //#region src/api/modules/admin/posts/routes/create.route.d.ts
3
+ declare const zodCreatePostSchema: z.ZodObject<{
4
+ title: z.ZodString;
5
+ content: z.ZodString;
6
+ categoryId: z.ZodNumber;
6
7
  }, z.core.$strip>;
7
- export declare const createPostRoute: import("@vitnode/core/api/lib/route").Route<"@vitnode/blog", {
8
- method: "post";
9
- path: "/";
10
- request: {
11
- body: {
12
- content: {
13
- "application/json": {
14
- schema: z.ZodObject<{
15
- title: z.ZodString;
16
- content: z.ZodString;
17
- categoryId: z.ZodNumber;
18
- }, z.core.$strip>;
19
- };
20
- };
8
+ declare const createPostRoute: import("@vitnode/core/api/lib/route").Route<"@vitnode/blog", {
9
+ method: "post";
10
+ path: "/";
11
+ request: {
12
+ body: {
13
+ content: {
14
+ "application/json": {
15
+ schema: z.ZodObject<{
16
+ title: z.ZodString;
17
+ content: z.ZodString;
18
+ categoryId: z.ZodNumber;
19
+ }, z.core.$strip>;
21
20
  };
21
+ };
22
22
  };
23
- responses: {
24
- 201: {
25
- content: {
26
- "application/json": {
27
- schema: z.ZodObject<{
28
- id: z.ZodNumber;
29
- title: z.ZodString;
30
- titleSeo: z.ZodString;
31
- content: z.ZodString;
32
- categoryId: z.ZodNumber;
33
- createdAt: z.ZodDate;
34
- updatedAt: z.ZodDate;
35
- }, z.core.$strip>;
36
- };
37
- };
38
- description: string;
39
- };
40
- 400: {
41
- description: string;
42
- };
43
- 404: {
44
- description: string;
23
+ };
24
+ responses: {
25
+ 201: {
26
+ content: {
27
+ "application/json": {
28
+ schema: z.ZodObject<{
29
+ id: z.ZodNumber;
30
+ title: z.ZodString;
31
+ titleSeo: z.ZodString;
32
+ content: z.ZodString;
33
+ categoryId: z.ZodNumber;
34
+ createdAt: z.ZodDate;
35
+ updatedAt: z.ZodDate;
36
+ }, z.core.$strip>;
45
37
  };
38
+ };
39
+ description: string;
40
+ };
41
+ 400: {
42
+ description: string;
43
+ };
44
+ 404: {
45
+ description: string;
46
46
  };
47
+ };
47
48
  } & {
48
- path: string;
49
+ path: string;
49
50
  }>;
51
+ //#endregion
52
+ export { createPostRoute, zodCreatePostSchema };
50
53
  //# sourceMappingURL=create.route.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"create.route.d.ts","sourceRoot":"","sources":["../../../../../../../src/api/modules/admin/posts/routes/create.route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAoBtC,eAAO,MAAM,mBAAmB;;;;iBAO9B,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6E1B,CAAC"}
1
+ {"version":3,"file":"create.route.d.ts","names":[],"sources":["../../../../../../../src/api/modules/admin/posts/routes/create.route.ts"],"mappings":";;cAoBa,qBAAmB,EAAA;;;;;cASnB,uDAAe"}
@@ -1 +1,2 @@
1
- import{z}from"@hono/zod-openapi";import{buildRoute}from"@vitnode/core/api/lib/route";import{removeSpecialCharacters}from"@vitnode/core/lib/special-characters";import{eq}from"drizzle-orm";import{HTTPException}from"hono/http-exception";import{CONFIG_PLUGIN}from"../../../../../const.js";import{blog_categories}from"../../../../../database/categories.js";import{blog_posts}from"../../../../../database/posts.js";const zodPostResponseSchema=z.object({id:z.number(),title:z.string(),titleSeo:z.string(),content:z.string(),categoryId:z.number(),createdAt:z.date(),updatedAt:z.date()});export const zodCreatePostSchema=z.object({title:z.string().min(3,"Title must be at least 3 characters long").max(255,"Title must not exceed 255 characters"),content:z.string(),categoryId:z.number()});export const createPostRoute=buildRoute({pluginId:CONFIG_PLUGIN.pluginId,adminStaffPermission:{module:"posts",permission:"can_create"},route:{method:"post",path:"/",request:{body:{content:{"application/json":{schema:zodCreatePostSchema}}}},responses:{201:{content:{"application/json":{schema:zodPostResponseSchema}},description:"Post created successfully"},400:{description:"Bad request - Invalid input data"},404:{description:"Category not found"}}},handler:async c=>{const{title,content,categoryId}=c.req.valid("json");const titleSeo=removeSpecialCharacters(title);const[category]=await c.get("db").select({id:blog_categories.id}).from(blog_categories).where(eq(blog_categories.id,categoryId)).limit(1);if(!category){throw new HTTPException(404,{message:"Category not found."})}const[titleSEODuplicate]=await c.get("db").select({titleSeo:blog_posts.titleSeo}).from(blog_posts).where(eq(blog_posts.titleSeo,titleSeo)).limit(1);if(titleSEODuplicate?.titleSeo===titleSeo){throw new HTTPException(400,{message:"Post with this title already exists."})}const[post]=await c.get("db").insert(blog_posts).values({title,titleSeo,content,categoryId}).returning();return c.json(post,201)}});
1
+ import{CONFIG_PLUGIN as e}from"../../../../../const.js";import{blog_categories as t}from"../../../../../database/categories.js";import{blog_posts as n}from"../../../../../database/posts.js";import{z as r}from"@hono/zod-openapi";import{buildRoute as i}from"@vitnode/core/api/lib/route";import{removeSpecialCharacters as a}from"@vitnode/core/lib/special-characters";import{eq as o}from"drizzle-orm";import{HTTPException as s}from"hono/http-exception";const c=r.object({id:r.number(),title:r.string(),titleSeo:r.string(),content:r.string(),categoryId:r.number(),createdAt:r.date(),updatedAt:r.date()}),l=r.object({title:r.string().min(3,`Title must be at least 3 characters long`).max(255,`Title must not exceed 255 characters`),content:r.string(),categoryId:r.number()}),u=i({pluginId:e.pluginId,adminStaffPermission:{module:`posts`,permission:`can_create`},route:{method:`post`,path:`/`,request:{body:{content:{"application/json":{schema:l}}}},responses:{201:{content:{"application/json":{schema:c}},description:`Post created successfully`},400:{description:`Bad request - Invalid input data`},404:{description:`Category not found`}}},handler:async e=>{let{title:r,content:i,categoryId:c}=e.req.valid(`json`),l=a(r),[u]=await e.get(`db`).select({id:t.id}).from(t).where(o(t.id,c)).limit(1);if(!u)throw new s(404,{message:`Category not found.`});let[d]=await e.get(`db`).select({titleSeo:n.titleSeo}).from(n).where(o(n.titleSeo,l)).limit(1);if(d?.titleSeo===l)throw new s(400,{message:`Post with this title already exists.`});let[f]=await e.get(`db`).insert(n).values({title:r,titleSeo:l,content:i,categoryId:c}).returning();return e.json(f,201)}});export{u as createPostRoute,l as zodCreatePostSchema};
2
+ //# sourceMappingURL=create.route.js.map