Skip to content
Docs

Command palette

Jump to a page or view, or find a todo by name.

Changelog

Team Trips

A professor creates a Team Trip (Caravana) for one event, shares a personal invite link or QR code, and sees who is going; athletes join with an account and choose what they show.

Markdown

What it does

A Team Trip is a server-side group of people going to one Event together, owned by one Organization: an Academy's, or the organizer's personal one. Creating one needs Pro, the owner or admin Org role in the owning Organization and a 16+ confirmation (the creator becomes its organizer, a member); joining is free and needs the optional account and the same confirmation. Joining never makes the athlete a Member of the Organization. Visibility follows Trip Membership, not the Active Organization (ADR-0023). The product spec is docs/bjj-journey/specs/team-trips.md. Everything is behind the team.trips flag: the apps hide the UI, and every procedure below, preview included, first checks the flag on the server (on for any platform opens it) and fails with TeamTripsUnavailable, mapped to NOT_FOUND "Team Trips are not available.". The web invite and join pages then show a neutral "not available".

Each Trip Member has a personal Invite Link https://<web domain>/t/<code>; joins through an organizer's link are in at once, joins through a member's link wait for approval (the organizer can switch to "everyone needs approval" or "anyone with a link"). Shared Fields (visible to the group, belt, division) are off by default; each grant and withdrawal is logged in team_trip_consent.

Procedures

ProcedureWhoFailures
teamTrips.createowner/admin of the named organizationId ("Me" or a registered Academy), with ProFORBIDDEN (role, no Pro), BAD_REQUEST (under 16), NOT_FOUND (unknown catalogue event)
teamTrips.get, teamTrips.listMineTrip Members (joined or pending), owning adminsNOT_FOUND
teamTrips.updateorganizers and co-organizers, owning adminsFORBIDDEN
teamTrips.ensureInviteorganizers; members while member invites are onFORBIDDEN, CONFLICT (ended)
teamTrips.previewanyone, no session (system read team-trips.invite-preview)— (state: not_found); NOT_FOUND only when the flag is off
teamTrips.joinsigned-in User with a codeBAD_REQUEST (under 16), NOT_FOUND (revoked), CONFLICT (ended), FORBIDDEN (blocked)
teamTrips.updateAttendance, teamTrips.updateSharethe member, on their own rowNOT_FOUND
teamTrips.rosterorganizers and admins (dashboard); joined members (totals and visible names)FORBIDDEN
teamTrips.approveMember, teamTrips.declineMemberorganizers, owning adminsFORBIDDEN, NOT_FOUND
teamTrips.noticesjoined members, owning admins (pending members see none)FORBIDDEN
teamTrips.postNotice, editNotice, deleteNoticeorganizers and co-organizers, owning adminsFORBIDDEN, TOO_MANY_REQUESTS (5 a day, 15 a week), CONFLICT (read-only)
teamTrips.ackNotice, updateNoticeSettingsthe member (Got it; lock-screen text opt-in, mute)FORBIDDEN (no Got it asked), NOT_FOUND
teamTrips.setRole, transferOrganizer, archivethe organizer, owning admins (transfer is the system write team-trips.organizer)FORBIDDEN, CONFLICT (read-only)
teamTrips.removeMember (block), unblockMemberorganizers and co-organizers (a co-organizer never removes the organizer or another co-organizer)FORBIDDEN, NOT_FOUND
teamTrips.leavethe memberCONFLICT with data.reason: organizer_must_transfer for the organizer
teamTrips.revokeAllInvitesorganizers and co-organizers, owning adminsFORBIDDEN
teamTrips.reportanyone in the trip (one open report per User)NOT_FOUND
teamTrips.overviewtrips the User organizes or administers as Academy owner/admin; organizationId narrows to oneFORBIDDEN (not owner/admin of the named Academy)
teamTrips.exportMineany signed-in User (not behind the flag)—
admin.teamTrips.reports, resolveReportplatform admins (adminProcedure, system "admin"); web view /admin/trip-reportsFORBIDDEN

join also refuses with CONFLICT data.reason: trip_full (300 joined or pending members) and TOO_MANY_REQUESTS (20 joins through one link in an hour). Both caps are checked and spent in one system transaction (team-trips.join) that locks the trip row, so concurrent joins cannot pass them; the link's count lives on the invite (join_window_start, join_window_count), so leaving does not give a join back. postNotice counts and inserts under the same row lock as the tenant. overview filters managed trips in SQL before its limit of 100, and its totals cover every active managed trip.

Data and isolation

Tables team_trip, team_trip_member, team_trip_invite, team_trip_consent, team_trip_notice, team_trip_notice_ack and team_trip_report have row-level security; their policies use the SECURITY DEFINER helpers app.trip_state, app.trip_role, app.trip_inviter, app.org_admin, app.trip_admin and app.trip_counts from rls-baseline.mjs. The service projects columns per Trip Role. Invite codes are derived (HMAC of the invite id); only their SHA-256 is stored. A link expires 7 days after the event's end (a custom event with only a start: its start); an undated custom event's links do not expire. team-trips.rls.test.ts runs in test:rls-matrix.

Notices and push (US-46)

Posting marks the notice push_pending; the cron tick's teamTrips job (team-trips.jobs.ts) fans it out into push_delivery rows (column trip_notice_id) for every device of a joined, unmuted member other than the author, addressed per User. The existing push job sends them through the Expo transport; at send time it re-checks the membership and builds the text in the member's language with noticePush (team-trips.rules.ts): neutral ("Curitiba trip" · "Transport update") unless the member turned on "show notice text on lock screen" for that trip. With PUSH_ENABLED off the fan-out marks notices done without deliveries, so old notices are never sent later. Tests drive the transport with a fake fetch (team-trips.s9.test.ts). The app shows a trip-notice banner in the foreground and opens team-trip/<id>?notice=<id> on tap. A notice's time is the event's wall clock: sent with a zero offset and always shown in UTC; the app offers any day from the trip's creation through the event's last day. Editing a notice re-pushes it only when it is pinned and the organizer turns "notify again" on (off by default). "Got it" is offered to every joined member the notice asks, organizers included, except its author (byMe).

The same job queues two more neutral pushes (push_delivery.trip_id and trip_push): the hourly approvals batch to joined, unmuted organizers and co-organizers when someone joined pending since the last batch ("Curitiba trip · 2 people waiting for approval", opens the roster), and the nudge to joined, unmuted members without an Attendance in the 7 days before the next price rise, else the event's first day ("Curitiba trip · Are you going?", opens the trip), at most one per trip per week. The push job drops either one at send time when nobody is pending any more or the member has answered.

Roles, leaving and retention (US-47, US-48)

Policies let nobody write an organizer row; transferring is the reviewed system write team-trips.organizer. Leaving or removal deletes the member row at once; acknowledgements cascade from it (composite foreign key); consent rows stay until the account is deleted. Blocking keeps an empty blocked row. The cron job hands a trip over when its organizer row is gone (oldest co-organizer, else the Academy's oldest owner/admin, else read-only with a system notice), ends trips after the event, archives them 30 days later (freezing aggregate counts in team_trip.summary and purging seat, bed, companions and registered) and deletes notices 90 days after the event. The full export on the phone adds team-trips.json from exportMine.

Dashboards (US-49, US-50)

/team (D-TeamTrips) sums the active trips the User organizes or administers for an Academy and lists them; /trips/$id (D-TeamTrip) has the tiles, a Bklit belt bar, the roster table with sort, filter and a CSV export (Shared Fields only, the responsibility note on the first line, formulas defused), the invited-by counts, approvals and a notices column. Academy Members who are not admins see none of the Academy's trips. Platform admins review "Report this trip" at /admin/trip-reports: resolve a report, or archive the trip after a confirmation.

Key files

Edit on GitHubDocumentation is in English.
Cookie settings
We use essential cookies to make our app work. With your consent, we also use optional cookies to improve your experience.

Read our Cookie Policy and Privacy Policy.