Crew
Crew is who works an operation: who applied, who is approved, and which team and role they hold. A volunteer applies through a form you choose for the operation, staff approve, reject or waitlist them, and an invite link puts a lead on a team directly. Everything a person holds is a team role in Teams: an approved crew member is a member of one of the operation's teams. For who may see what, use record audiences; for the operations themselves, Operations.
The package is @frigear-nu/crew. It answers who takes part in an operation, for Operations' participation hooks and
the operation grant kind.
What you get
- Volunteer pages (on by default, each can be turned off): a crew home at
/dashboard/crew, an area of the signed-in hub of Dashboard with tabs for thecrew.homedashboard, your applications and places, and what other modules add (Shifts: your shifts and the swaps); apply at/crew/apply/:operationSlug; and invite links at/crew/invite/:token. With Menu, a "Crew" entry in the hub'sdashboardmenu. With Mobile, a Crew tab: the home page in the hub, with its tabs, else the status page. - Admin area (with Admin and Widget): a Crew tab on the operation page of Operations. It holds the applications table with filters, bulk approval and a member form, the invite links, and the settings of how the crew is recruited.
- Server routes (on by default): your own status, the apply page's data and accepting an invite, and a staff API for settings, members, decisions and invites.
- Status emails (on by default): a person is emailed when their status changes, from templates the host can override and an operation can rewrite.
- Hooks:
crew:member:applied,crew:member:approved,crew:member:rejected,crew:member:waitlistedandcrew:member:withdrawn. - Role presets: the mapping rules of the
rolePresetsoption, such as "a globalstaffis alead", on the operation's teams, without adding anyone by hand.
@nuxthub/core, and @nuxt/ui for the pages.
Optional:Admin and Widget for the Crew tab,
Menu for the hub's menu entry, Mobile for the tab,
and Email Templates to render the emails from templates.Quick setup
Install Crew
pnpm add @frigear-nu/crew @nuxthub/core
Add it to nuxt.config.ts
List Admin and Widget before Crew, so the tab registers. Operations and Teams need their admin pages for the tab to have a page to live on.
export default defineNuxtConfig({
modules: ['@nuxthub/core', '@frigear-nu/admin', '@frigear-nu/widget', '@frigear-nu/crew'],
operations: { settings: { pages: { admin: true, adminOperation: true } } },
teams: { settings: { pages: { admin: true, adminTeam: true } } },
crew: {
rolePresets: [
{ match: { role: 'staff', except: ['admin'] }, teamRole: 'lead' },
{ match: { plan: 'yearly' }, teamRole: 'member' },
],
},
})
Generate the migration
team_members and users
do not exist, and every request to them fails. Crew extends tables it does not own, so generate the migration in your
app, with Teams, Users and Forms installed.pnpm db:generate
Decide who manages the crew
crew:manage, nobody can approve anyone. The admin role holds it when your app defines it.Make an application form
Create a form in Forms that asks for a signed-in user (access.auth: 'user') and stores its
submissions. Add a field with the key phone to collect phone numbers. Publish it.
Set up the operation's crew
Open the operation, then its Crew tab. Choose the form under Settings and save. The first save creates a "Crew" team for the operation when it has none, and the role presets.
/crew/apply/summer-festival-2027, fills in the form and gets an email.
The coordinator sees the application in the Crew tab and approves it. The volunteer now holds the role volunteer on
the Crew team at GET /api/teams/me, and the operation is in their GET /api/operations/me. A lead invite link added
from the same tab puts a person on the team as lead without an application.Options
Options go under the crew key.
| Option | Type | Default | Purpose |
|---|---|---|---|
settings.pages.home | string | boolean | on | The crew home: the crew.dashboard tabs. true is /dashboard/crew below the hub (/crew redirects there), or /crew when the hub is off. Signed-in only. |
settings.pages.apply | string | boolean | on | The apply page. true is /crew/apply/:operationSlug; a path must contain :operationSlug. false turns it off. |
settings.pages.status | string | boolean | on | A volunteer's applications and places: the My crew tab of the home page. In the hub, true adds no page (/crew/status redirects to /dashboard/crew?tab=status) and a path adds one there; without the hub, or with Mobile, true is also a page at /crew/status. false turns both off. |
settings.pages.invite | string | boolean | on | Accepting an invite link. true is /crew/invite/:token; a path must contain :token. |
settings.operationsTab | boolean | true | Add the Crew tab to the admin.operations tab area. |
rolePresets | { match: { role, except? } | { plan }, teamRole }[] | [] | The mapping rules the presets add to an operation. The app names its own roles. |
defaultTeamKind | string | default | The kind of the "Crew" team created for an operation without teams. |
phoneField | string | phone | The key of the form field that holds the phone number. |
rolePresets are owner-wide mapping rules: a global role or a plan, and the team role it gives on every team of
an operation that has presets. None ship with the module. A role match covers the roles that inherit it too; except
leaves out the holders of other roles, so { role: 'staff', except: ['admin'] } does not make every admin a lead. A plan match only does something when
Subscriptions is installed. A volunteer through a mapping rule is not crew: they do
not take part in the operation.
phoneField names the field the phone number is read from. The number is saved on the user, so shifts and SMS can
reach them, and shown to staff with crew:pii only. A different field key in your form needs this option. It follows
the users rule (parseUserPhone: up to 40 digits, spaces and +-().); a number that breaks it is not saved.
Permissions
Crew registers these permissions with Authorization.
| Name | Flags | Held by default | What it allows |
|---|---|---|---|
crew:apply | implicit | every signed-in user | Apply, see your own status and accept an invite. |
crew:read | implicit | every signed-in user | Read your own crew status, and the crew of the teams you lead (the /api/crew reads). |
crew:manage | admin | Approve, reject and waitlist, move people, edit the settings and revoke invites. | |
crew:pii | sensitive | admin | See emails, phone numbers and the answers of an application. |
crew:invite | session only | admin | Create invite links. |
- Scope: a token may use the named scope
creworcrew:readitself. Either reads your own status, never the staff routes.crew:piiis usable as a scope too. - Why
crew:pii: staff who manage the crew see names and statuses. Emails, phone numbers and answers are personal data, so they sit behind a separate grant. It ends in:pii, socrew:*and*never cover it. Onlyadminholds it by default. - Give the staff permissions to your own roles by naming them in the grant of each role, with
Authorization. The module grants them to
adminonly:nuxt.config.tsimport { defineRoles } from '@frigear-nu/auth/access' export default defineNuxtConfig({ authorization: { roles: defineRoles({ coordinator: { label: 'Coordinator', grant: ['crew:manage', 'crew:invite', 'crew:pii'] }, }), }, }) - Why
crew:inviteis session only: an invite link mints a credential that grants a role. Only a signed-in session creates one. An API token is refused with403 session_required, andcrew:invitecannot even be a token scope. - Policy on
crew:read: a crew member is readable by the person, by the leads of their team (the ladder's lead role and up, fromisTeamLeadof Teams) and by callers withcrew:manage. The record is a membership ({ userId, teamId }). Anyone else gets403.
Server
Everything under /api is in the Routes section. This section covers how the crew works.
Applying
An application is a submission of the operation's form. Crew listens to forms:submitted and registers the person from
the submission's user id, so the form must ask for a signed-in user and store its submissions. Saving the settings
refuses a form that does not, and a form another operation recruits with.
A new application is a row of team_members on the operation's default team, with the team's lowest role and a
crew status of applied. It exists, and shows in the team for staff, but the person holds nothing: Teams gives a role
only to a row whose status is null or active, and an applicant's is pending.
- One person, one row. Applying again leaves the application as it is. A withdrawn application reopens as the same row. A rejected one stays rejected: only staff change that.
- No application is taken before
opensAt, fromclosesAt, when the form is not published, or when the operation is wrapped up or archived. The apply page does not show the form then. A submission made anyway through the forms API is stored by Forms, but no crew row is created. - Private operations take applications only from people who may read them (
operations:read: they take part, or holdoperations:manage). For anybody else the apply route answers404, so the operation's name and form do not leak, and a form submission registers nobody. - Redelivery is safe. A submission that is stored on a crew row already, or is older than the person's last decision, registers nothing, so redelivering it from Forms' admin does not reopen a withdrawn application or send a second email. The phone number is saved only when an application registered somebody (a new row, or a reopened one).
- The language of the application is stored on the crew row. Emails to the person use their own language
(
users.localeof Users), and the crew row's when they have none; English only when neither is set. - People already on a team of the operation (added by hand in Teams) are not registered again.
- The phone number in the
phonefield (phoneField) is saved on the user.
Statuses
| Crew status | Teams status | Holds the role | How a person gets there |
|---|---|---|---|
applied | pending | no | Applying. |
waitlisted | pending | no | Applying over the capacity, or staff. |
approved | active | yes | Staff, a promotion off the waiting list, or an invite. |
rejected | inactive | no | Staff. |
withdrawn | inactive | no | Staff, for a person who stepped down. Volunteers cannot withdraw themselves: they contact their coordinator. |
Staff move a person from applied to any of approved, rejected, waitlisted and withdrawn, from waitlisted to
approved, rejected or withdrawn, from approved to rejected, waitlisted or withdrawn, and from rejected to approved or
waitlisted. A withdrawn person has left: staff cannot move them, and they come back by applying again (or staff add
them). Asking for the status a person has is a no-op.
Any other move is 409 crew_invalid_transition.
Every change is a conditional update on the status that was read. When two requests race (a double click, an approval against a withdrawal), the loser changes nothing: it gets the current row back and fires no hook and sends no email. Staff approval does not check the capacity, and neither does an invite: both may take the crew past it.
Approving may also set the team (a team of the same operation) and the role (on that team's ladder). Staff can move an approved person to another team or role without changing the status.
Adding people directly
Staff with crew:manage add someone to the crew without an application: POST /api/admin/crew/operations/:operationId/members with { userId, teamId?, role? } (crewApi.admin.addMember). The person
is approved at once, on the given team and role, else on the default team with the lowest role of its ladder. They get the
usual approval message (notifyUser on the crew.status topic), and crew:member:approved and the teams hooks fire.
- Somebody with no crew row in the operation gets a new one:
201. - A withdrawn or rejected person's row is reused and approved:
200, the sameid. - A person who is
applied,waitlistedorapprovedis a409 conflictwithdata.statusanddata.memberId; approve or move them instead. Someone on a team of the operation through Teams is a409withstatus: null. - An unknown user is a
400; an unknown operation a404, after the401/403checks.
Like a staff approval, adding does not check the capacity.
Capacity and the waiting list
An operation may have a capacity: how many approved people it needs. Once the approved crew reaches it, a new
application is waitlisted instead of applied, with the next place on the list, when the waiting list is on. With the
list off it stays applied. Staff can approve beyond the capacity.
When a place frees up (an approved person is marked withdrawn or is rejected, or the capacity is raised) Crew promotes people off the waiting list until the capacity is reached again, as if staff had approved them: the same hooks and the same email. They go in the order they joined the list (then by when they applied), or, with Earlier crew first, earlier crew first.
Promotions are safe to run at once. Each candidate is claimed with a conditional update and the count is checked again after the claim: a claim that overfilled the crew is put back, and the promotion reads the count again, so two requests that both put theirs back still fill the free place.
Only people the full crew waitlisted are promoted. Staff waitlisting is sticky: a person staff put on the list, whether
an applicant or an approved person they demoted, stays there until staff move them (waitlistReason is manual, as
against capacity). Each promotion is claimed with a conditional update and the capacity is checked again after the
claim, so several places freeing at once cannot overfill the crew.
Earlier crew
A person is earlier crew when they are approved in an operation that started before this one. The staff list shows it,
filters by it (?previous=true) and sorts by it, and it is a previousCrew field of the member. It reads the crew
rows, there is no separate score. A person who withdrew or was rejected after being approved is not earlier crew.
Invites
An invite is a link for a team of the operation and a role of its ladder: pick a lead role, such as lead, to invite
someone as a lead. It has a number of uses (1 by default) and expires after 30 days unless staff pick another date
(CREW_INVITE_DEFAULT_DAYS).
- The token is shown once, when the invite is created. The database keeps its SHA-256 hash and the first characters.
- Opening the link changes nothing. The person signs in and presses Join the crew, which calls
POST /api/crew/invites/:token/accept. - A use is claimed atomically:
uses < maxUses, not revoked, not expired. A one-use link adds exactly one person, even when two open it at once. The other gets410. - An operation that wrapped up, was archived or is past its
endsAttakes nobody through a link:410 invite_unavailable, and no use is spent. - Accepting adds the person as
approvedwith the invite's role. A person who is waiting or withdrew is moved onto the team on their existing row. Somebody approved anywhere in the operation, or holding a role there through Teams, gets409 crew_already_member, and a rejected applicant gets409 crew_rejected: staff's decision wins. No use is spent in either case. - When the invite fills a row on its own team and the person had a crew row on another team too, that older row is withdrawn. Wherever Crew reads "the" crew row of a person (the apply page, a new application), a live row wins over a withdrawn one.
- The use is given back only when writing the membership fails. A hook listener that throws afterwards does not give it back, since the person is on the team.
- The email goes out in the person's language (
users.locale), else the language of the request that accepted the invite. - Revoking an invite stops the link. People who joined with it stay.
Role presets
When the settings of an operation are saved for the first time with Role presets on (the default), Crew adds
owner-wide team_role_mappings rows for the operation, one per entry of the rolePresets option (none by default).
They are mapped grants: resolved when read, never stored per person, and an explicit membership always beats them. A
preset is skipped when the operation has a rule for the same role or plan already (whatever its team role or except) and when its role is on
no ladder. Presets are added once, and the choice is recorded in presets: later saves never add presets, and turning
them off removes nothing. Staff edit or delete the rules in Teams, and a rule they removed is not added back.
default ladder
(member, lead) and the default defaultTeamKind. An approved applicant starts as member on the default team. With
the rolePresets of the setup above ("a global staff is a lead" and "a subscriber of the yearly plan is a
member"), those people hold the role on every team of the operation without being added. An invite link with the role
lead puts a person on one team as its lead.Default team
The first save of an operation's settings creates a team called "Crew" (the defaultTeamKind option, teams' default
kind unless set) owned by the operation, when the operation has no team. Applications land on the default team, which
the settings let staff choose. Without a choice it is the operation's first team. Staff then move people to other teams.
Emails
When a status changes, the person gets an email through Notify's notifyUser, from
the template crew-status-<status> (applied, waitlisted, approved, rejected,
withdrawn). The templates are plain Vue files in src/runtime/emails, so a host overrides one by shipping a template
of the same name when Email Templates is installed. Without it the notification
goes out as built, with an HTML body and a plain text one.
The links in the emails use the configured site URL (NUXT_PUBLIC_SITE_URL, as Auth's emailed links do) and fall back
to the request's origin only when none is set. Each operation can turn an email off, or rewrite its subject and message, under Settings or statusEmails of the
settings API. Texts may be a plain string or per language, and may use {{name}}, {{operation}}, {{team}}, {{role}}
and {{status}}. A failing email is logged and never fails the change. No SMS is sent.
Everything is written in the person's language (users.locale, else the language of the application): the built-in
subjects and messages, the {{status}} label, the greeting and the template's heading and button are Danish for da
(da-DK too) and English otherwise; the templates take greeting, heading and button as props, with the English
texts as defaults. An operation's own texts are picked in that language too. The link goes to the status page, or to the
My crew tab of the home page when there is none (/dashboard/crew?tab=status), and carries the locale prefix of the
site's routes (the @nuxtjs/i18n strategy and default locale Crew records at build time), so a person reading English on
a Danish-first site lands on /en/dashboard/crew?tab=status.
An application, a promotion off the waiting list and an invite each send the email of the status they end in: someone who lands on the waiting list gets the waiting list email, not both.
Push
Crew registers the topic crew.status with Notify (email and push on
by default, SMS is not offered) and sends the status message through notifyUser, so a person can turn the email or the
push off on the account page of Preferences. The email goes to the
user's own address. The push notification says the email's subject and message and opens the status page; it reaches
phones with Push installed. An operation that turns a status email off sends neither. A
person without an email address still gets the push: Notify skips the email channel for them.
Who takes part
Crew answers Operations' two participation hooks from a server plugin it always registers:
operations:participation:resolve: the operations a person takes part in.operations:participants:resolve: the people who take part in any of the operations asked for, in queries under D1's bound parameter limit.
A person takes part when their membership on a team the operation owns grants (status null or active): approved
crew, and members added by hand in Teams. Applied, waitlisted, rejected and withdrawn people do not take part, and a
mapped team role never makes anyone take part. That is what fills GET /api/operations/me, the operations:read
policy and the operation grant kind of Auth's record audiences. Crew identifies the user from ctx.user,
and a failure adds nobody, never more.
Photo opt-outs
People choose on their profile whether they may be photographed as the main subject and tagged online (the media opt-outs of Users). Crew passes them on to the people who plan photos and posts:
- Crew rows.
CrewMemberDtocarriesnickname,photoOptOutandtagOptOut, for staff and for team leads. The Crew tab shows No photos and No tagging badges next to the name ("Name (nickname)"), and the member slideover shows both choices. - Export.
GET /api/admin/crew/operations/:operationId/media-opt-outs(crewApi.admin.mediaOptOuts) answers a CSV of everyone who takes part and opted out of either, one row per person, by name. It needscrew:manageon the operation andcrew:pii, since it lists names, emails and photos. The Crew tab's Export photo opt-outs button downloads it for callers withcrew:pii.
The CSV is UTF-8 with a byte order mark and CRLF line ends. Its columns are
name,nickname,email,avatar_url,photo_opt_out,tag_opt_out,team. The opt-outs are true or false, and the teams of a
person on several are joined with ; . Team names are in the ?locale= language (else the request's). A cell that
starts with =, +, - or @ gets a leading ', so a spreadsheet does not run it as a formula.
Team hooks
Teams fires teams:member:* from its own admin routes only, once per row change. When Crew changes rows it fires them
itself, with the same payloads, but they follow the grant instead of the row: teams:member:added when a person starts to hold a role (approved), teams:member:removed
when they stop, teams:member:role-changed when an approved person's role changes, and removed then added when an approved
person moves to another team. An applicant row has no grant, so it fires nothing in Teams; the crew hooks tell the story.
Dashboard item
Crew adds crew.status to crew.home and the hub's dashboard (permission
crew:read, order 10, two columns wide): where the person applied or works, with a status badge, team and role, and a link to My crew
(useCrewLinks().status()). It reads GET /api/crew/me, shows applications still in play first, and an empty state when the person
has not applied. Texts are under crew.dashboard.
App
Pages
| Page | Path | For |
|---|---|---|
| Home | /dashboard/crew | A signed-in crew member. The crew.dashboard tabs, the active one in ?tab=: Overview (the default, left out of the URL), the crew.home dashboard with every installed module's items the person may see, in their own order; My crew (status), the status below. |
| Apply | /crew/apply/:operationSlug | A signed-in volunteer. Renders the operation's form, or says why there is none: not open yet, closed, already applied, rejected, already on a team. Signed-out visitors go to the sign-in page and back. |
| Status | the My crew tab; /crew/status without the hub | A signed-in volunteer. Each operation they applied to or work at, with status, team and role, Apply again after a withdrawal, and the line "Need to step down? Contact your coordinator.": volunteers do not withdraw themselves. |
| Invite | /crew/invite/:token | A signed-in person with an invite link. The page changes nothing until they press Join. |
The apply, status and invite pages are public routes (anonymous visitors see the sign-in page) and need @nuxt/ui.
The home page is for signed-in people: crew guards it with guardPages, which
Authorization enforces. Each dashboard item and tab checks
its own permission. Below the hub the home page is an app page in the hub's dashboard layout; elsewhere it is a page of
the site.
In the hub, the old paths answer with a 302 to their tab (/crew to /dashboard/crew, /crew/status to
/dashboard/crew?tab=status; addPageRedirects of Module Kit). A page option set to a path keeps a page there. With
Mobile the pages stay (the redirects are left out): the Crew tab of the tab bar opens the
home page in the hub, with My crew and Shifts' My shifts and Swaps as its tabs, and the dashboard's Home tab renders
crew.home at /crew.
Tabs of the home page
The home page renders the Widget tab area crew.dashboard. Crew adds overview (order 0)
and status (10, crew:read), Shifts adds shifts (20) and swaps (30). A module adds
its own from setup(); the tab component reads what it needs itself:
import { extendTabs } from '@frigear-nu/widget/utils'
extendTabs(nuxt, 'crew.dashboard', {
id: 'trainings',
component: resolver.resolve('./runtime/app/tabs/MyTrainings.vue'),
label: 'Trainings',
labelKey: 'trainings.home.tab',
icon: 'i-lucide-graduation-cap',
order: 40,
permission: 'trainings:read',
})
Link to a tab with useCrewLinks().home('trainings') (/dashboard/crew?tab=trainings). A tab renders inside the page,
so it brings no heading: use SectionCard, ListCard or TableCard, a skeleton while its data loads and UEmpty when
there is nothing.
Tab on the operation page
Crew adds a Crew tab to the admin.operations tab area of Widget, before the Teams tab.
It reads the operation's record from the tab context and shows:
- Applications and crew: a table with filters (status, team, earlier crew) and search, sortable columns, row selection
with Approve selected, No photos and No tagging badges, Export photo opt-outs (with
crew:pii, see Photo opt-outs), and a row menu: Open application, Approve application, Move to waiting list, Reject application (confirms first). Opening a person shows their details, a form for team and role, and withcrew:piitheir application's answers. - Add crew member (the primary action of the table) opens a slideover with the shared
UserPickerand the team and role. The picker searches through crew's ownGET /api/admin/crew/users(crew:manage; emails, and matching on them, only withcrew:pii), so staff need nousers:list. Withusers:createits Create user adds someone who has no account. A person who is in the crew already is shown in the slideover with their status, not added. - Invite links: a table with a status per link. Create invite opens a slideover and shows the link once, with a copy button. A link is revoked from its row menu, with a confirmation.
- Settings: the form (only forms the operation can use are offered), default team, capacity, waiting list, earlier crew
first, the window, role presets (fixed once the settings exist) and the status emails. The tab reads what the caller may
do from
GET /api/auth/me/access, so the application's answers show only withcrew:pii.
Turn it off with settings.operationsTab: false.
Add to crew from the inbox
With Inbox, crew fills the inbox.thread.actions slot of the thread page (by name: crew
does not depend on inbox) with an Add to crew button, for staff with crew:manage. It opens the same slideover with a
choice of operation (planning or active ones; the list needs operations:manage):
- a contact with an account (a verified sender,
contact.userId) is preselected; - otherwise the slideover offers Create user prefilled with the contact's name, email and phone (the details need
inbox:pii), and the created user is selected. A taken email offers that user instead.
The addition sends inboxThreadId, and the route fires inbox:thread:linked: the thread's audit trail shows "Linked:
Composables
| Composable | What it does |
|---|---|
useCrewActions() | add (the "Add crew member" slideover; without an operation id it asks for one), approve, reject, waitlist, approveMany, open, createInvite, revokeInvite and menu(member, options), with toasts and confirmations. |
useCrewLinks() | Locale-aware links to the home page and its tabs (home(tab?)), apply, My crew (status(): the page, or the tab) and invite. |
useCrewTranslate() | Reads a translated text in the current locale. |
Hooks
Your app answers these Nitro hooks from a server plugin (server/plugins/*.ts).
| Hook | When | Payload |
|---|---|---|
crew:member:applied | After somebody applied, or applied again after withdrawing. | { event, operationId, member } |
crew:member:approved | After somebody joined: approved by staff, promoted or through an invite. | { event, operationId, member } |
crew:member:rejected | After an application was rejected, or an approved person was taken off. | { event, operationId, member } |
crew:member:waitlisted | After somebody is on the waiting list, over the capacity or by staff. | { event, operationId, member } |
crew:member:withdrawn | After staff marked somebody withdrawn. | { event, operationId, member } |
memberis the staff DTO with the email and phone number, whatever the caller may see, so a listener that forwards it decides what to share.- Somebody who lands on the waiting list fires
crew:member:appliedand thencrew:member:waitlisted. - Crew also listens to
forms:submittedand answersoperations:participation:resolveandoperations:participants:resolve.
Routes
Typed path builders are exported as crewApi from @frigear-nu/crew/api.
| Route | Who | What it does |
|---|---|---|
GET /api/crew/me | crew:read | Your crew status in every operation: your crew rows in any status, and the places teams staff added you to (source: 'teams', shown as approved). Who takes part follows one rule (crewTakesPart): a membership that grants, plain or an approved crew row. |
GET /api/crew/operations/:operation/apply | crew:apply | The form slug to render, or the reason not. :operation is the id or the URL name. 404 for a private operation the caller may not read. |
GET /api/crew/operations/:operation/members | crew:read | The crew as the caller may read it, paginated like the staff list. Staff read all; team leads their own teams; others an empty page. |
GET /api/crew/members/:id | crew:read + policy | One crew member: yourself, a lead of the team, or staff. |
POST /api/crew/invites/:token/accept | crew:apply | Join the invite's team. 404, 410 invite_revoked, invite_expired, invite_used, invite_unavailable (the team is gone, or the operation wrapped up, was archived or ended), or 409 crew_already_member. |
GET /api/admin/crew/operations/:operationId/settings | crew:manage | The settings, or the defaults (source: 'default'). |
PUT /api/admin/crew/operations/:operationId/settings | crew:manage | Save the whole record. Creates the default team and presets. 400 for an unsuitable form, 409 for a form in use. |
GET /api/admin/crew/forms | crew:manage | The forms an operation can recruit with: asking for a signed-in user, storing submissions, not used by another operation (?operationId= keeps its own). |
GET /api/admin/crew/operations/:operationId/members | crew:manage | The whole crew, paginated, with status, team, previous, q, sort, order. |
POST /api/admin/crew/operations/:operationId/members | crew:manage | Add { userId, teamId?, role?, inboxThreadId? }, approved at once: 201, or 200 when a withdrawn or rejected row is reused. 409 with data.status for someone applied, waitlisted or approved. |
GET /api/admin/crew/users | crew:manage | Users to add (?q=, at most 20): { id, name, avatar, email? }, matching emails and answering them only with crew:pii. |
POST /api/admin/crew/operations/:operationId/members/approve | crew:manage | Approve { ids } (up to 200). People that cannot be approved come back in skipped. |
PATCH /api/admin/crew/members/:id | crew:manage | Move to { teamId?, role? }. 409 when the person is on that team already (also when they were added there meanwhile). |
POST /api/admin/crew/members/:id/approve | crew:manage | Approve, optionally { teamId, role }. |
POST /api/admin/crew/members/:id/reject | crew:manage | Reject. |
POST /api/admin/crew/members/:id/withdraw | crew:manage | Mark a person who stepped down as withdrawn (the withdrawn email goes out). |
POST /api/admin/crew/members/:id/waitlist | crew:manage | Put on the waiting list. |
GET /api/admin/crew/members/:id/submission | crew:pii | The application's answers, with the form's labels. |
GET /api/admin/crew/operations/:operationId/media-opt-outs | crew:manage + crew:pii | A CSV of the people taking part who opted out of photos or tagging (?locale= for team names). See Photo opt-outs. |
GET /api/admin/crew/operations/:operationId/invites | crew:manage | The invite links, never their tokens. |
POST /api/admin/crew/operations/:operationId/invites | crew:invite | Create { teamId, role, maxUses?, expiresAt? }. Without expiresAt the link expires in 30 days. The token is in this answer only. |
DELETE /api/admin/crew/invites/:id | crew:manage | Revoke. |
Emails, phone numbers and the email search need crew:pii; without it the member has neither field. Reads that leads and
volunteers make live under /api/crew; /api/admin/crew is for staff.
Database
Tables or columns the module adds. Generate and commit a migration after installing.
| Table | Holds |
|---|---|
crew_settings | One row per operation: operationId, formId, defaultTeamId, capacity, waitlist, previousCrewFirst, opensAt, closesAt, statusEmails (json), presets. |
crew_invites | civ_ id, operationId, teamId, role, tokenHash (unique), prefix, maxUses, uses, expiresAt, createdBy, revokedAt. |
team_members (columns added) | crewStatus, appliedAt, decidedAt, decidedBy, submissionId, waitlistPosition, waitlistReason (capacity or manual), locale. A row with a crewStatus is a crew membership; rows added by hand in Teams have none. submissionId and crewStatus are indexed (team_member_submission_idx, team_member_crew_status_idx), declared in Crew's extension file. |
Operation, team and user ids carry no foreign key: those tables belong to other modules. The extension file is
team-members, with a .postgresql.ts twin. The phone number from an application is stored on users.phone, which
Users owns.
Translations
Override any string in your app's i18n/locales/<code>.json. The module registers da and en files under crew.*.
See overriding module strings.
Key groups: menu.*, home.* (with home.tabs.*), mobile.*, permissions.*, scopes.*, admin.* (with admin.tabs.*, admin.statuses.* and
admin.inviteStatuses.*), apply.*, status.* and invite.*. The email texts are per operation data, or the
templates.
Next steps
- Shifts – the shifts approved crew work.
- Teams – the memberships and mapping rules crew is built on.
- Operations – the occasions a crew works at.
Operations
The occasions your organisation works at, such as a festival bar, with a period, a place and a status, for crew, shifts and maps to attach to.
Shifts
Schedules, shift roles, assignment, swaps, check-in by pass, station or location, reminders, a calendar feed, broadcasts and earned perks, per operation, built on crew and teams.