@vilio/blog-module 0.0.3 → 0.0.5
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/actions/index.d.ts +177 -7
- package/dist/actions/index.d.ts.map +1 -0
- package/dist/actions/index.js +341 -0
- package/dist/actions/index.js.map +1 -0
- package/dist/components/BlogStatsWidget.d.ts +2 -2
- package/dist/components/BlogStatsWidget.d.ts.map +1 -0
- package/dist/components/BlogStatsWidget.js +18 -0
- package/dist/components/BlogStatsWidget.js.map +1 -0
- package/dist/components/RecentCommentsWidget.d.ts +2 -2
- package/dist/components/RecentCommentsWidget.d.ts.map +1 -0
- package/dist/components/RecentCommentsWidget.js +25 -0
- package/dist/components/RecentCommentsWidget.js.map +1 -0
- package/dist/components/RecentPostsWidget.d.ts +2 -2
- package/dist/components/RecentPostsWidget.d.ts.map +1 -0
- package/dist/components/RecentPostsWidget.js +25 -0
- package/dist/components/RecentPostsWidget.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +108 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/validation.d.ts +51 -4
- package/dist/lib/validation.d.ts.map +1 -0
- package/dist/lib/validation.js +57 -0
- package/dist/lib/validation.js.map +1 -0
- package/dist/navigation.d.ts +1 -0
- package/dist/navigation.d.ts.map +1 -0
- package/dist/navigation.js +43 -0
- package/dist/navigation.js.map +1 -0
- package/dist/routes.d.ts +1 -0
- package/dist/routes.d.ts.map +1 -0
- package/dist/routes.js +121 -0
- package/dist/routes.js.map +1 -0
- package/dist/schema.d.ts +491 -128
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +168 -0
- package/dist/schema.js.map +1 -0
- package/dist/ui/views.d.ts +15 -6
- package/dist/ui/views.d.ts.map +1 -0
- package/dist/ui/views.js +204 -0
- package/dist/ui/views.js.map +1 -0
- package/locales/en/global.json +28 -1
- package/locales/pl/global.json +36 -9
- package/package.json +16 -26
- package/dist/actions/index.cjs +0 -158
- package/dist/actions/index.mjs +0 -121
- package/dist/components/BlogStatsWidget.cjs +0 -45
- package/dist/components/BlogStatsWidget.mjs +0 -13
- package/dist/components/RecentCommentsWidget.cjs +0 -47
- package/dist/components/RecentCommentsWidget.mjs +0 -28
- package/dist/components/RecentPostsWidget.cjs +0 -47
- package/dist/components/RecentPostsWidget.mjs +0 -28
- package/dist/components/ui/button.cjs +0 -54
- package/dist/components/ui/button.d.ts +0 -11
- package/dist/components/ui/button.mjs +0 -47
- package/dist/components/ui/card.cjs +0 -47
- package/dist/components/ui/card.d.ts +0 -6
- package/dist/components/ui/card.mjs +0 -36
- package/dist/components/ui/input.cjs +0 -24
- package/dist/components/ui/input.d.ts +0 -5
- package/dist/components/ui/input.mjs +0 -17
- package/dist/components/ui/table.cjs +0 -68
- package/dist/components/ui/table.d.ts +0 -8
- package/dist/components/ui/table.mjs +0 -65
- package/dist/components/ui/textarea.cjs +0 -22
- package/dist/components/ui/textarea.d.ts +0 -5
- package/dist/components/ui/textarea.mjs +0 -16
- package/dist/index.cjs +0 -102
- package/dist/index.mjs +0 -97
- package/dist/intl.d.ts +0 -7
- package/dist/lib/utils.cjs +0 -11
- package/dist/lib/utils.d.ts +0 -2
- package/dist/lib/utils.mjs +0 -5
- package/dist/lib/validation.cjs +0 -16
- package/dist/lib/validation.mjs +0 -10
- package/dist/navigation.cjs +0 -23
- package/dist/navigation.mjs +0 -21
- package/dist/routes.cjs +0 -74
- package/dist/routes.mjs +0 -68
- package/dist/schema.cjs +0 -62
- package/dist/schema.mjs +0 -53
- package/dist/styles/globals.css +0 -1
- package/dist/ui/views.cjs +0 -448
- package/dist/ui/views.mjs +0 -237
package/dist/actions/index.d.ts
CHANGED
|
@@ -1,16 +1,155 @@
|
|
|
1
1
|
import type { z } from "zod";
|
|
2
|
-
import { commentSchema, postSchema } from "../lib/validation";
|
|
2
|
+
import { categorySchema, commentSchema, postSchema, tagSchema } from "../lib/validation";
|
|
3
3
|
export declare function createPost(data: z.infer<typeof postSchema>): Promise<{
|
|
4
|
+
success: boolean;
|
|
5
|
+
data: {
|
|
6
|
+
id: string;
|
|
7
|
+
slug: string;
|
|
8
|
+
createdAt: Date;
|
|
9
|
+
updatedAt: Date | null;
|
|
10
|
+
title: string;
|
|
11
|
+
excerpt: string | null;
|
|
12
|
+
content: string;
|
|
13
|
+
coverImage: string | null;
|
|
14
|
+
status: "draft" | "published" | "archived" | "scheduled";
|
|
15
|
+
views: number;
|
|
16
|
+
categoryId: string | null;
|
|
17
|
+
authorId: string;
|
|
18
|
+
publishedAt: Date | null;
|
|
19
|
+
};
|
|
20
|
+
error?: undefined;
|
|
21
|
+
} | {
|
|
22
|
+
success: boolean;
|
|
23
|
+
error: any;
|
|
24
|
+
data?: undefined;
|
|
25
|
+
}>;
|
|
26
|
+
export declare function updatePost(id: string, data: z.infer<typeof postSchema>): Promise<{
|
|
27
|
+
success: boolean;
|
|
28
|
+
error?: undefined;
|
|
29
|
+
} | {
|
|
30
|
+
success: boolean;
|
|
31
|
+
error: any;
|
|
32
|
+
}>;
|
|
33
|
+
export declare function getPosts(options?: {
|
|
34
|
+
status?: "draft" | "published" | "archived";
|
|
35
|
+
}): Promise<{
|
|
36
|
+
id: string;
|
|
37
|
+
title: string;
|
|
38
|
+
slug: string;
|
|
39
|
+
excerpt: string | null;
|
|
40
|
+
content: string;
|
|
41
|
+
coverImage: string | null;
|
|
42
|
+
status: "draft" | "published" | "archived" | "scheduled";
|
|
43
|
+
views: number;
|
|
44
|
+
createdAt: Date;
|
|
45
|
+
author: {
|
|
46
|
+
name: string;
|
|
47
|
+
image: string | null;
|
|
48
|
+
};
|
|
49
|
+
category: {
|
|
50
|
+
id: string;
|
|
51
|
+
name: string;
|
|
52
|
+
} | null;
|
|
53
|
+
}[]>;
|
|
54
|
+
export declare function getPostBySlug(slug: string): Promise<{
|
|
55
|
+
tags: {
|
|
56
|
+
tag: {
|
|
57
|
+
id: string;
|
|
58
|
+
name: string;
|
|
59
|
+
};
|
|
60
|
+
}[];
|
|
61
|
+
id: string;
|
|
62
|
+
title: string;
|
|
63
|
+
slug: string;
|
|
64
|
+
excerpt: string | null;
|
|
65
|
+
content: string;
|
|
66
|
+
coverImage: string | null;
|
|
67
|
+
status: "draft" | "published" | "archived" | "scheduled";
|
|
68
|
+
views: number;
|
|
69
|
+
createdAt: Date;
|
|
70
|
+
author: {
|
|
71
|
+
name: string;
|
|
72
|
+
image: string | null;
|
|
73
|
+
};
|
|
74
|
+
category: {
|
|
75
|
+
id: string;
|
|
76
|
+
name: string;
|
|
77
|
+
} | null;
|
|
78
|
+
} | null>;
|
|
79
|
+
export declare function getPostById(id: string): Promise<{
|
|
80
|
+
tags: {
|
|
81
|
+
tagId: string;
|
|
82
|
+
}[];
|
|
83
|
+
id: string;
|
|
84
|
+
title: string;
|
|
85
|
+
slug: string;
|
|
86
|
+
excerpt: string | null;
|
|
87
|
+
content: string;
|
|
88
|
+
coverImage: string | null;
|
|
89
|
+
status: "draft" | "published" | "archived" | "scheduled";
|
|
90
|
+
views: number;
|
|
91
|
+
categoryId: string | null;
|
|
92
|
+
authorId: string;
|
|
93
|
+
publishedAt: Date | null;
|
|
94
|
+
createdAt: Date;
|
|
95
|
+
updatedAt: Date | null;
|
|
96
|
+
} | null>;
|
|
97
|
+
export declare function getCategories(): Promise<{
|
|
98
|
+
id: string;
|
|
99
|
+
name: string;
|
|
100
|
+
slug: string;
|
|
101
|
+
description: string | null;
|
|
102
|
+
createdAt: Date;
|
|
103
|
+
updatedAt: Date | null;
|
|
104
|
+
}[]>;
|
|
105
|
+
export declare function createCategory(data: z.infer<typeof categorySchema>): Promise<{
|
|
106
|
+
success: boolean;
|
|
107
|
+
error?: undefined;
|
|
108
|
+
} | {
|
|
109
|
+
success: boolean;
|
|
110
|
+
error: any;
|
|
111
|
+
}>;
|
|
112
|
+
export declare function updateCategory(id: string, data: z.infer<typeof categorySchema>): Promise<{
|
|
113
|
+
success: boolean;
|
|
114
|
+
error?: undefined;
|
|
115
|
+
} | {
|
|
116
|
+
success: boolean;
|
|
117
|
+
error: any;
|
|
118
|
+
}>;
|
|
119
|
+
export declare function deleteCategory(id: string): Promise<{
|
|
120
|
+
success: boolean;
|
|
121
|
+
error?: undefined;
|
|
122
|
+
} | {
|
|
123
|
+
success: boolean;
|
|
124
|
+
error: any;
|
|
125
|
+
}>;
|
|
126
|
+
export declare function getTags(): Promise<{
|
|
127
|
+
id: string;
|
|
128
|
+
name: string;
|
|
129
|
+
slug: string;
|
|
130
|
+
createdAt: Date;
|
|
131
|
+
}[]>;
|
|
132
|
+
export declare function createTag(data: z.infer<typeof tagSchema>): Promise<{
|
|
133
|
+
success: boolean;
|
|
134
|
+
error?: undefined;
|
|
135
|
+
} | {
|
|
136
|
+
success: boolean;
|
|
137
|
+
error: any;
|
|
138
|
+
}>;
|
|
139
|
+
export declare function updateTag(id: string, data: z.infer<typeof tagSchema>): Promise<{
|
|
140
|
+
success: boolean;
|
|
141
|
+
error?: undefined;
|
|
142
|
+
} | {
|
|
143
|
+
success: boolean;
|
|
144
|
+
error: any;
|
|
145
|
+
}>;
|
|
146
|
+
export declare function deleteTag(id: string): Promise<{
|
|
4
147
|
success: boolean;
|
|
5
148
|
error?: undefined;
|
|
6
149
|
} | {
|
|
7
150
|
success: boolean;
|
|
8
151
|
error: any;
|
|
9
152
|
}>;
|
|
10
|
-
export declare function getPosts(): Promise<any>;
|
|
11
|
-
export declare function getPostBySlug(slug: string): Promise<any>;
|
|
12
|
-
export declare function getPostById(id: string): Promise<any>;
|
|
13
|
-
export declare function getComments(postId: string): Promise<any>;
|
|
14
153
|
export declare function createComment(data: z.infer<typeof commentSchema>): Promise<{
|
|
15
154
|
success: boolean;
|
|
16
155
|
error?: undefined;
|
|
@@ -18,17 +157,48 @@ export declare function createComment(data: z.infer<typeof commentSchema>): Prom
|
|
|
18
157
|
success: boolean;
|
|
19
158
|
error: any;
|
|
20
159
|
}>;
|
|
21
|
-
export declare function
|
|
160
|
+
export declare function getComments(postId: string): Promise<{
|
|
161
|
+
id: string;
|
|
162
|
+
content: string;
|
|
163
|
+
createdAt: Date;
|
|
164
|
+
author: {
|
|
165
|
+
name: string;
|
|
166
|
+
image: string | null;
|
|
167
|
+
};
|
|
168
|
+
}[]>;
|
|
169
|
+
export declare function getAllComments(): Promise<{
|
|
170
|
+
id: string;
|
|
171
|
+
content: string;
|
|
172
|
+
status: "pending" | "approved" | "spam" | "trash";
|
|
173
|
+
createdAt: Date;
|
|
174
|
+
author: {
|
|
175
|
+
name: string;
|
|
176
|
+
image: string | null;
|
|
177
|
+
};
|
|
178
|
+
post: {
|
|
179
|
+
title: string;
|
|
180
|
+
slug: string;
|
|
181
|
+
};
|
|
182
|
+
}[]>;
|
|
183
|
+
export declare function updateCommentStatus(id: string, status: "pending" | "approved" | "spam" | "trash"): Promise<{
|
|
22
184
|
success: boolean;
|
|
23
185
|
error?: undefined;
|
|
24
186
|
} | {
|
|
25
187
|
success: boolean;
|
|
26
188
|
error: any;
|
|
27
189
|
}>;
|
|
28
|
-
export declare function
|
|
190
|
+
export declare function deleteComment(id: string): Promise<{
|
|
191
|
+
success: boolean;
|
|
192
|
+
error?: undefined;
|
|
193
|
+
} | {
|
|
194
|
+
success: boolean;
|
|
195
|
+
error: any;
|
|
196
|
+
}>;
|
|
197
|
+
export declare function deletePost(id: string): Promise<{
|
|
29
198
|
success: boolean;
|
|
30
199
|
error?: undefined;
|
|
31
200
|
} | {
|
|
32
201
|
success: boolean;
|
|
33
202
|
error: any;
|
|
34
203
|
}>;
|
|
204
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/actions/index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,EACL,cAAc,EACd,aAAa,EACb,UAAU,EACV,SAAS,EACV,MAAM,mBAAmB,CAAC;AAiB3B,wB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AAE,MAAM;;;;;;;;KAoB/C;AAED,wBAAsB,cAAc;;;;;;;;;;;;;KAoBnC;AAED,wBAAsB,mBAAmB,CACvC,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,SAAS,GAAG,UAAU,GAAG,MAAM,GAAG,OAAO;;;;;;GAYlD;AAED,wBAAsB,aAAa,CAAC,EAAE,EAAE,MAAM;;;;;;GAQ7C;AAED,wBAAsB,UAAU,CAAC,EAAE,EAAE,MAAM;;;;;;GAQ1C"}
|
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
"use server";
|
|
2
|
+
import { db, getCurrentSession, userTable } from "@vilio/core/server";
|
|
3
|
+
import { applyFilters } from "@vilio/modules/server";
|
|
4
|
+
import { and, desc, eq } from "drizzle-orm";
|
|
5
|
+
import { revalidatePath } from "next/cache";
|
|
6
|
+
import { categorySchema, commentSchema, postSchema, tagSchema, } from "../lib/validation";
|
|
7
|
+
import { categoriesTable, commentsTable, postsTable, postTagsTable, tagsTable, } from "../schema";
|
|
8
|
+
// --- Helpers ---
|
|
9
|
+
const revalidateBlog = () => {
|
|
10
|
+
revalidatePath("/blog");
|
|
11
|
+
revalidatePath("/panel/blog");
|
|
12
|
+
revalidatePath("/vilio/blog");
|
|
13
|
+
};
|
|
14
|
+
// --- Posts ---
|
|
15
|
+
export async function createPost(data) {
|
|
16
|
+
try {
|
|
17
|
+
const { user } = await getCurrentSession();
|
|
18
|
+
if (!user)
|
|
19
|
+
throw new Error("Unauthorized");
|
|
20
|
+
const validated = postSchema.parse(data);
|
|
21
|
+
// --- HOOK: blog:post:before_create ---
|
|
22
|
+
const finalData = await applyFilters("blog:post:before_create", {
|
|
23
|
+
...validated,
|
|
24
|
+
authorId: user.id,
|
|
25
|
+
publishedAt: validated.status === "published" ? new Date() : validated.publishedAt,
|
|
26
|
+
});
|
|
27
|
+
const { tags, ...postData } = finalData;
|
|
28
|
+
const [post] = await db.insert(postsTable).values(postData).returning();
|
|
29
|
+
if (tags && tags.length > 0 && post) {
|
|
30
|
+
await db
|
|
31
|
+
.insert(postTagsTable)
|
|
32
|
+
.values(tags.map((tagId) => ({ postId: post.id, tagId })));
|
|
33
|
+
}
|
|
34
|
+
revalidateBlog();
|
|
35
|
+
return { success: true, data: post };
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
console.error("[BlogModule:Actions] createPost failed:", error);
|
|
39
|
+
return { success: false, error: error.message };
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
export async function updatePost(id, data) {
|
|
43
|
+
try {
|
|
44
|
+
const validated = postSchema.parse(data);
|
|
45
|
+
// --- HOOK: blog:post:before_update ---
|
|
46
|
+
const finalData = await applyFilters("blog:post:before_update", {
|
|
47
|
+
...validated,
|
|
48
|
+
id,
|
|
49
|
+
updatedAt: new Date(),
|
|
50
|
+
publishedAt: validated.status === "published" ? new Date() : validated.publishedAt,
|
|
51
|
+
});
|
|
52
|
+
const { tags, id: _, ...postData } = finalData;
|
|
53
|
+
await db.transaction(async (tx) => {
|
|
54
|
+
await tx.update(postsTable).set(postData).where(eq(postsTable.id, id));
|
|
55
|
+
await tx.delete(postTagsTable).where(eq(postTagsTable.postId, id));
|
|
56
|
+
if (tags && tags.length > 0) {
|
|
57
|
+
await tx
|
|
58
|
+
.insert(postTagsTable)
|
|
59
|
+
.values(tags.map((tagId) => ({ postId: id, tagId })));
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
revalidateBlog();
|
|
63
|
+
revalidatePath(`/blog/${validated.slug}`);
|
|
64
|
+
return { success: true };
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
console.error("[BlogModule:Actions] updatePost failed:", error);
|
|
68
|
+
return { success: false, error: error.message };
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
export async function getPosts(options = {}) {
|
|
72
|
+
try {
|
|
73
|
+
const filters = [];
|
|
74
|
+
if (options.status)
|
|
75
|
+
filters.push(eq(postsTable.status, options.status));
|
|
76
|
+
const posts = await db
|
|
77
|
+
.select({
|
|
78
|
+
id: postsTable.id,
|
|
79
|
+
title: postsTable.title,
|
|
80
|
+
slug: postsTable.slug,
|
|
81
|
+
excerpt: postsTable.excerpt,
|
|
82
|
+
content: postsTable.content,
|
|
83
|
+
coverImage: postsTable.coverImage,
|
|
84
|
+
status: postsTable.status,
|
|
85
|
+
views: postsTable.views,
|
|
86
|
+
createdAt: postsTable.createdAt,
|
|
87
|
+
author: {
|
|
88
|
+
name: userTable.name,
|
|
89
|
+
image: userTable.image,
|
|
90
|
+
},
|
|
91
|
+
category: {
|
|
92
|
+
id: categoriesTable.id,
|
|
93
|
+
name: categoriesTable.name,
|
|
94
|
+
},
|
|
95
|
+
})
|
|
96
|
+
.from(postsTable)
|
|
97
|
+
.leftJoin(categoriesTable, eq(postsTable.categoryId, categoriesTable.id))
|
|
98
|
+
.innerJoin(userTable, eq(postsTable.authorId, userTable.id))
|
|
99
|
+
.where(filters.length > 0 ? and(...filters) : undefined)
|
|
100
|
+
.orderBy(desc(postsTable.createdAt));
|
|
101
|
+
return posts;
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
console.error("[BlogModule:Actions] getPosts failed:", error);
|
|
105
|
+
throw error;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
export async function getPostBySlug(slug) {
|
|
109
|
+
try {
|
|
110
|
+
const [post] = await db
|
|
111
|
+
.select({
|
|
112
|
+
id: postsTable.id,
|
|
113
|
+
title: postsTable.title,
|
|
114
|
+
slug: postsTable.slug,
|
|
115
|
+
excerpt: postsTable.excerpt,
|
|
116
|
+
content: postsTable.content,
|
|
117
|
+
coverImage: postsTable.coverImage,
|
|
118
|
+
status: postsTable.status,
|
|
119
|
+
views: postsTable.views,
|
|
120
|
+
createdAt: postsTable.createdAt,
|
|
121
|
+
author: {
|
|
122
|
+
name: userTable.name,
|
|
123
|
+
image: userTable.image,
|
|
124
|
+
},
|
|
125
|
+
category: {
|
|
126
|
+
id: categoriesTable.id,
|
|
127
|
+
name: categoriesTable.name,
|
|
128
|
+
},
|
|
129
|
+
})
|
|
130
|
+
.from(postsTable)
|
|
131
|
+
.leftJoin(categoriesTable, eq(postsTable.categoryId, categoriesTable.id))
|
|
132
|
+
.innerJoin(userTable, eq(postsTable.authorId, userTable.id))
|
|
133
|
+
.where(eq(postsTable.slug, slug));
|
|
134
|
+
if (!post)
|
|
135
|
+
return null;
|
|
136
|
+
const tags = await db
|
|
137
|
+
.select({
|
|
138
|
+
tag: {
|
|
139
|
+
id: tagsTable.id,
|
|
140
|
+
name: tagsTable.name,
|
|
141
|
+
},
|
|
142
|
+
})
|
|
143
|
+
.from(postTagsTable)
|
|
144
|
+
.innerJoin(tagsTable, eq(postTagsTable.tagId, tagsTable.id))
|
|
145
|
+
.where(eq(postTagsTable.postId, post.id));
|
|
146
|
+
await db
|
|
147
|
+
.update(postsTable)
|
|
148
|
+
.set({ views: post.views + 1 })
|
|
149
|
+
.where(eq(postsTable.id, post.id));
|
|
150
|
+
return { ...post, tags };
|
|
151
|
+
}
|
|
152
|
+
catch (error) {
|
|
153
|
+
console.error("[BlogModule:Actions] getPostBySlug failed:", error);
|
|
154
|
+
throw error;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
export async function getPostById(id) {
|
|
158
|
+
try {
|
|
159
|
+
const [post] = await db
|
|
160
|
+
.select()
|
|
161
|
+
.from(postsTable)
|
|
162
|
+
.where(eq(postsTable.id, id));
|
|
163
|
+
if (!post)
|
|
164
|
+
return null;
|
|
165
|
+
const tags = await db
|
|
166
|
+
.select({ tagId: postTagsTable.tagId })
|
|
167
|
+
.from(postTagsTable)
|
|
168
|
+
.where(eq(postTagsTable.postId, id));
|
|
169
|
+
return { ...post, tags };
|
|
170
|
+
}
|
|
171
|
+
catch (error) {
|
|
172
|
+
console.error("[BlogModule:Actions] getPostById failed:", error);
|
|
173
|
+
throw error;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
// --- Categories ---
|
|
177
|
+
export async function getCategories() {
|
|
178
|
+
return await db.select().from(categoriesTable).orderBy(categoriesTable.name);
|
|
179
|
+
}
|
|
180
|
+
export async function createCategory(data) {
|
|
181
|
+
try {
|
|
182
|
+
const validated = categorySchema.parse(data);
|
|
183
|
+
await db.insert(categoriesTable).values(validated);
|
|
184
|
+
revalidateBlog();
|
|
185
|
+
return { success: true };
|
|
186
|
+
}
|
|
187
|
+
catch (error) {
|
|
188
|
+
return { success: false, error: error.message };
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
export async function updateCategory(id, data) {
|
|
192
|
+
try {
|
|
193
|
+
const validated = categorySchema.parse(data);
|
|
194
|
+
await db
|
|
195
|
+
.update(categoriesTable)
|
|
196
|
+
.set(validated)
|
|
197
|
+
.where(eq(categoriesTable.id, id));
|
|
198
|
+
revalidateBlog();
|
|
199
|
+
return { success: true };
|
|
200
|
+
}
|
|
201
|
+
catch (error) {
|
|
202
|
+
return { success: false, error: error.message };
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
export async function deleteCategory(id) {
|
|
206
|
+
try {
|
|
207
|
+
await db.delete(categoriesTable).where(eq(categoriesTable.id, id));
|
|
208
|
+
revalidateBlog();
|
|
209
|
+
return { success: true };
|
|
210
|
+
}
|
|
211
|
+
catch (error) {
|
|
212
|
+
return { success: false, error: error.message };
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
// --- Tags ---
|
|
216
|
+
export async function getTags() {
|
|
217
|
+
return await db.select().from(tagsTable).orderBy(tagsTable.name);
|
|
218
|
+
}
|
|
219
|
+
export async function createTag(data) {
|
|
220
|
+
try {
|
|
221
|
+
const validated = tagSchema.parse(data);
|
|
222
|
+
await db.insert(tagsTable).values(validated);
|
|
223
|
+
revalidateBlog();
|
|
224
|
+
return { success: true };
|
|
225
|
+
}
|
|
226
|
+
catch (error) {
|
|
227
|
+
return { success: false, error: error.message };
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
export async function updateTag(id, data) {
|
|
231
|
+
try {
|
|
232
|
+
const validated = tagSchema.parse(data);
|
|
233
|
+
await db.update(tagsTable).set(validated).where(eq(tagsTable.id, id));
|
|
234
|
+
revalidateBlog();
|
|
235
|
+
return { success: true };
|
|
236
|
+
}
|
|
237
|
+
catch (error) {
|
|
238
|
+
return { success: false, error: error.message };
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
export async function deleteTag(id) {
|
|
242
|
+
try {
|
|
243
|
+
await db.delete(tagsTable).where(eq(tagsTable.id, id));
|
|
244
|
+
revalidateBlog();
|
|
245
|
+
return { success: true };
|
|
246
|
+
}
|
|
247
|
+
catch (error) {
|
|
248
|
+
return { success: false, error: error.message };
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
// --- Comments ---
|
|
252
|
+
export async function createComment(data) {
|
|
253
|
+
try {
|
|
254
|
+
const { user } = await getCurrentSession();
|
|
255
|
+
if (!user)
|
|
256
|
+
throw new Error("Must be logged in to comment");
|
|
257
|
+
const validated = commentSchema.parse(data);
|
|
258
|
+
await db.insert(commentsTable).values({
|
|
259
|
+
...validated,
|
|
260
|
+
authorId: user.id,
|
|
261
|
+
status: "pending", // Nowe komentarze domyślnie oczekują na zatwierdzenie
|
|
262
|
+
});
|
|
263
|
+
revalidatePath(`/blog`);
|
|
264
|
+
return { success: true };
|
|
265
|
+
}
|
|
266
|
+
catch (error) {
|
|
267
|
+
console.error("[BlogModule:Actions] createComment failed:", error);
|
|
268
|
+
return { success: false, error: error.message };
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
export async function getComments(postId) {
|
|
272
|
+
return await db
|
|
273
|
+
.select({
|
|
274
|
+
id: commentsTable.id,
|
|
275
|
+
content: commentsTable.content,
|
|
276
|
+
createdAt: commentsTable.createdAt,
|
|
277
|
+
author: {
|
|
278
|
+
name: userTable.name,
|
|
279
|
+
image: userTable.image,
|
|
280
|
+
},
|
|
281
|
+
})
|
|
282
|
+
.from(commentsTable)
|
|
283
|
+
.innerJoin(userTable, eq(commentsTable.authorId, userTable.id))
|
|
284
|
+
.where(and(eq(commentsTable.postId, postId), eq(commentsTable.status, "approved")))
|
|
285
|
+
.orderBy(desc(commentsTable.createdAt));
|
|
286
|
+
}
|
|
287
|
+
export async function getAllComments() {
|
|
288
|
+
return await db
|
|
289
|
+
.select({
|
|
290
|
+
id: commentsTable.id,
|
|
291
|
+
content: commentsTable.content,
|
|
292
|
+
status: commentsTable.status,
|
|
293
|
+
createdAt: commentsTable.createdAt,
|
|
294
|
+
author: {
|
|
295
|
+
name: userTable.name,
|
|
296
|
+
image: userTable.image,
|
|
297
|
+
},
|
|
298
|
+
post: {
|
|
299
|
+
title: postsTable.title,
|
|
300
|
+
slug: postsTable.slug,
|
|
301
|
+
},
|
|
302
|
+
})
|
|
303
|
+
.from(commentsTable)
|
|
304
|
+
.innerJoin(userTable, eq(commentsTable.authorId, userTable.id))
|
|
305
|
+
.innerJoin(postsTable, eq(commentsTable.postId, postsTable.id))
|
|
306
|
+
.orderBy(desc(commentsTable.createdAt));
|
|
307
|
+
}
|
|
308
|
+
export async function updateCommentStatus(id, status) {
|
|
309
|
+
try {
|
|
310
|
+
await db
|
|
311
|
+
.update(commentsTable)
|
|
312
|
+
.set({ status })
|
|
313
|
+
.where(eq(commentsTable.id, id));
|
|
314
|
+
revalidateBlog();
|
|
315
|
+
return { success: true };
|
|
316
|
+
}
|
|
317
|
+
catch (error) {
|
|
318
|
+
return { success: false, error: error.message };
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
export async function deleteComment(id) {
|
|
322
|
+
try {
|
|
323
|
+
await db.delete(commentsTable).where(eq(commentsTable.id, id));
|
|
324
|
+
revalidateBlog();
|
|
325
|
+
return { success: true };
|
|
326
|
+
}
|
|
327
|
+
catch (error) {
|
|
328
|
+
return { success: false, error: error.message };
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
export async function deletePost(id) {
|
|
332
|
+
try {
|
|
333
|
+
await db.delete(postsTable).where(eq(postsTable.id, id));
|
|
334
|
+
revalidateBlog();
|
|
335
|
+
return { success: true };
|
|
336
|
+
}
|
|
337
|
+
catch (error) {
|
|
338
|
+
return { success: false, error: error.message };
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/actions/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,EAAE,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,EAAW,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,OAAO,EACL,cAAc,EACd,aAAa,EACb,UAAU,EACV,SAAS,GACV,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,eAAe,EACf,aAAa,EACb,UAAU,EACV,aAAa,EACb,SAAS,GACV,MAAM,WAAW,CAAC;AAEnB,kBAAkB;AAClB,MAAM,cAAc,GAAG,GAAG,EAAE;IAC1B,cAAc,CAAC,OAAO,CAAC,CAAC;IACxB,cAAc,CAAC,aAAa,CAAC,CAAC;IAC9B,cAAc,CAAC,aAAa,CAAC,CAAC;AAChC,CAAC,CAAC;AAEF,gBAAgB;AAChB,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,IAAgC;IAC/D,IAAI,CAAC;QACH,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,iBAAiB,EAAE,CAAC;QAC3C,IAAI,CAAC,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,cAAc,CAAC,CAAC;QAE3C,MAAM,SAAS,GAAG,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAEzC,wCAAwC;QACxC,MAAM,SAAS,GAAG,MAAM,YAAY,CAAC,yBAAyB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,CAAC,aAAa,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;QAC/D,cAAc,EAAE,CAAC;QACjB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC3B,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC;IAClD,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,EAAU;IACzC,IAAI,CAAC;QACH,MAAM,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,UAAU,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;QACzD,cAAc,EAAE,CAAC;QACjB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC3B,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC;IAClD,CAAC;AACH,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export default function BlogStatsWidget(): Promise<import("react/jsx-runtime").JSX.Element>;
|
|
2
|
+
//# sourceMappingURL=BlogStatsWidget.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BlogStatsWidget.d.ts","sourceRoot":"","sources":["../../src/components/BlogStatsWidget.tsx"],"names":[],"mappings":"AAQA,wBAA8B,eAAe,qDAqC5C"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { db } from "@vilio/core/server";
|
|
3
|
+
import { getTranslation } from "@vilio/intl/server";
|
|
4
|
+
import { Card, CardContent, CardHeader, CardTitle } from "@vilio/ui";
|
|
5
|
+
import { sql } from "drizzle-orm";
|
|
6
|
+
import { FileText, MessageSquare } from "lucide-react";
|
|
7
|
+
import { commentsTable, postsTable } from "../schema";
|
|
8
|
+
export default async function BlogStatsWidget() {
|
|
9
|
+
const { t } = await getTranslation();
|
|
10
|
+
const [postsCount] = await db
|
|
11
|
+
.select({ count: sql `count(*)` })
|
|
12
|
+
.from(postsTable);
|
|
13
|
+
const [commentsCount] = await db
|
|
14
|
+
.select({ count: sql `count(*)` })
|
|
15
|
+
.from(commentsTable);
|
|
16
|
+
return (_jsxs("div", { className: "grid gap-4 md:grid-cols-2 lg:grid-cols-2", children: [_jsxs(Card, { children: [_jsxs(CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [_jsx(CardTitle, { className: "text-sm font-medium", children: t("Total Posts") }), _jsx(FileText, { className: "h-4 w-4 text-muted-foreground" })] }), _jsx(CardContent, { children: _jsx("div", { className: "text-2xl font-bold", children: postsCount?.count || 0 }) })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [_jsx(CardTitle, { className: "text-sm font-medium", children: t("Total Comments") }), _jsx(MessageSquare, { className: "h-4 w-4 text-muted-foreground" })] }), _jsx(CardContent, { children: _jsx("div", { className: "text-2xl font-bold", children: commentsCount?.count || 0 }) })] })] }));
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=BlogStatsWidget.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BlogStatsWidget.js","sourceRoot":"","sources":["../../src/components/BlogStatsWidget.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACrE,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EAAE,QAAQ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
|
|
2
|
-
|
|
1
|
+
export default function RecentCommentsWidget(): Promise<import("react/jsx-runtime").JSX.Element>;
|
|
2
|
+
//# sourceMappingURL=RecentCommentsWidget.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RecentCommentsWidget.d.ts","sourceRoot":"","sources":["../../src/components/RecentCommentsWidget.tsx"],"names":[],"mappings":"AAgBA,wBAA8B,oBAAoB,qDAsDjD"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { db, userTable } from "@vilio/core/server";
|
|
3
|
+
import { getTranslation } from "@vilio/intl/server";
|
|
4
|
+
import { Avatar, AvatarFallback, AvatarImage, Card, CardContent, CardDescription, CardHeader, CardTitle, } from "@vilio/ui";
|
|
5
|
+
import { desc, eq } from "drizzle-orm";
|
|
6
|
+
import { commentsTable } from "../schema";
|
|
7
|
+
export default async function RecentCommentsWidget() {
|
|
8
|
+
const { t } = await getTranslation();
|
|
9
|
+
const comments = await db
|
|
10
|
+
.select({
|
|
11
|
+
id: commentsTable.id,
|
|
12
|
+
content: commentsTable.content,
|
|
13
|
+
createdAt: commentsTable.createdAt,
|
|
14
|
+
author: {
|
|
15
|
+
name: userTable.name,
|
|
16
|
+
image: userTable.image,
|
|
17
|
+
},
|
|
18
|
+
})
|
|
19
|
+
.from(commentsTable)
|
|
20
|
+
.leftJoin(userTable, eq(commentsTable.authorId, userTable.id))
|
|
21
|
+
.orderBy(desc(commentsTable.createdAt))
|
|
22
|
+
.limit(5);
|
|
23
|
+
return (_jsxs(Card, { children: [_jsxs(CardHeader, { children: [_jsx(CardTitle, { children: t("Recent Comments") }), _jsx(CardDescription, { children: t("What readers are saying about your posts.") })] }), _jsxs(CardContent, { className: "grid gap-8", children: [comments.map((comment) => (_jsxs("div", { className: "flex items-center gap-4", children: [_jsxs(Avatar, { className: "h-9 w-9", children: [_jsx(AvatarImage, { src: comment.author?.image || "", alt: "Avatar" }), _jsx(AvatarFallback, { children: comment.author?.name?.substring(0, 2).toUpperCase() || "CM" })] }), _jsxs("div", { className: "grid gap-1", children: [_jsx("p", { className: "text-sm font-medium leading-none line-clamp-1", children: comment.content }), _jsxs("p", { className: "text-sm text-muted-foreground", children: [comment.author?.name || t("Anonymous"), " \u2022", " ", new Date(comment.createdAt).toLocaleDateString()] })] })] }, comment.id))), comments.length === 0 && (_jsx("div", { className: "text-center py-4 text-muted-foreground", children: t("No comments yet.") }))] })] }));
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=RecentCommentsWidget.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RecentCommentsWidget.js","sourceRoot":"","sources":["../../src/components/RecentCommentsWidget.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EACL,MAAM,EACN,cAAc,EACd,WAAW,EACX,IAAI,EACJ,WAAW,EACX,eAAe,EACf,UAAU,EACV,SAAS,GACV,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAEvC,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE1C,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,oBAAoB;IAChD,MAAM,EAAE,CAAC,EAAE,GAAG,MAAM,cAAc,EAAE,CAAC;IAErC,MAAM,QAAQ,GAAG,MAAM,EAAE;SACtB,MAAM,CAAC;QACN,EAAE,EAAE,aAAa,CAAC,EAAE;QACpB,OAAO,EAAE,aAAa,CAAC,OAAO;QAC9B,SAAS,EAAE,aAAa,CAAC,SAAS;QAClC,MAAM,EAAE;YACN,IAAI,EAAE,SAAS,CAAC,IAAI;YACpB,KAAK,EAAE,SAAS,CAAC,KAAK;SACvB;KACF,CAAC;SACD,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AAkB,CAAC,GAClB,CACP,IACW,IACT,CACR,CAAC;AACJ,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export default function RecentPostsWidget(): Promise<import("react/jsx-runtime").JSX.Element>;
|
|
2
|
+
//# sourceMappingURL=RecentPostsWidget.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RecentPostsWidget.d.ts","sourceRoot":"","sources":["../../src/components/RecentPostsWidget.tsx"],"names":[],"mappings":"AAgBA,wBAA8B,iBAAiB,qDAmD9C"}
|