Skip to content

Commit

Permalink
Merge pull request #835 from devgenix/oss-organization_refactor
Browse files Browse the repository at this point in the history
Added User to Pydantic Converter
  • Loading branch information
mmabrouk authored Nov 1, 2023
2 parents 7bc6f4f + aa229f5 commit f2c2cc7
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions agenta-backend/agenta_backend/models/converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""
from typing import List
from agenta_backend.services import db_manager
from agenta_backend.models.api.user_models import User
from agenta_backend.models.db_models import (
AppVariantDB,
ImageDB,
Expand All @@ -15,6 +16,7 @@
EvaluationDB,
EvaluationScenarioDB,
VariantBaseDB,
UserDB,
)
from agenta_backend.models.api.api_models import (
AppVariant,
Expand Down Expand Up @@ -276,3 +278,12 @@ def trace_db_to_pydantic(trace_db: TraceDB) -> Trace:
feedbacks=result,
spans=[str(span) for span in trace_db.spans],
).dict(exclude_unset=True)


def user_db_to_pydantic(user_db: UserDB) -> User:
return User(
id=str(user_db.id),
uid=user_db.uid,
username=user_db.username,
email=user_db.email,
).dict(exclude_unset=True)

0 comments on commit f2c2cc7

Please sign in to comment.