Skip to content

User group

CLASS DESCRIPTION
UserGroupCreate

Schema for UserGroup creation

UserGroupRead

Schema for UserGroup read

Attributes

Classes

UserGroupCreate pydantic-model

Bases: BaseModel

Schema for UserGroup creation

ATTRIBUTE DESCRIPTION
name

Group name

TYPE: NonEmptyStr

Config:

  • extra: forbid

Fields:

Source code in fractal_server/app/schemas/user_group.py
class UserGroupCreate(BaseModel):
    """
    Schema for `UserGroup` creation

    Attributes:
        name: Group name
    """

    model_config = ConfigDict(extra="forbid")

    name: NonEmptyStr

UserGroupRead pydantic-model

Bases: BaseModel

Schema for UserGroup read

NOTE: user_ids does not correspond to a column of the UserGroup table, but it is rather computed dynamically in relevant endpoints.

ATTRIBUTE DESCRIPTION
id

Group ID

TYPE: int

name

Group name

TYPE: str

timestamp_created

Creation timestamp

TYPE: AwareDatetime

user_ids

IDs of users of this group

TYPE: list[int] | None

Fields:

Source code in fractal_server/app/schemas/user_group.py
class UserGroupRead(BaseModel):
    """
    Schema for `UserGroup` read

    NOTE: `user_ids` does not correspond to a column of the `UserGroup` table,
    but it is rather computed dynamically in relevant endpoints.

    Attributes:
        id: Group ID
        name: Group name
        timestamp_created: Creation timestamp
        user_ids: IDs of users of this group
    """

    id: int
    name: str
    timestamp_created: AwareDatetime
    user_ids: list[int] | None = None

    @field_serializer("timestamp_created")
    def serialize_datetime(v: datetime) -> str:
        return v.isoformat()