Skip to content

Commit 79b00f7

Browse files
committed
clean up and remove organization invitations
1 parent 19d7df4 commit 79b00f7

File tree

7 files changed

+8
-162
lines changed

7 files changed

+8
-162
lines changed

api/ee/databases/postgres/migrations/core/versions/59b85eb7516c_add_sso_oidc_tables.py

Lines changed: 1 addition & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -302,95 +302,7 @@ def upgrade() -> None:
302302
),
303303
)
304304

305-
# 4. organization_invitations table
306-
op.create_table(
307-
"organization_invitations",
308-
sa.Column(
309-
"id",
310-
sa.UUID(),
311-
nullable=False,
312-
),
313-
sa.Column(
314-
"organization_id",
315-
sa.UUID(),
316-
nullable=False,
317-
),
318-
sa.Column(
319-
"email",
320-
sa.String(),
321-
nullable=False,
322-
),
323-
sa.Column(
324-
"role",
325-
sa.String(),
326-
nullable=False,
327-
),
328-
sa.Column(
329-
"token",
330-
sa.String(),
331-
nullable=False,
332-
),
333-
sa.Column(
334-
"status",
335-
sa.String(),
336-
nullable=False,
337-
server_default="pending",
338-
),
339-
sa.Column(
340-
"expires_at",
341-
sa.TIMESTAMP(timezone=True),
342-
nullable=True,
343-
),
344-
sa.Column(
345-
"created_at",
346-
sa.TIMESTAMP(timezone=True),
347-
server_default=sa.text("CURRENT_TIMESTAMP"),
348-
nullable=False,
349-
),
350-
sa.Column(
351-
"updated_at",
352-
sa.TIMESTAMP(timezone=True),
353-
nullable=True,
354-
),
355-
sa.Column(
356-
"deleted_at",
357-
sa.TIMESTAMP(timezone=True),
358-
nullable=True,
359-
),
360-
sa.Column(
361-
"created_by_id",
362-
sa.UUID(),
363-
nullable=False,
364-
),
365-
sa.Column(
366-
"updated_by_id",
367-
sa.UUID(),
368-
nullable=True,
369-
),
370-
sa.Column(
371-
"deleted_by_id",
372-
sa.UUID(),
373-
nullable=True,
374-
),
375-
sa.PrimaryKeyConstraint("id"),
376-
sa.ForeignKeyConstraint(
377-
["organization_id"],
378-
["organizations.id"],
379-
ondelete="CASCADE",
380-
),
381-
sa.UniqueConstraint(
382-
"token",
383-
name="uq_organization_invitations_token",
384-
),
385-
sa.Index(
386-
"ix_organization_invitations_org_email_status",
387-
"organization_id",
388-
"email",
389-
"status",
390-
),
391-
)
392-
393-
# 5. Add is_active to users table
305+
# 4. Add is_active to users table
394306
op.add_column(
395307
"users",
396308
sa.Column(
@@ -406,12 +318,6 @@ def downgrade() -> None:
406318
# Drop in reverse order
407319
op.drop_column("users", "is_active")
408320

409-
op.drop_index(
410-
"ix_organization_invitations_org_email_status",
411-
table_name="organization_invitations",
412-
)
413-
op.drop_table("organization_invitations")
414-
415321
op.drop_index(
416322
"ix_organization_providers_flags",
417323
table_name="organization_providers",

api/ee/src/apis/fastapi/billing/router.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ async def handle_events(
263263
organization_id = metadata.get("organization_id")
264264

265265
log.info(
266-
"Stripe event: %s | %s | %s",
266+
"[billing] [stripe] %s | %s | %s",
267267
organization_id,
268268
stripe_event.type,
269269
target,

api/ee/src/core/subscriptions/service.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ async def process_event(
198198
**kwargs,
199199
) -> SubscriptionDTO:
200200
log.info(
201-
"Billing event: %s | %s | %s",
201+
"[billing] [internal] %s | %s | %s",
202202
organization_id,
203203
event,
204204
plan,

api/ee/src/dbs/postgres/organizations/dbes.py

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
from ee.src.dbs.postgres.organizations.dbas import (
99
OrganizationDomainDBA,
1010
OrganizationProviderDBA,
11-
OrganizationInvitationDBA,
1211
)
1312

1413

@@ -61,25 +60,3 @@ class OrganizationProviderDBE(Base, OrganizationProviderDBA):
6160
postgresql_using="gin",
6261
),
6362
)
64-
65-
66-
class OrganizationInvitationDBE(Base, OrganizationInvitationDBA):
67-
__tablename__ = "organization_invitations"
68-
69-
__table_args__ = (
70-
ForeignKeyConstraint(
71-
["organization_id"],
72-
["organizations.id"],
73-
ondelete="CASCADE",
74-
),
75-
UniqueConstraint(
76-
"token",
77-
name="uq_organization_invitations_token",
78-
),
79-
Index(
80-
"ix_organization_invitations_org_email_status",
81-
"organization_id",
82-
"email",
83-
"status",
84-
),
85-
)

api/ee/src/services/commoners.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@
2020
user_exists,
2121
)
2222
from ee.src.models.api.organization_models import CreateOrganization
23-
from oss.src.services.user_service import create_new_user, check_user_exists, delete_user
23+
from oss.src.services.user_service import (
24+
create_new_user,
25+
check_user_exists,
26+
delete_user,
27+
)
2428
from oss.src.models.db_models import UserDB, OrganizationDB
2529
from ee.src.services.email_helper import (
2630
add_contact_to_loops,
@@ -135,8 +139,6 @@ async def create_accounts(
135139

136140
user = await db_manager.get_user_with_email(email=user_dict["email"])
137141
if user is None:
138-
log.info("[scopes] Yey! A new user is signing up!")
139-
140142
# Check if user exists before attempting creation
141143
user_existed_before = await check_user_exists(user_dict["email"])
142144

api/ee/src/services/db_manager_ee.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1323,22 +1323,6 @@ async def get_workspace_details(workspace: WorkspaceDB) -> WorkspaceResponse:
13231323
raise e
13241324

13251325

1326-
async def get_organization_invitations(organization_id: str):
1327-
"""
1328-
Gets the organization invitations.
1329-
1330-
Args:
1331-
organization_id (str): The ID of the organization
1332-
"""
1333-
1334-
async with engine.core_session() as session:
1335-
result = await session.execute(
1336-
select(InvitationDB).filter_by(organization_id=organization_id)
1337-
)
1338-
invitations = result.scalars().all()
1339-
return invitations
1340-
1341-
13421326
async def get_project_invitations(project_id: str, **kwargs):
13431327
"""
13441328
Gets the project invitations.

api/oss/src/dbs/postgres/organizations/dbes.py

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
from oss.src.dbs.postgres.organizations.dbas import (
99
OrganizationDomainDBA,
1010
OrganizationProviderDBA,
11-
OrganizationInvitationDBA,
1211
)
1312

1413

@@ -61,25 +60,3 @@ class OrganizationProviderDBE(Base, OrganizationProviderDBA):
6160
postgresql_using="gin",
6261
),
6362
)
64-
65-
66-
class OrganizationInvitationDBE(Base, OrganizationInvitationDBA):
67-
__tablename__ = "organization_invitations"
68-
69-
__table_args__ = (
70-
ForeignKeyConstraint(
71-
["organization_id"],
72-
["organizations.id"],
73-
ondelete="CASCADE",
74-
),
75-
UniqueConstraint(
76-
"token",
77-
name="uq_organization_invitations_token",
78-
),
79-
Index(
80-
"ix_organization_invitations_org_email_status",
81-
"organization_id",
82-
"email",
83-
"status",
84-
),
85-
)

0 commit comments

Comments
 (0)