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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/dist/src/api/modules/admin/admin.module.d.ts +439 -0
  2. package/dist/src/api/modules/admin/admin.module.d.ts.map +1 -0
  3. package/dist/src/api/modules/admin/admin.module.js +1 -0
  4. package/dist/src/api/modules/admin/categories/categories.admin.module.d.ts +198 -0
  5. package/dist/src/api/modules/admin/categories/categories.admin.module.d.ts.map +1 -0
  6. package/dist/src/api/modules/admin/categories/categories.admin.module.js +1 -0
  7. package/dist/src/api/modules/{categories → admin/categories}/routes/create.route.d.ts +1 -1
  8. package/dist/src/api/modules/admin/categories/routes/create.route.d.ts.map +1 -0
  9. package/dist/src/api/modules/admin/categories/routes/create.route.js +1 -0
  10. package/dist/src/api/modules/{categories → admin/categories}/routes/delete.route.d.ts +1 -1
  11. package/dist/src/api/modules/admin/categories/routes/delete.route.d.ts.map +1 -0
  12. package/dist/src/api/modules/admin/categories/routes/delete.route.js +1 -0
  13. package/dist/src/api/modules/{categories → admin/categories}/routes/edit.route.d.ts +1 -1
  14. package/dist/src/api/modules/admin/categories/routes/edit.route.d.ts.map +1 -0
  15. package/dist/src/api/modules/admin/categories/routes/edit.route.js +1 -0
  16. package/dist/src/api/modules/admin/posts/posts.admin.module.d.ts +243 -0
  17. package/dist/src/api/modules/admin/posts/posts.admin.module.d.ts.map +1 -0
  18. package/dist/src/api/modules/admin/posts/posts.admin.module.js +1 -0
  19. package/dist/src/api/modules/{posts → admin/posts}/routes/create.route.d.ts +1 -1
  20. package/dist/src/api/modules/admin/posts/routes/create.route.d.ts.map +1 -0
  21. package/dist/src/api/modules/admin/posts/routes/create.route.js +1 -0
  22. package/dist/src/api/modules/{posts → admin/posts}/routes/delete.route.d.ts +1 -1
  23. package/dist/src/api/modules/admin/posts/routes/delete.route.d.ts.map +1 -0
  24. package/dist/src/api/modules/admin/posts/routes/delete.route.js +1 -0
  25. package/dist/src/api/modules/{posts → admin/posts}/routes/edit.route.d.ts +1 -1
  26. package/dist/src/api/modules/admin/posts/routes/edit.route.d.ts.map +1 -0
  27. package/dist/src/api/modules/admin/posts/routes/edit.route.js +1 -0
  28. package/dist/src/api/modules/categories/categories.module.d.ts +1 -197
  29. package/dist/src/api/modules/categories/categories.module.d.ts.map +1 -1
  30. package/dist/src/api/modules/categories/categories.module.js +1 -1
  31. package/dist/src/api/modules/categories/routes/get.route.d.ts +1 -1
  32. package/dist/src/api/modules/posts/posts.module.d.ts +5 -246
  33. package/dist/src/api/modules/posts/posts.module.d.ts.map +1 -1
  34. package/dist/src/api/modules/posts/posts.module.js +1 -1
  35. package/dist/src/api/modules/posts/routes/get.route.d.ts +5 -5
  36. package/dist/src/app_admin/blog/categories/page.d.ts +5 -1
  37. package/dist/src/app_admin/blog/categories/page.d.ts.map +1 -1
  38. package/dist/src/app_admin/blog/categories/page.js +1 -1
  39. package/dist/src/app_admin/blog/posts/page.d.ts +5 -1
  40. package/dist/src/app_admin/blog/posts/page.d.ts.map +1 -1
  41. package/dist/src/app_admin/blog/posts/page.js +1 -1
  42. package/dist/src/config.api.d.ts.map +1 -1
  43. package/dist/src/config.api.js +1 -1
  44. package/dist/src/views/admin/categories/actions/create-edit/create-edit.d.ts +1 -1
  45. package/dist/src/views/admin/categories/actions/create-edit/create-edit.d.ts.map +1 -1
  46. package/dist/src/views/admin/categories/actions/create-edit/mutation-api.d.ts +1 -1
  47. package/dist/src/views/admin/categories/actions/create-edit/mutation-api.d.ts.map +1 -1
  48. package/dist/src/views/admin/categories/actions/create-edit/mutation-api.js +1 -1
  49. package/dist/src/views/admin/categories/row-actions/delete/delete-action.d.ts.map +1 -1
  50. package/dist/src/views/admin/categories/row-actions/delete/delete-action.js +1 -1
  51. package/dist/src/views/admin/categories/row-actions/delete/mutation-api.d.ts.map +1 -1
  52. package/dist/src/views/admin/categories/row-actions/delete/mutation-api.js +1 -1
  53. package/dist/src/views/admin/categories/row-actions/edit-action.d.ts +1 -1
  54. package/dist/src/views/admin/categories/row-actions/edit-action.d.ts.map +1 -1
  55. package/dist/src/views/admin/posts/actions/create-edit/mutation-api.d.ts +1 -1
  56. package/dist/src/views/admin/posts/actions/create-edit/mutation-api.d.ts.map +1 -1
  57. package/dist/src/views/admin/posts/actions/create-edit/mutation-api.js +1 -1
  58. package/dist/src/views/admin/posts/row-actions/delete/delete-action.d.ts.map +1 -1
  59. package/dist/src/views/admin/posts/row-actions/delete/delete-action.js +1 -1
  60. package/dist/src/views/admin/posts/row-actions/delete/mutation-api.d.ts.map +1 -1
  61. package/dist/src/views/admin/posts/row-actions/delete/mutation-api.js +1 -1
  62. package/dist/tsconfig.tsbuildinfo +1 -1
  63. package/package.json +16 -16
  64. package/src/app_admin/blog/categories/page.tsx +11 -3
  65. package/src/app_admin/blog/posts/page.tsx +11 -2
  66. package/dist/src/api/modules/categories/routes/create.route.d.ts.map +0 -1
  67. package/dist/src/api/modules/categories/routes/create.route.js +0 -1
  68. package/dist/src/api/modules/categories/routes/delete.route.d.ts.map +0 -1
  69. package/dist/src/api/modules/categories/routes/delete.route.js +0 -1
  70. package/dist/src/api/modules/categories/routes/edit.route.d.ts.map +0 -1
  71. package/dist/src/api/modules/categories/routes/edit.route.js +0 -1
  72. package/dist/src/api/modules/posts/routes/create.route.d.ts.map +0 -1
  73. package/dist/src/api/modules/posts/routes/create.route.js +0 -1
  74. package/dist/src/api/modules/posts/routes/delete.route.d.ts.map +0 -1
  75. package/dist/src/api/modules/posts/routes/delete.route.js +0 -1
  76. package/dist/src/api/modules/posts/routes/edit.route.d.ts.map +0 -1
  77. package/dist/src/api/modules/posts/routes/edit.route.js +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitnode/blog",
3
- "version": "1.2.0-canary.23",
3
+ "version": "1.2.0-canary.24",
4
4
  "description": "Blog plugin for VitNode, providing a blogging platform with Next.js and Hono.js.",
5
5
  "author": "VitNode Team",
6
6
  "license": "MIT",
@@ -27,30 +27,30 @@
27
27
  }
28
28
  },
29
29
  "dependencies": {
30
- "@hono/zod-openapi": "^0.19.6",
31
- "drizzle-kit": "^0.31.0",
32
- "drizzle-orm": "^0.44.1",
33
- "hono": "^4.7.8",
34
- "lucide-react": "^0.513.0",
35
- "next": "^15.3.1",
30
+ "@hono/zod-openapi": "^0.19.8",
31
+ "drizzle-kit": "^0.31.1",
32
+ "drizzle-orm": "^0.44.2",
33
+ "hono": "^4.8.2",
34
+ "lucide-react": "^0.517.0",
35
+ "next": "^15.3.4",
36
36
  "next-intl": "^4.1.0",
37
37
  "react": "^19.1.0",
38
38
  "react-dom": "^19.1.0",
39
- "react-hook-form": "^7.57.0",
39
+ "react-hook-form": "^7.58.1",
40
40
  "sonner": "^2.0.5",
41
- "zod": "^3.25.56",
42
- "@vitnode/core": "1.2.0-canary.23"
41
+ "zod": "^3.25.67",
42
+ "@vitnode/core": "1.2.0-canary.24"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@swc/cli": "0.6.0",
46
- "@swc/core": "^1.11.24",
47
- "@types/react": "^19.1.3",
48
- "@types/react-dom": "^19.1.5",
46
+ "@swc/core": "^1.12.5",
47
+ "@types/react": "^19.1.8",
48
+ "@types/react-dom": "^19.1.6",
49
49
  "concurrently": "^9.1.2",
50
- "eslint": "^9.25.1",
51
- "tsc-alias": "^1.8.15",
50
+ "eslint": "^9.29.0",
51
+ "tsc-alias": "^1.8.16",
52
52
  "typescript": "^5.8.3",
53
- "@vitnode/eslint-config": "1.2.0-canary.23"
53
+ "@vitnode/eslint-config": "1.2.0-canary.24"
54
54
  },
55
55
  "scripts": {
56
56
  "build:plugins": "tsc && swc src -d dist --config-file .swcrc && tsc-alias -p tsconfig.json",
@@ -1,12 +1,18 @@
1
1
  import type { Metadata } from 'next';
2
2
 
3
3
  import { I18nProvider } from '@vitnode/core/components/i18n-provider';
4
+ import { DataTableSkeleton } from '@vitnode/core/components/table/data-table';
4
5
  import { HeaderContent } from '@vitnode/core/components/ui/header-content';
5
6
  import { getTranslations } from 'next-intl/server';
7
+ import React from 'react';
6
8
 
7
- import { CategoriesAdminView } from '@/views/admin/categories/categories-admin-view';
9
+ import { ActionsCategoriesAdmin } from '@/views/admin/categories/actions/actions';
8
10
 
9
- import { ActionsCategoriesAdmin } from '../../../views/admin/categories/actions/actions';
11
+ const CategoriesAdminView = React.lazy(async () =>
12
+ import('@/views/admin/categories/categories-admin-view').then(mod => ({
13
+ default: mod.CategoriesAdminView,
14
+ })),
15
+ );
10
16
 
11
17
  export const generateMetadata = async (): Promise<Metadata> => {
12
18
  const t = await getTranslations('@vitnode/blog.admin.nav');
@@ -31,7 +37,9 @@ export default async function CategoriesPage(
31
37
  <ActionsCategoriesAdmin />
32
38
  </HeaderContent>
33
39
 
34
- <CategoriesAdminView {...params} />
40
+ <React.Suspense fallback={<DataTableSkeleton columns={4} />}>
41
+ <CategoriesAdminView {...params} />
42
+ </React.Suspense>
35
43
  </div>
36
44
  </I18nProvider>
37
45
  );
@@ -1,11 +1,18 @@
1
1
  import type { Metadata } from 'next';
2
2
 
3
3
  import { I18nProvider } from '@vitnode/core/components/i18n-provider';
4
+ import { DataTableSkeleton } from '@vitnode/core/components/table/data-table';
4
5
  import { HeaderContent } from '@vitnode/core/components/ui/header-content';
5
6
  import { getTranslations } from 'next-intl/server';
7
+ import React from 'react';
6
8
 
7
9
  import { ActionsPostsAdmin } from '@/views/admin/posts/actions/actions';
8
- import { PostsAdminView } from '@/views/admin/posts/posts-admin-view';
10
+
11
+ const PostsAdminView = React.lazy(async () =>
12
+ import('@/views/admin/posts/posts-admin-view').then(mod => ({
13
+ default: mod.PostsAdminView,
14
+ })),
15
+ );
9
16
 
10
17
  export const generateMetadata = async (): Promise<Metadata> => {
11
18
  const t = await getTranslations('@vitnode/blog.admin.nav');
@@ -30,7 +37,9 @@ export default async function PostsPage(
30
37
  <ActionsPostsAdmin />
31
38
  </HeaderContent>
32
39
 
33
- <PostsAdminView {...params} />
40
+ <React.Suspense fallback={<DataTableSkeleton columns={5} />}>
41
+ <PostsAdminView {...params} />
42
+ </React.Suspense>
34
43
  </div>
35
44
  </I18nProvider>
36
45
  );
@@ -1 +0,0 @@
1
- {"version":3,"file":"create.route.d.ts","sourceRoot":"","sources":["../../../../../../src/api/modules/categories/routes/create.route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAStC,eAAO,MAAM,uBAAuB;;;;;;EAElC,CAAC;AASH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyD9B,CAAC"}
@@ -1 +0,0 @@
1
- import{z}from"@hono/zod-openapi";import{buildRoute}from"@vitnode/core/api/lib/route";import{removeSpecialCharacters}from"@vitnode/core/lib/special-characters";import{eq}from"drizzle-orm";import{HTTPException}from"hono/http-exception";import{CONFIG_PLUGIN}from"../../../../const.js";import{blog_categories}from"../../../../database/categories.js";export const zodCreateCategorySchema=z.object({title:z.string()});const zodCategoryResponseSchema=z.object({id:z.number(),title:z.string(),createdAt:z.date(),updatedAt:z.date()});export const createCategoryRoute=buildRoute({...CONFIG_PLUGIN,route:{method:"post",path:"/",request:{body:{content:{"application/json":{schema:zodCreateCategorySchema}}}},responses:{201:{content:{"application/json":{schema:zodCategoryResponseSchema}},description:"Category created successfully"},400:{description:"Bad request - Invalid input data"}}},handler:async c=>{const{title}=c.req.valid("json");const titleSeo=removeSpecialCharacters(title);const[titleSEODuplocate]=await c.get("db").select({titleSeo:blog_categories.titleSeo}).from(blog_categories).where(eq(blog_categories.titleSeo,titleSeo)).limit(1);if(titleSEODuplocate?.titleSeo===titleSeo){throw new HTTPException(400,{message:"Category with this title already exists."})}const[category]=await c.get("db").insert(blog_categories).values({title,titleSeo:removeSpecialCharacters(title)}).returning();return c.json(category,201)}});
@@ -1 +0,0 @@
1
- {"version":3,"file":"delete.route.d.ts","sourceRoot":"","sources":["../../../../../../src/api/modules/categories/routes/delete.route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAQtC,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkC9B,CAAC"}
@@ -1 +0,0 @@
1
- import{z}from"@hono/zod-openapi";import{buildRoute}from"@vitnode/core/api/lib/route";import{eq}from"drizzle-orm";import{HTTPException}from"hono/http-exception";import{CONFIG_PLUGIN}from"../../../../const.js";import{blog_categories}from"../../../../database/categories.js";export const deleteCategoryRoute=buildRoute({...CONFIG_PLUGIN,route:{method:"delete",path:"/{id}",request:{params:z.object({id:z.string().transform(Number)})},responses:{204:{description:"Category deleted successfully"},404:{description:"Category not found"}}},handler:async c=>{const{id}=c.req.valid("param");const result=await c.get("db").delete(blog_categories).where(eq(blog_categories.id,id)).returning();if(result.length===0){throw new HTTPException(404)}return c.body(null,204)}});
@@ -1 +0,0 @@
1
- {"version":3,"file":"edit.route.d.ts","sourceRoot":"","sources":["../../../../../../src/api/modules/categories/routes/edit.route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAkBtC,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiF5B,CAAC"}
@@ -1 +0,0 @@
1
- import{z}from"@hono/zod-openapi";import{buildRoute}from"@vitnode/core/api/lib/route";import{removeSpecialCharacters}from"@vitnode/core/lib/special-characters";import{eq}from"drizzle-orm";import{HTTPException}from"hono/http-exception";import{CONFIG_PLUGIN}from"../../../../const.js";import{blog_categories}from"../../../../database/categories.js";import{zodCreateCategorySchema}from"./create.route.js";const zodCategoryResponseSchema=z.object({id:z.number(),title:z.string(),createdAt:z.date(),updatedAt:z.date()});export const editCategoryRoute=buildRoute({...CONFIG_PLUGIN,route:{method:"put",path:"/{id}",request:{params:z.object({id:z.string().transform(Number)}),body:{content:{"application/json":{schema:zodCreateCategorySchema}}}},responses:{200:{content:{"application/json":{schema:zodCategoryResponseSchema}},description:"Category updated successfully"},400:{description:"Bad request - Invalid input data"},404:{description:"Category not found"}}},handler:async c=>{const{id}=c.req.valid("param");const{title}=c.req.valid("json");const titleSeo=removeSpecialCharacters(title);const[editData]=await c.get("db").select({titleSeo:blog_categories.titleSeo}).from(blog_categories).where(eq(blog_categories.id,id)).limit(1);if(!editData){throw new HTTPException(404)}const[titleSEODuplocate]=await c.get("db").select({titleSeo:blog_categories.titleSeo}).from(blog_categories).where(eq(blog_categories.titleSeo,titleSeo)).limit(1);if(titleSEODuplocate?.titleSeo===titleSeo&&titleSEODuplocate.titleSeo!==editData.titleSeo){throw new HTTPException(400,{message:"Category with this title already exists."})}const[category]=await c.get("db").update(blog_categories).set({title,titleSeo:removeSpecialCharacters(title)}).where(eq(blog_categories.id,id)).returning();return c.json(category)}});
@@ -1 +0,0 @@
1
- {"version":3,"file":"create.route.d.ts","sourceRoot":"","sources":["../../../../../../src/api/modules/posts/routes/create.route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAUtC,eAAO,MAAM,mBAAmB;;;;;;;;;;;;EAO9B,CAAC;AAYH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4E1B,CAAC"}
@@ -1 +0,0 @@
1
- import{z}from"@hono/zod-openapi";import{buildRoute}from"@vitnode/core/api/lib/route";import{removeSpecialCharacters}from"@vitnode/core/lib/special-characters";import{eq}from"drizzle-orm";import{HTTPException}from"hono/http-exception";import{CONFIG_PLUGIN}from"../../../../const.js";import{blog_categories}from"../../../../database/categories.js";import{blog_posts}from"../../../../database/posts.js";export const zodCreatePostSchema=z.object({title:z.string().min(3,"Title must be at least 3 characters long").max(255,"Title must not exceed 255 characters"),content:z.string(),categoryId:z.number()});const zodPostResponseSchema=z.object({id:z.number(),title:z.string(),titleSeo:z.string(),content:z.string(),categoryId:z.number(),createdAt:z.date(),updatedAt:z.date()});export const createPostRoute=buildRoute({...CONFIG_PLUGIN,route:{method:"post",path:"/",request:{body:{content:{"application/json":{schema:zodCreatePostSchema}}}},responses:{201:{content:{"application/json":{schema:zodPostResponseSchema}},description:"Post created successfully"},400:{description:"Bad request - Invalid input data"},404:{description:"Category not found"}}},handler:async c=>{const{title,content,categoryId}=c.req.valid("json");const titleSeo=removeSpecialCharacters(title);const[category]=await c.get("db").select({id:blog_categories.id}).from(blog_categories).where(eq(blog_categories.id,categoryId)).limit(1);if(!category){throw new HTTPException(404,{message:"Category not found."})}const[titleSEODuplicate]=await c.get("db").select({titleSeo:blog_posts.titleSeo}).from(blog_posts).where(eq(blog_posts.titleSeo,titleSeo)).limit(1);if(titleSEODuplicate?.titleSeo===titleSeo){throw new HTTPException(400,{message:"Post with this title already exists."})}const[post]=await c.get("db").insert(blog_posts).values({title,titleSeo,content,categoryId}).returning();return c.json(post,201)}});
@@ -1 +0,0 @@
1
- {"version":3,"file":"delete.route.d.ts","sourceRoot":"","sources":["../../../../../../src/api/modules/posts/routes/delete.route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAQtC,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkC1B,CAAC"}
@@ -1 +0,0 @@
1
- import{z}from"@hono/zod-openapi";import{buildRoute}from"@vitnode/core/api/lib/route";import{eq}from"drizzle-orm";import{HTTPException}from"hono/http-exception";import{CONFIG_PLUGIN}from"../../../../const.js";import{blog_posts}from"../../../../database/posts.js";export const deletePostRoute=buildRoute({...CONFIG_PLUGIN,route:{method:"delete",path:"/{id}",request:{params:z.object({id:z.string().transform(Number)})},responses:{204:{description:"Post deleted successfully"},404:{description:"Post not found"}}},handler:async c=>{const{id}=c.req.valid("param");const result=await c.get("db").delete(blog_posts).where(eq(blog_posts.id,id)).returning();if(result.length===0){throw new HTTPException(404)}return c.body(null,204)}});
@@ -1 +0,0 @@
1
- {"version":3,"file":"edit.route.d.ts","sourceRoot":"","sources":["../../../../../../src/api/modules/posts/routes/edit.route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAsBtC,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8FxB,CAAC"}
@@ -1 +0,0 @@
1
- import{z}from"@hono/zod-openapi";import{buildRoute}from"@vitnode/core/api/lib/route";import{removeSpecialCharacters}from"@vitnode/core/lib/special-characters";import{eq}from"drizzle-orm";import{HTTPException}from"hono/http-exception";import{CONFIG_PLUGIN}from"../../../../const.js";import{blog_categories}from"../../../../database/categories.js";import{blog_posts}from"../../../../database/posts.js";import{zodCreatePostSchema}from"./create.route.js";const zodPostResponseSchema=z.object({id:z.number(),title:z.string(),titleSeo:z.string(),content:z.string(),categoryId:z.number(),createdAt:z.date(),updatedAt:z.date()});export const editPostRoute=buildRoute({...CONFIG_PLUGIN,route:{method:"put",path:"/{id}",request:{params:z.object({id:z.string().transform(Number)}),body:{content:{"application/json":{schema:zodCreatePostSchema}}}},responses:{200:{content:{"application/json":{schema:zodPostResponseSchema}},description:"Post updated successfully"},400:{description:"Bad request - Invalid input data"},404:{description:"Post or category not found"}}},handler:async c=>{const{id}=c.req.valid("param");const{title,content,categoryId}=c.req.valid("json");const titleSeo=removeSpecialCharacters(title);const[existingPost]=await c.get("db").select({titleSeo:blog_posts.titleSeo}).from(blog_posts).where(eq(blog_posts.id,id)).limit(1);if(!existingPost){throw new HTTPException(404,{message:"Post not found."})}const[category]=await c.get("db").select({id:blog_categories.id}).from(blog_categories).where(eq(blog_categories.id,categoryId)).limit(1);if(!category){throw new HTTPException(404,{message:"Category not found."})}const[titleSEODuplicate]=await c.get("db").select({titleSeo:blog_posts.titleSeo}).from(blog_posts).where(eq(blog_posts.titleSeo,titleSeo)).limit(1);if(titleSEODuplicate?.titleSeo===titleSeo&&titleSEODuplicate.titleSeo!==existingPost.titleSeo){throw new HTTPException(400,{message:"Post with this title already exists."})}const[post]=await c.get("db").update(blog_posts).set({title,titleSeo,content,categoryId}).where(eq(blog_posts.id,id)).returning();return c.json(post)}});