Skip to main content

Like Groups API

Planned

This module is not yet shipped. The shape below describes the intended endpoints on the new Hono + Supabase + Drizzle stack.

A like group is how users apply to attend an event. The group is formed by one user (the creator) plus optional friends. Once enough event authors approve the group, the group is approved and a private chat is created for the participants.

See also: Approval algorithm, Like-groups model.

All endpoints require Authorization: Bearer <supabase-access-token>.

Endpoints

MethodPathDescription
GET/groupsList my groups (as creator or member)
GET/groups/:idGet a group
POST/groups/:id/membersAdd a friend to the group
DELETE/groups/:id/members/:userIdRemove a member
GET/groups/:id/approvalsList approvals for the group
POST/groups/:id/approveApprove the group (event author only)
POST/groups/:id/rejectReject the group (event author only)

Group creation happens via POST /events/:id/like.

Get group

GET /groups/:id
Authorization: Bearer <token>
{
"id": "uuid",
"eventId": "uuid",
"creatorId": "uuid",
"status": "pending",
"memberIds": ["uuid", "uuid"],
"createdAt": "2026-04-01T00:00:00Z"
}

Visibility: members of the group, the event creator, and event authors.

Manage members

POST /groups/:id/members
{ "userId": "friend-uuid" }

Rules:

  • Caller must be the group creator.
  • The user being added must be a friend of the group creator.
  • The user must not already be in another pending group for the same event.
  • Group is in pending (cannot mutate after approved / rejected).
LimitValue
Members per group10 (including creator)
DELETE /groups/:id/members/:userId

Removing members before approval recalculates the approval threshold; existing approvals still count. See Approval algorithm → edge cases.

Approvals

GET /groups/:id/approvals
[
{
"id": "uuid",
"groupId": "uuid",
"authorId": "uuid",
"approved": true,
"createdAt": "2026-04-01T00:00:00Z"
}
]
POST /groups/:id/approve
POST /groups/:id/reject

Authorization: caller must be a current author of the group's event.

Approve — side effects

When approvals_received >= min(authors_count, members_count):

  1. Group status → approved.
  2. A chat of type approved_group is created with all members + all authors as participants.
  3. A notification of type group_approved is fanned out to members (in-DB row + Supabase Realtime broadcast).
{
"id": "group-uuid",
"status": "approved",
"chatId": "new-chat-uuid"
}

Reject

A single author rejection sets status → rejected. No chat is created.

Errors

StatusReason
400Group not in pending state
403Caller is not group creator / event author / member
404Group not found
409Member already in another pending group for this event

Implementation notes

  • The threshold formula min(authors_count, members_count) lives in the service layer (src/feats/groups/groups.service.ts); see Approval algorithm for the rationale.
  • Group lifecycle and chat creation are wrapped in a single Drizzle transaction so partial state cannot escape.
  • Real-time updates use the group:{groupId} Supabase Realtime channel.