28 lines
999 B
Python
28 lines
999 B
Python
import uuid
|
|
from pydantic import BaseModel, Field
|
|
|
|
from domains.groups.models import GroupType, GroupMemberRole
|
|
|
|
class GroupCreate(BaseModel):
|
|
name: str = Field(..., max_length=50, description='name of the group')
|
|
|
|
class GroupResponse(BaseModel):
|
|
id: uuid.UUID = Field(...)
|
|
name: str = Field(..., max_length=50, description='name of the group')
|
|
type: GroupType = Field(..., description='type of the group')
|
|
is_active: bool = Field(..., description='is active')
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
class AddMemberRequest(BaseModel):
|
|
username: str = Field(..., max_length=20, description='username of the user')
|
|
|
|
class GroupMemberResponse(BaseModel):
|
|
user_id: uuid.UUID = Field(...)
|
|
username: str = Field(..., max_length=20, description='username of the user')
|
|
role: GroupMemberRole = Field(..., description='role of the user in the group')
|
|
is_online: bool = Field(False, description='is online')
|
|
|
|
class Config:
|
|
from_attributes = True |