diff --git a/myauth/migrations/0021_update_stripe_stoage_prices.py b/myauth/migrations/0021_update_stripe_storage_prices.py similarity index 98% rename from myauth/migrations/0021_update_stripe_stoage_prices.py rename to myauth/migrations/0021_update_stripe_storage_prices.py index 23da1dbe..bda97442 100644 --- a/myauth/migrations/0021_update_stripe_stoage_prices.py +++ b/myauth/migrations/0021_update_stripe_storage_prices.py @@ -6,7 +6,7 @@ class Migration(migrations.Migration): dependencies = [ - ("myauth", "0014_invite_is_collaborator"), + ("myauth", "0020_auto_20210920_1016"), ] if os.environ.get("DJANGO_SETTINGS_MODULE") == "server.settings.production": diff --git a/myauth/migrations/0022_team_name.py b/myauth/migrations/0022_team_name.py new file mode 100644 index 00000000..d221a4d7 --- /dev/null +++ b/myauth/migrations/0022_team_name.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.4 on 2021-10-14 12:53 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('myauth', '0021_update_stripe_storage_prices'), + ] + + operations = [ + migrations.AddField( + model_name='team', + name='name', + field=models.CharField(default='', max_length=200), + ), + ] diff --git a/myauth/models.py b/myauth/models.py index ac20b9bd..a57c1263 100644 --- a/myauth/models.py +++ b/myauth/models.py @@ -74,7 +74,7 @@ class Tier(models.Model): class Team(models.Model): id: int - + name = models.CharField(max_length=200, default="") # Protect means you can't delete an owner, remove the team first! owner = models.OneToOneField(User, on_delete=models.PROTECT) tier = models.ForeignKey(Tier, on_delete=models.PROTECT) diff --git a/server/api/schemas.py b/server/api/schemas.py index cb60108a..a16a87f6 100644 --- a/server/api/schemas.py +++ b/server/api/schemas.py @@ -43,6 +43,7 @@ class UserProfileIn(Schema): class TeamSchema(Schema): id: int + name: str owner_id: int tier: TierSchema usage: int diff --git a/server/api/user.py b/server/api/user.py index d4ba989f..094ae61c 100644 --- a/server/api/user.py +++ b/server/api/user.py @@ -42,8 +42,9 @@ def create_user(request, payload: UserProfileIn): if payload.team_id is None: # Create a team for this user. All teams are on the basic plan until we have processed payment + # use the sign up name for default team name tier = Tier.objects.get(name__exact="COMMUNITY") - team = Team.objects.create(owner_id=user.id, tier_id=tier.id, usage=0) + team = Team.objects.create(owner_id=user.id, name=f"{payload.name}'s Team", tier_id=tier.id, usage=0) else: try: invite = Invite.objects.get(from_team=payload.team_id, uid=payload.invite_id, email=user.email) diff --git a/server/settings/base.py b/server/settings/base.py index 529fd653..2ca88d06 100644 --- a/server/settings/base.py +++ b/server/settings/base.py @@ -8,7 +8,7 @@ from decouple import config from django.core.exceptions import ImproperlyConfigured -VERSION = "store@1.6.0" +VERSION = "store@1.7.0" # Use this if you want to enforce an env var being set. If you want a default, just use decouple directly