Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /MTSWebServices_syncmaster /syncmaster /schemas /v1 /users.py
| # SPDX-FileCopyrightText: 2023-present MTS PJSC | |
| # SPDX-License-Identifier: Apache-2.0 | |
| from pydantic import BaseModel, ConfigDict | |
| from syncmaster.db.models import GroupMemberRole | |
| from syncmaster.db.utils import Pagination | |
| from syncmaster.schemas.v1.page import MetaPageSchema, PageSchema | |
| class ReadGroupMember(BaseModel): | |
| id: int | |
| username: str | |
| role: GroupMemberRole | |
| model_config = ConfigDict(from_attributes=True) | |
| class ReadUserSchema(BaseModel): | |
| id: int | |
| username: str | |
| is_superuser: bool | |
| model_config = ConfigDict(from_attributes=True) | |
| class FullUserSchema(ReadGroupMember): | |
| is_active: bool | |
| class UserPageSchemaAsGroupMember(PageSchema): | |
| items: list[ReadGroupMember] | |
| def from_pagination(cls, pagination: Pagination): | |
| return cls( | |
| meta=MetaPageSchema( | |
| page=pagination.page, | |
| pages=pagination.pages, | |
| page_size=pagination.page_size, | |
| total=pagination.total, | |
| has_next=pagination.has_next, | |
| has_previous=pagination.has_previous, | |
| next_page=pagination.next_page, | |
| previous_page=pagination.previous_page, | |
| ), | |
| items=[ | |
| ReadGroupMember( | |
| id=user.id, | |
| username=user.username, | |
| role=role, | |
| ) | |
| for user, role in pagination.items | |
| ], | |
| ) | |
| class UserPageSchema(PageSchema): | |
| items: list[ReadUserSchema] | |
| def from_pagination(cls, pagination: Pagination): | |
| return cls( | |
| meta=MetaPageSchema( | |
| page=pagination.page, | |
| pages=pagination.pages, | |
| page_size=pagination.page_size, | |
| total=pagination.total, | |
| has_next=pagination.has_next, | |
| has_previous=pagination.has_previous, | |
| next_page=pagination.next_page, | |
| previous_page=pagination.previous_page, | |
| ), | |
| items=pagination.items, | |
| ) | |
Xet Storage Details
- Size:
- 2.11 kB
- Xet hash:
- eb1da6bbb693876067741b842b5ce7dfac19c60b0201219ed9960c4e9e140479
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.