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

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 (43) hide show
  1. package/dist/src/api/modules/categories/categories.module.d.ts +5 -0
  2. package/dist/src/api/modules/categories/categories.module.d.ts.map +1 -1
  3. package/dist/src/api/modules/categories/routes/create.route.d.ts.map +1 -1
  4. package/dist/src/api/modules/categories/routes/create.route.js +1 -1
  5. package/dist/src/api/modules/categories/routes/edit.route.d.ts +0 -7
  6. package/dist/src/api/modules/categories/routes/edit.route.d.ts.map +1 -1
  7. package/dist/src/api/modules/categories/routes/edit.route.js +1 -1
  8. package/dist/src/api/modules/categories/routes/get.route.d.ts +5 -0
  9. package/dist/src/api/modules/categories/routes/get.route.d.ts.map +1 -1
  10. package/dist/src/api/modules/categories/routes/get.route.js +1 -1
  11. package/dist/src/api/modules/posts/routes/create.route.js +1 -1
  12. package/dist/src/api/modules/posts/routes/edit.route.d.ts +0 -13
  13. package/dist/src/api/modules/posts/routes/edit.route.d.ts.map +1 -1
  14. package/dist/src/api/modules/posts/routes/edit.route.js +1 -1
  15. package/dist/src/api/modules/posts/routes/get.route.d.ts +48 -0
  16. package/dist/src/api/modules/posts/routes/get.route.d.ts.map +1 -1
  17. package/dist/src/api/modules/posts/routes/get.route.js +1 -1
  18. package/dist/src/app_admin/blog/categories/page.js +1 -1
  19. package/dist/src/app_admin/blog/posts/page.d.ts.map +1 -1
  20. package/dist/src/app_admin/blog/posts/page.js +1 -1
  21. package/dist/src/views/admin/categories/actions/create-edit/create-edit.d.ts.map +1 -1
  22. package/dist/src/views/admin/categories/actions/create-edit/create-edit.js +1 -1
  23. package/dist/src/views/admin/categories/row-actions/delete/delete-action.js +1 -1
  24. package/dist/src/views/admin/posts/actions/actions.d.ts +2 -0
  25. package/dist/src/views/admin/posts/actions/actions.d.ts.map +1 -0
  26. package/dist/src/views/admin/posts/actions/actions.js +1 -0
  27. package/dist/src/views/admin/posts/actions/create-edit/create-edit.d.ts +8 -0
  28. package/dist/src/views/admin/posts/actions/create-edit/create-edit.d.ts.map +1 -0
  29. package/dist/src/views/admin/posts/actions/create-edit/create-edit.js +1 -0
  30. package/dist/src/views/admin/posts/actions/create-edit/mutation-api.d.ts +11 -0
  31. package/dist/src/views/admin/posts/actions/create-edit/mutation-api.d.ts.map +1 -0
  32. package/dist/src/views/admin/posts/actions/create-edit/mutation-api.js +1 -0
  33. package/dist/src/views/admin/posts/posts-admin-view.d.ts.map +1 -1
  34. package/dist/src/views/admin/posts/posts-admin-view.js +1 -1
  35. package/dist/src/views/admin/posts/row-actions/delete/delete-action.js +1 -1
  36. package/dist/src/views/admin/posts/row-actions/edit-action.d.ts +9 -0
  37. package/dist/src/views/admin/posts/row-actions/edit-action.d.ts.map +1 -0
  38. package/dist/src/views/admin/posts/row-actions/edit-action.js +1 -0
  39. package/dist/tsconfig.tsbuildinfo +1 -1
  40. package/package.json +3 -3
  41. package/src/app_admin/blog/categories/page.tsx +1 -1
  42. package/src/app_admin/blog/posts/page.tsx +5 -2
  43. package/src/locales/en.json +17 -0
@@ -2,6 +2,7 @@ export declare const categoriesModule: import("@vitnode/core/api/lib/module").Bu
2
2
  handler: (c: import("hono").Context<import("@vitnode/core/api/middlewares/global/global").EnvVitNode, "/", {
3
3
  in: {
4
4
  query: {
5
+ search?: string | undefined;
5
6
  orderBy?: "updatedAt" | undefined;
6
7
  cursor?: string | undefined;
7
8
  first?: string | undefined;
@@ -11,6 +12,7 @@ export declare const categoriesModule: import("@vitnode/core/api/lib/module").Bu
11
12
  };
12
13
  out: {
13
14
  query: {
15
+ search?: string | undefined;
14
16
  orderBy?: "updatedAt" | undefined;
15
17
  cursor?: string | undefined;
16
18
  first?: string | undefined;
@@ -47,13 +49,16 @@ export declare const categoriesModule: import("@vitnode/core/api/lib/module").Bu
47
49
  } & {
48
50
  order: import("zod").ZodOptional<import("zod").ZodEnum<["asc", "desc"]>>;
49
51
  orderBy: import("zod").ZodOptional<import("zod").ZodEnum<["updatedAt"]>>;
52
+ search: import("zod").ZodOptional<import("zod").ZodString>;
50
53
  }, "strip", import("zod").ZodTypeAny, {
54
+ search?: string | undefined;
51
55
  orderBy?: "updatedAt" | undefined;
52
56
  cursor?: string | undefined;
53
57
  first?: string | undefined;
54
58
  last?: string | undefined;
55
59
  order?: "asc" | "desc" | undefined;
56
60
  }, {
61
+ search?: string | undefined;
57
62
  orderBy?: "updatedAt" | undefined;
58
63
  cursor?: string | undefined;
59
64
  first?: string | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"categories.module.d.ts","sourceRoot":"","sources":["../../../../../src/api/modules/categories/categories.module.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wRAS3B,CAAC"}
1
+ {"version":3,"file":"categories.module.d.ts","sourceRoot":"","sources":["../../../../../src/api/modules/categories/categories.module.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wRAS3B,CAAC"}
@@ -1 +1 @@
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;;;;;;EAKlC,CAAC;AASH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyD9B,CAAC"}
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 +1 @@
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().min(3,"Title must be at least 3 characters long").max(100,"Title must not exceed 100 characters")});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
+ 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,11 +1,4 @@
1
1
  import { z } from '@hono/zod-openapi';
2
- export declare const zodEditCategorySchema: z.ZodObject<{
3
- title: z.ZodString;
4
- }, "strip", z.ZodTypeAny, {
5
- title: string;
6
- }, {
7
- title: string;
8
- }>;
9
2
  export declare const editCategoryRoute: {
10
3
  handler: (c: import("hono").Context<import("@vitnode/core/api/middlewares/global/global").EnvVitNode, "/:id", {
11
4
  in: {
@@ -1 +1 @@
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;AAStC,eAAO,MAAM,qBAAqB;;;;;;EAKhC,CAAC;AASH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiF5B,CAAC"}
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 +1 @@
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 zodEditCategorySchema=z.object({title:z.string().min(3,"Title must be at least 3 characters long").max(100,"Title must not exceed 100 characters")});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:zodEditCategorySchema}}}},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{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)}});
@@ -3,6 +3,7 @@ export declare const categoriesRoute: {
3
3
  handler: (c: import("hono").Context<import("@vitnode/core/api/middlewares/global/global").EnvVitNode, "/", {
4
4
  in: {
5
5
  query: {
6
+ search?: string | undefined;
6
7
  orderBy?: "updatedAt" | undefined;
7
8
  cursor?: string | undefined;
8
9
  first?: string | undefined;
@@ -12,6 +13,7 @@ export declare const categoriesRoute: {
12
13
  };
13
14
  out: {
14
15
  query: {
16
+ search?: string | undefined;
15
17
  orderBy?: "updatedAt" | undefined;
16
18
  cursor?: string | undefined;
17
19
  first?: string | undefined;
@@ -48,13 +50,16 @@ export declare const categoriesRoute: {
48
50
  } & {
49
51
  order: z.ZodOptional<z.ZodEnum<["asc", "desc"]>>;
50
52
  orderBy: z.ZodOptional<z.ZodEnum<["updatedAt"]>>;
53
+ search: z.ZodOptional<z.ZodString>;
51
54
  }, "strip", z.ZodTypeAny, {
55
+ search?: string | undefined;
52
56
  orderBy?: "updatedAt" | undefined;
53
57
  cursor?: string | undefined;
54
58
  first?: string | undefined;
55
59
  last?: string | undefined;
56
60
  order?: "asc" | "desc" | undefined;
57
61
  }, {
62
+ search?: string | undefined;
58
63
  orderBy?: "updatedAt" | undefined;
59
64
  cursor?: string | undefined;
60
65
  first?: string | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"get.route.d.ts","sourceRoot":"","sources":["../../../../../../src/api/modules/categories/routes/get.route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAkBtC,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqD1B,CAAC"}
1
+ {"version":3,"file":"get.route.d.ts","sourceRoot":"","sources":["../../../../../../src/api/modules/categories/routes/get.route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAmBtC,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiE1B,CAAC"}
@@ -1 +1 @@
1
- import{z}from"@hono/zod-openapi";import{buildRoute}from"@vitnode/core/api/lib/route";import{withPagination,zodPaginationPageInfo,zodPaginationQuery}from"@vitnode/core/api/lib/with-pagination";import{CONFIG_PLUGIN}from"../../../../const.js";import{blog_categories}from"../../../../database/categories.js";const zodCategorySchema=z.object({id:z.number(),title:z.string(),createdAt:z.date(),updatedAt:z.date()});export const categoriesRoute=buildRoute({...CONFIG_PLUGIN,route:{method:"get",path:"/",request:{query:zodPaginationQuery.extend({order:z.enum(["asc","desc"]).optional(),orderBy:z.enum(["updatedAt"]).optional()})},responses:{200:{content:{"application/json":{schema:z.object({edges:z.array(zodCategorySchema),pageInfo:zodPaginationPageInfo})}},description:"Categories retrieved successfully"}}},handler:async c=>{const query=c.req.valid("query");const data=await withPagination({c,params:{query},primaryCursor:blog_categories.id,query:async({limit,where,orderBy})=>await c.get("db").select().from(blog_categories).where(where).orderBy(orderBy).limit(limit),table:blog_categories,orderBy:{column:query.orderBy?blog_categories[query.orderBy]:blog_categories.updatedAt,order:query.order??"desc"}});return c.json(data)}});
1
+ import{z}from"@hono/zod-openapi";import{buildRoute}from"@vitnode/core/api/lib/route";import{withPagination,zodPaginationPageInfo,zodPaginationQuery}from"@vitnode/core/api/lib/with-pagination";import{and,ilike}from"drizzle-orm";import{CONFIG_PLUGIN}from"../../../../const.js";import{blog_categories}from"../../../../database/categories.js";const zodCategorySchema=z.object({id:z.number(),title:z.string(),createdAt:z.date(),updatedAt:z.date()});export const categoriesRoute=buildRoute({...CONFIG_PLUGIN,route:{method:"get",path:"/",request:{query:zodPaginationQuery.extend({order:z.enum(["asc","desc"]).optional(),orderBy:z.enum(["updatedAt"]).optional(),search:z.string().optional()})},responses:{200:{content:{"application/json":{schema:z.object({edges:z.array(zodCategorySchema),pageInfo:zodPaginationPageInfo})}},description:"Categories retrieved successfully"}}},handler:async c=>{const query=c.req.valid("query");const data=await withPagination({c,params:{query},primaryCursor:blog_categories.id,query:async({limit,where,orderBy})=>{const searchCondition=query.search?ilike(blog_categories.title,`%${query.search}%`):undefined;const combinedWhere=searchCondition?where?and(where,searchCondition):searchCondition:where;return await c.get("db").select().from(blog_categories).where(combinedWhere).orderBy(orderBy).limit(limit)},table:blog_categories,orderBy:{column:query.orderBy?blog_categories[query.orderBy]:blog_categories.updatedAt,order:query.order??"desc"}});return c.json(data)}});
@@ -1 +1 @@
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().min(10,"Content must be at least 10 characters long"),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
+ 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,17 +1,4 @@
1
1
  import { z } from '@hono/zod-openapi';
2
- export declare const zodEditPostSchema: z.ZodObject<{
3
- title: z.ZodString;
4
- content: z.ZodString;
5
- categoryId: z.ZodNumber;
6
- }, "strip", z.ZodTypeAny, {
7
- title: string;
8
- content: string;
9
- categoryId: number;
10
- }, {
11
- title: string;
12
- content: string;
13
- categoryId: number;
14
- }>;
15
2
  export declare const editPostRoute: {
16
3
  handler: (c: import("hono").Context<import("@vitnode/core/api/middlewares/global/global").EnvVitNode, "/:id", {
17
4
  in: {
@@ -1 +1 @@
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;AAUtC,eAAO,MAAM,iBAAiB;;;;;;;;;;;;EAO5B,CAAC;AAYH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8FxB,CAAC"}
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 +1 @@
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 zodEditPostSchema=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().min(10,"Content must be at least 10 characters long"),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 editPostRoute=buildRoute({...CONFIG_PLUGIN,route:{method:"put",path:"/{id}",request:{params:z.object({id:z.string().transform(Number)}),body:{content:{"application/json":{schema:zodEditPostSchema}}}},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
+ 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,4 +1,52 @@
1
1
  import { z } from '@hono/zod-openapi';
2
+ export declare const zodPostSchema: z.ZodObject<{
3
+ id: z.ZodNumber;
4
+ title: z.ZodString;
5
+ titleSeo: z.ZodString;
6
+ content: z.ZodString;
7
+ categoryId: z.ZodNumber;
8
+ createdAt: z.ZodDate;
9
+ updatedAt: z.ZodDate;
10
+ category: z.ZodObject<{
11
+ id: z.ZodNumber;
12
+ title: z.ZodString;
13
+ titleSeo: z.ZodString;
14
+ }, "strip", z.ZodTypeAny, {
15
+ id: number;
16
+ title: string;
17
+ titleSeo: string;
18
+ }, {
19
+ id: number;
20
+ title: string;
21
+ titleSeo: string;
22
+ }>;
23
+ }, "strip", z.ZodTypeAny, {
24
+ id: number;
25
+ title: string;
26
+ createdAt: Date;
27
+ updatedAt: Date;
28
+ titleSeo: string;
29
+ content: string;
30
+ category: {
31
+ id: number;
32
+ title: string;
33
+ titleSeo: string;
34
+ };
35
+ categoryId: number;
36
+ }, {
37
+ id: number;
38
+ title: string;
39
+ createdAt: Date;
40
+ updatedAt: Date;
41
+ titleSeo: string;
42
+ content: string;
43
+ category: {
44
+ id: number;
45
+ title: string;
46
+ titleSeo: string;
47
+ };
48
+ categoryId: number;
49
+ }>;
2
50
  export declare const postsRoute: {
3
51
  handler: (c: import("hono").Context<import("@vitnode/core/api/middlewares/global/global").EnvVitNode, "/", {
4
52
  in: {
@@ -1 +1 @@
1
- {"version":3,"file":"get.route.d.ts","sourceRoot":"","sources":["../../../../../../src/api/modules/posts/routes/get.route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AA4BtC,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2ErB,CAAC"}
1
+ {"version":3,"file":"get.route.d.ts","sourceRoot":"","sources":["../../../../../../src/api/modules/posts/routes/get.route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAatC,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAaxB,CAAC;AAEH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2ErB,CAAC"}
@@ -1 +1 @@
1
- import{z}from"@hono/zod-openapi";import{buildRoute}from"@vitnode/core/api/lib/route";import{withPagination,zodPaginationPageInfo,zodPaginationQuery}from"@vitnode/core/api/lib/with-pagination";import{eq}from"drizzle-orm";import{CONFIG_PLUGIN}from"../../../../const.js";import{blog_categories}from"../../../../database/categories.js";import{blog_posts}from"../../../../database/posts.js";const zodPostSchema=z.object({id:z.number(),title:z.string(),titleSeo:z.string(),content:z.string(),categoryId:z.number(),createdAt:z.date(),updatedAt:z.date(),category:z.object({id:z.number(),title:z.string(),titleSeo:z.string()})});export const postsRoute=buildRoute({...CONFIG_PLUGIN,route:{method:"get",path:"/",request:{query:zodPaginationQuery.extend({order:z.enum(["asc","desc"]).optional(),orderBy:z.enum(["updatedAt","createdAt"]).optional(),categoryId:z.string().transform(Number).optional()})},responses:{200:{content:{"application/json":{schema:z.object({edges:z.array(zodPostSchema),pageInfo:zodPaginationPageInfo})}},description:"Posts retrieved successfully"}}},handler:async c=>{const query=c.req.valid("query");const data=await withPagination({c,params:{query},primaryCursor:blog_posts.id,query:async({limit,where,orderBy})=>await c.get("db").select({id:blog_posts.id,title:blog_posts.title,titleSeo:blog_posts.titleSeo,content:blog_posts.content,categoryId:blog_posts.categoryId,createdAt:blog_posts.createdAt,updatedAt:blog_posts.updatedAt,category:{id:blog_categories.id,title:blog_categories.title,titleSeo:blog_categories.titleSeo}}).from(blog_posts).innerJoin(blog_categories,eq(blog_posts.categoryId,blog_categories.id)).where(query.categoryId?eq(blog_posts.categoryId,query.categoryId):where).orderBy(orderBy).limit(limit),table:blog_posts,orderBy:{column:query.orderBy?blog_posts[query.orderBy]:blog_posts.updatedAt,order:query.order??"desc"}});return c.json(data)}});
1
+ import{z}from"@hono/zod-openapi";import{buildRoute}from"@vitnode/core/api/lib/route";import{withPagination,zodPaginationPageInfo,zodPaginationQuery}from"@vitnode/core/api/lib/with-pagination";import{eq}from"drizzle-orm";import{CONFIG_PLUGIN}from"../../../../const.js";import{blog_categories}from"../../../../database/categories.js";import{blog_posts}from"../../../../database/posts.js";export const zodPostSchema=z.object({id:z.number(),title:z.string(),titleSeo:z.string(),content:z.string(),categoryId:z.number(),createdAt:z.date(),updatedAt:z.date(),category:z.object({id:z.number(),title:z.string(),titleSeo:z.string()})});export const postsRoute=buildRoute({...CONFIG_PLUGIN,route:{method:"get",path:"/",request:{query:zodPaginationQuery.extend({order:z.enum(["asc","desc"]).optional(),orderBy:z.enum(["updatedAt","createdAt"]).optional(),categoryId:z.string().transform(Number).optional()})},responses:{200:{content:{"application/json":{schema:z.object({edges:z.array(zodPostSchema),pageInfo:zodPaginationPageInfo})}},description:"Posts retrieved successfully"}}},handler:async c=>{const query=c.req.valid("query");const data=await withPagination({c,params:{query},primaryCursor:blog_posts.id,query:async({limit,where,orderBy})=>await c.get("db").select({id:blog_posts.id,title:blog_posts.title,titleSeo:blog_posts.titleSeo,content:blog_posts.content,categoryId:blog_posts.categoryId,createdAt:blog_posts.createdAt,updatedAt:blog_posts.updatedAt,category:{id:blog_categories.id,title:blog_categories.title,titleSeo:blog_categories.titleSeo}}).from(blog_posts).innerJoin(blog_categories,eq(blog_posts.categoryId,blog_categories.id)).where(query.categoryId?eq(blog_posts.categoryId,query.categoryId):where).orderBy(orderBy).limit(limit),table:blog_posts,orderBy:{column:query.orderBy?blog_posts[query.orderBy]:blog_posts.updatedAt,order:query.order??"desc"}});return c.json(data)}});
@@ -1 +1 @@
1
- import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{I18nProvider}from"@vitnode/core/components/i18n-provider";import{HeaderContent}from"@vitnode/core/components/ui/header-content";import{getTranslations}from"next-intl/server";import{CategoriesAdminView}from"../../../views/admin/categories/categories-admin-view.js";import{ActionsCategoriesAdmin}from"../../../views/admin/categories/actions/actions.js";export const generateMetadata=async()=>{const t=await getTranslations("@vitnode/blog.admin.nav");return{title:t("categories")}};export default async function CategoriesPage(params){const[t,tNav]=await Promise.all([getTranslations("@vitnode/blog.admin.categories"),getTranslations("@vitnode/blog.admin.nav")]);return _jsx(I18nProvider,{namespaces:["@vitnode/blog.admin.categories"],children:_jsxs("div",{className:"container mx-auto p-4",children:[_jsx(HeaderContent,{desc:t("desc"),h1:tNav("categories"),children:_jsx(ActionsCategoriesAdmin,{})}),_jsx(CategoriesAdminView,{...params})]})})}
1
+ import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{I18nProvider}from"@vitnode/core/components/i18n-provider";import{HeaderContent}from"@vitnode/core/components/ui/header-content";import{getTranslations}from"next-intl/server";import{CategoriesAdminView}from"../../../views/admin/categories/categories-admin-view.js";import{ActionsCategoriesAdmin}from"../../../views/admin/categories/actions/actions.js";export const generateMetadata=async()=>{const t=await getTranslations("@vitnode/blog.admin.nav");return{title:t("categories")}};export default async function CategoriesPage(params){const[t,tNav]=await Promise.all([getTranslations("@vitnode/blog.admin.categories"),getTranslations("@vitnode/blog.admin.nav")]);return _jsx(I18nProvider,{namespaces:["@vitnode/blog.admin.categories"],children:_jsxs("div",{className:"p-4",children:[_jsx(HeaderContent,{desc:t("desc"),h1:tNav("categories"),children:_jsx(ActionsCategoriesAdmin,{})}),_jsx(CategoriesAdminView,{...params})]})})}
@@ -1 +1 @@
1
- {"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../../../../src/app_admin/blog/posts/page.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAMrC,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAEtE,eAAO,MAAM,gBAAgB,QAAa,OAAO,CAAC,QAAQ,CAMzD,CAAC;AAEF,wBAA8B,SAAS,CACrC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,oDAgBpD"}
1
+ {"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../../../../src/app_admin/blog/posts/page.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAOrC,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAEtE,eAAO,MAAM,gBAAgB,QAAa,OAAO,CAAC,QAAQ,CAMzD,CAAC;AAEF,wBAA8B,SAAS,CACrC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,oDAkBpD"}
@@ -1 +1 @@
1
- import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{I18nProvider}from"@vitnode/core/components/i18n-provider";import{HeaderContent}from"@vitnode/core/components/ui/header-content";import{getTranslations}from"next-intl/server";import{PostsAdminView}from"../../../views/admin/posts/posts-admin-view.js";export const generateMetadata=async()=>{const t=await getTranslations("@vitnode/blog.admin.nav");return{title:t("posts")}};export default async function PostsPage(params){const[t,tNav]=await Promise.all([getTranslations("@vitnode/blog.admin.posts"),getTranslations("@vitnode/blog.admin.nav")]);return _jsx(I18nProvider,{namespaces:["@vitnode/blog.admin.posts"],children:_jsxs("div",{className:"container mx-auto p-4",children:[_jsx(HeaderContent,{desc:t("desc"),h1:tNav("posts")}),_jsx(PostsAdminView,{...params})]})})}
1
+ import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{I18nProvider}from"@vitnode/core/components/i18n-provider";import{HeaderContent}from"@vitnode/core/components/ui/header-content";import{getTranslations}from"next-intl/server";import{ActionsPostsAdmin}from"../../../views/admin/posts/actions/actions.js";import{PostsAdminView}from"../../../views/admin/posts/posts-admin-view.js";export const generateMetadata=async()=>{const t=await getTranslations("@vitnode/blog.admin.nav");return{title:t("posts")}};export default async function PostsPage(params){const[t,tNav]=await Promise.all([getTranslations("@vitnode/blog.admin.posts"),getTranslations("@vitnode/blog.admin.nav")]);return _jsx(I18nProvider,{namespaces:["@vitnode/blog.admin.posts"],children:_jsxs("div",{className:"p-4",children:[_jsx(HeaderContent,{desc:t("desc"),h1:tNav("posts"),children:_jsx(ActionsPostsAdmin,{})}),_jsx(PostsAdminView,{...params})]})})}
@@ -1 +1 @@
1
- {"version":3,"file":"create-edit.d.ts","sourceRoot":"","sources":["../../../../../../../src/views/admin/categories/actions/create-edit/create-edit.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AAI5F,eAAO,MAAM,+BAA+B,GAAI,WAE7C;IACD,IAAI,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,GAAG;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;CACjE,4CA4EA,CAAC"}
1
+ {"version":3,"file":"create-edit.d.ts","sourceRoot":"","sources":["../../../../../../../src/views/admin/categories/actions/create-edit/create-edit.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AAI5F,eAAO,MAAM,+BAA+B,GAAI,WAE7C;IACD,IAAI,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,GAAG;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;CACjE,4CAqEA,CAAC"}
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{AutoForm}from"@vitnode/core/components/form/auto-form";import{AutoFormInput}from"@vitnode/core/components/form/fields/input";import{useDialog}from"@vitnode/core/components/ui/dialog";import{usePathname,useRouter}from"@vitnode/core/lib/navigation";import{useTranslations}from"next-intl";import{toast}from"sonner";import{z}from"zod";import{createMutationApi,editMutationApi}from"./mutation-api.js";export const CreateEditActionCategoriesAdmin=({data})=>{const t=useTranslations("@vitnode/blog.admin.categories");const tCore=useTranslations("core.global.errors");const{setOpen}=useDialog();const{push}=useRouter();const pathname=usePathname();const formSchema=z.object({title:z.string().min(3,{message:tCore("field_min_length",{min:3})}).default(data?.title??"")});const onSubmit=async(values,form)=>{let error="";if(data?.id){const mutation=await editMutationApi({id:data.id,...values});if(mutation?.error){error=mutation.error}}else{const mutation=await createMutationApi(values);if(mutation?.error){error=mutation.error}}if(error){if(error.includes("already exists")){form.setError("title",{type:"manual",message:t("create.form.title.already_exists")});return}toast.error(tCore("title"),{description:tCore("internal_server_error")});return}setOpen?.(false);push(pathname)};return _jsx(AutoForm,{fields:[{id:"title",component:props=>_jsx(AutoFormInput,{label:t("create.form.title.label"),...props})}],formSchema:formSchema,onSubmit:onSubmit,submitButtonProps:{children:t(`${data?"edit":"create"}.submit`)}})};
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{AutoForm}from"@vitnode/core/components/form/auto-form";import{AutoFormInput}from"@vitnode/core/components/form/fields/input";import{useDialog}from"@vitnode/core/components/ui/dialog";import{usePathname,useRouter}from"@vitnode/core/lib/navigation";import{useTranslations}from"next-intl";import{toast}from"sonner";import{z}from"zod";import{createMutationApi,editMutationApi}from"./mutation-api.js";export const CreateEditActionCategoriesAdmin=({data})=>{const t=useTranslations("@vitnode/blog.admin.categories");const tCore=useTranslations("core.global.errors");const{setOpen}=useDialog();const{push}=useRouter();const pathname=usePathname();const formSchema=z.object({title:z.string().default(data?.title??"")});const onSubmit=async(values,form)=>{let error="";if(data?.id){const mutation=await editMutationApi({id:data.id,...values});if(mutation?.error){error=mutation.error}}else{const mutation=await createMutationApi(values);if(mutation?.error){error=mutation.error}}if(error){if(error.includes("already exists")){form.setError("title",{type:"manual",message:t("create.form.title.already_exists")});return}toast.error(tCore("title"),{description:tCore("internal_server_error")});return}setOpen?.(false);push(pathname)};return _jsx(AutoForm,{fields:[{id:"title",component:props=>_jsx(AutoFormInput,{label:t("create.form.title.label"),...props})}],formSchema:formSchema,onSubmit:onSubmit,submitButtonProps:{children:t(`${data?"edit":"create"}.submit`)}})};
@@ -1 +1 @@
1
- "use client";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{AlertDialog,AlertDialogAction,AlertDialogCancel,AlertDialogContent,AlertDialogDescription,AlertDialogFooter,AlertDialogHeader,AlertDialogTitle,AlertDialogTrigger}from"@vitnode/core/components/ui/alert-dialog";import{Button}from"@vitnode/core/components/ui/button";import{Tooltip,TooltipContent,TooltipProvider,TooltipTrigger}from"@vitnode/core/components/ui/tooltip";import{Trash2Icon}from"lucide-react";import{useTranslations}from"next-intl";import{toast}from"sonner";import{mutationApi}from"./mutation-api.js";export const DeleteAction=({title,id})=>{const t=useTranslations("@vitnode/blog.admin.categories.delete");const tGlobal=useTranslations("core.global");return _jsxs(AlertDialog,{children:[_jsx(TooltipProvider,{children:_jsxs(Tooltip,{children:[_jsx(TooltipTrigger,{asChild:true,children:_jsx(AlertDialogTrigger,{asChild:true,children:_jsx(Button,{size:"icon",variant:"destructive",children:_jsx(Trash2Icon,{className:"size-4"})})})}),_jsx(TooltipContent,{children:t("title")})]})}),_jsxs(AlertDialogContent,{children:[_jsxs(AlertDialogHeader,{children:[_jsx(AlertDialogTitle,{children:t("title")}),_jsx(AlertDialogDescription,{children:t.rich("desc",{title:()=>_jsx("span",{className:"text-foreground font-bold",children:title})})})]}),_jsxs(AlertDialogFooter,{children:[_jsx(AlertDialogCancel,{children:tGlobal("cancel")}),_jsx(AlertDialogAction,{onClick:async()=>{const mutation=await mutationApi(id);if(mutation?.error){toast.error(tGlobal("errors.title"),{description:tGlobal("errors.internal_server_error")});return}toast.success(t("success"),{description:title})},children:t("confirm")})]})]})]})};
1
+ "use client";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{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")})]})]})]})};
@@ -0,0 +1,2 @@
1
+ export declare const ActionsPostsAdmin: () => import("react/jsx-runtime").JSX.Element;
2
+ //# sourceMappingURL=actions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../../../../../src/views/admin/posts/actions/actions.tsx"],"names":[],"mappings":"AAsBA,eAAO,MAAM,iBAAiB,+CAwB7B,CAAC"}
@@ -0,0 +1 @@
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{PlusIcon}from"lucide-react";import{useTranslations}from"next-intl";import React from"react";const CreateEditActionPostsAdmin=React.lazy(async()=>import("./create-edit/create-edit.js").then(module=>({default:module.CreateEditActionPostsAdmin})));export const ActionsPostsAdmin=()=>{const t=useTranslations("@vitnode/blog.admin.posts.create");return _jsxs(Dialog,{children:[_jsx(DialogTrigger,{asChild:true,children:_jsxs(Button,{children:[_jsx(PlusIcon,{}),t("title")]})}),_jsxs(DialogContent,{children:[_jsxs(DialogHeader,{children:[_jsx(DialogTitle,{children:t("title")}),_jsx(DialogDescription,{children:t("desc")})]}),_jsx(React.Suspense,{fallback:_jsx(Loader,{}),children:_jsx(CreateEditActionPostsAdmin,{})})]})]})};
@@ -0,0 +1,8 @@
1
+ import { z } from 'zod';
2
+ import type { zodPostSchema } from '../../../../../api/modules/posts/routes/get.route';
3
+ export declare const CreateEditActionPostsAdmin: ({ data, }: {
4
+ data?: z.infer<typeof zodPostSchema> & {
5
+ id?: number;
6
+ };
7
+ }) => import("react/jsx-runtime").JSX.Element;
8
+ //# sourceMappingURL=create-edit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-edit.d.ts","sourceRoot":"","sources":["../../../../../../../src/views/admin/posts/actions/create-edit/create-edit.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAM1E,eAAO,MAAM,0BAA0B,GAAI,WAExC;IACD,IAAI,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,GAAG;QAAE,EAAE,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACxD,4CAiIA,CAAC"}
@@ -0,0 +1 @@
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{AutoForm}from"@vitnode/core/components/form/auto-form";import{AutoFormComboboxAsync}from"@vitnode/core/components/form/fields/combobox-async";import{AutoFormInput}from"@vitnode/core/components/form/fields/input";import{AutoFormTextarea}from"@vitnode/core/components/form/fields/textarea";import{useDialog}from"@vitnode/core/components/ui/dialog";import{fetcherClient}from"@vitnode/core/lib/fetcher-client";import{usePathname,useRouter}from"@vitnode/core/lib/navigation";import{useTranslations}from"next-intl";import{toast}from"sonner";import{z}from"zod";import{categoriesModule}from"../../../../../api/modules/categories/categories.module.js";import{createMutationApi,editMutationApi}from"./mutation-api.js";export const CreateEditActionPostsAdmin=({data})=>{const t=useTranslations("@vitnode/blog.admin.posts");const tCore=useTranslations("core.global.errors");const{setOpen}=useDialog();const{push}=useRouter();const pathname=usePathname();const formSchema=z.object({title:z.string().min(3,{message:tCore("field_min_length",{min:3})}).default(data?.title??""),content:z.string().default(data?.content??""),categoryId:z.object({value:z.string(),label:z.string()}).refine(value=>value.value!=="",{message:tCore("field_required")}).default(data?.category?{value:data.category.id.toString(),label:data.category.title}:{value:"",label:""})});const onSubmit=async(values,form)=>{let error="";if(data?.id){const mutation=await editMutationApi({id:data.id,...values,categoryId:parseInt(values.categoryId.value,10)});if(mutation?.error){error=mutation.error}}else{const mutation=await createMutationApi({...values,categoryId:parseInt(values.categoryId.value,10)});if(mutation?.error){error=mutation.error}}if(error){if(error.includes("already exists")){form.setError("title",{type:"manual",message:t("create.form.title.already_exists")});return}toast.error(tCore("title"),{description:tCore("internal_server_error")});return}setOpen?.(false);push(pathname)};return _jsx(AutoForm,{fields:[{id:"title",component:props=>_jsx(AutoFormInput,{label:t("create.form.title.label"),...props})},{id:"categoryId",component:props=>_jsx(AutoFormComboboxAsync,{fetchData:async({search})=>{const res=await fetcherClient(categoriesModule,{path:"/",method:"get",module:"categories",args:{query:{search}}});const data=await res.json();return data.edges.map(category=>({label:category.title,value:category.id.toString()}))},id:"categoryId",label:t("create.form.category"),...props})},{id:"content",component:props=>_jsx(AutoFormTextarea,{label:t("create.form.content"),rows:10,...props})}],formSchema:formSchema,onSubmit:onSubmit,submitButtonProps:{children:t(`${data?"edit":"create"}.submit`)}})};
@@ -0,0 +1,11 @@
1
+ import type { z } from 'zod';
2
+ import type { zodCreatePostSchema } from '../../../../../api/modules/posts/routes/create.route';
3
+ export declare const createMutationApi: (body: z.infer<typeof zodCreatePostSchema>) => Promise<{
4
+ error: string;
5
+ } | undefined>;
6
+ export declare const editMutationApi: ({ id, ...body }: z.infer<typeof zodCreatePostSchema> & {
7
+ id: number;
8
+ }) => Promise<{
9
+ error: string;
10
+ } | undefined>;
11
+ //# sourceMappingURL=mutation-api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mutation-api.d.ts","sourceRoot":"","sources":["../../../../../../../src/views/admin/posts/actions/create-edit/mutation-api.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAK7B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAInF,eAAO,MAAM,iBAAiB,GAC5B,MAAM,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC;;cAmB1C,CAAC;AAEF,eAAO,MAAM,eAAe,GAAU,iBAGnC,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE;;cAqBtD,CAAC"}
@@ -0,0 +1 @@
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 createMutationApi=async body=>{const res=await fetcher(postsModule,{method:"post",module:"posts",path:"/",args:{body}});if(res.status!==201){return{error:await res.text()}}revalidatePath("/[locale]/admin/(auth)/(plugins)/(vitnode-blog)/blog/posts","page")};export const editMutationApi=async({id,...body})=>{const res=await fetcher(postsModule,{method:"put",module:"posts",path:"/{id}",args:{params:{id},body}});if(res.status!==200){return{error:await res.text()}}revalidatePath("/[locale]/admin/(auth)/(plugins)/(vitnode-blog)/blog/posts","page")};
@@ -1 +1 @@
1
- {"version":3,"file":"posts-admin-view.d.ts","sourceRoot":"","sources":["../../../../../src/views/admin/posts/posts-admin-view.tsx"],"names":[],"mappings":"AASA,eAAO,MAAM,cAAc,GAAU,mBAElC;IACD,YAAY,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC;CACtE,qDA2DA,CAAC"}
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 +1 @@
1
- import{jsx as _jsx}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";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})=>_jsx(DeleteAction,{...row})}],edges:data.edges.map(edge=>({...edge})),order:{columns:["createdAt","updatedAt"],defaultOrder:{column:"createdAt",order:"desc"}},pageInfo:data.pageInfo})};
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 +1 @@
1
- "use client";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{AlertDialog,AlertDialogAction,AlertDialogCancel,AlertDialogContent,AlertDialogDescription,AlertDialogFooter,AlertDialogHeader,AlertDialogTitle,AlertDialogTrigger}from"@vitnode/core/components/ui/alert-dialog";import{Button}from"@vitnode/core/components/ui/button";import{Tooltip,TooltipContent,TooltipProvider,TooltipTrigger}from"@vitnode/core/components/ui/tooltip";import{Trash2Icon}from"lucide-react";import{useTranslations}from"next-intl";import{toast}from"sonner";import{mutationApi}from"./mutation-api.js";export const DeleteAction=({title,id})=>{const t=useTranslations("@vitnode/blog.admin.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:"destructive",children:_jsx(Trash2Icon,{className:"size-4"})})})}),_jsx(TooltipContent,{children:t("title")})]})}),_jsxs(AlertDialogContent,{children:[_jsxs(AlertDialogHeader,{children:[_jsx(AlertDialogTitle,{children:t("title")}),_jsx(AlertDialogDescription,{children:t.rich("desc",{title:()=>_jsx("span",{className:"text-foreground font-bold",children:title})})})]}),_jsxs(AlertDialogFooter,{children:[_jsx(AlertDialogCancel,{children:tGlobal("cancel")}),_jsx(AlertDialogAction,{onClick:async()=>{const mutation=await mutationApi(id);if(mutation?.error){toast.error(tGlobal("errors.title"),{description:tGlobal("errors.internal_server_error")});return}toast.success(t("success"),{description:title})},children:t("confirm")})]})]})]})};
1
+ "use client";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{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")})]})]})]})};
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ declare const CreateEditActionPostsAdmin: React.LazyExoticComponent<({ data, }: {
3
+ data?: import("zod").TypeOf<typeof import("../../../../api/modules/posts/routes/get.route").zodPostSchema> & {
4
+ id?: number;
5
+ };
6
+ }) => import("react/jsx-runtime").JSX.Element>;
7
+ export declare const EditAction: (props: Required<React.ComponentProps<typeof CreateEditActionPostsAdmin>>) => import("react/jsx-runtime").JSX.Element;
8
+ export {};
9
+ //# sourceMappingURL=edit-action.d.ts.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1 @@
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})})]})]})};