async function archiveOldContent() {
// Create an archive category
const categoryResponse = await fetch(`${API_URL}/categories`, {
method: 'POST',
headers: {
'X-API-Key': API_KEY,
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'Archive',
description: 'Archived content for historical reference'
})
});
const archiveCategory = await categoryResponse.json();
const { oldContent } = await reviewContent();
// Move old content to archive (update with category)
for (const item of oldContent) {
if (item.type === 'raw') {
await fetch(`${API_URL}/content/raw/${item.id}`, {
method: 'PUT',
headers: {
'X-API-Key': API_KEY,
'Content-Type': 'application/json'
},
body: JSON.stringify({
title: `[ARCHIVED] ${item.title}`,
category_id: archiveCategory.category_id,
text: item.text || 'Archived content'
})
});
}
}
console.log(`Archived ${oldContent.length} items`);
}