Groups API

Group creation, listing, detail, and join-code workflows.

Behavior summary

Group routes manage lifecycle and membership. Core rules:

  • Creator becomes OWNER automatically.
  • joinCode is 6-char uppercase alphanumeric.
  • Duplicate membership is blocked by DB uniqueness.
  • Group capacity is bounded by maxMembers.

Endpoints

Creates a group and adds the caller as owner in one transaction.

Body

{
  "name": "Roommates Premium",
  "maxMembers": 6
}

Validation

  • name: string, 1-100 chars
  • maxMembers: integer, 2-10 (default 6)

Success

  • Status: 201
  • Returns newly created group object

Failure cases

  • 401 UNAUTHORIZED
  • 400 VALIDATION_ERROR

Transaction note

POST /api/groups must be atomic. If either group creation or owner membership insertion fails, no partial write should remain.