diff --git a/app/server/api/articles/index.post.ts b/app/server/api/articles/index.post.ts index a134a16..ec10106 100644 --- a/app/server/api/articles/index.post.ts +++ b/app/server/api/articles/index.post.ts @@ -1,36 +1,36 @@ -import { Article } from '../../models/Article' -import { requireAuth } from '../../utils/auth' +import { Article } from "../../models/Article"; +import { requireAuth } from "../../utils/auth"; export default defineEventHandler(async (event) => { // Require authentication - const user = await requireAuth(event) + const user = await requireAuth(event); // Check if user can create articles if (!user.permissions.canEdit) { throw createError({ statusCode: 403, - statusMessage: 'You do not have permission to create articles' - }) + statusMessage: "You do not have permission to create articles", + }); } // Get request body - const body = await readBody(event) + const body = await readBody(event); // Validate required fields if (!body.title || !body.slug || !body.content) { throw createError({ statusCode: 400, - statusMessage: 'Title, slug, and content are required' - }) + statusMessage: "Title, slug, and content are required", + }); } // Check if slug already exists - const existing = await Article.findOne({ slug: body.slug }) + const existing = await Article.findOne({ slug: body.slug }); if (existing) { throw createError({ statusCode: 409, - statusMessage: 'An article with this slug already exists' - }) + statusMessage: "An article with this slug already exists", + }); } // Create article @@ -38,34 +38,35 @@ export default defineEventHandler(async (event) => { const article = await Article.create({ slug: body.slug, title: body.title, - description: body.description || '', + description: body.description || "", content: body.content, - category: body.category || 'general', + category: body.category || "general", tags: body.tags || [], - accessLevel: body.accessLevel || 'member', + accessLevel: body.accessLevel || "public", cohorts: body.cohorts || [], author: user.userId, - status: body.status || 'draft', - publishedAt: body.status === 'published' ? new Date() : null, - revisions: [{ - content: body.content, - author: user.userId, - message: 'Initial creation', - createdAt: new Date() - }] - }) + status: body.status || "draft", + publishedAt: body.status === "published" ? new Date() : null, + revisions: [ + { + content: body.content, + author: user.userId, + message: "Initial creation", + createdAt: new Date(), + }, + ], + }); return { success: true, slug: article.slug, - message: 'Article created successfully' - } - + message: "Article created successfully", + }; } catch (error) { - console.error('Error creating article:', error) + console.error("Error creating article:", error); throw createError({ statusCode: 500, - statusMessage: 'Failed to create article' - }) + statusMessage: "Failed to create article", + }); } -}) \ No newline at end of file +}); diff --git a/content/articles/actionable-steam-metrics.md b/content/articles/actionable-steam-metrics.md index 652da0d..4471b1a 100644 --- a/content/articles/actionable-steam-metrics.md +++ b/content/articles/actionable-steam-metrics.md @@ -3,7 +3,7 @@ title: Actionable Steam Metrics description: '' category: strategy tags: [] -accessLevel: member +accessLevel: public author: Baby Ghosts publishedAt: '2025-11-10T10:42:09.227Z' --- diff --git a/content/articles/actionable-values.md b/content/articles/actionable-values.md index 2b74e31..f9b15c2 100644 --- a/content/articles/actionable-values.md +++ b/content/articles/actionable-values.md @@ -3,7 +3,7 @@ title: Actionable Values description: '' category: studio-development tags: [] -accessLevel: member +accessLevel: public author: Weird Ghosts publishedAt: '2025-11-10T10:52:42.621Z' --- diff --git a/content/articles/business-planning.md b/content/articles/business-planning.md index d587980..29bc5d4 100644 --- a/content/articles/business-planning.md +++ b/content/articles/business-planning.md @@ -3,7 +3,7 @@ title: Business Planning description: A business plan is a critical document for impact-oriented studios. category: strategy tags: [] -accessLevel: member +accessLevel: public author: Baby Ghosts publishedAt: '2025-11-10T10:42:09.221Z' --- diff --git a/content/articles/canada-council-funding.md b/content/articles/canada-council-funding.md index 6baf9e9..1a1a695 100644 --- a/content/articles/canada-council-funding.md +++ b/content/articles/canada-council-funding.md @@ -3,7 +3,7 @@ title: Canada Council Funding description: '' category: strategy tags: [] -accessLevel: member +accessLevel: public author: Baby Ghosts publishedAt: '2025-11-10T10:42:09.229Z' --- diff --git a/content/articles/cmf-quick-tips.md b/content/articles/cmf-quick-tips.md index 085f7e3..d5a8ae3 100644 --- a/content/articles/cmf-quick-tips.md +++ b/content/articles/cmf-quick-tips.md @@ -3,7 +3,7 @@ title: CMF Quick Tips description: '' category: strategy tags: [] -accessLevel: member +accessLevel: public author: Baby Ghosts publishedAt: '2025-11-10T10:42:09.229Z' --- diff --git a/content/articles/co-op-structure.md b/content/articles/co-op-structure.md index 2c55ab5..7b8e360 100644 --- a/content/articles/co-op-structure.md +++ b/content/articles/co-op-structure.md @@ -3,7 +3,7 @@ title: Co-op Structure description: '' category: studio-development tags: [] -accessLevel: member +accessLevel: public author: Weird Ghosts publishedAt: '2025-11-10T10:52:42.623Z' --- diff --git a/content/articles/decisions-and-conflict.md b/content/articles/decisions-and-conflict.md index 2226299..226ef37 100644 --- a/content/articles/decisions-and-conflict.md +++ b/content/articles/decisions-and-conflict.md @@ -3,7 +3,7 @@ title: Decisions and Conflict description: '' category: studio-development tags: [] -accessLevel: member +accessLevel: public author: Weird Ghosts publishedAt: '2025-11-10T10:52:42.624Z' --- diff --git a/content/articles/expo-tips.md b/content/articles/expo-tips.md index b0030c9..a67a5b3 100644 --- a/content/articles/expo-tips.md +++ b/content/articles/expo-tips.md @@ -3,7 +3,7 @@ title: Expo Tips description: '' category: strategy tags: [] -accessLevel: member +accessLevel: public author: Baby Ghosts publishedAt: '2025-11-10T10:42:09.230Z' --- diff --git a/content/articles/financial-modelling.md b/content/articles/financial-modelling.md index 6f072e0..50e9b9c 100644 --- a/content/articles/financial-modelling.md +++ b/content/articles/financial-modelling.md @@ -3,7 +3,7 @@ title: Financial modelling description: Introduction to financial modelling for game development cooperatives category: strategy tags: [] -accessLevel: member +accessLevel: public author: Jennie publishedAt: 2025-11-10T10:42:09.224Z --- diff --git a/content/articles/game-discovery-toolkit.md b/content/articles/game-discovery-toolkit.md index eadbcda..63cf499 100644 --- a/content/articles/game-discovery-toolkit.md +++ b/content/articles/game-discovery-toolkit.md @@ -3,7 +3,7 @@ title: Game Discovery Toolkit description: '' category: strategy tags: [] -accessLevel: member +accessLevel: public author: Baby Ghosts publishedAt: '2025-11-10T10:42:09.227Z' --- diff --git a/content/articles/impact-measurement.md b/content/articles/impact-measurement.md index 168cb8d..0f3571c 100644 --- a/content/articles/impact-measurement.md +++ b/content/articles/impact-measurement.md @@ -5,7 +5,7 @@ description: >- indie game studio. category: impact tags: [] -accessLevel: member +accessLevel: public author: Weird Ghosts publishedAt: '2025-11-10T10:52:42.627Z' --- diff --git a/content/articles/market-analysis.md b/content/articles/market-analysis.md index 8cde411..de64e32 100644 --- a/content/articles/market-analysis.md +++ b/content/articles/market-analysis.md @@ -3,7 +3,7 @@ title: Market Analysis description: Market Analysis category: strategy tags: [] -accessLevel: member +accessLevel: public author: Baby Ghosts publishedAt: '2025-11-10T10:42:09.226Z' --- diff --git a/content/articles/pitching-to-publishers.md b/content/articles/pitching-to-publishers.md index 6b1fed8..899557a 100644 --- a/content/articles/pitching-to-publishers.md +++ b/content/articles/pitching-to-publishers.md @@ -3,7 +3,7 @@ title: Pitching to Publishers description: Pitching to Publishers category: strategy tags: [] -accessLevel: member +accessLevel: public author: Baby Ghosts publishedAt: '2025-11-10T10:42:09.228Z' --- diff --git a/content/articles/process-development.md b/content/articles/process-development.md index cfa9118..497a2d8 100644 --- a/content/articles/process-development.md +++ b/content/articles/process-development.md @@ -3,7 +3,7 @@ title: Process Development description: '' category: studio-development tags: [] -accessLevel: member +accessLevel: public author: Weird Ghosts publishedAt: '2025-11-10T10:52:42.624Z' --- diff --git a/content/articles/publisher-contract-review.md b/content/articles/publisher-contract-review.md index 1aa4e73..777932e 100644 --- a/content/articles/publisher-contract-review.md +++ b/content/articles/publisher-contract-review.md @@ -3,7 +3,7 @@ title: Publisher Contract Review description: '' category: strategy tags: [] -accessLevel: member +accessLevel: public author: Baby Ghosts publishedAt: '2025-11-10T10:42:09.229Z' --- diff --git a/content/articles/results-flow.md b/content/articles/results-flow.md index fa21852..08f3387 100644 --- a/content/articles/results-flow.md +++ b/content/articles/results-flow.md @@ -3,7 +3,7 @@ title: Results Flow description: A step-by-step guide to creating a results flow for your indie game studio. category: impact tags: [] -accessLevel: member +accessLevel: public author: Weird Ghosts publishedAt: '2025-11-10T10:52:42.626Z' --- diff --git a/content/articles/schedule.md b/content/articles/schedule.md index adf6e8b..4e61ad4 100644 --- a/content/articles/schedule.md +++ b/content/articles/schedule.md @@ -3,7 +3,7 @@ title: Schedule description: '' category: programs tags: [] -accessLevel: member +accessLevel: public author: Baby Ghosts publishedAt: '2025-11-10T10:42:09.231Z' --- diff --git a/content/articles/self-assessment.md b/content/articles/self-assessment.md index 22ec22c..3fb516d 100644 --- a/content/articles/self-assessment.md +++ b/content/articles/self-assessment.md @@ -3,7 +3,7 @@ title: Self-Assessment description: '' category: programs tags: [] -accessLevel: member +accessLevel: public author: Baby Ghosts publishedAt: '2025-11-10T10:42:09.231Z' --- diff --git a/content/articles/stages-of-coop-development.md b/content/articles/stages-of-coop-development.md index ebac146..aa10cc2 100644 --- a/content/articles/stages-of-coop-development.md +++ b/content/articles/stages-of-coop-development.md @@ -3,7 +3,7 @@ title: Stages of Coop Development description: '' category: programs tags: [] -accessLevel: member +accessLevel: public author: Baby Ghosts publishedAt: '2025-11-10T10:42:09.232Z' --- diff --git a/content/articles/structures-for-impact.md b/content/articles/structures-for-impact.md index cc8ef99..2b19ea5 100644 --- a/content/articles/structures-for-impact.md +++ b/content/articles/structures-for-impact.md @@ -3,7 +3,7 @@ title: Structures for Impact description: '' category: strategy tags: [] -accessLevel: member +accessLevel: public author: Baby Ghosts publishedAt: '2025-11-10T10:42:09.223Z' --- diff --git a/content/articles/telling-your-story.md b/content/articles/telling-your-story.md index d764a8b..8f47ae2 100644 --- a/content/articles/telling-your-story.md +++ b/content/articles/telling-your-story.md @@ -3,7 +3,7 @@ title: Telling Your Story description: '' category: studio-development tags: [] -accessLevel: member +accessLevel: public author: Weird Ghosts publishedAt: '2025-11-10T10:52:42.625Z' --- diff --git a/content/articles/tiktok-meeting-notes.md b/content/articles/tiktok-meeting-notes.md index 8a121af..c48f5b4 100644 --- a/content/articles/tiktok-meeting-notes.md +++ b/content/articles/tiktok-meeting-notes.md @@ -3,7 +3,7 @@ title: TikTok Meeting Notes description: 'TikTok Marketing Meeting: July 3, 2023' category: strategy tags: [] -accessLevel: member +accessLevel: public author: Baby Ghosts publishedAt: '2025-11-10T10:42:09.230Z' ---