@company-manager/docs

Content Workflow

Editorial review, approval process, and publishing workflow diagrams

Content Workflow

This page covers the editorial workflow from content creation through review, approval, and publication.

Editorial Workflow State Machine

stateDiagram-v2
    [*] --> DRAFT: Author Creates

    state DRAFT {
        [*] --> Writing
        Writing --> Saving: Auto-save
        Saving --> Writing: Continue
    }

    DRAFT --> PENDING_REVIEW: Submit

    state PENDING_REVIEW {
        [*] --> InQueue
        InQueue --> Assigned: Assign Reviewer
    }

    PENDING_REVIEW --> IN_REVIEW: Start Review

    state IN_REVIEW {
        [*] --> Reviewing
        Reviewing --> AddingComments: Comment
        AddingComments --> Reviewing: Continue
    }

    IN_REVIEW --> APPROVED: Approve
    IN_REVIEW --> CHANGES_REQUESTED: Request Changes
    IN_REVIEW --> REJECTED: Reject

    CHANGES_REQUESTED --> DRAFT: Author Revises

    APPROVED --> SCHEDULED: Schedule
    APPROVED --> PUBLISHED: Publish Now

    SCHEDULED --> PUBLISHED: Time Reached

    PUBLISHED --> [*]
    REJECTED --> [*]

Content Creation Sequence

sequenceDiagram
    participant Author
    participant UI as Editor UI
    participant API as TRPC Router
    participant Service as CMS Service
    participant DB as Database
    participant Media as Media Service

    Author->>UI: Create new post
    UI->>API: createPost(type)
    API->>Service: initializePost(ctx, type)

    Service->>DB: Create draft post
    DB-->>Service: Post created

    Service-->>API: Post with editor URL
    API-->>UI: Open editor

    loop Content Editing
        Author->>UI: Edit content
        UI->>UI: Auto-save timer

        alt Auto-save triggers
            UI->>API: savePost(content)
            API->>Service: updateDraft(id, content)
            Service->>DB: Update post + create version
            DB-->>Service: Saved
            Service-->>API: Save confirmed
            API-->>UI: Show saved indicator
        end

        alt Upload media
            Author->>UI: Upload image
            UI->>Media: uploadMedia(file)
            Media->>Media: Process & optimize
            Media-->>UI: Media URL
            UI->>UI: Insert into content
        end
    end

    Author->>UI: Submit for review
    UI->>API: submitForReview(postId)
    API->>Service: changeStatus(id, PENDING_REVIEW)
    Service->>DB: Update status
    Service->>Service: Notify reviewers

Review Process Flow

flowchart TD
    SUBMIT[Submit for Review] --> QUEUE[Review Queue]

    QUEUE --> ASSIGN{Assignment}
    ASSIGN -->|Auto| AUTO[Auto-assign by Rules]
    ASSIGN -->|Manual| MANUAL[Editor Assigns]

    AUTO --> REVIEWER[Reviewer Assigned]
    MANUAL --> REVIEWER

    REVIEWER --> START[Start Review]

    START --> CHECK[Review Checklist]

    subgraph "Review Checklist"
        ACCURACY[Fact Accuracy]
        GRAMMAR[Grammar & Style]
        SEO[SEO Compliance]
        BRAND[Brand Guidelines]
        LEGAL[Legal Review]
    end

    CHECK --> ACCURACY
    CHECK --> GRAMMAR
    CHECK --> SEO
    CHECK --> BRAND
    CHECK --> LEGAL

    ACCURACY --> DECISION
    GRAMMAR --> DECISION
    SEO --> DECISION
    BRAND --> DECISION
    LEGAL --> DECISION

    DECISION{Decision}
    DECISION -->|Approve| APPROVED[Approved]
    DECISION -->|Changes| CHANGES[Request Changes]
    DECISION -->|Reject| REJECTED[Rejected]

    CHANGES --> FEEDBACK[Add Feedback]
    FEEDBACK --> NOTIFY[Notify Author]
    NOTIFY --> REVISE[Author Revises]
    REVISE --> SUBMIT

    style APPROVED fill:#e8f5e9
    style REJECTED fill:#ffebee

Review Sequence

sequenceDiagram
    participant Reviewer
    participant UI as Review UI
    participant API as TRPC Router
    participant Service as CMS Service
    participant DB as Database
    participant Email as Email Service
    participant Author

    Reviewer->>UI: Open review queue
    UI->>API: getReviewQueue()
    API->>Service: getPendingReviews(ctx)
    Service->>DB: Query pending posts
    DB-->>Service: Posts list
    Service-->>API: Review queue
    API-->>UI: Display queue

    Reviewer->>UI: Select post to review
    UI->>API: startReview(postId)
    API->>Service: assignReviewer(postId, reviewerId)
    Service->>DB: Update status (IN_REVIEW)
    Service->>DB: Log review started

    Reviewer->>UI: Add inline comments
    UI->>API: addComment(postId, location, text)
    API->>Service: createReviewComment(data)
    Service->>DB: Save comment

    Reviewer->>UI: Make decision
    UI->>API: submitReviewDecision(postId, decision, notes)
    API->>Service: processReviewDecision(postId, decision)

    alt Approved
        Service->>DB: Update status (APPROVED)
        Service->>Email: notifyApproval(author)
        Email->>Author: "Your post was approved"
    else Changes Requested
        Service->>DB: Update status (CHANGES_REQUESTED)
        Service->>Email: notifyChangesNeeded(author)
        Email->>Author: "Changes requested on your post"
    else Rejected
        Service->>DB: Update status (REJECTED)
        Service->>Email: notifyRejection(author)
        Email->>Author: "Your post was not approved"
    end

Scheduling & Publishing

flowchart TD
    APPROVED[Content Approved] --> PUBLISH_TYPE{Publish Type}

    PUBLISH_TYPE -->|Immediate| NOW[Publish Now]
    PUBLISH_TYPE -->|Scheduled| SCHEDULE[Set Schedule]

    SCHEDULE --> SELECT_DATE[Select Date/Time]
    SELECT_DATE --> TIMEZONE[Adjust for Timezone]
    TIMEZONE --> CONFIRM[Confirm Schedule]
    CONFIRM --> QUEUE[Add to Publish Queue]

    NOW --> PUBLISH[Publish Content]
    QUEUE --> CRON[Scheduler Checks]
    CRON --> TIME{Time Reached?}
    TIME -->|No| CRON
    TIME -->|Yes| PUBLISH

    PUBLISH --> CACHE[Clear Cache]
    CACHE --> INDEX[Update Search Index]
    INDEX --> SITEMAP[Update Sitemap]
    SITEMAP --> NOTIFY_SUB[Notify Subscribers]
    NOTIFY_SUB --> SOCIAL[Post to Social]

    SOCIAL --> LIVE[Content Live]

    style LIVE fill:#e8f5e9

Version Control

sequenceDiagram
    participant User
    participant Editor as Editor UI
    participant API as TRPC Router
    participant Service as CMS Service
    participant DB as Database

    User->>Editor: Make changes
    Editor->>API: savePost(postId, content)
    API->>Service: saveWithVersion(postId, content)

    Service->>DB: Get current version number
    DB-->>Service: Version N

    Service->>DB: Create version N+1
    Service->>DB: Update post content
    DB-->>Service: Saved

    Service-->>API: Version saved
    API-->>Editor: Show "Saved"

    Note over User,DB: Later - View history

    User->>Editor: View version history
    Editor->>API: getVersions(postId)
    API->>Service: getPostVersions(postId)
    Service->>DB: Query versions
    DB-->>Service: Version list
    Service-->>API: Versions
    API-->>Editor: Display timeline

    User->>Editor: Restore version
    Editor->>API: restoreVersion(postId, versionId)
    API->>Service: restorePostVersion(postId, versionId)
    Service->>DB: Copy version content to current
    Service->>DB: Create new version (restored)
    DB-->>Service: Restored
    Service-->>API: Success
    API-->>Editor: Content restored

Multi-Author Collaboration

flowchart TD
    subgraph "Collaboration Modes"
        SINGLE[Single Author]
        COLLAB[Co-Authors]
        CONTRIB[Contributors]
    end

    SINGLE --> FULL[Full Control]

    COLLAB --> SECTIONS[Section Assignment]
    SECTIONS --> LOCK[Section Locking]
    LOCK --> MERGE[Merge Changes]

    CONTRIB --> SUGGEST[Suggest Edits]
    SUGGEST --> REVIEW_EDIT[Author Reviews]
    REVIEW_EDIT --> ACCEPT[Accept/Reject]

    subgraph "Conflict Resolution"
        CONFLICT[Conflict Detected]
        CONFLICT --> COMPARE[Compare Versions]
        COMPARE --> CHOOSE[Choose Version]
        CHOOSE --> MANUAL_MERGE[Manual Merge]
    end

Publishing Workflow ERD

erDiagram
    POST ||--o{ POST_VERSION : has
    POST ||--o{ REVIEW : undergoes
    POST ||--o{ REVIEW_COMMENT : has
    POST ||--o{ PUBLISH_SCHEDULE : scheduled_by

    REVIEW }o--|| USER : reviewed_by
    REVIEW_COMMENT }o--|| USER : commented_by

    REVIEW {
        string id PK
        string postId FK
        string reviewerId FK
        enum status
        string notes
        timestamp startedAt
        timestamp completedAt
    }

    REVIEW_COMMENT {
        string id PK
        string postId FK
        string reviewId FK
        string userId FK
        text comment
        json location
        boolean resolved
        timestamp createdAt
    }

    PUBLISH_SCHEDULE {
        string id PK
        string postId FK
        timestamp scheduledFor
        string timezone
        enum status
        string createdBy FK
    }