Skip to content

First-class managed_club marker (server-scoped, forward-compatible to per-user) #101

Description

@Sootopolis

Problem

CCAS has no first-class representation of "a club the user manages". The club table holds many clubs — most are scouted/opponent/recruited-from clubs ingested incidentally, not clubs the user runs CCAS for. Today the only way to tell them apart is leaky side-effect signals (e.g. "has a recruitment_alias" or "has a membership_run"), which conflate management with having run a job once — reconciling an opponent club's roster to scout it would falsely mark it managed.

This bites any feature that must act on "my clubs" rather than "all known clubs" — directly surfaced while rescoping #45 (default scheduled jobs), where seeding History/Membership for all clubs would blow up the DB.

Proposal

Introduce a minimal, first-class managed-club marker:

  • New table managed_club (club_id BIGINT PRIMARY KEY REFERENCES club(club_id) ON DELETE RESTRICT) (preferred over a club.managed boolean — keeps lifecycle concerns out of the club row and extends cleanly).
  • Server-scoped for now (single-user v0, Epic: CLI v0 (Phase 1) #40). Forward-compatible to per-user: when auth lands (Backend auth, authz & abuse defenses (Phase 2 server hardening) #66) the PK becomes (user_id, club_id) and the existing rows migrate to the bootstrap user.
  • A club becomes managed by an explicit act, never derived — candidates: a new ccas manage <slug> command, on first recruitment-criteria set, and/or via CLI club-context: current_club + ccas use <slug> #86's ccas use <slug>. (Pick the trigger(s) as part of this issue.)
  • Club/new ManagedClub companion: createTable, selectAll/selectIds, markManaged(clubId), unmanage(clubId), isManaged(clubId).

Uses

  • A non-leaky source for per-managed-club scheduling (blocks #B / per-managed-club History+Membership seeding).
  • A validation hook for ScheduleRoutes ("only schedule per-club jobs for managed clubs").

Out of scope

Relationship

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:dbSchema, SQL, migrations, Magnumarea:serverBackend HTTP server, jobs, schedulerenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions