Spaces:
Paused

File size: 949 Bytes
5eb4857
 
 
 
 
 
4405ca9
5eb4857
 
 
 
 
 
 
 
 
 
 
 
 
b7980f7
5eb4857
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
"""
Workspace model — multi-customer isolation.
Each customer organization gets a separate workspace.
"""

from sqlalchemy import Column, String
from sqlalchemy.dialects.postgresql import JSONB
from sqlalchemy.orm import relationship
from core.database import Base
from models.base import PrimaryKeyMixin, TimestampMixin, SoftDeleteMixin


class Workspace(Base, PrimaryKeyMixin, TimestampMixin, SoftDeleteMixin):
    __tablename__ = "workspaces"

    name = Column(String(255), nullable=False)
    branding = Column(JSONB, default={}, doc="Logo URL, primary/secondary colors")

    # Relationships
    users = relationship("User", back_populates="workspace", lazy="selectin")
    user_links = relationship("UserWorkspace", back_populates="workspace", cascade="all, delete-orphan")
    tickets = relationship("Ticket", back_populates="workspace", lazy="selectin")
    projects = relationship("Project", back_populates="workspace", lazy="selectin")