Developer Docs

Blog Management System - Integration Guide

The Blog Management System allows Malet Owners to create, edit, and manage their blog posts directly from their Malet (Outlet).

Key Features

Management Dashboard

  • Access: Accessible via the "Manage" button on the public blog listing page (/[malet]/blog).
  • Route: ngwenya-deck/src/routes/[malet]/manage/blog/+page.svelte (Frontend)
  • Features:
    • List of all blog posts for the Malet.
    • Status-based filtering (All, Draft, Published, etc.) implemented client-side.
    • Quick navigation to create new posts or edit existing ones.

Publishing Flow

  • Creation: ngwenya-deck/src/routes/[malet]/manage/blog/new/+page.svelte
  • Status Support: The status field is correctly passed during creation.
    • Draft: Saves the post with DRAFT status.
    • Publish: Saves the post with PUBLISHED status, making it immediately visible on the public Malet profile.

Technical Implementation

GraphQL Integration

  • Mutation: CREATE_BLOG includes the status field in its input.
  • DTO Validation: (Backend) BlogInputDTO requires @IsOptional() and @IsEnum(BlogStatus) decorators to pass the class-validator whitelist middleware.

Frontend Logic

  • Reactive Filtering: The management page uses a reactive filteredBlogs variable to handle status filtering without re-fetching from the server unnecessarily.
  • Loop Prevention: Fixed a common Svelte reactivity pitfall where updating a variable inside its own reactive statement caused infinite loops.
  • Public List: /[malet]/blog (Shows only PUBLISHED posts by default).
  • Management: deck.mallnline.com/[malet]/manage/blog
  • Editor: deck.mallnline.com/[malet]/manage/blog/new or deck.mallnline.com/[malet]/manage/blog/[id]