feat: marketplaces endpoints

This commit is contained in:
2025-10-13 12:48:06 +04:00
parent d8eba188c9
commit 35869e2ea5
16 changed files with 441 additions and 10 deletions

View File

@ -14,3 +14,4 @@ from .deal_product import (
from .deal_service import DealService as DealService
from .product import Product as Product
from .service import Service as Service, ServiceCategory as ServiceCategory
from .marketplace import BaseMarketplace as BaseMarketplace, Marketplace as Marketplace

View File

@ -0,0 +1,32 @@
from typing import TYPE_CHECKING
from sqlalchemy import ForeignKey, JSON
from sqlalchemy.orm import Mapped, mapped_column, relationship
from models.base import BaseModel
from models.mixins import IdMixin, SoftDeleteMixin
if TYPE_CHECKING:
from modules.clients.models import Client
class BaseMarketplace(BaseModel, IdMixin):
__tablename__ = "fulfillment_base_base_marketplaces"
name: Mapped[str] = mapped_column()
icon_url: Mapped[str] = mapped_column()
class Marketplace(BaseModel, IdMixin, SoftDeleteMixin):
__tablename__ = "fulfillment_base_marketplaces"
base_marketplace_id: Mapped[str] = mapped_column(
ForeignKey("fulfillment_base_base_marketplaces.id")
)
base_marketplace: Mapped["BaseMarketplace"] = relationship(lazy="joined")
client_id: Mapped[int] = mapped_column(ForeignKey("clients.id"))
client: Mapped["Client"] = relationship()
name: Mapped[str] = mapped_column()
auth_data: Mapped[dict] = mapped_column(type_=JSON)