Skip to content

Commit 45a04c3

Browse files
authored
Merge pull request #102 from techdiary-dev/copilot/make-article-drafted-on-schedule-deletion
Draft article immediately on schedule deletion
2 parents e0b57b1 + 8a83b92 commit 45a04c3

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

src/app/dashboard/_components/DashboardArticleList.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,11 @@ const DashboardArticleList = () => {
6565
...page,
6666
nodes: page.nodes.map((article: any) =>
6767
article.id === article_id
68-
? { ...article, delete_scheduled_at: addDays(new Date(), 7) }
68+
? {
69+
...article,
70+
delete_scheduled_at: addDays(new Date(), 7),
71+
published_at: null,
72+
}
6973
: article
7074
),
7175
})),

src/backend/services/article.actions.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,9 +249,12 @@ export async function scheduleArticleDelete(article_id: string) {
249249
where: and(eq("id", article_id), eq("author_id", session_userID)),
250250
data: {
251251
delete_scheduled_at: addDays(new Date(), 7),
252+
published_at: null,
252253
},
253254
});
254255

256+
deleteArticleById(article_id);
257+
255258
return {
256259
success: true as const,
257260
data: updated.rows[0],

0 commit comments

Comments
 (0)