Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions content/docs/guides/data-modeling.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,32 @@ Field.lookup('contact', {
})
```

### User Fields

Pick a person — the equivalent of Airtable's *Collaborator* or Salesforce's
`Lookup(User)`. A `user` field is a **lookup specialized to the built-in
`sys_user` object**: it stores the user's id (a real foreign key), resolves to
the user's name/avatar via `$expand`, and renders as a searchable people picker.
You never reference `sys_user` by hand.

```typescript
// Single assignee
Field.user({ label: 'Assignee' })

// Collaborators / watchers (multiple)
Field.user({ label: 'Watchers', multiple: true })

// Auto-fill the acting user on create (record owner / reporter)
Field.user({ label: 'Owner', defaultValue: 'current_user' })
```

`defaultValue: 'current_user'` stamps the authenticated user's id at insert time
(the people-field counterpart to `'NOW()'` for timestamps). Because a `user`
field is stored exactly like a lookup, an existing `Field.lookup('sys_user')`
is equivalent at the storage layer — adopt `Field.user()` with no data
migration. Record ownership and row-level security continue to use the existing
`owner_id` convention.

### Address Field

Structured address data:
Expand Down
1 change: 1 addition & 0 deletions content/docs/guides/standards.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ export const MyObject = ObjectSchema.create({
| Choice | `Field.select()` | Status, category, type |
| Multiple choice | `Field.select({ multiple: true })` | Tags, skills |
| Reference | `Field.lookup()` | Relationships |
| User / Person | `Field.user()` | Assignee, owner, collaborators (picks a `sys_user`) |
| Location | `Field.location()` | GPS coordinates |
| Address | `Field.address()` | Mailing addresses |
| Color | `Field.color()` | Brand colors, themes |
Expand Down
1 change: 1 addition & 0 deletions content/docs/references/data/field.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ const result = Address.parse(data);
* `lookup`
* `master_detail`
* `tree`
* `user`
* `image`
* `file`
* `avatar`
Expand Down
2 changes: 1 addition & 1 deletion content/docs/references/data/seed-loader.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ Describes how a field reference is resolved during seed loading
| **field** | `string` | ✅ | Source field name containing the reference value |
| **targetObject** | `string` | ✅ | Target object name (snake_case) |
| **targetField** | `string` | ✅ | Field on target object used for matching |
| **fieldType** | `Enum<'lookup' \| 'master_detail'>` | ✅ | Relationship field type |
| **fieldType** | `Enum<'lookup' \| 'master_detail' \| 'user'>` | ✅ | Relationship field type |


---
Expand Down