Skip to content

user_group

UserGroupCreate

Bases: BaseModel

Schema for UserGroup creation

ATTRIBUTE DESCRIPTION
name

Group name

TYPE: NonEmptyStr

Source code in fractal_server/app/schemas/user_group.py
40
41
42
43
44
45
46
47
48
49
50
class UserGroupCreate(BaseModel):
    """
    Schema for `UserGroup` creation

    Attributes:
        name: Group name
    """

    model_config = ConfigDict(extra="forbid")

    name: NonEmptyStr

UserGroupRead

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

Source code in fractal_server/app/schemas/user_group.py
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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()