-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpopulate_articlesDB.js
More file actions
44 lines (40 loc) · 1.7 KB
/
populate_articlesDB.js
File metadata and controls
44 lines (40 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
const connectDB = require('./config/connect');
const Article = require('./models/article');
const run = async () => {
try {
await connectDB();
const testArticle = new Article({
title: "Wicked: The Untold Story of the Witches of Oz",
author: "LittleFlowerPH",
status: "unfinished",
publish_date: null,
blocks: [
{
type: "text",
data: `<p><strong>Wicked</strong> is a Broadway musical that tells the story of what happened before Dorothy arrived in Oz. It's a tale of friendship, rivalry, and how perception shapes reality.</p>`,
order: 0
},
{
type: "image",
data: "/uploads/wicked-banner.jpg", // replace with actual image path if needed
order: 1
},
{
type: "text",
data: `<p>The story centers around Elphaba, the misunderstood green-skinned girl, and Glinda, the popular and ambitious blonde witch. Through a series of events, their lives intertwine in unexpected ways.</p>`,
order: 2
},
{
type: "text",
data: `<p>With unforgettable songs like <em>"Defying Gravity"</em> and <em>"For Good"</em>, Wicked has enchanted audiences for over two decades.</p>`,
order: 3
}
]
});
await testArticle.save();
console.log("✅ Wicked test article saved successfully.");
} catch (err) {
console.error("❌ Error saving article:", err);
}
};
run();