2.5 KiB
2.5 KiB
PocketBase collection setup for Evoke chat
Create these collections in the PocketBase Admin UI at https://pocketbase.ccllc.pro/_/.
Auth (users)
Evoke uses the built-in users collection for login and signup. Ensure:
- The users collection exists (default in PocketBase).
- Auth is enabled: in the collection settings, enable "Allow username/auth" or the Email/Password auth method so users can register and log in with email + password.
- Optionally add a name field (Text) for display in the sidebar.
1. Collection: channels
| Field | Type | Notes |
|---|---|---|
| name | Text | Channel name |
| members | Relation | Multiple → users |
| created | Date | Auto |
| createdBy | Relation | Single → users (optional) |
API rules
- List:
members ?= @request.auth.id - View:
members ?= @request.auth.id - Create:
@request.auth.id != "" - Update/Delete: e.g. same as view or creator-only
2. Collection: messages (unified: voice, text, image, video)
| Field | Type | Notes |
|---|---|---|
| type | Select | Values: voice, text, image, video |
| channel | Relation | Single → channels |
| user | Relation | Single → users |
| body | Text | Required for text; optional caption for image/video/voice |
| audio | File | Single, accept audio/* (e.g. webm/opus); when type = voice |
| file | File | Single, accept image/* or video/*; when type = image or video |
| duration | Number | Seconds; when type = voice |
| waveform | JSON | Optional; e.g. {"peaks": [...]}; when type = voice |
| created | Date | Auto |
API rules
- Create:
@request.auth.id != "" && user = @request.auth.id - List:
channel.members ?= @request.auth.id - View:
channel.members ?= @request.auth.id
The channels and messages collections reference users (relation fields). Create users via the Evoke app (Sign up) or in the PocketBase Admin.