Skip to content

Commit

Permalink
Add email in User model (#1062)
Browse files Browse the repository at this point in the history
  • Loading branch information
svetleo-evidently committed Apr 9, 2024
1 parent 1092751 commit eedd08a
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion requirements.min.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ nltk==3.6.7
scipy==1.10.0
requests==2.31.0
PyYAML==5.4
pydantic==1.10.14
pydantic==1.10.12
litestar==2.5.1
typing-inspect==0.9.0
uvicorn==0.22.0
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"scipy>=1.10.0",
"requests>=2.31.0",
"PyYAML>=5.4",
"pydantic>=1.10.14",
"pydantic>=1.10.12",
"litestar>=2.6.3",
"typing-inspect>=0.9.0",
"uvicorn>=0.22.0",
Expand Down
3 changes: 2 additions & 1 deletion src/evidently/ui/api/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ def from_team(cls, team: Team):
class UserModel(BaseModel):
id: UserID
name: str
email: str

@classmethod
def from_user(cls, user: User):
return TeamModel(id=user.id, name=user.name)
return UserModel(id=user.id, name=user.name, email=user.email)
5 changes: 3 additions & 2 deletions src/evidently/ui/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ class Team(BaseModel):
class User(BaseModel):
id: UserID = Field(default_factory=uuid.uuid4)
name: str
email: str = ""


def _default_dashboard():
Expand Down Expand Up @@ -406,10 +407,10 @@ def delete_team(self, user_id: UserID, team_id: TeamID):
self._delete_team(team_id)

@abstractmethod
def _list_team_users(self, team_id: TeamID) -> List[User]:
def _list_team_users(self, team_id: TeamID) -> List[UserID]:
raise NotImplementedError

def list_team_users(self, user_id: UserID, team_id: TeamID) -> List[User]:
def list_team_users(self, user_id: UserID, team_id: TeamID) -> List[UserID]:
if not self.check_team_permission(user_id, team_id, TeamPermission.READ):
raise TeamNotFound()
return self._list_team_users(team_id)
Expand Down
2 changes: 1 addition & 1 deletion src/evidently/ui/storage/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def _list_user_teams(self, user_id: UserID, include_virtual: bool) -> List[Team]
def _delete_team(self, team_id: TeamID):
pass

def _list_team_users(self, team_id: TeamID) -> List[User]:
def _list_team_users(self, team_id: TeamID) -> List[UserID]:
return []


Expand Down

0 comments on commit eedd08a

Please sign in to comment.