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

Allow trial team to be manually created #4941

Merged
merged 10 commits into from
Dec 19, 2024
Merged

Conversation

knolleary
Copy link
Member

@knolleary knolleary commented Dec 18, 2024

Part of https://github.com/FlowFuse/CloudProject/issues/600#issuecomment-2549085040

Description

Currently when a user signs up on FFC, they have a Team tier team created in trial mode, with application + instance created.

This is enabled by having the 'Create a personal team for users when they register' option enabled in Admin Settings. Alongside that, the Team Type is configured with trial options.

To improve the onboarding experience with the new Freemium type, we want to offer the user a choice to team type when signing up - as per screenshot linked above.

This means we don't want to auto create the team as we do today when the user completes email verification.

The PR updates the Team Create api endpoint to include a trial flag. If set (and billing enabled etc), the code will now check if this user is allowed to create a new trial team, and if so, does the work to create the trial subscription, and auto create the application/instance.

The rules for whether a user is allowed to create a trial team are:

  1. EE license and billing configured
  2. User has no existing teams
  3. The chosen team type as trial mode set
  4. The user is less than a week old. Essentially, only the first team a user creates should be eligible for trial mode. Rather than add db state over whether a user has ever created a team, this was a pragmatic first iteration. Yes a user could create/delete a trial team multiple times during that week, but that really doesn't give them any advantage.

Due to time pressures, getting this PR raised so we can keep things on track this week. Will work on unit tests in parallel.

Copy link

codecov bot commented Dec 18, 2024

Codecov Report

Attention: Patch coverage is 15.21739% with 39 lines in your changes missing coverage. Please review.

Project coverage is 78.44%. Comparing base (449189a) to head (420c7ae).
Report is 11 commits behind head on main.

Files with missing lines Patch % Lines
forge/routes/api/team.js 9.30% 39 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4941      +/-   ##
==========================================
- Coverage   78.61%   78.44%   -0.18%     
==========================================
  Files         325      325              
  Lines       15311    15353      +42     
  Branches     3518     3529      +11     
==========================================
+ Hits        12037    12043       +6     
- Misses       3274     3310      +36     
Flag Coverage Δ
backend 78.44% <15.21%> (-0.18%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@Steve-Mcl Steve-Mcl left a comment

Choose a reason for hiding this comment

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

Thanks for the talk through Nick

all good here. code review and local pull test, create with/without auto create instance.

@knolleary knolleary merged commit cf9bfbe into main Dec 19, 2024
17 of 18 checks passed
@knolleary knolleary deleted the allow-team-trial-creation branch December 19, 2024 12:44
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.

3 participants