models:
- name: Activity
collection: activities
description: "A sales touchpoint or task — call, WhatsApp, email, meeting, visit, note — linked to a lead/opportunity/party"
fields:
id:
type: uuid
attributes: ["@id", "@default(uuid)"]
description: "Unique activity id"
subject:
type: string
attributes: ["@required", "@max(200)"]
description: "Short title / summary of the activity"
activity_type:
type: ActivityType
attributes: ["@required", "@default(whatsapp)"]
description: "What kind of touchpoint/task this is"
direction:
type: ActivityDirection?
description: "Inbound (customer to us) or outbound (us to customer)"
lead_id:
type: uuid?
attributes: ["@exclude_from_foreign_key_check"]
description: "Related lead (if pre-deal) # logical FK to lead.leads.id"
opportunity_id:
type: uuid?
attributes: ["@exclude_from_foreign_key_check"]
description: "Related opportunity (if in-pipeline) # logical FK to deal.opportunities.id"
party_id:
type: uuid?
attributes: ["@exclude_from_foreign_key_check"]
description: "The contact/customer # logical FK to party.Party.id"
status:
type: ActivityStatus
attributes: ["@required", "@default(planned)"]
description: "planned = upcoming task; done = logged interaction"
scheduled_at:
type: datetime?
description: "When the task is due / was planned for (status=planned)"
occurred_at:
type: datetime?
description: "When the interaction actually happened (status=done)"
assignee_id:
type: uuid?
attributes: ["@exclude_from_foreign_key_check"]
description: "Rep responsible # logical FK to sapiens.User.id"
outcome:
type: string?
attributes: ["@max(280)"]
description: "Result of the activity (e.g. 'interested', 'no answer', 'follow-up booked')"
notes:
type: string?
attributes: ["@max(4000)"]
description: "Free-text notes / summary of the conversation"
metadata:
type: Metadata
attributes: ["@audit_metadata"]
description: "Audit metadata"
indexes:
- type: index
fields: [lead_id]
- type: index
fields: [opportunity_id]
- type: index
fields: [party_id]
- type: index
fields: [assignee_id, scheduled_at]
enums:
- name: ActivityType
description: "Kind of sales activity"
variants:
- name: whatsapp
description: "WhatsApp message/exchange (primary Indonesia channel)"
default: true
- name: call
description: "Phone call"
- name: email
description: "Email"
- name: meeting
description: "Meeting (in-person or video)"
- name: visit
description: "Site/office visit"
- name: task
description: "Generic task / to-do"
- name: note
description: "Free-form note"
- name: other
description: "Other"
- name: ActivityStatus
description: "Activity lifecycle state"
variants:
- name: planned
description: "Scheduled / upcoming (a task)"
default: true
- name: in_progress
description: "Currently happening"
- name: done
description: "Completed / logged interaction"
- name: cancelled
description: "Cancelled / no-show"
- name: ActivityDirection
description: "Direction of an interaction"
variants:
- name: inbound
description: "Customer to us"
- name: outbound
description: "Us to customer"
default: true