feat: add payments feature access based on config

This commit is contained in:
swve 2024-11-25 23:56:08 +01:00
parent 5a746a946d
commit 546e8a5f98
19 changed files with 98 additions and 43 deletions

View file

@ -40,7 +40,6 @@ class AssignmentOrgConfig(BaseModel):
class PaymentOrgConfig(BaseModel):
enabled: bool = True
stripe_key: str = ""
class DiscussionOrgConfig(BaseModel):
@ -91,7 +90,7 @@ class OrgCloudConfig(BaseModel):
# Main Config
class OrganizationConfigBase(BaseModel):
config_version: str = "1.1"
config_version: str = "1.2"
general: OrgGeneralConfig
features: OrgFeatureConfig
cloud: OrgCloudConfig

View file

@ -330,7 +330,7 @@ def install_create_organization(org_object: OrganizationCreate, db_session: Sess
# Org Config
org_config = OrganizationConfigBase(
config_version="1.1",
config_version="1.2",
general=OrgGeneralConfig(
enabled=True,
color="normal",
@ -345,7 +345,7 @@ def install_create_organization(org_object: OrganizationCreate, db_session: Sess
storage=StorageOrgConfig(enabled=True, limit=0),
ai=AIOrgConfig(enabled=True, limit=0, model="gpt-4o-mini"),
assignments=AssignmentOrgConfig(enabled=True, limit=0),
payments=PaymentOrgConfig(enabled=True, stripe_key=""),
payments=PaymentOrgConfig(enabled=False),
discussions=DiscussionOrgConfig(enabled=True, limit=0),
analytics=AnalyticsOrgConfig(enabled=True, limit=0),
collaboration=CollaborationOrgConfig(enabled=True, limit=0),

View file

@ -8,7 +8,7 @@ from src.services.install.install import (
install_default_elements,
)
# TODO: Depreceated and need to be removed and remade
async def create_initial_data_for_tests(db_session: Session):
# Install default elements
await install_default_elements({}, db_session)