@vitnode/blog 1.2.0-canary.23 → 1.2.0-canary.25
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.
- package/dist/src/api/modules/admin/admin.module.d.ts +439 -0
- package/dist/src/api/modules/admin/admin.module.d.ts.map +1 -0
- package/dist/src/api/modules/admin/admin.module.js +1 -0
- package/dist/src/api/modules/admin/categories/categories.admin.module.d.ts +198 -0
- package/dist/src/api/modules/admin/categories/categories.admin.module.d.ts.map +1 -0
- package/dist/src/api/modules/admin/categories/categories.admin.module.js +1 -0
- package/dist/src/api/modules/{categories → admin/categories}/routes/create.route.d.ts +1 -1
- package/dist/src/api/modules/admin/categories/routes/create.route.d.ts.map +1 -0
- package/dist/src/api/modules/admin/categories/routes/create.route.js +1 -0
- package/dist/src/api/modules/{categories → admin/categories}/routes/delete.route.d.ts +1 -1
- package/dist/src/api/modules/admin/categories/routes/delete.route.d.ts.map +1 -0
- package/dist/src/api/modules/admin/categories/routes/delete.route.js +1 -0
- package/dist/src/api/modules/{categories → admin/categories}/routes/edit.route.d.ts +1 -1
- package/dist/src/api/modules/admin/categories/routes/edit.route.d.ts.map +1 -0
- package/dist/src/api/modules/admin/categories/routes/edit.route.js +1 -0
- package/dist/src/api/modules/admin/posts/posts.admin.module.d.ts +243 -0
- package/dist/src/api/modules/admin/posts/posts.admin.module.d.ts.map +1 -0
- package/dist/src/api/modules/admin/posts/posts.admin.module.js +1 -0
- package/dist/src/api/modules/{posts → admin/posts}/routes/create.route.d.ts +1 -1
- package/dist/src/api/modules/admin/posts/routes/create.route.d.ts.map +1 -0
- package/dist/src/api/modules/admin/posts/routes/create.route.js +1 -0
- package/dist/src/api/modules/{posts → admin/posts}/routes/delete.route.d.ts +1 -1
- package/dist/src/api/modules/admin/posts/routes/delete.route.d.ts.map +1 -0
- package/dist/src/api/modules/admin/posts/routes/delete.route.js +1 -0
- package/dist/src/api/modules/{posts → admin/posts}/routes/edit.route.d.ts +1 -1
- package/dist/src/api/modules/admin/posts/routes/edit.route.d.ts.map +1 -0
- package/dist/src/api/modules/admin/posts/routes/edit.route.js +1 -0
- package/dist/src/api/modules/categories/categories.module.d.ts +1 -197
- package/dist/src/api/modules/categories/categories.module.d.ts.map +1 -1
- package/dist/src/api/modules/categories/categories.module.js +1 -1
- package/dist/src/api/modules/categories/routes/get.route.d.ts +1 -1
- package/dist/src/api/modules/posts/posts.module.d.ts +5 -246
- package/dist/src/api/modules/posts/posts.module.d.ts.map +1 -1
- package/dist/src/api/modules/posts/posts.module.js +1 -1
- package/dist/src/api/modules/posts/routes/get.route.d.ts +5 -5
- package/dist/src/app_admin/blog/categories/page.d.ts +5 -1
- package/dist/src/app_admin/blog/categories/page.d.ts.map +1 -1
- package/dist/src/app_admin/blog/categories/page.js +1 -1
- package/dist/src/app_admin/blog/posts/page.d.ts +5 -1
- package/dist/src/app_admin/blog/posts/page.d.ts.map +1 -1
- package/dist/src/app_admin/blog/posts/page.js +1 -1
- package/dist/src/config.api.d.ts.map +1 -1
- package/dist/src/config.api.js +1 -1
- package/dist/src/views/admin/categories/actions/create-edit/create-edit.d.ts +1 -1
- package/dist/src/views/admin/categories/actions/create-edit/create-edit.d.ts.map +1 -1
- package/dist/src/views/admin/categories/actions/create-edit/mutation-api.d.ts +1 -1
- package/dist/src/views/admin/categories/actions/create-edit/mutation-api.d.ts.map +1 -1
- package/dist/src/views/admin/categories/actions/create-edit/mutation-api.js +1 -1
- package/dist/src/views/admin/categories/table/actions/delete/delete-action.d.ts.map +1 -0
- package/dist/src/views/admin/categories/table/actions/delete/delete-action.js +1 -0
- package/dist/src/views/admin/categories/table/actions/delete/mutation-api.d.ts.map +1 -0
- package/dist/src/views/admin/categories/table/actions/delete/mutation-api.js +1 -0
- package/dist/src/views/admin/categories/{row-actions → table/actions}/edit-action.d.ts +1 -1
- package/dist/src/views/admin/categories/table/actions/edit-action.d.ts.map +1 -0
- package/dist/src/views/admin/categories/table/actions/edit-action.js +1 -0
- package/dist/src/views/admin/categories/table/categories-admin-view.d.ts.map +1 -0
- package/dist/src/views/admin/categories/table/categories-admin-view.js +1 -0
- package/dist/src/views/admin/posts/actions/create-edit/mutation-api.d.ts +1 -1
- package/dist/src/views/admin/posts/actions/create-edit/mutation-api.d.ts.map +1 -1
- package/dist/src/views/admin/posts/actions/create-edit/mutation-api.js +1 -1
- package/dist/src/views/admin/posts/table/actions/delete/delete-action.d.ts.map +1 -0
- package/dist/src/views/admin/posts/table/actions/delete/delete-action.js +1 -0
- package/dist/src/views/admin/{categories/row-actions → posts/table/actions}/delete/mutation-api.d.ts.map +1 -1
- package/dist/src/views/admin/posts/table/actions/delete/mutation-api.js +1 -0
- package/dist/src/views/admin/posts/{row-actions → table/actions}/edit-action.d.ts +1 -1
- package/dist/src/views/admin/posts/table/actions/edit-action.d.ts.map +1 -0
- package/dist/src/views/admin/posts/table/actions/edit-action.js +1 -0
- package/dist/src/views/admin/posts/table/posts-admin-view.d.ts.map +1 -0
- package/dist/src/views/admin/posts/table/posts-admin-view.js +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +18 -18
- package/src/app_admin/blog/categories/page.tsx +11 -3
- package/src/app_admin/blog/posts/page.tsx +11 -2
- package/dist/src/api/modules/categories/routes/create.route.d.ts.map +0 -1
- package/dist/src/api/modules/categories/routes/create.route.js +0 -1
- package/dist/src/api/modules/categories/routes/delete.route.d.ts.map +0 -1
- package/dist/src/api/modules/categories/routes/delete.route.js +0 -1
- package/dist/src/api/modules/categories/routes/edit.route.d.ts.map +0 -1
- package/dist/src/api/modules/categories/routes/edit.route.js +0 -1
- package/dist/src/api/modules/posts/routes/create.route.d.ts.map +0 -1
- package/dist/src/api/modules/posts/routes/create.route.js +0 -1
- package/dist/src/api/modules/posts/routes/delete.route.d.ts.map +0 -1
- package/dist/src/api/modules/posts/routes/delete.route.js +0 -1
- package/dist/src/api/modules/posts/routes/edit.route.d.ts.map +0 -1
- package/dist/src/api/modules/posts/routes/edit.route.js +0 -1
- package/dist/src/views/admin/categories/categories-admin-view.d.ts.map +0 -1
- package/dist/src/views/admin/categories/categories-admin-view.js +0 -1
- package/dist/src/views/admin/categories/row-actions/delete/delete-action.d.ts.map +0 -1
- package/dist/src/views/admin/categories/row-actions/delete/delete-action.js +0 -1
- package/dist/src/views/admin/categories/row-actions/delete/mutation-api.js +0 -1
- package/dist/src/views/admin/categories/row-actions/edit-action.d.ts.map +0 -1
- package/dist/src/views/admin/categories/row-actions/edit-action.js +0 -1
- package/dist/src/views/admin/posts/posts-admin-view.d.ts.map +0 -1
- package/dist/src/views/admin/posts/posts-admin-view.js +0 -1
- package/dist/src/views/admin/posts/row-actions/delete/delete-action.d.ts.map +0 -1
- package/dist/src/views/admin/posts/row-actions/delete/delete-action.js +0 -1
- package/dist/src/views/admin/posts/row-actions/delete/mutation-api.d.ts.map +0 -1
- package/dist/src/views/admin/posts/row-actions/delete/mutation-api.js +0 -1
- package/dist/src/views/admin/posts/row-actions/edit-action.d.ts.map +0 -1
- package/dist/src/views/admin/posts/row-actions/edit-action.js +0 -1
- /package/dist/src/views/admin/categories/{row-actions → table/actions}/delete/delete-action.d.ts +0 -0
- /package/dist/src/views/admin/categories/{row-actions → table/actions}/delete/mutation-api.d.ts +0 -0
- /package/dist/src/views/admin/categories/{categories-admin-view.d.ts → table/categories-admin-view.d.ts} +0 -0
- /package/dist/src/views/admin/posts/{row-actions → table/actions}/delete/delete-action.d.ts +0 -0
- /package/dist/src/views/admin/posts/{row-actions → table/actions}/delete/mutation-api.d.ts +0 -0
- /package/dist/src/views/admin/posts/{posts-admin-view.d.ts → table/posts-admin-view.d.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitnode/blog",
|
|
3
|
-
"version": "1.2.0-canary.
|
|
3
|
+
"version": "1.2.0-canary.25",
|
|
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.
|
|
31
|
-
"drizzle-kit": "^0.31.
|
|
32
|
-
"drizzle-orm": "^0.44.
|
|
33
|
-
"hono": "^4.
|
|
34
|
-
"lucide-react": "^0.
|
|
35
|
-
"next": "^15.3.
|
|
36
|
-
"next-intl": "^4.1
|
|
30
|
+
"@hono/zod-openapi": "^0.19.8",
|
|
31
|
+
"drizzle-kit": "^0.31.3",
|
|
32
|
+
"drizzle-orm": "^0.44.2",
|
|
33
|
+
"hono": "^4.8.3",
|
|
34
|
+
"lucide-react": "^0.523.0",
|
|
35
|
+
"next": "^15.3.4",
|
|
36
|
+
"next-intl": "^4.3.1",
|
|
37
37
|
"react": "^19.1.0",
|
|
38
38
|
"react-dom": "^19.1.0",
|
|
39
|
-
"react-hook-form": "^7.
|
|
39
|
+
"react-hook-form": "^7.58.1",
|
|
40
40
|
"sonner": "^2.0.5",
|
|
41
|
-
"zod": "^3.25.
|
|
42
|
-
"@vitnode/core": "1.2.0-canary.
|
|
41
|
+
"zod": "^3.25.67",
|
|
42
|
+
"@vitnode/core": "1.2.0-canary.25"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@swc/cli": "0.6.0",
|
|
46
|
-
"@swc/core": "^1.
|
|
47
|
-
"@types/react": "^19.1.
|
|
48
|
-
"@types/react-dom": "^19.1.
|
|
49
|
-
"concurrently": "^9.
|
|
50
|
-
"eslint": "^9.
|
|
51
|
-
"tsc-alias": "^1.8.
|
|
46
|
+
"@swc/core": "^1.12.7",
|
|
47
|
+
"@types/react": "^19.1.8",
|
|
48
|
+
"@types/react-dom": "^19.1.6",
|
|
49
|
+
"concurrently": "^9.2.0",
|
|
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.
|
|
53
|
+
"@vitnode/eslint-config": "1.2.0-canary.25"
|
|
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 {
|
|
9
|
+
import { ActionsCategoriesAdmin } from '@/views/admin/categories/actions/actions';
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
const CategoriesAdminView = React.lazy(async () =>
|
|
12
|
+
import('@/views/admin/categories/table/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
|
-
<
|
|
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
|
-
|
|
10
|
+
|
|
11
|
+
const PostsAdminView = React.lazy(async () =>
|
|
12
|
+
import('@/views/admin/posts/table/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
|
-
<
|
|
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)}});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"categories-admin-view.d.ts","sourceRoot":"","sources":["../../../../../src/views/admin/categories/categories-admin-view.tsx"],"names":[],"mappings":"AAUA,eAAO,MAAM,mBAAmB,GAAU,mBAEvC;IACD,YAAY,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC;CACtE,qDA0DA,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";import{DateFormat}from"@vitnode/core/components/date-format";import{DataTable}from"@vitnode/core/components/table/data-table";import{fetcher}from"@vitnode/core/lib/fetcher";import{getTranslations}from"next-intl/server";import{categoriesModule}from"../../../api/modules/categories/categories.module.js";import{DeleteAction}from"./row-actions/delete/delete-action.js";import{EditAction}from"./row-actions/edit-action.js";export const CategoriesAdminView=async({searchParams})=>{const t=await getTranslations("@vitnode/blog.admin.categories.table");const query=await searchParams;const res=await fetcher(categoriesModule,{path:"/",method:"get",module:"categories",args:{query},withPagination:true,options:{cache:"force-cache"}});const data=await res.json();return _jsx(DataTable,{columns:[{id:"id",label:"ID",className:"w-24"},{id:"title",label:t("title")},{id:"updatedAt",label:t("updated_at"),className:"w-48",cell:({row})=>_jsx(DateFormat,{date:row.updatedAt})},{id:"actions",label:"",className:"w-10",cell:({row})=>_jsxs(_Fragment,{children:[_jsx(EditAction,{data:row}),_jsx(DeleteAction,{...row})]})}],edges:data.edges.map(edge=>({...edge})),order:{columns:["createdAt","updatedAt"],defaultOrder:{column:"createdAt",order:"desc"}},pageInfo:data.pageInfo})};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"delete-action.d.ts","sourceRoot":"","sources":["../../../../../../../src/views/admin/categories/row-actions/delete/delete-action.tsx"],"names":[],"mappings":"AA0BA,eAAO,MAAM,YAAY,GAAI,eAAe;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,4CAsDxE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use client";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{AlertDialog,AlertDialogAction,AlertDialogCancel,AlertDialogContent,AlertDialogDescription,AlertDialogFooter,AlertDialogHeader,AlertDialogTitle,AlertDialogTrigger}from"@vitnode/core/components/ui/alert-dialog";import{Button}from"@vitnode/core/components/ui/button";import{Tooltip,TooltipContent,TooltipProvider,TooltipTrigger}from"@vitnode/core/components/ui/tooltip";import{Trash2Icon}from"lucide-react";import{useTranslations}from"next-intl";import{toast}from"sonner";import{mutationApi}from"./mutation-api.js";export const DeleteAction=({title,id})=>{const t=useTranslations("@vitnode/blog.admin.categories.delete");const tGlobal=useTranslations("core.global");return _jsxs(AlertDialog,{children:[_jsx(TooltipProvider,{children:_jsxs(Tooltip,{children:[_jsx(TooltipTrigger,{asChild:true,children:_jsx(AlertDialogTrigger,{asChild:true,children:_jsx(Button,{size:"icon",variant:"destructiveGhost",children:_jsx(Trash2Icon,{className:"size-4"})})})}),_jsx(TooltipContent,{children:t("title")})]})}),_jsxs(AlertDialogContent,{children:[_jsxs(AlertDialogHeader,{children:[_jsx(AlertDialogTitle,{children:t("title")}),_jsx(AlertDialogDescription,{children:t.rich("desc",{title:()=>_jsx("span",{className:"text-foreground font-bold",children:title})})})]}),_jsxs(AlertDialogFooter,{children:[_jsx(AlertDialogCancel,{children:tGlobal("cancel")}),_jsx(AlertDialogAction,{onClick:async()=>{const mutation=await mutationApi(id);if(mutation?.error){toast.error(tGlobal("errors.title"),{description:tGlobal("errors.internal_server_error")});return}toast.success(t("success"),{description:title})},children:t("confirm")})]})]})]})};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use server";import{fetcher}from"@vitnode/core/lib/fetcher";import{revalidatePath}from"next/cache";import{categoriesModule}from"../../../../../api/modules/categories/categories.module.js";export const mutationApi=async id=>{const res=await fetcher(categoriesModule,{method:"delete",path:"/{id}",module:"categories",args:{params:{id}}});if(!res.ok){return{error:await res.text()}}revalidatePath("/[locale]/admin/(auth)/(plugins)/(vitnode-blog)/blog/categories","page")};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"edit-action.d.ts","sourceRoot":"","sources":["../../../../../../src/views/admin/categories/row-actions/edit-action.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,QAAA,MAAM,+BAA+B;QAEhB,CAAC;;;8CAErB,CAAC;AAEF,eAAO,MAAM,UAAU,GACrB,OAAO,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,+BAA+B,CAAC,CAAC,4CA+B9E,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use client";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{Button}from"@vitnode/core/components/ui/button";import{Dialog,DialogContent,DialogDescription,DialogHeader,DialogTitle,DialogTrigger}from"@vitnode/core/components/ui/dialog";import{Loader}from"@vitnode/core/components/ui/loader";import{Tooltip,TooltipContent,TooltipProvider,TooltipTrigger}from"@vitnode/core/components/ui/tooltip";import{PencilIcon}from"lucide-react";import{useTranslations}from"next-intl";import React from"react";const CreateEditActionCategoriesAdmin=React.lazy(async()=>import("../actions/create-edit/create-edit.js").then(mod=>({default:mod.CreateEditActionCategoriesAdmin})));export const EditAction=props=>{const t=useTranslations("@vitnode/blog.admin.categories.edit");return _jsxs(Dialog,{children:[_jsx(TooltipProvider,{children:_jsxs(Tooltip,{children:[_jsx(TooltipTrigger,{asChild:true,children:_jsx(DialogTrigger,{asChild:true,children:_jsx(Button,{size:"icon",variant:"ghost",children:_jsx(PencilIcon,{})})})}),_jsx(TooltipContent,{children:t("title")})]})}),_jsxs(DialogContent,{children:[_jsxs(DialogHeader,{children:[_jsx(DialogTitle,{children:t("title")}),_jsx(DialogDescription,{children:props.data.title})]}),_jsx(React.Suspense,{fallback:_jsx(Loader,{}),children:_jsx(CreateEditActionCategoriesAdmin,{...props})})]})]})};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"posts-admin-view.d.ts","sourceRoot":"","sources":["../../../../../src/views/admin/posts/posts-admin-view.tsx"],"names":[],"mappings":"AAUA,eAAO,MAAM,cAAc,GAAU,mBAElC;IACD,YAAY,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC;CACtE,qDAgEA,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";import{DateFormat}from"@vitnode/core/components/date-format";import{DataTable}from"@vitnode/core/components/table/data-table";import{fetcher}from"@vitnode/core/lib/fetcher";import{getTranslations}from"next-intl/server";import{postsModule}from"../../../api/modules/posts/posts.module.js";import{DeleteAction}from"./row-actions/delete/delete-action.js";import{EditAction}from"./row-actions/edit-action.js";export const PostsAdminView=async({searchParams})=>{const t=await getTranslations("@vitnode/blog.admin.posts.table");const query=await searchParams;const res=await fetcher(postsModule,{path:"/",method:"get",module:"posts",args:{query},withPagination:true,options:{cache:"force-cache"}});const data=await res.json();return _jsx(DataTable,{columns:[{id:"id",label:"ID",className:"w-24"},{id:"title",label:t("title")},{id:"category",label:t("category"),className:"w-48",cell:({row})=>row.category.title},{id:"updatedAt",label:t("updated_at"),className:"w-48",cell:({row})=>_jsx(DateFormat,{date:row.updatedAt})},{id:"actions",label:"",className:"w-10",cell:({row})=>_jsxs(_Fragment,{children:[_jsx(EditAction,{data:row}),_jsx(DeleteAction,{...row})]})}],edges:data.edges.map(edge=>({...edge})),order:{columns:["createdAt","updatedAt"],defaultOrder:{column:"createdAt",order:"desc"}},pageInfo:data.pageInfo})};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"delete-action.d.ts","sourceRoot":"","sources":["../../../../../../../src/views/admin/posts/row-actions/delete/delete-action.tsx"],"names":[],"mappings":"AA0BA,eAAO,MAAM,YAAY,GAAI,eAAe;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,4CAsDxE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use client";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{AlertDialog,AlertDialogAction,AlertDialogCancel,AlertDialogContent,AlertDialogDescription,AlertDialogFooter,AlertDialogHeader,AlertDialogTitle,AlertDialogTrigger}from"@vitnode/core/components/ui/alert-dialog";import{Button}from"@vitnode/core/components/ui/button";import{Tooltip,TooltipContent,TooltipProvider,TooltipTrigger}from"@vitnode/core/components/ui/tooltip";import{Trash2Icon}from"lucide-react";import{useTranslations}from"next-intl";import{toast}from"sonner";import{mutationApi}from"./mutation-api.js";export const DeleteAction=({title,id})=>{const t=useTranslations("@vitnode/blog.admin.posts.delete");const tGlobal=useTranslations("core.global");return _jsxs(AlertDialog,{children:[_jsx(TooltipProvider,{children:_jsxs(Tooltip,{children:[_jsx(TooltipTrigger,{asChild:true,children:_jsx(AlertDialogTrigger,{asChild:true,children:_jsx(Button,{size:"icon",variant:"destructiveGhost",children:_jsx(Trash2Icon,{className:"size-4"})})})}),_jsx(TooltipContent,{children:t("title")})]})}),_jsxs(AlertDialogContent,{children:[_jsxs(AlertDialogHeader,{children:[_jsx(AlertDialogTitle,{children:t("title")}),_jsx(AlertDialogDescription,{children:t.rich("desc",{title:()=>_jsx("span",{className:"text-foreground font-bold",children:title})})})]}),_jsxs(AlertDialogFooter,{children:[_jsx(AlertDialogCancel,{children:tGlobal("cancel")}),_jsx(AlertDialogAction,{onClick:async()=>{const mutation=await mutationApi(id);if(mutation?.error){toast.error(tGlobal("errors.title"),{description:tGlobal("errors.internal_server_error")});return}toast.success(t("success"),{description:title})},children:t("confirm")})]})]})]})};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mutation-api.d.ts","sourceRoot":"","sources":["../../../../../../../src/views/admin/posts/row-actions/delete/mutation-api.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,WAAW,GAAU,IAAI,MAAM;;cAoB3C,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use server";import{fetcher}from"@vitnode/core/lib/fetcher";import{revalidatePath}from"next/cache";import{postsModule}from"../../../../../api/modules/posts/posts.module.js";export const mutationApi=async id=>{const res=await fetcher(postsModule,{method:"delete",path:"/{id}",module:"posts",args:{params:{id}}});if(!res.ok){return{error:await res.text()}}revalidatePath("/[locale]/admin/(auth)/(plugins)/(vitnode-blog)/blog/posts","page")};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"edit-action.d.ts","sourceRoot":"","sources":["../../../../../../src/views/admin/posts/row-actions/edit-action.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,QAAA,MAAM,0BAA0B;QAeL,CAAC;UACG,CAAC;;8CAZ/B,CAAC;AAEF,eAAO,MAAM,UAAU,GACrB,OAAO,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,0BAA0B,CAAC,CAAC,4CA+BzE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use client";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{Button}from"@vitnode/core/components/ui/button";import{Dialog,DialogContent,DialogDescription,DialogHeader,DialogTitle,DialogTrigger}from"@vitnode/core/components/ui/dialog";import{Loader}from"@vitnode/core/components/ui/loader";import{Tooltip,TooltipContent,TooltipProvider,TooltipTrigger}from"@vitnode/core/components/ui/tooltip";import{PencilIcon}from"lucide-react";import{useTranslations}from"next-intl";import React from"react";const CreateEditActionPostsAdmin=React.lazy(async()=>import("../actions/create-edit/create-edit.js").then(mod=>({default:mod.CreateEditActionPostsAdmin})));export const EditAction=props=>{const t=useTranslations("@vitnode/blog.admin.posts.edit");return _jsxs(Dialog,{children:[_jsx(TooltipProvider,{children:_jsxs(Tooltip,{children:[_jsx(TooltipTrigger,{asChild:true,children:_jsx(DialogTrigger,{asChild:true,children:_jsx(Button,{size:"icon",variant:"ghost",children:_jsx(PencilIcon,{})})})}),_jsx(TooltipContent,{children:t("title")})]})}),_jsxs(DialogContent,{children:[_jsxs(DialogHeader,{children:[_jsx(DialogTitle,{children:t("title")}),_jsx(DialogDescription,{children:props.data.title})]}),_jsx(React.Suspense,{fallback:_jsx(Loader,{}),children:_jsx(CreateEditActionPostsAdmin,{...props})})]})]})};
|
/package/dist/src/views/admin/categories/{row-actions → table/actions}/delete/delete-action.d.ts
RENAMED
|
File without changes
|
/package/dist/src/views/admin/categories/{row-actions → table/actions}/delete/mutation-api.d.ts
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|