Skip to content

Commit 325892f

Browse files
committed
type alias
1 parent 1588e21 commit 325892f

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

packages/models-library/src/models_library/api_schemas_webserver/users.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
from ..basic_types import IDStr
2626
from ..emails import LowerCaseEmailStr
27-
from ..groups import AccessRightsDict, Group, GroupID, GroupsByTypeTuple
27+
from ..groups import AccessRightsDict, Group, GroupID, GroupsByTypeTuple, PrimaryGroupID
2828
from ..products import ProductName
2929
from ..rest_base import RequestParameters
3030
from ..users import (
@@ -399,8 +399,10 @@ class UserAccountGet(OutputSchema):
399399
Field(description="Username of the user if an account was created"),
400400
]
401401
user_primary_group_id: Annotated[
402-
GroupID | None,
403-
Field(description="Primary group ID of the user if an account was created"),
402+
PrimaryGroupID | None,
403+
Field(
404+
description="Primary group ID of the user if an account was created", gt=2
405+
),
404406
]
405407

406408
@field_validator("status")

packages/models-library/src/models_library/groups.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@
1515
EVERYONE_GROUP_ID: Final[int] = 1
1616

1717
GroupID: TypeAlias = PositiveInt
18+
PrimaryGroupID: TypeAlias = Annotated[GroupID, Field(gt=2)]
19+
StandardGroupID: TypeAlias = Annotated[GroupID, Field(gt=2)]
1820

1921
__all__: tuple[str, ...] = ("GroupType",)
2022

2123

2224
class Group(BaseModel):
23-
gid: PositiveInt
25+
gid: GroupID
2426
name: str
2527
description: str
2628
group_type: Annotated[GroupType, Field(alias="type")]

0 commit comments

Comments
 (0)