Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(common): team models #1986

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

feat(common): team models #1986

wants to merge 6 commits into from

Conversation

jonaro00
Copy link
Member

No description provided.

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This PR introduces team management functionality across the codebase, adding models and API support for team-based project organization.

  • Added new team models in common/src/models/team.rs with TeamResponse, TeamMembership, and TeamRole structures
  • Added optional team_id field to ProjectResponse in common/src/models/project.rs to support team-owned projects
  • Modified UserResponse in common/src/models/user.rs to include Auth0 ID documentation and optional flags field

6 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

(updates since last review)

This PR continues to expand the team management functionality with additional features and refinements. Here's what's new:

  • Added AddTeamMemberRequest in common/src/models/team.rs supporting both user ID and email-based invitations
  • Enhanced ProjectUpdateRequest with new fields for team transfers and ownership changes
  • Generated corresponding TypeScript interfaces in common/types.ts for frontend integration

The changes maintain consistency with existing patterns and provide proper documentation. The implementation appears well-structured but should be reviewed for potential validation logic around mutually exclusive operations in project transfers.

4 file(s) reviewed, 5 comment(s)
Edit PR Review Bot Settings | Greptile

pub user_id: Option<String>,
pub email: Option<String>,
/// Role of the user in the team
pub role: Option<TeamRole>,
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Consider making role field required since TeamMembership requires a role. Optional roles could lead to inconsistent states

Comment on lines 78 to 88
pub struct ProjectUpdateRequest {
/// Change display name
pub name: Option<String>,
/// Transfer to other user
pub user_id: Option<String>,
/// Transfer to a team
pub team_id: Option<String>,
/// Transfer away from current team
pub remove_from_team: Option<bool>,
/// Change compute tier
pub compute_tier: Option<ComputeTier>,
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: These fields could create conflicting states if multiple transfer options are set simultaneously (user_id, team_id, and remove_from_team). Consider adding validation or documenting the precedence rules.

Comment on lines +85 to +86
/// Transfer away from current team
pub remove_from_team: Option<bool>,
Copy link
Contributor

Choose a reason for hiding this comment

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

style: remove_from_team field could be redundant since setting team_id to None could achieve the same result. Consider consolidating the team management logic.

user_id?: string;
email?: string;
/** Role of the user in the team */
role?: TeamRole;
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: role field should be required since TeamMembership requires it. Optional role could lead to runtime errors when adding members.

Comment on lines +205 to +207
team_id?: string;
/** Transfer away from current team */
remove_from_team?: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

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

style: team_id and remove_from_team are mutually exclusive - consider using a discriminated union type instead of allowing both to be set

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

(updates since last review)

This PR finalizes the team management implementation with account tier adjustments and permission model changes.

  • Renamed Team account tier to Growth and removed Deployer tier in common/src/models/user.rs
  • Removed has_access_to_beta field from UserResponse as part of permission model cleanup
  • Added team-related fields to ProjectResponse and ProjectUpdateRequest for project ownership management

The changes streamline the permission model by consolidating special access flags and moving towards a role-based system. Consider documenting the migration path for existing users with the Deployer tier.

2 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile

Comment on lines 334 to +335
subscriptions: Subscription[];
has_access_to_beta?: boolean;
flags?: string[];
Copy link
Contributor

Choose a reason for hiding this comment

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

style: consider documenting the purpose and possible values of the new flags field

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant