mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
feat: init payments config backend & dash frontend
This commit is contained in:
parent
96e453a4de
commit
deba63cc15
15 changed files with 774 additions and 14 deletions
|
|
@ -30,7 +30,7 @@ class CollectionUpdate(CollectionBase):
|
|||
courses: Optional[list]
|
||||
name: Optional[str]
|
||||
public: Optional[bool]
|
||||
description: Optional[str]
|
||||
description: Optional[str] = ""
|
||||
|
||||
|
||||
class CollectionRead(CollectionBase):
|
||||
|
|
|
|||
49
apps/api/src/db/payments/payments.py
Normal file
49
apps/api/src/db/payments/payments.py
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
from datetime import datetime
|
||||
from enum import Enum
|
||||
from typing import Literal, Optional
|
||||
from pydantic import BaseModel
|
||||
from sqlalchemy import JSON
|
||||
from sqlmodel import Field, SQLModel, Column, BigInteger, ForeignKey
|
||||
|
||||
|
||||
class StripeProviderConfig(BaseModel):
|
||||
stripe_key: str = ""
|
||||
stripe_secret_key: str = ""
|
||||
stripe_webhook_secret: str = ""
|
||||
|
||||
class PaymentProviderEnum(str, Enum):
|
||||
STRIPE = "stripe"
|
||||
|
||||
class PaymentsConfigBase(SQLModel):
|
||||
enabled: bool = False
|
||||
provider: PaymentProviderEnum = PaymentProviderEnum.STRIPE
|
||||
provider_config: dict = Field(default={}, sa_column=Column(JSON))
|
||||
|
||||
|
||||
class PaymentsConfig(PaymentsConfigBase, table=True):
|
||||
id: Optional[int] = Field(default=None, primary_key=True)
|
||||
org_id: int = Field(
|
||||
sa_column=Column(BigInteger, ForeignKey("organization.id", ondelete="CASCADE"))
|
||||
)
|
||||
creation_date: datetime = Field(default=datetime.now())
|
||||
update_date: datetime = Field(default=datetime.now())
|
||||
|
||||
|
||||
class PaymentsConfigCreate(PaymentsConfigBase):
|
||||
pass
|
||||
|
||||
|
||||
class PaymentsConfigUpdate(PaymentsConfigBase):
|
||||
enabled: Optional[bool] = False
|
||||
provider_config: Optional[dict] = None
|
||||
|
||||
|
||||
class PaymentsConfigRead(PaymentsConfigBase):
|
||||
id: int
|
||||
org_id: int
|
||||
creation_date: datetime
|
||||
update_date: datetime
|
||||
|
||||
|
||||
class PaymentsConfigDelete(SQLModel):
|
||||
id: int
|
||||
Loading…
Add table
Add a link
Reference in a new issue