Skip to content

feat: Comprehensive CRM example demonstrating all ObjectStack protocol features#14

Merged
huangyiirene merged 9 commits into
mainfrom
copilot/add-crm-functionality-example
Jan 19, 2026
Merged

feat: Comprehensive CRM example demonstrating all ObjectStack protocol features#14
huangyiirene merged 9 commits into
mainfrom
copilot/add-crm-functionality-example

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 19, 2026

Created production-grade CRM example (~2,900 LOC) showcasing complete protocol surface area. Previous example only covered 3 basic objects with minimal features.

Objects Added

New:

  • Lead - conversion tracking, status workflows
  • Case - SLA management, escalation automation
  • Task - polymorphic relations, recurrence patterns

Enhanced (Account, Contact, Opportunity):

  • All 24 field types: autonumber, formula, currency, select with colors, master-detail, etc.
  • Multiple view types: grid, kanban, calendar, gantt
  • Validation: script, uniqueness, state machines
  • Workflow automation: field updates, email alerts, state transitions

UI Components

  • Actions (10): Lead conversion, record cloning, bulk updates with parameters
  • Dashboards (3): 35+ widgets across sales/service/executive views (metrics, charts, tables)
  • Reports (8): Tabular, summary, matrix with embedded visualizations

Example

// Opportunity with state machine validation and automated probability updates
export const Opportunity = ObjectSchema.create({
  name: 'opportunity',
  fields: {
    stage: Field.select(['prospecting', 'qualification', 'proposal', 'negotiation', 
                         'closed_won', 'closed_lost']),
    probability: Field.percent(),
    amount: Field.currency(),
    expected_revenue: Field.currency({ readonly: true }),
  },
  validations: [{
    type: 'state_machine',
    field: 'stage',
    transitions: {
      'prospecting': ['qualification', 'closed_lost'],
      'qualification': ['needs_analysis', 'closed_lost'],
      // ... enforces valid stage progressions
    }
  }],
  workflows: [{
    triggerType: 'on_create_or_update',
    criteria: 'ISCHANGED(stage)',
    actions: [
      { type: 'field_update', field: 'probability', 
        value: 'CASE(stage, "prospecting", 10, "closed_won", 100, ...)' },
      { type: 'field_update', field: 'expected_revenue', 
        value: 'amount * (probability / 100)' }
    ]
  }]
});

Protocol Coverage

Area Before After
Field Types 5 24
View Types 1 (grid) 4 (grid, kanban, calendar, gantt)
Validations 0 4 types
Workflows 1 Multiple per object
UI Components 0 21 (actions, dashboards, reports)

Bilingual documentation (EN/中文) with learning resources and architecture patterns.

Original prompt

给我一个能体现协议各项功能的crm例子


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@vercel
Copy link
Copy Markdown

vercel Bot commented Jan 19, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
spec Ready Ready Preview, Comment Jan 19, 2026 0:17am

Request Review

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copilot AI and others added 3 commits January 19, 2026 11:51
- Add phone field type helper to Field factory
- Update Field.select/multiselect to support both array and object signatures
- Add factory methods (Action.create, Dashboard.create, Report.create)
- Use z.input and parse for factory methods to support default values

Co-authored-by: huangyiirene <7665279+huangyiirene@users.noreply.github.com>
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
- Add tests for Field.phone() helper
- Add tests for Field.select() backward compatibility (old and new API)
- Add tests for Field.multiselect() backward compatibility
- Add tests for Action.create() with default value handling
- Add tests for Dashboard.create() with default value handling
- All 279 tests passing

Co-authored-by: huangyiirene <7665279+huangyiirene@users.noreply.github.com>
Copilot AI changed the title [WIP] Add example of CRM functionality for protocol feat: Comprehensive CRM example demonstrating all ObjectStack protocol features Jan 19, 2026
Copilot AI requested a review from hotlong January 19, 2026 12:04
Copilot AI and others added 3 commits January 19, 2026 12:05
Document backward-compatible API with examples for both old and new signatures

Co-authored-by: huangyiirene <7665279+huangyiirene@users.noreply.github.com>
- Extract options from config object to avoid confusion
- Change spread order to options first, then finalConfig
- Ensures processed options always take precedence

Co-authored-by: huangyiirene <7665279+huangyiirene@users.noreply.github.com>
@huangyiirene huangyiirene marked this pull request as ready for review January 19, 2026 12:18
@huangyiirene huangyiirene merged commit 2e2341a into main Jan 19, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants