Skip to content

Conversation

@jakubno
Copy link
Member

@jakubno jakubno commented Oct 10, 2025

  • Add addons table
  • Simplifies types for team, moves the querying to db and types to dedicated module, limits the usage of generated types

Note

Adds an addons table and shifts limit enforcement from Tier to aggregated TeamLimits across DB queries, types, auth cache, handlers, orchestrator, and template flows.

  • Database:
    • Add public.addons table with RLS and indexes; create team_limits view aggregating tier + active addons.
    • Replace tier-based queries with team_limits joins; update SQLc code; remove old tier queries/files.
  • Types:
    • Introduce internal/db/types: Team, TeamLimits, TeamWithDefault and constructors.
    • API now passes *types.Team (with Limits) instead of queries.Team/Tier pairs.
  • Auth/Cache:
    • Auth cache stores and returns *types.Team; validation function signatures updated.
  • Handlers/Orchestrator:
    • All endpoints use *types.Team; enforce limits via team.Limits (concurrency, max hours, vCPU/RAM/disk).
    • Rename helpers: GetTeamAndTier -> GetTeamAndLimits; analytics/telemetry use new team fields.
  • Template builds:
    • Concurrency gating uses Team.Limits.BuildConcurrency; resource limiting uses team.Limits.
  • Models (ent):
    • Remove Tier model/edges and related generated code; adjust Team schema/edges accordingly.

Written by Cursor Bugbot for commit c3661de. This will update automatically on new commits. Configure here.

@jakubno jakubno added the improvement Improvement for current functionality label Oct 10, 2025
@linear
Copy link

linear bot commented Oct 10, 2025

@jakubno jakubno force-pushed the refactor-api-to-use-the-new-add-ons-table-eng-3069 branch 5 times, most recently from 61c521c to dd8cc31 Compare October 13, 2025 08:21
@jakubno jakubno marked this pull request as ready for review October 13, 2025 09:53
@sitole sitole self-assigned this Oct 13, 2025
cursor[bot]

This comment was marked as outdated.

@jakubno jakubno force-pushed the refactor-api-to-use-the-new-add-ons-table-eng-3069 branch from a006852 to bd08a5e Compare October 15, 2025 08:38
ctx := c.Request.Context()

teams, err := a.sqlcDB.GetTeamsWithUsersTeamsWithTier(ctx, userID)
teams, err := dbapi.GetTeamByUser(ctx, a.sqlcDB, userID)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GetTeamByUser -> GetTeamsByUser

@jakubno jakubno force-pushed the refactor-api-to-use-the-new-add-ons-table-eng-3069 branch from bd08a5e to 36351ab Compare October 15, 2025 11:46
@jakubno jakubno requested a review from sitole October 15, 2025 11:47
cursor[bot]

This comment was marked as outdated.

@jakubno jakubno merged commit e558137 into main Oct 16, 2025
27 checks passed
@jakubno jakubno deleted the refactor-api-to-use-the-new-add-ons-table-eng-3069 branch October 16, 2025 12:07
Code42Cate pushed a commit that referenced this pull request Oct 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement Improvement for current functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants