Skip to content

Commit

Permalink
One more auth cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
majdyz committed Oct 23, 2024
1 parent 4745a9c commit b5636ff
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
24 changes: 11 additions & 13 deletions autogpt_platform/backend/backend/data/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,17 @@ async def get_user_by_id(user_id: str) -> Optional[User]:
return User.model_validate(user) if user else None


async def create_default_user(enable_auth: bool) -> Optional[User]:
if enable_auth:
user = await prisma.user.find_unique(where={"id": DEFAULT_USER_ID})
if not user:
user = await prisma.user.create(
data={
"id": DEFAULT_USER_ID,
"email": "[email protected]",
"name": "Default User",
}
)
return User.model_validate(user)
return None
async def create_default_user() -> Optional[User]:
user = await prisma.user.find_unique(where={"id": DEFAULT_USER_ID})
if not user:
user = await prisma.user.create(
data={
"id": DEFAULT_USER_ID,
"email": "[email protected]",
"name": "Default User",
}
)
return User.model_validate(user)


async def get_user_metadata(user_id: str) -> UserMetadataRaw:
Expand Down
2 changes: 1 addition & 1 deletion autogpt_platform/backend/backend/util/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ async def __aenter__(self):

await db.connect()
await initialize_blocks()
await create_default_user(False)
await create_default_user()

return self

Expand Down

0 comments on commit b5636ff

Please sign in to comment.